auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void checkExpectedImage(final NamedElement namedElement, final Stereotype stereotype) { Image image = labelProvider.getImage(namedElement); assertNotNull("The image must not be null.", image); Image expectedImage = getStereotypeIcon(stereotype); <START> assertNotNull("The Stereotype must contain an icon.", expectedImage); END> }</code><technical_language>compare 2 images check this is correct one</technical_language>

Target:
private void checkExpectedImage(final NamedElement namedElement, final Stereotype stereotype) { Image image = labelProvider.getImage(namedElement); assertNotNull("The image must not be null.", image); Image expectedImage = getStereotypeIcon(stereotype); assertNotNull("The Stereotype must contain an icon.", expectedImage); assertEquals("The icon of the Element must be the same as the expected icon.", expectedImage, image); }
Source:
<code>private boolean canViewChurch(int churchSecurity) { if(mAssignment == null) { return false; } switch(churchSecurity) { case 0: return mAssignment.isLeader() || mAssignment.isMember(); case 1: return mAssignment.isLeadership(); <START> case 2: <END> return true; default: return false; } }</code><technical_language>is a church security of 3 legacy data treated 2. Long term church security converted enum capture this legacy data value</technical_language>

Target:
private boolean canViewChurch(int churchSecurity) { if(mAssignment == null) { return false; } switch(churchSecurity) { case 0: return mAssignment.isLeader() || mAssignment.isMember(); case 1: return mAssignment.isLeadership(); case 2: case 3: return true; default: return false; } }
Source:
<code>public TanyaReaction calculate(String s, String t) { int whoopsCount = 0; int yayCount = 0; int[] countT = new int[52]; int[] countS = new int[52]; countLetters(countS, s); countLetters(countT, t); <START> for (int i = 0; i < 26; i++) { <END> while (countS[i] > 0 && countT[i] > 0) { yayCount++; countS[i]--; countT[i]--; } while (countS[i + 26] > 0 && countT[i + 26] > 0) { yayCount++; countS[i + 26]--; countT[i + 26]--; } while (countS[i] > 0 && countT[i + 26] > 0) { whoopsCount++; countS[i]--; countT[i + 26]--; } while (countS[i + 26] > 0 && countT[i] > 0) { whoopsCount++; countS[i + 26]--; countT[i]--; } } return new TanyaReaction(yayCount, whoopsCount); }</code><technical_language>magic const</technical_language>

Target:
public TanyaReaction calculate(String s, String t) { int whoopsCount = 0; int yayCount = 0; int[] countT = new int[ALPHABET_SIZE * 2]; int[] countS = new int[ALPHABET_SIZE * 2]; countLetters(countS, s); countLetters(countT, t); for (int i = 0; i < ALPHABET_SIZE; i++) { while (countS[i] > 0 && countT[i] > 0) { yayCount++; countS[i]--; countT[i]--; } while (countS[i + ALPHABET_SIZE] > 0 && countT[i + ALPHABET_SIZE] > 0) { yayCount++; countS[i + ALPHABET_SIZE]--; countT[i + ALPHABET_SIZE]--; } while (countS[i] > 0 && countT[i + ALPHABET_SIZE] > 0) { whoopsCount++; countS[i]--; countT[i + ALPHABET_SIZE]--; } while (countS[i + ALPHABET_SIZE] > 0 && countT[i] > 0) { whoopsCount++; countS[i + ALPHABET_SIZE]--; countT[i]--; } } return new TanyaReaction(yayCount, whoopsCount); }
Source:
<code>public void mediaChanged(MediaModel mediaModel) { List<Integer> indexList = PostUtils.indexesOfFeaturedMediaIdInList(mediaModel.getMediaId(), mPosts); for (int position : indexList) { if (isValidPostPosition(position)) { <START> int postId = mPosts.get(position).getId(); <END> mFeaturedImageUrls.put(postId, mediaModel.getUrl()); notifyItemChanged(position); } } }</code><technical_language>access mPosts directly, getItem(position) here? Example: for (int position : indexList) { PostModel post = getItem(position); if (post != null) { mFeaturedImageUrls.put(post.getId(), mediaModel.getUrl()); notifyItemChanged(position); } }</technical_language>

Target:
public void mediaChanged(MediaModel mediaModel) { List<Integer> indexList = PostUtils.indexesOfFeaturedMediaIdInList(mediaModel.getMediaId(), mPosts); for (int position : indexList) { PostModel post = getItem(position); if (post != null) { mFeaturedImageUrls.put(post.getId(), mediaModel.getUrl()); notifyItemChanged(position); } } }
Source:
<code>protected void tearDown() { boolean removed = api().deleteAccount(username); <START> assertTrue(removed); <END> }</code><technical_language>This fail if test creates account fails</technical_language>

Target:
protected void tearDown() { api().deleteAccount(username); }
Source:
<code>private BlockingTaskAwareExecutorServiceImpl createExecutorService() { <START> return new BlockingTaskAwareExecutorServiceImpl("BlockingAwareTest-Controller", new ThreadPoolExecutor(1, 2, 60, TimeUnit.SECONDS, <END> new LinkedBlockingQueue<>(1000), new DummyThreadFactory()), TIME_SERVICE); }</code><technical_language>Please full test class name for controller thread, for log filtering. Also, some local variables code left</technical_language>

Target:
private BlockingTaskAwareExecutorServiceImpl createExecutorService() { final String controllerName = "Controller-" + getClass().getSimpleName(); final ExecutorService realOne = new ThreadPoolExecutor(1, 2, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new DummyThreadFactory()); return new BlockingTaskAwareExecutorServiceImpl(controllerName, realOne, TIME_SERVICE); }
Source:
<code>public Object getCurrentTransactionId() { <START> com.arjuna.ats.internal.jta.transaction.jts.TransactionImple transaction = <END> com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.getTransaction(); if (transaction == null) return null; return transaction.get_uid(); }</code><technical_language>Try remove package</technical_language>

