auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void checkDecisionServerContainer() throws Exception { log.info("Running test checkDecisionServerContainer"); prepareClientInvocation(); getKieRestServiceClient(getRouteURL()).listContainers().getResult().getContainers().stream().forEach(container -> { String containerAliasToID = new SumCoder.MD5().encode(container.getResolvedReleaseId().getArtifactId() + "=" + container.getReleaseId()); if (!containerAliasToID.equals(container.getContainerId())){ containerAliasToID = new SumCoder.MD5().encode("AnotherContainer=" + container.getReleaseId()); } Assert.assertTrue(container.getContainerId().equals(containerAliasToID)); Assert.assertEquals(org.kie.server.api.model.KieContainerStatus.STARTED, container.getStatus()); }); }

Target:
public void checkDecisionServerContainer() throws MalformedURLException { log.info("Running test checkDecisionServerContainer"); prepareClientInvocation(); for (KieContainerResource container : getKieRestServiceClient(getRouteURL()).listContainers().getResult().getContainers()) { String containerAliasToID = new SumCoder.MD5().encode(container.getResolvedReleaseId().getArtifactId() + "=" + container.getReleaseId()); if (!containerAliasToID.equals(container.getContainerId())) { containerAliasToID = new SumCoder.MD5().encode("AnotherContainer=" + container.getReleaseId()); } Assert.assertTrue(container.getContainerId().equals(containerAliasToID)); Assert.assertEquals(org.kie.server.api.model.KieContainerStatus.STARTED, container.getStatus()); } }
Source:
public boolean sendCommand(final Command command) { if (ACTIVE_MQ_SERVER_LOGGER_TRACE_ENABLED) { traceSendCommand(command); } if (isDestroyed()) { return false; } try { physicalSend(command); } catch (Exception e) { return false; } catch (Throwable t) { return false; } return true; }

Target:
public boolean sendCommand(final Command command) { if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { ActiveMQServerLogger.LOGGER.trace("sending " + command); } if (isDestroyed()) { return false; } try { physicalSend(command); } catch (Exception e) { return false; } catch (Throwable t) { return false; } return true; }
Source:
default void inputDetail() { or(mandatory(cluster().id()), mandatory(cluster().name())); optional(configuration()); }

Target:
default void inputDetail() { or(mandatory(cluster().id()), mandatory(cluster().name())); optional(clone()); optional(exclusive()); optional(vm().name()); or(optional(storageDomain().id()), optional(storageDomain().name())); optional(vm().diskAttachments()[COLLECTION].disk().format()); optional(vm().diskAttachments()[COLLECTION].id()); optional(vm().diskAttachments()[COLLECTION].disk().sparse()); }
Source:
Subject cacheAndReturnSubject(ServerSession session) throws SecurityServiceException { UPAuthenticationToken usernamePasswordToken = new UPAuthenticationToken(session.getUsername(), session.getPassword()); return AccessController.doPrivileged( (ThrowingFunction) () -> securityManager.getSubject(usernamePasswordToken)); }

Target:
Subject cacheAndReturnSubject(ServerSession session) throws SecurityServiceException { UPAuthenticationToken usernamePasswordToken = new UPAuthenticationToken(session.getUsername(), session.getPassword()); try { return AccessController.doPrivileged( (PrivilegedExceptionAction<Subject>) () -> securityManager.getSubject(usernamePasswordToken)); } catch (PrivilegedActionException e) { if (e.getCause() instanceof SecurityServiceException) { throw (SecurityServiceException) e.getCause(); } throw new SecurityServiceException(e.getCause()); } }
Source:
public DruidQueryGenerator.GeneratedDql toQuery() { if (hasLimit() && aggregations > 1 && !groupByColumns.isEmpty()) { throw new PrestoException(DRUID_QUERY_GENERATOR_FAILURE, "Could not pushdown multiple aggregates in the presence of group by and limit"); } String expressions = selections.entrySet().stream() .map(s -> s.getValue().getEscapedDefinition()) .collect(Collectors.joining(", ")); if (expressions.isEmpty()) { throw new PrestoException(DRUID_QUERY_GENERATOR_FAILURE, "Empty Druid query"); } String tableName = from.orElseThrow(() -> new PrestoException(DRUID_QUERY_GENERATOR_FAILURE, "Table name missing in Druid query")); String query = "SELECT " + expressions + " FROM \"" + tableName + "\""; boolean pushdown = false; if (filter.isPresent()) { query += " WHERE " + filter.get(); pushdown = true; } if (!groupByColumns.isEmpty()) { String groupByExpression = groupByColumns.stream() .map(expression -> selections.containsKey(expression) ? selections.get(expression).getEscapedDefinition() : expression.getName()) .collect(Collectors.joining(", ")); query = query + " GROUP BY " + groupByExpression; pushdown = true; } if (hasAggregation()) { pushdown = true; } if (limit.isPresent()) { query += " LIMIT " + limit.getAsLong(); pushdown = true; } return new DruidQueryGenerator.GeneratedDql(tableName, query, pushdown); }

Target:
public DruidQueryGenerator.GeneratedDql toQuery() { if (hasLimit() && aggregations > 1 && !groupByColumns.isEmpty()) { throw new PrestoException(DRUID_QUERY_GENERATOR_FAILURE, "Could not pushdown multiple aggregates in the presence of group by and limit"); } String expressions = selections.entrySet().stream() .map(s -> s.getValue().getEscapedDefinition()) .collect(Collectors.joining(", ")); if (expressions.isEmpty()) { throw new PrestoException(DRUID_QUERY_GENERATOR_FAILURE, "Empty Druid query"); } String tableName = from.orElseThrow(() -> new PrestoException(DRUID_QUERY_GENERATOR_FAILURE, "Table name missing in Druid query")); String query = "SELECT " + expressions + " FROM " + escapeSqlIdentifier(tableName); boolean pushdown = false; if (filter.isPresent()) { query += " WHERE " + filter.get(); pushdown = true; } if (!groupByColumns.isEmpty()) { String groupByExpression = groupByColumns.stream() .map(expression -> selections.containsKey(expression) ? selections.get(expression).getEscapedDefinition() : expression.getName()) .collect(Collectors.joining(", ")); query = query + " GROUP BY " + groupByExpression; pushdown = true; } if (hasAggregation()) { pushdown = true; } if (limit.isPresent()) { query += " LIMIT " + limit.getAsLong(); pushdown = true; } return new DruidQueryGenerator.GeneratedDql(tableName, query, pushdown); }
Source:
public BPMNSignal from(ActivitiSignalEvent internalEvent) { BPMNSignalImpl signal = new BPMNSignalImpl(internalEvent.getActivityId(), internalEvent.getActivityName(), internalEvent.getActivityType()); signal.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); signal.setProcessInstanceId(internalEvent.getProcessInstanceId()); signal.setSignalPayload((SignalPayload)internalEvent.getSignalData()); return signal; }

