auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String streamingPredict(int tenantId, String userName, long modelId, String dataFormat, InputStream dataStream) throws MLModelHandlerException { List<String[]> data = new ArrayList<String[]>(); CSVFormat csvFormat = DataTypeFactory.getCSVFormat(dataFormat); BufferedReader br = new BufferedReader(new InputStreamReader(dataStream)); try { String line; while ((line = br.readLine()) != null) { String[] dataRow = line.split(csvFormat.getDelimiter() + ""); data.add(dataRow); } List<String[]> unencodedData = new ArrayList<String[]>(data.size()); for (String[] item : data) { unencodedData.add(item.clone()); } List<?> predictions = predict(tenantId, userName, modelId, data); StringBuilder predictionsWithData = new StringBuilder(); for (int i = 0; i < predictions.size(); i++) { predictionsWithData.append(MLUtils.arrayToCsvString(unencodedData.get(i), csvFormat.getDelimiter()) <START> + String.valueOf(predictions.get(i)) + MLConstants.NEW_LINE); <END> } return predictionsWithData.toString(); } catch (IOException e) { String msg = "Failed to read the data points for prediction for model [id] " + modelId; log.error(msg, e); throw new MLModelHandlerException(msg, e); } finally { try { if (dataStream != null && br != null) { dataStream.close(); br.close(); } } catch (IOException ignore) { } } }</code><technical_language>String concatenations predictionsWithData.append(), '+', replaced append() predictionsWithData.append(MLUtils.arrayToCsvString(unencodedData.get(i), csvFormat.getDelimiter())) .append(String.valueOf(predictions.get(i))).append(MLConstants.NEW_LINE);</technical_language>

Target:
public String streamingPredict(int tenantId, String userName, long modelId, String dataFormat, InputStream dataStream) throws MLModelHandlerException { List<String[]> data = new ArrayList<String[]>(); CSVFormat csvFormat = DataTypeFactory.getCSVFormat(dataFormat); BufferedReader br = new BufferedReader(new InputStreamReader(dataStream)); try { String line; while ((line = br.readLine()) != null) { String[] dataRow = line.split(csvFormat.getDelimiter() + ""); data.add(dataRow); } List<String[]> unencodedData = new ArrayList<String[]>(data.size()); for (String[] item : data) { unencodedData.add(item.clone()); } List<?> predictions = predict(tenantId, userName, modelId, data); StringBuilder predictionsWithData = new StringBuilder(); for (int i = 0; i < predictions.size(); i++) { predictionsWithData.append(MLUtils.arrayToCsvString(unencodedData.get(i), csvFormat.getDelimiter())) .append(String.valueOf(predictions.get(i))) .append(MLConstants.NEW_LINE); } return predictionsWithData.toString(); } catch (IOException e) { String msg = "Failed to read the data points for prediction for model [id] " + modelId; log.error(msg, e); throw new MLModelHandlerException(msg, e); } finally { try { if (dataStream != null && br != null) { dataStream.close(); br.close(); } } catch (IOException ignore) { } } }
Source:
<code>private void write(SelectionKey key, Transmission transmission) throws IOException { long startTimeToWriteInMs = time.milliseconds(); try { boolean sendComplete = transmission.write(); if (sendComplete) { logger.trace("Finished writing, registering for read on connection {}", <START> transmission.getSocketChannel().socket().getRemoteSocketAddress()); <END> transmission.getNetworkSend().onSendComplete(); this.completedSends.add(transmission.getNetworkSend()); metrics.sendInFlight.dec(); transmission.clearSend(); key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE | SelectionKey.OP_READ); } } finally { long writeTime = time.milliseconds() - startTimeToWriteInMs; logger.trace("SocketServer time spent on write per key = {}", transmission.getConnectionId(), writeTime); } }</code><technical_language>expose getRemoteAddress()</technical_language>

Target:
private void write(SelectionKey key, Transmission transmission) throws IOException { long startTimeToWriteInMs = time.milliseconds(); try { boolean sendComplete = transmission.write(); if (sendComplete) { logger.trace("Finished writing, registering for read on connection {}", transmission.getRemoteSocketAddress()); transmission.onSendComplete(); this.completedSends.add(transmission.getNetworkSend()); metrics.sendInFlight.dec(); transmission.clearSend(); key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE | SelectionKey.OP_READ); } } finally { long writeTime = time.milliseconds() - startTimeToWriteInMs; logger.trace("SocketServer time spent on write per key = {}", transmission.getConnectionId(), writeTime); } }
Source:
<code>private void checkNoSearchResults(String result,int length){ if (length>0) { textView.setText(getString(R.string.null_search_result) + " " + '"' + result + '"'); <START> textView.setTextColor(getTextColor()); <END> textView.setVisibility(View.VISIBLE); } else textView.setVisibility(View.INVISIBLE); }</code><technical_language>hide textview</technical_language>

Target:
private void checkNoSearchResults(String result,int length){ if (length>0) { textView.setText(getString(R.string.null_search_result) + " " + '"' + result + '"'); textView.setTextColor(getTextColor()); textView.setVisibility(View.VISIBLE); } else textView.setVisibility(View.GONE); }
Source:
<code>public void activate(OperatorContext context) { <START> scanDirService.scheduleAtFixedRate(new DirectoryScannerThread(), 0, scanIntervalMillis, TimeUnit.MILLISECONDS); <END> }</code><technical_language>This is scheduleAtFixedRate task DirectoryScannerThread terminates</technical_language>

