auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected SerialPort next(final SerialPort serialPort, final Observer<? super BluetoothValue> observer) { try { try (final InputStream inputStream = serialPort.getInputStream(); final Scanner scanner = new Scanner(inputStream) <START> ) { <END> if (scanner.hasNext()) { final String next = scanner.nextLine(); if (next != "") { observer.onNext(new BluetoothValue(scanner.nextLine())); } } } } catch (final IOException e) { observer.onError(e); } return serialPort; }</code><technical_language>calls close inputstream serial port close</technical_language>

Target:
protected SerialPort next(final SerialPort serialPort, final Observer<? super BluetoothValue> observer) { try { final InputStream inputStream = serialPort.getInputStream(); try (final Scanner scanner = new Scanner(inputStream)) { if (scanner.hasNext()) { final String next = scanner.nextLine(); if (!next.isEmpty()) { observer.onNext(new BluetoothValue(next)); } } } } catch (final IOException e) { observer.onError(e); } return serialPort; }
Source:
<code>public FormValidation doValidate(@QueryParameter String userName, @QueryParameter String url, @QueryParameter String password, @QueryParameter String groupVisibility, @QueryParameter String roleVisibility, @QueryParameter boolean useHTTPAuth, @QueryParameter String alternativeUrl, @QueryParameter Integer timeout) throws IOException { url = Util.fixEmpty(url); alternativeUrl = Util.fixEmpty(alternativeUrl); URL mainURL, alternativeURL = null; try{ if (url == null) { return FormValidation.error("No URL given"); } mainURL = new URL(url); } catch (MalformedURLException e){ return FormValidation.error(String.format("Malformed URL (%s)", url), e ); } try { if (alternativeUrl != null) { alternativeURL = new URL(alternativeUrl); } }catch (MalformedURLException e){ return FormValidation.error(String.format("Malformed alternative URL (%s)",alternativeUrl), e ); } JiraSite site = new JiraSite(mainURL, alternativeURL, userName, password, false, false, null, false, groupVisibility, roleVisibility, useHTTPAuth); site.setTimeout(timeout); try { JiraSession session = site.createSession(); if (session == null) { <START> return FormValidation.error("Failed to login to JIRA"); <END> } session.getMyPermissions(); return FormValidation.ok("Success"); } catch (RestClientException e) { LOGGER.log(Level.WARNING, "Failed to login to JIRA at " + url, e); } return FormValidation.error("Failed to login to JIRA"); }</code><technical_language>hide actual reason failed login (because of showing stacktrace) lines 812 815 handle cases additionally provide a stacktrace output logs underlying cause</technical_language>

Target:
public FormValidation doValidate(@QueryParameter String userName, @QueryParameter String url, @QueryParameter String password, @QueryParameter String groupVisibility, @QueryParameter String roleVisibility, @QueryParameter boolean useHTTPAuth, @QueryParameter String alternativeUrl, @QueryParameter Integer timeout) throws IOException { url = Util.fixEmpty(url); alternativeUrl = Util.fixEmpty(alternativeUrl); URL mainURL, alternativeURL = null; try{ if (url == null) { return FormValidation.error("No URL given"); } mainURL = new URL(url); } catch (MalformedURLException e){ return FormValidation.error(String.format("Malformed URL (%s)", url), e ); } try { if (alternativeUrl != null) { alternativeURL = new URL(alternativeUrl); } }catch (MalformedURLException e){ return FormValidation.error(String.format("Malformed alternative URL (%s)",alternativeUrl), e ); } JiraSite site = new JiraSite(mainURL, alternativeURL, userName, password, false, false, null, false, groupVisibility, roleVisibility, useHTTPAuth); site.setTimeout(timeout); try { JiraSession session = site.createSession(); session.getMyPermissions(); return FormValidation.ok("Success"); } catch (RestClientException e) { LOGGER.log(Level.WARNING, "Failed to login to JIRA at " + url, e); } return FormValidation.error("Failed to login to JIRA"); }
Source:
<code>public void whenCreateEventTypeWithWrongPartitionKeyFieldsThen422() throws Exception { final EventType eventType = buildEventType(randomValidEventTypeName(), new JSONObject("{ \"price\": 1000 }"), Collections.singletonList("blabla")); Mockito.doReturn(eventType).when(eventTypeRepository).findByName(eventType.getName()); <START> Mockito.doThrow(new TopicDeletionException("dummy message", null)).when(topicRepository).deleteTopic( <END> eventType.getTopic()); postEventType(eventType).andExpect(status().isUnprocessableEntity()) .andExpect(content().contentType("application/problem+json")); }</code><technical_language>I understand is this mock doThrow needed. needed</technical_language>

Target:
public void whenCreateEventTypeWithWrongPartitionKeyFieldsThen422() throws Exception { final EventType eventType = buildEventType(randomValidEventTypeName(), new JSONObject("{ \"price\": 1000 }"), Collections.singletonList("blabla")); Mockito.doReturn(eventType).when(eventTypeRepository).findByName(eventType.getName()); postEventType(eventType).andExpect(status().isUnprocessableEntity()) .andExpect(content().contentType("application/problem+json")); }
Source:
<code>private Iterable<S3ObjectSummary> getIterableObjectsFromPrefixes() { <START> return () -> S3Utils.objectSummaryIterator(s3Client, getPrefixes(), segmentPusherConfig.getMaxListingLength()); <END> }</code><technical_language>MAX_LISTING_LENGTH is defined in parent class (CloudObjectInputSource) is anymore. Please remove it</technical_language>

Target:
private Iterable<S3ObjectSummary> getIterableObjectsFromPrefixes() { return () -> S3Utils.objectSummaryIterator(s3Client, getPrefixes(), inputDataConfig.getMaxListingLength()); }
Source:
<code>public boolean hasProjects() { <START> Set<String> proj = getProjects().keySet(); <END> return (proj != null && !proj.isEmpty()); }</code><technical_language>size method return number of mappings? I necessary get keySet</technical_language>

Target:
public boolean hasProjects() { return (getProjects().size() > 0); }
Source:
<code>public Boolean getDevelopment() { return (Boolean) this.get("development"); <START> } <END></code><technical_language>add Builder</technical_language>

