auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void importFilter(SWTBotView viewBot) { try { File tempFile = File.createTempFile("test", ".xml"); FileWriter fw = new FileWriter(tempFile); try (BufferedWriter bw = new BufferedWriter(fw)) { bw.write(FILTER); } TmfFileDialogFactory.setOverrideFiles(tempFile.getAbsolutePath()); } catch (IOException e) { fail("Failed to add a filter"); } viewBot.toolbarButton("Import filters").click(); WaitUtils.waitUntil(count -> count > 0, <START> viewBot.bot().tree(0).rowCount(), "Failed <END> to import test filter"); }</code><technical_language>this evaluated once? need pass SWTBotTree argument</technical_language>

Target:
private static void importFilter(SWTBotView viewBot) { try { File tempFile = File.createTempFile("test", ".xml"); FileWriter fw = new FileWriter(tempFile); try (BufferedWriter bw = new BufferedWriter(fw)) { bw.write(FILTER); } TmfFileDialogFactory.setOverrideFiles(tempFile.getAbsolutePath()); } catch (IOException e) { fail("Failed to add a filter"); } viewBot.toolbarButton("Import filters").click(); WaitUtils.waitUntil(tree -> tree.rowCount() > 0, viewBot.bot().tree(0), "Failed to import test filter"); }
Source:
<code>public SAMFileWriter makeBAMWriter(final SAMFileHeader header, final boolean presorted, final Path outputPath, final int compressionLevel) { try { final boolean createMd5File = this.createMd5File && IOUtil.isRegularPath(outputPath); if (this.createMd5File && !createMd5File) { log.warn("Cannot create MD5 file for BAM because output file is not a regular file: " + outputPath.toUri()); } OutputStream os = IOUtil.maybeBufferOutputStream(Files.newOutputStream(outputPath), bufferSize); if (createMd5File) os = new Md5CalculatingOutputStream(os, IOUtil.addExtension(outputPath,".md5")); <START> final BAMFileWriter ret = new BAMFileWriter(os, outputPath.toString(), compressionLevel, deflaterFactory); <END> final boolean createIndex = this.createIndex && IOUtil.isRegularPath(outputPath); if (this.createIndex && !createIndex) { log.warn("Cannot create index for BAM because output file is not a regular file: " + outputPath.toUri()); } if (this.tmpDir != null) ret.setTempDirectory(this.tmpDir); initializeBAMWriter(ret, header, presorted, createIndex); if (this.useAsyncIo) return new AsyncSAMFileWriter(ret, this.asyncOutputBufferSize); else return ret; } catch (final IOException ioe) { throw new RuntimeIOException("Error opening file: " + outputPath.toUri()); } }</code><technical_language>URI string better</technical_language>

Target:
public SAMFileWriter makeBAMWriter(final SAMFileHeader header, final boolean presorted, final Path outputPath, final int compressionLevel) { try { final boolean createMd5File = this.createMd5File && IOUtil.isRegularPath(outputPath); if (this.createMd5File && !createMd5File) { log.warn("Cannot create MD5 file for BAM because output file is not a regular file: " + outputPath.toUri()); } OutputStream os = IOUtil.maybeBufferOutputStream(Files.newOutputStream(outputPath), bufferSize); if (createMd5File) os = new Md5CalculatingOutputStream(os, IOUtil.addExtension(outputPath,".md5")); final BAMFileWriter ret = new BAMFileWriter(os, outputPath.toUri().toString(), compressionLevel, deflaterFactory); final boolean createIndex = this.createIndex && IOUtil.isRegularPath(outputPath); if (this.createIndex && !createIndex) { log.warn("Cannot create index for BAM because output file is not a regular file: " + outputPath.toUri()); } initializeBAMWriter(ret, header, presorted, createIndex); if (this.useAsyncIo) return new AsyncSAMFileWriter(ret, this.asyncOutputBufferSize); else return ret; } catch (final IOException ioe) { throw new RuntimeIOException("Error opening file: " + outputPath.toUri()); } }
Source:
<code>public static WordVectors loadStaticModel(InputStream inputStream) throws IOException { File tmpFile = DL4JFileUtils.createTempFile("word2vec"+System.currentTimeMillis(), "tmp"); tmpFile.deleteOnExit(); FileUtils.copyInputStreamToFile(inputStream, tmpFile); <START> return loadStaticModel(tmpFile); <END> }</code><technical_language>IMO use: try{ return loadStaticModel(tmpFile); } finally { tmpFile.delete(); } This is for long-lived JVMs (and exit properly)</technical_language>

Target:
public static WordVectors loadStaticModel(InputStream inputStream) throws IOException { File tmpFile = DL4JFileUtils.createTempFile("word2vec"+System.currentTimeMillis(), "tmp"); FileUtils.copyInputStreamToFile(inputStream, tmpFile); try { return loadStaticModel(tmpFile); } finally { tmpFile.delete(); } }
Source:
<code>private void removeWidgetFromUI(WidgetToShow widget) { final Tab tab = widgets2Tabs.remove(widget); if (tab != null) { final int removedTabIndex = tabsPanel.getWidgetIndex(tab); tabsPanel.remove(tab); widgetsPanel.remove(widget.getWidget()); tabs2Widgets.remove(tab); final MenuItemWidget listItemWidget = widgets2ListItems.remove(widget); if (listItemWidget != null) { menu.removeListItem(listItemWidget); } if (tab == selectedTab) { <START> if (tabsPanel.getWidgetCount() > 1) { <END> Widget widgetToSelect; if (removedTabIndex < tabsPanel.getWidgetCount() - 1) { widgetToSelect = tabsPanel.getWidget(removedTabIndex); } else { widgetToSelect = tabsPanel.getWidget(tabsPanel.getWidgetCount() - 2); } if (widgetToSelect instanceof Tab) { selectTab((Tab) widgetToSelect); onTabClicked((Tab) widgetToSelect); } } } } }</code><technical_language>replace, I if (tab == selectedTab) { if (tabsPanel.getWidgetCount() > 1) { > if (tab == selectedTab && tabsPanel.getWidgetCount() > 1) {</technical_language>

Target:
private void removeWidgetFromUI(WidgetToShow widget) { final Tab tab = widgets2Tabs.remove(widget); if (tab != null) { final int removedTabIndex = tabsPanel.getWidgetIndex(tab); tabsPanel.remove(tab); widgetsPanel.remove(widget.getWidget()); tabs2Widgets.remove(tab); final MenuItemWidget listItemWidget = widgets2ListItems.remove(widget); if (listItemWidget != null) { menu.removeListItem(listItemWidget); } if (tab == selectedTab && tabsPanel.getWidgetCount() > 1) { Widget widgetToSelect; if (removedTabIndex < tabsPanel.getWidgetCount() - 1) { widgetToSelect = tabsPanel.getWidget(removedTabIndex); } else { widgetToSelect = tabsPanel.getWidget(tabsPanel.getWidgetCount() - 2); } if (widgetToSelect instanceof Tab) { selectTab((Tab) widgetToSelect); onTabClicked((Tab) widgetToSelect); } } } }
Source:
<code>public void shouldErrorOutWhenPluginDoesNotAgentSupportStatusReport() { final Capabilities capabilities = new Capabilities(true, false); final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false); elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities)); <START> thrown.expect(RuntimeException.class); <END> thrown.expectMessage("Plugin does not support agent status report."); service.getAgentStatusReport("cd.go.example.plugin", null, null); }</code><technical_language>this UnsupportedOperationException now</technical_language>

