auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void handleVmOnDown(VM cacheVm, VmDynamic vmDynamic) { VmExitStatus exitStatus = vmDynamic.getExitStatus(); if (cacheVm != null) { auditVmOnDownEvent(exitStatus, vmDynamic.getExitMessage(), vmDynamic.getId()); } if (exitStatus != VmExitStatus.Normal) { if (cacheVm != null) { if (vmsMonitoring.getResourceManager().isVmInAsyncRunningList(vmDynamic.getId())) { log.info("Running on vds during rerun failed vm: '{}'", vmDynamic.getRunOnVds()); rerun = true; } else if (cacheVm.isAutoStartup()) { autoVmToRun = true; } } else { ResourceManager.getInstance().removeAsyncRunningVm(vmDynamic.getId()); saveDynamic(vdsmVm.getVmDynamic()); } } else { vmsMonitoring.getResourceManager().removeAsyncRunningVm(vmDynamic.getId()); <START> } <END> }</code><technical_language>is a mess here.. honestly, deeper investigation able a convincing explanation for why, I treatment added in removeVmsFromCache in 'else' block (that 'stable' field confuses me, refactor this class..)</technical_language>

Target:
private void handleVmOnDown(VM cacheVm, VmDynamic vmDynamic) { VmExitStatus exitStatus = vmDynamic.getExitStatus(); if (cacheVm != null) { auditVmOnDownEvent(exitStatus, vmDynamic.getExitMessage(), vmDynamic.getId()); } if (exitStatus != VmExitStatus.Normal) { if (cacheVm != null) { if (vmsMonitoring.getResourceManager().isVmInAsyncRunningList(vmDynamic.getId())) { log.info("Running on vds during rerun failed vm: '{}'", vmDynamic.getRunOnVds()); rerun = true; } else if (cacheVm.isAutoStartup()) { autoVmToRun = true; } } else { ResourceManager.getInstance().removeAsyncRunningVm(vmDynamic.getId()); saveDynamic(vdsmVm.getVmDynamic()); } } else { vmsMonitoring.getResourceManager().removeAsyncRunningVm(vmDynamic.getId()); if (getVmManager().isColdReboot()) { setColdRebootFlag(); } } }
Source:
<code>private void doCreateTable(Exchange exchange, String tableName) throws KuduException { KuduClient connection = endpoint.getKuduClient(); LOG.debug("Creating table {}", tableName); <START> Schema schema = (Schema) exchange.getIn().getHeader("Schema"); <END> CreateTableOptions builder = (CreateTableOptions) exchange.getIn().getHeader("TableOptions"); connection.createTable(tableName, schema, builder); }</code><technical_language>expecting a header Schema, I find some information do set up, do expect user add it</technical_language>

Target:
private void doCreateTable(Exchange exchange, String tableName) throws KuduException { LOG.trace("Creating table {}", tableName); KuduClient connection = endpoint.getKuduClient(); Schema schema = (Schema) exchange.getIn().getHeader(KuduConstants.CAMEL_KUDU_SCHEMA); CreateTableOptions builder = (CreateTableOptions) exchange.getIn() .getHeader(KuduConstants.CAMEL_KUDU_TABLE_OPTIONS); connection.createTable(tableName, schema, builder); }
Source:
<code>public void refreshRoutingData(String namespace) { if (!_routingZkAddressMap.containsKey(namespace)) { LOG.error("Failed to refresh internally-cached routing data! Namespace not found: " + namespace); } try { _realmToShardingKeysMap.put(namespace, _routingDataReaderMap.get(namespace).getRoutingData()); } catch (InvalidRoutingDataException e) { LOG.error("Failed to get routing data for namespace: " + namespace + "!"); } <START> if (_routingDataMap != null) { END> } }</code><technical_language>If code is necessary, remove it</technical_language>

Target:
public void refreshRoutingData(String namespace) { if (_routingZkAddressMap == null || _routingDataMap == null || _realmToShardingKeysMap == null) { LOG.error("Construction is not completed! "); return; } if (!_routingZkAddressMap.containsKey(namespace)) { LOG.error("Failed to refresh internally-cached routing data! Namespace not found: {}", namespace); return; } try { Map<String, List<String>> rawRoutingData = _routingDataReaderMap.get(namespace).getRoutingData(); _realmToShardingKeysMap.put(namespace, rawRoutingData); MetadataStoreRoutingData routingData = new TrieRoutingData(rawRoutingData); _routingDataMap.put(namespace, routingData); } catch (InvalidRoutingDataException e) { LOG.error("Failed to refresh cached routing data for namespace {}", namespace, e); } }
Source:
<code>protected @Nullable String createToolTipText(Parameter param) { ISeries[] series = getChart().getSeriesSet().getSeries(); int seriesIndex = param.getSeriesIndex(); int dataIndex = param.getDataIndex(); if ((series != null) && (seriesIndex < series.length)) { ISeries serie = series[seriesIndex]; double[] xS = serie.getXSeries(); double[] yS = serie.getYSeries(); if ((xS != null) && (yS != null) && (dataIndex < xS.length) && (dataIndex < yS.length)) { StringBuffer buffer = new StringBuffer(); <START> buffer.append(checkNotNull(Messages.SegmentStoreScatterGraphViewer_xAxis) + '='); <END> buffer.append(new TmfTimestamp((long) xS[dataIndex] + getChartViewer().getTimeOffset(), ITmfTimestamp.NANOSECOND_SCALE).toString()); buffer.append('\n'); buffer.append(Messages.SegmentStoreScatterGraphViewer_yAxis + '='); buffer.append((long) yS[dataIndex]); return buffer.toString(); } } return null; }</code><technical_language>new append</technical_language>

