auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public FastaReferenceWriterBuilder setFastaOutput(final OutputStream fastaOutput) { this.fastaOutput = fastaOutput; this.fastaFile = null; <START> this.makeGziOutput = false; <END> return this; }</code><technical_language>I get this - restriction writing compressed output a stream, generating accompanying index</technical_language>

Target:
public FastaReferenceWriterBuilder setFastaOutput(final OutputStream fastaOutput) { this.fastaOutput = fastaOutput; this.fastaFile = null; this.gzippedFastaFile = false; this.makeGziOutput = false; return this; }
Source:
<code>public void updateFirstShouldDoNothingWhenCalledForEntitiesThatDoNotExist() { Query q = query(where("id").is(Long.MIN_VALUE)); <START> assumeThat(template.findOne(q, VersionedPerson.class), nullValue()); <END> template.updateFirst(q, Update.update("lastname", "supercalifragilisticexpialidocious"), VersionedPerson.class); assertThat(template.findOne(q, VersionedPerson.class), nullValue()); }</code><technical_language>Do need assumeThat( ) here? a big fan of essentially express: "we expect precondition fail want test fail then" is here, right</technical_language>

Target:
public void updateFirstShouldDoNothingWhenCalledForEntitiesThatDoNotExist() { Query q = query(where("id").is(Long.MIN_VALUE)); template.updateFirst(q, Update.update("lastname", "supercalifragilisticexpialidocious"), VersionedPerson.class); assertThat(template.findOne(q, VersionedPerson.class), nullValue()); }
Source:
<code>public static JsonArray listToJson(List<?> list) { if (list == null) { throw new RuntimeException(CANNOT_CONVERT_NULL_TO_A_JSON_OBJECT); } try { <START> return Json.instance().parse(objectMapper.writeValueAsString(list)); <END> } catch (JsonProcessingException e) { throw new RuntimeException("Error converting list to JSON", e); } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Define throw a dedicated exception instead of a generic one. [![rule](<LINK_2>](<LINK_0></technical_language>

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:
<code>private Map<Integer, Integer> getTypeIndexesPerLevel() { if (this.typeIndexesPerLevel == null) { <START> this.typeIndexesPerLevel = new SmallMap<>(); <END> } return this.typeIndexesPerLevel; }</code><technical_language>forSize(4)</technical_language>

Target:
private Map<Integer, Integer> getTypeIndexesPerLevel() { if (this.typeIndexesPerLevel == null) { this.typeIndexesPerLevel = new HashMap<>(4); } return this.typeIndexesPerLevel; }
Source:
<code>public void testGetCompletionTimesTwoFragmentInteractionP2PAsync() throws Exception { Trace trace1 = new Trace(); trace1.setId("1_2ip2pasync"); <START> trace1.setStartTime(TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()) - 4000); END> 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()); }</code><technical_language>60000 60000000 4000</technical_language>

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:
<code>private String getMessageFrom(Throwable throwable) { <START> String message = ""; <END> if (throwable instanceof RuntimeNodeException) { final RuntimeNodeException rne = (RuntimeNodeException) throwable; message += rne.getUri() + " "; } message += "error=" + throwable.getMessage(); return message; }</code><technical_language>need a local variable, early return instead</technical_language>

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:
<code>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); <START> ignite.cache(cacheName1).indexReadyFuture().get(); <END> assertFalse(indexRebuildCache1.value()); assertTrue(indexRebuildCache2.value()); ((BlockingIndexing)ignite.context().query().getIndexing()).stopBlock(cacheName2); ignite.cache(cacheName2).indexReadyFuture().get(); assertFalse(indexRebuildCache1.value()); assertFalse(indexRebuildCache2.value()); }</code><technical_language>perform get some timeout prevent test hanging</technical_language>

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:
<code>public Object evaluate(SymbolResolver inputs) <START> { <END> checkState(!optimize, "evaluate(int, Page) not allowed for optimizer"); return visitor.process(expression, inputs); }</code><technical_language>I understand this class please explain: this change, difference this evaluate interface optimize one</technical_language>