Target:
public boolean getDevelopment() { return (Boolean) this.get("development"); }
Source:
<code>public <K, V> CacheEventDispatcher<K, V> createCacheEventDispatcher(Store<K, V> store, ServiceConfiguration<?>... serviceConfigs) { String threadPoolAlias = defaultThreadPoolAlias; <START> DefaultCacheEventDispatcherConfiguration config = findSingletonAmongst(DefaultCacheEventDispatcherConfiguration.class, serviceConfigs); <END> if (config != null) { threadPoolAlias = config.getThreadPoolAlias(); } ExecutorService orderedExecutor = executionService.getOrderedExecutor(threadPoolAlias, new LinkedBlockingQueue<>()); ExecutorService unOrderedExecutor = executionService.getUnorderedExecutor(threadPoolAlias, new LinkedBlockingQueue<>()); return new CacheEventDispatcherImpl<>(unOrderedExecutor, orderedExecutor); }</code><technical_language>this (and other Object[] cast removals) trip a compiler warning varargs call</technical_language>

Target:
public <K, V> CacheEventDispatcher<K, V> createCacheEventDispatcher(Store<K, V> store, ServiceConfiguration<?>... serviceConfigs) { String threadPoolAlias = defaultThreadPoolAlias; DefaultCacheEventDispatcherConfiguration config = findSingletonAmongst(DefaultCacheEventDispatcherConfiguration.class, (Object[]) serviceConfigs); if (config != null) { threadPoolAlias = config.getThreadPoolAlias(); } ExecutorService orderedExecutor = executionService.getOrderedExecutor(threadPoolAlias, new LinkedBlockingQueue<>()); ExecutorService unOrderedExecutor = executionService.getUnorderedExecutor(threadPoolAlias, new LinkedBlockingQueue<>()); return new CacheEventDispatcherImpl<>(unOrderedExecutor, orderedExecutor); }
Source:
<code>public LicensedVideoSwapPageObject navigateToLvsPage() { backToLvsBtn.click(); PageObjectLogging.log("navigateToLvsPage", "verify that the lvs back button navigates to lvs page", true); return new LicensedVideoSwapPageObject(driver); <START> <END> }</code><technical_language>remove empty line</technical_language>

Target:
public LicensedVideoSwapPageObject navigateToLvsPage() { waitForElementByElement(backToLvsBtn); backToLvsBtn.click(); PageObjectLogging.log("navigateToLvsPage", "lvs back button navigates to lvs page", true); return new LicensedVideoSwapPageObject(driver); }
Source:
<code>private ItemGroup getItemGroup(Run<?, ?> build) { if (build instanceof AbstractBuild) { return ((AbstractBuild) build).getProject().getRootProject().getParent(); } else { <START> return build.getParent().getParent(); <END> } }</code><technical_language>This is fine. is equivalent of getRootProject for non-AbstractProjects, is needed. (The original code is usual hacks work matrix-project.)</technical_language>

Target:
private ItemGroup getItemGroup(Run<?, ?> build) { return getRootProject(build.getParent()).getParent(); }
Source:
<code>public void updateInitialRunFields() { if (vm.getCompatibilityVersion() != null) { AsyncDataProvider.isFloppySupported(new AsyncQuery<>(isFloppySupported -> { getIsSysprepPossible().setEntity(isFloppySupported && getIsWindowsOS()); <START> getIsSysprepEnabled().setEntity(isFloppySupported && getInitializationType() == InitializationType.Sysprep); <END> getIsCloudInitPossible().setEntity(!getIsWindowsOS()); getIsCloudInitEnabled().setEntity(getInitializationType() == InitializationType.CloudInit); getIsCloudInitEnabled().setIsAvailable(!getIsWindowsOS()); if (getIsSysprepPossible().getEntity() && getIsSysprepEnabled().getEntity()) { getVmInitModel().updateSysprepDomain(getVmInitModel().getSysprepDomain().getSelectedItem()); } }), vm.getOs(), vm.getCompatibilityVersion()); } }</code><technical_language>do isFloppySupported && getIsWindowsOS() in previous condition isFloppySupported in this one</technical_language>

Target:
public void updateInitialRunFields() { getIsSysprepPossible().setEntity(getIsWindowsOS()); getIsSysprepEnabled().setEntity(getInitializationType() == InitializationType.Sysprep); getIsCloudInitPossible().setEntity(!getIsWindowsOS()); getIsCloudInitEnabled().setEntity(getInitializationType() == InitializationType.CloudInit); getIsCloudInitEnabled().setIsAvailable(!getIsWindowsOS()); if (getIsSysprepPossible().getEntity() && getIsSysprepEnabled().getEntity()) { getVmInitModel().updateSysprepDomain(getVmInitModel().getSysprepDomain().getSelectedItem()); } }
Source:
<code>public void testPiano() { solo.assertCurrentActivity("correct activity",SplashScreen.class); <START> solo.waitForActivity("PianoActivity",3000); <END> }</code><technical_language>3000 is a magic number in -please "give a name"</technical_language>

Target:
public void testPiano() { int MaximumTimeout = 300; solo.assertCurrentActivity("correct activity",SplashScreen.class); solo.waitForActivity("PianoActivity",MaximumTimeout); }
Source:
<code><START> public HashSet<Project> getProjects() { <END> return threadConfig.get().getProjects(); }</code><technical_language>supertype Set</technical_language>

Target:
public Map<String,Project> getProjects() { return threadConfig.get().getProjects(); }
Source:
<code>public ZooKeeperServiceRegistry(ZooKeeperConnection connection) { checkNotNull(connection); CuratorFramework curator = ((CuratorConnection) connection).getCurator(); checkNotNull(curator); <START> checkArgument(curator.isStarted()); <END> _zooKeeperConnection = connection; }</code><technical_language>need check started anymore a ZooKeeperConnection now, get rid of this previous lines</technical_language>

Target:
public ZooKeeperServiceRegistry(ZooKeeperConnection connection) { checkNotNull(connection); _zooKeeperConnection = connection; }
Source:
<code>public void before() throws IOException { logMock = mock(Log.class); handler = new DefaultArtifactHandler(TYPE); List<ArtifactRepository> remoteArtifactRepositories = new ArrayList<>(); aetherRepositorySystemMock = mock(RepositorySystem.class); aetherRepositorySystemSessionMock = mock(RepositorySystemSession.class); installer = new ArtifactInstaller(logMock, remoteArtifactRepositories, aetherRepositorySystemMock, aetherRepositorySystemSessionMock); <START> outputFolder = new TemporaryFolder(); <END> outputFolder.create(); artifactFileFolder = new TemporaryFolder(); artifactFileFolder.create(); artifact = new DefaultArtifact(GROUP_ID, ARTIFACT_ID, VERSION, SCOPE, TYPE, CLASSIFIER, handler); }</code><technical_language>Remember a rool for this</technical_language>

