auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void numberOfJsonObjectsInResultArrayProducesEqualLengthList() throws Exception { JsonObject result = new JsonObject(); JsonArray results = new JsonArray(); for(int i = 1; i<=3; i++) { JsonObject element = new JsonObject(); element.addProperty("experiment_accession", "e"+ i); element.addProperty("contrast_id", "c"+ i); element.addProperty("bioentity_identifier", "id"+ i); element.addProperty("species", "org"+ i); element.addProperty("p_value", 1.11); element.addProperty("fold_change", -1.12); element.addProperty("t_statistic", 0.0); element.addProperty("keyword_symbol", i); results.add(element); <START> } <END> result.add("results", results); List<DiffAnalytics> expression = subject.parseDifferentialResults(result); assertThat(expression,hasSize(3)); }</code><technical_language>Refactor this loop a utilitiy method returns synthetic test data of size instead</technical_language>

Target:
public void numberOfJsonObjectsInResultArrayProducesEqualLengthList() throws Exception { JsonObject result = buildJsonObject(3,false); List<DiffAnalytics> expression = subject.parseDifferentialResults(result); assertThat(expression,hasSize(3)); }
Source:
<code>private void validateInputSchema(@Nullable Schema inputSchema) { <START> if (inputSchema != null) { <END> Schema.Field inputSchemaField = inputSchema.getField(config.bodyField); if (inputSchemaField == null) { throw new IllegalArgumentException( "Field " + config.bodyField + " is not present in the input schema"); } Schema fieldSchema = inputSchemaField.getSchema(); Schema.Type fieldType = fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (!fieldType.isSimpleType()) { throw new IllegalArgumentException(String.format( "Type %s for field %s is not supported. Supported types are Int, long, float, string, Bytes", fieldType, config.bodyField)); } } }</code><technical_language>inputSchema is null? Also, reduce indentation, prefer: if (inputSchema == null) { return; } // Rest of logic ..</technical_language>

Target:
private void validateInputSchema(@Nullable Schema inputSchema) { if (inputSchema == null) { return; } Schema.Field inputSchemaField = inputSchema.getField(config.bodyField); if (inputSchemaField == null) { throw new IllegalArgumentException( "Field " + config.bodyField + " is not present in the input schema"); } Schema fieldSchema = inputSchemaField.getSchema(); Schema.Type fieldType = fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (!fieldType.isSimpleType()) { throw new IllegalArgumentException(String.format( "Type %s for field %s is not supported. Supported types are %s, %s, %s, %s, %s, %s, %s", Schema.Type.BOOLEAN, Schema.Type.INT, Schema.Type.LONG, Schema.Type.FLOAT, Schema.Type.DOUBLE, Schema.Type.STRING, Schema.Type.BYTES, fieldType, config.bodyField)); } }
Source:
<code>private String getProjectDefaultLicenseInfoHeaderText() { String defaultLicenseInfoHeader = ""; try { <START> defaultLicenseInfoHeader = (new LicenseInfoHandler()).getDefaultLicenseInfoHeaderText(); <END> } catch (IOException e) { log.error("Could not load default license info header text.", e); } return defaultLicenseInfoHeader; }</code><technical_language>I find a bad idea add a dependency sw360-portlet a backend service implementation access some resource. Please move resource remove dependency</technical_language>

Target:
private String getProjectDefaultLicenseInfoHeaderText() { final LicenseInfoService.Iface licenseInfoClient = thriftClients.makeLicenseInfoClient(); try { String defaultLicenseInfoHeaderText = licenseInfoClient.getDefaultLicenseInfoHeaderText(); return defaultLicenseInfoHeaderText; } catch (TException e) { log.error("Could not load default license info header text from backend.", e); return ""; } }
Source:
<code>private void validateEntrypointSelector(Tool tool, List<HasMetadata> filteredObjects) throws DevfileFormatException { if (tool.getEntrypoints() == null || tool.getEntrypoints().isEmpty()) { return; } for (Entrypoint ep : tool.getEntrypoints()) { ContainerSearch search = new ContainerSearch( ep.getDeployment(), ep.getPod(), ep.getContainer(), ep.getPodSelector(), ep.getDeploymentSelector()); List<Container> cs = search.search(filteredObjects); if (cs.isEmpty()) { throw new DevfileFormatException( format( "Tool %s contains an entry point that doesn't match any container: %s", <START> tool.getName(), toYAML(ep))); <END> } } }</code><technical_language>Please check yaml inlined in error message good enough</technical_language>

Target:
private void validateEntrypointSelector(Tool tool, List<HasMetadata> filteredObjects) throws DevfileException { if (tool.getEntrypoints() == null || tool.getEntrypoints().isEmpty()) { return; } for (Entrypoint ep : tool.getEntrypoints()) { ContainerSearch search = new ContainerSearch(ep.getParentName(), ep.getParentSelector(), ep.getContainerName()); List<Container> cs = search.search(filteredObjects); if (cs.isEmpty()) { throw new DevfileFormatException( format( "Tool %s contains an entry point that doesn't match any container:\n%s", tool.getName(), toYAML(ep))); } } }
Source:
<code>public boolean abort() { abort = true; this.test.setAborted(true); if (Thread.currentThread() == this.getThread()) { throw new TestException("", Level.SEVERE); } if(OtePropertiesCore.abortMultipleInterrupt.getBooleanValue()){ int count = 0; do{ this.interrupt(); try{ <START> this.join(1000*60); <END> } catch (InterruptedException ex){ } count++; } while (this.isAlive() && count < 200); } else { this.interrupt(); try{ this.join(1000*60); } catch (InterruptedException ex){ } } if (this.isAlive()) { OseeLog.reportStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, "Waited 60s for test to abort but the thread did not die.")); return false; } return true; }</code><technical_language>10</technical_language>

