auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static JsonArray listToJson(List<?> list) { if (list == null) { throw new RuntimeException(CANNOT_CONVERT_NULL_TO_A_JSON_OBJECT); } try { return Json.instance().parse(objectMapper.writeValueAsString(list)); } catch (JsonProcessingException e) { throw new RuntimeException("Error converting list to JSON", e); } }

Target:
public static JsonArray listToJson(List<?> list) { Objects.requireNonNull(list, CANNOT_CONVERT_NULL_TO_A_JSON_OBJECT); try { return Json.instance().parse(objectMapper.writeValueAsString(list)); } catch (JsonProcessingException e) { throw new RuntimeException("Error converting list to JSON", e); } }
Source:
private Map<Integer, Integer> getTypeIndexesPerLevel() { if (this.typeIndexesPerLevel == null) { this.typeIndexesPerLevel = new SmallMap<>(); } return this.typeIndexesPerLevel; }

Target:
private Map<Integer, Integer> getTypeIndexesPerLevel() { if (this.typeIndexesPerLevel == null) { this.typeIndexesPerLevel = new HashMap<>(4); } return this.typeIndexesPerLevel; }
Source:
public void testGetCompletionTimesTwoFragmentInteractionP2PAsync() throws Exception { Trace trace1 = new Trace(); trace1.setId("1_2ip2pasync"); trace1.setStartTime(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()) - 4000); Consumer c1 = new Consumer(); c1.setUri("testuri"); c1.setDuration(3000); trace1.getNodes().add(c1); Producer p1 = new Producer(); p1.setUri("testuri2"); p1.setBaseTime(500); p1.setDuration(500); p1.addInteractionCorrelationId("cid1_2ip2pasync"); c1.getNodes().add(p1); Trace trace2 = new Trace(); trace2.setId("2_2ip2pasync"); trace2.setStartTime(trace1.getStartTime() + 500); Consumer c2 = new Consumer(); c2.setUri("testuri2"); c2.setDuration(4000); c2.addInteractionCorrelationId("cid1_2ip2pasync"); trace2.getNodes().add(c2); tracePublisher.publish(null, Arrays.asList(trace1, trace2)); Wait.until(() -> traceService.searchFragments(null, new Criteria()).size() == 2); Wait.until(() -> analyticsService.getTraceCompletionTimes(null, new Criteria()).size() == 1); List<CompletionTime> times = analyticsService.getTraceCompletionTimes(null, new Criteria()); assertNotNull(times); assertEquals(1, times.size()); assertEquals(4500, times.get(0).getDuration()); }

Target:
public void testGetCompletionTimesTwoFragmentInteractionP2PAsync() throws Exception { Trace trace1 = new Trace(); trace1.setId("1_2ip2pasync"); trace1.setStartTime(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()) - FOUR_MS_IN_MICRO_SEC); Consumer c1 = new Consumer(); c1.setUri("testuri"); c1.setDuration(3000); trace1.getNodes().add(c1); Producer p1 = new Producer(); p1.setUri("testuri2"); p1.setBaseTime(500); p1.setDuration(500); p1.addInteractionCorrelationId("cid1_2ip2pasync"); c1.getNodes().add(p1); Trace trace2 = new Trace(); trace2.setId("2_2ip2pasync"); trace2.setStartTime(trace1.getStartTime() + 500); Consumer c2 = new Consumer(); c2.setUri("testuri2"); c2.setDuration(4000); c2.addInteractionCorrelationId("cid1_2ip2pasync"); trace2.getNodes().add(c2); tracePublisher.publish(null, Arrays.asList(trace1, trace2)); Wait.until(() -> traceService.searchFragments(null, new Criteria()).size() == 2); Wait.until(() -> analyticsService.getTraceCompletionTimes(null, new Criteria()).size() == 1); List<CompletionTime> times = analyticsService.getTraceCompletionTimes(null, new Criteria()); assertNotNull(times); assertEquals(1, times.size()); assertEquals(4500, times.get(0).getDuration()); }
Source:
private String getMessageFrom(Throwable throwable) { String message = ""; if (throwable instanceof RuntimeNodeException) { final RuntimeNodeException rne = (RuntimeNodeException) throwable; message += rne.getUri() + " "; } message += "error=" + throwable.getMessage(); return message; }

Target:
private String getMessageFrom(Throwable throwable) { if (throwable instanceof RuntimeNodeException) { final RuntimeNodeException rne = (RuntimeNodeException) throwable; return rne.getUri() + " error=" + throwable.getMessage(); } return "error=" + throwable.getMessage(); }
Source:
public void testIndexRebuildingMetric() throws Exception { IgniteEx ignite = startGrid(0); ignite.cluster().active(true); String cacheName1 = "cache1"; String cacheName2 = "cache2"; IgniteCache<KeyClass, ValueClass> cache1 = ignite.getOrCreateCache(cacheConfiguration(cacheName1)); IgniteCache<KeyClass, ValueClass> cache2 = ignite.getOrCreateCache(cacheConfiguration(cacheName2)); cache1.put(new KeyClass(1), new ValueClass(1L)); cache2.put(new KeyClass(1), new ValueClass(1L)); List<Path> idxPaths = getIndexBinPaths(cacheName1); idxPaths.addAll(getIndexBinPaths(cacheName2)); stopAllGrids(); idxPaths.forEach(idxPath -> assertTrue(U.delete(idxPath))); GridQueryProcessor.idxCls = BlockingIndexing.class; ignite = startGrid(0); BooleanMetric indexRebuildCache1 = isIndexRebuildInProgressMetric(ignite, cacheName1); BooleanMetric indexRebuildCache2 = isIndexRebuildInProgressMetric(ignite, cacheName2); ignite.cluster().active(true); assertTrue(indexRebuildCache1.value()); assertTrue(indexRebuildCache2.value()); ((BlockingIndexing)ignite.context().query().getIndexing()).stopBlock(cacheName1); ignite.cache(cacheName1).indexReadyFuture().get(); assertFalse(indexRebuildCache1.value()); assertTrue(indexRebuildCache2.value()); ((BlockingIndexing)ignite.context().query().getIndexing()).stopBlock(cacheName2); ignite.cache(cacheName2).indexReadyFuture().get(); assertFalse(indexRebuildCache1.value()); assertFalse(indexRebuildCache2.value()); }

