auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void process(final Exchange exchange) throws Exception { final Message in = exchange.getIn(); String fcrepoBinaryUri = (String) in.getHeader(FCREPO_URI); if (fcrepoBinaryUri == null) { Document msgBody = MessageUtil.getDocumentBody(in); Element body = msgBody.getRootElement(); String pidValue = body.getChild("pid", ATOM_NS).getTextTrim(); String mimeType = body.getChild("mimeType", ATOM_NS).getTextTrim(); log.info("Adding enhancement headers for " + pidValue); in.setHeader(FCREPO_URI, pidValue); in.setHeader(CdrBinaryMimeType, mimeType); <START> in.setHeader("org.fcrepo.jms.resourceType", Binary.getURI()); <END> } }</code><technical_language>a constant out of this</technical_language>

Target:
public void process(final Exchange exchange) throws Exception { final Message in = exchange.getIn(); String fcrepoBinaryUri = (String) in.getHeader(FCREPO_URI); if (fcrepoBinaryUri == null) { Document msgBody = MessageUtil.getDocumentBody(in); Element body = msgBody.getRootElement(); String pidValue = body.getChild("pid", ATOM_NS).getTextTrim(); String mimeType = body.getChild("mimeType", ATOM_NS).getTextTrim(); log.info("Adding enhancement headers for " + pidValue); in.setHeader(FCREPO_URI, pidValue); in.setHeader(CdrBinaryMimeType, mimeType); in.setHeader(FCREPO_RESOURCE_TYPE, Binary.getURI()); } }
Source:
<code>public void removeAll(final Set<? extends K> keys) throws BulkCacheWritingException { removeAllObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(keys); if(keys.isEmpty()) { removeAllObserver.end(RemoveAllOutcome.SUCCESS); return; } for (K key: keys) { if (key == null) { throw new NullPointerException(); } } <START> RemoveAllFunction<K, V> removeAllFunction = new RemoveAllFunction<K, V>(); <END> try { store.bulkCompute(keys, removeAllFunction); addBulkMethodEntriesCount(BulkOps.REMOVE_ALL, removeAllFunction.getActualRemoveCount().get()); removeAllObserver.end(RemoveAllOutcome.SUCCESS); } catch (StoreAccessException e) { try { resilienceStrategy.removeAllFailure(keys, e); } finally { removeAllObserver.end(RemoveAllOutcome.FAILURE); } } }</code><technical_language>I declare this variable try / catch block too</technical_language>

Target:
public void removeAll(final Set<? extends K> keys) throws BulkCacheWritingException { removeAllObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(keys); if(keys.isEmpty()) { removeAllObserver.end(RemoveAllOutcome.SUCCESS); return; } for (K key: keys) { if (key == null) { throw new NullPointerException(); } } try { RemoveAllFunction<K, V> removeAllFunction = new RemoveAllFunction<K, V>(); store.bulkCompute(keys, removeAllFunction); addBulkMethodEntriesCount(BulkOps.REMOVE_ALL, removeAllFunction.getActualRemoveCount().get()); removeAllObserver.end(RemoveAllOutcome.SUCCESS); } catch (StoreAccessException e) { try { resilienceStrategy.removeAllFailure(keys, e); } finally { removeAllObserver.end(RemoveAllOutcome.FAILURE); } } }
Source:
<code>protected Collection<Negotiation> getNegotiationsLinkedToSubAward(Map<String, String> negotiationValues, Map<String, String> associatedValues) { Map<String, String> values = transformMap(associatedValues, subAwardTransform); if (values != null && values.containsKey("title")) values.remove("title"); if (values == null) { return new ArrayList<Negotiation>(); } Criteria criteria = getCollectionCriteriaFromMap(new SubAward(), values); Criteria negotiationCrit = new Criteria(); ReportQueryByCriteria subQuery = QueryFactory.newReportQuery(SubAward.class, criteria); subQuery.setAttributes(new String[] {"subAwardId"}); negotiationCrit.addIn(ASSOCIATED_DOC_ID_ATTR, subQuery); negotiationCrit.addEqualTo(NEGOTIATION_TYPE_ATTR, getNegotiationService().getNegotiationAssociationType(NegotiationAssociationType.SUB_AWARD_ASSOCIATION).getId()); Collection<Negotiation> result = this.findCollectionBySearchHelper(Negotiation.class, negotiationValues, false, false, negotiationCrit); <START> <END> return result; }</code><technical_language>This is place filtering moved</technical_language>

Target:
protected Collection<Negotiation> getNegotiationsLinkedToSubAward(Map<String, String> negotiationValues, Map<String, String> associatedValues) { Map<String, String> values = transformMap(associatedValues, subAwardTransform); if (values != null && values.containsKey("title")) values.remove("title"); if (values == null) { return new ArrayList<Negotiation>(); } Criteria criteria = getCollectionCriteriaFromMap(new SubAward(), values); Criteria negotiationCrit = new Criteria(); ReportQueryByCriteria subQuery = QueryFactory.newReportQuery(SubAward.class, criteria); subQuery.setAttributes(new String[] {"subAwardId"}); negotiationCrit.addIn(ASSOCIATED_DOC_ID_ATTR, subQuery); negotiationCrit.addEqualTo(NEGOTIATION_TYPE_ATTR, getNegotiationService().getNegotiationAssociationType(NegotiationAssociationType.SUB_AWARD_ASSOCIATION).getId()); Collection<Negotiation> result = this.findCollectionBySearchHelper(Negotiation.class, negotiationValues, false, false, negotiationCrit); if (result != null && !result.isEmpty()) result = filterNegotitations(result,associatedValues.get("title"),associatedValues.get("leadUnitNumber"),associatedValues.get("leadUnitName"),associatedValues.get("subAwardRequisitionerId")); return result; }
Source:
<code>public List<Plugin> getUpdates() { Map<String,Plugin> pluginMap = new LinkedHashMap<>(); Map<String, List<Plugin>> incompatiblePluginMap = new LinkedHashMap<>(); for (UpdateSite site : sites) { for (Plugin plugin: site.getUpdates()) { final Plugin existing = pluginMap.get(plugin.name); if (existing == null) { pluginMap.put(plugin.name, plugin); if (!plugin.isNeededDependenciesCompatibleWithInstalledVersion()) { for (Plugin incompatiblePlugin : plugin.getDependenciesIncompatibleWithInstalledVersion()) { <START> if (!incompatiblePluginMap.containsKey(incompatiblePlugin.name)) { <END> List<Plugin> l = new ArrayList<>(); l.add(plugin); incompatiblePluginMap.put(incompatiblePlugin.name, l); } else { incompatiblePluginMap.get(incompatiblePlugin.name).add(plugin); } } } } else if (!existing.version.equals(plugin.version)) { final String altKey = plugin.name + ":" + plugin.version; if (!pluginMap.containsKey(altKey)) { pluginMap.put(altKey, plugin); } } } } for(String incompatiblePlugin : incompatiblePluginMap.keySet()) { if(pluginMap.containsKey(incompatiblePlugin)) { pluginMap.get(incompatiblePlugin).setIncompatibleParentPlugins(incompatiblePluginMap.get(incompatiblePlugin)); } } return new ArrayList<>(pluginMap.values()); }</code><technical_language>This simplified incompatiblePluginMap.computeIfAbsent</technical_language>

