auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String toString() { if (!preferences.get(UserPreference.Receipts.OnlyIncludeReimbursable) && !totals.getGrandTotalPrice().equals(totals.getReimbursableGrandTotalPrice())) { return string .replace(REPORT_NAME, trip.getName()) .replace(USER_ID, preferences.get(UserPreference.ReportOutput.UserId)) .replace(REPORT_START, dateFormatter.getFormattedDate(trip.getStartDisplayableDate())) .replace(REPORT_END, dateFormatter.getFormattedDate(trip.getEndDisplayableDate())) .replace(REPORT_GROSS_TOTAL, totals.getReimbursableGrandTotalPrice().getCurrencyFormattedPrice()); } else { return string .replace(REPORT_NAME, trip.getName()) .replace(USER_ID, preferences.get(UserPreference.ReportOutput.UserId)) .replace(REPORT_START, dateFormatter.getFormattedDate(trip.getStartDisplayableDate())) .replace(REPORT_END, dateFormatter.getFormattedDate(trip.getEndDisplayableDate())) .replace(REPORT_GROSS_TOTAL, totals.getGrandTotalPrice().getCurrencyFormattedPrice()); } }

Target:
public String toString() { return string .replace(REPORT_NAME, trip.getName()) .replace(USER_ID, preferences.get(UserPreference.ReportOutput.UserId)) .replace(REPORT_START, dateFormatter.getFormattedDate(trip.getStartDisplayableDate())) .replace(REPORT_END, dateFormatter.getFormattedDate(trip.getEndDisplayableDate())) .replace(REPORT_GROSS_TOTAL, totals.getGrandTotalPrice().getCurrencyFormattedPrice()); }
Source:
public void notSet() throws Exception { final GuidedDecisionTableApplicationPreferencesLoader loader = new GuidedDecisionTableApplicationPreferencesLoader(); assertNull( new GuidedDecisionTableApplicationPreferencesLoader().load().get( GuidedDecisionTableEditorService.DTABLE_VERIFICATION_ENABLED ) ); }

Target:
public void notSet() throws Exception { assertEquals( "true", new GuidedDecisionTableApplicationPreferencesLoader().load().get( GuidedDecisionTableEditorService.DTABLE_VERIFICATION_ENABLED ) ); }
Source:
private void updateTrackablesList() { final TrackableLog[] trackablesArray = getSortedTrackables().toArray(new TrackableLog[trackables.size()]); final ListView inventoryList = ButterKnife.findById(this, R.id.inventory); inventoryList.setAdapter(new TrackableLogAdapter(this, R.layout.logcache_trackable_item, trackablesArray)); ViewUtils.setListViewHeightBasedOnItems(inventoryList); final LinearLayout inventoryBox = ButterKnife.findById(this, R.id.inventory_box); inventoryBox.setVisibility(trackables.isEmpty() ? View.GONE : View.VISIBLE); final LinearLayout inventoryChangeAllView = ButterKnife.findById(this, R.id.inventory_changeall); inventoryChangeAllView.setVisibility(trackables.size() > 1 ? View.VISIBLE : View.GONE); final Button changeButton = ButterKnife.findById(inventoryChangeAllView, R.id.changebutton); changeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { selectAllTrackablesAction(); } }); }

Target:
private void updateTrackablesList() { final TrackableLog[] trackablesArray = getSortedTrackables().toArray(new TrackableLog[trackables.size()]); final ListView inventoryList = ButterKnife.findById(this, R.id.inventory); inventoryList.setAdapter(new TrackableLogAdapter(this, R.layout.logcache_trackable_item, trackablesArray)); ViewUtils.setListViewHeightBasedOnItems(inventoryList); ButterKnife.findById(this, R.id.inventory_box).setVisibility(trackables.isEmpty() ? View.GONE : View.VISIBLE); final LinearLayout inventoryChangeAllView = ButterKnife.findById(this, R.id.inventory_changeall); inventoryChangeAllView.setVisibility(trackables.size() > 1 ? View.VISIBLE : View.GONE); final Button changeButton = ButterKnife.findById(inventoryChangeAllView, R.id.changebutton); changeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { selectAllTrackablesAction(); } }); }
Source:
public void checkoutRemoteBranchToExistingLocalBranchTest() throws Exception { String projectName = "testRepo"; String localBranch = "master"; String remoteBranch = "origin/master"; String gitMessage = "Ref master already exists"; projectExplorer.waitProjectExplorer(); git.importJavaApp(testRepo.getHtmlUrl(), projectName, BLANK); projectExplorer.waitAndSelectItem(projectName); menu.runCommand(GIT, BRANCHES); git.waitBranchInTheList(localBranch); git.waitBranchInTheList(remoteBranch); git.waitBranchInTheListWithCoState(localBranch); git.selectBranchAndClickCheckoutBtn(remoteBranch); git.closeBranchesForm(); git.waitGitStatusBarWithMess(gitMessage); eventsPanel.clickEventLogBtn(); eventsPanel.waitExpectedMessage(gitMessage); }

Target:
public void checkoutRemoteBranchToExistingLocalBranchTest() throws Exception { projectExplorer.waitProjectExplorer(); git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, BLANK); projectExplorer.waitAndSelectItem(PROJECT_NAME); menu.runCommand(GIT, BRANCHES); git.waitBranchInTheList(LOCAL_BRANCH); git.waitBranchInTheList(REMOTE_BRANCH); git.waitBranchInTheListWithCoState(LOCAL_BRANCH); git.selectBranchAndClickCheckoutBtn(REMOTE_BRANCH); git.closeBranchesForm(); git.waitGitStatusBarWithMess(GIT_MESSAGE); eventsPanel.clickEventLogBtn(); eventsPanel.waitExpectedMessage(GIT_MESSAGE); }
Source:
public static PathContext jsonApiCommonSyntax(Object input, String pathSpec) { try { Matcher matcher = JSON_PATH_BASE.matcher(pathSpec); if (!matcher.matches()) { throw new RuntimeException("illegal patch spec, missing mode declaration"); } PathMode mode = PathMode.valueOf(matcher.group(1).toUpperCase(Locale.ENGLISH)); String pathWff = matcher.group(2); DocumentContext ctx; switch (mode) { case STRICT: if (input instanceof Exception) { return PathContext.withStrictException((Exception) input); } ctx = JsonPath.parse(input, Configuration .builder() .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build() ); break; case LAX: if (input instanceof Exception) { return PathContext.withReturned(PathMode.LAX, null); } ctx = JsonPath.parse(input, Configuration .builder() .options(Option.SUPPRESS_EXCEPTIONS) .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build() ); break; default: throw new RuntimeException("illegal mode: " + mode); } try { return PathContext.withReturned(mode, ctx.read(pathWff)); } catch (Exception e) { return PathContext.withStrictException(e); } } catch (Exception e) { return PathContext.withUnknownException(e); } }

