auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void buildNeuralNetwork() { try { final Injector injector = Tang.Factory.getTang().newInjector(blasConfiguration, neuralNetworkConfiguration); mockParameterWorker = mock(ParameterWorker.class); injector.bindVolatileInstance(ParameterWorker.class, mockParameterWorker); neuralNetwork = injector.getInstance(NeuralNetwork.class); doAnswer(invocation -> { final LayerParameter layerParameterOne = LayerParameter.newBuilder() .setWeightParam(weightOne) .setBiasParam(biasOne) .build(); final LayerParameter layerParameterTwo = LayerParameter.newBuilder() .setWeightParam(weightTwo) .setBiasParam(biasTwo) .build(); final List<LayerParameter> result = new ArrayList<>(); result.add(layerParameterOne); result.add(layerParameterTwo); return result; }).when(mockParameterWorker).pull(anyObject()); neuralNetwork.updateParameters(); } catch (final InjectionException e) { e.printStackTrace(); <START> throw new RuntimeException(e); <END> } }</code><technical_language>Please revert this change, too. e.printStackTrace() debugging, I need this</technical_language>

Target:
public void buildNeuralNetwork() throws InjectionException { final Injector injector = Tang.Factory.getTang().newInjector(blasConfiguration, neuralNetworkConfiguration); mockParameterWorker = mock(ParameterWorker.class); injector.bindVolatileInstance(ParameterWorker.class, mockParameterWorker); neuralNetwork = injector.getInstance(NeuralNetwork.class); doAnswer(invocation -> { final LayerParameter layerParameterOne = LayerParameter.newBuilder() .setWeightParam(weightOne) .setBiasParam(biasOne) .build(); final LayerParameter layerParameterTwo = LayerParameter.newBuilder() .setWeightParam(weightTwo) .setBiasParam(biasTwo) .build(); final List<LayerParameter> result = new ArrayList<>(); result.add(layerParameterOne); result.add(layerParameterTwo); return result; }).when(mockParameterWorker).pull(anyObject()); neuralNetwork.updateParameters(); }
Source:
<code>public boolean signOutUser(String email) { session.checkSignedIn(); checkArgument(isNotBlank(email)); Map<String, String> queryParams = new HashMap<String, String>(); queryParams.put("email", email); HttpResponse response = post(config.getUsersSignOutApi() + toQueryString(queryParams)); <START> return response.getStatusLine().getStatusCode() == 200; <END> }</code><technical_language>I this is necessary. If request return 200, exception thrown. returning data, return void</technical_language>

Target:
public void signOutUser(String email) { session.checkSignedIn(); checkArgument(isNotBlank(email)); Map<String, String> queryParams = new HashMap<String, String>(); queryParams.put("email", email); post(config.getUsersSignOutApi() + toQueryString(queryParams)); }
Source:
<code>public static Long getLong(Object o, Long defaultValue) { if (null == o) { return defaultValue; } if ( o instanceof Long || o instanceof Integer || o instanceof Short || o instanceof Byte) { return ((Number) o).longValue(); } else if (o instanceof Double) { <START> final long l = (Long) o; <END> if (l <= Long.MAX_VALUE && l >= Long.MIN_VALUE) { return (long) l; } } else if (o instanceof String) { return Long.parseLong((String) o); } throw new IllegalArgumentException("Don't know how to convert " + o + " to long"); }</code><technical_language>This is work a Long larger MAX_VALUE for a long smaller MIN_VALUE for a Long. Technically I a bug in getInt if number is larger a Long hold</technical_language>

Target:
public static Long getLong(Object o, Long defaultValue) { if (null == o) { return defaultValue; } if (o instanceof Number) { return ((Number)o).longValue(); } else if (o instanceof String) { return Long.valueOf((String) o); } throw new IllegalArgumentException("Don't know how to convert " + o + " to a long"); }
Source:
<code>private Outer getNewCurrOut() throws FileNotFoundException { final int fileNum = outFiles.size(); File outFile = makeChunkFile(baseDir, fileNum); outFiles.add(outFile); <START> return new Outer(fileNum, new FileOutputStream(outFile).getChannel(), maxChunkSize); <END> }</code><technical_language>I FileOutputStream created try-with-resources, in case</technical_language>

Target:
private Outer getNewCurrOut() throws FileNotFoundException { final int fileNum = outFiles.size(); File outFile = makeChunkFile(baseDir, fileNum); outFiles.add(outFile); return new Outer(fileNum, new FileOutputStream(outFile), maxChunkSize); }
Source:
<code>private static boolean isStringIndexExpression(@NotNull GoIndexOrSliceExpr expr) { GoType type = Optional.of(expr) <START> .map(GoIndexOrSliceExpr::getExpression) <END> .map(e -> e.getGoType(null)) .orElse(null); if (!GoTypeUtil.isString(type)) { return false; } Trinity<GoExpression, GoExpression, GoExpression> indices = expr.getIndices(); return indices.getSecond() == null && indices.getThird() == null && expr.getNode().getChildren(TokenSet.create(GoTypes.COLON)).length == 0; }</code><technical_language>GoExpression expression = expr.getExpression(); GoType type = expression != null ? expression.getGoType(null) : null; more readable</technical_language>

Target:
private static boolean isStringIndexExpression(@NotNull GoIndexOrSliceExpr expr) { GoExpression expression = expr.getExpression(); GoType type = expression != null ? expression.getGoType(null) : null; if (!GoTypeUtil.isString(type)) { return false; } Trinity<GoExpression, GoExpression, GoExpression> indices = expr.getIndices(); return indices.getSecond() == null && indices.getThird() == null && expr.getNode().getChildren(TokenSet.create(GoTypes.COLON)).length == 0; }
Source:
<code>public static Error fromJson(JsonNode node) { if (node instanceof ObjectNode) { String e = null; String m = null; JsonNode x; x = ((ObjectNode) node).get("errorCode"); if (x != null) { e = x.asText(); } x = ((ObjectNode) node).get("msg"); if (x != null) { m = x.asText(); } Error ret = new Error(e, m); x = ((ObjectNode) node).get("context"); <START> if (x != null) { <END> StringTokenizer tok = new StringTokenizer(x.asText(), "/"); while (tok.hasMoreTokens()) { ret.pushContext(tok.nextToken()); } } return ret; } return null; }</code><technical_language>get rid of this well. Context is simply a string for client</technical_language>

