auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean equals(Object xmlAccountingLineObject) { if (xmlAccountingLineObject instanceof AccountingXmlDocumentAccountingLine) { AccountingXmlDocumentAccountingLine xmlAccountingLine = (AccountingXmlDocumentAccountingLine) xmlAccountingLineObject; return StringUtils.equals(this.chartCode, xmlAccountingLine.getChartCode()) && StringUtils.equals(this.accountNumber, xmlAccountingLine.getAccountNumber()) && StringUtils.equals(this.subAccountNumber, xmlAccountingLine.getSubAccountNumber()) && StringUtils.equals(this.objectCode, xmlAccountingLine.getObjectCode()) && StringUtils.equals(this.subObjectCode, xmlAccountingLine.getSubObjectCode()) && StringUtils.equals(this.projectCode, xmlAccountingLine.getProjectCode()) && StringUtils.equals(this.orgRefId, xmlAccountingLine.getOrgRefId()) && StringUtils.equals(this.lineDescription, xmlAccountingLine.getLineDescription()) && <START> CuKualiDecimalUtils.equals(this.amount, xmlAccountingLine.getAmount()); <END> } return false; }</code><technical_language>I Objects.equals() here, need create CuKualiDecimalUtils</technical_language>

Target:
public boolean equals(Object xmlAccountingLineObject) { if (xmlAccountingLineObject instanceof AccountingXmlDocumentAccountingLine) { AccountingXmlDocumentAccountingLine xmlAccountingLine = (AccountingXmlDocumentAccountingLine) xmlAccountingLineObject; return StringUtils.equals(this.chartCode, xmlAccountingLine.getChartCode()) && StringUtils.equals(this.accountNumber, xmlAccountingLine.getAccountNumber()) && StringUtils.equals(this.subAccountNumber, xmlAccountingLine.getSubAccountNumber()) && StringUtils.equals(this.objectCode, xmlAccountingLine.getObjectCode()) && StringUtils.equals(this.subObjectCode, xmlAccountingLine.getSubObjectCode()) && StringUtils.equals(this.projectCode, xmlAccountingLine.getProjectCode()) && StringUtils.equals(this.orgRefId, xmlAccountingLine.getOrgRefId()) && StringUtils.equals(this.lineDescription, xmlAccountingLine.getLineDescription()) && ObjectUtils.equals(this.amount, xmlAccountingLine.getAmount()); } return false; }
Source:
<code>private File selectImportFile() { JFileChooser chooser = new JFileChooser(Constant.getContextsDir()); <START> File file = null; <END> int rc = chooser.showOpenDialog(View.getSingleton().getMainFrame()); if (rc == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); if (file == null || !file.exists()) { return null; } return file; } return null; }</code><technical_language>declared later</technical_language>

Target:
private File selectImportFile() { JFileChooser chooser = new JFileChooser(); int rc = chooser.showOpenDialog(this.owner); if (rc == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (file == null || !file.exists()) { return null; } return file; } return null; }
Source:
<code>private InterpreterResult appendSessionExpire(InterpreterResult result, boolean sessionExpired) { if (sessionExpired) { InterpreterResult result2 = new InterpreterResult(result.code()); result2.add(InterpreterResult.Type.HTML, "<font color=\"red\">Previous session is expired, new session is created. " + <START> "Paragraphes that depend on this paragraph need to be re-executed !" + "</font>"); <END> for (InterpreterResultMessage message : result.message()) { result2.add(message.getType(), message.getData()); } return result2; } else { return result; } }</code><technical_language>I Paragraphs. Also, remove space</technical_language>

Target:
private InterpreterResult appendSessionExpire(InterpreterResult result, boolean sessionExpired) { if (sessionExpired) { InterpreterResult result2 = new InterpreterResult(result.code()); result2.add(InterpreterResult.Type.HTML, "<font color=\"red\">Previous livy session is expired, new livy session is created. " + "Paragraphs that depend on this paragraph need to be re-executed!" + "</font>"); for (InterpreterResultMessage message : result.message()) { result2.add(message.getType(), message.getData()); } return result2; } else { return result; } }
Source:
<code>public String getUrl() { <START> return null; END> }</code><technical_language>If this is want throw UnsupportedOperationException</technical_language>

Target:
public String getUrl() { throw new UnsupportedOperationException(); }
Source:
<code>public boolean matchStage(StageConfigIdentifier stageIdentifier, StageEvent event) { boolean anyPipelineAndStage = this.pipelineName.equals(GoConstants.ANY_PIPELINE) && this.stageName.equals(GoConstants.ANY_STAGE); if(anyPipelineAndStage && this.event.include(event)) { return true; } <START> else { <END> return stageIdentifier.getPipelineName().equals(pipelineName) && (stageIdentifier.getStageName().equals(stageName) || stageName.equals(GoConstants.ANY_STAGE)) && this.event.include(event); } }</code><technical_language>This else is redundant</technical_language>

Target:
public boolean matchStage(StageConfigIdentifier stageIdentifier, StageEvent event) { boolean anyPipelineAndStage = this.pipelineName.equals(GoConstants.ANY_PIPELINE) && this.stageName.equals(GoConstants.ANY_STAGE); if (anyPipelineAndStage && this.event.include(event)) { return true; } return stageIdentifier.getPipelineName().equals(pipelineName) && (stageIdentifier.getStageName().equals(stageName) || stageName.equals(GoConstants.ANY_STAGE)) && this.event.include(event); }
Source:
<code>public boolean isReading() { <START> return reading == true || (!writing && isSimpleSourceType()); <END> }</code><technical_language>simplify return reading || (!writing && isSimpleSourceType());</technical_language>

Target:
public boolean isReading() { return reading || (!writing && isSimpleSourceType()); }
Source:
<code>public void setTotalDiskSize(Integer value) { <START> value = (value == null) ? new Integer(0) : value; <END> if (!totalDiskSize.equals(value)) { totalDiskSize = value; } }</code><technical_language>This produce a Number Constructor FindBugs warning. Please Integer.valueOf(0)</technical_language>