Target:
public static PathContext jsonApiCommonSyntax(Object input, String pathSpec) { try { Matcher matcher = JSON_PATH_BASE.matcher(pathSpec); if (!matcher.matches()) { throw RESOURCE.illegalJsonPathSpec(pathSpec).ex(); } PathMode mode = PathMode.valueOf(matcher.group(1).toUpperCase(Locale.ENGLISH)); String pathWff = matcher.group(2); DocumentContext ctx; switch (mode) { case STRICT: if (input instanceof Exception) { return PathContext.withStrictException((Exception) input); } ctx = JsonPath.parse(input, Configuration .builder() .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build() ); break; case LAX: if (input instanceof Exception) { return PathContext.withReturned(PathMode.LAX, null); } ctx = JsonPath.parse(input, Configuration .builder() .options(Option.SUPPRESS_EXCEPTIONS) .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build() ); break; default: throw RESOURCE.illegalJsonPathModeInPathSpec(mode.toString(), pathSpec).ex(); } try { return PathContext.withReturned(mode, ctx.read(pathWff)); } catch (Exception e) { return PathContext.withStrictException(e); } } catch (Exception e) { return PathContext.withUnknownException(e); } }
Source:
public void createDb() { InputStream is = null; try { HttpConnection connection = HttpConnectionManager.connect("PUT", "application/json", this.uriHelper.getRootUri()); is = this.executeToInputStream(connection); DBOperationResponse res = jsonHelper.fromJson(new InputStreamReader(is), DBOperationResponse.class); if (!res.getOk()) { throw new ServerException("Response from couch db server: " + res.toString()); } } finally { closeQuietly(is); } }

Target:
public void createDb() { HttpConnection connection = Http.PUT(this.uriHelper.getRootUri(), "application/json"); DBOperationResponse res = executeToJsonObject(connection, DBOperationResponse.class); if (!res.getOk()) { throw new ServerException("Response from couch db server: " + res.toString()); } }
Source:
public int setTabIndexes(int nextTabIndex) { nextTabIndex = super.setTabIndexes(nextTabIndex); nextTabIndex = createSubnetEditor.setTabIndexes(nextTabIndex); nextTabIndex = this.subnetWidget.setTabIndexes(nextTabIndex); return nextTabIndex; }

Target:
public int setTabIndexes(int nextTabIndex) { nextTabIndex = createSubnetEditor.setTabIndexes(nextTabIndex); nextTabIndex = this.subnetWidget.setTabIndexes(nextTabIndex); return nextTabIndex; }
Source:
private boolean addTrace(@Nullable IProgressMonitor monitor) { boolean fetchTreeIsComplete = true; ITmfTrace trace = getTrace(); String traceName = Objects.requireNonNull(trace.getName()); EntryModelBuilder entry = fEntryBuilder.get(-1L, traceName); TraceEntryModel.Builder traceEntry; if (entry != null && entry instanceof TraceEntryModel.Builder) { traceEntry = (TraceEntryModel.Builder) entry; } else { long newId = ENTRY_ID.getAndIncrement(); traceEntry = new TraceEntryModel.Builder(newId, -1, Objects.requireNonNull(trace.getName()), trace.getStartTime().toNanos(), trace); fEntryBuilder.put(-1L, traceName, traceEntry); } long rootId = traceEntry.getId(); for (Entry<ITmfAnalysisModuleWithStateSystems, Boolean> moduleWithStatus : fModulesToStatus.entrySet()) { if (monitor != null) { if (monitor.isCanceled()) { return false; } } ITmfAnalysisModuleWithStateSystems module = Objects.requireNonNull(moduleWithStatus.getKey()); Boolean analysisIsDone = Objects.requireNonNull(moduleWithStatus.getValue()); if (!analysisIsDone || fStartedAnalysis.contains(module)) { fetchTreeIsComplete &= addModule(monitor, module, rootId, trace.getStartTime().toNanos()); fStartedAnalysis.remove(module); } } long traceEnd = traceEntry.getStartTime(); for (ModuleEntryModel moduleEntryModel : moduleEntryModelList) { if (monitor != null) { if (monitor.isCanceled()) { return false; } } traceEnd = Long.max(traceEnd, moduleEntryModel.getEndTime()); } traceEntry.setEndTime(traceEnd); fEntryBuilder.put(-1L, traceName, traceEntry); return fetchTreeIsComplete; }

Target:
private boolean addTrace(@Nullable IProgressMonitor monitor) { boolean fetchTreeIsComplete = true; ITmfTrace trace = getTrace(); String traceName = Objects.requireNonNull(trace.getName()); EntryModelBuilder entry = fEntryBuilder.get(-1L, traceName); TraceEntryModel.Builder traceEntry; if (entry != null && entry instanceof TraceEntryModel.Builder) { traceEntry = (TraceEntryModel.Builder) entry; } else { long newId = ENTRY_ID.getAndIncrement(); traceEntry = new TraceEntryModel.Builder(newId, -1, traceName, trace.getStartTime().toNanos(), trace); fEntryBuilder.put(-1L, traceName, traceEntry); } long rootId = traceEntry.getId(); for (Entry<ITmfAnalysisModuleWithStateSystems, Boolean> moduleWithStatus : fModulesToStatus.entrySet()) { if (monitor != null) { if (monitor.isCanceled()) { return false; } } ITmfAnalysisModuleWithStateSystems module = Objects.requireNonNull(moduleWithStatus.getKey()); Boolean analysisIsDone = Objects.requireNonNull(moduleWithStatus.getValue()); if (!analysisIsDone || fStartedAnalysis.contains(module)) { fetchTreeIsComplete &= addModule(monitor, module, rootId, trace.getStartTime().toNanos()); fStartedAnalysis.remove(module); } } long traceEnd = traceEntry.getEndTime(); for (ModuleEntryModel moduleEntryModel : fModuleEntryModelList) { if (monitor != null) { if (monitor.isCanceled()) { return false; } } traceEnd = Long.max(traceEnd, moduleEntryModel.getEndTime()); } traceEntry.setEndTime(traceEnd); return fetchTreeIsComplete; }
Source:
public <T> T getMojoParameterValue(final MavenProject project, final MojoExecution mojoExecution, final String parameter, final Class<T> asType, final IProgressMonitor monitor) throws CoreException { return context().execute(project, new ICallable<T>() { public T call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException { return getMojoParameterValue(context.getSession(), mojoExecution, parameter, asType); } }, monitor); }