Target:
public boolean abort() { abort = true; this.test.setAborted(true); if (Thread.currentThread() == this.getThread()) { throw new TestException("", Level.SEVERE); } if(OtePropertiesCore.abortMultipleInterrupt.getBooleanValue()){ int count = 0; do{ this.interrupt(); try{ this.join(10); } catch (InterruptedException ex){ } count++; } while (this.isAlive() && count < 200); } else { this.interrupt(); try{ this.join(1000*60); } catch (InterruptedException ex){ } } if (this.isAlive()) { OseeLog.reportStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, "Waited 60s for test to abort but the thread did not die.")); return false; } return true; }
Source:
<code>public WriteOptionsBuilder timestamp(Instant timestamp) { Assert.notNull(timestamp, "Timestamp must not be null"); <START> this.timestamp = timestamp.toEpochMilli() * 1000; <END> return this; }</code><technical_language>TimeUnit.MILLISECONDS.toMicros( )</technical_language>

Target:
public WriteOptionsBuilder timestamp(Instant timestamp) { Assert.notNull(timestamp, "Timestamp must not be null"); this.timestamp = TimeUnit.MILLISECONDS.toMicros(timestamp.toEpochMilli()); return this; }
Source:
<code>private void create() throws Exception { File file = new File(directory, name); if (!file.exists()) { assertTrue("Failed to create file", file.createNewFile()); } long val = lastModified; if (val == Long.MAX_VALUE) { val = System.currentTimeMillis(); } assertTrue("Failed to set modification time", file.setLastModified(val)); try { int s = Integer.parseInt(size); if (s > 0) { FileOutputStream out = new FileOutputStream(file); byte[] buffer = new byte[s]; out.write(buffer); out.close(); } <START> } catch (NumberFormatException e) { <END> } }</code><technical_language>empty catch</technical_language>