Target:
public void activate(OperatorContext context) { scanDirService.scheduleWithFixedDelay(new DirectoryScannerTask(), 0, scanIntervalMillis, TimeUnit.MILLISECONDS); }
Source:
<code>public static void indexXmlFiles(File collectionDirectory, IndexWriter writer, boolean isElementPath, TaggedValuePointable nodep, ArrayBackedValueStorage abvsFileNode, ITreeNodeIdProvider nodeIdProvider, SequenceBuilder sb, ByteBufferInputStream bbis, DataInputStream di, String nodeId) throws SystemException, IOException { for (File file : collectionDirectory.listFiles()) { if (readableXmlFile(file.getPath())) { abvsFileNode.reset(); IndexDocumentBuilder ibuilder = getIndexBuilder(file, writer, nodep, abvsFileNode, nodeIdProvider, bbis, di, nodeId); ibuilder.printStart(); if (!isMetaFilePresent) { XmlMetadata xmlMetadata = new XmlMetadata(); xmlMetadata.setPath(file.getCanonicalPath()); xmlMetadata.setFileName(file.getName()); try { xmlMetadata.setMd5(metaFileUtil.generateMD5(file)); } catch (NoSuchAlgorithmException e) { <START> e.printStackTrace(); <END> } metadataMap.put(file.getCanonicalPath(), xmlMetadata); } } else if (file.isDirectory()) { indexXmlFiles(file, writer, isElementPath, nodep, abvsFileNode, nodeIdProvider, sb, bbis, di, nodeId); } } }</code><technical_language>Please swallow exceptions. option wrap exception a SystemException error code SYSE0001</technical_language>

Target:
public static void indexXmlFiles(File collectionDirectory, IndexWriter writer, boolean isElementPath, TaggedValuePointable nodep, ArrayBackedValueStorage abvsFileNode, ITreeNodeIdProvider nodeIdProvider, SequenceBuilder sb, ByteBufferInputStream bbis, DataInputStream di, String nodeId) throws SystemException, IOException { for (File file : collectionDirectory.listFiles()) { if (readableXmlFile(file.getPath())) { abvsFileNode.reset(); IndexDocumentBuilder ibuilder = getIndexBuilder(file, writer, nodep, abvsFileNode, nodeIdProvider, bbis, di, nodeId); ibuilder.printStart(); if (!isMetaFilePresent) { XmlMetadata xmlMetadata = new XmlMetadata(); xmlMetadata.setPath(file.getCanonicalPath()); xmlMetadata.setFileName(file.getName()); try { xmlMetadata.setMd5(metaFileUtil.generateMD5(file)); } catch (NoSuchAlgorithmException e) { throw new SystemException(ErrorCode.SYSE0001, e); } metadataMap.put(file.getCanonicalPath(), xmlMetadata); } } else if (file.isDirectory()) { indexXmlFiles(file, writer, isElementPath, nodep, abvsFileNode, nodeIdProvider, sb, bbis, di, nodeId); } } }
Source:
<code><START> public void dispose() { <END> fTraceMap.clear(); }</code><technical_language>do fTrace = null;</technical_language>

Target:
public void dispose() { fTraceMap.clear(); fTrace = null; }
Source:
<code>public void stopMotor() { <START> for (CustomSpeedController motor : motors) { <END> motor.stopMotor(); } }</code><technical_language>SpeedController CustomSpeedController</technical_language>

Target:
public void stopMotor() { for (SpeedController motor : motors) { motor.stopMotor(); } }
Source:
<code>protected Object removeUnnecessaryInfo(Object entity) { String methodName; Object nullObj = null; <START> for (Method m : entity.getClass().getMethods()) { <END> methodName = m.getName(); if (methodName.startsWith("set") && !methodName.equals("setId") && !methodName.equals("setHref") && !methodName.equals("setLinks")) { try { m.invoke(entity, nullObj); } catch (IllegalAccessException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } catch (IllegalArgumentException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } catch (InvocationTargetException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } } } return entity; }</code><technical_language>create new instance of object [1] (you do types serializeable default constructor), copy id & href variables instead of looping fields setting NULLs, this is more efficient error prone [1] entity.getClass().newInstance()</technical_language>

Target:
protected Object removeUnnecessaryInfo(Object entity) throws InstantiationException, IllegalAccessException, NoSuchMethodException { String methodName; Object newEntity = entity.getClass().newInstance(); for (Method m : newEntity.getClass().getMethods()) { methodName = m.getName(); if (methodName.startsWith("set") && (methodName.equals("setId") || methodName.equals("setHref"))) { try { m.invoke(newEntity, getEntityValue(entity, getCorrespondingGetMethod(methodName))); } catch (IllegalAccessException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } catch (IllegalArgumentException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } catch (InvocationTargetException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } } } return entity; }
Source:
<code><START> public Matrix subi(final Matrix matrix) { <END> if (matrix.isDense()) { throw new UnsupportedOperationException(); } else { ((NumericOps) breezeMatrix).$minus$eq(((CSCMatrix) matrix).breezeMatrix, MatrixOps.SUBI_SS); return this; } }</code><technical_language>UnsupportedOperationException thrown this method</technical_language>

Target:
public Matrix subi(final Matrix matrix) { if (matrix.isDense()) { ((NumericOps) breezeMatrix).$minus$eq(((DenseMatrix) matrix).getBreezeMatrix(), MatrixOps.SUBI_MM); } else { ((NumericOps) breezeMatrix).$minus$eq(((CSCMatrix) matrix).breezeMatrix, MatrixOps.SUBI_SS); } return this; }
Source:
<code>public void update() { Stock updatedStock = (Stock) subject.getUpdate(); if (m.getStockForSymbol(updatedStock.getSymbol()) == null) { <START> return; <END> } if (history.containsKey(updatedStock.getSymbol())) { List<Double> priceList = history.get(updatedStock.getSymbol()); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } else { List<Double> priceList = new ArrayList<Double>(); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } }</code><technical_language>throw a exception return null</technical_language>