Target:
public void setTotalDiskSize(Integer value) { value = (value == null) ? Integer.valueOf(0) : value; if (!totalDiskSize.equals(value)) { totalDiskSize = value; } }
Source:
<code>public void post_commands_in_bulk() { final Command first = newCommand(); final Command second = newCommand(); final List<Command> commands = newArrayList(first, second); commandBus.unregister(createProjectHandler); <START> commandBus.register(createProjectHandler); <END> final CommandBus spy = spy(commandBus); spy.post(commands, StreamObservers.<Response>noOpObserver()); final ArgumentCaptor<Command> storingCaptor = forClass(Command.class); verify(spy, times(2)).store(storingCaptor.capture()); final List<Command> storingArgs = storingCaptor.getAllValues(); assertSize(commands.size(), storingArgs); assertContainsAll(storingArgs, first, second); final ArgumentCaptor<CommandEnvelope> postingCaptor = forClass(CommandEnvelope.class); verify(spy, times(2)).doPost(postingCaptor.capture()); final List<CommandEnvelope> postingArgs = postingCaptor.getAllValues(); assertSize(commands.size(), postingArgs); assertEquals(commands.get(0), postingArgs.get(0).getCommand()); assertEquals(commands.get(1), postingArgs.get(1).getCommand()); commandBus.unregister(createProjectHandler); }</code><technical_language>Please explain unregister register thing</technical_language>

Target:
public void post_commands_in_bulk() { final Command first = newCommand(); final Command second = newCommand(); final List<Command> commands = newArrayList(first, second); commandBus.unregister(createProjectHandler); commandBus.register(createProjectHandler); final CommandBus spy = spy(commandBus); spy.post(commands, StreamObservers.<IsSent>memoizingObserver()); @SuppressWarnings("unchecked") final ArgumentCaptor<Iterable<Command>> storingCaptor = forClass(Iterable.class); verify(spy).store(storingCaptor.capture()); final Iterable<Command> storingArgs = storingCaptor.getValue(); assertSize(commands.size(), storingArgs); assertContainsAll(storingArgs, first, second); final ArgumentCaptor<CommandEnvelope> postingCaptor = forClass(CommandEnvelope.class); verify(spy, times(2)).doPost(postingCaptor.capture()); final List<CommandEnvelope> postingArgs = postingCaptor.getAllValues(); assertSize(commands.size(), postingArgs); assertEquals(commands.get(0), postingArgs.get(0).getCommand()); assertEquals(commands.get(1), postingArgs.get(1).getCommand()); commandBus.unregister(createProjectHandler); }
Source:
<code>private <ID extends Serializable> ResponseEntity<ResourceSupport> uploadInternal(HttpServletRequest request, String apiCategory, String model, ID id, MultipartFile uploadfile) { checkModelPluralForm(apiCategory, model); DSpaceRestRepository<RestAddressableModel, ID> repository = utils.getResourceRepository(apiCategory, model); RestAddressableModel modelObject = null; try { modelObject = repository.upload(request, apiCategory, model, id, uploadfile); } catch (SQLException | IOException e) { <START> throw new RuntimeException(e.getMessage(), e); <END> } catch ( AuthorizeException ae) { throw new RESTAuthorizationException(ae); } DSpaceResource result = converter.toResource(modelObject); return ControllerUtils.toResponseEntity(HttpStatus.CREATED, new HttpHeaders(), result); }</code><technical_language>Tiny thing, this throw new RuntimeException(e); providing a more descriptive error message, reason for e.getMessage() here</technical_language>

Target:
private <ID extends Serializable> ResponseEntity<ResourceSupport> uploadInternal(HttpServletRequest request, String apiCategory, String model, ID id, MultipartFile uploadfile) { checkModelPluralForm(apiCategory, model); DSpaceRestRepository<RestAddressableModel, ID> repository = utils.getResourceRepository(apiCategory, model); RestAddressableModel modelObject = null; try { modelObject = repository.upload(request, apiCategory, model, id, uploadfile); } catch (SQLException | IOException e) { throw new RuntimeException("Error " + e.getMessage() + " uploading file to " + model + " with ID= " + id, e); } catch ( AuthorizeException ae) { throw new RESTAuthorizationException(ae); } DSpaceResource result = converter.toResource(modelObject); return ControllerUtils.toResponseEntity(HttpStatus.CREATED, new HttpHeaders(), result); }
Source:
<code>boolean verify(char[] guess) throws InvalidKeyException { ByteBuffer guessAsBuffer = StandardCharsets.UTF_8.encode(CharBuffer.wrap(guess)); byte[] guessAsBytes = new byte[guessAsBuffer.remaining()]; <START> guessAsBuffer.get(guessAsBytes); <END> byte[] output = bcrypt(this.iterationCount, this.getSalt(), guessAsBytes); return Arrays.equals(this.hash, output); }</code><technical_language>Hard if this is new String(guess).getBytes(UTF_8)..</technical_language>

Target:
boolean verify(char[] guess) throws InvalidKeyException { byte[] output = bcrypt(this.iterationCount, this.getSalt(), getNormalizedPasswordBytes(guess)); return Arrays.equals(this.hash, output); }
Source:
<code>@Test public void findByByIosClassChainTest() { assertNotEquals(driver <START> .findElementByIosClassChain("XCUIElementTypeWindow XCUIElementTypeButton") .size(), 0); }</code><technical_language>**/XCUIElementTypeButton</technical_language>