Target:
public void testIndexRebuildingMetric() throws Exception { IgniteEx ignite = startGrid(0); ignite.cluster().active(true); String cacheName1 = "cache1"; String cacheName2 = "cache2"; IgniteCache<KeyClass, ValueClass> cache1 = ignite.getOrCreateCache(cacheConfiguration(cacheName1)); IgniteCache<KeyClass, ValueClass> cache2 = ignite.getOrCreateCache(cacheConfiguration(cacheName2)); cache1.put(new KeyClass(1), new ValueClass(1L)); cache2.put(new KeyClass(1), new ValueClass(1L)); List<Path> idxPaths = getIndexBinPaths(cacheName1); idxPaths.addAll(getIndexBinPaths(cacheName2)); stopAllGrids(); idxPaths.forEach(idxPath -> assertTrue(U.delete(idxPath))); GridQueryProcessor.idxCls = BlockingIndexing.class; ignite = startGrid(0); BooleanMetric indexRebuildCache1 = isIndexRebuildInProgressMetric(ignite, cacheName1); BooleanMetric indexRebuildCache2 = isIndexRebuildInProgressMetric(ignite, cacheName2); ignite.cluster().active(true); assertTrue(indexRebuildCache1.value()); assertTrue(indexRebuildCache2.value()); ((BlockingIndexing)ignite.context().query().getIndexing()).stopBlock(cacheName1); ignite.cache(cacheName1).indexReadyFuture().get(30_000); assertFalse(indexRebuildCache1.value()); assertTrue(indexRebuildCache2.value()); ((BlockingIndexing)ignite.context().query().getIndexing()).stopBlock(cacheName2); ignite.cache(cacheName2).indexReadyFuture().get(30_000); assertFalse(indexRebuildCache1.value()); assertFalse(indexRebuildCache2.value()); }
Source:
public Object evaluate(SymbolResolver inputs) { checkState(!optimize, "evaluate(int, Page) not allowed for optimizer"); return visitor.process(expression, inputs); }

Target:
public Object evaluate(SymbolResolver inputs) { checkState(!optimize, "evaluate(SymbolResolver) not allowed for optimizer"); return visitor.process(expression, inputs); }
Source:
public void keepDependenciesAfterConversion(){ createWithRuntime(); new CheckBox("Delete original references from project").toggle(false); finishConversionDialog(); checkProblemsAndResolve(); PropertyDialog pd = openPropertiesProject(WEB_PROJECT_NAME); new DefaultTreeItem("Java Build Path").select(); new DefaultTabItem("Libraries").activate(); List<TreeItem> itRootDirs = new DefaultTree(1).getItems(); List<TreeItem> it = new ArrayList<TreeItem>(); for (TreeItem i: itRootDirs) { if (getJavaVersion().equals("1.8")) { it.add(i); } else { it.addAll(i.getItems()); } } List<String> libs = new ArrayList<String>(); log.debug("Libraries found after conversion:"); for(TreeItem i: it){ String lib = i.getText(); log.debug(" "+lib); libs.add(lib); } assertTrue("project contains more libraries than expected",libs.size()==3); Collections.sort(libs); Collections.sort(expectedLibsKeep); for(int i=0;i<3;i++){ assertTrue("Missing library "+expectedLibsKeep.get(i)+" but was"+libs.get(i), libs.get(i).contains(expectedLibsKeep.get(i))); if(libs.get(i).contains("Runtime")){ assertTrue("Wrong runtime added after conversion", libs.get(i).contains(sr.getRuntimeName())); } } pd.ok(); new WaitWhile(new ShellIsAvailable("Properties for "+WEB_PROJECT_NAME),TimePeriod.DEFAULT); }

Target:
public void keepDependenciesAfterConversion(){ createWithRuntime(); new CheckBox("Delete original references from project").toggle(false); finishConversionDialog(); checkProblemsAndResolve(); PropertyDialog pd = openPropertiesProject(WEB_PROJECT_NAME); List<String> libs = getJavaBuildPathLibraries(pd); assertTrue("project contains more libraries than expected",libs.size()==3); Collections.sort(libs); Collections.sort(expectedLibsKeep); for(int i=0;i<3;i++){ assertTrue("Missing library "+expectedLibsKeep.get(i)+" but was"+libs.get(i), libs.get(i).contains(expectedLibsKeep.get(i))); if(libs.get(i).contains("Runtime")){ assertTrue("Wrong runtime added after conversion", libs.get(i).contains(sr.getRuntimeName())); } } pd.ok(); new WaitWhile(new ShellIsAvailable("Properties for "+WEB_PROJECT_NAME),TimePeriod.DEFAULT); }
Source:
protected boolean checkIfLunDiskCanBeAdded(DiskValidator diskValidator) { LunDisk lunDisk = ((LunDisk) getParameters().getDiskInfo()); LUNs lun = lunDisk.getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (StorageServerConnections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; default: break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } if (getVm() != null && !(isVmNotLocked() && isVmNotInPreviewSnapshot())) { return false; } if (!validate(diskValidator.isVirtIoScsiValid(getVm()))) { return false; } if (!validate(diskValidator.isDiskInterfaceSupported(getVm()))) { return false; } if (getVds() != null) { updatedLun = getLunDisk(lun, getVds()); if (updatedLun == null) { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_INVALID); return false; } } if (!validate(diskValidator.isUsingScsiReservationValid(getVm(), lunDisk))) { return false; } return true; }

Target:
protected boolean checkIfLunDiskCanBeAdded(DiskValidator diskValidator) { LunDisk lunDisk = ((LunDisk) getParameters().getDiskInfo()); LUNs lun = lunDisk.getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (StorageServerConnections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; default: break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } if (getVm() != null && !(isVmNotLocked() && isVmNotInPreviewSnapshot())) { return false; } if (!validate(diskValidator.isVirtIoScsiValid(getVm()))) { return false; } if (!validate(diskValidator.isDiskInterfaceSupported(getVm()))) { return false; } if (getVds() != null) { lunFromStorage = getLunDisk(lun, getVds()); if (lunFromStorage == null) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_INVALID); } } if (!validate(diskValidator.isUsingScsiReservationValid(getVm(), lunDisk))) { return false; } return true; }
Source:
public void clear() { takeWriteLock(); try { bitmap.clear(); if (internalKeys != null) { internalKeys.clear(); internalKeyCounter = 0; } if (internalObjectKeys != null) { internalObjectKeys.clear(); internalKeyCounter = 0; } } finally { releaseWriteLock(); } }