Target:
public Object getCurrentTransactionId() { com.arjuna.ats.internal.jta.transaction.jts.TransactionImple transaction = TransactionImple.getTransaction(); if (transaction == null) return null; return transaction.get_uid(); }
Source:
<code>public void createODKDirs() throws RuntimeException { <START> if (!new StorageStateProvider().isStorageMounted()) { <END> throw new RuntimeException( Collect.getInstance().getString(R.string.sdcard_unmounted, Environment.getExternalStorageState())); } for (String dirPath : new StoragePathProvider().getOdkDirPaths()) { File dir = new File(dirPath); if (!dir.exists()) { if (!dir.mkdirs()) { String message = Collect.getInstance().getString(R.string.cannot_create_directory, dirPath); Timber.w(message); throw new RuntimeException(message); } } else { if (!dir.isDirectory()) { String message = Collect.getInstance().getString(R.string.not_a_directory, dirPath); Timber.w(message); throw new RuntimeException(message); } } } }</code><technical_language>I nice pull this out a constructor argument. For helps signal this is a dependency for object I want move objects constructed in Dagger allow mock/fake in tests. For moment a arg constructor in StoragePathProvider</technical_language>

Target:
public void createODKDirs() throws RuntimeException { if (!storageStateProvider.isStorageMounted()) { throw new RuntimeException(context.getString(R.string.sdcard_unmounted, Environment.getExternalStorageState())); } for (String dirPath : storagePathProvider.getOdkDirPaths()) { File dir = new File(dirPath); if (!dir.exists()) { if (!dir.mkdirs()) { String message = context.getString(R.string.cannot_create_directory, dirPath); Timber.w(message); throw new RuntimeException(message); } } else { if (!dir.isDirectory()) { String message = context.getString(R.string.not_a_directory, dirPath); Timber.w(message); throw new RuntimeException(message); } } } }
Source:
<code>public void createTables(Map<TableReference, byte[]> tableRefToTableMetadata) { if (tableRefToTableMetadata.isEmpty()) { return; } if (tableRefToTableMetadata.size() == 1) { Entry<TableReference, byte[]> element = Iterables.getOnlyElement(tableRefToTableMetadata.entrySet()); createTable(element.getKey(), element.getValue()); return; } for (TableReference tableRef : tableRefToTableMetadata.keySet()) { <START> sanityCheckTableName(tableRef); <END> } tableRefToTableMetadata.entrySet().forEach(entry -> sanityCheckTableMetadata(entry.getKey(), entry.getValue())); delegate.createTables(tableRefToTableMetadata); }</code><technical_language>do a drive-by java-8-ifying of for loop, too</technical_language>

Target:
public void createTables(Map<TableReference, byte[]> tableRefToTableMetadata) { if (tableRefToTableMetadata.isEmpty()) { return; } if (tableRefToTableMetadata.size() == 1) { Entry<TableReference, byte[]> element = Iterables.getOnlyElement(tableRefToTableMetadata.entrySet()); createTable(element.getKey(), element.getValue()); return; } tableRefToTableMetadata.keySet().forEach(ValidatingQueryRewritingKeyValueService::sanityCheckTableName); tableRefToTableMetadata.entrySet().forEach(entry -> sanityCheckTableMetadata(entry.getKey(), entry.getValue())); delegate.createTables(tableRefToTableMetadata); }
Source:
<code>private CapabilityCollection loadAllCapabilities() { final List<AccessSection> allCapabilities = new ArrayList<AccessSection>(); ProjectState s = this; do { final AccessSection capabilitiesSection = s.getConfig().getAccessSection(AccessSection.GLOBAL_CAPABILITIES); if (capabilitiesSection != null) { allCapabilities.add(capabilitiesSection); } Project.NameKey parent = s.getProject().getParent(); <START> final Set<Project.NameKey> seen = new HashSet<Project.NameKey>(); <END> seen.add(getProject().getNameKey()); if (parent == null || !seen.add(parent)) { if (s.isAllProjects) { break; } else { parent = allProjectsName; } allCapabilities.add(projectCache.getAllProjects().getConfig() .getAccessSection(AccessSection.GLOBAL_CAPABILITIES)); break; } s = projectCache.get(parent); } while (s != null); return new CapabilityCollection(allCapabilities); }</code><technical_language>resetting set iteration, track of previous projects</technical_language>

Target:
private CapabilityCollection loadAllCapabilities() { final List<AccessSection> allCapabilities = new ArrayList<AccessSection>(); ProjectState s = this; final Set<Project.NameKey> seen = new HashSet<Project.NameKey>(); do { final AccessSection capabilitiesSection = s.getConfig().getAccessSection(AccessSection.GLOBAL_CAPABILITIES); if (capabilitiesSection != null) { allCapabilities.add(capabilitiesSection); } if (s.isAllProjects) { break; } final Project.NameKey parent = s.getProject().getParent(); seen.add(getProject().getNameKey()); if (!seen.add(parent)) { break; } s = projectCache.get(parent); } while (s != null); return new CapabilityCollection(allCapabilities); }
Source:
<code>public QuietPeriodIndicator(@NonNull Registry registry, @NonNull QuietPeriodIndicatorConfigurationProperties config) { this.registry = registry; long startEpochMillis = parseIso(config.getStartIso()); long endEpochMillis = parseIso(config.getEndIso()); this.startEpochMillis = startEpochMillis; this.endEpochMillis = endEpochMillis; this.suppressedTriggerTypes = config.getSuppressedTriggerTypes(); this.enabled = config.isEnabled() && (startEpochMillis > 0 && endEpochMillis > 0); if (this.enabled) { log.info("Enabling quiet periods. Span in millis: to {}, ISO to (inclusive)", startEpochMillis, endEpochMillis, config.getStartIso(), config.getEndIso()); <START> log.info("Will suppress triggers of types during quiet periods.", config.getSuppressedTriggerTypes()); <END> } else { log.info("Not enabling quiet periods."); } PolledMeter.using(registry).withName("quietPeriod.enabled").monitorValue(this, QuietPeriodIndicator::gaugeMonitor); quietPeriodTestId = registry.createId("quietPeriod.tests"); }</code><technical_language>warn this, personally</technical_language>