Target:
public void shouldErrorOutWhenPluginDoesNotAgentSupportStatusReport() { final Capabilities capabilities = new Capabilities(true, false); final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false); elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities)); thrown.expect(UnsupportedOperationException.class); thrown.expectMessage("Plugin does not support agent status report."); service.getAgentStatusReport("cd.go.example.plugin", null, null); }
Source:
<code>private final Object decodeOne(final String field, final String string, final VCFCompoundHeaderLine format) { try { if ( string.equals(VCFConstants.MISSING_VALUE_v4) ) return null; else { switch ( format.getType() ) { case Character: return string; case Flag: final boolean b = Boolean.valueOf(string) || string.equals("1"); if ( b == false ) throw new TribbleException("VariantContext FLAG fields " + field + " cannot contain false values" + " as seen at " + getContig() + ":" + getStart()); return b; case String: return string; case Integer: return Integer.valueOf(string); <START> case Float: return Double.parseDouble(string); <END> default: throw new TribbleException("Unexpected type for field" + field); } } } catch (NumberFormatException e) { throw new TribbleException("Could not decode field " + field + " with value " + string + " of declared type " + format.getType()); } }</code><technical_language>Yes, change @yfarjoun suggests is needed address <LINK_0></technical_language>

Target:
private final Object decodeOne(final String field, final String string, final VCFCompoundHeaderLine format) { try { if ( string.equals(VCFConstants.MISSING_VALUE_v4) ) return null; else { switch ( format.getType() ) { case Character: return string; case Flag: final boolean b = Boolean.valueOf(string) || string.equals("1"); if ( b == false ) throw new TribbleException("VariantContext FLAG fields " + field + " cannot contain false values" + " as seen at " + getContig() + ":" + getStart()); return b; case String: return string; case Integer: return Integer.valueOf(string); case Float: return VCFUtils.parseVcfDouble(string); default: throw new TribbleException("Unexpected type for field" + field); } } } catch (NumberFormatException e) { throw new TribbleException("Could not decode field " + field + " with value " + string + " of declared type " + format.getType()); } }
Source:
<code>private String makeRowNumbers(final Issue issue) { StringBuilder builder = new StringBuilder(); Iterator<Integer> iterator = issue.getRowNumbers().iterator(); while (iterator.hasNext()) { builder.append(iterator.next()); if (iterator.hasNext()) { builder.append(", "); } } <START> return builder.toString(); <END> }</code><technical_language>candidate for streams</technical_language>

Target:
private String makeRowNumbers(final Issue issue) { return issue.getRowNumbers() .stream() .map(Object::toString) .collect(Collectors.joining(", ")); }
Source:
<code><START> public void createTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, boolean ignoreExisting) <END> { JdbcOutputTableHandle handle = jdbcClient.beginCreateTable(tableMetadata); finishCreateTable(session, handle, emptyList(), emptyList()); }</code><technical_language>is this needed? Is this related null columns? this extracted separate commit</technical_language>

Target:
public void createTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, boolean ignoreExisting) { jdbcClient.createTable(tableMetadata); }
Source:
<code>public List<String> getDCFromExpression(String expression) { Set<String> DC = new HashSet<String>(); Matcher m; ArrayList<String> patterns = new ArrayList<>(Arrays.asList( "\\.(?i)(CAP|CRZ|SFZ|XRD|CDG|CDU|CHI|CHX|CRD|DFW|FRA|FRF|HND|IA2|IAD|LON|ORD|PAR|PH2|PHX|PRD|SFM|SPZ|SYD|UKB|WAS|WAX|XRD|YHU|YUL)\\.", ":argus\\.")); if (expression == null || expression.isEmpty()) { _logger.error("Expression either null or empty. Cannot retrive DC from the expression. Returning default value PRD."); <START> DC.add("PRD"); <END> } else { List<MetricQuery> queries = getQueries(expression); for(MetricQuery currentQuery: queries) { m = Pattern.compile(patterns.get(0)).matcher(currentQuery.getScope()); while (m.find()) DC.add(m.group().substring(1, m.group().length() - 1).toUpperCase()); m = Pattern.compile(patterns.get(1)).matcher(currentQuery.getScope()); if(m.find()) DC.add("PRD"); } } if (DC.size() == 0) { _logger.info("Unable to identify DC from expression: " + expression +" . Returning default value PRD."); DC.add("PRD"); } return new ArrayList<>(DC); }</code><technical_language>this function</technical_language>

