auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected List<CompositeEvent> retrieveCompositeEventList(DocumentReference user) throws NotificationException { CompositeEvent resultCompositeEvent = new CompositeEvent(this.compositeEvent); if (this.hasCorrespondingNotificationPreference(user, resultCompositeEvent)) { for (NotificationFilter filter : this.notificationFilterManager.getAllNotificationFilters(user)) { <START> CopyOnWriteArrayList<Event> events = new CopyOnWriteArrayList<>(resultCompositeEvent.getEvents()); <END> for (Event event : events) { if (filter.filterEvent(event, user, NotificationFormat.EMAIL)) { resultCompositeEvent.remove(event); if (resultCompositeEvent.getEvents().size() == 0) { return Collections.emptyList(); } } } } return Collections.singletonList(resultCompositeEvent); } return Collections.emptyList(); }</code><technical_language>understand this. I I iterator instead, it.remove() instead</technical_language>

Target:
protected List<CompositeEvent> retrieveCompositeEventList(DocumentReference user) throws NotificationException { CompositeEvent resultCompositeEvent = new CompositeEvent(this.compositeEvent); if (this.hasCorrespondingNotificationPreference(user, resultCompositeEvent)) { for (NotificationFilter filter : this.notificationFilterManager.getAllNotificationFilters(user)) { Iterator<Event> it = resultCompositeEvent.getEvents().iterator(); while (it.hasNext()) { Event event = it.next(); if (filter.filterEvent(event, user, NotificationFormat.EMAIL)) { it.remove(); if (resultCompositeEvent.getEvents().size() == 0) { return Collections.emptyList(); } } } } return Collections.singletonList(resultCompositeEvent); } return Collections.emptyList(); }
Source:
<code>public void configure() throws Exception { onException(Throwable.class).logStackTrace(true); createCamelContext(); <START> from("timer:simple") <END> .process( new Processor() { private int count; @Override public void process(Exchange exchange) { count++; exchange.getIn().setBody("Message " + count); System.out.println(count + " PING"); } }) .to("amqp:sdk.example"); from("amqp:topic:sdk.example") .process(exchange -> System.out.println("ACK " + exchange.getIn().getBody())) .stop(); }</code><technical_language>I simply want remove line. This is example example is it, idea is real code would. need suppress I think</technical_language>

Target:
public void configure() throws Exception { onException(Throwable.class).logStackTrace(true); createCamelContext(); CamelContext camelContext = getContext(); from("timer:simple") .process( new Processor() { private int count; @Override public void process(Exchange exchange) { count++; exchange.getIn().setBody("Message " + count); System.out.println(count + " PING"); } }) .to("amqp:sdk.example"); from("amqp:topic:sdk.example") .process(exchange -> System.out.println("ACK " + exchange.getIn().getBody())) .stop(); }
Source:
<code>public void updated(Dictionary config) throws ConfigurationException { logger.info("Update DD-WRT Binding configuration ..."); if (config == null || config.isEmpty()) { <START> throw new RuntimeException("No properties in openhab.cfg set!"); <END> } if (config != null) { String ip = (String) config.get("ip"); if (StringUtils.isNotBlank(ip)) { if (!ip.equals(DDWRTBinding.ip)) { DDWRTBinding.ip = ip; String port = (String) config.get("port"); if (!StringUtils.isNotBlank(port)) { port = "23"; } DDWRTBinding.port = port; conditionalDeActivate(); } } String username = (String) config.get("username"); if (StringUtils.isNotBlank(username)) { DDWRTBinding.username = username; } String password = (String) config.get("password"); if (StringUtils.isNotBlank(password)) { DDWRTBinding.password = password; } String interface_24 = (String) config.get("interface_24"); if (StringUtils.isNotBlank(interface_24)) { DDWRTBinding.interface_24 = interface_24; } String interface_50 = (String) config.get("interface_50"); if (StringUtils.isNotBlank(interface_50)) { DDWRTBinding.interface_50 = interface_50; } String interface_guest = (String) config.get("interface_guest"); if (StringUtils.isNotBlank(interface_guest)) { DDWRTBinding.interface_guest = interface_guest; } } }</code><technical_language>config null, in case return action</technical_language>

Target:
public void updated(Dictionary config) throws ConfigurationException { logger.info("Update DD-WRT Binding configuration ..."); if (config == null) { return; } else { if (config.isEmpty()) { throw new RuntimeException("No properties in openhab.cfg set!"); } String ip = (String) config.get("ip"); if (StringUtils.isNotBlank(ip)) { if (!ip.equals(DDWRTBinding.ip)) { DDWRTBinding.ip = ip; String port = (String) config.get("port"); if (!StringUtils.isNotBlank(port)) { port = "23"; } DDWRTBinding.port = port; conditionalDeActivate(); } } String username = (String) config.get("username"); if (StringUtils.isNotBlank(username)) { DDWRTBinding.username = username; } String password = (String) config.get("password"); if (StringUtils.isNotBlank(password)) { DDWRTBinding.password = password; } String interface_24 = (String) config.get("interface_24"); if (StringUtils.isNotBlank(interface_24)) { DDWRTBinding.interface_24 = interface_24; } String interface_50 = (String) config.get("interface_50"); if (StringUtils.isNotBlank(interface_50)) { DDWRTBinding.interface_50 = interface_50; } String interface_guest = (String) config.get("interface_guest"); if (StringUtils.isNotBlank(interface_guest)) { DDWRTBinding.interface_guest = interface_guest; } } }
Source:
<code>public void MonetizationModuleTest_022(String countryCode, Boolean isFromsearch, String testWiki, String testArticle, int isMulti) { wikiURL = urlBuilder.getUrlForWiki(testWiki); String articleURL = urlBuilder.getUrlForPath(testWiki, testArticle); WikiBasePageObject base = new WikiBasePageObject(driver); base.openWikiPage(articleURL); MonetizationModuleComponentObject monetizationModule = new MonetizationModuleComponentObject(driver); if (isFromsearch) { monetizationModule.setCookieFromSearch(); } else { monetizationModule.deleteCookieFromSearch(); } monetizationModule.setCookieGeo(countryCode); base.refreshPage(); <START> monetizationModule.verifyMonetizationModuleNotShown(); <END> base.logInCookie(credentials.userName7, credentials.password7, wikiURL); base.openWikiPage(articleURL); monetizationModule.verifyMonetizationModuleNotShown(); }</code><technical_language>Consider checking for ecommerce unit ad unit in MonetizationModule shown for anon</technical_language>