Target:
public QuietPeriodIndicator(@NonNull Registry registry, @NonNull QuietPeriodIndicatorConfigurationProperties config) { this.registry = registry; long startEpochMillis = parseIso(config.getStartIso()); long endEpochMillis = parseIso(config.getEndIso()); this.startEpochMillis = startEpochMillis; this.endEpochMillis = endEpochMillis; this.suppressedTriggerTypes = config.getSuppressedTriggerTypes(); this.enabled = config.isEnabled() && (startEpochMillis > 0 && endEpochMillis > 0); if (this.enabled) { log.warn("Enabling quiet periods. Span in millis: to {}, ISO to (inclusive)", startEpochMillis, endEpochMillis, config.getStartIso(), config.getEndIso()); log.warn("Will suppress triggers of types during quiet periods.", config.getSuppressedTriggerTypes()); } PolledMeter.using(registry).withName("quietPeriod.enabled").monitorValue(this, QuietPeriodIndicator::gaugeMonitor); quietPeriodTestId = registry.createId("quietPeriod.tests"); }
Source:
<code>public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row parameters, SubQueryResults subQueryResults) { if (analysis.tables().isEmpty()) { consumer.accept(InMemoryBatchIterator.empty(SENTINEL), null); return; } Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate( plannerContext.transactionContext(), plannerContext.functions(), x, parameters, subQueryResults ); ArrayList<String> toRefresh = new ArrayList<>(); for (Map.Entry<Table<Symbol>, DocTableInfo> table : analysis.tables().entrySet()) { var tableInfo = table.getValue(); var tableSymbol = table.getKey(); if (tableSymbol.partitionProperties().isEmpty()) { toRefresh.addAll(Arrays.asList(tableInfo.concreteOpenIndices())); } else { var partitionName = toPartitionName( tableInfo, <START> tableSymbol.partitionProperties().stream().map(p -> p.map(eval)).collect(toList())); <END> if (!tableInfo.partitions().contains(partitionName)) { throw new PartitionUnknownException(partitionName); } toRefresh.add(partitionName.asIndexName()); } } RefreshRequest request = new RefreshRequest(toRefresh.toArray(String[]::new)); request.indicesOptions(IndicesOptions.lenientExpandOpen()); var transportRefreshAction = dependencies.transportActionProvider().transportRefreshAction(); transportRefreshAction.execute( request, new OneRowActionListener<>( consumer, response -> new Row1(toRefresh.isEmpty() ? -1L : (long) toRefresh.size()) ) ); }</code><technical_language>Lists2.map(tableSymbol.partitionProperties(), p -> p.map(eval)) instead of stream api</technical_language>

Target:
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row parameters, SubQueryResults subQueryResults) { if (analysis.tables().isEmpty()) { consumer.accept(InMemoryBatchIterator.empty(SENTINEL), null); return; } Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate( plannerContext.transactionContext(), plannerContext.functions(), x, parameters, subQueryResults ); ArrayList<String> toRefresh = new ArrayList<>(); for (Map.Entry<Table<Symbol>, DocTableInfo> table : analysis.tables().entrySet()) { var tableInfo = table.getValue(); var tableSymbol = table.getKey(); if (tableSymbol.partitionProperties().isEmpty()) { toRefresh.addAll(Arrays.asList(tableInfo.concreteOpenIndices())); } else { var partitionName = toPartitionName( tableInfo, Lists2.map(tableSymbol.partitionProperties(), p -> p.map(eval))); if (!tableInfo.partitions().contains(partitionName)) { throw new PartitionUnknownException(partitionName); } toRefresh.add(partitionName.asIndexName()); } } RefreshRequest request = new RefreshRequest(toRefresh.toArray(String[]::new)); request.indicesOptions(IndicesOptions.lenientExpandOpen()); var transportRefreshAction = dependencies.transportActionProvider().transportRefreshAction(); transportRefreshAction.execute( request, new OneRowActionListener<>( consumer, response -> new Row1(toRefresh.isEmpty() ? -1L : (long) toRefresh.size()) ) ); }
Source:
<code>private IStatus runWait(IProgressMonitor monitor) { boolean allStarted = false; long startTime = System.currentTimeMillis(); long endTime = startTime + maxWait; IModule[] modules = server.getModules(); monitor.beginTask("Checking module states for " + server.getName(), maxWait * 1000); while( !allStarted && System.currentTimeMillis() < endTime) { allStarted = true; long thisLoopStart = System.currentTimeMillis(); for( int i = 0; i < modules.length; i++ ) { IModule[] temp = new IModule[]{modules[i]}; int state = getModuleState(temp, new SubProgressMonitor(monitor, 1000)); ((Server)server).setModuleState(temp, state); boolean started = state == IServer.STATE_STARTED; <START> allStarted = allStarted && started; <END> ((Server)server).setModuleState(temp, state); } try { Thread.sleep(500); } catch(InterruptedException ie) { } long timeDif = System.currentTimeMillis() - thisLoopStart; monitor.worked((int)timeDif - (modules.length * 100)); } return Status.OK_STATUS; }</code><technical_language>((Server)server).setModuleState(temp, state) is called in this loop</technical_language>

Target:
private IStatus runWait(IProgressMonitor monitor) { boolean allStarted = false; long startTime = System.currentTimeMillis(); long endTime = startTime + maxWait; IModule[] modules = server.getModules(); monitor.beginTask("Checking module states for " + server.getName(), maxWait * 1000); while( !allStarted && System.currentTimeMillis() < endTime) { allStarted = true; long thisLoopStart = System.currentTimeMillis(); for( int i = 0; i < modules.length; i++ ) { IModule[] temp = new IModule[]{modules[i]}; int state = getModuleState(temp, new SubProgressMonitor(monitor, 1000)); boolean started = state == IServer.STATE_STARTED; allStarted = allStarted && started; ((Server)server).setModuleState(temp, state); } try { Thread.sleep(500); } catch(InterruptedException ie) { } long timeDif = System.currentTimeMillis() - thisLoopStart; monitor.worked((int)timeDif - (modules.length * 100)); } return Status.OK_STATUS; }
Source:
<code>private void writeResource(Resource r) throws IOException { try { Map<String, Property> props = getProperties(r); int len = calcMaxLength(props.keySet()); boolean first = true; _ps.newLine(); writeValue(r); for ( Map.Entry<String, Property> entry : props.entrySet() ) { <START> if ( first ) { first = false; } else { _ps.append(" ;"); } <END> _ps.newLine(); writePropertyDecl(entry.getKey(), len); writePropertyValues(r, entry.getValue()); } _ps.append(" ."); _ps.newLine(); } catch (IOException e) { throw e; } catch (Throwable t) { throw new IOException("Unexpected exception while writting: " + r.getURI(), t); } }</code><technical_language>reformatted class</technical_language>