Target:
private void create() throws Exception { File file = new File(directory, name); if (subdirs != null && subdirs.size() > 0) { assertTrue("Failed to create a directory", file.mkdirs()); for (FileEntry entry : subdirs) { entry.name = name + File.separator + entry.name; entry.create(); } } else { assertTrue("Failed to create file", file.createNewFile()); } long val = lastModified; if (val == Long.MAX_VALUE) { val = System.currentTimeMillis(); } assertTrue("Failed to set modification time", file.setLastModified(val)); if (subdirs == null && size > 0) { try (FileOutputStream out = new FileOutputStream(file)) { byte[] buffer = new byte[size]; out.write(buffer); } } }
Source:
<code>private void processStylers(final Graphics2D graphics, final Layer layer, String layerId) throws Exception { final FeatureSource featureSource = layer.getFeatureSource(); if (featureSource == null) { <START> throw new IllegalArgumentException("The layer does not contain a feature source"); <END> } final FeatureType schema = featureSource.getSchema(); final ArrayList<LiteFeatureTypeStyle> lfts = createLiteFeatureTypeStyles(layer, graphics, isOptimizedFTSRenderingEnabled()); if (lfts.isEmpty()) { return; } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Processing " + lfts.size() + " stylers for " + schema.getName()); } } List<List<LiteFeatureTypeStyle>> txClassified = classifyByFeatureProduction(lfts); for (List<LiteFeatureTypeStyle> uniform : txClassified) { FeatureCollection features = getFeatures(layer, schema, uniform); if (isOptimizedFTSRenderingEnabled() && lfts.size() > 1) { drawOptimized(graphics, layerId, features, uniform); } else { drawPlain(graphics, layerId, features, uniform); } } }</code><technical_language>identify layerId in this exception</technical_language>

Target:
private void processStylers(final Graphics2D graphics, final Layer layer, String layerId) throws Exception { final FeatureSource featureSource = layer.getFeatureSource(); if (featureSource == null) { throw new IllegalArgumentException( "The layer does not contain a feature source: " + layer.getTitle()); } final FeatureType schema = featureSource.getSchema(); final ArrayList<LiteFeatureTypeStyle> lfts = createLiteFeatureTypeStyles(layer, graphics, isOptimizedFTSRenderingEnabled()); if (lfts.isEmpty()) { return; } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Processing " + lfts.size() + " stylers for " + schema.getName()); } } List<List<LiteFeatureTypeStyle>> txClassified = classifyByFeatureProduction(lfts); for (List<LiteFeatureTypeStyle> uniform : txClassified) { FeatureCollection features = getFeatures(layer, schema, uniform); if (isOptimizedFTSRenderingEnabled() && lfts.size() > 1) { drawOptimized(graphics, layerId, features, uniform); } else { drawPlain(graphics, layerId, features, uniform); } } }
Source:
<code>private Workflow manualRegisterAndPublish(WorkflowsApi workflowsApi, String workflowPath, String workflowName, String descriptorType, SourceControl sourceControl, String descriptorPath, boolean toPublish) { Workflow workflow = workflowsApi .manualRegister(sourceControl.getFriendlyName().toLowerCase(), workflowPath, descriptorPath, workflowName, descriptorType, "/test.json"); assertEquals(Workflow.ModeEnum.STUB, workflow.getMode()); workflow = workflowsApi.refresh(workflow.getId()); assertEquals(Workflow.ModeEnum.FULL, workflow.getMode()); if (toPublish) { workflow = workflowsApi.publish(workflow.getId(), SwaggerUtility.createPublishRequest(true)); <START> assertTrue(workflow.isIsPublished()); <END> } return workflow; }</code><technical_language>Trivial nitpick: this out of if more general i.e. assertTrue(workflow.isIsPublished() == toPublish);</technical_language>

Target:
private Workflow manualRegisterAndPublish(WorkflowsApi workflowsApi, String workflowPath, String workflowName, String descriptorType, SourceControl sourceControl, String descriptorPath, boolean toPublish) { Workflow workflow = workflowsApi .manualRegister(sourceControl.getFriendlyName().toLowerCase(), workflowPath, descriptorPath, workflowName, descriptorType, "/test.json"); assertEquals(Workflow.ModeEnum.STUB, workflow.getMode()); workflow = workflowsApi.refresh(workflow.getId()); assertEquals(Workflow.ModeEnum.FULL, workflow.getMode()); if (toPublish) { workflow = workflowsApi.publish(workflow.getId(), SwaggerUtility.createPublishRequest(true)); } assertTrue(workflow.isIsPublished() == toPublish); return workflow; }
Source:
<code>public void cancelScan(UUID originNodeId, String cacheName, long id) { boolean res; try { IgniteClusterImpl cluster = ctx.cluster().get(); <START> ClusterNode srv = U.randomServerNode(ctx); <END> IgniteCompute compute = cluster.compute(); res = compute.execute(new VisorScanQueryCancelTask(), new VisorTaskArgument<>(srv.id(), new VisorScanQueryCancelTaskArg(originNodeId, cacheName, id), false)); } catch (Exception e) { throw new RuntimeException(e); } if (!res) { throw new RuntimeException("Query not found[originNodeId=" + originNodeId + ",cacheName=" + cacheName + ",qryId=" + id + ']'); } }</code><technical_language>do random node here? IMO need send task origin node run GridCacheDistributedQueryFuture#cancelQuery there</technical_language>

Target:
public void cancelScan(UUID originNodeId, String cacheName, long id) { try { IgniteClusterImpl cluster = ctx.cluster().get(); ClusterNode srv = U.randomServerNode(ctx); IgniteCompute compute = cluster.compute(); boolean res = compute.execute(new VisorScanQueryCancelTask(), new VisorTaskArgument<>(srv.id(), new VisorScanQueryCancelTaskArg(originNodeId, cacheName, id), false)); if (!res) { throw new RuntimeException("Query not found[originNodeId=" + originNodeId + ",cacheName=" + cacheName + ",qryId=" + id + ']'); } } catch (IgniteException e) { throw new RuntimeException(e); } }
Source:
<code>public ZKDatabase(FileTxnSnapLog snapLog) { dataTree = new DataTree(); sessionsWithTimeouts = new ConcurrentHashMap<Long, Integer>(); this.snapLog = snapLog; String value = System.getProperty(SNAPSHOT_SIZE_FACTOR, "0.33"); try { snapshotSizeFactor = Double.parseDouble(value); } catch (NumberFormatException e) { <START> LOG.error("Error parsing " + SNAPSHOT_SIZE_FACTOR <END> + " - use default value"); } LOG.info(SNAPSHOT_SIZE_FACTOR + "=" + snapshotSizeFactor); }</code><technical_language>Please parameterized log messages</technical_language>

Target:
public ZKDatabase(FileTxnSnapLog snapLog) { dataTree = new DataTree(); sessionsWithTimeouts = new ConcurrentHashMap<Long, Integer>(); this.snapLog = snapLog; try { snapshotSizeFactor = Double.parseDouble( System.getProperty(SNAPSHOT_SIZE_FACTOR, Double.toString(DEFAULT_SNAPSHOT_SIZE_FACTOR))); if (snapshotSizeFactor > 1) { snapshotSizeFactor = DEFAULT_SNAPSHOT_SIZE_FACTOR; LOG.warn("The configured is invalid, going to use " + "the default {}", SNAPSHOT_SIZE_FACTOR, DEFAULT_SNAPSHOT_SIZE_FACTOR); } } catch (NumberFormatException e) { LOG.error("Error parsing {}, using default value {}", SNAPSHOT_SIZE_FACTOR, DEFAULT_SNAPSHOT_SIZE_FACTOR); snapshotSizeFactor = DEFAULT_SNAPSHOT_SIZE_FACTOR; } LOG.info("{} = {}", SNAPSHOT_SIZE_FACTOR, snapshotSizeFactor); }
Source:
<code>protected void setOrganizationDocumentNumberToPostingDate(CorporateBilledCorporatePaidDocument cbcpDoc, Date transactionPostingDate) { if (transactionPostingDate != null) { cbcpDoc.getDocumentHeader().setOrganizationDocumentNumber(getDateFormat().format(transactionPostingDate)); } else { <START> LOG.error("setDocumentOrgDocumentNumber, unable to set the org document number, the posting date is null."); <END> } }</code><technical_language>Method name in error message match of enclosing method</technical_language>

Target:
protected void setOrganizationDocumentNumberToPostingDate(CorporateBilledCorporatePaidDocument cbcpDoc, Date transactionPostingDate) { if (transactionPostingDate != null) { cbcpDoc.getDocumentHeader().setOrganizationDocumentNumber(getDateFormat().format(transactionPostingDate)); } else { LOG.error("setOrganizationDocumentNumberToPostingDate, unable to set the org document number, the posting date is null."); } }
Source:
<code>public ParametersAction merge(@CheckForNull ParametersAction overrides) { if (overrides == null) { ParametersAction parametersAction = new ParametersAction(parameters); <START> loadSafeParameters(); <END> parametersAction.safeParameters = this.safeParameters; return parametersAction; } ParametersAction parametersAction = createUpdated(overrides.parameters); Set<String> safe = new TreeSet<>(); if (parametersAction.safeParameters != null) { safe.addAll(this.safeParameters); } overrides.loadSafeParameters(); if (overrides.safeParameters != null) { safe.addAll(overrides.safeParameters); } parametersAction.safeParameters = safe; return parametersAction; }</code><technical_language><code>getSafeParameters()</code> logic inside</technical_language>

Target:
public ParametersAction merge(@CheckForNull ParametersAction overrides) { if (overrides == null) { ParametersAction parametersAction = new ParametersAction(parameters, this.safeParameters); return parametersAction; } ParametersAction parametersAction = createUpdated(overrides.parameters); Set<String> safe = new TreeSet<>(); if (parametersAction.safeParameters != null && this.safeParameters != null) { safe.addAll(this.safeParameters); } if (overrides.safeParameters != null) { safe.addAll(overrides.safeParameters); } parametersAction.safeParameters = safe; return parametersAction; }
Source:
<code>public ThriftServerDef build() { checkState(niftyProcessorFactory != null || thriftProcessorFactory != null, "Processor not defined!"); checkState(niftyProcessorFactory == null || thriftProcessorFactory == null, "TProcessors will be automatically adapted to NiftyProcessors, don't specify both"); if (niftyProcessorFactory == null) { niftyProcessorFactory = factoryFromTProcessorFactory(thriftProcessorFactory); } return new ThriftServerDef( name, serverPort, maxFrameSize, queuedResponseLimit, <START> maxConnections, <END> niftyProcessorFactory, duplexProtocolFactory, clientIdleTimeout, thriftFrameCodecFactory, executor); }</code><technical_language>check maxConnections >= 0</technical_language>

Target:
public ThriftServerDef build() { checkState(niftyProcessorFactory != null || thriftProcessorFactory != null, "Processor not defined!"); checkState(niftyProcessorFactory == null || thriftProcessorFactory == null, "TProcessors will be automatically adapted to NiftyProcessors, don't specify both"); checkState(maxConnections >= 0, "maxConnections should be 0 (for unlimited) or positive"); if (niftyProcessorFactory == null) { niftyProcessorFactory = factoryFromTProcessorFactory(thriftProcessorFactory); } return new ThriftServerDef( name, serverPort, maxFrameSize, queuedResponseLimit, maxConnections, niftyProcessorFactory, duplexProtocolFactory, clientIdleTimeout, thriftFrameCodecFactory, executor); }
Source:
<code>private void onGetUserNameFinish(RemoteOperationResult result) { mWaitingForOpId = Long.MAX_VALUE; if (result.isSuccess()) { boolean success = false; String username = ((UserInfo) result.getData().get(0)).mDisplayName; if ( mAction == ACTION_CREATE) { mUsernameInput.setText(username); success = createAccount(result); } else { if (!mUsernameInput.getText().toString().trim().equals(username)) { result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME); mAuthToken = ""; updateAuthStatusIconAndText(result); showAuthStatus(); Log_OC.d(TAG, result.getLogMessage()); } else { try { updateAccountAuthentication(); success = true; } catch (AccountNotFoundException e) { Log_OC.e(TAG, "Account " + mAccount + " was removed!", e); Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show(); finish(); } } } if (success) finish(); } else { <START> int statusText = result.getCode() == ResultCode.MAINTENANCE_MODE ? R.string.maintenance_mode : R.string.auth_fail_get_user_name; <END> updateStatusIconFailUserName(statusText); showAuthStatus(); Log_OC.e(TAG, "Access to user name failed: " + result.getLogMessage()); } }</code><technical_language>Line long, please wrap 120 characters</technical_language>

Target:
private void onGetUserNameFinish(RemoteOperationResult result) { mWaitingForOpId = Long.MAX_VALUE; if (result.isSuccess()) { boolean success = false; String username = ((UserInfo) result.getData().get(0)).mDisplayName; if ( mAction == ACTION_CREATE) { mUsernameInput.setText(username); success = createAccount(result); } else { if (!mUsernameInput.getText().toString().trim().equals(username)) { result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME); mAuthToken = ""; updateAuthStatusIconAndText(result); showAuthStatus(); Log_OC.d(TAG, result.getLogMessage()); } else { try { updateAccountAuthentication(); success = true; } catch (AccountNotFoundException e) { Log_OC.e(TAG, "Account " + mAccount + " was removed!", e); Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show(); finish(); } } } if (success) finish(); } else { int failedStatusText = result.getCode() == ResultCode.MAINTENANCE_MODE ? R.string.maintenance_mode : R.string.auth_fail_get_user_name; updateFailedAuthStatusIconAndText(failedStatusText); showAuthStatus(); Log_OC.e(TAG, "Access to user name failed: " + result.getLogMessage()); } }
Source:
<code>public static void main(String[] args) { NavigatorPlugin plugin = NavigatorPlugin.fromConfigFile(args[0]); NavApiCient client = plugin.getClient(); Source fs = client.getSourcesForType(SourceType.HDFS).iterator().next(); HdfsEntity dir = new HdfsEntity("/user/hdfs", EntityType .DIRECTORY, fs.getIdentity()); <START> dir.setTags(Sets.newHashSet("TAG_1", <END> "TAG_2")); ResultSet results = plugin.write(dir); if (results.hasErrors()) { throw new RuntimeException(results.toString()); } }</code><technical_language>tag names ? :smile:</technical_language>