Target:
public void clear() { takeWriteLock(); try { bitmap.clear(); if (internalKeys != null) { internalKeys.clear(); } if (internalObjectKeys != null) { internalObjectKeys.clear(); } internalKeyCounter = 0; } finally { releaseWriteLock(); } }
Source:
private List<Integer> getHistoryIdsByParams(long sessionId, int startAtHistoryId, boolean includeHistTypes, int... histTypes) throws DatabaseException { try { boolean hasHistTypes = histTypes != null && histTypes.length > 0; int strLength = hasHistTypes ? 97 : 68; StringBuilder strBuilder = new StringBuilder(strLength); strBuilder.append("SELECT ").append(HISTORYID); strBuilder.append(" FROM ").append(TABLE_NAME).append(" WHERE ").append(SESSIONID).append(" = ?"); if (hasHistTypes && includeHistTypes) { strBuilder.append(" AND ").append(HISTTYPE).append(" IN ( UNNEST(?) )"); } else if(hasHistTypes && !includeHistTypes){ strBuilder.append(" AND ").append(HISTTYPE).append(" NOT IN ( UNNEST(?) )"); } if(startAtHistoryId > 0){ strBuilder.append(" AND ").append(HISTORYID).append(" >= ?"); } strBuilder.append(" ORDER BY ").append(HISTORYID); try (PreparedStatement psReadSession = getConnection().prepareStatement(strBuilder.toString())) { psReadSession.setLong(1, sessionId); int parameterIndex = 2; if (hasHistTypes) { Array arrayHistTypes = getConnection().createArrayOf("INTEGER", ArrayUtils.toObject(histTypes)); psReadSession.setArray(parameterIndex++, arrayHistTypes); } if(startAtHistoryId > 0) { psReadSession.setInt(parameterIndex++, startAtHistoryId); } try (ResultSet rs = psReadSession.executeQuery()) { ArrayList<Integer> ids = new ArrayList<>(); while (rs.next()) { ids.add(rs.getInt(HISTORYID)); } ids.trimToSize(); return ids; } } } catch (SQLException e) { throw new DatabaseException(e); } }

Target:
private List<Integer> getHistoryIdsByParams(long sessionId, int startAtHistoryId, boolean includeHistTypes, int... histTypes) throws DatabaseException { try { boolean hasHistTypes = histTypes != null && histTypes.length > 0; final int strLength = 121; StringBuilder strBuilder = new StringBuilder(strLength); strBuilder.append("SELECT ").append(HISTORYID); strBuilder.append(" FROM ").append(TABLE_NAME).append(" WHERE ").append(SESSIONID).append(" = ?"); if (hasHistTypes) { strBuilder.append(" AND ").append(HISTTYPE); if (!includeHistTypes) { strBuilder.append(" NOT"); } strBuilder.append(" IN ( UNNEST(?) )"); } if(startAtHistoryId > 0){ strBuilder.append(" AND ").append(HISTORYID).append(" >= ?"); } strBuilder.append(" ORDER BY ").append(HISTORYID); try (PreparedStatement psReadSession = getConnection().prepareStatement(strBuilder.toString())) { psReadSession.setLong(1, sessionId); int parameterIndex = 2; if (hasHistTypes) { Array arrayHistTypes = getConnection().createArrayOf("INTEGER", ArrayUtils.toObject(histTypes)); psReadSession.setArray(parameterIndex++, arrayHistTypes); } if(startAtHistoryId > 0) { psReadSession.setInt(parameterIndex++, startAtHistoryId); } try (ResultSet rs = psReadSession.executeQuery()) { ArrayList<Integer> ids = new ArrayList<>(); while (rs.next()) { ids.add(rs.getInt(HISTORYID)); } ids.trimToSize(); return ids; } } } catch (SQLException e) { throw new DatabaseException(e); } }
Source:
private Project<?, ?> createParentProject(String parentJobName, String... childJobNames) throws IOException { Project<?,?> project = createFreeStyleProject(parentJobName); List<AbstractBuildParameters> buildParameters = new ArrayList<AbstractBuildParameters>(); buildParameters.add(new CurrentBuildParameters()); StringBuilder childJobNamesString = new StringBuilder(); for(String childJobName : childJobNames){ childJobNamesString.append(childJobName); childJobNamesString.append(","); } project.getBuildersList().add(new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters))); TriggerBuilder tb = new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters)); List<BuildStep> blist = new ArrayList<BuildStep>(); blist.add(tb); project.getBuildersList().add(new ConditionalBuilder(new AlwaysRun(), new BuildStepRunner.Run(), blist)); project.getBuildersList().add(new ConditionalBuilder(new AlwaysRun(), new BuildStepRunner.Run(), blist)); TriggerBuilder tb2 = new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters)); project.getBuildersList().add(new SingleConditionalBuilder(tb2, new AlwaysRun(), new BuildStepRunner.Run())); project.getBuildersList().add(new SingleConditionalBuilder(tb2, new AlwaysRun(), new BuildStepRunner.Run())); project.getPublishersList().add(new BuildTrigger(new BuildTriggerConfig(childJobNamesString.toString(), ResultCondition.SUCCESS, new CurrentBuildParameters()))); return project; }

Target:
private Project<?, ?> createParentProject(String parentJobName, String... childJobNames) throws IOException { Project<?,?> project = createFreeStyleProject(parentJobName); List<AbstractBuildParameters> buildParameters = new ArrayList<AbstractBuildParameters>(); buildParameters.add(new CurrentBuildParameters()); StringBuilder childJobNamesString = new StringBuilder(); for(String childJobName : childJobNames){ childJobNamesString.append(childJobName); childJobNamesString.append(","); } project.getBuildersList().add(new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters))); List<BuildStep> blist = new ArrayList<BuildStep>(); TriggerBuilder tb = new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters)); blist.add(tb); project.getBuildersList().add(new ConditionalBuilder(new AlwaysRun(), new BuildStepRunner.Run(), blist)); TriggerBuilder tb2 = new TriggerBuilder(new BlockableBuildTriggerConfig(childJobNamesString.toString(), null, buildParameters)); project.getBuildersList().add(new SingleConditionalBuilder(tb2, new AlwaysRun(), new BuildStepRunner.Run())); project.getPublishersList().add(new BuildTrigger(new BuildTriggerConfig(childJobNamesString.toString(), ResultCondition.SUCCESS, new CurrentBuildParameters()))); return project; }
Source:
public void checkWorkingWithInstallers() { workspaceDetails.selectTabInWorkspaceMenu(INSTALLERS); workspaceMachines.selectMachine("Workspace Installers", "dev-machine"); EXPECTED_INSTALLERS.forEach( (name, value) -> { workspaceInstallers.checkInstallerExists(name); }); EXPECTED_INSTALLERS.forEach( (name, value) -> { assertEquals(workspaceInstallers.isInstallerStateTurnedOn(name), value); workspaceInstallers.switchInstallerState(name); WaitUtils.sleepQuietly(1); }); clickOnSaveButton(); EXPECTED_INSTALLERS.forEach( (name, value) -> { workspaceInstallers.switchInstallerState(name); loader.waitOnClosed(); }); clickOnSaveButton(); EXPECTED_INSTALLERS.forEach( (name, value) -> { assertEquals(workspaceInstallers.isInstallerStateTurnedOn(name), value); }); }