Target:
public void before() throws IOException { logMock = mock(Log.class); handler = new DefaultArtifactHandler(TYPE); List<ArtifactRepository> remoteArtifactRepositories = new ArrayList<>(); aetherRepositorySystemMock = mock(RepositorySystem.class); aetherRepositorySystemSessionMock = mock(RepositorySystemSession.class); installer = new ArtifactInstaller(logMock, remoteArtifactRepositories, aetherRepositorySystemMock, aetherRepositorySystemSessionMock); outputFolder.create(); artifactFileFolder.create(); artifact = new DefaultArtifact(GROUP_ID, ARTIFACT_ID, VERSION, SCOPE, TYPE, CLASSIFIER, handler); }
Source:
<code>public void testTransformSourceResponse() throws CatalogTransformerException, IOException { RtfQueryResponseAndMetacardTransformer transformer = createTransformer(); assertThat("Transformer cannot be null", transformer, notNullValue()); SourceResponse mockSourceResponse = mock(SourceResponse.class); List<Result> results = createMockResults(); when(mockSourceResponse.getResults()).thenReturn(results); when(mockSourceResponse.getResults()).thenReturn(results); <START> BinaryContent content = transformer.transform(mockSourceResponse, new HashMap<>()); <END> assertThat("Transformed content cannot be null", content, notNullValue()); assertThat( "Content mime type must be 'application/rtf'", content.getMimeType().toString(), equalTo("application/rtf")); assertThat("Content must not be empty", content.getByteArray().length, greaterThan(0)); }</code><technical_language>Collections.emptyMap()</technical_language>

Target:
public void testTransformSourceResponse() throws CatalogTransformerException, IOException, MimeTypeParseException { RtfQueryResponseAndMetacardTransformer transformer = createTransformer(); SourceResponse mockSourceResponse = mock(SourceResponse.class); List<Result> results = createMockResults(); when(mockSourceResponse.getResults()).thenReturn(results); BinaryContent content = transformer.transform(mockSourceResponse, Collections.emptyMap()); assertThat("Transformed content cannot be null", content, notNullValue()); assertThat( "Content mime type must be 'application/rtf'", content.getMimeType().toString(), equalTo("application/rtf")); String rtfResult = inputStreamToString(content.getInputStream()); assertThat("Content must not be empty", rtfResult, is(not(isEmptyOrNullString()))); String referenceRtf = getReferenceSourceResponseRtfFile(); assertThat("Produced RTF document must match reference", rtfResult, equalTo(referenceRtf)); }
Source:
<code>public boolean supportsBitmapIndex(final BitmapIndexSelector selector) { <START> return requiredBindings.isEmpty() <END> || (requiredBindings.size() == 1 && selector.getBitmapIndex(Iterables.getOnlyElement(requiredBindings)) != null && !selector.hasMultipleValues(Iterables.getOnlyElement(requiredBindings))); }</code><technical_language>break this statement multiple for readability</technical_language>

Target:
public boolean supportsBitmapIndex(final BitmapIndexSelector selector) { if (requiredBindings.isEmpty()) { return true; } else if (requiredBindings.size() == 1) { final String column = Iterables.getOnlyElement(requiredBindings); return selector.getBitmapIndex(column) != null && !selector.hasMultipleValues(column); } else { return false; } }
Source:
<code>public Api(final String domain) { <START> this(domain, true, "/w/api.php", null); <END> }</code><technical_language>this string is in places, I this a constant a descriptive name</technical_language>

Target:
public Api(final String domain) { this(domain, true, DEFAULT_ENDPOINT, null); }
Source:
<code>public void nullableStringFromEmptyString() { <START> assertThat(InternalQueries.nullableString("")).isEqualTo(null); <END> }</code><technical_language>isNull()</technical_language>

Target:
public void nullableStringFromEmptyString() { assertThat(InternalQueries.nullableString("")).isNull(); }
Source:
<code>public void preInit(FMLPreInitializationEvent event) { Logger.initiallize(); ConfigurationHandler.init(event.getSuggestedConfigurationFile()); PacketHandler.init(); ItemsAndBlocks.init(); SpecialListMananger.init(); Item dustDiamond = new ItemDust(0x13ECFC).setUnlocalizedName("dustDiamond"); GameRegistry.registerItem(dustDiamond, "dustDiamond"); OreDictionary.registerOre("dustDiamond", dustDiamond); <START> Item dustEmerald = new ItemDust(0x17DD62).setUnlocalizedName("dustEmerald"); <END> GameRegistry.registerItem(dustEmerald, "dustEmerald"); OreDictionary.registerOre("dustEmerald", dustEmerald); BCARecipeManager.duster = new DusterRecipeManager(); BCARecipeManager.duster.addRecipe("oreRedstone", new ItemStack(Items.redstone, 6)); BCARecipeManager.duster.addRecipe("oreCoal", new ItemStack(Items.coal, 2)); BCARecipeManager.duster.addRecipe("oreLapis", new ItemStack(Items.dye, 6, 4)); BCARecipeManager.duster.addRecipe("oreQuartz", new ItemStack(Items.quartz, 2)); BCARecipeManager.duster.addRecipe("stone", new ItemStack(Blocks.gravel)); BCARecipeManager.duster.addRecipe("cobblestone", new ItemStack(Blocks.sand)); BCARecipeManager.duster.addRecipe("oreDiamond", new ItemStack(dustDiamond, 2)); BCARecipeManager.duster.addRecipe("gemDiamond", new ItemStack(dustDiamond)); BCARecipeManager.duster.addRecipe("oreEmerald", new ItemStack(dustEmerald, 2)); BCARecipeManager.duster.addRecipe("gemEmerald", new ItemStack(dustEmerald)); BCARecipeManager.duster.addRecipe(new ItemStack(Items.blaze_rod), new ItemStack(Items.blaze_powder, 4)); }</code><technical_language>user for emerald dust</technical_language>