Target:
public static void main(String[] args) { NavigatorPlugin plugin = NavigatorPlugin.fromConfigFile(args[0]); NavApiCient client = plugin.getClient(); Source fs = client.getSourcesForType(SourceType.HDFS).iterator().next(); HdfsEntity dir = new HdfsEntity("/user/hdfs", EntityType .DIRECTORY, fs.getIdentity()); dir.setTags(Sets.newHashSet("HAS_SENSITIVE_FILES", "CONTAINS_SOME_SUPER_SECRET_STUFF")); ResultSet results = plugin.write(dir); if (results.hasErrors()) { throw new RuntimeException(results.toString()); } }
Source:
<code>public void shutdown() { <START> GerritServer server = PluginImpl.getInstance().getServer(serverName); <END> if (server != null) { server.removeListener((GerritEventListener)this); } else { logger.error("Could not find server {}", serverName); } }</code><technical_language>CheckForNull</technical_language>

Target:
public void shutdown() { GerritServer server = PluginImpl.getServer_(serverName); if (server != null) { server.removeListener((GerritEventListener)this); } else { logger.error("Could not find server {}", serverName); } }
Source:
<code>public String getToolTipText() { if (tooltip == null) { if (base == null) { tooltip = MessageFormat.format(UIText.DiffEditorInput_Tooltip1, <START> tip.getObjectId().abbreviate(7).name(), GitLabels.getPlainShortLabel(tip.getRepository())); } else { tooltip = MessageFormat.format( UIText.DiffEditorInput_Tooltip2, base.getObjectId().abbreviate(7).name(), tip.getObjectId().abbreviate(7).name(), <END> GitLabels.getPlainShortLabel(tip.getRepository())); } } return tooltip; }</code><technical_language>missed</technical_language>

Target:
public String getToolTipText() { if (tooltip == null) { if (base == null) { tooltip = MessageFormat.format(UIText.DiffEditorInput_Tooltip1, Utils.getShortObjectId(tip.getObjectId()), GitLabels.getPlainShortLabel(tip.getRepository())); } else { tooltip = MessageFormat.format( UIText.DiffEditorInput_Tooltip2, Utils.getShortObjectId(base.getObjectId()), Utils.getShortObjectId(tip.getObjectId()), GitLabels.getPlainShortLabel(tip.getRepository())); } } return tooltip; }
Source:
<code>public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { final User workingUser = scoreDirector.lookUpWorkingObjectOrReturnNull(user); <START> if (workingUser != null) { <END> scoreDirector.beforeProblemPropertyChanged(workingUser); workingUser.setEnabled(enabled); workingUser.setAllLabelValues(labelValues); workingUser.setAttributes(attributes); workingUser.setGroups(groups); scoreDirector.afterProblemPropertyChanged(workingUser); releaseNonPinnedTasks(workingUser, scoreDirector); scoreDirector.triggerVariableListeners(); } }</code><technical_language>suggestion nesting</technical_language>