Target:
public void checkWorkingWithInstallers() { workspaceDetails.selectTabInWorkspaceMenu(INSTALLERS); assertTrue(workspaceInstallers.isInstallerStateNotChangeable("Workspace API")); workspaceMachines.selectMachine("Workspace Installers", "dev-machine"); EXPECTED_INSTALLERS.forEach( (name, value) -> { workspaceInstallers.checkInstallerExists(name); }); EXPECTED_INSTALLERS.forEach( (name, value) -> { assertEquals(workspaceInstallers.isInstallerStateTurnedOn(name), value); workspaceInstallers.switchInstallerState(name); WaitUtils.sleepQuietly(1); }); clickOnSaveButton(); EXPECTED_INSTALLERS.forEach( (name, value) -> { workspaceInstallers.switchInstallerState(name); loader.waitOnClosed(); }); clickOnSaveButton(); EXPECTED_INSTALLERS.forEach( (name, value) -> { assertEquals(workspaceInstallers.isInstallerStateTurnedOn(name), value); }); }
Source:
public Date getOnsetDate() { return onsetDate != null ? (Date) onsetDate.clone() : new Date(); }

Target:
public Date getOnsetDate() { return onsetDate != null ? (Date) onsetDate.clone() : null; }
Source:
public static Client createClient(ClientConfig config) { Client client = null; synchronized (ClientFactory.class) { if (!m_preserveResources && ++m_activeClientCount == 1) { VoltLogger.startAsynchronousLogging(); EstTimeUpdater.start(); ReverseDNSCache.start(); } } config.enableSSL(); client = new ClientImpl(config, config.getSslContext()); return client; }

Target:
public static Client createClient(ClientConfig config) { Client client = null; synchronized (ClientFactory.class) { if (!m_preserveResources && ++m_activeClientCount == 1) { VoltLogger.startAsynchronousLogging(); EstTimeUpdater.start(); ReverseDNSCache.start(); } } client = new ClientImpl(config); return client; }
Source:
private WarehouseInstance.Tuple verifyLoad(String tableName, String tableNameOp, String lastReplId) throws Throwable { String[] resultArray = new String[]{"1", "2", "3", "4", "5"}; if (tableNameOp == null) { return verifyIncrementalLoad(Lists.newArrayList("select key from " + tableName, "select key from " + tableNameOp), Lists.newArrayList(resultArray, resultArray), lastReplId); } return verifyIncrementalLoad(Lists.newArrayList("select key from " + tableName, "select key from " + tableNameOp, "select key from " + tableName + "_nopart", "select key from " + tableNameOp + "_nopart"), Lists.newArrayList(resultArray, resultArray, resultArray, resultArray), lastReplId); }

Target:
private WarehouseInstance.Tuple verifyLoad(String tableName, String tableNameOp, String lastReplId) throws Throwable { String[] resultArray = new String[]{"1", "2", "3", "4", "5"}; if (tableNameOp == null) { return verifyIncrementalLoad(Lists.newArrayList("select key from " + tableName + " order by key", "select key from " + tableName + "_nopart order by key"), Lists.newArrayList(resultArray, resultArray), lastReplId); } return verifyIncrementalLoad(Lists.newArrayList("select key from " + tableName + " order by key", "select key from " + tableNameOp + " order by key", "select key from " + tableName + "_nopart" + " order by key", "select key from " + tableNameOp + "_nopart" + " order by key"), Lists.newArrayList(resultArray, resultArray, resultArray, resultArray), lastReplId); }
Source:
@Test void testSqlInsertSqlBasicCallToString() throws Exception { final String sql = "insert into emps select * from emps"; final SqlNode sqlNode = getSqlParser(sql).parseStmt(); final SqlNode sqlNodeVisited = sqlNode.accept(new SqlShuttle() { @Override public SqlNode visit(SqlIdentifier identifier) { return new SqlIdentifier(identifier.names, identifier.getParserPosition()); } }); final String str = "INSERT INTO `EMPS`\n" + "(SELECT *\n" + "FROM `EMPS`)"; assertEquals(linux(sqlNodeVisited.toString()), str); }