Target:
public List<Plugin> getUpdates() { Map<String,Plugin> pluginMap = new LinkedHashMap<>(); final Map<String, Set<Plugin>> incompatiblePluginMap = new LinkedHashMap<>(); final PluginManager.MetadataCache cache = new PluginManager.MetadataCache(); for (UpdateSite site : sites) { for (Plugin plugin: site.getUpdates()) { final Plugin existing = pluginMap.get(plugin.name); if (existing == null) { pluginMap.put(plugin.name, plugin); if (!plugin.isNeededDependenciesCompatibleWithInstalledVersion()) { for (Plugin incompatiblePlugin : plugin.getDependenciesIncompatibleWithInstalledVersion(cache)) { incompatiblePluginMap.computeIfAbsent(incompatiblePlugin.name, _ignored -> new HashSet<>()).add(plugin); } } } else if (!existing.version.equals(plugin.version)) { final String altKey = plugin.name + ":" + plugin.version; if (!pluginMap.containsKey(altKey)) { pluginMap.put(altKey, plugin); } } } } incompatiblePluginMap.forEach((key, incompatiblePlugins) -> pluginMap.computeIfPresent(key, (_ignored, plugin) -> { plugin.setIncompatibleParentPlugins(incompatiblePlugins); return plugin; })); return new ArrayList<>(pluginMap.values()); }
Source:
<code><START> public void resumeMigrations() { <END> logger.info("Resuming ongoing migrations ..."); TypedQuery<Migration> query = em.createNamedQuery("Migration.findByStatus", Migration.class); query.setParameter("statuses", PENDING_STATUSES); query.getResultList().stream().forEach(m -> { try { migrationService.migrate(m); } catch (InvalidMigrationException e) { logger.warn("Unable to resume migration with id: " + m.getId(), e); } }); }</code><technical_language>purpose of this? Is this resume migrations done (or service receive result) crashed? If is optimistic ... assume kie server finish while this service down. if want this automatic check if migration finished successfully first</technical_language>

Target:
public void resumeMigrations() { logger.info("Resuming ongoing migrations ..."); TypedQuery<Migration> query = em.createNamedQuery("Migration.findByStatus", Migration.class); query.setParameter("statuses", PENDING_STATUSES); query.getResultList().forEach(m -> { try { migrationService.migrate(m); } catch (InvalidMigrationException e) { logger.warn("Unable to resume migration with id: " + m.getId(), e); } }); }
Source:
<code>public static void close(Closeable c) { try { <START> if(c != null) { <END> c.close(); } } catch (Exception e) { } }</code><technical_language>closeQuietly again</technical_language>

Target:
public static void close(Closeable c) { IOUtils.closeQuietly(c); }
Source:
<code>private void tick(final Tick message) { _periodicMetrics.recordCounter("job_executor_actor_ticks", 1); if (!_cachedJob.isPresent()) { killSelf(); throw new IllegalStateException("somehow, uninitialized JobExecutorActor is trying to tick"); } final CachedJob<T> cachedJob = _cachedJob.get(); final Optional<Instant> nextRun = cachedJob.getSchedule().nextRun(cachedJob.getLastRun()); if (!nextRun.isPresent()) { LOGGER.info() .setMessage("job has no more scheduled runs") .addData("cachedJob", cachedJob) .log(); <START> killSelf(); <END> return; } if (_clock.instant().isBefore(nextRun.get().minus(EXECUTION_SLOP))) { scheduleTickFor(nextRun.get()); } else { attemptExecuteAndUpdateRepository(nextRun.get()); } }</code><technical_language>I this method de-register actor in future this explain difference contexts this actor resurrect sudden/unexpected suicides should. advocating (perhaps clearly) call method unhandled exception. Also, in a future revision please this method name clear; e.g. killAndDeregisterSelf</technical_language>

Target:
private void tick(final Tick message) throws ActorNotInitializedException { _periodicMetrics.recordCounter("job_executor_actor_ticks", 1); if (!_cachedJob.isPresent()) { throw new ActorNotInitializedException("somehow, uninitialized JobExecutorActor is trying to tick"); } final CachedJob<T> cachedJob = _cachedJob.get(); final Optional<Instant> nextRun = cachedJob.getSchedule().nextRun(cachedJob.getLastRun()); if (!nextRun.isPresent()) { LOGGER.info() .setMessage("job has no more scheduled runs") .addData("cachedJob", cachedJob) .log(); killSelf(); return; } if (_clock.instant().isBefore(nextRun.get().minus(EXECUTION_SLOP))) { scheduleTickFor(nextRun.get()); } else { try { attemptExecuteAndUpdateRepository(nextRun.get()); } catch (final NoSuchJobException error) { LOGGER.warn() .setMessage("attempted to start executing job, but job no longer exists in repository") .addData("ref", cachedJob.getRef()) .addData("scheduled", nextRun.get()) .log(); killSelf(); } } }
Source:
<code>public Map<String, List<EvaluatorParameters>> getWorkerMetrics() { synchronized (workerEvalParams) { <START> final Map<String, List<EvaluatorParameters>> currWorkerMetrics = new HashMap<>(workerEvalParams); <END> return currWorkerMetrics; } }</code><technical_language>List objects of values of map shared maps. getServerMetrics()</technical_language>