Target:
public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { final User workingUser = scoreDirector.lookUpWorkingObjectOrReturnNull(user); if (workingUser == null) { return; } scoreDirector.beforeProblemPropertyChanged(workingUser); workingUser.setEnabled(enabled); workingUser.setAllLabelValues(labelValues); workingUser.setAttributes(attributes); workingUser.setGroups(groups); scoreDirector.afterProblemPropertyChanged(workingUser); releaseNonPinnedTasks(workingUser, scoreDirector); scoreDirector.triggerVariableListeners(); }
Source:
<code>public void checkClassInterfaces(ClassTree tree) { List<InterfaceTreeAndStringPairReport> reportTreeAndStringInterfaces = new ArrayList<>(); List<TypeTree> interfacesList = tree.superInterfaces(); if (!interfacesList.isEmpty()) { <START> IntStream.range(0, interfacesList.size()) <END> .forEach(i -> { JavaType jt = (JavaType) tree.symbol().interfaces().get(i); if (jt.isParameterized()) { Optional<String> reportString = matchFunctionalInterface(jt); reportString.ifPresent(rs -> reportTreeAndStringInterfaces.add(new InterfaceTreeAndStringPairReport(rs, interfacesList.get(i)))); } }); } if (!reportTreeAndStringInterfaces.isEmpty()) { List<JavaFileScannerContext.Location> flow = reportTreeAndStringInterfaces.stream() .map(interf -> new JavaFileScannerContext.Location("", interf.classInterface)) .collect(Collectors.toList()); reportIssue(tree.simpleName(), reportMessage(reportTreeAndStringInterfaces), flow, null); } }</code><technical_language>need that, interfaces trees, symbols. guarantee list in symbol is ordered way</technical_language>

Target:
public void checkClassInterfaces(ClassTree tree) { List<InterfaceTreeAndStringPairReport> reportTreeAndStringInterfaces = tree.superInterfaces().stream() .map(typeTree -> matchFunctionalInterface(typeTree.symbolType()).map(rs -> new InterfaceTreeAndStringPairReport(rs, typeTree)).orElse(null)) .filter(Objects::nonNull) .collect(Collectors.toList()); if (reportTreeAndStringInterfaces.isEmpty()) { return; } List<JavaFileScannerContext.Location> secondaryLocations = reportTreeAndStringInterfaces.stream() .map(interf -> new JavaFileScannerContext.Location("", interf.classInterface)) .collect(Collectors.toList()); reportIssue(tree.simpleName(), reportMessage(reportTreeAndStringInterfaces), secondaryLocations, null); }
Source:
<code>public List<Command> handle(final List<Command> commands) { active = true; try { final List<Command> results = new LinkedList<>(); <START> for (Command command : commands) { <END> results.addAll(serverConnector.receive(command)); hasResponseCommands = !results.isEmpty(); } return results; } finally { active = false; } }</code><technical_language>Add final keyword</technical_language>

Target:
public List<Command> handle(final List<Command> commands) { active = true; try { final List<Command> results = new LinkedList<>(); for (final Command command : commands) { results.addAll(serverConnector.receive(command)); hasResponseCommands = !results.isEmpty(); } return results; } finally { active = false; } }
Source:
<code>static Integer runCli( List<String> args, Map<String, String> params, String workingDir ) { ArrayList<String> arguments = new ArrayList<>( args ); <START> if (params.size() > 0 ) <END> { Collections.addAll( arguments, toJavaParams( params ).split( "\\s+" ) ); } boolean argsContainsFile = false; for ( String s : args) { if ( s.startsWith( "--file" ) ) { argsContainsFile = true; break; } } if ( ! argsContainsFile ) { arguments.add( "--log=" + workingDir + File.separator + "build.log" ); arguments.add( "--file=" + workingDir + File.separator + "pom.xml" ); } logger.info( "Invoking CLI with ", arguments ); Cli cli = new Cli(); int result = cli.run( arguments.toArray( new String[0] ) ); final ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( org.slf4j.Logger.ROOT_LOGGER_NAME ); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.reset(); PatternLayoutEncoder ple = new PatternLayoutEncoder(); ple.setPattern( "[%t] %level %logger{32} - %msg%n" ); ple.setContext( loggerContext ); ple.start(); ConsoleAppender<ILoggingEvent> consoleAppender = new ConsoleAppender<>(); consoleAppender.setEncoder( ple ); consoleAppender.setContext( loggerContext ); consoleAppender.start(); root.addAppender( consoleAppender ); root.setLevel( Level.DEBUG ); return result; }</code><technical_language>minor, I prefer !isEmpty() size() > 0. I checked HashMap literally checks size == 0, essentially same, for some things, imagine performance. Also, logically I more sense is tested</technical_language>

Target:
static Integer runCli( List<String> args, Map<String, String> params, String workingDir ) { ArrayList<String> arguments = new ArrayList<>( args ); if (!params.isEmpty() ) { Collections.addAll( arguments, toJavaParams( params ).split( "\\s+" ) ); } boolean argsContainsFile = false; for ( String s : args) { if ( s.startsWith( "--file" ) ) { argsContainsFile = true; break; } } if ( ! argsContainsFile ) { arguments.add( "--log=" + workingDir + File.separator + "build.log" ); arguments.add( "--file=" + workingDir + File.separator + "pom.xml" ); } logger.info( "Invoking CLI with ", arguments ); Cli cli = new Cli(); int result = cli.run( arguments.toArray( new String[0] ) ); final ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( org.slf4j.Logger.ROOT_LOGGER_NAME ); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.reset(); PatternLayoutEncoder ple = new PatternLayoutEncoder(); ple.setPattern( "[%t] %level %logger{32} - %msg%n" ); ple.setContext( loggerContext ); ple.start(); ConsoleAppender<ILoggingEvent> consoleAppender = new ConsoleAppender<>(); consoleAppender.setEncoder( ple ); consoleAppender.setContext( loggerContext ); consoleAppender.start(); root.addAppender( consoleAppender ); root.setLevel( Level.DEBUG ); return result; }
Source:
<code>private Review processAdditionalReviewFields( ReviewType reviewType, Review.Builder builder, Element filmElement ) { Element author = filmElement.getFirstChildElement(reviewType.authorTag()); Element authorInitials = filmElement.getFirstChildElement(reviewType.authorInitialsTag()); <START> Element rating = filmElement.getFirstChildElement("rating"); <END> if (hasValue(author)) { builder.withAuthor(author.getValue()); } if (hasValue(authorInitials)) { builder.withAuthorInitials(authorInitials.getValue()); } if (hasValue(rating)) { builder.withRating(rating.getValue()); } if (reviewType.equals(ReviewType.FOTD_REVIEW)) { Element reviewDate = filmElement.getFirstChildElement(reviewType.dateTag()); if (hasValue(reviewDate)) { builder.withDate(Date.from(Instant.parse(reviewDate.getValue()))); } } return builder.build(); }</code><technical_language>add a method ReviewType get rating tag, for consistency</technical_language>