Target:
protected @Nullable String createToolTipText(Parameter param) { ISeries[] series = getChart().getSeriesSet().getSeries(); int seriesIndex = param.getSeriesIndex(); int dataIndex = param.getDataIndex(); if ((series != null) && (seriesIndex < series.length)) { ISeries serie = series[seriesIndex]; double[] xS = serie.getXSeries(); double[] yS = serie.getYSeries(); if ((xS != null) && (yS != null) && (dataIndex < xS.length) && (dataIndex < yS.length)) { StringBuffer buffer = new StringBuffer(); buffer.append(checkNotNull(Messages.SegmentStoreScatterGraphViewer_xAxis)).append('='); buffer.append(new TmfTimestamp((long) xS[dataIndex] + getChartViewer().getTimeOffset(), ITmfTimestamp.NANOSECOND_SCALE).toString()); buffer.append('\n'); buffer.append(Messages.SegmentStoreScatterGraphViewer_yAxis).append('='); buffer.append((long) yS[dataIndex]); return buffer.toString(); } } return null; }
Source:
<code>public void testCompressionSkipForBinaryFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel(new PerMessageDeflateEncoder(9, 15, false, ALWAYS_SKIP)); EmbeddedChannel decoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE)); byte[] payload = new byte[300]; random.nextBytes(payload); WebSocketFrame binaryFrame = new BinaryWebSocketFrame(Unpooled.copiedBuffer(payload)); <START> encoderChannel.writeOutbound(binaryFrame.copy()); <END> WebSocketFrame outboundFrame = encoderChannel.readOutbound(); assertEquals(0, outboundFrame.rsv()); assertArrayEquals(payload, ByteBufUtil.getBytes(outboundFrame.content())); assertTrue(outboundFrame.release()); decoderChannel.writeInbound(binaryFrame); WebSocketFrame inboundFrame = decoderChannel.readInbound(); assertEquals(0, inboundFrame.rsv()); assertArrayEquals(payload, ByteBufUtil.getBytes(inboundFrame.content())); assertTrue(inboundFrame.release()); assertEquals(0, binaryFrame.refCnt()); }</code><technical_language>assert return</technical_language>

Target:
public void testCompressionSkipForBinaryFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel(new PerMessageDeflateEncoder(9, 15, false, ALWAYS_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); WebSocketFrame binaryFrame = new BinaryWebSocketFrame(Unpooled.wrappedBuffer(payload)); assertTrue(encoderChannel.writeOutbound(binaryFrame.copy())); WebSocketFrame outboundFrame = encoderChannel.readOutbound(); assertEquals(0, outboundFrame.rsv()); assertArrayEquals(payload, ByteBufUtil.getBytes(outboundFrame.content())); assertTrue(outboundFrame.release()); assertFalse(encoderChannel.finish()); }
Source:
<code>public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModelCore model) throws CoreException { TextEditGroup group= createTextEditGroup(FixMessages.TypeParametersFix_insert_inferred_type_arguments_description, cuRewrite); ASTRewrite rewrite= cuRewrite.getASTRewrite(); ImportRewrite importRewrite= cuRewrite.getImportRewrite(); AST ast= cuRewrite.getRoot().getAST(); for (int i= 0; i < <START> fCreatedTypes.length; <END> i++) { ParameterizedType createdType= fCreatedTypes[i]; ITypeBinding[] typeArguments= createdType.resolveBinding().getTypeArguments(); ContextSensitiveImportRewriteContext importContext= new ContextSensitiveImportRewriteContext(cuRewrite.getRoot(), createdType.getStartPosition(), importRewrite); ListRewrite argumentsRewrite= rewrite.getListRewrite(createdType, ParameterizedType.TYPE_ARGUMENTS_PROPERTY); for (int j= 0; j < typeArguments.length; j++) { ITypeBinding typeArgument= typeArguments[j]; Type argumentNode= importRewrite.addImport(typeArgument, ast, importContext, TypeLocation.TYPE_ARGUMENT); argumentsRewrite.insertLast(argumentNode, group); } } }</code><technical_language>stay java 1.4 ideoms java 1.5 for loop instead, imho</technical_language>

Target:
public void rewriteAST(CompilationUnitRewrite cuRewrite, LinkedProposalModelCore model) throws CoreException { TextEditGroup group= createTextEditGroup(FixMessages.TypeParametersFix_insert_inferred_type_arguments_description, cuRewrite); ASTRewrite rewrite= cuRewrite.getASTRewrite(); ImportRewrite importRewrite= cuRewrite.getImportRewrite(); AST ast= cuRewrite.getRoot().getAST(); for (ParameterizedType createdType : fCreatedTypes) { ITypeBinding[] typeArguments= createdType.resolveBinding().getTypeArguments(); ContextSensitiveImportRewriteContext importContext= new ContextSensitiveImportRewriteContext(cuRewrite.getRoot(), createdType.getStartPosition(), importRewrite); ListRewrite argumentsRewrite= rewrite.getListRewrite(createdType, ParameterizedType.TYPE_ARGUMENTS_PROPERTY); for (ITypeBinding typeArgument : typeArguments) { Type argumentNode= importRewrite.addImport(typeArgument, ast, importContext, TypeLocation.TYPE_ARGUMENT); argumentsRewrite.insertLast(argumentNode, group); } } }
Source:
<code>public static ResponseDefinitionBuilder unauthorizedJson(String body) { <START> return aResponse().withStatus(401).withHeader(CONTENT_TYPE, "application/json").withBody(body); <END> }</code><technical_language>This useful for other HttpStatus' too. extract withHeader().withBody() out another method allow for fluent composition other error codes? For example unauthorized().withJsonBody() / badRequest().withJsonBody()</technical_language>

Target:
public static ResponseDefinitionBuilder unauthorizedJson(String body) { return aResponse().withStatus(401).withJsonBody(body); }
Source:
<code>public static <K, V> Map<V, K> invertMap(final Map<K, V> map) { <START> Objects.requireNonNull(map, "The map must not be null"); <END> final Map<V, K> out = new HashMap<>(map.size()); for (final Entry<K, V> entry : map.entrySet()) { out.put(entry.getValue(), entry.getKey()); } return out; }</code><technical_language>Please simply argument name "map" faulty argument name is</technical_language>

Target:
public static <K, V> Map<V, K> invertMap(final Map<K, V> map) { Objects.requireNonNull(map, "The map to invert must not be null."); final Map<V, K> out = new HashMap<>(map.size()); for (final Entry<K, V> entry : map.entrySet()) { out.put(entry.getValue(), entry.getKey()); } return out; }
Source:
<code>public boolean checkAndSetDefaultVersion(String newDefaultVersion) { <START> if (newDefaultVersion == null) { <END> return true; } for (Version version : this.getVersions()) { if (Objects.equals(newDefaultVersion, version.getName())) { this.setDefaultVersion(newDefaultVersion); return true; } } return false; }</code><technical_language>If newDefaultVersion is null, do want return true</technical_language>