Target:
@Test public void findByByIosClassChainTest() { assertNotEquals(driver .findElementByIosClassChain("**/XCUIElementTypeButton") .getText(), null); assertNotEquals(driver .findElementsByIosClassChain("**/XCUIElementTypeButton") .size(), 0); }
Source:
<code>protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { final boolean debug = this.logger.isDebugEnabled(); String token; try { token = this.bearerTokenResolver.resolve(request); } catch ( OAuth2AuthenticationException invalid ) { this.authenticationEntryPoint.commence(request, response, invalid); return; <START> } catch ( Exception unexpected ) { <END> this.logger.error("An unexpected error occured when trying to parse the request for the bearer token." + " Will let one of the other filters try.", unexpected); filterChain.doFilter(request, response); return; } if (token == null) { filterChain.doFilter(request, response); return; } BearerTokenAuthenticationToken authenticationRequest = new BearerTokenAuthenticationToken(token); authenticationRequest.setDetails(this.authenticationDetailsSource.buildDetails(request)); try { Authentication authenticationResult = this.authenticationManager.authenticate(authenticationRequest); SecurityContext context = SecurityContextHolder.createEmptyContext(); context.setAuthentication(authenticationResult); SecurityContextHolder.setContext(context); filterChain.doFilter(request, response); } catch (AuthenticationException failed) { SecurityContextHolder.clearContext(); if (debug) { this.logger.debug("Authentication request for failed: " + failed); } this.authenticationEntryPoint.commence(request, response, failed); } }</code><technical_language>do continue processing filter chain here? expect this fails. If expecting this a normal flow log error</technical_language>

Target:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { final boolean debug = this.logger.isDebugEnabled(); String token; try { token = this.bearerTokenResolver.resolve(request); } catch ( OAuth2AuthenticationException invalid ) { this.authenticationEntryPoint.commence(request, response, invalid); return; } if (token == null) { filterChain.doFilter(request, response); return; } BearerTokenAuthenticationToken authenticationRequest = new BearerTokenAuthenticationToken(token); authenticationRequest.setDetails(this.authenticationDetailsSource.buildDetails(request)); try { Authentication authenticationResult = this.authenticationManager.authenticate(authenticationRequest); SecurityContext context = SecurityContextHolder.createEmptyContext(); context.setAuthentication(authenticationResult); SecurityContextHolder.setContext(context); filterChain.doFilter(request, response); } catch (AuthenticationException failed) { SecurityContextHolder.clearContext(); if (debug) { this.logger.debug("Authentication request for failed: " + failed); } this.authenticationEntryPoint.commence(request, response, failed); } }
Source:
<code>public void connectionClosed() { synchronized (clientHandles) { if (--refCount == 0) { clientHandles.remove(this.url); } <START> ; <END> } }</code><technical_language>remove semicolon</technical_language>

Target:
public void connectionClosed() { synchronized (clientHandles) { if (--refCount == 0) { clientHandles.remove(this.url); } } }
Source:
<code>public void testDeleteServerDeleteMutationPlan() throws Exception { String tableName = generateUniqueName(); String indexName = generateUniqueName(); String tagValue = "customer-delete"; String delete = "DELETE FROM " + tableName; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(ConnectionQueryServices.SOURCE_OPERATION_ATTRIB, tagValue); createAndUpsertTable(tableName, indexName, props); <START> verifyDeletePlan(delete, "ServerSelectDeleteMutationPlan", props); <END> executeDelete(delete, props, 2); String startRowKeyForBaseTable = "1"; String startRowKeyForIndexTable = "foo"; checkTagPresentInDeleteMarker(tableName, startRowKeyForBaseTable, true, tagValue); checkTagPresentInDeleteMarker(indexName, startRowKeyForIndexTable, false, null); }</code><technical_language>hardcode string, class name</technical_language>

Target:
public void testDeleteServerDeleteMutationPlan() throws Exception { String tableName = generateUniqueName(); String indexName = generateUniqueName(); String tagValue = "customer-delete"; String delete = "DELETE FROM " + tableName; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(ConnectionQueryServices.SOURCE_OPERATION_ATTRIB, tagValue); createAndUpsertTable(tableName, indexName, props); verifyDeletePlan(delete, DeleteCompiler.ServerSelectDeleteMutationPlan.class, props); executeDelete(delete, props, 2); String startRowKeyForBaseTable = "1"; String startRowKeyForIndexTable = "foo"; checkTagPresentInDeleteMarker(tableName, startRowKeyForBaseTable, true, tagValue); checkTagPresentInDeleteMarker(indexName, startRowKeyForIndexTable, false, null); }
Source:
<code>void endTransaction(Transaction t, boolean hasChanges) { t.closeIt(); int txId = t.transactionId; transactions.set(txId, null); boolean success; do { VersionedBitSet original = openTransactions.get(); assert original.get(txId); VersionedBitSet clone = original.clone(); clone.clear(txId); success = openTransactions.compareAndSet(original, clone); } while(!success); if (hasChanges) { boolean wasStored = t.wasStored; if (wasStored && !preparedTransactions.isClosed()) { preparedTransactions.remove(txId); } if (wasStored || store.getAutoCommitDelay() == 0) { store.tryCommit(); } else { boolean empty = true; BitSet openTrans = openTransactions.get(); for (int i = openTrans.nextSetBit(0); empty && i >= 0; i = openTrans.nextSetBit(i + 1)) { MVMap<Long, Object[]> undoLog = undoLogs[i]; if (undoLog != null) { <START> empty = undoLog.isEmpty(); <END> } } if (empty) { int unsaved = store.getUnsavedMemory(); int max = store.getAutoCommitMemory(); if (unsaved * 4 > max * 3) { store.tryCommit(); } } } } }</code><technical_language>replace Java if (undoLog != null && !undoLog.isEmpty) { return; } remove empty variable</technical_language>

Target:
void endTransaction(Transaction t, boolean hasChanges) { t.closeIt(); int txId = t.transactionId; transactions.set(txId, null); boolean success; do { VersionedBitSet original = openTransactions.get(); assert original.get(txId); VersionedBitSet clone = original.clone(); clone.clear(txId); success = openTransactions.compareAndSet(original, clone); } while(!success); if (hasChanges) { boolean wasStored = t.wasStored; if (wasStored && !preparedTransactions.isClosed()) { preparedTransactions.remove(txId); } if (wasStored || store.getAutoCommitDelay() == 0) { store.tryCommit(); } else { if (isUndoEmpty()) { int unsaved = store.getUnsavedMemory(); int max = store.getAutoCommitMemory(); if (unsaved * 4 > max * 3) { store.tryCommit(); } } } } }
Source:
<code>public void handleSoundSettings(Command command, ChannelUID channelUID) throws IOException { if (command instanceof RefreshType) { try { logger.debug("SrsZr5Handler handleSoundSettings RefreshType"); Map<String, String> result = sound_settings_cache.getValue(); if (result != null) { <START> logger.debug("SrsZr5Handler Updateing sound field to {}", result.get("clearAudio"), <END> result.get("soundField")); if (result.get("clearAudio").equalsIgnoreCase("on")) { updateState(channelUID, new StringType("clearAudio")); } else { updateState(channelUID, new StringType(result.get("soundField"))); } } } catch (CompletionException ex) { throw new IOException(ex.getCause()); } } if (command instanceof StringType) { if (((StringType) command).toString().equalsIgnoreCase("clearAudio")) { connection.setSoundSettings("clearAudio", "on"); } else { connection.setSoundSettings("soundField", ((StringType) command).toString()); } } }</code><technical_language>typo: Updateing -> Updating</technical_language>