Target:
public BPMNSignal from(ActivitiSignalEvent internalEvent) { BPMNSignalImpl signal = new BPMNSignalImpl(internalEvent.getActivityId()); signal.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); signal.setProcessInstanceId(internalEvent.getProcessInstanceId()); SignalPayload signalPayload = ProcessPayloadBuilder.signal() .withName(internalEvent.getSignalName()) .build(); if (internalEvent.getSignalData() != null) { Map<String, Object> sourceVariables = (Map<String, Object>) internalEvent.getSignalData(); signalPayload.setVariables(new HashMap<>(sourceVariables)); } signal.setSignalPayload(signalPayload); return signal; }
Source:
private void recalculateMacsCount() { if (!validate()) { setAvailableMacsCount(-1); return; } if (macRange.getMacPoolId() == null) { String from = getLeftBound().getEntity(); String to = getRightBound().getEntity(); Long count = MacRangeValidation.macToLong(to) - MacRangeValidation.macToLong(from) + 1; setAvailableMacsCount(count.intValue()); } }

Target:
private void recalculateMacsCount() { if (!validate()) { setAvailableMacsCount(-1); return; } if (macRange.getMacPoolId() == null) { String from = getLeftBound().getEntity(); String to = getRightBound().getEntity(); long count = MacRangeValidation.macToLong(to) - MacRangeValidation.macToLong(from) + 1; setAvailableMacsCount((int) count); } }
Source:
protected HttpWebRequest buildEwsHttpWebRequest() throws Exception { HttpWebRequest request = null; try { request = this.getService().prepareHttpWebRequest(); AsyncExecutor ae = new AsyncExecutor(); Callable getStream = new GetStream(request, "getOutputStream"); Future task = ae.submit(getStream, null); ae.shutdown(); this.getService().traceHttpRequestHeaders(TraceFlags.EwsRequestHttpHeaders, request); boolean needSignature = this.getService().getCredentials() != null && this.getService().getCredentials().isNeedSignature(); boolean needTrace = this.getService().isTraceEnabledFor( TraceFlags.EwsRequest); ByteArrayOutputStream memoryStream = new ByteArrayOutputStream(); EwsServiceXmlWriter writer = new EwsServiceXmlWriter(this .getService(), memoryStream); writer.setRequireWSSecurityUtilityNamespace(needSignature); this.writeToXml(writer); if (needSignature || needTrace) { if (needSignature) { this.service.getCredentials().sign(memoryStream); } if (needTrace) { this.getService().traceXml(TraceFlags.EwsRequest, memoryStream); } ByteArrayOutputStream serviceRequestStream = this.getWebRequestStream(task); EwsUtilities.copyStream(memoryStream, serviceRequestStream); } else { ByteArrayOutputStream requestStream = this .getWebRequestStream(task); EwsServiceXmlWriter writer1 = new EwsServiceXmlWriter(this .getService(), requestStream); this.writeToXml(writer1); } return request; } catch (IOException e) { throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed, e.getMessage()), e); } }

Target:
protected HttpWebRequest buildEwsHttpWebRequest() throws Exception { try { HttpWebRequest request = this.getService().prepareHttpWebRequest(); AsyncExecutor ae = new AsyncExecutor(); Callable getStream = new GetStream(request, "getOutputStream"); Future task = ae.submit(getStream, null); ae.shutdown(); this.getService().traceHttpRequestHeaders(TraceFlags.EwsRequestHttpHeaders, request); boolean needSignature = this.getService().getCredentials() != null && this.getService().getCredentials().isNeedSignature(); boolean needTrace = this.getService().isTraceEnabledFor( TraceFlags.EwsRequest); ByteArrayOutputStream memoryStream = new ByteArrayOutputStream(); EwsServiceXmlWriter writer = new EwsServiceXmlWriter(this .getService(), memoryStream); writer.setRequireWSSecurityUtilityNamespace(needSignature); this.writeToXml(writer); if (needSignature || needTrace) { if (needSignature) { this.service.getCredentials().sign(memoryStream); } if (needTrace) { this.getService().traceXml(TraceFlags.EwsRequest, memoryStream); } ByteArrayOutputStream serviceRequestStream = this.getWebRequestStream(task); EwsUtilities.copyStream(memoryStream, serviceRequestStream); } else { ByteArrayOutputStream requestStream = this .getWebRequestStream(task); EwsServiceXmlWriter writer1 = new EwsServiceXmlWriter(this .getService(), requestStream); this.writeToXml(writer1); } return request; } catch (IOException e) { throw new ServiceRequestException(String.format(Strings.ServiceRequestFailed, e.getMessage()), e); } }
Source:
public boolean isImageNetworkDisk(DiskImage diskImage, Version clusterVersion, Guid clusterId) { StorageType storageType = diskImage.getStorageTypes().get(0); if (storageType == StorageType.GLUSTERFS) { if (FeatureSupported.libgfApiSupported(clusterVersion)) { return true; } return isFeatureSupportedAsAdditionalFeature(clusterId, ConfigValues.LibgfApiSupported.name()); } return false; }

Target:
public boolean isImageNetworkDisk(DiskImage diskImage, Version clusterVersion, Guid clusterId) { StorageType storageType = diskImage.getStorageTypes().get(0); if (storageType == StorageType.GLUSTERFS) { return FeatureSupported.libgfApiSupported(clusterVersion) || isFeatureSupportedAsAdditionalFeature(clusterId, ConfigValues.LibgfApiSupported.name()); } return false; }
Source:
public CompletableFuture<?> purge(String tenantId) { multiTenancyStrategy.checkTenantId( tenantId, eventContext ); JsonObject document = ( tenantId == null ) ? matchAll() : matchAllByTenant( tenantId ); return orchestrator.submit( workFactory.deleteByQuery( indexName, document ) ); }

