idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,210,370 | public static <T, V> Collection<V> collectIf(Iterable<T> iterable, Predicate<? super T> predicate, Function<? super T, ? extends V> function) {<NEW_LINE>if (iterable instanceof MutableCollection) {<NEW_LINE>return ((MutableCollection<T>) iterable).collectIf(predicate, function);<NEW_LINE>}<NEW_LINE>if (iterable instanceof ArrayList) {<NEW_LINE>return ArrayListIterate.collectIf((ArrayList<T>) iterable, predicate, function);<NEW_LINE>}<NEW_LINE>if (iterable instanceof List) {<NEW_LINE>return ListIterate.collectIf((List<T>) iterable, predicate, function);<NEW_LINE>}<NEW_LINE>if (iterable instanceof Collection) {<NEW_LINE>return IterableIterate.collectIf(iterable, predicate, function, DefaultSpeciesNewStrategy.INSTANCE.speciesNew((Collection<T>) iterable));<NEW_LINE>}<NEW_LINE>if (iterable != null) {<NEW_LINE>return IterableIterate.<MASK><NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("Cannot perform a collectIf on null");<NEW_LINE>} | collectIf(iterable, predicate, function); |
461,095 | private long restartInternal(long oldExecutionId, Properties restartParameters) throws JobExecutionAlreadyCompleteException, NoSuchJobExecutionException, JobExecutionNotMostRecentException, JobRestartException, JobSecurityException {<NEW_LINE>if (authService != null) {<NEW_LINE>authService.authorizedJobRestartByExecution(oldExecutionId);<NEW_LINE>}<NEW_LINE>if (logger.isLoggable(Level.FINE)) {<NEW_LINE>logger.fine("JobOperator restart, with old executionId = " + oldExecutionId + "\n" + traceJobParameters(restartParameters));<NEW_LINE>}<NEW_LINE>// Check if there are no job executions and step executions running.<NEW_LINE><MASK><NEW_LINE>// Set instance state to submitted to be consistent with start<NEW_LINE>long instanceId = getPersistenceManagerService().getJobInstanceIdFromExecutionId(oldExecutionId);<NEW_LINE>getPersistenceManagerService().updateJobInstanceOnRestart(instanceId, new Date());<NEW_LINE>WSJobExecution jobExecution = getPersistenceManagerService().createJobExecution(instanceId, restartParameters, new Date());<NEW_LINE>long newExecutionId = getBatchKernelService().restartJob(jobExecution.getExecutionId(), restartParameters).getKey();<NEW_LINE>if (logger.isLoggable(Level.FINE)) {<NEW_LINE>logger.fine("Restarted job with new executionId: " + newExecutionId + ", and old executionID: " + oldExecutionId);<NEW_LINE>}<NEW_LINE>return newExecutionId;<NEW_LINE>} | BatchStatusValidator.validateStatusAtExecutionRestart(oldExecutionId, restartParameters); |
1,585,752 | final CreateContactListResult executeCreateContactList(CreateContactListRequest createContactListRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createContactListRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateContactListRequest> request = null;<NEW_LINE>Response<CreateContactListResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateContactListRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createContactListRequest));<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, "SESv2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateContactList");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateContactListResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateContactListResultJsonUnmarshaller());<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 awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
812,342 | private void alterResourcesConfig(final String schemaName, final Map<String, YamlProxyDataSourceConfiguration> yamlDataSourceMap) throws DistSQLException {<NEW_LINE>Map<String, DataSourceProperties> toBeUpdatedResourcePropsMap = new LinkedHashMap<>(yamlDataSourceMap.size(), 1);<NEW_LINE>for (Entry<String, YamlProxyDataSourceConfiguration> each : yamlDataSourceMap.entrySet()) {<NEW_LINE>DataSourceProperties dataSourceProps = DataSourcePropertiesCreator.create(HikariDataSource.class.getName(), dataSourceConfigSwapper.swap<MASK><NEW_LINE>toBeUpdatedResourcePropsMap.put(each.getKey(), dataSourceProps);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>validator.validate(toBeUpdatedResourcePropsMap);<NEW_LINE>Collection<String> currentResourceNames = new LinkedList<>(ProxyContext.getInstance().getMetaData(schemaName).getResource().getDataSources().keySet());<NEW_LINE>Collection<String> toBeDroppedResourceNames = currentResourceNames.stream().filter(each -> !toBeUpdatedResourcePropsMap.containsKey(each)).collect(Collectors.toSet());<NEW_LINE>ProxyContext.getInstance().getContextManager().addResource(schemaName, toBeUpdatedResourcePropsMap);<NEW_LINE>if (toBeDroppedResourceNames.size() > 0) {<NEW_LINE>ProxyContext.getInstance().getContextManager().dropResource(schemaName, toBeDroppedResourceNames);<NEW_LINE>}<NEW_LINE>} catch (final SQLException ex) {<NEW_LINE>throw new InvalidResourcesException(toBeUpdatedResourcePropsMap.keySet());<NEW_LINE>}<NEW_LINE>} | (each.getValue())); |
1,078,202 | public static Map<String, Instant> readIndividualReplicaLastPasswordTimes(final PwmDomain pwmDomain, final SessionLabel sessionLabel, final UserIdentity userIdentity) throws PwmUnrecoverableException {<NEW_LINE>final Map<String, Instant> returnValue = new LinkedHashMap<>();<NEW_LINE>final ChaiProvider chaiProvider = pwmDomain.getProxyChaiProvider(sessionLabel, userIdentity.getLdapProfileID());<NEW_LINE>final Collection<ChaiConfiguration> perReplicaConfigs = ChaiUtility.splitConfigurationPerReplica(chaiProvider.getChaiConfiguration(), Collections.singletonMap(ChaiSetting.FAILOVER_CONNECT_RETRIES, "1"));<NEW_LINE>for (final ChaiConfiguration loopConfiguration : perReplicaConfigs) {<NEW_LINE>final String loopReplicaUrl = loopConfiguration.getSetting(ChaiSetting.BIND_DN);<NEW_LINE>ChaiProvider loopProvider = null;<NEW_LINE>try {<NEW_LINE>loopProvider = pwmDomain.getLdapConnectionService().<MASK><NEW_LINE>final Instant lastModifiedDate = determinePwdLastModified(pwmDomain, sessionLabel, userIdentity);<NEW_LINE>returnValue.put(loopReplicaUrl, lastModifiedDate);<NEW_LINE>} catch (final ChaiUnavailableException e) {<NEW_LINE>LOGGER.error(sessionLabel, () -> "unreachable server during replica password sync check");<NEW_LINE>} finally {<NEW_LINE>if (loopProvider != null) {<NEW_LINE>try {<NEW_LINE>loopProvider.close();<NEW_LINE>} catch (final Exception e) {<NEW_LINE>final String errorMsg = "error closing loopProvider to " + loopReplicaUrl + " while checking individual password sync status";<NEW_LINE>LOGGER.error(sessionLabel, () -> errorMsg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return returnValue;<NEW_LINE>} | getChaiProviderFactory().newProvider(loopConfiguration); |
1,020,351 | private void drawPathRelativeTicks(Canvas canvas, float x, float y) {<NEW_LINE>float x1 = mPoints[0];<NEW_LINE>float y1 = mPoints[1];<NEW_LINE>float x2 = mPoints[mPoints.length - 2];<NEW_LINE>float y2 = mPoints[mPoints.length - 1];<NEW_LINE>float dist = (float) Math.hypot(x1 - x2, y1 - y2);<NEW_LINE>float t = ((x - x1) * (x2 - x1) + (y - y1) * (y2 - y1)) / (dist * dist);<NEW_LINE>float xp = x1 + t * (x2 - x1);<NEW_LINE>float yp = y1 + t * (y2 - y1);<NEW_LINE>Path path = new Path();<NEW_LINE><MASK><NEW_LINE>path.lineTo(xp, yp);<NEW_LINE>float len = (float) Math.hypot(xp - x, yp - y);<NEW_LINE>String text = "" + ((int) (100 * len / dist)) / 100.0f;<NEW_LINE>getTextBounds(text, mTextPaint);<NEW_LINE>float off = len / 2 - mBounds.width() / 2;<NEW_LINE>canvas.drawTextOnPath(text, path, off, -20, mTextPaint);<NEW_LINE>canvas.drawLine(x, y, xp, yp, mPaintGraph);<NEW_LINE>} | path.moveTo(x, y); |
1,284,230 | public static Map<SubqueryLabel, RexPermuteInputsShuttle> mergePullUpSubqueryPredicates(Map<RexSubQuery, SubqueryLabel> subqueryLabelMap, List<RelDataTypeField> outFields, List<Pair<Label, ImmutableBitSet>> outInputBitSets, List<RexNode> outPredicates) {<NEW_LINE>// Put all columns and predicates together<NEW_LINE>final Map<SubqueryLabel, RexPermuteInputsShuttle> inputPermuteMap = new HashMap<>();<NEW_LINE>for (Entry<RexSubQuery, SubqueryLabel> entry : subqueryLabelMap.entrySet()) {<NEW_LINE>final SubqueryLabel subquery = entry.getValue();<NEW_LINE>final RelDataType subqueryRowType = subquery.getRowType();<NEW_LINE>final int leftCount = outFields.size();<NEW_LINE>final int rightCount = subqueryRowType.getFieldCount();<NEW_LINE>final RexPermuteInputsShuttle permute = RexPermuteInputsShuttle.of(Mappings.createShiftMapping(rightCount, leftCount, 0, rightCount));<NEW_LINE>// Add inferred correlation conditions<NEW_LINE>Optional.ofNullable(subquery.getInferredCorrelateCondition()).ifPresent(preds -> preds.getPredicates().forEach(p -> outPredicates.add(p.accept(permute))));<NEW_LINE>// Pull up predicates from subquery<NEW_LINE>Optional.ofNullable(subquery.getPullUp()).ifPresent(p -> p.forEach((digest, pullUp) -> RelOptUtil.decomposeConjunction(pullUp.accept(permute), outPredicates)));<NEW_LINE>// Generate permutations for pull up inferred predicates<NEW_LINE>outFields.addAll(subqueryRowType.getFieldList());<NEW_LINE>outInputBitSets.add(Pair.of(subquery, ImmutableBitSet.range(<MASK><NEW_LINE>inputPermuteMap.put(subquery, RexPermuteInputsShuttle.of(Mappings.createShiftMapping(leftCount + rightCount, 0, leftCount, rightCount)));<NEW_LINE>}<NEW_LINE>return inputPermuteMap;<NEW_LINE>} | leftCount, leftCount + rightCount))); |
356,300 | public void publishAdditionalModelData(JavaSparkContext sparkContext, PMML pmml, JavaRDD<String> newData, JavaRDD<String> pastData, Path modelParentPath, TopicProducer<String, String> modelUpdateTopic) {<NEW_LINE>// Send item updates first, before users. That way, user-based endpoints like /recommend<NEW_LINE>// may take longer to not return 404, but when they do, the result will be more complete.<NEW_LINE>log.info("Sending item / Y data as model updates");<NEW_LINE>String yPathString = AppPMMLUtils.getExtensionValue(pmml, "Y");<NEW_LINE>JavaPairRDD<String, float[]> productRDD = readFeaturesRDD(sparkContext, new Path(modelParentPath, yPathString));<NEW_LINE>String updateBroker = modelUpdateTopic.getUpdateBroker();<NEW_LINE><MASK><NEW_LINE>// For now, there is no use in sending known users for each item<NEW_LINE>productRDD.foreachPartition(new EnqueueFeatureVecsFn("Y", updateBroker, topic));<NEW_LINE>log.info("Sending user / X data as model updates");<NEW_LINE>String xPathString = AppPMMLUtils.getExtensionValue(pmml, "X");<NEW_LINE>JavaPairRDD<String, float[]> userRDD = readFeaturesRDD(sparkContext, new Path(modelParentPath, xPathString));<NEW_LINE>if (noKnownItems) {<NEW_LINE>userRDD.foreachPartition(new EnqueueFeatureVecsFn("X", updateBroker, topic));<NEW_LINE>} else {<NEW_LINE>log.info("Sending known item data with model updates");<NEW_LINE>JavaRDD<String[]> allData = (pastData == null ? newData : newData.union(pastData)).map(MLFunctions.PARSE_FN);<NEW_LINE>JavaPairRDD<String, Collection<String>> knownItems = knownsRDD(allData, true);<NEW_LINE>userRDD.join(knownItems).foreachPartition(new EnqueueFeatureVecsAndKnownItemsFn("X", updateBroker, topic));<NEW_LINE>}<NEW_LINE>} | String topic = modelUpdateTopic.getTopic(); |
1,228,898 | public static void register(MetricsRegistry metricsRegistry) {<NEW_LINE>checkNotNull(metricsRegistry, "metricsRegistry");<NEW_LINE>OperatingSystemMXBean mxBean = ManagementFactory.getOperatingSystemMXBean();<NEW_LINE>registerMethod(<MASK><NEW_LINE>registerMethod(metricsRegistry, mxBean, "getFreePhysicalMemorySize", OS_FULL_METRIC_FREE_PHYSICAL_MEMORY_SIZE);<NEW_LINE>registerMethod(metricsRegistry, mxBean, "getFreeSwapSpaceSize", OS_FULL_METRIC_FREE_SWAP_SPACE_SIZE);<NEW_LINE>registerMethod(metricsRegistry, mxBean, "getProcessCpuTime", OS_FULL_METRIC_PROCESS_CPU_TIME);<NEW_LINE>registerMethod(metricsRegistry, mxBean, "getTotalPhysicalMemorySize", OS_FULL_METRIC_TOTAL_PHYSICAL_MEMORY_SIZE);<NEW_LINE>registerMethod(metricsRegistry, mxBean, "getTotalSwapSpaceSize", OS_FULL_METRIC_TOTAL_SWAP_SPACE_SIZE);<NEW_LINE>registerMethod(metricsRegistry, mxBean, "getMaxFileDescriptorCount", OS_FULL_METRIC_MAX_FILE_DESCRIPTOR_COUNT);<NEW_LINE>registerMethod(metricsRegistry, mxBean, "getOpenFileDescriptorCount", OS_FULL_METRIC_OPEN_FILE_DESCRIPTOR_COUNT);<NEW_LINE>// value will be between 0.0 and 1.0 or a negative value, if not available<NEW_LINE>registerMethod(metricsRegistry, mxBean, "getProcessCpuLoad", OS_FULL_METRIC_PROCESS_CPU_LOAD, PERCENTAGE_MULTIPLIER);<NEW_LINE>// value will be between 0.0 and 1.0 or a negative value, if not available<NEW_LINE>registerMethod(metricsRegistry, mxBean, "getSystemCpuLoad", OS_FULL_METRIC_SYSTEM_CPU_LOAD, PERCENTAGE_MULTIPLIER);<NEW_LINE>metricsRegistry.registerStaticProbe(mxBean, OS_FULL_METRIC_SYSTEM_LOAD_AVERAGE, MANDATORY, OperatingSystemMXBean::getSystemLoadAverage);<NEW_LINE>} | metricsRegistry, mxBean, "getCommittedVirtualMemorySize", OS_FULL_METRIC_COMMITTED_VIRTUAL_MEMORY_SIZE); |
1,016,489 | public List<JPACompletionItem> doCompletion(CompletionContext context) {<NEW_LINE>List<JPACompletionItem> results <MASK><NEW_LINE>int caretOffset = context.getCaretOffset();<NEW_LINE>String typedChars = context.getTypedPrefix();<NEW_LINE>String providerClass = getProviderClass(context.getTag());<NEW_LINE>Project enclosingProject = FileOwnerQuery.getOwner(NbEditorUtilities.getFileObject(context.getDocument()));<NEW_LINE>Provider provider = ProviderUtil.getProvider(providerClass, enclosingProject);<NEW_LINE>ArrayList<String> keys = new ArrayList<String>();<NEW_LINE>String ver = provider == null ? context.getDocumentContext().getVersion() : ProviderUtil.getVersion(provider);<NEW_LINE>if (provider == null || (ver != null && !Persistence.VERSION_1_0.equals(ver))) {<NEW_LINE>keys.addAll(allKeyAndValues.get(null).keySet());<NEW_LINE>}<NEW_LINE>if (provider != null && allKeyAndValues.get(provider) != null) {<NEW_LINE>keys.addAll(allKeyAndValues.get(provider).keySet());<NEW_LINE>}<NEW_LINE>String[] itemTexts = keys.toArray(new String[] {});<NEW_LINE>for (int i = 0; i < itemTexts.length; i++) {<NEW_LINE>if (itemTexts[i].startsWith(typedChars.trim()) || itemTexts[i].startsWith("javax.persistence." + typedChars.trim())) {<NEW_LINE>// NOI18N<NEW_LINE>JPACompletionItem item = JPACompletionItem.createAttribValueItem(caretOffset - typedChars.length(), itemTexts[i]);<NEW_LINE>results.add(item);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setAnchorOffset(context.getCurrentTokenOffset() + 1);<NEW_LINE>return results;<NEW_LINE>} | = new ArrayList<JPACompletionItem>(); |
813,375 | CompletableFuture<Channel> initTls(Channel ch, InetSocketAddress sniHost) {<NEW_LINE>Objects.requireNonNull(ch, "A channel is required");<NEW_LINE>Objects.requireNonNull(sniHost, "A sniHost is required");<NEW_LINE>if (!tlsEnabled) {<NEW_LINE>throw new IllegalStateException("TLS is not enabled in client configuration");<NEW_LINE>}<NEW_LINE>CompletableFuture<Channel> initTlsFuture = new CompletableFuture<>();<NEW_LINE>ch.eventLoop().execute(() -> {<NEW_LINE>try {<NEW_LINE>SslHandler handler = tlsEnabledWithKeyStore ? new SslHandler(nettySSLContextAutoRefreshBuilder.get().createSSLEngine(sniHost.getHostString(), sniHost.getPort())) : sslContextSupplier.get().newHandler(ch.alloc(), sniHost.getHostString(<MASK><NEW_LINE>ch.pipeline().addFirst(TLS_HANDLER, handler);<NEW_LINE>initTlsFuture.complete(ch);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>initTlsFuture.completeExceptionally(t);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return initTlsFuture;<NEW_LINE>} | ), sniHost.getPort()); |
1,315,096 | protected void reset(@Nonnull LayoutImpl component) {<NEW_LINE>UISettings settings = UISettings.getInstance();<NEW_LINE>component.myFontCombo.setValue(settings.FONT_FACE);<NEW_LINE>component.myAntialiasingInIDE.setValue(settings.IDE_AA_TYPE);<NEW_LINE>component.myAntialiasingInEditor.setValue(settings.EDITOR_AA_TYPE);<NEW_LINE>component.myFontSizeCombo.setValue(Integer<MASK><NEW_LINE>component.myPresentationModeFontSize.setValue(Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE));<NEW_LINE>component.myAnimateWindowsCheckBox.setValue(settings.ANIMATE_WINDOWS);<NEW_LINE>component.myWindowShortcutsCheckBox.setValue(settings.SHOW_TOOL_WINDOW_NUMBERS);<NEW_LINE>component.myShowToolStripesCheckBox.setValue(!settings.HIDE_TOOL_STRIPES);<NEW_LINE>component.myCbDisplayIconsInMenu.setValue(settings.SHOW_ICONS_IN_MENUS);<NEW_LINE>component.myAllowMergeButtons.setValue(settings.ALLOW_MERGE_BUTTONS);<NEW_LINE>component.myCycleScrollingCheckBox.setValue(settings.CYCLE_SCROLLING);<NEW_LINE>component.myHideIconsInQuickNavigation.setValue(settings.SHOW_ICONS_IN_QUICK_NAVIGATION);<NEW_LINE>component.myMoveMouseOnDefaultButtonCheckBox.setValue(settings.MOVE_MOUSE_ON_DEFAULT_BUTTON);<NEW_LINE>component.myHideNavigationPopupsCheckBox.setValue(settings.HIDE_NAVIGATION_ON_FOCUS_LOSS);<NEW_LINE>component.myAltDNDCheckBox.setValue(settings.DND_WITH_PRESSED_ALT_ONLY);<NEW_LINE>component.myLafComboBox.setValue(StyleManager.get().getCurrentStyle());<NEW_LINE>component.myOverrideLAFFonts.setValue(settings.OVERRIDE_NONIDEA_LAF_FONTS);<NEW_LINE>component.myDisableMnemonics.setValue(settings.DISABLE_MNEMONICS);<NEW_LINE>component.myUseSmallLabelsOnTabs.setValue(settings.USE_SMALL_LABELS_ON_TABS);<NEW_LINE>component.myWidescreenLayoutCheckBox.setValue(settings.WIDESCREEN_SUPPORT);<NEW_LINE>component.myLeftLayoutCheckBox.setValue(settings.LEFT_HORIZONTAL_SPLIT);<NEW_LINE>component.myRightLayoutCheckBox.setValue(settings.RIGHT_HORIZONTAL_SPLIT);<NEW_LINE>component.myEditorTooltipCheckBox.setValue(settings.SHOW_EDITOR_TOOLTIP);<NEW_LINE>component.myDisableMnemonicInControlsCheckBox.setValue(settings.DISABLE_MNEMONICS_IN_CONTROLS);<NEW_LINE>component.mySmoothScrollingBox.setValue(settings.SMOOTH_SCROLLING);<NEW_LINE>component.myIconThemeComboBox.setValue(getActiveIconLibraryOrNull());<NEW_LINE>} | .toString(settings.FONT_SIZE)); |
1,180,391 | public MappingStore match(Tree src, Tree dst, MappingStore mappings) {<NEW_LINE>List<Mapping> leavesMappings = new ArrayList<>();<NEW_LINE>List<Tree> dstLeaves = retainLeaves(TreeUtils.postOrder(dst));<NEW_LINE>for (Iterator<Tree> srcLeaves = TreeUtils.leafIterator(TreeUtils.postOrderIterator(src)); srcLeaves.hasNext(); ) {<NEW_LINE>Tree srcLeaf = srcLeaves.next();<NEW_LINE>for (Tree dstLeaf : dstLeaves) {<NEW_LINE>if (mappings.isMappingAllowed(srcLeaf, dstLeaf)) {<NEW_LINE>double sim = StringMetrics.qGramsDistance().compare(srcLeaf.getLabel(), dstLeaf.getLabel());<NEW_LINE>if (sim > labelSimThreshold)<NEW_LINE>leavesMappings.add(new Mapping(srcLeaf, dstLeaf));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Set<Tree> ignoredSrcTrees = new HashSet<>();<NEW_LINE>Set<Tree> ignoredDstTrees = new HashSet<>();<NEW_LINE>Collections.sort(leavesMappings, new LeafMappingComparator());<NEW_LINE>while (leavesMappings.size() > 0) {<NEW_LINE>Mapping bestMapping = leavesMappings.remove(0);<NEW_LINE>if (!(ignoredSrcTrees.contains(bestMapping.first) || ignoredDstTrees.contains(bestMapping.second))) {<NEW_LINE>mappings.addMapping(bestMapping.first, bestMapping.second);<NEW_LINE><MASK><NEW_LINE>ignoredDstTrees.add(bestMapping.second);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return mappings;<NEW_LINE>} | ignoredSrcTrees.add(bestMapping.first); |
1,608,876 | public static ListFlowJobResponse unmarshall(ListFlowJobResponse listFlowJobResponse, UnmarshallerContext _ctx) {<NEW_LINE>listFlowJobResponse.setRequestId(_ctx.stringValue("ListFlowJobResponse.RequestId"));<NEW_LINE>listFlowJobResponse.setPageNumber(_ctx.integerValue("ListFlowJobResponse.PageNumber"));<NEW_LINE>listFlowJobResponse.setPageSize(_ctx.integerValue("ListFlowJobResponse.PageSize"));<NEW_LINE>listFlowJobResponse.setTotal(_ctx.integerValue("ListFlowJobResponse.Total"));<NEW_LINE>List<Job> jobList = new ArrayList<Job>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListFlowJobResponse.JobList.Length"); i++) {<NEW_LINE>Job job = new Job();<NEW_LINE>job.setId(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Id"));<NEW_LINE>job.setGmtCreate(_ctx.longValue<MASK><NEW_LINE>job.setGmtModified(_ctx.longValue("ListFlowJobResponse.JobList[" + i + "].GmtModified"));<NEW_LINE>job.setName(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Name"));<NEW_LINE>job.setType(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Type"));<NEW_LINE>job.setDescription(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Description"));<NEW_LINE>job.setFailAct(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].FailAct"));<NEW_LINE>job.setMaxRetry(_ctx.integerValue("ListFlowJobResponse.JobList[" + i + "].MaxRetry"));<NEW_LINE>job.setRetryInterval(_ctx.longValue("ListFlowJobResponse.JobList[" + i + "].RetryInterval"));<NEW_LINE>job.setParams(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Params"));<NEW_LINE>job.setParamConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].ParamConf"));<NEW_LINE>job.setCustomVariables(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].CustomVariables"));<NEW_LINE>job.setEnvConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].EnvConf"));<NEW_LINE>job.setRunConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].RunConf"));<NEW_LINE>job.setMonitorConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].MonitorConf"));<NEW_LINE>job.setCategoryId(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].CategoryId"));<NEW_LINE>job.setMode(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].mode"));<NEW_LINE>job.setAdhoc(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].Adhoc"));<NEW_LINE>job.setAlertConf(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].AlertConf"));<NEW_LINE>job.setLastInstanceDetail(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].LastInstanceDetail"));<NEW_LINE>List<Resource> resourceList = new ArrayList<Resource>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("ListFlowJobResponse.JobList[" + i + "].ResourceList.Length"); j++) {<NEW_LINE>Resource resource = new Resource();<NEW_LINE>resource.setPath(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].ResourceList[" + j + "].Path"));<NEW_LINE>resource.setAlias(_ctx.stringValue("ListFlowJobResponse.JobList[" + i + "].ResourceList[" + j + "].Alias"));<NEW_LINE>resourceList.add(resource);<NEW_LINE>}<NEW_LINE>job.setResourceList(resourceList);<NEW_LINE>jobList.add(job);<NEW_LINE>}<NEW_LINE>listFlowJobResponse.setJobList(jobList);<NEW_LINE>return listFlowJobResponse;<NEW_LINE>} | ("ListFlowJobResponse.JobList[" + i + "].GmtCreate")); |
1,841,694 | private void processA() {<NEW_LINE>reclaimDisposedBuffers();<NEW_LINE>decodingView.undecodedLimit = buffer.position();<NEW_LINE>decode();<NEW_LINE>decodingView.unconsumedOffset += consumeA();<NEW_LINE>// Resize region A<NEW_LINE>regionA.setOffsetAndLimit((undisposedDataOffset >= 0) ? undisposedDataOffset : decodingView.unconsumedOffset, decodingView.undecodedLimit);<NEW_LINE>if (regionA.offset == regionA.limit) {<NEW_LINE>// All data has been consumed, we can reset region A and decoding view<NEW_LINE>buffer.limit(buffer.capacity());<NEW_LINE>buffer.position(0);<NEW_LINE><MASK><NEW_LINE>decodingView.unconsumedOffset = 0;<NEW_LINE>decodingView.undecodedOffset = 0;<NEW_LINE>decodingView.undecodedLimit = 0;<NEW_LINE>} else {<NEW_LINE>// We need to compare the amount of free space<NEW_LINE>// to the left and to the right of region A<NEW_LINE>// and create region B, if there's more free space<NEW_LINE>// to the left than to the right<NEW_LINE>int freeSpaceBeforeOffset = regionA.offset - 1;<NEW_LINE>int freeSpaceAfterLimit = buffer.capacity() - regionA.limit;<NEW_LINE>if (freeSpaceBeforeOffset > freeSpaceAfterLimit) {<NEW_LINE>regionB = new Region(0, 0);<NEW_LINE>decodingView.undecodedOffset = regionB.offset;<NEW_LINE>decodingView.undecodedLimit = regionB.limit;<NEW_LINE>// Adjust buffer's position and limit,<NEW_LINE>// so that it would be possible to append new data to it<NEW_LINE>buffer.limit(regionA.offset - 1);<NEW_LINE>buffer.position(0);<NEW_LINE>} else {<NEW_LINE>buffer.limit(buffer.capacity());<NEW_LINE>buffer.position(decodingView.undecodedLimit);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | regionA.setOffsetAndLimit(0, 0); |
820,858 | public boolean apply(Game game, Ability source) {<NEW_LINE>Permanent permanent = game.getPermanent(source.getFirstTarget());<NEW_LINE>if (permanent != null) {<NEW_LINE>ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn);<NEW_LINE>effect.setTargetPointer(new FixedTarget(permanent, game));<NEW_LINE>game.addEffect(effect, source);<NEW_LINE>permanent.untap(game);<NEW_LINE>effect = new GainAbilityTargetEffect(HasteAbility.<MASK><NEW_LINE>effect.setTargetPointer(new FixedTarget(permanent, game));<NEW_LINE>game.addEffect(effect, source);<NEW_LINE>}<NEW_LINE>Permanent permanent2 = game.getPermanent(source.getTargets().get(1).getFirstTarget());<NEW_LINE>if (permanent2 != null) {<NEW_LINE>permanent2.damage(2, source.getSourceId(), source, game);<NEW_LINE>} else {<NEW_LINE>Player player = game.getPlayer(source.getTargets().get(1).getFirstTarget());<NEW_LINE>if (player != null) {<NEW_LINE>player.damage(2, source.getSourceId(), source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | getInstance(), Duration.EndOfTurn); |
1,846,320 | public static byte[] convertPrivateKey(byte[] keySpec) {<NEW_LINE>if (keySpec == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>byte[] bytes = new byte[keySpec.length];<NEW_LINE>System.arraycopy(keySpec, 0, bytes, 0, keySpec.length);<NEW_LINE>byte<MASK><NEW_LINE>byte[] oidBytes = encodeOID(RSA_ENCRYPTION);<NEW_LINE>byte[] verBytes = { 0x02, 0x01, 0x00 };<NEW_LINE>byte[][] seqBytes = new byte[4][];<NEW_LINE>seqBytes[0] = oidBytes;<NEW_LINE>seqBytes[1] = NULL_BYTES;<NEW_LINE>seqBytes[2] = null;<NEW_LINE>byte[] oidSeqBytes = encodeSequence(seqBytes);<NEW_LINE>seqBytes[0] = verBytes;<NEW_LINE>seqBytes[1] = oidSeqBytes;<NEW_LINE>seqBytes[2] = octetBytes;<NEW_LINE>seqBytes[3] = null;<NEW_LINE>return encodeSequence(seqBytes);<NEW_LINE>} | [] octetBytes = encodeOctetString(bytes); |
1,850,121 | // DO NOT MODIFY THIS CODE, GENERATED AUTOMATICALLY<NEW_LINE>public static com.sun.jdi.ThreadReference thread(com.sun.jdi.event.MonitorWaitEvent a) throws org.netbeans.modules.debugger.jpda.jdi.InternalExceptionWrapper, org.netbeans.modules.debugger.jpda.jdi.VMDisconnectedExceptionWrapper {<NEW_LINE>if (org.netbeans.modules.debugger.jpda.JDIExceptionReporter.isLoggable()) {<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.logCallStart("com.sun.jdi.event.MonitorWaitEvent", "thread", "JDI CALL: com.sun.jdi.event.MonitorWaitEvent({0}).thread()", new Object[] { a });<NEW_LINE>}<NEW_LINE>Object retValue = null;<NEW_LINE>try {<NEW_LINE>com.sun.jdi.ThreadReference ret;<NEW_LINE>ret = a.thread();<NEW_LINE>retValue = ret;<NEW_LINE>return ret;<NEW_LINE>} catch (com.sun.jdi.InternalException ex) {<NEW_LINE>retValue = ex;<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.report(ex);<NEW_LINE>throw new org.netbeans.modules.debugger.jpda.jdi.InternalExceptionWrapper(ex);<NEW_LINE>} catch (com.sun.jdi.VMDisconnectedException ex) {<NEW_LINE>retValue = ex;<NEW_LINE>if (a instanceof com.sun.jdi.Mirror) {<NEW_LINE>com.sun.jdi.VirtualMachine vm = ((com.sun.jdi.Mirror) a).virtualMachine();<NEW_LINE>try {<NEW_LINE>vm.dispose();<NEW_LINE>} catch (com.sun.jdi.VMDisconnectedException vmdex) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new org.netbeans.modules.debugger.jpda.jdi.VMDisconnectedExceptionWrapper(ex);<NEW_LINE>} catch (Error err) {<NEW_LINE>retValue = err;<NEW_LINE>throw err;<NEW_LINE>} catch (RuntimeException rex) {<NEW_LINE>retValue = rex;<NEW_LINE>throw rex;<NEW_LINE>} finally {<NEW_LINE>if (org.netbeans.modules.debugger.jpda.JDIExceptionReporter.isLoggable()) {<NEW_LINE>org.netbeans.modules.debugger.jpda.JDIExceptionReporter.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | logCallEnd("com.sun.jdi.event.MonitorWaitEvent", "thread", retValue); |
703,388 | private ExternallyReferencedCandidate forRecord(@NonNull final I_C_Invoice_Candidate icRecord) {<NEW_LINE>final ExternallyReferencedCandidateBuilder candidate = ExternallyReferencedCandidate.builder();<NEW_LINE>candidate.orgId(OrgId.ofRepoId(icRecord.getAD_Org_ID())).id(InvoiceCandidateId.ofRepoId(icRecord.getC_Invoice_Candidate_ID())).externalHeaderId(ExternalId.ofOrNull(icRecord.getExternalHeaderId())).externalLineId(ExternalId.ofOrNull(icRecord.getExternalLineId()));<NEW_LINE>candidate.poReference(icRecord.getPOReference());<NEW_LINE>final BPartnerId bpartnerId = BPartnerId.ofRepoId(icRecord.getBill_BPartner_ID());<NEW_LINE>final BPartnerInfo bpartnerInfo = BPartnerInfo.builder().bpartnerId(bpartnerId).bpartnerLocationId(BPartnerLocationId.ofRepoId(bpartnerId, icRecord.getBill_Location_ID())).contactId(BPartnerContactId.ofRepoIdOrNull(bpartnerId, icRecord.getBill_User_ID<MASK><NEW_LINE>candidate.billPartnerInfo(bpartnerInfo);<NEW_LINE>candidate.dateOrdered(TimeUtil.asLocalDate(icRecord.getDateOrdered()));<NEW_LINE>candidate.presetDateInvoiced(TimeUtil.asLocalDate(icRecord.getPresetDateInvoiced()));<NEW_LINE>candidate.invoiceRule(InvoiceRule.ofCode(icRecord.getInvoiceRule())).invoiceRuleOverride(InvoiceRule.ofNullableCode(icRecord.getInvoiceRule_Override()));<NEW_LINE>// the column is not mandatory in the DB, but still<NEW_LINE>final ProductId productId = ProductId.ofRepoId(icRecord.getM_Product_ID());<NEW_LINE>candidate.productId(productId);<NEW_LINE>candidate.pricingSystemId(PricingSystemId.ofRepoId(icRecord.getM_PricingSystem_ID())).priceListVersionId(PriceListVersionId.ofRepoIdOrNull(icRecord.getM_PriceList_Version_ID()));<NEW_LINE>final ProductPrice priceEntered = invoiceCandBL.getPriceEntered(icRecord);<NEW_LINE>candidate.priceEntered(priceEntered);<NEW_LINE>final ProductPrice priceEnteredOverride = invoiceCandBL.getPriceEnteredOverride(icRecord).orElse(null);<NEW_LINE>candidate.priceEnteredOverride(priceEnteredOverride);<NEW_LINE>candidate.discount(Percent.ofNullable(icRecord.getDiscount())).discountOverride(Percent.ofNullable(icRecord.getDiscount_Override()));<NEW_LINE>candidate.priceActual(invoiceCandBL.getPriceActual(icRecord));<NEW_LINE>final StockQtyAndUOMQty qtyDelivered = StockQtyAndUOMQtys.create(icRecord.getQtyDelivered(), productId, icRecord.getQtyDeliveredInUOM(), UomId.ofRepoId(icRecord.getC_UOM_ID()));<NEW_LINE>candidate.qtyDelivered(qtyDelivered);<NEW_LINE>final StockQtyAndUOMQty qtyOrdered = StockQtyAndUOMQtys.create(icRecord.getQtyOrdered(), productId, icRecord.getQtyEntered(), UomId.ofRepoId(icRecord.getC_UOM_ID()));<NEW_LINE>candidate.qtyOrdered(qtyOrdered);<NEW_LINE>candidate.soTrx(SOTrx.ofBoolean(icRecord.isSOTrx()));<NEW_LINE>candidate.invoiceDocTypeId(DocTypeId.ofRepoIdOrNull(icRecord.getC_DocTypeInvoice_ID()));<NEW_LINE>candidate.invoicingUomId(UomId.ofRepoId(icRecord.getC_UOM_ID()));<NEW_LINE>candidate.lineDescription(icRecord.getDescription());<NEW_LINE>candidate.taxId(TaxId.ofRepoId(icRecord.getC_Tax_ID()));<NEW_LINE>return candidate.build();<NEW_LINE>} | ())).build(); |
1,511,567 | public void actionPerformed(ActionEvent arg0) {<NEW_LINE>try {<NEW_LINE>FileDialog fileDialog = new FileDialog(MainFrame.get(), "Load Gcode Profile From...", FileDialog.LOAD);<NEW_LINE>fileDialog.setFilenameFilter(new FilenameFilter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean accept(File dir, String name) {<NEW_LINE>return name.toLowerCase().endsWith(".xml");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>fileDialog.setVisible(true);<NEW_LINE>String filename = fileDialog.getFile();<NEW_LINE>File file = new File(new File(fileDialog.getDirectory()), filename);<NEW_LINE>Serializer ser = Configuration.createSerializer();<NEW_LINE>FileReader r = new FileReader(file);<NEW_LINE>GcodeDriver d = ser.read(GcodeDriver.class, r);<NEW_LINE>// copySettings(d, driver);<NEW_LINE>} catch (Exception e) {<NEW_LINE>MessageBoxes.errorBox(MainFrame.<MASK><NEW_LINE>}<NEW_LINE>} | get(), "Import Failed", e); |
914,209 | protected void closeSheet() {<NEW_LINE>if (sheetHelper != null) {<NEW_LINE>XlsReportConfiguration configuration = getCurrentItemConfiguration();<NEW_LINE>boolean isIgnorePageMargins = configuration.isIgnorePageMargins();<NEW_LINE>if (currentSheetFirstPageNumber != null && currentSheetFirstPageNumber > 0) {<NEW_LINE>sheetHelper.exportFooter(sheetIndex, oldPageFormat == null ? pageFormat : oldPageFormat, isIgnorePageMargins, sheetAutoFilter, currentSheetPageScale, currentSheetFirstPageNumber, false, pageIndex - <MASK><NEW_LINE>firstPageNotSet = false;<NEW_LINE>} else {<NEW_LINE>Integer documentFirstPageNumber = configuration.getFirstPageNumber();<NEW_LINE>if (documentFirstPageNumber != null && documentFirstPageNumber > 0 && firstPageNotSet) {<NEW_LINE>sheetHelper.exportFooter(sheetIndex, oldPageFormat == null ? pageFormat : oldPageFormat, isIgnorePageMargins, sheetAutoFilter, currentSheetPageScale, documentFirstPageNumber, false, pageIndex - sheetInfo.sheetFirstPageIndex, sheetInfo.printSettings);<NEW_LINE>firstPageNotSet = false;<NEW_LINE>} else {<NEW_LINE>sheetHelper.exportFooter(sheetIndex, oldPageFormat == null ? pageFormat : oldPageFormat, isIgnorePageMargins, sheetAutoFilter, currentSheetPageScale, null, firstPageNotSet, pageIndex - sheetInfo.sheetFirstPageIndex, sheetInfo.printSettings);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (sheetAutoFilter != null) {<NEW_LINE>int index = Math.max(0, sheetIndex - 1);<NEW_LINE>definedNames.append("<definedName name=\"_xlnm._FilterDatabase\" localSheetId=\"" + index + "\">'" + JRStringUtil.xmlEncode(currentSheetName) + "'!" + sheetAutoFilter + "</definedName>\n");<NEW_LINE>}<NEW_LINE>sheetHelper.close();<NEW_LINE>sheetRelsHelper.exportFooter();<NEW_LINE>sheetRelsHelper.close();<NEW_LINE>drawingHelper.exportFooter();<NEW_LINE>drawingHelper.close();<NEW_LINE>drawingRelsHelper.exportFooter();<NEW_LINE>drawingRelsHelper.close();<NEW_LINE>}<NEW_LINE>} | sheetInfo.sheetFirstPageIndex, sheetInfo.printSettings); |
568,856 | public final RolloutMigrationConfig init(final String[] args) {<NEW_LINE>final CommandLineParser parser = new DefaultParser();<NEW_LINE>final CommandLine cmd;<NEW_LINE>try {<NEW_LINE>cmd = parser.parse(options, args);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>logger.error(e.getLocalizedMessage() + "\n\n" + printHelpToString());<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>final boolean printHelp = cmd.hasOption(OPTION_Help);<NEW_LINE>if (printHelp) {<NEW_LINE>printHelp(System.out);<NEW_LINE>return RolloutMigrationConfig.builder().rolloutDirName("not relevant").canRun(false).build();<NEW_LINE>}<NEW_LINE>final RolloutMigrationConfigBuilder configBuilder = RolloutMigrationConfig.builder();<NEW_LINE>final String rolloutDir = cmd.getOptionValue(OPTION_RolloutDirectory, DEFAULT_RolloutDirectory);<NEW_LINE>configBuilder.rolloutDirName(stripQuotes(rolloutDir));<NEW_LINE>final String settingsFile = cmd.getOptionValue(OPTION_SettingsFile);<NEW_LINE>configBuilder.dataBaseSettingsFile(stripQuotes(settingsFile));<NEW_LINE>final String scriptFile = cmd.getOptionValue(OPTION_ScriptFile);<NEW_LINE>configBuilder.scriptFileName(stripQuotes(scriptFile));<NEW_LINE>final boolean justMarkScriptAsExecuted = cmd.hasOption(OPTION_JustMarkScriptAsExecuted);<NEW_LINE>configBuilder.justMarkScriptAsExecuted(justMarkScriptAsExecuted);<NEW_LINE>final String[] optionValues = cmd.getOptionValues(OPTION_CreateNewDB);<NEW_LINE>if (optionValues != null) {<NEW_LINE>configBuilder.templateDBName(optionValues[0]);<NEW_LINE>configBuilder.newDBName(optionValues[1]);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(OPTION_Interactive)) {<NEW_LINE>logger.info("Interactive mode: true");<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (cmd.hasOption(OPTION_DoNotCheckVersions)) {<NEW_LINE>logger.info("Will *not* attempt to compare DB Versions");<NEW_LINE>configBuilder.checkVersions(false);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(OPTION_DoNotFailIfRolloutIsGreaterThanDB)) {<NEW_LINE>logger.info("Will *not* fail if the DB's version is greater than our own version");<NEW_LINE>configBuilder.failIfRolloutIsGreaterThanDB(false);<NEW_LINE>}<NEW_LINE>if (cmd.hasOption(OPTION_DoNotStoreVersion)) {<NEW_LINE>logger.info("Will *not* attempt to update the DB's version after rollout");<NEW_LINE>configBuilder.storeVersion(false);<NEW_LINE>}<NEW_LINE>configBuilder.additionalSqlDirs(extractAdditionalSqlDirs(cmd));<NEW_LINE>final RolloutMigrationConfig config = configBuilder.canRun(true).build();<NEW_LINE>logger.info("config={}", config);<NEW_LINE>return config;<NEW_LINE>} | configBuilder.scriptsApplierListener(ConsoleScriptsApplierListener.instance); |
954,437 | public void addMapperAnnotations(Interface interfaze, Method method) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Select"));<NEW_LINE>buildInitialSelectAnnotationStrings().forEach(method::addAnnotation);<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>javaIndent(sb, 1);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>sb.append("\"from ");<NEW_LINE>sb.append(escapeStringForJava(introspectedTable.getAliasedFullyQualifiedTableNameAtRuntime()));<NEW_LINE>// $NON-NLS-1$<NEW_LINE>sb.append("\",");<NEW_LINE>method.<MASK><NEW_LINE>buildByPrimaryKeyWhereClause().forEach(method::addAnnotation);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>method.addAnnotation("})");<NEW_LINE>if (useResultMapIfAvailable) {<NEW_LINE>if (introspectedTable.getRules().generateBaseResultMap() || introspectedTable.getRules().generateResultMapWithBLOBs()) {<NEW_LINE>addResultMapAnnotation(method);<NEW_LINE>} else {<NEW_LINE>addAnnotatedResults(interfaze, method, introspectedTable.getNonPrimaryKeyColumns());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>addAnnotatedResults(interfaze, method, introspectedTable.getNonPrimaryKeyColumns());<NEW_LINE>}<NEW_LINE>} | addAnnotation(sb.toString()); |
407,526 | private OHashTable.BucketPath nextNonEmptyNode(OHashTable.BucketPath bucketPath, final OAtomicOperation atomicOperation) throws IOException {<NEW_LINE>nextBucketLoop: while (bucketPath != null) {<NEW_LINE>final long[] node = directory.getNode(bucketPath.nodeIndex, atomicOperation);<NEW_LINE>final int startIndex <MASK><NEW_LINE>@SuppressWarnings("UnnecessaryLocalVariable")<NEW_LINE>final int endIndex = MAX_LEVEL_SIZE;<NEW_LINE>for (int i = startIndex; i < endIndex; i++) {<NEW_LINE>final long position = node[i];<NEW_LINE>if (position > 0) {<NEW_LINE>final int hashMapSize = 1 << bucketPath.nodeLocalDepth;<NEW_LINE>final int hashMapOffset = (i / hashMapSize) * hashMapSize;<NEW_LINE>final int itemIndex = i - hashMapOffset;<NEW_LINE>return new OHashTable.BucketPath(bucketPath.parent, hashMapOffset, itemIndex, bucketPath.nodeIndex, bucketPath.nodeLocalDepth, bucketPath.nodeGlobalDepth);<NEW_LINE>}<NEW_LINE>if (position < 0) {<NEW_LINE>final int childNodeIndex = (int) ((position & Long.MAX_VALUE) >> 8);<NEW_LINE>final int childItemOffset = (int) position & 0xFF;<NEW_LINE>final OHashTable.BucketPath parent = new OHashTable.BucketPath(bucketPath.parent, 0, i, bucketPath.nodeIndex, bucketPath.nodeLocalDepth, bucketPath.nodeGlobalDepth);<NEW_LINE>final int childLocalDepth = directory.getNodeLocalDepth(childNodeIndex, atomicOperation);<NEW_LINE>bucketPath = new OHashTable.BucketPath(parent, childItemOffset, 0, childNodeIndex, childLocalDepth, bucketPath.nodeGlobalDepth + childLocalDepth);<NEW_LINE>continue nextBucketLoop;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>bucketPath = nextLevelUp(bucketPath, atomicOperation);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | = bucketPath.itemIndex + bucketPath.hashMapOffset; |
1,328,427 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see javax.ws.rs.ext.MessageBodyReader#readFrom(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType,<NEW_LINE>* javax.ws.rs.core.MultivaluedMap, java.io.InputStream)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public MyObject readFrom(Class<MyObject> clazz, Type type, Annotation[] annos, MediaType mt, MultivaluedMap<String, String> map, InputStream is) throws IOException, WebApplicationException {<NEW_LINE>BufferedReader br = new BufferedReader(new InputStreamReader(is));<NEW_LINE>String line = br.readLine();<NEW_LINE>System.out.println("MyLowPriorityMBR received: " + line);<NEW_LINE>String[] <MASK><NEW_LINE>MyObject myObject = new MyObject();<NEW_LINE>myObject.setMyString(fields[0]);<NEW_LINE>myObject.setMyInt(Integer.parseInt(fields[1]));<NEW_LINE>myObject.setMbrVersion(mbrVersion);<NEW_LINE>Version v = providers.getContextResolver(Version.class, mt).getContext(null);<NEW_LINE>myObject.setContextResolverVersionFromReader(v.getVersion());<NEW_LINE>return myObject;<NEW_LINE>} | fields = line.split("\\|"); |
1,403,216 | public void createTable(Table table) throws IOException {<NEW_LINE><MASK><NEW_LINE>validateWholeTableReference(tableReference);<NEW_LINE>synchronized (tables) {<NEW_LINE>Map<String, TableContainer> dataset = tables.get(tableReference.getProjectId(), tableReference.getDatasetId());<NEW_LINE>if (dataset == null) {<NEW_LINE>throwNotFound("Tried to get a dataset %s:%s, but no such table was set", tableReference.getProjectId(), tableReference.getDatasetId());<NEW_LINE>}<NEW_LINE>dataset.computeIfAbsent(tableReference.getTableId(), k -> {<NEW_LINE>TableContainer tableContainer = new TableContainer(table);<NEW_LINE>// Create the default stream.<NEW_LINE>String streamName = String.format("projects/%s/datasets/%s/tables/%s/streams/_default", tableReference.getProjectId(), tableReference.getDatasetId(), BigQueryHelpers.stripPartitionDecorator(tableReference.getTableId()));<NEW_LINE>writeStreams.put(streamName, new Stream(streamName, tableContainer, Type.COMMITTED));<NEW_LINE>return tableContainer;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | TableReference tableReference = table.getTableReference(); |
1,631,412 | protected ScanIteration<Tuple> doScan(byte[] key, long cursorId, ScanOptions options) {<NEW_LINE>if (isQueueing() || isPipelined()) {<NEW_LINE>throw new UnsupportedOperationException("'ZSCAN' cannot be called in pipeline / transaction mode.");<NEW_LINE>}<NEW_LINE>List<Object> args = new ArrayList<Object>();<NEW_LINE>args.add(key);<NEW_LINE>args.add(cursorId);<NEW_LINE>if (options.getPattern() != null) {<NEW_LINE>args.add("MATCH");<NEW_LINE>args.<MASK><NEW_LINE>}<NEW_LINE>if (options.getCount() != null) {<NEW_LINE>args.add("COUNT");<NEW_LINE>args.add(options.getCount());<NEW_LINE>}<NEW_LINE>RFuture<ListScanResult<Tuple>> f = executorService.readAsync(client, key, ByteArrayCodec.INSTANCE, ZSCAN, args.toArray());<NEW_LINE>ListScanResult<Tuple> res = syncFuture(f);<NEW_LINE>client = res.getRedisClient();<NEW_LINE>return new ScanIteration<Tuple>(res.getPos(), res.getValues());<NEW_LINE>} | add(options.getPattern()); |
1,648,470 | void loadServicePrivateKey() {<NEW_LINE>final String pkeyFactoryClass = System.getProperty(ZTSConsts.ZTS_PROP_PRIVATE_KEY_STORE_FACTORY_CLASS, ZTSConsts.ZTS_PKEY_STORE_FACTORY_CLASS);<NEW_LINE>PrivateKeyStoreFactory pkeyFactory;<NEW_LINE>try {<NEW_LINE>pkeyFactory = (PrivateKeyStoreFactory) Class.forName(pkeyFactoryClass).newInstance();<NEW_LINE>} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {<NEW_LINE>LOGGER.error("Invalid PrivateKeyStoreFactory class: {} error: {}", pkeyFactoryClass, e.getMessage());<NEW_LINE>throw new IllegalArgumentException("Invalid private key store");<NEW_LINE>}<NEW_LINE>// extract the private key for our service - we're going to ask for our algorithm<NEW_LINE>// specific keys and then if neither one is provided our generic one.<NEW_LINE>privateKeyStore = pkeyFactory.create();<NEW_LINE>privateECKey = privateKeyStore.getPrivateKey(ZTSConsts.ZTS_SERVICE, serverHostName, serverRegion, ZTSConsts.EC);<NEW_LINE>privateRSAKey = privateKeyStore.getPrivateKey(ZTSConsts.ZTS_SERVICE, serverHostName, serverRegion, ZTSConsts.RSA);<NEW_LINE>// if we don't have ec and rsa specific keys specified then we're going to fall<NEW_LINE>// back and use the old private key api and use that for our private key<NEW_LINE>// if both ec and rsa keys are provided, we use the ec key as preferred<NEW_LINE>// when signing policy files<NEW_LINE>if (privateECKey == null && privateRSAKey == null) {<NEW_LINE><MASK><NEW_LINE>PrivateKey pkey = privateKeyStore.getPrivateKey(ZTSConsts.ZTS_SERVICE, serverHostName, privKeyId);<NEW_LINE>privateKey = new ServerPrivateKey(pkey, privKeyId.toString());<NEW_LINE>} else if (privateECKey != null) {<NEW_LINE>privateKey = privateECKey;<NEW_LINE>} else {<NEW_LINE>privateKey = privateRSAKey;<NEW_LINE>}<NEW_LINE>} | StringBuilder privKeyId = new StringBuilder(256); |
1,322,202 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String mobileNetworkName, String dataNetworkName, 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 (mobileNetworkName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter mobileNetworkName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (dataNetworkName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter dataNetworkName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = <MASK><NEW_LINE>return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), mobileNetworkName, dataNetworkName, accept, context);<NEW_LINE>} | this.client.mergeContext(context); |
1,053,099 | private void addUnassigned(Client client) {<NEW_LINE>for (Security security : client.getSecurities()) {<NEW_LINE><MASK><NEW_LINE>assignment.setWeight(0);<NEW_LINE>investmentVehicle2weight.put(security, assignment);<NEW_LINE>}<NEW_LINE>for (Account account : client.getAccounts()) {<NEW_LINE>Assignment assignment = new Assignment(account);<NEW_LINE>assignment.setWeight(0);<NEW_LINE>investmentVehicle2weight.put(account, assignment);<NEW_LINE>}<NEW_LINE>visitAll(node -> {<NEW_LINE>if (!(node instanceof AssignmentNode))<NEW_LINE>return;<NEW_LINE>Assignment assignment = node.getAssignment();<NEW_LINE>Assignment count = investmentVehicle2weight.get(assignment.getInvestmentVehicle());<NEW_LINE>count.setWeight(count.getWeight() + assignment.getWeight());<NEW_LINE>});<NEW_LINE>List<Assignment> unassigned = new ArrayList<>();<NEW_LINE>for (Assignment assignment : investmentVehicle2weight.values()) {<NEW_LINE>if (assignment.getWeight() >= Classification.ONE_HUNDRED_PERCENT)<NEW_LINE>continue;<NEW_LINE>Assignment a = new Assignment(assignment.getInvestmentVehicle());<NEW_LINE>a.setWeight(Classification.ONE_HUNDRED_PERCENT - assignment.getWeight());<NEW_LINE>unassigned.add(a);<NEW_LINE>assignment.setWeight(Classification.ONE_HUNDRED_PERCENT);<NEW_LINE>}<NEW_LINE>Collections.sort(unassigned, (o1, o2) -> o1.getInvestmentVehicle().toString().compareToIgnoreCase(o2.getInvestmentVehicle().toString()));<NEW_LINE>for (Assignment assignment : unassigned) unassignedNode.addChild(assignment);<NEW_LINE>} | Assignment assignment = new Assignment(security); |
1,829,849 | public void removeRadiusConfig(String xSdsAuthToken) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/system/config/auth/radius";<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (xSdsAuthToken != null)<NEW_LINE>localVarHeaderParams.put("X-Sds-Auth-Token", apiClient.parameterToString(xSdsAuthToken));<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String <MASK><NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "oauth2" };<NEW_LINE>apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);<NEW_LINE>} | localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
1,212,913 | public JComponent build() {<NEW_LINE>ProjectStructureSettingsUtil util = (ProjectStructureSettingsUtil) ShowSettingsUtil.getInstance();<NEW_LINE>final SdkModel projectSdksModel = util.getSdksModel();<NEW_LINE>final SdkComboBox comboBox = new SdkComboBox(projectSdksModel, mySdkFilter, null, myNullItemName, myNullItemIcon);<NEW_LINE>comboBox.insertModuleItems(myMutableModuleExtension, mySdkPointerFunction);<NEW_LINE>final MutableModuleInheritableNamedPointer<Sdk> inheritableSdk = mySdkPointerFunction.fun(myMutableModuleExtension);<NEW_LINE>assert inheritableSdk != null;<NEW_LINE>if (inheritableSdk.isNull()) {<NEW_LINE>comboBox.setSelectedNoneSdk();<NEW_LINE>} else {<NEW_LINE>final String sdkInheritModuleName = inheritableSdk.getModuleName();<NEW_LINE>if (sdkInheritModuleName != null) {<NEW_LINE>final Module sdkInheritModule = inheritableSdk.getModule();<NEW_LINE>if (sdkInheritModule == null) {<NEW_LINE>comboBox.addInvalidModuleItem(sdkInheritModuleName);<NEW_LINE>}<NEW_LINE>comboBox.setSelectedModule(sdkInheritModuleName);<NEW_LINE>} else {<NEW_LINE>comboBox.setSelectedSdk(inheritableSdk.getName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>comboBox.addItemListener(e -> {<NEW_LINE>if (e.getStateChange() == ItemEvent.SELECTED) {<NEW_LINE>Sdk oldValue = inheritableSdk.get();<NEW_LINE>inheritableSdk.set(comboBox.getSelectedModuleName(), comboBox.getSelectedSdkName());<NEW_LINE>if (myPostConsumer != null) {<NEW_LINE>Sdk sdk = inheritableSdk.get();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (myLaterUpdater != null) {<NEW_LINE>SwingUtilities.invokeLater(myLaterUpdater);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return LabeledComponent.left(comboBox, myLabelText);<NEW_LINE>} | myPostConsumer.consume(oldValue, sdk); |
1,170,522 | protected IndexTreePath<E> choosePath(IndexTreePath<E> subtree, SpatialComparable mbr, int depth, int cur) {<NEW_LINE>if (getLogger().isDebuggingFiner()) {<NEW_LINE>getLogger().debugFiner("node " + subtree + ", depth " + depth);<NEW_LINE>}<NEW_LINE>N node = getNode(subtree.getEntry());<NEW_LINE>if (node == null) {<NEW_LINE>throw new IllegalStateException("Page file did not return node for node id: " + getPageID(subtree.getEntry()));<NEW_LINE>}<NEW_LINE>if (node.isLeaf()) {<NEW_LINE>return subtree;<NEW_LINE>}<NEW_LINE>// first test on containment<NEW_LINE>IndexTreePath<E> newSubtree = containedTest(subtree, node, mbr);<NEW_LINE>if (newSubtree != null) {<NEW_LINE>return (++cur == depth) ? newSubtree : choosePath(newSubtree, mbr, depth, cur);<NEW_LINE>}<NEW_LINE>N childNode = getNode(node.getEntry(0));<NEW_LINE>int num = settings.insertionStrategy.choose(node, NodeArrayAdapter.STATIC, mbr, height, cur);<NEW_LINE>newSubtree = new IndexTreePath<>(subtree, node.getEntry(num), num);<NEW_LINE>if (++cur == depth) {<NEW_LINE>return newSubtree;<NEW_LINE>}<NEW_LINE>// children are leafs<NEW_LINE>if (childNode.isLeaf()) {<NEW_LINE>// Check for programming errors<NEW_LINE>assert cur == newSubtree.getPathCount();<NEW_LINE>throw new IllegalArgumentException(<MASK><NEW_LINE>}<NEW_LINE>// children are directory nodes<NEW_LINE>return choosePath(newSubtree, mbr, depth, cur);<NEW_LINE>} | "childNode is leaf, but currentDepth != depth: " + cur + " != " + depth); |
404,321 | public void execute(AdminCommandContext context) {<NEW_LINE>Config config = targetUtil.getConfig(target);<NEW_LINE>if (config == null) {<NEW_LINE>context.getActionReport().setMessage("No such config named: " + target);<NEW_LINE>context.getActionReport().setActionExitCode(ActionReport.ExitCode.FAILURE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MonitoringService monitoringService = config.getMonitoringService();<NEW_LINE>AMXConfiguration amxConfiguration = config.getExtensionByType(AMXConfiguration.class);<NEW_LINE>final ActionReport actionReport = context.getActionReport();<NEW_LINE>final String[] headers = { "Monitoring Enabled", "AMX Enabled", "MBeans Enabled", "DTrace Enabled" };<NEW_LINE>ColumnFormatter columnFormatter = new ColumnFormatter(headers);<NEW_LINE>columnFormatter.addRow(new Object[] { monitoringService.getMonitoringEnabled(), amxConfiguration.getEnabled(), monitoringService.getMbeanEnabled()<MASK><NEW_LINE>actionReport.appendMessage(columnFormatter.toString());<NEW_LINE>Map<String, Object> extraPropertiesMap = new HashMap<>();<NEW_LINE>extraPropertiesMap.put("monitoringEnabled", monitoringService.getMonitoringEnabled());<NEW_LINE>extraPropertiesMap.put("amxEnabled", amxConfiguration.getEnabled());<NEW_LINE>extraPropertiesMap.put("mbeanEnabled", monitoringService.getMbeanEnabled());<NEW_LINE>extraPropertiesMap.put("dtraceEnabled", monitoringService.getDtraceEnabled());<NEW_LINE>Properties extraProperties = new Properties();<NEW_LINE>extraProperties.put("getMonitoringServiceConfiguration", extraPropertiesMap);<NEW_LINE>actionReport.setExtraProperties(extraProperties);<NEW_LINE>actionReport.setMessage(columnFormatter.toString());<NEW_LINE>actionReport.setActionExitCode(ActionReport.ExitCode.SUCCESS);<NEW_LINE>} | , monitoringService.getDtraceEnabled() }); |
195,803 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>String msg = request.getParameter("arg0");<NEW_LINE>PrintWriter writer = response.getWriter();<NEW_LINE>port = request.getParameter("port");<NEW_LINE>hostname = request.getParameter("hostname");<NEW_LINE>String serviceName = request.getParameter("service");<NEW_LINE>String warName = request.getParameter("war").replace(".war", "");<NEW_LINE>if (hostname == null || hostname.isEmpty() || port == null || port.isEmpty() || warName == null || warName.isEmpty() || serviceName == null || serviceName.isEmpty()) {<NEW_LINE>writer.println("Parameters named port, hostname, service and war are all required.");<NEW_LINE>writer.flush();<NEW_LINE>writer.close();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (serviceName.equals("SimpleImplService")) {<NEW_LINE>invokeSimpleImplService(<MASK><NEW_LINE>} else if (serviceName.equals("SimpleImplProviderService")) {<NEW_LINE>invokeSimpleImplProviderService(msg, warName, serviceName, writer);<NEW_LINE>} else {<NEW_LINE>writer.println("Not supported service: " + serviceName);<NEW_LINE>writer.flush();<NEW_LINE>writer.close();<NEW_LINE>}<NEW_LINE>} | msg, warName, serviceName, writer); |
1,561,224 | private void parseLoggingConfig(Map<String, ?> loggingConfig) {<NEW_LINE>if (loggingConfig != null) {<NEW_LINE>Boolean value = JsonUtil.getBoolean(loggingConfig, "enable_cloud_logging");<NEW_LINE>if (value != null) {<NEW_LINE>enableCloudLogging = value;<NEW_LINE>}<NEW_LINE>destinationProjectId = <MASK><NEW_LINE>flushMessageCount = JsonUtil.getNumberAsLong(loggingConfig, "flush_message_count");<NEW_LINE>List<?> rawList = JsonUtil.getList(loggingConfig, "log_filters");<NEW_LINE>if (rawList != null) {<NEW_LINE>List<Map<String, ?>> jsonLogFilters = JsonUtil.checkObjectList(rawList);<NEW_LINE>ImmutableList.Builder<LogFilter> logFiltersBuilder = new ImmutableList.Builder<>();<NEW_LINE>for (Map<String, ?> jsonLogFilter : jsonLogFilters) {<NEW_LINE>logFiltersBuilder.add(parseJsonLogFilter(jsonLogFilter));<NEW_LINE>}<NEW_LINE>this.logFilters = logFiltersBuilder.build();<NEW_LINE>}<NEW_LINE>rawList = JsonUtil.getList(loggingConfig, "event_types");<NEW_LINE>if (rawList != null) {<NEW_LINE>List<String> jsonEventTypes = JsonUtil.checkStringList(rawList);<NEW_LINE>ImmutableList.Builder<EventType> eventTypesBuilder = new ImmutableList.Builder<>();<NEW_LINE>for (String jsonEventType : jsonEventTypes) {<NEW_LINE>eventTypesBuilder.add(convertEventType(jsonEventType));<NEW_LINE>}<NEW_LINE>this.eventTypes = eventTypesBuilder.build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | JsonUtil.getString(loggingConfig, "destination_project_id"); |
359,486 | private String constructImportStatement(Map.Entry<String, BImport> importEntry) {<NEW_LINE>String orgName = importEntry.getValue().getResolvedSymbol().id().orgName();<NEW_LINE>// If the import belongs to a module inside the current package, replace the original org name name with<NEW_LINE>// temporary evaluation project org name.<NEW_LINE>if (context.getPackageOrg().isPresent() && orgName.equals(context.getPackageOrg().get())) {<NEW_LINE>orgName = EVALUATION_PACKAGE_ORG;<NEW_LINE>}<NEW_LINE>String moduleName = getModuleName(importEntry.getValue().getResolvedSymbol().id());<NEW_LINE>String[] <MASK><NEW_LINE>// If the import belongs to a module inside the current package, replace the original package name with<NEW_LINE>// temporary evaluation project package name.<NEW_LINE>if (context.getPackageName().isPresent() && moduleNameParts[0].equals(context.getPackageName().get())) {<NEW_LINE>StringJoiner newModuleName = new StringJoiner(MODULE_NAME_SEPARATOR);<NEW_LINE>newModuleName.add(EVALUATION_PACKAGE_NAME);<NEW_LINE>for (int i = 1, copyOfRangeLength = moduleNameParts.length; i < copyOfRangeLength; i++) {<NEW_LINE>newModuleName.add(moduleNameParts[i]);<NEW_LINE>}<NEW_LINE>moduleName = newModuleName.toString();<NEW_LINE>}<NEW_LINE>String alias = importEntry.getKey();<NEW_LINE>return String.format(EVALUATION_IMPORT_TEMPLATE, orgName, moduleName, alias);<NEW_LINE>} | moduleNameParts = moduleName.split(MODULE_NAME_SEPARATOR_REGEX); |
1,414,156 | private void ensureExpandedTexture() {<NEW_LINE>if (mExpandedTitleTexture != null || mExpandedBounds.isEmpty() || TextUtils.isEmpty(mTextToDraw)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>calculateOffsets(0f);<NEW_LINE>mTextureAscent = mTextPaint.ascent();<NEW_LINE>mTextureDescent = mTextPaint.descent();<NEW_LINE>final int w = Math.round(mTextPaint.measureText(mTextToDraw, 0, mTextToDraw.length()));<NEW_LINE>final int h = Math.round(mTextureDescent - mTextureAscent);<NEW_LINE>if (w <= 0 || h <= 0) {<NEW_LINE>// If the width or height are 0, return<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mExpandedTitleTexture = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);<NEW_LINE>Canvas c = new Canvas(mExpandedTitleTexture);<NEW_LINE>c.drawText(mTextToDraw, 0, mTextToDraw.length(), 0, h - <MASK><NEW_LINE>if (mTexturePaint == null) {<NEW_LINE>// Make sure we have a paint<NEW_LINE>mTexturePaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);<NEW_LINE>}<NEW_LINE>} | mTextPaint.descent(), mTextPaint); |
20,976 | private void addStaticImport(ICompilationUnit movedUnit, IImportDeclaration importDecl, ImportRewrite rewrite) {<NEW_LINE><MASK><NEW_LINE>int oldPackLength = movedUnit.getParent().getElementName().length();<NEW_LINE>StringBuilder result = new StringBuilder(fDestination.getElementName());<NEW_LINE>if (oldPackLength == 0) {<NEW_LINE>result.append('.').append(old);<NEW_LINE>} else if (result.length() == 0) {<NEW_LINE>// cut "."<NEW_LINE>result.append(old.substring(oldPackLength + 1));<NEW_LINE>} else {<NEW_LINE>result.append(old.substring(oldPackLength));<NEW_LINE>}<NEW_LINE>// $NON-NLS-1$<NEW_LINE>int index = result.lastIndexOf(".");<NEW_LINE>if (index > 0 && index < result.length() - 1) {<NEW_LINE>rewrite.addStaticImport(result.substring(0, index), result.substring(index + 1, result.length()), true);<NEW_LINE>}<NEW_LINE>} | String old = importDecl.getElementName(); |
509,714 | protected void deleteLinks(List<Link> links, String reason, List<LDUpdate> updateList) {<NEW_LINE>NodePortTuple srcNpt, dstNpt;<NEW_LINE>List<LDUpdate> linkUpdateList = new ArrayList<LDUpdate>();<NEW_LINE>lock.writeLock().lock();<NEW_LINE>try {<NEW_LINE>for (Link lt : links) {<NEW_LINE>srcNpt = new NodePortTuple(lt.getSrc(), lt.getSrcPort());<NEW_LINE>dstNpt = new NodePortTuple(lt.getDst(), lt.getDstPort());<NEW_LINE>if (switchLinks.containsKey(lt.getSrc())) {<NEW_LINE>switchLinks.get(lt.getSrc()).remove(lt);<NEW_LINE>if (switchLinks.get(lt.getSrc()).isEmpty())<NEW_LINE>this.switchLinks.remove(lt.getSrc());<NEW_LINE>}<NEW_LINE>if (this.switchLinks.containsKey(lt.getDst())) {<NEW_LINE>switchLinks.get(lt.getDst()).remove(lt);<NEW_LINE>if (this.switchLinks.get(lt.getDst()).isEmpty())<NEW_LINE>this.switchLinks.remove(lt.getDst());<NEW_LINE>}<NEW_LINE>if (this.portLinks.get(srcNpt) != null) {<NEW_LINE>this.portLinks.get(srcNpt).remove(lt);<NEW_LINE>if (this.portLinks.get(srcNpt).isEmpty())<NEW_LINE>this.portLinks.remove(srcNpt);<NEW_LINE>}<NEW_LINE>if (this.portLinks.get(dstNpt) != null) {<NEW_LINE>this.portLinks.get(dstNpt).remove(lt);<NEW_LINE>if (this.portLinks.get(dstNpt).isEmpty())<NEW_LINE>this.portLinks.remove(dstNpt);<NEW_LINE>}<NEW_LINE>LinkInfo info = this.links.remove(lt);<NEW_LINE>LinkType linkType = getLinkType(lt, info);<NEW_LINE>linkUpdateList.add(new LDUpdate(lt.getSrc(), lt.getSrcPort(), lt.getDst(), lt.getDstPort(), lt.getLatency(), linkType, UpdateOperation.LINK_REMOVED));<NEW_LINE>// remove link from storage.<NEW_LINE>removeLinkFromStorage(lt);<NEW_LINE>// TODO Whenever link is removed, it has to checked if<NEW_LINE>// the switchports must be added to quarantine.<NEW_LINE>if (linkType == ILinkDiscovery.LinkType.DIRECT_LINK) {<NEW_LINE>log.info("Inter-switch link removed: {}", lt);<NEW_LINE>} else if (log.isTraceEnabled()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (updateList != null)<NEW_LINE>linkUpdateList.addAll(updateList);<NEW_LINE>updates.addAll(linkUpdateList);<NEW_LINE>lock.writeLock().unlock();<NEW_LINE>}<NEW_LINE>} | log.trace("Deleted link {}", lt); |
1,838,479 | public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {<NEW_LINE>finalizeCommandsOnStart(cmds, profile);<NEW_LINE>SecondaryStorageVmVO secVm = _secStorageVmDao.findById(profile.getId());<NEW_LINE><MASK><NEW_LINE>List<NicProfile> nics = profile.getNics();<NEW_LINE>for (NicProfile nic : nics) {<NEW_LINE>if ((nic.getTrafficType() == TrafficType.Public && dc.getNetworkType() == NetworkType.Advanced) || (nic.getTrafficType() == TrafficType.Guest && (dc.getNetworkType() == NetworkType.Basic || dc.isSecurityGroupEnabled()))) {<NEW_LINE>secVm.setPublicIpAddress(nic.getIPv4Address());<NEW_LINE>secVm.setPublicNetmask(nic.getIPv4Netmask());<NEW_LINE>secVm.setPublicMacAddress(nic.getMacAddress());<NEW_LINE>} else if (nic.getTrafficType() == TrafficType.Management) {<NEW_LINE>secVm.setPrivateIpAddress(nic.getIPv4Address());<NEW_LINE>secVm.setPrivateMacAddress(nic.getMacAddress());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>_secStorageVmDao.update(secVm.getId(), secVm);<NEW_LINE>return true;<NEW_LINE>} | DataCenter dc = dest.getDataCenter(); |
295,255 | final ListFirewallRuleGroupAssociationsResult executeListFirewallRuleGroupAssociations(ListFirewallRuleGroupAssociationsRequest listFirewallRuleGroupAssociationsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listFirewallRuleGroupAssociationsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListFirewallRuleGroupAssociationsRequest> request = null;<NEW_LINE>Response<ListFirewallRuleGroupAssociationsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListFirewallRuleGroupAssociationsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listFirewallRuleGroupAssociationsRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListFirewallRuleGroupAssociations");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListFirewallRuleGroupAssociationsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListFirewallRuleGroupAssociationsResultJsonUnmarshaller());<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.SERVICE_ID, "Route53Resolver"); |
608,089 | public void run() {<NEW_LINE>// Sandbox transactions have no order ID, so we'll make a dummy transaction ID<NEW_LINE>// in this case.<NEW_LINE>String transactionId = (purchase.getOrderId() == null || purchase.getOrderId().isEmpty()) ? "play-sandbox-" + UUID.randomUUID().toString() : purchase.getOrderId();<NEW_LINE>String purchaseJsonStr = purchase.getOriginalJson();<NEW_LINE>try {<NEW_LINE>// In order to verify receipts, we'll need both the order data and the signature<NEW_LINE>// so we'll pack it all into a single JSON string.<NEW_LINE>JSONObject purchaseJson = new JSONObject(purchaseJsonStr);<NEW_LINE>JSONObject rootJson = new JSONObject();<NEW_LINE>rootJson.put("data", purchaseJson);<NEW_LINE>rootJson.put(<MASK><NEW_LINE>purchaseJsonStr = rootJson.toString();<NEW_LINE>} catch (JSONException ex) {<NEW_LINE>Logger.getLogger(CodenameOneActivity.class.getName()).log(Level.SEVERE, null, ex);<NEW_LINE>}<NEW_LINE>com.codename1.payment.Purchase.postReceipt(Receipt.STORE_CODE_PLAY, sku, transactionId, purchase.getPurchaseTime(), purchaseJsonStr);<NEW_LINE>pc.itemPurchased(sku);<NEW_LINE>} | "signature", purchase.getSignature()); |
1,154,618 | protected void addRequestMethods(StringBuilder sb, int indent, @SuppressWarnings("unused") String typeName) {<NEW_LINE>indent(sb, indent);<NEW_LINE>// noinspection unused<NEW_LINE>sb.append("static ").append("Requester<$typeName>").append(" request(String urlBase) {\n");<NEW_LINE>indent(sb, indent);<NEW_LINE>sb.append(" return new Requester<>(urlBase, result -> RuntimeMethods.coerce( result, $typeName.class));\n");<NEW_LINE>indent(sb, indent);<NEW_LINE>sb.append("}\n");<NEW_LINE>indent(sb, indent);<NEW_LINE>// noinspection unused<NEW_LINE>sb.append("static ").append<MASK><NEW_LINE>indent(sb, indent);<NEW_LINE>sb.append(" return new Requester<>(endpoint, result -> RuntimeMethods.coerce( result, $typeName.class));\n");<NEW_LINE>indent(sb, indent);<NEW_LINE>sb.append("}\n");<NEW_LINE>} | ("Requester<$typeName>").append(" request(Endpoint endpoint) {\n"); |
675,741 | // Non-static class methods must be empty for `@record` and `@interface` as per the style guide.<NEW_LINE>private static void checkClassMethods(NodeTraversal t, Node classNode, @Nullable Node ctorDef) {<NEW_LINE>Node classMembers = classNode.getLastChild();<NEW_LINE>checkState(classMembers.isClassMembers(), classMembers);<NEW_LINE>for (Node memberFuncDef = classMembers.getFirstChild(); memberFuncDef != null; memberFuncDef = memberFuncDef.getNext()) {<NEW_LINE>if (memberFuncDef.equals(ctorDef)) {<NEW_LINE>// constructor was already checked; don't check here.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (memberFuncDef.isStaticMember()) {<NEW_LINE>// `static foo() {...}`<NEW_LINE>String className = NodeUtil.getName(classNode);<NEW_LINE>if (className == null) {<NEW_LINE>className = ANONYMOUS_CLASSNAME;<NEW_LINE>}<NEW_LINE>String funcName = memberFuncDef.getString();<NEW_LINE>t.report(memberFuncDef, STATIC_MEMBER_FUNCTION_IN_INTERFACE_CLASS, className, funcName);<NEW_LINE>} else {<NEW_LINE>Node block = memberFuncDef<MASK><NEW_LINE>if (block.hasChildren()) {<NEW_LINE>t.report(block.getFirstChild(), INTERFACE_CLASS_NONSTATIC_METHOD_NOT_EMPTY);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getLastChild().getLastChild(); |
1,348,089 | // Used by DatumReader. Applications should not call.<NEW_LINE>@SuppressWarnings(value = "unchecked")<NEW_LINE>public void put(int field$, java.lang.Object value$) {<NEW_LINE>switch(field$) {<NEW_LINE>case 0:<NEW_LINE>ownerId = (java.lang.Integer) value$;<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>timestampLastResetMs = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>timeSinceLastResetMs = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>dimension = (java.lang.CharSequence) value$;<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>numReqBootstrap = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>numReqSnapshot = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 6:<NEW_LINE>numReqCatchup = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 7:<NEW_LINE>numErrReqBootstrap = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 8:<NEW_LINE>numErrReqDatabaseTooOld = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 9:<NEW_LINE>numErrSqlException = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 10:<NEW_LINE>numReqStartSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 11:<NEW_LINE>numReqTargetSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 12:<NEW_LINE>numErrStartSCN = <MASK><NEW_LINE>break;<NEW_LINE>case 13:<NEW_LINE>numErrTargetSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 14:<NEW_LINE>latencySnapshot = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 15:<NEW_LINE>latencyCatchup = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 16:<NEW_LINE>latencyStartSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 17:<NEW_LINE>latencyTargetSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 18:<NEW_LINE>sizeBatch = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 19:<NEW_LINE>minBootstrapSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>case 20:<NEW_LINE>maxBootstrapSCN = (java.lang.Long) value$;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new org.apache.avro.AvroRuntimeException("Bad index");<NEW_LINE>}<NEW_LINE>} | (java.lang.Long) value$; |
435,836 | final UpdateReplicationConfigurationResult executeUpdateReplicationConfiguration(UpdateReplicationConfigurationRequest updateReplicationConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateReplicationConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateReplicationConfigurationRequest> request = null;<NEW_LINE>Response<UpdateReplicationConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateReplicationConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateReplicationConfigurationRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "mgn");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateReplicationConfiguration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateReplicationConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateReplicationConfigurationResultJsonUnmarshaller());<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.CLIENT_ENDPOINT, endpoint); |
1,109,384 | public void write(OutputStream out) throws IOException {<NEW_LINE>if (database != null) {<NEW_LINE>StreamUtil.writeUB3(out, calcPacketSize());<NEW_LINE>} else {<NEW_LINE>StreamUtil.writeUB3(out, calcPacketSize() - 1);<NEW_LINE>}<NEW_LINE>StreamUtil.write(out, packetId);<NEW_LINE>// capability flags<NEW_LINE><MASK><NEW_LINE>StreamUtil.writeUB4(out, maxPacketSize);<NEW_LINE>StreamUtil.write(out, (byte) charsetIndex);<NEW_LINE>out.write(FILLER);<NEW_LINE>if (user == null) {<NEW_LINE>StreamUtil.write(out, (byte) 0);<NEW_LINE>} else {<NEW_LINE>StreamUtil.writeWithNull(out, user.getBytes());<NEW_LINE>}<NEW_LINE>if (password == null) {<NEW_LINE>StreamUtil.write(out, (byte) 0);<NEW_LINE>} else {<NEW_LINE>StreamUtil.writeWithLength(out, password);<NEW_LINE>}<NEW_LINE>if (database != null) {<NEW_LINE>StreamUtil.writeWithNull(out, database.getBytes());<NEW_LINE>}<NEW_LINE>} | StreamUtil.writeUB4(out, clientFlags); |
400,993 | public void drawU(UGraphic ug, Area area, Context2D context) {<NEW_LINE>if (config.isHidden()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Dimension2D dimensionToUse = area.getDimensionToUse();<NEW_LINE>final UmlCharArea charArea = ((UGraphicTxt) ug).getCharArea();<NEW_LINE>final int width = (int) dimensionToUse.getWidth();<NEW_LINE>final int height = (int) dimensionToUse.getHeight();<NEW_LINE>final int textWidth = StringUtils.getWcWidth(stringsToDisplay);<NEW_LINE>final int yarrow = height - 2;<NEW_LINE>charArea.drawHLine(fileFormat == FileFormat.UTXT ? '\u2500' : '-', yarrow, 1, width);<NEW_LINE>if (config.isDotted()) {<NEW_LINE>for (int i = 1; i < width; i += 2) {<NEW_LINE>charArea.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (config.getArrowDirection() == ArrowDirection.LEFT_TO_RIGHT_NORMAL) {<NEW_LINE>charArea.drawChar('>', width - 1, yarrow);<NEW_LINE>} else if (config.getArrowDirection() == ArrowDirection.RIGHT_TO_LEFT_REVERSE) {<NEW_LINE>charArea.drawChar('<', 1, yarrow);<NEW_LINE>} else if (config.getArrowDirection() == ArrowDirection.BOTH_DIRECTION) {<NEW_LINE>charArea.drawChar('>', width - 1, yarrow);<NEW_LINE>charArea.drawChar('<', 1, yarrow);<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException();<NEW_LINE>}<NEW_LINE>// final int position = Math.max(0, (width - textWidth) / 2);<NEW_LINE>if (fileFormat == FileFormat.UTXT) {<NEW_LINE>charArea.drawStringsLRUnicode(stringsToDisplay.asList(), (width - textWidth) / 2, 0);<NEW_LINE>} else {<NEW_LINE>charArea.drawStringsLRSimple(stringsToDisplay.asList(), (width - textWidth) / 2, 0);<NEW_LINE>}<NEW_LINE>} | drawChar(' ', i, yarrow); |
1,229,421 | public long[] updateRTAs(PiecePicker picker) {<NEW_LINE>long overall_pos = current_position + file_offset_in_torrent;<NEW_LINE>int first_piece = (int) (overall_pos / piece_size);<NEW_LINE>long rate = byte_rate.getAverage();<NEW_LINE>int buffer_millis = (int) (<MASK><NEW_LINE>long buffer_bytes = (buffer_millis * rate) / 1000;<NEW_LINE>int pieces_to_buffer = (int) (buffer_bytes / piece_size);<NEW_LINE>if (pieces_to_buffer < 1) {<NEW_LINE>pieces_to_buffer = 1;<NEW_LINE>}<NEW_LINE>int millis_per_piece = buffer_millis / pieces_to_buffer;<NEW_LINE>if (pieces_to_buffer < DEFAULT_MIN_PIECES_TO_BUFFER) {<NEW_LINE>pieces_to_buffer = DEFAULT_MIN_PIECES_TO_BUFFER;<NEW_LINE>}<NEW_LINE>// System.out.println( "rate=" + rate + ", buffer_bytes=" + buffer_bytes + ", first_piece=" + first_piece + ", pieces=" + pieces_to_buffer + ", millis_per_piece=" + millis_per_piece );<NEW_LINE>Arrays.fill(rtas, 0);<NEW_LINE>long now = SystemTime.getCurrentTime();<NEW_LINE>now += buffer_delay_millis;<NEW_LINE>for (int i = first_piece; i < first_piece + pieces_to_buffer && i < rtas.length; i++) {<NEW_LINE>rtas[i] = now + ((i - first_piece) * millis_per_piece);<NEW_LINE>}<NEW_LINE>return (rtas);<NEW_LINE>} | buffer_millis_override == 0 ? DEFAULT_BUFFER_MILLIS : buffer_millis_override); |
1,451,860 | protected void processModulesAndArgs() {<NEW_LINE>super.processModulesAndArgs();<NEW_LINE>if (contains(argRepeat)) {<NEW_LINE>String[] x = getValue(argRepeat).split(",");<NEW_LINE>if (x.length == 1) {<NEW_LINE>try {<NEW_LINE>repeatCount = Integer.parseInt(x[0]);<NEW_LINE>} catch (NumberFormatException ex) {<NEW_LINE>throw new CmdException("Can't parse " + x[0] + " in arg " + getValue(argRepeat) + " as an integer");<NEW_LINE>}<NEW_LINE>} else if (x.length == 2) {<NEW_LINE>try {<NEW_LINE>warmupCount = Integer.parseInt(x[0]);<NEW_LINE>} catch (NumberFormatException ex) {<NEW_LINE>throw new CmdException("Can't parse " + x[0] + " in arg " + getValue(argRepeat) + " as an integer");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>repeatCount = Integer.parseInt(x[1]);<NEW_LINE>} catch (NumberFormatException ex) {<NEW_LINE>throw new CmdException("Can't parse " + x[1] + " in arg " <MASK><NEW_LINE>}<NEW_LINE>} else<NEW_LINE>throw new CmdException("Wrong format for repeat count: " + getValue(argRepeat));<NEW_LINE>}<NEW_LINE>if (isVerbose())<NEW_LINE>ARQ.getContext().setTrue(ARQ.symLogExec);<NEW_LINE>if (hasArg(argExplain))<NEW_LINE>ARQ.setExecutionLogging(Explain.InfoLevel.ALL);<NEW_LINE>if (hasArg(argOptimize)) {<NEW_LINE>String x1 = getValue(argOptimize);<NEW_LINE>if (hasValueOfTrue(argOptimize) || x1.equalsIgnoreCase("on") || x1.equalsIgnoreCase("yes"))<NEW_LINE>queryOptimization = true;<NEW_LINE>else if (hasValueOfFalse(argOptimize) || x1.equalsIgnoreCase("off") || x1.equalsIgnoreCase("no"))<NEW_LINE>queryOptimization = false;<NEW_LINE>else<NEW_LINE>throw new CmdException("Optimization flag must be true/false/on/off/yes/no. Found: " + getValue(argOptimize));<NEW_LINE>}<NEW_LINE>} | + getValue(argRepeat) + " as an integer"); |
1,231,978 | public void encryptDeterministically(DeterministicAeadEncryptRequest request, StreamObserver<DeterministicAeadEncryptResponse> responseObserver) {<NEW_LINE>DeterministicAeadEncryptResponse response;<NEW_LINE>try {<NEW_LINE>KeysetHandle keysetHandle = CleartextKeysetHandle.read(BinaryKeysetReader.withBytes(request.getKeyset<MASK><NEW_LINE>DeterministicAead daead = keysetHandle.getPrimitive(DeterministicAead.class);<NEW_LINE>byte[] ciphertext = daead.encryptDeterministically(request.getPlaintext().toByteArray(), request.getAssociatedData().toByteArray());<NEW_LINE>response = DeterministicAeadEncryptResponse.newBuilder().setCiphertext(ByteString.copyFrom(ciphertext)).build();<NEW_LINE>} catch (GeneralSecurityException | InvalidProtocolBufferException e) {<NEW_LINE>response = DeterministicAeadEncryptResponse.newBuilder().setErr(e.toString()).build();<NEW_LINE>} catch (IOException e) {<NEW_LINE>responseObserver.onError(Status.UNKNOWN.withDescription(e.getMessage()).asException());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>responseObserver.onNext(response);<NEW_LINE>responseObserver.onCompleted();<NEW_LINE>} | ().toByteArray())); |
362,022 | public void mouseDown(MouseEvent event) {<NEW_LINE>if (event.button == 3) {<NEW_LINE>TableItem[] tebleItems = table.getSelection();<NEW_LINE>final String fileName = tebleItems[0].getText();<NEW_LINE>Menu menu = new Menu(table.getShell(), SWT.POP_UP);<NEW_LINE>MenuItem downloadItem = new MenuItem(menu, SWT.PUSH);<NEW_LINE>downloadItem.setText("Download");<NEW_LINE>downloadItem.setImage(Images.download);<NEW_LINE>downloadItem.addListener(SWT.Selection, new Listener() {<NEW_LINE><NEW_LINE>public void handleEvent(Event event) {<NEW_LINE>IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();<NEW_LINE>Action act = new HeapDumpDownloadAction(window, "Download Binary Dump", fileName, objName, objHash, Images.heap, serverId);<NEW_LINE>act.run();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>MenuItem deleteItem = new <MASK><NEW_LINE>deleteItem.setText("Delete");<NEW_LINE>deleteItem.setImage(Images.table_delete);<NEW_LINE>deleteItem.addListener(SWT.Selection, new Listener() {<NEW_LINE><NEW_LINE>public void handleEvent(Event event) {<NEW_LINE>IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();<NEW_LINE>Action act = new HeapDumpDeleteAction(window, "Delete Binary Dump", fileName, objHash, fileName, Images.heap, serverId);<NEW_LINE>act.run();<NEW_LINE>reload();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>Point pt = new Point(event.x, event.y);<NEW_LINE>pt = table.toDisplay(pt);<NEW_LINE>menu.setLocation(pt.x, pt.y);<NEW_LINE>menu.setVisible(true);<NEW_LINE>}<NEW_LINE>} | MenuItem(menu, SWT.PUSH); |
177,265 | public void run(WorkingCopy workingCopy) throws IOException {<NEW_LINE><MASK><NEW_LINE>TreeMaker make = workingCopy.getTreeMaker();<NEW_LINE>CompilationUnitTree compilationUnitTree = workingCopy.getCompilationUnit();<NEW_LINE>// change the package when file was move to different dir.<NEW_LINE>CompilationUnitTree cutCopy = make.CompilationUnit(compilationUnitTree.getPackageAnnotations(), "".equals(packageName) ? null : make.Identifier(packageName), compilationUnitTree.getImports(), compilationUnitTree.getTypeDecls(), compilationUnitTree.getSourceFile());<NEW_LINE>workingCopy.rewrite(compilationUnitTree, cutCopy);<NEW_LINE>// go to rename also the top level class too...<NEW_LINE>if (originalName != null && !originalName.equals(newName)) {<NEW_LINE>for (Tree typeDecl : compilationUnitTree.getTypeDecls()) {<NEW_LINE>if (TreeUtilities.CLASS_TREE_KINDS.contains(typeDecl.getKind())) {<NEW_LINE>ClassTree clazz = (ClassTree) typeDecl;<NEW_LINE>if (originalName.contentEquals(clazz.getSimpleName())) {<NEW_LINE>Tree copy = make.setLabel(typeDecl, newName);<NEW_LINE>workingCopy.rewrite(typeDecl, copy);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | workingCopy.toPhase(Phase.RESOLVED); |
481,423 | public PolicyInformation unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>PolicyInformation policyInformation = new PolicyInformation();<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("CertPolicyId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>policyInformation.setCertPolicyId(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("PolicyQualifiers", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>policyInformation.setPolicyQualifiers(new ListUnmarshaller<PolicyQualifierInfo>(PolicyQualifierInfoJsonUnmarshaller.getInstance()).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 policyInformation;<NEW_LINE>} | class).unmarshall(context)); |
1,044,093 | public LinkNode<K, V> remove(LinkNode<K, V> node) {<NEW_LINE>assert node != this.empty;<NEW_LINE>assert node != this<MASK><NEW_LINE>while (true) {<NEW_LINE>LinkNode<K, V> prev = node.prev;<NEW_LINE>if (prev == this.empty) {<NEW_LINE>assert node.next == this.empty;<NEW_LINE>// Ignore the node if it has been removed<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>List<Lock> locks = this.lock(prev, node);<NEW_LINE>try {<NEW_LINE>if (prev != node.prev) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>assert node.next != null : node;<NEW_LINE>assert node.next != node.prev : node.next;<NEW_LINE>// Build the link between node.prev and node.next<NEW_LINE>node.prev.next = node.next;<NEW_LINE>node.next.prev = node.prev;<NEW_LINE>assert prev == node.prev : prev.key() + "!=" + node.prev;<NEW_LINE>// Clear the links of `node`<NEW_LINE>node.prev = this.empty;<NEW_LINE>node.next = this.empty;<NEW_LINE>return node;<NEW_LINE>} finally {<NEW_LINE>this.unlock(locks);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .head && node != this.rear; |
889,880 | public void handleEvent(Event event) {<NEW_LINE>switch(event.type) {<NEW_LINE>case SWT.Selection:<NEW_LINE>try {<NEW_LINE>String counterTitle = counterCombo.getText();<NEW_LINE>CubridSingleItem <MASK><NEW_LINE>String fromTime = (calendar.getMonth() + 1) + "/" + calendar.getDay() + "/" + calendar.getYear() + " " + (startTime.getHours() < 10 ? "0" : "") + startTime.getHours() + ":" + (startTime.getMinutes() < 10 ? "0" : "") + startTime.getMinutes();<NEW_LINE>boolean nextDay0 = false;<NEW_LINE>if (endTime.getHours() == 0 && endTime.getMinutes() == 0) {<NEW_LINE>nextDay0 = true;<NEW_LINE>}<NEW_LINE>String toTime = (calendar.getMonth() + 1) + "/" + calendar.getDay() + "/" + calendar.getYear() + " " + (endTime.getHours() < 10 ? "0" : "") + endTime.getHours() + ":" + (endTime.getMinutes() < 10 ? "0" : "") + endTime.getMinutes();<NEW_LINE>long startTime = DateUtil.getTime(fromTime, "MM/dd/yyyy HH:mm");<NEW_LINE>long endTime = DateUtil.getTime(toTime, "MM/dd/yyyy HH:mm");<NEW_LINE>if (nextDay0) {<NEW_LINE>endTime += DateUtil.MILLIS_PER_DAY - 1000;<NEW_LINE>}<NEW_LINE>if (endTime <= startTime) {<NEW_LINE>MessageDialog.openWarning(dialog, "Warning", "Time range is incorrect");<NEW_LINE>} else {<NEW_LINE>callback.onPressedOk(dbListCombo.getItem(dbListCombo.getSelectionIndex()), type, startTime, endTime);<NEW_LINE>dialog.close();<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>MessageDialog.openError(dialog, "Error55", "format error:" + e.getMessage());<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | type = CubridSingleItem.fromCounterName(counterTitle); |
12,044 | private void init() {<NEW_LINE>String velocityRootPath = Config.getStringProperty("VELOCITY_ROOT", "/WEB-INF/velocity");<NEW_LINE>if (velocityRootPath.startsWith("/WEB-INF")) {<NEW_LINE>String startPath = velocityRootPath.substring(0, 8);<NEW_LINE>String endPath = velocityRootPath.substring(9, velocityRootPath.length());<NEW_LINE>velocityRootPath = FileUtil.getRealPath(startPath) + File.separator + endPath;<NEW_LINE>}<NEW_LINE>VELOCITY_ROOT = velocityRootPath + File.separator;<NEW_LINE>File f = new File(VELOCITY_ROOT);<NEW_LINE>try {<NEW_LINE>if (f.exists()) {<NEW_LINE>velocityCanoncalPath = f.getCanonicalPath();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>Logger.fatal(this, e.getMessage(), e);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (UtilMethods.isSet(Config.getStringProperty("ASSET_REAL_PATH"))) {<NEW_LINE>f = new File(Config.getStringProperty("ASSET_REAL_PATH"));<NEW_LINE>if (f.exists()) {<NEW_LINE>assetRealCanoncalPath = f.getCanonicalPath();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>Logger.fatal(this, e.getMessage(), e);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (UtilMethods.isSet(Config.getStringProperty("ASSET_PATH"))) {<NEW_LINE>f = new File(FileUtil.getRealPath(<MASK><NEW_LINE>if (f.exists()) {<NEW_LINE>assetCanoncalPath = f.getCanonicalPath();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>Logger.fatal(this, e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | Config.getStringProperty("ASSET_PATH"))); |
46,299 | static List<Object> toArray(ReadableArray readableArray) {<NEW_LINE>List<Object> result = new ArrayList<>(readableArray.size());<NEW_LINE>for (int i = 0; i < readableArray.size(); i++) {<NEW_LINE>ReadableType <MASK><NEW_LINE>switch(indexType) {<NEW_LINE>case Null:<NEW_LINE>result.add(i, null);<NEW_LINE>break;<NEW_LINE>case Boolean:<NEW_LINE>result.add(i, readableArray.getBoolean(i));<NEW_LINE>break;<NEW_LINE>case Number:<NEW_LINE>result.add(i, readableArray.getDouble(i));<NEW_LINE>break;<NEW_LINE>case String:<NEW_LINE>result.add(i, readableArray.getString(i));<NEW_LINE>break;<NEW_LINE>case Map:<NEW_LINE>result.add(i, toMap(readableArray.getMap(i)));<NEW_LINE>break;<NEW_LINE>case Array:<NEW_LINE>result.add(i, toArray(readableArray.getArray(i)));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>Log.e(TAG, "Could not convert object at index " + i + ".");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | indexType = readableArray.getType(i); |
1,650,558 | private List<String> fetchHostsFromDns(final String primaryServer, OContextConfiguration contextConfiguration) {<NEW_LINE>OLogManager.instance().debug(this, "Retrieving URLs from DNS '%s' (timeout=%d)...", primaryServer, contextConfiguration.getValueAsInteger(OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_TIMEOUT));<NEW_LINE>List<String> toAdd = new ArrayList<>();<NEW_LINE>try {<NEW_LINE>final Hashtable<String, String> env = new Hashtable<String, String>();<NEW_LINE>env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");<NEW_LINE>env.put("com.sun.jndi.ldap.connect.timeout", contextConfiguration.getValueAsString(OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_TIMEOUT));<NEW_LINE>final <MASK><NEW_LINE>final String hostName = !primaryServer.contains(":") ? primaryServer : primaryServer.substring(0, primaryServer.indexOf(":"));<NEW_LINE>final Attributes attrs = ictx.getAttributes(hostName, new String[] { "TXT" });<NEW_LINE>final Attribute attr = attrs.get("TXT");<NEW_LINE>if (attr != null) {<NEW_LINE>for (int i = 0; i < attr.size(); ++i) {<NEW_LINE>String configuration = (String) attr.get(i);<NEW_LINE>if (configuration.startsWith("\""))<NEW_LINE>configuration = configuration.substring(1, configuration.length() - 1);<NEW_LINE>if (configuration != null) {<NEW_LINE>final String[] parts = configuration.split(" ");<NEW_LINE>for (String part : parts) {<NEW_LINE>if (part.startsWith("s=")) {<NEW_LINE>toAdd.add(part.substring("s=".length()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (NamingException ignore) {<NEW_LINE>}<NEW_LINE>return toAdd;<NEW_LINE>} | DirContext ictx = new InitialDirContext(env); |
64,133 | private ReuseSet generateReuseSet(ReuseKey key) {<NEW_LINE>long start = System.nanoTime();<NEW_LINE>ReuseSet reuseSet = new ReuseSet();<NEW_LINE>try (DatabaseSession databaseSession = bimServer.getDatabase().createSession(OperationType.READ_ONLY)) {<NEW_LINE>// Assuming all given roids are of projects that all have the same schema<NEW_LINE>Revision revision = databaseSession.get(key.getRoids().iterator().next(), OldQuery.getDefault());<NEW_LINE>PackageMetaData packageMetaData = bimServer.getMetaDataManager().getPackageMetaData(revision.getProject().getSchema());<NEW_LINE>Query query = new Query(packageMetaData);<NEW_LINE>Set<EClass> excluded = new HashSet<>();<NEW_LINE>for (String exclude : key.getExcludedClasses()) {<NEW_LINE>excluded.add(packageMetaData.getEClass(exclude));<NEW_LINE>}<NEW_LINE>QueryPart queryPart = query.createQueryPart();<NEW_LINE>queryPart.addType(packageMetaData.getEClass("IfcProduct"), true, excluded);<NEW_LINE>Include product = queryPart.createInclude();<NEW_LINE>product.addType(packageMetaData.getEClass("IfcProduct"), true);<NEW_LINE>product.addFieldDirect("geometry");<NEW_LINE>Include geometryInfo = product.createInclude();<NEW_LINE>geometryInfo.addType(GeometryPackage.eINSTANCE.getGeometryInfo(), false);<NEW_LINE>Map<Long, ReuseObject> <MASK><NEW_LINE>QueryObjectProvider queryObjectProvider = new QueryObjectProvider(databaseSession, bimServer, query, key.getRoids(), packageMetaData);<NEW_LINE>HashMapVirtualObject next = queryObjectProvider.next();<NEW_LINE>while (next != null) {<NEW_LINE>AbstractHashMapVirtualObject geometry = next.getDirectFeature(packageMetaData.getEReference("IfcProduct", "geometry"));<NEW_LINE>if (geometry != null) {<NEW_LINE>Long dataId = (Long) geometry.get("data");<NEW_LINE>ReuseObject reuseObject = map.get(dataId);<NEW_LINE>if (reuseObject == null) {<NEW_LINE>reuseObject = new ReuseObject(dataId, 1, (int) geometry.get("primitiveCount"));<NEW_LINE>map.put(dataId, reuseObject);<NEW_LINE>} else {<NEW_LINE>reuseObject.inc();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>next = queryObjectProvider.next();<NEW_LINE>}<NEW_LINE>for (long dataId : map.keySet()) {<NEW_LINE>reuseSet.add(map.get(dataId));<NEW_LINE>}<NEW_LINE>long end = System.nanoTime();<NEW_LINE>LOGGER.info("ReuseSets generated in " + ((end - start) / 1000000) + " ms");<NEW_LINE>} catch (BimserverDatabaseException e) {<NEW_LINE>LOGGER.error("", e);<NEW_LINE>} catch (QueryException e) {<NEW_LINE>LOGGER.error("", e);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOGGER.error("", e);<NEW_LINE>}<NEW_LINE>return reuseSet;<NEW_LINE>} | map = new HashMap<>(); |
1,754,883 | private void submitPost(MenuItem item) {<NEW_LINE>if (!subredditSelected) {<NEW_LINE>Snackbar.make(coordinatorLayout, R.string.select_a_subreddit, Snackbar.LENGTH_SHORT).show();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (titleEditText.getText() == null || titleEditText.getText().toString().equals("")) {<NEW_LINE>Snackbar.make(coordinatorLayout, R.string.title_required, Snackbar.LENGTH_SHORT).show();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>isPosting = true;<NEW_LINE>if (item != null) {<NEW_LINE>item.setEnabled(false);<NEW_LINE>item.getIcon().setAlpha(130);<NEW_LINE>}<NEW_LINE>mPostingSnackbar.show();<NEW_LINE>String subredditName;<NEW_LINE>if (subredditIsUser) {<NEW_LINE>subredditName = "u_" + subredditNameTextView.getText().toString();<NEW_LINE>} else {<NEW_LINE>subredditName = subredditNameTextView.getText().toString();<NEW_LINE>}<NEW_LINE>Intent intent = new Intent(this, SubmitPostService.class);<NEW_LINE>intent.putExtra(SubmitPostService.EXTRA_ACCOUNT, selectedAccount);<NEW_LINE>intent.putExtra(SubmitPostService.EXTRA_SUBREDDIT_NAME, subredditName);<NEW_LINE>intent.putExtra(SubmitPostService.EXTRA_TITLE, titleEditText.getText().toString());<NEW_LINE>intent.putExtra(SubmitPostService.EXTRA_CONTENT, contentEditText.getText().toString());<NEW_LINE>intent.putExtra(SubmitPostService.EXTRA_KIND, APIUtils.KIND_SELF);<NEW_LINE>intent.putExtra(SubmitPostService.EXTRA_FLAIR, flair);<NEW_LINE>intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler);<NEW_LINE>intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW);<NEW_LINE>intent.putExtra(SubmitPostService.EXTRA_RECEIVE_POST_REPLY_NOTIFICATIONS, receivePostReplyNotificationsSwitchMaterial.isChecked());<NEW_LINE>intent.putExtra(<MASK><NEW_LINE>ContextCompat.startForegroundService(this, intent);<NEW_LINE>} | SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TEXT_OR_LINK); |
43,869 | public FormFieldValidator createValidator(Element constraint, BpmnParse bpmnParse, ExpressionManager expressionManager) {<NEW_LINE>String name = constraint.attribute("name");<NEW_LINE>String <MASK><NEW_LINE>if ("validator".equals(name)) {<NEW_LINE>// custom validators<NEW_LINE>if (config == null || config.isEmpty()) {<NEW_LINE>bpmnParse.addError("validator configuration needs to provide either a fully " + "qualified classname or an expression resolving to a custom FormFieldValidator implementation.", constraint);<NEW_LINE>} else {<NEW_LINE>if (StringUtil.isExpression(config)) {<NEW_LINE>// expression<NEW_LINE>Expression validatorExpression = expressionManager.createExpression(config);<NEW_LINE>return new DelegateFormFieldValidator(validatorExpression);<NEW_LINE>} else {<NEW_LINE>// classname<NEW_LINE>return new DelegateFormFieldValidator(config);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// built-in validators<NEW_LINE>Class<? extends FormFieldValidator> validator = validators.get(name);<NEW_LINE>if (validator != null) {<NEW_LINE>FormFieldValidator validatorInstance = createValidatorInstance(validator);<NEW_LINE>return validatorInstance;<NEW_LINE>} else {<NEW_LINE>bpmnParse.addError("Cannot find validator implementation for name '" + name + "'.", constraint);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | config = constraint.attribute("config"); |
1,182,726 | private void saveDataverse(String successMessage) {<NEW_LINE>if (successMessage.isEmpty()) {<NEW_LINE>// "Template data updated";<NEW_LINE>successMessage = BundleUtil.getStringFromBundle("template.update");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>engineService.submit(new UpdateDataverseCommand(getDataverse(), null, null, dvRequestService.getDataverseRequest(), null));<NEW_LINE>// JH.addMessage(FacesMessage.SEVERITY_INFO, successMessage);<NEW_LINE>JsfHelper.addFlashMessage(successMessage);<NEW_LINE>} catch (CommandException ex) {<NEW_LINE>// "Template update failed";<NEW_LINE>String failMessage = BundleUtil.getStringFromBundle("template.update.error");<NEW_LINE>if (successMessage.equals(BundleUtil.getStringFromBundle("template.delete"))) {<NEW_LINE>// "The dataset template cannot be deleted.";<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (successMessage.equals(BundleUtil.getStringFromBundle("template.makeDefault"))) {<NEW_LINE>// "The dataset template cannot be made default.";<NEW_LINE>failMessage = BundleUtil.getStringFromBundle("template.makeDefault.error");<NEW_LINE>}<NEW_LINE>JH.addMessage(FacesMessage.SEVERITY_FATAL, failMessage);<NEW_LINE>}<NEW_LINE>} | failMessage = BundleUtil.getStringFromBundle("template.delete.error"); |
1,369,021 | public EditorInspector<?> createRequestInspector(Editor<?> editor, ModelItem modelItem) {<NEW_LINE>try {<NEW_LINE>if (targetClass.isAssignableFrom(modelItem.getClass())) {<NEW_LINE>try {<NEW_LINE>Method appliesMethod = inspectorClass.getMethod("applies", targetClass);<NEW_LINE>if (appliesMethod != null) {<NEW_LINE>Object applies = appliesMethod.invoke(null, modelItem);<NEW_LINE>if (!Boolean.valueOf(String.valueOf(applies)))<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>// this is ok - ignore<NEW_LINE>}<NEW_LINE>Constructor<Inspector> constructor = inspectorClass.getConstructor(Editor.class, targetClass);<NEW_LINE>EditorInspector<?> inspectorToReturn = (EditorInspector<?>) <MASK><NEW_LINE>return PluginProxies.proxyIfApplicable(inspectorToReturn);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>SoapUI.logError(e);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | constructor.newInstance(editor, modelItem); |
744,408 | public void paint(Graphics g) {<NEW_LINE>Dimension size = getSize();<NEW_LINE>int gridSize = (int) renderer.getScaledGridSize();<NEW_LINE>// Background<NEW_LINE>g.setColor(getBackground());<NEW_LINE>g.fillRect(x, y, <MASK><NEW_LINE>// Border<NEW_LINE>AppStyle.border.paintAround((Graphics2D) g, x, y, size.width - 1, size.height - 1);<NEW_LINE>// Images<NEW_LINE>tokenLocationList.clear();<NEW_LINE>for (int i = 0; i < tokenList.size(); i++) {<NEW_LINE>Token token = tokenList.get(i);<NEW_LINE>BufferedImage image = ImageManager.getImage(token.getImageAssetId(), renderer);<NEW_LINE>Dimension imgSize = new Dimension(image.getWidth(), image.getHeight());<NEW_LINE>SwingUtil.constrainTo(imgSize, gridSize);<NEW_LINE>Rectangle bounds = new Rectangle(x + PADDING + i * (gridSize + PADDING), y + PADDING, imgSize.width, imgSize.height);<NEW_LINE>g.drawImage(image, bounds.x, bounds.y, bounds.width, bounds.height, renderer);<NEW_LINE>tokenLocationList.add(new TokenLocation(bounds, token));<NEW_LINE>}<NEW_LINE>} | size.width, size.height); |
526,917 | public RestRequest makeRequest(int method, String url, java.util.Map<String, String> params, RestRequest.Listener listener, RestRequest.ErrorListener errorListener) {<NEW_LINE>AppLog.v(T.TESTS, this.getClass() + ": makeRequest(" + url + ")");<NEW_LINE>RestRequest dummyReturnValue = new RestRequest(method, url, params, listener, errorListener);<NEW_LINE>// URL example: https://public-api.wordpress.com/rest/v1/me<NEW_LINE>// Filename: default-public-api-wordpress-com-rest-v1-me.json<NEW_LINE>String filename = mPrefix + "-" + url.replace("https://", "").replace("/", "-").replace(".", "-").<MASK><NEW_LINE>if ("password-invalid".equals(mPrefix) && errorListener != null) {<NEW_LINE>errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename));<NEW_LINE>return dummyReturnValue;<NEW_LINE>}<NEW_LINE>if ("username-exists".equals(mPrefix) && errorListener != null) {<NEW_LINE>errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename));<NEW_LINE>return dummyReturnValue;<NEW_LINE>}<NEW_LINE>if ("timeout".equals(mPrefix) && errorListener != null) {<NEW_LINE>errorListener.onErrorResponse(forgeVolleyTimeoutError());<NEW_LINE>return dummyReturnValue;<NEW_LINE>}<NEW_LINE>if ("site-reserved".equals(mPrefix) && errorListener != null) {<NEW_LINE>errorListener.onErrorResponse(forgeVolleyErrorFromFilename(filename));<NEW_LINE>return dummyReturnValue;<NEW_LINE>}<NEW_LINE>String data = fileToString(filename);<NEW_LINE>if (data == null) {<NEW_LINE>AppLog.e(T.TESTS, "Can't read file: " + filename);<NEW_LINE>throw new RuntimeException("Can't read file: " + filename);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>JSONObject jsonObj = new JSONObject(data);<NEW_LINE>listener.onResponse(jsonObj);<NEW_LINE>} catch (JSONException je) {<NEW_LINE>AppLog.e(T.TESTS, je.toString());<NEW_LINE>}<NEW_LINE>return dummyReturnValue;<NEW_LINE>} | replace("?", "-") + ".json"; |
13,187 | public com.amazonaws.services.personalize.model.InvalidNextTokenException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.personalize.model.InvalidNextTokenException invalidNextTokenException = new com.amazonaws.services.personalize.model.InvalidNextTokenException(null);<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 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>} 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 invalidNextTokenException;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
485,462 | private void mapRequestBodyMatchers(YamlContract.Request yamlContractRequest, Request dslContractRequest) {<NEW_LINE>dslContractRequest.bodyMatchers((bodyMatchers) -> Optional.ofNullable(yamlContractRequest.matchers).map(stubMatchers -> stubMatchers.body).ifPresent(stubMatchers -> stubMatchers.forEach(stubMatcher -> {<NEW_LINE>ContentType contentType = evaluateClientSideContentType(yamlHeadersToContractHeaders(Optional.ofNullable(yamlContractRequest.headers).orElse(new HashMap<>())), Optional.ofNullable(yamlContractRequest.body).orElse(null));<NEW_LINE>MatchingTypeValue value = null;<NEW_LINE>switch(stubMatcher.type) {<NEW_LINE>case by_date:<NEW_LINE>value = bodyMatchers.byDate();<NEW_LINE>break;<NEW_LINE>case by_time:<NEW_LINE>value = bodyMatchers.byTime();<NEW_LINE>break;<NEW_LINE>case by_timestamp:<NEW_LINE>value = bodyMatchers.byTimestamp();<NEW_LINE>break;<NEW_LINE>case by_regex:<NEW_LINE>String regex = stubMatcher.value;<NEW_LINE>if (stubMatcher.predefined != null) {<NEW_LINE>regex = predefinedToPattern(stubMatcher.predefined).pattern();<NEW_LINE>}<NEW_LINE>value = bodyMatchers.byRegex(regex);<NEW_LINE>break;<NEW_LINE>case by_equality:<NEW_LINE>value = bodyMatchers.byEquality();<NEW_LINE>break;<NEW_LINE>case by_type:<NEW_LINE>value = bodyMatchers.byType(matchingTypeValueHolder -> {<NEW_LINE>if (stubMatcher.minOccurrence != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (stubMatcher.maxOccurrence != null) {<NEW_LINE>matchingTypeValueHolder.maxOccurrence(stubMatcher.maxOccurrence);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>break;<NEW_LINE>case by_null:<NEW_LINE>// do nothing<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new UnsupportedOperationException("The type [" + stubMatcher.type + "] is" + " unsupported.Hint:If you 're using <predefined> remember to pass <type:by_regex > ");<NEW_LINE>}<NEW_LINE>if (value != null) {<NEW_LINE>if (XML == contentType) {<NEW_LINE>bodyMatchers.xPath(stubMatcher.path, value);<NEW_LINE>} else {<NEW_LINE>bodyMatchers.jsonPath(stubMatcher.path, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>})));<NEW_LINE>} | matchingTypeValueHolder.minOccurrence(stubMatcher.minOccurrence); |
1,534,118 | private void invokeBatchlet(Batchlet batchlet) throws BatchContainerServiceException {<NEW_LINE>String batchletId = batchlet.getRef();<NEW_LINE>List<Property> propList = (batchlet.getProperties() == null) ? null : (List<Property>) batchlet.getProperties().getPropertyList();<NEW_LINE>String sourceMethod = "invokeBatchlet";<NEW_LINE>if (logger.isLoggable(Level.FINER)) {<NEW_LINE>logger.entering(sourceClass, sourceMethod, batchletId);<NEW_LINE>}<NEW_LINE>InjectionReferences injectionRef = new InjectionReferences(runtimeWorkUnitExecution.getWorkUnitJobContext(), runtimeStepExecution, propList);<NEW_LINE>try {<NEW_LINE>batchletProxy = ProxyFactory.createBatchletProxy(batchletId, injectionRef, runtimeStepExecution);<NEW_LINE>} catch (ArtifactValidationException e) {<NEW_LINE>throw new BatchContainerServiceException("Cannot create the batchlet [" + batchletId + "]", e);<NEW_LINE>}<NEW_LINE>if (logger.isLoggable(Level.FINE))<NEW_LINE>logger.fine("Batchlet is loaded and validated: " + batchletProxy);<NEW_LINE>if (wasStopIssuedOnJob()) {<NEW_LINE>logger.fine("Exit without executing batchlet since stop() request has been received.");<NEW_LINE>} else {<NEW_LINE>// The lack of synchronization here implies a very small window in which a stop() can get called before a process(),<NEW_LINE>// and the application must deal with that, if it wants to fail cleanly. Ending up in stopped vs.<NEW_LINE>// failed might not be a huge difference typically if you just want to restart next, but one<NEW_LINE>// could imagine a case where it DOES matter. OTOH, we can't just hold a lock and prevent stop while<NEW_LINE>// process() runs, obviously.<NEW_LINE>//<NEW_LINE>// Consider adding statement to the SPEC.<NEW_LINE>logger.fine("Starting process() for the Batchlet Artifact");<NEW_LINE>String processRetVal = batchletProxy.process();<NEW_LINE>logger.fine("Set process() return value = " + processRetVal + " for possible use as exitStatus");<NEW_LINE>runtimeStepExecution.setBatchletProcessRetVal(processRetVal);<NEW_LINE>logger.exiting(sourceClass, sourceMethod, <MASK><NEW_LINE>}<NEW_LINE>} | processRetVal == null ? "<null>" : processRetVal); |
521,688 | protected void init(DiscoveryContext context, DiscoveryTreeNode parent) {<NEW_LINE>MicroserviceInstance myself = RegistrationManager.INSTANCE.getMicroserviceInstance();<NEW_LINE>Map<String, MicroserviceInstance> instancesRegionAndAZMatch = new HashMap<>();<NEW_LINE>Map<String, MicroserviceInstance> instancesAZMatch = new HashMap<>();<NEW_LINE>Map<String, MicroserviceInstance> <MASK><NEW_LINE>Map<String, MicroserviceInstance> instances = parent.data();<NEW_LINE>instances.entrySet().forEach(stringMicroserviceInstanceEntry -> {<NEW_LINE>String id = stringMicroserviceInstanceEntry.getKey();<NEW_LINE>MicroserviceInstance target = stringMicroserviceInstanceEntry.getValue();<NEW_LINE>if (regionAndAZMatch(myself, target)) {<NEW_LINE>instancesRegionAndAZMatch.put(id, target);<NEW_LINE>} else if (regionMatch(myself, target)) {<NEW_LINE>instancesAZMatch.put(id, target);<NEW_LINE>} else {<NEW_LINE>instancesNoMatch.put(id, target);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>Map<String, DiscoveryTreeNode> children = new HashMap<>();<NEW_LINE>children.put(GROUP_RegionAndAZMatch, new DiscoveryTreeNode().subName(parent, GROUP_RegionAndAZMatch).data(instancesRegionAndAZMatch));<NEW_LINE>children.put(GROUP_InstancesAZMatch, new DiscoveryTreeNode().subName(parent, GROUP_InstancesAZMatch).data(instancesAZMatch));<NEW_LINE>children.put(GROUP_InstancesNoMatch, new DiscoveryTreeNode().subName(parent, GROUP_InstancesNoMatch).data(instancesNoMatch));<NEW_LINE>children.put(GROUP_Instances_All, new DiscoveryTreeNode().subName(parent, GROUP_Instances_All).data(instances));<NEW_LINE>parent.children(children);<NEW_LINE>} | instancesNoMatch = new HashMap<>(); |
488,328 | public void denoise(GrayF32 transform, int numLevels) {<NEW_LINE>int scale = UtilWavelet.computeScale(numLevels);<NEW_LINE>final int h = transform.height;<NEW_LINE>final int w = transform.width;<NEW_LINE>// width and height of scaling image<NEW_LINE>final int innerWidth = w / scale;<NEW_LINE>final int innerHeight = h / scale;<NEW_LINE>GrayF32 subbandHH = transform.subimage(w / 2, h / 2, w, h, null);<NEW_LINE>float sigma = <MASK><NEW_LINE>float threshold = (float) UtilDenoiseWavelet.universalThreshold(subbandHH, sigma);<NEW_LINE>// apply same threshold to all wavelet coefficients<NEW_LINE>rule.process(transform.subimage(innerWidth, 0, w, h, null), threshold);<NEW_LINE>rule.process(transform.subimage(0, innerHeight, innerWidth, h, null), threshold);<NEW_LINE>} | UtilDenoiseWavelet.estimateNoiseStdDev(subbandHH, null); |
1,004,203 | public void processOpts() {<NEW_LINE>super.processOpts();<NEW_LINE>if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {<NEW_LINE>setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));<NEW_LINE>} else {<NEW_LINE>setPackageName("openapi");<NEW_LINE>}<NEW_LINE>if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) {<NEW_LINE>setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION));<NEW_LINE>} else {<NEW_LINE>setPackageVersion("1.0.0");<NEW_LINE>}<NEW_LINE>additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);<NEW_LINE>additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);<NEW_LINE>additionalProperties.put("length", new Mustache.Lambda() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void execute(Template.Fragment fragment, Writer writer) throws IOException {<NEW_LINE>writer.write(length(fragment.context()));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>additionalProperties.put("qsEncode", new Mustache.Lambda() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void execute(Template.Fragment fragment, Writer writer) throws IOException {<NEW_LINE>writer.write(qsEncode(fragment.context()));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>modelPackage = packageName;<NEW_LINE>apiPackage = packageName;<NEW_LINE>supportingFiles.add(new SupportingFile<MASK><NEW_LINE>supportingFiles.add(new SupportingFile("app.src.mustache", "", "src" + File.separator + this.packageName + ".app.src"));<NEW_LINE>supportingFiles.add(new SupportingFile("utils.mustache", "", "src" + File.separator + this.packageName + "_utils.erl"));<NEW_LINE>supportingFiles.add(new SupportingFile("gen.mustache", "", "src" + File.separator + this.packageName + "_gen.erl"));<NEW_LINE>supportingFiles.add(new SupportingFile("include.mustache", "", "src" + File.separator + this.packageName + ".hrl"));<NEW_LINE>supportingFiles.add(new SupportingFile("statem.hrl.mustache", "", "src" + File.separator + this.packageName + "_statem.hrl"));<NEW_LINE>supportingFiles.add(new SupportingFile("test.mustache", "", "test" + File.separator + "prop_" + this.packageName + ".erl"));<NEW_LINE>supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));<NEW_LINE>} | ("rebar.config.mustache", "", "rebar.config")); |
1,643,139 | public boolean clearRelation(String relationName) {<NEW_LINE>Set<PersistentResource> mine = filter(ReadPermission.class, Optional.empty(), ALL_FIELDS, getRelationUncheckedUnfiltered(relationName)).toList(LinkedHashSet::new).blockingGet();<NEW_LINE>checkFieldAwareDeferPermissions(UpdatePermission.class, relationName, Collections.emptySet(), mine.stream().map(PersistentResource::getObject).collect<MASK><NEW_LINE>if (mine.isEmpty()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>RelationshipType type = getRelationshipType(relationName);<NEW_LINE>if (type.isToOne()) {<NEW_LINE>PersistentResource oldValue = IterableUtils.first(mine);<NEW_LINE>if (oldValue != null && oldValue.getObject() != null) {<NEW_LINE>this.nullValue(relationName, oldValue);<NEW_LINE>oldValue.markDirty();<NEW_LINE>this.markDirty();<NEW_LINE>// hook for updateToOneRelation<NEW_LINE>transaction.updateToOneRelation(transaction, obj, relationName, null, requestScope);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Collection collection = (Collection) getValueUnchecked(relationName);<NEW_LINE>if (CollectionUtils.isNotEmpty(collection)) {<NEW_LINE>Set<Object> deletedRelationships = new LinkedHashSet<>();<NEW_LINE>mine.stream().forEach(toDelete -> {<NEW_LINE>deletedRelationships.add(toDelete.getObject());<NEW_LINE>});<NEW_LINE>modifyCollection(collection, relationName, Collections.emptySet(), deletedRelationships, true);<NEW_LINE>this.markDirty();<NEW_LINE>// hook for updateToManyRelation<NEW_LINE>transaction.updateToManyRelation(transaction, obj, relationName, new LinkedHashSet<>(), deletedRelationships, requestScope);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | (Collectors.toSet())); |
274,579 | void initMediaSessionMetadata() {<NEW_LINE>MediaMetadataCompat.Builder metadataBuilder = new MediaMetadataCompat.Builder();<NEW_LINE>// Notification icon in card<NEW_LINE>MediaMetaData md = RemoteControlCallback.getMetaData();<NEW_LINE>if (md == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (md.getDisplayIcon() != null) {<NEW_LINE>Bitmap i = (Bitmap) md.getDisplayIcon().getImage();<NEW_LINE>metadataBuilder.putBitmap(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON, i);<NEW_LINE>}<NEW_LINE>if (md.getAlbumArt() != null) {<NEW_LINE>Bitmap i = (Bitmap) md.getDisplayIcon().getImage();<NEW_LINE>metadataBuilder.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, i);<NEW_LINE>}<NEW_LINE>// lock screen icon for pre lollipop<NEW_LINE>if (md.getArt() != null) {<NEW_LINE>Bitmap i = (Bitmap) md.getDisplayIcon().getImage();<NEW_LINE>metadataBuilder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, i);<NEW_LINE>}<NEW_LINE>metadataBuilder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_TITLE, md.getTitle());<NEW_LINE>metadataBuilder.putString(MediaMetadataCompat.<MASK><NEW_LINE>metadataBuilder.putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, md.getTrackNumber());<NEW_LINE>metadataBuilder.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, md.getNumTracks());<NEW_LINE>mMediaSessionCompat.setMetadata(metadataBuilder.build());<NEW_LINE>} | METADATA_KEY_DISPLAY_SUBTITLE, md.getSubtitle()); |
1,408,498 | public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {<NEW_LINE>String key = DocValueFormat.<MASK><NEW_LINE>if (appendPrefixLength) {<NEW_LINE>key = key + "/" + prefixLength;<NEW_LINE>}<NEW_LINE>if (keyed) {<NEW_LINE>builder.startObject(key);<NEW_LINE>} else {<NEW_LINE>builder.startObject();<NEW_LINE>builder.field(CommonFields.KEY.getPreferredName(), key);<NEW_LINE>}<NEW_LINE>if (isIpv6 == false) {<NEW_LINE>builder.field("netmask", DocValueFormat.IP.format(netmask(prefixLength)));<NEW_LINE>}<NEW_LINE>builder.field(CommonFields.DOC_COUNT.getPreferredName(), docCount);<NEW_LINE>builder.field(IpPrefixAggregationBuilder.IS_IPV6_FIELD.getPreferredName(), isIpv6);<NEW_LINE>builder.field(IpPrefixAggregationBuilder.PREFIX_LENGTH_FIELD.getPreferredName(), prefixLength);<NEW_LINE>aggregations.toXContentInternal(builder, params);<NEW_LINE>builder.endObject();<NEW_LINE>return builder;<NEW_LINE>} | IP.format(this.key); |
263,144 | public void weave() {<NEW_LINE>getLogger().info("Artemis plugin started.");<NEW_LINE>if (!enableArtemisPlugin) {<NEW_LINE>getLogger().info("Plugin disabled via 'enableArtemisPlugin' set to false.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long start = System.currentTimeMillis();<NEW_LINE>// @todo provide gradle alternative.<NEW_LINE>// if (context != null && !context.hasDelta(sourceDirectory)) return;<NEW_LINE>Logger log = getLogger();<NEW_LINE>// log.info("");<NEW_LINE>log.info("CONFIGURATION");<NEW_LINE>log.info(WeaverLog.LINE<MASK><NEW_LINE>log.info(WeaverLog.format("enablePooledWeaving", enablePooledWeaving));<NEW_LINE>log.info(WeaverLog.format("generateLinkMutators", generateLinkMutators));<NEW_LINE>log.info(WeaverLog.format("optimizeEntitySystems", optimizeEntitySystems));<NEW_LINE>if (classesDirs != null && !classesDirs.isEmpty()) {<NEW_LINE>log.info(WeaverLog.format("outputDirectories", classesDirs.getFiles()));<NEW_LINE>} else {<NEW_LINE>log.info(WeaverLog.format("outputDirectory", classesDir));<NEW_LINE>}<NEW_LINE>log.info(WeaverLog.LINE.replaceAll("\n", ""));<NEW_LINE>Weaver.enablePooledWeaving(enablePooledWeaving);<NEW_LINE>Weaver.generateLinkMutators(generateLinkMutators);<NEW_LINE>Weaver.optimizeEntitySystems(optimizeEntitySystems);<NEW_LINE>Weaver weaver;<NEW_LINE>if (classesDirs != null && !classesDirs.isEmpty()) {<NEW_LINE>weaver = new Weaver(classesDirs.getFiles());<NEW_LINE>} else {<NEW_LINE>weaver = new Weaver(classesDir);<NEW_LINE>}<NEW_LINE>WeaverLog processed = weaver.execute();<NEW_LINE>for (String s : processed.getFormattedLog().split("\n")) {<NEW_LINE>log.info(s);<NEW_LINE>}<NEW_LINE>} | .replaceAll("\n", "")); |
273,181 | // NOI18N<NEW_LINE>@Hint(displayName = "#DN_org.netbeans.modules.java.hints.ClassStructure.noopMethodInAbstractClass", description = "#DESC_org.netbeans.modules.java.hints.ClassStructure.noopMethodInAbstractClass", category = "class_structure", enabled = false, suppressWarnings = { "NoopMethodInAbstractClass" }, options = Options.QUERY)<NEW_LINE>@TriggerTreeKind(Kind.METHOD)<NEW_LINE>public static ErrorDescription noopMethodInAbstractClass(HintContext context) {<NEW_LINE>final MethodTree mth = (MethodTree) context.getPath().getLeaf();<NEW_LINE>final Tree parent = context.getPath().getParentPath().getLeaf();<NEW_LINE>if (TreeUtilities.CLASS_TREE_KINDS.contains(parent.getKind()) && ((ClassTree) parent).getModifiers().getFlags().contains(Modifier.ABSTRACT)) {<NEW_LINE>final <MASK><NEW_LINE>if (body != null && body.getStatements().isEmpty()) {<NEW_LINE>// NOI18N<NEW_LINE>return ErrorDescriptionFactory.forName(context, mth, NbBundle.getMessage(ClassStructure.class, "MSG_NoopMethodInAbstractClass", mth.getName()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | BlockTree body = mth.getBody(); |
1,141,458 | private List<Subspace> generateSubspaceCandidates(List<Subspace> subspaces) {<NEW_LINE>if (subspaces.isEmpty()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>StringBuilder msgFinest = LOG.isDebuggingFinest() ? new StringBuilder(1000) : null;<NEW_LINE>if (msgFinest != null) {<NEW_LINE>msgFinest.append("subspaces ").append(subspaces).append('\n');<NEW_LINE>}<NEW_LINE>List<Subspace> candidates = new ArrayList<>();<NEW_LINE>// Generate d-dimensional candidate subspaces<NEW_LINE>final int d = subspaces.get(0).dimensionality() + 1;<NEW_LINE>for (int i = 0; i < subspaces.size(); i++) {<NEW_LINE>Subspace s1 = subspaces.get(i);<NEW_LINE>for (int j = i + 1; j < subspaces.size(); j++) {<NEW_LINE>Subspace candidate = s1.join(subspaces.get(j));<NEW_LINE>if (candidate == null) {<NEW_LINE>// Filtered by prefix rule<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// prune irrelevant candidate subspaces<NEW_LINE>if (d == 2 || checkLower(candidate, subspaces)) {<NEW_LINE>if (msgFinest != null) {<NEW_LINE>msgFinest.append("candidate: ").append(candidate.dimensionsToString<MASK><NEW_LINE>}<NEW_LINE>candidates.add(candidate);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (msgFinest != null) {<NEW_LINE>LOG.debugFinest(msgFinest.toString());<NEW_LINE>}<NEW_LINE>if (LOG.isDebugging()) {<NEW_LINE>StringBuilder msg = new StringBuilder(1000).append(d).append("-dimensional candidate subspaces: ");<NEW_LINE>for (Subspace candidate : candidates) {<NEW_LINE>msg.append(candidate.dimensionsToString()).append(' ');<NEW_LINE>}<NEW_LINE>LOG.debug(msg.toString());<NEW_LINE>}<NEW_LINE>return candidates;<NEW_LINE>} | ()).append('\n'); |
1,678,209 | public void updateOrCreateWorkspace() throws IOException {<NEW_LINE>boolean workspaceUpdated = false;<NEW_LINE>Document workspaceDocument = null;<NEW_LINE>Path workspacePath = getWorkspacePath();<NEW_LINE>if (filesystem.exists(workspacePath)) {<NEW_LINE>try (InputStream workspaceFile = filesystem.newFileInputStream(workspacePath)) {<NEW_LINE>LOG.debug("Trying to update existing workspace.");<NEW_LINE>workspaceDocument = updateExistingWorkspace(workspaceFile);<NEW_LINE>workspaceUpdated = true;<NEW_LINE>} catch (ParserConfigurationException | SAXException | XPathExpressionException e) {<NEW_LINE>LOG.error("Cannot update workspace.xml file, trying re-create it", e);<NEW_LINE>}<NEW_LINE>if (!workspaceUpdated && !filesystem.deleteFileAtPathIfExists(workspacePath)) {<NEW_LINE>LOG.warn("Cannot remove file: %s", filesystem.resolve(workspacePath));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!workspaceUpdated) {<NEW_LINE>try {<NEW_LINE>workspaceDocument = createNewWorkspace();<NEW_LINE>} catch (ParserConfigurationException e) {<NEW_LINE>LOG.error("Cannot create workspace.xml file", e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try (OutputStream workspaceFile = filesystem.newFileOutputStream(workspacePath)) {<NEW_LINE>writeDocument(Objects<MASK><NEW_LINE>} catch (TransformerException e) {<NEW_LINE>LOG.error(e, "Cannot create workspace in %s", filesystem.resolve(workspacePath));<NEW_LINE>}<NEW_LINE>} | .requireNonNull(workspaceDocument), workspaceFile); |
1,384,380 | final CreateConnectionResult executeCreateConnection(CreateConnectionRequest createConnectionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createConnectionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateConnectionRequest> request = null;<NEW_LINE>Response<CreateConnectionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateConnectionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createConnectionRequest));<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, "Glue");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateConnection");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateConnectionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateConnectionResultJsonUnmarshaller());<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); |
901,097 | private void packVector(AMD64MacroAssembler asm, AVXSize vecSize, Register src, Register dst, Register index, int displacement, boolean direct) {<NEW_LINE>int displacementSrc = displacement << scaleSrc.log2 - scaleDst.log2;<NEW_LINE>Register vec1 = asRegister(vectorTemp[0]);<NEW_LINE>Register vec2 = asRegister(vectorTemp[1]);<NEW_LINE>movdqu(asm, vecSize, vec1, indexAddressOrDirect(src, index, displacementSrc, 0, direct));<NEW_LINE>movdqu(asm, vecSize, vec2, indexAddressOrDirect(src, index, displacementSrc, vecSize.getBytes(), direct));<NEW_LINE>switch(op) {<NEW_LINE>case compressCharToByte:<NEW_LINE>packuswb(asm, vecSize, vec1, vec2);<NEW_LINE>break;<NEW_LINE>case compressIntToChar:<NEW_LINE>packusdw(asm, vecSize, vec1, vec2);<NEW_LINE>break;<NEW_LINE>case compressIntToByte:<NEW_LINE>Register vec3 <MASK><NEW_LINE>Register vec4 = asRegister(vectorTemp[3]);<NEW_LINE>movdqu(asm, vecSize, vec3, indexAddressOrDirect(src, index, displacementSrc, vecSize.getBytes() * 2, direct));<NEW_LINE>movdqu(asm, vecSize, vec4, indexAddressOrDirect(src, index, displacementSrc, vecSize.getBytes() * 3, direct));<NEW_LINE>packusdw(asm, vecSize, vec1, vec2);<NEW_LINE>packusdw(asm, vecSize, vec3, vec4);<NEW_LINE>packuswb(asm, vecSize, vec1, vec3);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (vecSize == YMM) {<NEW_LINE>if (op == Op.compressIntToByte) {<NEW_LINE>VexRVMOp.VPERMD.emit(asm, vecSize, vec1, asRegister(vectorTemp[4]), vec1);<NEW_LINE>} else {<NEW_LINE>VexRMIOp.VPERMQ.emit(asm, vecSize, vec1, vec1, 0b11011000);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>movdqu(asm, vecSize, new AMD64Address(dst, index, scaleDst, displacement), vec1);<NEW_LINE>} | = asRegister(vectorTemp[2]); |
762,270 | private void removeFunctionsNotInProgram2(AddressSetView addrSet2, TaskMonitor monitor) throws CancelledException, UnsupportedOperationException {<NEW_LINE>if (!originToResultTranslator.isOneForOneTranslator()) {<NEW_LINE>String message = originToResultTranslator.getClass().getName() + " is not a one for one translator and can't remove functions not in program2.";<NEW_LINE>throw new UnsupportedOperationException(message);<NEW_LINE>}<NEW_LINE>monitor.setMessage("Removing Functions...");<NEW_LINE>AddressSet addrSet1 = originToResultTranslator.getAddressSet(addrSet2);<NEW_LINE>FunctionManager funcMgr1 = this.resultProgram.getFunctionManager();<NEW_LINE>FunctionManager funcMgr2 = this.originProgram.getFunctionManager();<NEW_LINE>FunctionIterator funcIter1 = funcMgr1.getFunctions(addrSet1, true);<NEW_LINE>FunctionIterator funcIter2 = funcMgr2.getFunctions(addrSet2, true);<NEW_LINE><MASK><NEW_LINE>FunctionAddressIterator iter2 = new FunctionAddressIterator(funcIter2);<NEW_LINE>HashSet<Address> resultsToKeep = new HashSet<>();<NEW_LINE>while (iter2.hasNext()) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>Address addr2 = iter2.next();<NEW_LINE>Address addr1 = originToResultTranslator.getAddress(addr2);<NEW_LINE>resultsToKeep.add(addr1);<NEW_LINE>}<NEW_LINE>while (iter1.hasNext()) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>Address resultAddress = iter1.next();<NEW_LINE>if (!resultsToKeep.contains(resultAddress)) {<NEW_LINE>monitor.setMessage("Removing Functions... " + resultAddress.toString(true));<NEW_LINE>funcMgr1.removeFunction(resultAddress);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | FunctionAddressIterator iter1 = new FunctionAddressIterator(funcIter1); |
423,153 | public void createMenuItems(Bundle savedInstanceState) {<NEW_LINE>final OsmandApplication app = getMyApplication();<NEW_LINE>Context context = getContext();<NEW_LINE>if (context == null || app == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (savedInstanceState != null) {<NEW_LINE>pluginId = savedInstanceState.getString(PLUGIN_ID_KEY);<NEW_LINE>} else {<NEW_LINE>Bundle args = getArguments();<NEW_LINE>if (args != null) {<NEW_LINE>pluginId = args.getString(PLUGIN_ID_KEY);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>OsmandPlugin plugin = OsmandPlugin.getPlugin(pluginId);<NEW_LINE>if (plugin == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>BaseBottomSheetItem titleItem = new TitleItem.Builder().setTitle(getString(R.string.new_plugin_added)).setLayoutId(R.layout.bottom_sheet_item_title_big).create();<NEW_LINE>items.add(titleItem);<NEW_LINE>Typeface typeface = FontCache.getRobotoMedium(getContext());<NEW_LINE>SpannableString pluginTitleSpan = new SpannableString(plugin.getName());<NEW_LINE>pluginTitleSpan.setSpan(new CustomTypefaceSpan(typeface), 0, pluginTitleSpan.length(), 0);<NEW_LINE>Drawable pluginIcon = plugin.getLogoResource();<NEW_LINE>if (pluginIcon.getConstantState() != null) {<NEW_LINE>pluginIcon = pluginIcon.getConstantState().newDrawable().mutate();<NEW_LINE>}<NEW_LINE>pluginIcon = UiUtilities.tintDrawable(pluginIcon, ColorUtilities.getDefaultIconColor(app, nightMode));<NEW_LINE>BaseBottomSheetItem pluginTitle = new SimpleBottomSheetItem.Builder().setTitle(pluginTitleSpan).setTitleColorId(ColorUtilities.getActiveColorId(nightMode)).setIcon(pluginIcon).setLayoutId(R.layout.bottom_sheet_item_simple_56dp).create();<NEW_LINE>items.add(pluginTitle);<NEW_LINE>descrItem = (BottomSheetItemTitleWithDescrAndButton) new BottomSheetItemTitleWithDescrAndButton.Builder().setButtonTitle(getString(R.string.show_full_description)).setOnButtonClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>descriptionExpanded = !descriptionExpanded;<NEW_LINE>descrItem.setButtonText(getString(descriptionExpanded ? R.string.hide_full_description : R.string.show_full_description));<NEW_LINE>descrItem.setDescriptionMaxLines(descriptionExpanded ? Integer.MAX_VALUE : COLLAPSED_DESCRIPTION_LINES);<NEW_LINE>setupHeightAndBackground(getView());<NEW_LINE>}<NEW_LINE>}).setDescriptionLinksClickable(true).setDescription(plugin.getDescription()).setDescriptionMaxLines(COLLAPSED_DESCRIPTION_LINES).setLayoutId(R.layout.bottom_sheet_item_with_expandable_descr).create();<NEW_LINE>items.add(descrItem);<NEW_LINE>List<ApplicationMode<MASK><NEW_LINE>if (!addedAppModes.isEmpty()) {<NEW_LINE>createAddedAppModesItems(addedAppModes);<NEW_LINE>}<NEW_LINE>List<IndexItem> suggestedMaps = plugin.getSuggestedMaps();<NEW_LINE>if (!suggestedMaps.isEmpty()) {<NEW_LINE>createSuggestedMapsItems(suggestedMaps);<NEW_LINE>}<NEW_LINE>} | > addedAppModes = plugin.getAddedAppModes(); |
1,324,909 | public void splitStockMoveLinesUnit(ActionRequest request, ActionResponse response) {<NEW_LINE>try {<NEW_LINE>StockMove stockMove = request.getContext().asType(StockMove.class);<NEW_LINE>List<StockMoveLine> stockMoveLineContextList = (List<StockMoveLine>) request.getContext().get("stockMoveLineList");<NEW_LINE>stockMove = Beans.get(StockMoveRepository.class).find(stockMove.getId());<NEW_LINE>if (stockMoveLineContextList == null) {<NEW_LINE>response.setFlash(I18n.get(IExceptionMessage.STOCK_MOVE_14));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<StockMoveLine> stockMoveLineList = new ArrayList<>();<NEW_LINE>StockMoveLineRepository stockMoveLineRepo = Beans.get(StockMoveLineRepository.class);<NEW_LINE>for (StockMoveLine stockMoveLineContext : stockMoveLineContextList.stream().filter(StockMoveLine::isSelected).collect(Collectors.toList())) {<NEW_LINE>StockMoveLine stockMoveLine = stockMoveLineRepo.<MASK><NEW_LINE>stockMoveLine.setSelected(true);<NEW_LINE>stockMoveLineList.add(stockMoveLine);<NEW_LINE>}<NEW_LINE>boolean selected = Beans.get(StockMoveService.class).splitStockMoveLines(stockMove, stockMoveLineList, BigDecimal.ONE);<NEW_LINE>if (!selected) {<NEW_LINE>response.setFlash(I18n.get(IExceptionMessage.STOCK_MOVE_15));<NEW_LINE>}<NEW_LINE>response.setReload(true);<NEW_LINE>} catch (Exception e) {<NEW_LINE>TraceBackService.trace(response, e);<NEW_LINE>}<NEW_LINE>} | find(stockMoveLineContext.getId()); |
1,589,507 | protected void prepare() {<NEW_LINE>ProcessInfoParameter[] para = getParameter();<NEW_LINE>for (int i = 0; i < para.length; i++) {<NEW_LINE>String name = para[i].getParameterName();<NEW_LINE>if (para[i].getParameter() == null)<NEW_LINE>;<NEW_LINE>else if (name.equals("AD_Client_ID"))<NEW_LINE>p_AD_Client_ID = para[i].getParameterAsInt();<NEW_LINE>else if (name.equals("M_Product_Category_ID"))<NEW_LINE>p_M_Product_Category_ID = <MASK><NEW_LINE>else if (name.equals("SetFutureCostTo"))<NEW_LINE>p_SetFutureCostTo = (String) para[i].getParameter();<NEW_LINE>else if (name.equals("M_PriceList_Version_ID"))<NEW_LINE>p_M_PriceList_Version_ID = para[i].getParameterAsInt();<NEW_LINE>else if (name.equals("SetStandardCost"))<NEW_LINE>p_SetStandardCost = (String) para[i].getParameter();<NEW_LINE>else<NEW_LINE>log.log(Level.SEVERE, "Unknown Parameter: " + name);<NEW_LINE>}<NEW_LINE>p_Record_ID = getRecord_ID();<NEW_LINE>} | para[i].getParameterAsInt(); |
188,375 | public byte[] toBytes() {<NEW_LINE>ByteBuffer byteBuffer = ByteBuffer.allocate(chunkSize);<NEW_LINE>byteBuffer.order(ByteOrder.LITTLE_ENDIAN);<NEW_LINE>byteBuffer.clear();<NEW_LINE>byteBuffer.putShort(type);<NEW_LINE>byteBuffer.putShort(headSize);<NEW_LINE>byteBuffer.putInt(chunkSize);<NEW_LINE>byteBuffer.put(id);<NEW_LINE>byteBuffer.put(reserved0);<NEW_LINE>byteBuffer.putShort(reserved1);<NEW_LINE>byteBuffer.putInt(entryCount);<NEW_LINE>byteBuffer.putInt(entryTableOffset);<NEW_LINE>if (resConfigFlags != null) {<NEW_LINE>byteBuffer.put(resConfigFlags.toBytes());<NEW_LINE>}<NEW_LINE>if (headPadding > 0) {<NEW_LINE>byteBuffer.put(new byte[headPadding]);<NEW_LINE>}<NEW_LINE>if (entryOffsets != null) {<NEW_LINE>for (int i = 0; i < entryOffsets.size(); i++) {<NEW_LINE>byteBuffer.putInt(entryOffsets.get(i));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (entryTable != null) {<NEW_LINE>for (int i = 0; i < entryTable.size(); i++) {<NEW_LINE>if (entryTable.get(i) != null) {<NEW_LINE>byteBuffer.put(entryTable.get(i).toBytes());<NEW_LINE>} else {<NEW_LINE>// NO_ENTRY<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (chunkPadding > 0) {<NEW_LINE>byteBuffer.<MASK><NEW_LINE>}<NEW_LINE>byteBuffer.flip();<NEW_LINE>return byteBuffer.array();<NEW_LINE>} | put(new byte[chunkPadding]); |
91,084 | private void runActivities(@Nonnull UIAccess uiAccess, @Nonnull Deque<StartupActivity> activities, @Nonnull String phaseName) {<NEW_LINE>Activity activity = StartUpMeasurer.startMainActivity(phaseName);<NEW_LINE>while (true) {<NEW_LINE>StartupActivity startupActivity;<NEW_LINE>synchronized (myLock) {<NEW_LINE>startupActivity = activities.pollFirst();<NEW_LINE>}<NEW_LINE>if (startupActivity == null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>long startTime = StartUpMeasurer.getCurrentTime();<NEW_LINE>PluginDescriptor plugin = PluginManager.getPlugin(startupActivity.getClass());<NEW_LINE>PluginId pluginId = plugin != null ? plugin.getPluginId() : PluginIds.CONSULO_PLATFORM_BASE;<NEW_LINE>runActivity(uiAccess, startupActivity);<NEW_LINE>StartUpMeasurer.addCompletedActivity(startTime, startupActivity.getClass(), ActivityCategory.POST_STARTUP_ACTIVITY, pluginId.<MASK><NEW_LINE>}<NEW_LINE>activity.end();<NEW_LINE>} | toString(), StartUpMeasurer.MEASURE_THRESHOLD); |
1,253,930 | public int next(int targetRecordCount) {<NEW_LINE>try {<NEW_LINE>for (int outgoingIndex = 0; outgoingIndex < targetRecordCount; outgoingIndex++) {<NEW_LINE>if (queueSize == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>int compoundIndex = vector4.get(0);<NEW_LINE>int batch = compoundIndex >>> 16;<NEW_LINE>assert batch < batchGroups.size() : String.format("batch: %d batchGroups: %d", batch, batchGroups.size());<NEW_LINE>doCopy(compoundIndex, outgoingIndex);<NEW_LINE>int nextIndex = batchGroups.<MASK><NEW_LINE>if (nextIndex < 0) {<NEW_LINE>vector4.set(0, vector4.get(--queueSize));<NEW_LINE>} else {<NEW_LINE>vector4.set(0, batch, nextIndex);<NEW_LINE>}<NEW_LINE>if (queueSize == 0) {<NEW_LINE>VectorAccessibleUtilities.setValueCount(outgoing, ++outgoingIndex);<NEW_LINE>return outgoingIndex;<NEW_LINE>}<NEW_LINE>siftDown();<NEW_LINE>}<NEW_LINE>VectorAccessibleUtilities.setValueCount(outgoing, targetRecordCount);<NEW_LINE>return targetRecordCount;<NEW_LINE>} catch (SchemaChangeException e) {<NEW_LINE>throw new IllegalStateException(e);<NEW_LINE>}<NEW_LINE>} | get(batch).getNextIndex(); |
677,993 | protected void deactivate(ComponentContext context) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>Tr.entry(this, tc, "deactivate", context, _isChainActivated, _isChainDeactivated);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())<NEW_LINE>SibTr.debug(this, tc, "CommsOutboundChain: Destroying " + (_isSSLChain ? "Secure" : "Non-Secure") + " chain ", _chainName);<NEW_LINE>// The chain may have failed to activate if, for example, sslOptions and sslSupport were not defined.<NEW_LINE>if (_isChainDeactivated) {<NEW_LINE>FFDCFilter.processException(new IllegalStateException("_isChainActivated=" + _isChainActivated + " _isChainDeactivated=" + _isChainDeactivated), CommsOutboundChain.class.getName(), "050819_297", new Object[] { _isChainActivated, _isChainDeactivated });<NEW_LINE>} else {<NEW_LINE>_isChainDeactivated = true;<NEW_LINE>terminateConnectionsAssociatedWithChain();<NEW_LINE>}<NEW_LINE>_sslOptions.deactivate(context);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>Tr.<MASK><NEW_LINE>} | exit(this, tc, "deactivate"); |
1,221,719 | private static <T> T merge(T v1, T v2) {<NEW_LINE>if (v2 == null)<NEW_LINE>return v1;<NEW_LINE>if (v1 instanceof Collection) {<NEW_LINE>final Collection<Object> c1 = (Collection<Object>) v1;<NEW_LINE>final Collection<Object> c2 = (Collection<Object>) v2;<NEW_LINE>final Collection<Object> cm;<NEW_LINE>if (v1 instanceof List)<NEW_LINE>cm = new ArrayList<>(c1.size() + c2.size());<NEW_LINE>else if (v1 instanceof Set)<NEW_LINE>cm = new HashSet<>(c1.size() + c2.size());<NEW_LINE>else<NEW_LINE>throw new RuntimeException("Unhandled type: " + v1.<MASK><NEW_LINE>cm.addAll(c1);<NEW_LINE>addAllIfAbsent(cm, c2);<NEW_LINE>return (T) cm;<NEW_LINE>} else if (v1 instanceof Map) {<NEW_LINE>final Map<Object, Object> mm = new HashMap<>();<NEW_LINE>mm.putAll((Map<Object, Object>) v1);<NEW_LINE>mm.putAll((Map<Object, Object>) v2);<NEW_LINE>return (T) mm;<NEW_LINE>} else<NEW_LINE>return v2;<NEW_LINE>} | getClass().getName()); |
96,404 | private void updateOutline(@NotNull FlutterOutline outline) {<NEW_LINE>currentOutline = outline;<NEW_LINE>final DefaultMutableTreeNode rootNode = getRootNode();<NEW_LINE>rootNode.removeAllChildren();<NEW_LINE>outlinesWithWidgets.clear();<NEW_LINE>outlineToNodeMap.clear();<NEW_LINE>if (outline.getChildren() != null) {<NEW_LINE>computeOutlinesWithWidgets(outline);<NEW_LINE>updateOutlineImpl(rootNode, outline.getChildren());<NEW_LINE>}<NEW_LINE>getTreeModel().reload(rootNode);<NEW_LINE>tree.expandAll();<NEW_LINE>if (currentEditor != null) {<NEW_LINE>final Caret caret = currentEditor.getCaretModel().getPrimaryCaret();<NEW_LINE>applyEditorSelectionToTree(caret);<NEW_LINE>}<NEW_LINE>if (FlutterSettings.getInstance().isEnableHotUi() && propertyEditPanel == null) {<NEW_LINE>propertyEditSplitter = new Splitter(false, 0.75f);<NEW_LINE>propertyEditPanel = new PropertyEditorPanel(inspectorGroupManagerService, project, flutterAnalysisServer, false, false, project);<NEW_LINE>propertyEditPanel.<MASK><NEW_LINE>propertyEditToolbarGroup = new DefaultActionGroup();<NEW_LINE>final ActionToolbar windowToolbar = ActionManager.getInstance().createActionToolbar("PropertyArea", propertyEditToolbarGroup, true);<NEW_LINE>final SimpleToolWindowPanel window = new SimpleToolWindowPanel(true, true);<NEW_LINE>window.setToolbar(windowToolbar.getComponent());<NEW_LINE>final JScrollPane propertyScrollPane = ScrollPaneFactory.createScrollPane(propertyEditPanel);<NEW_LINE>window.setContent(propertyScrollPane);<NEW_LINE>propertyEditSplitter.setFirstComponent(window.getComponent());<NEW_LINE>final InspectorGroupManagerService.Client inspectorStateServiceClient = new InspectorGroupManagerService.Client(project) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onInspectorAvailabilityChanged() {<NEW_LINE>super.onInspectorAvailabilityChanged();<NEW_LINE>// Only show the screen mirror if there is a running device and<NEW_LINE>// the inspector supports the neccessary apis.<NEW_LINE>if (getInspectorService() != null && getInspectorService().isHotUiScreenMirrorSupported()) {<NEW_LINE>// Wait to create the preview area until it is needed.<NEW_LINE>if (previewArea == null) {<NEW_LINE>previewArea = new PreviewArea(project, outlinesWithWidgets, project);<NEW_LINE>}<NEW_LINE>propertyEditSplitter.setSecondComponent(previewArea.getComponent());<NEW_LINE>} else {<NEW_LINE>propertyEditSplitter.setSecondComponent(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>inspectorGroupManagerService.addListener(inspectorStateServiceClient, project);<NEW_LINE>splitter.setSecondComponent(propertyEditSplitter);<NEW_LINE>}<NEW_LINE>// TODO(jacobr): this is the wrong spot.<NEW_LINE>if (propertyEditToolbarGroup != null) {<NEW_LINE>final TitleAction propertyTitleAction = new TitleAction("Properties");<NEW_LINE>propertyEditToolbarGroup.removeAll();<NEW_LINE>propertyEditToolbarGroup.add(propertyTitleAction);<NEW_LINE>}<NEW_LINE>} | initalize(null, activeOutlines, currentFile); |
1,072,317 | protected void parseIntent(Context ctx, String action, Bundle bundle) {<NEW_LINE>if (ACTION_SPOTIFY_PLAYBACKSTATECHANGED.equals(action)) {<NEW_LINE>if (bundle.getBoolean("playing")) {<NEW_LINE>setState(MicroService.State.RESUME);<NEW_LINE>setIsSameAsCurrentTrack();<NEW_LINE>} else {<NEW_LINE>setState(MicroService.State.PAUSE);<NEW_LINE>setIsSameAsCurrentTrack();<NEW_LINE>}<NEW_LINE>} else if (ACTION_SPOTIFY_METADATACHANGED.equals(action)) {<NEW_LINE>setState(MicroService.State.START);<NEW_LINE>Artist artist = Artist.get(bundle.getString("artist"));<NEW_LINE>Album album = null;<NEW_LINE>if (bundle.getString("album") != null) {<NEW_LINE>album = Album.get(bundle.getString("album"), artist);<NEW_LINE>}<NEW_LINE>Track track = Track.get(bundle.getString<MASK><NEW_LINE>setTimestamp(System.currentTimeMillis());<NEW_LINE>// throws on bad data<NEW_LINE>setTrack(track);<NEW_LINE>}<NEW_LINE>} | ("track"), album, artist); |
545,537 | public static ModifySipAgentGroupResponse unmarshall(ModifySipAgentGroupResponse modifySipAgentGroupResponse, UnmarshallerContext context) {<NEW_LINE>modifySipAgentGroupResponse.setRequestId(context.stringValue("ModifySipAgentGroupResponse.RequestId"));<NEW_LINE>modifySipAgentGroupResponse.setSuccess(context.booleanValue("ModifySipAgentGroupResponse.Success"));<NEW_LINE>modifySipAgentGroupResponse.setCode(context.stringValue("ModifySipAgentGroupResponse.Code"));<NEW_LINE>modifySipAgentGroupResponse.setMessage<MASK><NEW_LINE>modifySipAgentGroupResponse.setHttpStatusCode(context.integerValue("ModifySipAgentGroupResponse.HttpStatusCode"));<NEW_LINE>modifySipAgentGroupResponse.setProvider(context.stringValue("ModifySipAgentGroupResponse.Provider"));<NEW_LINE>List<SipAgent> sipAgents = new ArrayList<SipAgent>();<NEW_LINE>for (int i = 0; i < context.lengthValue("ModifySipAgentGroupResponse.SipAgents.Length"); i++) {<NEW_LINE>SipAgent sipAgent = new SipAgent();<NEW_LINE>sipAgent.setId(context.longValue("ModifySipAgentGroupResponse.SipAgents[" + i + "].Id"));<NEW_LINE>sipAgent.setName(context.stringValue("ModifySipAgentGroupResponse.SipAgents[" + i + "].Name"));<NEW_LINE>sipAgent.setIp(context.stringValue("ModifySipAgentGroupResponse.SipAgents[" + i + "].Ip"));<NEW_LINE>sipAgent.setPort(context.stringValue("ModifySipAgentGroupResponse.SipAgents[" + i + "].Port"));<NEW_LINE>sipAgent.setSendInterface(context.integerValue("ModifySipAgentGroupResponse.SipAgents[" + i + "].SendInterface"));<NEW_LINE>sipAgent.setStatus(context.booleanValue("ModifySipAgentGroupResponse.SipAgents[" + i + "].Status"));<NEW_LINE>sipAgents.add(sipAgent);<NEW_LINE>}<NEW_LINE>modifySipAgentGroupResponse.setSipAgents(sipAgents);<NEW_LINE>return modifySipAgentGroupResponse;<NEW_LINE>} | (context.stringValue("ModifySipAgentGroupResponse.Message")); |
571,288 | public static String asString() {<NEW_LINE>final StringBuilder sb = new StringBuilder("Config{\n");<NEW_LINE>sb.append(" DEFAULT_BASE_DIR=").append(DEFAULT_BASE_DIR);<NEW_LINE>sb.append(",\n DEFAULT_BASE_CACHE_DIR=").append(DEFAULT_BASE_CACHE_DIR);<NEW_LINE>sb.append(",\n DEFAULT_BASE_LOG_FILE=").append(DEFAULT_BASE_LOG_FILE);<NEW_LINE>sb.append(",\n DEFAULT_BASE_CONFIG_FILE=").append(DEFAULT_BASE_CONFIG_FILE);<NEW_LINE>sb.append(",\n DEFAULT_BASE_OVERLAYS_FILE=").append(DEFAULT_BASE_OVERLAYS_FILE);<NEW_LINE>sb.append(",\n DEFAULT_REGION_SELECTION_COLOR=").append(DEFAULT_REGION_SELECTION_COLOR);<NEW_LINE>sb.append(",\n DEFAULT_CHUNK_SELECTION_COLOR=").append(DEFAULT_CHUNK_SELECTION_COLOR);<NEW_LINE>sb.append(",\n DEFAULT_PASTE_CHUNKS_COLOR=").append(DEFAULT_PASTE_CHUNKS_COLOR);<NEW_LINE>sb.append(",\n DEFAULT_LOCALE=").append(DEFAULT_LOCALE);<NEW_LINE>sb.append(",\n DEFAULT_PROCESS_THREADS=").append(DEFAULT_PROCESS_THREADS);<NEW_LINE>sb.append(",\n DEFAULT_WRITE_THREADS=").append(DEFAULT_WRITE_THREADS);<NEW_LINE>sb.append(",\n DEFAULT_MAX_LOADED_FILES=").append(DEFAULT_MAX_LOADED_FILES);<NEW_LINE>sb.append(",\n DEFAULT_SHADE=").append(DEFAULT_SHADE);<NEW_LINE>sb.append(",\n DEFAULT_SHADE_WATER=").append(DEFAULT_SHADE_WATER);<NEW_LINE>sb.append(",\n DEFAULT_SHOW_NONEXISTENT_REGIONS=").append(DEFAULT_SHOW_NONEXISTENT_REGIONS);<NEW_LINE>sb.append(",\n DEFAULT_SMOOTH_RENDERING=").append(DEFAULT_SMOOTH_RENDERING);<NEW_LINE>sb.append(",\n DEFAULT_SMOOTH_OVERLAYS=").append(DEFAULT_SMOOTH_OVERLAYS);<NEW_LINE>sb.append(",\n DEFAULT_TILEMAP_BACKGROUND='").append(DEFAULT_TILEMAP_BACKGROUND).append('\'');<NEW_LINE>sb.append(",\n DEFAULT_DEBUG=").append(DEFAULT_DEBUG);<NEW_LINE>sb.append(",\n DEFAULT_MC_SAVES_DIR='").append(DEFAULT_MC_SAVES_DIR).append('\'');<NEW_LINE>sb.append(",\n DEFAULT_RENDER_HEIGHT=").append(DEFAULT_RENDER_HEIGHT);<NEW_LINE>sb.append(",\n DEFAULT_RENDER_LAYER_ONLY=").append(DEFAULT_RENDER_LAYER_ONLY);<NEW_LINE>sb.append(",\n DEFAULT_RENDER_CAVES=").append(DEFAULT_RENDER_CAVES);<NEW_LINE>sb.append(",\n worldDir=").append(worldDir);<NEW_LINE>sb.append(",\n worldDirs=").append(worldDirs);<NEW_LINE>sb.append(",\n worldUUID=").append(worldUUID);<NEW_LINE>sb.append(",\n baseCacheDir=").append(baseCacheDir);<NEW_LINE>sb.append(",\n logFile=").append(logFile);<NEW_LINE>sb.append(",\n cacheDir=").append(cacheDir);<NEW_LINE>sb.append(",\n locale=").append(locale);<NEW_LINE>sb.append(",\n regionSelectionColor=").append(regionSelectionColor);<NEW_LINE>sb.append(",\n chunkSelectionColor=").append(chunkSelectionColor);<NEW_LINE>sb.append(",\n pasteChunksColor=").append(pasteChunksColor);<NEW_LINE>sb.append(",\n processThreads=").append(processThreads);<NEW_LINE>sb.append(",\n writeThreads=").append(writeThreads);<NEW_LINE>sb.append(",\n maxLoadedFiles=").append(maxLoadedFiles);<NEW_LINE>sb.append(",\n shade=").append(shade);<NEW_LINE>sb.append(",\n shadeWater=").append(shadeWater);<NEW_LINE>sb.append(",\n showNonexistentRegions=").append(showNonexistentRegions);<NEW_LINE>sb.append(",\n smoothRendering=").append(smoothRendering);<NEW_LINE>sb.append(",\n smoothOverlays=").append(smoothOverlays);<NEW_LINE>sb.append(",\n tileMapBackground='").append(tileMapBackground).append('\'');<NEW_LINE>sb.append(",\n mcSavesDir='").append(mcSavesDir).append('\'');<NEW_LINE>sb.append(",\n renderHeight=").append(renderHeight);<NEW_LINE>sb.append(",\n renderLayerOnly=").append(renderLayerOnly);<NEW_LINE>sb.append(",\n renderCaves=").append(renderCaves);<NEW_LINE>sb.append<MASK><NEW_LINE>sb.append(",\n MAX_SCALE=").append(MAX_SCALE);<NEW_LINE>sb.append(",\n MIN_SCALE=").append(MIN_SCALE);<NEW_LINE>sb.append(",\n IMAGE_POOL_SIZE=").append(IMAGE_POOL_SIZE);<NEW_LINE>sb.append("\n}");<NEW_LINE>return sb.toString();<NEW_LINE>} | (",\n debug=").append(debug); |
1,550,711 | public static void main(String[] args) {<NEW_LINE>Exercise24_PriorityQueueExplicitLinks<Integer>.PriorityQueueExplicitLinks priorityQueueExplicitLinks = new Exercise24_PriorityQueueExplicitLinks().new PriorityQueueExplicitLinks();<NEW_LINE>StdOut.println("isEmpty: " + priorityQueueExplicitLinks.isEmpty() + " Expected: true");<NEW_LINE>priorityQueueExplicitLinks.insert(10);<NEW_LINE>priorityQueueExplicitLinks.insert(2);<NEW_LINE>priorityQueueExplicitLinks.insert(7);<NEW_LINE>priorityQueueExplicitLinks.insert(20);<NEW_LINE>StdOut.println("Size: " + <MASK><NEW_LINE>StdOut.println("isEmpty: " + priorityQueueExplicitLinks.isEmpty() + " Expected: false");<NEW_LINE>StdOut.println("Item removed: " + priorityQueueExplicitLinks.deleteMax());<NEW_LINE>StdOut.println("Item removed: " + priorityQueueExplicitLinks.deleteMax());<NEW_LINE>StdOut.println("Item removed: " + priorityQueueExplicitLinks.deleteMax());<NEW_LINE>StdOut.println("Item removed: " + priorityQueueExplicitLinks.deleteMax());<NEW_LINE>} | priorityQueueExplicitLinks.size() + " Expected: 4"); |
447,022 | public void viewDirection(ActionRequest request, ActionResponse response) {<NEW_LINE>AddressRepository addressRepository = Beans.get(AddressRepository.class);<NEW_LINE>try {<NEW_LINE>MapService mapService = Beans.get(MapService.class);<NEW_LINE>String key = null;<NEW_LINE>if (Beans.get(AppBaseService.class).getAppBase().getMapApiSelect() == AppBaseRepository.MAP_API_GOOGLE) {<NEW_LINE>key = mapService.getGoogleMapsApiKey();<NEW_LINE>}<NEW_LINE>Company company = Optional.ofNullable(AuthUtils.getUser()).map(User::getActiveCompany).orElse(null);<NEW_LINE>if (company == null) {<NEW_LINE>response.setFlash(I18n.get(IExceptionMessage.PRODUCT_NO_ACTIVE_COMPANY));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Address departureAddress = company.getAddress();<NEW_LINE>if (departureAddress == null) {<NEW_LINE>response.setFlash(I18n.get(IExceptionMessage.ADDRESS_7));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>departureAddress = addressRepository.find(departureAddress.getId());<NEW_LINE>Optional<Pair<BigDecimal, BigDecimal>> departureLatLong = Beans.get(AddressService.class).getOrUpdateLatLong(departureAddress);<NEW_LINE>if (!departureLatLong.isPresent()) {<NEW_LINE>response.setFlash(String.format(I18n.get(IExceptionMessage.ADDRESS_5), departureAddress.getFullName()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Address arrivalAddress = request.getContext().asType(Address.class);<NEW_LINE>arrivalAddress = addressRepository.find(arrivalAddress.getId());<NEW_LINE>Optional<Pair<BigDecimal, BigDecimal>> arrivalLatLong = Beans.get(AddressService.class).getOrUpdateLatLong(arrivalAddress);<NEW_LINE>if (!arrivalLatLong.isPresent()) {<NEW_LINE>response.setFlash(String.format(I18n.get(IExceptionMessage.ADDRESS_5), arrivalAddress.getFullName()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Map<String, Object> <MASK><NEW_LINE>mapView.put("title", "Map");<NEW_LINE>mapView.put("resource", mapService.getDirectionUrl(key, departureLatLong.get(), arrivalLatLong.get()));<NEW_LINE>mapView.put("viewType", "html");<NEW_LINE>response.setView(mapView);<NEW_LINE>response.setReload(true);<NEW_LINE>} catch (Exception e) {<NEW_LINE>TraceBackService.trace(response, e);<NEW_LINE>}<NEW_LINE>} | mapView = new HashMap<>(); |
56,581 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {<NEW_LINE>log.info("doGet from " + request.getRemoteHost() + " - " + request.getRemoteAddr());<NEW_LINE>String url = "/rfqs.jsp";<NEW_LINE>//<NEW_LINE>HttpSession <MASK><NEW_LINE>if (session == null || session.getAttribute(WebInfo.NAME) == null)<NEW_LINE>url = "/login.jsp";<NEW_LINE>else {<NEW_LINE>session.removeAttribute(WebSessionCtx.HDR_MESSAGE);<NEW_LINE>WebInfo info = (WebInfo) session.getAttribute(WebInfo.NAME);<NEW_LINE>if (info != null)<NEW_LINE>info.setMessage("");<NEW_LINE>// Parameter = Note_ID - if is valid create PDF & stream it<NEW_LINE>String msg = streamAttachment(request, response);<NEW_LINE>if (msg == null || msg.length() == 0)<NEW_LINE>return;<NEW_LINE>if (info != null)<NEW_LINE>info.setMessage(msg);<NEW_LINE>}<NEW_LINE>log.info("doGet - Forward to " + url);<NEW_LINE>RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);<NEW_LINE>dispatcher.forward(request, response);<NEW_LINE>} | session = request.getSession(false); |
1,217,492 | /*<NEW_LINE>* @see com.sitewhere.microservice.security.SystemUserRunnable#runAsSystemUser()<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void runAsSystemUser() throws SiteWhereException {<NEW_LINE>getLogger().info("Processing batch element: " + getUnprocessed().getBatchElement().getId().toString());<NEW_LINE>// Check whether manager has been paused.<NEW_LINE>handlePauseAndThrottle();<NEW_LINE>// Only process unprocessed elements.<NEW_LINE>IBatchElement element = getUnprocessed().getBatchElement();<NEW_LINE>IBatchOperation operation = getBatchManagement().getBatchOperation(element.getBatchOperationId());<NEW_LINE>if (element.getProcessingStatus() != ElementProcessingStatus.Unprocessed) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Indicate element is being processed.<NEW_LINE>BatchElementCreateRequest request = new BatchElementCreateRequest();<NEW_LINE><MASK><NEW_LINE>getBatchManagement().updateBatchElement(element.getId(), request);<NEW_LINE>request = new BatchElementCreateRequest();<NEW_LINE>request.setMetadata(new HashMap<String, String>());<NEW_LINE>ElementProcessingStatus status = ElementProcessingStatus.Succeeded;<NEW_LINE>try {<NEW_LINE>IBatchOperationHandler handler = getHandlersByOperationType().get(operation.getOperationType());<NEW_LINE>if (handler != null) {<NEW_LINE>status = handler.process(operation, element, request);<NEW_LINE>} else {<NEW_LINE>status = ElementProcessingStatus.Failed;<NEW_LINE>}<NEW_LINE>// Indicate element succeeded in processing.<NEW_LINE>request.setProcessingStatus(status);<NEW_LINE>request.setProcessedDate(new Date());<NEW_LINE>} catch (SiteWhereException t) {<NEW_LINE>// Indicate element failed in processing.<NEW_LINE>getLogger().error("Error processing batch invocation element.", t);<NEW_LINE>request.setProcessingStatus(ElementProcessingStatus.Failed);<NEW_LINE>} finally {<NEW_LINE>getBatchManagement().updateBatchElement(element.getId(), request);<NEW_LINE>}<NEW_LINE>} | request.setProcessingStatus(ElementProcessingStatus.Processing); |
460,103 | public static void safeDeleteFile(final String pathName) {<NEW_LINE>String <MASK><NEW_LINE>if (StringUtils.isNullOrWhitespaceOnly(userDir)) {<NEW_LINE>throw new RuntimeException("user.dir is empty");<NEW_LINE>}<NEW_LINE>File file = new File(pathName);<NEW_LINE>if (!file.getAbsolutePath().startsWith(userDir)) {<NEW_LINE>throw new RuntimeException("Trying to delete a file/dir outside of user directory.");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (file.exists()) {<NEW_LINE>if (AlinkGlobalConfiguration.isPrintProcessInfo()) {<NEW_LINE>System.out.println("deleting " + file.getName());<NEW_LINE>}<NEW_LINE>if (file.isFile()) {<NEW_LINE>file.delete();<NEW_LINE>} else if (file.isDirectory()) {<NEW_LINE>FileUtils.deleteDirectory(file);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("Fail to delete " + pathName);<NEW_LINE>}<NEW_LINE>} | userDir = System.getProperty("user.dir"); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.