auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Set<byte[]> zRangeByScore(byte[] key, Range range, Limit limit) { Assert.notNull(range, "Range cannot be null for ZRANGEBYSCORE."); byte[] min = JedisConverters.boundaryToBytesForZRange(range.getMin(), JedisConverters.toBytes("-inf")); byte[] max = JedisConverters.boundaryToBytesForZRange(range.getMax(), JedisConverters.toBytes("+inf")); try { if (isPipelined()) { <START> if (limit != null) { <END> pipeline(new JedisResult(pipeline.zrangeByScore(key, min, max, limit.getOffset(), limit.getCount()))); } else { pipeline(new JedisResult(pipeline.zrangeByScore(key, min, max))); } return null; } if (isQueueing()) { if (limit != null) { transaction(new JedisResult(transaction.zrangeByScore(key, min, max, limit.getOffset(), limit.getCount()))); } else { transaction(new JedisResult(transaction.zrangeByScore(key, min, max))); } return null; } if (limit != null) { return jedis.zrangeByScore(key, min, max, limit.getOffset(), limit.getCount()); } return jedis.zrangeByScore(key, min, max); } catch (Exception ex) { throw convertJedisAccessException(ex); } }</code><technical_language>introduce a Null Object like: Limit.ALL Limit.NONE get rid of null checks</technical_language>