Target:
public static Error fromJson(JsonNode node) { if (node instanceof ObjectNode) { String e = null; String m = null; String c = null; JsonNode x; x = ((ObjectNode) node).get("context"); if (x != null) { c = x.asText(); } x = ((ObjectNode) node).get("errorCode"); if (x != null) { e = x.asText(); } x = ((ObjectNode) node).get("msg"); if (x != null) { m = x.asText(); } return new Error(c, e, m); } return null; }
Source:
<code>void initTable(ApplicationConstants constants) { getTable().enableColumnResizing(); getTable().addColumn(new BrickStatusColumn(), constants.empty(), "30px"); TextColumnWithTooltip<GlusterBrickEntity> volNameColumn = new TextColumnWithTooltip<GlusterBrickEntity>() { @Override public String getValue(GlusterBrickEntity object) { return object.getVolumeName(); } }; volNameColumn.makeSortable(new Comparator<GlusterBrickEntity>() { @Override public int compare(GlusterBrickEntity o1, GlusterBrickEntity o2) { <START> return o1.getVolumeName().compareTo(o2.getVolumeName()); <END> } }); getTable().addColumn(volNameColumn, constants.volumeName()); TextColumnWithTooltip<GlusterBrickEntity> brickDirColumn = new TextColumnWithTooltip<GlusterBrickEntity>() { @Override public String getValue(GlusterBrickEntity object) { return object.getBrickDirectory(); } }; brickDirColumn.makeSortable(new Comparator<GlusterBrickEntity>() { @Override public int compare(GlusterBrickEntity o1, GlusterBrickEntity o2) { return o1.getBrickDirectory().compareTo(o2.getBrickDirectory()); } }); getTable().addColumn(brickDirColumn, constants.brickDirectoryBricks(), "220px"); }</code><technical_language>Please consider LexoNumericComparator for comparing String values</technical_language>

Target:
void initTable(ApplicationConstants constants) { getTable().enableColumnResizing(); getTable().addColumn(new BrickStatusColumn(), constants.empty(), "30px"); TextColumnWithTooltip<GlusterBrickEntity> volNameColumn = new TextColumnWithTooltip<GlusterBrickEntity>() { @Override public String getValue(GlusterBrickEntity object) { return object.getVolumeName(); } }; volNameColumn.makeSortable(); getTable().addColumn(volNameColumn, constants.volumeName()); TextColumnWithTooltip<GlusterBrickEntity> brickDirColumn = new TextColumnWithTooltip<GlusterBrickEntity>() { @Override public String getValue(GlusterBrickEntity object) { return object.getBrickDirectory(); } }; brickDirColumn.makeSortable(); getTable().addColumn(brickDirColumn, constants.brickDirectoryBricks(), "220px"); }
Source:
<code>public int read(byte b[], int off, int len) throws IOException { if (currentOffset == messageReadSet.sizeInBytes(indexToRead)) { throw new IOException("Reached end of stream of message read set"); } ByteBuffer buf = ByteBuffer.wrap(b); ByteBufferOutputStream bufferStream = new ByteBufferOutputStream(buf); long sizeInBlobReadOptions = messageReadSet.sizeInBytes(indexToRead); <START> long sizeToRead = sizeInBlobReadOptions == -1 ? buf.remaining() <END> : Math.min(buf.remaining(), sizeInBlobReadOptions - currentOffset); long bytesWritten = messageReadSet.writeTo(indexToRead, Channels.newChannel(bufferStream), currentOffset, sizeToRead); currentOffset += bytesWritten; return (int) bytesWritten; }</code><technical_language>sizeInBytes result in -1</technical_language>

Target:
public int read(byte b[], int off, int len) throws IOException { if (off < 0 || len < 0 || len > b.length - off) { throw new IndexOutOfBoundsException(); } if (currentOffset == messageReadSet.sizeInBytes(indexToRead)) { throw new IOException("Reached end of stream of message read set"); } ByteBuffer buf = ByteBuffer.wrap(b); ByteBufferOutputStream bufferStream = new ByteBufferOutputStream(buf); long sizeToRead = Math.min(len - off, messageReadSet.sizeInBytes(indexToRead) - currentOffset); long bytesWritten = messageReadSet.writeTo(indexToRead, Channels.newChannel(bufferStream), currentOffset, sizeToRead); currentOffset += bytesWritten; return (int) bytesWritten; }
Source:
<code>public void verifyNoDomainForMemoryWhenDomainHasNoSpaceForClonedDisks() { when(validStorageDomainValidator.hasSpaceForClonedDisks(anyCollectionOf(DiskImage.class))) .thenReturn(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)); <START> verifyNoDomainForMemory(Arrays.asList(validStorageDomain)); <END> }</code><technical_language>Please Collections.singletonList()</technical_language>

Target:
public void verifyNoDomainForMemoryWhenDomainHasNoSpaceForClonedDisks() { when(validStorageDomainValidator.hasSpaceForClonedDisks(anyCollectionOf(DiskImage.class))) .thenReturn(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)); verifyNoDomainForMemory(Collections.singletonList(validStorageDomain)); }
Source:
<code>public void testWorkNonIdempotent() throws InterruptedException { MetricsTracker tracker = new MetricsTracker(); int duration = getDurationMillis() * 2; SleepWork work = new SleepWork(duration); work.setIdempotent(false); assertFalse(work.isIdempotent()); service.schedule(work); <START> assertTrue(service.awaitCompletion(duration + 100, TimeUnit.MILLISECONDS)); <END> tracker.assertDiff(0, 0, 1, 0); service.schedule(work); service.schedule(work); service.schedule(work); assertFalse(service.awaitCompletion(duration / 2, TimeUnit.MILLISECONDS)); assertTrue(service.awaitCompletion(duration * 3, TimeUnit.SECONDS)); tracker.assertDiff(0, 0, 4, 0); }</code><technical_language>100ms of margin is low, a CI slave run dozen of jobs in concurrency expect stop-of-the-world of anywhere. is pb long timeout here, timeout reached error case</technical_language>