Target:
public <T> T getMojoParameterValue(final MavenProject project, final MojoExecution mojoExecution, final String parameter, final Class<T> asType, final IProgressMonitor monitor) throws CoreException { return context().execute(project, (context, pm) -> getMojoParameterValue(context.getSession(), mojoExecution, parameter, asType), monitor); }
Source:
public Optional<?> getLowValue() { return lowValue; }

Target:
public Optional<? extends Comparable<?>> getLowValue() { return lowValue; }
Source:
public void beforeToProto() { throw new ZoomConvert.ConvertException("Conversion of an object of " + "class: " + this.getClass() + " to a protocol buffer is not " + "supported"); }

Target:
public void beforeToProto() { throw new ZoomConvert.ConvertException("Conversion of an object of " + "class: " + getClass() + " to a protocol buffer is not " + "supported"); }
Source:
public static void createRejoinNodeIndicator(ZooKeeper zk, String node) { try { System.out.println("start create znode" + node); zk.create(node, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); System.out.println("finshed create znode" + node); } catch (KeeperException e) { if (e.code() != KeeperException.Code.NODEEXISTS) { VoltDB.crashLocalVoltDB("Unable to create rejoin node Indicator", true, e); } } catch (InterruptedException e) { VoltDB.crashLocalVoltDB("Unable to create rejoin node Indicator", true, e); } }

Target:
public static void createRejoinNodeIndicator(ZooKeeper zk, String node) { try { zk.create(node, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); } catch (KeeperException e) { if (e.code() != KeeperException.Code.NODEEXISTS) { VoltDB.crashLocalVoltDB("Unable to create rejoin node Indicator", true, e); } } catch (InterruptedException e) { VoltDB.crashLocalVoltDB("Unable to create rejoin node Indicator", true, e); } }
Source:
public long getAtsSearchUuid() { if (iWorldEditorProvider instanceof WorldEditorParameterSearchItemProvider) { WorldSearchItem worldSearchItem = ((WorldEditorParameterSearchItemProvider) iWorldEditorProvider).getWorldSearchItem(); if (worldSearchItem instanceof AtsSearchWorkflowSearchItem) { return ((AtsSearchWorkflowSearchItem) worldSearchItem).getSearchUuid(); } } return 0L; }

Target:
public Long getAtsSearchUuid() { if (iWorldEditorProvider instanceof WorldEditorParameterSearchItemProvider) { WorldSearchItem worldSearchItem = ((WorldEditorParameterSearchItemProvider) iWorldEditorProvider).getWorldSearchItem(); if (worldSearchItem instanceof AtsSearchWorkflowSearchItem) { return ((AtsSearchWorkflowSearchItem) worldSearchItem).getSearchUuid(); } } return 0L; }
Source:
public void testUpdateVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { Invokable<?, ?> method = method(VirtualMachineApi.class, "updateVirtualMachine", String.class, UpdateVirtualMachineOptions.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5", UpdateVirtualMachineOptions.Builder.group("test"))); assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=updateVirtualMachine&id=5&group=test HTTP/1.1"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertPayloadEquals(httpRequest, null, null, false); assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class); checkFilters(httpRequest); }

Target:
public void testUpdateVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { Invokable<?, ?> method = method(VirtualMachineApi.class, "updateVirtualMachine", String.class, UpdateVirtualMachineOptions.class); byte[] unencodedData = "userData".getBytes(Charset.forName("utf-8")); UpdateVirtualMachineOptions options = UpdateVirtualMachineOptions.Builder .displayName("disp").group("test").haEnable(true).osTypeId("osid").userData(unencodedData); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5", options)); String base64UrlEncodedData = URLEncoder.encode(base64().encode(unencodedData), "utf-8"); assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=updateVirtualMachine" + "&id=5&displayname=disp&group=test&haenable=true&ostypeid=osid&userdata=" + base64UrlEncodedData + " HTTP/1.1"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertPayloadEquals(httpRequest, null, null, false); assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class); assertSaxResponseParserClassEquals(method, null); assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class); checkFilters(httpRequest); }
Source:
protected String getLocaleStringFromPath(final String path) { String result = null; if (null != path) { if (!path.startsWith("/")) { throw new IllegalArgumentException("Path should start with a '/'"); } String[] pathElements = path.substring(1).split("/"); File localeFile = new File(base, pathElements[0]); if (!localeFile.exists() || localeFile.isDirectory()) { result = pathElements[0]; } } return result; }

Target:
protected String getLocaleStringFromPath(final String path) { String result = null; if (path != null) { if (!path.startsWith("/")) { log.warn("Path should start with a '/'"); return null; } String[] pathElements = path.substring(1).split("/"); File localeFile = new File(base, pathElements[0]); if (!localeFile.exists() || localeFile.isDirectory()) { result = pathElements[0]; } } return result; }
Source:
private void runAddOATag(final File inputSam, final File output, final File intervalList) throws IOException { final ArrayList<String> args = new ArrayList<String>(){ { add("INPUT=" + inputSam); add("OUTPUT=" + output); } }; if (intervalList != null) { args.add("INTERVAL_LIST=" + intervalList); } AddOATag addOATag = new AddOATag(); Assert.assertEquals(addOATag.instanceMain(args.toArray(new String[args.size()])), 0, "Running addOATag did not succeed"); }