Target:
public boolean checkAndSetDefaultVersion(String newDefaultVersion) { for (Version version : this.getVersions()) { if (Objects.equals(newDefaultVersion, version.getName())) { this.setDefaultVersion(newDefaultVersion); return true; } } return false; }
Source:
<code><START> public void testEmpty() throws IOException { <END> MatcherAssert.assertThat( new PsAll(new ArrayList<Pass>(0), 0).enter(new RqFake()).has(), Matchers.is(false) ); }</code><technical_language>@lautarobock declare throws Exception, [recommendations here](<LINK_0></technical_language>

Target:
public void testEmpty() throws Exception { MatcherAssert.assertThat( new PsAll(new ArrayList<Pass>(0), 0).enter(new RqFake()).has(), Matchers.is(false) ); }
Source:
<code>private void makeActions() { boolean hideAvailableCustomizationsDialog = viewerDescriptor .getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_AVAILABLE_CUSTOMIZATIONS_DIALOG); if (!hideAvailableCustomizationsDialog) { selectFiltersAction = new SelectFiltersAction(commonViewer, this); ImageDescriptor selectFiltersIcon = NavigatorPlugin.getImageDescriptor("icons/full/elcl16/filter_ps.gif"); selectFiltersAction.setImageDescriptor(selectFiltersIcon); selectFiltersAction.setHoverImageDescriptor(selectFiltersIcon); filtersMenu = new MenuManager(CommonNavigatorMessages.FilterActionGroup_Filters); menuListener = new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { <START> filtersMenu.removeAll(); <END> addLRUFilterActions(filtersMenu); } }; } }</code><technical_language>Do opportunity avoid removeAll create menus for new entries/remove entries? instead of a queue of ICommonFilterDescriptor, directory store manipulate a queue of related ToggleFilterAction</technical_language>

Target:
private void makeActions() { boolean hideAvailableCustomizationsDialog = viewerDescriptor .getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_AVAILABLE_CUSTOMIZATIONS_DIALOG); if (!hideAvailableCustomizationsDialog) { selectFiltersAction = new SelectFiltersAction(commonViewer, this); ImageDescriptor selectFiltersIcon = NavigatorPlugin.getImageDescriptor("icons/full/elcl16/filter_ps.png"); selectFiltersAction.setImageDescriptor(selectFiltersIcon); selectFiltersAction.setHoverImageDescriptor(selectFiltersIcon); filtersMenu = new MenuManager(CommonNavigatorMessages.FilterActionGroup_Filters); menuListener = new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { filtersMenu.removeAll(); addLRUFilterActions(filtersMenu); } }; } }
Source:
<code>static Socket connectToWatchdogWithTimeout(final String host, final int port, final long timeout, final TimeUnit timeUnit, final SoloWatchdogConnector connector) { final Socket socket; try { socket = Polling.awaitUnchecked(timeout, timeUnit, new Callable<Socket>() { @Override public Socket call() throws Exception { final Socket socket = new Socket(); try { connector.connect(socket, host, port); return socket; } catch (IOException e) { return null; } } }); } catch (TimeoutException e) { throw Throwables.propagate(e); } <START> log.info("Connecting to helios-solo watchdog at {}:{}", host, port); <END> return socket; }</code><technical_language>if connection is this point, log line "_Connected_ helios-solo watchdog ..."</technical_language>

Target:
static Socket connectToWatchdogWithTimeout(final String host, final int port, final long timeout, final TimeUnit timeUnit, final SoloWatchdogConnector connector) { final Socket socket; log.info("Connecting to helios-solo watchdog at {}:{}", host, port); try { socket = Polling.awaitUnchecked(timeout, timeUnit, new Callable<Socket>() { @Override public Socket call() throws Exception { final Socket socket = new Socket(); try { connector.connect(socket, host, port); return socket; } catch (IOException e) { log.debug("Failed to connect to helios-solo watchdog"); return null; } } }); } catch (TimeoutException e) { throw Throwables.propagate(e); } return socket; }
Source:
<code>private void getMRelations(Entity entity, MClassWrapper graph) { Collection<MRelationEntry> relationAttrs = registry.getRelations( entity.getClass()); for (MRelationEntry relEntry : relationAttrs) { for(Entity other : relEntry.getConnectedEntities(entity)) { <START> if (!other.getIsEndPoint()) { <END> getAllMClasses(other, graph); } } graph.addRelation(relEntry.buildRelation(entity, config.getNamespace())); } }</code><technical_language>I thought do this</technical_language>

Target:
private void getMRelations(Entity entity, MClassWrapper graph) { Collection<MRelationEntry> relationAttrs = registry.getRelations( entity.getClass()); for (MRelationEntry relEntry : relationAttrs) { for(Entity other : relEntry.getConnectedEntities(entity)) { if (!(other instanceof EndPointProxy)) { getAllMClasses(other, graph); } } graph.addRelation(relEntry.buildRelation(entity, config.getNamespace())); } }
Source:
<code>private List<String> fetchPathwaysFromFile (String experimentAccession, Contrast comparison) { Map<String, Double> result = new HashMap<>(); List<String[]> lines = dataFileHub.getReactomePathwaysCFiles(experimentAccession, comparison.getId()).reactomePathways.get().readAll(); <START> for(int i = 1; i < lines.size(); i++) { <END> String[] strings = lines.get(i); String pathway = strings[0]; Double pvalue = Double.valueOf(strings[4]); if (pvalue < 0.05) { result.put(pathway, pvalue); } } Map<String, Double> ordered = result.entrySet() .stream() .sorted(Map.Entry.comparingByValue()) .limit(10) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); return new ArrayList<>(ordered.keySet()); }</code><technical_language>not: for (String line: lines.subList(1, lines.size() -1)) { ... }</technical_language>

