auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void onSaveInstanceState(Bundle outState) { <START> super.onSaveInstanceState(outState); <END> outState.putBoolean("hasTemporaryWikitextStored", true); outState.putParcelable("abusefilter", abusefilterEditResult); outState.putBoolean("sectionTextModified", sectionTextModified); captchaHandler.saveState(outState); }</code><technical_language>save temporary wikitext here, instead of in onPause? saving in onPause, get saved unnecessarily, e.g. user simply backs out of editing</technical_language>

Target:
protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean("hasTemporaryWikitextStored", true); outState.putParcelable("abusefilter", abusefilterEditResult); outState.putBoolean("sectionTextModified", sectionTextModified); captchaHandler.saveState(outState); Prefs.storeTemporaryWikitext(sectionWikitext); }
Source:
<code>public static void setupDomain() { <START> testSupport = DomainTestSuite.createSupport(EEConcurrencyExecutorShutdownTestCase.class.getSimpleName()); <END> domainMasterLifecycleUtil = testSupport.getDomainMasterLifecycleUtil(); masterClient = domainMasterLifecycleUtil.getDomainClient(); }</code><technical_language>This test belong DomainTestSuite. @dcihak, If intention is include EEConcurrencyExecutorShutdownTestCase in test suite, sense this test is stopping servers reused other test in test suite, DomainTestSuite in this class. DomainTestSupport.createAndStartDefaultSupport(EEConcurrencyExecutorShutdownTestCase.class.getSimpleName()); instead for example</technical_language>

Target:
public static void setupDomain() { testSupport = createAndStartDefaultEESupport(EEConcurrencyExecutorShutdownTestCase.class.getSimpleName()); domainMasterLifecycleUtil = testSupport.getDomainMasterLifecycleUtil(); masterClient = domainMasterLifecycleUtil.getDomainClient(); }
Source:
<code>private void createDatasets(PipelineConfigurer pipelineConfigurer) { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); try { if (!excelInputreaderConfig.containsMacro("errorDatasetName") && !Strings.isNullOrEmpty(excelInputreaderConfig.errorDatasetName)) { Map<String, String> properties = new HashMap<>(); properties.put(Properties.Table.PROPERTY_SCHEMA, errorRecordSchema.toString()); properties.put(Properties.Table.PROPERTY_SCHEMA_ROW_FIELD, KEY); DatasetProperties datasetProperties = DatasetProperties.builder().addAll(properties).build(); pipelineConfigurer.createDataset(excelInputreaderConfig.errorDatasetName, Table.class, datasetProperties); } else if (!excelInputreaderConfig.containsMacro("ifErrorRecord") && excelInputreaderConfig.ifErrorRecord.equalsIgnoreCase(WRITE_ERROR_DATASET)) { collector.addFailure("Error dataset name should not be empty if choosing write to error " + "dataset for 'On Error' input.", null) .withConfigProperty(IF_ERROR_RECORD).withConfigProperty(ERROR_DATASET_NAME); } if (!excelInputreaderConfig.containsMacro("memoryTableName") && !Strings.isNullOrEmpty(excelInputreaderConfig.memoryTableName)) { pipelineConfigurer.createDataset(excelInputreaderConfig.memoryTableName, KeyValueTable.class); } <START> } catch (Exception e) { <END> collector.addFailure(String.format("Exception while creating dataset: %s.", e.getMessage()), null); } }</code><technical_language>throws exception anymore. If not, remove this</technical_language>

Target:
private void createDatasets(PipelineConfigurer pipelineConfigurer) { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); if (!excelInputreaderConfig.containsMacro("errorDatasetName") && !Strings.isNullOrEmpty(excelInputreaderConfig.errorDatasetName)) { Map<String, String> properties = new HashMap<>(); properties.put(Properties.Table.PROPERTY_SCHEMA, errorRecordSchema.toString()); properties.put(Properties.Table.PROPERTY_SCHEMA_ROW_FIELD, KEY); DatasetProperties datasetProperties = DatasetProperties.builder().addAll(properties).build(); pipelineConfigurer.createDataset(excelInputreaderConfig.errorDatasetName, Table.class, datasetProperties); } else if (!excelInputreaderConfig.containsMacro("ifErrorRecord") && excelInputreaderConfig.ifErrorRecord.equalsIgnoreCase(WRITE_ERROR_DATASET)) { collector.addFailure("Error dataset name should not be empty if choosing write to error " + "dataset for 'On Error' input.", null) .withConfigProperty(IF_ERROR_RECORD).withConfigProperty(ERROR_DATASET_NAME); } if (!excelInputreaderConfig.containsMacro("memoryTableName") && !Strings.isNullOrEmpty(excelInputreaderConfig.memoryTableName)) { pipelineConfigurer.createDataset(excelInputreaderConfig.memoryTableName, KeyValueTable.class); } }
Source:
<code>private boolean tryLoadOrganizations(WizardPage currentPage) { currentPage.setMessage(null); try { getContainer().run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { List<RemoteOrganization> userOrgs = ConnectedEngineFacade.listUserOrganizations(model.getServerUrl(), model.getUsername(), model.getPassword(), monitor); model.setUserOrgs(userOrgs); } catch (UnsupportedServerException e) { model.setUserOrgs(null); } finally { monitor.done(); } } }); } catch (InvocationTargetException e) { SonarLintLogger.get().debug("Unable to download organizations", e.getCause()); currentPage.setMessage(e.getCause().getMessage(), IMessageProvider.ERROR); model.setUserOrgs(null); return false; } catch (InterruptedException e) { model.setUserOrgs(null); <START> Thread.currentThread().interrupt(); <END> return false; } return true; }</code><technical_language>Ok, I this one. InterruptedException is specific threads, Eclipse for jobs. I remove ignore issue</technical_language>

Target:
private boolean tryLoadOrganizations(WizardPage currentPage) { currentPage.setMessage(null); try { getContainer().run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { List<RemoteOrganization> userOrgs = ConnectedEngineFacade.listUserOrganizations(model.getServerUrl(), model.getUsername(), model.getPassword(), monitor); model.setUserOrgs(userOrgs); } catch (UnsupportedServerException e) { model.setUserOrgs(null); } finally { monitor.done(); } } }); } catch (InvocationTargetException e) { SonarLintLogger.get().debug("Unable to download organizations", e.getCause()); currentPage.setMessage(e.getCause().getMessage(), IMessageProvider.ERROR); model.setUserOrgs(null); return false; } catch (InterruptedException e) { model.setUserOrgs(null); return false; } return true; }
Source:
<code>public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { <START> final AbstractStatementVisitor visitor = new PreStatementVisitor(context); <END> syntaxNode.accept(visitor); return visitor.programState; }</code><technical_language>remove final modifiers everywhere</technical_language>