Target:
public Map<String, List<EvaluatorParameters>> getWorkerMetrics() { synchronized (workerEvalParams) { final Map<String, List<EvaluatorParameters>> currWorkerMetrics = new HashMap<>(); for (final Map.Entry<String, List<EvaluatorParameters>> entry : workerEvalParams.entrySet()) { currWorkerMetrics.put(entry.getKey(), new ArrayList<>(entry.getValue())); } return currWorkerMetrics; } }
Source:
<code>protected void handleCreateTarget() { final Map<String, String> commands = uiManager.getAddTargetCommands(); final Map<String, Image> images = uiManager.getTargetIcons(); if (!commands.isEmpty()) { <START> Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); <END> ListDialog ld = new ListDialog(shell); ld.setTitle("New Target"); ld.setMessage("Select target type to create"); ld.setContentProvider(new ArrayContentProvider()); ld.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return (String)element; } @Override public Image getImage(Object element) { return images.get(element); } }); ld.setInput(commands.keySet().toArray()); switch(ld.open()) { case Window.CANCEL: return; case Window.OK: String command = commands.get((String) (ld.getResult()[0])); Activator.runCommand(command); return; default: } } }</code><technical_language>get shell control of current element, i.e. getControl().getShell()</technical_language>

Target:
protected void handleCreateTarget() { final Map<String, String> commands = uiManager.getAddTargetCommands(); final Map<String, Image> images = uiManager.getTargetIcons(); if (!commands.isEmpty()) { ListDialog ld = new ListDialog(getShell()); ld.setTitle("New Launch Target"); ld.setMessage("Select target type to create"); ld.setContentProvider(new ArrayContentProvider()); ld.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return (String)element; } @Override public Image getImage(Object element) { return images.get(element); } }); ld.setInput(commands.keySet().toArray()); switch(ld.open()) { case Window.CANCEL: return; case Window.OK: String command = commands.get((String) (ld.getResult()[0])); Activator.runCommand(command); return; default: } } }
Source:
<code>public static IFile getVersionFile(IProject project) { <START> return ResourceManager <END> .getOneFolder(project, EResourceConstant.LIBRARIES) .getFile(PluginConstant.VERSION_FILE_PATH); }</code><technical_language>do need check project == null here</technical_language>

Target:
public static IFile getVersionFile(IProject project) { if (project == null) { project = ResourceManager.getRootProject(); } return ResourceManager .getOneFolder(project, EResourceConstant.LIBRARIES) .getFile(PluginConstant.VERSION_FILE_PATH); }
Source:
<code>private List<ChannelWithBlockCount> startSpilling(Queue<CircularElement<E>> cache) throws IOException, InterruptedException { final FileIOChannel.Enumerator enumerator = this.ioManager.createChannelEnumerator(); List<ChannelWithBlockCount> channelIDs = new ArrayList<>(); <START> CircularElement<E> element; <END> openSpillingBehaviour(); while (isRunning()) { element = cache.isEmpty() ? this.dispatcher.take(SortStage.SPILL) : cache.poll(); if (!isRunning()) { return Collections.emptyList(); } if (element == EOF_MARKER) { break; } FileIOChannel.ID channel = enumerator.next(); spillChannelManager.registerChannelToBeRemovedAtShutdown(channel); final BlockChannelWriter<MemorySegment> writer = this.ioManager.createBlockChannelWriter(channel); spillChannelManager.registerOpenChannelToBeRemovedAtShutdown(writer); final ChannelWriterOutputView output = new ChannelWriterOutputView(writer, this.writeMemory, this.memManager.getPageSize()); LOG.debug("Spilling buffer " + element.getId() + "."); spillingBehaviour.spillBuffer(element, output, largeRecordHandler); LOG.debug("Spilled buffer " + element.getId() + "."); output.close(); spillChannelManager.unregisterOpenChannelToBeRemovedAtShutdown(writer); if (output.getBytesWritten() > 0) { channelIDs.add(new ChannelWithBlockCount(channel, output.getBlockCount())); } element.getBuffer().reset(); this.dispatcher.send(SortStage.READ, element); } LOG.debug("Spilling done."); LOG.debug("Releasing sort-buffer memory."); disposeSortBuffers(false); return channelIDs; }</code><technical_language>This in while() loop final</technical_language>

Target:
private List<ChannelWithBlockCount> startSpilling(Queue<CircularElement<E>> cache) throws IOException, InterruptedException { final FileIOChannel.Enumerator enumerator = this.ioManager.createChannelEnumerator(); List<ChannelWithBlockCount> channelIDs = new ArrayList<>(); openSpillingBehaviour(); while (isRunning()) { final CircularElement<E> element = cache.isEmpty() ? this.dispatcher.take(SortStage.SPILL) : cache.poll(); if (!isRunning()) { return Collections.emptyList(); } if (element == EOF_MARKER) { break; } FileIOChannel.ID channel = enumerator.next(); spillChannelManager.registerChannelToBeRemovedAtShutdown(channel); final BlockChannelWriter<MemorySegment> writer = this.ioManager.createBlockChannelWriter(channel); spillChannelManager.registerOpenChannelToBeRemovedAtShutdown(writer); final ChannelWriterOutputView output = new ChannelWriterOutputView(writer, this.writeMemory, this.memManager.getPageSize()); LOG.debug("Spilling buffer " + element.getId() + "."); spillingBehaviour.spillBuffer(element, output, largeRecordHandler); LOG.debug("Spilled buffer " + element.getId() + "."); output.close(); spillChannelManager.unregisterOpenChannelToBeRemovedAtShutdown(writer); if (output.getBytesWritten() > 0) { channelIDs.add(new ChannelWithBlockCount(channel, output.getBlockCount())); } element.getBuffer().reset(); this.dispatcher.send(SortStage.READ, element); } LOG.debug("Spilling done."); LOG.debug("Releasing sort-buffer memory."); disposeSortBuffers(false); return channelIDs; }
Source:
<code>public void visitNode(Tree tree) { <START> statements = CheckUtils.getStatements(tree); <END> for (int i = 0; i < statements.size() - 1; i++) { StatementTree currentStatement = statements.get(i); if (currentStatement.is(Kind.IF_STATEMENT)) { checkStatement(getLastStatement((IfStatementTree)currentStatement), i, MESSAGE_IF); } else if (currentStatement.is(Kind.FOR_STATEMENT)) { checkStatement(((ForStatementTree) currentStatement).statements().get(0), i, MESSAGE_LOOP); } else if (currentStatement.is(Kind.FOREACH_STATEMENT)) { checkStatement(((ForEachStatementTree) currentStatement).statements().get(0), i, MESSAGE_LOOP); } else if (currentStatement.is(Kind.WHILE_STATEMENT)) { checkStatement(((WhileStatementTree) currentStatement).statements().get(0), i, MESSAGE_LOOP); } } }</code><technical_language>@vilchik-elena I prefer avoiding a field (statements) for that</technical_language>