Target:
public Set<byte[]> zRangeByScore(byte[] key, Range range, Limit limit) { Assert.notNull(range, "Range cannot be null for ZRANGEBYSCORE."); byte[] min = JedisConverters.boundaryToBytesForZRange(range.getMin(), JedisConverters.NEGATIVE_INFINITY_BYTES); byte[] max = JedisConverters.boundaryToBytesForZRange(range.getMax(), JedisConverters.POSITIVE_INFINITY_BYTES); try { if (isPipelined()) { if (limit != null) { pipeline(new JedisResult(pipeline.zrangeByScore(key, min, max, limit.getOffset(), limit.getCount()))); } else { pipeline(new JedisResult(pipeline.zrangeByScore(key, min, max))); } return null; } if (isQueueing()) { if (limit != null) { transaction(new JedisResult(transaction.zrangeByScore(key, min, max, limit.getOffset(), limit.getCount()))); } else { transaction(new JedisResult(transaction.zrangeByScore(key, min, max))); } return null; } if (limit != null) { return jedis.zrangeByScore(key, min, max, limit.getOffset(), limit.getCount()); } return jedis.zrangeByScore(key, min, max); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
Source:
<code>public Response labelsLabelIdDelete(String labelId, String ifMatch, String ifUnmodifiedSince) { try { APIAdmin apiAdmin = new APIAdminImpl(); String user = RestApiUtil.getLoggedInUsername(); apiAdmin.deleteLabel(user, labelId); return Response.ok().build(); } catch (APIManagementException e) { String errorMessage = "Error while deleting API : " + labelId; <START> RestApiUtil.handleInternalServerError(errorMessage, log); <END> } return null; }</code><technical_language>do log error trace now</technical_language>

Target:
public Response labelsLabelIdDelete(String labelId, String ifMatch, String ifUnmodifiedSince) { try { APIAdmin apiAdmin = new APIAdminImpl(); String user = RestApiUtil.getLoggedInUsername(); apiAdmin.deleteLabel(user, labelId); return Response.ok().build(); } catch (APIManagementException e) { String errorMessage = "Error while deleting label : " + labelId; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }
Source:
<code>public WidgetInfos(StyledText textWidget, Canvas canvas) { maxLines= textWidget.getLineCount(); bounds= canvas.getBounds(); int w= 0; int i= 0; <START> while (w < bounds.height && i < maxLines) { <END> w+= JFaceTextUtil.computeLineHeight(textWidget, i); i++; } writable= w; ScrollBar verticalBar= textWidget.getVerticalBar(); if (verticalBar != null && !verticalBar.getVisible()) { int max= verticalBar.getMaximum(); double clientAreaHeight= textWidget.getClientArea().height; if (max > clientAreaHeight) { double percentage= clientAreaHeight / max; thumbHeight= (int) (bounds.height * percentage); } else { thumbHeight= bounds.height; } if (thumbHeight < 0) { thumbHeight= 0; } } else { thumbHeight= verticalBar != null ? Math.max(Math.min(bounds.height, verticalBar.getThumbBounds().height), 0) : 0; } int partialTopIndex= JFaceTextUtil.getPartialTopIndex(textWidget); int topLineHeight= textWidget.getLineHeight(textWidget.getOffsetAtLine(partialTopIndex)); int topLinePixel= textWidget.getLinePixel(partialTopIndex); double topIndex= partialTopIndex - (double) topLinePixel / topLineHeight; int partialBottomIndex= JFaceTextUtil.getPartialBottomIndex(textWidget); int bottomLineHeight= textWidget.getLineHeight(textWidget.getOffsetAtLine(partialBottomIndex)); int bottomLinePixel= textWidget.getLinePixel(partialBottomIndex); double bottomIndex= partialBottomIndex - ((double) bottomLinePixel - textWidget.getClientArea().height) / bottomLineHeight; visibleLines= bottomIndex - topIndex; invisibleLines= maxLines - visibleLines; }</code><technical_language>I get a review question "Why for loop" disliked it. I ask question. :D</technical_language>

Target:
public WidgetInfos(StyledText textWidget, Canvas canvas) { maxLines= textWidget.getLineCount(); bounds= canvas.getBounds(); int w= 0; for (int i= 0; i < maxLines && w < bounds.height; i++) { w+= JFaceTextUtil.computeLineHeight(textWidget, i); } writable= w; ScrollBar verticalBar= textWidget.getVerticalBar(); if (verticalBar != null && !verticalBar.getVisible()) { int max= verticalBar.getMaximum(); double clientAreaHeight= textWidget.getClientArea().height; if (max > clientAreaHeight) { double percentage= clientAreaHeight / max; thumbHeight= (int) (bounds.height * percentage); } else { thumbHeight= bounds.height; } if (thumbHeight < 0) { thumbHeight= 0; } } else { thumbHeight= verticalBar != null ? Math.max(Math.min(bounds.height, verticalBar.getThumbBounds().height), 0) : 0; } int partialTopIndex= JFaceTextUtil.getPartialTopIndex(textWidget); int topLineHeight= textWidget.getLineHeight(textWidget.getOffsetAtLine(partialTopIndex)); int topLinePixel= textWidget.getLinePixel(partialTopIndex); double topIndex= partialTopIndex - (double) topLinePixel / topLineHeight; int partialBottomIndex= JFaceTextUtil.getPartialBottomIndex(textWidget); int bottomLineHeight= textWidget.getLineHeight(textWidget.getOffsetAtLine(partialBottomIndex)); int bottomLinePixel= textWidget.getLinePixel(partialBottomIndex); double bottomIndex= partialBottomIndex - ((double) bottomLinePixel - textWidget.getClientArea().height) / bottomLineHeight; visibleLines= bottomIndex - topIndex; invisibleLines= maxLines - visibleLines; }
Source:
<code>private Map<String, String> getBundle(String serviceName) { <START> ResourceLoader rb = new ResourceLoader("org.sakaiproject.feedback"); <END> Map<String, String> bundleMap = new HashMap<String, String>(); for (Object key : rb.keySet()) { bundleMap.put((String) key, rb.getString((String) key)); } formatProperties(rb, bundleMap, serviceName); return bundleMap; }</code><technical_language>I ResourceLoader a static class variable creating ResourceLoader expensive</technical_language>

Target:
private Map<String, String> getBundle(String serviceName) { Map<String, String> bundleMap = new HashMap<String, String>(); for (Object key : rb.keySet()) { bundleMap.put((String) key, rb.getString((String) key)); } formatProperties(rb, bundleMap, serviceName); return bundleMap; }
Source:
<code>public List<Checksum> convertToEntityAttribute(String checksumString) { List<Checksum> cs = new ArrayList<>(); <START> if (checksumString != null && !checksumString.isEmpty()) { <END> String[] checksumsArray = checksumString.split(","); try { for (String s : checksumsArray) { cs.add(new Checksum(s.split(":")[0].trim(), s.split(":")[1].trim())); } return cs; } catch (ArrayIndexOutOfBoundsException ex) { LOG.error("Could not parse checksum(s) " + checksumString, ex); return null; } } return null; }</code><technical_language>simplify if (StringUtils.isNotEmpty(checksumString)) {</technical_language>

Target:
public List<Checksum> convertToEntityAttribute(String checksumString) { List<Checksum> cs = new ArrayList<>(); if (StringUtils.isNotEmpty(checksumString)) { String[] checksumsArray = checksumString.split(","); try { for (String s : checksumsArray) { cs.add(new Checksum(s.split(":")[0].trim(), s.split(":")[1].trim())); } return cs; } catch (ArrayIndexOutOfBoundsException ex) { LOG.error("Could not parse checksum(s) " + checksumString, ex); return null; } } return null; }
Source:
<code>protected List<Edge> getEdgeList(DDiagram representation) { List<Edge> edges = new ArrayList<Edge>(); for (Iterator<EObject> iterator = representation.eAllContents(); iterator.hasNext(); ) { EObject element = iterator.next(); if (element instanceof Edge) { <START> edges.add((Edge) element); <END> } } return edges; }</code><technical_language>more efficient TreeIterator.prune skip subelements</technical_language>

Target:
protected List<Edge> getEdgeList(DDiagram representation) { List<Edge> edges = new ArrayList<Edge>(); TreeIterator<EObject> eAllContents = representation.eAllContents(); while (eAllContents.hasNext()) { EObject element = eAllContents.next(); if (element instanceof Edge) { edges.add((Edge) element); eAllContents.prune(); } } return edges; }
Source:
<code>public WebTargetGraphiteClient(WebTarget webTarget) { this.webTarget = webTarget .path("render") <START> .queryParam("from", "-5minutes") <END> .queryParam("until", "-2minutes") .queryParam("format", "json"); }</code><technical_language>Do need 3 minutes of data? logic fetches data point. I want confirm graphite guarantees return data points for this query</technical_language>

Target:
public WebTargetGraphiteClient(WebTarget webTarget) { this.webTarget = webTarget .path("render") .queryParam("from", "-5minutes") .queryParam("until", "-1minutes") .queryParam("format", "json"); }
Source:
<code>public final int parseArguments(final Parameters params) throws CmdLineException { final String token = params.getParameter(0); final String[] tokens = token.split(","); if (tokens.length != 3) { throw new CmdLineException(owner, "change should be specified as " + "<project>,<branch>,<change-id>"); } Change.Key key; try { key = Change.Key.parse(tokens[2]); <START> for (Change change : db.changes().byKeyRange(key, key.max())) { <END> if (change.getProject().get().equals(tokens[0]) && change.getDest().getShortName().equals(tokens[1])) { setter.addValue(change.getId()); return 1; } throw new CmdLineException(owner, change.getDest().get() + " " + change.getProject().get()); } } catch (IllegalArgumentException e) { throw new CmdLineException(owner, "Change-Id is not valid"); } catch (OrmException e) { throw new CmdLineException(owner, "Database error: " + e.getMessage()); } throw new CmdLineException(owner, "\"" + token + "\": change not found"); }</code><technical_language>avoid load changes? I guess need load keyRange support abbreviated Change-ID's? add a new query immediately filters branch, e.g. db.changes().byBranchKeyRange(branch, key, key.max())</technical_language>

Target:
public final int parseArguments(final Parameters params) throws CmdLineException { final String token = params.getParameter(0); final String[] tokens = token.split(","); if (tokens.length != 3) { throw new CmdLineException(owner, "change should be specified as " + "<project>,<branch>,<change-id>"); } try { final Change.Key key = Change.Key.parse(tokens[2]); for (final Change change : db.changes().byKey(key)) { if (change.getProject().get().equals(tokens[0]) && change.getDest().getShortName().equals(tokens[1])) { setter.addValue(change.getId()); return 1; } } } catch (IllegalArgumentException e) { throw new CmdLineException(owner, "Change-Id is not valid"); } catch (OrmException e) { throw new CmdLineException(owner, "Database error: " + e.getMessage()); } throw new CmdLineException(owner, "\"" + token + "\": change not found"); }
Source:
<code>protected void startTraceJaegerListener(String strPort, ReportableEntityHandlerFactory handlerFactory, @Nullable WavefrontSender wfSender, Sampler sampler) { if (tokenAuthenticator.authRequired()) { logger.warning("Port: " + strPort + " is not compatible with HTTP authentication, ignoring"); return; } startAsManagedThread(() -> { activeListeners.inc(); try { TChannel server = new TChannel.Builder("jaeger-collector"). setServerPort(Integer.valueOf(strPort)). build(); server. makeSubChannel("jaeger-collector", Connection.Direction.IN). <START> register("Collector::submitBatches", new JaegerTChannelCollectorHandler(strPort, <END> handlerFactory, wfSender, traceDisabled::get, spanLogsDisabled::get, preprocessors.get(strPort), sampler, traceAlwaysSampleErrors, traceJaegerApplicationName, traceDerivedCustomTagKeys)); server.listen().channel().closeFuture().sync(); server.shutdown(false); } catch (InterruptedException e) { logger.info("Listener on port " + strPort + " shut down."); } catch (Exception e) { logger.log(Level.SEVERE, "Jaeger trace collector exception", e); } finally { activeListeners.dec(); } }, "listener-jaeger-thrift-" + strPort); logger.info("listening on port: " + strPort + " for trace data (Jaeger format over TChannel)"); }</code><technical_language>nit: modify "listener-jaeger-thrift-" -> "listener-jaeger-tchannel-"</technical_language>

Target:
protected void startTraceJaegerListener(String strPort, ReportableEntityHandlerFactory handlerFactory, @Nullable WavefrontSender wfSender, Sampler sampler) { if (tokenAuthenticator.authRequired()) { logger.warning("Port: " + strPort + " is not compatible with HTTP authentication, ignoring"); return; } startAsManagedThread(() -> { activeListeners.inc(); try { TChannel server = new TChannel.Builder("jaeger-collector"). setServerPort(Integer.valueOf(strPort)). build(); server. makeSubChannel("jaeger-collector", Connection.Direction.IN). register("Collector::submitBatches", new JaegerTChannelCollectorHandler(strPort, handlerFactory, wfSender, traceDisabled::get, spanLogsDisabled::get, preprocessors.get(strPort), sampler, traceAlwaysSampleErrors, traceJaegerApplicationName, traceDerivedCustomTagKeys)); server.listen().channel().closeFuture().sync(); server.shutdown(false); } catch (InterruptedException e) { logger.info("Listener on port " + strPort + " shut down."); } catch (Exception e) { logger.log(Level.SEVERE, "Jaeger trace collector exception", e); } finally { activeListeners.dec(); } }, "listener-jaeger-tchannel-" + strPort); logger.info("listening on port: " + strPort + " for trace data (Jaeger format over TChannel)"); }
Source:
<code>public Response getNoArgs() { <START> return Response.status(Response.Status.BAD_REQUEST.getStatusCode()).entity(new ErrorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "path /{userID} required")).build(); <END> }</code><technical_language>tiny nitpick. Change to: return Response.status(Response.Status.BAD_REQUEST).entity(new ErrorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "path /{userID} required")).build() This is in other places too</technical_language>

Target:
public Response getNoArgs() { return Response.status(Response.Status.BAD_REQUEST).entity(new ErrorResponse(Response.Status.BAD_REQUEST.getStatusCode(), "path /{userID} required")).build(); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } <START> if (!(obj instanceof Member)) { <END> return false; } if (!getClass().equals(obj.getClass())) { return false; } Member other = (Member) obj; return getId() == other.getId(); }</code><technical_language>this line 134 ? Replacing .getClass() check instead of obj == null check ? in User object ? I return false for null anyway, this return false if compare Member RichMember wanted comparable. In User object continue params comparison compare User Candidate RichUser. I implementation equivalent in Member User objects</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Member)) { return false; } Member other = (Member) obj; return getId() == other.getId(); }
Source:
<code>private void updateStartStopMenuItemState() { if (mMenuItemStartStop == null) { return; } MainApp app = (MainApp) getApplication(); if (app == null) { return; } ClientStumblerService svc = app.getService(); if (svc == null) { return; } boolean isScanning = svc.isScanning(); if (isScanning) { <START> keepScreenOnChanged(ClientPrefs.getInstance().getKeepScreenOn()); <END> } else { keepScreenOnChanged(false); } if (Build.VERSION.SDK_INT >= 11) { Switch s = (Switch) mMenuItemStartStop.getActionView(); s.setOnCheckedChangeListener(null); if (isScanning && !s.isChecked()) { s.setChecked(true); } else if (!isScanning && s.isChecked()) { s.setChecked(false); } s.setOnCheckedChangeListener(mStartStopButtonListener); } else { boolean buttonStateIsScanning = mMenuItemStartStop.getTitle().equals(getString(R.string.stop_scanning)); if (isScanning && !buttonStateIsScanning) { mMenuItemStartStop.setIcon(android.R.drawable.ic_media_pause); mMenuItemStartStop.setTitle(R.string.stop_scanning); } else if (!isScanning && buttonStateIsScanning) { mMenuItemStartStop.setIcon(android.R.drawable.ic_media_play); mMenuItemStartStop.setTitle(R.string.start_scanning); } } mMapFragment.dimToolbar(); }</code><technical_language>Nitpicking, rename this method keepScreenOn instead of keepScreenOnChanged argument passing is is actual state of screen flag</technical_language>