Target:
private static void runAddOATag(final File inputSam, final File output, final File intervalList) throws IOException { final List<String> args = new ArrayList<>(Arrays.asList( "INPUT=" + inputSam, "OUTPUT=" + output )); if (intervalList != null) { args.add("INTERVAL_LIST=" + intervalList); } AddOATag addOATag = new AddOATag(); Assert.assertEquals(addOATag.instanceMain(args.toArray(new String[0])), 0, "Running addOATag did not succeed"); }
Source:
protected void compensate() { try { if (isQuotaDependant()) { rollbackQuota(); } } catch (NullPointerException e) { log.debug("RollbackQuota: failed (may be because quota is disabled)", e); } if (!commandId.equals(getCompensationContext().getCommandId())) { return; } try { compensator.compensate(commandId, getClass().getName(), getCompensationContext()); } catch (Throwable t) { log.error("Unable to compensate command {}: {}", commandId, ExceptionUtils.getRootCauseMessage(t)); } }

Target:
protected void compensate() { try { if (isQuotaDependant()) { rollbackQuota(); } } catch (NullPointerException e) { log.debug("RollbackQuota: failed (may be because quota is disabled)", e); } if (!commandId.equals(getCompensationContext().getCommandId())) { return; } try { compensator.compensate(commandId, getClass().getName(), getCompensationContext()); } catch (Throwable t) { log.error("Unable to compensate command {}: {}", commandId, ExceptionUtils.getRootCauseMessage(t)); log.debug("Exception", t); } }
Source:
public static MachineProvisioningLocation<? extends SshMachineLocation> createLocation(ManagementContext mgmt) { Location bestLocation = mgmt.getLocationRegistry().resolveIfPossible("named:ChefTests"); if (bestLocation==null) { log.info("using AWS for chef tests because named:ChefTests does not exist"); bestLocation = mgmt.getLocationRegistry().resolveIfPossible("jclouds:aws-ec2"); } if (bestLocation==null) { throw new IllegalStateException("Need a location called named:ChefTests or AWS configured for these tests"); } return (MachineProvisioningLocation<? extends SshMachineLocation>)bestLocation; }

Target:
public static MachineProvisioningLocation<? extends SshMachineLocation> createLocation(ManagementContext mgmt) { Location bestLocation = mgmt.getLocationRegistry().resolveIfPossible("named:ChefTests"); if (bestLocation==null) { log.info("using AWS for chef tests because named:ChefTests does not exist"); bestLocation = mgmt.getLocationRegistry().resolveIfPossible("jclouds:aws-ec2:us-east-1"); } if (bestLocation==null) { throw new IllegalStateException("Need a location called named:ChefTests or AWS configured for these tests"); } return (MachineProvisioningLocation<? extends SshMachineLocation>)bestLocation; }
Source:
private TimeLockServices createNewClient(String client) { Preconditions.checkArgument(!client.equals(PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE), "The client name '%s' is reserved for the leader election service, and may not be " + "used.", PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE); if (servicesByClient.size() >= maxNumberOfClients.get()) { log.error( "Unable to create timelock services for client {}, as it would exceed the maximum number of " + "allowed clients ({}).", SafeArg.of("client", client), SafeArg.of("maxNumberOfClients", maxNumberOfClients)); throw new IllegalStateException("Maximum number of clients exceeded"); } return clientServicesFactory.apply(client); }

Target:
private TimeLockServices createNewClient(String client) { Preconditions.checkArgument(!client.equals(PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE), "The client name '%s' is reserved for the leader election service, and may not be " + "used.", PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE); if (servicesByClient.size() >= maxNumberOfClients.get()) { log.error( "Unable to create timelock services for client {}, as it would exceed the maximum number of " + "allowed clients ({}). If this is intentional, the maximum number of clients can be " + "increased via the maximum-number-of-clients runtime config property.", SafeArg.of("client", client), SafeArg.of("maxNumberOfClients", maxNumberOfClients)); throw new IllegalStateException("Maximum number of clients exceeded"); } return clientServicesFactory.apply(client); }
Source:
private void analyzeTables() { if (Thread.holdsLock(database.isPersistent() ? this : database) && tablesToAnalyze != null) { HashSet<Table> tablesToAnalyzeLocal = tablesToAnalyze; tablesToAnalyze = null; int rowCount = getDatabase().getSettings().analyzeSample / 10; for (Table table : tablesToAnalyzeLocal) { Analyze.analyzeTable(this, table, rowCount, false); } database.unlockMeta(this); if (database.isMVStore()) { commit(true); } } }

Target:
private void analyzeTables() { if (tablesToAnalyze != null && Thread.holdsLock(database.isMVStore() ? this : database)) { HashSet<Table> tablesToAnalyzeLocal = tablesToAnalyze; tablesToAnalyze = null; int rowCount = getDatabase().getSettings().analyzeSample / 10; for (Table table : tablesToAnalyzeLocal) { Analyze.analyzeTable(this, table, rowCount, false); } database.unlockMeta(this); if (database.isMVStore()) { commit(true); } } }
Source:
public List<Artifact> uploadArtifactsBySpec(String uploadSpec, int numberOfThreads, File workspace, Multimap<String, String> buildProperties, ArtifactoryBuildInfoClientBuilder clientBuilder) throws Exception { Spec spec = this.getDownloadUploadSpec(uploadSpec, new UploadSpecValidator()); try ( buildInfoClientsArray clients = new buildInfoClientsArray(numberOfThreads, clientBuilder) ) { clients.buildBuildInfoClients(); ProducerRunnableBase[] producerRunnable = new ProducerRunnableBase[]{new SpecDeploymentProducer(spec, workspace, buildProperties)}; ConsumerRunnableBase[] consumerRunnables = new ConsumerRunnableBase[numberOfThreads]; for (int i = 0; i < clients.buildInfoClients.length; i++) { consumerRunnables[i] = new SpecDeploymentConsumer(clients.buildInfoClients[i]); } ProducerConsumerExecutor deploymentExecutor = new ProducerConsumerExecutor(log, producerRunnable, consumerRunnables, 10); deploymentExecutor.start(); Set<DeployDetails> deployedArtifacts = ((SpecDeploymentProducer) producerRunnable[0]).getDeployedArtifacts(); return convertDeployDetailsToArtifacts(deployedArtifacts); } }