Target:
private Review processAdditionalReviewFields( ReviewType reviewType, Review.Builder builder, Element filmElement ) { Element author = filmElement.getFirstChildElement(reviewType.authorTag()); Element authorInitials = filmElement.getFirstChildElement(reviewType.authorInitialsTag()); Element rating = filmElement.getFirstChildElement("rating"); if (hasValue(author)) { builder.withAuthor(author.getValue()); } if (hasValue(authorInitials)) { builder.withAuthorInitials(authorInitials.getValue()); } if (hasValue(rating)) { builder.withRating(rating.getValue()); } if (reviewType.equals(ReviewType.FOTD_REVIEW)) { Element reviewDate = filmElement.getFirstChildElement(reviewType.dateTag()); if (hasValue(reviewDate)) { DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy"); try { builder.withDate(dateFormat.parse(reviewDate.getValue())); } catch (ParseException e) { } } } return builder.build(); }
Source:
<code>private static InternalLoggerFactory newDefaultFactory(String name) { <START> return JdkLoggerFactory.INSTANCE; <END> }</code><technical_language>do in original implementation log JDK implementation ? java InternalLoggerFactory f = JdkLoggerFactory.INSTANCE; f.newInstance(name).debug("Using java.util.logging default logging framework"); return f;</technical_language>

Target:
private static InternalLoggerFactory newDefaultFactory(String name) { InternalLoggerFactory f = JdkLoggerFactory.INSTANCE; f.newInstance(name).debug("Using java.util.logging as the default logging framework"); return f; }
Source:
<code>public String formatValue(String key, Object value) { if (key.equals(Command.KEY_ENABLE)) { return (Boolean) value ? "1" : "0"; } else if (key.equals(Command.KEY_TIMEZONE)) { <START> return String.format("%+03d", TimeZone.getTimeZone(value.toString()).getRawOffset() / 3600000); <END> } else if (key.equals(Command.KEY_INDEX)) { switch (((Number) value).intValue()) { case 0: return "A"; case 1: return "B"; case 2: return "C"; default: return null; } } return null; }</code><technical_language>do need call toString()? for other places well</technical_language>

Target:
public String formatValue(String key, Object value) { if (key.equals(Command.KEY_ENABLE)) { return (Boolean) value ? "1" : "0"; } else if (key.equals(Command.KEY_TIMEZONE)) { return String.format("%+03d", TimeZone.getTimeZone((String) value).getRawOffset() / 3600000); } else if (key.equals(Command.KEY_INDEX)) { switch (((Number) value).intValue()) { case 0: return "A"; case 1: return "B"; case 2: return "C"; default: return null; } } return null; }
Source:
<code>public void testReturnContainerRamLimitAndRequest() { long limit = Containers.getRamLimit(container); <START> long request = (Containers.getRamRequest(container)); <END> assertEquals(limit, RAM_LIMIT); assertEquals(request, RAM_REQUEST); }</code><technical_language>is this surrounded parenthesis</technical_language>

Target:
public void testReturnContainerRamLimitAndRequest() { long limit = Containers.getRamLimit(container); long request = Containers.getRamRequest(container); assertEquals(limit, RAM_LIMIT); assertEquals(request, RAM_REQUEST); }
Source:
<code>public BowShootHandler onShoot() { return (e, n) -> { Collection<Entity> entites = n.getWorld().getNearbyEntities(n.getLocation(), range.getValue(), range.getValue(), range.getValue(), entity -> entity instanceof LivingEntity); for (Entity entity : entites) { <START> if (entity.isValid() && entity instanceof LivingEntity) { <END> LivingEntity entityL = (LivingEntity) entity; double distance = entityL.getLocation().distance(n.getLocation()); double damage = calculateDamage(distance, e.getDamage()); Vector distanceVector = entityL.getLocation().toVector().subtract(n.getLocation().toVector()); distanceVector.setY(distanceVector.getY() + 0.6D); Vector entityVelocity = entityL.getVelocity(); Vector knockback = entityVelocity.add(distanceVector.normalize().multiply((int) (e.getDamage() / Math.round(damage)))); entityL.setVelocity(knockback); entityL.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, entityL.getLocation(), 1); entityL.getWorld().playSound(entityL.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1F, 1F); if (!entityL.getUniqueId().equals(n.getUniqueId())) { entityL.damage(damage); EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(e.getDamager(), entityL, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, damage); Bukkit.getPluginManager().callEvent(damageEvent); } } } }; }</code><technical_language>This "instanceof LivingEntity" check is redundant, this in Predicate above</technical_language>

Target:
public BowShootHandler onShoot() { return (e, target) -> { target.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation(), 1); target.getWorld().playSound(target.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1F, 1F); Collection<Entity> entites = target.getWorld().getNearbyEntities(target.getLocation(), range.getValue(), range.getValue(), range.getValue(), entity -> entity instanceof LivingEntity && entity.isValid()); for (Entity entity : entites) { LivingEntity entityL = (LivingEntity) entity; Vector distanceVector = entityL.getLocation().toVector().subtract(target.getLocation().toVector()); distanceVector.setY(distanceVector.getY() + 0.6D); Vector entityVelocity = entityL.getVelocity(); double distanceSquared = distanceVector.lengthSquared(); double damage = calculateDamage(distanceSquared, e.getDamage()); Vector knockback = entityVelocity.add(distanceVector.normalize().multiply((int) (e.getDamage() / damage))); entityL.setVelocity(knockback); if (!entityL.getUniqueId().equals(target.getUniqueId())) { EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(e.getDamager(), entityL, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, damage); Bukkit.getPluginManager().callEvent(damageEvent); if (!damageEvent.isCancelled()) { entityL.damage(damageEvent.getDamage()); } } } }; }
Source:
<code>private String getOutput(Process process, String correlationId) throws IOException { final String ERROR_PREFIX = "error"; String output; BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); <START> while ((output = br.readLine()) != null) { <END> if (output.startsWith(ERROR_PREFIX)) { output = output.substring(ERROR_PREFIX.length() + 1); break; } else if (output.startsWith(correlationId)) { output = output.substring(correlationId.length() + 1); break; } } return output; }</code><technical_language>A newline "while" statement</technical_language>