Target:
public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { AbstractStatementVisitor visitor = new PreStatementVisitor(context); syntaxNode.accept(visitor); return visitor.programState; }
Source:
<code>public Object readFromRegistry(String resourcePath) { try { if (registry.resourceExists(resourcePath)) { resource = registry.get(resourcePath); byte[] content = (byte[]) resource.getContent(); try { obj = toObject(content); } catch (ClassNotFoundException e) { <START> log.error(e.getMessage()); <END> } catch (IOException e) { log.error(e.getMessage()); } } } catch (RegistryException e) { log.error(e.getMessage()); } return obj; }</code><technical_language>Log full exception well, this fixed in entire PR</technical_language>

Target:
public Object readFromRegistry(String resourcePath) { try { if (registry.resourceExists(resourcePath)) { resource = registry.get(resourcePath); byte[] content = (byte[]) resource.getContent(); obj = toObject(content); } } catch (RegistryException e) { log.error("error while handle with registry", e); } return obj; }
Source:
<code>public HttpResponse doStop() { lock.writeLock().lock(); try { if (executable != null) { final SubTask parentOf; try { parentOf = getParentOfOrFail(executable); } catch(InvocationTargetException ex) { <START> return HttpResponses.error(500, ex); <END> } Tasks.getOwnerTaskOf(parentOf).checkAbortPermission(); interrupt(); } } finally { lock.writeLock().unlock(); } return HttpResponses.forwardToPreviousPage(); }</code><technical_language>Suffices throw this exception (or a wrapper) out of method</technical_language>

Target:
public HttpResponse doStop() { lock.writeLock().lock(); try { if (executable != null) { Tasks.getOwnerTaskOf(getParentOf(executable)).checkAbortPermission(); interrupt(); } } finally { lock.writeLock().unlock(); } return HttpResponses.forwardToPreviousPage(); }
Source:
<code>public PhysicalLocator createPhysicalLocator(IPv4Addr ip) throws Exception { Insert<GenericTableSchema> op = plTable.insert(ip); try { UUID newId = modify(client, plTable, op) <START> .result(Duration.Inf()); <END> if (newId == null) throw new VtepException(endPoint, "cannot create locator for tunnel endpoint ip: " + ip); Set<PhysicalLocator> locator = retrievePhysicalLocator( plTable.getUuidMatcher(newId)); if (locator.isEmpty()) throw new VtepException(endPoint, "cannot retrieve locator for tunnel endpoint ip: " + ip); return locator.iterator().next(); } catch (TimeoutException tOut) { throw new VtepException(endPoint, tOut); } }</code><technical_language>need wrap</technical_language>

Target:
public PhysicalLocator createPhysicalLocator(IPv4Addr ip) throws Exception { Insert<GenericTableSchema> op = plTable.insert(ip); try { UUID newId = modify(client, plTable, op).result(Duration.Inf()); if (newId == null) throw new VtepException(endPoint, "cannot create locator for tunnel endpoint ip: " + ip); Set<PhysicalLocator> locator = retrievePhysicalLocator( plTable.getUuidMatcher(newId)); if (locator.isEmpty()) throw new VtepRetrievalException("locator for ip " + ip); return locator.iterator().next(); } catch (TimeoutException tOut) { throw new VtepException(endPoint, tOut); } }
Source:
<code>private static void updateV2VJobs(VDS vds, Map<String, Object> xmlRpcStruct) { if (!xmlRpcStruct.containsKey(VdsProperties.v2vJobs)) { return; } <START> List<V2VJobInfo> v2vJobs = new ArrayList<>(); ((Map<String, Object>) xmlRpcStruct.get(VdsProperties.v2vJobs)).entrySet() .stream() .forEach(job -> v2vJobs.add(buildV2VJobData(job.getKey(), (Map<String, Object>) job.getValue()))); <END> vds.getStatisticsData().setV2VJobs(v2vJobs); }</code><technical_language>I Java 8 is below: List<V2VJobInfo> v2vJobs = jobs .entrySet() .stream() .map(e -> buildV2VJobData(e.getKey(), (Map<String, Object>) e.getValue())) .collect(Collectors.toList());</technical_language>

Target:
private static void updateV2VJobs(VDS vds, Map<String, Object> xmlRpcStruct) { if (!xmlRpcStruct.containsKey(VdsProperties.v2vJobs)) { return; } List<V2VJobInfo> v2vJobs = ((Map<String, Object>) xmlRpcStruct.get(VdsProperties.v2vJobs)).entrySet() .stream() .map(job -> buildV2VJobData(job.getKey(), (Map<String, Object>) job.getValue())).collect(Collectors.toList()); vds.getStatisticsData().setV2VJobs(v2vJobs); }
Source:
<code>protected void write(ByteBuffer header, ByteBuffer data) throws IOException { <START> sendBinary(header); sendBinary(data); <END> }</code><technical_language>suggestion sendBinary(header, false); sendBinary(data, true); if WebSocketSession is extended in obvious</technical_language>

Target:
protected void write(ByteBuffer header, ByteBuffer data) throws IOException { LOGGER.finest(() -> "sending message of length " + ChunkHeader.length(ChunkHeader.peek(header))); sendBinary(header, false); sendBinary(data, true); }
Source:
<code>public CompilationOptionsCustomizerProvider(final Long expectedCompilationTime) { <START> this.expectedCompilationTime = expectedCompilationTime.intValue(); <END> }</code><technical_language>longValue()</technical_language>

