auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected final List<?> createValues() { <START> if (withNulls == Nulls.ALL) { <END> return NULL_VALUES; } if (withNulls == Nulls.PARTIAL) { return IntStream.range(0, ROWS).mapToObj(i -> i % 2 == 0 ? createValue() : null).collect(toList()); } return IntStream.range(0, ROWS).mapToObj(i -> createValue()).collect(toList()); }</code><technical_language>nit: switch statement more natural switch (withNulls) { case ALL: return NULL_VALUES; case PARTIAL: return IntStream.range(0, ROWS).mapToObj(i -> i % 2 == 0 ? createValue() : null).collect(toList()); default: return IntStream.range(0, ROWS).mapToObj(i -> createValue()).collect(toList()); }</technical_language>

Target:
protected final List<?> createValues() { switch (withNulls) { case ALL: return NULL_VALUES; case PARTIAL: return IntStream.range(0, ROWS).mapToObj(i -> i % 2 == 0 ? createValue() : null).collect(toList()); default: return IntStream.range(0, ROWS).mapToObj(i -> createValue()).collect(toList()); } }
Source:
<code>private void trackModerationFromNotification(final CommentStatus newStatus) { switch (newStatus) { case APPROVED: AnalyticsTracker.track(Stat.NOTIFICATION_APPROVED); break; case UNAPPROVED: <START> AnalyticsTracker.track(Stat.NOTIFICATION_APPROVED); <END> break; case SPAM: AnalyticsTracker.track(Stat.NOTIFICATION_FLAGGED_AS_SPAM); break; case TRASH: AnalyticsTracker.track(Stat.NOTIFICATION_TRASHED); break; } }</code><technical_language>I meant change this NOTIFICATION_APPROVED, missing something</technical_language>

Target:
private void trackModerationFromNotification(final CommentStatus newStatus) { switch (newStatus) { case APPROVED: AnalyticsTracker.track(Stat.NOTIFICATION_APPROVED); break; case UNAPPROVED: AnalyticsTracker.track(Stat.NOTIFICATION_UNAPPROVED); break; case SPAM: AnalyticsTracker.track(Stat.NOTIFICATION_FLAGGED_AS_SPAM); break; case TRASH: AnalyticsTracker.track(Stat.NOTIFICATION_TRASHED); break; } }
Source:
<code>public void initialize(ContainerContext context) { try { ServletContext servletContext = context.getServletContext(); String mode = (String)servletContext.getAttribute(JETTY_CDI_ATTRIBUTE); if (mode == null) { mode = DECORATING_LISTENER_MODE; } switch (mode) { case CDI_SPI_DECORATOR_MODE: JettyLogger.LOG.jettyCdiSpiIsSupported(); break; case CDI_DECORATING_LISTENER_MODE: super.initialize(context); servletContext.setAttribute(CDI_DECORATING_LISTENER_ATTRIBUTE, new WeldDecorator(servletContext)); JettyLogger.LOG.jettyDecorationIsSupported(); break; case DECORATING_LISTENER_MODE: super.initialize(context); String attribute = (String) servletContext.getAttribute(DECORATING_LISTENER_ATTRIBUTE); servletContext.setAttribute(attribute, new WeldDecorator(servletContext)); JettyLogger.LOG.jettyDecorationIsSupported(); break; default: <START> throw new IllegalStateException("unknown mode: " + mode); <END> } } catch (Exception e) { JettyLogger.LOG.unableToCreateJettyWeldInjector(e); } }</code><technical_language>a bit more verbose here. while it, place this JettyLogger please (here is [another logger](<LINK_0> example)</technical_language>

Target:
public void initialize(ContainerContext context) { try { ServletContext servletContext = context.getServletContext(); String mode = (String)servletContext.getAttribute(JETTY_CDI_ATTRIBUTE); if (mode == null) { mode = DECORATING_LISTENER_MODE; } switch (mode) { case CDI_SPI_DECORATOR_MODE: JettyLogger.LOG.jettyCdiSpiIsSupported(); break; case CDI_DECORATING_LISTENER_MODE: super.initialize(context); servletContext.setAttribute(CDI_DECORATING_LISTENER_ATTRIBUTE, new WeldDecorator(servletContext)); JettyLogger.LOG.jettyCdiDecorationIsSupported(); break; case DECORATING_LISTENER_MODE: super.initialize(context); String attribute = (String) servletContext.getAttribute(DECORATING_LISTENER_ATTRIBUTE); servletContext.setAttribute(attribute, new WeldDecorator(servletContext)); JettyLogger.LOG.jettyDecorationIsSupported(); break; default: throw JettyLogger.LOG.unknownIntegrationMode(mode); } } catch (Exception e) { JettyLogger.LOG.unableToCreateJettyWeldInjector(e); } }
Source:
<code>public void contextInitialized(ServletContextEvent servletContextEvent) { LOG.debug("Calling Custom contextInitialized"); String secret = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_SECRET, null); String algorithm = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM, null); String paddingMode = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM_PADDING, null); String ivHash = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM_IV, null); ServletContext context = servletContextEvent.getServletContext(); <START> if (secret != null) { <END> context.setInitParameter(StateUtils.INIT_SECRET, secret); } if (algorithm != null) { context.setInitParameter(StateUtils.INIT_ALGORITHM, algorithm); } if (paddingMode != null) { context.setInitParameter(StateUtils.INIT_ALGORITHM_PARAM, paddingMode); } if (ivHash != null) { context.setInitParameter(StateUtils.INIT_ALGORITHM_IV, ivHash); } super.contextInitialized(servletContextEvent); }</code><technical_language>Do need properties. If && values</technical_language>