Target:
private String getOutput(Process process, String correlationId) throws IOException { final String ERROR_PREFIX = "error"; String output; BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); while ((output = br.readLine()) != null) { if (output.startsWith(ERROR_PREFIX)) { return output.substring(ERROR_PREFIX.length() + 1); } else if (output.startsWith(correlationId)) { return output.substring(correlationId.length() + 1); } log.debug("ignored cinderlib output: {}", output); } return ""; }
Source:
<code>public Consent createConsentForDataset(DataSetDTO dataset) { String consentId = UUID.randomUUID().toString(); Optional<DataSetPropertyDTO> nameProp = dataset.getProperties() .stream() .filter(p -> p.getPropertyName().equalsIgnoreCase(DATASET_NAME_KEY)) .findFirst(); String groupName = nameProp.isPresent() ? nameProp.get().getPropertyValue() : dataset.getAlias(); String name = CONSENT_NAME_PREFIX + dataset.getDataSetId(); Date createDate = new Date(); if (Objects.nonNull(dataset.getDataUse())) { boolean manualReview = isConsentDataUseManualReview(dataset.getDataUse()); consentDAO.insertConsent(consentId, manualReview, null, dataset.getDataUse().toString(), null, name, null, createDate, createDate, null, true, groupName, dataset.getDacId()); String associationType = AssociationType.SAMPLESET.getValue(); consentDAO.insertConsentAssociation(consentId, associationType, dataset.getDacId()); return consentDAO.findConsentById(consentId); } else { <START> throw new NullPointerException("Dataset is missing Data Use information. Consent could not be created."); <END> } }</code><technical_language>This IllegalArgumentException</technical_language>

Target:
public Consent createConsentForDataset(DataSetDTO dataset) { String consentId = UUID.randomUUID().toString(); Optional<DataSetPropertyDTO> nameProp = dataset.getProperties() .stream() .filter(p -> p.getPropertyName().equalsIgnoreCase(DATASET_NAME_KEY)) .findFirst(); String groupName = nameProp.isPresent() ? nameProp.get().getPropertyValue() : dataset.getAlias(); String name = CONSENT_NAME_PREFIX + dataset.getDataSetId(); Date createDate = new Date(); if (Objects.nonNull(dataset.getDataUse())) { boolean manualReview = isConsentDataUseManualReview(dataset.getDataUse()); consentDAO.insertConsent(consentId, manualReview, null, dataset.getDataUse().toString(), null, name, null, createDate, createDate, null, true, groupName, dataset.getDacId()); String associationType = AssociationType.SAMPLESET.getValue(); consentDAO.insertConsentAssociation(consentId, associationType, dataset.getDacId()); return consentDAO.findConsentById(consentId); } else { throw new IllegalArgumentException("Dataset is missing Data Use information. Consent could not be created."); } }
Source:
<code>public Void execute(final TransactionContext context) { final CodeSystem codeSystem = context.lookup(uniqueId, CodeSystem.class); <START> if (codeSystem == null) { <END> throw new BadRequestException("Code System with unique ID %s was not found.", uniqueId); } updateOid(codeSystem, context); updateName(codeSystem); updateShortName(codeSystem, context); updateLink(codeSystem); updateLanguage(codeSystem); updateCitation(codeSystem); updateBranchPath(codeSystem); updateIconPath(codeSystem); updateTerminologyId(codeSystem); return null; }</code><technical_language>context.lookup() care of this, throw a 404 (NotFoundException), instead of 400 Bad Request (BadRequestException)</technical_language>

Target:
public Void execute(final TransactionContext context) { final CodeSystem codeSystem = context.lookup(uniqueId, CodeSystem.class); updateName(codeSystem); updateLink(codeSystem); updateLanguage(codeSystem); updateCitation(codeSystem); updateBranchPath(codeSystem); updateIconPath(codeSystem); return null; }
Source:
<code>public void addChildren(AlluxioURI path, Collection<UfsStatus> children) { UfsStatus status = mStatuses.get(path); <START> if (status != null) { <END> mChildren.computeIfAbsent(path, ufsStatus -> new ConcurrentHashSet<>()).addAll(children); } children.forEach(child -> { AlluxioURI childPath = path.joinUnsafe(child.getName()); addStatus(childPath, child); }); }</code><technical_language>add this parent->children listing cache if parent status is in other map</technical_language>

Target:
public Collection<UfsStatus> addChildren(AlluxioURI path, Collection<UfsStatus> children) { ConcurrentHashSet<UfsStatus> set = new ConcurrentHashSet<>(); children.forEach(child -> { AlluxioURI childPath = path.joinUnsafe(child.getName()); addStatus(childPath, child); set.add(child); }); return mChildren.put(path, set); }
Source:
<code>public void checkMaskValidValue() { <START> if (!isMaskValidFormat) { <END> return; } assertEquals("Failed to validate mask value" + mask, isMaskValid, MaskValidator.getInstance().isMaskValid(mask)); }</code><technical_language>depend expected passed developer - MaskValidator.getInstance().isMaskFormatValid(mask)</technical_language>