Target:
public void preInit(FMLPreInitializationEvent event) { Logger.initiallize(); ConfigurationHandler.init(event.getSuggestedConfigurationFile()); PacketHandler.init(); ItemsAndBlocks.init(); SpecialListMananger.init(); Item dustDiamond = new ItemDust(0x13ECFC).setUnlocalizedName("dustDiamond"); GameRegistry.registerItem(dustDiamond, "dustDiamond"); OreDictionary.registerOre("dustDiamond", dustDiamond); BCARecipeManager.duster = new DusterRecipeManager(); BCARecipeManager.duster.addRecipe("oreRedstone", new ItemStack(Items.redstone, 6)); BCARecipeManager.duster.addRecipe("oreCoal", new ItemStack(Items.coal, 2)); BCARecipeManager.duster.addRecipe("oreLapis", new ItemStack(Items.dye, 6, 4)); BCARecipeManager.duster.addRecipe("oreQuartz", new ItemStack(Items.quartz, 2)); BCARecipeManager.duster.addRecipe("stone", new ItemStack(Blocks.gravel)); BCARecipeManager.duster.addRecipe("cobblestone", new ItemStack(Blocks.sand)); BCARecipeManager.duster.addRecipe("oreDiamond", new ItemStack(Items.diamond, 2)); BCARecipeManager.duster.addRecipe("gemDiamond", new ItemStack(dustDiamond)); BCARecipeManager.duster.addRecipe("oreEmerald", new ItemStack(Items.emerald, 2)); BCARecipeManager.duster.addRecipe(new ItemStack(Items.blaze_rod), new ItemStack(Items.blaze_powder, 4)); }
Source:
<code>public PageContainerForm deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException { final JsonNode jsonNode = jsonParser.readValueAsTree(); if (!jsonNode.elements().hasNext()) { <START> throw new BadRequestException(""); <END> } final List<ContainerEntry> entries = new ArrayList<>(); for (final JsonNode jsonElement : jsonNode) { final String containerId = jsonElement.get(CONTAINER_ID_ATTRIBUTE_NAME).asText(); final String containerUUID = jsonElement.get(CONTAINER_UUID_ATTRIBUTE_NAME).asText(); final ContainerEntry containerEntry = new ContainerEntry(containerId, containerUUID); final JsonNode containerNode = jsonElement.get(CONTAINER_CONTENTLETSID_ATTRIBUTE_NAME); containerNode.forEach((JsonNode contentId) -> containerEntry.addContentId(contentId.textValue())); entries.add(containerEntry); } return new PageContainerForm(entries, jsonNode.toString()); }</code><technical_language>include a message</technical_language>

Target:
public PageContainerForm deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException { final JsonNode jsonNode = jsonParser.readValueAsTree(); final List<ContainerEntry> entries = new ArrayList<>(); for (final JsonNode jsonElement : jsonNode) { final JsonNode containerIdNode = jsonElement.get(CONTAINER_ID_ATTRIBUTE_NAME); final JsonNode containerUUIDNode = jsonElement.get(CONTAINER_UUID_ATTRIBUTE_NAME); if (containerIdNode == null || containerUUIDNode == null) { throw new BadRequestException("Container id and uuid are required"); } final String containerId = containerIdNode.asText(); final String containerUUID = containerUUIDNode.asText(); final ContainerEntry containerEntry = new ContainerEntry(containerId, containerUUID); final JsonNode containerNode = jsonElement.get(CONTAINER_CONTENTLETSID_ATTRIBUTE_NAME); containerNode.forEach((JsonNode contentId) -> containerEntry.addContentId(contentId.textValue())); entries.add(containerEntry); } return new PageContainerForm(entries, jsonNode.toString()); }
Source:
<code>public void testExecuteQueryGetUnregisteredTemplate() throws OvfReaderException { setUpTemplate(); setUpQueryEntities(); getQuery().executeQueryCommand(); @SuppressWarnings("unchecked") VmTemplate result = getQuery().getQueryReturnValue().getReturnValue(); assertEquals(VmTemplateReturnForOvf, result, "Wrong <START> Templates entity"); <END> }</code><technical_language>template</technical_language>

Target:
public void testExecuteQueryGetUnregisteredTemplate() throws OvfReaderException { setUpTemplate(); setUpQueryEntities(); getQuery().executeQueryCommand(); @SuppressWarnings("unchecked") VmTemplate result = getQuery().getQueryReturnValue().getReturnValue(); assertEquals(VmTemplateReturnForOvf, result, "Wrong Template entity"); }
Source:
<code>public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) { Builder table = InMemoryRecordSet.builder(transactionsTable); for (TransactionInfo info : transactionManager.getAllTransactionInfos()) { table.addRow( info.getTransactionId().toString(), info.getIsolationLevel().toString(), info.isReadOnly(), info.isAutoCommitContext(), <START> info.getCreateTimeMillis(), <END> (long) info.getIdleTime().getValue(TimeUnit.SECONDS), info.getWrittenConnectorId().map(ConnectorId::getCatalogName).orElse(null), createStringsBlock(info.getConnectorIds())); } return table.build().cursor(); }</code><technical_language>Unrelated change</technical_language>

Target:
public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) { Builder table = InMemoryRecordSet.builder(transactionsTable); for (TransactionInfo info : transactionManager.getAllTransactionInfos()) { table.addRow( info.getTransactionId().toString(), info.getIsolationLevel().toString(), info.isReadOnly(), info.isAutoCommitContext(), info.getCreateTime().getMillis(), (long) info.getIdleTime().getValue(TimeUnit.SECONDS), info.getWrittenConnectorId().map(ConnectorId::getCatalogName).orElse(null), createStringsBlock(info.getConnectorIds())); } return table.build().cursor(); }
Source:
<code>public int hashCode() { if (service==null && parentService==null) { return 0; } if (service==null) { return parentService.hashCode(); } if (parentService==null) { return service.hashCode(); <START> } <END> return 997 * ((int)service.hashCode()) ^ 991 * ((int)parentService.hashCode()); }</code><technical_language>Consider Objects.hashCode(...), null checks for you</technical_language>

Target:
public int hashCode() { if (service==null && parentService==null) { return 0; } if (service==null) { return parentService.hashCode(); } if (parentService==null) { return service.hashCode(); } return 997 * (service.hashCode()) ^ 991 * (parentService.hashCode()); }
Source:
<code>public CPPASTLiteralExpression(int kind, char[] value, char[] numericCompilerSuffixes) { fKind = kind; fSuffix = getSuffix(kind, value, <START> fSuffix); <END> fLiteral = getLiteral(value, fSuffix); fNumericCompilerSuffixes = (numericCompilerSuffixes == null) ? CharArrayUtils.EMPTY : numericCompilerSuffixes; }</code><technical_language>fSuffix is guaranteed null this point, preferable pass CharArrayUtils.EMPTY parameter minimize amount of work done getSuffix method</technical_language>

