auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static List<Ignite> allGrids() { List<Ignite> res = IgnitionEx.allGrids(); if (res == null || res.isEmpty()) return res; Ignite ignite = res.get(0); if (ignite instanceof IgniteEx && insideSandbox()) return res.stream().map((i) -> sandboxIgniteProxy(i, false)).collect(Collectors.toList()); return res; }

Target:
public static List<Ignite> allGrids() { List<Ignite> res = IgnitionEx.allGrids(); if (F.isEmpty(res)) return res; if (isInsideSandbox()) return res.stream().map(Ignition::wrapToProxy).collect(Collectors.toList()); return res; }
Source:
public void init() { check = () -> { try { kuid = randomUUID().toString(); client = KurentoClient.create(kurentoWsUrl, new KConnectionListener(kuid)); client.getServerManager().addObjectCreatedListener(new KWatchDogCreate()); client.getServerManager().addObjectDestroyedListener(new KWatchDogDestroy()); } catch (Exception e) { log.warn("Fail to create Kurento client, will re-try in ms", checkTimeout); kmsRecheckScheduler.schedule(check, checkTimeout, MILLISECONDS); } }; check.run(); }

Target:
public void init() { check = () -> { try { kuid = randomUUID().toString(); client = KurentoClient.create(kurentoWsUrl, new KConnectionListener(kuid)); client.getServerManager().addObjectCreatedListener(new KWatchDogCreate()); client.getServerManager().addObjectDestroyedListener(new EventListener<>() { @Override public void onEvent(ObjectDestroyedEvent event) { log.debug("Kurento::ObjectDestroyedEvent objectId {}, tags {}, source {}", event.getObjectId(), event.getTags(), event.getSource()); } }); } catch (Exception e) { log.warn("Fail to create Kurento client, will re-try in ms", checkTimeout); kmsRecheckScheduler.schedule(check, checkTimeout, MILLISECONDS); } }; check.run(); }
Source:
public synchronized boolean put(String key, String value) { SQLiteDatabase db = this.getWritableDatabase(); try { db.execSQL("INSERT OR REPLACE INTO " + TABLE_NAME + " (" + COL_KEY + ", " + COL_VALUE + ") " + " VALUES('" + key + "', '" + value + "')"); } catch (SQLException ignored) { return false; } finally { db.close(); } return true; }

Target:
public synchronized boolean put(String key, String value) { SQLiteDatabase db = this.getWritableDatabase(); try { db.execSQL("INSERT OR REPLACE INTO " + TABLE_NAME + " (" + COL_KEY + ", " + COL_VALUE + ") " + " VALUES('" + key + "', '" + value + "')"); } catch (Exception ignored) { return false; } finally { db.close(); } return true; }
Source:
public void start() { ScriptEngine engine = orcsApi.getScriptEngine(); resources.add(new OrcsScriptResource(engine)); classes.add(BranchesResource.class); resources.add(new IdeClientEndpointImpl()); resources.add(new BranchEndpointImpl(orcsApi, resourceManager, activityLog)); resources.add(new OrcsWriterEndpointImpl(orcsApi)); resources.add(new TransactionEndpointImpl(orcsApi)); resources.add(new TypesEndpointImpl(orcsApi)); resources.add(new IndexerEndpointImpl(orcsApi)); resources.add(new ResourcesEndpointImpl(resourceManager)); resources.add(new DatastoreEndpointImpl(orcsApi, activityLog)); resources.add(new LinkUpdateResource(orcsApi)); }

Target:
public void start() { ScriptEngine engine = orcsApi.getScriptEngine(); resources.add(new OrcsScriptResource(engine)); classes.add(BranchesResource.class); resources.add(new IdeClientEndpointImpl()); resources.add(new BranchEndpointImpl(orcsApi, resourceManager, activityLog)); resources.add(new OrcsWriterEndpointImpl(orcsApi)); resources.add(new TransactionEndpointImpl(orcsApi)); resources.add(new TypesEndpointImpl(orcsApi)); resources.add(new IndexerEndpointImpl(orcsApi)); resources.add(new ResourcesEndpointImpl(resourceManager)); resources.add(new DatastoreEndpointImpl(orcsApi, activityLog)); resources.add(new KeyValueResource(orcsApi)); resources.add(new LinkUpdateResource(orcsApi)); }
Source:
public void onUpgradeAlreadyOccurred() { final int oldVersion = DatabaseHelper.DATABASE_VERSION; final int newVersion = DatabaseHelper.DATABASE_VERSION; final TableDefaultsCustomizer customizer = mock(TableDefaultsCustomizer.class); mDistanceTable.onUpgrade(mSQLiteDatabase, oldVersion, newVersion, customizer); verify(mSQLiteDatabase, atLeast(0)).execSQL(mSqlCaptor.capture()); verifyZeroInteractions(customizer); }

Target:
public void onUpgradeAlreadyOccurred() { final int oldVersion = DatabaseHelper.DATABASE_VERSION; final int newVersion = DatabaseHelper.DATABASE_VERSION; final TableDefaultsCustomizer customizer = mock(TableDefaultsCustomizer.class); mDistanceTable.onUpgrade(mSQLiteDatabase, oldVersion, newVersion, customizer); verify(mSQLiteDatabase, never()).execSQL(mSqlCaptor.capture()); verifyZeroInteractions(customizer); }
Source:
private GlusterVolumeTaskStatusEntity fetchRemobeBricksStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRemoveBricksStatus, new GlusterVolumeRemoveBricksVDSParameters(getUpServerId(clusterId), volume.getName(), getParameters().getBricks(), volume.getReplicaCount())); GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue(); GlusterAsyncTask asyncTask = volume.getAsyncTask(); if (asyncTask != null) { Guid taskId = asyncTask.getTaskId(); if (taskId != null) { List<Step> stepsList = getStepDao().getStepsByExternalId(taskId); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } } } return entity; }