Target:
private void writeResource(Resource r) throws IOException { Map<String, Property> props = getProperties(r); int len = calcMaxLength(props.keySet()); boolean first = true; bufferedWriter.newLine(); writeValue(r); for (Map.Entry<String, Property> entry : props.entrySet()) { if (first) { first = false; } else { bufferedWriter.append(" ;"); } bufferedWriter.newLine(); writePropertyDecl(entry.getKey(), len); writePropertyValues(r, entry.getValue()); } bufferedWriter.append(" ."); bufferedWriter.newLine(); }
Source:
<code>public RuntimeCapabilityRegistration removeCapability(String capabilityName, CapabilityContext context, PathAddress registrationPoint) { try { <START> writeLock.lock(); <END> CapabilityId capabilityId = new CapabilityId(capabilityName, context); RuntimeCapabilityRegistration removed = null; RuntimeCapabilityRegistration candidate = capabilities.get(capabilityId); if (candidate != null) { RegistrationPoint rp = new RegistrationPoint(registrationPoint, null); if (candidate.removeRegistrationPoint(rp)) { if (candidate.getRegistrationPointCount() == 0) { removed = capabilities.remove(capabilityId); requirements.remove(capabilityId); runtimeOnlyRequirements.remove(capabilityId); } else { Map<String, RuntimeRequirementRegistration> candidateRequirements = requirements.get(capabilityId); if (candidateRequirements != null) { for (String req : candidateRequirements.keySet().toArray(new String[candidateRequirements.size()])) { removeRequirement(new RuntimeRequirementRegistration(req, capabilityName, context, rp), false); } } candidateRequirements = runtimeOnlyRequirements.get(capabilityId); if (candidateRequirements != null) { for (String req : candidateRequirements.keySet().toArray(new String[candidateRequirements.size()])) { removeRequirement(new RuntimeRequirementRegistration(req, capabilityName, context, rp), true); } } } } } if (removed != null) { modified = true; } return removed; } finally { writeLock.unlock(); } }</code><technical_language>of lock acquisitions need try/finally</technical_language>

Target:
public RuntimeCapabilityRegistration removeCapability(String capabilityName, CapabilityContext context, PathAddress registrationPoint) { writeLock.lock(); try { CapabilityId capabilityId = new CapabilityId(capabilityName, context); RuntimeCapabilityRegistration removed = null; RuntimeCapabilityRegistration candidate = capabilities.get(capabilityId); if (candidate != null) { RegistrationPoint rp = new RegistrationPoint(registrationPoint, null); if (candidate.removeRegistrationPoint(rp)) { if (candidate.getRegistrationPointCount() == 0) { removed = capabilities.remove(capabilityId); requirements.remove(capabilityId); runtimeOnlyRequirements.remove(capabilityId); } else { Map<String, RuntimeRequirementRegistration> candidateRequirements = requirements.get(capabilityId); if (candidateRequirements != null) { for (String req : candidateRequirements.keySet().toArray(new String[candidateRequirements.size()])) { removeRequirement(new RuntimeRequirementRegistration(req, capabilityName, context, rp), false); } } candidateRequirements = runtimeOnlyRequirements.get(capabilityId); if (candidateRequirements != null) { for (String req : candidateRequirements.keySet().toArray(new String[candidateRequirements.size()])) { removeRequirement(new RuntimeRequirementRegistration(req, capabilityName, context, rp), true); } } } } } if (removed != null) { modified = true; } return removed; } finally { writeLock.unlock(); } }
Source:
<code>public InMemoryClientRegistrationRepository(ClientRegistration... registrations) { <START> this.registrations = toUnmodifiableMapByRegistrationId(Stream.of(checkEmptyRegistrations(registrations, Assert::notEmpty))); <END> }</code><technical_language>Is a reason change this is</technical_language>

Target:
public InMemoryClientRegistrationRepository(ClientRegistration... registrations) { Assert.notEmpty(registrations, "registrations cannot be empty"); this.registrations = createClientRegistrationIdToClientRegistration(Arrays.asList(registrations)); }
Source:
<code>private Condition parse(FunctionDef functionDef) throws ParseException { parseReturnSentence(); functionName = parseFunctionName(); <START> functionName = functionName.substring(KIE_FUNCTIONS.length(), functionName.length()); <END> Condition condition = new Condition(functionName); String param; String[] variableParam; boolean first = true; for (ParamDef paramDef : functionDef.getParams()) { if (first) { variableParam = parseVariableParam(); param = variableParam[0] + (variableParam[1] != null ? ("." + variableParam[1]) : ""); first = false; } else { parseParamDelimiter(); param = parseStringParameter(); } condition.addParam(param); } parseFunctionClose(); parseSentenceClose(); return condition; }</code><technical_language>functionName.length() invocation is redundant here</technical_language>