Target:
private void updateStartStopMenuItemState() { if (mMenuItemStartStop == null) { return; } MainApp app = (MainApp) getApplication(); if (app == null) { return; } ClientStumblerService svc = app.getService(); if (svc == null) { return; } boolean isScanning = svc.isScanning(); if (isScanning) { keepScreenOn(ClientPrefs.getInstance().getKeepScreenOn()); } else { keepScreenOn(false); } if (Build.VERSION.SDK_INT >= 11) { Switch s = (Switch) mMenuItemStartStop.getActionView(); s.setOnCheckedChangeListener(null); if (isScanning && !s.isChecked()) { s.setChecked(true); } else if (!isScanning && s.isChecked()) { s.setChecked(false); } s.setOnCheckedChangeListener(mStartStopButtonListener); } else { boolean buttonStateIsScanning = mMenuItemStartStop.getTitle().equals(getString(R.string.stop_scanning)); if (isScanning && !buttonStateIsScanning) { mMenuItemStartStop.setIcon(android.R.drawable.ic_media_pause); mMenuItemStartStop.setTitle(R.string.stop_scanning); } else if (!isScanning && buttonStateIsScanning) { mMenuItemStartStop.setIcon(android.R.drawable.ic_media_play); mMenuItemStartStop.setTitle(R.string.start_scanning); } } mMapFragment.dimToolbar(); }
Source:
<code>protected Query doToQuery(QueryShardContext context) { final List<String> fields; if (this.fields == null) { <START> fields = Collections.singletonList(context.defaultFields().get(0)); <END> } else { fields = Arrays.stream(this.fields) .filter(x -> context.fieldMapper(x) != null) .filter(x -> context.fieldMapper(x).tokenized()) .filter(x -> SUPPORTED_TYPES.contains(context.fieldMapper(x).typeName())) .map(x -> context.fieldMapper(x).name()) .collect(Collectors.toList()); if (fields.isEmpty()) { throw new QueryShardException(context, "fuzzy_like_this all provided fields are unknown or not tonized"); } if (failOnUnsupportedField && fields.size() != this.fields.length) { List<String> unsupportedFields = Stream.of(this.fields) .filter(x -> !fields.contains(x)) .collect(Collectors.toList()); throw new QueryShardException(context, "fuzzy_like_this some fields are either unknown/untokenized/non-text: {}", unsupportedFields); } } final Analyzer analyzer; if (this.analyzer == null) { analyzer = context.getMapperService().searchAnalyzer(); } else { analyzer = context.getMapperService().getIndexAnalyzers().get(this.analyzer); } FuzzyLikeThisQuery query = new FuzzyLikeThisQuery(maxQueryTerms, analyzer); int maxDist = fuzziness.asDistance(); for (String field : fields) { query.addTerms(likeText, field, maxDist, prefixLength); } query.setIgnoreTF(ignoreTF); return query; }</code><technical_language>this fields,</technical_language>