Target:
public void contextInitialized(ServletContextEvent servletContextEvent) { LOG.trace("Calling Custom contextInitialized"); String secret = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_SECRET, null); String algorithm = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM, null); String paddingMode = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM_PADDING, null); String ivHash = HelperUtil.readPropertyAdminGui(GUIConstants.JSF_ALGORITHM_IV, null); ServletContext context = servletContextEvent.getServletContext(); if (secret != null && algorithm != null && paddingMode != null && ivHash != null) { context.setInitParameter(StateUtils.INIT_SECRET, secret); context.setInitParameter(StateUtils.INIT_ALGORITHM, algorithm); context.setInitParameter(StateUtils.INIT_ALGORITHM_PARAM, paddingMode); context.setInitParameter(StateUtils.INIT_ALGORITHM_IV, ivHash); } super.contextInitialized(servletContextEvent); }
Source:
<code>private void addValueToPrefs(String value, String prefsName) { if (value.length() > 0) { IDialogSettings settings = org.eclipse.egit.ui.Activator .getDefault().getDialogSettings(); String[] existingValues = settings.getArray(prefsName); if (existingValues == null) { existingValues = new String[] { value }; settings.put(prefsName, existingValues); } else { List<String> values = new ArrayList<String>( existingValues.length + 1); for (String existingValue : existingValues) { if (!values.contains(existingValue)) values.add(existingValue); } if (!values.contains(value)) <START> values.add(value); <END> while (values.size() > 10) values.remove(0); settings.put(prefsName, values .toArray(new String[values.size()])); } } }</code><technical_language>sort in existing in a appears top of list</technical_language>

Target:
private void addValueToPrefs(String value, String prefsName) { if (value.length() > 0) { IDialogSettings settings = org.eclipse.egit.ui.Activator .getDefault().getDialogSettings(); String[] existingValues = settings.getArray(prefsName); if (existingValues == null) { existingValues = new String[] { value }; settings.put(prefsName, existingValues); } else { List<String> values = new ArrayList<String>( existingValues.length + 1); for (String existingValue : existingValues) values.add(existingValue); if (values.indexOf(value) == 0) return; values.remove(value); values.add(0, value); while (values.size() > 10) values.remove(values.size() - 1); settings.put(prefsName, values .toArray(new String[values.size()])); } } }
Source:
<code>private static void defaultTunnelHandler(VirtualFile file, Response response) { <START> try (InputStream in = file.createInputStream()) { <END> if (in == null) { response.error(HttpResponseStatus.NOT_FOUND); return; } try (OutputStream out = response.outputStream(HttpResponseStatus.OK, MimeHelper.guessMimeType(file.name()))) { ByteStreams.copy(in, out); } } catch (IOException e) { response.error(HttpResponseStatus.INTERNAL_SERVER_ERROR, e.getMessage()); } }</code><technical_language>in -> input</technical_language>

Target:
private static void defaultTunnelHandler(VirtualFile file, Response response) { try (InputStream from = file.createInputStream()) { if (from == null) { response.error(HttpResponseStatus.NOT_FOUND); return; } try (OutputStream to = response.outputStream(HttpResponseStatus.OK, MimeHelper.guessMimeType(file.name()))) { ByteStreams.copy(from, to); } } catch (IOException e) { response.error(HttpResponseStatus.INTERNAL_SERVER_ERROR, e.getMessage()); } }
Source:
<code>public void testModelTransformationFromAtoB() throws Exception { File watchfile1 = tempFolder.newFile("file1.csv"); File watchfile2 = tempFolder.newFile("file2.csv"); registerConnector("org.openengsb.domain.example.model.SourceModelA", watchfile1); registerConnector("org.openengsb.domain.example.model.SourceModelB", watchfile2); TransformationEngine transformationEngine = getOsgiService(TransformationEngine.class); <START> ModelDescription modelDescriptionA = new ModelDescription(SourceModelA.class, "3.0.0.SNAPSHOT"); <END> ModelDescription modelDescriptionB = new ModelDescription(SourceModelB.class, "3.0.0.SNAPSHOT"); TransformationDescription transfDescription = new TransformationDescription(modelDescriptionA, modelDescriptionB); transfDescription.forwardField("edbId", "edbId"); transfDescription.forwardField("name", "name"); transformationEngine.saveDescription(transfDescription); FileUtils.write(watchfile1, "\"foo\",\"bar\""); Thread.sleep(1500); String fileContents = FileUtils.readFileToString(watchfile2); assertThat(fileContents, is("\"foo\",\"bar\"")); }</code><technical_language>I live this solution. long I hard code :-)</technical_language>

Target:
public void testModelTransformationFromAtoB() throws Exception { TransformationEngine transformationEngine = getOsgiService(TransformationEngine.class); ModelDescription modelDescriptionA = new ModelDescription(SourceModelA.class, getExampleDomainVersion().toString()); ModelDescription modelDescriptionB = new ModelDescription(SourceModelB.class, getExampleDomainVersion().toString()); TransformationDescription transfDescription = new TransformationDescription(modelDescriptionA, modelDescriptionB); transfDescription.forwardField("edbId", "edbId"); transfDescription.forwardField("name", "name"); transformationEngine.saveDescription(transfDescription); File watchfile1 = tempFolder.newFile("file1.csv"); File watchfile2 = tempFolder.newFile("file2.csv"); registerConnector(SourceModelA.class.getName(), watchfile1); registerConnector(SourceModelB.class.getName(), watchfile2); getOsgiService(ExampleDomain.class, 30000L); Thread.sleep(5000); FileUtils.write(watchfile1, "foo,bar"); Thread.sleep(2000); String fileContents = FileUtils.readFileToString(watchfile2).trim(); assertThat(fileContents, is("foo,bar")); }
Source:
<code>protected ILogData read(final long address, long readStartTime) { try { if (System.currentTimeMillis() - readStartTime < runtime.getParameters().getHoleFillTimeout().toMillis()) { return runtime.getAddressSpaceView().read(address, readOptions); } <START> <END> ReadOptions options = ReadOptions.builder() .ignoreTrim(readOptions.isIgnoreTrim()) .clientCachable(readOptions.isClientCachable()) .serverCachable(readOptions.isServerCachable()) .waitForHole(false) .build(); return runtime.getAddressSpaceView().read(address, options); } catch (TrimmedException te) { processTrimmedException(te); throw te; } }</code><technical_language>simplify long build block here. pass a parameter called toBuilder ReadOption builder: Builder(toBuilder=true), simply use: java ReadOptions options = readOptions.toBuilder() .waitForHole(false) .build() This other fields readOption for waitForHole</technical_language>

