idx
int32 46
1.86M
| input
stringlengths 321
6.6k
| target
stringlengths 9
1.24k
|
|---|---|---|
285,398
|
public void read(org.apache.thrift.protocol.TProtocol prot, continueScan_result struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;<NEW_LINE>java.util.BitSet incoming = iprot.readBitSet(5);<NEW_LINE>if (incoming.get(0)) {<NEW_LINE>struct.success = new org.apache.accumulo.core.dataImpl.thrift.ScanResult();<NEW_LINE>struct.success.read(iprot);<NEW_LINE>struct.setSuccessIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(1)) {<NEW_LINE>struct.nssi = new NoSuchScanIDException();<NEW_LINE>struct.nssi.read(iprot);<NEW_LINE>struct.setNssiIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(2)) {<NEW_LINE>struct.nste = new NotServingTabletException();<NEW_LINE><MASK><NEW_LINE>struct.setNsteIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(3)) {<NEW_LINE>struct.tmfe = new TooManyFilesException();<NEW_LINE>struct.tmfe.read(iprot);<NEW_LINE>struct.setTmfeIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(4)) {<NEW_LINE>struct.tsnpe = new TSampleNotPresentException();<NEW_LINE>struct.tsnpe.read(iprot);<NEW_LINE>struct.setTsnpeIsSet(true);<NEW_LINE>}<NEW_LINE>}
|
struct.nste.read(iprot);
|
1,598,866
|
protected boolean copyFile(IFileStore sourceStore, IFileStore sourceRoot, IFileStore destinationRoot, IProgressMonitor monitor) {<NEW_LINE>if (sourceStore == null || CloakingUtils.isFileCloaked(sourceStore)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>boolean success = true;<NEW_LINE>IFileStore[] sourceStores = null, targetStores = null;<NEW_LINE>try {<NEW_LINE>if (sourceStore.equals(sourceRoot)) {<NEW_LINE>// copying the whole source<NEW_LINE>sourceStores = sourceRoot.childStores(EFS.NONE, monitor);<NEW_LINE>targetStores = new IFileStore[sourceStores.length];<NEW_LINE>for (int i = 0; i < targetStores.length; ++i) {<NEW_LINE>targetStores[i] = destinationRoot.getChild(sourceStores[i].getName());<NEW_LINE>}<NEW_LINE>} else if (sourceRoot.isParentOf(sourceStore)) {<NEW_LINE>// finds the relative path of the file to be copied and maps to<NEW_LINE>// the destination target<NEW_LINE>sourceStores = new IFileStore[1];<NEW_LINE>sourceStores[0] = sourceStore;<NEW_LINE>targetStores = new IFileStore[1];<NEW_LINE>String sourceRootPath = sourceRoot.toString();<NEW_LINE>String sourcePath = sourceStore.toString();<NEW_LINE>int index = sourcePath.indexOf(sourceRootPath);<NEW_LINE>if (index > -1) {<NEW_LINE>String relativePath = sourcePath.substring(index + sourceRootPath.length());<NEW_LINE>targetStores[0] = destinationRoot.getFileStore(new Path(relativePath));<NEW_LINE>// makes sure the parent folder is created on the<NEW_LINE>// destination side<NEW_LINE>IFileStore parent <MASK><NEW_LINE>if (parent != targetStores[0]) {<NEW_LINE>parent.mkdir(EFS.NONE, monitor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (sourceStores == null) {<NEW_LINE>// the file to be copied is not a child of the source root;<NEW_LINE>// cannot copy<NEW_LINE>success = false;<NEW_LINE>sourceStores = new IFileStore[0];<NEW_LINE>targetStores = new IFileStore[0];<NEW_LINE>}<NEW_LINE>for (int i = 0; i < sourceStores.length; ++i) {<NEW_LINE>success = copyFile(sourceStores[i], targetStores[i], monitor) && success;<NEW_LINE>}<NEW_LINE>} catch (CoreException e) {<NEW_LINE>IdeLog.logError(IOUIPlugin.getDefault(), MessageFormat.format(Messages.CopyFilesOperation_ERR_FailedToCopyToDest, sourceStore, destinationRoot), e);<NEW_LINE>success = false;<NEW_LINE>}<NEW_LINE>return success;<NEW_LINE>}
|
= getFolderStore(targetStores[0]);
|
1,318,365
|
public // ignored by this CTR mode<NEW_LINE>void // ignored by this CTR mode<NEW_LINE>init(boolean encrypting, CipherParameters params) throws IllegalArgumentException {<NEW_LINE>if (params instanceof ParametersWithIV) {<NEW_LINE>ParametersWithIV ivParam = (ParametersWithIV) params;<NEW_LINE>initArrays();<NEW_LINE>IV = Arrays.clone(ivParam.getIV());<NEW_LINE>if (IV.length != blockSize / 2) {<NEW_LINE>throw new IllegalArgumentException("Parameter IV length must be == blockSize/2");<NEW_LINE>}<NEW_LINE>System.arraycopy(IV, 0, CTR, 0, IV.length);<NEW_LINE>for (int i = IV.length; i < blockSize; i++) {<NEW_LINE>CTR[i] = 0;<NEW_LINE>}<NEW_LINE>// if null it's an IV changed only.<NEW_LINE>if (ivParam.getParameters() != null) {<NEW_LINE>cipher.init(<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>initArrays();<NEW_LINE>// if it's null, key is to be reused.<NEW_LINE>if (params != null) {<NEW_LINE>cipher.init(true, params);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>initialized = true;<NEW_LINE>}
|
true, ivParam.getParameters());
|
775,306
|
private static CallbackHandlerConfiguration createCallbackHandlerConfiguration(Binding b, boolean client) {<NEW_LINE>WSDLModel model = b.getModel();<NEW_LINE>Policy p = PolicyModelHelper.getPolicyForElement(b);<NEW_LINE>CallbackHandlerConfiguration chc = (CallbackHandlerConfiguration) PolicyModelHelper.getTopLevelElement(<MASK><NEW_LINE>if (chc == null) {<NEW_LINE>boolean isTransaction = model.isIntransaction();<NEW_LINE>if (!isTransaction) {<NEW_LINE>model.startTransaction();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>WSDLComponentFactory wcf = model.getFactory();<NEW_LINE>ConfigVersion cfgVersion = PolicyModelHelper.getConfigVersion(b);<NEW_LINE>PolicyModelHelper pmh = PolicyModelHelper.getInstance(cfgVersion);<NEW_LINE>All all = pmh.createPolicy(b, !client);<NEW_LINE>if (client) {<NEW_LINE>chc = (CallbackHandlerConfiguration) wcf.create(all, ProprietarySecurityPolicyQName.CALLBACKHANDLERCONFIGURATION.getQName());<NEW_LINE>} else {<NEW_LINE>chc = (CallbackHandlerConfiguration) wcf.create(all, ProprietarySecurityPolicyServiceQName.CALLBACKHANDLERCONFIGURATION.getQName());<NEW_LINE>}<NEW_LINE>all.addExtensibilityElement(chc);<NEW_LINE>chc.setVisibility(ProprietaryPolicyQName.INVISIBLE);<NEW_LINE>} finally {<NEW_LINE>if (!isTransaction) {<NEW_LINE>model.endTransaction();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return chc;<NEW_LINE>}
|
p, CallbackHandlerConfiguration.class, false);
|
866,356
|
public RestMethodResult doPatch(final List<Map<String, Object>> propertySets) throws FrameworkException {<NEW_LINE>final RestMethodResult result = new RestMethodResult(HttpServletResponse.SC_OK);<NEW_LINE>final App app = StructrApp.getInstance(securityContext);<NEW_LINE>final Iterator<Map<String, Object>> iterator = propertySets.iterator();<NEW_LINE>final int batchSize = intOrDefault(RequestKeywords.BatchSize.keyword(), 1000);<NEW_LINE>int overallCount = 0;<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>try (final Tx tx = app.tx()) {<NEW_LINE>int count = 0;<NEW_LINE>while (iterator.hasNext() && count++ < batchSize) {<NEW_LINE>final Map<String, Object> propertySet = iterator.next();<NEW_LINE>Class localType = entityClass;<NEW_LINE>overallCount++;<NEW_LINE>// determine type of object<NEW_LINE>final Object typeSource = propertySet.get("type");<NEW_LINE>if (typeSource != null && typeSource instanceof String) {<NEW_LINE>final String typeString = (String) typeSource;<NEW_LINE>Class type = SchemaHelper.getEntityClassForRawType(typeString);<NEW_LINE>if (type != null) {<NEW_LINE>localType = type;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// virtual type?<NEW_LINE>if (virtualType != null) {<NEW_LINE>virtualType.transformInput(securityContext, localType, propertySet);<NEW_LINE>}<NEW_LINE>// find object by id, apply PATCH<NEW_LINE>final Object <MASK><NEW_LINE>if (idSource != null) {<NEW_LINE>if (idSource instanceof String) {<NEW_LINE>final String id = (String) idSource;<NEW_LINE>final GraphObject obj = app.get(localType, id);<NEW_LINE>if (obj != null) {<NEW_LINE>// test<NEW_LINE>localType = obj.getClass();<NEW_LINE>propertySet.remove("id");<NEW_LINE>final PropertyMap data = PropertyMap.inputTypeToJavaType(securityContext, localType, propertySet);<NEW_LINE>obj.setProperties(securityContext, data);<NEW_LINE>} else {<NEW_LINE>throw new NotFoundException("Object with ID " + id + " not found.");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new FrameworkException(422, "Invalid PATCH input, object id must be of type string.");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>createNode(propertySet);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.info("Committing PATCH transaction batch, {} objects processed.", overallCount);<NEW_LINE>tx.success();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}
|
idSource = propertySet.get("id");
|
550,609
|
public List<SelectionRange> selectionRange(SelectionRangeParams params, IProgressMonitor monitor) {<NEW_LINE>if (params.getPositions() == null || params.getPositions().isEmpty()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>ITypeRoot root = JDTUtils.resolveTypeRoot(params.getTextDocument().getUri());<NEW_LINE>if (root == null) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>CompilationUnit ast = CoreASTProvider.getInstance().getAST(root, CoreASTProvider.WAIT_YES, monitor);<NEW_LINE>// extra logic to check within the line comments and block comments, which are not parts of the AST<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>List<Comment> comments = new ArrayList<Comment>(ast.getCommentList());<NEW_LINE>comments.removeIf(comment -> {<NEW_LINE>// Javadoc nodes are already in the AST<NEW_LINE>return (comment instanceof Javadoc);<NEW_LINE>});<NEW_LINE>List<SelectionRange> $ = new ArrayList<>();<NEW_LINE>for (Position pos : params.getPositions()) {<NEW_LINE>try {<NEW_LINE>int offset = JsonRpcHelpers.toOffset(root.getBuffer(), pos.getLine(), pos.getCharacter());<NEW_LINE>ASTNode node = NodeFinder.perform(ast, offset, 0);<NEW_LINE>if (node == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// find all the ancestors<NEW_LINE>List<ASTNode> nodes = new ArrayList<>();<NEW_LINE>while (node != null) {<NEW_LINE>nodes.add(node);<NEW_LINE>node = node.getParent();<NEW_LINE>}<NEW_LINE>// find all the ranges corresponding to the parent nodes<NEW_LINE>SelectionRange selectionRange = null;<NEW_LINE>ListIterator<ASTNode> iterator = nodes.<MASK><NEW_LINE>while (iterator.hasPrevious()) {<NEW_LINE>node = iterator.previous();<NEW_LINE>Range range = JDTUtils.toRange(root, node.getStartPosition(), node.getLength());<NEW_LINE>selectionRange = new SelectionRange(range, selectionRange);<NEW_LINE>}<NEW_LINE>// find in comments<NEW_LINE>ASTNode containingComment = containingComment(comments, offset);<NEW_LINE>if (containingComment != null) {<NEW_LINE>Range range = JDTUtils.toRange(root, containingComment.getStartPosition(), containingComment.getLength());<NEW_LINE>selectionRange = new SelectionRange(range, selectionRange);<NEW_LINE>}<NEW_LINE>if (selectionRange != null) {<NEW_LINE>$.add(selectionRange);<NEW_LINE>}<NEW_LINE>} catch (JavaModelException e) {<NEW_LINE>JavaLanguageServerPlugin.logException("Failed to calculate selection range", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return $;<NEW_LINE>}
|
listIterator(nodes.size());
|
228,134
|
public void putInt(long t, int v) {<NEW_LINE>if (writeCurArrayIndex == capacity) {<NEW_LINE>if (capacity >= CAPACITY_THRESHOLD) {<NEW_LINE>timeRet.add(new long[capacity]);<NEW_LINE>intRet.add(new int[capacity]);<NEW_LINE>writeCurListIndex++;<NEW_LINE>writeCurArrayIndex = 0;<NEW_LINE>} else {<NEW_LINE>int newCapacity = capacity << 1;<NEW_LINE>long[<MASK><NEW_LINE>int[] newValueData = new int[newCapacity];<NEW_LINE>System.arraycopy(timeRet.get(0), 0, newTimeData, 0, capacity);<NEW_LINE>System.arraycopy(intRet.get(0), 0, newValueData, 0, capacity);<NEW_LINE>timeRet.set(0, newTimeData);<NEW_LINE>intRet.set(0, newValueData);<NEW_LINE>capacity = newCapacity;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>timeRet.get(writeCurListIndex)[writeCurArrayIndex] = t;<NEW_LINE>intRet.get(writeCurListIndex)[writeCurArrayIndex] = v;<NEW_LINE>writeCurArrayIndex++;<NEW_LINE>count++;<NEW_LINE>}
|
] newTimeData = new long[newCapacity];
|
1,775,320
|
public Request<ChangeMessageVisibilityRequest> marshall(ChangeMessageVisibilityRequest changeMessageVisibilityRequest) {<NEW_LINE>if (changeMessageVisibilityRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<ChangeMessageVisibilityRequest> request = new DefaultRequest<ChangeMessageVisibilityRequest>(changeMessageVisibilityRequest, "AmazonSQS");<NEW_LINE>request.addParameter("Action", "ChangeMessageVisibility");<NEW_LINE>request.addParameter("Version", "2012-11-05");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>if (changeMessageVisibilityRequest.getQueueUrl() != null) {<NEW_LINE>request.addParameter("QueueUrl", StringUtils.fromString(changeMessageVisibilityRequest.getQueueUrl()));<NEW_LINE>}<NEW_LINE>if (changeMessageVisibilityRequest.getReceiptHandle() != null) {<NEW_LINE>request.addParameter("ReceiptHandle", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>if (changeMessageVisibilityRequest.getVisibilityTimeout() != null) {<NEW_LINE>request.addParameter("VisibilityTimeout", StringUtils.fromInteger(changeMessageVisibilityRequest.getVisibilityTimeout()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>}
|
(changeMessageVisibilityRequest.getReceiptHandle()));
|
1,612,267
|
protected JavaType _narrow(Class<?> subclass) {<NEW_LINE>if (_class == subclass) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>// Should we check that there is a sub-class relationship?<NEW_LINE>// 15-Jan-2016, tatu: Almost yes, but there are some complications with<NEW_LINE>// placeholder values (`Void`, `NoClass`), so cannot quite do yet.<NEW_LINE>// TODO: fix in 2.9<NEW_LINE>if (!_class.isAssignableFrom(subclass)) {<NEW_LINE>return new SimpleType(subclass, _bindings, this, _superInterfaces, _valueHandler, _typeHandler, _asStatic);<NEW_LINE>}<NEW_LINE>// Otherwise, stitch together the hierarchy. First, super-class<NEW_LINE>Class<?> next = subclass.getSuperclass();<NEW_LINE>if (next == _class) {<NEW_LINE>// straight up parent class? Great.<NEW_LINE>return new SimpleType(subclass, _bindings, this, _superInterfaces, _valueHandler, _typeHandler, _asStatic);<NEW_LINE>}<NEW_LINE>if ((next != null) && _class.isAssignableFrom(next)) {<NEW_LINE>JavaType superb = _narrow(next);<NEW_LINE>return new SimpleType(subclass, _bindings, superb, null, _valueHandler, _typeHandler, _asStatic);<NEW_LINE>}<NEW_LINE>// if not found, try a super-interface<NEW_LINE>Class<?>[] nextI = subclass.getInterfaces();<NEW_LINE>for (Class<?> iface : nextI) {<NEW_LINE>if (iface == _class) {<NEW_LINE>// directly implemented<NEW_LINE>return new SimpleType(subclass, _bindings, null, new JavaType[] { this }, _valueHandler, _typeHandler, _asStatic);<NEW_LINE>}<NEW_LINE>if (_class.isAssignableFrom(iface)) {<NEW_LINE>// indirect, so recurse<NEW_LINE>JavaType superb = _narrow(iface);<NEW_LINE>return new SimpleType(subclass, _bindings, null, new JavaType[] { superb }, _valueHandler, _typeHandler, _asStatic);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// should not get here but...<NEW_LINE>throw new IllegalArgumentException("Internal error: Cannot resolve sub-type for Class " + subclass.getName() + <MASK><NEW_LINE>}
|
" to " + _class.getName());
|
1,216,575
|
public static int binarySearch(long[] array, int startIndex, int endIndex, long value) {<NEW_LINE>checkIndexForBinarySearch(array.length, startIndex, endIndex);<NEW_LINE>int low = startIndex, mid = -1, high = endIndex - 1;<NEW_LINE>while (low <= high) {<NEW_LINE>mid = (low + high) >>> 1;<NEW_LINE>if (value > array[mid]) {<NEW_LINE>low = mid + 1;<NEW_LINE>} else if (value == array[mid]) {<NEW_LINE>return mid;<NEW_LINE>} else {<NEW_LINE>high = mid - 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (mid < 0) {<NEW_LINE>int insertPoint = endIndex;<NEW_LINE>for (int index = startIndex; index < endIndex; index++) {<NEW_LINE>if (value < array[index]) {<NEW_LINE>insertPoint = index;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return -insertPoint - 1;<NEW_LINE>}<NEW_LINE>return -mid - (value < array<MASK><NEW_LINE>}
|
[mid] ? 1 : 2);
|
839,882
|
public AirbyteConnectionStatus checkStorageIamPermissions(JsonNode config) {<NEW_LINE>final JsonNode loadingMethod = config.get(BigQueryConsts.LOADING_METHOD);<NEW_LINE>final String bucketName = loadingMethod.get(BigQueryConsts.GCS_BUCKET_NAME).asText();<NEW_LINE>try {<NEW_LINE>ServiceAccountCredentials credentials = getServiceAccountCredentials(config);<NEW_LINE>Storage storage = StorageOptions.newBuilder().setProjectId(config.get(BigQueryConsts.CONFIG_PROJECT_ID).asText()).setCredentials(!isNull(credentials) ? credentials : ServiceAccountCredentials.getApplicationDefault()).build().getService();<NEW_LINE>List<Boolean> permissionsCheckStatusList = storage.testIamPermissions(bucketName, REQUIRED_PERMISSIONS);<NEW_LINE>List<String> missingPermissions = StreamUtils.zipWithIndex(permissionsCheckStatusList.stream()).filter(i -> !i.getValue()).map(i -> REQUIRED_PERMISSIONS.get(Math.toIntExact(i.getIndex()))).<MASK><NEW_LINE>if (!missingPermissions.isEmpty()) {<NEW_LINE>LOGGER.error("Please make sure you account has all of these permissions:{}", REQUIRED_PERMISSIONS);<NEW_LINE>return new AirbyteConnectionStatus().withStatus(AirbyteConnectionStatus.Status.FAILED).withMessage("Could not connect to the Gcs bucket with the provided configuration. " + "Missing permissions: " + missingPermissions);<NEW_LINE>}<NEW_LINE>return new AirbyteConnectionStatus().withStatus(Status.SUCCEEDED);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>LOGGER.error("Exception attempting to access the Gcs bucket: {}", e.getMessage());<NEW_LINE>return new AirbyteConnectionStatus().withStatus(AirbyteConnectionStatus.Status.FAILED).withMessage("Could not connect to the Gcs bucket with the provided configuration. \n" + e.getMessage());<NEW_LINE>}<NEW_LINE>}
|
collect(Collectors.toList());
|
1,648,570
|
public Object execute(VirtualFrame frame) {<NEW_LINE>JSDynamicObject functionObject = JSFrameUtil.getFunctionObject(frame);<NEW_LINE>JSDynamicObject promise = (JSDynamicObject) getPromise(functionObject);<NEW_LINE>Object resolution = resolutionNode.execute(frame);<NEW_LINE>AlreadyResolved alreadyResolved = (AlreadyResolved) getAlreadyResolvedNode.getValue(functionObject);<NEW_LINE>if (alreadyResolvedProfile.profile(alreadyResolved.value)) {<NEW_LINE>context.notifyPromiseRejectionTracker(promise, JSPromise.REJECTION_TRACKER_OPERATION_RESOLVE_AFTER_RESOLVED, resolution);<NEW_LINE>return Undefined.instance;<NEW_LINE>}<NEW_LINE>alreadyResolved.value = true;<NEW_LINE>context.notifyPromiseHook(PromiseHook.TYPE_RESOLVE, promise);<NEW_LINE>if (resolution == promise) {<NEW_LINE>enterErrorBranch();<NEW_LINE>return rejectPromise(promise, Errors.createTypeError("self resolution!"));<NEW_LINE>}<NEW_LINE>if (!isObjectNode.executeBoolean(resolution)) {<NEW_LINE>return fulfillPromise(promise, resolution);<NEW_LINE>}<NEW_LINE>Object then;<NEW_LINE>try {<NEW_LINE>then = getThen(resolution);<NEW_LINE>} catch (AbstractTruffleException ex) {<NEW_LINE>enterErrorBranch();<NEW_LINE>return rejectPromise(promise, ex);<NEW_LINE>}<NEW_LINE>if (!isCallableNode.executeBoolean(then)) {<NEW_LINE>return fulfillPromise(promise, resolution);<NEW_LINE>}<NEW_LINE>JSFunctionObject job = promiseResolveThenableJob(promise, resolution, then);<NEW_LINE>context.<MASK><NEW_LINE>return Undefined.instance;<NEW_LINE>}
|
promiseEnqueueJob(getRealm(), job);
|
654,875
|
private IterOutcome doWork(BatchStatusWrappper batchStatus, boolean newSchema) {<NEW_LINE>Preconditions.checkArgument(batchStatus.batch.getSchema().getFieldCount() == container.getSchema().getFieldCount(), "Input batch and output batch have different field counthas!");<NEW_LINE>if (newSchema) {<NEW_LINE>createUnionAller(batchStatus.batch);<NEW_LINE>}<NEW_LINE>// Get number of records to include in the batch.<NEW_LINE>final int recordsToProcess = Math.min(batchMemoryManager.getOutputRowCount(), batchStatus.getRemainingRecords());<NEW_LINE>container.zeroVectors();<NEW_LINE>batchMemoryManager.allocateVectors(allocationVectors, recordsToProcess);<NEW_LINE>recordCount = unionall.unionRecords(<MASK><NEW_LINE>VectorUtil.setValueCount(allocationVectors, recordCount);<NEW_LINE>container.setRecordCount(recordCount);<NEW_LINE>// save number of records processed so far in batch status.<NEW_LINE>batchStatus.recordsProcessed += recordCount;<NEW_LINE>batchMemoryManager.updateOutgoingStats(recordCount);<NEW_LINE>RecordBatchStats.logRecordBatchStats(RecordBatchIOType.OUTPUT, this, getRecordBatchStatsContext());<NEW_LINE>if (callBack.getSchemaChangedAndReset()) {<NEW_LINE>return IterOutcome.OK_NEW_SCHEMA;<NEW_LINE>} else {<NEW_LINE>return IterOutcome.OK;<NEW_LINE>}<NEW_LINE>}
|
batchStatus.recordsProcessed, recordsToProcess, 0);
|
187,217
|
final CreateAddonResult executeCreateAddon(CreateAddonRequest createAddonRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createAddonRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateAddonRequest> request = null;<NEW_LINE>Response<CreateAddonResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateAddonRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createAddonRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EKS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateAddon");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateAddonResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateAddonResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
|
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
|
1,061,731
|
private String handleParseErrorException(final org.apache.lucene.queryparser.classic.ParseException exception) {<NEW_LINE>final SystemMessageBuilder systemMessageBuilder = new SystemMessageBuilder();<NEW_LINE>final StringBuilder message = new StringBuilder();<NEW_LINE>final String errorMessage = WordUtils.wrap(UtilMethods.isSet(exception.getMessage()) ? exception.getMessage() : exception.toString(), 15, Html.br(), false);<NEW_LINE>if (null != exception.currentToken) {<NEW_LINE>message.append(Html.h3("Lucene Query Parsing Error")).append(Html.b("Current Token")).append(NEW_LINE).append(exception.currentToken).append(Html.br()).append(Html.pre(errorMessage));<NEW_LINE>} else {<NEW_LINE>message.append(Html.h3("Lucene Query Parsing Error.")).append(Html.pre(errorMessage));<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>systemMessageBuilder.setMessage(messageAsString).setLife(DateUtil.FIVE_SECOND_MILLIS).setType(MessageType.SIMPLE_MESSAGE).setSeverity(MessageSeverity.ERROR);<NEW_LINE>final String userId = PrincipalThreadLocal.getName();<NEW_LINE>if (UtilMethods.isSet(userId)) {<NEW_LINE>SystemMessageEventUtil.getInstance().pushMessage("", systemMessageBuilder.create(), Collections.singletonList(userId));<NEW_LINE>}<NEW_LINE>return messageAsString;<NEW_LINE>}
|
String messageAsString = message.toString();
|
702,480
|
protected void handleHide(KrollDict options) {<NEW_LINE>if (view != null) {<NEW_LINE>synchronized (pendingAnimationLock) {<NEW_LINE>if (pendingAnimation != null) {<NEW_LINE>handlePendingAnimation(false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (TiConvert.toBoolean(options, TiC.PROPERTY_ANIMATED, false)) {<NEW_LINE>View nativeView = view.getOuterView();<NEW_LINE>int width = nativeView.getWidth();<NEW_LINE>int height = nativeView.getHeight();<NEW_LINE>int radius = Math.max(width, height);<NEW_LINE>Animator anim = ViewAnimationUtils.createCircularReveal(nativeView, width / 2, <MASK><NEW_LINE>anim.addListener(new AnimatorListenerAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onAnimationEnd(Animator animation) {<NEW_LINE>super.onAnimationEnd(animation);<NEW_LINE>view.hide();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>anim.start();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>view.hide();<NEW_LINE>}<NEW_LINE>}
|
height / 2, radius, 0);
|
500,728
|
private void calculateContentRect(int outerWidth, int outerHeight, Rectangle2D rect) {<NEW_LINE>int paddingLeft = 0;<NEW_LINE>int paddingRight = 0;<NEW_LINE>int paddingBottom = 0;<NEW_LINE>int paddingTop = 0;<NEW_LINE>if (stroke != null) {<NEW_LINE>if (stroke[TOP] != null) {<NEW_LINE>paddingTop += Math.ceil(stroke[TOP].thickness.floatPx() / 2);<NEW_LINE>}<NEW_LINE>if (stroke[LEFT] != null) {<NEW_LINE>paddingLeft += Math.ceil(stroke[LEFT].thickness.floatPx() / 2);<NEW_LINE>}<NEW_LINE>if (stroke[RIGHT] != null) {<NEW_LINE>paddingRight += Math.ceil(stroke[RIGHT].thickness.floatPx() / 2);<NEW_LINE>}<NEW_LINE>if (stroke[BOTTOM] != null) {<NEW_LINE>paddingBottom += Math.ceil(stroke[BOTTOM].thickness.floatPx() / 2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (boxShadow != null && !boxShadow.inset) {<NEW_LINE>paddingTop += -boxShadow.vOffsetPx() + boxShadow.blurPx() + boxShadow.spreadPx();<NEW_LINE>paddingBottom += boxShadow.vOffsetPx() + boxShadow.blurPx() + boxShadow.spreadPx();<NEW_LINE>paddingLeft += -boxShadow.hOffsetPx() + boxShadow.blurPx<MASK><NEW_LINE>paddingRight += boxShadow.hOffsetPx() + boxShadow.blurPx() + boxShadow.spreadPx();<NEW_LINE>}<NEW_LINE>rect.setX(paddingLeft);<NEW_LINE>rect.setY(paddingTop);<NEW_LINE>rect.setWidth(outerWidth - paddingLeft - paddingRight);<NEW_LINE>rect.setHeight(outerHeight - paddingTop - paddingBottom);<NEW_LINE>}
|
() + boxShadow.spreadPx();
|
445,962
|
public JRDataSource createDatasource() throws JRException {<NEW_LINE>try {<NEW_LINE>@SuppressWarnings("deprecation")<NEW_LINE>Workbook workbook = (Workbook) getParameterValue(JRXlsxQueryExecuterFactory.XLSX_WORKBOOK);<NEW_LINE>if (workbook == null) {<NEW_LINE>workbook = (Workbook) getParameterValue(AbstractXlsQueryExecuterFactory.XLS_WORKBOOK, true);<NEW_LINE>}<NEW_LINE>if (workbook != null) {<NEW_LINE>datasource = new JRXlsxDataSource(workbook);<NEW_LINE>} else {<NEW_LINE>@SuppressWarnings("deprecation")<NEW_LINE>InputStream xlsxInputStream = (InputStream) getParameterValue(JRXlsxQueryExecuterFactory.XLSX_INPUT_STREAM);<NEW_LINE>if (xlsxInputStream == null) {<NEW_LINE>xlsxInputStream = (InputStream) getParameterValue(AbstractXlsQueryExecuterFactory.XLS_INPUT_STREAM, true);<NEW_LINE>}<NEW_LINE>if (xlsxInputStream != null) {<NEW_LINE>datasource = new JRXlsxDataSource(xlsxInputStream);<NEW_LINE>} else {<NEW_LINE>@SuppressWarnings("deprecation")<NEW_LINE>File xlsxFile = (File) getParameterValue(JRXlsxQueryExecuterFactory.XLSX_FILE);<NEW_LINE>if (xlsxFile == null) {<NEW_LINE>xlsxFile = (File) getParameterValue(AbstractXlsQueryExecuterFactory.XLS_FILE, true);<NEW_LINE>}<NEW_LINE>if (xlsxFile != null) {<NEW_LINE>datasource = new JRXlsxDataSource(xlsxFile);<NEW_LINE>} else {<NEW_LINE>@SuppressWarnings("deprecation")<NEW_LINE>String <MASK><NEW_LINE>if (xlsxSource == null) {<NEW_LINE>xlsxSource = getStringParameterOrProperty(AbstractXlsQueryExecuterFactory.XLS_SOURCE);<NEW_LINE>}<NEW_LINE>if (xlsxSource != null) {<NEW_LINE>// TODO<NEW_LINE>datasource = new JRXlsxDataSource(getRepositoryContext(), xlsxSource);<NEW_LINE>} else {<NEW_LINE>if (log.isWarnEnabled()) {<NEW_LINE>log.warn("No XLS source was provided.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new JRException(e);<NEW_LINE>}<NEW_LINE>if (datasource != null) {<NEW_LINE>initDatasource(datasource);<NEW_LINE>}<NEW_LINE>return datasource;<NEW_LINE>}
|
xlsxSource = getStringParameterOrProperty(JRXlsxQueryExecuterFactory.XLSX_SOURCE);
|
754,091
|
private void saveBPartnerLocation(@NonNull final BPartnerLocationSaveRequest request) {<NEW_LINE>final BPartnerLocation partnerLocation = request.getLocation();<NEW_LINE>final BPartnerLocationId partnerLocationId = partnerLocation.getId();<NEW_LINE>final OrgId orgId = request.getOrgId();<NEW_LINE>final boolean validatePermissions = request.isValidatePermissions();<NEW_LINE>try (final MDCCloseable ignored = TableRecordMDC.putTableRecordReference(I_C_BPartner_Location.Table_Name, partnerLocationId)) {<NEW_LINE>final I_C_BPartner_Location bpartnerLocationRecord = loadOrNew(partnerLocationId, I_C_BPartner_Location.class);<NEW_LINE>if (orgId != null) {<NEW_LINE>bpartnerLocationRecord.setAD_Org_ID(orgId.getRepoId());<NEW_LINE>}<NEW_LINE>bpartnerLocationRecord.setExternalId(ExternalId.toValue(partnerLocation.getExternalId()));<NEW_LINE>bpartnerLocationRecord.setGLN(GLN.toCode(partnerLocation.getGln()));<NEW_LINE>// bpartnerLocation.getId() // id is only for lookup and won't be updated later<NEW_LINE>bpartnerLocationRecord.setIsActive(partnerLocation.isActive());<NEW_LINE>bpartnerLocationRecord.setC_BPartner_ID(request.getBpartnerId().getRepoId());<NEW_LINE>bpartnerLocationRecord.setName(partnerLocation.getName());<NEW_LINE>bpartnerLocationRecord.setBPartnerName(partnerLocation.getBpartnerName());<NEW_LINE>bpartnerLocationRecord.setPhone(partnerLocation.getPhone());<NEW_LINE>bpartnerLocationRecord.setPhone2(partnerLocation.getMobile());<NEW_LINE>bpartnerLocationRecord.setFax(partnerLocation.getFax());<NEW_LINE>bpartnerLocationRecord.setEMail(partnerLocation.getEmail());<NEW_LINE>bpartnerLocationRecord.setSetup_Place_No(partnerLocation.getSetupPlaceNo());<NEW_LINE>bpartnerLocationRecord.setIsHandOverLocation(partnerLocation.isHandOverLocation());<NEW_LINE>bpartnerLocationRecord.setIsRemitTo(partnerLocation.isRemitTo());<NEW_LINE>bpartnerLocationRecord.setVisitorsAddress(partnerLocation.isVisitorsAddress());<NEW_LINE>bpartnerLocationRecord.setIsReplicationLookupDefault(partnerLocation.isReplicationLookupDefault());<NEW_LINE>final BPartnerLocationType locationType = partnerLocation.getLocationType();<NEW_LINE>if (locationType != null) {<NEW_LINE>locationType.getBillTo().ifPresent(bpartnerLocationRecord::setIsBillTo);<NEW_LINE>locationType.getBillToDefault().ifPresent(bpartnerLocationRecord::setIsBillToDefault);<NEW_LINE>locationType.getShipTo().ifPresent(bpartnerLocationRecord::setIsShipTo);<NEW_LINE>locationType.getShipToDefault().ifPresent(bpartnerLocationRecord::setIsShipToDefault);<NEW_LINE>locationType.getVisitorsAddress().ifPresent(bpartnerLocationRecord::setVisitorsAddress);<NEW_LINE>}<NEW_LINE>final BPartnerLocationAddressPart address = saveLocationRecord(partnerLocation);<NEW_LINE>bpartnerLocationRecord.setC_Location_ID(address.<MASK><NEW_LINE>bpartnerBL.setAddress(bpartnerLocationRecord);<NEW_LINE>if (validatePermissions) {<NEW_LINE>assertCanCreateOrUpdate(bpartnerLocationRecord);<NEW_LINE>}<NEW_LINE>bpartnerLocationRecord.setAD_Org_Mapping_ID(OrgMappingId.toRepoId(partnerLocation.getOrgMappingId()));<NEW_LINE>saveRecord(bpartnerLocationRecord);<NEW_LINE>//<NEW_LINE>// Update model from saved record:<NEW_LINE>partnerLocation.setId(BPartnerLocationId.ofRepoId(bpartnerLocationRecord.getC_BPartner_ID(), bpartnerLocationRecord.getC_BPartner_Location_ID()));<NEW_LINE>partnerLocation.setLocationType(BPartnerCompositesLoader.extractBPartnerLocationType(bpartnerLocationRecord));<NEW_LINE>partnerLocation.setFromAddress(address);<NEW_LINE>}<NEW_LINE>}
|
getExistingLocationId().getRepoId());
|
1,467,074
|
public static void main(String[] argv) {<NEW_LINE>if (argv.length == 0) {<NEW_LINE>System.out.println("Usage : java JavaSignatureLexer [ --encoding <name> ] <inputfile(s)>");<NEW_LINE>} else {<NEW_LINE>int firstFilePos = 0;<NEW_LINE>String encodingName = "UTF-8";<NEW_LINE>if (argv[0].equals("--encoding")) {<NEW_LINE>firstFilePos = 2;<NEW_LINE>encodingName = argv[1];<NEW_LINE>try {<NEW_LINE>// Side-effect: is encodingName valid?<NEW_LINE>java.nio.charset.Charset.forName(encodingName);<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.out.println("Invalid encoding '" + encodingName + "'");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = firstFilePos; i < argv.length; i++) {<NEW_LINE>JavaSignatureLexer scanner = null;<NEW_LINE>try {<NEW_LINE>java.io.FileInputStream stream = new java.io.FileInputStream(argv[i]);<NEW_LINE>java.io.Reader reader = new java.<MASK><NEW_LINE>scanner = new JavaSignatureLexer(reader);<NEW_LINE>while (!scanner.zzAtEOF) scanner.yylex();<NEW_LINE>} catch (java.io.FileNotFoundException e) {<NEW_LINE>System.out.println("File not found : \"" + argv[i] + "\"");<NEW_LINE>} catch (java.io.IOException e) {<NEW_LINE>System.out.println("IO error scanning file \"" + argv[i] + "\"");<NEW_LINE>System.out.println(e);<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.out.println("Unexpected exception:");<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
io.InputStreamReader(stream, encodingName);
|
1,209,086
|
private void listWithFromActivityTokenBackward(String activityToken, List<String> results) throws Exception {<NEW_LINE>List<String> from = SetUniqueList.setUniqueList(new ArrayList<String>());<NEW_LINE>List<String> ids = this.listWithArrivedActivityToken(activityToken);<NEW_LINE>if (!ids.isEmpty()) {<NEW_LINE>for (WorkLog o : this.entityManagerContainer().fetch(ids, WorkLog.class, ListTools.toList(WorkLog.fromActivityToken_FIELDNAME, WorkLog.connected_FIELDNAME))) {<NEW_LINE>if (!results.contains(o.getId())) {<NEW_LINE>results.<MASK><NEW_LINE>if ((o.getConnected()) && (StringUtils.isNotEmpty(o.getFromActivityToken()))) {<NEW_LINE>from.add(o.getFromActivityToken());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!from.isEmpty()) {<NEW_LINE>for (String str : from) {<NEW_LINE>this.listWithFromActivityTokenBackward(str, results);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
add(o.getId());
|
1,403,010
|
public int copyLinesFrom(MInvoiceBatch invoiceBatchFrom) {<NEW_LINE>if (isProcessed())<NEW_LINE>return 0;<NEW_LINE>List<MInvoiceBatchLine> fromInvoiceBatchLines = Arrays.asList(invoiceBatchFrom.getLines(true));<NEW_LINE>AtomicInteger count = new AtomicInteger();<NEW_LINE>fromInvoiceBatchLines.stream().forEach(invoiceBatchLineFrom -> {<NEW_LINE>MInvoiceBatchLine invoiceBatchLineTo = new MInvoiceBatchLine(getCtx(<MASK><NEW_LINE>PO.copyValues(invoiceBatchLineFrom, invoiceBatchLineTo, invoiceBatchLineFrom.getAD_Client_ID(), invoiceBatchLineFrom.getAD_Org_ID());<NEW_LINE>invoiceBatchLineTo.setC_InvoiceBatch_ID(getC_InvoiceBatch_ID());<NEW_LINE>// new<NEW_LINE>invoiceBatchLineTo.set_ValueNoCheck("C_InvoiceBatchLine_ID", I_ZERO);<NEW_LINE>invoiceBatchLineTo.setProcessed(false);<NEW_LINE>invoiceBatchLineTo.saveEx();<NEW_LINE>count.updateAndGet(no -> no + 1);<NEW_LINE>});<NEW_LINE>if (fromInvoiceBatchLines.size() != count.get())<NEW_LINE>log.log(Level.SEVERE, "Line difference - From=" + fromInvoiceBatchLines.size() + " <> Saved=" + count);<NEW_LINE>return count.get();<NEW_LINE>}
|
), 0, get_TrxName());
|
5,843
|
private void handle(final APIReconnectVirtualRouterMsg msg) {<NEW_LINE>thdf.chainSubmit(new ChainTask(msg) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getSyncSignature() {<NEW_LINE>return syncThreadName;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(final SyncTaskChain chain) {<NEW_LINE>final APIReconnectVirtualRouterEvent evt = new <MASK><NEW_LINE>refreshVO();<NEW_LINE>ErrorCode allowed = validateOperationByState(msg, self.getState(), SysErrors.OPERATION_ERROR);<NEW_LINE>if (allowed != null) {<NEW_LINE>evt.setError(allowed);<NEW_LINE>bus.publish(evt);<NEW_LINE>chain.next();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>reconnect(new Completion(msg, chain) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success() {<NEW_LINE>evt.setInventory((ApplianceVmInventory) getSelfInventory());<NEW_LINE>bus.publish(evt);<NEW_LINE>chain.next();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void fail(ErrorCode errorCode) {<NEW_LINE>evt.setError(errorCode);<NEW_LINE>bus.publish(evt);<NEW_LINE>chain.next();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getName() {<NEW_LINE>return String.format("reconnect-virtual-router-%s", self.getUuid());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}
|
APIReconnectVirtualRouterEvent(msg.getId());
|
361,020
|
void addPlugins(List<String> classNames) throws PluginException {<NEW_LINE>PluginException pe = null;<NEW_LINE>List<Plugin> list = new ArrayList<>(classNames.size());<NEW_LINE>List<String> badList = new ArrayList<>();<NEW_LINE>for (String className : classNames) {<NEW_LINE>try {<NEW_LINE>Class<? extends Plugin> pluginClass = PluginUtils.forName(className);<NEW_LINE>if (getLoadedPlugin(pluginClass) != null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>PluginUtils.assertUniquePluginName(pluginClass);<NEW_LINE>Plugin p = PluginUtils.instantiatePlugin(pluginClass, tool);<NEW_LINE>list.add(p);<NEW_LINE>} catch (PluginException e) {<NEW_LINE>pe = e.getPluginException(pe);<NEW_LINE>badList.add(className);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Plugin[] pluginArray = list.toArray(new Plugin[list.size()]);<NEW_LINE>try {<NEW_LINE>addPlugins(pluginArray);<NEW_LINE>} catch (PluginException e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (badList.size() > 0) {<NEW_LINE>// EventManager eventMgr = tool.getEventManager<NEW_LINE>for (String className : badList) {<NEW_LINE>// remove from event manager<NEW_LINE>tool.removeEventListener(className);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (pe != null) {<NEW_LINE>throw pe;<NEW_LINE>}<NEW_LINE>}
|
pe = e.getPluginException(pe);
|
220,277
|
public HttpResponse testGroupParametersForHttpResponse(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Map<String, Object> params) throws IOException {<NEW_LINE>// verify the required parameter 'requiredStringGroup' is set<NEW_LINE>if (requiredStringGroup == null) {<NEW_LINE>throw new IllegalArgumentException("Missing the required parameter 'requiredStringGroup' when calling testGroupParameters");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'requiredBooleanGroup' is set<NEW_LINE>if (requiredBooleanGroup == null) {<NEW_LINE>throw new IllegalArgumentException("Missing the required parameter 'requiredBooleanGroup' when calling testGroupParameters");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'requiredInt64Group' is set<NEW_LINE>if (requiredInt64Group == null) {<NEW_LINE>throw new IllegalArgumentException("Missing the required parameter 'requiredInt64Group' when calling testGroupParameters");<NEW_LINE>}<NEW_LINE>UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");<NEW_LINE>// Copy the params argument if present, to allow passing in immutable maps<NEW_LINE>Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);<NEW_LINE>// Add the required query param 'requiredStringGroup' to the map of query params<NEW_LINE>allParams.put("requiredStringGroup", requiredStringGroup);<NEW_LINE>// Add the required query param 'requiredInt64Group' to the map of query params<NEW_LINE>allParams.put("requiredInt64Group", requiredInt64Group);<NEW_LINE>for (Map.Entry<String, Object> entry : allParams.entrySet()) {<NEW_LINE>String key = entry.getKey();<NEW_LINE><MASK><NEW_LINE>if (key != null && value != null) {<NEW_LINE>if (value instanceof Collection) {<NEW_LINE>uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());<NEW_LINE>} else if (value instanceof Object[]) {<NEW_LINE>uriBuilder = uriBuilder.queryParam(key, (Object[]) value);<NEW_LINE>} else {<NEW_LINE>uriBuilder = uriBuilder.queryParam(key, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String localVarUrl = uriBuilder.build().toString();<NEW_LINE>GenericUrl genericUrl = new GenericUrl(localVarUrl);<NEW_LINE>HttpContent content = null;<NEW_LINE>return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute();<NEW_LINE>}
|
Object value = entry.getValue();
|
1,255,414
|
public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {<NEW_LINE>final AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE);<NEW_LINE>final CredentialsProvider credsProvider = (CredentialsProvider) context.getAttribute(ClientContext.CREDS_PROVIDER);<NEW_LINE>final HttpHost targetHost = (HttpHost) <MASK><NEW_LINE>// If not auth scheme has been initialized yet<NEW_LINE>if (authState.getAuthScheme() == null) {<NEW_LINE>AuthScope authScope = new AuthScope(targetHost.getHostName(), targetHost.getPort());<NEW_LINE>// Obtain credentials matching the target host<NEW_LINE>Credentials creds = credsProvider.getCredentials(authScope);<NEW_LINE>// If found, generate BasicScheme preemptively<NEW_LINE>if (creds != null) {<NEW_LINE>authState.setAuthScheme(new BasicScheme());<NEW_LINE>authState.setCredentials(creds);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
|
250,482
|
public boolean needRecycle(String workerTag) {<NEW_LINE>if (s_logger.isInfoEnabled())<NEW_LINE>s_logger.info("Check to see if a worker VM with tag " + workerTag + " needs to be recycled");<NEW_LINE>if (workerTag == null || workerTag.isEmpty()) {<NEW_LINE>s_logger.error("Invalid worker VM tag " + workerTag);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String[] tokens = workerTag.split("-");<NEW_LINE>if (tokens.length != 3) {<NEW_LINE>s_logger.error("Invalid worker VM tag " + workerTag);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>long startTick = Long.parseLong(tokens[0]);<NEW_LINE>long msid = Long.parseLong(tokens[1]);<NEW_LINE>long runid = Long.parseLong(tokens[2]);<NEW_LINE>if (msHostPeerDao.countStateSeenInPeers(msid, runid, ManagementServerHost.State.Down) > 0) {<NEW_LINE>if (s_logger.isInfoEnabled())<NEW_LINE>s_logger.info("Worker VM's owner management server node has been detected down from peer nodes, recycle it");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (runid != clusterManager.getManagementRunId(msid)) {<NEW_LINE>if (s_logger.isInfoEnabled())<NEW_LINE>s_logger.info("Worker VM's owner management server has changed runid, recycle it");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// this time-out check was disabled<NEW_LINE>// "until we have found out a VMware API that can check if there are pending tasks on the subject VM"<NEW_LINE>// but as we expire jobs and those stale worker VMs stay around untill an MS reboot we opt in to have them removed anyway<NEW_LINE>Instant start = Instant.ofEpochMilli(startTick);<NEW_LINE>Instant end = start.plusSeconds(2 * (AsyncJobManagerImpl.JobExpireMinutes.value() + AsyncJobManagerImpl.JobCancelThresholdMinutes<MASK><NEW_LINE>Instant now = Instant.now();<NEW_LINE>if (s_vmwareCleanOldWorderVMs.value() && now.isAfter(end)) {<NEW_LINE>if (s_logger.isInfoEnabled()) {<NEW_LINE>s_logger.info("Worker VM expired, seconds elapsed: " + Duration.between(start, now).getSeconds());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (s_logger.isTraceEnabled()) {<NEW_LINE>s_logger.trace("Worker VM with tag '" + workerTag + "' does not need recycling, yet." + "But in " + Duration.between(now, end).getSeconds() + " seconds, though");<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}
|
.value()) * SECONDS_PER_MINUTE);
|
1,776,236
|
private void process(JaxbXmlPart part) throws Docx4JException {<NEW_LINE>log.info("/n Processing " + part.getPartName().getName());<NEW_LINE>org.docx4j.openpackaging.packages.OpcPackage pkg = part.getPackage();<NEW_LINE>// Binding is a concept which applies more broadly<NEW_LINE>// than just Word documents.<NEW_LINE>org.w3c.dom.Document doc = XmlUtils.marshaltoW3CDomDocument(part.getJaxbElement());<NEW_LINE>JAXBContext jc = Context.jc;<NEW_LINE>try {<NEW_LINE>// Use constructor which takes Unmarshaller, rather than JAXBContext,<NEW_LINE>// so we can set JaxbValidationEventHandler<NEW_LINE>Unmarshaller u = jc.createUnmarshaller();<NEW_LINE>JaxbValidationEventHandler eventHandler = new org<MASK><NEW_LINE>// eventHandler.setContinue(true);<NEW_LINE>u.setEventHandler(eventHandler);<NEW_LINE>Map<String, Object> transformParameters = new HashMap<String, Object>();<NEW_LINE>transformParameters.put("OpenDoPEIntegrity", this);<NEW_LINE>try {<NEW_LINE>javax.xml.bind.util.JAXBResult result = new javax.xml.bind.util.JAXBResult(u);<NEW_LINE>org.docx4j.XmlUtils.transform(doc, xslt, transformParameters, result);<NEW_LINE>part.setJaxbElement(result);<NEW_LINE>// this will fail if there is unexpected content,<NEW_LINE>// since JaxbValidationEventHandler fails by default<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error(e.getMessage(), e);<NEW_LINE>log.error("Input in question:" + XmlUtils.w3CDomNodeToString(doc));<NEW_LINE>log.error("Now trying DOMResult..");<NEW_LINE>DOMResult result = new DOMResult();<NEW_LINE>org.docx4j.XmlUtils.transform(doc, xslt, transformParameters, result);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>org.w3c.dom.Document docResult = ((org.w3c.dom.Document) result.getNode());<NEW_LINE>// log.debug("After ODI: " + XmlUtils.w3CDomNodeToString(docResult));<NEW_LINE>Object o = XmlUtils.unmarshal(((org.w3c.dom.Document) result.getNode()));<NEW_LINE>part.setJaxbElement(o);<NEW_LINE>} else {<NEW_LINE>// part.unmarshal( ((org.w3c.dom.Document)result.getNode()).getDocumentElement() );<NEW_LINE>Object o = XmlUtils.unmarshal(((org.w3c.dom.Document) result.getNode()));<NEW_LINE>part.setJaxbElement(o);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new Docx4JException("Problems ensuring integrity", e);<NEW_LINE>}<NEW_LINE>}
|
.docx4j.jaxb.JaxbValidationEventHandler();
|
438,656
|
public Object compute(Object[] args, ExecutionContext ec) {<NEW_LINE>for (Object arg : args) {<NEW_LINE>if (FunctionUtils.isNull(arg)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Long hour = DataTypes.LongType.convertFrom(args[0]);<NEW_LINE>Long minute = DataTypes.LongType.convertFrom(args[1]);<NEW_LINE>Double second = DataTypes.DoubleType<MASK><NEW_LINE>if (hour == null || minute == null || second == null || minute < 0 || minute > 59) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>DivStructure divStructure = DivStructure.fromDouble(second);<NEW_LINE>long[] div = divStructure == null ? null : divStructure.getDiv();<NEW_LINE>if (div == null || div[0] < 0 || div[0] > 59 || div[1] < 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>MysqlDateTime t = new MysqlDateTime();<NEW_LINE>t.setSqlType(Types.TIME);<NEW_LINE>// todo can't handle overflows<NEW_LINE>if (hour < 0) {<NEW_LINE>t.setNeg(true);<NEW_LINE>}<NEW_LINE>t.setHour(hour < 0 ? -hour : hour);<NEW_LINE>t.setMinute(minute);<NEW_LINE>t.setSecond(div[0]);<NEW_LINE>t.setSecondPart(div[1] / 1000 * 1000);<NEW_LINE>// handle max time value<NEW_LINE>if (!MySQLTimeTypeUtil.checkTimeRangeQuick(t)) {<NEW_LINE>t.setHour(MySQLTimeTypeUtil.TIME_MAX_HOUR);<NEW_LINE>t.setMinute(59);<NEW_LINE>t.setSecond(59);<NEW_LINE>t.setDay(0);<NEW_LINE>t.setSecondPart(0);<NEW_LINE>}<NEW_LINE>t = MySQLTimeCalculator.timeAddNanoWithRound(t, (int) (div[1] % 1000));<NEW_LINE>// handle max time value<NEW_LINE>if (!MySQLTimeTypeUtil.checkTimeRangeQuick(t)) {<NEW_LINE>t.setHour(MySQLTimeTypeUtil.TIME_MAX_HOUR);<NEW_LINE>t.setMinute(59);<NEW_LINE>t.setSecond(59);<NEW_LINE>}<NEW_LINE>return DataTypeUtil.fromMySQLDatetime(resultType, t, InternalTimeZone.DEFAULT_TIME_ZONE);<NEW_LINE>}
|
.convertFrom(args[2]);
|
1,527,558
|
public boolean addVelocimacro(String name, Node macroBody, String[] argArray, String sourceTemplate) {<NEW_LINE>// Called by RuntimeInstance.addVelocimacro<NEW_LINE>if (name == null || macroBody == null || argArray == null || sourceTemplate == null) {<NEW_LINE>String msg = "VM '" + name + "' addition rejected : ";<NEW_LINE>if (name == null) {<NEW_LINE>msg += "name";<NEW_LINE>} else if (macroBody == null) {<NEW_LINE>msg += "macroBody";<NEW_LINE>} else if (argArray == null) {<NEW_LINE>msg += "argArray";<NEW_LINE>} else {<NEW_LINE>msg += "sourceTemplate";<NEW_LINE>}<NEW_LINE>msg += " argument was null";<NEW_LINE><MASK><NEW_LINE>throw new NullPointerException(msg);<NEW_LINE>}<NEW_LINE>if (!canAddVelocimacro(name, sourceTemplate)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>synchronized (this) {<NEW_LINE>vmManager.addVM(name, macroBody, argArray, sourceTemplate, replaceAllowed);<NEW_LINE>}<NEW_LINE>if (Logger.isDebugEnabled(this.getClass())) {<NEW_LINE>Logger.debug(this, "added VM " + name + ": source=" + sourceTemplate);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}
|
Logger.error(this, msg);
|
1,447,766
|
/* (non-Javadoc)<NEW_LINE>* @see org.netbeans.modules.j2ee.persistence.wizard.fromdb.FacadeGenerator#generate(org.netbeans.api.project.Project, java.util.Map, org.openide.filesystems.FileObject, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, boolean)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public Set<FileObject> generate(Project project, Map<String, String> entityNames, FileObject targetFolder, String entityFQN, String idClass, String pkg, boolean hasRemote, boolean hasLocal, boolean overrideExisting) throws IOException {<NEW_LINE>final Set<FileObject> createdFiles = new HashSet<FileObject>();<NEW_LINE>final String entitySimpleName = JavaIdentifiers.unqualify(entityFQN);<NEW_LINE>// create the facade<NEW_LINE>String resourceName = entitySimpleName + REST_FACADE_SUFFIX;<NEW_LINE>reportProgress(resourceName);<NEW_LINE>FileObject existingFO = targetFolder.getFileObject(resourceName, "java");<NEW_LINE>if (existingFO != null) {<NEW_LINE>if (overrideExisting) {<NEW_LINE>existingFO.delete();<NEW_LINE>} else {<NEW_LINE>throw new IOException("file alerady exists exception: " + existingFO);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final FileObject facade = GenerationUtils.createClass(<MASK><NEW_LINE>createdFiles.add(facade);<NEW_LINE>if (!generateInfrastracture(createdFiles, entityFQN, facade)) {<NEW_LINE>return createdFiles;<NEW_LINE>}<NEW_LINE>generateResourceMethods(facade, entityFQN, idClass);<NEW_LINE>return createdFiles;<NEW_LINE>}
|
targetFolder, entitySimpleName + REST_FACADE_SUFFIX, null);
|
134,956
|
public MutableDateTime parseMutableDateTime(String text) {<NEW_LINE>InternalParser parser = requireParser();<NEW_LINE>Chronology chrono = selectChronology(null);<NEW_LINE>DateTimeParserBucket bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);<NEW_LINE>int newPos = parser.parseInto(bucket, text, 0);<NEW_LINE>if (newPos >= 0) {<NEW_LINE>if (newPos >= text.length()) {<NEW_LINE>long millis = bucket.computeMillis(true, text);<NEW_LINE>if (iOffsetParsed && bucket.getOffsetInteger() != null) {<NEW_LINE>int parsedOffset = bucket.getOffsetInteger();<NEW_LINE>DateTimeZone <MASK><NEW_LINE>chrono = chrono.withZone(parsedZone);<NEW_LINE>} else if (bucket.getZone() != null) {<NEW_LINE>chrono = chrono.withZone(bucket.getZone());<NEW_LINE>}<NEW_LINE>MutableDateTime dt = new MutableDateTime(millis, chrono);<NEW_LINE>if (iZone != null) {<NEW_LINE>dt.setZone(iZone);<NEW_LINE>}<NEW_LINE>return dt;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>newPos = ~newPos;<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException(FormatUtils.createErrorMessage(text, newPos));<NEW_LINE>}
|
parsedZone = DateTimeZone.forOffsetMillis(parsedOffset);
|
1,665,797
|
public void startMoving(String[] compIds, Rectangle[] bounds, Point hotspot) {<NEW_LINE>if (logTestCode()) {<NEW_LINE>// NOI18N<NEW_LINE>testCode.add("// > START MOVING");<NEW_LINE>}<NEW_LINE>LayoutComponent[] comps = new LayoutComponent[compIds.length];<NEW_LINE>for (int i = 0; i < compIds.length; i++) {<NEW_LINE>comps[i] = layoutModel.getLayoutComponent(compIds[i]);<NEW_LINE>}<NEW_LINE>prepareDragger(comps, bounds, hotspot, LayoutDragger.ALL_EDGES);<NEW_LINE>if (logTestCode()) {<NEW_LINE>// NOI18N<NEW_LINE>testCode.add("{");<NEW_LINE>// NOI18N<NEW_LINE>LayoutTestUtils.writeStringArray(testCode, "compIds", compIds);<NEW_LINE>// NOI18N<NEW_LINE>LayoutTestUtils.<MASK><NEW_LINE>// NOI18N<NEW_LINE>testCode.// NOI18N<NEW_LINE>add(// NOI18N<NEW_LINE>"Point hotspot = new Point(" + new Double(hotspot.getX()).intValue() + "," + new Double(hotspot.getY()).intValue() + ");");<NEW_LINE>// NOI18N<NEW_LINE>testCode.add("ld.startMoving(compIds, bounds, hotspot);");<NEW_LINE>// NOI18N<NEW_LINE>testCode.add("}");<NEW_LINE>}<NEW_LINE>setDragTarget(comps[0].getParent(), comps, false);<NEW_LINE>if (logTestCode()) {<NEW_LINE>// NOI18N<NEW_LINE>testCode.add("// < START MOVING");<NEW_LINE>}<NEW_LINE>}
|
writeRectangleArray(testCode, "bounds", bounds);
|
514,611
|
public MTable deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {<NEW_LINE>final ObjectCodec codec = jsonParser.getCodec();<NEW_LINE>final JsonNode node = codec.readTree(jsonParser);<NEW_LINE>final JsonNode schemaNode = node.get(M_TABLE_SCHEMA_STR);<NEW_LINE>final JsonNode dataNode = node.get(M_TABLE_DATA);<NEW_LINE>final TableSchema schema = TableUtil.schemaStr2Schema(schemaNode.asText());<NEW_LINE>final String[] names = schema.getFieldNames();<NEW_LINE>final TypeInformation<?>[] types = schema.getFieldTypes();<NEW_LINE>final int arity = names.length;<NEW_LINE>final List<Row> data = new ArrayList<>();<NEW_LINE>for (int j = 0; j < names.length; ++j) {<NEW_LINE>final Iterator<JsonNode> objectIterator = dataNode.get(names<MASK><NEW_LINE>int index = 0;<NEW_LINE>while (objectIterator.hasNext()) {<NEW_LINE>JsonNode item = objectIterator.next();<NEW_LINE>if (j == 0) {<NEW_LINE>Row row = new Row(arity);<NEW_LINE>row.setField(j, from(codec, item, types[j]));<NEW_LINE>data.add(index, row);<NEW_LINE>} else {<NEW_LINE>data.get(index).setField(j, from(codec, item, types[j]));<NEW_LINE>}<NEW_LINE>index++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new MTable(data, schema);<NEW_LINE>}
|
[j]).elements();
|
907,530
|
public static ServiceAccountCredentialsNodesResponse fromXContent(XContentParser parser) throws IOException {<NEW_LINE>ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser);<NEW_LINE>NodesResponseHeader header = null;<NEW_LINE>List<ServiceTokenInfo> fileTokenInfos = List.of();<NEW_LINE>XContentParser.Token token;<NEW_LINE>while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {<NEW_LINE>ensureExpectedToken(XContentParser.Token.FIELD_NAME, token, parser);<NEW_LINE>if ("_nodes".equals(parser.currentName())) {<NEW_LINE>if (header == null) {<NEW_LINE>header = <MASK><NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("expecting only a single [_nodes] field, multiple found");<NEW_LINE>}<NEW_LINE>} else if ("file_tokens".equals(parser.currentName())) {<NEW_LINE>fileTokenInfos = parseFileToken(parser);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("expecting field of either [_nodes] or [file_tokens], found [" + parser.currentName() + "]");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ServiceAccountCredentialsNodesResponse(header, fileTokenInfos);<NEW_LINE>}
|
NodesResponseHeader.fromXContent(parser, null);
|
1,340,620
|
private void dropDatabase() throws SQLException {<NEW_LINE>String name = mongoDB.getName();<NEW_LINE>mongoDB.getCollection(OAUTHCLIENT).drop();<NEW_LINE>mongoDB.getCollection(OAUTHCONSENT).drop();<NEW_LINE>mongoDB.getCollection(OAUTHTOKEN).drop();<NEW_LINE>// just in case, clean up generic tables<NEW_LINE>if (mongoDB.collectionExists(OAUTHCLIENT_BASE)) {<NEW_LINE>mongoDB.getCollection(OAUTHCLIENT_BASE).drop();<NEW_LINE>mongoDB.getCollection(OAUTHCONSENT_BASE).drop();<NEW_LINE>mongoDB.getCollection(OAUTHTOKEN_BASE).drop();<NEW_LINE>System.out.println("oAuth20MongoSetup Dropped collections for " + OAUTHCLIENT_BASE);<NEW_LINE>}<NEW_LINE>if (mongoDB.collectionExists(OAUTHCLIENT_BASE + "defaultUID")) {<NEW_LINE>mongoDB.getCollection(<MASK><NEW_LINE>mongoDB.getCollection(OAUTHCONSENT_BASE + "defaultUID").drop();<NEW_LINE>mongoDB.getCollection(OAUTHTOKEN_BASE + "defaultUID").drop();<NEW_LINE>System.out.println("oAuth20MongoSetup Dropped collections for " + OAUTHCLIENT_BASE + "defaultUID");<NEW_LINE>}<NEW_LINE>System.out.println("oAuth20MongoSetup Dropped collections in mongoDB database " + name);<NEW_LINE>System.out.println("oAuth20MongoSetup Collection dropped for " + OAUTHCLIENT + ": " + !mongoDB.collectionExists(OAUTHCLIENT));<NEW_LINE>}
|
OAUTHCLIENT_BASE + "defaultUID").drop();
|
1,168,798
|
static void saveCreateCaseOutput(Case caseForJob, String outputDirPath, String baseCaseName) {<NEW_LINE>JsonFactory jsonGeneratorFactory = new JsonFactory();<NEW_LINE>String reportOutputPath = outputDirPath + File.separator + "createCase_" + TimeStampUtils.createTimeStamp() + ".json";<NEW_LINE>java.io.File reportFile = Paths.get(reportOutputPath).toFile();<NEW_LINE>try {<NEW_LINE>Files.createDirectories(Paths.get(reportFile.getParent()));<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.SEVERE, "Unable to create output file " + reportFile.toString() + " for 'Create Case' command", ex);<NEW_LINE>// NON-NLS<NEW_LINE>System.err.println("Unable to create output file " + <MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>JsonGenerator jsonGenerator = null;<NEW_LINE>try {<NEW_LINE>jsonGenerator = jsonGeneratorFactory.createGenerator(reportFile, JsonEncoding.UTF8);<NEW_LINE>// instert \n after each field for more readable formatting<NEW_LINE>jsonGenerator.setPrettyPrinter(new DefaultPrettyPrinter().withObjectIndenter(new DefaultIndenter(" ", "\n")));<NEW_LINE>// save command output<NEW_LINE>jsonGenerator.writeStartObject();<NEW_LINE>jsonGenerator.writeStringField("@caseName", baseCaseName);<NEW_LINE>jsonGenerator.writeStringField("@caseDir", caseForJob.getCaseDirectory());<NEW_LINE>jsonGenerator.writeEndObject();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.SEVERE, "Failed to create JSON output for 'Create Case' command", ex);<NEW_LINE>// NON-NLS<NEW_LINE>System.err.println("Failed to create JSON output for 'Create Case' command");<NEW_LINE>} finally {<NEW_LINE>if (jsonGenerator != null) {<NEW_LINE>try {<NEW_LINE>jsonGenerator.close();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// NON-NLS<NEW_LINE>logger.log(Level.WARNING, "Failed to close JSON output file for 'Create Case' command", ex);<NEW_LINE>// NON-NLS<NEW_LINE>System.err.println("Failed to close JSON output file for 'Create Case' command");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
reportFile.toString() + " for 'Create Case' command");
|
123,009
|
public void transfer(final Session<?> source, final Session<?> destination, final Path file, final Local local, final TransferOptions options, final TransferStatus overall, final TransferStatus segment, final ConnectionCallback connectionCallback, final ProgressListener listener, final StreamListener streamListener) throws BackgroundException {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug(String.format("Transfer file %s with options %s", file, options));<NEW_LINE>}<NEW_LINE>if (local.isSymbolicLink()) {<NEW_LINE>final Symlink feature = source.getFeature(Symlink.class);<NEW_LINE>final UploadSymlinkResolver symlinkResolver = new UploadSymlinkResolver(feature, roots);<NEW_LINE>if (symlinkResolver.resolve(local)) {<NEW_LINE>// Make relative symbolic link<NEW_LINE>final String target = symlinkResolver.relativize(local.getAbsolute(), local.getSymlinkTarget().getAbsolute());<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug(String.format("Create symbolic link from %s to %s", file, target));<NEW_LINE>}<NEW_LINE>feature.symlink(file, target);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (file.isFile()) {<NEW_LINE>listener.message(MessageFormat.format(LocaleFactory.localizedString("Uploading {0}", "Status"), file.getName()));<NEW_LINE>// Transfer<NEW_LINE>final Upload upload = <MASK><NEW_LINE>final Object reply = upload.upload(file, local, bandwidth, new UploadStreamListener(this, streamListener), segment, connectionCallback);<NEW_LINE>}<NEW_LINE>}
|
source.getFeature(Upload.class);
|
1,299,178
|
public Projector visitSysUpdateProjection(SysUpdateProjection projection, Context context) {<NEW_LINE>Map<Reference, Symbol> assignments = projection.assignments();<NEW_LINE>assert !assignments.isEmpty() : "at least one assignment is required";<NEW_LINE>List<Input<?>> valueInputs = new ArrayList<>(assignments.size());<NEW_LINE>List<ColumnIdent> assignmentCols = new ArrayList<>(assignments.size());<NEW_LINE>RelationName relationName = null;<NEW_LINE>InputFactory.Context<NestableCollectExpression<?, ?>> readCtx = null;<NEW_LINE>for (Map.Entry<Reference, Symbol> e : assignments.entrySet()) {<NEW_LINE>Reference ref = e.getKey();<NEW_LINE>assert relationName == null || relationName.equals(ref.ident().tableIdent()) : "mixed table assignments found";<NEW_LINE>relationName = ref.ident().tableIdent();<NEW_LINE>if (readCtx == null) {<NEW_LINE>StaticTableDefinition<?> tableDefinition = staticTableDefinitionGetter.apply(relationName);<NEW_LINE>readCtx = inputFactory.ctxForRefs(context.txnCtx, tableDefinition.getReferenceResolver());<NEW_LINE>}<NEW_LINE>assignmentCols.add(ref.column());<NEW_LINE>Input<?> sourceInput = readCtx.add(e.getValue());<NEW_LINE>valueInputs.add(sourceInput);<NEW_LINE>}<NEW_LINE>SysRowUpdater<?> rowUpdater = sysUpdaterGetter.apply(relationName);<NEW_LINE>assert readCtx != null : "readCtx must not be null";<NEW_LINE>assert rowUpdater != null : "row updater needs to exist";<NEW_LINE>Consumer<Object> rowWriter = rowUpdater.newRowWriter(assignmentCols, valueInputs, readCtx.expressions());<NEW_LINE>if (projection.returnValues() == null) {<NEW_LINE>return new SysUpdateProjector(rowWriter);<NEW_LINE>} else {<NEW_LINE>InputFactory.Context<NestableCollectExpression<SysNodeCheck, ?>> cntx = new InputFactory(nodeCtx).ctxForRefs(context.txnCtx, new StaticTableReferenceResolver<>(SysNodeChecksTableInfo.create<MASK><NEW_LINE>cntx.add(List.of(projection.returnValues()));<NEW_LINE>return new SysUpdateResultSetProjector(rowUpdater, rowWriter, cntx.expressions(), cntx.topLevelInputs());<NEW_LINE>}<NEW_LINE>}
|
().expressions()));
|
1,711,502
|
public Map<String, Comparative> toColumnCondition(List<String> columns) {<NEW_LINE>final Map<String, Comparative> result = new HashMap<>();<NEW_LINE>if (null == label || GeneralUtil.isEmpty(predicates) || columns == null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>Preconditions.checkArgument(label instanceof TableScanLabel);<NEW_LINE>final RelDataType tableRowType = label.getRel().getRowType();<NEW_LINE>final RexBuilder builder = this.label.getRel().getCluster().getRexBuilder();<NEW_LINE>final List<RexNode> sorted = PredicateUtil.sortPredicates(predicates);<NEW_LINE>final RexNode comparison = RexUtil.<MASK><NEW_LINE>if (null != comparison) {<NEW_LINE>try {<NEW_LINE>RexNode dnf = RexUtil.toDnf(builder, comparison);<NEW_LINE>final List<String> qualifiedName = ((TableScanLabel) label).getTable().getQualifiedName();<NEW_LINE>final String schema = qualifiedName.size() > 1 ? qualifiedName.get(qualifiedName.size() - 2) : null;<NEW_LINE>Partitioner partitioner = OptimizerContext.getContext(schema).getPartitioner();<NEW_LINE>PlannerUtils.buildColumnsComparative(result, dnf, tableRowType, columns, partitioner);<NEW_LINE>} catch (TddlRuntimeException e) {<NEW_LINE>if (e.getErrorCode() == ErrorCode.ERR_TODNF_LIMIT_EXCEED.getCode()) {<NEW_LINE>// do nothing, just skip this condition<NEW_LINE>} else {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}
|
composeConjunction(builder, sorted, true);
|
518,178
|
private void doAction(final MyAction action) {<NEW_LINE>LOG.debug("doAction: START " + action.name());<NEW_LINE>final MyExitAction[] exitActions;<NEW_LINE>List<Runnable> toBeCalled = null;<NEW_LINE>synchronized (myLock) {<NEW_LINE>final MyState oldState = myState;<NEW_LINE>myState = myState.transition(action);<NEW_LINE>if (oldState.equals(myState))<NEW_LINE>return;<NEW_LINE>exitActions = MyTransitionAction.getExit(oldState, myState);<NEW_LINE>LOG.debug("doAction: oldState: " + oldState.name() + ", newState: " + myState.name());<NEW_LINE>if (LOG.isDebugEnabled() && exitActions != null) {<NEW_LINE>final String debugExitActions = StringUtil.join(exitActions, exitAction -> exitAction.name(), " ");<NEW_LINE>LOG.debug("exit actions: " + debugExitActions);<NEW_LINE>}<NEW_LINE>if (exitActions != null) {<NEW_LINE>for (MyExitAction exitAction : exitActions) {<NEW_LINE>if (MyExitAction.markStart.equals(exitAction)) {<NEW_LINE>myWaitingFinishListeners.addAll(myWaitingStartListeners);<NEW_LINE>myWaitingStartListeners.clear();<NEW_LINE>} else if (MyExitAction.markEnd.equals(exitAction)) {<NEW_LINE>toBeCalled <MASK><NEW_LINE>myWaitingFinishListeners.clear();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (exitActions != null) {<NEW_LINE>for (MyExitAction exitAction : exitActions) {<NEW_LINE>if (MyExitAction.submitRequestToExecutor.equals(exitAction)) {<NEW_LINE>myAlarm.consume(myWorker);<NEW_LINE>// myAlarm.addRequest(myWorker, ourDelay);<NEW_LINE>// ApplicationManager.getApplication().executeOnPooledThread(myWorker);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (toBeCalled != null) {<NEW_LINE>for (Runnable runnable : toBeCalled) {<NEW_LINE>runnable.run();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOG.debug("doAction: END " + action.name());<NEW_LINE>}
|
= new ArrayList<>(myWaitingFinishListeners);
|
482,524
|
public void run() {<NEW_LINE>if (!hasValidSelection()) {<NEW_LINE>setEnabled(false);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>IFolder parent = (IFolder<MASK><NEW_LINE>CompoundCommand compoundCommand = new NonNotifyingCompoundCommand() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getLabel() {<NEW_LINE>return getCommands().size() > 1 ? Messages.PasteAction_1 : super.getLabel();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>for (IArchimateModelObject selected : TreeModelCutAndPaste.INSTANCE.getObjects()) {<NEW_LINE>if (isAllowedToPaste(parent, selected)) {<NEW_LINE>if (selected instanceof IFolder) {<NEW_LINE>// This first - folders go in folders<NEW_LINE>compoundCommand.add(new MoveFolderCommand(parent, (IFolder) selected));<NEW_LINE>} else {<NEW_LINE>compoundCommand.add(new MoveObjectCommand(parent, selected));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CommandStack commandStack = (CommandStack) parent.getAdapter(CommandStack.class);<NEW_LINE>if (commandStack != null) {<NEW_LINE>commandStack.execute(compoundCommand);<NEW_LINE>TreeModelCutAndPaste.INSTANCE.clear();<NEW_LINE>((TreeViewer) getSelectionProvider()).expandToLevel(parent, 1);<NEW_LINE>}<NEW_LINE>}
|
) getSelection().getFirstElement();
|
1,114,915
|
protected void readNodeChildren(org.w3c.dom.Node node, java.util.Map namespacePrefixes) {<NEW_LINE>org.w3c.dom.NodeList children = node.getChildNodes();<NEW_LINE>for (int i = 0, size = children.getLength(); i < size; ++i) {<NEW_LINE>org.w3c.dom.Node childNode = children.item(i);<NEW_LINE>if (!(childNode instanceof org.w3c.dom.Element)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern());<NEW_LINE>String childNodeValue = "";<NEW_LINE>if (childNode.getFirstChild() != null) {<NEW_LINE>childNodeValue = childNode.getFirstChild().getNodeValue();<NEW_LINE>}<NEW_LINE>boolean recognized = readNodeChild(childNode, childNodeName, childNodeValue, namespacePrefixes);<NEW_LINE>if (!recognized) {<NEW_LINE>if (childNode instanceof org.w3c.dom.Element) {<NEW_LINE>_logger.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
info("Found extra unrecognized childNode '" + childNodeName + "'");
|
869,571
|
public static ClientMessage encodeRequest(java.lang.String name, com.hazelcast.internal.serialization.Data key, boolean includeValue, int listenerFlags, boolean localOnly) {<NEW_LINE>ClientMessage clientMessage = ClientMessage.createForEncode();<NEW_LINE>clientMessage.setRetryable(false);<NEW_LINE>clientMessage.setOperationName("Map.AddEntryListenerToKey");<NEW_LINE>ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);<NEW_LINE>encodeInt(<MASK><NEW_LINE>encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);<NEW_LINE>encodeBoolean(initialFrame.content, REQUEST_INCLUDE_VALUE_FIELD_OFFSET, includeValue);<NEW_LINE>encodeInt(initialFrame.content, REQUEST_LISTENER_FLAGS_FIELD_OFFSET, listenerFlags);<NEW_LINE>encodeBoolean(initialFrame.content, REQUEST_LOCAL_ONLY_FIELD_OFFSET, localOnly);<NEW_LINE>clientMessage.add(initialFrame);<NEW_LINE>StringCodec.encode(clientMessage, name);<NEW_LINE>DataCodec.encode(clientMessage, key);<NEW_LINE>return clientMessage;<NEW_LINE>}
|
initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);
|
1,728,965
|
public void installFeature(Collection<String> featureIds, File fromDir, String toExtension, boolean acceptLicense, boolean offlineOnly) throws InstallException {<NEW_LINE>// fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING"));<NEW_LINE>this.installAssets = new ArrayList<List<InstallAsset>>();<NEW_LINE>ArrayList<InstallAsset> installAssets = new ArrayList<InstallAsset>();<NEW_LINE>ArrayList<String> unresolvedFeatures = new ArrayList<String>();<NEW_LINE>Collection<ESAAsset> autoFeatures = getResolveDirector().getAutoFeature(fromDir, toExtension);<NEW_LINE>getResolveDirector().resolve(featureIds, fromDir, toExtension, offlineOnly, installAssets, unresolvedFeatures);<NEW_LINE>if (!offlineOnly && !unresolvedFeatures.isEmpty()) {<NEW_LINE>log(Level.FINEST, "installFeature() determined unresolved features: " + unresolvedFeatures.toString() + " from " + fromDir.getAbsolutePath());<NEW_LINE>installFeatures(unresolvedFeatures, toExtension, acceptLicense, null, null, 5);<NEW_LINE>}<NEW_LINE>if (!installAssets.isEmpty()) {<NEW_LINE>getResolveDirector().resolveAutoFeatures(autoFeatures, installAssets);<NEW_LINE>this.installAssets.add(installAssets);<NEW_LINE>}<NEW_LINE>if (this.installAssets.isEmpty()) {<NEW_LINE>throw ExceptionUtils.createByKey(InstallException.ALREADY_EXISTS, <MASK><NEW_LINE>}<NEW_LINE>}
|
"ALREADY_INSTALLED", featureIds.toString());
|
1,307,117
|
// Convert the list to XML to pass back to the view.<NEW_LINE>private Document toXml(List<Post> itemsList) {<NEW_LINE>try {<NEW_LINE>DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();<NEW_LINE>DocumentBuilder builder = factory.newDocumentBuilder();<NEW_LINE>Document doc = builder.newDocument();<NEW_LINE>// Start building the XML.<NEW_LINE>Element root = doc.createElement("Items");<NEW_LINE>doc.appendChild(root);<NEW_LINE>// Iterate through the collection.<NEW_LINE>for (Post post : itemsList) {<NEW_LINE>Element item = doc.createElement("Item");<NEW_LINE>root.appendChild(item);<NEW_LINE>// Set Id.<NEW_LINE>Element id = doc.createElement("Id");<NEW_LINE>id.appendChild(doc.createTextNode(post.getId()));<NEW_LINE>item.appendChild(id);<NEW_LINE>// Set Date.<NEW_LINE>Element name = doc.createElement("Date");<NEW_LINE>name.appendChild(doc.createTextNode(post.getDate()));<NEW_LINE>item.appendChild(name);<NEW_LINE>// Set Title.<NEW_LINE>Element date = doc.createElement("Title");<NEW_LINE>date.appendChild(doc.createTextNode(post.getTitle()));<NEW_LINE>item.appendChild(date);<NEW_LINE>// Set Content.<NEW_LINE>Element <MASK><NEW_LINE>desc.appendChild(doc.createTextNode(post.getBody()));<NEW_LINE>item.appendChild(desc);<NEW_LINE>// Set Author.<NEW_LINE>Element guide = doc.createElement("Author");<NEW_LINE>guide.appendChild(doc.createTextNode(post.getAuthor()));<NEW_LINE>item.appendChild(guide);<NEW_LINE>}<NEW_LINE>return doc;<NEW_LINE>} catch (ParserConfigurationException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}
|
desc = doc.createElement("Content");
|
958,064
|
public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) {<NEW_LINE>log.debug("Configuring Hazelcast");<NEW_LINE>Config config = new Config();<NEW_LINE>config.setInstanceName("gateway");<NEW_LINE>// The serviceId is by default the application's name, see Spring Boot's eureka.instance.appname property<NEW_LINE>String serviceId = discoveryClient.getLocalServiceInstance().getServiceId();<NEW_LINE>log.debug("Configuring Hazelcast clustering for instanceId: {}", serviceId);<NEW_LINE>// In development, everything goes through 127.0.0.1, with a different port<NEW_LINE>if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)) {<NEW_LINE>log.debug("Application is running with the \"dev\" profile, Hazelcast " + "cluster will only work with localhost instances");<NEW_LINE><MASK><NEW_LINE>config.getNetworkConfig().setPort(serverProperties.getPort() + 5701);<NEW_LINE>config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);<NEW_LINE>config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true);<NEW_LINE>for (ServiceInstance instance : discoveryClient.getInstances(serviceId)) {<NEW_LINE>String clusterMember = "127.0.0.1:" + (instance.getPort() + 5701);<NEW_LINE>log.debug("Adding Hazelcast (dev) cluster member " + clusterMember);<NEW_LINE>config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(clusterMember);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Production configuration, one host per instance all using port 5701<NEW_LINE>config.getNetworkConfig().setPort(5701);<NEW_LINE>config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);<NEW_LINE>config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true);<NEW_LINE>for (ServiceInstance instance : discoveryClient.getInstances(serviceId)) {<NEW_LINE>String clusterMember = instance.getHost() + ":5701";<NEW_LINE>log.debug("Adding Hazelcast (prod) cluster member " + clusterMember);<NEW_LINE>config.getNetworkConfig().getJoin().getTcpIpConfig().addMember(clusterMember);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>config.getMapConfigs().put("default", initializeDefaultMapConfig());<NEW_LINE>config.getMapConfigs().put("com.gateway.domain.*", initializeDomainMapConfig(jHipsterProperties));<NEW_LINE>return Hazelcast.newHazelcastInstance(config);<NEW_LINE>}
|
System.setProperty("hazelcast.local.localAddress", "127.0.0.1");
|
1,016,732
|
public String order(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) {<NEW_LINE>Integer C_Order_ID = (Integer) value;<NEW_LINE>if (// assuming it is resetting value<NEW_LINE>isCalloutActive() || C_Order_ID == null || C_Order_ID.intValue() == 0)<NEW_LINE>return "";<NEW_LINE>mTab.setValue("C_Invoice_ID", null);<NEW_LINE>mTab.setValue("C_Charge_ID", null);<NEW_LINE>mTab.setValue("IsPrepayment", Boolean.TRUE);<NEW_LINE>//<NEW_LINE>mTab.setValue("DiscountAmt", Env.ZERO);<NEW_LINE>mTab.setValue("WriteOffAmt", Env.ZERO);<NEW_LINE>mTab.setValue("IsOverUnderPayment", Boolean.FALSE);<NEW_LINE>mTab.setValue("OverUnderAmt", Env.ZERO);<NEW_LINE>// Payment Date<NEW_LINE>Timestamp ts = (Timestamp) mTab.getValue("DateTrx");<NEW_LINE>if (ts == null)<NEW_LINE>ts = new Timestamp(System.currentTimeMillis());<NEW_LINE>//<NEW_LINE>String sql = // #1<NEW_LINE>"SELECT COALESCE(Bill_BPartner_ID, C_BPartner_ID) as C_BPartner_ID " + ", C_Currency_ID " + ", GrandTotal " + "FROM C_Order WHERE C_Order_ID=?";<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sql, null);<NEW_LINE>pstmt.setInt(1, C_Order_ID.intValue());<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>if (rs.next()) {<NEW_LINE>mTab.setValue("C_BPartner_ID", new Integer(rs.getInt(1)));<NEW_LINE>// Set Order Currency<NEW_LINE>int C_Currency_ID = rs.getInt(2);<NEW_LINE>mTab.setValue(<MASK><NEW_LINE>//<NEW_LINE>// Set Pay<NEW_LINE>BigDecimal GrandTotal = rs.getBigDecimal(3);<NEW_LINE>// Amount<NEW_LINE>if (GrandTotal == null)<NEW_LINE>GrandTotal = Env.ZERO;<NEW_LINE>mTab.setValue("PayAmt", GrandTotal);<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>log.log(Level.SEVERE, sql, e);<NEW_LINE>return e.getLocalizedMessage();<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>}<NEW_LINE>return docType(ctx, WindowNo, mTab, mField, value);<NEW_LINE>}
|
"C_Currency_ID", new Integer(C_Currency_ID));
|
1,429,983
|
final StartMonitoringMemberResult executeStartMonitoringMember(StartMonitoringMemberRequest startMonitoringMemberRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(startMonitoringMemberRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<StartMonitoringMemberRequest> request = null;<NEW_LINE>Response<StartMonitoringMemberResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StartMonitoringMemberRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startMonitoringMemberRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Detective");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartMonitoringMember");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StartMonitoringMemberResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartMonitoringMemberResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
|
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
|
660,329
|
protected void printPoint(UnifiedImageBuilder<?> imageBdr, MapNode node, DefaultEntityViewInfo pInfo, UColor nameColor) {<NEW_LINE>int x = transformer.x(node.getLon());<NEW_LINE>int y = transformer.y(node.getLat());<NEW_LINE>int width = 0;<NEW_LINE>if (pInfo.icon != null) {<NEW_LINE>width = Math.round(pInfo.icon.size * displayFactorSym);<NEW_LINE>pInfo.icon.draw(<MASK><NEW_LINE>}<NEW_LINE>if (nameColor != null) {<NEW_LINE>String name = (debugMode) ? "P" + node.getId() : node.getName();<NEW_LINE>if (name != null) {<NEW_LINE>NameInfo info = new NameInfo(name, nameColor, pInfo.printOrder);<NEW_LINE>info.x = x + width;<NEW_LINE>info.y = y + width / 4;<NEW_LINE>nameInfoBuffer.add(info);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
imageBdr, x, y, displayFactor);
|
1,745,024
|
public PlanBean createPlan(String organizationId, NewPlanBean bean) throws OrganizationNotFoundException, PlanAlreadyExistsException, NotAuthorizedException, InvalidNameException {<NEW_LINE>securityContext.checkPermissions(PermissionType.planEdit, organizationId);<NEW_LINE>FieldValidator.validateName(bean.getName());<NEW_LINE>PlanBean newPlan = new PlanBean();<NEW_LINE>newPlan.setName(bean.getName());<NEW_LINE>newPlan.setDescription(bean.getDescription());<NEW_LINE>newPlan.setId(BeanUtils.idFromName(bean.getName()));<NEW_LINE>newPlan.setCreatedOn(new Date());<NEW_LINE>newPlan.setCreatedBy(securityContext.getCurrentUser());<NEW_LINE>try {<NEW_LINE>// Store/persist the new plan<NEW_LINE>storage.beginTx();<NEW_LINE>OrganizationBean orgBean = getOrganizationFromStorage(organizationId);<NEW_LINE>if (storage.getPlan(orgBean.getId(), newPlan.getId()) != null) {<NEW_LINE>throw ExceptionFactory.planAlreadyExistsException(newPlan.getName());<NEW_LINE>}<NEW_LINE>newPlan.setOrganization(orgBean);<NEW_LINE>storage.createPlan(newPlan);<NEW_LINE>storage.createAuditEntry(AuditUtils<MASK><NEW_LINE>if (bean.getInitialVersion() != null) {<NEW_LINE>NewPlanVersionBean newPlanVersion = new NewPlanVersionBean();<NEW_LINE>newPlanVersion.setVersion(bean.getInitialVersion());<NEW_LINE>createPlanVersionInternal(newPlanVersion, newPlan);<NEW_LINE>}<NEW_LINE>storage.commitTx();<NEW_LINE>// $NON-NLS-1$<NEW_LINE>log.debug(String.format("Created plan: %s", newPlan));<NEW_LINE>return newPlan;<NEW_LINE>} catch (AbstractRestException e) {<NEW_LINE>storage.rollbackTx();<NEW_LINE>throw e;<NEW_LINE>} catch (Exception e) {<NEW_LINE>storage.rollbackTx();<NEW_LINE>throw new SystemErrorException(e);<NEW_LINE>}<NEW_LINE>}
|
.planCreated(newPlan, securityContext));
|
932,436
|
public void translate(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException {<NEW_LINE>TranslationHelpers.checkTranslationArguments(<MASK><NEW_LINE>// Skip the argument number check because we do not access the arguments anyway<NEW_LINE>final long baseOffset = instruction.getAddress().toLong() * 0x100;<NEW_LINE>final String isolatedMsb = environment.getNextVariableString();<NEW_LINE>final String shiftedMsb = environment.getNextVariableString();<NEW_LINE>// Isolate the MSB of EAX<NEW_LINE>instructions.add(ReilHelpers.createAnd(baseOffset, OperandSize.DWORD, "eax", OperandSize.DWORD, "2147483648", OperandSize.DWORD, isolatedMsb));<NEW_LINE>// Shift the MSB into the LSB<NEW_LINE>instructions.add(ReilHelpers.createBsh(baseOffset + 1, OperandSize.DWORD, isolatedMsb, OperandSize.DWORD, "-31", OperandSize.DWORD, shiftedMsb));<NEW_LINE>// Set the new value of EDX to 0 (= 0 - 0) or -1 (= 0 - 1)<NEW_LINE>instructions.add(ReilHelpers.createSub(baseOffset + 2, OperandSize.DWORD, "0", OperandSize.DWORD, shiftedMsb, OperandSize.DWORD, "edx"));<NEW_LINE>}
|
environment, instruction, instructions, "cdq");
|
974,550
|
public static DataflowWorkerHarnessOptions createFromSystemProperties() throws IOException {<NEW_LINE>ObjectMapper objectMapper = new ObjectMapper();<NEW_LINE>DataflowWorkerHarnessOptions options;<NEW_LINE>if (System.getProperties().containsKey("sdk_pipeline_options")) {<NEW_LINE>// TODO: remove this method of getting pipeline options, once migration is complete.<NEW_LINE>String serializedOptions = System.getProperty("sdk_pipeline_options");<NEW_LINE>LOG.info("Worker harness starting with: {}", serializedOptions);<NEW_LINE>options = objectMapper.readValue(serializedOptions, PipelineOptions.class).as(DataflowWorkerHarnessOptions.class);<NEW_LINE>} else if (System.getProperties().containsKey("sdk_pipeline_options_file")) {<NEW_LINE>String filePath = System.getProperty("sdk_pipeline_options_file");<NEW_LINE>LOG.info("Loading pipeline options from " + filePath);<NEW_LINE>String serializedOptions = new String(Files.readAllBytes(Paths.get(filePath)), StandardCharsets.UTF_8);<NEW_LINE>LOG.info("Worker harness starting with: " + serializedOptions);<NEW_LINE>options = objectMapper.readValue(serializedOptions, PipelineOptions.class).as(DataflowWorkerHarnessOptions.class);<NEW_LINE>} else {<NEW_LINE>LOG.info("Using empty PipelineOptions, as none were provided.");<NEW_LINE>options = PipelineOptionsFactory.as(DataflowWorkerHarnessOptions.class);<NEW_LINE>}<NEW_LINE>// These values will not be known at job submission time and must be provided.<NEW_LINE>if (System.getProperties().containsKey("worker_id")) {<NEW_LINE>options.setWorkerId(System.getProperty("worker_id"));<NEW_LINE>}<NEW_LINE>if (System.getProperties().containsKey("job_id")) {<NEW_LINE>options.setJobId(System.getProperty("job_id"));<NEW_LINE>}<NEW_LINE>if (System.getProperties().containsKey("worker_pool")) {<NEW_LINE>options.setWorkerPool<MASK><NEW_LINE>}<NEW_LINE>return options;<NEW_LINE>}
|
(System.getProperty("worker_pool"));
|
1,325,806
|
private <T> T doSaveVersioned(AdaptibleEntity<T> source, String collectionName) {<NEW_LINE>if (source.isNew()) {<NEW_LINE>return (T) doInsert(collectionName, source.getBean(), this.mongoConverter);<NEW_LINE>}<NEW_LINE>// Create query for entity with the id and old version<NEW_LINE><MASK><NEW_LINE>// Bump version number<NEW_LINE>T toSave = source.incrementVersion();<NEW_LINE>toSave = maybeEmitEvent(new BeforeConvertEvent<T>(toSave, collectionName)).getSource();<NEW_LINE>toSave = maybeCallBeforeConvert(toSave, collectionName);<NEW_LINE>if (source.getBean() != toSave) {<NEW_LINE>source = operations.forEntity(toSave, mongoConverter.getConversionService());<NEW_LINE>}<NEW_LINE>source.assertUpdateableIdIfNotSet();<NEW_LINE>MappedDocument mapped = source.toMappedDocument(mongoConverter);<NEW_LINE>maybeEmitEvent(new BeforeSaveEvent<>(toSave, mapped.getDocument(), collectionName));<NEW_LINE>toSave = maybeCallBeforeSave(toSave, mapped.getDocument(), collectionName);<NEW_LINE>UpdateDefinition update = mapped.updateWithoutId();<NEW_LINE>UpdateResult result = doUpdate(collectionName, query, update, toSave.getClass(), false, false);<NEW_LINE>if (result.getModifiedCount() == 0) {<NEW_LINE>throw new OptimisticLockingFailureException(String.format("Cannot save entity %s with version %s to collection %s. Has it been modified meanwhile?", source.getId(), source.getVersion(), collectionName));<NEW_LINE>}<NEW_LINE>maybeEmitEvent(new AfterSaveEvent<>(toSave, mapped.getDocument(), collectionName));<NEW_LINE>return maybeCallAfterSave(toSave, mapped.getDocument(), collectionName);<NEW_LINE>}
|
Query query = source.getQueryForVersion();
|
892,298
|
public static Bitmap hookDecodeByteArray(byte[] array, int offset, int length, @Nullable BitmapFactory.Options opts) {<NEW_LINE>StaticWebpNativeLoader.ensure();<NEW_LINE>Bitmap bitmap;<NEW_LINE>if (WebpSupportStatus.sIsWebpSupportRequired && isWebpHeader(array, offset, length)) {<NEW_LINE>bitmap = nativeDecodeByteArray(array, offset, length, opts, getScaleFromOptions(opts), getInTempStorageFromOptions(opts));<NEW_LINE>// We notify that the direct decoding failed<NEW_LINE>if (bitmap == null) {<NEW_LINE>sendWebpErrorLog("webp_direct_decode_array");<NEW_LINE>}<NEW_LINE>setWebpBitmapOptions(bitmap, opts);<NEW_LINE>} else {<NEW_LINE>bitmap = originalDecodeByteArray(<MASK><NEW_LINE>if (bitmap == null) {<NEW_LINE>sendWebpErrorLog("webp_direct_decode_array_failed_on_no_webp");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return bitmap;<NEW_LINE>}
|
array, offset, length, opts);
|
840,578
|
public ListComponentBuildVersionsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListComponentBuildVersionsResult listComponentBuildVersionsResult = new ListComponentBuildVersionsResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listComponentBuildVersionsResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("requestId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listComponentBuildVersionsResult.setRequestId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("componentSummaryList", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listComponentBuildVersionsResult.setComponentSummaryList(new ListUnmarshaller<ComponentSummary>(ComponentSummaryJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listComponentBuildVersionsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return listComponentBuildVersionsResult;<NEW_LINE>}
|
int originalDepth = context.getCurrentDepth();
|
1,358,372
|
public byte[] compress(byte[] data) {<NEW_LINE>byte[] input = data;<NEW_LINE>byte[] output = new byte[MAX_COMPRESSION_TEXT_LENGTH];<NEW_LINE>Deflater compressor = new Deflater();<NEW_LINE>compressor.setInput(<MASK><NEW_LINE>int compressedDataLength = compressor.deflate(output, 0, MAX_COMPRESSION_TEXT_LENGTH, compressor.SYNC_FLUSH);<NEW_LINE>byte[] realOutput = new byte[compressedDataLength];<NEW_LINE>System.arraycopy(output, 0, realOutput, 0, compressedDataLength);<NEW_LINE>byte[] veryRealOutput;<NEW_LINE>if (secondPacketFlagCompression) {<NEW_LINE>veryRealOutput = Arrays.copyOfRange(realOutput, 2, realOutput.length);<NEW_LINE>} else {<NEW_LINE>veryRealOutput = Arrays.copyOfRange(realOutput, 0, realOutput.length);<NEW_LINE>secondPacketFlagCompression = true;<NEW_LINE>}<NEW_LINE>return veryRealOutput;<NEW_LINE>}
|
input, 0, input.length);
|
47,451
|
public Request<PutRecordRequest> marshall(PutRecordRequest putRecordRequest) {<NEW_LINE>if (putRecordRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<PutRecordRequest> request = new DefaultRequest<PutRecordRequest>(putRecordRequest, "AmazonKinesis");<NEW_LINE>String target = "Kinesis_20131202.PutRecord";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>request.setResourcePath("");<NEW_LINE>try {<NEW_LINE>ByteArrayOutputStream baos = new ByteArrayOutputStream();<NEW_LINE>GZIPOutputStream gos = new GZIPOutputStream(baos, 8192);<NEW_LINE>Writer writer = new OutputStreamWriter(gos, StringUtils.UTF8);<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(writer);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (putRecordRequest.getStreamName() != null) {<NEW_LINE>jsonWriter.name("StreamName").value(putRecordRequest.getStreamName());<NEW_LINE>}<NEW_LINE>if (putRecordRequest.getData() != null) {<NEW_LINE>jsonWriter.name("Data").value(putRecordRequest.getData());<NEW_LINE>}<NEW_LINE>if (putRecordRequest.getPartitionKey() != null) {<NEW_LINE>jsonWriter.name("PartitionKey").value(putRecordRequest.getPartitionKey());<NEW_LINE>}<NEW_LINE>if (putRecordRequest.getExplicitHashKey() != null) {<NEW_LINE>jsonWriter.name("ExplicitHashKey").value(putRecordRequest.getExplicitHashKey());<NEW_LINE>}<NEW_LINE>if (putRecordRequest.getSequenceNumberForOrdering() != null) {<NEW_LINE>jsonWriter.name("SequenceNumberForOrdering").value(putRecordRequest.getSequenceNumberForOrdering());<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.flush();<NEW_LINE>gos.finish();<NEW_LINE>writer.close();<NEW_LINE>byte[] content = baos.toByteArray();<NEW_LINE>request.setContent(new ByteArrayInputStream(content));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE><MASK><NEW_LINE>request.addHeader("Content-Encoding", "gzip");<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>}
|
request.addHeader("Content-Type", "application/x-amz-json-1.1");
|
1,421,587
|
private Slime osVersions() {<NEW_LINE>Slime slime = new Slime();<NEW_LINE>Cursor root = slime.setObject();<NEW_LINE>Set<OsVersionTarget> targets = controller.osVersionTargets();<NEW_LINE>Cursor versions = root.setArray("versions");<NEW_LINE>controller.osVersionStatus().versions().forEach((osVersion, nodeVersions) -> {<NEW_LINE>Cursor currentVersionObject = versions.addObject();<NEW_LINE>currentVersionObject.setString("version", osVersion.version().toFullString());<NEW_LINE>Optional<OsVersionTarget> target = targets.stream().filter(t -> t.osVersion().equals(osVersion)).findFirst();<NEW_LINE>currentVersionObject.setBool("targetVersion", target.isPresent());<NEW_LINE>target.ifPresent(t -> currentVersionObject.setString("upgradeBudget", t.upgradeBudget().toString()));<NEW_LINE>target.ifPresent(t -> currentVersionObject.setLong("scheduledAt", t.scheduledAt().toEpochMilli()));<NEW_LINE>currentVersionObject.setString("cloud", osVersion.<MASK><NEW_LINE>Cursor nodesArray = currentVersionObject.setArray("nodes");<NEW_LINE>nodeVersions.forEach(nodeVersion -> {<NEW_LINE>Cursor nodeObject = nodesArray.addObject();<NEW_LINE>nodeObject.setString("hostname", nodeVersion.hostname().value());<NEW_LINE>nodeObject.setString("environment", nodeVersion.zone().environment().value());<NEW_LINE>nodeObject.setString("region", nodeVersion.zone().region().value());<NEW_LINE>});<NEW_LINE>});<NEW_LINE>return slime;<NEW_LINE>}
|
cloud().value());
|
1,478,493
|
public Object calculate(Context ctx) {<NEW_LINE>IParam param = this.param;<NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("cor" + mm.getMessage("function.missingParam"));<NEW_LINE>} else if (param.isLeaf()) {<NEW_LINE>Object obj = param.getLeafExpression().calculate(ctx);<NEW_LINE>return Boolean.valueOf<MASK><NEW_LINE>} else {<NEW_LINE>int size = param.getSubSize();<NEW_LINE>for (int i = 0; i < size; ++i) {<NEW_LINE>IParam sub = param.getSub(i);<NEW_LINE>if (sub == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("cor" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>Object obj = sub.getLeafExpression().calculate(ctx);<NEW_LINE>if (Variant.isTrue(obj)) {<NEW_LINE>return Boolean.TRUE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Boolean.FALSE;<NEW_LINE>}<NEW_LINE>}
|
(Variant.isTrue(obj));
|
773,918
|
public void connect(final OnTransportConnected callback) {<NEW_LINE>new Thread(() -> {<NEW_LINE>final int timeout = candidate.getType() == JingleCandidate.TYPE_DIRECT ? SOCKET_TIMEOUT_DIRECT : SOCKET_TIMEOUT_PROXY;<NEW_LINE>try {<NEW_LINE>final boolean useTor = this.account.isOnion() || connection.getConnectionManager().getXmppConnectionService().useTorToConnect();<NEW_LINE>if (useTor) {<NEW_LINE>socket = SocksSocketFactory.createSocketOverTor(candidate.getHost(), candidate.getPort());<NEW_LINE>} else {<NEW_LINE>socket = new Socket();<NEW_LINE>SocketAddress address = new InetSocketAddress(candidate.getHost(), candidate.getPort());<NEW_LINE>socket.connect(address, timeout);<NEW_LINE>}<NEW_LINE>inputStream = socket.getInputStream();<NEW_LINE>outputStream = socket.getOutputStream();<NEW_LINE>socket.setSoTimeout(timeout);<NEW_LINE>SocksSocketFactory.<MASK><NEW_LINE>socket.setSoTimeout(0);<NEW_LINE>isEstablished = true;<NEW_LINE>callback.established();<NEW_LINE>} catch (final IOException e) {<NEW_LINE>callback.failed();<NEW_LINE>}<NEW_LINE>}).start();<NEW_LINE>}
|
createSocksConnection(socket, destination, 0);
|
404,909
|
void selectRawHostAccountStorageStatsMap(Map<Long, Map<Short, Map<Short, ContainerStorageStats>>> selectedHostAccountStorageStatsMap, Map<Long, Map<Short, Map<Short, ContainerStorageStats>>> hostAccountStorageStatsMap, Map<Long, Long> partitionTimestampMap, Map<Long, Long> partitionPhysicalStorageMap, long snapshotTimestamp, String instanceName) {<NEW_LINE>for (Map.Entry<Long, Map<Short, Map<Short, ContainerStorageStats>>> hostAccountStorageStatsMapEntry : hostAccountStorageStatsMap.entrySet()) {<NEW_LINE>long partitionId = hostAccountStorageStatsMapEntry.getKey();<NEW_LINE>if (!selectedHostAccountStorageStatsMap.containsKey(partitionId)) {<NEW_LINE>logger.trace("First entry for partition {} is from {}", partitionId, instanceName);<NEW_LINE>selectedHostAccountStorageStatsMap.put(partitionId, hostAccountStorageStatsMapEntry.getValue());<NEW_LINE>partitionTimestampMap.put(partitionId, snapshotTimestamp);<NEW_LINE>} else {<NEW_LINE>long existingValue = partitionPhysicalStorageMap.computeIfAbsent(partitionId, k -> sumPhysicalStorageUsage(selectedHostAccountStorageStatsMap.get(partitionId)));<NEW_LINE>long currentValue = sumPhysicalStorageUsage(hostAccountStorageStatsMapEntry.getValue());<NEW_LINE>long deltaInValue = currentValue - existingValue;<NEW_LINE>long deltaInTimeMs = snapshotTimestamp - partitionTimestampMap.get(partitionId);<NEW_LINE>if (Math.abs(deltaInTimeMs) < relevantTimePeriodInMs && deltaInValue > 0) {<NEW_LINE>logger.trace("Updating partition {} storage stats from instance {} as last updated time is within" + "relevant time period and delta value has increased ", partitionId, instanceName);<NEW_LINE>selectedHostAccountStorageStatsMap.put(partitionId, hostAccountStorageStatsMapEntry.getValue());<NEW_LINE>partitionPhysicalStorageMap.put(partitionId, currentValue);<NEW_LINE>partitionTimestampMap.put(partitionId, snapshotTimestamp);<NEW_LINE>} else if (deltaInTimeMs > relevantTimePeriodInMs) {<NEW_LINE>logger.trace("Updating partition {} snapshot from instance {} as new value is updated " + "within relevant time period compared to already existing one", partitionId, instanceName);<NEW_LINE>selectedHostAccountStorageStatsMap.put(<MASK><NEW_LINE>partitionPhysicalStorageMap.put(partitionId, currentValue);<NEW_LINE>partitionTimestampMap.put(partitionId, snapshotTimestamp);<NEW_LINE>} else {<NEW_LINE>logger.trace("Ignoring snapshot from {} for partition {}", instanceName, partitionId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
partitionId, hostAccountStorageStatsMapEntry.getValue());
|
237,961
|
public static void deleteObjectsInPath(OSS client, OssInputDataConfig config, String bucket, String prefix, Predicate<OSSObjectSummary> filter) throws Exception {<NEW_LINE>final List<String> keysToDelete = new ArrayList<>(config.getMaxListingLength());<NEW_LINE>final OssObjectSummaryIterator iterator = new OssObjectSummaryIterator(client, ImmutableList.of(new CloudObjectLocation(bucket, prefix).toUri("http")<MASK><NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>final OSSObjectSummary nextObject = iterator.next();<NEW_LINE>if (filter.apply(nextObject)) {<NEW_LINE>keysToDelete.add(nextObject.getKey());<NEW_LINE>if (keysToDelete.size() == config.getMaxListingLength()) {<NEW_LINE>deleteBucketKeys(client, bucket, keysToDelete);<NEW_LINE>log.info("Deleted %d files", keysToDelete.size());<NEW_LINE>keysToDelete.clear();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (keysToDelete.size() > 0) {<NEW_LINE>deleteBucketKeys(client, bucket, keysToDelete);<NEW_LINE>log.info("Deleted %d files", keysToDelete.size());<NEW_LINE>}<NEW_LINE>}
|
), config.getMaxListingLength());
|
474,373
|
// object.<NEW_LINE>private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {<NEW_LINE>in.defaultReadObject();<NEW_LINE>byte[] ec = new byte[Constants.EYE_CATCHER_LENGTH];<NEW_LINE>// d164415 start<NEW_LINE>int bytesRead = 0;<NEW_LINE>for (int offset = 0; offset < Constants.EYE_CATCHER_LENGTH; offset += bytesRead) {<NEW_LINE>bytesRead = in.read(ec, offset, Constants.EYE_CATCHER_LENGTH - offset);<NEW_LINE>if (bytesRead == -1) {<NEW_LINE>throw new IOException("end of input stream while reading eye catcher");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// d164415 end<NEW_LINE>// validate that the eyecatcher matches<NEW_LINE>for (int i = 0; i < frceEyecatcher.length; i++) {<NEW_LINE>if (frceEyecatcher[i] != ec[i]) {<NEW_LINE>String eyeCatcherString = new String(ec);<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// platform<NEW_LINE>in.readShort();<NEW_LINE>// vid<NEW_LINE>in.readShort();<NEW_LINE>}
|
IOException("Invalid eye catcher '" + eyeCatcherString + "' in FinderResultClientEnumeration input stream");
|
1,772,478
|
public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {<NEW_LINE>Assert.isNotNull(monitor);<NEW_LINE>try {<NEW_LINE>Change change = fChange;<NEW_LINE>if (change != null) {<NEW_LINE>String project = null;<NEW_LINE>IJavaProject javaProject = fTypeParameter.getJavaProject();<NEW_LINE>if (javaProject != null) {<NEW_LINE>project = javaProject.getElementName();<NEW_LINE>}<NEW_LINE>String description = Messages.format(RefactoringCoreMessages.RenameTypeParameterProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fTypeParameter.getElementName()));<NEW_LINE>String header = Messages.format(RefactoringCoreMessages.RenameTypeParameterProcessor_descriptor_description, new String[] { BasicElementLabels.getJavaElementName(fTypeParameter.getElementName()), JavaElementLabels.getElementLabel(fTypeParameter.getDeclaringMember(), JavaElementLabels.ALL_FULLY_QUALIFIED), BasicElementLabels.getJavaElementName(getNewElementName()) });<NEW_LINE>String comment = new JDTRefactoringDescriptorComment(project, this, header).asString();<NEW_LINE>RenameJavaElementDescriptor descriptor = RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_TYPE_PARAMETER);<NEW_LINE>descriptor.setProject(project);<NEW_LINE>descriptor.setDescription(description);<NEW_LINE>descriptor.setComment(comment);<NEW_LINE>descriptor.setFlags(RefactoringDescriptor.NONE);<NEW_LINE>descriptor.setJavaElement(fTypeParameter);<NEW_LINE>descriptor.setNewName(getNewElementName());<NEW_LINE>descriptor.setUpdateReferences(fUpdateReferences);<NEW_LINE>change = new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.RenameTypeParameterProcessor_change_name, <MASK><NEW_LINE>}<NEW_LINE>return change;<NEW_LINE>} finally {<NEW_LINE>fChange = null;<NEW_LINE>monitor.done();<NEW_LINE>}<NEW_LINE>}
|
new Change[] { change });
|
893,525
|
private void buildNewBinaryPredicate(Expr slotToLiteral, List<Expr> slotEqSlotExpr, Set<Pair<Expr, Expr>> slotToLiteralDeDuplication, List<Pair<Expr, Boolean>> newExprWithState, Analyzer analyzer, ExprRewriter.ClauseType clauseType) {<NEW_LINE>SlotRef checkSlot = slotToLiteral.getChild(0).unwrapSlotRef();<NEW_LINE>if (checkSlot instanceof SlotRef) {<NEW_LINE>for (Expr conjunct : slotEqSlotExpr) {<NEW_LINE>SlotRef leftSlot = conjunct.getChild(0).unwrapSlotRef();<NEW_LINE>SlotRef rightSlot = conjunct.getChild(1).unwrapSlotRef();<NEW_LINE>if (leftSlot instanceof SlotRef && rightSlot instanceof SlotRef) {<NEW_LINE>if (checkSlot.notCheckDescIdEquals(leftSlot)) {<NEW_LINE>addNewBinaryPredicate(genNewBinaryPredicate(slotToLiteral, rightSlot), slotToLiteralDeDuplication, newExprWithState, isNeedInfer(rightSlot, leftSlot, analyzer, clauseType), analyzer, clauseType);<NEW_LINE>} else if (checkSlot.notCheckDescIdEquals(rightSlot)) {<NEW_LINE>addNewBinaryPredicate(genNewBinaryPredicate(slotToLiteral, leftSlot), slotToLiteralDeDuplication, newExprWithState, isNeedInfer(leftSlot, rightSlot, analyzer<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
, clauseType), analyzer, clauseType);
|
338,349
|
private static String decrypt(byte[] key, String cipherText) throws CryptoException {<NEW_LINE>try {<NEW_LINE>PaddedBufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new <MASK><NEW_LINE>cipher.init(false, new KeyParameter(key));<NEW_LINE>byte[] cipherTextBytes = DECODER.decode(cipherText);<NEW_LINE>byte[] plainTextBytes = new byte[cipher.getOutputSize(cipherTextBytes.length)];<NEW_LINE>int outputLength = cipher.processBytes(cipherTextBytes, 0, cipherTextBytes.length, plainTextBytes, 0);<NEW_LINE>cipher.doFinal(plainTextBytes, outputLength);<NEW_LINE>int paddingStarts = plainTextBytes.length - 1;<NEW_LINE>for (; paddingStarts >= 0; paddingStarts--) {<NEW_LINE>if (plainTextBytes[paddingStarts] != 0) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new String(plainTextBytes, 0, paddingStarts + 1);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new CryptoException(e);<NEW_LINE>}<NEW_LINE>}
|
CBCBlockCipher(new DESEngine()));
|
1,233,582
|
private CompilationResult.ContractMetadata compileContract() throws IOException {<NEW_LINE>logger.info("Compiling contract...");<NEW_LINE>SolidityCompiler.Result result = compiler.compileSrc(contract.getBytes(), true, true, SolidityCompiler.Options.ABI, SolidityCompiler.Options.BIN);<NEW_LINE>if (result.isFailed()) {<NEW_LINE>throw new RuntimeException("Contract compilation failed:\n" + result.errors);<NEW_LINE>}<NEW_LINE>CompilationResult res = CompilationResult.parse(result.output);<NEW_LINE>if (res.getContracts().isEmpty()) {<NEW_LINE>throw new RuntimeException("Compilation failed, no contracts returned:\n" + result.errors);<NEW_LINE>}<NEW_LINE>CompilationResult.ContractMetadata metadata = res.getContracts()<MASK><NEW_LINE>if (metadata.bin == null || metadata.bin.isEmpty()) {<NEW_LINE>throw new RuntimeException("Compilation failed, no binary returned:\n" + result.errors);<NEW_LINE>}<NEW_LINE>return metadata;<NEW_LINE>}
|
.iterator().next();
|
68,183
|
public void visitOnEntry(ImmutableTransition<?, ?, ?, ?> visitable) {<NEW_LINE>ImmutableState<?, ?, ?, ?> sourceState = visitable.getSourceState();<NEW_LINE>ImmutableState<?, ?, ?, ?> targetState = visitable.getTargetState();<NEW_LINE>String sourceStateId = getName(sourceState.getStateId());<NEW_LINE>String targetStateId = getName(targetState.getStateId());<NEW_LINE>boolean sourceIsCluster = sourceState.hasChildStates();<NEW_LINE>boolean targetIsCluster = targetState.hasChildStates();<NEW_LINE>String source = (<MASK><NEW_LINE>String target = (targetIsCluster) ? "cluster_" + targetStateId : null;<NEW_LINE>String realStart = (sourceIsCluster) ? getName(getSimpleChildOf(sourceState).getStateId()) : sourceStateId;<NEW_LINE>String realEnd = (targetIsCluster) ? getName(getSimpleChildOf(targetState).getStateId()) : targetStateId;<NEW_LINE>String edgeLabel = visitable.getEvent().toString();<NEW_LINE>String ltail = (source != null) ? "ltail=\"" + source + "\"" : null;<NEW_LINE>String lhead = (target != null) ? "lhead=\"" + target + "\"" : null;<NEW_LINE>transBuf.append("\n" + realStart + " -> " + realEnd + " [" + ((ltail != null) ? ltail + "," : "") + ((lhead != null) ? lhead + "," : "") + " label=\"" + edgeLabel + "\"];");<NEW_LINE>}
|
sourceIsCluster) ? "cluster_" + sourceStateId : null;
|
1,032,777
|
private double computeImpactB(IntVar v, int a, int b, double before) {<NEW_LINE>model.getEnvironment().worldPush();<NEW_LINE>double after;<NEW_LINE>try {<NEW_LINE>v.updateBounds(a, b, this);<NEW_LINE>model.getSolver().getEngine().propagate();<NEW_LINE>after = searchSpaceSize(vars);<NEW_LINE>return 1.0d - (after / before);<NEW_LINE>} catch (ContradictionException e) {<NEW_LINE>model.getSolver().getEngine().flush();<NEW_LINE>model.getEnvironment().worldPop();<NEW_LINE>model.getEnvironment().worldPush();<NEW_LINE>// if the value leads to fail, then the value can be removed from the domain<NEW_LINE>try {<NEW_LINE>v.removeInterval(a, b, this);<NEW_LINE>model.getSolver().getEngine().propagate();<NEW_LINE>} catch (ContradictionException ex) {<NEW_LINE>learnsAndFails = true;<NEW_LINE>model.getSolver()<MASK><NEW_LINE>}<NEW_LINE>return 1.0d;<NEW_LINE>} finally {<NEW_LINE>model.getEnvironment().worldPop();<NEW_LINE>}<NEW_LINE>}
|
.getEngine().flush();
|
899,162
|
public State convertToState(RFXComValueSelector valueSelector) throws RFXComException {<NEW_LINE>org.openhab.core.types.State state = UnDefType.UNDEF;<NEW_LINE>if (valueSelector.getItemClass() == NumberItem.class) {<NEW_LINE>if (valueSelector == RFXComValueSelector.SIGNAL_LEVEL) {<NEW_LINE>state = new DecimalType(signalLevel);<NEW_LINE>} else if (valueSelector == RFXComValueSelector.BATTERY_LEVEL) {<NEW_LINE>state = new DecimalType(batteryLevel);<NEW_LINE>} else if (valueSelector == RFXComValueSelector.INSTANT_AMPS) {<NEW_LINE>state = new DecimalType(instantAmps);<NEW_LINE>} else if (valueSelector == RFXComValueSelector.TOTAL_AMP_HOURS) {<NEW_LINE>state = new DecimalType(totalAmpHours);<NEW_LINE>} else {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>} else if (valueSelector.getItemClass() == StringItem.class) {<NEW_LINE>if (valueSelector == RFXComValueSelector.RAW_DATA) {<NEW_LINE>state = new StringType(DatatypeConverter.printHexBinary(rawMessage));<NEW_LINE>} else {<NEW_LINE>throw new RFXComException("Can't convert " + valueSelector + " to StringItem");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new RFXComException("Can't convert " + valueSelector + " to " + valueSelector.getItemClass());<NEW_LINE>}<NEW_LINE>return state;<NEW_LINE>}
|
RFXComException("Can't convert " + valueSelector + " to NumberItem");
|
230,045
|
private Mono<Response<ClusterInner>> updateWithResponseAsync(String resourceGroupName, String clusterName, ClusterPatch cluster, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (clusterName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (cluster == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter cluster is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>cluster.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterName, this.client.getApiVersion(), cluster, accept, context);<NEW_LINE>}
|
error(new IllegalArgumentException("Parameter clusterName is required and cannot be null."));
|
64,168
|
public int fill(ByteBuffer sink) throws IOException {<NEW_LINE>Entry entry;<NEW_LINE>try (AutoLock l = lock.lock()) {<NEW_LINE>entry = dataQueue.poll();<NEW_LINE>}<NEW_LINE>if (LOG.isDebugEnabled())<NEW_LINE>LOG.debug("filled {} on {}", entry, this);<NEW_LINE>if (entry == null)<NEW_LINE>return 0;<NEW_LINE>if (entry.isEOF()) {<NEW_LINE>entry.succeed();<NEW_LINE>return shutdownInput();<NEW_LINE>}<NEW_LINE>IOException failure = entry.ioFailure();<NEW_LINE>if (failure != null) {<NEW_LINE>entry.fail(failure);<NEW_LINE>throw failure;<NEW_LINE>}<NEW_LINE>int sinkPosition = BufferUtil.flipToFill(sink);<NEW_LINE>ByteBuffer source = entry.buffer;<NEW_LINE>int sourceLength = source.remaining();<NEW_LINE>int length = Math.min(sourceLength, sink.remaining());<NEW_LINE>int sourceLimit = source.limit();<NEW_LINE>source.limit(<MASK><NEW_LINE>sink.put(source);<NEW_LINE>source.limit(sourceLimit);<NEW_LINE>BufferUtil.flipToFlush(sink, sinkPosition);<NEW_LINE>if (source.hasRemaining()) {<NEW_LINE>try (AutoLock l = lock.lock()) {<NEW_LINE>dataQueue.offerFirst(entry);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>entry.succeed();<NEW_LINE>// WebSocket does not have a backpressure API so you must always demand<NEW_LINE>// the next frame after succeeding the previous one.<NEW_LINE>stream.demand(1);<NEW_LINE>}<NEW_LINE>return length;<NEW_LINE>}
|
source.position() + length);
|
967,261
|
private void verifyBrace(final DetailAST brace, final DetailAST startToken) {<NEW_LINE>final String braceLine = getLine(<MASK><NEW_LINE>// Check for being told to ignore, or have '{}' which is a special case<NEW_LINE>if (braceLine.length() <= brace.getColumnNo() + 1 || braceLine.charAt(brace.getColumnNo() + 1) != '}') {<NEW_LINE>if (option == LeftCurlyOption.NL) {<NEW_LINE>if (!CommonUtil.hasWhitespaceBefore(brace.getColumnNo(), braceLine)) {<NEW_LINE>log(brace, MSG_KEY_LINE_NEW, OPEN_CURLY_BRACE, brace.getColumnNo() + 1);<NEW_LINE>}<NEW_LINE>} else if (option == LeftCurlyOption.EOL) {<NEW_LINE>validateEol(brace, braceLine);<NEW_LINE>} else if (!TokenUtil.areOnSameLine(startToken, brace)) {<NEW_LINE>validateNewLinePosition(brace, startToken, braceLine);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
brace.getLineNo() - 1);
|
595,381
|
/*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see org.openhab.binding.digitalSTROM2.internal.client.job.SensorJob#execute(org.openhab.binding.digitalSTROM2.<NEW_LINE>* internal.client.DigitalSTROMAPI)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void execute(DigitalSTROMAPI digitalSTROM, String token) {<NEW_LINE>int value = digitalSTROM.getDeviceOutputValue(token, this.device.getDSID(), null, this.index);<NEW_LINE>logger.info("DeviceOutputValue on Demand : " + value + ", DSID: " + this.device.getDSID().getValue());<NEW_LINE>if (value != 1) {<NEW_LINE>switch(this.index) {<NEW_LINE>case 0:<NEW_LINE>this.device.setOutputValue(value);<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
this.device.setSlatPosition(value);
|
537,895
|
private void removeValue(int inputId, Object fileSet, Value value) {<NEW_LINE>if (fileSet == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (fileSet instanceof ChangeBufferingList) {<NEW_LINE><MASK><NEW_LINE>changesList.remove(inputId);<NEW_LINE>if (!changesList.isEmpty())<NEW_LINE>return;<NEW_LINE>} else if (fileSet instanceof Integer) {<NEW_LINE>if (((Integer) fileSet).intValue() != inputId) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Map<Value, Object> mapping = asMapping();<NEW_LINE>if (mapping == null) {<NEW_LINE>myInputIdMapping = null;<NEW_LINE>myInputIdMappingValue = null;<NEW_LINE>} else {<NEW_LINE>mapping.remove(value);<NEW_LINE>if (mapping.size() == 1) {<NEW_LINE>Value mappingValue = mapping.keySet().iterator().next();<NEW_LINE>myInputIdMapping = mappingValue;<NEW_LINE>Object inputIdMappingValue = mapping.get(mappingValue);<NEW_LINE>// prevent NPEs on file set due to Value class being mutable or having inconsistent equals wrt disk persistence<NEW_LINE>// (instance that is serialized and new instance created with deserialization from the same bytes are expected to be equal)<NEW_LINE>myInputIdMappingValue = inputIdMappingValue != null ? inputIdMappingValue : new Integer(0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
|
final ChangeBufferingList changesList = (ChangeBufferingList) fileSet;
|
333,929
|
/*<NEW_LINE>* Ideally, this would not use HTML to make the table, but the other methods tried were far uglier / not useful.<NEW_LINE>*/<NEW_LINE>private JScrollPane createSyscallsHelpPane() {<NEW_LINE>ArrayList<AbstractSyscall> list = SyscallLoader.getSyscallList();<NEW_LINE>String[] columnNames = { "Name", "Number", "Description", "Inputs", "Ouputs" };<NEW_LINE>String[][] data = new String[list.size()][5];<NEW_LINE>Collections.sort(list);<NEW_LINE>int i = 0;<NEW_LINE>for (AbstractSyscall syscall : list) {<NEW_LINE>data[i][0] = syscall.getName();<NEW_LINE>data[i][1] = Integer.toString(syscall.getNumber());<NEW_LINE>data[i][2] = syscall.getDescription();<NEW_LINE>data[i][3] = syscall.getInputs();<NEW_LINE>data[i][4] = syscall.getOutputs();<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>JEditorPane html = new JEditorPane("text/html", loadFiletoStringBuilder(Globals.helpPath + "SyscallHelpPrelude.html") + convertToHTMLTable(data, columnNames).toString() + loadFiletoStringBuilder<MASK><NEW_LINE>// this affects scroll position<NEW_LINE>html.setCaretPosition(0);<NEW_LINE>html.setEditable(false);<NEW_LINE>return new JScrollPane(html, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);<NEW_LINE>}
|
(Globals.helpPath + "SyscallHelpConclusion.html"));
|
861,411
|
public void start() throws Exception {<NEW_LINE>HttpServer server = vertx.createHttpServer(new HttpServerOptions().setUseAlpn(true).setSsl(true).setPemKeyCertOptions(new PemKeyCertOptions().setKeyPath("server-key.pem").setCertPath("server-cert.pem")));<NEW_LINE>server.requestHandler(req -> {<NEW_LINE>String path = req.path();<NEW_LINE>HttpServerResponse resp = req.response();<NEW_LINE>if ("/".equals(path)) {<NEW_LINE>resp.push(HttpMethod.GET, "/script.js", ar -> {<NEW_LINE>if (ar.succeeded()) {<NEW_LINE>System.out.println("sending push");<NEW_LINE>HttpServerResponse pushedResp = ar.result();<NEW_LINE>pushedResp.sendFile("script.js");<NEW_LINE>} else {<NEW_LINE>// Sometimes Safari forbids push : "Server push not allowed to opposite endpoint."<NEW_LINE>}<NEW_LINE>});<NEW_LINE>resp.sendFile("index.html");<NEW_LINE>} else if ("/script.js".equals(path)) {<NEW_LINE>resp.sendFile("script.js");<NEW_LINE>} else {<NEW_LINE>System.out.println("Not found " + path);<NEW_LINE>resp.setStatusCode(404).end();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>server.listen(8443, "localhost", ar -> {<NEW_LINE>if (ar.succeeded()) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>ar.cause().printStackTrace();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}
|
System.out.println("Server started");
|
1,701,131
|
private void drawCross(Graphics2D g2d) {<NEW_LINE>int x, y;<NEW_LINE>final String cross = "+";<NEW_LINE>final int w = g2d.getFontMetrics().stringWidth(cross);<NEW_LINE>final int h = g2d.getFontMetrics().getMaxAscent();<NEW_LINE>if (_offset.x > _imgW / 2) {<NEW_LINE>x = getWidth() - w;<NEW_LINE>} else if (_offset.x < -_imgW / 2) {<NEW_LINE>x = 0;<NEW_LINE>} else {<NEW_LINE>x = (int) (getWidth() / 2 + _offset.x * _scale - w / 2);<NEW_LINE>}<NEW_LINE>if (_offset.y > _imgH / 2) {<NEW_LINE>y = getHeight<MASK><NEW_LINE>} else if (_offset.y < -_imgH / 2) {<NEW_LINE>y = h / 2 + 2;<NEW_LINE>} else {<NEW_LINE>y = (int) (getHeight() / 2 + _offset.y * _scale + h / 2);<NEW_LINE>}<NEW_LINE>g2d.setFont(textFont);<NEW_LINE>g2d.setColor(new Color(0, 0, 0, 180));<NEW_LINE>g2d.drawString(cross, x + 1, y + 1);<NEW_LINE>g2d.setColor(new Color(255, 0, 0, 180));<NEW_LINE>g2d.drawString(cross, x, y);<NEW_LINE>}
|
() + h / 2 - 3;
|
489,904
|
protected JComponent createCenterPanel() {<NEW_LINE>final JPanel panel = new JPanel(new BorderLayout());<NEW_LINE>// Should be called from here to initialize fields !!!<NEW_LINE>final JComponent optionsPanel = createOptionsPanel();<NEW_LINE>final JPanel subPanel = new JPanel(new BorderLayout());<NEW_LINE>final List<Pair<String, JPanel>> panels = createAdditionalPanels();<NEW_LINE>if (myMethod.canChangeParameters()) {<NEW_LINE>final JPanel parametersPanel = createParametersPanel(!panels.isEmpty());<NEW_LINE>if (!panels.isEmpty()) {<NEW_LINE>parametersPanel.<MASK><NEW_LINE>}<NEW_LINE>subPanel.add(parametersPanel, BorderLayout.CENTER);<NEW_LINE>}<NEW_LINE>if (myMethod.canChangeVisibility() && !(myVisibilityPanel instanceof ComboBoxVisibilityPanel)) {<NEW_LINE>subPanel.add(myVisibilityPanel, myMethod.canChangeParameters() ? BorderLayout.EAST : BorderLayout.CENTER);<NEW_LINE>}<NEW_LINE>panel.add(subPanel, BorderLayout.CENTER);<NEW_LINE>final JPanel main;<NEW_LINE>if (panels.isEmpty()) {<NEW_LINE>main = panel;<NEW_LINE>} else {<NEW_LINE>final TabbedPaneWrapper tabbedPane = new TabbedPaneWrapper(getDisposable());<NEW_LINE>tabbedPane.addTab(RefactoringBundle.message("parameters.border.title"), panel);<NEW_LINE>for (Pair<String, JPanel> extraPanel : panels) {<NEW_LINE>tabbedPane.addTab(extraPanel.first, extraPanel.second);<NEW_LINE>}<NEW_LINE>main = new JPanel(new BorderLayout());<NEW_LINE>final JComponent tabs = tabbedPane.getComponent();<NEW_LINE>main.add(tabs, BorderLayout.CENTER);<NEW_LINE>// remove traversal policies<NEW_LINE>for (JComponent c : UIUtil.findComponentsOfType(tabs, JComponent.class)) {<NEW_LINE>c.setFocusCycleRoot(false);<NEW_LINE>c.setFocusTraversalPolicy(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final JPanel bottom = new JPanel(new BorderLayout());<NEW_LINE>bottom.add(optionsPanel, BorderLayout.NORTH);<NEW_LINE>bottom.add(createSignaturePanel(), BorderLayout.SOUTH);<NEW_LINE>main.add(bottom, BorderLayout.SOUTH);<NEW_LINE>main.setBorder(IdeBorderFactory.createEmptyBorder(5, 0, 0, 0));<NEW_LINE>return main;<NEW_LINE>}
|
setBorder(IdeBorderFactory.createEmptyBorder());
|
129,434
|
public F5LoadBalancerResponse createF5LoadBalancerResponse(ExternalLoadBalancerDeviceVO lbDeviceVO) {<NEW_LINE>F5LoadBalancerResponse response = new F5LoadBalancerResponse();<NEW_LINE>Host lbHost = _hostDao.<MASK><NEW_LINE>Map<String, String> lbDetails = _detailsDao.findDetails(lbDeviceVO.getHostId());<NEW_LINE>response.setId(lbDeviceVO.getUuid());<NEW_LINE>response.setIpAddress(lbHost.getPrivateIpAddress());<NEW_LINE>PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(lbDeviceVO.getPhysicalNetworkId());<NEW_LINE>if (pnw != null) {<NEW_LINE>response.setPhysicalNetworkId(pnw.getUuid());<NEW_LINE>}<NEW_LINE>response.setPublicInterface(lbDetails.get("publicInterface"));<NEW_LINE>response.setPrivateInterface(lbDetails.get("privateInterface"));<NEW_LINE>response.setDeviceName(lbDeviceVO.getDeviceName());<NEW_LINE>if (lbDeviceVO.getCapacity() == 0) {<NEW_LINE>long defaultLbCapacity = NumbersUtil.parseLong(_configDao.getValue(Config.DefaultExternalLoadBalancerCapacity.key()), 50);<NEW_LINE>response.setDeviceCapacity(defaultLbCapacity);<NEW_LINE>} else {<NEW_LINE>response.setDeviceCapacity(lbDeviceVO.getCapacity());<NEW_LINE>}<NEW_LINE>response.setDedicatedLoadBalancer(lbDeviceVO.getIsDedicatedDevice());<NEW_LINE>response.setProvider(lbDeviceVO.getProviderName());<NEW_LINE>response.setDeviceState(lbDeviceVO.getState().name());<NEW_LINE>response.setObjectName("f5loadbalancer");<NEW_LINE>return response;<NEW_LINE>}
|
findById(lbDeviceVO.getHostId());
|
996,420
|
final DeleteResourcePolicyResult executeDeleteResourcePolicy(DeleteResourcePolicyRequest deleteResourcePolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteResourcePolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteResourcePolicyRequest> request = null;<NEW_LINE>Response<DeleteResourcePolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteResourcePolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteResourcePolicyRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeBuild");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteResourcePolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteResourcePolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteResourcePolicyResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
|
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
|
1,380,015
|
Set<SubscriptionName> decode(byte[] data) {<NEW_LINE>MessageHeaderDecoder header = new MessageHeaderDecoder();<NEW_LINE>AssignmentsDecoder body = new AssignmentsDecoder();<NEW_LINE>UnsafeBuffer buffer = new UnsafeBuffer(data);<NEW_LINE>header.wrap(buffer, 0);<NEW_LINE>if (header.schemaId() != AssignmentsDecoder.SCHEMA_ID || header.templateId() != AssignmentsDecoder.TEMPLATE_ID) {<NEW_LINE>logger.warn("Unable to decode assignments, schema or template id mismatch. " + "Required by decoder: [schema id={}, template id={}], " + "encoded in payload: [schema id={}, template id={}]", AssignmentsDecoder.SCHEMA_ID, AssignmentsDecoder.TEMPLATE_ID, header.schemaId(<MASK><NEW_LINE>return Collections.emptySet();<NEW_LINE>}<NEW_LINE>body.wrap(buffer, header.encodedLength(), header.blockLength(), header.version());<NEW_LINE>Set<SubscriptionName> subscriptions = new HashSet<>();<NEW_LINE>for (AssignmentsDecoder.SubscriptionsDecoder subscriptionDecoder : body.subscriptions()) {<NEW_LINE>long id = subscriptionDecoder.id();<NEW_LINE>subscriptionIds.getSubscriptionId(id).map(SubscriptionId::getSubscriptionName).ifPresent(subscriptions::add);<NEW_LINE>}<NEW_LINE>return subscriptions;<NEW_LINE>}
|
), header.templateId());
|
874,821
|
public String longestPalindrome(String s) {<NEW_LINE><MASK><NEW_LINE>boolean[][] dp = new boolean[n][n];<NEW_LINE>int mx = 1, start = 0;<NEW_LINE>for (int j = 0; j < n; ++j) {<NEW_LINE>for (int i = 0; i <= j; ++i) {<NEW_LINE>if (j - i < 2) {<NEW_LINE>dp[i][j] = s.charAt(i) == s.charAt(j);<NEW_LINE>} else {<NEW_LINE>dp[i][j] = dp[i + 1][j - 1] && s.charAt(i) == s.charAt(j);<NEW_LINE>}<NEW_LINE>if (dp[i][j] && mx < j - i + 1) {<NEW_LINE>mx = j - i + 1;<NEW_LINE>start = i;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return s.substring(start, start + mx);<NEW_LINE>}
|
int n = s.length();
|
1,132,341
|
public Cursor handle(RelNode logicalPlan, ExecutionContext executionContext) {<NEW_LINE>AlterTableGroupBackfill backfill = (AlterTableGroupBackfill) logicalPlan;<NEW_LINE>String schemaName = backfill.getSchemaName();<NEW_LINE>String logicalTable = backfill.getLogicalTableName();<NEW_LINE>BackfillExecutor backfillExecutor = new BackfillExecutor((List<RelNode> inputs, ExecutionContext executionContext1) -> {<NEW_LINE>QueryConcurrencyPolicy queryConcurrencyPolicy = getQueryConcurrencyPolicy(executionContext1);<NEW_LINE>List<Cursor> inputCursors = new ArrayList<<MASK><NEW_LINE>executeWithConcurrentPolicy(executionContext1, inputs, queryConcurrencyPolicy, inputCursors, schemaName);<NEW_LINE>return inputCursors;<NEW_LINE>});<NEW_LINE>executionContext = clearSqlMode(executionContext.copy());<NEW_LINE>upgradeEncoding(executionContext, schemaName, logicalTable);<NEW_LINE>Map<String, Set<String>> sourcePhyTables = backfill.getSourcePhyTables();<NEW_LINE>Map<String, Set<String>> targetPhyTables = backfill.getTargetPhyTables();<NEW_LINE>int affectRows = 0;<NEW_LINE>if (!sourcePhyTables.isEmpty()) {<NEW_LINE>affectRows = backfillExecutor.backfill(schemaName, logicalTable, executionContext, sourcePhyTables);<NEW_LINE>}<NEW_LINE>// Check target table immediately after backfill by default.<NEW_LINE>assert !targetPhyTables.isEmpty();<NEW_LINE>final boolean check = executionContext.getParamManager().getBoolean(ConnectionParams.TABLEGROUP_REORG_CHECK_AFTER_BACKFILL);<NEW_LINE>if (check) {<NEW_LINE>final boolean useFastChecker = FastChecker.isSupported(schemaName) && executionContext.getParamManager().getBoolean(ConnectionParams.TABLEGROUP_REORG_BACKFILL_USE_FASTCHECKER);<NEW_LINE>if (useFastChecker && fastCheckWithCatchEx(backfill, executionContext)) {<NEW_LINE>return new AffectRowCursor(affectRows);<NEW_LINE>} else {<NEW_LINE>checkInCN(backfill, executionContext);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new AffectRowCursor(affectRows);<NEW_LINE>}
|
>(inputs.size());
|
623,016
|
public static ScreenInfo computeScreenInfo(DisplayInfo displayInfo, Rect crop, int maxSize, int lockedVideoOrientation) {<NEW_LINE>int rotation = displayInfo.getRotation();<NEW_LINE>if (lockedVideoOrientation == Device.LOCK_VIDEO_ORIENTATION_INITIAL) {<NEW_LINE>// The user requested to lock the video orientation to the current orientation<NEW_LINE>lockedVideoOrientation = rotation;<NEW_LINE>}<NEW_LINE>Size deviceSize = displayInfo.getSize();<NEW_LINE>Rect contentRect = new Rect(0, 0, deviceSize.getWidth(<MASK><NEW_LINE>if (crop != null) {<NEW_LINE>if (rotation % 2 != 0) {<NEW_LINE>// 180s preserve dimensions<NEW_LINE>// the crop (provided by the user) is expressed in the natural orientation<NEW_LINE>crop = flipRect(crop);<NEW_LINE>}<NEW_LINE>if (!contentRect.intersect(crop)) {<NEW_LINE>// intersect() changes contentRect so that it is intersected with crop<NEW_LINE>Ln.w("Crop rectangle (" + formatCrop(crop) + ") does not intersect device screen (" + formatCrop(deviceSize.toRect()) + ")");<NEW_LINE>// empty<NEW_LINE>contentRect = new Rect();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Size videoSize = computeVideoSize(contentRect.width(), contentRect.height(), maxSize);<NEW_LINE>return new ScreenInfo(contentRect, videoSize, rotation, lockedVideoOrientation);<NEW_LINE>}
|
), deviceSize.getHeight());
|
237,271
|
private void appendReleases(StringBuilder buffer, List<StyleRange> styles) {<NEW_LINE>Version currentVersion = FrameworkUtil.getBundle(this.getClass()).getVersion();<NEW_LINE>for (Release release : newVersion.getReleases()) {<NEW_LINE>if (release.getVersion().compareTo(currentVersion) <= 0)<NEW_LINE>continue;<NEW_LINE>if (buffer.length() > 0)<NEW_LINE>// $NON-NLS-1$<NEW_LINE>buffer.append("\n\n");<NEW_LINE>String heading = MessageFormat.format(Messages.MsgUpdateNewInVersionX, release.getVersion().toString());<NEW_LINE>StyleRange style = new StyleRange();<NEW_LINE>style.start = buffer.length();<NEW_LINE>style.length = heading.length();<NEW_LINE>style.fontStyle = SWT.BOLD;<NEW_LINE>styles.add(style);<NEW_LINE>buffer.append(heading);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>buffer.append("\n\n");<NEW_LINE><MASK><NEW_LINE>for (// $NON-NLS-1$<NEW_LINE>String line : // $NON-NLS-1$<NEW_LINE>release.getLines()) buffer.append(line).append("\n");<NEW_LINE>}<NEW_LINE>}
|
appendMessages(buffer, styles, release);
|
461,235
|
public ByteBuffer transcode(List<ByteBuffer> data, ByteBuffer _out) {<NEW_LINE>for (ByteBuffer nalUnit : data) {<NEW_LINE><MASK><NEW_LINE>NALUnit marker = NALUnit.read(nalUnit);<NEW_LINE>_out.putInt(1);<NEW_LINE>marker.write(_out);<NEW_LINE>if (marker.type == NALUnitType.NON_IDR_SLICE || marker.type == NALUnitType.IDR_SLICE) {<NEW_LINE>transcodeSlice(nalUnit, marker);<NEW_LINE>} else {<NEW_LINE>if (marker.type == NALUnitType.SPS) {<NEW_LINE>SeqParameterSet _sps = SeqParameterSet.read(nalUnit.duplicate());<NEW_LINE>sps.put(_sps.seqParameterSetId, _sps);<NEW_LINE>} else if (marker.type == NALUnitType.PPS) {<NEW_LINE>PictureParameterSet _pps = PictureParameterSet.read(nalUnit.duplicate());<NEW_LINE>pps.put(_pps.picParameterSetId, _pps);<NEW_LINE>}<NEW_LINE>NIOUtils.write(_out, nalUnit);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>_out.flip();<NEW_LINE>return _out;<NEW_LINE>}
|
NIOUtils.skip(nalUnit, 4);
|
854,820
|
private void print(IntVar[][] pos) {<NEW_LINE>System.out.printf("%-13s%-13s%-13s%-13s%-13s%-13s%n", "", sHouse[0], sHouse[1], sHouse[2], sHouse[3], sHouse[4]);<NEW_LINE>for (int i = 0; i < SIZE; i++) {<NEW_LINE>String[] sortedLine = new String[SIZE];<NEW_LINE>for (int j = 0; j < SIZE; j++) {<NEW_LINE>sortedLine[pos[i][j].getValue() - 1] = sAttr[i][j];<NEW_LINE>}<NEW_LINE>System.out.printf<MASK><NEW_LINE>for (int j = 0; j < SIZE; j++) {<NEW_LINE>System.out.printf("%-13s", sortedLine[j]);<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>}
|
("%-13s", sAttrTitle[i]);
|
111,315
|
protected void executeServiceCode(ServiceProxy proxy) {<NEW_LINE>final String EXTRA_NAME = "interval";<NEW_LINE>IntentProxy intentProxy = proxy.getIntent();<NEW_LINE>if (intentProxy == null || !intentProxy.hasExtra(EXTRA_NAME)) {<NEW_LINE>Log.w(<MASK><NEW_LINE>super.executeServiceCode(proxy);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Intent intent = intentProxy.getIntent();<NEW_LINE>Bundle extras = intent.getExtras();<NEW_LINE>Object intervalObj = extras.get(EXTRA_NAME);<NEW_LINE>long interval = -1;<NEW_LINE>if (intervalObj instanceof Number) {<NEW_LINE>interval = ((Number) intervalObj).longValue();<NEW_LINE>}<NEW_LINE>if (interval < 0) {<NEW_LINE>Log.w(TAG, "The intent's extra '" + EXTRA_NAME + "' value is negative or non-numeric, therefore the code will be executed only once.");<NEW_LINE>super.executeServiceCode(proxy);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (runners == null) {<NEW_LINE>runners = Collections.synchronizedList(new ArrayList<>());<NEW_LINE>}<NEW_LINE>String fullUrl = url;<NEW_LINE>if (!fullUrl.contains("://") && !fullUrl.startsWith("/") && proxy.getCreationUrl().baseUrl != null) {<NEW_LINE>fullUrl = proxy.getCreationUrl().baseUrl + fullUrl;<NEW_LINE>}<NEW_LINE>if (fullUrl.startsWith(TiC.URL_APP_PREFIX)) {<NEW_LINE>fullUrl = fullUrl.replaceAll("app:/", "Resources");<NEW_LINE>} else if (fullUrl.startsWith(TiC.URL_ANDROID_ASSET_RESOURCES)) {<NEW_LINE>fullUrl = fullUrl.replaceAll("file:///android_asset/", "");<NEW_LINE>}<NEW_LINE>IntervalServiceRunner runner = new IntervalServiceRunner(this, proxy, interval, fullUrl);<NEW_LINE>runners.add(runner);<NEW_LINE>runner.start();<NEW_LINE>}
|
TAG, "The intent is missing the extra value '" + EXTRA_NAME + "', therefore the code will be executed only once.");
|
600,427
|
private static Vector apply(CompLongFloatVector v1, LongDummyVector v2, Binary op) {<NEW_LINE>LongFloatVector[] parts = v1.getPartitions();<NEW_LINE>Storage[] resParts = StorageSwitch.applyComp(v1, v2, op);<NEW_LINE>if (!op.isKeepStorage()) {<NEW_LINE>for (int i = 0; i < parts.length; i++) {<NEW_LINE>if (parts[i].getStorage() instanceof LongFloatSortedVectorStorage) {<NEW_LINE>resParts[i] = new LongFloatSparseVectorStorage(parts[i].getDim(), parts[i].getStorage().getIndices(), parts[i].getStorage().getValues());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long subDim = (v1.getDim() + v1.getNumPartitions() - 1) / v1.getNumPartitions();<NEW_LINE>for (int i = 0; i < v1.getDim(); i++) {<NEW_LINE>int pidx = <MASK><NEW_LINE>long subidx = i % subDim;<NEW_LINE>((LongFloatVectorStorage) resParts[pidx]).set(subidx, op.apply(parts[pidx].get(subidx), v2.get(i)));<NEW_LINE>}<NEW_LINE>LongFloatVector[] res = new LongFloatVector[parts.length];<NEW_LINE>int i = 0;<NEW_LINE>for (LongFloatVector part : parts) {<NEW_LINE>res[i] = new LongFloatVector(part.getMatrixId(), part.getRowId(), part.getClock(), part.getDim(), (LongFloatVectorStorage) resParts[i]);<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>v1.setPartitions(res);<NEW_LINE>return v1;<NEW_LINE>}
|
(int) (i / subDim);
|
1,271,233
|
public com.amazonaws.services.machinelearning.model.InvalidInputException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.machinelearning.model.InvalidInputException invalidInputException = new com.amazonaws.services.<MASK><NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("code", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>invalidInputException.setCode(context.getUnmarshaller(Integer.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return invalidInputException;<NEW_LINE>}
|
machinelearning.model.InvalidInputException(null);
|
1,092,141
|
public final ConstraintContext constraint() throws RecognitionException {<NEW_LINE>ConstraintContext _localctx = new ConstraintContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 20, RULE_constraint);<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>// Model aModel, String id, List<Expression> exps, List<EAnnotation> annotations<NEW_LINE>ArrayList<<MASK><NEW_LINE>setState(278);<NEW_LINE>match(CONSTRAINT);<NEW_LINE>setState(279);<NEW_LINE>((ConstraintContext) _localctx).IDENTIFIER = match(IDENTIFIER);<NEW_LINE>setState(280);<NEW_LINE>match(LP);<NEW_LINE>setState(281);<NEW_LINE>((ConstraintContext) _localctx).e = expr();<NEW_LINE>exps.add(((ConstraintContext) _localctx).e.exp);<NEW_LINE>setState(289);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>while (_la == CM) {<NEW_LINE>{<NEW_LINE>{<NEW_LINE>setState(283);<NEW_LINE>match(CM);<NEW_LINE>setState(284);<NEW_LINE>((ConstraintContext) _localctx).e = expr();<NEW_LINE>exps.add(((ConstraintContext) _localctx).e.exp);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(291);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>}<NEW_LINE>setState(292);<NEW_LINE>match(RP);<NEW_LINE>setState(293);<NEW_LINE>((ConstraintContext) _localctx).anns = annotations();<NEW_LINE>setState(294);<NEW_LINE>match(SC);<NEW_LINE>String name = (((ConstraintContext) _localctx).IDENTIFIER != null ? ((ConstraintContext) _localctx).IDENTIFIER.getText() : null);<NEW_LINE>datas.incCstrCounter(name);<NEW_LINE>FConstraint.valueOf(name).build(mModel, datas, name, exps, ((ConstraintContext) _localctx).anns.anns);<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>}
|
Expression> exps = new ArrayList();
|
1,795,740
|
private SelectorContext findSelectorContext(String text) {<NEW_LINE>int index = text.length() - 1;<NEW_LINE>StringBuilder prefix = new StringBuilder();<NEW_LINE>while (index > -1) {<NEW_LINE>char <MASK><NEW_LINE>switch(c) {<NEW_LINE>case ' ':<NEW_LINE>case '(':<NEW_LINE>case ',':<NEW_LINE>return new SelectorContext(prefix.toString(), index, Arrays.asList(SelectorKind.TAG, SelectorKind.ID, SelectorKind.CLASS));<NEW_LINE>case '#':<NEW_LINE>return new SelectorContext(prefix.toString(), index, Arrays.asList(SelectorKind.ID));<NEW_LINE>case '.':<NEW_LINE>return new SelectorContext(prefix.toString(), index, Arrays.asList(SelectorKind.CLASS));<NEW_LINE>case '[':<NEW_LINE>return new SelectorContext(prefix.toString(), index, Arrays.asList(SelectorKind.TAG_ATTRIBUTE));<NEW_LINE>case ':':<NEW_LINE>return new SelectorContext(prefix.toString(), index, Arrays.asList(SelectorKind.AFTER_COLON));<NEW_LINE>}<NEW_LINE>prefix.insert(0, c);<NEW_LINE>index--;<NEW_LINE>}<NEW_LINE>if (index < 0) {<NEW_LINE>return new SelectorContext(prefix.toString(), 0, Arrays.asList(SelectorKind.TAG, SelectorKind.ID, SelectorKind.CLASS, SelectorKind.AFTER_COLON));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}
|
c = text.charAt(index);
|
903,514
|
public void vmDefaultL3NetworkChanged(VmInstanceInventory vm, String previousL3, String nowL3) {<NEW_LINE>List<String> l3Uuids = new ArrayList<String>();<NEW_LINE>if (previousL3 != null) {<NEW_LINE>l3Uuids.add(previousL3);<NEW_LINE>}<NEW_LINE>if (nowL3 != null) {<NEW_LINE>l3Uuids.add(nowL3);<NEW_LINE>}<NEW_LINE>SimpleQuery<L3NetworkVO> q = dbf.createQuery(L3NetworkVO.class);<NEW_LINE>q.add(L3NetworkVO_.uuid, Op.IN, l3Uuids);<NEW_LINE>List<L3NetworkVO> vos = q.list();<NEW_LINE>List<L3NetworkInventory> <MASK><NEW_LINE>Map<NetworkServiceProviderType, List<L3NetworkInventory>> providerMap = getNetworkServiceProviderMap(NetworkServiceType.DHCP, invs);<NEW_LINE>for (Map.Entry<NetworkServiceProviderType, List<L3NetworkInventory>> e : providerMap.entrySet()) {<NEW_LINE>NetworkServiceProviderType ptype = e.getKey();<NEW_LINE>NetworkServiceDhcpBackend bkd = dhcpBackends.get(ptype);<NEW_LINE>if (bkd == null) {<NEW_LINE>throw new CloudRuntimeException(String.format("unable to find NetworkServiceDhcpBackend[provider type: %s]", ptype));<NEW_LINE>}<NEW_LINE>bkd.vmDefaultL3NetworkChanged(vm, previousL3, nowL3, new Completion(null) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success() {<NEW_LINE>// pass<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void fail(ErrorCode errorCode) {<NEW_LINE>logger.warn(String.format("unable to change the VM[uuid:%s]'s default L3 network in the DHCP backend, %s. You may need to reboot" + " the VM to use the new default L3 network setting", vm.getUuid(), errorCode));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}
|
invs = L3NetworkInventory.valueOf(vos);
|
66,215
|
public static BrowserWrapper create(Composite composite, int style) {<NEW_LINE>try {<NEW_LINE>Map<String, Object> <MASK><NEW_LINE>for (BrowserProvider provider : providers) {<NEW_LINE>try {<NEW_LINE>BrowserWrapper browser = provider.create(composite, style, properties);<NEW_LINE>if (browser != null) {<NEW_LINE>return (browser);<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Debug.out(e);<NEW_LINE>}<NEW_LINE>Utils.disposeComposite(composite, false);<NEW_LINE>}<NEW_LINE>return (new BrowserWrapperSWT(composite, style));<NEW_LINE>} catch (SWTError error) {<NEW_LINE>Control[] children = composite.getChildren();<NEW_LINE>for (Control child : children) {<NEW_LINE>if (child.getData(BROWSER_KEY) != null) {<NEW_LINE>try {<NEW_LINE>child.dispose();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (new BrowserWrapperFake(composite, style, error));<NEW_LINE>}<NEW_LINE>}
|
properties = new HashMap<>();
|
1,525,840
|
public NetworkModule createNetworkModule(URI brokerUri, MqttConnectOptions options, String clientId) throws MqttException {<NEW_LINE>String host = brokerUri.getHost();<NEW_LINE>// -1 if not defined<NEW_LINE>int port = brokerUri.getPort();<NEW_LINE>if (port == -1) {<NEW_LINE>port = 1883;<NEW_LINE>}<NEW_LINE>String path = brokerUri.getPath();<NEW_LINE>if (path != null && !path.isEmpty()) {<NEW_LINE>throw new IllegalArgumentException(brokerUri.toString());<NEW_LINE>}<NEW_LINE>SocketFactory factory = options.getSocketFactory();<NEW_LINE>if (factory == null) {<NEW_LINE>factory = SocketFactory.getDefault();<NEW_LINE>} else if (factory instanceof SSLSocketFactory) {<NEW_LINE>throw ExceptionHelper.createMqttException(MqttException.REASON_CODE_SOCKET_FACTORY_MISMATCH);<NEW_LINE>}<NEW_LINE>TCPNetworkModule networkModule = new TCPNetworkModule(<MASK><NEW_LINE>networkModule.setConnectTimeout(options.getConnectionTimeout());<NEW_LINE>return networkModule;<NEW_LINE>}
|
factory, host, port, clientId);
|
1,500,238
|
public final <T> Lookup.Result<T> lookup(Lookup.Template<T> template) {<NEW_LINE>beforeLookupResult(template);<NEW_LINE>for (; ; ) {<NEW_LINE>AbstractLookup.ISE toRun = null;<NEW_LINE>AbstractLookup.Storage<?> t = enterStorage();<NEW_LINE>try {<NEW_LINE>Lookup.Result<T> prev = t.findResult(template);<NEW_LINE>if (prev != null) {<NEW_LINE>return prev;<NEW_LINE>}<NEW_LINE>R<T> r = new R<T>();<NEW_LINE>ReferenceToResult<T> newRef = new ReferenceToResult<T<MASK><NEW_LINE>newRef.next = t.registerReferenceToResult(newRef);<NEW_LINE>return r;<NEW_LINE>} catch (AbstractLookup.ISE ex) {<NEW_LINE>toRun = ex;<NEW_LINE>} finally {<NEW_LINE>exitStorage();<NEW_LINE>}<NEW_LINE>toRun.recover(this);<NEW_LINE>// and try again<NEW_LINE>}<NEW_LINE>}
|
>(r, this, template);
|
1,412,177
|
final UpdateNetworkAnalyzerConfigurationResult executeUpdateNetworkAnalyzerConfiguration(UpdateNetworkAnalyzerConfigurationRequest updateNetworkAnalyzerConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateNetworkAnalyzerConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateNetworkAnalyzerConfigurationRequest> request = null;<NEW_LINE>Response<UpdateNetworkAnalyzerConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateNetworkAnalyzerConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateNetworkAnalyzerConfigurationRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT Wireless");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateNetworkAnalyzerConfiguration");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateNetworkAnalyzerConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateNetworkAnalyzerConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>}
|
addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
|
1,576,934
|
public void resourceResourceIdDelete(String resourceId, String cookie, String ifMatch) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'resourceId' is set<NEW_LINE>if (resourceId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'resourceId' when calling resourceResourceIdDelete");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/resource/{resourceId}".replaceAll("\\{" + "resourceId" + "\\}", apiClient.escapeString(resourceId.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams <MASK><NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (cookie != null)<NEW_LINE>localVarHeaderParams.put("cookie", apiClient.parameterToString(cookie));<NEW_LINE>if (ifMatch != null)<NEW_LINE>localVarHeaderParams.put("If-Match", apiClient.parameterToString(ifMatch));<NEW_LINE>final String[] localVarAccepts = {};<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "bearerAuth" };<NEW_LINE>apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);<NEW_LINE>}
|
= new ArrayList<Pair>();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.