Target:
public void handleSoundSettings(Command command, ChannelUID channelUID) throws IOException { if (command instanceof RefreshType) { try { logger.debug("SrsZr5Handler handleSoundSettings RefreshType"); Map<String, String> result = soundSettingsCache.getValue(); if (result != null) { logger.debug("SrsZr5Handler Updating sound field to {}", result.get("clearAudio"), result.get("soundField")); if (result.get("clearAudio").equalsIgnoreCase("on")) { updateState(channelUID, new StringType("clearAudio")); } else { updateState(channelUID, new StringType(result.get("soundField"))); } } } catch (CompletionException ex) { throw new IOException(ex.getCause()); } } if (command instanceof StringType) { if (((StringType) command).toString().equalsIgnoreCase("clearAudio")) { connection.setSoundSettings("clearAudio", "on"); } else { connection.setSoundSettings("soundField", ((StringType) command).toString()); } } }
Source:
<code>public void testNoDifference(final Comparison comparison, final CompareTestSupport support) { final List<Diff> differences = comparison.getDifferences(); final EList<Conflict> conflicts = comparison.getConflicts(); final Resource originResource = support.getAncestorResource(); final Resource leftResource = support.getLeftResource(); final Resource rightResource = support.getRightResource(); assertNoMigration(originResource); assertNoMigration(leftResource); assertNoMigration(rightResource); assertMigratedStructure(originResource, true, <START> "This is just for testing."); <END> assertMigratedStructure(leftResource, true, "This is just for testing."); assertMigratedStructure(rightResource, true, "This is just for testing."); assertTrue("Unexpected conflicts: " + conflicts, conflicts.isEmpty()); assertTrue("Unexpected differences: " + differences, differences.isEmpty()); }</code><technical_language>introduce a constant for this string</technical_language>

Target:
public void testNoDifference(final Comparison comparison, final CompareTestSupport support) { final List<Diff> differences = comparison.getDifferences(); final EList<Conflict> conflicts = comparison.getConflicts(); final Resource originResource = support.getAncestorResource(); final Resource leftResource = support.getLeftResource(); final Resource rightResource = support.getRightResource(); assertNoMigration(originResource); assertNoMigration(leftResource); assertNoMigration(rightResource); assertMigratedStructure(originResource, BLOCK_ISENCAPSULATED, VIEWPOINT_PURPOSE); assertMigratedStructure(leftResource, BLOCK_ISENCAPSULATED, VIEWPOINT_PURPOSE); assertMigratedStructure(rightResource, BLOCK_ISENCAPSULATED, VIEWPOINT_PURPOSE); assertTrue("Unexpected conflicts: " + conflicts, conflicts.isEmpty()); assertTrue("Unexpected differences: " + differences, differences.isEmpty()); }
Source:
<code><START> public Map<String, ComponentMetrics> get(String... desiredBoltNames) { <END> Map<String, ComponentMetrics> result = new HashMap<>(); Set<String> boltNameFilter = new HashSet<>(); if (desiredBoltNames.length > 0) { boltNameFilter.addAll(Arrays.asList(desiredBoltNames)); } String[] boltComponents = topologyProvider.getBoltNames(); for (String boltComponent : boltComponents) { if (!boltNameFilter.isEmpty() && !boltNameFilter.contains(boltComponent)) { continue; } String[] boltInstanceNames = packingPlanProvider.getBoltInstanceNames(boltComponent); Map<String, InstanceMetrics> instanceMetrics = new HashMap<>(); for (String boltInstanceName : boltInstanceNames) { String metric = BUFFER_SIZE + boltInstanceName + BUFFER_SIZE_SUFFIX; Map<String, ComponentMetrics> stmgrResult = metricsProvider.getComponentMetrics( metric, getDuration(BufferSizeSensor.class.getSimpleName()), HealthMgrConstants.COMPONENT_STMGR); HashMap<String, InstanceMetrics> streamManagerResult = stmgrResult.get(HealthMgrConstants.COMPONENT_STMGR).getMetrics(); double stmgrInstanceResult = streamManagerResult.values().iterator().next().getMetricValueSum(metric); InstanceMetrics boltInstanceMetric = new InstanceMetrics(boltInstanceName, BUFFER_SIZE, stmgrInstanceResult); instanceMetrics.put(boltInstanceName, boltInstanceMetric); } ComponentMetrics componentMetrics = new ComponentMetrics(boltComponent, instanceMetrics); result.put(boltComponent, componentMetrics); } return result; }</code><technical_language>this private? for other non-override methods in other sensor classes</technical_language>