Target:
protected ILogData read(final long address, long readStartTime) { try { if (System.currentTimeMillis() - readStartTime < runtime.getParameters().getHoleFillTimeout().toMillis()) { return runtime.getAddressSpaceView().read(address, readOptions); } ReadOptions options = readOptions.toBuilder() .waitForHole(false) .build(); return runtime.getAddressSpaceView().read(address, options); } catch (TrimmedException te) { processTrimmedException(te); throw te; } }
Source:
<code>private void filterAsynchronousResponses(ArrayList<String> responses) throws ResponseException { for (String response : responses) { <START> if (response.contains("HTTP/1.1 400")) { <END> throw new ResponseException("ElasticSearch failed to add one or more documents!"); } } }</code><technical_language>other error messages server side (like 404, 500, ...)</technical_language>

Target:
private void filterAsynchronousResponses(ArrayList<String> responses) throws ResponseException { for (String response : responses) { if (!(response.contains("HTTP/1.1 200") || response.contains("HTTP/1.1 201"))) { throw new ResponseException("ElasticSearch failed to add one or more documents! Reason: " + response); } } }
Source:
<code><START> public int[] crc32(Context context) <END> { for (int i = 0; i < SIZE; i++) { context.bb.rewind(); context.results[i] = U.calcCrc(context.bb, BUF_LEN); } return context.results; }</code><technical_language>formatting error</technical_language>

Target:
public int[] crc32(Context context) { for (int i = 0; i < SIZE; i++) { context.bb.rewind(); context.results[i] = FastCrc.calcCrc(context.bb, BUF_LEN); } return context.results; }
Source:
<code>private void writeSavedConnectionResponse(HttpServletResponse response, DatabaseConfiguration savedConnection) throws IOException { Writer w = response.getWriter(); try { JsonGenerator writer = ParsingUtilities.mapper.getFactory().createGenerator(w); writer.writeStartObject(); writer.writeArrayFieldStart(DatabaseUtils.SAVED_CONNECTION_KEY); writer.writeStartObject(); <START> String sanitizedConnName = Encode.forHtml(savedConnection.getConnectionName()); <END> writer.writeStringField("connectionName", sanitizedConnName); writer.writeStringField("databaseType", savedConnection.getDatabaseType()); String sanitizedHost = Encode.forHtml(savedConnection.getDatabaseHost()); writer.writeStringField("databaseHost", sanitizedHost); writer.writeNumberField("databasePort", savedConnection.getDatabasePort()); String sanitizedDbName = Encode.forHtml(savedConnection.getDatabaseName()); writer.writeStringField("databaseName", sanitizedDbName); String dbPasswd = savedConnection.getDatabasePassword(); if(dbPasswd != null && !dbPasswd.isEmpty()) { dbPasswd = DatabaseUtils.decrypt(savedConnection.getDatabasePassword()); } writer.writeStringField("databasePassword", dbPasswd); writer.writeStringField("databaseSchema", savedConnection.getDatabaseSchema()); String sanitizedDbUser = Encode.forHtml(savedConnection.getDatabaseUser()); writer.writeStringField("databaseUser", sanitizedDbUser); logger.info("Input DB User:{}, SanitizedDbUser:{}", savedConnection.getDatabaseUser(), sanitizedDbUser); writer.writeEndObject(); writer.writeEndArray(); writer.writeEndObject(); writer.flush(); writer.close(); }finally { w.flush(); w.close(); } }</code><technical_language>Intuitively I do HTML escaping in frontend. backend expose database credentials in true form, is frontend's job render user</technical_language>

Target:
private void writeSavedConnectionResponse(HttpServletResponse response, DatabaseConfiguration savedConnection) throws IOException { Writer w = response.getWriter(); try { JsonGenerator writer = ParsingUtilities.mapper.getFactory().createGenerator(w); writer.writeStartObject(); writer.writeArrayFieldStart(DatabaseUtils.SAVED_CONNECTION_KEY); writer.writeStartObject(); writer.writeStringField("connectionName", savedConnection.getConnectionName()); writer.writeStringField("databaseType", savedConnection.getDatabaseType()); writer.writeStringField("databaseHost", savedConnection.getDatabaseHost()); writer.writeNumberField("databasePort", savedConnection.getDatabasePort()); writer.writeStringField("databaseName", savedConnection.getDatabaseName()); String dbPasswd = savedConnection.getDatabasePassword(); if(dbPasswd != null && !dbPasswd.isEmpty()) { dbPasswd = DatabaseUtils.decrypt(savedConnection.getDatabasePassword()); } writer.writeStringField("databasePassword", dbPasswd); writer.writeStringField("databaseSchema", savedConnection.getDatabaseSchema()); writer.writeStringField("databaseUser", savedConnection.getDatabaseUser()); writer.writeEndObject(); writer.writeEndArray(); writer.writeEndObject(); writer.flush(); writer.close(); }finally { w.flush(); w.close(); } }
Source:
<code>public void testGenericImageExtraction() { org.atlasapi.media.entity.Series extractedGenericImage = extractor.extract(seriesWithGenericImage()); Image genericImage = Iterables.getOnlyElement(extractedGenericImage.getImages()); <START> Assert.assertEquals("<LINK_0>", extractedGenericImage.getImage()); <END> Assert.assertEquals(ImageType.GENERIC_IMAGE_CONTENT_ORIGINATOR, genericImage.getType()); }</code><technical_language>import static Assert.assertEquals()</technical_language>

