auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void testSpecificTestInstancePreDestroyCallbackIsCalled() { executeTestsForClass( TestCaseWithTestSpecificTestInstancePreDestroyCallback.class).testEvents().assertStatistics( stats -> stats.started(1).succeeded(1)); assertThat(callSequence).containsExactly( "fooPostProcessTestInstance:TestCaseWithTestSpecificTestInstancePreDestroyCallback", "beforeEachMethod", "test", "fooPreDestroyCallbackTestInstance:TestCaseWithTestSpecificTestInstancePreDestroyCallback" ); }

Target:
void testSpecificTestInstancePreDestroyCallbackIsCalled() { executeTestsForClass( TestCaseWithTestSpecificTestInstancePreDestroyCallback.class).testEvents().assertStatistics( stats -> stats.started(1).succeeded(1)); assertThat(callSequence).containsExactly( "beforeEachMethod", "test", "fooPreDestroyCallbackTestInstance:TestCaseWithTestSpecificTestInstancePreDestroyCallback" ); }
Source:
public final void assertEventsMatchLoosely(Condition<? super Event>... conditions) { Preconditions.notNull(conditions, "conditions must not be null"); assertEventsMatchLoosely(this.events, conditions); }

Target:
public final void assertEventsMatchLoosely(Condition<? super Event>... conditions) { Preconditions.notNull(conditions, "conditions must not be null"); Preconditions.containsNoNullElements(conditions, "conditions must not contain null elements"); assertEventsMatchLoosely(this.events, conditions); }
Source:
private DruidExpression handleDateTruncationViaDateTruncation( CallExpression function, Map<VariableReferenceExpression, DruidQueryGeneratorContext.Selection> context) { RowExpression timeInputParameter = function.getArguments().get(1); String inputColumn; String inputTimeZone; String inputFormat; CallExpression timeConversion = getExpressionAsFunction(timeInputParameter, timeInputParameter); switch (timeConversion.getDisplayName().toLowerCase(ENGLISH)) { case FROM_UNIXTIME: inputColumn = timeConversion.getArguments().get(0).accept(this, context).getDefinition(); inputTimeZone = timeConversion.getArguments().size() > 1 ? getStringFromConstant(timeConversion.getArguments().get(1)) : DateTimeZone.UTC.getID(); inputFormat = "seconds"; break; default: throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported time function: " + timeConversion.getDisplayName() + " to pushdown for Druid connector "); } RowExpression intervalParameter = function.getArguments().get(0); if (!(intervalParameter instanceof ConstantExpression)) { throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported interval unit: " + intervalParameter + " to pushdown for Druid connector "); } return derived("dateTrunc(" + inputColumn + "," + inputFormat + ", " + inputTimeZone + ", " + getStringFromConstant(intervalParameter) + ")"); }

Target:
private DruidExpression handleDateTruncationViaDateTruncation( CallExpression function, Map<VariableReferenceExpression, DruidQueryGeneratorContext.Selection> context) { RowExpression timeInputParameter = function.getArguments().get(1); String inputColumn; String inputTimeZone; String inputFormat; CallExpression timeConversion = getExpressionAsFunction(timeInputParameter, timeInputParameter); if (!timeConversion.getDisplayName().toLowerCase(ENGLISH).equals(FROM_UNIXTIME)) { throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported time function: " + timeConversion.getDisplayName() + " to pushdown for Druid connector."); } inputColumn = timeConversion.getArguments().get(0).accept(this, context).getDefinition(); inputTimeZone = timeConversion.getArguments().size() > 1 ? getStringFromConstant(timeConversion.getArguments().get(1)) : DateTimeZone.UTC.getID(); inputFormat = "seconds"; RowExpression intervalParameter = function.getArguments().get(0); if (!(intervalParameter instanceof ConstantExpression)) { throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported interval unit: " + intervalParameter + " to pushdown for Druid connector."); } return derived("dateTrunc(" + inputColumn + "," + inputFormat + ", " + inputTimeZone + ", " + getStringFromConstant(intervalParameter) + ")"); }
Source:
public void startExec(String execId, MessageProcessor<LogMessage> execOutputProcessor) throws IOException { final List<Pair<String, ?>> headers = new ArrayList<>(2); headers.add(Pair.of("Content-Type", "application/json")); final ExecStart execStart = new ExecStart().withDetach(execOutputProcessor == null); final String entity = JsonHelper.toJson(execStart, FIRST_LETTER_LOWERCASE); headers.add(Pair.of("Content-Length", entity.getBytes().length)); try (DockerConnection connection = openConnection(dockerDaemonUri).method("POST") .path("/exec/" + execId + "/start") .headers(headers) .entity(entity)) { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (status / 100 != 2) { throw new DockerException(getDockerExceptionMessage(response), status); } if (status != 204 && execOutputProcessor != null) { try (InputStream responseStream = response.getInputStream()) { new LogMessagePumper(responseStream, execOutputProcessor).start(); } } } }

Target:
public void startExec(String execId, MessageProcessor<LogMessage> execOutputProcessor) throws IOException { final ExecStart execStart = new ExecStart().withDetach(execOutputProcessor == null); final String entity = JsonHelper.toJson(execStart, FIRST_LETTER_LOWERCASE); final List<Pair<String, ?>> headers = new ArrayList<>(2); headers.add(Pair.of("Content-Type", MediaType.APPLICATION_JSON)); headers.add(Pair.of("Content-Length", entity.getBytes().length)); try (DockerConnection connection = openConnection(dockerDaemonUri).method("POST") .path("/exec/" + execId + "/start") .headers(headers) .entity(entity)) { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (status / 100 != 2) { throw new DockerException(getDockerExceptionMessage(response), status); } if (status != NO_CONTENT.getStatusCode() && execOutputProcessor != null) { try (InputStream responseStream = response.getInputStream()) { new LogMessagePumper(responseStream, execOutputProcessor).start(); } } } }
Source:
protected void checkInitialized() throws IllegalStateException { if (terminated) { throw new IllegalStateException("This SmartProxy instance has been terminated and cannot be used any more."); } if (!initialized) { throw new IllegalStateException("This SmartProxy instance has not been initialized."); } }