Target:
public void update() { Stock updatedStock = (Stock) subject.getUpdate(); if (m.getStockForSymbol(updatedStock.getSymbol()) == null) { return; } if (history.containsKey(updatedStock.getSymbol())) { List<Double> priceList = history.get(updatedStock.getSymbol()); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } else { updateExistingStock(updatedStock); } }
Source:
<code>public void initialise() { <START> UILabel subtitle2 = find("subtitle2", UILabel.class); <END> if (subtitle2 != null) { subtitle2.bindText(new ReadOnlyBinding<String>() { @Override public String get() { if (loadingAsServer) { return "Multiplayer"; } return "Singleplayer"; } }); } final UIList<GameInfo> gameList = find("gameList", UIList.class); refreshList(gameList); gameList.subscribe((widget, item) -> loadGame(item)); WidgetUtil.trySubscribe(this, "create", button -> { CreateGameScreen createGameScreen = getManager().pushScreen("engine:createGameScreen", CreateGameScreen.class); createGameScreen.setLoadingAsServer(loadingAsServer); }); WidgetUtil.trySubscribe(this, "load", button -> { GameInfo gameInfo = gameList.getSelection(); if (gameInfo != null) { loadGame(gameInfo); } }); WidgetUtil.trySubscribe(this, "delete", button -> { GameInfo gameInfo = gameList.getSelection(); if (gameInfo != null) { Path world = PathManager.getInstance().getSavePath(gameInfo.getManifest().getTitle()); try { FilesUtil.recursiveDelete(world); gameList.getList().remove(gameInfo); gameList.setSelection(null); } catch (Exception e) { logger.error("Failed to delete saved game", e); getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error Deleting Game", e.getMessage()); } } }); WidgetUtil.trySubscribe(this, "close", button -> getManager().popScreen()); }</code><technical_language>Good! find a name subtitle2</technical_language>

Target:
public void initialise() { UILabel gameTypeTitle = find("gameTypeTitle", UILabel.class); if (gameTypeTitle != null) { gameTypeTitle.bindText(new ReadOnlyBinding<String>() { @Override public String get() { if (loadingAsServer) { return translationSystem.translate("${engine:menu#select-multiplayer-game-sub-title}"); } else { return translationSystem.translate("${engine:menu#select-singleplayer-game-sub-title}"); } } }); } final UIList<GameInfo> gameList = find("gameList", UIList.class); refreshList(gameList); gameList.subscribe((widget, item) -> loadGame(item)); WidgetUtil.trySubscribe(this, "create", button -> { CreateGameScreen createGameScreen = getManager().pushScreen("engine:createGameScreen", CreateGameScreen.class); createGameScreen.setLoadingAsServer(loadingAsServer); }); WidgetUtil.trySubscribe(this, "load", button -> { GameInfo gameInfo = gameList.getSelection(); if (gameInfo != null) { loadGame(gameInfo); } }); WidgetUtil.trySubscribe(this, "delete", button -> { GameInfo gameInfo = gameList.getSelection(); if (gameInfo != null) { Path world = PathManager.getInstance().getSavePath(gameInfo.getManifest().getTitle()); try { FilesUtil.recursiveDelete(world); gameList.getList().remove(gameInfo); gameList.setSelection(null); } catch (Exception e) { logger.error("Failed to delete saved game", e); getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error Deleting Game", e.getMessage()); } } }); WidgetUtil.trySubscribe(this, "close", button -> getManager().popScreen()); }
Source:
<code>protected static void updateCompactionMetrics(ShowCompactResponse showCompactResponse) { Map<String, ShowCompactResponseElement> lastElements = new HashMap<>(); for(ShowCompactResponseElement element : showCompactResponse.getCompacts()) { <START> String key = element.getDbname() + "/" + element.getTablename() + "/" + element.getPartitionname(); <END> lastElements.compute(key, (k, old) -> (old == null) ? element : (element.getId() > old.getId() ? element : old)); } Map<String, Long> counts = lastElements.values().stream() .collect(Collectors.groupingBy(e -> e.getState(), Collectors.counting())); for (int i = 0; i < TxnStore.COMPACTION_STATES.length; ++i) { String key = MetricsConstants.COMPACTION_STATUS_PREFIX + TxnStore.COMPACTION_STATES[i]; Long count = counts.get(TxnStore.COMPACTION_STATES[i]); if (count != null) { Metrics.getOrCreateGauge(key).set(count.intValue()); } else { Metrics.getOrCreateGauge(key).set(0); } } }</code><technical_language>element.getPartitionname() return null, resulting in a key="dbName/tableName/null"</technical_language>

Target:
protected static void updateCompactionMetrics(ShowCompactResponse showCompactResponse) { Map<String, ShowCompactResponseElement> lastElements = new HashMap<>(); for(ShowCompactResponseElement element : showCompactResponse.getCompacts()) { String key = element.getDbname() + "/" + element.getTablename() + (element.getPartitionname() != null ? "/" + element.getPartitionname() : ""); lastElements.compute(key, (k, old) -> (old == null) ? element : (element.getId() > old.getId() ? element : old)); } Map<String, Long> counts = lastElements.values().stream() .collect(Collectors.groupingBy(e -> e.getState(), Collectors.counting())); for (int i = 0; i < TxnStore.COMPACTION_STATES.length; ++i) { String key = MetricsConstants.COMPACTION_STATUS_PREFIX + TxnStore.COMPACTION_STATES[i]; Long count = counts.get(TxnStore.COMPACTION_STATES[i]); if (count != null) { Metrics.getOrCreateGauge(key).set(count.intValue()); } else { Metrics.getOrCreateGauge(key).set(0); } } }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: <START> System.out.println("[jls] this was unexpected"); <END> this.onBackPressed(); return true; default: return super.onOptionsItemSelected(item); } }</code><technical_language>Please remove this line</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { this.onBackPressed(); return true; } return super.onOptionsItemSelected(item); }
Source:
<code>private Map<String, List<String>> computeLiveDocumentRefsToRenditionRefs() { Map<String, List<String>> liveDocumentRefsToRenditionRefs = new HashMap<>(); String query = String.format( "SELECT ecm:uuid, %s, %s FROM Document WHERE %s IS NOT NULL AND ecm:isVersion = 0", RENDITION_SOURCE_ID_PROPERTY, RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY, RENDITION_SOURCE_ID_PROPERTY); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> res : result) { <START> String renditionRef = res.get("ecm:uuid").toString(); <END> String sourceId = res.get(RENDITION_SOURCE_ID_PROPERTY).toString(); Serializable sourceVersionableId = res.get(RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY); String key = sourceVersionableId != null ? sourceVersionableId.toString() : sourceId; List<String> renditionRefs = liveDocumentRefsToRenditionRefs.get(key); if (renditionRefs == null) { renditionRefs = new ArrayList<>(); liveDocumentRefsToRenditionRefs.put(key, renditionRefs); } renditionRefs.add(renditionRef); } } return liveDocumentRefsToRenditionRefs; }</code><technical_language>NXQL.ECM_UUID instead of "ecm:uuid"</technical_language>

Target:
private Map<String, List<String>> computeLiveDocumentRefsToRenditionRefs() { Map<String, List<String>> liveDocumentRefsToRenditionRefs = new HashMap<>(); String query = String.format("SELECT %s, %s, %s FROM Document WHERE %s IS NOT NULL AND ecm:isVersion = 0", NXQL.ECM_UUID, RENDITION_SOURCE_ID_PROPERTY, RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY, RENDITION_SOURCE_ID_PROPERTY); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> res : result) { String renditionRef = res.get(NXQL.ECM_UUID).toString(); String sourceId = res.get(RENDITION_SOURCE_ID_PROPERTY).toString(); Serializable sourceVersionableId = res.get(RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY); String key = sourceVersionableId != null ? sourceVersionableId.toString() : sourceId; liveDocumentRefsToRenditionRefs.computeIfAbsent(key, k -> new ArrayList<>()).add(renditionRef); } } return liveDocumentRefsToRenditionRefs; }
Source:
<code>public IEntityGroup find(String name) throws GroupsException { <START> List<IPersonAttributesGroupDefinition> groups = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(name); <END> IPersonAttributesGroupDefinition pagsGroup = groups.get(0); GroupDefinition groupDef = initGroupDef(pagsGroup); IEntityGroup group = new EntityTestingGroupImpl(groupDef.getKey(), IPERSON_CLASS); group.setName(groupDef.getName()); group.setDescription(groupDef.getDescription()); return group; }</code><technical_language>Undetected error condition multiple groups match name</technical_language>

Target:
public IEntityGroup find(String name) throws GroupsException { Set<IPersonAttributesGroupDefinition> groups = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(name); IPersonAttributesGroupDefinition pagsGroup = groups.iterator().next(); GroupDefinition groupDef = initGroupDef(pagsGroup); IEntityGroup group = new EntityTestingGroupImpl(groupDef.getKey(), IPERSON_CLASS); group.setName(groupDef.getName()); group.setDescription(groupDef.getDescription()); return group; }
Source:
<code>public void setBeanResolver(BeanResolver beanResolver) { <START> this.beanResolver = beanResolver; <END> }</code><technical_language>Please check for null like: java Assert.notNull(beanResolver, "beanResolver null");</technical_language>

Target:
public void setBeanResolver(BeanResolver beanResolver) { Assert.notNull(beanResolver, "beanResolver cannot be null"); this.beanResolver = beanResolver; }
Source:
<code>public void waitingForShards() throws IOException{ try (ElasticsearchContainer container = new ElasticsearchContainer(new ImageFromDockerfile() .withFileFromClasspath("data.zip", "elasticsearch-preload/data.zip") .withFileFromClasspath("Dockerfile", "elasticsearch-preload/Dockerfile") ).waitingForShards()) { container.start(); <START> Response response = getClient(container).performRequest(new Request("GET", "/_cat/shards")); <END> assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(EntityUtils.toString(response.getEntity()), containsString("STARTED")); } }</code><technical_language>I rewrite code in test. I test desired behavior: querying work for example. If shards ready query fail return partial result - run aggregation query</technical_language>

Target:
public void waitingForShards() throws IOException{ try (ElasticsearchContainer container = new ElasticsearchContainer() .withClasspathResourceMapping("elasticsearch-preload/6.4.1/data", "/usr/share/elasticsearch/data", BindMode.READ_WRITE) .waitingForShards() ) { container.start(); Response response = getClient(container).performRequest(new Request("GET", "/index/_doc/1")); assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(EntityUtils.toString(response.getEntity()), containsString("testcontainer")); } }
Source:
<code>public void install() { LOG.info("Installing Node.JS {}", getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION)); List<String> commands = MutableList.<String>builder() .add(BashCommands.INSTALL_CURL) .add(BashCommands.ifExecutableElse0("apt-get", BashCommands.chain( BashCommands.installPackage("software-properties-common python-software-properties python g++ make"), BashCommands.sudo("add-apt-repository ppa:chris-lea/node.js")))) .add(BashCommands.installPackage(MutableMap.of("yum", "git nodejs npm", "apt", "git-core nodejs"), null)) <START> .add("npm install n") END> .add(BashCommands.sudo("npm install -g n")) .add(BashCommands.sudo("n " + getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION))) .build(); newScript(INSTALLING) .body.append(commands) .execute(); }</code><technical_language>I thought global install recommended, normal possible? a NodeJS expert wrong</technical_language>

Target:
public void install() { LOG.info("Installing Node.JS {}", getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION)); List<String> commands = MutableList.<String>builder() .add(BashCommands.INSTALL_CURL) .add(BashCommands.ifExecutableElse0("apt-get", BashCommands.chain( BashCommands.installPackage("software-properties-common python-software-properties python g++ make"), BashCommands.sudo("add-apt-repository ppa:chris-lea/node.js")))) .add(BashCommands.installPackage(MutableMap.of("yum", "git nodejs npm", "apt", "git-core nodejs"), null)) .add("mkdir \"$HOME/.npm\"") .add(BashCommands.sudo("npm install -g n")) .add(BashCommands.sudo("n " + getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION))) .build(); newScript(INSTALLING) .body.append(commands) .execute(); }
Source:
<code>public static Config parse(Map<String, Object> opts) { <START> int cacheSize = (int)(opts.containsKey("--sequencer-cache-size") ? <END> Long.parseLong((String) opts.get("--sequencer-cache-size")) : DEFAULT_CACHE_SIZE); return Config.builder() .cacheSize(cacheSize) .build(); }</code><technical_language>nt cacheSize = (int) opts.getOrDefault("--sequencer-cache-size", DEFAULT_CACHE_SIZE);</technical_language>