Target:
public void testWorkNonIdempotent() throws InterruptedException { MetricsTracker tracker = new MetricsTracker(); SleepWork work = new SleepWork(getDurationMillis()); work.setIdempotent(false); assertFalse(work.isIdempotent()); service.schedule(work); assertTrue(service.awaitCompletion(5000, TimeUnit.MILLISECONDS)); tracker.assertDiff(0, 0, 1, 0); service.schedule(work); service.schedule(work); service.schedule(work); assertFalse(service.awaitCompletion(getDurationMillis() / 2, TimeUnit.MILLISECONDS)); assertTrue(service.awaitCompletion(getDurationMillis() * 3, TimeUnit.SECONDS)); tracker.assertDiff(0, 0, 4, 0); }
Source:
<code>public void removeBuddyAfterConnectRejection(UUID idOfRequestingUser, UUID buddyID) { User user = User.getRepository().findOne(idOfRequestingUser); Buddy buddy = getEntityByID(buddyID); <START> if (buddy != null) <END> { user.removeBuddy(buddy); } }</code><technical_language>In scenario buddy null here? error</technical_language>

Target:
public void removeBuddyAfterConnectRejection(UUID idOfRequestingUser, UUID buddyID) { User user = User.getRepository().findOne(idOfRequestingUser); Buddy buddy = getEntityByID(buddyID); user.removeBuddy(buddy); }
Source:
<code>protected void categorizeInvalidRows(Context context, Map<String, Pair<Long, List<Object>>> targetPkToSourceValues) { Set<Map.Entry<String, Pair<Long, List<Object>>>> entrySet = targetPkToSourceValues.entrySet(); Iterator<Map.Entry<String, Pair<Long, List<Object>>>> itr = entrySet.iterator(); while(itr.hasNext()) { Map.Entry<String, Pair<Long, List<Object>>> entry = itr.next(); Pair<Long, List<Object>> sourceValues = entry.getValue(); Long sourceTS = sourceValues.getFirst(); <START> if (hasRowExpiredOnSource(sourceTS, ttl)) { <END> context.getCounter(PhoenixScrutinyJobCounters.EXPIRED_ROW_COUNT).increment(1L); itr.remove(); } else if (isRowOlderThanMaxLookback(sourceTS)){ context.getCounter(PhoenixScrutinyJobCounters.BEYOND_MAX_LOOKBACK).increment(1L); } else { context.getCounter(PhoenixScrutinyJobCounters.INVALID_ROW_COUNT) .increment(1L); } } }</code><technical_language>do need around</technical_language>

Target:
protected void categorizeInvalidRows(Context context, Map<String, Pair<Long, List<Object>>> targetPkToSourceValues) { Set<Map.Entry<String, Pair<Long, List<Object>>>> entrySet = targetPkToSourceValues.entrySet(); Iterator<Map.Entry<String, Pair<Long, List<Object>>>> itr = entrySet.iterator(); while(itr.hasNext()) { Map.Entry<String, Pair<Long, List<Object>>> entry = itr.next(); Pair<Long, List<Object>> sourceValues = entry.getValue(); Long sourceTS = sourceValues.getFirst(); if (hasRowExpiredOnSource(sourceTS, ttl)) { context.getCounter(PhoenixScrutinyJobCounters.EXPIRED_ROW_COUNT).increment(1L); itr.remove(); } else if (isRowOlderThanMaxLookback(sourceTS)) { context.getCounter(PhoenixScrutinyJobCounters.BEYOND_MAX_LOOKBACK_COUNT).increment(1L); } else { context.getCounter(PhoenixScrutinyJobCounters.INVALID_ROW_COUNT) .increment(1L); } } }
Source:
<code>public void checkDeprecatedComponent(Component component) { JvmType type = component.getType(); if (type instanceof JvmAnnotationTarget && DeprecationUtil.isDeprecated((JvmAnnotationTarget) type)) { warning( "The '" + type.getQualifiedName() + "' is deprecated.", <START> component, <END> Mwe2Package.Literals.REFERRABLE__NAME, DEPRECATED_ELEMENT); } }</code><technical_language>"everything" underlined class name</technical_language>

Target:
public void checkDeprecatedComponent(Component component) { JvmType type = component.getType(); if (type instanceof JvmAnnotationTarget && DeprecationUtil.isDeprecated((JvmAnnotationTarget) type)) { warning( "The '" + type.getQualifiedName() + "' is deprecated.", component, Mwe2Package.Literals.REFERRABLE__TYPE, DEPRECATED_ELEMENT); } }
Source:
<code>public Optional<TokenCredentials> extract(WebContext context) { <START> final Optional<String> header = context.getRequestHeader(this.headerName); <END> if (!header.isPresent()) { return Optional.empty(); } if (!header.get().startsWith(this.prefixHeader)) { throw new CredentialsException("Wrong prefix for header: " + this.headerName); } final String headerWithoutPrefix = header.get().substring(this.prefixHeader.length()); return Optional.of(new TokenCredentials(headerWithoutPrefix)); }</code><technical_language>try exploit map for this method</technical_language>

Target:
public Optional<TokenCredentials> extract(WebContext context) { return context.getRequestHeader(this.headerName).map( header -> { if (!header.startsWith(this.prefixHeader)) { throw new CredentialsException("Wrong prefix for header: " + this.headerName); } final String headerWithoutPrefix = header.substring(this.prefixHeader.length()); return new TokenCredentials(headerWithoutPrefix); } ); }
Source:
<code>public static long byteArrayToLong(byte[] b) { <START> byte[] values = b; <END> if (b.length < 8) { values = new byte[8]; int diff = 8 - b.length; for (int i = 0; i < diff; i++) values[i] = 0; for (int i = diff; i < 8; i++) values[i] = b[i - diff]; } return ((values[0] & 0xFF) << 56) | ((values[1] & 0xFF) << 48) | ((values[2] & 0xFF) << 40) | ((values[3] & 0xFF) << 32) | ((values[4] & 0xFF) << 24) | ((values[5] & 0xFF) << 16) | ((values[6] & 0xFF) << 8) | (values[7] & 0xFF); }</code><technical_language>Check if byte[] is null</technical_language>