Target:
public Object evaluate(SymbolResolver inputs) { checkState(!optimize, "evaluate(SymbolResolver) not allowed for optimizer"); return visitor.process(expression, inputs); }
Source:
<code>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(); <START> List<TreeItem> itRootDirs = new DefaultTree(1).getItems(); <END> 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); }</code><technical_language>code line 92</technical_language>

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:
<code>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); <START> return false; <END> } } if (!validate(diskValidator.isUsingScsiReservationValid(getVm(), lunDisk))) { return false; } return true; }</code><technical_language>cleaner way: return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_INVALID);</technical_language>

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:
<code>public void clear() { takeWriteLock(); try { bitmap.clear(); if (internalKeys != null) { internalKeys.clear(); internalKeyCounter = 0; } if (internalObjectKeys != null) { internalObjectKeys.clear(); <START> internalKeyCounter = 0; <END> } } finally { releaseWriteLock(); } }</code><technical_language>In case of "no remapping, raw attribute values long keys" internalKeys internalObjectKeys null reset internalKeyCounter 0</technical_language>

Target:
public void clear() { takeWriteLock(); try { bitmap.clear(); if (internalKeys != null) { internalKeys.clear(); } if (internalObjectKeys != null) { internalObjectKeys.clear(); } internalKeyCounter = 0; } finally { releaseWriteLock(); } }
Source:
<code>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; } <START> } <END> } catch (SQLException e) { throw new DatabaseException(e); } }</code><technical_language>extracting a method (whenever possible, in this case) in place existing method/logic, easier review changes clearer for history</technical_language>

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:
<code>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())); <START> project.getBuildersList().add(new SingleConditionalBuilder(tb2, new AlwaysRun(), new BuildStepRunner.Run())); <END> project.getPublishersList().add(new BuildTrigger(new BuildTriggerConfig(childJobNamesString.toString(), ResultCondition.SUCCESS, new CurrentBuildParameters()))); return project; }</code><technical_language>reuse tb tb2. This onJobRenamed is applied twice. Is this expected</technical_language>

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:
<code>public void checkWorkingWithInstallers() { workspaceDetails.selectTabInWorkspaceMenu(INSTALLERS); <START> workspaceMachines.selectMachine("Workspace Installers", "dev-machine"); <END> 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); }); }</code><technical_language>check appearance of disabled "Workspace API" installers</technical_language>

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:
<code>public Date getOnsetDate() { <START> return onsetDate != null ? (Date) onsetDate.clone() : new Date(); <END> }</code><technical_language>changing original logic of this method</technical_language>

Target:
public Date getOnsetDate() { return onsetDate != null ? (Date) onsetDate.clone() : null; }
Source:
<code>public static Client createClient(ClientConfig config) { Client client = null; synchronized (ClientFactory.class) { if (!m_preserveResources && ++m_activeClientCount == 1) { VoltLogger.startAsynchronousLogging(); EstTimeUpdater.start(); ReverseDNSCache.start(); } } <START> config.enableSSL(); <END> client = new ClientImpl(config, config.getSslContext()); return client; }</code><technical_language>here? this create SSL clients</technical_language>

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:
<code>private WarehouseInstance.Tuple verifyLoad(String tableName, String tableNameOp, String lastReplId) throws Throwable { <START> String[] resultArray = new String[]{"1", "2", "3", "4", "5"}; <END> 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); }</code><technical_language>Is supported</technical_language>

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:
<code>@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()); } }); <START> final String str = "INSERT INTO `EMPS`\n" <END> + "(SELECT *\n" + "FROM `EMPS`)"; assertEquals(linux(sqlNodeVisited.toString()), str); }</code><technical_language>more test actual execution</technical_language>

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:
<code>boolean isPanelValid() { return !StringUtils.isBlank(getConfigPath()) && (getFileSystemName(getConfigPath().substring(0, 3)).equals("NTFS") <START> || getFileSystemName(getConfigPath().substring(0, 3)).equals("exFAT")) END> && ((configureDriveRadioButton.isSelected() && !StringUtils.isBlank(driveList.getSelectedValue())) || (configureFolderRadioButton.isSelected() && (!configFileTextField.getText().isEmpty()))); }</code><technical_language>allowing NTFS exFat is allowing FAT/FAT32</technical_language>

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:
<code>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); <START> PARAM_POOL.setId(Guid.newGuid()); PARAM_POOL.setName("p1"); PARAM_POOL.setRanges(Arrays.asList(range1, range2)); <END> 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()); }</code><technical_language>MacPool p1 = command.getParameters().getMacPool(); p1.setRanges(Arrays.asList(range1, range2));</technical_language>

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:
<code>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()){ <START> Object obj = metaFieldsAndValues.get(key); <END> 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; }</code><technical_language>entrySet in iterator instead of keySet a call getis more efficient</technical_language>

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:
<code>private RuntimeException generateJiraException(int code, String errorMessage) { if (errorMessage.contains("errorMessages")) { errorMessage = errorMessage.substring(errorMessage.indexOf("errorMessages")) .substring(errorMessage.indexOf("[") + 1, errorMessage.lastIndexOf("]")); } <START> return new RuntimeException( <END> "Can't get response from server, error code is " + code + " , error message: " + errorMessage); }</code><technical_language>please throw TalendRuntimeException instead of RuntimeException</technical_language>

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:
<code>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); <START> int whereClauseIndex = sql.indexOf(":where_clause:"); <END> 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); } }</code><technical_language>":where_clause:" 14 sprinkled around, add a constant for both</technical_language>

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:
<code>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)); <START> hash = 37 * hash + timestamp.hashCode(); <END> return hash; }</code><technical_language>this needs wrapped in if (timestamp != null) check</technical_language>

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:
<code>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); <START> } <END> 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); } }</code><technical_language>If throw LdapException means ldapConnectionFactory and/or ldapConnectionPool null... do want register a null object online 127-129? return early this method</technical_language>

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:
<code>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(); <START> } catch (Exception e) { <END> log.error(String.format("Error generating cache key hash. Using unmodified string value: %s", value), e); return value; } }</code><technical_language>Try narrow this down. unclear meant catch invalid input errors hashing process. bet this is covering a useless declared exceptions libraries (e.g., NoSuchAlgorithmException). better, uglier, toss in a throw new RuntimeException(e) happens. (If helps feel code clutter, of a critique of library time do it. "I care if this is important, isn't!") Also, of if Guava's HashFunction interface above</technical_language>