Target:
public static Config parse(Map<String, Object> opts) { int cacheSize = (int)(opts.containsKey("--sequencer-cache-size") ? Integer.parseInt((String)opts.get("--sequencer-cache-size")) : DEFAULT_CACHE_SIZE); return Config.builder() .cacheSize(cacheSize) .build(); }
Source:
<code>public static void createSecureConfiguration(Properties properties, AuthenticationMethod authType) { switch (authType) { case KERBEROS: Configuration conf = new org.apache.hadoop.conf.Configuration(); conf.set("hadoop.security.authentication", KERBEROS.toString()); UserGroupInformation.setConfiguration(conf); try { if (!UserGroupInformation.isSecurityEnabled() || UserGroupInformation.getCurrentUser().getAuthenticationMethod() != KERBEROS || !UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.loginUserFromKeytab( properties.getProperty("zeppelin.jdbc.principal"), properties.getProperty("zeppelin.jdbc.keytab.location")); <START> } <END> } catch (IOException e) { LOGGER.error("Failed to get either keytab location or principal name in the " + "interpreter", e); } } }</code><technical_language>log if conditions met</technical_language>

Target:
public static void createSecureConfiguration(Properties properties, AuthenticationMethod authType) { switch (authType) { case KERBEROS: Configuration conf = new org.apache.hadoop.conf.Configuration(); conf.set("hadoop.security.authentication", KERBEROS.toString()); UserGroupInformation.setConfiguration(conf); try { if (!UserGroupInformation.isSecurityEnabled() || UserGroupInformation.getCurrentUser().getAuthenticationMethod() != KERBEROS || !UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.loginUserFromKeytab( properties.getProperty("zeppelin.jdbc.principal"), properties.getProperty("zeppelin.jdbc.keytab.location")); } else { LOGGER.info("The user has already logged in using Keytab and principal, " + "no action required"); } } catch (IOException e) { LOGGER.error("Failed to get either keytab location or principal name in the " + "interpreter", e); } } }
Source:
<code>public CompositeBiJoiner(List<SingleBiJoiner<A, B>> joinerList) { this.joinerList = joinerList; if (joinerList.isEmpty()) { throw new IllegalArgumentException("The joinerList (" + joinerList + ") must not be empty."); <START> } <END> }</code><technical_language>switch store check</technical_language>