Target:
public CompletableFuture<?> purge(String tenantId) { multiTenancyStrategy.checkTenantId( tenantId, eventContext ); return orchestrator.submit( workFactory.deleteAll( indexName, tenantId ) ); }
Source:
public void testOneChannel() { final MySignal sig1 = new MySignal(sender, 0); final MySignal sig2 = new MySignal(sender, 0); final MySignal sig3 = new MySignal(sender, 0); synchronized(this) { sender.sendSignal(sig1); sender.sendSignal(sig2); sender.sendSignal(sig3); } sleep(250); assertEquals(1, listener.nbReceived[0]); assertEquals(0, listener.nbReceived[1]); assertEquals(0, listener.nbReceived[2]); }

Target:
public void testOneChannel() { final MySignal sig1 = new MySignal(sender, 0); final MySignal sig2 = new MySignal(sender, 0); final MySignal sig3 = new MySignal(sender, 0); synchronized(this) { sender.sendSignal(sig1); sender.sendSignal(sig2); sender.sendSignal(sig3); } sleep(1000); assertEquals(1, listener.nbReceived[0]); assertEquals(0, listener.nbReceived[1]); assertEquals(0, listener.nbReceived[2]); }
Source:
private HBox createNameArea() { HBox nameArea = new HBox(); nameText = new Text(panelName); nameText.setId(model.getDefaultRepo() + "_col" + panel.panelIndex + "_nameText"); nameText.setWrappingWidth(NAME_DISPLAY_WIDTH); nameBox = new HBox(); nameBox.getChildren().add(nameText); nameBox.setMinWidth(NAME_DISPLAY_WIDTH); nameBox.setMaxWidth(NAME_DISPLAY_WIDTH); nameBox.setAlignment(Pos.CENTER_LEFT); nameBox.setOnMouseClicked(mouseEvent -> { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { mouseEvent.consume(); activateInplaceRename(); } } }); Tooltip.install(nameArea, new Tooltip("Rename")); HBox renameBox = new HBox(); renameButton = new Label(OCTICON_RENAME_PANEL); renameButton.getStyleClass().addAll("octicon", "label-button"); renameButton.setId(model.getDefaultRepo() + "_col" + panel.panelIndex + "_renameButton"); renameButton.setOnMouseClicked(e -> { e.consume(); activateInplaceRename(); }); renameBox.getChildren().add(renameButton); renameBox.setAlignment(Pos.TOP_RIGHT); nameArea.getChildren().addAll(nameBox, renameButton); nameArea.setMinWidth(360); nameArea.setMaxWidth(360); return nameArea; }

Target:
private HBox createNameArea() { HBox nameArea = new HBox(); nameText = new Text(panelName); nameText.setId(model.getDefaultRepo() + "_col" + panel.panelIndex + "_nameText"); nameText.setWrappingWidth(NAME_DISPLAY_WIDTH); nameBox = new HBox(); nameBox.getChildren().add(nameText); nameBox.setMinWidth(NAME_DISPLAY_WIDTH); nameBox.setMaxWidth(NAME_DISPLAY_WIDTH); nameBox.setAlignment(Pos.CENTER_LEFT); nameBox.setOnMouseClicked(mouseEvent -> { if (mouseEvent.getButton().equals(MouseButton.PRIMARY) && mouseEvent.getClickCount() == 2) { mouseEvent.consume(); activateInplaceRename(); } }); Tooltip.install(nameArea, new Tooltip("Edit the name of this panel")); HBox renameBox = new HBox(); renameButton = new Label(OCTICON_RENAME_PANEL); renameButton.getStyleClass().addAll("octicon", "label-button"); renameButton.setId(model.getDefaultRepo() + "_col" + panel.panelIndex + "_renameButton"); renameButton.setOnMouseClicked(e -> { e.consume(); activateInplaceRename(); }); renameBox.getChildren().add(renameButton); renameBox.setAlignment(Pos.TOP_RIGHT); nameArea.getChildren().addAll(nameBox, renameButton); nameArea.setMinWidth(360); nameArea.setMaxWidth(360); return nameArea; }
Source:
public void sendHttpRequestAndWriteResponseAsJson() throws Exception { final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"msg\": \"hi\"}") ).start(); final GhLabel label = new GhLabel( new ApacheRequest(container.home()), new DefaultGithub() .repos().get(new Coordinates.Simple("mark", "test")), "bug" ); MatcherAssert.assertThat( label.json().getString("msg"), Matchers.equalTo("hi") ); container.stop(); }

Target:
public void sendHttpRequestAndWriteResponseAsJson() throws Exception { final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HttpURLConnection.HTTP_OK, "{\"msg\": \"hi\"}") ).start(); final GhLabel label = new GhLabel( new ApacheRequest(container.home()), GhLabelTest.repo(), "bug" ); MatcherAssert.assertThat( label.json().getString("msg"), Matchers.equalTo("hi") ); container.stop(); }
Source:
public void run() { synchronized (managedStateImpl.commitLock) { long bytesSum = 0; for (Bucket bucket : managedStateImpl.buckets) { if (bucket != null) { bytesSum += bucket.getSizeInBytes(); } } if (bytesSum > managedStateImpl.getMaxMemorySize()) { Duration duration = managedStateImpl.getDurationPreventingFreeingSpace(); long durationMillis = 0; if (duration != null) { durationMillis = duration.getMillis(); } BucketIdTimeWrapper idTimeWrapper; while (bytesSum > managedStateImpl.getMaxMemorySize() && bucketHeap.size() > 0 && null != (idTimeWrapper = bucketHeap.first())) { if (System.currentTimeMillis() - idTimeWrapper.getLastAccessedTime() < durationMillis) { break; } long bucketId = idTimeWrapper.bucketId; Bucket bucket = managedStateImpl.getBucket(bucketId); if (bucket != null) { synchronized (bucket) { long sizeFreed = 0; try { sizeFreed = bucket.freeMemory(managedStateImpl.getCheckpointManager().getLastTransferredWindow()); LOG.debug("bucket freed {}", bucketId, sizeFreed); } catch (IOException e) { managedStateImpl.throwable.set(e); throw new RuntimeException("freeing " + bucketId, e); } bytesSum -= sizeFreed; } bucketHeap.remove(idTimeWrapper); bucketAccessTimes.remove(bucketId); } } } } }