Target:
public void visitNode(Tree tree) { List<StatementTree> statements = CheckUtils.getStatements(tree); for (int i = 0; i < statements.size() - 1; i++) { StatementTree currentStatement = statements.get(i); if (currentStatement.is(Kind.IF_STATEMENT)) { checkStatement(getLastStatement((IfStatementTree)currentStatement), i, statements); } else if (currentStatement.is(Kind.FOR_STATEMENT)) { checkStatement(((ForStatementTree) currentStatement).statements().get(0), i, statements); } else if (currentStatement.is(Kind.FOREACH_STATEMENT)) { checkStatement(((ForEachStatementTree) currentStatement).statements().get(0), i, statements); } else if (currentStatement.is(Kind.WHILE_STATEMENT)) { checkStatement(((WhileStatementTree) currentStatement).statements().get(0), i, statements); } } }
Source:
<code>public boolean isVmStatusQuotaCountable(VMStatus status) { if (nonCountableQutoaVmStatusesMap.size() == 0) { synchronized (nonCountableQutoaVmStatusesMap) { List<Integer> list = DbFacade.getInstance().getQuotaDao().getNonCountableQutoaVmStatuses(); for (int i = 0; i < list.size(); i++) { <START> nonCountableQutoaVmStatusesMap.put(list.get(i), null); <END> } } } return nonCountableQutoaVmStatusesMap.get(status.getValue()) == null; }</code><technical_language>do need a map? list of NonCountableQutoaVmStatuses is of size 5!!! if get size 10 is redundant. List.contains(Object)...</technical_language>

Target:
public boolean isVmStatusQuotaCountable(VMStatus status) { if (nonCountableQutoaVmStatusesList.size() == 0) { synchronized (nonCountableQutoaVmStatusesList) { nonCountableQutoaVmStatusesList.addAll(DbFacade.getInstance() .getQuotaDao() .getNonCountableQutoaVmStatuses()); } } return !nonCountableQutoaVmStatusesList.contains(status.getValue()); }
Source:
<code>public void isValidTransition_indicatesValidAndInvalidTransition() throws Exception { assertThat(PaymentGatewayStateTransitions.isValidTransition(CAPTURE_READY, CAPTURE_SUBMITTED), is(true)); <START> assertThat(PaymentGatewayStateTransitions.isValidTransition(CREATED, AUTHORISATION_READY), is(false)); <END> }</code><technical_language>simplified importing import static uk.gov.pay.connector.common.model.domain.PaymentGatewayStateTransitions.isValidTransition;</technical_language>

Target:
public void isValidTransition_indicatesValidAndInvalidTransition() { assertThat(isValidTransition(CAPTURE_READY, CAPTURE_SUBMITTED), is(true)); assertThat(isValidTransition(CREATED, AUTHORISATION_READY), is(false)); }
Source:
<code>private void copyContact(Person src, Person dst) { dst.setActive(src.isActive()); dst.setFavorite(src.isFavorite()); dst.setIgnored(src.isIgnored()); dst.setLastPrayed(src.getLastPrayed()); dst.setPrayed(src.isPrayed()); dst.setSource(src.getSource()); <START> RealmList<Note> notes = src.getNotes(); <END> for (Note n : notes) { RealmList<Person> peopleTagged = n.getPeopleTagged(); Iterator<Person> i = peopleTagged.iterator(); while (i.hasNext()) { Person p = i.next(); if (p.getId().equals(src.getId())) { i.remove(); } } peopleTagged.add(dst); n.setPeopleTagged(peopleTagged); } dst.setNotes(src.getNotes()); }</code><technical_language>separate this chunk out a helper function</technical_language>

Target:
private void copyContact(Person src, Person dst) { dst.setActive(src.isActive()); dst.setFavorite(src.isFavorite()); dst.setIgnored(src.isIgnored()); dst.setLastPrayed(src.getLastPrayed()); dst.setPrayed(src.isPrayed()); dst.setSource(src.getSource()); transferNotes(src, dst); }
Source:
<code><START> public void process(Node externs, Node root) { <END> FindImportsAndExports finder = new FindImportsAndExports(); NodeTraversal.traverseEs6(compiler, root, finder); Builder<Node> exports = ImmutableList.builder(); if (finder.isCommonJsModule()) { finder.reportModuleErrors(); finder.replaceUmdPatterns(); for (Node export : finder.getModuleExports()) { if (NodeUtil.getEnclosingScript(export) != null) { exports.add(export); } } for (Node export : finder.getExports()) { if (NodeUtil.getEnclosingScript(export) != null) { exports.add(export); } } finder.addGoogProvide(); compiler.reportCodeChange(); } NodeTraversal.traverseEs6(compiler, root, new RewriteModule(finder.isCommonJsModule(), exports.build())); }</code><technical_language>I a bit confused first, root node usual jsRoot (the parent of input files). add a Preconditions check root a SCRIPT node</technical_language>