Target:
public CompositeBiJoiner(List<SingleBiJoiner<A, B>> joinerList) { if (joinerList.isEmpty()) { throw new IllegalArgumentException("The joinerList (" + joinerList + ") must not be empty."); } this.joinerList = joinerList; }
Source:
<code><START> public void testValidatesOtherStrandNotLonger() throws IllegalArgumentException { <END> thrown.expect(IllegalArgumentException.class); Hamming.compute("AAA", "AAAG"); }</code><technical_language>for this :)</technical_language>

Target:
public void testValidatesOtherStrandNotLonger() { thrown.expect(IllegalArgumentException.class); Hamming.compute("AAA", "AAAG"); }
Source:
<code>private ConditionalModule(Class<T> config, Predicate<T> predicate, Module module) { <START> this.config = config; <END> this.predicate = predicate; this.module = module; }</code><technical_language>Check for null</technical_language>

Target:
private ConditionalModule(Class<T> config, Predicate<T> predicate, Module module) { this.config = requireNonNull(config, "config is null"); this.predicate = requireNonNull(predicate, "predicate is null"); this.module = requireNonNull(module, "module is null"); }
Source:
<code>InputStream getAssetFile() throws IOException { if (contextWeakRef != null) { Context context = contextWeakRef.get(); <START> if (context != null) { <END> return context.getAssets().open(assetFilePath); } } return null; }</code><technical_language>reason this null is if Activity context instead, in case throw IllegalStateException RealmException application context used, import logic fail silently I tell</technical_language>

Target:
InputStream getAssetFile() throws IOException { Context context = contextWeakRef.get(); if (context != null) { return context.getAssets().open(assetFilePath); } else { throw new IllegalArgumentException("Context should not be null. Use Application Context instead of Activity Context."); } }
Source:
<code>default B with(int data) { <START> return with( ByteBuffer.allocate(Integer.BYTES).putInt( data ).array()); <END> }</code><technical_language>If read code ByteBuffer.allocate is a lot of overhead calls. If this Builder is efficient I suggest writing methods explicitly: java // little-endian return with(new byte[]{(byte) (data ), (byte) (data >> 8), (byte) (data >> 16), (byte) (data >> 24)});</technical_language>

Target:
default B with(int data) { return with(new byte[]{(byte) (data ), (byte) (data >> 8), (byte) (data >> 16), (byte) (data >> 24)}); }
Source:
<code>public static DesignDocument fromFile(File file) { assertNotEmpty(file, "Design js file"); DesignDocument dd = new DesignDocument(); Gson gson = new Gson(); try { String contents = readURL(file.toURI().toURL()); <START> dd = gson.fromJson(contents, DesignDocument.class); <END> } catch (MalformedURLException e) { e.printStackTrace(); } return dd; }</code><technical_language>Instead of reading a String, pass a FileReader Gson? throw FileNotFoundException caller handle figuring out if wrong path read access whatever</technical_language>

Target:
public static DesignDocument fromFile(File file) throws FileNotFoundException { assertNotEmpty(file, "Design js file"); DesignDocument designDocument; Gson gson = new Gson(); designDocument = gson.fromJson(new FileReader(file), DesignDocument.class); return designDocument; }
Source:
<code>private void fetchPerTestData(RootNode controlTree) { testIdToPlotsMap = new HashMap<Long, MetricPlotDTOs>(); Set<MetricNode> allMetrics = new HashSet<MetricNode>(); DetailsNode detailsNode = controlTree.getDetailsNode(); <START> if (detailsNode.getChildren().isEmpty()) <END> return; for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { allMetrics.addAll(testDetailsNode.getMetrics()); } try { Map<MetricNode, PlotIntegratedDto> dataMap = databaseService.getPlotDataByMetricNode(allMetrics); for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { getDetailsPlotsReport(testDetailsNode, testDetailsNode.getTaskDataDto().getId(), dataMap); } } catch (Exception e) { log.error("Unable to get plots information for metrics"); } }</code><technical_language>propose check getTests() instead of getChildren()</technical_language>