Target:
public void run() { synchronized (managedStateImpl.commitLock) { long bytesSum = 0; for (Bucket bucket : managedStateImpl.buckets) { if (bucket != null) { bytesSum += bucket.getSizeInBytes(); } } if (bytesSum > managedStateImpl.getMaxMemorySize()) { Duration duration = managedStateImpl.getDurationPreventingFreeingSpace(); long durationMillis = 0; if (duration != null) { durationMillis = duration.getMillis(); } BucketIdTimeWrapper idTimeWrapper; while (bytesSum > managedStateImpl.getMaxMemorySize() && bucketHeap.size() > 0 && null != (idTimeWrapper = bucketHeap.first())) { if (System.currentTimeMillis() - idTimeWrapper.getLastAccessedTime() < durationMillis) { break; } long bucketId = idTimeWrapper.bucketId; Bucket bucket = managedStateImpl.getBucket(bucketId); if (bucket != null) { synchronized (bucket) { long sizeFreed; try { sizeFreed = bucket.freeMemory(managedStateImpl.getCheckpointManager().getLastTransferredWindow()); LOG.debug("bucket freed {}", bucketId, sizeFreed); } catch (IOException e) { managedStateImpl.throwable.set(e); throw new RuntimeException("freeing " + bucketId, e); } bytesSum -= sizeFreed; } bucketHeap.remove(idTimeWrapper); bucketAccessTimes.remove(bucketId); } } } } }
Source:
protected ProviderMetadata createProviderMetadata() { synchronized (this) { if (providerMeta == null) { providerMeta = new AzureComputeProviderMetadata(); } } return providerMeta; }

Target:
protected ProviderMetadata createProviderMetadata() { if (providerMeta == null) { providerMeta = new AzureComputeProviderMetadata(); } return providerMeta; }
Source:
private void parseConfiguration(String config) throws IllegalArgumentException { String[] mappings = config.split(","); for (String mapping : mappings) { String[] params = mapping.split(":"); if (params.length < 2) { throw new IllegalArgumentException("Configuration " + mapping + " is in-correctly formed. " + "Format should be <fieldname>:<encoder-type>"); } String field = params[0]; String type = params[1].toUpperCase(); EncodeType eType; switch (type) { case "STRING_BASE64": eType = EncodeType.STRING_BASE64; break; case "STRING_BASE32": eType = EncodeType.STRING_BASE32; break; case "BASE64": eType = EncodeType.BASE64; break; case "BASE32": eType = EncodeType.BASE32; break; case "HEX": eType = EncodeType.HEX; break; case "NONE": eType = EncodeType.NONE; break; default: throw new IllegalArgumentException("Unknown encoder type " + type + " found in mapping " + mapping); } if (encodeMap.containsKey(field)) { throw new IllegalArgumentException("Field " + field + " already has encoder set. Check the mapping."); } else { encodeMap.put(field, eType); } } }

Target:
private void parseConfiguration(String config) throws IllegalArgumentException { String[] mappings = config.split(","); for (String mapping : mappings) { String[] params = mapping.split(":"); if (params.length < 2) { throw new IllegalArgumentException("Configuration " + mapping + " is in-correctly formed. " + "Format should be <fieldname>:<encoder-type>"); } String field = params[0]; String type = params[1].toUpperCase(); EncodeType eType = EncodeType.valueOf(type); if (encodeMap.containsKey(field)) { throw new IllegalArgumentException("Field " + field + " already has encoder set. Check the mapping."); } else { encodeMap.put(field, eType); } } }
Source:
protected void readBlob() { closePreviousInputStream(); try { File tmp = File.createTempFile("talend-adls-gen2-tmp", ".parquet"); tmp.deleteOnExit(); BlobClient blobClient = service.getBlobClient(getCurrentBlob().getName()); InputStream input = blobClient.getBlockBlobClient().openInputStream(); Files.copy(input, tmp.toPath(), StandardCopyOption.REPLACE_EXISTING); IOUtils.closeQuietly(input); HadoopInputFile hdpIn = HadoopInputFile.fromPath(new Path(tmp.getPath()), new org.apache.hadoop.conf.Configuration()); reader = AvroParquetReader.<GenericRecord>builder(hdpIn).build(); currentRecord = reader.read(); } catch (IOException e) { throw new ComponentException(e); } }

Target:
protected void readBlob() { closePreviousInputStream(); InputStream input = null; try { File tmp = File.createTempFile("talend-adls-gen2-tmp", ".parquet"); tmp.deleteOnExit(); BlobClient blobClient = service.getBlobClient(getCurrentBlob().getName()); input = blobClient.getBlockBlobClient().openInputStream(); Files.copy(input, tmp.toPath(), StandardCopyOption.REPLACE_EXISTING); reader = AvroParquetReader.<GenericRecord>builder(new Path(tmp.getPath())).build(); currentRecord = reader.read(); } catch (IOException e) { throw new ComponentException(e); } finally { IOUtils.closeQuietly(input); } }
Source:
public File stripCRLFile(File file) throws IOException { File tempFile = File.createTempFile("candlepin_crl_", ".pem"); BufferedReader r = null; BufferedWriter w = null; String line = null; try { r = new BufferedReader(new FileReader(file)); w = new BufferedWriter(new FileWriter(tempFile)); do { line = r.readLine(); } while (line != null && (WHITESPACE.matcher(line).matches() || CRL_HEADER_PATTERN.matcher(line).matches())); if (line == null) { throw new IOException("No data left in file " + file); } do { w.write(line); line = r.readLine(); } while (line != null && !CRL_FOOTER_PATTERN.matcher(line).matches()); return tempFile; } finally { if (w != null) { w.close(); } if (r != null) { r.close(); } } }

Target:
public File stripCRLFile(File file) throws IOException { File tempFile = File.createTempFile("candlepin_crl_", ".pem"); try (BufferedReader r = new BufferedReader(new FileReader(file)); BufferedWriter w = new BufferedWriter(new FileWriter(tempFile))) { String line = null; do { line = r.readLine(); } while (line != null && (WHITESPACE.matcher(line).matches() || CRL_HEADER_PATTERN.matcher(line).matches())); if (line == null) { throw new IOException("No data left in file " + file); } do { w.write(line); line = r.readLine(); } while (line != null && !CRL_FOOTER_PATTERN.matcher(line).matches()); return tempFile; } }
Source:
public FilterInstantSpell(String name) { super(name); this.add(Predicates.or(CardType.INSTANT.getPredicate())); }