Target:
public CompilationOptionsCustomizerProvider(final Long expectedCompilationTime) { this.expectedCompilationTime = expectedCompilationTime; }
Source:
<code>public synchronized static List<IngestProfile> getIngestProfiles() { File dir = Paths.get(PlatformUtil.getUserConfigDirectory(), PROFILE_FOLDER).toFile(); File[] directoryListing = dir.listFiles(); List<IngestProfile> profileList = new ArrayList<>(); if (directoryListing != null) { for (File child : directoryListing) { <START> String name = child.getName().replace(PROFILE_FILE_EXT, ""); END> String context = PROFILE_FOLDER + File.separator + name; String desc = ModuleSettings.getConfigSetting(context, PROFILE_DESC_KEY); String fileIngestFilter = ModuleSettings.getConfigSetting(context, PROFILE_FILTER_KEY); profileList.add(new IngestProfile(name, desc, fileIngestFilter)); } } return profileList; }</code><technical_language>please FilenameUtils.removeExtension() org.apache.commons.io.FilenameUtils package instead? a large collection of methods for manipulating file names. in places code</technical_language>

Target:
public synchronized static List<IngestProfile> getIngestProfiles() { File dir = Paths.get(PlatformUtil.getUserConfigDirectory(), PROFILE_FOLDER).toFile(); File[] directoryListing = dir.listFiles(); List<IngestProfile> profileList = new ArrayList<>(); if (directoryListing != null) { for (File child : directoryListing) { String name = FilenameUtils.removeExtension(child.getName()); String context = PROFILE_FOLDER + File.separator + name; String desc = ModuleSettings.getConfigSetting(context, PROFILE_DESC_KEY); String fileIngestFilter = ModuleSettings.getConfigSetting(context, PROFILE_FILTER_KEY); profileList.add(new IngestProfile(name, desc, fileIngestFilter)); } } return profileList; }
Source:
<code>public void addReceiver(String endpointId, VideoConstraints newVideoConstraints) { VideoConstraints oldVideoConstraints = receiverVideoConstraintsMap.put(endpointId, newVideoConstraints); if (oldVideoConstraints == null || !oldVideoConstraints.equals(newVideoConstraints)) { <START> setReceiverVideoConstraints(ImmutableMap.copyOf(receiverVideoConstraintsMap)); <END> } }</code><technical_language>is difference adding constraints receiverVideoConstraintsMap calling setReceiverVideoConstraints</technical_language>

Target:
public void addReceiver(String endpointId, VideoConstraints newVideoConstraints) { VideoConstraints oldVideoConstraints = receiverVideoConstraintsMap.put(endpointId, newVideoConstraints); if (oldVideoConstraints == null || !oldVideoConstraints.equals(newVideoConstraints)) { receiverVideoConstraintsChanged(ImmutableMap.copyOf(receiverVideoConstraintsMap)); } }
Source:
<code>private Rule[] updateRuleTitles(Rule[] rules, Map<Rule, AtomicInteger> counters) { ArrayList<Rule> result = new ArrayList<Rule>(); for (int i = 0; i < rules.length; i++) { Rule rule = rules[i]; AtomicInteger counter = counters.get(rule); if (counter.get() == 0 && this.hideEmptyRules) { continue; } String label = LegendUtils.getRuleLabel(rule, request); if (StringUtils.isEmpty(label)) { label = "(" + counter.get() + ")"; } else { label = label + " (" + counter.get() + ")"; } <START> TargetLabelUpdater duplicatingVisitor = new TargetLabelUpdater(label); <END> rule.accept(duplicatingVisitor); Rule clone = (Rule) duplicatingVisitor.getCopy(); result.add(clone); } return result.toArray(new Rule[result.size()]); }</code><technical_language>Do clone rule, a reference ok? matter for complex rules this a while</technical_language>

Target:
private Rule[] updateRuleTitles(Rule[] rules, Map<Rule, AtomicInteger> counters) { ArrayList<Rule> result = new ArrayList<Rule>(); for (int i = 0; i < rules.length; i++) { Rule rule = rules[i]; AtomicInteger counter = counters.get(rule); if (counter.get() == 0 && this.hideEmptyRules) { continue; } String label = LegendUtils.getRuleLabel(rule, request); if (this.countMatched) { if (StringUtils.isEmpty(label)) { label = "(" + counter.get() + ")"; } else { label = label + " (" + counter.get() + ")"; } } TargetLabelUpdater duplicatingVisitor = new TargetLabelUpdater(label); rule.accept(duplicatingVisitor); Rule clone = (Rule) duplicatingVisitor.getCopy(); result.add(clone); } return result.toArray(new Rule[result.size()]); }
Source:
<code><START> public final static <T> Observable<T> mergeDelayError(Iterable<? extends Observable<? extends T>> sequences, int maxConcurrent) { <END> return mergeDelayError(from(sequences), maxConcurrent); }</code><technical_language>final is needed</technical_language>

Target:
public static <T> Observable<T> mergeDelayError(Iterable<? extends Observable<? extends T>> sequences, int maxConcurrent) { return mergeDelayError(from(sequences), maxConcurrent); }
Source:
<code>public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelectorFactory factory) { final VirtualColumn virtualColumn = getVirtualColumn(dimensionSpec.getDimension()); if (virtualColumn == null) { return dimensionSpec.decorate(ConstantDimensionSelector.of(null, dimensionSpec.getExtractionFn())); } else { final DimensionSelector selector = virtualColumn.makeDimensionSelector(dimensionSpec, factory); <START> if (selector == null) { <END> return dimensionSpec.decorate(ConstantDimensionSelector.of(null, dimensionSpec.getExtractionFn())); } else { return selector; } } }</code><technical_language>this logic virtualColumn.makeDimensionSelector()? dimensionSpec.decorate() is applied site</technical_language>

Target:
public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec, ColumnSelectorFactory factory) { final VirtualColumn virtualColumn = getVirtualColumn(dimensionSpec.getDimension()); if (virtualColumn == null) { throw new IAE("No such virtual column[%s]", dimensionSpec.getDimension()); } else { final DimensionSelector selector = virtualColumn.makeDimensionSelector(dimensionSpec, factory); Preconditions.checkNotNull(selector, "selector"); return selector; } }
Source:
<code>public void shouldScrollIntoTerminal() throws InterruptedException { openMC("/"); try { terminal.movePageDownListTerminal("opt"); terminal.moveDownListTerminal(".dockerenv"); terminal.waitExpectedTextIntoTerminal(".dockerenv"); terminal.movePageUpListTerminal("projects"); terminal.moveUpListTerminal("bin"); terminal.waitExpectedTextIntoTerminal("bin"); } catch (TimeoutException ex) { <START> fail("Known issue <LINK_0>"); <END> } }</code><technical_language>line in try block issue</technical_language>