Target:
public Map<String, ComponentMetrics> get(String... desiredBoltNames) { Map<String, ComponentMetrics> result = new HashMap<>(); Set<String> boltNameFilter = new HashSet<>(); if (desiredBoltNames.length > 0) { boltNameFilter.addAll(Arrays.asList(desiredBoltNames)); } String[] boltComponents = topologyProvider.getBoltNames(); for (String boltComponent : boltComponents) { if (!boltNameFilter.isEmpty() && !boltNameFilter.contains(boltComponent)) { continue; } String[] boltInstanceNames = packingPlanProvider.getBoltInstanceNames(boltComponent); Map<String, InstanceMetrics> instanceMetrics = new HashMap<>(); for (String boltInstanceName : boltInstanceNames) { String metric = this.metricName + boltInstanceName + BUFFER_SIZE_SUFFIX; Map<String, ComponentMetrics> stmgrResult = metricsProvider.getComponentMetrics( metric, getDuration(BufferSizeSensor.class.getSimpleName()), HealthMgrConstants.COMPONENT_STMGR); HashMap<String, InstanceMetrics> streamManagerResult = stmgrResult.get(HealthMgrConstants.COMPONENT_STMGR).getMetrics(); double stmgrInstanceResult = streamManagerResult.values().iterator().next().getMetricValueSum(metric); InstanceMetrics boltInstanceMetric = new InstanceMetrics(boltInstanceName, this.metricName, stmgrInstanceResult); instanceMetrics.put(boltInstanceName, boltInstanceMetric); } ComponentMetrics componentMetrics = new ComponentMetrics(boltComponent, instanceMetrics); result.put(boltComponent, componentMetrics); } return result; }
Source:
<code>public ModeledSegment(final SimpleInterval interval, final String call, final long originalProbeCount, final double segmentMeanInLogCR) { this.simpleInterval = Utils.nonNull(interval, "The input interval cannot be null"); this.call = Utils.nonNull(call, String.format("The input call cannot be null. Use empty string, instead (\"%s\")", NO_CALL)); <START> this.segmentMean = ParamUtils.isFinite(segmentMeanInLogCR, "Segment Mean must be a finite."); <END> this.originalProbeCount = ParamUtils.isPositiveOrZero(originalProbeCount, "Number of original probes must be positive or zero."); }</code><technical_language>Extraneous 'a'</technical_language>

Target:
public ModeledSegment(final SimpleInterval interval, final String call, final long originalProbeCount, final double segmentMeanInLogCR) { this.simpleInterval = Utils.nonNull(interval, "The input interval cannot be null"); this.call = Utils.nonNull(call, String.format("The input call cannot be null. Use empty string, instead (\"%s\")", NO_CALL)); this.segmentMean = ParamUtils.isFinite(segmentMeanInLogCR, "Segment Mean must be finite."); this.originalProbeCount = ParamUtils.isPositiveOrZero(originalProbeCount, "Number of original probes must be positive or zero."); }
Source:
<code>static OverlapDetector<Chain> loadChains(final BufferedLineReader reader, String sourceName) { final OverlapDetector<Chain> ret = new OverlapDetector<Chain>(0, 0); Chain chain; while ((chain = Chain.loadChain(reader, sourceName)) != null) { ret.addLhs(chain, chain.interval); } <START> reader.close(); <END> return ret; }</code><technical_language>BufferedReader is passed in instead of opened method, this longer closed here. caller is responsible for that</technical_language>

Target:
static OverlapDetector<Chain> loadChains(final BufferedLineReader reader, String sourceName) { final OverlapDetector<Chain> ret = new OverlapDetector<Chain>(0, 0); Chain chain; while ((chain = Chain.loadChain(reader, sourceName)) != null) { ret.addLhs(chain, chain.interval); } return ret; }
Source:
<code>public int pickBiome(int x, int y, int z, long seed) { tempBase.setSeed((int) seed*3); moistBase.setSeed((int) seed^2); int biome = 99; VanillaBiomeType biomes[] = {VanillaBiomes.DESERT, VanillaBiomes.JUNGLE, VanillaBiomes.MOUNTAIN, VanillaBiomes.MUSHROOM, VanillaBiomes.OCEAN, VanillaBiomes.PLAIN, VanillaBiomes.SWAMP, VanillaBiomes.TAIGA, VanillaBiomes.TUNDRA};; for(VanillaBiomeType b : biomes) { if(b.isValidPlacement(tempBase.GetValue(x, y, z)*100.0, moistBase.GetValue(x, y, z)*100.0)) { <START> biome = b.getBiomeId(); <END> } } return biome; }</code><technical_language>Biome IDs for vanilla protocol. BiomeSelectors do biome selecting a bit of refactoring</technical_language>

Target:
public int pickBiome(int x, int y, int z, long seed) { base.setSeed((int) seed); noise.setSeed((int) seed); return (int) (noise.GetValue(x / 256.0 + 0.05, y + 0.05, z / 256.0 + 0.05) * 64); }
Source:
<code>void serializeForWhere(QueryMetadata metadata) { boolean requireSchemaInWhere = templates.isRequiresSchemaInWhere(); if (requireSchemaInWhere) { dmlWithSchema = true; } append(templates.getWhere()).handle(metadata.getWhere()); if (requireSchemaInWhere) { <START> dmlWithSchema = false; <END> } }</code><technical_language>safer store of dmlWithSchema, restore here</technical_language>

Target:
void serializeForWhere(QueryMetadata metadata) { boolean requireSchemaInWhere = templates.isRequiresSchemaInWhere(); boolean originalDmlWithSchema = dmlWithSchema; if (requireSchemaInWhere) { dmlWithSchema = true; } append(templates.getWhere()).handle(metadata.getWhere()); if (requireSchemaInWhere) { dmlWithSchema = originalDmlWithSchema; } }
Source:
<code>public FabricConfiguration(FabricWorldEdit mod) { <START> super(new File(mod.getWorkingDir() + File.separator + "worldedit.properties")); <END> }</code><technical_language>new File(mod.getWorkingDir(), "worldedit.properties")</technical_language>

Target:
public FabricConfiguration(FabricWorldEdit mod) { super(new File(mod.getWorkingDir(), "worldedit.properties")); }
Source:
<code><START> public GridCacheDataStore createGridCacheDataStore( <END> CacheGroupContext grpCtx, int partId, boolean exists, IgniteLogger log ) { return new GridCacheDataStore( grpCtx, partId, true, busyLock, log ); }</code><technical_language>Please, reuse for createCacheDataStore0</technical_language>

Target:
public GridCacheDataStore createGridCacheDataStore( CacheGroupContext grpCtx, int partId, boolean exists, IgniteLogger log ) { return new GridCacheDataStore( grpCtx, partId, exists, busyLock, log ); }
Source:
<code>public DefaultResilienceStrategyConfiguration bind(RecoveryStore<?> store, CacheLoaderWriter<?, ?> loaderWriter) { <START> Object[] arguments = getArguments(); <END> Object[] boundArguments = Arrays.copyOf(arguments, arguments.length + 2); boundArguments[arguments.length] = store; boundArguments[arguments.length + 1] = loaderWriter; return new BoundConfiguration(getClazz(), boundArguments); }</code><technical_language>This argument passing is ugly I guess is is..</technical_language>