Target:
private Condition parse(FunctionDef functionDef) throws ParseException { parseReturnSentence(); functionName = parseFunctionName(); functionName = functionName.substring(KIE_FUNCTIONS.length()); parseFunctionOpen(); Condition condition = new Condition(functionName); String param; String[] variableParam; boolean first = true; for (ParamDef ignored : functionDef.getParams()) { if (first) { variableParam = parseVariableParam(); param = variableParam[0] + (variableParam[1] != null ? ("." + variableParam[1]) : ""); first = false; } else { parseParamDelimiter(); param = parseStringParameter(); } condition.addParam(param); } parseFunctionClose(); parseSentenceClose(); return condition; }
Source:
<code>private String exportReport(final ExecResult execResult, final ReportExportFormat format) { notNull(execResult, "execResult"); notNull(format, "format"); final ObjectNode root = mapper.createObjectNode(); final ObjectNode child = mapper.createObjectNode(); child.put("result", execResult.getJsonNode()); <START> child.put("format", format.name().toLowerCase()); <END> root.put("result_req", child); try { return restTemplate.postForObject(EXPORTING_URI, root, UriResponse.class).getUri(); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to export report", e); } }</code><technical_language>add enum instead of ....name().toLowerCase()</technical_language>

Target:
private String exportReport(final ExecResult execResult, final ReportExportFormat format) { notNull(execResult, "execResult"); notNull(format, "format"); final ObjectNode root = mapper.createObjectNode(); final ObjectNode child = mapper.createObjectNode(); child.put("result", execResult.getJsonNode()); child.put("format", format.getValue()); root.put("result_req", child); try { return restTemplate.postForObject(EXPORTING_URI, root, UriResponse.class).getUri(); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to export report", e); } }
Source:
<code>public void testExecutableAttributes() throws Exception { FS fs = FS.DETECTED; <START> org.junit.Assume.assumeTrue(fs.getClass().equals(FS_POSIX_Java7.class)); <END> File f = new File(trash, "bla"); assertTrue(f.createNewFile()); assertFalse(fs.canExecute(f)); String umask = readUmask(); if (umask == null) { return; } char others = umask.charAt(umask.length() - 1); boolean badUmask; if (others != '0' && others != '2' && others != '4' && others != '6') { badUmask = true; } else { badUmask = false; } Set<PosixFilePermission> permissions = readPermissions(f); assertTrue(!permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.GROUP_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.OWNER_EXECUTE)); fs.setExecute(f, true); permissions = readPermissions(f); assertTrue("'owner' execute permission not set", permissions.contains(PosixFilePermission.OWNER_EXECUTE)); assertTrue("'group' execute permission not set", permissions.contains(PosixFilePermission.GROUP_EXECUTE)); if (badUmask) { assertFalse("'others' execute permission set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); fail("Unexpected umask during test execution: " + umask); } else { assertTrue("'others' execute permission not set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); } }</code><technical_language>If introduce FS_POSIX_Java8 (subclassing FS_POSIX_Java7) this test skipped valid. If system I "sh" understand buildin umask command test skipped. I org.junit.Assume.assumeTrue(fs instanceof FS_POSIX_Java7); String umask = readUmask(); org.junit.Assume.assumeTrue(umask != null);</technical_language>

Target:
public void testExecutableAttributes() throws Exception { FS fs = FS.DETECTED; assumeTrue(fs instanceof FS_POSIX_Java7); File f = new File(trash, "bla"); assertTrue(f.createNewFile()); assertFalse(fs.canExecute(f)); String umask = readUmask(); org.junit.Assume.assumeNotNull(umask); char others = umask.charAt(umask.length() - 1); boolean badUmask; if (others != '0' && others != '2' && others != '4' && others != '6') { badUmask = true; } else { badUmask = false; } Set<PosixFilePermission> permissions = readPermissions(f); assertTrue(!permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.GROUP_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.OWNER_EXECUTE)); fs.setExecute(f, true); permissions = readPermissions(f); assertTrue("'owner' execute permission not set", permissions.contains(PosixFilePermission.OWNER_EXECUTE)); assertTrue("'group' execute permission not set", permissions.contains(PosixFilePermission.GROUP_EXECUTE)); if (badUmask) { assertFalse("'others' execute permission set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); System.err.println("WARNING: your system's umask: \"" + umask + "\" doesn't allow FSJava7Test to test if setting posix" + " permissions for \"others\" works properly"); assumeFalse(badUmask); } else { assertTrue("'others' execute permission not set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); } }
Source:
<code>public List<Class> getSupportedTypes() { <START> return new ArrayList<>(Arrays.asList(Period.class)); <END> }</code><technical_language>Collections.singletonList</technical_language>

Target:
public List<Class> getSupportedTypes() { return Collections.singletonList(Period.class); }
Source:
<code>public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); <START> final News news = Parcels.unwrap(getActivity().getIntent().getParcelableExtra(Constants.NEWS)); <END> setUpFAB(view, news); this.newsDetail = (RecyclerView) view.findViewById(R.id.news_detail); this.newsDetail.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); this.newsDetail.setLayoutManager(layoutManager); this.newsDetail.setAdapter(new NewsDetailAdapter(this, news)); RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST); this.newsDetail.addItemDecoration(itemDecoration); }</code><technical_language>is final</technical_language>

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); News news = Parcels.unwrap(getActivity().getIntent().getParcelableExtra(Constants.NEWS)); setUpFAB(view, news); this.newsDetail = (RecyclerView) view.findViewById(R.id.news_detail); this.newsDetail.setHasFixedSize(true); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); this.newsDetail.setLayoutManager(layoutManager); this.newsDetail.setAdapter(new NewsDetailAdapter(this, news)); RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST); this.newsDetail.addItemDecoration(itemDecoration); }
Source:
<code>private void fillActions(WorkflowInstance instance, boolean includeStateVariables, Long requestedMaxActions) { long maxActions = getMaxActions(requestedMaxActions); String sql = sqlVariants .limit("select nflow_workflow_action.* from nflow_workflow_action where workflow_id = ? order by id desc", maxActions); List<WorkflowInstanceAction.Builder> actionBuilders = jdbc.query(sql, new WorkflowInstanceActionRowMapper(sqlVariants), instance.id); if (includeStateVariables) { Map<Long, Map<String, String>> actionStates = fetchActionStateVariables(instance, actionBuilders.size(), maxActions); actionBuilders.forEach(builder -> { Map<String, String> actionState = actionStates.get(builder.getId()); if (actionState != null) { builder.setUpdatedStateVariables(actionState); } }); } <START> instance.actions.addAll(actionBuilders.stream().map(WorkflowInstanceAction.Builder::build).collect(toList())); <END> }</code><technical_language>actionBuilders.stream().map(WorkflowInstanceAction.Builder::build).forEach(instance.actions::add)</technical_language>