Target:
public void shouldScrollIntoTerminal() throws InterruptedException { openMC("/"); try { terminal.movePageDownListTerminal("opt"); } catch (TimeoutException ex) { fail("Known issue <LINK_0>", ex); } terminal.moveDownListTerminal(".dockerenv"); terminal.waitExpectedTextIntoTerminal(".dockerenv"); terminal.movePageUpListTerminal("projects"); terminal.moveUpListTerminal("bin"); terminal.waitExpectedTextIntoTerminal("bin"); }
Source:
<code>public void removeAllUserFacilityAttributes(PerunSession sess, User user) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException { List<RichAttribute<User, Facility>> userFacilitiesAttributes = getAttributesManagerImpl().getAllUserFacilityRichAttributes(sess, user); getAttributesManagerImpl().removeAllUserFacilityAttributes(sess, user); <START> log.info("{} removed all attributes from user on all facilities. User id = ", user.getId()); <END> getPerunBl().getAuditer().log(sess, "All non-virtual user-facility attributes removed for all facilities and {}", user); for (RichAttribute<User, Facility> richAttribute : userFacilitiesAttributes) { try { checkAttributeValue(sess, richAttribute.getSecondaryHolder(), richAttribute.getPrimaryHolder(), new Attribute(richAttribute.getAttribute())); this.checkAttributeDependencies(sess, richAttribute); } catch (WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } } for (RichAttribute<User, Facility> attribute : userFacilitiesAttributes) { try { getAttributesManagerImpl().changedAttributeHook(sess, attribute.getSecondaryHolder(), attribute.getPrimaryHolder(), new Attribute(attribute.getAttribute())); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } } }</code><technical_language>log.info("{} removed attributes user facilities", sess.getLogId(), user.getId());</technical_language>

Target:
public void removeAllUserFacilityAttributes(PerunSession sess, User user) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException { List<RichAttribute<User, Facility>> userFacilitiesAttributes = getAttributesManagerImpl().getAllUserFacilityRichAttributes(sess, user); getAttributesManagerImpl().removeAllUserFacilityAttributes(sess, user); log.info("{} removed all attributes from user on all facilities.", sess.getLogId(), user.getId()); getPerunBl().getAuditer().log(sess, "All non-virtual user-facility attributes removed for all facilities and {}", user); for (RichAttribute<User, Facility> richAttribute : userFacilitiesAttributes) { try { checkAttributeValue(sess, richAttribute.getSecondaryHolder(), richAttribute.getPrimaryHolder(), new Attribute(richAttribute.getAttribute())); this.checkAttributeDependencies(sess, richAttribute); } catch (WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } } for (RichAttribute<User, Facility> attribute : userFacilitiesAttributes) { try { getAttributesManagerImpl().changedAttributeHook(sess, attribute.getSecondaryHolder(), attribute.getPrimaryHolder(), new Attribute(attribute.getAttribute())); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } } }
Source:
<code>private String getCitationMarkerField(BibEntry entry, BibDatabase database, String field) { String authorField = getStringCitProperty(AUTHOR_FIELD); String[] fields = field.split(FieldName.FIELD_SEPARATOR); for (String s : fields) { Objects.requireNonNull(entry, "Entry cannot be null"); <START> Objects.requireNonNull(database, "database cannot be null"); <END> Optional<String> content = entry.getResolvedFieldOrAlias(s, database); if ((content.isPresent()) && !content.get().trim().isEmpty()) { if (field.equals(authorField) && StringUtil.isInCurlyBrackets(content.get())) { return "{" + fieldFormatter.format(content.get()) + "}"; } return fieldFormatter.format(content.get()); } } return ""; }</code><technical_language>moved beginning of method</technical_language>

Target:
private String getCitationMarkerField(BibEntry entry, BibDatabase database, String field) { Objects.requireNonNull(entry, "Entry cannot be null"); Objects.requireNonNull(database, "database cannot be null"); String authorField = getStringCitProperty(AUTHOR_FIELD); String[] fields = field.split(FieldName.FIELD_SEPARATOR); for (String s : fields) { Optional<String> content = entry.getResolvedFieldOrAlias(s, database); if ((content.isPresent()) && !content.get().trim().isEmpty()) { if (field.equals(authorField) && StringUtil.isInCurlyBrackets(content.get())) { return "{" + fieldFormatter.format(content.get()) + "}"; } return fieldFormatter.format(content.get()); } } return ""; }
Source:
<code>public void customize() { if (downloadedFilename != null) { newScript(CUSTOMIZING) .failOnNonZeroResultCode() .environmentVariablesReset() .body.append(ArchiveUtils.extractCommands(downloadedFilename, getInstallDir())) .execute(); } <START> else { <END> String customizeCommand = getEntity().getConfig(VanillaSoftwareProcess.CUSTOMIZE_COMMAND); if (!StringUtils.isBlank(customizeCommand)) { newScript(CUSTOMIZING) .failOnNonZeroResultCode() .environmentVariablesReset() .body.append(customizeCommand) .execute(); } } }</code><technical_language>again, else</technical_language>

Target:
public void customize() { if (downloadedFilename != null) { newScript(CUSTOMIZING) .failOnNonZeroResultCode() .environmentVariablesReset() .body.append(ArchiveUtils.extractCommands(downloadedFilename, getInstallDir())) .execute(); } String customizeCommand = getEntity().getConfig(VanillaSoftwareProcess.CUSTOMIZE_COMMAND); if (Strings.isNonBlank(customizeCommand)) { newScript(CUSTOMIZING) .failOnNonZeroResultCode() .environmentVariablesReset() .body.append(customizeCommand) .execute(); } }
Source:
<code>private static boolean checkOrderOther(Session session, Expression expr, ArrayList<String> expressionSQL) { if (expr.isConstant()) { return true; } String exprSQL = expr.getSQL(); for (String sql: expressionSQL) { if (session.getDatabase().equalsIdentifiers(exprSQL, sql)) { return true; } } int count = expr.getSubexpressionCount(); <START> if (expr instanceof Function ? !((Function) expr).isDeterministic() : count <= 0) { <END> return false; } for (int i = 0; i < count; i++) { if (!checkOrderOther(session, expr.getSubexpression(i), expressionSQL)) { return false; } } return true; }</code><technical_language>yuck, this condition is hard read</technical_language>