Target:
public void MonetizationModuleTest_022(String countryCode, Boolean isFromsearch, String testWiki, String testArticle, int isMulti) { wikiURL = urlBuilder.getUrlForWiki(testWiki); String articleURL = urlBuilder.getUrlForPath(testWiki, testArticle); WikiBasePageObject base = new WikiBasePageObject(driver); base.openWikiPage(articleURL); MonetizationModuleComponentObject monetizationModule = new MonetizationModuleComponentObject(driver); if (isFromsearch) { monetizationModule.setCookieFromSearch(); } else { monetizationModule.deleteCookieFromSearch(); } monetizationModule.setCookieGeo(countryCode); base.refreshPage(); monetizationModule.verifyEcommerceUnitNotShown(); base.logInCookie(credentials.userName7, credentials.password7, wikiURL); base.openWikiPage(articleURL); monetizationModule.verifyEcommerceUnitNotShown(); }
Source:
<code>public CallReader setStartTimeBefore(final ZonedDateTime startTimeBefore) { <START> this.startTimeBefore = startTimeBefore; <END> return this; }</code><technical_language>This nullify this.startTime, setStartTime nullify this.startTimeBefore/After</technical_language>

Target:
public CallReader setStartTimeBefore(final ZonedDateTime startTimeBefore) { this.startTime = null; this.startTimeBefore = startTimeBefore; return this; }
Source:
<code>public void testAggregationExpressionRewrite() throws Exception { tester().assertThat(new FunctionCallExpressionRewriter()).on(p -> p.aggregation((a) -> a.globalGrouping() .addAggregation( p.symbol("count_1", BigintType.BIGINT), new FunctionCall(QualifiedName.of("count"), ImmutableList.of()), ImmutableList.of(BigintType.BIGINT)) .source( p.values()))) .matches( PlanMatchPattern.aggregation( ImmutableMap.of("count_1", functionCall("none", ImmutableList.of())), <START> PlanMatchPattern.values())); <END> }</code><technical_language>format this as: a -> a .globalGrouping() ..</technical_language>

Target:
public void testAggregationExpressionRewrite() throws Exception { tester().assertThat(functionCallRewriter).on(p -> p.aggregation(a -> a .globalGrouping() .addAggregation( p.symbol("count_1", BigintType.BIGINT), new FunctionCall(QualifiedName.of("count"), ImmutableList.of()), ImmutableList.of(BigintType.BIGINT)) .source( p.values()))) .matches( PlanMatchPattern.aggregation( ImmutableMap.of("count_1", functionCall("now", ImmutableList.of())), values())); }
Source:
<code>public void testToDateFunctionBind() throws Exception { long ts = nextTimestamp(); Date date = new Date(1); String tenantId = getOrganizationId(); <START> initATableValues("aTable", tenantId, getDefaultSplits(tenantId),date, ts, getUrl()); <END> Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts+1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { String query = "SELECT a_date FROM atable WHERE organization_id='" + tenantId + "' and a_date < TO_DATE(?)"; PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, "1970-1-1 12:00:00"); ResultSet rs = statement.executeQuery(); verifyDateResultSet(rs, date, 3); } finally { conn.close(); } }</code><technical_language>If need pass atable name static constant defined in BaseTest</technical_language>

Target:
public void testToDateFunctionBind() throws Exception { long ts = nextTimestamp(); Date date = new Date(1); String tenantId = getOrganizationId(); initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId),date, ts, getUrl()); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts+1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { String query = "SELECT a_date FROM atable WHERE organization_id='" + tenantId + "' and a_date < TO_DATE(?)"; PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, "1970-1-1 12:00:00"); ResultSet rs = statement.executeQuery(); verifyDateResultSet(rs, date, 3); } finally { conn.close(); } }
Source:
<code>public static ExecutionEnvironmentResolutionHandler adapt(ExecutionEnvironmentConfiguration eeConfiguration) { <START> if (eeConfiguration.isCustomProfile()) { <END> return new CustomEEResolutionHandler(eeConfiguration); } else { return new StandardEEResolutionHandler(eeConfiguration.getProfileNameForResolver()); } }</code><technical_language>This wrong: A custom profile override dependency-resolution/executionEnvironment configuration, configuration precedence</technical_language>

Target:
public static ExecutionEnvironmentResolutionHandler adapt(ExecutionEnvironmentConfiguration eeConfiguration) { if (eeConfiguration.isIgnoredByResolver()) { return new AllKnownEEsResolutionHandler(); } else if (eeConfiguration.isCustomProfile()) { return new CustomEEResolutionHandler(eeConfiguration); } else { return new StandardEEResolutionHandler(eeConfiguration.getProfileName()); } }
Source:
<code>public EurekaArchaius2InstanceConfig(Config config, String namespace, DataCenterInfo dcInfo) { this.defaultAppGroup = config.getString(FALLBACK_APP_GROUP_KEY, Values.UNKNOWN_APPLICATION); this.namespace = namespace; this.config = config.getPrefixedView(namespace); this.dcInfo = dcInfo; <START> DiscoveryManager.getInstance().setEurekaInstanceConfig(this); <END> }</code><technical_language>If need do this, I feel do this else. A binding for DiscoveryManagerInitializer dependencies Config classes work</technical_language>

Target:
public EurekaArchaius2InstanceConfig(Config config, String namespace, DataCenterInfo dcInfo) { this.defaultAppGroup = config.getString(FALLBACK_APP_GROUP_KEY, Values.UNKNOWN_APPLICATION); this.namespace = namespace; this.config = config.getPrefixedView(namespace); this.dcInfo = dcInfo; }
Source:
<code>private boolean isFarmable(World world, Block block, int x, int y, int z) { return (block != null && !block.isAir(world, x, y, z) && <START> (block == Blocks.dirt || block == Blocks.grass)); <END> }</code><technical_language>Do need !block.isAir(world, x, y, z) here? (block == Blocks.dirt || block == Blocks.grass) return false if air</technical_language>