Target:
public FilterInstantSpell(String name) { super(name); this.add(CardType.INSTANT.getPredicate()); }
Source:
@Test public void shouldGetBookingFormAsyncThrowError() { String responseError = "{\"error\":\"That userToken is unrecognised.\",\"errorCode\":401,\"usererror\":false}"; ResponseBody responseBody = ResponseBody.create(MediaType.parse("application/json"), responseError); final Response<BookingForm> response = Response.error(401, responseBody); when(bookingApi.getFormAsync("url")) .thenReturn(Observable.just(response)); final TestSubscriber<BookingForm> subscriber = new TestSubscriber<>(); service.getFormAsync("url").subscribe(subscriber); subscriber.awaitTerminalEvent(); subscriber.assertError(BookingError.class); Throwable error = subscriber.getOnErrorEvents().get(0); assertThat(error instanceof BookingError).isTrue(); }

Target:
@Test public void shouldGetBookingFormAsyncThrowError() { String responseError = "{\"error\":\"That userToken is unrecognised.\",\"errorCode\":401,\"usererror\":false}"; ResponseBody responseBody = ResponseBody.create(MediaType.parse("application/json"), responseError); final Response<BookingForm> response = Response.error(401, responseBody); when(bookingApi.getFormAsync("url")) .thenReturn(Observable.just(response)); final TestSubscriber<BookingForm> subscriber = new TestSubscriber<>(); service.getFormAsync("url").subscribe(subscriber); subscriber.awaitTerminalEvent(); subscriber.assertError(BookingError.class); Throwable error = subscriber.getOnErrorEvents().get(0); assertThat(error.getMessage()).isEqualTo("That userToken is unrecognised."); }
Source:
private void pushUpstream(final RevCommit commit, final PushMode pushTo) { RemoteConfig config = SimpleConfigurePushDialog .getConfiguredRemote(repository); if (pushTo == PushMode.GERRIT) { final Wizard pushWizard = new PushToGerritWizard(repository); openPushWizard(pushWizard); } else if (config == null) { try { Wizard pushWizard = null; String fullBranch = repository.getFullBranch(); if (fullBranch != null && fullBranch.startsWith(Constants.R_HEADS)) { Ref ref = repository.findRef(fullBranch); pushWizard = new PushBranchWizard(repository, ref); } else { pushWizard = new PushBranchWizard(repository, commit.getId()); } openPushWizard(pushWizard); } catch (IOException e) { Activator.handleError( NLS.bind(UIText.CommitUI_pushFailedMessage, e), e, true); } } else { PushOperationUI op = new PushOperationUI(repository, config.getName(), false); op.start(); } }

Target:
private void pushUpstream(final RevCommit commit, final PushMode pushTo) { RemoteConfig config = SimpleConfigurePushDialog .getConfiguredRemote(repository); if (pushTo == PushMode.GERRIT) { final Wizard pushWizard = new PushToGerritWizard(repository); openPushWizard(pushWizard); } else if (config == null) { try { Wizard pushWizard = null; String fullBranch = repository.getFullBranch(); if (fullBranch != null && fullBranch.startsWith(Constants.R_HEADS)) { Ref ref = repository.exactRef(fullBranch); pushWizard = new PushBranchWizard(repository, ref); } else { pushWizard = new PushBranchWizard(repository, commit.getId()); } openPushWizard(pushWizard); } catch (IOException e) { Activator.handleError( NLS.bind(UIText.CommitUI_pushFailedMessage, e), e, true); } } else { PushOperationUI op = new PushOperationUI(repository, config.getName(), false); op.start(); } }
Source:
public void onError(Exception exception) { AppLog.e(AppLog.T.MEDIA, "Can't optimize the video", exception); if (isStopped) { return; } trackVideoProcessingEvents(true, exception); final EditPostActivity parentActivity = mEditPostActivityWeakReference.get(); if (parentActivity == null || parentActivity.isFinishing()) { return; } ProgressDialog pd = mWeakProgressDialog.get(); dismissProgressDialog(pd); ToastUtils.showToast(parentActivity, R.string.video_optimization_generic_error_message, ToastUtils.Duration.LONG); mVideoOptimizationListener.done(mOriginalPath); }

Target:
public void onError(Exception exception) { AppLog.e(AppLog.T.MEDIA, "Can't optimize the video", exception); trackVideoProcessingEvents(true, exception); if (isStopped) { return; } final EditPostActivity parentActivity = mEditPostActivityWeakReference.get(); if (parentActivity == null || parentActivity.isFinishing()) { return; } ProgressDialog pd = mWeakProgressDialog.get(); dismissProgressDialog(pd); ToastUtils.showToast(parentActivity, R.string.video_optimization_generic_error_message, ToastUtils.Duration.LONG); mVideoOptimizationListener.done(mOriginalPath); }
Source:
PhoneNumberSearch> beginPurchaseSearch(String searchId, Duration pollInterval) { Objects.requireNonNull(searchId, "'searchId' can not be null."); if (pollInterval == null) { pollInterval = Duration.ofSeconds(5); } return new PollerFlux<PhoneNumberSearch, PhoneNumberSearch>(pollInterval, purchaseSearchActivationOperation(searchId), purchaseSearchPollOperation(searchId), (activationResponse, pollingContext) -> Mono.error(new RuntimeException("Cancellation is not supported")), purchaseSearchFetchResultOperation()); }

Target:
public PollerFlux<Void, Void> beginPurchaseSearch(String searchId, Duration pollInterval) { Objects.requireNonNull(searchId, "'searchId' can not be null."); if (pollInterval == null) { pollInterval = defaultPollInterval; } return new PollerFlux<Void, Void>(pollInterval, purchaseSearchActivationOperation(searchId), purchaseSearchPollOperation(searchId), (activationResponse, pollingContext) -> Mono.error(new RuntimeException("Cancellation is not supported")), purchaseSearchFetchResultOperation()); }
Source:
public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId); List<SshPairImpl> vcsSshPairs = getVcsSshPairs(identity); List<SshPairImpl> systemSshPairs = getSystemSshPairs(identity); List<SshPairImpl> all = new ArrayList<>(vcsSshPairs); all.addAll(systemSshPairs); doProvisionSshKeys(all, k8sEnv, identity.getWorkspaceId()); StringBuilder sshConfigData = new StringBuilder(); for (SshPair sshPair : vcsSshPairs) { sshConfigData.append(buildConfig(sshPair.getName())); } String sshConfigMapName = identity.getWorkspaceId() + SSH_CONFIG_MAP_NAME_SUFFIX; doProvisionSshConfig(sshConfigMapName, sshConfigData.toString(), k8sEnv); }