Target:
public void process(Node externs, Node root) { Preconditions.checkState(root.isScript()); FindImportsAndExports finder = new FindImportsAndExports(); NodeTraversal.traverseEs6(compiler, root, finder); Builder<Node> exports = ImmutableList.builder(); if (finder.isCommonJsModule()) { finder.reportModuleErrors(); finder.replaceUmdPatterns(); for (Node export : finder.getModuleExports()) { if (NodeUtil.getEnclosingScript(export) != null) { exports.add(export); } } for (Node export : finder.getExports()) { if (NodeUtil.getEnclosingScript(export) != null) { exports.add(export); } } finder.addGoogProvide(); compiler.reportCodeChange(); } NodeTraversal.traverseEs6(compiler, root, new RewriteModule(finder.isCommonJsModule(), exports.build())); }
Source:
<code>public static void doMove(final List<MoveDescription> moves, final IMoveDelegate moveDel) { final GameData data = ProData.getData(); <START> for (int i = 0; i < moves.size(); i++) { <END> final Route r = moves.get(i).getRoute(); if (!moves.get(i).getUnitsToTransports().isEmpty()) { continue; } for (int j = i + 1; j < moves.size(); j++) { if (!moves.get(j).getUnitsToTransports().isEmpty()) { continue; } final Route r2 = moves.get(j).getRoute(); if (r.equals(r2)) { final var mergedUnits = new ArrayList<Unit>(); mergedUnits.addAll(moves.get(j).getUnits()); mergedUnits.addAll(moves.get(i).getUnits()); moves.set(i, new MoveDescription(mergedUnits, r)); moves.remove(i); i--; break; } } } for (final MoveDescription move : moves) { if (move.getRoute() == null || move.getRoute().getEnd() == null || move.getRoute().getStart() == null) { ProLogger.warn( data.getSequence().getRound() + "-" + data.getSequence().getStep().getName() + ": route not valid " + move.getRoute() + " units: " + move.getUnits()); continue; } final String result = moveDel.performMove(move); if (result != null) { ProLogger.warn( data.getSequence().getRound() + "-" + data.getSequence().getStep().getName() + ": could not move " + move.getUnits() + " over " + move.getRoute() + " because: " + result); } if (!ProData.isSimulation) { ProUtils.pause(); } } }</code><technical_language>Is this block checked automated test? safe is update here</technical_language>

Target:
public static void doMove(final List<MoveDescription> moves, final IMoveDelegate moveDel) { final GameData data = ProData.getData(); final boolean noTransportLoads = moves.stream().allMatch(move -> move.getUnitsToTransports().isEmpty()); if (noTransportLoads) { for (int i = 0; i < moves.size(); i++) { final Route r = moves.get(i).getRoute(); for (int j = i + 1; j < moves.size(); j++) { final Route r2 = moves.get(j).getRoute(); if (r.equals(r2)) { final var mergedUnits = new ArrayList<Unit>(); mergedUnits.addAll(moves.get(j).getUnits()); mergedUnits.addAll(moves.get(i).getUnits()); moves.set(j, new MoveDescription(mergedUnits, r)); moves.remove(i); i--; break; } } } } for (final MoveDescription move : moves) { if (move.getRoute().getEnd() == null || move.getRoute().getStart() == null) { ProLogger.warn( data.getSequence().getRound() + "-" + data.getSequence().getStep().getName() + ": route not valid " + move.getRoute() + " units: " + move.getUnits()); continue; } final String result = moveDel.performMove(move); if (result != null) { ProLogger.warn( data.getSequence().getRound() + "-" + data.getSequence().getStep().getName() + ": could not move " + move.getUnits() + " over " + move.getRoute() + " because: " + result); } if (!ProData.isSimulation) { ProUtils.pause(); } } }
Source:
<code>protected boolean isVmNotLocked() { return getVmId() != null && <START> validate(new VmValidator(getVm()).vmNotLocked()); <END> }</code><technical_language>getVmId() is checked, getVm() return null NPE</technical_language>

Target:
protected boolean isVmNotLocked() { return getVm() != null && validate(new VmValidator(getVm()).vmNotLocked()); }
Source:
<code>public String httpGet(String url) { String domain = getResources().getString(R.string.ais_domain); String result = ""; CookieStore cookieStore = new BasicCookieStore(); BasicHttpContext localContext = new BasicHttpContext(); localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); try { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); if(!authorizationCookie.equals("")) { String[] cookies = authorizationCookie.split(";"); for (int i = 0; i < cookies.length; i++) { String[] nvp = cookies[i].split("="); <START> BasicClientCookie c = new BasicClientCookie(nvp[0], nvp[1]); <END> c.setDomain(domain); cookieStore.addCookie(c); } } HttpResponse httpResponse = httpClient.execute(httpGet, localContext); result = EntityUtils.toString(httpResponse.getEntity()); } catch (Exception e) { Log.e(TAG, e.getLocalizedMessage()); } return result; }</code><technical_language>if cookie '=', ArrayOutOfBoundsException occur here</technical_language>

Target:
public String httpGet(String url) { String domain = getResources().getString(R.string.ais_domain); String result = ""; CookieStore cookieStore = new BasicCookieStore(); BasicHttpContext localContext = new BasicHttpContext(); localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); try { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); if(!authorizationCookie.equals("")) { String[] cookies = authorizationCookie.split(";"); for (int i = 0; i < cookies.length; i++) { String[] kvp = cookies[i].split("="); if(kvp.length != 2) { throw new Exception("Illegal cookie: missing key/value pair."); } BasicClientCookie c = new BasicClientCookie(kvp[0], kvp[1]); c.setDomain(domain); cookieStore.addCookie(c); } } HttpResponse httpResponse = httpClient.execute(httpGet, localContext); result = EntityUtils.toString(httpResponse.getEntity()); } catch (Exception e) { Log.e(TAG, e.getLocalizedMessage()); } return result; }
Source:
<code>public void start() throws SlickException { try { runSetup(); getDelta(); while (running()) gameLoop(); } catch (Exception e) { this.e = e; } try { close_sub(); } catch (Exception e) { if (this.e == null) this.e = e; } destroy(); if (e != null) { CrashReport report = new CrashReport(null, e); CrashInfo info = new CrashInfo("Game Engine Details"); info.addSectionSafe("State Info", new Callable<String>() { public String call() throws Exception { StateBasedGame sbg = (StateBasedGame)game; return sbg.getCurrentStateID() + " - " + sbg.getCurrentState().getClass().getSimpleName(); } }); info.addSection("OpenGL software mode", isSoftwareMode()); report.addCrashInfo(info); ErrorHandler.error(report, true); e = null; forceExit = true; } if (forceExit) { Opsu.close(); <START> System.exit(-1); <END> } }</code><technical_language>more conventional return 1 failure</technical_language>