Target:
protected void checkInitialized() { if (terminated) { throw new IllegalStateException("This SmartProxy instance has been terminated and cannot be used any more."); } if (!initialized) { throw new IllegalStateException("This SmartProxy instance has not been initialized."); } }
Source:
public void workDirEnabledByDefaultWithFsRootAsDefaultPath() throws Exception { final File fsRootPath = temporaryRemotingFolder.newFolder("fsrootdir"); TestUtils.createSwarmClient(j, processDestroyer, temporaryFolder, "-fsroot", fsRootPath.getAbsolutePath()); assertTrue("Workdir exists", new File(fsRootPath, "remoting").isDirectory()); }

Target:
public void workDirEnabledByDefaultWithFsRootAsDefaultPath() throws Exception { final File fsRootPath = temporaryRemotingFolder.newFolder("fsrootdir"); TestUtils.createSwarmClient( j, processDestroyer, temporaryFolder, "-fsroot", fsRootPath.getAbsolutePath()); assertDirectories( fsRootPath, new File(fsRootPath, "remoting"), new File(fsRootPath, "remoting/logs"), new File(fsRootPath, "remoting/jarCache")); }
Source:
private Object configure() { if (StringUtils.isEmpty(monitoredDirectory)) { LOGGER.warn("Cannot setup camel route - must specify a directory to be monitored"); return null; } CompletableFuture.runAsync(this::attemptAddRoutes, configurationExecutor); return null; }

Target:
private Object configure() { if (StringUtils.isEmpty(monitoredDirectory)) { LOGGER.warn("Cannot setup camel route - must specify a directory to be monitored"); return null; } attemptAddRoutes(); return null; }
Source:
private DateTime getTimeBoundary(StorageAdapter adapter, TimeBoundaryQuery legacyQuery, boolean descending) { final Sequence<Result<DateTime>> resultSequence = QueryRunnerHelper.makeCursorBasedQuery( adapter, legacyQuery.getQuerySegmentSpec().getIntervals(), Filters.toFilter(legacyQuery.getDimensionsFilter()), descending, new AllGranularity(), skipToFirstMatching ); List<Result<DateTime>> resultList = Sequences.toList(resultSequence, Lists.<Result<DateTime>>newArrayList()); if (resultList.size() > 0) { return resultList.get(0).getValue(); } return null; }

Target:
private DateTime getTimeBoundary(StorageAdapter adapter, TimeBoundaryQuery legacyQuery, boolean descending) { final Sequence<Result<DateTime>> resultSequence = QueryRunnerHelper.makeCursorBasedQuery( adapter, legacyQuery.getQuerySegmentSpec().getIntervals(), Filters.toFilter(legacyQuery.getDimensionsFilter()), descending, new AllGranularity(), this.skipToFirstMatching ); final List<Result<DateTime>> resultList = Sequences.toList( Sequences.limit(resultSequence, 1), Lists.<Result<DateTime>>newArrayList() ); if (resultList.size() > 0) { return resultList.get(0).getValue(); } return null; }
Source:
public String toString() { return "ContinuousTimeRangeCondition: min=" + min() + ", max =" + max(); }

Target:
public String toString() { return "ContinuousTimeRangeCondition: (" + min() + '\u2025' + max() + ')'; }
Source:
private AbstractBackupPath getAbstractBackupPath(final File file, final BackupFileType type) throws Exception { final AbstractBackupPath bp = pathFactory.get(); bp.parseLocal(file, type); return bp; }

Target:
private AbstractBackupPath getAbstractBackupPath(final File file, final BackupFileType type) throws ParseException { final AbstractBackupPath bp = pathFactory.get(); bp.parseLocal(file, type); return bp; }
Source:
public void testComputeBroadcast() throws Exception { barrier = new CyclicBarrier(6); SystemView<ComputeJobView> jobs = server.context().systemView().view(JOBS_VIEW); for (int i = 0; i < 5; i++) { client.compute().broadcastAsync(() -> { try { barrier.await(TIMEOUT, MILLISECONDS); barrier.await(TIMEOUT, MILLISECONDS); } catch (InterruptedException | BrokenBarrierException | TimeoutException e) { throw new RuntimeException(e); } }); } barrier.await(TIMEOUT, MILLISECONDS); assertEquals(5, jobs.size()); ComputeJobView t = jobs.iterator().next(); checkTask(t); barrier.await(TIMEOUT, MILLISECONDS); }

Target:
public void testComputeBroadcast() throws Exception { barrier = new CyclicBarrier(6); SystemView<ComputeJobView> jobs = server.context().systemView().view(JOBS_VIEW); for (int i = 0; i < 5; i++) { client.compute().broadcastAsync(() -> { try { barrier.await(TIMEOUT, MILLISECONDS); barrier.await(TIMEOUT, MILLISECONDS); } catch (InterruptedException | BrokenBarrierException | TimeoutException e) { throw new RuntimeException(e); } }); } barrier.await(TIMEOUT, MILLISECONDS); assertEquals(5, jobs.size()); for (ComputeJobView job : jobs) checkJobView(job); barrier.await(TIMEOUT, MILLISECONDS); boolean res = waitForCondition(() -> jobs.size() == 0, TIMEOUT); assertTrue(res); }
Source:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { DestroyImageCommand<DestroyImageParameters> command = commandCoordinatorUtil.retrieveCommand(cmdId); Set<Guid> taskIds = new HashSet<>(command.getReturnValue().getVdsmTaskIdList()); Map<Guid, AsyncTaskStatus> idToTaskStatusMap = commandCoordinatorUtil.pollTasks(taskIds); for (Map.Entry<Guid, AsyncTaskStatus> idToTaskStatus : idToTaskStatusMap.entrySet()) { Guid id = idToTaskStatus.getKey(); AsyncTaskStatus status = idToTaskStatus.getValue(); if (status.getTaskIsRunning()) { log.info("Waiting on destroy image command to complete the task (taskId = {})", id); return; } } List<Guid> failedTasks = new ArrayList<>(); for (Map.Entry<Guid, AsyncTaskStatus> idToStatus : idToTaskStatusMap.entrySet()) { Guid id = idToStatus.getKey(); AsyncTaskStatus status = idToStatus.getValue(); if (!status.getTaskEndedSuccessfully()) { failedTasks.add(id); } } if (failedTasks.isEmpty()) { command.setSucceeded(true); command.setCommandStatus(CommandStatus.SUCCEEDED); command.persistCommand(command.getParameters().getParentCommand()); log.info("Destroy image command has completed successfully for images '{}' with async tasks '{}'.", command.getParameters().getImageList(), taskIds); } else { command.setSucceeded(false); command.setCommandStatus(CommandStatus.FAILED); log.info("Destroy image command has failed for images '{}' with async tasks '{}'.", command.getParameters().getImageList(), failedTasks); } command.persistCommand(command.getParameters().getParentCommand()); }