Target:
private GlusterVolumeTaskStatusEntity fetchRemobeBricksStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRemoveBricksStatus, new GlusterVolumeRemoveBricksVDSParameters(getUpServerId(clusterId), volume.getName(), getParameters().getBricks(), volume.getReplicaCount())); GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) returnValue.getReturnValue(); GlusterAsyncTask asyncTask = volume.getAsyncTask(); if (asyncTask != null && asyncTask.getTaskId() != null) { List<Step> stepsList = getStepDao().getStepsByExternalId(asyncTask.getTaskId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } } return entity; }
Source:
protected void dropAllDatabaseObjects() throws SQLException { Statement statement = null; try { statement = connection.createStatement(); String query = "DROP ALL OBJECTS"; statement.execute(query); } catch (JdbcSQLNonTransientException e) { log.info("connection is already closed, most likely a test method already dropped all database objects"); } finally { connection.close(); } }

Target:
protected void dropAllDatabaseObjects() throws SQLException { Statement statement = null; try { statement = connection.createStatement(); String query = "DROP ALL OBJECTS"; statement.execute(query); } catch (JdbcSQLNonTransientException e) { log.error("connection is already closed, most likely a test method already dropped all database objects"); } finally { connection.close(); } }
Source:
void testResourceCreateFailure() { server.expect().post().withPath("/api/v1/namespaces/test/pods").andReturn(HttpURLConnection.HTTP_BAD_REQUEST, new PodBuilder() .withNewMetadata().withResourceVersion("12345").endMetadata().build()).once(); KubernetesClient client = server.getClient(); assertThrows(KubernetesClientException.class, () -> client.resource(new PodBuilder().withNewMetadata().withName("pod123").endMetadata().build()).createOrReplace()); }

Target:
void testResourceCreateFailure() { server.expect().post().withPath("/api/v1/namespaces/test/pods").andReturn(HttpURLConnection.HTTP_BAD_REQUEST, new PodBuilder() .withNewMetadata().withResourceVersion("12345").endMetadata().build()).once(); KubernetesClient client = server.getClient(); NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicable<Pod, Boolean> podOperation = client.resource(new PodBuilder().withNewMetadata().withName("pod123").endMetadata().build()); assertThrows(KubernetesClientException.class, podOperation::createOrReplace); }
Source:
protected Future<Slice> getAsyncManagedState(Object tuple) { Future<Slice> valFuture = ((ManagedTimeStateImpl)managedState).getAsync(getBucketId(getKey(tuple)), getKey(tuple)); return valFuture; }

Target:
protected Future<Slice> getAsyncManagedState(Object tuple) { Slice key = getKey(tuple); Future<Slice> valFuture = ((ManagedTimeStateImpl)managedState).getAsync(getBucketId(key), key); return valFuture; }
Source:
private static String logContent(byte[] content, String contentEncoding) { String contentString; try { contentString = new String(content, contentEncoding); } catch (UnsupportedEncodingException e) { contentString = ""; } return AnonymizerUtil.anonymize(contentString); }

Target:
private static String logContent(byte[] content, String contentEncoding) { String contentString; try { contentString = new String(content, contentEncoding); } catch (UnsupportedEncodingException e) { contentString = "We were not able to encode the content: " + e.getMessage(); } return AnonymizerUtil.anonymize(contentString); }
Source:
public final ChannelPipeline addLast(String name, ChannelHandler handler) { checkMultiplicity(handler); if (name == null) { name = generateName(handler); } AbstractChannelHandlerContext newCtx = newContext(name, handler); EventExecutor executor = executor(); boolean inEventLoop = executor().inEventLoop(); synchronized (this) { if (context(name) != null) { throw new IllegalArgumentException("Duplicate handler name: " + name); } handlers.add(newCtx); if (!inEventLoop) { try { executor.execute(() -> addLast0(newCtx)); return this; } catch (Throwable cause) { handlers.remove(newCtx); throw cause; } } } addLast0(newCtx); return this; }

Target:
public final ChannelPipeline addLast(String name, ChannelHandler handler) { checkMultiplicity(handler); if (name == null) { name = generateName(handler); } AbstractChannelHandlerContext newCtx = newContext(name, handler); EventExecutor executor = executor(); boolean inEventLoop = executor.inEventLoop(); synchronized (this) { if (context(name) != null) { throw new IllegalArgumentException("Duplicate handler name: " + name); } handlers.add(newCtx); if (!inEventLoop) { try { executor.execute(() -> addLast0(newCtx)); return this; } catch (Throwable cause) { handlers.remove(handlers.size() - 1); throw cause; } } } addLast0(newCtx); return this; }
Source:
public LazyECPoint(ECCurve curve, byte[] bits) { this.curve = curve; this.bits = bits; this.compressed = (bits[0] == 2 || bits[0] == 3); }

Target:
public LazyECPoint(ECCurve curve, byte[] bits) { this.curve = curve; this.bits = bits; this.compressed = ECKey.isPubKeyCompressed(bits); }
Source:
public Result createExternalIdentifier() throws Exception { UserSession session = getAuthenticatedSession(); studyService.getStudy(session.getStudyIdentifier()); AccountId accountId = AccountId.forHealthCode(session.getStudyIdentifier().getIdentifier(), session.getHealthCode()); ExternalIdentifier externalId = parseJson(request(), ExternalIdentifier.class); externalId.setStudyId(accountId.getStudyId()); Account account = accountDao.getAccount(accountId); ExternalIdentifier extIdObj = externalIdService.beginAssignExternalId(account, externalId.getIdentifier()); externalIdService.commitAssignExternalId(extIdObj); sessionUpdateService.updateExternalId(session, externalId); return okResult(UserSessionInfo.toJSON(session)); }

Target:
public Result createExternalIdentifier() throws Exception { UserSession session = getAuthenticatedSession(); AccountId accountId = AccountId.forHealthCode(session.getStudyIdentifier().getIdentifier(), session.getHealthCode()); ExternalIdentifier externalId = parseJson(request(), ExternalIdentifier.class); externalId.setStudyId(accountId.getStudyId()); participantService.assignExternalId(accountId, externalId); sessionUpdateService.updateExternalId(session, externalId); return okResult(UserSessionInfo.toJSON(session)); }
Source:
public void moveSelectedPathToParentPath() { fVariablesTreeContentProvider.addPath(new Path(ID_GROUP1)); fVariablesTreeContentProvider.addPath(new Path(ID_GROUP1_SUBGROUP1)); fVariablesTreeContentProvider.addPath(new Path(ID_GROUP1_SUBGROUP1_SUBGROUP11)); fVariablesTreeContentProvider.moveSelectedPath(new Path("/group1/subgroup11"), new Path("/group1/subgroup1/subgroup11")); final Object[] actualAdditionalPathSubgroup1 = fVariablesTreeContentProvider.getChildren(new Path(ID_GROUP1).makeRelative()); assertEquals(2, actualAdditionalPathSubgroup1.length); assertEquals(new Path("group1/subgroup1"), actualAdditionalPathSubgroup1[0]); assertEquals(new Path("group1/subgroup11"), actualAdditionalPathSubgroup1[1]); assertTrue(!fVariablesTreeContentProvider.hasChildren(new Path(ID_GROUP1_SUBGROUP1))); }