Target:
public void start() throws SlickException { try { runSetup(); getDelta(); while (running()) gameLoop(); } catch (Exception e) { this.e = e; } try { close_sub(); } catch (Exception e) { if (this.e == null) this.e = e; } destroy(); if (e != null) { ErrorHandler.error(null, e, true); e = null; forceExit = true; } if (forceExit) { Opsu.close(); System.exit((e == null) ? 0 : 1); } }
Source:
<code>public void testIrisDataFetcher() throws Exception { MnistFetcher mnistFetcher = new MnistFetcher(); mnistFetcher.downloadAndUntar(); <START> <END> }</code><technical_language>Add assertion for files downloaded extracted successfully</technical_language>

Target:
public void testIrisDataFetcher() throws Exception { MnistFetcher mnistFetcher = new MnistFetcher(); File mnistDir = mnistFetcher.downloadAndUntar(); assert(mnistDir.isDirectory()); }
Source:
<code>public Builder cmd(final List<String> cmd) { <START> if (cmd != null && !cmd.isEmpty()) { <END> this.cmd = new ArrayList<String>(cmd); } return this; }</code><technical_language>same, set is coming in</technical_language>

Target:
public Builder cmd(final List<String> cmd) { this.cmd = cmd; return this; }
Source:
<code>private boolean isIsoVersionCompatible(String isoFile) { boolean retValue = true; VdsDynamic vdsDynamic = getVdsDynamicDAO().get(getVdsId()); try { RpmVersion vdsOsVersion = new RpmVersion(vdsDynamic.gethost_os(), "RHEV Hypervisor -", true); RpmVersion isoVersion = new RpmVersion(isoFile, Config.<String> GetValue(ConfigValues.OvirtIsoPrefix), true); if (isoVersion.getMajor() != vdsOsVersion.getMajor() && vdsOsVersion.getMajor() != -1 && isoVersion.getMajor() != -1) { retValue = false; } <START> } catch (RuntimeException e) { <END> log.errorFormat("Failed to parse iso version {0} or ovirt os version {1} with error {2}", vdsDynamic.gethost_os(), isoFile, ExceptionUtils.getMessage(e)); } return retValue; }</code><technical_language>get RunTimeException? if can, set retValue false here</technical_language>

Target:
private boolean isIsoVersionCompatible(String isoFile) { boolean retValue = true; VdsDynamic vdsDynamic = getVdsDynamicDAO().get(getVdsId()); try { RpmVersion vdsOsVersion = new RpmVersion(vdsDynamic.gethost_os(), "RHEV Hypervisor -", true); RpmVersion isoVersion = new RpmVersion(isoFile, Config.<String> GetValue(ConfigValues.OvirtIsoPrefix), true); if (isoVersion.getMajor() != vdsOsVersion.getMajor() && vdsOsVersion.getMajor() != -1 && isoVersion.getMajor() != -1) { retValue = false; } } catch (RuntimeException e) { log.warnFormat("Failed to parse iso version {0} or ovirt os version {1} with error {2}", isoFile, vdsDynamic.gethost_os(), ExceptionUtils.getMessage(e)); } return retValue; }
Source:
<code>public static Optional<TraceState> getTrace() { Deque<TraceState> stack = STATE.get(); <START> return (!stack.isEmpty()) ? Optional.of(stack.peek()) : Optional.<TraceState>absent(); <END> }</code><technical_language>avoid negation for readability</technical_language>

Target:
public static Optional<TraceState> getTrace() { Deque<TraceState> stack = STATE.get(); return stack.isEmpty() ? Optional.<TraceState>absent() : Optional.of(stack.peek()); }
Source:
<code>public void execute(@Observes InterceptorsExecuted event) { try { ControllerMethod method = event.getControllerMethod(); methodReady.fire(new MethodReady(method)); Method reflectionMethod = method .getMethod(); Object[] parameters = methodInfo.getParametersValues(); log.debug("Invoking {}", reflectionMethod); Object instance = event.getControllerInstance(); Object result = new Mirror().on(instance).invoke().method(reflectionMethod).withArgs(parameters); if (validator.hasErrors()) { if (log.isDebugEnabled()) { try { validator.onErrorUse(nothing()); } catch (ValidationException e) { log.debug("Some validation errors occured: {}", e.getErrors()); } } throw new InterceptionException( "There are validation errors and you forgot to specify where to go. Please add in your method " + "something like:\n" + "validator.onErrorUse(page()).of(AnyController.class).anyMethod();\n" + "or any view that you like.\n" + "If you didn't add any validation error, it is possible that a conversion error had happened."); } this.methodInfo.setResult(result); methodExecutedEvent.fire(new MethodExecuted(method, methodInfo)); } catch (IllegalArgumentException e) { throw new InterceptionException(e); } catch (ReflectionProviderException e) { throwIfNotValidationException(e, new ApplicationLogicException(e.getCause())); <START> } catch (Exception e) { <END> throwIfNotValidationException(e, new ApplicationLogicException(e)); } }</code><technical_language>Sounds great. change throwIfNotValidationException receive e.getCause instantiate a ApplicationLogicException in 122 line? <LINK_0> this catch subsequent catch logic</technical_language>