Target:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { DestroyImageCommand<DestroyImageParameters> command = commandCoordinatorUtil.retrieveCommand(cmdId); Set<Guid> taskIds = new HashSet<>(command.getReturnValue().getVdsmTaskIdList()); Map<Guid, AsyncTaskStatus> idToTaskStatusMap = commandCoordinatorUtil.pollTasks(taskIds); for (Map.Entry<Guid, AsyncTaskStatus> idToTaskStatus : idToTaskStatusMap.entrySet()) { Guid id = idToTaskStatus.getKey(); AsyncTaskStatus status = idToTaskStatus.getValue(); if (status.getTaskIsRunning()) { log.info("Waiting on destroy image command to complete the task (taskId = {})", id); return; } } List<Guid> failedTasks = new ArrayList<>(); idToTaskStatusMap.forEach((id, status) -> { if (!status.getTaskEndedSuccessfully()) { failedTasks.add(id); } }); if (failedTasks.isEmpty()) { command.setSucceeded(true); command.setCommandStatus(CommandStatus.SUCCEEDED); command.persistCommand(command.getParameters().getParentCommand()); log.info("Destroy image command has completed successfully for images '{}' with async tasks '{}'.", command.getParameters().getImageList(), taskIds); } else { command.setSucceeded(false); command.setCommandStatus(CommandStatus.FAILED); log.info("Destroy image command has failed for images '{}' with async tasks '{}'.", command.getParameters().getImageList(), failedTasks); } command.persistCommand(command.getParameters().getParentCommand()); }
Source:
private IProject createTestProject(IProgressMonitor monitor) throws CoreException { IProject project = getTestProject(); assertFalse("Expected test project to not exist at beginning of test", project.exists()); ensureExistsInWorkspace(project, true); assertTrue("Expected test project to be open after creation", project.isOpen()); IProjectDescription projectDescription = project.getDescription(); ICommand[] buildSpec = projectDescription.getBuildSpec(); ICommand command = projectDescription.newCommand(); command.setBuilderName("Simple Builder"); Collection<ICommand> builders = new ArrayList<>(Arrays.asList(buildSpec)); builders.add(command); projectDescription.setBuildSpec(builders.toArray(new ICommand[] {})); project.setDescription(projectDescription, monitor); return project; }

Target:
private IProject createTestProject(IProgressMonitor monitor) throws CoreException { IProject project = getTestProject(); assertFalse("Expected test project to not exist at beginning of test", project.exists()); ensureExistsInWorkspace(project, true); assertTrue("Expected test project to be open after creation", project.isOpen()); IProjectDescription projectDescription = project.getDescription(); ICommand[] buildSpec = projectDescription.getBuildSpec(); ICommand command = projectDescription.newCommand(); command.setBuilderName(SimpleBuilder.BUILDER_ID); Collection<ICommand> builders = new ArrayList<>(Arrays.asList(buildSpec)); builders.add(command); projectDescription.setBuildSpec(builders.toArray(new ICommand[] {})); project.setDescription(projectDescription, monitor); return project; }
Source:
public void writeObject(ObjectOutput output, JPAContinuousQueryCacheEventFilterConverter filterAndConverter) throws IOException { output.writeUTF(filterAndConverter.jpaQuery); Map<String, Object> namedParameters = filterAndConverter.namedParameters; if (namedParameters != null) { output.writeInt(namedParameters.size()); for (Map.Entry<String, Object> e : namedParameters.entrySet()) { output.writeUTF(e.getKey()); output.writeObject(e.getValue()); } } else { output.writeInt(-1); } output.writeObject(filterAndConverter.matcherImplClass); }

Target:
public void writeObject(ObjectOutput output, JPAContinuousQueryCacheEventFilterConverter filterAndConverter) throws IOException { output.writeUTF(filterAndConverter.jpaQuery); Map<String, Object> namedParameters = filterAndConverter.namedParameters; if (namedParameters != null) { UnsignedNumeric.writeUnsignedInt(output, namedParameters.size()); for (Map.Entry<String, Object> e : namedParameters.entrySet()) { output.writeUTF(e.getKey()); output.writeObject(e.getValue()); } } else { UnsignedNumeric.writeUnsignedInt(output, 0); } output.writeObject(filterAndConverter.matcherImplClass); }
Source:
public String getStripped(String input, int wordCount) { String[] words = input.split(" "); if(words.length < wordCount) return input; String result = ""; for (int i = 0; i < wordCount; i++){ result += words[i] + " "; } return result; }

Target:
private String getStripped(String input, int wordCount) { String[] words = input.split(" "); if(words.length < wordCount) return input; StringBuilder result = new StringBuilder(); for (int i = 0; i < wordCount; i++){ result.append(words[i]); result.append(" "); } return result.toString(); }
Source:
public static <T> Class<? extends T> defineClass(ClassDefinition classDefinition, Class<T> superType, Map<Long, MethodHandle> callSiteBindings, ClassLoader parentClassLoader) { try { return defineClass(classDefinition, superType, new DynamicClassLoader(parentClassLoader, callSiteBindings)); } catch (ByteCodeTooLargeException byteCodeTooLargeException) { throw new PrestoException(GENERATED_BYTECODE_TOO_LARGE, ERROR_LARGE_BYTECODE); } }

Target:
public static <T> Class<? extends T> defineClass(ClassDefinition classDefinition, Class<T> superType, Map<Long, MethodHandle> callSiteBindings, ClassLoader parentClassLoader) { return defineClass(classDefinition, superType, new DynamicClassLoader(parentClassLoader, callSiteBindings)); }
Source:
public boolean lastDismissedReminderMoreThan24hAgo() { long now = System.currentTimeMillis(); long lastReminder = prefs.getLong(PREFS_KEY_BACKUP_SEED_LAST_DISMISSED_REMINDER, now); return now - lastReminder > 86400000; }