Target:
public List<Artifact> uploadArtifactsBySpec(String uploadSpec, int numberOfThreads, File workspace, Multimap<String, String> buildProperties, ArtifactoryBuildInfoClientBuilder clientBuilder) throws Exception { Spec spec = this.getDownloadUploadSpec(uploadSpec, new UploadSpecValidator()); try (BuildInfoClientsArray clients = new BuildInfoClientsArray(numberOfThreads, clientBuilder)) { clients.buildBuildInfoClients(); ProducerRunnableBase[] producerRunnable = new ProducerRunnableBase[]{new SpecDeploymentProducer(spec, workspace, buildProperties)}; ConsumerRunnableBase[] consumerRunnables = new ConsumerRunnableBase[numberOfThreads]; for (int i = 0; i < clients.buildInfoClients.length; i++) { consumerRunnables[i] = new SpecDeploymentConsumer(clients.buildInfoClients[i]); } ProducerConsumerExecutor deploymentExecutor = new ProducerConsumerExecutor(log, producerRunnable, consumerRunnables, 10); deploymentExecutor.start(); Set<DeployDetails> deployedArtifacts = ((SpecDeploymentProducer) producerRunnable[0]).getDeployedArtifacts(); return convertDeployDetailsToArtifacts(deployedArtifacts); } }
Source:
private void parseSecondArgWithoutDash(String arg, boolean passFileExists) { int delimiterIndex = arg.indexOf("="); if (isSetOrMergeAction() && delimiterIndex == -1 && !passFileExists) { throw new IllegalArgumentException("Argument for set/concat action must be in format of key=value."); } String key = getStringBeforeEqualChar(arg, delimiterIndex); String value = getStringAfterEqualChar(arg, delimiterIndex); if (!key.isEmpty()) { if (!value.isEmpty()) { parseSecondArgWithKeyValue(arg, key, value); } else if (isSetOrMergeAction() && getKey() == null) { engineConfigMap.setKey(key); engineConfigMap.setValue(value); } else if ((getConfigAction().equals(ConfigActionType.ACTION_GET) || getConfigAction().equals(ConfigActionType.ACTION_HELP)) && getKey() == null) { engineConfigMap.setKey(arg); } else { log.debug("parsing error: illegal argument " + arg + ". Skipping argument."); } } else { log.debug("parsing error: illegal argument " + arg + ", starts with '='. Skipping argument."); } }

Target:
private void parseSecondArgWithoutDash(String arg, boolean passFileExists) { int delimiterIndex = arg.indexOf("="); if (isSetOrMergeAction() && delimiterIndex == -1 && !passFileExists) { throw new IllegalArgumentException("Argument for set/merge action must be in format of key=value."); } String key = getStringBeforeEqualChar(arg, delimiterIndex); String value = getStringAfterEqualChar(arg, delimiterIndex); if (!key.isEmpty()) { if (!value.isEmpty()) { parseSecondArgWithKeyValue(arg, key, value); } else if (isSetOrMergeAction() && getKey() == null) { engineConfigMap.setKey(key); engineConfigMap.setValue(value); } else if ((getConfigAction().equals(ConfigActionType.ACTION_GET) || getConfigAction().equals(ConfigActionType.ACTION_HELP)) && getKey() == null) { engineConfigMap.setKey(arg); } else { log.debug("parsing error: illegal argument " + arg + ". Skipping argument."); } } else { log.debug("parsing error: illegal argument " + arg + ", starts with '='. Skipping argument."); } }
Source:
private String determineErrorMessage(final ProtocolResponseMessage message) { final String errorMessage; if (message.getOsgpException() == null) { errorMessage = ""; } else if (message.getOsgpException().getCause() == null) { errorMessage = message.getOsgpException().getMessage(); } else { errorMessage = message.getOsgpException().getCause().getMessage(); } return errorMessage; }

Target:
private String determineErrorMessage(final ProtocolResponseMessage message) { if (message.getOsgpException() == null) { return ""; } else if (message.getOsgpException().getCause() == null) { return message.getOsgpException().getMessage(); } else { return message.getOsgpException().getCause().getMessage(); } }
Source:
public void destroy() { if (runner != null) { runner.close(); } runner = null; determinismChecker = null; }

Target:
public void destroy() { closeAllRuntimeException(runner); runner = null; determinismChecker = null; }
Source:
private String getPropertyValue(final String envVariable, final Properties properties, final String defaultValue, final String property) { final String valueInEnvironment = System.getenv(envVariable); if (Strings.isNullOrEmpty(valueInEnvironment)) { return getPropertyValue(properties, defaultValue, property); } return valueInEnvironment; }

Target:
private String getPropertyValue(final String envVariable, final Properties properties, final String defaultValue, final String property) { final String valueInEnvironment = System.getenv(envVariable); return (Strings.isNullOrEmpty(valueInEnvironment)) ? getPropertyValue(properties, defaultValue, property) : valueInEnvironment; }
Source:
public boolean resolveConflictsOnMerge() { EntryMergePolicy policy = mergePolicy(); return (policy instanceof MergePolicy && policy != MergePolicy.NONE) || policy != null; }

Target:
public boolean resolveConflictsOnMerge() { EntryMergePolicy policy = mergePolicy(); if (policy == MergePolicy.NONE) return false; return policy != null; }
Source:
public void init() { if (!executorStarted) { if (maxRunningTime > -1) { requeue(maxRunningTime); } try { executor.init(); this.executorStarted = true; ServiceRegistry.get().register(org.kie.api.executor.ExecutorService.class.getSimpleName(), this); } catch (ExecutorNotStartedException e) { this.executorStarted = false; } } }

Target:
public void init() { if (!executorStarted) { if (maxRunningTime > -1) { requeue(maxRunningTime); } try { executor.init(); this.executorStarted = true; ServiceRegistry.get().register(ServiceRegistry.EXECUTOR_SERVICE, this); } catch (ExecutorNotStartedException e) { this.executorStarted = false; } } }
Source:
protected FixedLengthCharsetTransformingDecompressorStream(InputStream in, FixedLengthCharset fixedLengthCharset, long start, long end) throws IOException { super(in, new FixedLengthCharsetTransformingDecompressor(fixedLengthCharset)); long skippedBytes = in.skip(start); this.start = start; this.end = end; }