Target:
public void execute(@Observes InterceptorsExecuted event) { try { ControllerMethod method = event.getControllerMethod(); methodReady.fire(new MethodReady(method)); Method reflectionMethod = method .getMethod(); Object[] parameters = methodInfo.getParametersValues(); log.debug("Invoking {}", reflectionMethod); Object instance = event.getControllerInstance(); Object result = new Mirror().on(instance).invoke().method(reflectionMethod).withArgs(parameters); if (validator.hasErrors()) { if (log.isDebugEnabled()) { try { validator.onErrorUse(nothing()); } catch (ValidationException e) { log.debug("Some validation errors occured: {}", e.getErrors()); } } throw new InterceptionException( "There are validation errors and you forgot to specify where to go. Please add in your method " + "something like:\n" + "validator.onErrorUse(page()).of(AnyController.class).anyMethod();\n" + "or any view that you like.\n" + "If you didn't add any validation error, it is possible that a conversion error had happened."); } this.methodInfo.setResult(result); methodExecutedEvent.fire(new MethodExecuted(method, methodInfo)); } catch (IllegalArgumentException e) { throw new InterceptionException(e); } catch (ReflectionProviderException e) { throwIfNotValidationException(e, e.getCause()); } catch (Exception e) { throwIfNotValidationException(e, e); } }
Source:
<code>protected void addSkuToCart(Sku sku, OrderItemRequestDTO orderItemRequestDTO, Product product, CartOperationRequest request) throws InventoryUnavailableException{ if (!hasSkuOrIsNonDiscreteOI(sku, orderItemRequestDTO)) { handleIfNoSku(orderItemRequestDTO, product); } else if (sku == null) { handleIfNonDiscreteOI(orderItemRequestDTO); } else if (!sku.isActive()) { <START> throw new InventoryUnavailableException("Sku is not Active"); <END> } else { request.getItemRequest().setSkuId(sku.getId()); } }</code><technical_language>a Sku is inactive means for sale InventoryUnavailableException is for a Sku is active inventory this time. a subtle difference if change signature return IllegalArgumentException I create a new Exception. IMO a reason throwing IllegalArgumentException. other Exception in Broadleaf sense</technical_language>

Target:
protected void addSkuToCart(Sku sku, OrderItemRequestDTO orderItemRequestDTO, Product product, CartOperationRequest request) throws InventoryUnavailableException{ if (!hasSkuOrIsNonDiscreteOI(sku, orderItemRequestDTO)) { handleIfNoSku(orderItemRequestDTO, product); } else if (sku == null) { handleIfNonDiscreteOI(orderItemRequestDTO); } else if (!sku.isActive()) { throw new SkuNotActiveException("Sku is not Active"); } else { request.getItemRequest().setSkuId(sku.getId()); } }
Source:
<code>public static int CompareVariantContextToLocus(final SAMSequenceDictionary dictionary, final VariantContext variantContext, final Locus locus) { final int indexDiff = dictionary.getSequenceIndex(variantContext.getContig()) - locus.getSequenceIndex(); if (indexDiff != 0) { return indexDiff < 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE; } <START> if (locus.getPosition() < variantContext.getStart()) <END> return variantContext.getStart() - locus.getPosition(); if (locus.getPosition() > variantContext.getEnd()) return variantContext.getEnd() - locus.getPosition(); return 0; }</code><technical_language>add avoid future bugs</technical_language>

Target:
public static int CompareVariantContextToLocus(final SAMSequenceDictionary dictionary, final VariantContext variantContext, final Locus locus) { final int indexDiff = dictionary.getSequenceIndex(variantContext.getContig()) - locus.getSequenceIndex(); if (indexDiff != 0) { return indexDiff < 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE; } if (locus.getPosition() < variantContext.getStart()) { return variantContext.getStart() - locus.getPosition(); } if (locus.getPosition() > variantContext.getEnd()) { return variantContext.getEnd() - locus.getPosition(); } return 0; }
Source:
<code>private void fatalError(final int status, final String msg) { String err = Errors.getErrorMessage(status); <START> this.logger.error("Fatal Error: " + status + (err == null ? " " : err)); <END> if (msg != null) { this.logger.error(msg); } }</code><technical_language>Need parameterized logging instead of string concatenation. This a warning, error</technical_language>

Target:
private void fatalError(final int status, final String msg) { String err = Errors.getErrorMessage(status); this.logger.warn("ISY Fatal Error: {}", status, (err == null ? " " : err), (msg == null ? " " : msg) ); }
Source:
<code>public List<DocumentModel> getComments(CoreSession session, DocumentModel docModel) throws CommentSecurityException { if (session.exists(docModel.getRef()) && !session.hasPermission(docModel.getRef(), SecurityConstants.READ)) { throw new CommentSecurityException("The user " + session.getPrincipal().getName() + " does not have access to the comments of document " + docModel.getId()); <START> } <END> PageProviderService ppService = Framework.getService(PageProviderService.class); Map<String, Serializable> props = Collections.singletonMap(CORE_SESSION_PROPERTY, (Serializable) session); PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) ppService.getPageProvider( GET_COMMENTS_FOR_DOC_PAGEPROVIDER_NAME, singletonList(new SortInfo(COMMENT_CREATION_DATE, true)), null, null, props, docModel.getId()); return pageProvider.getCurrentPage(); }</code><technical_language>indeed, mistake</technical_language>

Target:
public List<DocumentModel> getComments(CoreSession session, DocumentModel docModel) throws CommentSecurityException { if (session.exists(docModel.getRef()) && !session.hasPermission(docModel.getRef(), SecurityConstants.READ)) { throw new CommentSecurityException("The user " + session.getPrincipal().getName() + " does not have access to the comments of document " + docModel.getId()); } PageProviderService ppService = Framework.getService(PageProviderService.class); return CoreInstance.doPrivileged(session, s -> { Map<String, Serializable> props = Collections.singletonMap(CORE_SESSION_PROPERTY, (Serializable) s); PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) ppService.getPageProvider( GET_COMMENTS_FOR_DOC_PAGEPROVIDER_NAME, singletonList(new SortInfo(COMMENT_CREATION_DATE, true)), null, null, props, docModel.getId()); return pageProvider.getCurrentPage(); }); }
Source:
<code>public static void main(String[] args) throws InterruptedException { Configuration configuration = new Configuration(args); Set<String> registers = configuration.getRegisters(); ScheduledExecutorService executorService = Executors.newScheduledThreadPool( <START> (int) registers.stream().filter(r -> configuration.cloudSearchEndPoint(r).isPresent() || configuration.elasticSearchEndPoint(r).isPresent()).count() + <END> 2 * registers.size() ); List<Indexer> indexers = registers.stream().map(r -> new Indexer(configuration, r)).collect(Collectors.toList()); addShutdownHook(executorService, indexers); indexers.stream().parallel().forEach(indexer -> indexer.start(executorService)); Thread.currentThread().join(); }</code><technical_language>is worth extracting this stream processing a separate method giving a meaningful name</technical_language>