Target:
public boolean lastDismissedReminderMoreThan24hAgo() { long now = System.currentTimeMillis(); long lastReminder = prefs.getLong(PREFS_KEY_BACKUP_SEED_LAST_DISMISSED_REMINDER, now); return now - lastReminder > TimeUnit.HOURS.toMillis(24); }
Source:
public void testNullPathWithRoot() { AbsolutePathResolver apr = new AbsolutePathResolver(null); assertThat(apr.getPath("USER_DIRECTORY"), nullValue()); }

Target:
public void testNullPathWithRoot() { AbsolutePathResolver apr = new AbsolutePathResolver(null); assertThat(apr.getPath(USER_DIRECTORY), nullValue()); }
Source:
public void checkAndSetupStreamsDrawer() { try { if (streamsDrawer.getAdapter().getCount() != 0) return; setupListViewAdapter(); } catch (NullPointerException npe) { setupListViewAdapter(); } }

Target:
public void checkAndSetupStreamsDrawer() { try { if (streamsDrawer.getAdapter().getCount() != 0) { return; } setupListViewAdapter(); } catch (NullPointerException npe) { setupListViewAdapter(); } }
Source:
private void updateSnapshotConfigWithoutImage(Guid imageGroupToRemove) { List<DiskImage> snapshotDisks = getDiskImageDao().getAllSnapshotsForImageGroup(imageGroupToRemove); for (DiskImage snapshotDisk : snapshotDisks) { NGuid vmSnapshotId = snapshotDisk.getvm_snapshot_id(); if (vmSnapshotId != null && !Guid.Empty.equals(vmSnapshotId.getValue())) { try { lockSnapshotWithWait(vmSnapshotId.getValue()); final Snapshot updated = prepareSnapshotConfigWithoutImageSingleImage(vmSnapshotId.getValue(), snapshotDisk.getImageId()); if (updated != null) { TransactionSupport.executeInScope(TransactionScopeOption.RequiresNew, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getSnapshotDao().update(updated); return null; } }); } } finally { freeSnapshotLock(); } } } }

Target:
private void updateSnapshotConfigWithoutImage(Guid imageGroupToRemove) { List<DiskImage> snapshotDisks = getDiskImageDao().getAllSnapshotsForImageGroup(imageGroupToRemove); Collections.shuffle(snapshotDisks); for (DiskImage snapshotDisk : snapshotDisks) { NGuid vmSnapshotId = snapshotDisk.getvm_snapshot_id(); if (vmSnapshotId != null && !Guid.Empty.equals(vmSnapshotId.getValue())) { try { lockSnapshotWithWait(vmSnapshotId.getValue()); final Snapshot updated = prepareSnapshotConfigWithoutImageSingleImage(vmSnapshotId.getValue(), snapshotDisk.getImageId()); if (updated != null) { TransactionSupport.executeInScope(TransactionScopeOption.RequiresNew, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getSnapshotDao().update(updated); return null; } }); } } finally { freeSnapshotLock(); } } } }
Source:
public void downloadBlob(BlobId blobId, OutputStream outputStream) throws CloudStorageException { azureMetrics.blobDownloadRequestCount.inc(); Timer.Context storageTimer = azureMetrics.blobDownloadTime.time(); try { CloudBlobContainer azureContainer = getContainer(blobId, false); String azureBlobName = getAzureBlobName(blobId); CloudBlockBlob azureBlob = azureContainer.getBlockBlobReference(azureBlobName); azureBlob.download(outputStream); azureMetrics.blobUploadSuccessCount.inc(); } catch (URISyntaxException | StorageException e) { throw new CloudStorageException("Error donwloading blob " + blobId, e); } finally { storageTimer.stop(); } }

Target:
public void downloadBlob(BlobId blobId, OutputStream outputStream) throws CloudStorageException { azureMetrics.blobDownloadRequestCount.inc(); Timer.Context storageTimer = azureMetrics.blobDownloadTime.time(); try { CloudBlockBlob azureBlob = getAzureBlobReference(blobId); azureBlob.download(outputStream); azureMetrics.blobDownloadSuccessCount.inc(); } catch (URISyntaxException | StorageException e) { azureMetrics.blobDownloadErrorCount.inc(); throw new CloudStorageException("Error downloading blob " + blobId, e); } finally { storageTimer.stop(); } }
Source:
public void estimateVoterMatchStrengths_for_DocOrgRelationMatcher() throws IOException { createInputDataFromJsonFiles( ImmutableList.of("src/test/resources/experimentalData/input/all_organizations.json"), ImmutableList.of("src/test/resources/experimentalData/input/set4/docs_with_aff_real_data.json"), ImmutableList.of("src/test/resources/experimentalData/input/set4/doc_project.json"), ImmutableList.of(), ImmutableList.of("src/test/resources/experimentalData/input/set4/org_project.json")); AffOrgMatcher affOrgMatcher = createDocOrgRelationMatcher(sparkContext, inputDocProjDirPath, inputInferredDocProjDirPath, inputProjOrgDirPath, inputDocProjConfidenceThreshold); List<AffOrgMatchVoter> voters = createDocOrgRelationMatcherVoters(); estimateVoterMatchStrengths(affOrgMatcher, "Doc-Org Relation Matcher", voters, ImmutableList.of("src/test/resources/experimentalData/expectedOutput/set4/matched_aff.json")); }

Target:
public void estimateVoterMatchStrengths_for_DocOrgRelationMatcher() throws IOException { createInputDataFromJsonFiles( ImmutableList.of(INPUT_DATA_DIR_PATH + "/all_organizations.json"), ImmutableList.of(INPUT_DATA_DIR_PATH + "/set4/docs_with_aff_real_data.json"), ImmutableList.of(INPUT_DATA_DIR_PATH + "/set4/doc_project.json"), ImmutableList.of(), ImmutableList.of(INPUT_DATA_DIR_PATH + "/set4/org_project.json")); AffOrgMatcher affOrgMatcher = createDocOrgRelationMatcher(sparkContext, inputDocProjDirPath, inputInferredDocProjDirPath, inputProjOrgDirPath, inputDocProjConfidenceThreshold); List<AffOrgMatchVoter> voters = createDocOrgRelationMatcherVoters(); estimateVoterMatchStrengths(affOrgMatcher, "Doc-Org Relation Matcher", voters, ImmutableList.of("src/test/resources/experimentalData/expectedOutput/set4/matched_aff.json")); }
Source:
public final String getFileStem() { return Pattern .create("/((?:[^/]|\\\\/)+?)\\.rstheme$") .match(getUrl(), 0) .getGroup(1); }