Target:
protected Query doToQuery(QueryShardContext context) { final List<String> fields; if (this.fields == null) { fields = context.defaultFields(); } else { fields = Arrays.stream(this.fields) .filter(x -> context.fieldMapper(x) != null) .filter(x -> context.fieldMapper(x).tokenized()) .filter(x -> SUPPORTED_TYPES.contains(context.fieldMapper(x).typeName())) .map(x -> context.fieldMapper(x).name()) .collect(Collectors.toList()); if (fields.isEmpty()) { throw new QueryShardException(context, "fuzzy_like_this all provided fields are unknown or not tonized"); } if (failOnUnsupportedField && fields.size() != this.fields.length) { List<String> unsupportedFields = Stream.of(this.fields) .filter(x -> !fields.contains(x)) .collect(Collectors.toList()); throw new QueryShardException(context, "fuzzy_like_this some fields are either unknown/untokenized/non-text: {}", unsupportedFields); } } final Analyzer analyzer; if (this.analyzer == null) { analyzer = context.getMapperService().searchAnalyzer(); } else { analyzer = context.getMapperService().getIndexAnalyzers().get(this.analyzer); } FuzzyLikeThisQuery query = new FuzzyLikeThisQuery(maxQueryTerms, analyzer); int maxDist = fuzziness.asDistance(); for (String field : fields) { query.addTerms(likeText, field, maxDist, prefixLength); } query.setIgnoreTF(ignoreTF); return query; }
Source:
<code>public void onUserSelectionChange(){ String text = scriptPanel.getText().trim(); <START> if (!text.isEmpty()) { <END> executeAction.setEnabled(true); clearAction.setEnabled(true); saveAction.setEnabled(true); findAction.setEnabled(true); } else{ executeAction.setEnabled(false); clearAction.setEnabled(false); saveAction.setEnabled(false); findAction.setEnabled(false); } }</code><technical_language>user modification method called gather+process text editor.. Try modification huge file</technical_language>

Target:
public void onUserSelectionChange(){ String text = scriptPanel.getText().trim(); if (text.isEmpty()) { executeAction.setEnabled(false); clearAction.setEnabled(false); saveAction.setEnabled(false); findAction.setEnabled(false); } else{ executeAction.setEnabled(true); clearAction.setEnabled(true); saveAction.setEnabled(true); findAction.setEnabled(true); } }
Source:
<code>private static void findRightPlace() { if (allafterdeclarations == null || alldefinitionsoutside == null) return; for(ICPPASTFunctionDeclarator decl: allafterdeclarations) { String decl_name = decl.getName().toString(); for(ICPPASTFunctionDefinition def: alldefinitionsoutside) { String def_name = null; if (def.getDeclarator().getName() instanceof ICPPASTQualifiedName) { ICPPASTQualifiedName qname = (ICPPASTQualifiedName) def.getDeclarator().getName(); <START> def_name = qname.getAllSegments()[1].toString(); <END> } else if (def.getDeclarator().getName() instanceof CPPASTName) { def_name = def.getDeclarator().getName().toString(); } if (decl_name.equals(def_name)) { if (def.getParent() != null && def.getParent() instanceof ICPPASTTemplateDeclaration) { position = (IASTDeclaration) def.getParent(); } else { position = def; } return; } } } }</code><technical_language>qname.getNames()[1] instead of qname.lastName()</technical_language>

Target:
private static void findRightPlace() { if (allafterdeclarations == null || alldefinitionsoutside == null) return; for(ICPPASTFunctionDeclarator decl: allafterdeclarations) { String decl_name = decl.getName().toString(); for(ICPPASTFunctionDefinition def: alldefinitionsoutside) { String def_name = null; IASTName name = def.getDeclarator().getName(); if (name != null) def_name = name.getLastName().toString(); if (decl_name.equals(def_name)) { if (def.getParent() != null && def.getParent() instanceof ICPPASTTemplateDeclaration) { position = (IASTDeclaration) def.getParent(); } else { position = def; } return; } } } }
Source:
<code>public boolean isOpen() { <START> return (open.get() && !closing.get()) || opening.get(); <END> }</code><technical_language>If opening is true, opening done opening yet</technical_language>

Target:
public boolean isOpen() { return (open.get() && !closing.get()); }
Source:
<code>private static boolean isDynamicallyGenerated(ExpressionTree tree) { if (tree.is(Tree.Kind.IDENTIFIER)) { Symbol symbol = ((IdentifierTree) tree).symbol(); VariableTree declaration = ((Symbol.VariableSymbol) symbol).declaration(); return declaration != null && (isSecureRandomGenerateSeed(declaration.initializer()) || <START> getReassignments(symbol.declaration(), symbol.usages()).stream() <END> .map(AssignmentExpressionTree::expression) .anyMatch(CipherBlockChainingCheck::isSecureRandomGenerateSeed)); } else { return isSecureRandomGenerateSeed(tree); } }</code><technical_language>reuse declaration instead of symbol.declaration() here</technical_language>