Target:
public CPPASTLiteralExpression(int kind, char[] value, char[] numericCompilerSuffixes) { fKind = kind; fSuffix = getSuffix(kind, value, CharArrayUtils.EMPTY); fLiteral = getLiteral(value, fSuffix); fNumericCompilerSuffixes = (numericCompilerSuffixes == null) ? CharArrayUtils.EMPTY : numericCompilerSuffixes; fStringLiteralSize = -1; }
Source:
<code>private ComparableMethodId(@Nonnull JMethodId methodId) { this.methodId = methodId; int sum = methodId.getName().hashCode(); for (JType type : methodId.getParamTypes()) { <START> sum ^= <END> type.hashCode(); } hashCode = sum; }</code><technical_language>is a sum ;-)</technical_language>

Target:
private ComparableMethodId(@Nonnull JMethodId methodId) { this.methodId = methodId; int code = methodId.getName().hashCode(); for (JType type : methodId.getParamTypes()) { code ^= type.hashCode(); } hashCode = code; }
Source:
<code>public void testExportWithStorageDomainName() throws Exception { setUpEntityQueryExpectations(VdcQueryType.GetAllStorageDomains, VdcQueryParametersBase.class, new String[] {}, new Object[] {}, <START> Collections.singletonList(getStorageDomain(2))); <END> StorageDomain storageDomain = new StorageDomain(); storageDomain.setName(NAMES[2]); doTestExport(storageDomain, false, false); }</code><technical_language>please tests, for admin search (old code) for non-admin VdcQueryType.GetAllStorageDomains (new code), note setup filter=true header expectation for it</technical_language>

Target:
public void testExportWithStorageDomainName() throws Exception { setUpGetEntityExpectations("Storage: name=" + NAMES[2], SearchType.StorageDomain, getStorageDomain(2)); StorageDomain storageDomain = new StorageDomain(); storageDomain.setName(NAMES[2]); doTestExport(storageDomain, false, false); }
Source:
<code>protected void beforeSendDeviceInfo(final Context context) { try { Class.forName( "com.amazon.device.messaging.ADM" ); } catch (ClassNotFoundException e) { SwrveLogger.e(LOG_TAG, "ADM message class not found.", e); return; } try { final ADM adm = new ADM(context); String newRegistrationId = adm.getRegistrationId(); if (SwrveHelper.isNullOrEmpty(newRegistrationId)) { SwrveLogger.i(LOG_TAG, "adm.getRegistrationId() returned null. Will call adm.startRegister()."); adm.startRegister(); } else { SwrveLogger.i(LOG_TAG, "adm.getRegistrationId() returned: " + newRegistrationId); registrationId = newRegistrationId; } <START> } catch (Throwable exp) { <END> SwrveLogger.e(LOG_TAG, "Couldn't obtain the registration key for the device.", exp); } }</code><technical_language>catch throwable? Exception surely</technical_language>

Target:
protected void beforeSendDeviceInfo(final Context context) { try { Class.forName( "com.amazon.device.messaging.ADM" ); } catch (ClassNotFoundException e) { SwrveLogger.e(LOG_TAG, "ADM message class not found.", e); return; } try { final ADM adm = new ADM(context); String newRegistrationId = adm.getRegistrationId(); if (SwrveHelper.isNullOrEmpty(newRegistrationId)) { SwrveLogger.i(LOG_TAG, "adm.getRegistrationId() returned null. Will call adm.startRegister()."); adm.startRegister(); } else { SwrveLogger.i(LOG_TAG, "adm.getRegistrationId() returned: " + newRegistrationId); registrationId = newRegistrationId; } } catch (Exception exp) { SwrveLogger.e(LOG_TAG, "Exception when trying to obtain the registration key for the device.", exp); } }
Source:
<code>public SliceDirectSelectiveStreamReader(StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, LocalMemoryContext newLocalMemoryContext) { this.streamDescriptor = streamDescriptor; <START> this.filter = filter.isPresent() ? filter.get() : null; <END> this.systemMemoryContext = newLocalMemoryContext; this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || nonDeterministicFilter || this.filter.testNull(); this.outputRequired = outputType.isPresent(); this.outputType = requireNonNull(outputType, "outputType is null").orElse(null); }</code><technical_language>filter.orElse(null) requireNonNull this.filter = requireNonNull(filter, "filter is null").orElse(null);</technical_language>

Target:
public SliceDirectSelectiveStreamReader(StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, LocalMemoryContext newLocalMemoryContext) { this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = requireNonNull(filter, "filter is null").orElse(null); this.systemMemoryContext = newLocalMemoryContext; this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || nonDeterministicFilter || this.filter.testNull(); this.outputType = requireNonNull(outputType, "outputType is null").orElse(null); this.outputRequired = outputType.isPresent(); this.isCharType = streamDescriptor.getOrcType().getOrcTypeKind() == OrcType.OrcTypeKind.CHAR; this.maxCodePointCount = streamDescriptor.getOrcType().getLength().orElse(-1); checkArgument(filter.isPresent() || outputRequired, "filter must be present if outputRequired is false"); }
Source:
<code>public static ConnectionManagerAwareDbKvs create(DbKeyValueServiceConfig config) { return create(config, false); <START> } <END></code><technical_language>above: AtlasDbConstants.DEFAULT_INITIALIZE_ASYNC</technical_language>