Target:
public void checkMaskValidValue() { if (!MaskValidator.getInstance().isMaskFormatValid(mask, isPrefixAllowed)) { return; } assertEquals("Failed to validate mask value" + mask, isMaskValid, MaskValidator.getInstance().isMaskValid(mask, isPrefixAllowed)); }
Source:
<code>public void onSensorChanged(SensorEvent event) { <START> <END> if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { gravArray = event.values; } if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { magneticArray = event.values; } if (gravArray != null && magneticArray != null) { float[] num1 = new float[9]; float[] num2 = new float[9]; boolean success = SensorManager.getRotationMatrix(num1, num2, gravArray, magneticArray); if (success) { float[] orientation = new float[3]; SensorManager.getOrientation(num1, orientation); azimut = orientation[0]; pitch = orientation[1]; roll = orientation[2]; CameraPosition position = new CameraPosition.Builder() .tilt(pitch * -90) .bearing(roll * 90) .build(); if (mapboxMap != null) { mapboxMap.animateCamera(CameraUpdateFactory .newCameraPosition(position), 100 ); } } } }</code><technical_language>inconsistent of white spacing compared other methods</technical_language>

Target:
public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { gravityArray = event.values; } if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { magneticArray = event.values; } if (gravityArray != null && magneticArray != null) { boolean success = SensorManager.getRotationMatrix(rotationMatrix, inclinationMatrix, gravityArray, magneticArray); if (success) { if (mapboxMap != null) { int mapCameraAnimationMillisecondsSpeed = 100; mapboxMap.animateCamera(CameraUpdateFactory .newCameraPosition(createNewCameraPosition()), mapCameraAnimationMillisecondsSpeed ); } } } }
Source:
<code>protected void serviceStop() throws Exception { if (mbeanObjectName != null) { MBeans.unregister(mbeanObjectName); } if (null != materializeDir) { FileUtils.deleteQuietly(materializeDir.toFile()); } <START> if (localizationEventsHandler != null) { <END> localizationEventsHandler.interrupt(); } LOG.debug("Stopped CertificateLocalization service"); super.serviceStop(); }</code><technical_language>stop thread deleting parent directory avoid potential IOException shutdown</technical_language>

Target:
protected void serviceStop() throws Exception { if (mbeanObjectName != null) { MBeans.unregister(mbeanObjectName); } if (localizationEventsHandler != null) { localizationEventsHandler.interrupt(); } if (null != materializeDir) { FileUtils.deleteQuietly(materializeDir.toFile()); } LOG.debug("Stopped CertificateLocalization service"); super.serviceStop(); }
Source:
<code>public void setUpFluo() throws Exception { config = new FluoConfiguration(); config.setMiniStartAccumulo(false); config.setApplicationName("lit"); config.setAccumuloInstance(cluster.getInstanceName()); config.setAccumuloUser("root"); config.setAccumuloPassword("secret"); config.setInstanceZookeepers(cluster.getZooKeepers() + "/fluo"); config.setAccumuloZookeepers(cluster.getZooKeepers()); config.setAccumuloTable("data" + tableCounter.getAndIncrement()); config.setWorkerThreads(5); exportTable = "export" + tableCounter.getAndIncrement(); cluster.getConnector("root", "secret").tableOperations().create(exportTable); config.addObserver(new ObserverConfiguration(PageObserver.class.getName())); <START> FluoApp.configureApplication(config, <END> new TableInfo(cluster.getInstanceName(), cluster.getZooKeepers(), "root", "secret", exportTable), 5); FluoFactory.newAdmin(config).initialize( new FluoAdmin.InitOpts().setClearTable(true).setClearZookeeper(true)); miniFluo = FluoFactory.newMiniFluo(config); }</code><technical_language>5 set FluoApp.NUM_BUCKETS</technical_language>

Target:
public void setUpFluo() throws Exception { config = new FluoConfiguration(); config.setMiniStartAccumulo(false); config.setApplicationName("lit"); config.setAccumuloInstance(cluster.getInstanceName()); config.setAccumuloUser("root"); config.setAccumuloPassword("secret"); config.setInstanceZookeepers(cluster.getZooKeepers() + "/fluo"); config.setAccumuloZookeepers(cluster.getZooKeepers()); config.setAccumuloTable("data" + tableCounter.getAndIncrement()); config.setWorkerThreads(5); exportTable = "export" + tableCounter.getAndIncrement(); cluster.getConnector("root", "secret").tableOperations().create(exportTable); config.addObserver(new ObserverConfiguration(PageObserver.class.getName())); FluoApp.configureApplication(config, new TableInfo(cluster.getInstanceName(), cluster.getZooKeepers(), "root", "secret", exportTable), FluoApp.NUM_BUCKETS); FluoFactory.newAdmin(config).initialize( new FluoAdmin.InitOpts().setClearTable(true).setClearZookeeper(true)); miniFluo = FluoFactory.newMiniFluo(config); }
Source:
<code>public void onReceive(Context context, Intent intent) { mContext = context; if (MESSAGE_STATUS_RECEIVED_ACTION.equals(intent.getAction())) { Uri messageUri = intent.getData(); byte[] pdu = (byte[]) intent.getExtra("pdu"); boolean isStatusMessage = updateMessageStatus(context, messageUri, pdu); <START> SmsMessage message = SmsMessage.createFromPdu(pdu); <END> if (message.getStatus() < Sms.STATUS_PENDING) MessagingNotification.nonBlockingUpdateNewMessageIndicator(context, true, isStatusMessage); } }</code><technical_language>this code more closely, concerned calling heavy function SmsMessage.createFromPdu in call updateMessageStatus. changing function updateMessageStatus return SmsMessage? set isStatusMessage = smsMessage.isStatusReportMessage() get smsMessage.getStatus(). do think</technical_language>

Target:
public void onReceive(Context context, Intent intent) { mContext = context; if (MESSAGE_STATUS_RECEIVED_ACTION.equals(intent.getAction())) { Uri messageUri = intent.getData(); byte[] pdu = (byte[]) intent.getExtra("pdu"); SmsMessage message = updateMessageStatus(context, messageUri, pdu); if (message.getStatus() < Sms.STATUS_PENDING) MessagingNotification.nonBlockingUpdateNewMessageIndicator(context, true, message.isStatusReportMessage); } }