Target:
public List<String> getDCFromExpression(String expression) { Set<String> DC = new HashSet<String>(); Matcher m; String dcList = _configuration.getValue(com.salesforce.dva.argus.system.SystemConfiguration.Property.DC_LIST).replaceAll(",","|"); String defaultDC = _configuration.getValue(SystemConfiguration.Property.DC_DEFAULT); ArrayList<String> patterns = new ArrayList<>(Arrays.asList( "\\.(?i)(" + dcList + ")\\.", ":argus\\.")); if (expression == null || expression.isEmpty()) { _logger.error("Expression either null or empty. Cannot retrive DC from the expression. Returning default value " + defaultDC); DC.add(defaultDC); } else { List<MetricQuery> queries = getQueries(expression); for(MetricQuery currentQuery: queries) { m = Pattern.compile(patterns.get(0)).matcher(currentQuery.getScope()); while (m.find()) DC.add(m.group().substring(1, m.group().length() - 1).toUpperCase()); m = Pattern.compile(patterns.get(1)).matcher(currentQuery.getScope()); if(m.find()) DC.add(defaultDC); } } if (DC.size() == 0) { _logger.info("Unable to identify DC from expression: " + expression +" . Returning default value PRD " + defaultDC); DC.add(defaultDC); } return new ArrayList<>(DC); }
Source:
<code>long allocatedSize() { long bloomAllocatedSize = bloomFilter == null ? 0 : bloomFilter.getBitsetSize(); return repetitionLevelColumn.getAllocatedSize() + definitionLevelColumn.getAllocatedSize() + dataColumn.getAllocatedSize() + pageWriter.allocatedSize() <START> + bloomAllocatedSize; <END> }</code><technical_language>Based invocations this method represent a memory footprint related column chunk. So, bloom filters counted either</technical_language>

Target:
long allocatedSize() { return repetitionLevelColumn.getAllocatedSize() + definitionLevelColumn.getAllocatedSize() + dataColumn.getAllocatedSize() + pageWriter.allocatedSize(); }
Source:
<code>public boolean isIntermediateResultComparable() { <START> return true; <END> }</code><technical_language>Geometry is comparable</technical_language>

Target:
public boolean isIntermediateResultComparable() { return false; }
Source:
<code>public void testSeek() throws IOException { int bufferSize = 20000; int startPosition = 250000; int length = 5000; final int[] RELATIVE_SEEK_OFFSET = new int[]{-bufferSize*2, -bufferSize, -bufferSize/2, -length, -length/2, 0, length/2, length, bufferSize/2, bufferSize, bufferSize*2}; for (final int seekOffset : RELATIVE_SEEK_OFFSET) { byte[] buffer1 = new byte[length]; <START> SeekableStream unBufferedStream = new SeekableFileStream(BAM_FILE); <END> unBufferedStream.seek(startPosition); int bytesRead = unBufferedStream.read(buffer1, 0, length); Assert.assertEquals(length, bytesRead); byte[] buffer2 = new byte[length]; SeekableStream bufferedStream = new SeekableBufferedStream(new SeekableHTTPStream(new URL(BAM_URL_STRING)), bufferSize); bufferedStream.seek(startPosition); bytesRead = bufferedStream.read(buffer2, 0, length); Assert.assertEquals(length, bytesRead); Assert.assertEquals(buffer1, buffer2); unBufferedStream.seek(startPosition + seekOffset); bytesRead = unBufferedStream.read(buffer1, 0, length); Assert.assertEquals(length, bytesRead); bufferedStream.seek(startPosition + seekOffset); bytesRead = bufferedStream.read(buffer2, 0, length); Assert.assertEquals(length, bytesRead); Assert.assertEquals(buffer1, buffer2, "Error at relative seek offset " + seekOffset); } }</code><technical_language>pull stream creation a try-with-resources block get closed</technical_language>

Target:
public void testSeek() throws IOException { final int bufferSize = 20000; final int startPosition = 250000; final int length = 5000; final int[] RELATIVE_SEEK_OFFSET = new int[]{-bufferSize*2, -bufferSize, -bufferSize/2, -length, -length/2, -1, 0, 1, length/2, length, bufferSize/2, bufferSize-1, bufferSize, bufferSize*2}; for (final int seekOffset : RELATIVE_SEEK_OFFSET) { try (SeekableStream unBufferedStream = new SeekableFileStream(BAM_FILE); SeekableBufferedStream bufferedStream = new SeekableBufferedStream(new SeekableHTTPStream(new URL(BAM_URL_STRING)), bufferSize)) { byte[] buffer1 = new byte[length]; unBufferedStream.seek(startPosition); int bytesRead = unBufferedStream.read(buffer1, 0, length); Assert.assertEquals(length, bytesRead); byte[] buffer2 = new byte[length]; bufferedStream.seek(startPosition); bytesRead = bufferedStream.read(buffer2, 0, length); Assert.assertEquals(length, bytesRead); Assert.assertEquals(buffer1, buffer2); unBufferedStream.seek(startPosition + seekOffset); bytesRead = unBufferedStream.read(buffer1, 0, length); Assert.assertEquals(length, bytesRead); Object internalBuffer = bufferedStream.bufferedStream; bufferedStream.seek(startPosition + seekOffset); bytesRead = bufferedStream.read(buffer2, 0, length); Assert.assertEquals(length, bytesRead); Object newInternalBuffer = bufferedStream.bufferedStream; if (seekOffset >=0 && seekOffset < bufferSize) { Assert.assertSame(internalBuffer, newInternalBuffer, "Internal buffer should have been reused for seek offset " + seekOffset); } else { Assert.assertNotSame(internalBuffer, newInternalBuffer, "Internal buffer should not have been reused for seek offset " + seekOffset); } Assert.assertEquals(buffer1, buffer2, "Error at relative seek offset " + seekOffset); } } }
Source:
<code>public List<StartIdentifiedAtlasDbTransactionResponse> startIdentifiedAtlasDbTransactionBatch(int count) { <START> return runTaskTimed("startIdentifiedAtlasDbTransactionBatch", () -> delegate.startIdentifiedAtlasDbTransactionBatch(1)); <END> }</code><technical_language>need propagate count</technical_language>

Target:
public List<StartIdentifiedAtlasDbTransactionResponse> startIdentifiedAtlasDbTransactionBatch(int count) { return runTaskTimed("startIdentifiedAtlasDbTransactionBatch", () -> delegate.startIdentifiedAtlasDbTransactionBatch(count)); }
Source:
<code>public void testEmailConstraint() { Validator validator = TestUtil.getValidatorUnderTest(); EmailDummyEntity foo = new EmailDummyEntity( "invalid" ); Set<ConstraintViolation<EmailDummyEntity>> constraintViolations = validator.validate( foo ); <START> assertThat( constraintViolations ).containsOnlyViolations( <END> violationOf( Email.class ).withProperty( "email" ) ); }</code><technical_language>test. based expectation is considered illegal validator? valid in term of regex? test cover flags() property</technical_language>