Target:
public void testGenericImageExtraction() { org.atlasapi.media.entity.Series extractedGenericImage = extractor.extract(seriesWithGenericImage()); Image genericImage = Iterables.getOnlyElement(extractedGenericImage.getImages()); assertEquals("<LINK_0>", extractedGenericImage.getImage()); assertEquals(ImageType.GENERIC_IMAGE_CONTENT_ORIGINATOR, genericImage.getType()); }
Source:
<code>protected boolean setAndValidateDiskProfiles() { Map<DiskImage, Guid> map = new HashMap<>(); <START> if (diskInfoDestinationMap != null) { <END> for (DiskImage diskImage : diskInfoDestinationMap.values()) { map.put(diskImage, diskImage.getStorageIds().get(0)); } } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); }</code><technical_language>create map needed</technical_language>

Target:
protected boolean setAndValidateDiskProfiles() { if (diskInfoDestinationMap != null) { Map<DiskImage, Guid> map = new HashMap<>(); for (DiskImage diskImage : diskInfoDestinationMap.values()) { map.put(diskImage, diskImage.getStorageIds().get(0)); } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }
Source:
<code>public void testSingleRollingFileFailedWrite1() { SingleHDFSExactlyOnceWriter writer = new SingleHDFSExactlyOnceWriter(); writer.setFilePath(testMeta.getDir()); writer.setMaxLength(4); writer.setAlwaysWriteToTmp(testMeta.writeToTmp); writer.setup(testMeta.testOperatorContext); writer.beginWindow(0); writer.input.put(0); writer.input.put(1); writer.input.put(2); writer.endWindow(); writer.beginWindow(1); writer.input.put(3); writer.input.put(4); writer.endWindow(); AbstractFileOutputOperator checkPointWriter = checkpoint(writer, 0); <START> AbstractFileOutputOperator checkPointWriter1 = checkpoint(writer, -1); <END> LOG.debug("Checkpoint endOffsets={}", checkPointWriter.endOffsets); writer.beginWindow(2); writer.input.put(5); writer.teardown(); restoreCheckPoint(checkPointWriter, writer); LOG.debug("Checkpoint endOffsets={}", checkPointWriter.endOffsets); writer.setup(testMeta.testOperatorContext); writer.beginWindow(2); writer.input.put(5); writer.endWindow(); writer.beginWindow(3); writer.input.put(6); writer.input.put(7); writer.input.put(8); writer.endWindow(); writer.teardown(); restoreCheckPoint(checkPointWriter1, writer); writer.setup(testMeta.testOperatorContext); writer.committed(2); String singleFilePath = testMeta.getDir() + File.separator + SINGLE_FILE; String correctContents = "0\n" + "1\n" + "2\n"; checkOutput(0, singleFilePath, correctContents); correctContents = "3\n" + "4\n"; checkOutput(1, singleFilePath, correctContents); }</code><technical_language>Nitpick: instead of -1, Stateless.WindowId</technical_language>

Target:
public void testSingleRollingFileFailedWrite1() { SingleHDFSExactlyOnceWriter writer = new SingleHDFSExactlyOnceWriter(); writer.setFilePath(testMeta.getDir()); writer.setMaxLength(4); writer.setAlwaysWriteToTmp(testMeta.writeToTmp); writer.setup(testMeta.testOperatorContext); writer.beginWindow(0); writer.input.put(0); writer.input.put(1); writer.input.put(2); writer.endWindow(); writer.beginWindow(1); writer.input.put(3); writer.input.put(4); writer.endWindow(); AbstractFileOutputOperator checkPointWriter = checkpoint(writer, Stateless.WINDOW_ID); AbstractFileOutputOperator checkPointWriter1 = checkpoint(writer, Stateless.WINDOW_ID); LOG.debug("Checkpoint endOffsets={}", checkPointWriter.endOffsets); writer.beginWindow(2); writer.input.put(5); writer.teardown(); restoreCheckPoint(checkPointWriter, writer); LOG.debug("Checkpoint endOffsets={}", checkPointWriter.endOffsets); writer.setup(testMeta.testOperatorContext); writer.beginWindow(2); writer.input.put(5); writer.endWindow(); writer.beginWindow(3); writer.input.put(6); writer.input.put(7); writer.input.put(8); writer.endWindow(); writer.teardown(); restoreCheckPoint(checkPointWriter1, writer); writer.setup(testMeta.testOperatorContext); writer.committed(2); String singleFilePath = testMeta.getDir() + File.separator + SINGLE_FILE; String correctContents = "0\n" + "1\n" + "2\n"; checkOutput(0, singleFilePath, correctContents); correctContents = "3\n" + "4\n"; checkOutput(1, singleFilePath, correctContents); }
Source:
<code>public List<UserDeveloperMapDTO> getByDeveloperId(final Long developerId) { Query query = entityManager.createQuery( "from UserDeveloperMapEntity udm " + "join fetch udm.developer developer " + "join fetch udm.user u " + "join fetch u.permission perm " + "join fetch u.contact contact " + "where (udm.deleted != true) " <START> + "AND (cb.id = :developerId) ", <END> UserDeveloperMapEntity.class); query.setParameter("developerId", developerId); List<UserDeveloperMapEntity> result = query.getResultList(); List<UserDeveloperMapDTO> dtos = new ArrayList<UserDeveloperMapDTO>(); for (UserDeveloperMapEntity entity : result) { dtos.add(new UserDeveloperMapDTO(entity)); } return dtos; }</code><technical_language>"cb.id" I "cb" is in this query. I change HQL if code is called need this method</technical_language>

Target:
public List<UserDeveloperMapDTO> getByDeveloperId(final Long developerId) { Query query = entityManager.createQuery( "from UserDeveloperMapEntity udm " + "join fetch udm.developer developer " + "join fetch udm.user u " + "join fetch u.permission perm " + "join fetch u.contact contact " + "where (udm.deleted != true) " + "AND (developer.id = :developerId) ", UserDeveloperMapEntity.class); query.setParameter("developerId", developerId); List<UserDeveloperMapEntity> result = query.getResultList(); List<UserDeveloperMapDTO> dtos = new ArrayList<UserDeveloperMapDTO>(); for (UserDeveloperMapEntity entity : result) { dtos.add(new UserDeveloperMapDTO(entity)); } return dtos; }
Source:
<code>public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fUstAnalysisModule.getAnalysisRequirements(); <START> assertNotNull(requirements); <END> TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST, domain); } String[] events = { UstMemoryStrings.MALLOC, UstMemoryStrings.FREE, UstMemoryStrings.CALLOC, UstMemoryStrings.REALLOC, UstMemoryStrings.MEMALIGN, UstMemoryStrings.POSIX_MEMALIGN }; List<String> expectedEvents = Arrays.asList(events); assertEquals(6, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } Set<String> infos = eventReq.getInformation(); assertEquals(2, infos.size()); }</code><technical_language>Iterable give a .size() method, check assertTrue(requirements.hasNext()), (I assume) actual requirements sent</technical_language>