Target:
private void fetchPerTestData(RootNode controlTree) { Set<MetricNode> allMetrics = new HashSet<MetricNode>(); DetailsNode detailsNode = controlTree.getDetailsNode(); if (detailsNode.getTests().isEmpty()) return; for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { allMetrics.addAll(testDetailsNode.getMetrics()); } try { Map<MetricNode, PlotIntegratedDto> dataMap = databaseService.getPlotDataByMetricNode(allMetrics); for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { TaskDataDto taskDataDto = testDetailsNode.getTaskDataDto(); getPlotsReport( dataMap, testDetailsNode, new PerTestReportPlotHelper(taskDataDto.getId(), taskDataDto.getTaskName()) ); } } catch (Exception e) { log.error("Unable to get metrics plots information for session " + this.sessionId, e); } }
Source:
<code>private MetricsForStrategy(MetricsManager manager, String strategy, Function<Long, Long> tsToMillis, Clock wallClock, long recomputeMillis) { Map<String, String> tag = ImmutableMap.of(AtlasDbMetricNames.TAG_STRATEGY, strategy); this.manager = manager; enqueuedWrites = register(AtlasDbMetricNames.ENQUEUED_WRITES, TimestampedAccumulatingValueMetric.create(), tag); entriesRead = registerAccumulating(AtlasDbMetricNames.ENTRIES_READ, tag); tombstonesPut = registerAccumulating(AtlasDbMetricNames.TOMBSTONES_PUT, tag); abortedWritesDeleted = registerAccumulating(AtlasDbMetricNames.ABORTED_WRITES_DELETED, tag); sweepTimestamp = register(AtlasDbMetricNames.SWEEP_TS, new CurrentValueMetric<>(), tag); AggregatingVersionedSupplier<Long> lastSweptTsSupplier = new AggregatingVersionedSupplier<>( TargetedSweepMetrics::minimum, recomputeMillis); lastSweptTs = register(AtlasDbMetricNames.LAST_SWEPT_TS, new AggregatingVersionedMetric<>(lastSweptTsSupplier), tag); Supplier<Long> millisSinceLastSweptTs = new CachedComposedSupplier<>( <START> swept -> estimateMillisSinceTs(swept, wallClock, tsToMillis), lastSweptTs::getVersionedValue); <END> register(AtlasDbMetricNames.LAG_MILLIS, millisSinceLastSweptTs::get, tag); }</code><technical_language>nit: I lastSwept* variables if this named swept, sweptTs</technical_language>

Target:
private MetricsForStrategy(MetricsManager manager, String strategy, Function<Long, Long> tsToMillis, Clock wallClock, long recomputeMillis) { Map<String, String> tag = ImmutableMap.of(AtlasDbMetricNames.TAG_STRATEGY, strategy); this.manager = manager; enqueuedWrites = register(AtlasDbMetricNames.ENQUEUED_WRITES, TimestampedAccumulatingValueMetric.create(), tag); entriesRead = registerAccumulating(AtlasDbMetricNames.ENTRIES_READ, tag); tombstonesPut = registerAccumulating(AtlasDbMetricNames.TOMBSTONES_PUT, tag); abortedWritesDeleted = registerAccumulating(AtlasDbMetricNames.ABORTED_WRITES_DELETED, tag); sweepTimestamp = register(AtlasDbMetricNames.SWEEP_TS, new CurrentValueMetric<>(), tag); AggregatingVersionedSupplier<Long> lastSweptTsSupplier = new AggregatingVersionedSupplier<>( TargetedSweepMetrics::minimum, recomputeMillis); lastSweptTs = register(AtlasDbMetricNames.LAST_SWEPT_TS, new AggregatingVersionedMetric<>(lastSweptTsSupplier), tag); Supplier<Long> millisSinceLastSweptTs = new CachedComposedSupplier<>( sweptTs -> estimateMillisSinceTs(sweptTs, wallClock, tsToMillis), lastSweptTs::getVersionedValue); register(AtlasDbMetricNames.LAG_MILLIS, millisSinceLastSweptTs::get, tag); }
Source:
<code>public Collection<TopicPartition> onPartitionsAssigned(Collection<TopicPartition> partitions) { <START> return EMPTY_PARTITIONS_SET; <END> }</code><technical_language>matters in case of this class Collections.unmodifiableCollection(EMPTY_PARTITIONS_SET)</technical_language>

Target:
public Collection<TopicPartition> onPartitionsAssigned(Collection<TopicPartition> partitions) { return Collections.unmodifiableSet(EMPTY_PARTITIONS_SET); }
Source:
<code>public void testWebpackAmdPattern() { testModules( "test.js", LINE_JOINER.join( "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", "!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)],", " __WEBPACK_AMD_DEFINE_RESULT__ = function (b, c) {", " console.log(b, c.exportA, c.exportB);", " }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),", <START> " __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));"), <END> LINE_JOINER.join( "goog.provide('module$test');", "var module$test = {};", "var __WEBPACK_AMD_DEFINE_ARRAY__$$module$test;", "!(__WEBPACK_AMD_DEFINE_ARRAY__$$module$test = [__webpack_require__(1), __webpack_require__(2)],", " module$test = function(b,c){console.log(b,c.exportA,c.exportB)}", " .apply(module$test,__WEBPACK_AMD_DEFINE_ARRAY__$$module$test),", " module$test!==undefined && module$test)")); }</code><technical_language>line long</technical_language>