Target:
private boolean isFarmable(World world, Block block, int x, int y, int z) { return (block != null && (block == Blocks.dirt || block == Blocks.grass)); }
Source:
<code><START> private KeyStore createRepacementKeyStore(KeyStore keyStore, char[] password) { <END> final KeyStore replacementKeyStore = createEmptyStore(this.keyStoreType); final KeyStore.ProtectionParameter protection = new KeyStore.PasswordProtection(password); final KeyStore.Entry keyEntry; try { keyEntry = keyStore.getEntry(this.keyAlias, protection); } catch (NoSuchAlgorithmException ex) { throw new IllegalStateException("Failed to read certificate for alias " + this.keyAlias, ex); } catch (UnrecoverableEntryException ex) { throw new IllegalStateException("Failed to read certificate for alias '" + this.keyAlias + "'. Maybe the password is not correct.", ex); } catch (KeyStoreException ex) { throw new IllegalStateException("Failed to read certificate for alias " + this.keyAlias, ex); } if (keyEntry == null) { throw new IllegalStateException("Failed to read certificate for alias '" + this.keyAlias + "'. Maybe wrong alias was provided."); } try { replacementKeyStore.setEntry(this.keyAlias, keyEntry, protection); } catch (KeyStoreException ex) { throw new IllegalStateException("Failed to write certificate for alias " + this.keyAlias, ex); } return replacementKeyStore; }</code><technical_language>please explain this is necessary? If I understand correctly, this copy key original keystore a new keystore. in essence, new keystore is a clone of original one, difference new keystore contains key original. is needed</technical_language>

Target:
private KeyStore createRepacementKeyStore(KeyStore keyStore, char[] password) { final KeyStore replacementKeyStore = createEmptyStore(KeyStoreType.DEFAULT_TYPE); final KeyStore.ProtectionParameter protection = new KeyStore.PasswordProtection(password); final KeyStore.Entry keyEntry; try { keyEntry = keyStore.getEntry(this.keyAlias, protection); } catch (NoSuchAlgorithmException ex) { throw new IllegalStateException("Failed to read certificate for alias " + this.keyAlias, ex); } catch (UnrecoverableEntryException ex) { throw new IllegalStateException("Failed to read certificate for alias '" + this.keyAlias + "'. Maybe the password is not correct.", ex); } catch (KeyStoreException ex) { throw new IllegalStateException("Failed to read certificate for alias " + this.keyAlias, ex); } if (keyEntry == null) { throw new IllegalStateException("Failed to read certificate for alias '" + this.keyAlias + "'. Maybe wrong alias was provided."); } try { replacementKeyStore.setEntry(this.keyAlias, keyEntry, protection); } catch (KeyStoreException ex) { throw new IllegalStateException("Failed to write certificate for alias " + this.keyAlias, ex); } return replacementKeyStore; }
Source:
<code>public final void setVolumeByIncrement(float level) throws IOException { <START> Volume volume = this.getStatus().volume; <END> float total = volume.level; if (level > total) { while (total < level) { total = Math.min(total + volume.increment, level); setVolume(total); } } else if (level < total) { while (total > level) { total = Math.max(total - volume.increment, level); setVolume(total); } } }</code><technical_language>increment zero? In this case fall infinite loop. I need prevent this adding some kind of check increment throw ChromeCastException increment is zero</technical_language>

Target:
public final void setVolumeByIncrement(float level) throws IOException { Volume volume = this.getStatus().volume; float total = volume.level; if (volume.increment <= 0f) { throw new ChromeCastException("Volume.increment is <= 0"); } if (level > total) { while (total < level) { total = Math.min(total + volume.increment, level); setVolume(total); } } else if (level < total) { while (total > level) { total = Math.max(total - volume.increment, level); setVolume(total); } } }
Source:
<code>private static DateRange getNewTaskScheduleDateRange(String preference) { switch (preference) { case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_NOT_SCHEDULED: return null; case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TODAY: return TaskActivityUtil.getCurrentWeek().getToday(); <START> case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TOMORROW: <END> return TaskActivityUtil.getCurrentWeek().getToday().next(); } return TaskActivityUtil.getCurrentWeek(); }</code><technical_language>add a case for this week explicit separate default</technical_language>

Target:
private static DateRange getNewTaskScheduleDateRange(String preference) { switch (preference) { case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_NOT_SCHEDULED: return null; case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TODAY: return TaskActivityUtil.getCurrentWeek().getToday(); case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TOMORROW: return TaskActivityUtil.getCurrentWeek().getToday().next(); case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_THIS_WEEK: return TaskActivityUtil.getCurrentWeek(); } return TaskActivityUtil.getCurrentWeek(); }
Source:
<code>public String getUpstreamCert( @PathParam("dbid") String entitlementId) { Entitlement ent = entitlementCurator.find(entitlementId); if (ent == null) { throw new NotFoundException(i18n.tr( "Entitlement with ID ''{0}'' could not be found.", entitlementId)); } String subscriptionId = null; Pool entPool = ent.getPool(); if (StringUtils.isBlank(entPool.getSourceStackId())) { subscriptionId = entPool.getSubscriptionId(); } else { log.debug("Entitlement is from a stack derived pool, searching for oldest " + "active entitlements in source stack."); Entitlement e = entitlementCurator.findUpstreamEntitlementForStack( entPool.getSourceConsumer(), entPool.getSourceStackId()); if (e != null) { subscriptionId = e.getPool().getSubscriptionId(); } } <START> if (subscriptionId == null) { <END> throw new NotFoundException( i18n.tr("Unable to find upstream certificate for entitlement: {0}", entitlementId)); } return subResource.getSubCertAsPem(subscriptionId); }</code><technical_language>isBlank/isEmpty here. In other patch, subscriptionId a nested object null, I database give empty string for null values. support</technical_language>