Target:
@Test void testSqlInsertSqlBasicCallToString() throws Exception { final String sql0 = "insert into emps select * from emps"; final SqlNode sqlNode0 = getSqlParser(sql0).parseStmt(); final SqlNode sqlNodeVisited0 = sqlNode0.accept(new SqlShuttle() { @Override public SqlNode visit(SqlIdentifier identifier) { return new SqlIdentifier(identifier.names, identifier.getParserPosition()); } }); final String str0 = "INSERT INTO `EMPS`\n" + "(SELECT *\n" + "FROM `EMPS`)"; assertEquals(linux(sqlNodeVisited0.toString()), str0); final String sql1 = "insert into emps select empno from emps"; final SqlNode sqlNode1 = getSqlParser(sql1).parseStmt(); final SqlNode sqlNodeVisited1 = sqlNode1.accept(new SqlShuttle() { @Override public SqlNode visit(SqlIdentifier identifier) { return new SqlIdentifier(identifier.names, identifier.getParserPosition()); } }); final String str1 = "INSERT INTO `EMPS`\n" + "(SELECT `EMPNO`\n" + "FROM `EMPS`)"; assertEquals(linux(sqlNodeVisited1.toString()), str1); }
Source:
private Collection<EvaluatorParameters> generateEvaluatorParameters(final int numComputeTasks, final int[] dataUnitsArray) { final List<EvaluatorParameters> ret = new ArrayList<>(numComputeTasks + 1); double maxComputeTaskEndTime = 0D; for (int i = 0; i < numComputeTasks; ++i) { final List<DataInfo> cmpTaskDataInfos = new ArrayList<>(1); int sumDataUnits = 0; for (int j = 0; j < dataUnitsArray.length; ++j) { final int dataUnitsPerEval = dataUnitsArray[j] / numComputeTasks; final int dataUnits = (i == 0) ? dataUnitsPerEval + (dataUnitsArray[j] % numComputeTasks) : dataUnitsPerEval; cmpTaskDataInfos.add(new DataInfoImpl("testType-" + j, dataUnits)); sumDataUnits += dataUnits; } final Map<String, Double> cmpTaskMetrics = new HashMap<>(); final double computeTaskEndTime = (random.nextDouble() + 1) * sumDataUnits; if (computeTaskEndTime > maxComputeTaskEndTime) { maxComputeTaskEndTime = computeTaskEndTime; } cmpTaskMetrics.put(DolphinMetricKeys.COMPUTE_TASK_USER_COMPUTE_TASK_START, 0D); cmpTaskMetrics.put(DolphinMetricKeys.COMPUTE_TASK_USER_COMPUTE_TASK_END, computeTaskEndTime); ret.add(new EvaluatorParametersImpl(ComputeTask.TASK_ID_PREFIX + i, cmpTaskDataInfos, cmpTaskMetrics)); } final Map<String, Double> metrics = new HashMap<>(); metrics.put(DolphinMetricKeys.CONTROLLER_TASK_SEND_DATA_START, 0D); metrics.put(DolphinMetricKeys.CONTROLLER_TASK_RECEIVE_DATA_END, maxComputeTaskEndTime + random.nextInt(50)); ret.add(new EvaluatorParametersImpl(ControllerTask.TASK_ID_PREFIX + 2, new ArrayList<DataInfo>(0), metrics)); return ret; }

Target:
private Collection<EvaluatorParameters> generateEvaluatorParameters(final int numComputeTasks, final int[] dataUnitsArray) { final List<EvaluatorParameters> ret = new ArrayList<>(numComputeTasks + 1); double maxComputeTaskEndTime = 0D; for (int i = 0; i < numComputeTasks; ++i) { final List<DataInfo> cmpTaskDataInfos = new ArrayList<>(1); int sumDataUnits = 0; for (int j = 0; j < dataUnitsArray.length; ++j) { final int dataUnitsPerEval = dataUnitsArray[j] / numComputeTasks; final int dataUnits = (i == 0) ? dataUnitsPerEval + (dataUnitsArray[j] % numComputeTasks) : dataUnitsPerEval; cmpTaskDataInfos.add(new DataInfoImpl(String.format("testType-%d", j), dataUnits)); sumDataUnits += dataUnits; } final Map<String, Double> cmpTaskMetrics = new HashMap<>(); final double computeTaskEndTime = (random.nextDouble() + 1) * sumDataUnits; if (computeTaskEndTime > maxComputeTaskEndTime) { maxComputeTaskEndTime = computeTaskEndTime; } cmpTaskMetrics.put(DolphinMetricKeys.COMPUTE_TASK_USER_COMPUTE_TASK_START, 0D); cmpTaskMetrics.put(DolphinMetricKeys.COMPUTE_TASK_USER_COMPUTE_TASK_END, computeTaskEndTime); ret.add(new EvaluatorParametersImpl(ComputeTask.TASK_ID_PREFIX + i, cmpTaskDataInfos, cmpTaskMetrics)); } final Map<String, Double> metrics = new HashMap<>(); metrics.put(DolphinMetricKeys.CONTROLLER_TASK_SEND_DATA_START, 0D); metrics.put(DolphinMetricKeys.CONTROLLER_TASK_RECEIVE_DATA_END, maxComputeTaskEndTime + random.nextInt(50)); ret.add(new EvaluatorParametersImpl(ControllerTask.TASK_ID_PREFIX + 2, new ArrayList<DataInfo>(0), metrics)); return ret; }
Source:
boolean isPanelValid() { return !StringUtils.isBlank(getConfigPath()) && (getFileSystemName(getConfigPath().substring(0, 3)).equals("NTFS") || getFileSystemName(getConfigPath().substring(0, 3)).equals("exFAT")) && ((configureDriveRadioButton.isSelected() && !StringUtils.isBlank(driveList.getSelectedValue())) || (configureFolderRadioButton.isSelected() && (!configFileTextField.getText().isEmpty()))); }

Target:
boolean isPanelValid() { return !StringUtils.isBlank(getConfigPath()) && !(getFileSystemName(getConfigPath().substring(0, 3)).equals("FAT") || getFileSystemName(getConfigPath().substring(0, 3)).equals("FAT32")) && ((configureDriveRadioButton.isSelected() && !StringUtils.isBlank(driveList.getSelectedValue())) || (configureFolderRadioButton.isSelected() && (!configFileTextField.getText().isEmpty()))); }
Source:
public void testValidateOverlapWithinPool( String range1From, String range1To, String range2From, String range2To, boolean overlapping) { MacRange range1 = new MacRange(); range1.setMacFrom(range1From); range1.setMacTo(range1To); MacRange range2 = new MacRange(); range2.setMacFrom(range2From); range2.setMacTo(range2To); PARAM_POOL.setId(Guid.newGuid()); PARAM_POOL.setName("p1"); PARAM_POOL.setRanges(Arrays.asList(range1, range2)); MacPool oldMacPool = new MacPool(); oldMacPool.setId(Guid.newGuid()); when(macPoolDao.get(any())).thenReturn(oldMacPool); when(macPoolPerCluster.isDuplicateMacAddressesAllowed(any())).thenReturn(false); when(macPoolDao.getAll()).thenReturn(Collections.emptyList()); assertEquals(!overlapping, command.validate()); }