Target:
public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fUstAnalysisModule.getAnalysisRequirements(); assertNotNull(requirements); assertTrue(requirements.iterator().hasNext()); TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST, domain); } List<String> expectedEvents = ImmutableList.of( UstMemoryStrings.MALLOC, UstMemoryStrings.FREE, UstMemoryStrings.CALLOC, UstMemoryStrings.REALLOC, UstMemoryStrings.MEMALIGN, UstMemoryStrings.POSIX_MEMALIGN ); assertEquals(6, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } Set<String> infos = eventReq.getInformation(); assertEquals(2, infos.size()); }
Source:
<code>void onShinyRecordTest() { checkTestPackageDependencies( new Command() { @Override public void execute() { String shinyAppPath = FilePathUtils.dirFromFile(docUpdateSentinel_.getPath()); if (fileType_.canKnitToHTML()) { shinyAppPath = docUpdateSentinel_.getPath(); } <START> String code = "shinytest::recordTest(\"" + shinyAppPath + "\")"; <END> events_.fireEvent(new SendToConsoleEvent(code, true)); } }, false ); }</code><technical_language>Needs quote escaping</technical_language>

Target:
void onShinyRecordTest() { checkTestPackageDependencies( new Command() { @Override public void execute() { String shinyAppPath = FilePathUtils.dirFromFile(docUpdateSentinel_.getPath()); if (fileType_.canKnitToHTML()) { shinyAppPath = docUpdateSentinel_.getPath(); } String code = "shinytest::recordTest(\"" + shinyAppPath.replace("\"", "\\\"") + "\")"; events_.fireEvent(new SendToConsoleEvent(code, true)); } }, false ); }
Source:
<code>private Map<String, Object> contextWithSqlId(Map<String, Object> queryContext) { Map<String, Object> newContext = new HashMap<>(); if (queryContext != null) { newContext.putAll(queryContext); } <START> newContext.putIfAbsent(PlannerContext.CTX_SQL_QUERY_ID, UUID.randomUUID().toString()); <END> return newContext; }</code><technical_language>Another good candidate for computeIfAbsent</technical_language>

Target:
private Map<String, Object> contextWithSqlId(Map<String, Object> queryContext) { Map<String, Object> newContext = new HashMap<>(); if (queryContext != null) { newContext.putAll(queryContext); } newContext.computeIfAbsent(PlannerContext.CTX_SQL_QUERY_ID, k -> UUID.randomUUID().toString()); return newContext; }
Source:
<code>protected void prepareURLs() { UrlBuilder urlBuilder = new UrlBuilder(config.getEnv()); wikiURL = urlBuilder.getUrlForWiki(config.getWikiName()); wikiCorporateURL = urlBuilder.getUrlForWiki("wikia"); <START> wikiCorpSetupURL = urlBuilder.getUrlForWiki("corp"); <END> printProperties(); }</code><technical_language>I moved Test file</technical_language>

Target:
protected void prepareURLs() { urlBuilder = new UrlBuilder(config.getEnv()); wikiURL = urlBuilder.getUrlForWiki(config.getWikiName()); wikiCorporateURL = urlBuilder.getUrlForWiki("wikia"); printProperties(); }
Source:
<code>public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); ModelNode modelNode = context.readResourceFromRoot(address).getModel(); <START> ModelNode configuredApplication = modelNode.get(ModelDescriptionConstants.CONFIGURED_APPLICATION); <END> final ModelNode value = operation.require(VALUE); final ApplicationTypeConfigResource resource = (ApplicationTypeConfigResource)context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS); final ApplicationTypeConfig classification = resource.applicationType; classification.setConfiguredApplication(readValue(context, value, CONFIGURED_APPLICATION)); context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { try { classification.setConfiguredApplication(readValue(context, configuredApplication, CONFIGURED_APPLICATION)); } catch (OperationFailedException e) { throw new RuntimeException(e); } } }); }</code><technical_language>lines L128 line ModelNode modelNode = resource.getModel(); Resource context.readResourceForUpdate includes data need restore</technical_language>

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode value = operation.require(VALUE); final ApplicationTypeConfigResource resource = (ApplicationTypeConfigResource) context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS); final ModelNode modelNode = resource.getModel(); final ModelNode configuredApplication = modelNode.get(ModelDescriptionConstants.CONFIGURED_APPLICATION); final ApplicationTypeConfig classification = resource.applicationType; classification.setConfiguredApplication(readValue(context, value, CONFIGURED_APPLICATION)); context.completeStep(new OperationContext.RollbackHandler() { @Override public void handleRollback(OperationContext context, ModelNode operation) { try { classification.setConfiguredApplication(readValue(context, configuredApplication, CONFIGURED_APPLICATION)); } catch (OperationFailedException e) { throw new RuntimeException(e); } } }); }
Source:
<code>public String getDefaultDunningCampaignCode() { String parameterDunningCampaignCode = ""; <START> if (getParameterService().parameterExists(DunningCampaign.class, ArConstants.DEFAULT_DUNNING_CAMPAIGN_PARAMETER)) { <END> parameterDunningCampaignCode = getParameterService().getParameterValueAsString(DunningCampaign.class, ArConstants.DEFAULT_DUNNING_CAMPAIGN_PARAMETER); } return parameterDunningCampaignCode; }</code><technical_language>Do need this anymore? send empty string a default</technical_language>