Target:
public static String createKeyHash(String value) { return BaseEncoding.base16().encode(HASH_ALGORITHM.hashString(value, HASH_CHARSET).asBytes()); }
Source:
<code>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()); <START> invoke("publishMqttMsgString", new String(message.getPayload()), topic); <END> }</code><technical_language>Is a reason for this?: publish is topic, payload. is payload string, topic</technical_language>

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:
<code>private boolean compatibilityCheck(Version input) { <START> if(version.major > input.major) <END> 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; }</code><technical_language>return version.major >= input.major ? true : false; ?</technical_language>

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:
<code>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()) { <START> pipeline(new LettuceResult(getAsyncConnection().eval(new String(script, "UTF-8"), LettuceConverters.toScriptOutputType(returnType), <END> 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); } }</code><technical_language>a dedicated converter for in LettuceConverters</technical_language>

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:
<code>private void mainLoop() { try { while (!Thread.currentThread().isInterrupted()) { final Notice notice = notices.take(); try { <START> if (notice instanceof RunNotice) { <END> 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) { } }</code><technical_language>polymorphic deserialization here</technical_language>

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:
<code>public void fromJson(JSONObject json) { super.fromJson(json); logger.debug("from json"); if (json.containsKey("approvals")) { logger.debug("approvals"); <START> JSONArray approvals = json.getJSONArray("approvals"); <END> this.approvals = approvals; } }</code><technical_language>convert this a "cleaner" java object structure. ease future debugging handle modern code completing IDEs</technical_language>

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:
<code>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); <START> parameterDefinition.setChoicesText(choiceText); <END> return parameterDefinition; }</code><technical_language>original constructor</technical_language>

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:
<code><START> public void copyDefaultConfigs(File f, boolean forceReset) throws IOException, ConfigurationException { <END> 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); } }</code><technical_language>argument forceReset used</technical_language>

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:
<code>private void generateCommands() throws IOException, TemplateException { for (final Ds3Request request : spec.getRequests()) { generateRequest(request); } if (null != spec.getTypes()) { <START> for ( Map.Entry<String, Ds3Type> typeEntry : spec.getTypes().entrySet()) { <END> System.out.println("Generating Type[" + typeEntry.getKey() + "][" + typeEntry.getValue() + "]"); } } }</code><technical_language>Extra space '('</technical_language>

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() + "]"); } } }