Target:
public void moveSelectedPathToParentPath() { fVariablesTreeContentProvider.addPath(new Path(ID_GROUP1)); fVariablesTreeContentProvider.addPath(new Path(ID_GROUP1_SUBGROUP1)); fVariablesTreeContentProvider.addPath(new Path(ID_GROUP1_SUBGROUP1_SUBGROUP11)); fVariablesTreeContentProvider.moveSelectedPath(new Path("/group1/subgroup11"), new Path("/group1/subgroup1/subgroup11")); final Object[] actualAdditionalPathSubgroup1 = fVariablesTreeContentProvider.getChildren(new Path(ID_GROUP1).makeRelative()); assertEquals(2, actualAdditionalPathSubgroup1.length); assertEquals(new Path("group1/subgroup1"), actualAdditionalPathSubgroup1[0]); assertEquals(new Path("group1/subgroup11"), actualAdditionalPathSubgroup1[1]); assertFalse(fVariablesTreeContentProvider.hasChildren(new Path(ID_GROUP1_SUBGROUP1))); }
Source:
public abstract void read(BitBuffer input) throws CTFReaderException; protected static void alignRead(BitBuffer input, IDeclaration declaration) throws CTFReaderException { long align = declaration.getAlignment(); long position = input.position(); long pos = position + ((align - (position % align)) % align); input.position(pos); }

Target:
public abstract void read(BitBuffer input) throws CTFReaderException; protected static void alignRead(BitBuffer input, IDeclaration declaration) throws CTFReaderException{ long mask = declaration.getAlignment() -1; long pos = input.position(); if ((pos & mask) == 0) { return; } pos = (pos + mask) & ~mask; input.position(pos); }
Source:
protected boolean isDetachAllowed() { if (getStoragePoolIsoMap() == null) { return failValidation(EngineMessage.STORAGE_DOMAIN_NOT_ATTACHED_TO_STORAGE_POOL); } List<StorageDomain> storageDomains = storageDomainDao.getAllForStoragePool(getStoragePool().getId()); if (storageDomains.size() > 1 && isMaster()) { return failValidation(EngineMessage.ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN); } return true; }

Target:
protected boolean isDetachAllowed() { if (getStoragePoolIsoMap() == null) { return failValidation(EngineMessage.STORAGE_DOMAIN_NOT_ATTACHED_TO_STORAGE_POOL); } if (isMaster() && storageDomainDao.getAllForStoragePool(getStoragePoolId()).size() > 1) { return failValidation(EngineMessage.ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN); } return true; }
Source:
private AuditEvents doListAuditEvents(final String uri) { try { return restTemplate.getForObject(uri, AuditEvents.class); } catch (GoodDataRestException e) { if (UNAUTHORIZED.value() == e.getStatusCode()) { throw new AuditEventsForbiddenException(e); } else { throw e; } } catch (RestClientException e) { throw new GoodDataException("Unable to list audit events"); } }

Target:
private AuditEvents doListAuditEvents(final String uri) { try { return restTemplate.getForObject(uri, AuditEvents.class); } catch (GoodDataRestException e) { if (UNAUTHORIZED.value() == e.getStatusCode()) { throw new AuditEventsForbiddenException(e); } else { throw e; } } catch (RestClientException e) { throw new GoodDataException("Unable to list audit events: " + uri); } }
Source:
public void spread_element() throws Exception { SpreadElementTree tree = parse("var x = [1, ... expression];", Kind.SPREAD_ELEMENT); assertThat(tree.is(Kind.SPREAD_ELEMENT)).isTrue(); assertThat(tree.ellipsis().text()).isEqualTo(JavaScriptPunctuator.ELLIPSIS.getValue()); }

Target:
public void spread_element() throws Exception { SpreadElementTree tree = parse("var x = [1, ... expression];", Kind.SPREAD_ELEMENT); assertThat(tree.is(Kind.SPREAD_ELEMENT)).isTrue(); assertThat(tree.ellipsis().text()).isEqualTo(JavaScriptPunctuator.ELLIPSIS.getValue()); assertThat(tree.element().is(Kind.IDENTIFIER_REFERENCE)).isTrue(); }
Source:
public void init() { log.info("Start initializing " + getClass().getSimpleName()); List<VDS> allVdsList = DbFacade.getInstance().getVdsDao().getAll(); HashSet<Guid> nonResponsiveVdss = new HashSet<Guid>(); for (VDS helper_vds : allVdsList) { if (helper_vds.getStatus() == VDSStatus.NonResponsive) { nonResponsiveVdss.add(helper_vds.getId()); } } boolean runningVmsInTransition = false; List<VM> vms = DbFacade.getInstance().getVmDao().getAll(); for (VM vm : vms) { if (!vm.isNotRunning()) { if (vm.getRunOnVds() != null) { MultiValueMapUtils.addToMap(vm.getRunOnVds(), vm.getId(), _vdsAndVmsList, new MultiValueMapUtils.HashSetCreator<Guid>()); } if (vm.getRunOnVds() != null && nonResponsiveVdss.contains(vm.getRunOnVds())) { SetVmUnknown(vm); } } if (!runningVmsInTransition && vm.isRunning() && vm.getStatus() != VMStatus.Up) { runningVmsInTransition = true; } } for (VDS _vds : allVdsList) { boolean _saveVdsDynamic = false; if (_vds.getPendingVcpusCount() != 0 && !runningVmsInTransition) { _vds.setPendingVcpusCount(0); _saveVdsDynamic = true; } if (_vds.getPendingVmemSize() != 0 && !runningVmsInTransition) { _vds.setPendingVmemSize(0); _saveVdsDynamic = true; } if (_saveVdsDynamic) { DbFacade.getInstance().getVdsDynamicDao().update(_vds.getDynamicData()); } } for (VDS curVds : allVdsList) { AddVds(curVds, true); } IrsBrokerCommand.Init(); log.info("Finished initializing " + getClass().getSimpleName()); }