Target:
private static boolean checkOrderOther(Session session, Expression expr, ArrayList<String> expressionSQL) { if (expr.isConstant()) { return true; } String exprSQL = expr.getSQL(); for (String sql: expressionSQL) { if (session.getDatabase().equalsIdentifiers(exprSQL, sql)) { return true; } } int count = expr.getSubexpressionCount(); if (expr instanceof Function) { if (!((Function) expr).isDeterministic()) { return false; } } else if (count <= 0) { return false; } for (int i = 0; i < count; i++) { if (!checkOrderOther(session, expr.getSubexpression(i), expressionSQL)) { return false; } } return true; }
Source:
<code>void setArguments(Object[] args) { if (args == null) { return; } int count = args.length; if (!isSynchronous) { count -= 1; } for (int i = 0; i < count; i++) { String name = paramNames[i]; Object value = args[i]; RestMethodInfo.ParamUsage paramUsage = paramUsages[i]; switch (paramUsage) { case PATH: if (value == null) { throw new IllegalArgumentException( "Path parameter \"" + name + "\" value must not be null."); } <START> { <END> Boolean disableUrlEncoding = paramFlags[i]; addPathParam(name, value.toString(), disableUrlEncoding); } break; case QUERY: if (value != null) { Boolean disableUrlEncoding = paramFlags[i]; addQueryParam(name, value.toString(), disableUrlEncoding); } break; case HEADER: if (value != null) { addHeader(name, value.toString()); } break; case FIELD: if (value != null) { formBody.addField(name, value.toString()); } break; case PART: if (value != null) { if (value instanceof TypedOutput) { multipartBody.addPart(name, (TypedOutput) value); } else if (value instanceof String) { multipartBody.addPart(name, new TypedString((String) value)); } else { multipartBody.addPart(name, converter.toBody(value)); } } break; case BODY: if (value == null) { throw new IllegalArgumentException("Body parameter value must not be null."); } if (value instanceof TypedOutput) { body = (TypedOutput) value; } else { body = converter.toBody(value); } break; default: throw new IllegalArgumentException("Unknown parameter usage: " + paramUsage); } } }</code><technical_language>awkward block here? Move in one</technical_language>

Target:
void setArguments(Object[] args) { if (args == null) { return; } int count = args.length; if (!isSynchronous) { count -= 1; } for (int i = 0; i < count; i++) { String name = paramNames[i]; Object value = args[i]; RestMethodInfo.ParamUsage paramUsage = paramUsages[i]; switch (paramUsage) { case PATH: if (value == null) { throw new IllegalArgumentException( "Path parameter \"" + name + "\" value must not be null."); } addPathParam(name, value.toString()); break; case ENCODED_PATH: if (value == null) { throw new IllegalArgumentException( "Path parameter \"" + name + "\" value must not be null."); } addEncodedPathParam(name, value.toString()); break; case QUERY: if (value != null) { addQueryParam(name, value.toString()); } break; case ENCODED_QUERY: if (value != null) { addEncodedQueryParam(name, value.toString()); } break; case HEADER: if (value != null) { addHeader(name, value.toString()); } break; case FIELD: if (value != null) { formBody.addField(name, value.toString()); } break; case PART: if (value != null) { if (value instanceof TypedOutput) { multipartBody.addPart(name, (TypedOutput) value); } else if (value instanceof String) { multipartBody.addPart(name, new TypedString((String) value)); } else { multipartBody.addPart(name, converter.toBody(value)); } } break; case BODY: if (value == null) { throw new IllegalArgumentException("Body parameter value must not be null."); } if (value instanceof TypedOutput) { body = (TypedOutput) value; } else { body = converter.toBody(value); } break; default: throw new IllegalArgumentException("Unknown parameter usage: " + paramUsage); } } }
Source:
<code>public void shouldBeAbleToGetCurrentUser() { Mockito.reset(userService); final UserDetails userDetails = new UserDetails(USER_NAME, "PASSWORD", Collections.emptyList()); assertThat(userDetails.getPassword()).isNotNull(); setCurrentUserDetails(userDetails); final Response response = target().request().get(); assertThat(response).isNotNull(); assertThat(response.getStatus()).isEqualTo(HttpStatusCode.OK_200); assertThat(response.readEntity(HashMap.class)) .isNotNull() <START> .containsKeys("createdAt", "updatedAt", "lastConnectionAt"); <END> }</code><technical_language>change this :)</technical_language>

Target:
public void shouldBeAbleToGetCurrentUser() { Mockito.reset(userService); final UserDetails userDetails = new UserDetails(USER_NAME, "PASSWORD", Collections.emptyList()); assertThat(userDetails.getPassword()).isNotNull(); setCurrentUserDetails(userDetails); final Response response = target().request().get(); assertThat(response).isNotNull(); assertThat(response.getStatus()).isEqualTo(HttpStatusCode.OK_200); assertThat(response.readEntity(HashMap.class)) .isNotNull() .containsKeys("created_at", "updated_at", "last_connection_at"); }
Source:
<code>public void init() { if (encryptJwtYN) { if (StringUtils.isBlank(encryptionPassword)) { log.error( "The value of required property is blank", ENCRYPTION_PASSWORD_PROPERTY); throw new IllegalStateException("Missing property " + ENCRYPTION_PASSWORD_PROPERTY); } else if (DEFAULT_ENCRYPTION_PASSWORD.equals(encryptionPassword)) { log.warn( <START> "Property is using the deafult value; please change it", <END> ENCRYPTION_PASSWORD_PROPERTY); } textEncryptor.setPassword(encryptionPassword); } }</code><technical_language>suggestion "Property is default value; please change it",</technical_language>