Target:
public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { String workspaceId = identity.getWorkspaceId(); TracingTags.WORKSPACE_ID.set(workspaceId); List<SshPairImpl> vcsSshPairs = getVcsSshPairs(k8sEnv, identity); List<SshPairImpl> systemSshPairs = getSystemSshPairs(k8sEnv, identity); List<SshPairImpl> all = new ArrayList<>(vcsSshPairs); all.addAll(systemSshPairs); doProvisionSshKeys(all, k8sEnv, workspaceId); doProvisionVcsSshConfig(vcsSshPairs, k8sEnv, workspaceId); }
Source:
public Parser<String, Object> makeParser() { if(flattenSpec.isEnabled()) { return new JSONPathParser(convertFieldSpecs(flattenSpec.getFields()), flattenSpec.usingFieldDiscovery()); } else { return new JSONParser(objectMapper, null); } }

Target:
public Parser<String, Object> makeParser() { return new JSONPathParser( convertFieldSpecs(flattenSpec.getFields()), flattenSpec.isUseFieldDiscovery(), objectMapper ); }
Source:
private Set<String> getDefaultOrigins() { List<VDS> allVds = vdsDao.getAll(getUserID(), getParameters().isFiltered()); Set<String> result = new HashSet<>(); for (VDS vds : allVds) { if (!getParameters().getSuffixes().isEmpty()) { for (String suffix : getParameters().getSuffixes()) { result.add(HTTPS + vds.getHostName() + suffix); } } else { result.add(HTTPS + vds.getHostName()); } } if (log.isDebugEnabled()) { log.debug("Default list of origins refreshed to: {}", StringUtils.join(result, ',')); } return result; }

Target:
private Set<String> getDefaultOrigins() { List<VDS> allVds = vdsDao.getAll(getUserID(), getParameters().isFiltered()); Set<String> allowedOrigins = new HashSet<>(); if (getParameters().getSuffixes().isEmpty()) { allVds.stream().forEach( vds -> allowedOrigins.add(String.format("https://%s", vds.getHostName()))); } else { allVds.stream().forEach( vds -> allowedOrigins.addAll(getHostOrigins(vds.getHostName(), getParameters().getSuffixes()))); } if (log.isDebugEnabled()) { log.debug("Default list of origins refreshed to: {}", StringUtils.join(allowedOrigins, ',')); } return allowedOrigins; }
Source:
public boolean isValid(ILaunchConfiguration config) { if (!super.isValid(config)) return false; setErrorMessage(null); int currentSelection = connectionCombo.getSelectionIndex(); if (currentSelection < 0) { setErrorMessage(CONNECTION_TEXT_ERROR); return false; } String connection_name = connectionCombo.getItem(currentSelection); if (connection_name.isEmpty()) { setErrorMessage(CONNECTION_TEXT_ERROR); return false; } String remoteProgName = remoteProgText.getText().trim(); if (remoteProgName.isEmpty()) { setErrorMessage(REMOTE_PROG_TEXT_ERROR); return false; } Path remoteProgPath = Path.forPosix(remoteProgName); if (!remoteProgPath.isAbsolute()) { setErrorMessage(REMOTE_PROG_NOT_ABSOLUTE); return false; } return true; }

Target:
public boolean isValid(ILaunchConfiguration config) { if (!super.isValid(config)) { return false; } setErrorMessage(null); int currentSelection = connectionCombo.getSelectionIndex(); if (currentSelection < 0) { setErrorMessage(CONNECTION_TEXT_ERROR); return false; } String connection_name = connectionCombo.getItem(currentSelection); if (connection_name.isEmpty()) { setErrorMessage(CONNECTION_TEXT_ERROR); return false; } String remoteProgName = remoteProgText.getText().trim(); if (remoteProgName.isEmpty()) { setErrorMessage(REMOTE_PROG_TEXT_ERROR); return false; } Path remoteProgPath = Path.forPosix(remoteProgName); if (!remoteProgPath.isAbsolute()) { setErrorMessage(REMOTE_PROG_NOT_ABSOLUTE); return false; } return true; }
Source:
public void process() throws IOException, ClientConnectionException { processIncoming(); checkHeartBeat(); processOutgoing(); }

Target:
public void process() throws IOException, ClientConnectionException { processIncoming(); processHeartbeat(); processOutgoing(); }
Source:
protected SparseHtmlFile getSparseHtmlFileB(PatchScript s) { AccountDiffPreference dp = new AccountDiffPreference(s.getDiffPrefs()); PrettyFormatter f = ClientSideFormatter.FACTORY.get(); f.setDiffPrefs(dp); f.setFileName(s.getB().getPath()); f.setEditFilter(PrettyFormatter.B); f.setEditList(s.getEdits()); if ((dp.isSyntaxHighlighting() || dp.getContext() != AccountDiffPreference.WHOLE_FILE_CONTEXT) && s.getA().isWholeFile() && !s.getB().isWholeFile()) { f.format(s.getB().apply(s.getA(), s.getEdits())); } else { f.format(s.getB()); } return f; }

Target:
protected SparseHtmlFile getSparseHtmlFileB(PatchScript s) { AccountDiffPreference dp = new AccountDiffPreference(s.getDiffPrefs()); SparseFileContent b = s.getB(); PrettyFormatter f = ClientSideFormatter.FACTORY.get(); f.setDiffPrefs(dp); f.setFileName(b.getPath()); f.setEditFilter(PrettyFormatter.B); f.setEditList(s.getEdits()); if (s.getA().isWholeFile() && !b.isWholeFile()) { b = b.apply(s.getA(), s.getEdits()); } f.format(b); return f; }
Source:
public URI getProcessDataDirectory(Process process) { if (Objects.isNull(process.getProcessBaseUri())) { process.setProcessBaseUri(fileService.getProcessBaseUriForExistingProcess(process)); if (!isUnitTesting) { try { save(process); } catch (DataException e) { logger.error(e.getMessage(), e); return URI.create(""); } } } return process.getProcessBaseUri(); }