Target:
public String getDefaultDunningCampaignCode() { return getParameterService().getParameterValueAsString(DunningCampaign.class, ArConstants.DEFAULT_DUNNING_CAMPAIGN_PARAMETER,""); }
Source:
<code>private static NetworkInterface findNetworkInterface() { Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (final SocketException ex) { throw new HostException(ex); } List<NetworkInterface> validNetworkInterfaces = new LinkedList<>(); while (interfaces.hasMoreElements()) { NetworkInterface networkInterface = interfaces.nextElement(); if (ignoreNetworkInterface(networkInterface)) { continue; } validNetworkInterfaces.add(networkInterface); } NetworkInterface networkInterface = null; for (NetworkInterface item : validNetworkInterfaces) { if (isPreferredNetworkInterface(item)) { networkInterface = item; break; } } if (networkInterface == null) { networkInterface = getFirstNetworkInterface(validNetworkInterfaces); } <START> return networkInterface; <END> }</code><technical_language>prefer result name result variable</technical_language>

Target:
private static NetworkInterface findNetworkInterface() { Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); } catch (final SocketException ex) { throw new HostException(ex); } List<NetworkInterface> validNetworkInterfaces = new LinkedList<>(); while (interfaces.hasMoreElements()) { NetworkInterface networkInterface = interfaces.nextElement(); if (ignoreNetworkInterface(networkInterface)) { continue; } validNetworkInterfaces.add(networkInterface); } NetworkInterface result = null; for (NetworkInterface each : validNetworkInterfaces) { if (isPreferredNetworkInterface(each)) { result = each; break; } } if (null == result) { result = getFirstNetworkInterface(validNetworkInterfaces); } return result; }
Source:
<code>public static String constrainLevel( RolapLevel level, SqlQuery query, RolapCube baseCube, AggStar aggStar, String[] columnValue, boolean caseSensitive) { RolapStar.Column column = null; if (level instanceof RolapCubeLevel) { column = ((RolapCubeLevel)level).getBaseStarKeyColumn(baseCube); } String columnString; Dialect.Datatype datatype; if (column != null) { if (column.getNameColumn() == null) { datatype = level.getDatatype(); } else { column = column.getNameColumn(); datatype = Dialect.Datatype.String; } if (aggStar != null) { int bitPos = column.getBitPosition(); AggStar.Table.Column aggColumn = aggStar.lookupColumn(bitPos); if(aggColumn == null){ <START> LOG.warn("Aggregate table: A constraint will not be generated because name column is not the same as key column"); <END> return ""; } columnString = aggColumn.generateExprString(query); } else { columnString = column.generateExprString(query); } } else { assert (aggStar == null); MondrianDef.Expression exp = level.getNameExp(); if (exp == null) { exp = level.getKeyExp(); datatype = level.getDatatype(); } else { datatype = Dialect.Datatype.String; } columnString = exp.getExpression(query); } String constraint; constraint = getColumnValueConstraint( query, columnValue, caseSensitive, columnString, datatype); return constraint; }</code><technical_language>This message externalized in mondrianresource.xml</technical_language>

Target:
public static String constrainLevel( RolapLevel level, SqlQuery query, RolapCube baseCube, AggStar aggStar, String[] columnValue, boolean caseSensitive) { RolapStar.Column column = null; if (level instanceof RolapCubeLevel) { column = ((RolapCubeLevel)level).getBaseStarKeyColumn(baseCube); } String columnString; Dialect.Datatype datatype; if (column != null) { if (column.getNameColumn() == null) { datatype = level.getDatatype(); } else { column = column.getNameColumn(); datatype = Dialect.Datatype.String; } if (aggStar != null) { int bitPos = column.getBitPosition(); AggStar.Table.Column aggColumn = aggStar.lookupColumn(bitPos); if(aggColumn == null){ LOG.warn(mres.AggTableNoConstraintGenerated.str(aggStar.getFactTable().getName())); return ""; } columnString = aggColumn.generateExprString(query); } else { columnString = column.generateExprString(query); } } else { assert (aggStar == null); MondrianDef.Expression exp = level.getNameExp(); if (exp == null) { exp = level.getKeyExp(); datatype = level.getDatatype(); } else { datatype = Dialect.Datatype.String; } columnString = exp.getExpression(query); } String constraint; constraint = getColumnValueConstraint( query, columnValue, caseSensitive, columnString, datatype); return constraint; }
Source:
<code>public void testKillArguments() { assertParseArgsThrows("Expected type of resource to kill.", "--kill"); assertParseArgsThrows("Expected compute task id.", "--kill", "compute"); assertParseArgsThrows("Invalid UUID string: not_a_uuid", IllegalArgumentException.class, "--kill", "compute", "not_a_uuid"); assertParseArgsThrows("Expected service name.", "--kill", "service"); <START> assertParseArgsThrows("Expected transaction id.", "--kill", "tx"); <END> assertParseArgsThrows("Expected SQL query id.", "--kill", "sql"); assertParseArgsThrows("Expected global query id. " + EXPECTED_GLOBAL_QRY_ID_FORMAT, "--kill", "sql", "not_sql_id"); }</code><technical_language>Do positive parsing tests ensure arguments parsed well? tests ensure wrong argument types handled gracefully</technical_language>

Target:
public void testKillArguments() { assertParseArgsThrows("Expected type of resource to kill.", "--kill"); assertParseArgsThrows("Expected compute task id.", "--kill", "compute"); assertParseArgsThrows("Invalid UUID string: not_a_uuid", IllegalArgumentException.class, "--kill", "compute", "not_a_uuid"); assertParseArgsThrows("Expected service name.", "--kill", "service"); assertParseArgsThrows("Expected transaction id.", "--kill", "transaction"); assertParseArgsThrows("Expected SQL query id.", "--kill", "sql"); assertParseArgsThrows("Expected global query id. " + EXPECTED_GLOBAL_QRY_ID_FORMAT, "--kill", "sql", "not_sql_id"); }
Source:
<code>private void checkInitialDB() throws IOException { assertThat(getWorkflows().size()).isEqualTo(0); <START> assertThat(getTools().size()).isEqualTo(4); <END> }</code><technical_language>this number increase test new features, breaking this test. Check 4 tools, 1 dockstoretestuser2, etc</technical_language>