Target:
public static ConnectionManagerAwareDbKvs create(DbKeyValueServiceConfig config) { return create(config, AtlasDbConstants.DEFAULT_INITIALIZE_ASYNC); }
Source:
<code>public ChangeDetailX getChangeDetail(int reviewId, IProgressMonitor monitor) throws GerritException { final Change.Id id = new Change.Id(reviewId); ChangeDetailX changeDetail = execute(monitor, new Operation<ChangeDetailX>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { getChangeDetailService(monitor).changeDetailX(id, this); } }); if (isVersion26OrLater(monitor)) { if (changeDetail.getApprovals() == null) { ChangeInfo changeInfo = getChangeInfo(reviewId, monitor); changeDetail.setApprovals(changeInfo.convertToApprovalDetails()); changeDetail.setApprovalTypes(changeInfo.convertToApprovalTypes()); } List<ReviewerInfo> reviewers = listReviewers(reviewId, monitor); if (!hasAllReviewers(changeDetail.getAccounts(), reviewers)) { merge(changeDetail.getAccounts(), reviewers); } } else if (changeDetail.getApprovalTypes() == null) { <START> changeDetail.convertSubmitRecordsToApprovalTypes(getGerritConfig().getApprovalTypes()); <END> } return changeDetail; }</code><technical_language>getGerritConfig() return null. this: } else if (changeDetail.getApprovalTypes() == null) { changeDetail.setApprovalTypes(getApprovalTypes(refreshConfigOnce(monitor))); } return changeDetail; } private Set<ApprovalType> getApprovalTypes(GerritConfiguration configuration) { if (configuration != null) { GerritConfigX config = configuration.getGerritConfig(); if (config.getApprovalTypes() != null && config.getApprovalTypes().getApprovalTypes() != null) { return new LinkedHashSet<ApprovalType>(config.getApprovalTypes().getApprovalTypes()); } } return null; }</technical_language>

Target:
public ChangeDetailX getChangeDetail(int reviewId, IProgressMonitor monitor) throws GerritException { final Change.Id id = new Change.Id(reviewId); ChangeDetailX changeDetail = execute(monitor, new Operation<ChangeDetailX>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { getChangeDetailService(monitor).changeDetailX(id, this); } }); if (isVersion26OrLater(monitor)) { if (changeDetail.getApprovals() == null) { ChangeInfo changeInfo = getChangeInfo(reviewId, monitor); changeDetail.setApprovals(changeInfo.convertToApprovalDetails()); changeDetail.setApprovalTypes(changeInfo.convertToApprovalTypes()); } List<ReviewerInfo> reviewers = listReviewers(reviewId, monitor); if (!hasAllReviewers(changeDetail.getAccounts(), reviewers)) { merge(changeDetail.getAccounts(), reviewers); } } else if (changeDetail.getApprovalTypes() == null && getGerritConfig() != null) { changeDetail.convertSubmitRecordsToApprovalTypes(getGerritConfig().getApprovalTypes()); } return changeDetail; }
Source:
<code><START> protected List<File> scanPaths() { <END> final List<File> allFiles = new ArrayList<>(); for (int i = 0; i < paths.size(); i++) { final Path currentPath = paths.get(i); final List<File> pathFiles = scanPath(currentPath, i + 1); allFiles.addAll(pathFiles); } return allFiles; }</code><technical_language>protected ? please private</technical_language>

Target:
private List<File> scanPaths() { final List<File> allFiles = new ArrayList<>(); for (int i = 0; i < paths.size(); i++) { final Path currentPath = paths.get(i); final List<File> pathFiles = scanPath(currentPath, i + 1); allFiles.addAll(pathFiles); } return allFiles; }
Source:
<code>public void actionPerformed(ActionEvent event) { try { Case.getCurrentCaseThrows().getSleuthkitCase().deleteDataSource(selectDataSource); } catch (NoCurrentCaseException | TskCoreException e) { String msg = MessageFormat.format(Bundle.ErrorDeletingDataSource_name_text(), selectDataSource); <START> logger.log(Level.WARNING, msg, e); <END> } }</code><technical_language>localize exception messages</technical_language>

Target:
public void actionPerformed(ActionEvent event) { try { Case.getCurrentCaseThrows().getSleuthkitCase().deleteDataSource(selectedDataSource); } catch (NoCurrentCaseException | TskCoreException e) { logger.log(Level.WARNING, "Error Deleting Data source " + selectedDataSource, e); } }
Source:
<code>public void workingWithServers() { dashboardWorkspace.selectTabInWorspaceMenu(TabNames.SERVERS); dashboardWorkspace.selectMachine("Servers", "db"); dashboardWorkspace.clickOnAddServerButton(); dashboardWorkspace.waitAddServerDialogIsOpen(); dashboardWorkspace.enterReference("agen"); dashboardWorkspace.enterPort("8080"); dashboardWorkspace.enterProtocol("https"); dashboardWorkspace.clickOnAddDialogButton(); dashboardWorkspace.checkServerExists("agen", "8080"); clickOnSaveButton(); dashboardWorkspace.clickOnEditServerButton("agen"); dashboardWorkspace.enterReference("agent"); dashboardWorkspace.enterPort("80"); dashboardWorkspace.enterProtocol("http"); dashboardWorkspace.clickOnUpdateDialogButton(); dashboardWorkspace.checkServerExists("agent", "80"); dashboardWorkspace.clickOnDeleteServerButton("agent"); dashboardWorkspace.clickOnDeleteDialogButton(); <START> clickOnSaveButton(); <END> }</code><technical_language>check result of clicking save button in test? long test divided parts is test in fact separated verification part</technical_language>

Target:
public void workingWithServers() { dashboardWorkspace.selectTabInWorspaceMenu(TabNames.SERVERS); dashboardWorkspace.selectMachine("Servers", "db"); dashboardWorkspace.clickOnAddServerButton(); dashboardWorkspace.waitAddServerDialogIsOpen(); dashboardWorkspace.enterReference("agen"); dashboardWorkspace.enterPort("8080"); dashboardWorkspace.enterProtocol("https"); dashboardWorkspace.clickOnAddDialogButton(); clickOnSaveButton(); dashboardWorkspace.checkServerExists("agen", "8080"); dashboardWorkspace.clickOnEditServerButton("agen"); dashboardWorkspace.enterReference("agent"); dashboardWorkspace.enterPort("80"); dashboardWorkspace.enterProtocol("http"); dashboardWorkspace.clickOnUpdateDialogButton(); dashboardWorkspace.checkServerExists("agent", "80"); dashboardWorkspace.clickOnDeleteServerButton("agent"); dashboardWorkspace.clickOnDeleteDialogButton(); clickOnSaveButton(); dashboardWorkspace.checkServerIsNotExists("agent", "80"); }
Source:
<code>private void getNodesAndReleaseThem(int number, TopologyDescriptor descriptor, int expectedReceived, int expectedExtraNodesSize) { <START> NodeSet ns = resourceManager.getAtMostNodes(number, descriptor, null, null); <END> Assert.assertEquals(expectedReceived, ns.size()); Collection<Node> extra = ns.getExtraNodes(); if (expectedExtraNodesSize == 0) { Assert.assertNull(extra); } else { Assert.assertEquals(expectedExtraNodesSize, extra.size()); } resourceManager.releaseNodes(ns).getBooleanValue(); }</code><technical_language>getAtMostNodes is deprecated, do if is replaced NodeSet getNodes(Criteria criteria)</technical_language>