Target:
public void init() { if (encryptJwtYN) { if (StringUtils.isBlank(encryptionPassword)) { log.error( "The value of required property is blank", ENCRYPTION_PASSWORD_PROPERTY); throw new IllegalStateException("Missing property " + ENCRYPTION_PASSWORD_PROPERTY); } else if (DEFAULT_ENCRYPTION_PASSWORD.equals(encryptionPassword)) { log.warn( "Property is using the default value; please change it", ENCRYPTION_PASSWORD_PROPERTY); } textEncryptor.setPassword(encryptionPassword); } }
Source:
<code>private List<OzoneAcl> getAclList() { List<OzoneAcl> listOfAcls = new ArrayList<>(); listOfAcls.add(new OzoneAcl(ACLIdentityType.USER, ugi.getUserName(), userRights)); <START> List<String> userGroups = Arrays.asList(UserGroupInformation <END> .createRemoteUser(ugi.getUserName()).getGroupNames()); userGroups.stream().forEach((group) -> listOfAcls.add( new OzoneAcl(ACLIdentityType.GROUP, group, groupRights))); return listOfAcls; }</code><technical_language>do need recreate a new UGI instead of ugi.getGroups() here</technical_language>

Target:
private List<OzoneAcl> getAclList() { return OzoneUtils.getAclList(ugi.getUserName(), ugi.getGroups(), userRights, groupRights); }
Source:
<code>public void thingUpdated(final Thing thing, ThingTrackerEvent thingTrackerEvent) { ThingUID thingUID = thing.getUID(); if (thingUpdatedLock.contains(thingUID)) { replaceThing(getThing(thingUID), thing); } else { Lock lock1 = getLockForThing(thing.getUID()); try { lock1.lock(); replaceThing(getThing(thingUID), thing); <START> ThingHandler thingHandler = thingHandlers.get(thing.getUID()); <END> if (thingHandler != null) { if (ThingHandlerHelper.isHandlerInitialized(thing) || isInitializing(thing)) { safeCaller.create(thingHandler).build().thingUpdated(thing); } else { logger.debug( "Cannot notify handler about updated thing '{}', because handler is not initialized (thing must be in status UNKNOWN, ONLINE or OFFLINE). Starting handler initialization instead.", thing.getThingTypeUID()); initializeHandler(thing); } } else { registerAndInitializeHandler(thing, getThingHandlerFactory(thing)); } } finally { lock1.unlock(); } } }</code><technical_language>replaceThing is a private method access new handler already. So, if replaceThing returns handler of argument, is need do twice</technical_language>