Target:
public void testEmailConstraint() { Validator validator = TestUtil.getValidatorUnderTest(); EmailDummyEntity foo = new EmailDummyEntity( "test@example.com" ); Set<ConstraintViolation<EmailDummyEntity>> constraintViolations = validator.validate( foo ); assertThat( constraintViolations ).containsOnlyViolations( violationOf( Email.class ).withProperty( "email" ) ); }
Source:
<code>protected double getMaxY() { double maxY = super.getMaxY(); if (maxY == 0) { return 10; } <START> if (maxY % 2 == 0) { <END> return maxY; } else { return maxY+1; } }</code><technical_language>nitpick; replaced return maxY + (maxY % 2); if want get tricky ;)</technical_language>

Target:
protected double getMaxY() { double maxY = super.getMaxY(); if (maxY == 0) { return DEFAULT_MAX_Y; } return maxY + (maxY % 2); }
Source:
<code>public void invalidIfAreaCodeStartsWith0() { expectedException.expect(IllegalArgumentException.class); <START> expectedException.expectMessage(illegalCharacterExceptionMessage); <END> new PhoneNumber("(023) 456-7890"); }</code><technical_language>I this error message accurately describes wrong. Please change describes problem applies next tests</technical_language>

Target:
public void invalidIfAreaCodeStartsWith0() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage(illegalAreaOrExchangeCodeMessage); new PhoneNumber("(023) 456-7890"); }
Source:
<code>public void assertSamValid(final File samFile) { final List<String> args = new ArrayList<>(); args.add("I=" + samFile.getAbsolutePath()); <START> ignoreErrors.forEach(s->args.add("IGNORE=" + s )); <END> final int validateExitStatus = runPicardCommandLine(args.toArray(new String[1 + ignoreErrors.size()])); Assert.assertEquals(validateExitStatus, 0, "There were problems in file: " + samFile.getAbsolutePath()); }</code><technical_language>add whitespace suggestion ignoreErrors.forEach(s -> args.add("IGNORE=" + s ));</technical_language>

Target:
public void assertSamValid(final File samFile) { final List<String> args = new ArrayList<>(); args.add("I=" + samFile.getAbsolutePath()); ignoreErrors.forEach(s -> args.add("IGNORE=" + s)); final int validateExitStatus = runPicardCommandLine(args.toArray(new String[0])); Assert.assertEquals(validateExitStatus, 0, "There were problems in file: " + samFile.getAbsolutePath()); }
Source:
<code>public boolean handle(HttpServletRequest request, HttpServletResponse response, Account account) { <START> System.out.println("----> PostLoginHandler"); <END> return true; }</code><technical_language>Remove System.out.println replace log.debug</technical_language>

Target:
public boolean handle(HttpServletRequest request, HttpServletResponse response, Account account) { log.debug("----> PostLoginHandler"); return true; }
Source:
<code>private SshServer setupSSHDaemon() throws Exception { SshServer sshServer = SshServer.setUpDefaultServer(); SimpleGeneratorHostKeyProvider simpleGeneratorHostKeyProvider = new SimpleGeneratorHostKeyProvider(); simpleGeneratorHostKeyProvider.setAlgorithm(KeyUtils.RSA_ALGORITHM); sshServer.setKeyPairProvider(simpleGeneratorHostKeyProvider); sshServer.setPasswordAuthenticator(new PasswordAuthenticator() { @Override public boolean authenticate(String username, String password, ServerSession session) { <START> return username.equals(USER) && password.equals(PASSPHRASE); <END> } }); sshServer.setShellFactory(new ProcessShellFactory(SHELL_ARGS)); sshServer.setCommandFactory(EchoCommandFactory.INSTANCE); return sshServer; }</code><technical_language>return USER.equals(username) && PASSPHRASE.equals(password)</technical_language>

Target:
private static SshServer setupSSHDaemon() throws Exception { SshServer sshServer = SshServer.setUpDefaultServer(); SimpleGeneratorHostKeyProvider simpleGeneratorHostKeyProvider = new SimpleGeneratorHostKeyProvider(); simpleGeneratorHostKeyProvider.setAlgorithm(KeyUtils.RSA_ALGORITHM); sshServer.setKeyPairProvider(simpleGeneratorHostKeyProvider); sshServer.setPasswordAuthenticator(new PasswordAuthenticator() { @Override public boolean authenticate(String username, String password, ServerSession session) { return USER.equals(username) && PASSPHRASE.equals(password); } }); sshServer.setShellFactory(new ProcessShellFactory(SHELL_ARGS)); sshServer.setCommandFactory(EchoCommandFactory.INSTANCE); return sshServer; }
Source:
<code>public void tookAndTimedOut() { StubMappingScope scope = indexManager.createScope(); SearchQuery<DocumentReference> genericQuery = scope.query() .predicate( f -> f.matchAll() ) .toQuery(); ElasticsearchSearchQuery<DocumentReference> esQuery = genericQuery.extension( ElasticsearchExtension.get() ); ElasticsearchSearchResult<DocumentReference> result = esQuery.fetchAll(); assertNotNull( result.getTook() ); <START> assertNotNull( result.getTimedOut() ); <END> }</code><technical_language>assert false, in this case :)</technical_language>

Target:
public void tookAndTimedOut() { StubMappingScope scope = indexManager.createScope(); SearchQuery<DocumentReference> genericQuery = scope.query() .predicate( f -> f.matchAll() ) .toQuery(); ElasticsearchSearchQuery<DocumentReference> esQuery = genericQuery.extension( ElasticsearchExtension.get() ); ElasticsearchSearchResult<DocumentReference> result = esQuery.fetchAll(); assertNotNull( result.getTook() ); assertNotNull( result.isTimedOut() ); assertFalse( result.isTimedOut() ); }
Source:
<code>public boolean isClientError(HttpMessage msg) { <START> return isPage404(msg) <END> ? true : HttpStatusCode.isClientError(msg.getResponseHeader().getStatusCode()); }</code><technical_language>This inlined? isPage404 return false if page 200 match, checking status code in case</technical_language>