Target:
public void init() { log.info("Start initializing " + getClass().getSimpleName()); List<VDS> allVdsList = DbFacade.getInstance().getVdsDao().getAll(); HashSet<Guid> nonResponsiveVdss = new HashSet<Guid>(); for (VDS helper_vds : allVdsList) { if (helper_vds.getStatus() == VDSStatus.NonResponsive) { nonResponsiveVdss.add(helper_vds.getId()); } } List<VM> vms = DbFacade.getInstance().getVmDao().getAll(); for (VM vm : vms) { if (!vm.isNotRunning()) { if (vm.getRunOnVds() != null) { MultiValueMapUtils.addToMap(vm.getRunOnVds(), vm.getId(), _vdsAndVmsList, new MultiValueMapUtils.HashSetCreator<Guid>()); } if (vm.getRunOnVds() != null && nonResponsiveVdss.contains(vm.getRunOnVds())) { SetVmUnknown(vm); } } } for (VDS _vds : allVdsList) { boolean _saveVdsDynamic = false; boolean runningVmsInTransition = false; List<VM> _vms = DbFacade.getInstance().getVmDao().getAllRunningForVds(_vds.getId()); for (VM vm : _vms) { if (vm.isRunning() && vm.getStatus() != VMStatus.Up) { runningVmsInTransition = true; break; } } if (_vds.getPendingVcpusCount() != 0 && !runningVmsInTransition) { _vds.setPendingVcpusCount(0); _saveVdsDynamic = true; } if (_vds.getPendingVmemSize() != 0 && !runningVmsInTransition) { _vds.setPendingVmemSize(0); _saveVdsDynamic = true; } if (_saveVdsDynamic) { DbFacade.getInstance().getVdsDynamicDao().update(_vds.getDynamicData()); } } for (VDS curVds : allVdsList) { AddVds(curVds, true); } IrsBrokerCommand.Init(); log.info("Finished initializing " + getClass().getSimpleName()); }
Source:
public void phoneSignIn() throws Exception { TestUtils.mockPlayContextWithJson(PHONE_SIGN_IN); Metrics metrics = new Metrics(TEST_REQUEST_ID); doReturn(metrics).when(controller).getMetrics(); when(authenticationService.phoneSignIn(any(), any())).thenReturn(userSession); Result result = controller.phoneSignIn(); assertEquals(200, result.status()); verify(authenticationService).phoneSignIn(contextCaptor.capture(), signInCaptor.capture()); CriteriaContext context = contextCaptor.getValue(); assertEquals(TEST_STUDY_ID_STRING, context.getStudyIdentifier().getIdentifier()); SignIn captured = signInCaptor.getValue(); assertEquals(TEST_STUDY_ID_STRING, captured.getStudyId()); assertEquals(TEST_TOKEN, captured.getToken()); assertEquals(TestConstants.PHONE.getNumber(), captured.getPhone().getNumber()); }

Target:
public void phoneSignIn() throws Exception { response = mockPlayContextWithJson(PHONE_SIGN_IN); when(authenticationService.phoneSignIn(any(), any())).thenReturn(userSession); Result result = controller.phoneSignIn(); assertEquals(200, result.status()); JsonNode node = TestUtils.getJson(result); assertEquals(TEST_SESSION_TOKEN, node.get("sessionToken").textValue()); assertEquals("UserSessionInfo", node.get("type").textValue()); verify(authenticationService).phoneSignIn(contextCaptor.capture(), signInCaptor.capture()); CriteriaContext context = contextCaptor.getValue(); assertEquals(TEST_STUDY_ID_STRING, context.getStudyIdentifier().getIdentifier()); SignIn captured = signInCaptor.getValue(); assertEquals(TEST_STUDY_ID_STRING, captured.getStudyId()); assertEquals(TEST_TOKEN, captured.getToken()); assertEquals(TestConstants.PHONE.getNumber(), captured.getPhone().getNumber()); verifyCommonLoggingForSignIns(); }
Source:
public void execute() { if (getRoleId() == null || getRoleId() < 1L) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided"); } Role role = roleService.findRole(getRoleId()); if (role == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided"); } CallContext.current().setEventDetails("Role id: " + role.getId()); boolean result = roleService.deleteRole(role); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); setResponseObject(response); }