Target:
public static long byteArrayToLong(byte[] b) { if (b == null) throw new NullPointerException("Byte array cannot be null."); byte[] values = b; if (b.length < 8) { values = new byte[8]; int diff = 8 - b.length; for (int i = 0; i < diff; i++) values[i] = 0; for (int i = diff; i < 8; i++) values[i] = b[i - diff]; } return ((long)values[0] << 56) + ((long)(values[1] & 0xFF) << 48) + ((long)(values[2] & 0xFF) << 40) + ((long)(values[3] & 0xFF) << 32) + ((long)(values[4] & 0xFF) << 24) + ((values[5] & 0xFF) << 16) + ((values[6] & 0xFF) << 8) + (values[7] & 0xFF); }
Source:
<code>public static Collection<Object[]> data() { KieServicesConfiguration restConfiguration = createKieServicesRestConfiguration(); Collection<Object[]> parameterData = new ArrayList<Object[]>(Arrays.asList(new Object[][] { {MarshallingFormat.JAXB, restConfiguration}, <START> {MarshallingFormat.JSON, createKieServicesRestConfiguration(Collections.singletonMap(KieServerConstants.KIE_CONTENT_TYPE_HEADER, "application/json; fields=not_null"))}, <END> {MarshallingFormat.XSTREAM, restConfiguration} } )); if (TestConfig.getRemotingUrl() != null && !TestConfig.skipJMS()) { KieServicesConfiguration jmsConfiguration = createKieServicesJmsConfiguration(); parameterData.addAll(Arrays.asList(new Object[][] { {MarshallingFormat.JAXB, jmsConfiguration}, {MarshallingFormat.JSON, jmsConfiguration}, {MarshallingFormat.XSTREAM, jmsConfiguration} }) ); } return parameterData; }</code><technical_language>This this slow integration test level (veeeeeeeeery slow). testing full logic of marshalling checking fields retrieved not. need check kie-server string response thoses fields returned o not</technical_language>

Target:
public static Collection<Object[]> data() { KieServicesConfiguration restConfiguration = createKieServicesRestConfiguration(); Collection<Object[]> parameterData = new ArrayList<Object[]>(Arrays.asList(new Object[][] { {MarshallingFormat.JAXB, restConfiguration}, {MarshallingFormat.JSON, restConfiguration}, {MarshallingFormat.XSTREAM, restConfiguration} } )); if (TestConfig.getRemotingUrl() != null && !TestConfig.skipJMS()) { KieServicesConfiguration jmsConfiguration = createKieServicesJmsConfiguration(); parameterData.addAll(Arrays.asList(new Object[][] { {MarshallingFormat.JAXB, jmsConfiguration}, {MarshallingFormat.JSON, jmsConfiguration}, {MarshallingFormat.XSTREAM, jmsConfiguration} }) ); } return parameterData; }
Source:
<code>public void sendsEmail() throws Exception { final Postman postman = Mockito.mock(Postman.class); final MkBase base = new MkBase(); final Alias alias = new EmAlias(base.randomAlias(), postman); final Bout bout = alias.inbox().bout(alias.inbox().start()); <START> bout.messages().post("how are you?"); <END> final ArgumentCaptor<Envelope> captor = ArgumentCaptor.forClass(Envelope.class); Mockito.verify(postman).send(captor.capture()); final Message msg = captor.getValue().unwrap(); MatcherAssert.assertThat(msg.getFrom().length, Matchers.is(1)); MatcherAssert.assertThat(msg.getAllRecipients().length, Matchers.is(1)); MatcherAssert.assertThat(msg.getSubject(), Matchers.startsWith("#1: ")); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); MimeMultipart.class.cast(msg.getContent()).writeTo(baos); MatcherAssert.assertThat( baos.toString(), Matchers.containsString("how are you") ); }</code><technical_language>@lautarobock This test is failing Travis, please check</technical_language>

Target:
public void sendsEmail() throws Exception { final Postman postman = Mockito.mock(Postman.class); final MkBase base = new MkBase(); final Alias alias = new EmAlias(base.randomAlias(), postman); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.friends().invite(base.randomAlias().name()); bout.messages().post("how are you?"); final ArgumentCaptor<Envelope> captor = ArgumentCaptor.forClass(Envelope.class); Mockito.verify(postman).send(captor.capture()); final Message msg = captor.getValue().unwrap(); MatcherAssert.assertThat(msg.getFrom().length, Matchers.is(1)); MatcherAssert.assertThat(msg.getAllRecipients().length, Matchers.is(1)); MatcherAssert.assertThat(msg.getSubject(), Matchers.startsWith("#1: ")); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); MimeMultipart.class.cast(msg.getContent()).writeTo(baos); MatcherAssert.assertThat( baos.toString(), Matchers.containsString("how are you") ); }
Source:
<code>public String processOtherSchemeScopes(String swaggerContent) throws APIManagementException { if (!isDefaultGiven(swaggerContent)) { Swagger swagger = getSwagger(swaggerContent); <START> swagger = injectMgwThrottlingExtensionsToDefault(swagger); <END> swagger = processLegacyScopes(swagger); swagger = injectOtherScopesToDefaultScheme(swagger); swagger = injectOtherResourceScopesToDefaultScheme(swagger); return getSwaggerJsonString(swagger); } return swaggerContent; }</code><technical_language>move this <LINK_0></technical_language>

Target:
public String processOtherSchemeScopes(String swaggerContent) throws APIManagementException { if (!isDefaultGiven(swaggerContent)) { Swagger swagger = getSwagger(swaggerContent); swagger = processLegacyScopes(swagger); swagger = injectOtherScopesToDefaultScheme(swagger); swagger = injectOtherResourceScopesToDefaultScheme(swagger); return getSwaggerJsonString(swagger); } return swaggerContent; }
Source:
<code>private long internalGetOffset() { if (fIsScaled) { return (long) <START> (fClockOffsetSeconds * getClockScale()) + <END> fClockOffset; } return fClockOffsetSeconds + fClockOffset; }</code><technical_language>(ONE_BILLION_L * fClockOffsetSeconds * getClockAntiScale())</technical_language>

Target:
private long internalGetOffset() { if (fIsScaled) { return (long) (fClockOffsetNanoSeconds * getClockAntiScale()) + fClockOffset; } return fClockOffsetNanoSeconds + fClockOffset; }
Source:
<code>private static void write(String content, File file, Charset charset) throws IOException { <START> Writer writer = new OutputStreamWriter(new FileOutputStream(file), charset); <END> writer.write(content); writer.close(); }</code><technical_language>a try resource try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), charset);) { writer.write(content); }</technical_language>