Target:
public boolean isClientError(HttpMessage msg) { if (isCustomPage(msg, CustomPage.Type.OK_200) || isCustomPage(msg, CustomPage.Type.ERROR_500)) { return false; } if (isCustomPage(msg, CustomPage.Type.NOTFOUND_404) || !parent.getAnalyser().isFileExist(msg)) { return true; } return HttpStatusCode.isClientError(msg.getResponseHeader().getStatusCode()); }
Source:
<code>private org.infinispan.configuration.cache.ConfigurationBuilder createConfigurationBuilder() { org.infinispan.configuration.cache.ConfigurationBuilder builder = new org.infinispan.configuration.cache.ConfigurationBuilder(); builder.persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class) .fetchPersistentState(false) .ignoreModifications(false) <START> .purgeOnStartup(false) <END> .shared(false) .table() .dropOnExit(true) .createOnStart(true) .tableNamePrefix("TBL") .idColumnName("ID").idColumnType(DATABASE.getDatabase().getIdColumType()) .dataColumnName("DATA").dataColumnType(DATABASE.getDatabase().getDataColumnType()) .timestampColumnName("TS").timestampColumnType(DATABASE.getDatabase().getTimeStampColumnType()) .segmentColumnName("S").segmentColumnType(DATABASE.getDatabase().getSegmentColumnType()) .dataSource().jndiUrl("jdbc/database"); return builder; }</code><technical_language>removed default values: - fetchPersistentState - ignoreModifications - ignoreModifications - shared</technical_language>

Target:
private org.infinispan.configuration.cache.ConfigurationBuilder createConfigurationBuilder() { org.infinispan.configuration.cache.ConfigurationBuilder builder = new org.infinispan.configuration.cache.ConfigurationBuilder(); builder.persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class) .table() .dropOnExit(true) .tableNamePrefix("TBL") .idColumnName("ID").idColumnType(DATABASE.getDatabase().getIdColumType()) .dataColumnName("DATA").dataColumnType(DATABASE.getDatabase().getDataColumnType()) .timestampColumnName("TS").timestampColumnType(DATABASE.getDatabase().getTimeStampColumnType()) .segmentColumnName("S").segmentColumnType(DATABASE.getDatabase().getSegmentColumnType()) .dataSource().jndiUrl("jdbc/database"); return builder; }
Source:
<code>private boolean matchTraversedDevice(PacketContext pktCtx) { return traversedDevice == null || traversedDeviceInv ^ pktCtx.flowTags().contains( <START> FlowTagger.tagForDevice(traversedDevice)); <END> }</code><technical_language>cache FlowTagger.tagForDevice(traversedDevice)</technical_language>

Target:
private boolean matchTraversedDevice(PacketContext pktCtx) { FlowTagger.FlowTag tag = traversedDeviceTag(); return tag == null || traversedDeviceInv ^ pktCtx.flowTags().contains(tag); }
Source:
<code>private void deleteTopic(Datastream datastream) { <START> if (datastream.getMetadata().get(DatastreamMetadataConstants.IS_USER_MANAGED_DESTINATION_KEY).equals("true")) { <END> _log.info("BYOT(bring your own topic), topic will not be deleted"); } else { _transportProviderAdmins.get(datastream.getTransportProviderName()).dropDestination(datastream); } }</code><technical_language>metadata return null hit NPE. StringUtils.equals instead</technical_language>

Target:
private void deleteTopic(Datastream datastream) { try { if (StringUtils.equals(datastream.getMetadata().get(DatastreamMetadataConstants.IS_USER_MANAGED_DESTINATION_KEY), "true")) { _log.info("BYOT(bring your own topic), topic will not be deleted"); } else { _transportProviderAdmins.get(datastream.getTransportProviderName()).dropDestination(datastream); } } catch (Exception e) { _log.error("Runtime Exception while delete topic", e); } }
Source:
<code>private void aggregate(List<Path> files, Path outputFile) throws GoGoDuckException { CommandLine command = new CommandLine(getGoGoDuckConfig().getNcrcatPath()); command.addArgument("-D2"); command.addArgument("-4"); command.addArgument("-h"); command.addArgument("-O"); if (files.size() == 1) { File file = files.get(0).toFile(); try { if (outputFile.toFile().exists() && outputFile.toFile().isFile()) { logger.info(String.format("Deleting '%s'", outputFile)); Files.delete(outputFile); } logger.info(String.format("Renaming '%s' -> '%s'", file, outputFile)); Files.move(file.toPath(), outputFile); } catch (IOException e) { logger.error(e.getMessage(), e); throw new GoGoDuckException(String.format("Could not rename result file: '%s'", file), e); } } else { logger.info(String.format("Concatenating %d files into '%s'", files.size(), outputFile)); command.addArgument(outputFile.toFile().getAbsolutePath()); Set<String> fileNames = new LinkedHashSet<>(); for (Path file : files) { String filePath = file.toAbsolutePath().toString(); fileNames.add(filePath); } String stdin = StringUtils.join(fileNames, " "); try { execute(command, stdin); } catch (Exception e) { <START> logger.error(String.format("Could not concatenate files: %s into a single file: '%s'", Arrays.toString(fileNames.toArray()), outputFile)); <END> logger.error(e.getMessage(), e); throw new GoGoDuckException(String.format("Could not concatenate %s files into a single file: '%s'", files.size(), outputFile), e); } } }</code><technical_language>This lead large log entries. Is issue</technical_language>

Target:
private void aggregate(List<Path> files, Path outputFile) throws GoGoDuckException { CommandLine command = new CommandLine(getGoGoDuckConfig().getNcrcatPath()); command.addArgument("-D2"); command.addArgument("-4"); command.addArgument("-h"); command.addArgument("-O"); if (files.size() == 1) { File file = files.get(0).toFile(); try { if (outputFile.toFile().exists() && outputFile.toFile().isFile()) { logger.info(String.format("Deleting '%s'", outputFile)); Files.delete(outputFile); } logger.info(String.format("Renaming '%s' -> '%s'", file, outputFile)); Files.move(file.toPath(), outputFile); } catch (IOException e) { logger.error(e.getMessage(), e); throw new GoGoDuckException(String.format("Could not rename result file: '%s'", file), e); } } else { logger.info(String.format("Concatenating %d files into '%s'", files.size(), outputFile)); command.addArgument(outputFile.toFile().getAbsolutePath()); Set<String> fileNames = new LinkedHashSet<>(); for (Path file : files) { String filePath = file.toAbsolutePath().toString(); fileNames.add(filePath); } String stdin = StringUtils.join(fileNames, " "); try { execute(command, stdin); } catch (Exception e) { throw new GoGoDuckException(String.format("Could not concatenate %s files into a single file: '%s'", files.size(), outputFile), e); } } }
Source:
<code>protected void doWork(IProgressMonitor monitor) throws OseeCoreException { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("function", Function.PURGE_BRANCH.name()); BranchState currentState = branch.getBranchState(); BranchArchivedState archivedState = branch.getArchiveState(); ArtifactCache.deCache(branch); branch.setBranchState(BranchState.PURGE_IN_PROGRESS); branch.setArchived(true); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.Purging, branch.getGuid())); AcquireResult response = null; try { PurgeBranchRequest requestData = new PurgeBranchRequest(branch.getId(), recursive); response = HttpClientMessage.send(OseeServerContext.BRANCH_CONTEXT, parameters, CoreTranslatorId.PURGE_BRANCH_REQUEST, requestData, null); <START> } catch (OseeCoreException ex) { <END> branch.setBranchState(currentState); branch.setArchived(archivedState.isArchived()); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.StateUpdated, branch.getGuid())); throw ex; } if (response.wasSuccessful()) { branch.setStorageState(StorageState.PURGED); branch.setBranchState(BranchState.PURGED); branch.setArchived(true); BranchManager.decache(branch); BranchManager.getCache().reloadCache(); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.Purged, branch.getGuid())); } }</code><technical_language>original exception lost if next lines exception out</technical_language>