Target:
public void execute() { Role role = roleService.findRole(getRoleId()); if (role == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id"); } CallContext.current().setEventDetails("Role id: " + role.getId()); boolean result = roleService.deleteRole(role); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); setResponseObject(response); }
Source:
public Task(String name, TaskTriggerInformation trigger, List<TaskActionInformation> actions, TaskConfig taskConfig, boolean enabled, boolean hasRegisteredChannel) { this.name = name; this.actions = actions == null ? new ArrayList<TaskActionInformation>() : actions; this.trigger = trigger; this.enabled = enabled; this.hasRegisteredChannel = hasRegisteredChannel; this.taskConfig = taskConfig == null ? new TaskConfig() : taskConfig; this.validationErrors = new HashSet<>(); this.failuresInRow = 0; this.numberOfRetries = DEFAULT_NUMBER_FOR_TASK_RETRIES; this.retryIntervalInMilliseconds = DEFAULT_TIME_FOR_RETRY_INTERVAL; this.useTimeWindow = false; this.startTime = null; this.endTime = null; }

Target:
public Task(String name, TaskTriggerInformation trigger, List<TaskActionInformation> actions, TaskConfig taskConfig, boolean enabled, boolean hasRegisteredChannel) { this.name = name; this.actions = actions == null ? new ArrayList<TaskActionInformation>() : actions; this.trigger = trigger; this.enabled = enabled; this.hasRegisteredChannel = hasRegisteredChannel; this.taskConfig = taskConfig == null ? new TaskConfig() : taskConfig; this.validationErrors = new HashSet<>(); this.failuresInRow = 0; this.numberOfRetries = DEFAULT_NUMBER_FOR_TASK_RETRIES; this.retryIntervalInMilliseconds = DEFAULT_TIME_FOR_RETRY_INTERVAL; }
Source:
public boolean isNavMenuVisible() { return !menuView.getAttribute("class").contains("collapsed"); }

Target:
public boolean isNavMenuVisible() throws WebDriverException { if (menuView.getAttribute("class") == null) { throw new WebDriverException("Expected String but got null"); } return !menuView.getAttribute("class").contains("collapsed"); }
Source:
public int countFeatureTargets(EObject seedSource, EStructuralFeature feature) { if (feature.isMany()){ return ((List<?>)seedSource.eGet(feature)).size(); } return seedSource.eGet(feature) == null ? 0 : 1; }

Target:
public int countFeatureTargets(EObject seedSource, EStructuralFeature feature) { return instanceStore.getHolderToFeatureToValueMap().get(seedSource, toKey(feature)).size(); }
Source:
public void stop() { if (isStarted.compareAndSet(true, false)) { stopQueue(); dispatcher.stop(); } if (config.getPersistentQueueMode() == PersistentQueueMode.STICKY_POLLING) { reaper.stop(); } }

Target:
public void stop() { if (isStarted.compareAndSet(true, false)) { stopQueue(); dispatcher.stop(); } reaper.stop(); }
Source:
public void handleMethodPOST(URI uri, HTTPRequest request, ToadletContext ctx) throws ToadletContextClosedException, IOException { MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); if (request.isPartSet("dismiss-user-alert")) { int userAlertHashCode = request.getIntPart("disable", -1); ctx.getAlertManager().dismissAlert(userAlertHashCode); } String redirect; try { redirect = request.getPartAsStringThrowing("redirectToAfterDisable", 1024); } catch (SizeLimitExceededException | NoSuchElementException e) { redirect = "."; } headers.put("Location", redirect); ctx.sendReplyHeaders(302, "Found", headers, null, 0); }

Target:
public void handleMethodPOST(URI uri, HTTPRequest request, ToadletContext ctx) throws ToadletContextClosedException, IOException { MultiValueTable<String, String> headers = new MultiValueTable<String, String>(); if (request.isPartSet("dismiss-user-alert")) { int userAlertHashCode = request.getIntPart("disable", -1); ctx.getAlertManager().dismissAlert(userAlertHashCode); } String redirect; try { redirect = request.getPartAsStringThrowing("redirectToAfterDisable", 1024); } catch (SizeLimitExceededException | NoSuchElementException e) { redirect = "."; } if (!("/alerts/".equals(redirect) || "/".equals(redirect) || "/#bookmarks".equals(redirect))) { redirect = "."; } headers.put("Location", redirect); ctx.sendReplyHeaders(302, "Found", headers, null, 0); }
Source:
protected void copyFile() throws CVSException { FileChannel tempFileChannel=null; FileChannel fileChannel=null; try (FileInputStream tempFileStream = new FileInputStream(tempFile); FileOutputStream fileStream = new FileOutputStream(file)){ tempFileChannel = tempFileStream.getChannel(); fileChannel = fileStream.getChannel(); long size= tempFileChannel.size(); long bytesTransferred = fileChannel.transferFrom(tempFileChannel, 0, size); while (bytesTransferred != size){ bytesTransferred += fileChannel.transferFrom(tempFileChannel, bytesTransferred, size); } } catch (IOException e) { throw CVSException.wrapException(e); } finally { if (tempFileChannel!=null) try { tempFileChannel.close(); } catch (IOException e) { throw CVSException.wrapException(e); } if (fileChannel!=null) try { fileChannel.close(); } catch (IOException e) { throw CVSException.wrapException(e); } if (tempFile != null) tempFile.delete(); } }

Target:
protected void copyFile() throws CVSException { try (FileInputStream tempFileStream = new FileInputStream(tempFile); FileOutputStream fileStream = new FileOutputStream(file)) { FileChannel tempFileChannel = tempFileStream.getChannel(); FileChannel fileChannel = fileStream.getChannel(); long size = tempFileChannel.size(); long bytesTransferred = fileChannel.transferFrom(tempFileChannel, 0, size); while (bytesTransferred != size) { bytesTransferred += fileChannel.transferFrom(tempFileChannel, bytesTransferred, size); } } catch (IOException e) { throw CVSException.wrapException(e); } finally { if (tempFile != null) tempFile.delete(); } }
Source:
public SlaveComputer(Slave slave) { super(slave); this.log = new RewindableFileOutputStream(getLogFile()); this.taskListener = new StreamTaskListener(decorate(this.log)); assert slave.getNumExecutors()!=0 : "Computer created with 0 executors"; }

Target:
public SlaveComputer(Slave slave) { super(slave); this.log = new RewindableRotatingFileOutputStream(getLogFile(), 10); this.taskListener = new StreamTaskListener(decorate(this.log)); assert slave.getNumExecutors()!=0 : "Computer created with 0 executors"; }
Source:
protected final void extractAdditionalFields(NitroItemSource<SOURCE> source, ITEM item, DateTime now) { ImmutableSetMultimap<String, Broadcast> broadcasts = extractBroadcasts(source.getBroadcasts(), now); OptionalMap<String, Set<Encoding>> encodings = extractEncodings(source.getAvailabilities(), now); ImmutableSet.Builder<Version> versions = ImmutableSet.builder(); for (com.metabroadcast.atlas.glycerin.model.Version nitroVersion : source.getVersions()) { Version version = new Version(); if (nitroVersion.getDuration() != null) { version.setDuration(convertDuration(nitroVersion.getDuration())); } version.setLastUpdated(now); version.setCanonicalUri(BbcFeeds.nitroUriForPid(nitroVersion.getPid())); version.setBroadcasts(broadcasts.get(nitroVersion.getPid())); Optional<Set<Encoding>> optEncodings = encodings.get(nitroVersion.getPid()); if (optEncodings.isPresent()) { Set<Encoding> versionEncodings = optEncodings.get(); for (Encoding encoding: versionEncodings) { encoding.setVideoAspectRatio(nitroVersion.getAspectRatio()); encoding.setAudioDescribed(isVersionOfType(nitroVersion, AUDIO_DESCRIBED_VERSION_TYPE)); encoding.setSigned(isVersionOfType(nitroVersion, SIGNED_VERSION_TYPE)); version.setManifestedAs(versionEncodings); } } Optional<WarningText> warningText = warningTextFrom(nitroVersion); version.setRestriction(generateRestriction(warningText)); versions.add(version); } item.setVersions(versions.build()); if (item instanceof Film) { item.setMediaType(MediaType.VIDEO); item.setSpecialization(Specialization.FILM); } else { extractMediaTypeAndSpecialization(source, item); } extractAdditionalItemFields(source, item, now); }

Target:
protected final void extractAdditionalFields(NitroItemSource<SOURCE> source, ITEM item, DateTime now) { ImmutableSetMultimap<String, Broadcast> broadcasts = extractBroadcasts(source.getBroadcasts(), now); OptionalMap<String, Set<Encoding>> encodings = extractEncodings(source.getAvailabilities(), now); ImmutableSet.Builder<Version> versions = ImmutableSet.builder(); for (com.metabroadcast.atlas.glycerin.model.Version nitroVersion : source.getVersions()) { Version version = generateVersion(now, broadcasts, encodings, nitroVersion); versions.add(version); } item.setVersions(versions.build()); if (item instanceof Film) { item.setMediaType(MediaType.VIDEO); item.setSpecialization(Specialization.FILM); } else { extractMediaTypeAndSpecialization(source, item); } extractAdditionalItemFields(source, item, now); }
Source:
public Set<String> undocumentedParameters() { return elementParameters.stream() .filter(name -> isEmptyDescription(blockTagDescriptions.get(BlockTagKey.of(BlockTag.PARAM, name)))) .collect(Collectors.toSet()); }

Target:
public List<String> undocumentedParameters() { return undocumentedNamedTags.computeIfAbsent(BlockTag.PARAM, key -> computeUndocumentedParameters()); }
Source:
private static ContinuousStream<HashMap<String, Tuple2<Object, CepValueType>>> cepInputTranslator( final MISTQueryBuilder queryBuilder, final CepInput cepInput) { if (cepInput.getInputType() == CepInputType.TEXT_SOCKET_SOURCE) { String sourceHostname = cepInput.getSourceConfiguration().get("SOCKET_INPUT_ADDRESS").toString(); int sourcePort = (int) cepInput.getSourceConfiguration().get("SOCKET_INPUT_PORT"); SourceConfiguration sourceConf = new TextSocketSourceConfiguration().newBuilder() .setHostAddress(sourceHostname) .setHostPort(sourcePort) .build(); return queryBuilder.socketTextStream(sourceConf) .map(s -> CepTuple.stringToMap(s, cepInput.getFields(), cepInput.getSeparator())); } else { throw new IllegalStateException("No other source is ready yet!"); } }

Target:
private static ContinuousStream<Map<String, Object>> cepInputTranslator( final MISTQueryBuilder queryBuilder, final CepInput cepInput) { switch (cepInput.getInputType()) { case TEXT_SOCKET_SOURCE: { final String sourceHostname = cepInput.getSourceConfiguration().get("SOCKET_INPUT_ADDRESS").toString(); final int sourcePort = (int) cepInput.getSourceConfiguration().get("SOCKET_INPUT_PORT"); final SourceConfiguration sourceConf = new TextSocketSourceConfiguration().newBuilder() .setHostAddress(sourceHostname) .setHostPort(sourcePort) .build(); final List<Tuple2<String, CepValueType>> fields = cepInput.getFields(); final String separator = cepInput.getSeparator(); return queryBuilder.socketTextStream(sourceConf) .map(new CepStringToMapFunction(fields, separator)); } default: throw new IllegalStateException("No other source is ready yet!"); } }
Source:
public void childAdded(final TaskChild child, final boolean userThread) throws InvalidTransactionStateException { assert ! holdsLock(this); int state; synchronized (this) { if (currentState() == STATE_EXECUTE) { children.add(child); unfinishedChildren++; unvalidatedChildren++; unterminatedChildren++; state = nextState(userThread, NO_FLAGS); } else { if (userThread) { throw new IllegalStateException("Dependent may not be added at this point"); } else { return; } } } executeTasks(state); }

Target:
public void childAdded(final TaskChild child, final boolean userThread) throws InvalidTransactionStateException { assert ! holdsLock(this); int state; synchronized (this) { state = this.state; if (stateIsIn(state, STATE_EXECUTE)) { children.add(child); unfinishedChildren++; unvalidatedChildren++; unterminatedChildren++; if (userThread) state |= FLAG_USER_THREAD; state = transition(state); this.state = state & PERSISTENT_STATE; } else { if (userThread) { throw new IllegalStateException("Dependent may not be added at this point"); } else { return; } } } executeTasks(state); }
Source:
private Token obtainSnapshotTimestamp() { final AbstractTransactionalContext parentCtx = getParentContext(); final Token txnBuilderTs = getTransaction().getSnapshot(); CorfuRuntime rt = getTransaction().getRuntime(); if (parentCtx != null) { Token parentTimestamp = parentCtx.getSnapshotTimestamp(); log.trace("obtainSnapshotTimestamp: inheriting parent snapshot" + " SnapshotTimestamp[{}] {}", this, parentTimestamp); return parentTimestamp; } else if (!txnBuilderTs.equals(Token.UNINITIALIZED)) { log.trace("obtainSnapshotTimestamp: using user defined snapshot" + " SnapshotTimestamp[{}] {}", this, txnBuilderTs); return txnBuilderTs; } else { Token timestamp = rt .getSequencerView() .query() .getToken(); log.trace("obtainSnapshotTimestamp: sequencer SnapshotTimestamp[{}] {}", this, timestamp); return timestamp; } }

Target:
private Token obtainSnapshotTimestamp() { final AbstractTransactionalContext parentCtx = getParentContext(); final Token txnBuilderTs = getTransaction().getSnapshot(); if (parentCtx != null) { Token parentTimestamp = parentCtx.getSnapshotTimestamp(); log.trace("obtainSnapshotTimestamp: inheriting parent snapshot" + " SnapshotTimestamp[{}] {}", this, parentTimestamp); return parentTimestamp; } else if (!txnBuilderTs.equals(Token.UNINITIALIZED)) { log.trace("obtainSnapshotTimestamp: using user defined snapshot" + " SnapshotTimestamp[{}] {}", this, txnBuilderTs); return txnBuilderTs; } else { Token timestamp = getTransaction() .getRuntime() .getSequencerView() .query() .getToken(); log.trace("obtainSnapshotTimestamp: sequencer SnapshotTimestamp[{}] {}", this, timestamp); return timestamp; } }
Source:
public void theSetAdministrativeStatusRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }

Target:
public void theSetAdministrativeStatusRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
private EquivalentContentIndexingGraphWorker( ContentIndex contentIndex, EquivalenceGraphUpdateResolver graphUpdateResolver, String metricPrefix, MetricRegistry metricRegistry ) { this.contentIndex = checkNotNull(contentIndex); this.graphUpdateResolver = checkNotNull(graphUpdateResolver); this.executionTimer = metricRegistry.timer(metricPrefix + "timer.execution"); this.messageReceivedMeter = metricRegistry.meter(metricPrefix + "meter.received"); this.failureMeter = metricRegistry.meter(metricPrefix + "meter.failure"); this.latencyTimer = metricRegistry.timer(metricPrefix + "latency.meter"); }

Target:
private EquivalentContentIndexingGraphWorker( ContentIndex contentIndex, EquivalenceGraphUpdateResolver graphUpdateResolver, String metricPrefix, MetricRegistry metricRegistry ) { this.contentIndex = checkNotNull(contentIndex); this.graphUpdateResolver = checkNotNull(graphUpdateResolver); this.executionTimer = metricRegistry.timer(metricPrefix + "timer.execution"); this.messageReceivedMeter = metricRegistry.meter(metricPrefix + "meter.received"); this.failureMeter = metricRegistry.meter(metricPrefix + "meter.failure"); this.latencyTimer = metricRegistry.timer(metricPrefix + "timer.latency"); }
Source:
public boolean anyVisibleWhen() { if (toolbarContribution.getVisibleWhen() != null) { return true; } List<MToolBarElement> childrenToInspect; if (toolbarContribution.getTransientData().get(FACTORY) != null) { childrenToInspect = toolbarModel.getChildren(); } else { childrenToInspect = toolbarContribution.getChildren(); } for (MToolBarElement child : childrenToInspect) { if (child.getVisibleWhen() != null || child.getPersistedState().get( MenuManagerRenderer.VISIBILITY_IDENTIFIER) != null) { return true; } } return false; }