Target:
public void testValidateOverlapWithinPool( String range1From, String range1To, String range2From, String range2To, boolean overlapping) { MacRange range1 = new MacRange(); range1.setMacFrom(range1From); range1.setMacTo(range1To); MacRange range2 = new MacRange(); range2.setMacFrom(range2From); range2.setMacTo(range2To); command.getParameters().getMacPool().setId(Guid.newGuid()); command.getParameters().getMacPool().setName("p1"); command.getParameters().getMacPool().setRanges(Arrays.asList(range1, range2)); MacPool oldMacPool = new MacPool(); oldMacPool.setId(Guid.newGuid()); when(macPoolDao.get(any())).thenReturn(oldMacPool); when(macPoolPerCluster.isDuplicateMacAddressesAllowed(any())).thenReturn(false); when(macPoolDao.getAll()).thenReturn(Collections.emptyList()); assertEquals(!overlapping, command.validate()); }
Source:
public abstract SQLiteDatabase getHandle() throws SessionUnavailableException; public ContentValues getContentValues(Externalizable e){ ContentValues ret = new ContentValues(); HashMap<String, Object> metaFieldsAndValues = DatabaseHelper.getMetaFieldsAndValues(e); for(String key: metaFieldsAndValues.keySet()){ Object obj = metaFieldsAndValues.get(key); if(obj instanceof String){ ret.put(key,(String)obj); } else if(obj instanceof Integer){ ret.put(key, (Integer) obj); } else if(obj instanceof byte[]){ ret.put(key, (byte[]) obj); } else{ System.out.println("Couldn't determine type of object: " + obj); } } return ret; }

Target:
public abstract SQLiteDatabase getHandle() throws SessionUnavailableException; public ContentValues getContentValues(Externalizable e){ ContentValues ret = new ContentValues(); HashMap<String, Object> metaFieldsAndValues = DatabaseHelper.getMetaFieldsAndValues(e); for(Map.Entry<String, Object> entry: metaFieldsAndValues.entrySet()){ String key = entry.getKey(); Object obj = entry.getValue(); if(obj instanceof String){ ret.put(key,(String)obj); } else if(obj instanceof Integer){ ret.put(key, (Integer) obj); } else if(obj instanceof byte[]){ ret.put(key, (byte[]) obj); } else{ System.out.println("Couldn't determine type of object: " + obj); } } return ret; }
Source:
private RuntimeException generateJiraException(int code, String errorMessage) { if (errorMessage.contains("errorMessages")) { errorMessage = errorMessage.substring(errorMessage.indexOf("errorMessages")) .substring(errorMessage.indexOf("[") + 1, errorMessage.lastIndexOf("]")); } return new RuntimeException( "Can't get response from server, error code is " + code + " , error message: " + errorMessage); }

Target:
private ComponentException generateJiraException(int code, String errorMessage) { return new ComponentException(new DefaultErrorCode(code), ExceptionContext.build() .put("message", "Can't get response from server, error code is " + code + "\n" + errorMessage)); }
Source:
FilterToSQL filter( SimpleFeatureType featureType, Filter filter, StringBuffer sql, FilterToSQL toSQL) throws IOException { try { SimpleFeatureType fullSchema = getSchema(featureType.getTypeName()); toSQL.setInline(true); String filterSql = toSQL.encodeToString(filter); int whereClauseIndex = sql.indexOf(":where_clause:"); if (whereClauseIndex != -1) { sql.replace(whereClauseIndex, whereClauseIndex + 14, "AND " + filterSql); sql.append("1 = 1"); } else { sql.append(filterSql); } return toSQL; } catch (FilterToSQLException e) { throw new RuntimeException(e); } }

Target:
FilterToSQL filter( SimpleFeatureType featureType, Filter filter, StringBuffer sql, FilterToSQL toSQL) throws IOException { try { SimpleFeatureType fullSchema = getSchema(featureType.getTypeName()); toSQL.setInline(true); String filterSql = toSQL.encodeToString(filter); int whereClauseIndex = sql.indexOf(WHERE_CLAUSE_PLACE_HOLDER); if (whereClauseIndex != -1) { sql.replace( whereClauseIndex, whereClauseIndex + WHERE_CLAUSE_PLACE_HOLDER_LENGTH, "AND " + filterSql); sql.append("1 = 1"); } else { sql.append(filterSql); } return toSQL; } catch (FilterToSQLException e) { throw new RuntimeException(e); } }
Source:
public int hashCode() { int hash = 1; hash = 37 * hash + name.hashCode(); hash = 37 * hash + labelNames.hashCode(); hash = 37 * hash + labelValues.hashCode(); long d = Double.doubleToLongBits(value); hash = 37 * hash + (int)(d ^ (d >>> 32)); hash = 37 * hash + timestamp.hashCode(); return hash; }

Target:
public int hashCode() { int hash = 1; hash = 37 * hash + name.hashCode(); hash = 37 * hash + labelNames.hashCode(); hash = 37 * hash + labelValues.hashCode(); long d = Double.doubleToLongBits(value); hash = 37 * hash + (int)(d ^ (d >>> 32)); if (timestampMs != null) { hash = 37 * hash + timestampMs.hashCode(); } return hash; }
Source:
public void update(Map<String, ?> props) { if (props != null) { LOGGER.debug("Received an updated set of configurations for the LDAP Login Config."); if (connectionPoolServiceRegistration != null) { connectionPoolServiceRegistration.unregister(); } if (ldapConnectionPool != null) { ldapConnectionPool.close(); } try { LDAPConnectionFactory ldapConnectionFactory = createLdapConnectionFactory( (String) ldapProperties.get(LDAP_URL), Boolean.parseBoolean((String) ldapProperties.get(START_TLS))); ldapConnectionPool = new LDAPConnectionPool(ldapConnectionFactory, id); } catch (LdapException e) { LOGGER.error("Error creating ldap connection factory", e); } Dictionary<String, String> serviceProps = new Hashtable<>(); serviceProps.put("id", id); LOGGER.debug("Registering LdapConnectionPool"); connectionPoolServiceRegistration = context.registerService( LDAPConnectionPool.class.getName(), ldapConnectionPool, serviceProps); Module ldapModule = createLdapModule(props); ldapService.update(ldapModule); } }

Target:
public void update(Map<String, ?> props) { if (props != null) { LOGGER.debug("Received an updated set of configurations for the LDAP Login Config."); if (connectionPoolServiceRegistration != null) { connectionPoolServiceRegistration.unregister(); } if (ldapConnectionPool != null) { ldapConnectionPool.close(); } LDAPConnectionFactory ldapConnectionFactory = createLdapConnectionFactory( (String) ldapProperties.get(LDAP_URL), Boolean.parseBoolean((String) ldapProperties.get(START_TLS))); ldapConnectionPool = new GenericObjectPool<>( new LdapConnectionPooledObjectFactory(ldapConnectionFactory), createGenericPoolConfig(id), createGenericPoolAbandonConfig()); Dictionary<String, String> serviceProps = new Hashtable<>(); serviceProps.put("id", id); LOGGER.debug("Registering LdapConnectionPool"); connectionPoolServiceRegistration = context.registerService( GenericObjectPool.class.getName(), ldapConnectionPool, serviceProps); Module ldapModule = createLdapModule(props); ldapService.update(ldapModule); } }
Source:
public static String createKeyHash(String value) { try { MessageDigest md = MessageDigest.getInstance(HASH_ALGORITHM); byte[] hashed = md.digest(value.getBytes("UTF-8")); StringBuffer stringBuffer = new StringBuffer(); for (int i = 0; i < hashed.length; i++) { stringBuffer.append(Integer.toString((hashed[i] & 0xff) + 0x100, 16) .substring(1)); } return stringBuffer.toString(); } catch (Exception e) { log.error(String.format("Error generating cache key hash. Using unmodified string value: %s", value), e); return value; } }