Target:
public void thingUpdated(final Thing thing, ThingTrackerEvent thingTrackerEvent) { ThingUID thingUID = thing.getUID(); if (thingUpdatedLock.contains(thingUID)) { replaceThing(getThing(thingUID), thing); } else { Lock lock1 = getLockForThing(thing.getUID()); try { lock1.lock(); ThingHandler thingHandler = replaceThing(getThing(thingUID), thing); if (thingHandler != null) { if (ThingHandlerHelper.isHandlerInitialized(thing) || isInitializing(thing)) { safeCaller.create(thingHandler).build().thingUpdated(thing); } else { logger.debug( "Cannot notify handler about updated thing '{}', because handler is not initialized (thing must be in status UNKNOWN, ONLINE or OFFLINE). Starting handler initialization instead.", thing.getThingTypeUID()); initializeHandler(thing); } } else { registerAndInitializeHandler(thing, getThingHandlerFactory(thing)); } } finally { lock1.unlock(); } } }
Source:
<code>public static boolean isEqual(Object object1, Object object2) { boolean result = false; if (object1 == object2) { result = true; } else if (object1 == null || object2 == null) { <START> result = false; <END> } else { if (object1.getClass().isArray()) { if (object2.getClass().isArray() && (object2.getClass() == object1.getClass())) { result = (Array.getLength(object1) == Array.getLength(object2)); if (result) { for(int i = 0, icount = Array.getLength(object1); result && (i < icount); i++) { result = isEqual(Array.get(object1, i), Array.get(object2, i)); } } } } else { int t1 = getNumericType(object1); int t2 = getNumericType(object2); if (t1 == NONNUMERIC && t2 == NONNUMERIC && (!(object1 instanceof Comparable) || !(object2 instanceof Comparable))) { result = object1.equals(object2); } else { result = compareWithConversion(object1, object2) == 0; } } } return result; }</code><technical_language>SonarLint this assignment is redundant. be... java } else if (object1 != null && object2 != null) {</technical_language>

Target:
public static boolean isEqual(Object object1, Object object2) { boolean result = false; if (object1 == object2) { result = true; } else if (object1 != null && object2 != null) { if (object1.getClass().isArray()) { if (object2.getClass().isArray() && (object2.getClass() == object1.getClass())) { result = (Array.getLength(object1) == Array.getLength(object2)); if (result) { for(int i = 0, icount = Array.getLength(object1); result && (i < icount); i++) { result = isEqual(Array.get(object1, i), Array.get(object2, i)); } } } } else { int t1 = getNumericType(object1); int t2 = getNumericType(object2); if (t1 == NONNUMERIC && t2 == NONNUMERIC && (!(object1 instanceof Comparable) || !(object2 instanceof Comparable))) { result = object1.equals(object2); } else { result = compareWithConversion(object1, object2) == 0; } } } return result; }
Source:
<code>public void constructorShouldBePrivate() { <START> PrivateConstructorChecker.forClass(EventStream.class).expectedTypeOfException(AssertionError.class).expectedExceptionMessage("No instances.").check(); <END> }</code><technical_language>refactored a TestHelper enum: java public enum TestHelper { ; public static void check(Class<?> clazz) { PrivateConstructorChecker.forClass(clazz) .expectedTypeOfException(IllegalStateException.class) .expectedExceptionMessage("No instances!").check(); } }</technical_language>

Target:
public void constructorShouldBePrivate() { PrivateConstructorChecker.forClass(EventStream.class).expectedTypeOfException(IllegalStateException.class).expectedExceptionMessage("No instances!").check(); }
Source:
<code>private PrimaryAction getPrimaryAction() { if (!userCanPublishPosts()) { return PrimaryAction.SUBMIT_FOR_REVIEW; } switch (PostStatus.fromPost(mPost)) { case SCHEDULED: return PrimaryAction.SCHEDULE; case DRAFT: return PrimaryAction.PUBLISH_NOW; case PENDING: case TRASHED: return PrimaryAction.SAVE; case PRIVATE: case PUBLISHED: case UNKNOWN: return PrimaryAction.UPDATE; } <START> return PrimaryAction.SAVE; <END> }</code><technical_language>I this line is technically unreachable, right? want follow fail fast principle throw exception here. Imagine forgets "return" keyword. This code continue work app in undefined state. Wdyt</technical_language>

Target:
private PrimaryAction getPrimaryAction() { if (!userCanPublishPosts()) { switch (PostStatus.fromPost(mPost)) { case SCHEDULED: case DRAFT: case PENDING: case PRIVATE: case PUBLISHED: case UNKNOWN: return PrimaryAction.SUBMIT_FOR_REVIEW; case TRASHED: return PrimaryAction.SAVE; } } switch (PostStatus.fromPost(mPost)) { case SCHEDULED: return PrimaryAction.SCHEDULE; case DRAFT: return PrimaryAction.PUBLISH_NOW; case PENDING: case TRASHED: return PrimaryAction.SAVE; case PRIVATE: case PUBLISHED: case UNKNOWN: return PrimaryAction.UPDATE; } throw new IllegalStateException( "Switch in getPrimaryAction is missing a required case or the case is missing \"return\" keyword "); }
Source:
<code>private String uriRelativeToContextRoot(HttpServletRequest request) { <START> String uri = VRaptorRequest.stripContextPath(request.getContextPath(), request.getRequestURI()); <END> return removeQueryStringAndJSessionId(uri); }</code><technical_language>do changing stripContextPath(request)? stripContextPath ask for contextPath requestURI internally</technical_language>

Target:
private String uriRelativeToContextRoot(HttpServletRequest request) { String uri = VRaptorRequest.getRelativeRequestURI(request); return removeQueryStringAndJSessionId(uri); }
Source:
<code>public static ASTNode loadPgmAst(String content, Source source, Boolean kappize, Sort startSymbol, Context context) throws ParseFailedException { ASTNode out; org.kframework.parser.concrete.KParser.ImportTblPgm(context.kompiled); <START> String parsed = org.kframework.parser.concrete.KParser.ParseProgramString(content, startSymbol.getName()); <END> Document doc = XmlLoader.getXMLDoc(parsed); XmlLoader.addSource(doc.getFirstChild(), source); XmlLoader.reportErrors(doc); JavaClassesFactory.startConstruction(context); out = JavaClassesFactory.getTerm((Element) doc.getDocumentElement().getFirstChild().getNextSibling()); JavaClassesFactory.endConstruction(); out = new PriorityFilter(context).visitNode(out); out = new PreferAvoidFilter(context).visitNode(out); out = new NormalizeASTTransformer(context).visitNode(out); out = new AmbFilter(context).visitNode(out); out = new RemoveBrackets(context).visitNode(out); if (kappize) out = new FlattenTerms(context).visitNode(out); return out; }</code><technical_language>tostring</technical_language>

Target:
public static ASTNode loadPgmAst(String content, Source source, Boolean kappize, Sort startSymbol, Context context) throws ParseFailedException { ASTNode out; org.kframework.parser.concrete.KParser.ImportTblPgm(context.kompiled); String parsed = org.kframework.parser.concrete.KParser.ParseProgramString(content, startSymbol.toString()); Document doc = XmlLoader.getXMLDoc(parsed); XmlLoader.addSource(doc.getFirstChild(), source); XmlLoader.reportErrors(doc); JavaClassesFactory.startConstruction(context); out = JavaClassesFactory.getTerm((Element) doc.getDocumentElement().getFirstChild().getNextSibling()); JavaClassesFactory.endConstruction(); out = new PriorityFilter(context).visitNode(out); out = new PreferAvoidFilter(context).visitNode(out); out = new NormalizeASTTransformer(context).visitNode(out); out = new AmbFilter(context).visitNode(out); out = new RemoveBrackets(context).visitNode(out); if (kappize) out = new FlattenTerms(context).visitNode(out); return out; }
Source:
<code>public static Matrix4 createRotationMatrix(final Vector3 axis, double angle) { Matrix4 ret = new Matrix4(); <START> return ret.setToRotation(axis, angle); <END> }</code><technical_language>return new Matrix4().setToRotation(axis, angle);</technical_language>

Target:
public static Matrix4 createRotationMatrix(final Vector3 axis, double angle) { return new Matrix4().setToRotation(axis, angle); }
Source:
<code>public boolean isDeprecated() { <START> return deprecated; <END> }</code><technical_language>missing this</technical_language>

Target:
public boolean isDeprecated() { return this.deprecated; }
Source:
<code>public SdkCliCommand getSdkInstallAndUpdateCommand(final String proxySettings, final List<String> components) { final StringBuilder complist = new StringBuilder(); for (final String component : components) { final String modifiedComponent = component .replaceAll("^tool$", "tools") .replaceAll("^platform-tool$", "platform-tools") <START> .replaceAll("^addon-$", "addons-") <END> .replaceAll("^extra-google-", "extras;google;") .replaceAll("^extra-android-", "extras;android;") .replaceAll("^addon-", "add-ons;addon-") .replaceAll("^build-tools-", "build-tools;") .replaceAll("^android-", "platforms;android-") .replaceAll("^sys-img-(.*)-android-([0-9]*)", "system-images;android-$2;default;$1") .replaceAll("^sys-img-(.*)-(.*)-([0-9]*)", "system-images;android-$3;$2;$1"); complist.append(modifiedComponent); complist.append(' '); } final String upgradeArgs = String.format("--include_obsolete %s", complist.toString().trim()); return new SdkCliCommand(Tool.SDKMANAGER, upgradeArgs); }</code><technical_language>$ suspicious</technical_language>

Target:
public SdkCliCommand getSdkInstallAndUpdateCommand(final String proxySettings, final List<String> components) { final StringBuilder complist = new StringBuilder(); for (final String component : components) { final String modifiedComponent = component .replaceAll("^tool$", "tools") .replaceAll("^platform-tool$", "platform-tools") .replaceAll("^extra-google-", "extras;google;") .replaceAll("^extra-android-", "extras;android;") .replaceAll("^addon-", "add-ons;addon-") .replaceAll("^build-tools-", "build-tools;") .replaceAll("^android-", "platforms;android-") .replaceAll("^sys-img-(.*)-android-([0-9]*)", "system-images;android-$2;default;$1") .replaceAll("^sys-img-(.*)-(.*)-([0-9]*)", "system-images;android-$3;$2;$1"); complist.append(modifiedComponent); complist.append(' '); } final String upgradeArgs = String.format("--include_obsolete %s", complist.toString().trim()); return new SdkCliCommand(Tool.SDKMANAGER, upgradeArgs); }
Source:
<code>private static Method getSingleApplyMethod(Class lambdaFunctionInterface) { checkCondition(lambdaFunctionInterface.isAnnotationPresent(FunctionalInterface.class), COMPILER_ERROR, "Lambda function interface is required to annotated with FunctionalInterface"); List<Method> applyMethods = Arrays.stream(lambdaFunctionInterface.getMethods()) .filter(method -> method.getName().equals("apply")) <START> .collect(toImmutableList()); <END> checkCondition(applyMethods.size() == 1, COMPILER_ERROR, "Expect to have exact method with name 'apply' in interface " + lambdaFunctionInterface.getName()); return applyMethods.get(0); }</code><technical_language>I suppose this is method for SAM method in lambda interface? Please extend name of this field</technical_language>

Target:
private static Method getSingleApplyMethod(Class lambdaFunctionInterface) { checkCondition(lambdaFunctionInterface.isAnnotationPresent(FunctionalInterface.class), COMPILER_ERROR, "Lambda function interface is required to be annotated with FunctionalInterface"); List<Method> applyMethods = Arrays.stream(lambdaFunctionInterface.getMethods()) .filter(method -> method.getName().equals("apply")) .collect(toImmutableList()); checkCondition(applyMethods.size() == 1, COMPILER_ERROR, "Expect to have exactly 1 method with name 'apply' in interface " + lambdaFunctionInterface.getName()); return applyMethods.get(0); }
Source:
<code>public void getResourcesFromADroolsPRJWithErrorWithMavenSkip() throws Exception { <START> System.setProperty(MAVEN_MAIN_SKIP, Boolean.TRUE.toString()); <END> Path tmpRoot = Files.createTempDirectory("repo"); Path tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", ResourcesConstants.KJAR_2_SINGLE_RESOURCES_WITH_ERROR); AFCompiler compiler = KieMavenCompilerFactory.getCompiler(KieDecorator.KIE_AFTER); WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(Paths.get(tmp.toUri())); CompilationRequest req = new DefaultCompilationRequest(mavenRepo, info, new String[]{MavenCLIArgs.INSTALL}, Boolean.FALSE); KieCompilationResponse res = (KieCompilationResponse) compiler.compile(req); TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName); if (!res.isSuccessful()) { List<String> msgs = res.getMavenOutput(); for (String msg : msgs) { logger.info(msg); } } assertThat(res.isSuccessful()).isTrue(); Optional<KieModuleMetaInfo> metaDataOptional = res.getKieModuleMetaInfo(); assertThat(metaDataOptional).isPresent(); KieModuleMetaInfo kieModuleMetaInfo = metaDataOptional.get(); assertThat(kieModuleMetaInfo).isNotNull(); Map<String, Set<String>> rulesBP = kieModuleMetaInfo.getRulesByPackage(); assertThat(rulesBP).hasSize(1); Optional<KieModule> kieModuleOptional = res.getKieModule(); assertThat(kieModuleOptional).isPresent(); List<String> classloaderOptional = CompilerClassloaderUtils.getStringFromTargets(tmpRoot); assertThat(classloaderOptional).hasSize(3); TestUtil.rm(tmpRoot.toFile()); }</code><technical_language>Clear property test is executed please</technical_language>

Target:
public void getResourcesFromADroolsPRJWithErrorWithMavenSkip() throws Exception { System.setProperty(MAVEN_MAIN_SKIP, Boolean.TRUE.toString()); Path tmpRoot = Files.createTempDirectory("repo"); Path tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", ResourcesConstants.KJAR_2_SINGLE_RESOURCES_WITH_ERROR); AFCompiler compiler = KieMavenCompilerFactory.getCompiler(KieDecorator.KIE_AFTER); WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(Paths.get(tmp.toUri())); CompilationRequest req = new DefaultCompilationRequest(mavenRepo, info, new String[]{MavenCLIArgs.INSTALL}, Boolean.FALSE); KieCompilationResponse res = (KieCompilationResponse) compiler.compile(req); TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName); if (!res.isSuccessful()) { List<String> msgs = res.getMavenOutput(); for (String msg : msgs) { logger.info(msg); } } assertThat(res.isSuccessful()).isTrue(); Optional<KieModuleMetaInfo> metaDataOptional = res.getKieModuleMetaInfo(); assertThat(metaDataOptional).isPresent(); KieModuleMetaInfo kieModuleMetaInfo = metaDataOptional.get(); assertThat(kieModuleMetaInfo).isNotNull(); Map<String, Set<String>> rulesBP = kieModuleMetaInfo.getRulesByPackage(); assertThat(rulesBP).hasSize(1); Optional<KieModule> kieModuleOptional = res.getKieModule(); assertThat(kieModuleOptional).isPresent(); List<String> classloaderOptional = CompilerClassloaderUtils.getStringFromTargets(tmpRoot); assertThat(classloaderOptional).hasSize(3); }
Source:
<code>public void setUp() { mMockEapStateMachine = mock(EapStateMachine.class); mCallbackLock = new Object(); mHandlerThread = new HandlerThread(HANDLER_THREAD_NAME); <START> mHandlerThread.start(); <END> mCallbackHandler = new Handler(mHandlerThread.getLooper()); mCallbackFired = false; }</code><technical_language>If a test looper, omit extra thread, do "synchronously"</technical_language>

Target:
public void setUp() { if (Looper.myLooper() == null) Looper.prepare(); mMockEapStateMachine = mock(EapStateMachine.class); mTestLooper = new TestLooper(); mCallbackHandler = new Handler(mTestLooper.getLooper()); mCallbackFired = false; }
Source:
<code><START> public static <M> Stage createStage(final AbstractViewController<M> viewBinder) { <END> Assert.requireNonNull(viewBinder, "viewBinder"); return new DolphinStage<M>(viewBinder); }</code><technical_language>please add final keyword</technical_language>

Target:
public static final <M> Stage createStage(final AbstractViewController<M> viewBinder) { Assert.requireNonNull(viewBinder, "viewBinder"); return new DolphinStage<M>(viewBinder); }