Target:
private static boolean isDynamicallyGenerated(ExpressionTree tree) { if (tree.is(Tree.Kind.IDENTIFIER)) { Symbol symbol = ((IdentifierTree) tree).symbol(); if (!symbol.isVariableSymbol()) { return false; } VariableTree declaration = ((Symbol.VariableSymbol) symbol).declaration(); return declaration != null && (isSecureRandomGenerateSeed(declaration.initializer()) || getReassignments(declaration, symbol.usages()).stream() .map(AssignmentExpressionTree::expression) .anyMatch(CipherBlockChainingCheck::isSecureRandomGenerateSeed)); } else { return isSecureRandomGenerateSeed(tree); } }
Source:
<code>protected boolean readElement(IConfigurationElement element, boolean add) { String tagName = element.getName(); <START> if (tagName.equals(TAG_PROFILE) || tagName.equals(TAG_PACKAGE)) { <END> Map<String, URI> uriToLocationMap = tagName.equals(TAG_PROFILE) ? ePackageNsURIToProfileLocationMap : ePackageNsURIToPackageLocationMap; String uri = element.getAttribute(ATT_URI); if (uri == null) { logMissingAttribute(element, ATT_URI); } else if (add) { if (uriToLocationMap != null) { String location = element.getAttribute(ATT_LOCATION); if (location != null) { URI profileLocation = URI.createURI(location); if (profileLocation.isRelative()) { profileLocation = URI.createPlatformPluginURI( element.getDeclaringExtension() .getContributor().getName() + '/' + location, false); } uriToLocationMap.put(uri, profileLocation); } } return true; } else { uriToLocationMap.remove(uri); return true; } } return false; }</code><technical_language>I this done cases, 1) if profile, add registries 2) if package, add package registry</technical_language>

Target:
protected boolean readElement(IConfigurationElement element, boolean add) { String tagName = element.getName(); if (tagName.equals(TAG_PROFILE) || tagName.equals(TAG_PACKAGE)) { String uri = element.getAttribute(ATT_URI); if (uri == null) { logMissingAttribute(element, ATT_URI); } else if (add) { String location = element.getAttribute(ATT_LOCATION); if (location != null) { URI profileLocation = URI.createURI(location); if (profileLocation.isRelative()) { profileLocation = URI.createPlatformPluginURI( element.getDeclaringExtension() .getContributor().getName() + '/' + location, false); } if (ePackageNsURIToPackageLocationMap != null){ ePackageNsURIToPackageLocationMap.put(uri, profileLocation); } if (tagName.equals(TAG_PROFILE)) { ePackageNsURIToProfileLocationMap.put(uri, profileLocation); } } return true; } else { if (ePackageNsURIToPackageLocationMap != null) { ePackageNsURIToPackageLocationMap.remove(uri); } if (tagName.equals(TAG_PROFILE)) { ePackageNsURIToProfileLocationMap.remove(uri); } return true; } } return false; }
Source:
<code>public boolean getWarningOnLostOrRestoredSignal(){ return prefs.getBoolean("tts_lost_signal", DEFAULT_TTS_WARN_LOST_SIGNAL); <START> } <END></code><technical_language>@squilter great! pretty good.. remaining, methods context.getString(...) retrieve preference key, getSpokenStatusInterval() them</technical_language>

Target:
public boolean getWarningOnLostOrRestoredSignal(){ return prefs.getBoolean(context.getString(R.string.pref_tts_warning_lost_signal_key), DEFAULT_TTS_WARNING_LOST_SIGNAL); }
Source:
<code>private DebtRemediationFunction remediationFunction(DebtRemediationFunctions drf) { if (func.startsWith("Constant")) { <START> return drf.constantPerIssue(constantCost.replace("mn", "min")); <END> } if ("Linear".equals(func)) { return drf.linear(linearFactor.replace("mn", "min")); } return drf.linearWithOffset(linearFactor.replace("mn", "min"), linearOffset.replace("mn", "min")); }</code><technical_language>@ivandalbosco I copied this piece JS, perfect :) drop .replace("mn", "min") (3 places). This done RSPECs legacy mn for minutes. fixed now. is some RSPEC mn plugin fails, update this RSPEC</technical_language>

Target:
private DebtRemediationFunction remediationFunction(DebtRemediationFunctions drf) { if (func.startsWith("Constant")) { return drf.constantPerIssue(constantCost); } if ("Linear".equals(func)) { return drf.linear(linearFactor); } return drf.linearWithOffset(linearFactor, linearOffset); }
Source:
<code>private void addToUnsecuredCookies(AssignmentExpressionTree assignment) { if (assignment.expression().is(Tree.Kind.NEW_CLASS) && assignment.variable().is(Tree.Kind.IDENTIFIER)) { IdentifierTree identifier = (IdentifierTree) assignment.variable(); <START> boolean isMethodVariable = identifier.symbol().isVariableSymbol() && identifier.symbol().owner().isMethodSymbol(); <END> boolean isMatchedType = isCookieClass(identifier.symbolType()) || isCookieClass(assignment.expression().symbolType()); if (isMethodVariable && isMatchedType && isSecureParamFalse((NewClassTree) assignment.expression())) { unsecuredCookies.add((Symbol.VariableSymbol) ((IdentifierTree) assignment.variable()).symbol()); } } }</code><technical_language>extract identifier.symbol() a dedicated variable in order improve readability</technical_language>