Target:
public URI getProcessDataDirectory(Process process) { if (Objects.isNull(process.getProcessBaseUri())) { process.setProcessBaseUri(fileService.getProcessBaseUriForExistingProcess(process)); try { save(process); } catch (DataException e) { logger.error(e.getMessage(), e); return URI.create(""); } } return process.getProcessBaseUri(); }
Source:
void fullRefresh(boolean includeGraphs, boolean includeResults, boolean includeSourceFiles, boolean includeApplicationValues) { try { HPCCWsWorkUnitsClient wsWorkunitsClient = platform.getWsClient().getWsWorkunitsClient(); try { WorkunitWrapper wi = wsWorkunitsClient.getWUInfo(info.getWuid(), includeResults, includeGraphs, includeSourceFiles, includeApplicationValues, false, false, false, false, false); if (wi != null) { update(wi.getEclWorkunit()); if (wi.getResultViews() != null) { resultViews = Arrays.asList(wi.getResultViews()); } } } catch (Exception ex) { if (ex.getCause() != null) { Throwable cause = ex.getCause(); System.out.println(cause.getLocalizedMessage()); { setChanged(); notifyObservers(Notification.WORKUNIT); } } } catch (ArrayOfEspExceptionWrapper e) { System.out.println(e.toString()); } } catch (RemoteException e) { e.printStackTrace(); } catch (Exception e1) { e1.printStackTrace(); } }

Target:
void fullRefresh(boolean includeGraphs, boolean includeResults, boolean includeSourceFiles, boolean includeApplicationValues) { try { HPCCWsWorkUnitsClient wsWorkunitsClient = platform.getWsClient().getWsWorkunitsClient(); try { WorkunitWrapper wi = wsWorkunitsClient.getWUInfo(info.getWuid(), includeResults, includeGraphs, includeSourceFiles, includeApplicationValues, false, false, false, false, false); if (wi != null) { update(wi.getEclWorkunit()); if (wi.getResultViews() != null) { resultViews = Arrays.asList(wi.getResultViews()); } } } catch (Exception | ArrayOfEspExceptionWrapper ex) { if (ex.getCause() != null) { Throwable cause = ex.getCause(); System.out.println(cause.getLocalizedMessage()); { setChanged(); notifyObservers(Notification.WORKUNIT); } } } } catch (RemoteException e) { e.printStackTrace(); } catch (Exception e1) { e1.printStackTrace(); } }
Source:
public void recognizeCustomFormLabeledDataWithContentTypeAutoDetection(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); customFormDataRunner(data -> beginTrainingLabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller<OperationResult, CustomFormModel> trainingPoller = getFormTrainingAsyncClient(httpClient, serviceVersion).beginTraining(trainingFilesUrl, useTrainingLabels).getSyncPoller(); trainingPoller.waitForCompletion(); SyncPoller<OperationResult, List<RecognizedForm>> syncPoller = client.beginRecognizeCustomForms(getReplayableBufferData(FORM_LOCAL_URL), trainingPoller.getFinalResult().getModelId(), CUSTOM_FORM_FILE_LENGTH, null, true, null).getSyncPoller(); syncPoller.waitForCompletion(); validateRecognizedResult(syncPoller.getFinalResult(), true, true); })); }

Target:
public void recognizeCustomFormLabeledDataWithContentTypeAutoDetection(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); customFormDataRunner((data, dataLength) -> beginTrainingLabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller<OperationResult, CustomFormModel> trainingPoller = getFormTrainingAsyncClient(httpClient, serviceVersion).beginTraining(trainingFilesUrl, useTrainingLabels, null, durationTestMode).getSyncPoller(); trainingPoller.waitForCompletion(); SyncPoller<OperationResult, List<RecognizedForm>> syncPoller = client.beginRecognizeCustomForms( new RecognizeCustomFormsOptions(getReplayableBufferData(FORM_LOCAL_URL), dataLength, trainingPoller.getFinalResult().getModelId()) .setIncludeTextContent(true).setPollInterval(durationTestMode)).getSyncPoller(); syncPoller.waitForCompletion(); validateRecognizedResult(syncPoller.getFinalResult(), true, true); })); }
Source:
public CacheSimpleConfig(CacheSimpleConfig cacheSimpleConfig) { this.name = cacheSimpleConfig.name; this.keyType = cacheSimpleConfig.keyType; this.valueType = cacheSimpleConfig.valueType; this.statisticsEnabled = cacheSimpleConfig.statisticsEnabled; this.managementEnabled = cacheSimpleConfig.managementEnabled; this.readThrough = cacheSimpleConfig.readThrough; this.writeThrough = cacheSimpleConfig.writeThrough; this.cacheLoaderFactory = cacheSimpleConfig.cacheLoaderFactory; this.cacheWriterFactory = cacheSimpleConfig.cacheWriterFactory; this.expiryPolicyFactoryConfig = cacheSimpleConfig.expiryPolicyFactoryConfig; this.cacheEntryListeners = cacheSimpleConfig.cacheEntryListeners; this.asyncBackupCount = cacheSimpleConfig.asyncBackupCount; this.backupCount = cacheSimpleConfig.backupCount; this.inMemoryFormat = cacheSimpleConfig.inMemoryFormat; if (cacheSimpleConfig.evictionConfig != null) { this.evictionConfig = cacheSimpleConfig.evictionConfig; } this.wanReplicationRef = cacheSimpleConfig.wanReplicationRef; this.partitionLostListenerConfigs = new ArrayList<>(cacheSimpleConfig.getPartitionLostListenerConfigs()); this.quorumName = cacheSimpleConfig.quorumName; this.mergePolicyConfig = cacheSimpleConfig.mergePolicyConfig; this.hotRestartConfig = new HotRestartConfig(cacheSimpleConfig.hotRestartConfig); this.eventJournalConfig = new EventJournalConfig(cacheSimpleConfig.eventJournalConfig); this.disablePerEntryInvalidationEvents = cacheSimpleConfig.disablePerEntryInvalidationEvents; }