Target:
public static String createKeyHash(String value) { return BaseEncoding.base16().encode(HASH_ALGORITHM.hashString(value, HASH_CHARSET).asBytes()); }
Source:
public void messageArrived(String topic, MqttMessage message) throws MqttException { String time = new Timestamp(System.currentTimeMillis()).toString(); String payload = new String(message.getPayload()); String messageStr = "onMqttMsg Time: " + time + "\tTopic: " + topic + "\tMessage: " + payload + "\tQoS: " + message.getQos(); log.info(messageStr); try { Message msg = (Message) codec.decode(payload, Message.class); URI uri = new URI(url); inbox.add(msg); END ---------------- } catch (Exception e) { error("tried decoding [%] into a message", payload); } invoke("publishMqttMsg", topic, message.getPayload()); invoke("publishMqttMsgByte", message.getPayload()); invoke("publishMqttMsgString", new String(message.getPayload()), topic); }

Target:
public void messageArrived(String topic, MqttMessage message) throws MqttException { String time = new Timestamp(System.currentTimeMillis()).toString(); String payload = new String(message.getPayload()); String messageStr = "onMqttMsg Time: " + time + "\tTopic: " + topic + "\tMessage: " + payload + "\tQoS: " + message.getQos(); log.info(messageStr); try { Message msg = (Message) codec.decode(payload, Message.class); URI uri = new URI(url); inbox.add(msg); END ---------------- } catch (Exception e) { error("tried decoding [%] into a message", payload); } invoke("publishMqttMsg", topic, message.getPayload()); invoke("publishMqttMsgByte", message.getPayload()); invoke("publishMqttMsgString", topic, new String(message.getPayload())); }
Source:
private boolean compatibilityCheck(Version input) { if(version.major > input.major) return true; else if(version.major < input.major) return false; if(version.minor > input.minor) return true; else if(version.minor < input.minor) return false; if(version.point > input.point) return true; else if(version.point < input.point) return false; else return true; }