Target:
private void addToUnsecuredCookies(AssignmentExpressionTree assignment) { if (assignment.expression().is(Tree.Kind.NEW_CLASS) && assignment.variable().is(Tree.Kind.IDENTIFIER)) { IdentifierTree assignmentVariable = (IdentifierTree) assignment.variable(); Symbol assignmentVariableSymbol = assignmentVariable.symbol(); boolean isMethodVariable = assignmentVariableSymbol.isVariableSymbol() && assignmentVariableSymbol.owner().isMethodSymbol(); boolean isMatchedType = isCookieClass(assignmentVariable.symbolType()) || isCookieClass(assignment.expression().symbolType()); if (isMethodVariable && isMatchedType && isSecureParamFalse((NewClassTree) assignment.expression())) { unsecuredCookies.add((Symbol.VariableSymbol) assignmentVariableSymbol); } } }
Source:
<code>private static PRPAIN201306UV02MFMIMT700711UV01RegistrationEvent createRegEvent(Patient patient, PRPAIN201305UV02 query) { II id = new II(); id.getNullFlavor().add("NA"); CS statusCode = new CS(); statusCode.setCode("active"); PRPAIN201306UV02MFMIMT700711UV01RegistrationEvent regEvent = new PRPAIN201306UV02MFMIMT700711UV01RegistrationEvent(); regEvent.getMoodCode().add("EVN"); <START> regEvent.getClassCode().add("REG"); <END> regEvent.getId().add(id); regEvent.setStatusCode(statusCode); regEvent.setSubject1(createSubject1(patient, query)); return regEvent; }</code><technical_language>Above, Mood Class code constants, in-line literal. Is this intentional</technical_language>

Target:
private static PRPAIN201306UV02MFMIMT700711UV01RegistrationEvent createRegEvent(Patient patient, PRPAIN201305UV02 query) { II id = new II(); id.getNullFlavor().add(NA); CS statusCode = new CS(); statusCode.setCode(STATUS_CD); PRPAIN201306UV02MFMIMT700711UV01RegistrationEvent regEvent = new PRPAIN201306UV02MFMIMT700711UV01RegistrationEvent(); regEvent.getMoodCode().add(REG_MOOD_CODE); regEvent.getClassCode().add(REG_CLASS_CODE); regEvent.getId().add(id); regEvent.setStatusCode(statusCode); regEvent.setSubject1(createSubject1(patient, query)); return regEvent; }
Source:
<code>private void waitForTerminateInstances(Long stackId, List<String> instanceIds, AmazonEC2Client amazonEC2Client) { LOGGER.debug("Polling instance until terminated. [stack: {}, instances: {}]", stackId, instanceIds); Waiter<DescribeInstancesRequest> instanceTerminatedWaiter = amazonEC2Client.waiters().instanceTerminated(); DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest().withInstanceIds(instanceIds); StackCancellationCheck stackCancellationCheck = new StackCancellationCheck(stackId); <START> run(instanceTerminatedWaiter, describeInstancesRequest, stackCancellationCheck, "Instances termination failed"); <END> }</code><technical_language>mention instance id relevant info</technical_language>

Target:
private void waitForTerminateInstances(Long stackId, List<String> instanceIds, AmazonEC2Client amazonEC2Client) { LOGGER.debug("Polling instance until terminated. [stack: {}, instances: {}]", stackId, instanceIds); Waiter<DescribeInstancesRequest> instanceTerminatedWaiter = amazonEC2Client.waiters().instanceTerminated(); DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest().withInstanceIds(instanceIds); StackCancellationCheck stackCancellationCheck = new StackCancellationCheck(stackId); run(instanceTerminatedWaiter, describeInstancesRequest, stackCancellationCheck, String.format("There was an error when application are deleting instances", String.join(",", instanceIds))); }
Source:
<code><START> public ViewModelFactory(ArrayMap<Class<? extends ViewModel>, Provider<ViewModel>> viewModelsMap) { <END> this.mViewModelsMap = viewModelsMap; }</code><technical_language>I remove this public</technical_language>

Target:
ViewModelFactory(ArrayMap<Class<? extends ViewModel>, Provider<ViewModel>> viewModelsMap) { this.mViewModelsMap = viewModelsMap; }
Source:
<code>public void collectWithParamsForEachTest() throws IOException { List<TagWithParams> tagsWithParams = getTagsWithParameters("{{#each items as |item|}}{{i18n item}}{{/each}}"); <START> assertEquals(tagsWithParams.size(), 1); <END> TagWithParams tagWithParams = tagsWithParams.get(0); assertEquals(tagWithParams.getTagType(), TagType.VAR); assertEquals(tagWithParams.getTag(), "i18n"); assertEquals(tagWithParams.getParams().size(), 1); Param param = tagWithParams.getParams().get(0); RefParam refParam = (RefParam) param; assertEquals(refParam.toString(), "item"); }</code><technical_language>hmm here? Tag("each", items) Tag("i18n", item)</technical_language>

Target:
public void collectWithParamsForEachTest() throws IOException { List<Tag> tagsWithParams = getTagsWithParameters("{{#each shoppingCartItems as |item|}}{{i18n item}}{{/each}}"); assertEquals(tagsWithParams.size(), 2); Tag i18NTag = tagsWithParams.get(0); System.out.println("i18nTag.getParams() is "+ i18NTag.getParams()); assertEquals(i18NTag.getTagType(), TagType.VAR); assertEquals(i18NTag.getTag(), "i18n"); assertEquals(i18NTag.getParams().size(), 1); Param i18nParam = i18NTag.getParams().get(0); RefParam i18nRefParam = (RefParam) i18nParam; assertEquals(i18nRefParam.toString(), "item"); Tag eachTag = tagsWithParams.get(1); assertEquals(eachTag.getTagType(), TagType.SECTION); assertEquals(eachTag.getTag(), "each"); assertEquals(eachTag.getParams().size(), 2); System.out.println("eachTag.getParams() is "+ eachTag.getParams()); Param param1 = eachTag.getParams().get(0); RefParam refParam1 = (RefParam) param1; assertEquals(refParam1.toString(), "item"); Param param2 = eachTag.getParams().get(1); RefParam refParam2 = (RefParam) param2; assertEquals(refParam2.toString(), "shoppingCartItems"); }
Source:
<code><START> public List<String> getUntrackedFolders() { <END> return ((indexDiffFilter == null) ? Collections.<String>emptyList() : indexDiffFilter.getUntrackedFolders()); }</code><technical_language>I a Set returned here. This improves performance clint side</technical_language>

Target:
public Set<String> getUntrackedFolders() { return ((indexDiffFilter == null) ? Collections.<String> emptySet() : new HashSet<String>(indexDiffFilter.getUntrackedFolders())); }
Source:
<code>public Object prepare(final Object value) { if (value == null || value instanceof String || !stringify) { return value; } else { <START> if (value instanceof Boolean) { <END> return PREFIX_BOOLEAN + value; } else if (value instanceof Integer) { return PREFIX_INT + value; } else if (value instanceof Long) { return PREFIX_LONG + value; } else if (value instanceof Date) { return PREFIX_DATE + newSdf().format((Date) value); } else if (value instanceof URI) { return PREFIX_URI + value.toString(); } else { return PREFIX_SB64 + serializationHelper.serializeToBase64((Serializable) value); } } }</code><technical_language>Do need handle BigDecimal well</technical_language>