Target:
public CacheSimpleConfig(CacheSimpleConfig cacheSimpleConfig) { this.name = cacheSimpleConfig.name; this.keyType = cacheSimpleConfig.keyType; this.valueType = cacheSimpleConfig.valueType; this.statisticsEnabled = cacheSimpleConfig.statisticsEnabled; this.managementEnabled = cacheSimpleConfig.managementEnabled; this.readThrough = cacheSimpleConfig.readThrough; this.writeThrough = cacheSimpleConfig.writeThrough; this.cacheLoaderFactory = cacheSimpleConfig.cacheLoaderFactory; this.cacheWriterFactory = cacheSimpleConfig.cacheWriterFactory; this.expiryPolicyFactoryConfig = cacheSimpleConfig.expiryPolicyFactoryConfig; this.cacheEntryListeners = cacheSimpleConfig.cacheEntryListeners; this.asyncBackupCount = cacheSimpleConfig.asyncBackupCount; this.backupCount = cacheSimpleConfig.backupCount; this.inMemoryFormat = cacheSimpleConfig.inMemoryFormat; if (cacheSimpleConfig.evictionConfig != null) { this.evictionConfig = cacheSimpleConfig.evictionConfig; } this.wanReplicationRef = cacheSimpleConfig.wanReplicationRef; this.partitionLostListenerConfigs = new ArrayList<>(cacheSimpleConfig.getPartitionLostListenerConfigs()); this.quorumName = cacheSimpleConfig.quorumName; this.mergePolicyConfig = new MergePolicyConfig(cacheSimpleConfig.mergePolicyConfig); this.hotRestartConfig = new HotRestartConfig(cacheSimpleConfig.hotRestartConfig); this.eventJournalConfig = new EventJournalConfig(cacheSimpleConfig.eventJournalConfig); this.disablePerEntryInvalidationEvents = cacheSimpleConfig.disablePerEntryInvalidationEvents; }
Source:
public void bind(Editing editingModel) { this.editingModel = editingModel; LOG.info("Calling bind in ConfigurationViewModels"); setAsObservableConfigModel(editingModel.currentConfig()); }

Target:
public void bind(Editing editingModel) { this.editingModel = editingModel; setAsObservableConfigModel(editingModel.currentConfig()); }
Source:
public void testSyncInOnlyException() throws Exception { String routeId = "testSyncInOnlyExceptionRoute"; RouteBuilder builder = new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start").routeId(routeId) .setBody(simple("${body.getParameter(\"request\")}")) .throwException(new IllegalArgumentException("Illegal contennt!")) .to("mock:result"); } }; context.addRoutes(builder); try { ServiceRegistry.get().register("GlobalCamelService", context); String expectedBody = "helloRequest"; resultEndpoint.expectedBodiesReceived(expectedBody); WorkItemImpl workItem = new WorkItemImpl(); workItem.setParameter("camel-endpoint-id", "start"); workItem.setParameter("request", expectedBody); TestWorkItemManager manager = new TestWorkItemManager(); WorkItemHandler handler = new InOnlyCamelWorkItemHandler(); handler.executeWorkItem(workItem, manager); assertThat(manager.getResults().size(), equalTo(0)); resultEndpoint.assertIsSatisfied(); } finally { context.removeRoute(routeId); } }

Target:
public void testSyncInOnlyException() throws Exception { String routeId = "testSyncInOnlyExceptionRoute"; RouteBuilder builder = new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start").routeId(routeId) .setBody(simple("${body.getParameter(\"Request\")}")) .throwException(new IllegalArgumentException("Illegal contennt!")) .to("mock:result"); } }; context.addRoutes(builder); try { ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, context); String expectedBody = "helloRequest"; resultEndpoint.expectedBodiesReceived(expectedBody); WorkItemImpl workItem = new WorkItemImpl(); workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, "start"); workItem.setParameter("Request", expectedBody); TestWorkItemManager manager = new TestWorkItemManager(); WorkItemHandler handler = new InOnlyCamelWorkItemHandler(); handler.executeWorkItem(workItem, manager); assertThat(manager.getResults().size(), equalTo(0)); resultEndpoint.assertIsSatisfied(); } finally { context.removeRoute(routeId); } }
Source:
private void addSessionTrackingShutdownHook() { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { sessionTracker.setShuttingDown(true); sessionExecutorService.shutdown(); try { if (!sessionExecutorService .awaitTermination(SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS)) { LOGGER.warn("Shutdown of 'session tracking' threads" + " took too long - forcing a shutdown"); sessionExecutorService.shutdownNow(); } } catch (InterruptedException ex) { LOGGER.warn("Shutdown of 'session tracking' thread " + "was interrupted - forcing a shutdown"); sessionExecutorService.shutdownNow(); } } }); }

Target:
private void addSessionTrackingShutdownHook() { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { sessionTracker.shutdown(); sessionExecutorService.shutdown(); try { if (!sessionExecutorService .awaitTermination(SHUTDOWN_TIMEOUT_MS, TimeUnit.MILLISECONDS)) { LOGGER.warn("Shutdown of 'session tracking' threads" + " took too long - forcing a shutdown"); sessionExecutorService.shutdownNow(); } } catch (InterruptedException ex) { LOGGER.warn("Shutdown of 'session tracking' thread " + "was interrupted - forcing a shutdown"); sessionExecutorService.shutdownNow(); } } }); }
Source:
private String getSavedDvsSpawnedByRecurringDvForCurrentAndPastFiscalPeriodsSelectSql(Date currentFisalPeriodEndDate) { SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy", Locale.US); return new String("SELECT B.DV_DOC_NBR, B.DV_CHECK_DT FROM KFS.FP_DV_DOC_T A, KFS.FP_RCDV_DTL_T B, CYNERGY.KREW_DOC_HDR_T C WHERE A.FDOC_NBR = B.DV_DOC_NBR AND C.DOC_HDR_ID = B.DV_DOC_NBR AND C.DOC_HDR_STAT_CD = '") +KewApiConstants.ROUTE_HEADER_SAVED_CD+ ("' AND B.DV_CHECK_DT <= '" +formatter.format(currentFisalPeriodEndDate)+ "'"); }

Target:
private String getSavedDvsSpawnedByRecurringDvForCurrentAndPastFiscalPeriodsSelectSql(Date currentFisalPeriodEndDate) { SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy", Locale.US); StringBuilder sqlBuilder = new StringBuilder("SELECT B.DV_DOC_NBR, B.DV_CHECK_DT "); sqlBuilder.append("FROM KFS.FP_DV_DOC_T A, KFS.FP_RCDV_DTL_T B, CYNERGY.KREW_DOC_HDR_T C "); sqlBuilder.append("WHERE A.FDOC_NBR = B.DV_DOC_NBR AND C.DOC_HDR_ID = B.DV_DOC_NBR "); sqlBuilder.append("AND C.DOC_HDR_STAT_CD = '").append(KewApiConstants.ROUTE_HEADER_SAVED_CD).append("' "); sqlBuilder.append("AND B.DV_CHECK_DT <= '").append(formatter.format(currentFisalPeriodEndDate)).append("'"); return sqlBuilder.toString(); }