Target:
private void getNodesAndReleaseThem(int number, TopologyDescriptor descriptor, int expectedReceived, int expectedExtraNodesSize) { Criteria c = new Criteria(number); c.setTopology(descriptor); NodeSet ns = resourceManager.getNodes(c); Assert.assertEquals(expectedReceived, ns.size()); Collection<Node> extra = ns.getExtraNodes(); if (expectedExtraNodesSize == 0) { Assert.assertNull(extra); } else { Assert.assertEquals(expectedExtraNodesSize, extra.size()); } resourceManager.releaseNodes(ns).getBooleanValue(); }
Source:
<code>public static String argToString(final Arguments arg) { switch (arg.getType().toLowerCase()) { case "boolean": case "void": return "null"; case "string": return capFirst(arg.getName()); case "double": case "integer": case "int": case "long": return capFirst(arg.getName()) + ".ToString()"; default: <START> return uncapFirst(arg.getName()) + ".toString()"; <END> } }</code><technical_language>this a capital T: ".ToString()"</technical_language>

Target:
public static String argToString(final Arguments arg) { switch (arg.getType().toLowerCase()) { case "boolean": case "void": return "null"; case "string": return capFirst(arg.getName()); case "double": case "integer": case "int": case "long": return capFirst(arg.getName()) + ".ToString()"; default: return uncapFirst(arg.getName()) + ".ToString()"; } }
Source:
<code>public void setCurrentRefreshRate(int newRefreshRate) { saveRefreshRate(newRefreshRate); getModelTimer().setRefreshRate(readRefreshRate()); <START> updateController(); <END> }</code><technical_language>Hm, I suggest extract timer-specific code in updateController method a separate method, for example: private void updateController() { this.controller = modelProvider.getModel(); } private void updateModelTimer() { // rest of code original updateController method } If I read this correctly, need execute timer-specific code (i.e. updateModelTimer method) refresh rate change GUI (i.e. setCurrentRefreshRate method)</technical_language>

Target:
public void setCurrentRefreshRate(int newRefreshRate) { saveRefreshRate(newRefreshRate); getModelTimer().setRefreshRate(readRefreshRate()); updateTimer(); }
Source:
<code>public void shouldNotGenerateUpdateForMultipleExistingPropertiesAndLabels() { NodeUpdates updates = NodeUpdates.forNode( nodeId, labels ) .existing( propertyKeyId1, Values.of( "Neo" ) ) .existing( propertyKeyId2, Values.of( 100L ) ) <START> .existing( propertyKeyId3, Values.of( Values.pointValue( CoordinateReferenceSystem.WGS84, 12.3, 45.6 ) ) ) <END> .build(); assertThat( updates.forIndexKeys( indexes, assertNoLoading() ), emptyIterable() ); }</code><technical_language>need extra Values.of wrap</technical_language>

Target:
public void shouldNotGenerateUpdateForMultipleExistingPropertiesAndLabels() { NodeUpdates updates = NodeUpdates.forNode( nodeId, labels ) .existing( propertyKeyId1, Values.of( "Neo" ) ) .existing( propertyKeyId2, Values.of( 100L ) ) .existing( propertyKeyId3, Values.pointValue( CoordinateReferenceSystem.WGS84, 12.3, 45.6 ) ) .build(); assertThat( updates.forIndexKeys( indexes, assertNoLoading() ), emptyIterable() ); }
Source:
<code>public static Number translateStringToNumber(String val) { try { val = val.replaceAll(" ", ""); if (val.matches("\\d*\\.\\d*")) { return (float)Float.parseFloat(val); } else { return new BigInteger(val); } } catch (Exception e) { <START> logger.info("Unable to parse int/float number from value " + val); <END> } return 0; }</code><technical_language>I un-parsable warrants a warning. If this message is logged constantly, I indicator of a more serious problem</technical_language>

Target:
public static Number translateStringToNumber(String val) { try { val = val.replaceAll(" ", ""); if (val.matches("\\d*\\.\\d*")) { return (float)Float.parseFloat(val); } else { return new BigInteger(val); } } catch (Exception e) { logger.severe("Unable to parse int/float number from value " + val); } return 0; }
Source:
<code>ExecutionPath addEdge(ExplodedGraph.Edge edge) { ImmutableList.Builder<JavaFileScannerContext.Location> flowBuilder = ImmutableList.builder(); flowBuilder.addAll(flow); Symbol newTrackSymbol = addFlowFromLearnedAssociations(edge, flowBuilder); Stream<Constraint> constraintStream = addFlowFromLearnedConstraints(edge, flowBuilder); <START> boolean finished = edge.parent.edges().stream().noneMatch(this::notVisited) || constraintStream.anyMatch(terminateTraversal); <END> return new ExecutionPath(edge, visited.add(edge), newTrackSymbol, flowBuilder.build(), finished); }</code><technical_language>This noneMatch(notVisited) convoluted for practical reason : a Collections.disjoint enough in case ? and/or Guava Sets.intersection (maybe applicable sets only) ? Ideally encapsulated in a "visitedAllParents" method</technical_language>

Target:
ExecutionPath addEdge(ExplodedGraph.Edge edge) { ImmutableList.Builder<JavaFileScannerContext.Location> flowBuilder = ImmutableList.builder(); flowBuilder.addAll(flow); Symbol newTrackSymbol = addFlowFromLearnedAssociations(edge, flowBuilder); Stream<Constraint> constraintStream = addFlowFromLearnedConstraints(edge, flowBuilder); return new ExecutionPath(edge, visited.add(edge), newTrackSymbol, flowBuilder.build(), visitedAllParents(edge) || constraintStream.anyMatch(terminateTraversal)); }
Source:
<code>float getGrowthFactor(int size) { <START> if (CURRENT_GROWTH_RATE >= MINIMUM_GROWTH_FACTOR) { <END> float val = (float) (1 / (1 + Math.pow(Math.E, (-1) * (((double) size / MAX_SIZE) * 12.0 - 6.0)))); CURRENT_GROWTH_RATE = INITIAL_GROWTH_FACTOR - DIFF_GROWTH_FACTOR * val; } return CURRENT_GROWTH_RATE; }</code><technical_language>editing this code, rename CURRENT_GROWTH_RATE currentGrowthRate, clearer instance variable</technical_language>

Target:
float getGrowthFactor(int size) { if (currentGrowthRate >= MINIMUM_GROWTH_FACTOR) { float val = (float) (1 / (1 + Math.pow(Math.E, (-1) * (((double) size / MAX_SIZE) * 12.0 - 6.0)))); currentGrowthRate = INITIAL_GROWTH_FACTOR - DIFF_GROWTH_FACTOR * val; } return currentGrowthRate; }
Source:
<code>public KeyValue next() throws IOException { ByteArrayOutputStream messageBuffer = new ByteArrayOutputStream(); int nextByte; <START> while ((nextByte = mReader.read()) != DELIMITER) { <END> if (nextByte == -1) { if (messageBuffer.size() == 0) { return null; } else { throw new EOFException( "Non-empty message without delimiter"); } } messageBuffer.write(nextByte); } return new KeyValue(this.mOffset++, messageBuffer.toByteArray()); }</code><technical_language>Do need handle case delimiter is part of data (i.e. do need add escaping logic in case delimiter needs escaped</technical_language>

Target:
public KeyValue next() throws IOException { ByteArrayOutputStream messageBuffer = new ByteArrayOutputStream(); int nextByte; while ((nextByte = mReader.read()) != mDelimiter) { if (nextByte == -1) { if (messageBuffer.size() == 0) { return null; } else { throw new EOFException( "Non-empty message without delimiter"); } } messageBuffer.write(nextByte); } return new KeyValue(this.mOffset++, messageBuffer.toByteArray()); }
Source:
<code>public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { if (command.hasFlag(Flag.PUT_FOR_EXTERNAL_READ)) { return handleNonTxWriteCommand(ctx, command); } try { return handleTxWriteCommand(ctx, command, new SingleKeyRecipientGenerator(command.getKey()), <START> command.hasFlag(Flag.PUT_FOR_STATE_TRANSFER)); <END> } finally { if (ctx.isOriginLocal()) { command.setValueMatcher(command.isSuccessful() ? ValueMatcher.MATCH_ALWAYS : ValueMatcher.MATCH_NEVER); } } }</code><technical_language>I removed RecipientGenerator completely passed key directly</technical_language>

Target:
public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { if (command.hasFlag(Flag.PUT_FOR_EXTERNAL_READ)) { return handleNonTxWriteCommand(ctx, command); } try { return handleTxWriteCommand(ctx, command, command.getKey(), command.hasFlag(Flag.PUT_FOR_STATE_TRANSFER)); } finally { if (ctx.isOriginLocal()) { command.setValueMatcher(command.isSuccessful() ? ValueMatcher.MATCH_ALWAYS : ValueMatcher.MATCH_NEVER); } } }
Source:
<code>public void setup(Context.OperatorContext context) { super.setup(context); if (basePath != null) { <START> ((ReaderContext.FixedBytesReaderContext)this.readerContext).setLength((int)fs.getDefaultBlockSize(new Path(basePath))); <END> } }</code><technical_language>add instanceof check</technical_language>

Target:
public void setup(Context.OperatorContext context) { super.setup(context); if (basePath != null && this.readerContext instanceof ReaderContext.FixedBytesReaderContext) { ((ReaderContext.FixedBytesReaderContext)this.readerContext).setLength((int)fs.getDefaultBlockSize(new Path(basePath))); } }
Source:
<code>public synchronized boolean remove(Object o) { boolean removed = removeComponent(legacyInstances, o); if(extensions!=null) { List<ExtensionComponent<T>> r = new ArrayList<ExtensionComponent<T>>(extensions); removed |= removeComponent(r,o); extensions = sort(r); <START> fireOnChangeListeners(); <END> } return removed; }</code><technical_language>exposing lock listeners</technical_language>

Target:
public boolean remove(Object o) { try { return removeSync(o); } finally { if(extensions!=null) { fireOnChangeListeners(); } } }
Source:
<code><START> @Override public Map<String, BatchHandler> getSupportedHandlers() { <END> return Collections.unmodifiableMap(handlers); }</code><technical_language>Format: @Override a separate line single of this method needs keys, return a Set<String></technical_language>

Target:
public Set<String> getSupportedHandlers() { return Collections.unmodifiableSet(handlers.keySet()); }
Source:
<code>public static String getMissingDependenciesErrorMessage(Map<String, Collection<String>> missingDependencies) { Function<Collection<String>, String> toStringList = new Function<Collection<String>, String>() { @Override public String apply(java.util.Collection<String> from) { return Joiner.on(", ").join(from); } }; StringBuilder sb = new StringBuilder(Messages.ViewpointSelection_missingDependencies_header).append("\n"); for (Map.Entry<String, Collection<String>> entry : missingDependencies.entrySet()) { sb.append("- ").append(MessageFormat.format(Messages.ViewpointSelection_missingDependencies_requirements, entry.getKey(), toStringList.apply(entry.getValue()))).append("\n"); <START> } <END> return sb.toString(); }</code><technical_language>I additional "\n" end of new error message</technical_language>

Target:
public static String getMissingDependenciesErrorMessage(Map<String, Collection<String>> missingDependencies) { Function<Collection<String>, String> toStringList = new Function<Collection<String>, String>() { @Override public String apply(java.util.Collection<String> from) { return Joiner.on(", ").join(from); } }; StringBuilder sb = new StringBuilder(Messages.ViewpointSelection_missingDependencies_header).append("\n"); List<String> lines = Lists.newArrayList(); for (Map.Entry<String, Collection<String>> entry : missingDependencies.entrySet()) { lines.add("- " + MessageFormat.format(Messages.ViewpointSelection_missingDependencies_requirements, entry.getKey(), toStringList.apply(entry.getValue()))); } sb.append(Joiner.on("\n").join(lines)); return sb.toString(); }
Source:
<code>public Long getSum(@Nullable Object worker) { Long sum = 0L; for (Long duration : fWorkerStats.get(worker)) { <START> sum += duration; <END> } return sum; }</code><technical_language>+= a Long object boxing time. sum a "long", return Long.valueOf(sum) end. simply return a long in this method</technical_language>

Target:
public Long getSum(@Nullable Object worker) { long sum = 0L; synchronized (fWorkerStats) { for (long duration : fWorkerStats.get(worker)) { sum += duration; } } return sum; }