Target:
private void fillActions(WorkflowInstance instance, boolean includeStateVariables, Long requestedMaxActions) { long maxActions = getMaxActions(requestedMaxActions); String sql = sqlVariants .limit("select nflow_workflow_action.* from nflow_workflow_action where workflow_id = ? order by id desc", maxActions); List<WorkflowInstanceAction.Builder> actionBuilders = jdbc.query(sql, new WorkflowInstanceActionRowMapper(sqlVariants), instance.id); if (includeStateVariables) { Map<Long, Map<String, String>> actionStates = fetchActionStateVariables(instance, actionBuilders.size(), maxActions); actionBuilders.forEach(builder -> { Map<String, String> actionState = actionStates.get(builder.getId()); if (actionState != null) { builder.setUpdatedStateVariables(actionState); } }); } actionBuilders.stream().map(WorkflowInstanceAction.Builder::build).forEach(instance.actions::add); }
Source:
<code>public boolean isRecurring() { <START> return period == null && cronExpression == null ? false : true; <END> }</code><technical_language>simply return period != null || cronExpression != null; If IntelliJ, automatically suggests refactors</technical_language>

Target:
public boolean isRecurring() { return period != null || cronExpression != null; }
Source:
<code>public static HealthCheckRegistry getHealthCheckRegistry() { if(healthCheckRegistry == null) { healthCheckRegistry = CrudCheckConfiguration.createHealthCheckRegistry(); } return healthCheckRegistry; <START> } <END></code><technical_language>Do need CrudCheckRegistry CrudCheckConfiguration</technical_language>

Target:
public static HealthCheckRegistry getHealthCheckRegistry() { if(healthCheckRegistry == null) { healthCheckRegistry = createHealthCheckRegistry(); } return healthCheckRegistry; }
Source:
<code>public void removeThreadFilters(IExecutionDMContext[] threads) throws CoreException { <START> synchronized (fFilteredThreadsByTarget) { <END> if (threads != null && threads.length > 0) { IContainerDMContext target = DMContexts.getAncestorOfType(threads[0], IContainerDMContext.class); Set<IExecutionDMContext> set = fFilteredThreadsByTarget.get(target); if (set != null) { set.removeAll(Arrays.asList(threads)); if (set.isEmpty()) { fFilteredThreadsByTarget.remove(target); } } } } }</code><technical_language>clear this is needed</technical_language>

Target:
public void removeThreadFilters( IExecutionDMContext[] threads ) throws CoreException { if ( threads != null && threads.length > 0 ) { IContainerDMContext target = DMContexts.getAncestorOfType(threads[0], IContainerDMContext.class); Set<IExecutionDMContext> set = fFilteredThreadsByTarget.get( target ); if ( set != null ) { set.removeAll( Arrays.asList( threads ) ); if ( set.isEmpty() ) { fFilteredThreadsByTarget.remove( target ); } } } }
Source:
<code>public void reset(ExtSed sed, boolean dataMayChange) { boolean fixed; try { fixed = this.getVisualizerPreferences() .getSelectedSedPreferences().getPlotPreferences().getFixed(); <START> } catch (NullPointerException ex) { <END> fixed = this.getVisualizerPreferences().getPlotPreferences().getFixed(); } resetPlot(sed, fixed, dataMayChange); }</code><technical_language>generally practice add a null check rely exception thrown. If user opens plotter SED is selected, sed null</technical_language>

Target:
public void reset(ExtSed sed, boolean dataMayChange) { boolean fixed = this.getPlotPreferences(sed).getFixed(); resetPlot(sed, fixed, dataMayChange); }
Source:
<code>Set<Status> ignoredStates() { return EnumSet.of( Status.REQUESTED, Status.CREATE_IN_PROGRESS, Status.UPDATE_IN_PROGRESS, Status.UPDATE_REQUESTED, Status.STOP_REQUESTED, Status.START_REQUESTED, Status.STOP_IN_PROGRESS, Status.START_IN_PROGRESS, Status.WAIT_FOR_SYNC, Status.MAINTENANCE_MODE_ENABLED, Status.EXTERNAL_DATABASE_CREATION_IN_PROGRESS, Status.BACKUP_IN_PROGRESS, Status.BACKUP_FAILED, <START> Status.BACKUP_FINISHED, Status.RESTORE_IN_PROGRESS, Status.RESTORE_FAILED, Status.RESTORE_FINISHED <END> ); }</code><technical_language>skip check in case of finished state? is changed in other PR</technical_language>

Target:
Set<Status> ignoredStates() { return EnumSet.of( Status.REQUESTED, Status.CREATE_IN_PROGRESS, Status.UPDATE_IN_PROGRESS, Status.UPDATE_REQUESTED, Status.STOP_REQUESTED, Status.START_REQUESTED, Status.STOP_IN_PROGRESS, Status.START_IN_PROGRESS, Status.WAIT_FOR_SYNC, Status.MAINTENANCE_MODE_ENABLED, Status.EXTERNAL_DATABASE_CREATION_IN_PROGRESS, Status.BACKUP_IN_PROGRESS, Status.RESTORE_IN_PROGRESS ); }
Source:
<code>public String getHostName() throws IOException, InterruptedException { String cachedHostName = this.cachedHostName; if(cachedHostName != null) return cachedHostName; VirtualChannel channel = getChannel(); if(channel==null) return null; for( String address : channel.call(new ListPossibleNames())) { try { InetAddress ia = InetAddress.getByName(address); if(!(ia instanceof Inet4Address)) { LOGGER.fine(address+" is not an IPv4 address"); continue; } if(!ComputerPinger.checkIsReachable(ia, 3)) { LOGGER.fine(address+" didn't respond to ping"); continue; } cachedHostName = ia.getCanonicalHostName(); this.cachedHostName = cachedHostName; return cachedHostName; } catch (IOException e) { LOGGER.log(Level.FINE, "Failed to parse "+address,e); } } <START> cachedHostName = channel.call(new GetFallbackName()); <END> this.cachedHostName = cachedHostName; return cachedHostName; }</code><technical_language>null a result this... in case try resolve host name repeatedly _every_ time method is called</technical_language>