Target:
private List<String> fetchPathwaysFromFile (String experimentAccession, Contrast comparison) { Map<String, Double> result = new HashMap<>(); List<String[]> lines = dataFileHub.getReactomePathwaysFiles(experimentAccession, comparison.getId()).get().readAll(); for(int i = 1; i < lines.size(); i++) { String[] strings = lines.get(i); String pathway = strings[0]; Double pvalue = Double.valueOf(strings[4]); if (pvalue < 0.05) { result.put(pathway, pvalue); } } return result.entrySet() .stream() .sorted(Map.Entry.comparingByValue()) .limit(10) .map(Map.Entry::getKey) .collect(Collectors.toList()); }
Source:
<code>public void onActivityCreated(Bundle savedInstanceState) { <START> ThemeBrowserActivity themeBrowserActivity = (ThemeBrowserActivity) getActivity(); <END> super.onActivityCreated(savedInstanceState); if (this instanceof ThemeSearchFragment) { (themeBrowserActivity).setThemeSearchFragment((ThemeSearchFragment) this); } else { (themeBrowserActivity).setThemeBrowserFragment(this); } Cursor cursor = fetchThemes(getSpinnerPosition()); if (cursor == null) { return; } mAdapter = new ThemeBrowserAdapter(themeBrowserActivity, cursor, false, mCallback); setEmptyViewVisible(mAdapter.getCount() == 0); mGridView.setAdapter(mAdapter); restoreState(savedInstanceState); }</code><technical_language>a ton of calls (and casts) getActivity(). save a reference onAttach cast once</technical_language>

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (this instanceof ThemeSearchFragment) { mThemeBrowserActivity.setThemeSearchFragment((ThemeSearchFragment) this); } else { mThemeBrowserActivity.setThemeBrowserFragment(this); } Cursor cursor = fetchThemes(getSpinnerPosition()); if (cursor == null) { return; } mAdapter = new ThemeBrowserAdapter(mThemeBrowserActivity, cursor, false, mCallback); setEmptyViewVisible(mAdapter.getCount() == 0); mGridView.setAdapter(mAdapter); restoreState(savedInstanceState); }
Source:
<code>private TradeInfo calculateSettlementDate(ReferenceData refData) { if (info.getSettlementDate().isPresent()) { return info; } if (info.getTradeDate().isPresent()) { LocalDate tradeDate = info.getTradeDate().get(); LocalDate settlementDate = product.getSettlementDateOffset().adjust(tradeDate, refData); return info.toBuilder().settlementDate(settlementDate).build(); } <START> throw new IllegalStateException("FixedCouponBondTrade.resolve() requires either trade date or settlement date"); <END> }</code><technical_language>Wrong class name in error message</technical_language>

Target:
private TradeInfo calculateSettlementDate(ReferenceData refData) { if (info.getSettlementDate().isPresent()) { return info; } if (info.getTradeDate().isPresent()) { LocalDate tradeDate = info.getTradeDate().get(); LocalDate settlementDate = product.getSettlementDateOffset().adjust(tradeDate, refData); return info.toBuilder().settlementDate(settlementDate).build(); } throw new IllegalStateException("CapitalIndexedBondTrade.resolve() requires either trade date or settlement date"); }
Source:
<code>public void createClientMessageTracker(String name, boolean fromActive) { <START> this.messageTrackers.put(name, new DefaultClientMessageTracker(fromActive)); <END> }</code><technical_language>if active, choose create this object</technical_language>

Target:
public void createClientMessageTracker(String name, boolean fromActive) { if (!fromActive) { this.messageTrackers.put(name, new DefaultClientMessageTracker()); } }
Source:
<code>protected void onResume() { if (PhoneFactory.getDefaultPhone().getPhoneType() != Phone.PHONE_TYPE_CDMA) { mButtonCdmaRoam.setEnabled(false); mButtonCdmaSubscription.setEnabled(false); } else { mButtonCdmaRoam.setEnabled(true); <START> mButtonCdmaSubscription.setEnabled(true); <END> } super.onResume(); }</code><technical_language>This needs conditional. This enabled devices NV RUIM. system default type</technical_language>

Target:
protected void onResume() { if (PhoneFactory.getDefaultPhone().getPhoneType() != Phone.PHONE_TYPE_CDMA) { mButtonCdmaRoam.setEnabled(false); mButtonCdmaSubscription.setEnabled(false); } else { mButtonCdmaRoam.setEnabled(true); if(deviceSupportsNvAndRuim()) { mButtonCdmaSubscription.setEnabled(true); } else { mButtonCdmaSubscription.setEnabled(false); } } super.onResume(); }
Source:
<code>public void start() throws Exception { logger.info("Starting Gerrit-Trigger Plugin"); doXStreamRegistrations(); logger.trace("Loading configs"); load(); <START> if (servers == null) { <END> servers = new ArrayList<GerritServer>(); if (config != null) { GerritServer defaultServer = new GerritServer(DEFAULT_SERVER_NAME); defaultServer.setConfig(config); servers.add(defaultServer); } } for (GerritServer s : servers) { s.start(); } }</code><technical_language>a tiiny bit safer/nicer if put config -> servers conversion load method</technical_language>

Target:
public void start() throws Exception { logger.info("Starting Gerrit-Trigger Plugin"); doXStreamRegistrations(); logger.trace("Loading configs"); load(); for (GerritServer s : servers) { s.start(); } }
Source:
<code>public void handle(EquivalenceResult<T> result) { try { <START> sender.sendMessage(messageFrom(result));; <END> } catch (Exception e) { log.error("Failed to send equiv update message: " + result.subject(), e); } }</code><technical_language>double semi-colon</technical_language>

Target:
public void handle(EquivalenceResult<T> result) { try { sender.sendMessage(messageFrom(result)); } catch (Exception e) { log.error("Failed to send equiv update message: " + result.subject(), e); } }
Source:
<code><START> private void extractCigarFromCGAttribute(final Cigar sentinelCigar) { <END> int[] cigarFromCG = (int[]) getAttribute(CG.name()); if (cigarFromCG == null) return; final ByteBuffer byteBuffer = ByteBuffer.allocate(cigarFromCG.length * CIGAR_SIZE_MULTIPLIER) .order(ByteOrder.LITTLE_ENDIAN); byteBuffer.asIntBuffer().put(cigarFromCG); final Cigar decodedCigar = BinaryCigarCodec.decode(byteBuffer); if (decodedCigar.getCigarElements().size() <= MAX_CIGAR_OPERATORS) { throw new IllegalStateException(String.format( "Only Cigar with > 65535 operators should be placed in CG tag. Found %d operators.", decodedCigar.getCigarElements().size())); } if (decodedCigar.getReferenceLength() != sentinelCigar.getReferenceLength()) { throw new IllegalStateException(String.format( "Sentinel cigar and CG cigar should have the same reference length. Found %d and %d.", sentinelCigar.getReferenceLength(), decodedCigar.getReferenceLength())); } if (decodedCigar.getReadLength() != sentinelCigar.getReadLength()) { throw new IllegalStateException(String.format( "Sentinel cigar and CG cigar should have the same read length. Found %d and %d.", sentinelCigar.getReadLength(), decodedCigar.getReadLength())); } setCigar(decodedCigar); setAttribute(CG.name(), null); }</code><technical_language>change condition to: java return cigar.getCigarElement(0).getOperator() == CigarOperator.S && (cigar.getCigarElement(0).getLength() == readLength || readLength == 0) && cigar.getCigarElement(1).getOperator() == CigarOperator.N;</technical_language>