Target:
public final String getFileStem() { return FileSystemItem.createFile(this.getUrl()).getStem(); }
Source:
public String showForm(@RequestParam(required = false, value = "userId") Integer userId, @RequestParam(required = false, value = "createNewPerson") String createNewPerson, @ModelAttribute("user") User user, ModelMap model) { model.addAttribute("isNewUser", isNewUser(user)); if (isNewUser(user) || Context.hasPrivilege(PrivilegeConstants.EDIT_USER_PASSWORDS)) { model.addAttribute("modifyPasswords", true); } if (createNewPerson != null) { model.addAttribute("createNewPerson", createNewPerson); } if (!isNewUser(user)) { model.addAttribute("changePassword", new UserProperties(user.getUserProperties()).isSupposedToChangePassword()); model.addAttribute("secretQuestion", userService.getSecretQuestion(user)); } Collection<Provider> col = Context.getProviderService().getProvidersByPerson(user.getPerson()); System.out.println(Context.getProviderService().getProvidersByPerson(user.getPerson()).isEmpty()); if (user.getPerson().getId() != null && !Context.getProviderService().getProvidersByPerson(user.getPerson()).isEmpty()) { model.addAttribute("isProvider", true); } else { model.addAttribute("isProvider", false); } return "module/legacyui/admin/users/userForm"; }

Target:
public String showForm( @RequestParam(required = false, value = "userId") Integer userId, @RequestParam(required = false, value = "createNewPerson") String createNewPerson, @ModelAttribute("user") User user, ModelMap model) { model.addAttribute("isNewUser", isNewUser(user)); if (isNewUser(user) || Context.hasPrivilege(PrivilegeConstants.EDIT_USER_PASSWORDS)) { model.addAttribute("modifyPasswords", true); } if (createNewPerson != null) { model.addAttribute("createNewPerson", createNewPerson); } if (!isNewUser(user)) { model.addAttribute("changePassword", new UserProperties(user.getUserProperties()).isSupposedToChangePassword()); model.addAttribute("secretQuestion", userService.getSecretQuestion(user)); } if (user.getPerson().getId() != null && !Context.getProviderService().getProvidersByPerson(user.getPerson()).isEmpty()) { model.addAttribute("isProvider", true); model.addAttribute("providerList", Context.getProviderService().getProvidersByPerson(user.getPerson())); } else { model.addAttribute("isProvider", false); } return "module/legacyui/admin/users/userForm"; }
Source:
public void testLeaderInConnectingFollowers() throws Exception { File tmpDir = File.createTempFile("test", "dir", testData); tmpDir.delete(); tmpDir.mkdir(); Leader leader = null; try { QuorumPeer peer = ZabUtils.createQuorumPeer(tmpDir); leader = ZabUtils.createLeader(tmpDir, peer); peer.leader = leader; peer.setAcceptedEpoch(5); FollowerMockThread f1 = new FollowerMockThread(1, leader, true); FollowerMockThread f2 = new FollowerMockThread(2, leader, true); f1.start(); f2.start(); f1.join(leader.self.getInitLimit()*leader.self.getTickTime() + 5000); f2.join(leader.self.getInitLimit()*leader.self.getTickTime() + 5000); try { long epoch = leader.getEpochToPropose(leader.self.getId(), leader.self.getAcceptedEpoch()); Assert.assertEquals("leader got wrong epoch from getEpochToPropose", 6, epoch); } catch (Exception e){ Assert.fail("leader timed out in getEpochToPropose"); } } finally { if (leader != null) { leader.shutdown("end of test"); } recursiveDelete(tmpDir); } }

Target:
public void testLeaderInConnectingFollowers() throws Exception { File tmpDir = File.createTempFile("test", "dir", testData); tmpDir.delete(); tmpDir.mkdir(); Leader leader = null; try { QuorumPeer peer = createQuorumPeer(tmpDir); leader = createLeader(tmpDir, peer); peer.leader = leader; peer.setAcceptedEpoch(5); FollowerMockThread f1 = new FollowerMockThread(1, leader, true); FollowerMockThread f2 = new FollowerMockThread(2, leader, true); f1.start(); f2.start(); f1.join(leader.self.getInitLimit()*leader.self.getTickTime() + 5000); f2.join(leader.self.getInitLimit()*leader.self.getTickTime() + 5000); try { long epoch = leader.getEpochToPropose(leader.self.getId(), leader.self.getAcceptedEpoch()); Assert.assertEquals("leader got wrong epoch from getEpochToPropose", 6, epoch); } catch (Exception e){ Assert.fail("leader timed out in getEpochToPropose"); } } finally { if (leader != null) { leader.shutdown("end of test"); } recursiveDelete(tmpDir); } }
Source:
public void destroy() { this.gatewayMap.values().forEach(gw -> gw.destroy()); }

Target:
public void destroy() { this.gatewayMap.values().forEach(MethodInvocationGateway::destroy); }
Source:
public static void buildFixtureIndices(SQLiteDatabase database, String tableName, Set<String> indices) { try { database.beginTransaction(); for (String index : indices) { String indexName = index + "_index"; if (index.contains(",")) { indexName = index.replaceAll(",", "_") + "_index"; } String indexStmt = DatabaseAppOpenHelper.indexOnTableCommand(indexName, tableName, index); database.execSQL(indexStmt); } database.setTransactionSuccessful(); } finally { database.endTransaction(); } }