Target:
public String getUpstreamCert( @PathParam("dbid") String entitlementId) { Entitlement ent = entitlementCurator.find(entitlementId); if (ent == null) { throw new NotFoundException(i18n.tr( "Entitlement with ID ''{0}'' could not be found.", entitlementId)); } String subscriptionId = null; Pool entPool = ent.getPool(); if (StringUtils.isBlank(entPool.getSourceStackId())) { subscriptionId = entPool.getSubscriptionId(); } else { log.debug("Entitlement is from a stack derived pool, searching for oldest " + "active entitlements in source stack."); Entitlement e = entitlementCurator.findUpstreamEntitlementForStack( entPool.getSourceConsumer(), entPool.getSourceStackId()); if (e != null) { subscriptionId = e.getPool().getSubscriptionId(); } } if (StringUtils.isEmpty(subscriptionId)) { throw new NotFoundException( i18n.tr("Unable to find upstream certificate for entitlement: {0}", entitlementId)); } return subResource.getSubCertAsPem(subscriptionId); }
Source:
<code>private String getInstituteForStudent( CourseStudent student, List<Instructor> allInstructors, List<Account> allAccounts) { <START> courseIdToInstituteMap.computeIfAbsent(student.getCourseId(), key -> { <END> List<Instructor> instructorList = getInstructorsOfCourse(allInstructors, student.getCourseId()); return getInstituteForInstructors(instructorList, allAccounts); }); return courseIdToInstituteMap.get(student.getCourseId()); }</code><technical_language>return this directly</technical_language>

Target:
private String getInstituteForStudent( CourseStudent student, List<Instructor> allInstructors, List<Account> allAccounts) { return courseIdToInstituteMap.computeIfAbsent(student.getCourseId(), key -> { List<Instructor> instructorList = getInstructorsOfCourse(allInstructors, student.getCourseId()); return getInstituteForInstructors(instructorList, allAccounts); }); }
Source:
<code>public void close() { try { arrayOut.close(); } catch (IOException e) { throw new ParquetRuntimeException("Error closing output stream.", e){ }; <START> } <END> }</code><technical_language>factor out</technical_language>

Target:
public void close() { arrayOut.close(); out.close(); }
Source:
<code>private void checkSnapDir() throws SnapdirContentCheckException { <START> File[] files = this.snapDir.listFiles(); <END> if(files != null) { boolean hasLogFiles = false; for (File file : files) { if(Util.isLogFile(file)){ hasLogFiles = true; break; } } if (hasLogFiles) { throw new SnapdirContentCheckException("Snapshot directory has log files. Check if dataLogDir and dataDir configuration is correct."); } } }</code><technical_language>here. Get files fileNameFilter if returns non-empty array, throw exception</technical_language>

Target:
private void checkSnapDir() throws SnapDirContentCheckException { File[] files = this.snapDir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return Util.isLogFileName(name); } }); if (files != null && files.length > 0) { throw new SnapDirContentCheckException("Snapshot directory has log files. Check if dataLogDir and dataDir configuration is correct."); } }
Source:
<code>public final CompletableFuture<Void> enterSynchronizationAsync(CompletableFuture<Void> releaseFuture) { <START> while (true) { <END> CompletableFuture<Void> currentFuture = synchronization.get(); if (synchronization.compareAndSet(currentFuture, releaseFuture)) return currentFuture; } }</code><technical_language>a do-while avoid checking 2 conditions (the while true CAS)</technical_language>

Target:
public final CompletableFuture<Void> enterSynchronizationAsync(CompletableFuture<Void> releaseFuture) { CompletableFuture<Void> currentFuture; do { currentFuture = synchronization.get(); } while (!synchronization.compareAndSet(currentFuture, releaseFuture)); return currentFuture; }
Source:
<code>private static String aggregatePerHostResults(VoltTable vtable) { vtable.advanceRow(); String kitCheckResult = vtable.getString("KIT_CHECK_RESULT"); String rootCheckResult = vtable.getString("ROOT_CHECK_RESULT"); StringBuilder result = new StringBuilder(); <START> if (!kitCheckResult.equals("Success")){ <END> result.append(kitCheckResult); } if (!rootCheckResult.equals("Success")) { result.append(rootCheckResult); } if (result.length() == 0) { result.append("Success"); } return result.toString(); }</code><technical_language>a lot of "Success", try replace a static final string</technical_language>

Target:
private static String aggregatePerHostResults(VoltTable vtable) { vtable.advanceRow(); String kitCheckResult = vtable.getString("KIT_CHECK_RESULT"); String rootCheckResult = vtable.getString("ROOT_CHECK_RESULT"); StringBuilder result = new StringBuilder(); if (!kitCheckResult.equals(SUCCESS)){ result.append(kitCheckResult); } if (!rootCheckResult.equals(SUCCESS)) { result.append(rootCheckResult); } if (result.length() == 0) { result.append(SUCCESS); } return result.toString(); }
Source:
<code>protected <T extends DAO> T getDao(Class<T> daoType) { @SuppressWarnings("unchecked") Set<T> daos = (Set<T>) beanManager.getBeans(daoType, (Annotation[]) null); if (daos.size() == 0) { <START> log.error("Can't find dao for " + daoType); <END> return null; } T dao = daos.iterator().next(); if (dao instanceof BaseDAODbFacade && !(dao instanceof HibernateFacade)) { BaseDAODbFacade dbFacadeDAO = (BaseDAODbFacade) dao; dbFacadeDAO.setTemplate(jdbcTemplate); dbFacadeDAO.setDialect(dbEngineDialect); dbFacadeDAO.setDbFacade(this); } return dao; }</code><technical_language>replace lines 272-275 assertion, this is a code bug. org.apache.commons.lang.Validate: Validate.notEmpty(daos, "Can't find dao for " + daoType);</technical_language>