Target:
protected void doWork(IProgressMonitor monitor) throws OseeCoreException { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("function", Function.PURGE_BRANCH.name()); BranchState currentState = branch.getBranchState(); BranchArchivedState archivedState = branch.getArchiveState(); ArtifactCache.deCache(branch); branch.setBranchState(BranchState.PURGE_IN_PROGRESS); branch.setArchived(true); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.Purging, branch.getGuid())); AcquireResult response = null; try { PurgeBranchRequest requestData = new PurgeBranchRequest(branch.getId(), recursive); response = HttpClientMessage.send(OseeServerContext.BRANCH_CONTEXT, parameters, CoreTranslatorId.PURGE_BRANCH_REQUEST, requestData, null); } catch (OseeCoreException ex) { try { branch.setBranchState(currentState); branch.setArchived(archivedState.isArchived()); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.StateUpdated, branch.getGuid())); } catch (Exception ex2) { log(ex2); } throw ex; } if (response.wasSuccessful()) { branch.setStorageState(StorageState.PURGED); branch.setBranchState(BranchState.PURGED); branch.setArchived(true); BranchManager.decache(branch); BranchManager.getCache().reloadCache(); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.Purged, branch.getGuid())); } }
Source:
<code>private EmbeddedExpirableMetadata( long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit, EntryVersion version) { super(version); this.lifespan = lifespan < 0 ? lifespan : lifespanUnit.toMillis(lifespan); <START> this.maxIdle = maxIdleUnit.toMillis(maxIdle); <END> }</code><technical_language>handle maxIdle</technical_language>

Target:
private EmbeddedExpirableMetadata( long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit, EntryVersion version) { super(version); this.lifespan = lifespan < 0 ? -1 : lifespanUnit.toMillis(lifespan); this.maxIdle = maxIdle < 0 ? -1 : maxIdleUnit.toMillis(maxIdle); }
Source:
<code>public void shouldAddSystemPermissionsOnPostUserPersistedEvent() throws Exception { <START> Injector injector = Guice.createInjector(new BaseModule()); <END> UserManager userManager = injector.getInstance(UserManager.class); when(userManager.getByName(eq(NAME))).thenReturn(user); AdminPermissionInitializer creator = injector.getInstance(AdminPermissionInitializer.class); creator.onEvent( new PostUserPersistedEvent(new UserImpl(NAME, EMAIL, NAME, PASSWORD, emptyList()))); verify(permissionsManager) .storePermission( argThat( new ArgumentMatcher<SystemPermissionsImpl>() { @Override public boolean matches(Object argument) { return ((SystemPermissionsImpl) argument).getUserId().equals(NAME); } })); }</code><technical_language>easier injection AdminPermissionInitializer constructor avoid usage Guice</technical_language>

Target:
public void shouldAddSystemPermissionsOnPostUserPersistedEvent() throws Exception { when(userManager.getByName(eq(NAME))).thenReturn(user); initializer.init(); initializer.onEvent( new PostUserPersistedEvent(new UserImpl(NAME, EMAIL, NAME, PASSWORD, emptyList()))); verify(permissionsManager) .storePermission( argThat( new ArgumentMatcher<SystemPermissionsImpl>() { @Override public boolean matches(Object argument) { return ((SystemPermissionsImpl) argument).getUserId().equals(NAME); } })); }
Source:
<code>public static List<TopLevelItemDescriptor> all(Authentication a, ItemGroup c) { List<TopLevelItemDescriptor> result = new ArrayList<TopLevelItemDescriptor>(); ACL acl; if (c instanceof AccessControlled) { acl = ((AccessControlled) c).getACL(); <START> } else if (c instanceof Item) { <END> acl = ((Item) c).getACL(); } else { acl = Jenkins.getInstance().getACL(); } for (TopLevelItemDescriptor d: all()) { if (acl.hasCreatePermission(a, c, d) && d.isApplicableIn(c)) { result.add(d); } } return result; }</code><technical_language>Huh? Item implements AccessControlled</technical_language>

Target:
public static List<TopLevelItemDescriptor> all(Authentication a, ItemGroup c) { List<TopLevelItemDescriptor> result = new ArrayList<TopLevelItemDescriptor>(); ACL acl; if (c instanceof AccessControlled) { acl = ((AccessControlled) c).getACL(); } else { acl = Jenkins.getInstance().getACL(); } for (TopLevelItemDescriptor d: all()) { if (acl.hasCreatePermission(a, c, d) && d.isApplicableIn(c)) { result.add(d); } } return result; }
Source:
<code>public void shouldFailValidationWithMoreThan10Keys() { Map<String, Object> metadata = new HashMap<>(); for (int i = 0; i < 11; i++) { metadata.put("key" + i, "value" + i); <START> } <END> ExternalMetadata invalidExternalMetadata = new ExternalMetadata(metadata); Set<ConstraintViolation<ExternalMetadata>> violations = validator.validate(invalidExternalMetadata); assertThat(violations.size(), is(1)); assertThat(violations.iterator().next().getMessage(), is("metadata cannot have more than 10 key-value pairs")); }</code><technical_language>alternative initialise this map be: java Map<String, Object> metadata = IntStream.rangeClosed(1, 11).boxed() .collect(Collectors.toUnmodifiableMap(i -> "key" + i, i -> "value" + i));</technical_language>