Target:
public static void buildFixtureIndices(SQLiteDatabase database, String tableName, Set<String> indices) { try { database.beginTransaction(); for (String indexStmt : DatabaseIndexingUtils.getIndexStatements(tableName, indices)) { database.execSQL(indexStmt); } database.setTransactionSuccessful(); } finally { database.endTransaction(); } }
Source:
public TestConfiguration(final WebApplicationContext context, final HttpSession httpSession) throws Exception { Assert.requireNonNull(context, "context"); Assert.requireNonNull(httpSession, "httpSession"); DefaultPlatformConfiguration defaultPlatformConfiguration = ConfigurationFileLoader.loadConfiguration(); RemotingConfiguration remotingConfiguration = new RemotingConfiguration(defaultPlatformConfiguration); final ExecutorService clientExecutor = Executors.newSingleThreadExecutor(); final ClientSessionStoreImpl clientSessionStore = new ClientSessionStoreImpl(); final Function<ClientModelStore, AbstractClientConnector> connectorProvider = s -> new DolphinTestClientConnector(s, clientExecutor, c -> sendToServer(c)); clientContext = new TestClientContextImpl(PlatformClient.getClientConfiguration(), new URI("http://dummy"), connectorProvider, clientSessionStore); final ControllerRepository controllerRepository = new ControllerRepository(new DefaultClasspathScanner(defaultPlatformConfiguration.getListProperty(ROOT_PACKAGE_FOR_CLASSPATH_SCAN))); final TestSpringManagedBeanFactory containerManager = new TestSpringManagedBeanFactory(context); containerManager.init(context.getServletContext()); final DolphinContextProviderMock dolphinContextProviderMock = new DolphinContextProviderMock(); dolphinTestContext = new TestDolphinContext(remotingConfiguration, new HttpClientSessionImpl(httpSession), dolphinContextProviderMock, containerManager, controllerRepository, createEmptyCallback()); dolphinContextProviderMock.setCurrentContext(dolphinTestContext); }

Target:
public TestConfiguration(final WebApplicationContext context, final HttpSession httpSession) throws Exception { Assert.requireNonNull(context, "context"); Assert.requireNonNull(httpSession, "httpSession"); final DefaultPlatformConfiguration defaultPlatformConfiguration = ConfigurationFileLoader.loadConfiguration(); final RemotingConfiguration remotingConfiguration = new RemotingConfiguration(defaultPlatformConfiguration); final ExecutorService clientExecutor = Executors.newSingleThreadExecutor(); final ClientSessionStoreImpl clientSessionStore = new ClientSessionStoreImpl(); final Function<ClientModelStore, AbstractClientConnector> connectorProvider = s -> new DolphinTestClientConnector(s, clientExecutor, c -> sendToServer(c)); clientContext = new TestClientContextImpl(PlatformClient.getClientConfiguration(), new URI("http://dummy"), connectorProvider, clientSessionStore); final ControllerRepository controllerRepository = new ControllerRepository(new DefaultClasspathScanner(defaultPlatformConfiguration.getListProperty(ROOT_PACKAGE_FOR_CLASSPATH_SCAN))); final TestSpringManagedBeanFactory containerManager = new TestSpringManagedBeanFactory(context); containerManager.init(context.getServletContext()); final DolphinContextProviderMock dolphinContextProviderMock = new DolphinContextProviderMock(); dolphinTestContext = new TestDolphinContext(remotingConfiguration, new HttpClientSessionImpl(httpSession), dolphinContextProviderMock, containerManager, controllerRepository, createEmptyCallback()); dolphinContextProviderMock.setCurrentContext(dolphinTestContext); }
Source:
public ArchaiusModule withApplicationOverrides(Config config) { try { applicationLayer.addConfig(getUniqueName("override-"), config); } catch (ConfigException e) { throw new ProvisionException("Failed to add application overrides" , e); } return this; }

Target:
public ArchaiusModule withApplicationOverrides(Config config) { try { applicationLayer.addConfig(getUniqueName("override"), config); } catch (ConfigException e) { throw new ProvisionException("Failed to add application overrides" , e); } return this; }
Source:
public boolean retainAll(final Collection<?> c) { if (size < 1) { return false; } final IdentityHashMap<Object, Object> toKeep = new IdentityHashMap<Object, Object>(); for (Object o : c) { if (indexOf(o) > 0) { toKeep.put(o, o); } } if (toKeep.size() == size) { return false; } for (int i = 0; i < size; i++) { if(!toKeep.containsKey(get(i))) { remove(i); } } return true; }

Target:
public boolean retainAll(final Collection<?> c) { if (size < 1) { return false; } final Map<Object,Object> toRetain = new IdentityHashMap<Object,Object>(); for (Object o : c) { toRetain.put(o, null); } final List<IonValue> toRemove = new ArrayList<IonValue>(size - c.size()); for (int i = 0; i < size; i++) { final IonValue ionValue = get(i); if (!toRetain.containsKey(ionValue)) { toRemove.add(ionValue); } } return removeAll(toRemove); }
Source:
public static UnixResolverOptions.Builder newBuilder() { return new UnixResolverOptions.Builder(); }

Target:
static UnixResolverOptions.Builder newBuilder() { return new UnixResolverOptions.Builder(); }
Source:
private long updateWaterMark(int reqNewLowWater, int reqNewHighWater) { assert reqNewLowWater != -1 || reqNewHighWater != -1; assert reqNewLowWater == -1 || reqNewHighWater == -1 || reqNewLowWater <= reqNewHighWater; long oldVal, newVal; int oldHighWater, oldLowWater; int newLowWater, newHighWater; do { oldVal = connectionStatus; oldLowWater = getLowWater(oldVal); oldHighWater = getHighWater(oldVal); newLowWater = reqNewLowWater == -1 ? oldLowWater : reqNewLowWater; newHighWater = reqNewHighWater == -1 ? oldHighWater : reqNewHighWater; if (reqNewLowWater != -1 && newLowWater > newHighWater) { newHighWater = newLowWater; } else if (reqNewHighWater != -1 && newHighWater < newLowWater) { newLowWater = newHighWater; } if (oldLowWater == newLowWater && oldHighWater == newHighWater) { return oldVal; } newVal = (long)newLowWater << CONN_LOW_BIT | (long)newHighWater << CONN_HIGH_BIT; } while (! connectionStatusUpdater.compareAndSet(this, oldVal, newVal)); getIoThread().execute(new Runnable() { @Override public void run() { if(openConnections >= getHighWater(connectionStatus)) { synchronized (QueuedNioTcpServer.this) { suspendedDueToWatermark = true; } } else if(suspendedDueToWatermark && openConnections <= getLowWater(connectionStatus)) { synchronized (QueuedNioTcpServer.this) { suspendedDueToWatermark = false; } } } }); return oldVal; }