Target:
public static void main(String[] args) throws InterruptedException { Configuration configuration = new Configuration(args); Set<String> registers = configuration.getRegisters(); ScheduledExecutorService executorService = Executors.newScheduledThreadPool(getCorePoolSize(configuration, registers)); List<Indexer> indexers = registers.stream().map(r -> new Indexer(configuration, r)).collect(Collectors.toList()); addShutdownHook(executorService, indexers); indexers.stream().parallel().forEach(indexer -> indexer.start(executorService)); Thread.currentThread().join(); }
Source:
<code>public Tokenizer create(String toTokenize) { if (toTokenize.isEmpty()) { throw new IllegalArgumentException("Unable to proceed; no sentence to tokenize"); } JapaneseTokenizer t = new JapaneseTokenizer(kuromoji, toTokenize, useBaseForm); <START> <END> if (preProcessor != null) { t.setTokenPreProcessor(preProcessor); } return t; }</code><technical_language>JapaneseTokenizer t -> Tokenizer t = new JapaneseTokenizer</technical_language>

Target:
public Tokenizer create(String toTokenize) { if (toTokenize.isEmpty()) { throw new IllegalArgumentException("Unable to proceed; no sentence to tokenize"); } Tokenizer t = new JapaneseTokenizer(kuromoji, toTokenize, useBaseForm); if (preProcessor != null) { t.setTokenPreProcessor(preProcessor); } return t; }
Source:
<code>private VillagerCareer init(EntityVillager.ITradeList[][] traids) { for(int i = 0; i<traids.length; i++) { ArrayList<ITradeList> tradesForLevel = new ArrayList<ITradeList>(); for(ITradeList trade: traids[i]) <START> { <END> tradesForLevel.add(trade); } levelTrades.put(i, tradesForLevel); } return this; }</code><technical_language>Protip, arraylist a constructor takes array, lists a addAll function</technical_language>

Target:
private VillagerCareer init(EntityVillager.ITradeList[][] traids) { for(int i = 0; i<traids.length; i++) { ArrayList<ITradeList> tradesForLevel = Lists.newArrayList(traids[i]); levelTrades.put(i, tradesForLevel); } return this; }
Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.log_list, menu); MenuItem shareItem = menu.findItem(R.id.menu_share); <START> shareItem.setTitle(mSyncthingLog ? R.string.log_android_title : R.string.log_syncthing_title); <END> ShareActionProvider actionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem); mShareIntent = new Intent(); mShareIntent.setAction(Intent.ACTION_SEND); mShareIntent.setType("text/plain"); mShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, mLog.getText()); actionProvider.setShareIntent(mShareIntent); return true; }</code><technical_language>need do setTitle() R.id.switch_logs</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.log_list, menu); MenuItem switchLog = menu.findItem(R.id.switch_logs); switchLog.setTitle(mSyncthingLog ? R.string.log_android_title : R.string.log_syncthing_title); MenuItem shareItem = menu.findItem(R.id.menu_share); ShareActionProvider actionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem); mShareIntent = new Intent(); mShareIntent.setAction(Intent.ACTION_SEND); mShareIntent.setType("text/plain"); mShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, mLog.getText()); actionProvider.setShareIntent(mShareIntent); return true; }
Source:
<code>public Builder setPrincipalDecoder(PrincipalDecoder principalDecoder) { <START> Assert.checkNotNullParam("roleMapper", roleMapper); <END> assertNotBuilt(); this.principalDecoder = principalDecoder; return this; }</code><technical_language>This "principalDecoder", I guess</technical_language>

Target:
public Builder setPrincipalDecoder(PrincipalDecoder principalDecoder) { Assert.checkNotNullParam("principalDecoder", principalDecoder); assertNotBuilt(); this.principalDecoder = principalDecoder; return this; }
Source:
<code>public Vector<T> prependAll(java.lang.Iterable<? extends T> elements) { <START> List<T> list = List.ofAll(elements); <END> final int newIndexShift = indexShift - list.length(); HashArrayMappedTrie<Integer, T> newTrie = trie; for (int i = 0; !list.isEmpty(); i++) { newTrie = newTrie.put(newIndexShift + i, list.head()); list = list.tail(); } return new Vector<>(newIndexShift, newTrie); }</code><technical_language>elements.iterator() (of type java.util.Iterator) instead of List.ofAll(). this save cycles memory</technical_language>

Target:
public Vector<T> prependAll(java.lang.Iterable<? extends T> elements) { List<T> list = List.ofAll(elements); final int newIndexShift = indexShift - list.length(); HashArrayMappedTrie<Integer, T> newTrie = trie; for (int i = newIndexShift; !list.isEmpty(); i++) { newTrie = newTrie.put(i, list.head()); list = list.tail(); } return new Vector<>(newIndexShift, newTrie); }
Source:
<code>public String getConfigurationUrl() { String httpPolicy = yarnConfiguration.get(TaskFactory.YARN_HTTP_POLICY); String address = StringUtils.EMPTY; if (httpPolicy != null && httpPolicy.equals(TaskFactory.YARN_HTTP_POLICY_HTTPS_ONLY)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_WEBAPP_HTTPS_ADDRESS); if (StringUtils.isEmpty(address)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_HOSTNAME) + ":8090"; } } else { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_WEBAPP_ADDRESS); if (StringUtils.isEmpty(address)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_HOSTNAME) + ":8088"; } } <START> return "http://" + address + "/yarnConfiguration"; <END> }</code><technical_language>adhere http policy? if is https</technical_language>

Target:
public String getConfigurationUrl() { String httpPolicy = yarnConfiguration.get(TaskFactory.YARN_HTTP_POLICY); String address = StringUtils.EMPTY; if (httpPolicy != null && httpPolicy.equals(TaskFactory.YARN_HTTP_POLICY_HTTPS_ONLY)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_WEBAPP_HTTPS_ADDRESS); if (StringUtils.isEmpty(address)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_HOSTNAME) + ":8090"; } return "https://" + address + "/yarnConfiguration"; } else { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_WEBAPP_ADDRESS); if (StringUtils.isEmpty(address)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_HOSTNAME) + ":8088"; } return "http://" + address + "/yarnConfiguration"; } }