Target:
private boolean compatibilityCheck(Version input) { if (targetVersion.major > input.major) return true; else if (targetVersion.major < input.major) return false; if (targetVersion.minor > input.minor) return true; else if (targetVersion.minor < input.minor) return false; if (targetVersion.point > input.point) return true; else if (targetVersion.point < input.point) return false; else return true; }
Source:
public <T> T eval(byte[] script, ReturnType returnType, int numKeys, byte[]... keysAndArgs) { try { byte[][] keys = extractScriptKeys(numKeys, keysAndArgs); byte[][] args = extractScriptArgs(numKeys, keysAndArgs); if (isPipelined()) { pipeline(new LettuceResult(getAsyncConnection().eval(new String(script, "UTF-8"), LettuceConverters.toScriptOutputType(returnType), keys, args), new LettuceEvalResultsConverter<T>(returnType))); return null; } if (isQueueing()) { transaction(new LettuceTxResult(getConnection().eval(new String(script, "UTF-8"), LettuceConverters.toScriptOutputType(returnType), keys, args), new LettuceEvalResultsConverter<T>(returnType))); return null; } return new LettuceEvalResultsConverter<T>(returnType).convert(getConnection().eval(new String(script, "UTF-8"), LettuceConverters.toScriptOutputType(returnType), keys, args)); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }

Target:
public <T> T eval(byte[] script, ReturnType returnType, int numKeys, byte[]... keysAndArgs) { try { byte[][] keys = extractScriptKeys(numKeys, keysAndArgs); byte[][] args = extractScriptArgs(numKeys, keysAndArgs); String convertedScript = LettuceConverters.toString(script); if (isPipelined()) { pipeline(new LettuceResult(getAsyncConnection().eval(convertedScript, LettuceConverters.toScriptOutputType(returnType), keys, args), new LettuceEvalResultsConverter<T>(returnType))); return null; } if (isQueueing()) { transaction(new LettuceTxResult(getConnection().eval(convertedScript, LettuceConverters.toScriptOutputType(returnType), keys, args), new LettuceEvalResultsConverter<T>(returnType))); return null; } return new LettuceEvalResultsConverter<T>(returnType).convert(getConnection().eval(convertedScript, LettuceConverters.toScriptOutputType(returnType), keys, args)); } catch (Exception ex) { throw convertLettuceAccessException(ex); } }
Source:
private void mainLoop() { try { while (!Thread.currentThread().isInterrupted()) { final Notice notice = notices.take(); try { if (notice instanceof RunNotice) { handleRunNotice((RunNotice) notice); } else if (notice instanceof StatusNotice) { handleStatusNotice((StatusNotice) notice); } else if (notice instanceof LocationNotice) { handleLocationNotice((LocationNotice) notice); } } catch (Exception e) { log.makeAlert(e, "Failed to handle notice") .addData("noticeClass", notice.getClass().getSimpleName()) .addData("noticeTaskId", notice.getTaskId()) .emit(); } } } catch (InterruptedException e) { } }

Target:
private void mainLoop() { try { while (!Thread.currentThread().isInterrupted()) { final Notice notice = notices.take(); try { notice.handle(); } catch (Exception e) { log.makeAlert(e, "Failed to handle notice") .addData("noticeClass", notice.getClass().getSimpleName()) .addData("noticeTaskId", notice.getTaskId()) .emit(); } } } catch (InterruptedException e) { log.info("WorkerTaskMonitor interrupted, exiting."); } }
Source:
public void fromJson(JSONObject json) { super.fromJson(json); logger.debug("from json"); if (json.containsKey("approvals")) { logger.debug("approvals"); JSONArray approvals = json.getJSONArray("approvals"); this.approvals = approvals; } }

Target:
public void fromJson(JSONObject json) { super.fromJson(json); if (json.containsKey(AUTHOR)) { account = new Account(json.getJSONObject(AUTHOR)); } if (json.containsKey(APPROVALS)) { JSONArray eventApprovals = json.getJSONArray(APPROVALS); for (int i = 0; i < eventApprovals.size(); i++) { approvals.add(new Approval(eventApprovals.getJSONObject(i))); } } }
Source:
public ParameterDefinition newInstance(@Nullable StaplerRequest req, @Nonnull JSONObject formData) throws FormException { String name = formData.getString("name"); String desc = formData.getString("description"); String choiceText = formData.getString("choices"); ChoiceParameterDefinition parameterDefinition = new ChoiceParameterDefinition(name, desc); parameterDefinition.setChoicesText(choiceText); return parameterDefinition; }

Target:
public ParameterDefinition newInstance(@Nullable StaplerRequest req, @Nonnull JSONObject formData) throws FormException { String name = formData.getString("name"); String desc = formData.getString("description"); String choiceText = formData.getString("choices"); return new ChoiceParameterDefinition(name, choiceText, desc); }
Source:
public void copyDefaultConfigs(File f, boolean forceReset) throws IOException, ConfigurationException { FileCopier copier = new FileCopier(); File oldf; if (isDevBuild() || isDailyBuild()) { oldf = new File (getDefaultHomeDirectory(false) + FILE_SEPARATOR + FILE_CONFIG_NAME); } else { oldf = new File (zapHome + FILE_SEPARATOR + "zap" + FILE_SEPARATOR + FILE_CONFIG_NAME); } if (oldf.exists() && Paths.get(zapHome).equals(Paths.get(getDefaultHomeDirectory(true)))) { LOG.info("Copying defaults from " + oldf.getAbsolutePath() + " to " + FILE_CONFIG); copier.copy(oldf,f); if (isDevBuild() || isDailyBuild()) { ZapXmlConfiguration newConfig = new ZapXmlConfiguration(f); newConfig.setProperty(OptionsParamCheckForUpdates.DOWNLOAD_DIR, Constant.FOLDER_LOCAL_PLUGIN); newConfig.save(); } } else { LOG.info("Copying defaults from " + getPathDefaultConfigFile() + " to " + FILE_CONFIG); copier.copy(getPathDefaultConfigFile().toFile(),f); } }

Target:
public void copyDefaultConfigs(File f, boolean forceReset) throws IOException, ConfigurationException { FileCopier copier = new FileCopier(); File oldf; if (isDevBuild() || isDailyBuild()) { oldf = new File (getDefaultHomeDirectory(false) + FILE_SEPARATOR + FILE_CONFIG_NAME); } else { oldf = new File (zapHome + FILE_SEPARATOR + "zap" + FILE_SEPARATOR + FILE_CONFIG_NAME); } if (!forceReset && oldf.exists() && Paths.get(zapHome).equals(Paths.get(getDefaultHomeDirectory(true)))) { LOG.info("Copying defaults from " + oldf.getAbsolutePath() + " to " + FILE_CONFIG); copier.copy(oldf,f); if (isDevBuild() || isDailyBuild()) { ZapXmlConfiguration newConfig = new ZapXmlConfiguration(f); newConfig.setProperty(OptionsParamCheckForUpdates.DOWNLOAD_DIR, Constant.FOLDER_LOCAL_PLUGIN); newConfig.save(); } } else { LOG.info("Copying defaults from " + getPathDefaultConfigFile() + " to " + FILE_CONFIG); copier.copy(getPathDefaultConfigFile().toFile(),f); } }
Source:
private void generateCommands() throws IOException, TemplateException { for (final Ds3Request request : spec.getRequests()) { generateRequest(request); } if (null != spec.getTypes()) { for ( Map.Entry<String, Ds3Type> typeEntry : spec.getTypes().entrySet()) { System.out.println("Generating Type[" + typeEntry.getKey() + "][" + typeEntry.getValue() + "]"); } } }

Target:
private void generateCommands() throws IOException, TemplateException { for (final Ds3Request request : spec.getRequests()) { generateRequest(request); } if (null != spec.getTypes()) { for (final Map.Entry<String, Ds3Type> typeEntry : spec.getTypes().entrySet()) { System.out.println("Generating Type[" + typeEntry.getKey() + "][" + typeEntry.getValue() + "]"); } } }
Source:
public static boolean isPersonCurrentDepartmentPresident(Person person, Department department) { return getCurrentDepartmentPresidents(department).contains(person); }

Target:
public static boolean isPersonCurrentDepartmentPresident(Person person, Department department) { return getCurrentDepartmentPresidents(department).anyMatch(p -> p.equals(person)); }
Source:
public void VEAndRTEDisabledEditorEntryAnonTests_002_MainEditEntry() { ArticlePageObject article = base.openArticleByName(wikiURL, PageContent.articleNamePrefix + base.getTimeStamp()); VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); }

Target:
public void VEAndRTEDisabledEditorEntryAnonTests_002_MainEditEntry() { ArticlePageObject article = base.openArticleByName(wikiURL, base.getNameForArticle()); VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); }
Source:
public Image getImageFromPlugin(String bundleID, String path) { Optional<ImageDescriptor> desc = ResourceLocator.imageDescriptorFromBundle(bundleID, path); return desc.isPresent() ? get(desc.get()) : getBlankImage(); }

Target:
public Image getImageFromPlugin(String bundleID, String path) { return ResourceLocator.imageDescriptorFromBundle(bundleID, path).map(d-> get(d)).orElse(getBlankImage()); }
Source:
public MessageType getConvertedMessageType() { final MessageType result; if (currentType == null) { result = new MessageType(currentName, new ArrayList<Type>()); } else { GroupType rootType = currentType.asGroupType(); result = new MessageType(currentName, rootType.getFields()); } logger.info("projected fields"); while (!projectedFields.empty()) { logger.info(projectedFields.pop()); } logger.info("\n\ndiscarded fields"); while (!discardedFields.empty()) { logger.info(discardedFields.pop()); } return result; }

Target:
public MessageType getConvertedMessageType() { logger.info("project fields"); for (String path : fieldProjectionFilter.getMatchedPaths()) { logger.info(path); } logger.info("\n\ndiscarded fields"); for (String path : fieldProjectionFilter.getUnmatchedPaths()) { logger.info(path); } if (currentType == null) return new MessageType(currentName, new ArrayList<Type>()); GroupType rootType = currentType.asGroupType(); return new MessageType(currentName, rootType.getFields()); }