Target:
public FixedLengthCharsetTransformingDecompressorStream(InputStream in, FixedLengthCharset fixedLengthCharset, long start, long end) throws IOException { super(in, new FixedLengthCharsetTransformingDecompressor(fixedLengthCharset), 4096); ((Seekable) in).seek(start); this.start = start; this.end = end; }
Source:
public double yieldFromPrice(double price, LocalDate settlementDate) { double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate()); if (yieldConvention.equals(DISCOUNT)) { return (1.0d - price) / accrualFactor; } if (yieldConvention.equals(INTEREST_AT_MATURITY) || yieldConvention.equals(FRANCE_CD) || yieldConvention.equals(JAPAN_BILLS)) { return (1.0d / price - 1) / accrualFactor; } throw new UnsupportedOperationException("The convention " + yieldConvention.name() + " is not supported."); }

Target:
public double yieldFromPrice(double price, LocalDate settlementDate) { double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate()); return yieldConvention.yieldFromPrice(price, accrualFactor); }
Source:
private static boolean isAttemptToRemovePermissionFromAnyoneOnPrivateComponent(GroupPermissionChange change, ProjectId projectId) { return projectId.isPrivate() && change.getOperation() == REMOVE && ProjectPermissions.PUBLIC_PERMISSIONS.contains(change.getPermission()); }

Target:
private static boolean isAttemptToRemovePermissionFromAnyoneOnPrivateComponent(GroupPermissionChange change, ProjectId projectId) { return projectId.isPrivate() && change.getOperation() == REMOVE && change.getGroupIdOrAnyone().isAnyone(); }
Source:
private Map<User,UserInfo> getUserInfo(Collection<? extends Item> items) { Map<User,UserInfo> users = new HashMap<User,UserInfo>(); for (Item item : items) { for (Job<?, ?> job : item.getAllJobs()) { if (job instanceof SCMTriggerItem) { RunList<? extends Run<?, ?>> runs = job.getBuilds(); for (Run<?, ?> r : runs) { if (r instanceof RunWithSCM) { RunWithSCM<?,?> runWithSCM = (RunWithSCM<?,?>) r; for (ChangeLogSet<? extends Entry> c : runWithSCM.getChangeSets()) { for (Entry entry : c) { User user = entry.getAuthor(); UserInfo info = users.get(user); if (info == null) users.put(user, new UserInfo(user, job, r.getTimestamp())); else if (info.getLastChange().before(r.getTimestamp())) { info.project = job; info.lastChange = r.getTimestamp(); } } } } } } } } return users; }

Target:
private Map<User,UserInfo> getUserInfo(Collection<? extends Item> items) { Map<User,UserInfo> users = new HashMap<User,UserInfo>(); for (Item item : items) { for (Job<?, ?> job : item.getAllJobs()) { RunList<? extends Run<?, ?>> runs = job.getBuilds(); for (Run<?, ?> r : runs) { if (r instanceof RunWithSCM) { RunWithSCM<?,?> runWithSCM = (RunWithSCM<?,?>) r; for (ChangeLogSet<? extends Entry> c : runWithSCM.getChangeSets()) { for (Entry entry : c) { User user = entry.getAuthor(); UserInfo info = users.get(user); if (info == null) users.put(user, new UserInfo(user, job, r.getTimestamp())); else if (info.getLastChange().before(r.getTimestamp())) { info.project = job; info.lastChange = r.getTimestamp(); } } } } } } } return users; }
Source:
FileCommentPanel(SideBySide2 host, DiffTable table, String path, Side side) { this.parent = host; this.table = table; this.path = path; this.side = side; boxes = new ArrayList<CommentBox>(); initWidget(body = new HTMLPanel("")); }

Target:
FileCommentPanel(SideBySide2 host, DiffTable table, String path, Side side) { this.parent = host; this.table = table; this.path = path; this.side = side; boxes = new ArrayList<CommentBox>(); initWidget(body = new FlowPanel()); }
Source:
public StatusInfo getCurrentStatus(@RequestParam(name = "token", required = true) String token) throws InvalidMonitoringTokenException { if (StringUtils.isNotEmpty(token) && StringUtils.equals(token, getConfiguredToken())) { return StatusInfo.getCurrentStatus(); } else { throw new InvalidMonitoringTokenException("Invalid token for monitoring authorization"); } }

Target:
public StatusInfo getCurrentStatus(@RequestParam(name = "token", required = true) String token) throws InvalidManagementTokenException { if (StringUtils.isNotEmpty(token) && StringUtils.equals(token, getConfiguredToken())) { return StatusInfo.getCurrentStatus(); } else { throw new InvalidManagementTokenException("Management authorization failed, invalid token."); } }
Source:
public Builder withSubAnalyses(Collection<? extends SubAnalysis> subAnalyses) { if (null == subAnalyses) { throw new IllegalArgumentException("The 'subAnalyses' parameter cannot be null."); } for (SubAnalysis subAnalysis : subAnalyses) { addSubAnalysis(subAnalysis); } return this; }

Target:
public Builder withSubAnalyses(Collection<? extends SubAnalysis> subAnalyses) { if (null == subAnalyses) { throw new IllegalArgumentException("The 'subAnalyses' parameter cannot be null."); } setSubAnalyses(subAnalyses); return this; }
Source:
public ItemStackSnapshot getExemplaryResult() { return recipe.getExemplaryResult(); }

Target:
public ItemStackSnapshot getExemplaryResult() { return this.recipe.getExemplaryResult(); }
Source:
public void testCompleteAndThenCancel() throws Exception { RunnableFuture<Integer> interruptible = new InterruptibleFuture<Integer>() { @Override public Integer call() throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); return 1; } }; executor.execute(interruptible); assertThat(interruptible.get(), is(1)); interruptible.cancel(true); assertThat(interruptible.get(), is(1)); }

Target:
public void testCompleteAndThenCancel() throws Exception { RunnableFuture<Integer> interruptible = new InterruptibleFuture<Integer>() { @Override public Integer call() throws InterruptedException { if (Thread.interrupted()) { throw new InterruptedException(); } return 1; } }; executor.execute(interruptible); assertThat(interruptible.get(), is(1)); interruptible.cancel(true); assertThat(interruptible.get(), is(1)); }
Source:
protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_SQUID_AMBIENT; }