Target:
private void checkInitialDB() throws IOException { List<Workflow> currentWorkflows = getWorkflows(); assertThat(currentWorkflows.size()).isGreaterThanOrEqualTo(0); List<Tool> currentTools = getTools(); List<Tool> dockstore2Tools = currentTools.parallelStream().filter(tool -> tool.getNamespace().equals("dockstore2")) .collect(Collectors.toList()); List<Tool> dockstoretestuser2Tools = currentTools.parallelStream().filter(tool -> tool.getNamespace().equals("dockstoretestuser2")) .collect(Collectors.toList()); assertThat(dockstore2Tools.size()).isGreaterThanOrEqualTo(1); assertThat(dockstoretestuser2Tools.size()).isGreaterThanOrEqualTo(3); assertThat(currentTools.size()).isGreaterThanOrEqualTo(4); previousTools = currentTools; previousWorkflows = currentWorkflows; }
Source:
<code>protected boolean set(Entity dataHolder, Integer value) { dataHolder.hurtResistantTime = value; <START> if (dataHolder instanceof EntityLivingBase) ((EntityLivingBase) dataHolder).hurtTime = value; <END> return true; }</code><technical_language>Need braces statement style guide</technical_language>

Target:
protected boolean set(Entity dataHolder, Integer value) { dataHolder.hurtResistantTime = value; if (dataHolder instanceof EntityLivingBase) { ((EntityLivingBase) dataHolder).hurtTime = value; } return true; }
Source:
<code>private static PropertyDescriptor[] getPropertiesHelper(Class type, boolean read, boolean write) { try { BeanInfo info = Introspector.getBeanInfo(type, Object.class); PropertyDescriptor[] all = info.getPropertyDescriptors(); if (read && write) { return all; } List properties = new ArrayList(all.length); for (int i = 0; i < all.length; i++) { PropertyDescriptor pd = all[i]; if ((read && pd.getReadMethod() != null) || (write && pd.getWriteMethod() != null)) { properties.add(pd); } } <START> return (PropertyDescriptor[]) properties.toArray(new PropertyDescriptor[0]); <END> } catch (IntrospectionException e) { throw new CodeGenerationException(e); } }</code><technical_language>Please revert this change</technical_language>

Target:
private static PropertyDescriptor[] getPropertiesHelper(Class type, boolean read, boolean write) { try { BeanInfo info = Introspector.getBeanInfo(type, Object.class); PropertyDescriptor[] all = info.getPropertyDescriptors(); if (read && write) { return all; } List properties = new ArrayList(all.length); for (int i = 0; i < all.length; i++) { PropertyDescriptor pd = all[i]; if ((read && pd.getReadMethod() != null) || (write && pd.getWriteMethod() != null)) { properties.add(pd); } } return (PropertyDescriptor[]) properties.toArray(new PropertyDescriptor[properties.size()]); } catch (IntrospectionException e) { throw new CodeGenerationException(e); } }
Source:
<code>public Stock getStockForSymbol(String symbol) { if (stockList.containsKey(symbol)) { return stockList.get(symbol); } <START> return null; <END> }</code><technical_language>throw a exception return null</technical_language>

Target:
public Stock getStockForSymbol(String symbol) { if (stockList.containsKey(symbol)) { return stockList.get(symbol); } throw new StockMarketExpection( "Tried to enter a key that is invalid (" + stock.getSymbol() + ")"); }
Source:
<code>public void onMediaRetryClicked(String mediaId) { <START> MediaModel media = mMediaStore.getMediaWithLocalId(Integer.valueOf(mediaId)); <END> if (media == null) { AppLog.e(T.MEDIA, "Can't find media with local id: " + mediaId); return; } if (UploadState.valueOf(media.getUploadState()) == UploadState.UPLOADED) { if (mEditorMediaUploadListener != null) { mEditorMediaUploadListener.onMediaUploadSucceeded(String.valueOf(media.getId()), FluxCUtils.mediaFileFromMediaModel(media)); } } else { media.setUploadState(UploadState.QUEUED.name()); mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(media)); mPendingUploads.add(media); startMediaUploadService(); } AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_RETRIED); }</code><technical_language>I run issue in #5566 in this line. checking ! TextUtils.isEmpty(mediaId) attempting run Integer.valueOf prevent</technical_language>

Target:
public void onMediaRetryClicked(String mediaId) { if (TextUtils.isEmpty(mediaId)) { AppLog.e(T.MEDIA, "Invalid media id passed to onMediaRetryClicked"); return; } MediaModel media = mMediaStore.getMediaWithLocalId(Integer.valueOf(mediaId)); if (media == null) { AppLog.e(T.MEDIA, "Can't find media with local id: " + mediaId); return; } if (UploadState.valueOf(media.getUploadState()) == UploadState.UPLOADED) { if (mEditorMediaUploadListener != null) { mEditorMediaUploadListener.onMediaUploadSucceeded(String.valueOf(media.getId()), FluxCUtils.mediaFileFromMediaModel(media)); } } else { media.setUploadState(UploadState.QUEUED.name()); mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(media)); mPendingUploads.add(media); startMediaUploadService(); } AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_RETRIED); }
Source:
<code>public void insertRowsFromTsvFileWithHeader() { File dataFile = new File("src/test/resources/examples/dataWithHeader1.tsv"); TsvFileParser parser = new TsvFileParser().withHeader(true); String[] header = parser.parseHeader(dataFile); <START> shell.insertInto("source_db", "test_table") <END> .withColumns(header) .addRowsFrom(dataFile, parser) .commit(); printResult(shell.executeStatement("select * from source_db.test_table")); }</code><technical_language>I nicer if header extraction implicit, i.e. magically call addRowsFrom do need manually extract header a call TsvFileParser.parseHeader. This simpler for users remove a method public API. Yes, require a reworking of insertInto implementation, I find sequence a bit clunky unnecessary: String[] header = parser.parseHeader(dataFile); ... .withColumns(header) insertInto able figure out columns parser</technical_language>