Target:
public boolean anyVisibleWhen() { if (toolbarContribution.getVisibleWhen() != null) { return true; } List<MToolBarElement> childrenToInspect; if (toolbarContribution.getTransientData().get(FACTORY) != null) { childrenToInspect = this.generatedElements; } else { childrenToInspect = toolbarContribution.getChildren(); } for (MToolBarElement child : childrenToInspect) { if (child.getVisibleWhen() != null || child.getPersistedState().get( MenuManagerRenderer.VISIBILITY_IDENTIFIER) != null) { return true; } } return false; }
Source:
public void execute() throws MojoExecutionException, MojoFailureException { for (Merge mergeData : merges) { final List<File> files = Arrays.asList(mergeData.getFiles()); final Properties properties = new Properties(); InputStream is = null; OutputStream os = null; for (File propertiesFile : files) { if (!propertiesFile.exists()) throw new MojoExecutionException("File does not exist: " + propertiesFile.getAbsolutePath()); try { is = new FileInputStream(propertiesFile); properties.load(is); } catch (Exception e) { throw new MojoExecutionException("", e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } File destination = mergeData.getDestination(); try { os = new FileOutputStream(destination); properties.store(os, destination.getName()); } catch (Exception e) { throw new MojoExecutionException("Exception writing in the file" + destination.getName(), e); } finally { if (os != null) { try { os.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } }

Target:
public void execute() throws MojoExecutionException, MojoFailureException { for (Merge mergeData : merges) { final Properties properties = new Properties(); InputStream is = null; OutputStream os = null; for (File propertiesFile : mergeData.getFiles()) { if (!propertiesFile.exists()) throw new MojoExecutionException("File does not exist: " + propertiesFile.getAbsolutePath()); try { is = new FileInputStream(propertiesFile); properties.load(is); } catch (Exception e) { throw new MojoExecutionException("Exception while loading the file " + propertiesFile.getAbsolutePath(), e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } File destination = mergeData.getDestination(); try { os = new FileOutputStream(destination); properties.store(os, destination.getName()); } catch (Exception e) { throw new MojoExecutionException("Exception writing in the file " + destination.getName(), e); } finally { if (os != null) { try { os.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } }
Source:
public static String getState(int errorCode) { switch (errorCode) { case NO_DATA_AVAILABLE: return "02000"; case INVALID_PARAMETER_COUNT_2: return "07001"; case ERROR_OPENING_DATABASE_1: return "08000"; case COLUMN_COUNT_DOES_NOT_MATCH: return "21S02"; case TABLE_OR_VIEW_ALREADY_EXISTS_1: return "42S01"; case TABLE_OR_VIEW_NOT_FOUND_1: return "42S02"; case TABLE_OR_VIEW_NOT_FOUND_2: return "42S03"; case TABLE_OR_VIEW_NOT_FOUND_3: return "42S04"; case INDEX_ALREADY_EXISTS_1: return "42S11"; case INDEX_NOT_FOUND_1: return "42S12"; case DUPLICATE_COLUMN_NAME_1: return "42S21"; case COLUMN_NOT_FOUND_1: return "42S22"; case IDENTICAL_EXPRESSIONS_SHOULD_BE_USED: return "42S31"; case GENERAL_ERROR_1: return "HY000"; case UNKNOWN_DATA_TYPE_1: return "HY004"; case FEATURE_NOT_SUPPORTED_1: return "HYC00"; case LOCK_TIMEOUT_1: return "HYT00"; default: return Integer.toString(errorCode); } }

Target:
public static String getState(int errorCode) { switch (errorCode) { case NO_DATA_AVAILABLE: return "02000"; case INVALID_PARAMETER_COUNT_2: return "07001"; case ERROR_OPENING_DATABASE_1: return "08000"; case COLUMN_COUNT_DOES_NOT_MATCH: return "21S02"; case TABLE_OR_VIEW_ALREADY_EXISTS_1: return "42S01"; case TABLE_OR_VIEW_NOT_FOUND_1: return "42S02"; case TABLE_OR_VIEW_NOT_FOUND_WITH_CANDIDATES_2: return "42S03"; case TABLE_OR_VIEW_NOT_FOUND_DATABASE_EMPTY_1: return "42S04"; case INDEX_ALREADY_EXISTS_1: return "42S11"; case INDEX_NOT_FOUND_1: return "42S12"; case DUPLICATE_COLUMN_NAME_1: return "42S21"; case COLUMN_NOT_FOUND_1: return "42S22"; case IDENTICAL_EXPRESSIONS_SHOULD_BE_USED: return "42S31"; case GENERAL_ERROR_1: return "HY000"; case UNKNOWN_DATA_TYPE_1: return "HY004"; case FEATURE_NOT_SUPPORTED_1: return "HYC00"; case LOCK_TIMEOUT_1: return "HYT00"; default: return Integer.toString(errorCode); } }
Source:
public void ifCantCreateTempFile() { final Environment env = Mockito.mock(Environment.class); Mockito.when(env.tempdir()).thenReturn(new File("/dev/null")); Mockito.when(env.excludes("findbugs")).thenReturn( Arrays.asList("org.package.Class") ); Assertions.assertThrows( IllegalStateException.class, new FindBugsExcludes(env)::asArguments, "Didn't throw an exception for invalid file" ); }

Target:
public void ifCantCreateTempFile() { final Environment env = Mockito.mock(Environment.class); Mockito.when(env.tempdir()).thenReturn(new File("/dev/null")); Mockito.when(env.excludes("findbugs")).thenReturn( new ListOf<>("org.package.Class") ); Assertions.assertThrows( IOException.class, new FindBugsExcludes(env)::asArguments, "Didn't throw an exception for invalid file" ); }
Source:
public void log(LogLevel level, LogDomain domain, String message) { if(level.compareTo(_level) < 0 || (!_domains.contains(domain) && !_domains.containsAll(EnumSet.allOf(LogDomain.class)))) { return; } switch(level) { case DEBUG: Log.d("CouchbaseLite/" + domain.toString(), message); break; case VERBOSE: Log.v("CouchbaseLite/" + domain.toString(), message); break; case INFO: Log.i("CouchbaseLite/" + domain.toString(), message); break; case WARNING: Log.w("CouchbaseLite/" + domain.toString(), message); break; case ERROR: Log.e("CouchbaseLite/" + domain.toString(), message); break; } }

Target:
public void log(LogLevel level, LogDomain domain, String message) { if(level.compareTo(_level) < 0 || (!_domains.contains(domain) && !_domains.contains(LogDomain.ALL))) { return; } switch(level) { case DEBUG: Log.d("CouchbaseLite/" + domain.toString(), message); break; case VERBOSE: Log.v("CouchbaseLite/" + domain.toString(), message); break; case INFO: Log.i("CouchbaseLite/" + domain.toString(), message); break; case WARNING: Log.w("CouchbaseLite/" + domain.toString(), message); break; case ERROR: Log.e("CouchbaseLite/" + domain.toString(), message); break; } }
Source:
protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } if (!glusterVolume.getVolumeType().isDistributedType()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED); } else if (glusterVolume.getVolumeType().isDistributedType() && glusterVolume.getBricks().size() == 1) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_VOLUME); } return true; }

Target:
protected boolean canDoAction() { GlusterVolumeEntity glusterVolume = getGlusterVolume(); if (!super.canDoAction()) { return false; } boolean isVolumeDistributed = glusterVolume.getVolumeType().isDistributedType(); if (!isVolumeDistributed) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED); } else if (isVolumeDistributed && glusterVolume.getBricks().size() == 1) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_VOLUME); } return true; }
Source:
private List<Queue> converteQueueList(List<QueueInfo> queues) { return queues.stream() .map(qi -> convert(qi)) .collect(Collectors.toList()); }

Target:
private List<Queue> converteQueueList(List<QueueInfo> queues) { return queues.stream() .map(this::convert) .collect(Collectors.toList()); }
Source:
public void validateTest() throws Exception { final String port = System.getProperty("server.http.port", "8080"); System.out.println(""); System.out.println("==========================================="); System.out.println("Running test on port: " + port); final String urlPath1 = "http://localhost:" + port + "/WebApp1" + versionNum + "/test/"; final String urlPath2 = "http://localhost:" + port + "/WebApp2" + versionNum + "/test/"; deployer.deploy("webapp1"); int result = WebClient.create(urlPath1) .type(MediaType.APPLICATION_JSON_TYPE).post("valid").getStatus(); System.out.println(result); Assert.assertEquals(200, result); deployer.undeploy("webapp1"); deployer.deploy("webapp2"); result = WebClient.create(urlPath2) .type(MediaType.APPLICATION_JSON_TYPE).post("valid").getStatus(); System.out.println(result); Assert.assertEquals(200, result); deployer.undeploy("webapp2"); System.out.println("==========================================="); System.out.println(""); }

Target:
public void validateTest() throws Exception { final String port = System.getProperty("server.http.port", "8080"); System.out.println(""); System.out.println("==========================================="); System.out.println("Running test on port: " + port); final String urlPath1 = "http://localhost:" + port + "/WebApp1/test/"; final String urlPath2 = "http://localhost:" + port + "/WebApp2/test/"; deployer.deploy("webapp1"); int result = WebClient.create(urlPath1) .type(MediaType.APPLICATION_JSON_TYPE).post("validd").getStatus(); System.out.println(result); Assert.assertEquals(406, result); deployer.undeploy("webapp1"); deployer.deploy("webapp2"); result = WebClient.create(urlPath2) .type(MediaType.APPLICATION_JSON_TYPE).post("validd").getStatus(); System.out.println(result); Assert.assertEquals(406, result); result = WebClient.create(urlPath2) .type(MediaType.APPLICATION_JSON_TYPE).post("valid").getStatus(); System.out.println(result); Assert.assertEquals(200, result); deployer.undeploy("webapp2"); System.out.println("==========================================="); System.out.println(""); }
Source:
private static String defaultFileContent() { String result; try { Path path = Paths.get(CFGViewer.class.getResource(DEFAULT_SOURCE_CODE).toURI()); result = new String(Files.readAllBytes(path)); } catch (URISyntaxException | IOException e) { result = " } return result; }

Target:
private static String defaultFileContent() { String result; try { Path path = Paths.get(CFGViewer.class.getResource(DEFAULT_SOURCE_CODE).toURI()); result = new String(Files.readAllBytes(path)); } catch (URISyntaxException | IOException e) { e.printStackTrace(); result = " } return result; }