Target:
public void testWebpackAmdPattern() { testModules( "test.js", LINE_JOINER.join( "var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;", "!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)],", " __WEBPACK_AMD_DEFINE_RESULT__ = function (b, c) {", " console.log(b, c.exportA, c.exportB);", " }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),", " __WEBPACK_AMD_DEFINE_RESULT__ !== undefined", " && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));"), LINE_JOINER.join( "goog.provide('module$test');", "var module$test = {};", "var __WEBPACK_AMD_DEFINE_ARRAY__$$module$test;", "!(__WEBPACK_AMD_DEFINE_ARRAY__$$module$test = ", " [__webpack_require__(1), __webpack_require__(2)],", " module$test = function(b,c){console.log(b,c.exportA,c.exportB)}", " .apply(module$test,__WEBPACK_AMD_DEFINE_ARRAY__$$module$test),", " module$test!==undefined && module$test)")); }
Source:
<code>HandlerFunctionDescription(HandlerFunction<?> handlerFunction) { <START> this.className = handlerFunction.getClass().getName(); <END> }</code><technical_language>I do this. a fallback if getCanonicalName is empty? a change of format a breaking change. adapt test? I looked in details thinking out loud</technical_language>

Target:
HandlerFunctionDescription(HandlerFunction<?> handlerFunction) { this.className = getHandlerFunctionClassName(handlerFunction); }
Source:
<code>private static Term intTerm(String name, int value) { BytesRef bytes = new BytesRef(NumericUtils.BUF_SIZE_INT); BytesRefBuilder builder = new BytesRefBuilder(); builder.append(bytes); <START> NumericUtils.intToPrefixCodedBytes(value, 0, builder); <END> return new Term(name, bytes); }</code><technical_language>Need builder.get(). Done</technical_language>

Target:
private static Term intTerm(String name, int value) { BytesRefBuilder builder = new BytesRefBuilder(); NumericUtils.intToPrefixCodedBytes(value, 0, builder); return new Term(name, builder.get()); }
Source:
<code>public List<Folder> getValidationFolders() { <START> return typeValidateImages <END> ? process.getProject().getFolders().parallelStream() .filter(Folder::isValidateFolder) .collect(Collectors.toList()) : Collections.emptyList(); }</code><technical_language>change this? Please put logic in return statement</technical_language>

Target:
public List<Folder> getValidationFolders() { List<Folder> validationFolders = typeValidateImages ? process.getProject().getFolders().parallelStream() .filter(Folder::isValidateFolder) .collect(Collectors.toList()) : Collections.emptyList(); return validationFolders; }
Source:
<code>public DataPointGroup aggregate(DataPointGroup dataPointGroup) { <START> if (m_sampling == null) END> m_sampling = new Sampling(1, TimeUnit.MILLISECONDS); checkNotNull(dataPointGroup); if (m_alignSampling) { m_startTime = alignRangeBoundary(m_startTime); } return (new RangeDataPointAggregator(dataPointGroup, getSubAggregator())); }</code><technical_language>This is unnecessary annotation this null. catch this api syntax error return caller</technical_language>

Target:
public DataPointGroup aggregate(DataPointGroup dataPointGroup) { checkNotNull(dataPointGroup); if (m_alignSampling) m_startTime = alignRangeBoundary(m_startTime); return (new RangeDataPointAggregator(dataPointGroup, getSubAggregator())); }
Source:
<code>public void testBuildingRtfFromTemplate() { RtfTemplate template = new RtfTemplate.Builder() .withMetacard(mockMetacard) .usingCategories(mockCategories) .build(); assertThat("Template cannot be null", template, notNullValue()); assertThat( "There should be 4 categories", mockCategories.get(0).getAttributes().size(), equalTo(4)); Rtf doc = Rtf.rtf(); Rtf generatedTemplate = template.rtf(doc); assertThat("Rtf template instance cannot be null", generatedTemplate, notNullValue()); String finishedDoc = generatedTemplate.out().toString(); assertThat("RTF output cannot be null", finishedDoc, notNullValue()); assertThat("RTF document must start with {\\rtf1", finishedDoc.startsWith("{\\rtf1"), is(true)); assertThat( String.format("RTF document must contain section with title: %s", METACARD_TITLE), finishedDoc.contains(METACARD_TITLE), <START> is(true)); <END> }</code><technical_language>[containsString()](<LINK_0> matcher instead</technical_language>

Target:
public void testBuildingRtfFromTemplate() { RtfTemplate template = new RtfTemplate.Builder().withMetacard(mockMetacard).withCategories(mockCategories).build(); assertThat("Template cannot be null", template, notNullValue()); assertThat("There should be 4 categories", mockCategories.get(0).getAttributes(), hasSize(4)); Rtf doc = Rtf.rtf(); Rtf generatedTemplate = template.rtf(doc); assertThat("Rtf template instance cannot be null", generatedTemplate, notNullValue()); String finishedDoc = generatedTemplate.out().toString(); assertThat("RTF output cannot be null", finishedDoc, notNullValue()); assertThat("RTF document must start with {\\rtf1", finishedDoc, startsWith("{\\rtf1")); assertThat( String.format("RTF document must contain section with title: %s", METACARD_TITLE), finishedDoc, containsString(METACARD_TITLE)); }
Source:
<code>public static void setUp() { final Injector injector = GuiceInjectors.makeStartupInjectorWithModules( ImmutableList.of( new Module() { @Override public void configure(Binder binder) { binder.bind(LocalDataSegmentPuller.class); } } ) ); mapper = new DefaultObjectMapper(); mapper.registerModule( new com.fasterxml.jackson.databind.Module() { @Override public String getModuleName() { return "noName"; } @Override public Version version() { return Version.unknownVersion(); } @Override public void setupModule(SetupContext context) { context.registerSubtypes(LocalLoadSpec.class); } } ); mapper.setInjectableValues( new InjectableValues() { @Override public Object findInjectableValue( Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance ) { if (valueId instanceof Key) { return injector.getInstance((Key) valueId); } <START> if (valueId instanceof String) { <END> try { return injector.getInstance(Class.forName((String) valueId)); } catch (ClassNotFoundException e) { throw new IAE(e, "Cannot get class [%s]", valueId); } } throw new IAE("Unknown class type [%s]", valueId.getClass().getCanonicalName()); } } ); }</code><technical_language>reason a String is GuiceAnnotationIntrospector registered ObjectMapper</technical_language>

Target:
public static void setUp() { final Injector injector = GuiceInjectors.makeStartupInjectorWithModules( ImmutableList.of( new Module() { @Override public void configure(Binder binder) { binder.bind(LocalDataSegmentPuller.class); } } ) ); mapper = new DefaultObjectMapper(); mapper.registerModule( new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class)); mapper.setInjectableValues(new GuiceInjectableValues(injector)); final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector(); mapper.setAnnotationIntrospectors( new AnnotationIntrospectorPair( guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector() ), new AnnotationIntrospectorPair( guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector() ) ); }
Source:
<code>public void run() { AbstractPollingEndpoint.this.taskExecutor.execute(() -> { int count = 0; while (AbstractPollingEndpoint.this.initialized && (AbstractPollingEndpoint.this.maxMessagesPerPoll <= 0 || count < AbstractPollingEndpoint.this.maxMessagesPerPoll)) { try { if (!Poller.this.pollingTask.call()) { break; } count++; } catch (Exception e) { if (e instanceof MessagingException) { throw (MessagingException) e; } else { <START> throw new MessagingException(messageHolder.get(), e); <END> } } finally { messageHolder.remove(); } } }); }</code><technical_language>I think, fine solution. I thought ThreadLocal a TX, is finished cleaned Poller.this.pollingTask.call(). if TX throws exception commit, a TX-synched resource consult for Message. So, LGTM here, I MessageHandlingException. generic case, handleMessage(Message) problem</technical_language>