Target:
public String getHostName() throws IOException, InterruptedException { if(hostNameCached) return cachedHostName; VirtualChannel channel = getChannel(); if(channel==null) return null; for( String address : channel.call(new ListPossibleNames())) { try { InetAddress ia = InetAddress.getByName(address); if(!(ia instanceof Inet4Address)) { LOGGER.fine(address+" is not an IPv4 address"); continue; } if(!ComputerPinger.checkIsReachable(ia, 3)) { LOGGER.fine(address+" didn't respond to ping"); continue; } cachedHostName = ia.getCanonicalHostName(); hostNameCached = true; return cachedHostName; } catch (IOException e) { LOGGER.log(Level.FINE, "Failed to parse "+address,e); } } cachedHostName = channel.call(new GetFallbackName()); hostNameCached = true; return cachedHostName; }
Source:
<code>public void setExcludedPatterns(Collection<String> regularExpressions) { <START> regularExpressions.forEach(regex -> excludeRegex(regex)); <END> }</code><technical_language>)</technical_language>

Target:
public void setExcludedPatterns(Collection<String> regularExpressions) { excludedPatterns.clear(); regularExpressions.forEach(regex -> excludeRegex(regex)); }
Source:
<code>public void convertWorks() { WorkflowExecutor executor = new WorkflowExecutor(1, "host", 2, "executorGroup", now(), now().plusMinutes(1), now() <START> .plusMinutes(15), now().plusSeconds(-7)); <END> ListWorkflowExecutorResponse resp = converter.convert(executor); assertThat(resp.id, is(executor.id)); assertThat(resp.host, is(executor.host)); assertThat(resp.pid, is(executor.pid)); assertThat(resp.executorGroup, is(executor.executorGroup)); assertThat(resp.started, is(executor.started)); assertThat(resp.active, is(executor.active)); assertThat(resp.expires, is(executor.expires)); assertThat(resp.stopped, is(executor.stopped)); }</code><technical_language>suggestion .plusMinutes(15), now().minusSeconds(7));</technical_language>

Target:
public void convertWorks() { WorkflowExecutor executor = new WorkflowExecutor(1, "host", 2, "executorGroup", now(), now().plusMinutes(1), now().plusMinutes(15), now().minusSeconds(7)); ListWorkflowExecutorResponse resp = converter.convert(executor); assertThat(resp.id, is(executor.id)); assertThat(resp.host, is(executor.host)); assertThat(resp.pid, is(executor.pid)); assertThat(resp.executorGroup, is(executor.executorGroup)); assertThat(resp.started, is(executor.started)); assertThat(resp.active, is(executor.active)); assertThat(resp.expires, is(executor.expires)); assertThat(resp.stopped, is(executor.stopped)); }
Source:
<code>protected void onResume() { super.onResume(); Intent callingintent = getIntent(); Bundle extras = callingintent.getExtras(); <START> extras.getString("message_type_id"); <END> extras.getString("message"); String myString = extras.getString("extrasString"); Log.e("EXTRAS", extras.toString()); final IntentFilter filter = new IntentFilter("com.google.android.c2dm.intent.RECEIVE"); filter.addCategory("com.example.gcm"); filter.setPriority(1); registerReceiver(dynamicReceiver, filter, "com.google.android.c2dm.permission.SEND", null); }</code><technical_language>clean non-generic keys</technical_language>

Target:
protected void onResume() { super.onResume(); final IntentFilter filter = new IntentFilter("com.google.android.c2dm.intent.RECEIVE"); filter.addCategory("com.example.gcm"); filter.setPriority(1); registerReceiver(dynamicReceiver, filter, "com.google.android.c2dm.permission.SEND", null); }
Source:
<code>private void applyDiff(MapDiff<? extends K, ? extends V> diff, Map<K, V> map) { for (K <START> name : <END> diff.getRemovedKeys()) map.remove(name); for (K key : diff.getChangedKeys()) { map.put(key, diff.getNewValue(key)); } for (K key : diff.getAddedKeys()) { map.put(key, diff.getNewValue(key)); } }</code><technical_language>rename key</technical_language>

Target:
private void applyDiff(MapDiff<? extends K, ? extends V> diff, Map<K, V> map) { for (K key : diff.getRemovedKeys()) { map.remove(key); } for (K key : diff.getChangedKeys()) { map.put(key, diff.getNewValue(key)); } for (K key : diff.getAddedKeys()) { map.put(key, diff.getNewValue(key)); } }
Source:
<code>public final Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { wrapEntryIfNeeded(ctx, command); <START> if (ctx.lookupEntry(command.getKey()) != null && ctx.lookupEntry(command.getKey()).getMetadata() instanceof L1Metadata) { <END> log.tracef("Put with L1 metadata"); } return setSkipRemoteGetsAndInvokeNextForDataCommand(ctx, command); }</code><technical_language>leftover debugging</technical_language>

Target:
public final Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable { wrapEntryIfNeeded(ctx, command); return setSkipRemoteGetsAndInvokeNextForDataCommand(ctx, command); }
Source:
<code><START> Rescheduler rescheduler() { <END> checkState(rescheduler != null, "Rescheduler is not initialized"); return rescheduler; }</code><technical_language>This method private</technical_language>