Target:
protected SoundEvent getAmbientSound() { if(this.isInWater()) { return SoundEvents.ENTITY_SQUID_AMBIENT; }else { return SoundEvents.BLOCK_GRAVEL_STEP; } }
Source:
public IBinding[] findBindings(IASTName n, boolean isPrefix, String[] namespaces) { IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix, namespaces); if (fQualifierPos >= 0) { IBinding binding = fQualifier[fQualifierPos].resolveBinding(); IType type; while (binding instanceof ITypedef) { ITypedef typedef = (ITypedef) binding; type = typedef.getType(); if (type instanceof IBinding) { binding = (IBinding) type; } else { binding = null; } } if (binding instanceof ICPPClassType) { ICPPClassType classType = (ICPPClassType) binding; final boolean isDeclaration = getParent().getParent() instanceof IASTSimpleDeclaration; List<IBinding> filtered = filterClassScopeBindings(classType, bindings, isDeclaration); if (isDeclaration && nameMatches(classType.getNameCharArray(), n.getLookupKey(), isPrefix)) { ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(classType, n); for (int i = 0; i < constructors.length; i++) { if (!constructors[i].isImplicit()) { filtered.add(constructors[i]); } } } return filtered.toArray(new IBinding[filtered.size()]); } } return bindings; }

Target:
public IBinding[] findBindings(IASTName n, boolean isPrefix, String[] namespaces) { IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix, namespaces); if (fQualifierPos >= 0) { IBinding binding = fQualifier[fQualifierPos].resolveBinding(); while (binding instanceof ITypedef) { ITypedef typedef = (ITypedef) binding; IType type = typedef.getType(); if (type instanceof IBinding) { binding = (IBinding) type; } else { binding = null; } } if (binding instanceof ICPPClassType) { ICPPClassType classType = (ICPPClassType) binding; final boolean isDeclaration = getParent().getParent() instanceof IASTSimpleDeclaration; List<IBinding> filtered = filterClassScopeBindings(classType, bindings, isDeclaration); if (isDeclaration && nameMatches(classType.getNameCharArray(), n.getLookupKey(), isPrefix)) { ICPPConstructor[] constructors = ClassTypeHelper.getConstructors(classType, n); for (int i = 0; i < constructors.length; i++) { if (!constructors[i].isImplicit()) { filtered.add(constructors[i]); } } } return filtered.toArray(new IBinding[filtered.size()]); } } return bindings; }
Source:
private static void validateMigrateStmt(String sql, VoltXMLElement xmlSQL, Database db) { final Map<String, String> attributes = xmlSQL.attributes; assert attributes.size() == 1; final Table targetTable = db.getTables().get(attributes.get("table")); assert targetTable != null; if (StringUtil.isEmpty(targetTable.getMigrationtarget())) { throw new PlanningErrorException(String.format( "%s: Cannot migrate from table %s because the table does not contain migration target", sql, targetTable.getTypeName())); } List<Pair<AbstractExpression, AbstractExpression>> leafAndParentList = ExpressionUtil.collectTerminalParentPairs( ExpressionUtil.from(db, VoltXMLElementHelper.getFirstChild( VoltXMLElementHelper.getFirstChild(xmlSQL, "condition"), "operation"))); for (Pair<AbstractExpression, AbstractExpression> leafAndParent : leafAndParentList) { if (leafAndParent.getFirst() instanceof FunctionExpression) { if (((FunctionExpression) leafAndParent.getFirst()).getFunctionName().equals("migrating") && leafAndParent.getSecond().getExpressionType() == ExpressionType.OPERATOR_NOT) { return; } } } throw new PlanningErrorException(String.format( "%s: Cannot migrate from table %s because the WHERE clause does not contain NOT MIGRATING()", sql, targetTable.getTypeName())); }

Target:
private static void validateMigrateStmt(String sql, VoltXMLElement xmlSQL, Database db) { final Map<String, String> attributes = xmlSQL.attributes; assert attributes.size() == 1; final Table targetTable = db.getTables().get(attributes.get("table")); assert targetTable != null; if (StringUtil.isEmpty(targetTable.getMigrationtarget())) { throw new PlanningErrorException(String.format( "%s: Cannot migrate from table %s because the table definition does not specify a migration target", sql, targetTable.getTypeName())); } if (ExpressionUtil.containsTerminalParentPairs(ExpressionUtil.from(db, VoltXMLElementHelper.getFirstChild( VoltXMLElementHelper.getFirstChild(xmlSQL, "condition"), "operation")), isNotMigrating())) { return; } throw new PlanningErrorException(String.format( "%s: Cannot migrate from table %s because the WHERE clause does not contain NOT MIGRATING()", sql, targetTable.getTypeName())); }
Source:
public Response updateInsertionFeature(@PathParam("programUuid") long programUuid, @PathParam("insertionUuid") long insertionUuid, JaxNewInsertionFeature newFeature) throws Exception { ArtifactReadable insertionFeatureArt = atsServer.getQuery().andUuid(newFeature.getUuid()).getResults().getExactlyOne(); if (!insertionFeatureArt.getArtifactType().equals(AtsArtifactTypes.InsertionFeature)) { throw new OseeCoreException("Given insertion feature uuid not insertion feature type"); } Response response = null; if (!insertionFeatureArt.getName().equals(newFeature.getName())) { IAtsConfigObject updated = atsServer.getConfigItemFactory().updateInsertionFeature(newFeature); response = getResponse(updated); } else { response = Response.notModified().build(); } return response; }