Target:
protected <T extends DAO> T getDao(Class<T> daoType) { for (DAO dao : daos) { if (daoType.isAssignableFrom(dao.getClass())) { if (dao instanceof BaseDAODbFacade && !(dao instanceof HibernateFacade)) { BaseDAODbFacade dbFacadeDAO = (BaseDAODbFacade) dao; dbFacadeDAO.setTemplate(jdbcTemplate); dbFacadeDAO.setDialect(dbEngineDialect); dbFacadeDAO.setDbFacade(this); } return (T) dao; } } log.error("Can't find dao for " + daoType); return null; }
Source:
<code>public static HadoopDruidIndexerConfig fromDistributedFileSystem(String path) { try { Path pt = new Path(path); <START> FileSystem fs = FileSystem.get(new Configuration()); <END> Reader reader = new InputStreamReader(fs.open(pt)); return fromMap( (Map<String, Object>) HadoopDruidIndexerConfig.jsonMapper.readValue( reader, new TypeReference<Map<String, Object>>() { } ) ); } catch (IOException e) { throw Throwables.propagate(e); } }</code><technical_language>get(URI uri, Configuration conf). allow users hdfs://... paths other URI schemes defined in configuration, s3://..</technical_language>

Target:
public static HadoopDruidIndexerConfig fromDistributedFileSystem(String path) { try { Path pt = new Path(path); FileSystem fs = FileSystem.get(pt.toUri(), new Configuration()); Reader reader = new InputStreamReader(fs.open(pt)); return fromMap( (Map<String, Object>) HadoopDruidIndexerConfig.jsonMapper.readValue( reader, new TypeReference<Map<String, Object>>() { } ) ); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>public void save() { if(BulkChange.contains(this)) return; lock.lock(); try { State state = new State(); state.counter = WaitingItem.COUNTER.longValue(); for (Item item: getItems()) { if(item.task instanceof TransientTask) continue; state.items.add(item); } try { XmlFile queueFile = new XmlFile(XSTREAM, getXMLQueueFile()); queueFile.write(state); <START> SaveableListener.fireOnChange(this, queueFile); <END> } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to write out the queue file " + getXMLQueueFile(), e); } } finally { lock.unlock(); } }</code><technical_language>Prefer fire events lock</technical_language>

Target:
public void save() { if(BulkChange.contains(this)) return; XmlFile queueFile = new XmlFile(XSTREAM, getXMLQueueFile()); lock.lock(); try { State state = new State(); state.counter = WaitingItem.COUNTER.longValue(); for (Item item: getItems()) { if(item.task instanceof TransientTask) continue; state.items.add(item); } try { queueFile.write(state); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to write out the queue file " + getXMLQueueFile(), e); } } finally { lock.unlock(); } SaveableListener.fireOnChange(this, queueFile); }
Source:
<code>public void testAttributeResettingWorks(final VCBuilderScheme builderScheme) { final VariantContextBuilder root1 = new VariantContextBuilder(snpSource, snpChr, snpLocStart, snpLocStop, Arrays.asList(Aref, C)); final VariantContext result1 = root1.attribute("AC", 1).make(); final VariantContextBuilder root2 = builderScheme.getOtherBuilder(root1, result1) .source(snpSource).chr(snpChr).start(snpLocStart).stop(snpLocStop).alleles(Arrays.asList(Aref, C)); final VariantContext ignored = root1.attribute("AC", 2).make(); final VariantContext result2 = root2.attribute("AC", 1).make(); <START> Assert.assertEquals(result1.getAttribute("AC"), result2.getAttribute("AC")); <END> }</code><technical_language>of potential issues builder is subtle bugs relate order of instantiation alteration. this initialization: builder1.attribute("AC", 1) builder2 = new Builder(builder1) operations different: case1: result1 = builder1.make() builder2.attribute("AC", 2) result2= builder2.make() case2: builder2.attribute("AC", 2) result1 = builder1.make() result2= builder2.make() case if builder internal state is accidentally shared/modified make() operation performs a copy. In cases I expect result1 ac of 1 case 1 fine case 2 broken. I a test for type of difference here. I in practice place make() copies is alleles, this unnecessary / overkill tests</technical_language>

Target:
public void testAttributeResettingWorks(final VCBuilderScheme builderScheme) { final VariantContextBuilder root1 = new VariantContextBuilder(snpSource, snpChr, snpLocStart, snpLocStop, Arrays.asList(Aref, C)); final VariantContext result1 = root1.attribute("AC", 1).make(); final VariantContextBuilder root2 = builderScheme.getOtherBuilder(root1, result1) .source(snpSource) .chr(snpChr) .start(snpLocStart) .stop(snpLocStop) .alleles(Arrays.asList(Aref, C)); final VariantContext ignored = root1.attribute("AC", 2).make(); final VariantContext result2 = root2.attribute("AC", 1).make(); Assert.assertEquals(result1.getAttribute("AC"), 1); Assert.assertEquals(result2.getAttribute("AC"), 1); }
Source:
<code>public static boolean handleUserInput(final CrashManagerUserInput userInput, final CrashMetaData userProvidedMetaData, final CrashManagerListener listener, final WeakReference<Context> weakContext, final boolean ignoreDefaultHandler) { switch (userInput) { case CrashManagerUserInputDontSend: if (listener != null) { listener.onUserDeniedCrashes(); } deleteStackTraces(weakContext); registerHandler(weakContext, listener, ignoreDefaultHandler); return true; case CrashManagerUserInputSend: Context context = null; if (weakContext != null) { context = weakContext.get(); } if (context == null) { return false; } <START> final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); <END> prefs.edit().putBoolean(ALWAYS_SEND_KEY, true).commit(); sendCrashes(weakContext, listener, ignoreDefaultHandler, userProvidedMetaData); return true; case CrashManagerUserInputAlwaysSend: sendCrashes(weakContext, listener, ignoreDefaultHandler, userProvidedMetaData); return true; default: return false; } }</code><technical_language>This is in wrong spot, it? in case CrashManagerUserInputAlwaysSend:, right</technical_language>

Target:
public static boolean handleUserInput(final CrashManagerUserInput userInput, final CrashMetaData userProvidedMetaData, final CrashManagerListener listener, final WeakReference<Context> weakContext, final boolean ignoreDefaultHandler) { switch (userInput) { case CrashManagerUserInputDontSend: if (listener != null) { listener.onUserDeniedCrashes(); } deleteStackTraces(weakContext); registerHandler(weakContext, listener, ignoreDefaultHandler); return true; case CrashManagerUserInputAlwaysSend: Context context = null; if (weakContext != null) { context = weakContext.get(); } if (context == null) { return false; } final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putBoolean(ALWAYS_SEND_KEY, true).commit(); sendCrashes(weakContext, listener, ignoreDefaultHandler, userProvidedMetaData); return true; case CrashManagerUserInputSend: sendCrashes(weakContext, listener, ignoreDefaultHandler, userProvidedMetaData); return true; default: return false; } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = this; generateAndStoreKey(); if (initCipher()) { mCryptoObject = new BiometricPrompt.CryptoObject(mCipher); } BiometricManager biometricManager = BiometricManager.from(this); <START> switch (biometricManager.canAuthenticate()) { case BiometricManager.BIOMETRIC_SUCCESS: showBiometricPrompt(); <END> break; default: authError(); } }</code><technical_language>if instead of switch if 2 options</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = this; generateAndStoreKey(); if (initCipher()) { mCryptoObject = new BiometricPrompt.CryptoObject(mCipher); } BiometricManager biometricManager = BiometricManager.from(this); if (biometricManager.canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS) { showBiometricPrompt(); } else { authError(); } }
Source:
<code>public CellPointer(final int tableIndex, final int fieldIndex, final int row) { <START> Preconditions.checkElementIndex(tableIndex, tables.length); <END> Preconditions.checkElementIndex(fieldIndex, tables[tableIndex].numColumns()); Preconditions.checkArgument(row >= 0 && row <= tables[tableIndex].numTuples()); this.tableIndex = tableIndex; this.fieldIndex = fieldIndex; this.row = row; }</code><technical_language>please put error messages a Preconditions function</technical_language>

Target:
public CellPointer(final int tableIndex, final int fieldIndex, final int row) { Preconditions.checkElementIndex(tableIndex, tables.length, "tableIndex exceeds legal range."); Preconditions.checkElementIndex(fieldIndex, tables[tableIndex].numColumns(), "fieldIndex exceeds legal range."); Preconditions.checkState(row >= 0 && row <= tables[tableIndex].numTuples(), "row number exceeds legal range."); this.tableIndex = tableIndex; this.fieldIndex = fieldIndex; this.row = row; }
Source:
<code>@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { PrometheusStatsCollector.createAndRegister(); <START> HTTPServer server = new HTTPServer(HOST, PORT, true); <END> IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true))); OpenCensusMetricExporterSpi ocSpi = new OpenCensusMetricExporterSpi(); ocSpi.setExportFilter(m -> !m.name().startsWith(FILTERED_PREFIX)); ocSpi.setPeriod(EXPORT_TIMEOUT); ocSpi.setSendConsistentId(true); ocSpi.setSendInstanceName(true); ocSpi.setSendNodeId(true); cfg.setMetricExporterSpi(ocSpi); return cfg; }</code><technical_language>variable is used. If wanted start server move logic @Before stop in @After</technical_language>

Target:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true))); OpenCensusMetricExporterSpi ocSpi = new OpenCensusMetricExporterSpi(); ocSpi.setExportFilter(m -> !m.name().startsWith(FILTERED_PREFIX)); ocSpi.setPeriod(EXPORT_TIMEOUT); ocSpi.setSendConsistentId(true); ocSpi.setSendInstanceName(true); ocSpi.setSendNodeId(true); cfg.setMetricExporterSpi(ocSpi); return cfg; }
Source:
<code>private void displayShowroomMaps() { enterLoadingState(); mapService.getMostPlayedMaps(TOP_ELEMENT_COUNT, 1).thenAccept(maps -> replaceSearchResult(maps, mostPlayedPane)) .thenCompose(aVoid -> mapService.getHighestRatedMaps(TOP_ELEMENT_COUNT, 1)).thenAccept(maps -> replaceSearchResult(maps, mostLikedPane)) .thenCompose(aVoid -> mapService.getNewestMaps(TOP_ELEMENT_COUNT, 1)).thenAccept(maps -> replaceSearchResult(maps, newestPane)) .thenCompose(aVoid -> mapService.getLadderMaps(TOP_ELEMENT_COUNT, 1).thenAccept(maps -> replaceSearchResult(maps, ladderPane))) .thenCompose(aVoid -> { Optional<Player> currentPlayer = playerService.getCurrentPlayer(); if (!currentPlayer.isPresent()) { throw new IllegalStateException("Current Player not set"); <START> } <END> return mapService.getOwnedMaps(currentPlayer.get().getId(), TOP_ELEMENT_COUNT, 1); }) .thenAccept(mapBeans -> { if (mapBeans.isEmpty()) { ownedPane.setVisible(false); ownedMoreButton.setVisible(false); ownedMoreLabel.setVisible(false); } replaceSearchResult(mapBeans, ownedPane); }) .thenRun(this::enterShowroomState) .exceptionally(throwable -> { logger.warn("Could not populate maps", throwable); return null; }); }</code><technical_language>Player player = playerService.getCurrentPlayer() .orElseThrow(() -> new IllegalStateException("Current player set"));</technical_language>