Target:
private static void write(String content, File file, Charset charset) throws IOException { try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), charset)) { writer.write(content); } }
Source:
<code><START> private void extractFile(ZipInputStream zin, String fileName, File outdir) { <END> try { OutputStream out = new FileOutputStream(outdir.getAbsolutePath() + File.separator + fileName); byte[] buffer = new byte[8192]; int len; while ((len = zin.read(buffer)) != -1) { out.write(buffer, 0, len); } out.close(); } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>I recommend this methods instead of reinventing wheel dump IOstreams files :) <LINK_0>,%20java.io.File)</technical_language>

Target:
private void extractFile(ZipInputStream zin, String fileName, File outdir) { OutputStream out = null; try { out = new FileOutputStream(outdir.getAbsolutePath() + File.separator + fileName); byte[] buffer = new byte[8192]; int len; while ((len = zin.read(buffer)) != -1) { out.write(buffer, 0, len); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (out != null) { out.close(); } } catch (IOException e) { e.printStackTrace(); } } }
Source:
<code>public void adjust(Mechanism mechanism) { if (mechanism.matches("delay") && mechanism.requireInteger()) { <START> int count = mechanism.getValue().asInt(); <END> if (count < getMin() || count > getMax()) { Debug.echoError("Delay value '" + count + "' is not valid. Must be between " + getMin() + " and " + getMax() + "."); return; } getRepeater().setDelay(count); } }</code><technical_language>fix variable name</technical_language>

Target:
public void adjust(Mechanism mechanism) { if (mechanism.matches("delay") && mechanism.requireInteger()) { int delay = mechanism.getValue().asInt(); if (delay < getMin() || delay > getMax()) { Debug.echoError("Delay value '" + delay + "' is not valid. Must be between " + getMin() + " and " + getMax() + "."); return; } getRepeater().setDelay(delay); } }
Source:
<code>public Long getTotalUserCount(){ return getUserCount(null); <START> } <END></code><technical_language>getUserCount checks for null changes it, pass empty string instead</technical_language>

Target:
public Long getTotalUserCount(){ return getUserCount(""); }
Source:
<code>public void onEventMainThread(UploadService.UploadErrorEvent event) { SiteModel site = getSelectedSite(); if (site != null) { <START> if (event.post.getLocalSiteId() == site.getId()) { <END> UploadUtils.onPostUploadedSnackbarHandler(getActivity(), getActivity().findViewById(R.id.coordinator), true, event.post, event.errorMessage, site, mDispatcher); } } }</code><technical_language>Do need null check event.post here</technical_language>

Target:
public void onEventMainThread(UploadService.UploadErrorEvent event) { SiteModel site = getSelectedSite(); if (site != null && event.post != null) { if (event.post.getLocalSiteId() == site.getId()) { UploadUtils.onPostUploadedSnackbarHandler(getActivity(), getActivity().findViewById(R.id.coordinator), true, event.post, event.errorMessage, site, mDispatcher); } } }
Source:
<code>public static ValidWriteIdList getTableValidWriteIdList(Configuration conf, String fullTableName) { String txnString = conf.get(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY); <START> ValidTxnWriteIdList validTxnList = new ValidTxnWriteIdList(txnString); <END> return validTxnList.getTableWriteIdList(fullTableName); }</code><technical_language>this do meaningful if key is found? error condition. This mask issues</technical_language>

Target:
public static ValidWriteIdList getTableValidWriteIdList(Configuration conf, String fullTableName) { String txnString = conf.get(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY); ValidTxnWriteIdList validTxnList = new ValidTxnWriteIdList(txnString); return validTxnList.getTableValidWriteIdList(fullTableName); }
Source:
<code>public void start(ServiceProvider serviceProvider) { timeSource = serviceProvider.getService(TimeSourceService.class); managementRegistry = serviceProvider.getService(ManagementRegistryService.class); configuration = managementRegistry.getConfiguration(); cacheManagerProviderService = serviceProvider.getService(CacheManagerProviderService.class); <START> scheduledExecutorService = serviceProvider.getService(ExecutionService.class).getScheduledExecutor(DefaultCollectorService.class.getSimpleName()); <END> cacheManagerProviderService.getCacheManager().registerListener(this); }</code><technical_language>This correct ExecutionService... need pulling alias user provided config. This work in default case service ignores aliases... if user constrain threads in named pools need able set of aliases system matches pool names</technical_language>

Target:
public synchronized void start(ServiceProvider serviceProvider) { timeSource = serviceProvider.getService(TimeSourceService.class).getTimeSource(); managementRegistry = serviceProvider.getService(ManagementRegistryService.class); configuration = managementRegistry.getConfiguration(); cacheManager = serviceProvider.getService(CacheManagerProviderService.class).getCacheManager(); scheduledExecutorService = serviceProvider.getService(ExecutionService.class).getScheduledExecutor(configuration.getCollectorExecutorAlias()); cacheManager.registerListener(this); }
Source:
<code>public void setGenericPasswordForOptions(String service, String username, String password, Promise promise) { try { if (username == null || username.isEmpty() || password == null || password.isEmpty()) { throw new EmptyParameterException("you passed empty or null username/password"); } CipherStorage currentCipherStorage = getCipherStorageForCurrentAPILevel(); if (currentCipherStorage == null) { <START> throw new CryptoFailedException("Unsupported Android SDK " + Build.VERSION.SDK_INT); <END> } EncryptionResult result = currentCipherStorage.encrypt(service, username, password); prefsStorage.storeEncryptedEntry(service, result); promise.resolve("KeychainModule saved the data"); } catch (EmptyParameterException e) { Log.e(KEYCHAIN_MODULE, e.getMessage()); promise.reject(E_EMPTY_PARAMETERS, e); } catch (CryptoFailedException e) { Log.e(KEYCHAIN_MODULE, e.getMessage()); promise.reject(E_CRYPTO_FAILED, e); } }</code><technical_language>imho nicer if this exception thrown fromgetCipherStorageForCurrentAPILevel</technical_language>