Target:
public void shouldFailValidationWithMoreThan10Keys() { Map<String, Object> metadata = IntStream.rangeClosed(1, 11).boxed() .collect(Collectors.toUnmodifiableMap(i -> "key" + i, i-> "value" + i)); ExternalMetadata invalidExternalMetadata = new ExternalMetadata(metadata); Set<ConstraintViolation<ExternalMetadata>> violations = validator.validate(invalidExternalMetadata); assertThat(violations.size(), is(1)); assertThat(violations.iterator().next().getMessage(), is("metadata cannot have more than 10 key-value pairs")); }
Source:
<code>protected void contextMenuAboutToShow(IMenuManager menuManager) { menuManager.add(fCopyAction); menuManager.add(fPasteAction); menuManager.add(fSelectAllAction); menuManager.add(new Separator()); menuManager.add(fClearAction); menuManager.add(new Separator()); menuManager.add(fScrollLockAction); menuManager.add(new Separator()); menuManager.add(fTerminateLaunchAction); menuManager.add(fInvertColorsAction); menuManager.add(fAutoTerminateAction); <START> menuManager.add(fShowPreferencePageAction); <END> }</code><technical_language>Add a separator, preference page</technical_language>

Target:
protected void contextMenuAboutToShow(IMenuManager menuManager) { menuManager.add(fCopyAction); menuManager.add(fPasteAction); menuManager.add(fSelectAllAction); menuManager.add(new Separator()); menuManager.add(fClearAction); menuManager.add(new Separator()); menuManager.add(fScrollLockAction); menuManager.add(new Separator()); menuManager.add(fTerminateLaunchAction); menuManager.add(fInvertColorsAction); menuManager.add(fAutoTerminateAction); menuManager.add(new Separator()); menuManager.add(fShowPreferencePageAction); }
Source:
<code>public WeldSEClassFileInfo(String className, IndexView index, LoadingCache<DotName, Set<String>> annotationClassAnnotationsCache, ClassLoader classLoader) { this.index = index; this.annotationClassAnnotationsCache = annotationClassAnnotationsCache; this.classInfo = index.getClassByName(DotName.createSimple(className)); if (this.classInfo == null) { <START> throw new IllegalStateException(("Index for name:" + className + "not found")); <END> } this.isVetoed = isVetoedTypeOrPackage(); this.hasCdiConstructor = this.classInfo.hasNoArgsConstructor() || hasInjectConstructor(); this.classLoader = classLoader; }</code><technical_language>double parentheses, exception message proper whitespace</technical_language>

Target:
public WeldSEClassFileInfo(String className, IndexView index, LoadingCache<DotName, Set<String>> annotationClassAnnotationsCache, ClassLoader classLoader) { this.index = index; this.annotationClassAnnotationsCache = annotationClassAnnotationsCache; this.classInfo = index.getClassByName(DotName.createSimple(className)); if (this.classInfo == null) { throw new IllegalStateException("Index for name: " + className + " not found"); } this.isVetoed = isVetoedTypeOrPackage(); this.hasCdiConstructor = this.classInfo.hasNoArgsConstructor() || hasInjectConstructor(); this.classLoader = classLoader; }
Source:
<code>private void scheduleTasksCleanupForWorker(final String worker, final List<String> tasksToFail) { removedWorkerCleanups.put( worker, exec.schedule( new Runnable() { @Override public void run() { log.info("Running scheduled cleanup for Worker[%s]", worker); <START> for (String assignedTask : tasksToFail) { <END> String taskPath = JOINER.join(indexerZkConfig.getTasksPath(), worker, assignedTask); String statusPath = JOINER.join(indexerZkConfig.getStatusPath(), worker, assignedTask); try { if (cf.checkExists().forPath(taskPath) != null) { cf.delete().guaranteed().forPath(taskPath); } if (cf.checkExists().forPath(statusPath) != null) { cf.delete().guaranteed().forPath(statusPath); } } catch (Exception e) { throw Throwables.propagate(e); } log.info("Failing task[%s]", assignedTask); RemoteTaskRunnerWorkItem taskRunnerWorkItem = runningTasks.remove(assignedTask); if (taskRunnerWorkItem != null) { taskRunnerWorkItem.setResult(TaskStatus.failure(taskRunnerWorkItem.getTaskId())); } else { log.warn("RemoteTaskRunner has no knowledge of task[%s]", assignedTask); } } } }, config.getTaskCleanupTimeout().toStandardDuration().getMillis(), TimeUnit.MILLISECONDS ) ); }</code><technical_language>In presence of spotty networking, host go. In a case sense a "last on" check task skipped this of purging if getTaskCleanupTimeout</technical_language>