Target:
public Object prepare(final Object value) { if (value == null || value instanceof String || !stringify) { return value; } else { if (value instanceof Boolean) { return PREFIX_BOOLEAN.concat(value.toString()); } else if (value instanceof Integer) { return PREFIX_INT.concat(value.toString()); } else if (value instanceof Long) { return PREFIX_LONG.concat(value.toString()); } else if (value instanceof Date) { return PREFIX_DATE.concat(newSdf().format((Date) value)); } else if (value instanceof URI) { return PREFIX_URI.concat(value.toString()); } else { return PREFIX_SB64.concat(serializationHelper.serializeToBase64((Serializable) value)); } } }
Source:
<code>public ProfileConfiguration getProfileConfig(String profileName) throws UserStoreException { if (profileName != null) { return profileConfigs.get(profileName); } else { <START> return null; <END> } }</code><technical_language>avoid returning null here, is root for NPEs adding complexity of checking for null results caller functions</technical_language>

Target:
public ProfileConfiguration getProfileConfig(String profileName) throws UserStoreException { if (profileName != null) { return profileConfigs.get(profileName); } else { throw new UserStoreException("profileName value is null."); } }
Source:
<code>public void deleteRootOfTheModel() { final List<EObject> selectedElement = new ArrayList<EObject>(); selectedElement.add(getRootOfTheModel()); getModelExplorerView().revealSemanticElement(selectedElement); RunnableWithResult<IWorkbenchPart> runnable; Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<IWorkbenchPart>() { public void run() { try { <START> IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); <END> IWorkbenchPart activePart = activePage.getActivePart(); setResult(activePart); setStatus(Status.OK_STATUS); } catch (Exception ex) { setStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage())); } } }); Assert.assertEquals(runnable.getStatus().getMessage(), IStatus.OK, runnable.getStatus().getSeverity()); IWorkbenchPart activePart = runnable.getResult(); Assert.assertTrue("The active part is not the ModelExplorer", activePart instanceof ModelExplorerPageBookView); final IStructuredSelection currentSelection = getCurrentSelection(); Assert.assertEquals("Only one element should be selected", currentSelection.size(), 1); Object obj = currentSelection.getFirstElement(); obj = EMFHelper.getEObject(obj); Assert.assertSame(getRootOfTheModel(), obj); final IHandler currentHandler = getActiveHandler(); if (currentHandler == null) { } else { Assert.assertFalse("We can delete the root of the model. It is not the wanted behavior", currentHandler.isEnabled()); } }</code><technical_language>Utils method exist for in org.eclipse.papyrus.infra.tools.util.WorkbenchPartHelper#getCurrentActiveWorkbenchPart() (but, name of method improved)! + class completed get activePart</technical_language>

Target:
public void deleteRootOfTheModel() { final List<EObject> selectedElement = new ArrayList<EObject>(); selectedElement.add(getRootOfTheModel()); getModelExplorerView().revealSemanticElement(selectedElement); IWorkbenchPart activePart = WorkbenchPartHelper.getCurrentActiveWorkbenchPart(); Assert.assertNotNull("The active part could not be retrieved.", activePart); Assert.assertTrue("The active part is not the ModelExplorer", activePart instanceof ModelExplorerPageBookView); final IStructuredSelection currentSelection = getCurrentSelection(); Assert.assertEquals("Only one element should be selected", currentSelection.size(), 1); Object obj = currentSelection.getFirstElement(); obj = EMFHelper.getEObject(obj); Assert.assertSame(getRootOfTheModel(), obj); final IHandler currentHandler = getActiveHandler(); if (currentHandler == null) { } else { Assert.assertFalse("We can delete the root of the model. It is not the wanted behavior", currentHandler.isEnabled()); } }
Source:
<code>public Calendar getCalendarService(Credential credential) throws GeneralSecurityException, IOException { HttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport(); return new Calendar.Builder( <START> HTTP_TRANSPORT, JSON_FACTORY, credential) <END> .setApplicationName(APPLICATION_NAME) .build(); }</code><technical_language>pls move previous line, is indent subsequent method chaining good</technical_language>

Target:
public Calendar getCalendarService(Credential credential) throws GeneralSecurityException, IOException { HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); return new Calendar.Builder(httpTransport, JSON_FACTORY, credential) .setApplicationName(APPLICATION_NAME) .build(); }
Source:
<code>private static Object[][] failsWithoutWrappers(){ return new Object[][] { {MANGLED_VCF, VCF_INDEX, new VCFCodec()}, <START> {VCF, MANGLED_VCF_INDEX, new VCFCodec()}, <END> }; }</code><technical_language>Test mangled tabix inputs</technical_language>

Target:
private static Object[][] failsWithoutWrappers(){ return new Object[][] { {MANGLED_VCF, MANGLED_VCF_INDEX}, {VCF, MANGLED_VCF_INDEX}, {MANGLED_VCF, VCF_INDEX}, {MANGLED_VCF_TABIX_BLOCK_GZIPPED, MANGLED_VCF_TABIX_INDEX}, {VCF_TABIX_BLOCK_GZIPPED, MANGLED_VCF_TABIX_INDEX}, {MANGLED_VCF_TABIX_BLOCK_GZIPPED, VCF_TABIX_INDEX}, }; }
Source:
<code>public Object register(Object obj, Runnable action) { try { Object cleaner = createMtd.invoke(null); registerMtd.invoke(cleaner, obj, action); return cleaner; } catch (IllegalAccessException | InvocationTargetException e) { <START> e.printStackTrace(); <END> throw new RuntimeException("Reflection failure: invoke java.lang.ref.Cleaner method failed", e); } }</code><technical_language>I want this print in rethrow a</technical_language>