Target:
public Response updateInsertionFeature(@PathParam("programUuid") long programUuid, @PathParam("insertionUuid") long insertionUuid, JaxNewInsertionFeature newFeature) throws Exception { ArtifactReadable insertionFeatureArt = atsServer.getArtifactByUuid(newFeature.getUuid()); if (insertionFeatureArt == null) { throw new OseeCoreException("Given insertion feature uuid not found"); } if (!insertionFeatureArt.getArtifactType().equals(AtsArtifactTypes.InsertionFeature)) { throw new OseeCoreException("Given insertion feature uuid not insertion feature type"); } Response response = null; if (!insertionFeatureArt.getName().equals(newFeature.getName())) { IAtsConfigObject updated = atsServer.getConfigItemFactory().updateInsertionFeature(newFeature); response = Response.ok().entity(updated).build(); } else { response = Response.notModified().build(); } return response; }
Source:
public void execute() throws JMXConnectionException, Exception { JMXConnectorMgr connMgr = null; List<T> result = null; try { connMgr = new JMXConnectorMgr(config); }catch (IOException | InterruptedException e){ measurement.incrementFailureCnt(1); this.metricPublisher.publish(measurement); throw new JMXConnectionException("Exception during creating JMX connection for operation: " + taskType.name(), e); } try { result = manageTask(connMgr); measurement.incrementSuccessCnt(1); this.metricPublisher.publish(measurement); logger.info("Successfully finished executing the cluster management task: with result: {}", taskType, result); } catch (Exception e) { measurement.incrementFailureCnt(1); this.metricPublisher.publish(measurement); throw new RuntimeException(String.format("Exception during %s.",taskType), e); } finally { if (connMgr != null) connMgr.close(); } if (result.isEmpty()) { logger.warn("{} task completed successfully but no action was done.", taskType.name()); } }

Target:
public void execute() throws Exception { if (!lock.tryLock()) { logger.error("Operation is already running! Try again later."); throw new Exception("Operation already running"); } try { String result = runTask(); measurement.incrementSuccessCnt(1); this.metricPublisher.publish(measurement); logger.info("Successfully finished executing the cluster management task: with result: {}", taskType, result); if (result.isEmpty()) { logger.warn("{} task completed successfully but no action was done.", taskType.name()); } } catch (Exception e){ measurement.incrementFailureCnt(1); this.metricPublisher.publish(measurement); throw new Exception("Exception during execution of operation: " + taskType.name(), e); } finally { lock.unlock(); } }
Source:
public Pipeline createPipelineInstance(PipelineConfig pipelineConfig, BuildCause buildCause, SchedulingContext context, String md5, Clock clock) { buildCause.assertMaterialsMatch(pipelineConfig.materialConfigs()); buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig); Map<CaseInsensitiveString, String> variables = EnvironmentVariables.toEnvironmentVariables(pipelineConfig.getVariables()).insecureVariablesHash(); variables.putAll(buildCause.getVariables().insecureVariablesHash()); return new Pipeline(CaseInsensitiveString.str(pipelineConfig.name()), pipelineConfig.getLabelTemplate(), buildCause, variables, createStageInstance(pipelineConfig.first(), context, md5, clock)); }

Target:
public Pipeline createPipelineInstance(PipelineConfig pipelineConfig, BuildCause buildCause, SchedulingContext context, String md5, Clock clock) { buildCause.assertMaterialsMatch(pipelineConfig.materialConfigs()); buildCause.assertPipelineConfigAndMaterialRevisionMatch(pipelineConfig); EnvironmentVariables variables = EnvironmentVariables.toEnvironmentVariables(pipelineConfig.getVariables()); variables.overrideWith(buildCause.getVariables()); return new Pipeline(CaseInsensitiveString.str(pipelineConfig.name()), pipelineConfig.getLabelTemplate(), buildCause, variables, createStageInstance(pipelineConfig.first(), context, md5, clock)); }
Source:
public void run() { DownloadDetailsDTO currentDownload = null; try { while (true) { if(shutdownFlag.get() || Thread.currentThread().isInterrupted()) { break; } Thread.sleep(pollDelay); currentDownload = persistentQueueDAO.getNextDownload(maxRecords, downloadType); if (currentDownload != null) { downloadServiceExecutor.submitDownload(currentDownload); } } } catch (InterruptedException | RejectedExecutionException e) { Thread.currentThread().interrupt(); } finally { try { downloadServiceExecutor.shutdown(); downloadServiceExecutor.awaitTermination(3, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { downloadServiceExecutor.shutdownNow(); } } }

Target:
public void run() { DownloadDetailsDTO currentDownload = null; try { while (true) { if(shutdownFlag.get() || Thread.currentThread().isInterrupted()) { break; } Thread.sleep(pollDelay); if(!downloadServiceExecutor.reserveCapacity(pollDelay, TimeUnit.MILLISECONDS)) { continue; } if(shutdownFlag.get() || Thread.currentThread().isInterrupted()) { break; } currentDownload = persistentQueueDAO.getNextDownload(maxRecords, downloadType); if (currentDownload != null) { downloadServiceExecutor.submitDownload(currentDownload, parallelQueryExecutor); } else { downloadServiceExecutor.returnCapacity(); } } } catch (InterruptedException | RejectedExecutionException e) { Thread.currentThread().interrupt(); } finally { try { downloadServiceExecutor.shutdown(); downloadServiceExecutor.awaitTermination(3, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { downloadServiceExecutor.shutdownNow(); } } }
Source:
public void testDeletePool() throws Exception { Pool pool = createPoolAndSub(o, socketLimitedProduct, 100L, TestUtil.createDate(2000, 3, 2), TestUtil.createDate(2050, 3, 2)); poolCurator.create(pool); List<Pool> pools = poolCurator.listByOwner(o); assertEquals(5, poolCurator.listByOwner(o).size()); poolManager.deletePools(Arrays.asList(pool, pools.get(0))); pools = poolCurator.listByOwner(o); assertEquals(3, pools.size()); poolManager.deletePools(pools); pools = poolCurator.listByOwner(o); assertTrue(pools.isEmpty()); }

Target:
public void testDeletePool() throws Exception { Pool pool = createPoolAndSub(o, socketLimitedProduct, 100L, TestUtil.createDate(2000, 3, 2), TestUtil.createDate(2050, 3, 2)); poolCurator.create(pool); List<Pool> pools = poolCurator.listByOwner(o); assertEquals(5, pools.size()); poolManager.deletePools(Arrays.asList(pool, pools.get(0))); pools = poolCurator.listByOwner(o); assertEquals(3, pools.size()); poolManager.deletePools(pools); pools = poolCurator.listByOwner(o); assertTrue(pools.isEmpty()); }