Target:
public void run() { AbstractPollingEndpoint.this.taskExecutor.execute(() -> { int count = 0; while (AbstractPollingEndpoint.this.initialized && (AbstractPollingEndpoint.this.maxMessagesPerPoll <= 0 || count < AbstractPollingEndpoint.this.maxMessagesPerPoll)) { try { if (!Poller.this.pollingTask.call()) { break; } count++; } catch (Exception e) { if (e instanceof MessagingException) { throw (MessagingException) e; } else { Message<?> failedMessage = null; if (AbstractPollingEndpoint.this.transactionSynchronizationFactory != null) { Object resource = TransactionSynchronizationManager.getResource(getResourceToBind()); if (resource instanceof IntegrationResourceHolder) { failedMessage = ((IntegrationResourceHolder) resource).getMessage(); } } throw new MessagingException(failedMessage, e); } } finally { if (AbstractPollingEndpoint.this.transactionSynchronizationFactory != null) { Object resource = getResourceToBind(); if (TransactionSynchronizationManager.hasResource(resource)) { TransactionSynchronizationManager.unbindResource(resource); } } } } }); }
Source:
<code>public int hashCode() { <START> return com.google.common.base.Objects.hashCode(context, label, provider); <END> }</code><technical_language>Please Java 8 built in methods</technical_language>

Target:
public int hashCode() { return Objects.hash(context, label, provider); }
Source:
<code>public ObjectId insert(int type, long len, InputStream in) throws IOException { byte[] buf = buffer(); <START> if (buf.length < len && len < (10 << 20)) <END> buf = new byte[(int) len]; if (len <= buf.length) { IO.readFully(in, buf, 0, (int) len); return insert(type, buf, 0, (int) len); } long offset = beginObject(type, len); MessageDigest md = digest(); md.update(Constants.encodedTypeString(type)); md.update((byte) ' '); md.update(Constants.encodeASCII(len)); md.update((byte) 0); while (0 < len) { int n = in.read(buf, 0, (int) Math.min(buf.length, len)); if (n <= 0) throw new EOFException(); md.update(buf, 0, n); packOut.compress.write(buf, 0, n); len -= n; } packOut.compress.finish(); return endObject(ObjectId.fromRaw(md.digest()), offset); }</code><technical_language>nice if share a constant match buffer sizes</technical_language>

Target:
public ObjectId insert(int type, long len, InputStream in) throws IOException { byte[] buf = buffer(); if (buf.length < len && len < db.getReaderOptions().getStreamFileThreshold()) buf = new byte[(int) len]; if (len <= buf.length) { IO.readFully(in, buf, 0, (int) len); return insert(type, buf, 0, (int) len); } long offset = beginObject(type, len); MessageDigest md = digest(); md.update(Constants.encodedTypeString(type)); md.update((byte) ' '); md.update(Constants.encodeASCII(len)); md.update((byte) 0); while (0 < len) { int n = in.read(buf, 0, (int) Math.min(buf.length, len)); if (n <= 0) throw new EOFException(); md.update(buf, 0, n); packOut.compress.write(buf, 0, n); len -= n; } packOut.compress.finish(); return endObject(ObjectId.fromRaw(md.digest()), offset); }
Source:
<code>public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String hostOs) { boolean alert = false; for (RpmVersion iso: isos) { try { String nodeInfo[] = hostOs.split("-"); String formattedISOversion = iso.getValue(); formattedISOversion = formattedISOversion.substring(formattedISOversion.length() - 8); Date dateISO = dateISOformat.parse(formattedISOversion); Date dateNodeISO = dateISOformat.parse(nodeInfo[2].split("\\.")[0].trim()); <START> if (dateISO.compareTo(dateNodeISO)>0) { <END> alert = true; break; } } catch (RuntimeException ex) { getLogger().error("Error while trying to determine host upgrade alert", ex); } } return alert; }</code><technical_language>stupid question reviews... compare version as-is? date meaningless</technical_language>

Target:
public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String hostOs) { boolean alert = false; for (RpmVersion iso: isos) { String nodeInfo[] = hostOs.split("-"); String nodeVersion[] = nodeInfo[1].trim().split("\\."); String isoVersion[] = iso.getValue().trim().split("\\."); if (Integer.parseInt(isoVersion[0]) == Integer.parseInt(nodeVersion[0])) { if (Integer.parseInt(isoVersion[1]) > Integer.parseInt(nodeVersion[1]) || Integer.parseInt(isoVersion[2]) > Integer.parseInt(nodeVersion[2])) { alert = true; break; } } } return alert; }