Target:
private long updateWaterMark(int reqNewLowWater, int reqNewHighWater) { assert reqNewLowWater != -1 || reqNewHighWater != -1; assert reqNewLowWater == -1 || reqNewHighWater == -1 || reqNewLowWater <= reqNewHighWater; long oldVal, newVal; int oldHighWater, oldLowWater; int newLowWater, newHighWater; do { oldVal = connectionStatus; oldLowWater = getLowWater(oldVal); oldHighWater = getHighWater(oldVal); newLowWater = reqNewLowWater == -1 ? oldLowWater : reqNewLowWater; newHighWater = reqNewHighWater == -1 ? oldHighWater : reqNewHighWater; if (reqNewLowWater != -1 && newLowWater > newHighWater) { newHighWater = newLowWater; } else if (reqNewHighWater != -1 && newHighWater < newLowWater) { newLowWater = newHighWater; } if (oldLowWater == newLowWater && oldHighWater == newHighWater) { return oldVal; } newVal = (long)newLowWater << CONN_LOW_BIT | (long)newHighWater << CONN_HIGH_BIT; } while (! connectionStatusUpdater.compareAndSet(this, oldVal, newVal)); getIoThread().execute(new Runnable() { @Override public void run() { if(openConnections >= getHighWater(connectionStatus)) { synchronized (QueuedNioTcpServer.this) { suspendedDueToWatermark = true; tcpServerLog.logf(FQCN, Logger.Level.DEBUG, null, "Total open connections reach high water limit (%s) after updating water mark", getHighWater(connectionStatus)); } } else if(suspendedDueToWatermark && openConnections <= getLowWater(connectionStatus)) { suspendedDueToWatermark = false; } } }); return oldVal; }
Source:
@Override public void onConfigurationOpen( HadoopConfiguration hadoopConfiguration, boolean defaultConfiguration ) { try { shimBridgingServiceTracker.registerWithClassloader( hadoopConfiguration, NamedClusterServiceFactory.class, SHIMCONFIG_SERVICE_FACTORY_CANONICAL_NAME, bundleContext, hadoopConfiguration.getHadoopShim().getClass().getClassLoader(), new Class<?>[] { boolean.class, HadoopConfiguration.class }, new Object[] { defaultConfiguration, hadoopConfiguration } ); } catch ( Exception e ) { LOGGER.error( "Unable to register " + hadoopConfiguration.getIdentifier() + " shim", e ); } }

Target:
@Override public void onConfigurationOpen( HadoopConfiguration hadoopConfiguration, boolean defaultConfiguration ) { try { shimBridgingServiceTracker.registerWithClassloader( hadoopConfiguration, NamedClusterServiceFactory.class, SHIMCONFIG_SERVICE_FACTORY_CANONICAL_NAME, bundleContext, hadoopConfiguration.getHadoopShim().getClass().getClassLoader(), new Class<?>[] { boolean.class, HadoopConfiguration.class }, new Object[] { defaultConfiguration, hadoopConfiguration } ); } catch ( Exception e ) { LOGGER.error( BaseMessages.getString( JaasConfigServiceLoader.class, "jaas.config.service.load.error", hadoopConfiguration.getIdentifier() ) ); } }
Source:
public void testV2FetchWantRefIfNotAllowed() throws Exception { RevCommit one = remote.commit().message("1").create(); remote.update("one", one); thrown.expect(PackProtocolException.class); thrown.expectMessage("unexpected want-ref refs/heads/one"); uploadPackV2( "command=fetch\n", PacketLineIn.DELIM, "want-ref refs/heads/one\n", "done\n", PacketLineIn.END); }

Target:
public void testV2FetchWantRefIfNotAllowed() throws Exception { RevCommit one = remote.commit().message("1").create(); remote.update("one", one); try { uploadPackV2( "command=fetch\n", PacketLineIn.DELIM, "want-ref refs/heads/one\n", "done\n", PacketLineIn.END); } catch (PackProtocolException e) { assertThat( e.getMessage(), containsString("unexpected want-ref refs/heads/one")); return; } fail("expected PackProtocolException"); }
Source:
private static String resolvePathParameters(final String basePath, final String classPathAnnotation, final String methodPathAnnotation, final Map<String, Object> pathParameterValues) { final UriBuilder builder = UriBuilder.fromUri(basePath); if (classPathAnnotation != null && !classPathAnnotation.equals("")) { builder.path(classPathAnnotation); } if (methodPathAnnotation != null && !methodPathAnnotation.equals("")) { builder.path(methodPathAnnotation); } String returnUri = null; Map<String, Object> parameters = pathParameterValues; if (parameters == null) { parameters = new HashMap<>(); } final URI resolvedUri = builder.buildFromMap(parameters); if (resolvedUri != null) { returnUri = resolvedUri.toString(); } log.warn("Could not build a path URI for basePath={}", basePath); return returnUri; }

Target:
private static String resolvePathParameters(final String basePath, final String classPathAnnotation, final String methodPathAnnotation, final Map<String, Object> pathParameterValues) { final UriBuilder builder = UriBuilder.fromUri(basePath); if (classPathAnnotation != null && !classPathAnnotation.equals("")) { builder.path(classPathAnnotation); } if (methodPathAnnotation != null && !methodPathAnnotation.equals("")) { builder.path(methodPathAnnotation); } final URI resolvedUri = builder.buildFromMap(pathParameterValues); if (resolvedUri != null) { return resolvedUri.toString(); } log.warn("Could not build a path URI for basePath={} and path annotations (class='{}',method='{}')", basePath, classPathAnnotation, methodPathAnnotation ); return null; }
Source:
public void testNonSerializableParentConstructor() throws Exception { final MarshallerFactory factory = new RiverMarshallerFactory(); final MarshallingConfiguration configuration = new MarshallingConfiguration(); final Marshaller marshaller = factory.createMarshaller(configuration); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); marshaller.start(Marshalling.createByteOutput(baos)); final MySerializable input = new MySerializable("test"); assertTrue("Sanity check failed", input.is_mutable_one()); marshaller.writeObject(input); marshaller.finish(); final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); final Unmarshaller unmarshaller = factory.createUnmarshaller(configuration); unmarshaller.start(Marshalling.createByteInput(bais)); final MySerializable result = unmarshaller.readObject(MySerializable.class); assertTrue("JBMAR-221: NonSerializableParent constructor was not executed", result.is_mutable_one()); unmarshaller.finish(); }