Target:
private void displayShowroomMaps() { enterLoadingState(); mapService.getMostPlayedMaps(TOP_ELEMENT_COUNT, 1).thenAccept(maps -> replaceSearchResult(maps, mostPlayedPane)) .thenCompose(aVoid -> mapService.getHighestRatedMaps(TOP_ELEMENT_COUNT, 1)).thenAccept(maps -> replaceSearchResult(maps, mostLikedPane)) .thenCompose(aVoid -> mapService.getNewestMaps(TOP_ELEMENT_COUNT, 1)).thenAccept(maps -> replaceSearchResult(maps, newestPane)) .thenCompose(aVoid -> mapService.getLadderMaps(TOP_ELEMENT_COUNT, 1).thenAccept(maps -> replaceSearchResult(maps, ladderPane))) .thenCompose(aVoid -> { Player player = playerService.getCurrentPlayer() .orElseThrow(() -> new IllegalStateException("Current player not set")); return mapService.getOwnedMaps(player.getId(), TOP_ELEMENT_COUNT, 1); }) .thenAccept(mapBeans -> { if (mapBeans.isEmpty()) { ownedPane.setVisible(false); ownedMoreButton.setVisible(false); ownedMoreLabel.setVisible(false); } replaceSearchResult(mapBeans, ownedPane); }) .thenRun(this::enterShowroomState) .exceptionally(throwable -> { logger.warn("Could not populate maps", throwable); return null; }); }
Source:
<code>public void close(C connection) throws MuleException { if (!closed.get()) { <START> closed.set(true); <END> delegate.close(connection); } }</code><technical_language>yo compareAndSet</technical_language>