Target:
public void setGenericPasswordForOptions(String service, String username, String password, Promise promise) { try { if (username == null || username.isEmpty() || password == null || password.isEmpty()) { throw new EmptyParameterException("you passed empty or null username/password"); } service = getDefaultServiceIfNull(service); CipherStorage currentCipherStorage = getCipherStorageForCurrentAPILevel(); EncryptionResult result = currentCipherStorage.encrypt(service, username, password); prefsStorage.storeEncryptedEntry(service, result); promise.resolve("KeychainModule saved the data"); } catch (EmptyParameterException e) { Log.e(KEYCHAIN_MODULE, e.getMessage()); promise.reject(E_EMPTY_PARAMETERS, e); } catch (CryptoFailedException e) { Log.e(KEYCHAIN_MODULE, e.getMessage()); promise.reject(E_CRYPTO_FAILED, e); } }
Source:
<code>public Map<ObjectId, String> call() throws GitAPIException { try { Map<ObjectId, String> nonCommits = new HashMap<ObjectId, String>(); FIFORevQueue pending = new FIFORevQueue(); <START> for (Ref ref : refs) { <END> addRef(ref, nonCommits, pending); } addPrefixes(nonCommits, pending); int cutoff = minCommitTime() - COMMIT_TIME_SLOP; while (true) { NameRevCommit c = (NameRevCommit) pending.next(); if (c == null) break; if (c.getCommitTime() < cutoff) continue; boolean merge = c.getParentCount() > 1; long cost = c.cost + (merge ? MERGE_COST : 1); for (int i = 0; i < c.getParentCount(); i++) { NameRevCommit p = (NameRevCommit) walk.parseCommit(c.getParent(i)); if (p.tip == null || compare(c.tip, cost, p.tip, p.cost) < 0) { if (merge) { p.tip = c.format().append('^').append(i + 1).toString(); p.distance = 0; } else { p.tip = c.tip; p.distance = c.distance + 1; } p.cost = cost; pending.add(p); } } } Map<ObjectId, String> result = new LinkedHashMap<ObjectId, String>(revs.size()); for (ObjectId id : revs) { RevObject o = walk.parseAny(id); if (o instanceof NameRevCommit) { NameRevCommit c = (NameRevCommit) o; if (c.tip != null) result.put(id, simplify(c.format().toString())); } else { String name = nonCommits.get(id); if (name != null) result.put(id, simplify(name)); } } setCallable(false); walk.release(); return result; } catch (IOException e) { walk.reset(); throw new JGitInternalException(e.getMessage(), e); } }</code><technical_language>nit: curly braces</technical_language>

Target:
public Map<ObjectId, String> call() throws GitAPIException { try { Map<ObjectId, String> nonCommits = new HashMap<ObjectId, String>(); FIFORevQueue pending = new FIFORevQueue(); for (Ref ref : refs) addRef(ref, nonCommits, pending); addPrefixes(nonCommits, pending); int cutoff = minCommitTime() - COMMIT_TIME_SLOP; while (true) { NameRevCommit c = (NameRevCommit) pending.next(); if (c == null) break; if (c.getCommitTime() < cutoff) continue; boolean merge = c.getParentCount() > 1; long cost = c.cost + (merge ? MERGE_COST : 1); for (int i = 0; i < c.getParentCount(); i++) { NameRevCommit p = (NameRevCommit) walk.parseCommit(c.getParent(i)); if (p.tip == null || compare(c.tip, cost, p.tip, p.cost) < 0) { if (merge) { p.tip = c.format().append('^').append(i + 1).toString(); p.distance = 0; } else { p.tip = c.tip; p.distance = c.distance + 1; } p.cost = cost; pending.add(p); } } } Map<ObjectId, String> result = new LinkedHashMap<ObjectId, String>(revs.size()); for (ObjectId id : revs) { RevObject o = walk.parseAny(id); if (o instanceof NameRevCommit) { NameRevCommit c = (NameRevCommit) o; if (c.tip != null) result.put(id, simplify(c.format().toString())); } else { String name = nonCommits.get(id); if (name != null) result.put(id, simplify(name)); } } setCallable(false); walk.release(); return result; } catch (IOException e) { walk.reset(); throw new JGitInternalException(e.getMessage(), e); } }
Source:
<code>public U action(TestContext testContext, U testDto, FreeIPAClient client) throws Exception { int retries = 0; U result = null; <START> while (retries >= testDto.getWaitUtil().getMaxRetry()) { <END> try { result = freeIPAAction(testContext, testDto, client); } catch (Exception e) { LOGGER.info("Exception during executing FreeIPA action: ", e); if (e.getMessage().contains("Flows under operation")) { waitTillFlowInOperation(testDto.getWaitUtil()); retries++; } else { throw e; } } } return result; }</code><technical_language><=</technical_language>

Target:
public U action(TestContext testContext, U testDto, FreeIPAClient client) throws Exception { int retries = 0; while (retries <= testDto.getWaitUtil().getMaxRetry()) { try { return freeIPAAction(testContext, testDto, client); } catch (InternalServerErrorException e) { String message = e.getResponse().readEntity(String.class); LOGGER.info("Exception during executing FreeIPA action: ", e); if (message.contains("Flows under operation")) { waitTillFlowInOperation(testDto.getWaitUtil()); retries++; } else { throw e; } } } throw new Exception("Exception during executing FreeIPA action: exceeding maxrety during waiting for flow"); }
Source:
<code>public String getMobileUri() { <START> return getUriForDomain(getSite().authority()).replaceFirst("\\.", ".m."); <END> }</code><technical_language>Do need elsewhere? If so, I idea of sharing this logic please in mind some of details currently encapsulated Site: - Subdomain for authority mobile conversion. - URL language code is lossy, language code URL separate. - Authorities include authentication section yet</technical_language>