Target:
private void scheduleTasksCleanupForWorker(final String worker, final List<String> tasksToFail) { removedWorkerCleanups.put( worker, cleanupExec.schedule( new Runnable() { @Override public void run() { log.info("Running scheduled cleanup for Worker[%s]", worker); try { for (String assignedTask : tasksToFail) { String taskPath = JOINER.join(indexerZkConfig.getTasksPath(), worker, assignedTask); String statusPath = JOINER.join(indexerZkConfig.getStatusPath(), worker, assignedTask); try { if (cf.checkExists().forPath(taskPath) != null) { cf.delete().guaranteed().forPath(taskPath); } if (cf.checkExists().forPath(statusPath) != null) { cf.delete().guaranteed().forPath(statusPath); } } catch (Exception e) { throw Throwables.propagate(e); } log.info("Failing task[%s]", assignedTask); RemoteTaskRunnerWorkItem taskRunnerWorkItem = runningTasks.remove(assignedTask); if (taskRunnerWorkItem != null) { taskRunnerWorkItem.setResult(TaskStatus.failure(taskRunnerWorkItem.getTaskId())); } else { log.warn("RemoteTaskRunner has no knowledge of task[%s]", assignedTask); } } } finally { removedWorkerCleanups.remove(worker); } } }, config.getTaskCleanupTimeout().toStandardDuration().getMillis(), TimeUnit.MILLISECONDS ) ); }
Source:
<code>public List<MetricFamilySamples> collect() { List<MetricFamilySamples.Sample> samples = new ArrayList<MetricFamilySamples.Sample>(); for(Map.Entry<List<String>, Child> c: children.entrySet()) { Child.Value v = c.getValue().get(); List<String> labelNamesWithQuantile = new ArrayList<String>(labelNames); labelNamesWithQuantile.add("quantile"); <START> for (CKMSQuantiles.Quantile q : this.quantiles) { <END> List<String> labelValuesWithQuantile = new ArrayList<String>(c.getKey()); labelValuesWithQuantile.add(doubleToGoString(q.quantile)); samples.add(new MetricFamilySamples.Sample(fullname, labelNamesWithQuantile, labelValuesWithQuantile, v.quantiles.get(q.quantile))); } samples.add(new MetricFamilySamples.Sample(fullname + "_count", labelNames, c.getKey(), v.count)); samples.add(new MetricFamilySamples.Sample(fullname + "_sum", labelNames, c.getKey(), v.sum)); } MetricFamilySamples mfs = new MetricFamilySamples(fullname, Type.SUMMARY, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(); mfsList.add(mfs); return mfsList; }</code><technical_language>sorted</technical_language>

Target:
public List<MetricFamilySamples> collect() { List<MetricFamilySamples.Sample> samples = new ArrayList<MetricFamilySamples.Sample>(); for(Map.Entry<List<String>, Child> c: children.entrySet()) { Child.Value v = c.getValue().get(); List<String> labelNamesWithQuantile = new ArrayList<String>(labelNames); labelNamesWithQuantile.add("quantile"); for(Map.Entry<Double, Double> q : v.quantiles.entrySet()) { List<String> labelValuesWithQuantile = new ArrayList<String>(c.getKey()); labelValuesWithQuantile.add(doubleToGoString(q.getKey())); samples.add(new MetricFamilySamples.Sample(fullname, labelNamesWithQuantile, labelValuesWithQuantile, q.getValue())); } samples.add(new MetricFamilySamples.Sample(fullname + "_count", labelNames, c.getKey(), v.count)); samples.add(new MetricFamilySamples.Sample(fullname + "_sum", labelNames, c.getKey(), v.sum)); } MetricFamilySamples mfs = new MetricFamilySamples(fullname, Type.SUMMARY, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(); mfsList.add(mfs); return mfsList; }
Source:
<code>private void initHandler() { mHandler = ViewModelProviders.of(this).get(EmailLinkEmailHandler.class); mHandler.init(getFlowParams()); mHandler.getOperation().observe(this, new ResourceObserver<String>(this, R.string .fui_progress_dialog_sending) { @Override <START> protected void onSuccess(@NonNull String email) { <END> } @Override protected void onFailure(@NonNull Exception e) { mListener.onSendEmailFailure(); } }); }</code><technical_language>do success? log a message</technical_language>

Target:
private void initHandler() { mEmailLinkSendEmailHandler = ViewModelProviders.of(this).get(EmailLinkSendEmailHandler .class); mEmailLinkSendEmailHandler.init(getFlowParams()); mEmailLinkSendEmailHandler.getOperation().observe(this, new ResourceObserver<String>(this, R.string.fui_progress_dialog_sending) { @Override protected void onSuccess(@NonNull String email) { Log.w(TAG, "Email for email link sign in sent successfully."); doAfterTimeout(new Runnable() { @Override public void run() { mTopLevelView.setVisibility(View.VISIBLE); } }); } @Override protected void onFailure(@NonNull Exception e) { mListener.onSendEmailFailure(e); } }); }
Source:
<code>private void updateButtonSpacing() { Resources res = getContext().getResources(); int buttonOffset = <START> res.getDimensionPixelSize(R.dimen.car_padding_4) - res.getDimensionPixelSize(R.dimen.car_padding_2); <END> ViewGroup.MarginLayoutParams positiveButtonLayoutParams = (ViewGroup.MarginLayoutParams) mPositiveButton.getLayoutParams(); ViewGroup.MarginLayoutParams negativeButtonLayoutParams = (ViewGroup.MarginLayoutParams) mNegativeButton.getLayoutParams(); if ((mPositiveButton.getVisibility() == View.VISIBLE && mNegativeButton.getVisibility() == View.VISIBLE)) { positiveButtonLayoutParams.setMarginStart(buttonOffset); positiveButtonLayoutParams.setMarginEnd(mButtonSpacing); mPositiveButton.requestLayout(); negativeButtonLayoutParams.setMarginStart(mButtonSpacing); mNegativeButton.requestLayout(); } else if (mPositiveButton.getVisibility() == View.VISIBLE) { positiveButtonLayoutParams.setMarginStart(buttonOffset); mPositiveButton.requestLayout(); } else if (mNegativeButton.getVisibility() == View.VISIBLE) { negativeButtonLayoutParams.setMarginStart(buttonOffset); mNegativeButton.requestLayout(); } }</code><technical_language>retrieved of fields already. reason reuse them</technical_language>

Target:
private void updateButtonSpacing() { Resources res = getContext().getResources(); int buttonOffset = mBottomPadding - mButtonSpacing; ViewGroup.MarginLayoutParams positiveButtonLayoutParams = (ViewGroup.MarginLayoutParams) mPositiveButton.getLayoutParams(); ViewGroup.MarginLayoutParams negativeButtonLayoutParams = (ViewGroup.MarginLayoutParams) mNegativeButton.getLayoutParams(); if ((mPositiveButton.getVisibility() == View.VISIBLE && mNegativeButton.getVisibility() == View.VISIBLE)) { positiveButtonLayoutParams.setMarginStart(buttonOffset); positiveButtonLayoutParams.setMarginEnd(mButtonSpacing); mPositiveButton.requestLayout(); negativeButtonLayoutParams.setMarginStart(mButtonSpacing); mNegativeButton.requestLayout(); } else if (mPositiveButton.getVisibility() == View.VISIBLE) { positiveButtonLayoutParams.setMarginStart(buttonOffset); mPositiveButton.requestLayout(); } else if (mNegativeButton.getVisibility() == View.VISIBLE) { negativeButtonLayoutParams.setMarginStart(buttonOffset); mNegativeButton.requestLayout(); } }
Source:
<code><START> public void startMetrics() { <END> for (MetricsReporter reporter:reporters.values()) { reporter.register("samza-container-" + processorId, metrics.getMetricsRegistry()); reporter.start(); } }</code><technical_language>I this method scope private</technical_language>

Target:
private void startMetrics() { for (MetricsReporter reporter: reporters.values()) { reporter.register("job-coordinator-" + processorId, (ReadableMetricsRegistry) metrics.getMetricsRegistry()); reporter.start(); } }