Target:
public DefaultResilienceStrategyConfiguration bind(RecoveryStore<?> store, CacheLoaderWriter<?, ?> loaderWriter) throws IllegalStateException { if (getInstance() == null) { Object[] arguments = getArguments(); Object[] boundArguments = Arrays.copyOf(arguments, arguments.length + 2); boundArguments[arguments.length] = store; boundArguments[arguments.length + 1] = loaderWriter; return new BoundConfiguration(getClazz(), boundArguments); } else { return this; } }
Source:
<code>public void verifyResendPublishedEmailButtonDoesNotExist(String courseId, String evalName) { int rowId = getEvaluationRowId(courseId, evalName); waitForElementPresence(By.id("session" + rowId)); WebElement sessionRow = browser.driver.findElement(By.id("session" + rowId)); String resendLinksClassNamePrefix = "session-resend-published-email-for-test"; <START> verifyElementDoesNotContainsElement(sessionRow, By.className(resendLinksClassNamePrefix)); <END> }</code><technical_language>summarise lines: java WebElement sessionRow = waitForElementPresence(By.id("session" + getEvaluationRowId(courseId, evalName))); verifyElementDoesNotContainElement(sessionRow, By.className("session-resend-published-email-for-test"));</technical_language>

Target:
public void verifyResendPublishedEmailButtonDoesNotExist(String courseId, String evalName) { WebElement sessionRow = waitForElementPresence(By.id("session" + getEvaluationRowId(courseId, evalName))); verifyElementDoesNotContainElement(sessionRow, By.className("session-resend-published-email-for-test")); }
Source:
<code>private void addPersistentWatches(String clientPath, Set<Watcher> result) { synchronized (persistentWatches) { PathIterator pathIterator = new PathIterator(clientPath); <START> while (pathIterator.hasNext()) { <END> addTo(persistentWatches.get(pathIterator.next()), result); } } }</code><technical_language>If change PathIterator implement Iterable Iterator (see below) this line be: for (String path: pathIterator) { addTo(persistentWatches.get(path), result); }</technical_language>

Target:
private void addPersistentWatches(String clientPath, Set<Watcher> result) { synchronized (persistentWatches) { addTo(persistentWatches.get(clientPath), result); } synchronized (persistentRecursiveWatches) { for (String path : PathParentIterator.forAll(clientPath).asIterable()) { addTo(persistentRecursiveWatches.get(path), result); } } }
Source:
<code>public final void disconnect(ConnectionAnchor anchor) { boolean disconnected = false; boolean wasConnected = isConnected(); if (startAnchor.isPresent() && startAnchor.get().equals(anchor)) { startAnchor = Optional.empty(); disconnected = true; } else if (endAnchor.isPresent() && endAnchor.get().equals(anchor)) { endAnchor = Optional.empty(); disconnected = true; } <START> if(disconnected) { <END> removeListeners(anchor); anchor.disconnectConnection(this); if (wasConnected) { ConnectionCreationManager.nextConnectionState(); anchor.getBlock().setConnectionState(ConnectionCreationManager.getConnectionState()); startAnchor.ifPresent(a -> a.getBlock().setConnectionState(ConnectionCreationManager.getConnectionState())); endAnchor.ifPresent(a -> a.getBlock().setConnectionState(ConnectionCreationManager.getConnectionState())); this.setErrorState(false); } } }</code><technical_language>Space (</technical_language>

Target:
public final void disconnect(ConnectionAnchor anchor) { boolean disconnected = false; boolean wasConnected = isConnected(); if (startAnchor.isPresent() && startAnchor.get().equals(anchor)) { startAnchor = Optional.empty(); disconnected = true; } else if (endAnchor.isPresent() && endAnchor.get().equals(anchor)) { endAnchor = Optional.empty(); disconnected = true; } if (disconnected) { removeListeners(anchor); anchor.disconnectConnection(this); if (wasConnected) { int state = ConnectionCreationManager.nextConnectionState(); anchor.getBlock().setConnectionState(state); startAnchor.ifPresent(a -> a.getBlock().setConnectionState(state)); endAnchor.ifPresent(a -> a.getBlock().setConnectionState(state)); this.setErrorState(false); } } }
Source:
<code>public RemoveNetworksModel(ListModel sourceListModel) { this.sourceListModel = sourceListModel; setTitle(ConstantsManager.getInstance().getConstants().removeLogicalNetworkTitle()); setHelpTag(HelpTag.remove_logical_network); setHashName("remove_logical_network"); ArrayList<String> list = new ArrayList<>(); Set<Guid> externalProviderIds = new HashSet(); for (Network network : (Iterable<Network>) sourceListModel.getSelectedItems()) { if (network instanceof NetworkView) { NetworkView netView = (NetworkView) network; if (netView.getDescription() == null || netView.getDescription().trim().equals("")) { list.add(ConstantsManager.getInstance() .getMessages() .networkDc(netView.getName(), netView.getDataCenterName())); } else { list.add(ConstantsManager.getInstance() .getMessages() .networkDcDescription(netView.getName(), netView.getDataCenterName(), netView.getDescription())); } } else { if (network.getDescription() == null || "".equals(network.getDescription().trim())) { list.add(network.getName()); } else { list.add(StringFormat.format("%1$s (%2$s)", network.getName(), network.getDescription())); } } if (network.isExternal()) { externalProviderIds.add(network.getProvidedBy().getProviderId()); } } setItems(list); <START> adjustRemoveExternalForNetworkReadOnlyProperty(externalProviderIds); <END> UICommand tempVar = UICommand.createDefaultOkUiCommand("onRemove", this); getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("cancel", this); getCommands().add(tempVar2); }</code><technical_language>typo</technical_language>

Target:
public RemoveNetworksModel(ListModel sourceListModel) { this.sourceListModel = sourceListModel; setTitle(ConstantsManager.getInstance().getConstants().removeLogicalNetworkTitle()); setHelpTag(HelpTag.remove_logical_network); setHashName("remove_logical_network"); ArrayList<String> list = new ArrayList<>(); Set<Guid> externalProviderIds = new HashSet(); for (Network network : (Iterable<Network>) sourceListModel.getSelectedItems()) { if (network instanceof NetworkView) { NetworkView netView = (NetworkView) network; if (netView.getDescription() == null || netView.getDescription().trim().equals("")) { list.add(ConstantsManager.getInstance() .getMessages() .networkDc(netView.getName(), netView.getDataCenterName())); } else { list.add(ConstantsManager.getInstance() .getMessages() .networkDcDescription(netView.getName(), netView.getDataCenterName(), netView.getDescription())); } } else { if (network.getDescription() == null || "".equals(network.getDescription().trim())) { list.add(network.getName()); } else { list.add(StringFormat.format("%1$s (%2$s)", network.getName(), network.getDescription())); } } if (network.isExternal()) { externalProviderIds.add(network.getProvidedBy().getProviderId()); } } setItems(list); adjustRemoveExternalOptions(externalProviderIds); UICommand tempVar = UICommand.createDefaultOkUiCommand("onRemove", this); getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("cancel", this); getCommands().add(tempVar2); }
Source:
<code>public ElytronManagedThreadFactory(String name, ContextServiceImpl contextService, int priority) { super(name, contextService, priority); <START> fccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); <END> }</code><technical_language>sense org.jboss.as.ee module class loader instead of hoping get right one</technical_language>