Target:
public Object register(Object obj, Runnable action) { try { Object cleaner = createMtd.invoke(null); registerMtd.invoke(cleaner, obj, action); return cleaner; } catch (IllegalAccessException | InvocationTargetException e) { throw new RuntimeException("Reflection failure: invoke java.lang.ref.Cleaner method failed", e); } }
Source:
<code>public void testExecuteQueryComplete() throws InterruptedException { AsyncQuery queryObj = mock(AsyncQuery.class); <START> when(resultStorageEngine.supportedResultTypes()).thenReturn(EnumSet.of(ResultType.EMBEDDED, <END> ResultType.DOWNLOAD)); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; when(queryObj.getQuery()).thenReturn(query); when(queryObj.getId()).thenReturn(id); when(queryObj.getRequestId()).thenReturn(id); when(queryObj.getQueryType()).thenReturn(QueryType.JSONAPI_V1_0); when(queryObj.getAsyncAfterSeconds()).thenReturn(10); when(queryObj.getResultType()).thenReturn(ResultType.EMBEDDED); service.executeQuery(queryObj, testUser, NO_VERSION); verify(queryObj, times(1)).setStatus(QueryStatus.COMPLETE); }</code><technical_language>Do tests for result types: embedded download</technical_language>

Target:
public void testExecuteQueryComplete() throws InterruptedException { AsyncQuery queryObj = mock(AsyncQuery.class); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; when(queryObj.getQuery()).thenReturn(query); when(queryObj.getId()).thenReturn(id); when(queryObj.getRequestId()).thenReturn(id); when(queryObj.getQueryType()).thenReturn(QueryType.JSONAPI_V1_0); when(queryObj.getAsyncAfterSeconds()).thenReturn(10); service.executeQuery(queryObj, testUser, NO_VERSION, any()); verify(queryObj, times(1)).setStatus(QueryStatus.COMPLETE); }
Source:
<code>public void sendSyncAckMessageIfNecessary() { synchronized (this.messagesLock) { if (!this.successfulSyncIds.isEmpty() || !this.failedSyncIds.isEmpty()) { log.debug( "Sending sync acknowledgment for successful messages and failed messages {}", this.successfulSyncIds, this.failedSyncIds ); this.responseObserver.onNext( SyncResponse .newBuilder() .setUploadAck( UploadAcknowledgement .newBuilder() .addAllSucessfulIds(this.successfulSyncIds) .addAllUnsuccessfulIds(this.failedSyncIds) .build() ) .build() ); this.successfulSyncIds.clear(); this.failedSyncIds.clear(); <START> } <END> } }</code><technical_language>add a WARN if this condition is true</technical_language>

Target:
public void sendSyncAckMessageIfNecessary() { synchronized (this.messagesLock) { if (!this.requestResults.isEmpty()) { log.debug("Sending sync acknowledgment for messages {}", this.requestResults); this.responseObserver.onNext( SyncResponse .newBuilder() .setSyncAck( SyncAcknowledgement .newBuilder() .addAllResults(this.requestResults) .build() ) .build() ); this.requestResults.clear(); } } }
Source:
<code>public static <V> V adapt(Object object, Class<V> target) { if (object == null) { return null; } if (target.isInstance(object)) { return target.cast(object); } if (object instanceof IAdaptable) { V adapter = Utils.getAdapter(((IAdaptable) object), target); <START> if (adapter != null) { <END> return adapter; } } Object adapted = Platform.getAdapterManager().getAdapter(object, target); return target.cast(adapted); }</code><technical_language>good. if (adapter != null || object instanceof PlatformObject) { Compare org.eclipse.core.runtime.Adapters (since 3.8 only, unfortunately)</technical_language>

Target:
public static <V> V adapt(Object object, Class<V> target) { if (object == null) { return null; } if (target.isInstance(object)) { return target.cast(object); } if (object instanceof IAdaptable) { V adapter = Utils.getAdapter(((IAdaptable) object), target); if (adapter != null || object instanceof PlatformObject) { return adapter; } } Object adapted = Platform.getAdapterManager().getAdapter(object, target); return target.cast(adapted); }
Source:
<code>public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, Version hostOs) { boolean alert = false; for (RpmVersion iso: isos) { if (iso.getMajor() == hostOs.getMajor() && <START> iso.compareTo(hostOs) != 0) { <END> alert = true; break; } } return alert; }</code><technical_language>changed > !=</technical_language>

Target:
public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, Version hostOs) { boolean alert = false; for (RpmVersion iso: isos) { if (iso.getMajor() == hostOs.getMajor() && iso.compareTo(hostOs) > 0) { alert = true; break; } } return alert; }
Source:
<code>public ServerCpu getServerCpuByName(String cpuName) { ServerCpu result = null; <START> if (!StringUtils.isEmpty(cpuName)) { <END> result = intelCpuByNameDictionary.get(cpuName); if (result == null) { result = amdCpuByNameDictionary.get(cpuName); } if (result == null) { result = ibmCpuByNameDictionary.get(cpuName); } if (result == null) { result = s390CpuByNameDictionary.get(cpuName); } } return result; }</code><technical_language>more readable "isNotEmpty()" instead of "!isEmpty()"</technical_language>

Target:
public ServerCpu getServerCpuByName(String cpuName) { ServerCpu result = null; if (StringUtils.isNotEmpty(cpuName)) { result = intelCpuByNameDictionary.get(cpuName); if (result == null) { result = amdCpuByNameDictionary.get(cpuName); } if (result == null) { result = ibmCpuByNameDictionary.get(cpuName); } if (result == null) { result = s390CpuByNameDictionary.get(cpuName); } } return result; }
Source:
<code>public void testDelaySubscription() { TestScheduler scheduler = new TestScheduler(); Completable result = Completable.complete() .delaySubscription(100, TimeUnit.MILLISECONDS, scheduler); Observer<Void> o = TestHelper.mockObserver(); TestObserver<Void> to = new TestObserver<Void>(o); result.subscribe(to); scheduler.advanceTimeBy(90, TimeUnit.MILLISECONDS); to.assertEmpty(); scheduler.advanceTimeBy(15, TimeUnit.MILLISECONDS); to.assertComplete(); <START> verify(o, never()).onError(any(Throwable.class)); <END> }</code><technical_language>need talk a mocked observer, TestObserver.assertEmpty() verifies these</technical_language>

Target:
public void testDelaySubscription() { TestScheduler scheduler = new TestScheduler(); Completable result = Completable.complete() .delaySubscription(100, TimeUnit.MILLISECONDS, scheduler); TestObserver<Void> to = result.test(); scheduler.advanceTimeBy(90, TimeUnit.MILLISECONDS); to.assertEmpty(); scheduler.advanceTimeBy(15, TimeUnit.MILLISECONDS); to.assertResult(); }