Target:
public void close(C connection) throws MuleException { if (closed.compareAndSet(false, true)) { delegate.close(connection); } }
Source:
<code>public static SimpleFeatureCollection getFeatures(String endPoint, String user, String pass, String typeName, ReferencedEnvelope bbox, CoordinateReferenceSystem crs, int maxFeatures, Filter filter) { Map<String, String> query = getQueryParams(typeName, bbox, crs, maxFeatures, filter); query.put("OUTPUTFORMAT", "application/json"); byte[] response = getResponse(endPoint, user, pass, query); try { return parseGeoJSON(new ByteArrayInputStream(response), crs); } catch (Exception e) { if (!isOutputFormatInvalid(new ByteArrayInputStream(response))) { throw new ServiceRuntimeException("Unable to get features"); } <START> LOG.debug(e, "Failed to parse GeoJSON response"); <END> } query.remove("OUTPUTFORMAT"); response = getResponse(endPoint, user, pass, query); try { return OSKARI_GML.decodeFeatureCollection(new ByteArrayInputStream(response), user, pass); } catch (Exception e) { throw new ServiceRuntimeException("Unable to get features"); } }</code><technical_language>Move logging done exception throw get cause</technical_language>

Target:
public static SimpleFeatureCollection getFeatures(String endPoint, String user, String pass, String typeName, ReferencedEnvelope bbox, CoordinateReferenceSystem crs, int maxFeatures, Filter filter) { Map<String, String> query = getQueryParams(typeName, bbox, crs, maxFeatures, filter); query.put("OUTPUTFORMAT", "application/json"); byte[] response = getResponse(endPoint, user, pass, query); try { return parseGeoJSON(new ByteArrayInputStream(response), crs); } catch (IOException e) { if (!isOutputFormatInvalid(new ByteArrayInputStream(response))) { throw new ServiceRuntimeException("Unable to parse GeoJSON", e); } } query.remove("OUTPUTFORMAT"); response = getResponse(endPoint, user, pass, query); try { return OSKARI_GML.decodeFeatureCollection(new ByteArrayInputStream(response), user, pass); } catch (Exception e) { throw new ServiceRuntimeException("Unable to parse GML", e); } }
Source:
<code>private void determineSendTimeout() { Map<String, Object> props = this.kafkaTemplate.getProducerFactory().getConfigurationProperties(); Object dt = props.get(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG); if (dt == null) { dt = ProducerConfig.configDef().defaultValues().get(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG); } if (dt instanceof Long) { this.sendTimeoutExpression = new ValueExpression<>(((Long) dt) + TIMEOUT_BUFFER); } else if (dt instanceof Integer) { this.sendTimeoutExpression = new ValueExpression<>(Long.valueOf((Integer) dt) + TIMEOUT_BUFFER); } else if (dt instanceof String) { <START> this.sendTimeoutExpression = new ValueExpression<>(Long.parseLong((String) dt) + TIMEOUT_BUFFER); <END> } }</code><technical_language>call setSendTimeout(long sendTimeout) instead</technical_language>

Target:
private void determineSendTimeout() { Map<String, Object> props = this.kafkaTemplate.getProducerFactory().getConfigurationProperties(); Object dt = props.get(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG); if (dt == null) { dt = ProducerConfig.configDef().defaultValues().get(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG); } if (dt instanceof Long) { setSendTimeout(((Long) dt) + TIMEOUT_BUFFER); } else if (dt instanceof Integer) { setSendTimeout(Long.valueOf((Integer) dt) + TIMEOUT_BUFFER); } else if (dt instanceof String) { setSendTimeout(Long.parseLong((String) dt) + TIMEOUT_BUFFER); } }
Source:
<code>private static ImmutableWorkerInfo selectFromEligibleWorkers(final Map<String, ImmutableWorkerInfo> eligibleWorkers) { final TreeSet<ImmutableWorkerInfo> sortedWorkers = Sets.newTreeSet( Comparator.comparing(ImmutableWorkerInfo::getAvailableCapacity).reversed() <START> ); <END> sortedWorkers.addAll(eligibleWorkers.values()); return Iterables.getFirst(sortedWorkers, null); }</code><technical_language>here. this TreeSet is needed</technical_language>

Target:
private static ImmutableWorkerInfo selectFromEligibleWorkers(final Map<String, ImmutableWorkerInfo> eligibleWorkers) { return eligibleWorkers.values().stream().max( Comparator.comparing(ImmutableWorkerInfo::getAvailableCapacity) ).orElse(null); }
Source:
<code>public void visitExpressionStatement(ExpressionStatementTree tree) { super.visitExpressionStatement(tree); ExpressionTree expression = tree.expression(); if (expression.is(Tree.Kind.NEW_CLASS) <START> && ((AbstractTypedTree) expression).isTypeSet() <END> && ((JavaType) expression.symbolType()).isTagged(JavaType.DEFERRED)) { JavaType parametrizedTypeWithObject = resolve.parametrizedTypeWithObject((ParametrizedTypeJavaType) getType(((NewClassTree) expression).identifier())); setInferedType(parametrizedTypeWithObject, (DeferredType) expression.symbolType()); } }</code><technical_language>This false</technical_language>