Target:
private Rescheduler rescheduler() { checkState(rescheduler != null, "Rescheduler is not initialized"); return rescheduler; }
Source:
<code>public void run() { if(isValid()) { if(getRunLocal() == false) { try{ ScpClient scpclient = new ScpClient(); serverfileName = fileName.substring(fileName.lastIndexOf('/')+1); tmpfileName="/tmp/"+ serverfileName; scpclient.transfer(fileName,tmpfileName); } catch (JSchException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } final String[] script = buildStandardScript(); final String[] envVars = getEnvironmentVariables(); if(continueRun) { Display.getDefault().asyncExec(new Runnable() { public void run() { final ScriptConsole console; if(getRunLocal() == false) { console = ScriptConsole.getInstance(serverfileName); console.run(script, envVars, new PasswordPrompt(IDESessionSettings.password), new StapErrorParser()); scriptConsoleInitialized(console); } else { console = ScriptConsole.getInstance(fileName); console.runLocally(script, envVars, new PasswordPrompt(IDESessionSettings.password), new StapErrorParser()); scriptConsoleInitialized(console); <START> } <END> } }); } } }</code><technical_language>scriptConsoleInitialized(console) is in if else clauses, please move of if/else structure</technical_language>

Target:
public void run() { if(isValid()) { if(getRunLocal() == false) { try{ ScpClient scpclient = new ScpClient(); serverfileName = fileName.substring(fileName.lastIndexOf('/')+1); tmpfileName="/tmp/"+ serverfileName; scpclient.transfer(fileName,tmpfileName); } catch (JSchException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } final String[] script = buildStandardScript(); final String[] envVars = getEnvironmentVariables(); if(continueRun) { Display.getDefault().asyncExec(new Runnable() { public void run() { final ScriptConsole console; if(getRunLocal() == false) { console = ScriptConsole.getInstance(serverfileName); console.run(script, envVars, new PasswordPrompt(IDESessionSettings.password), new StapErrorParser()); } else { console = ScriptConsole.getInstance(fileName); console.runLocally(script, envVars, new PasswordPrompt(IDESessionSettings.password), new StapErrorParser()); } scriptConsoleInitialized(console); } }); } } }
Source:
<code>private String getArtifactText() throws NoOpenCoreException, SolrServerException{ String indexedText = KeywordSearch.getServer().getSolrContent(this.objectId, 1); if (indexedText == null || indexedText.isEmpty()) { <START> return NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentViewer.getSolrContent.noTxtYetMsg", "artifact"); <END> } indexedText = EscapeUtil.escapeHtml(indexedText).trim(); StringBuilder sb = new StringBuilder(indexedText.length() + 20); sb.append("<pre>").append(indexedText).append("</pre>"); return sb.toString(); }</code><technical_language>For artifact, this is simply error condition</technical_language>

Target:
private String getArtifactText() throws NoOpenCoreException, SolrServerException { String indexedText = KeywordSearch.getServer().getSolrContent(this.objectId, 1); if (indexedText == null || indexedText.isEmpty()) { return Bundle.IndexedText_errorMessage_errorGettingText(); } indexedText = EscapeUtil.escapeHtml(indexedText).trim(); StringBuilder sb = new StringBuilder(indexedText.length() + 20); sb.append("<pre>").append(indexedText).append("</pre>"); return sb.toString(); }
Source:
<code>public HttpResponse doRemoveJobFromView(@QueryParameter String name) throws IOException, ServletException { checkPermission(View.CONFIGURE); if(name==null) throw new Failure("Query parameter 'name' is required"); TopLevelItem item = resolveName(name); if (item==null) <START> throw new Failure("Query parameter 'name' does not correspond to a known item"); <END> if (remove(item)) owner.save(); return HttpResponses.ok(); }</code><technical_language>"known readable"</technical_language>

Target:
public HttpResponse doRemoveJobFromView(@QueryParameter String name) throws IOException, ServletException { checkPermission(View.CONFIGURE); if(name==null) throw new Failure("Query parameter 'name' is required"); TopLevelItem item = resolveName(name); if (item==null) throw new Failure("Query parameter 'name' does not correspond to a known and readable item"); if (remove(item)) owner.save(); return HttpResponses.ok(); }
Source:
<code>public void performAction() { boolean isSinglePanelViewNow = mainFrame.toggleSinglePanel(); if (isSinglePanelViewNow) { <START> this.previousRatio = mainFrame.getSplitPane().getSplitRatio(); <END> hideOtherPanel(); } else { mainFrame.getSplitPane().setSplitRatio(this.previousRatio); showOtherPanel(); } }</code><technical_language>minor style issue - please explicitly state 'this' needed</technical_language>

Target:
public void performAction() { boolean isSinglePanelViewNow = mainFrame.toggleSinglePanel(); if (isSinglePanelViewNow) { previousRatio = mainFrame.getSplitPane().getSplitRatio(); hideInactivePanel(); } else { mainFrame.getSplitPane().setSplitRatio(previousRatio); showInactivePanel(); } }
Source:
<code>public void start() { if (timer != null) { throw new IllegalStateException("ServerChecker is already started"); } <START> timer = new Timer("Server-" + serverRef + <END> "-readiness-checker", true); timer.schedule(new ServerCheckingTask(), 0); }</code><technical_language>share Timer instance for server checks for machine</technical_language>

Target:
public void start() { timer.schedule(new ServerCheckingTask(), 0); }
Source:
<code>public void upload(File file, String objectId, String md5, final boolean redo) throws IOException { <START> boolean flag = redo; <END> for (int retry = 0; retry < retryNumber; retry++) try { if (flag) { startUpload(file, objectId, md5, flag); } else { resumeIfPossible(file, objectId, md5, retry == 0 ? true : false); } return; } catch (NotRetryableException e) { log.warn( "Upload was not completed successfully in the last execution. Checking data integrity. Please wait..."); flag = !storageService.isUploadDataRecoverable(objectId, file.length()); } }</code><technical_language>name flag represent</technical_language>

Target:
public void upload(File file, String objectId, String md5, final boolean redo) throws IOException { boolean tryAgain = redo; for (int retry = 0; retry < retryNumber; retry++) try { if (tryAgain) { startUpload(file, objectId, md5, tryAgain); } else { resumeIfPossible(file, objectId, md5, retry == 0 ? true : false); } return; } catch (NotRetryableException e) { log.warn( "Upload was not completed successfully in the last execution. Checking data integrity. Please wait..."); tryAgain = !storageService.isUploadDataRecoverable(objectId, file.length()); } }