Target:
public void insertRowsFromTsvFileWithHeader() { File dataFile = new File("src/test/resources/examples/dataWithHeader1.tsv"); TsvFileParser parser = new TsvFileParser().withHeader(); shell.insertInto("source_db", "test_table") .addRowsFrom(dataFile, parser) .commit(); printResult(shell.executeStatement("select * from source_db.test_table")); }
Source:
<code>public void run() { while(keepRunning) { try { List<String> messages = Lists.newArrayList(); Set<ObjectName> beans = server.queryNames(null, null); for(ObjectName name : beans) { String item = objectMapper.writeValueAsString(name); Broadcast broadcast = null; if(name.getKeyPropertyList().get("type") != null) { if (name.getKeyPropertyList().get("type").equals("ThroughputQueue")) { broadcast = objectMapper.readValue(item, ThroughputQueueBroadcast.class); } else if (name.getKeyPropertyList().get("type").equals("StreamsTaskCounter")) { broadcast = objectMapper.readValue(item, StreamsTaskCounterBroadcast.class); } else if (name.getKeyPropertyList().get("type").equals("DatumStatusCounter")) { broadcast = objectMapper.readValue(item, DatumStatusCounterBroadcast.class); } else if (name.getKeyPropertyList().get("type").equals("Memory")) { broadcast = objectMapper.readValue(item, MemoryUsageBroadcast.class); } if(broadcast != null) { messages.add(objectMapper.writeValueAsString(broadcast)); } } } messagePersister.persistMessages(messages); <START> Thread.sleep(DEFAULT_WAIT_TIME); <END> } catch (InterruptedException e) { LOGGER.error("Interrupted!: {}", e); } catch (Exception e) { LOGGER.error("Exception: {}", e); } } }</code><technical_language>adding monitoring.broadcast_interval_ms StreamsConfiguration parse/load setup</technical_language>

Target:
public void run() { while(keepRunning) { try { List<String> messages = Lists.newArrayList(); Set<ObjectName> beans = server.queryNames(null, null); for(ObjectName name : beans) { String item = objectMapper.writeValueAsString(name); Broadcast broadcast = null; if(name.getKeyPropertyList().get("type") != null) { if (name.getKeyPropertyList().get("type").equals("ThroughputQueue")) { broadcast = objectMapper.readValue(item, ThroughputQueueBroadcast.class); } else if (name.getKeyPropertyList().get("type").equals("StreamsTaskCounter")) { broadcast = objectMapper.readValue(item, StreamsTaskCounterBroadcast.class); } else if (name.getKeyPropertyList().get("type").equals("DatumStatusCounter")) { broadcast = objectMapper.readValue(item, DatumStatusCounterBroadcast.class); } else if (name.getKeyPropertyList().get("type").equals("Memory")) { broadcast = objectMapper.readValue(item, MemoryUsageBroadcast.class); } if(broadcast != null) { messages.add(objectMapper.writeValueAsString(broadcast)); } } } messagePersister.persistMessages(messages); Thread.sleep(waitTime); } catch (InterruptedException e) { LOGGER.error("Interrupted!: {}", e); } catch (Exception e) { LOGGER.error("Exception: {}", e); } } }
Source:
<code>public void verifyAnswerableForStudent(FeedbackQuestionAttributes feedbackQuestionAttributes) { <START> verifyNotNull(feedbackQuestionAttributes, "feedback session's course ID"); <END> if (feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.STUDENTS && feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.TEAMS) { throw new UnauthorizedAccessException("Feedback question is not answerable for students"); } }</code><technical_language>feedback session's ID -> feedback question</technical_language>

Target:
public void verifyAnswerableForStudent(FeedbackQuestionAttributes feedbackQuestionAttributes) { verifyNotNull(feedbackQuestionAttributes, "feedback question"); if (feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.STUDENTS && feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.TEAMS) { throw new UnauthorizedAccessException("Feedback question is not answerable for students"); } }
Source:
<code>private void startTransferThread() { try { final byte[] keyBytes = key.getBytes("UTF-8"); Runnable transferFromQueueToSystem = () -> { while (!Thread.currentThread().isInterrupted()) { try { <START> sendEventToSystemProducer(logQueue.take()); <END> } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { metrics.logMessagesErrors.inc(); log.error("Error sending " + getName() + " event to SystemProducer", t); } } }; transferThread = new Thread(transferFromQueueToSystem); transferThread.setDaemon(true); transferThread.setName("Samza " + getName() + " Producer " + transferThread.getName()); transferThread.start(); } catch (UnsupportedEncodingException e) { throw new SamzaException(String.format( "Container name: %s could not be encoded to bytes. %s cannot proceed.", key, getName()), e); } }</code><technical_language>cached keyBytes instance level, get rid of local keyBytes byte array</technical_language>

Target:
private void startTransferThread() { Runnable transferFromQueueToSystem = () -> { while (!Thread.currentThread().isInterrupted()) { try { sendEventToSystemProducer(logQueue.take()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (Throwable t) { metrics.logMessagesErrors.inc(); System.err.println("Error sending " + getName() + " event to SystemProducer " + t); } } }; transferThread = new Thread(transferFromQueueToSystem); transferThread.setDaemon(true); transferThread.setName("Samza " + getName() + " Producer " + transferThread.getName()); transferThread.start(); }
Source:
<code>public WatchPageObject unfollowArticle(String wikiURL) { <START> String url = URLsContent.buildUrl(wikiURL, "title="+articleTitle.getText()); <END> url = URLsContent.buildUrl(url, "&action=unwatch"); getUrl(url); return new WatchPageObject(driver); }</code><technical_language>spaces "+" (i favourite :P)</technical_language>

Target:
public WatchPageObject unfollowArticle(String wikiURL) { String url = URLsContent.buildUrl(wikiURL, "title=" + articleTitle.getText()); url = URLsContent.buildUrl(url, URLsContent.unfollowParameter); getUrl(url); return new WatchPageObject(driver); }