Target:
public void visitExpressionStatement(ExpressionStatementTree tree) { super.visitExpressionStatement(tree); ExpressionTree expression = tree.expression(); if (((JavaType) expression.symbolType()).isTagged(JavaType.DEFERRED) && expression.is(Tree.Kind.NEW_CLASS)) { JavaType parametrizedTypeWithObject = resolve.parametrizedTypeWithErasure((ParametrizedTypeJavaType) getType(((NewClassTree) expression).identifier())); setInferedType(parametrizedTypeWithObject, (DeferredType) expression.symbolType()); } }
Source:
<code>public KerberosTicketValidation validateTicket(byte[] token) throws BadCredentialsException { try { <START> return Subject.doAs(this.serviceSubject, new KerberosValidateAction(token)); <END> } catch (PrivilegedActionException e) { throw new BadCredentialsException("Kerberos validation not successful", e); } }</code><technical_language>call init() method first, instead of letting KerberosAuthenticator do for us</technical_language>

Target:
public KerberosTicketValidation validateTicket(byte[] token) throws BadCredentialsException { init(); try { return Subject.doAs(this.serviceSubject, new KerberosValidateAction(token)); } catch (PrivilegedActionException e) { throw new BadCredentialsException("Kerberos validation not successful", e); } }
Source:
<code>public ApnsConsumer() { final Properties props = new Properties(); props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, resolveKafkaService()); <START> props.put(ConsumerConfig.GROUP_ID_CONFIG, "apns-agents-ocp22"); <END> props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, GenericDeserializer.class); consumer = new KafkaConsumer(props); sender = new PushyApnsSender(); }</code><technical_language>Strings stored in a constant</technical_language>

Target:
public ApnsConsumer() { final Properties props = new Properties(); props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, resolveKafkaService()); props.put(ConsumerConfig.GROUP_ID_CONFIG, KAFKA_APNS_CONSUMER_GROUP); props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, GenericDeserializer.class); consumer = new KafkaConsumer(props); sender = new PushyApnsSender(); }
Source:
<code>public void unsubscribe() { State oldState; State newState; do { <START> oldState = state.get(); <END> if (oldState.isUnsubscribed) { return; } else { newState = oldState.unsubscribe(); } } while (!state.compareAndSet(oldState, newState)); oldState.subscription.unsubscribe(); }</code><technical_language>field state read a local variable loop</technical_language>

Target:
public void unsubscribe() { State oldState; State newState; final AtomicReference<State> localState = this.state; do { oldState = localState.get(); if (oldState.isUnsubscribed) { return; } else { newState = oldState.unsubscribe(); } } while (!localState.compareAndSet(oldState, newState)); oldState.subscription.unsubscribe(); }
Source:
<code>public Collection<DiagramElement> getNodeDownStreams(Node pNode) <START> { <END> assert pNode!=null; Set<DiagramElement> downstreamElements = new HashSet<>(); if(isInConstructorCall(pNode)) { Optional<Edge> constructorEdge = getConstructorEdge(pNode); if(constructorEdge.isPresent()) { downstreamElements.addAll(getEdgeDownStreams(constructorEdge.get())); } } else if(isImplicitParameterNodeInConstructorCall(pNode)) { Optional<Edge> constructorEdge = getConstructorEdge(getFirstChild(pNode)); if(constructorEdge.isPresent()) { downstreamElements.addAll(getEdgeDownStreams(constructorEdge.get())); } } else if(pNode.getClass() == CallNode.class) { for(Edge edge: getCalls(pNode)) { downstreamElements.addAll(getEdgeDownStreams(edge)); } } else if (pNode.getClass() == ImplicitParameterNode.class) { downstreamElements.addAll(pNode.getChildren()); for(Node child: pNode.getChildren()) { for(Edge edge: getCalls(child)) { downstreamElements.addAll(getEdgeDownStreams(edge)); } } } return downstreamElements; }</code><technical_language>Please rename getDownstreamNodes</technical_language>

Target:
public Collection<DiagramElement> getNodeDownStreams(Node pNode) { assert pNode!=null; Set<DiagramElement> downstreamElements = new HashSet<>(); if(isConstructorExecution(pNode)) { Optional<Edge> constructorEdge = getConstructorEdge(pNode); if(constructorEdge.isPresent()) { downstreamElements.addAll(getEdgeDownStreams(constructorEdge.get())); } } else if(isConstructedObject(pNode)) { Optional<Edge> constructorEdge = getConstructorEdge(getFirstChild(pNode)); if(constructorEdge.isPresent()) { downstreamElements.addAll(getEdgeDownStreams(constructorEdge.get())); } } else if(pNode.getClass() == CallNode.class) { for(Edge edge: getCalls(pNode)) { downstreamElements.addAll(getEdgeDownStreams(edge)); } } else if (pNode.getClass() == ImplicitParameterNode.class) { downstreamElements.addAll(pNode.getChildren()); for(Node child: pNode.getChildren()) { for(Edge edge: getCalls(child)) { downstreamElements.addAll(getEdgeDownStreams(edge)); } } } return downstreamElements; }
Source:
<code>public MessageStream apply(HttpResponse response) { if (response.getStatusCode() == 204) { <START> return new Messages(ImmutableSet.<Message> of(), ImmutableSet.<Link> of()); <END> } MessagesWithHref messagesWithHref = json.apply(response); List<Message> messages = Lists.newArrayList(); for (MessageWithHref messageWithHref: messagesWithHref) { Message message = messageWithHref.toBuilder().id(getMessageId(messageWithHref.getId())).build(); messages.add(message); } return new Messages(messages, messagesWithHref.getLinks()); }</code><technical_language>a builder</technical_language>

Target:
public MessageStream apply(HttpResponse response) { if (response.getStatusCode() == 204) { return new Messages(ImmutableSet.<Message> of(), ImmutableSet.<Link> of()); } MessagesWithHref messagesWithHref = json.apply(response); Iterable<Message> messages = Iterables.transform(messagesWithHref, TO_MESSAGE); return new Messages(messages, messagesWithHref.getLinks()); }