Target:
private void extractCigarFromCGAttribute(final Cigar sentinelCigar) throws IllegalStateException { final int[] cigarFromCG = (int[]) getAttribute(SAMTagUtil.getSingleton().CG); if (cigarFromCG == null) return; final ByteBuffer byteBuffer = ByteBuffer.allocate(cigarFromCG.length * CIGAR_SIZE_MULTIPLIER) .order(ByteOrder.LITTLE_ENDIAN); byteBuffer.asIntBuffer().put(cigarFromCG); final Cigar decodedCigar = BinaryCigarCodec.decode(byteBuffer); if (decodedCigar.numCigarElements() <= MAX_CIGAR_OPERATORS) { throw new IllegalStateException(String.format( "Only Cigar with > %d operators should be placed in CG tag. Found %d operators. \n Here's the Cigar:\n%s", MAX_CIGAR_OPERATORS, decodedCigar.getCigarElements().size(), decodedCigar.toString())); } if (decodedCigar.getReferenceLength() != sentinelCigar.getReferenceLength()) { throw new IllegalStateException(String.format( "Sentinel cigar and %s cigar should have the same reference length. Found %d and %d.\n Here's the Cigar:\n%s", CG.name(), sentinelCigar.getReferenceLength(), decodedCigar.getReferenceLength(), decodedCigar.toString())); } if (decodedCigar.getReadLength() != sentinelCigar.getReadLength() ) { throw new IllegalStateException(String.format( "Sentinel cigar and %s cigar should have the same read length. Found %d and %d.\n Here's the Cigar:\n%s", CG.name(), sentinelCigar.getReadLength(), decodedCigar.getReadLength(), decodedCigar.toString())); } initializeCigar(decodedCigar); setAttribute(SAMTagUtil.getSingleton().CG, null); }
Source:
<code><START> private static Map<String, String> getSuperCategoryMap() { <END> if (groupToSuperCategory == null) { groupToSuperCategory = new HashMap<>(); groupToSuperCategory.put(DOC_CAT_FASTA, DOC_SUPERCAT_TOOLS); groupToSuperCategory.put(DOC_CAT_READS, DOC_SUPERCAT_TOOLS); groupToSuperCategory.put(DOC_CAT_VARIANT, DOC_SUPERCAT_TOOLS); groupToSuperCategory.put(DOC_CAT_TEST, DOC_SUPERCAT_EXCLUDE); } return groupToSuperCategory; }</code><technical_language>nice this method supercategory values accessible reuse this map. For example, if I create a new program group for a tool I add tools supercategory reuse this class include others copying code in this method re-define supercat constants.... I this in GATK re-use super-categories read groups..</technical_language>

Target:
public static Map<String, String> getSuperCategoryMap() { if (groupToSuperCategory == null) { groupToSuperCategory = new HashMap<>(); groupToSuperCategory.put(DOC_CAT_FASTA, DOC_SUPERCAT_TOOLS); groupToSuperCategory.put(DOC_CAT_READS, DOC_SUPERCAT_TOOLS); groupToSuperCategory.put(DOC_CAT_VARIANT, DOC_SUPERCAT_TOOLS); groupToSuperCategory.put(DOC_CAT_TEST, DOC_SUPERCAT_EXCLUDE); } return groupToSuperCategory; }
Source:
<code>public void onLoadFinished(Loader<Cursor> loader,Cursor cursor) { if(eventListAdapter!=null && cursor!=null) eventListAdapter.swapCursor(cursor); else <START> Log.v(TAG, "OnLoadFinished: mAdapter is null"); <END> }</code><technical_language>Please braces code blocks in this case needed. Also, variable is mAdapter eventListAdapter</technical_language>