Target:
public String getMobileUri() { return getUriForDomain(getSite().mobileAuthority()); }
Source:
<code>public static Object safeEGet(EObject object, EStructuralFeature feature) { final EClass clazz = object.eClass(); if (clazz.getEPackage() == feature.getEContainingClass().getEPackage()) { return object.eGet(feature, false); } <START> final EStructuralFeature clazzFeature = clazz.getEStructuralFeature(feature.getName()); <END> if (clazzFeature == null && object instanceof AnyType) { for (Entry entry : ((AnyType)object).getAnyAttribute()) { if (entry.getEStructuralFeature().getName().equals(feature.getName())) { return entry.getValue(); } } return feature.getDefaultValue(); } return object.eGet(clazzFeature, false); }</code><technical_language>I find dangerous change behaviour of this core method, risk of regression high me. of a implement this nehavior else, in a method explicit if feature exist return a raw String in code deals missing profile migration</technical_language>

Target:
public static Object safeEGet(EObject object, EStructuralFeature feature) { final EClass clazz = object.eClass(); if (clazz.getEPackage() == feature.getEContainingClass().getEPackage()) { return object.eGet(feature, false); } return object.eGet(clazz.getEStructuralFeature(feature.getName()), false); }
Source:
<code>public void filterBatches() { currentBatches = new ArrayList<>(); List<Batch> batches = new ArrayList<>(); try { batches = ServiceManager.getBatchService().getAll(); } catch (DAOException e) { logger.error(e); } for (Batch batch : batches) { if (ServiceManager.getBatchService().contains(batch, batchfilter)) { currentBatches.add(batch); } } <START> for (Batch batch : this.currentBatches) { <END> ServiceManager.getBatchService().toString(batch); } }</code><technical_language>create label in "getLabel" if is label? I intuitive create label</technical_language>

Target:
public void filterBatches() { currentBatches = new ArrayList<>(); List<Batch> batches = new ArrayList<>(); try { batches = ServiceManager.getBatchService().getAll(); } catch (DAOException e) { logger.error(e); } for (Batch batch : batches) { if (ServiceManager.getBatchService().contains(batch, batchfilter)) { currentBatches.add(batch); } } for (Batch batch : this.currentBatches) { ServiceManager.getBatchService().createLabel(batch); } }
Source:
<code><START> public Set adviseAllServersWithInterest() { <END> return adviseFilter(profile -> { CacheProfile prof = (CacheProfile) profile; return prof.hasCacheServer && prof.filterProfile != null && prof.filterProfile.hasInterest(); }); }</code><technical_language>need public, invoked PRTombstoneMessage, belongs package</technical_language>

Target:
Set adviseAllServersWithInterest() { return adviseFilter(profile -> { CacheProfile prof = (CacheProfile) profile; return prof.hasCacheServer && prof.filterProfile != null && prof.filterProfile.hasInterest(); }); }
Source:
<code>public void putObject(String bucketName, String objectName, InputStream stream, long size, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException { if ((sse.getType() == ServerSideEncryption.Type.SSE_C) && (!this.baseUrl.isHttps())) { <START> throw new InvalidArgumentException("SSE_C provided keys must be made over a secure connection."); <END> } Map<String, String> headers = new HashMap<>(); sse.marshal(headers); putObject(bucketName, objectName, size, new BufferedInputStream(stream), headers); }</code><technical_language>SSE_C operations performed a secure connection</technical_language>

Target:
public void putObject(String bucketName, String objectName, InputStream stream, long size, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException { if ((sse.getType() == (ServerSideEncryption.Type.SSE_C)) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_C operations must be performed over a secure connection."); } else if ((sse.getType() == (ServerSideEncryption.Type.SSE_KMS)) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_KMS operations must be performed over a secure connection."); } Map<String, String> headers = new HashMap<>(); sse.marshal(headers); putObject(bucketName, objectName, size, new BufferedInputStream(stream), headers); }
Source:
<code>public CompletableFuture<?> add(Object id, Object entity) { Class<?> clazz = introspector.getClass( entity ); <START> PojoTypeWorkExecutor indexWork = this.indexWorkExecutor.get( clazz ); <END> if ( indexWork == null ) { indexWork = createIndexWork( clazz ); indexWorkExecutor.put( clazz, indexWork ); } return indexWork.add( id, entity ); }</code><technical_language>"typeExecutor" "indexWork"</technical_language>

Target:
public CompletableFuture<?> add(Object id, Object entity) { Class<?> clazz = introspector.getClass( entity ); PojoTypeDocumentWorkExecutor<?, ?, ?> typeExecutor = this.typeExecutors.get( clazz ); if ( typeExecutor == null ) { typeExecutor = createTypeDocumentExecutor( clazz ); typeExecutors.put( clazz, typeExecutor ); } return typeExecutor.add( id, entity ); }
Source:
<code>public static void checkDestinationType(Destination destination) throws WrongPatternException { String destinationType = destination.getType(); <START> if ( <END> ( !destinationType.equals(Destination.DESTINATIONHOSTTYPE) && (!destinationType.equals(Destination.DESTINATIONEMAILTYPE)) && (!destinationType.equals(Destination.DESTINATIONSEMAILTYPE)) && (!destinationType.equals(Destination.DESTINATIONURLTYPE)) && (!destinationType.equals(Destination.DESTINATIONUSERHOSTTYPE)) && (!destinationType.equals(Destination.DESTINATIONUSERHOSTPORTTYPE)) && (!destinationType.equals(Destination.DESTINATIONSERVICESPECIFICTYPE))) ) { throw new WrongPatternException("Destination type " + destinationType + " is not supported."); } }</code><technical_language>tabulators in opinion. Please 1 instead of 2 3. is need new line row 943. inspire in VoEntryManager line:97 method getAllVos. Thank you</technical_language>

Target:
public static void checkDestinationType(Destination destination) throws InternalErrorException, WrongPatternException { if (destination == null) { throw new InternalErrorException("Destination is null."); } String destinationType = destination.getType(); if ((!destinationType.equals(Destination.DESTINATIONHOSTTYPE) && (!destinationType.equals(Destination.DESTINATIONEMAILTYPE)) && (!destinationType.equals(Destination.DESTINATIONSEMAILTYPE)) && (!destinationType.equals(Destination.DESTINATIONURLTYPE)) && (!destinationType.equals(Destination.DESTINATIONUSERHOSTTYPE)) && (!destinationType.equals(Destination.DESTINATIONUSERHOSTPORTTYPE)) && (!destinationType.equals(Destination.DESTINATIONSERVICESPECIFICTYPE)))) { throw new WrongPatternException("Destination type " + destinationType + " is not supported."); } }
Source:
<code>public void close() { try { temporaryOutput.close(); try (InputStream in = Files.newInputStream(temporaryPath); OutputStream conclusiveOutput = new GZIPOutputStream(Files.newOutputStream(conclusivePath, CREATE, APPEND), 16*1024)) { ByteStreams.copy(in, conclusiveOutput); conclusiveOutput.close(); <START> temporaryPath.toFile().delete(); <END> } } catch (IOException ex) { throw Throwables.propagate(ex); } }</code><technical_language>Delete temporary file in finally block</technical_language>

Target:
public void close() { try { output.close(); if (realtimeFollow) { try (InputStream in = Files.newInputStream(temporaryPath); OutputStream out = new GZIPOutputStream(Files.newOutputStream(path, CREATE, APPEND), 16*1024)) { ByteStreams.copy(in, out); } } } catch (IOException ex) { throw Throwables.propagate(ex); } finally { if (realtimeFollow) { temporaryPath.toFile().delete(); } } }
Source:
<code>private static void copy(final Reader input, final Writer output) throws IOException { <START> char[] buffer = new char[1 << 12]; <END> for (int n; (n = input.read(buffer)) >= 0;) { output.write(buffer, 0, n); } }</code><technical_language>is useful of 1 << 12</technical_language>

Target:
private static void copy(final Reader input, final Writer output) throws IOException { char[] buffer = new char[4096]; for (int length; (length = input.read(buffer)) >= 0;) { output.write(buffer, 0, length); } }
Source:
<code>protected Control createDialogArea(final Composite parent) { initializeDialogUnits(parent); final Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(GridLayoutFactory.swtDefaults().create()); new Label(composite, SWT.NONE) .setText(UIText.CreateTagDialog_tagMessage); messageText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); messageText.setLayoutData(GridDataFactory.fillDefaults().span(2, 1) .grab(true, true).hint(400, 100).create()); messageText.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent arg0) { if (arg0.keyCode == SWT.CR && (arg0.stateMask & SWT.CONTROL) > 0) { Control button = getButton(IDialogConstants.OK_ID); if (null != button && button.isEnabled()) buttonPressed(IDialogConstants.OK_ID); } else if (arg0.keyCode == SWT.TAB && (arg0.stateMask & SWT.SHIFT) == 0) { arg0.doit = false; messageText.traverse(SWT.TRAVERSE_TAB_NEXT); } validateInput(); } }); overwriteButton = new Button(composite, SWT.CHECK); overwriteButton.setText(UIText.CreateTagDialog_overwriteTag); overwriteButton .setToolTipText(UIText.CreateTagDialog_overwriteTagToolTip); overwriteButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (overwriteButton.getSelection()) { Control button = getButton(IDialogConstants.OK_ID); <START> button.setEnabled(true); <END> } else { validateInput(); } } }); createAdvancedSection(composite); if (null != tag) { setTagImpl(); } validateInput(); applyDialogFont(parent); return composite; }</code><technical_language>do want do this. means I check 'Overwrite' button 'OK' button enabled allows user create a tag empty string. need perform input validation. Also, if overwriting a tag, dialog "Already exists"</technical_language>