Target:
public ElytronManagedThreadFactory(String name, ContextServiceImpl contextService, int priority) { super(name, contextService, priority); }
Source:
<code><START> public String getPageRendered(final HttpServletRequest request, final <END> HttpServletResponse response, final User user, final String uri, PageMode mode) throws ResourceNotFoundException, ParseErrorException, DotRuntimeException, Exception { final Context velocityContext = VelocityUtil.getWebContext(request, response); final String siteName = null == request.getParameter(Host.HOST_VELOCITY_VAR_NAME) ? request.getServerName() : request.getParameter(Host.HOST_VELOCITY_VAR_NAME); final Host site = this.hostWebAPI.resolveHostName(siteName, user, RESPECT_FE_ROLES); final String pageUri = (uri.length()>0 && '/' == uri.charAt(0)) ? uri : ("/" + uri); final HTMLPageAsset page = (HTMLPageAsset) this.htmlPageAssetAPI.getPageByPath(pageUri, site, this.languageAPI.getDefaultLanguage().getId(), mode.respectAnonPerms); if(null==page) { response.sendError(404); return null; } if(mode.isAdmin ) { APILocator.getPermissionAPI().checkPermission(page, PermissionLevel.READ, user); } switch (mode) { case PREVIEW_MODE: return new VelocityPreviewMode(request, response, pageUri, site).eval(); case EDIT_MODE: return new VelocityEditMode(request, response, pageUri, site).eval(); default: return new VelocityLiveMode(request, response, pageUri, site).eval(); } }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Reduce number of returns of this method 4, maximum allowed 3. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public String getPageRendered(final HttpServletRequest request, final HttpServletResponse response, final User user, final String uri, PageMode mode) throws DotDataException, DotSecurityException, IOException { final String siteName = null == request.getParameter(Host.HOST_VELOCITY_VAR_NAME) ? request.getServerName() : request.getParameter(Host.HOST_VELOCITY_VAR_NAME); final Host site = this.hostWebAPI.resolveHostName(siteName, user, RESPECT_FE_ROLES); final String pageUri = (uri.length()>0 && '/' == uri.charAt(0)) ? uri : ("/" + uri); final HTMLPageAsset page = (HTMLPageAsset) this.htmlPageAssetAPI.getPageByPath(pageUri, site, this.languageAPI.getDefaultLanguage().getId(), mode.respectAnonPerms); if(null==page) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return null; } if(mode.isAdmin ) { APILocator.getPermissionAPI().checkPermission(page, PermissionLevel.READ, user); } switch (mode) { case PREVIEW_MODE: return new VelocityPreviewMode(request, response, pageUri, site).eval(); case EDIT_MODE: return new VelocityEditMode(request, response, pageUri, site).eval(); default: return new VelocityLiveMode(request, response, pageUri, site).eval(); } }
Source:
<code>public TransactionTemplate retries( int retries ) { if ( retries < 1 ) { throw new IllegalArgumentException( "Number of retries must be greater than or equal to 1" ); <START> } <END> return new TransactionTemplate( gds, monitor, retries, backoff, retryPredicate ); }</code><technical_language>Oh, number of retries includes try well</technical_language>

Target:
public TransactionTemplate retries( int retries ) { return new TransactionTemplate( gds, monitor, retries, backoff, retryPredicate ); }
Source:
<code>public List<RadiologyReport> getRadiologyReportsByRadiologyOrderAndRadiologyReportStatus(RadiologyOrder radiologyOrder, RadiologyReportStatus radiologyReportStatus) { <START> List<RadiologyReport> result = sessionFactory.getCurrentSession() <END> .createCriteria(RadiologyReport.class) .add(Restrictions.eq("radiologyOrder", radiologyOrder)) .add(Restrictions.eq("reportStatus", radiologyReportStatus)) .list(); return result == null ? new ArrayList<RadiologyReport>() : result; }</code><technical_language>final</technical_language>