Target:
public void onLoadFinished(Loader<Cursor> loader,Cursor cursor) { if(eventListAdapter!=null && cursor!=null) { eventListAdapter.swapCursor(cursor); } else { Log.v(TAG, "OnLoadFinished: eventListAdapter is null"); } }
Source:
<code>public String toString() { String resourceId = myPayloadId; if (resourceId == null) { resourceId = myId; } <START> return "ResourceModified Message { " + myOperationType + ", " + resourceId + "}"; <END> }</code><technical_language>FWIW, typically do ToStringBuilder. Intellij do work for if want. [Here's a random example](<LINK_0></technical_language>

Target:
public String toString() { return new ToStringBuilder(this) .append("myId", myId) .append("myOperationType", myOperationType) .append("mySubscriptionId", mySubscriptionId) .append("myPayloadId", myPayloadId) .toString(); }
Source:
<code>private String variableName(Node node, int level) { String label = node.label(); <START> char name = (label != null) ? label.charAt(0) : 'x'; <END> return "" + Character.toLowerCase(name) + level; }</code><technical_language>if multiple related nodes level? get variable name (e.g. x1 level)? Thinking happen labels start letter (e.g. Person, Place ...) - create separate issue</technical_language>

Target:
private String variableName(Node node, int level) { String label = node.label().orElse("x"); char name = label.charAt(0); return "" + Character.toLowerCase(name) + level; }
Source:
<code>private void setupTabs() { tabsList.clear(); tabsList.addAll(tabsManager.getTabs()); boolean wasAdapterNull = pagerAdapter == null; if (pagerAdapter == null || !pagerAdapter.sameTabs(tabsList)) { pagerAdapter = new SelectedTabsPagerAdapter(requireContext(), getChildFragmentManager(), tabsList); } <START> viewPager.setAdapter(pagerAdapter); <END> if (!wasAdapterNull) { viewPager.setOffscreenPageLimit(tabsList.size()); } updateTabsIconAndDescription(); updateTitleForTab(viewPager.getCurrentItem()); hasTabsChanged = false; }</code><technical_language>this put if (!wasAdapterNull), too</technical_language>

Target:
private void setupTabs() { tabsList.clear(); tabsList.addAll(tabsManager.getTabs()); if (pagerAdapter == null || !pagerAdapter.sameTabs(tabsList)) { pagerAdapter = new SelectedTabsPagerAdapter(requireContext(), getChildFragmentManager(), tabsList); } viewPager.setAdapter(null); viewPager.setOffscreenPageLimit(tabsList.size()); viewPager.setAdapter(pagerAdapter); updateTabsIconAndDescription(); updateTitleForTab(viewPager.getCurrentItem()); hasTabsChanged = false; }
Source:
<code>public boolean isValid(Object[] array, ConstraintValidatorContext constraintValidatorContext) { if ( array == null ) { return false; } <START> return Array.getLength( array ) > 0; <END> }</code><technical_language>Interesting, rationale for array.length</technical_language>

Target:
public boolean isValid(Object[] array, ConstraintValidatorContext constraintValidatorContext) { if ( array == null ) { return false; } return array.length > 0; }
Source:
<code><START> public void testSingletonMap(){ <END> IgniteCache<Integer, Map<TestObject,TestObject>> c = jcache(0); TestObject obj = new TestObject(123); c.put(0, Collections.singletonMap(obj,obj)); checkSingleElement(c.get(0).entrySet(), entry -> { assertEquals(123, entry.getKey().val); assertEquals(123, entry.getValue().val); }); IgniteCache<Integer, Map<BinaryObject,BinaryObject>> kpc = keepBinaryCache(); Map<?,?> cBinary = kpc.get(0); assertEquals(Collections.singletonMap(null,null).getClass(), cBinary.getClass()); checkSingleElement(cBinary.entrySet(), entry -> { assertTrue(entry.getKey() instanceof BinaryObject); assertTrue(entry.getValue() instanceof BinaryObject); assertEquals(Integer.valueOf(123), ((BinaryObject)entry.getKey()).field("val")); assertEquals(Integer.valueOf(123), ((BinaryObject)entry.getValue()).field("val")); }); }</code><technical_language>space decl</technical_language>

Target:
public void testSingletonMap() { IgniteCache<Integer, Map<TestObject, TestObject>> c = jcache(0); TestObject obj = new TestObject(123); c.put(0, Collections.singletonMap(obj, obj)); c.put(1, Collections.singletonMap(null, null)); assertEquals(1, c.get(0).size()); Map.Entry<TestObject, TestObject> entry = c.get(0).entrySet().iterator().next(); assertEquals(123, entry.getKey().val); assertEquals(123, entry.getValue().val); IgniteCache<Integer, Map<BinaryObject, BinaryObject>> kpc = keepBinaryCache(); Map<?, ?> cBinary = kpc.get(0); assertEquals(Collections.singletonMap(null, null).getClass(), cBinary.getClass()); Map.Entry<?, ?> binaryEntry = kpc.get(0).entrySet().iterator().next(); assertTrue(binaryEntry.getKey() instanceof BinaryObject); assertTrue(binaryEntry.getValue() instanceof BinaryObject); assertEquals(Integer.valueOf(123), ((BinaryObject)binaryEntry.getKey()).field("val")); assertEquals(Integer.valueOf(123), ((BinaryObject)binaryEntry.getValue()).field("val")); Map.Entry<?, ?> nullEntry = kpc.get(1).entrySet().iterator().next(); assertNull(nullEntry.getKey()); assertNull(nullEntry.getValue()); }
Source:
<code>public Response getVendor(@PathParam(PurapPropertyConstants.VENDOR_NUMBER) String vendorNumber, @Context HttpHeaders headers) { try { HashMap<String, String> vendorCombinedPk = parseVendorNumber(vendorNumber); VendorDetail vendorDetail = getLookupDao().findObjectByMap(VendorDetail.class.newInstance(), vendorCombinedPk); if (ObjectUtils.isNull(vendorDetail)) { return respondNotFound(); } String responseBody = gson.toJson(getVendorProperties(vendorDetail)); return Response.ok(responseBody).build(); } <START> catch (BadRequestException ex) { <END> return respondGetVendorBadRequest(); } catch (Exception ex) { LOG.error(ex); return respondInternalServerError(ex); } }</code><technical_language>similar thought merging catches</technical_language>

Target:
public Response getVendor(@PathParam(PurapPropertyConstants.VENDOR_NUMBER) String vendorNumber, @Context HttpHeaders headers) { try { HashMap<String, String> vendorCombinedPk = parseVendorNumber(vendorNumber); VendorDetail vendorDetail = getLookupDao().findObjectByMap(VendorDetail.class.newInstance(), vendorCombinedPk); if (ObjectUtils.isNull(vendorDetail)) { return respondNotFound(); } String responseBody = gson.toJson(getVendorProperties(vendorDetail)); return Response.ok(responseBody).build(); } catch (Exception ex) { LOG.error("getVendor", ex); return ex instanceof BadRequestException ? respondGetVendorBadRequest() : respondInternalServerError(ex); } }
Source:
<code>private boolean exportToProvider(Intent intent, boolean deleteAfterExport) { if ((intent == null) || (intent.getData() == null)) { Timber.e("exportToProvider() provided with insufficient intent data %s", intent); return false; } Uri uri = intent.getData(); Timber.d("Exporting from file to ContentProvider URI: %s/%s", mExportFileName, uri.toString()); FileOutputStream fileOutputStream; ParcelFileDescriptor pfd; try { pfd = getContentResolver().openFileDescriptor(uri, "w"); if (pfd != null) { fileOutputStream = new FileOutputStream(pfd.getFileDescriptor()); CompatHelper.getCompat().copyFile(mExportFileName, fileOutputStream); fileOutputStream.close(); pfd.close(); } if (deleteAfterExport && !new File(mExportFileName).delete()) { Timber.i("Failed to delete temporary export file %s", mExportFileName); <START> } <END> } catch (Exception e) { Timber.e(e, "Unable to export file to Uri: %s/%s", mExportFileName, uri.toString()); return false; } return true; }</code><technical_language>noticed a strange habit of explicitly error checks handling error properly. Here, need return false if pfd == null, docs happen for some unspecified reason. a weird mistake for multiple times, if (pfd != null) part added shows conscious null, handle case correctly... want try keeping this in mind coding, explicitly watch out for in self-reviews</technical_language>

Target:
private boolean exportToProvider(Intent intent, boolean deleteAfterExport) { if ((intent == null) || (intent.getData() == null)) { Timber.e("exportToProvider() provided with insufficient intent data %s", intent); return false; } Uri uri = intent.getData(); Timber.d("Exporting from file to ContentProvider URI: %s/%s", mExportFileName, uri.toString()); FileOutputStream fileOutputStream; ParcelFileDescriptor pfd; try { pfd = getContentResolver().openFileDescriptor(uri, "w"); if (pfd != null) { fileOutputStream = new FileOutputStream(pfd.getFileDescriptor()); CompatHelper.getCompat().copyFile(mExportFileName, fileOutputStream); fileOutputStream.close(); pfd.close(); } else { Timber.w("exportToProvider() failed - ContentProvider returned null file descriptor for %s", uri); return false; } if (deleteAfterExport && !new File(mExportFileName).delete()) { Timber.w("Failed to delete temporary export file %s", mExportFileName); } } catch (Exception e) { Timber.e(e, "Unable to export file to Uri: %s/%s", mExportFileName, uri.toString()); return false; } return true; }
Source:
<code>public void testNoLeaksAfterShutdown() { withRemoteCacheManager(new RemoteCacheManagerCallable(getRemoteCacheManager()) { @Override public void call() { RemoteCache<Integer, String> remote = rcm.getCache(cacheName); EventLogListener<Integer> eventListener = new EventLogListener<>(); remote.addClientListener(eventListener); eventListener.expectNoEvents(); remote.put(1, "one"); eventListener.expectOnlyCreatedEvent(1, cache(cacheName)); } }); WaitFor .condition(() -> listThreadsMatchingRegexp(".*Client-Listener-ClientListenerLeakTest-.*").size() == 0) .atMost(10, TimeUnit.MILLISECONDS) <START> .await(); <END> }</code><technical_language>a method for this AbstractInfinispanTest#eventually, here</technical_language>

Target:
public void testNoLeaksAfterShutdown() { withRemoteCacheManager(new RemoteCacheManagerCallable(getRemoteCacheManager()) { @Override public void call() { RemoteCache<Integer, String> remote = rcm.getCache(cacheName); EventLogListener<Integer> eventListener = new EventLogListener<>(); remote.addClientListener(eventListener); eventListener.expectNoEvents(); remote.put(1, "one"); eventListener.expectOnlyCreatedEvent(1, cache(cacheName)); } }); detectThreadLeaks(".*Client-Listener-ClientListenerLeakTest-.*"); }
Source:
<code>private void collectPluginCapabilities(Map<String, CapabilityInfo> output) { for (String pluginName : pluginCapabilities.plugins()) { for (Map.Entry<String, Provider<CapabilityDefinition>> entry : pluginCapabilities.byPlugin(pluginName).entrySet()) { <START> if (isPluginNameSane(pluginName)) { <END> String id = String.format("%s-%s", pluginName, entry.getKey()); output.put(id, new CapabilityInfo( id, entry.getValue().get().getDescription())); } else { log.warn(String.format("Plugin name is not sane: <%s> " + "dropping plugin owned capability %s; " + "consider changing the plugin filename.", pluginName, entry.getKey())); } } } }</code><technical_language>put this check in outer loop (i.e. line 66 67) log for plugin invalid name? for (String pluginName : pluginCapabilities.plugins()) { if (!isPluginNameSane(pluginName)) { log.warn("..."); continue; } for (Map.Entry<String, Provider<CapabilityDefinition>> entry : ... { } } do need log capability is dropped</technical_language>

Target:
private void collectPluginCapabilities(Map<String, CapabilityInfo> output) { for (String pluginName : pluginCapabilities.plugins()) { if (!isPluginNameSane(pluginName)) { log.warn(String.format("Plugin name is not sane: <%s> " + "dropping all plugin owned capabilities; " + "consider changing the plugin filename.", pluginName)); continue; } for (Map.Entry<String, Provider<CapabilityDefinition>> entry : pluginCapabilities.byPlugin(pluginName).entrySet()) { String id = String.format("%s-%s", pluginName, entry.getKey()); output.put(id, new CapabilityInfo( id, entry.getValue().get().getDescription())); } } }
Source:
<code><START> public Boolean getKeepNullColumns() <END> { return keepNullColumns; }</code><technical_language>boolean too</technical_language>

Target:
public boolean getKeepNullColumns() { return keepNullColumns; }
Source:
<code>public void testHeaderBar() { fTableBot.click(0, TIMESTAMP_COLUMN); fBot.text().typeText("2"); fBot.text().pressShortcut(Keystrokes.LF); fTableBot.click(0, MESSAGE_COLUMN); fBot.text().typeText("F"); fBot.text().pressShortcut(Keystrokes.CTRL, Keystrokes.LF); fBot.waitUntil(ConditionHelpers.isTableCellFilled(fTableBot, "2/22", 1, 1)); fBot.waitUntil(ConditionHelpers.isTableCellFilled(fTableBot, "Message F", 3, MESSAGE_COLUMN)); <START> waitForHighlightState(3, TIMESTAMP_COLUMN, true); <END> waitForHighlightState(3, MESSAGE_COLUMN, true); fTableBot.pressShortcut(Keystrokes.DELETE); waitForHighlightState(3, TIMESTAMP_COLUMN, false); waitForHighlightState(3, MESSAGE_COLUMN, false); SWTBotCLabel filterCLabel = fBot.clabel("Message matches \"F\""); SWTBotCanvas filterCanvas = new SWTBotCanvas(filterCLabel.widget); filterCanvas.click(); waitForHighlightState(3, TIMESTAMP_COLUMN, false); waitForHighlightState(3, MESSAGE_COLUMN, true); Rectangle imageBounds = filterCLabel.image().getBounds(); filterCanvas.click(filterCLabel.widget.getLeftMargin() + imageBounds.width / 2, filterCLabel.widget.getTopMargin() + imageBounds.height / 2); fBot.waitUntil(ConditionHelpers.isTableCellFilled(fTableBot, "5/22", 1, 1)); }</code><technical_language>I good check CLabels there. I.e: fBot.clabel("Message matches \"F\""); fBot.clabel("Timestamp matches \"2\"");</technical_language>

Target:
public void testHeaderBar() { fTableBot.click(0, TIMESTAMP_COLUMN); fBot.text().typeText("2"); fBot.text().pressShortcut(Keystrokes.CR); fTableBot.click(0, MESSAGE_COLUMN); fBot.text().typeText("F"); fBot.text().pressShortcut(Keystrokes.CTRL, Keystrokes.CR); fBot.waitUntil(ConditionHelpers.isTableCellFilled(fTableBot, "2/22", 1, 1)); fBot.waitUntil(ConditionHelpers.isTableCellFilled(fTableBot, "Message F", 3, MESSAGE_COLUMN)); fBot.clabel("Timestamp matches \"2\""); fBot.clabel("Message matches \"F\""); waitForHighlightState(3, TIMESTAMP_COLUMN, true); waitForHighlightState(3, MESSAGE_COLUMN, true); fTableBot.pressShortcut(Keystrokes.DELETE); waitForHighlightState(3, TIMESTAMP_COLUMN, false); waitForHighlightState(3, MESSAGE_COLUMN, false); SWTBotCLabel filterCLabel = fBot.clabel("Message matches \"F\""); SWTBotCanvas filterCanvas = new SWTBotCanvas(filterCLabel.widget); filterCanvas.click(); waitForHighlightState(3, TIMESTAMP_COLUMN, false); waitForHighlightState(3, MESSAGE_COLUMN, true); Rectangle imageBounds = filterCLabel.image().getBounds(); filterCanvas.click(filterCLabel.widget.getLeftMargin() + imageBounds.width / 2, filterCLabel.widget.getTopMargin() + imageBounds.height / 2); fBot.waitUntil(ConditionHelpers.isTableCellFilled(fTableBot, "5/22", 1, 1)); }
Source:
<code>public final void run(T configuration, Environment environment) throws Exception { final PooledDataSourceFactory dbConfig = getDataSourceFactory(configuration); this.sessionFactory = sessionFactoryFactory.build(this, environment, dbConfig, entities, name()); registerUnitOfWorkListerIfAbsent(environment).registerSessionFactory(name(), sessionFactory); environment.healthChecks().register(name(), new SessionFactoryHealthCheck( environment.getHealthCheckExecutorService(), <START> dbConfig.getValidationQueryTimeout().orElseGet(() -> Duration.seconds(5)), <END> sessionFactory, dbConfig.getValidationQuery())); }</code><technical_language>orElse(Duration.seconds(5))</technical_language>

Target:
public final void run(T configuration, Environment environment) throws Exception { final PooledDataSourceFactory dbConfig = getDataSourceFactory(configuration); this.sessionFactory = sessionFactoryFactory.build(this, environment, dbConfig, entities, name()); registerUnitOfWorkListerIfAbsent(environment).registerSessionFactory(name(), sessionFactory); environment.healthChecks().register(name(), new SessionFactoryHealthCheck( environment.getHealthCheckExecutorService(), dbConfig.getValidationQueryTimeout().orElse(Duration.seconds(5)), sessionFactory, dbConfig.getValidationQuery())); }
Source:
<code>public void testFastForwardRebaseWithModification() throws Exception { writeTrashFile("file0", "file0"); writeTrashFile(FILE1, "file1"); git.add().addFilepattern("file0").addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/topic"); writeTrashFile("file0", "mofified file0 in index"); git.add().addFilepattern("file0").addFilepattern(FILE1).call(); writeTrashFile("file0", "modified file0"); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(Status.FAST_FORWARD, result.getStatus()); assertEquals("[file0, mode:100644, content:mofified file0 in index]" + "[file1, mode:100644, content:modified file1]", <START> indexState(CONTENT)); <END> assertEquals(RepositoryState.SAFE, db.getRepositoryState()); }</code><technical_language>add assertion contents of file0 "modified file0" (for working directory)</technical_language>

Target:
public void testFastForwardRebaseWithModification() throws Exception { writeTrashFile("file0", "file0"); writeTrashFile(FILE1, "file1"); git.add().addFilepattern("file0").addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/topic"); writeTrashFile("file0", "modified file0 in index"); git.add().addFilepattern("file0").addFilepattern(FILE1).call(); writeTrashFile("file0", "modified file0"); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(Status.FAST_FORWARD, result.getStatus()); checkFile(new File(db.getWorkTree(), "file0"), "modified file0"); checkFile(new File(db.getWorkTree(), FILE1), "modified file1"); assertEquals("[file0, mode:100644, content:modified file0 in index]" + "[file1, mode:100644, content:modified file1]", indexState(CONTENT)); assertEquals(RepositoryState.SAFE, db.getRepositoryState()); }
Source:
<code>public static Map<String, Integer> getComponentsToScaleDown(Map<String, Integer> componentChanges) { Map<String, Integer> componentsToScaleDown = new HashMap<String, Integer>(); <START> for (Map.Entry<String, Integer> entry : componentChanges.entrySet()) { <END> if (entry.getValue() < 0) { componentsToScaleDown.put(entry.getKey(), entry.getValue()); } } return componentsToScaleDown; }</code><technical_language>iterate keySet() instead? naming helps tend more descriptive entry.getKey() entry.getValue(). for below</technical_language>

Target:
public static Map<String, Integer> getComponentsToScaleDown(Map<String, Integer> componentChanges) { Map<String, Integer> componentsToScaleDown = new HashMap<String, Integer>(); for (String component : componentChanges.keySet()) { int parallelismChange = componentChanges.get(component); if (parallelismChange < 0) { componentsToScaleDown.put(component, parallelismChange); } } return componentsToScaleDown; }
Source:
<code>public static boolean isMultiPartForm(@CheckForNull String contentType) { if (contentType == null) { return false; } String[] parts = contentType.split(";"); if (parts.length == 0) { return false; } <START> for (String part : parts) { <END> if ("multipart/form-data".equals(part)) { return true; } } return false; }</code><technical_language>replace this return ArrayUtils.contains(parts, "multipart/form-data");</technical_language>

Target:
public static boolean isMultiPartForm(@CheckForNull String contentType) { if (contentType == null) { return false; } String[] parts = contentType.split(";"); return ArrayUtils.contains(parts, "multipart/form-data"); }
Source:
<code>public void decorate(Object element, IDecoration decoration) { if (!(element instanceof IFolder)) { return; } IFolder folder = (IFolder)element; try { if (folder.getProject().hasNature("org.eclipse.thym.core.HybridAppNature") && folder.getProjectRelativePath().toPortableString().equals("www")) { decoration.addOverlay(wwwOverlay); } } catch (CoreException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>please log this exception</technical_language>

Target:
public void decorate(Object element, IDecoration decoration) { if (!(element instanceof IFolder)) { return; } IFolder folder = (IFolder)element; try { if (folder.getProject().hasNature("org.eclipse.thym.core.HybridAppNature") && folder.getProjectRelativePath().toPortableString().equals("www")) { decoration.addOverlay(wwwOverlay); } } catch (CoreException e) { HybridUI.log(IStatus.WARNING, "Could not determine Nature of project", e); } }