Target:
protected Control createDialogArea(final Composite parent) { initializeDialogUnits(parent); SashForm mainForm = new SashForm(parent, SWT.HORIZONTAL); mainForm.setLayoutData(GridDataFactory.swtDefaults().indent(5, 5).create()); createLeftSection(mainForm); createExistingTagsSection(mainForm); mainForm.setWeights(new int[] {70, 30}); if (null != tag) { setTagImpl(); } validateInput(); applyDialogFont(parent); return mainForm; }
Source:
<code>private boolean isLogDataValid(long address, ILogData logData, boolean throwException) { if (logData == null || logData.getType() == DataType.EMPTY) { throw new RuntimeException("Unexpected return of empty data at address " + address + " on read"); } if (logData.isTrimmed()) { if (throwException) { <START> throw new TrimmedException(Collections.singletonList(address)); <END> } return false; } return true; }</code><technical_language>Cleaner push constructor</technical_language>

Target:
private boolean isLogDataValid(long address, ILogData logData, boolean throwException) { if (logData == null || logData.getType() == DataType.EMPTY) { throw new RuntimeException("Unexpected return of empty data at address " + address + " on read"); } if (logData.isTrimmed()) { if (throwException) { throw new TrimmedException(address); } return false; } return true; }
Source:
<code>public void testConnectionOnAfterGetConnectionAfterGettingFromDriverWithThrowingSQLException() throws SQLException { try { DriverManager.getConnection("jdbc:p6spy:h2:tcp://dev/null/", "sa", null); <START> } catch (SQLException expected) { <END> } verify(mockedJdbcListener).onAfterGetConnection(connectionInformationWithoutConnection(), any(SQLException.class)); }</code><technical_language>ditto (Assert.fail())</technical_language>

Target:
public void testConnectionOnAfterGetConnectionAfterGettingFromDriverWithThrowingSQLException() throws SQLException { try { DriverManager.getConnection("jdbc:p6spy:h2:tcp://dev/null/", "sa", null); Assert.fail("exception should be thrown"); } catch (SQLException expected) { } verify(mockedJdbcListener).onAfterGetConnection(connectionInformationWithoutConnection(), any(SQLException.class)); }
Source:
<code>private static Map<String, String> toMap(final Iterable<RuleFlowGroup> groups) { <START> Map<String, String> result = new HashMap<>(); <END> for (RuleFlowGroup group : groups) { if (result.containsKey(group.getName())) { String project = getProjectFromPath(group.getPathUri()); if (!result.get(group.getName()).contains(project)) { result.put(group.getName(), addProjectToDescription(result.get(group.getName()), project)); } } else { result.put(group.getName(), getGroupDescription(group)); } } return result; }</code><technical_language>logic addressed in lines Streams, read this method faster... Eg: Streams.stream(groups).filter(...).map(...).collect(...)</technical_language>

Target:
private static Map<String, String> toMap(final Iterable<RuleFlowGroup> groups) { Map<String, String> result = new HashMap<>(); for (RuleFlowGroup group : groups) { if (result.containsKey(group.getName())) { updateExistingGroup(result, group); } else { addNewGroup(result, group); } } return result; }