Target:
public List<RadiologyReport> getRadiologyReportsByRadiologyOrderAndRadiologyReportStatus(RadiologyOrder radiologyOrder, RadiologyReportStatus radiologyReportStatus) { final List<RadiologyReport> result = sessionFactory.getCurrentSession() .createCriteria(RadiologyReport.class) .add(Restrictions.eq("radiologyOrder", radiologyOrder)) .add(Restrictions.eq("reportStatus", radiologyReportStatus)) .list(); return result == null ? new ArrayList<RadiologyReport>() : result; }
Source:
<code>public void show(@NonNull View anchorView, @Nullable Callback callback) { this.callback = callback; popupWindowHost = new PopupWindow(this, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); popupWindowHost.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); PopupWindowCompat.setOverlapAnchor(popupWindowHost, true); final int compatOffset = 8; PopupWindowCompat.showAsDropDown(popupWindowHost, anchorView, 0, Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? -DimenUtil.getToolbarHeightPx(anchorView.getContext()) + DimenUtil.roundedDpToPx(compatOffset) : 0, Gravity.END); String lastSyncTime = Prefs.getReadingListsLastSyncTime(); lastSync.setVisibility(TextUtils.isEmpty(lastSyncTime) ? View.GONE : View.VISIBLE); if (!TextUtils.isEmpty(lastSyncTime)) { try { lastSync.setText(String.format(getContext().getString(R.string.reading_list_menu_last_sync), DateUtil.getReadingListsLastSyncDateString(Prefs.getReadingListsLastSyncTime()))); } catch <START> (Exception e) <END> { } } }</code><technical_language>reason narrower ParseException here..</technical_language>

Target:
public void show(@NonNull View anchorView, @Nullable Callback callback) { this.callback = callback; popupWindowHost = new PopupWindow(this, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true); popupWindowHost.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); PopupWindowCompat.setOverlapAnchor(popupWindowHost, true); final int compatOffset = 8; PopupWindowCompat.showAsDropDown(popupWindowHost, anchorView, 0, Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? -DimenUtil.getToolbarHeightPx(anchorView.getContext()) + DimenUtil.roundedDpToPx(compatOffset) : 0, Gravity.END); String lastSyncTime = Prefs.getReadingListsLastSyncTime(); lastSync.setVisibility(TextUtils.isEmpty(lastSyncTime) ? View.GONE : View.VISIBLE); if (!TextUtils.isEmpty(lastSyncTime)) { try { lastSync.setText(String.format(getContext().getString(R.string.reading_list_menu_last_sync), DateUtil.getReadingListsLastSyncDateString(Prefs.getReadingListsLastSyncTime()))); } catch (ParseException e) { } } }
Source:
<code><START> public RecoverPasswordController(final ContentRenderer contentRenderer, final FormFactory formFactory, <END> final RecoverPasswordPageContentFactory pageContentFactory, final RecoverPasswordFormData formData, final RecoverPasswordControllerAction controllerAction, final AuthenticationReverseRouter authenticationReverseRouter) { super(contentRenderer, formFactory, pageContentFactory, formData, controllerAction); this.authenticationReverseRouter = authenticationReverseRouter; }</code><technical_language>Remove public</technical_language>

Target:
RecoverPasswordController(final ContentRenderer contentRenderer, final FormFactory formFactory, final RecoverPasswordPageContentFactory pageContentFactory, final RecoverPasswordFormData formData, final RecoverPasswordControllerAction controllerAction, final AuthenticationReverseRouter authenticationReverseRouter) { super(contentRenderer, formFactory, pageContentFactory, formData, controllerAction); this.authenticationReverseRouter = authenticationReverseRouter; }
Source:
<code>protected void initialize() throws ResourceManagerException { try { resourceManagerDriver.initialize( this, <START> command -> getMainThreadExecutor().execute(command)); END> } catch (Throwable t) { throw new ResourceManagerException("Cannot initialize resource provider.", t); } }</code><technical_language>a note: If ResourceManagerDriver run this executor while ResourceManager leadership, simply executed. Is this ok current behaviour of ResourceManagerDriver</technical_language>

Target:
protected void initialize() throws ResourceManagerException { try { resourceManagerDriver.initialize( this, command -> getMainThreadExecutor().execute(command)); } catch (Exception e) { throw new ResourceManagerException("Cannot initialize resource provider.", e); } }
Source:
<code>private Result giveConsentForVersion(int version, SubpopulationGuid subpopGuid) { final UserSession session = getAuthenticatedSession(); final Study study = studyService.getStudy(session.getStudyIdentifier()); final ConsentSignature consentSignature = ConsentSignature.fromJSON(requestToJSON(request())); final SharingOption sharing = SharingOption.fromJson(requestToJSON(request()), version); Map<SubpopulationGuid,ConsentStatus> consentStatuses = session.getConsentStatuses(); ConsentStatus status = consentStatuses.get(subpopGuid); if (status == null) { throw new EntityNotFoundException(Subpopulation.class); } consentService.consentToResearch(study, subpopGuid, session.getParticipant(), consentSignature, sharing.getSharingScope(), true); CriteriaContext context = getCriteriaContext(session); Map<SubpopulationGuid,ConsentStatus> statuses = consentService.getConsentStatuses(context); sessionUpdateService.updateConsentStatus(session, statuses, sharing.getSharingScope(), false); if (session.doesConsent()) { notificationsService.createSmsRegistrationAfterConsent(session.getParticipant(), <START> getCriteriaContext(session)); <END> } return createdResult(UserSessionInfo.toJSON(session)); }</code><technical_language>a lot of studies people consent now, including some users in mPower 2.0 externally consented. this catch case of SMS subscription want catch? client register manually</technical_language>

Target:
private Result giveConsentForVersion(int version, SubpopulationGuid subpopGuid) { final UserSession session = getAuthenticatedSession(); final Study study = studyService.getStudy(session.getStudyIdentifier()); final ConsentSignature consentSignature = ConsentSignature.fromJSON(requestToJSON(request())); final SharingOption sharing = SharingOption.fromJson(requestToJSON(request()), version); Map<SubpopulationGuid,ConsentStatus> consentStatuses = session.getConsentStatuses(); ConsentStatus status = consentStatuses.get(subpopGuid); if (status == null) { throw new EntityNotFoundException(Subpopulation.class); } consentService.consentToResearch(study, subpopGuid, session.getParticipant(), consentSignature, sharing.getSharingScope(), true); CriteriaContext context = getCriteriaContext(session); Map<SubpopulationGuid,ConsentStatus> statuses = consentService.getConsentStatuses(context); sessionUpdateService.updateConsentStatus(session, statuses, sharing.getSharingScope(), false); return createdResult(UserSessionInfo.toJSON(session)); }