Target:
public void testNonSerializableParentConstructor() throws Throwable { runReadWriteTest(new ReadWriteTest() { @Override public void runWrite(Marshaller marshaller) throws Throwable { final MySerializable input = new MySerializable("test"); assertTrue("Sanity check failed", input.is_mutable_one()); marshaller.writeObject(input); } @Override public void runRead(Unmarshaller unmarshaller) throws Throwable { final MySerializable result = unmarshaller.readObject(MySerializable.class); assertTrue("JBMAR-221: NonSerializableParent constructor was not executed", result.is_mutable_one()); } }); }
Source:
public static void createJob() throws IOException { String projectId = "your-project-id"; String tenantId = "your-tenant-id"; String companyId = "your-company-id"; String requisitionId = "your-unique-req-id"; String title = "your-job-title"; String description = "your-job-description"; String jobApplicationUrl = "your-job-url"; String addressOne = "your-job-address-1"; String addressTwo = "your-job-address-2"; String languageCode = "your-lang-code"; createJob( projectId, tenantId, companyId, requisitionId, title, description, jobApplicationUrl, addressOne, addressTwo, languageCode); }

Target:
public static void createJob() throws IOException { String projectId = "your-project-id"; String tenantId = "your-tenant-id"; String companyId = "your-company-id"; String requisitionId = "your-unique-req-id"; String jobApplicationUrl = "your-job-url"; createJob(projectId, tenantId, companyId, requisitionId, jobApplicationUrl); }
Source:
public void updateCallback(Map<String, Object> properties) { synchronized (lock) { if (properties != null) { setMonitoredDirectoryPath((String) properties.get("monitoredDirectoryPath")); setProcessingMechanism((String) properties.get("processingMechanism")); setNumThreads((Integer) properties.get("numThreads")); setReadLockIntervalMilliseconds((Integer) properties.get("readLockIntervalMilliseconds")); String[] parameterArray = (String[]) properties.get(Constants.ATTRIBUTE_OVERRIDES_KEY); if (parameterArray != null) { setAttributeOverrides(Arrays.asList(parameterArray)); } destroy(0); destroyed.set(false); init(); } } }

Target:
public void updateCallback(Map<String, Object> properties) { if (properties != null) { setMonitoredDirectoryPath((String) properties.get("monitoredDirectoryPath")); setProcessingMechanism((String) properties.get("processingMechanism")); setNumThreads((Integer) properties.get("numThreads")); setReadLockIntervalMilliseconds((Integer) properties.get("readLockIntervalMilliseconds")); String[] parameterArray = (String[]) properties.get(Constants.ATTRIBUTE_OVERRIDES_KEY); if (parameterArray != null) { setAttributeOverrides(Arrays.asList(parameterArray)); } destroy(0); init(); } }
Source:
private Object[] getTagsChildren(TagsNode parentNode, Repository repo) { List<RepositoryTreeNode<?>> nodes = new ArrayList<>(); try (RevWalk walk = new RevWalk(repo)) { walk.setRetainBody(true); String filterText = filters != null ? filters.get(parentNode) : null; NodesByCommitTimeFilter timeFilter = new NodesByCommitTimeFilter( filterText); Matcher nameFilter = matcher(filterText); for (Ref tagRef : getRefs(repo, Constants.R_TAGS).values()) { if (!timeFilter.isFilterActive() && !nameFilter .matches(Repository.shortenRefName(tagRef.getName()))) { continue; } ObjectId objectId = tagRef.getLeaf().getObjectId(); RevObject revObject = walk.parseAny(objectId); RevObject peeledObject = walk.peel(revObject); TagNode tagNode = createTagNode(parentNode, repo, tagRef, revObject, peeledObject); timeFilter.addNode(tagNode, peeledObject); } nodes.addAll(timeFilter.getFilteredFilteredNodes()); } catch (IOException e) { return handleException(e, parentNode); } return nodes.toArray(); }

Target:
private Object[] getTagsChildren(TagsNode parentNode, Repository repo) { List<RepositoryTreeNode<?>> nodes = new ArrayList<>(); try (RevWalk walk = new RevWalk(repo)) { walk.setRetainBody(true); String filterText = filters != null ? filters.get(parentNode) : null; NodesByCommitTimeFilter timeFilter = new NodesByCommitTimeFilter( filterText); Matcher nameFilter = matcher(filterText); for (Ref tagRef : getRefs(repo, Constants.R_TAGS).values()) { if (!timeFilter.isFilterActive() && !nameFilter .matches(Repository.shortenRefName(tagRef.getName()))) { continue; } ObjectId objectId = tagRef.getLeaf().getObjectId(); RevObject revObject = walk.parseAny(objectId); RevObject peeledObject = walk.peel(revObject); TagNode tagNode = createTagNode(parentNode, repo, tagRef, revObject, peeledObject); timeFilter.addNode(tagNode, peeledObject); } nodes.addAll(timeFilter.getFilteredNodes()); } catch (IOException e) { return handleException(e, parentNode); } return nodes.toArray(); }
Source:
public String getTitle(){ if(map.get("title") !=null){ return map.get("title").toString(); } try { String x = null; if (!(this.getContentType() instanceof WidgetContentType)){ ContentletAPI conAPI = APILocator.getContentletAPI(); x = conAPI.getName(this, APILocator.getUserAPI().getSystemUser(), false); map.put("title", x); } return x; } catch (Exception e) { Logger.error(this,"Unable to get title."); return ""; } }

Target:
public String getTitle(){ try { Optional<com.dotcms.contenttype.model.field.Field> fieldFound = this.getContentType().fields().stream(). filter(field -> field.variable().equals("title")).findAny(); if (!fieldFound.isPresent()) { return map.get("title")!=null?map.get("title").toString():null; } ContentletAPI conAPI = APILocator.getContentletAPI(); String title = conAPI.getName(this, APILocator.getUserAPI().getSystemUser(), false); map.put("title", title); return title; } catch (Exception e) { Logger.error(this,"Unable to get title."); return ""; } }
Source:
public static void moveFile(String source, String dest) throws IOException { try { Files.move(Paths.get(source), Paths.get(dest)); } catch (IOException e) { String errorMessage = "Error while moving file from" + source + "to" + dest; throw new IOException(errorMessage, e); } }

Target:
public static void moveFile(String source, String dest) throws APIManagementException { try { Files.move(Paths.get(source), Paths.get(dest)); } catch (IOException e) { String errorMessage = "Error while moving file from" + source + "to" + dest; throw new APIManagementException(errorMessage, e); } }