auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>HdfsFileStatus startFile(String src, PermissionStatus permissions, String holder, String clientMachine, EnumSet<CreateFlag> flag, boolean createParent, short replication, long blockSize, CryptoProtocolVersion[] supportedVersions, String ecPolicyName, String storagePolicy, boolean logRetryCache) throws IOException { HdfsFileStatus status; try { status = startFileInt(src, permissions, holder, clientMachine, flag, createParent, replication, blockSize, supportedVersions, ecPolicyName, storagePolicy, logRetryCache); } catch (AccessControlException e) { <START> logAuditEvent(false, "create(options=" + flag.toString() + ")", src); <END> throw e; } logAuditEvent(true, "create(options=" + flag.toString() + ")", src, status); return status; }</code><technical_language>leave a space "create" is consistent rename? e.g., "create (options=..."</technical_language>

Target:
HdfsFileStatus startFile(String src, PermissionStatus permissions, String holder, String clientMachine, EnumSet<CreateFlag> flag, boolean createParent, short replication, long blockSize, CryptoProtocolVersion[] supportedVersions, String ecPolicyName, String storagePolicy, boolean logRetryCache) throws IOException { HdfsFileStatus status; try { status = startFileInt(src, permissions, holder, clientMachine, flag, createParent, replication, blockSize, supportedVersions, ecPolicyName, storagePolicy, logRetryCache); } catch (AccessControlException e) { logAuditEvent(false, "create (options=" + flag + ")", src); throw e; } logAuditEvent(true, "create (options=" + flag + ")", src, status); return status; }
Source:
<code>private Optional<VSwitch> tryFindVSwitchInVPC(String regionId, String vpcId, String vSwitchId) { checkNotNull(vpcId, "vpcId"); ListVSwitchesOptions listVSwitchesOptions = Strings.isNullOrEmpty(vSwitchId) ? <START> ListVSwitchesOptions.Builder.vpcId(vpcId) : <END> ListVSwitchesOptions.Builder.vpcId(vpcId).vSwitchId(vSwitchId); return api.vSwitchApi().list(regionId, listVSwitchesOptions).firstMatch(Predicates.<VSwitch>notNull()); }</code><technical_language>here. a vSwitchId present calling this</technical_language>

Target:
private Optional<VSwitch> tryFindVSwitchInVPC(String regionId, String vpcId, String vSwitchId) { ListVSwitchesOptions listVSwitchesOptions = ListVSwitchesOptions.Builder.vpcId(vpcId).vSwitchId(vSwitchId); return api.vSwitchApi().list(regionId, listVSwitchesOptions).first(); }
Source:
<code>private void processInstance(Instance inst, InstancesContentEvent instContentEvent, boolean isTesting, boolean isTraining){ inst.setDataset(this.dataset); <START> boolean testAndTrain = false; <END> double[] prediction = null; if (isTesting) { prediction = getVotesForInstance(inst, testAndTrain); this.resultStream.put(newResultContentEvent(prediction, inst, instContentEvent)); } if (isTraining && testAndTrain == false) { trainOnInstanceImpl(inst); if (this.changeDetector != null) { if (prediction == null) { prediction = getVotesForInstance(inst); } boolean correctlyClassifies = this.correctlyClassifies(inst,prediction); double oldEstimation = this.changeDetector.getEstimation(); this.changeDetector.input(correctlyClassifies ? 0 : 1); if (this.changeDetector.getEstimation() > oldEstimation) { this.resetLearning(); this.changeDetector.resetLearning(); } } } }</code><technical_language>double[] is ensemble, right? ModelAggregatorProcessor represent a single VHT. do combine things</technical_language>

Target:
private void processInstance(Instance inst, InstancesContentEvent instContentEvent, boolean isTesting, boolean isTraining){ inst.setDataset(this.dataset); boolean testAndTrain = false; double[] prediction = null; if (isTesting) { prediction = getVotesForInstance(inst, testAndTrain); this.resultStream.put(newResultContentEvent(prediction, inst, instContentEvent)); } if (isTraining && testAndTrain == false) { trainOnInstanceImpl(inst); if (this.changeDetector != null) { if (prediction == null) { prediction = getVotesForInstance(inst); } boolean correctlyClassifies = this.correctlyClassifies(inst,prediction); double oldEstimation = this.changeDetector.getEstimation(); this.changeDetector.input(correctlyClassifies ? 0 : 1); if (this.changeDetector.getEstimation() > oldEstimation) { logger.info("Change detected, resetting the classifier"); this.resetLearning(); this.changeDetector.resetLearning(); } } } }
Source:
<code>public HttpResponse execute(ClientRequestContext ctx, HttpRequest req) throws Exception { String credentials = basicCredentials.getCredentials(); <START> if (Objects.nonNull(credentials)) { <END> ctx.addAdditionalRequestHeader(HttpHeaderNames.AUTHORIZATION, credentials); } return delegate().execute(ctx, req); }</code><technical_language>suggestion if (credentials != null) {</technical_language>

Target:
public HttpResponse execute(ClientRequestContext ctx, HttpRequest req) throws Exception { String credentials = basicCredentials.getCredentials(); if (credentials != null) { ctx.addAdditionalRequestHeader(HttpHeaderNames.AUTHORIZATION, credentials); } return delegate().execute(ctx, req); }
Source:
<code>private static FileObject findDataCleanerHome() throws FileSystemException { final FileSystemManager manager = VFSUtils.getFileSystemManager(); FileObject candidate = null; String env = System.getenv("DATACLEANER_HOME"); if (!StringUtils.isNullOrEmpty(env)) { if (env.startsWith("~")) { String userHomePath = System.getProperty("user.home"); env = env.replace("~", userHomePath); } candidate = manager.resolveFile(env); logger.info("Resolved env. variable DATACLEANER_HOME ({}) to: {}", env, candidate); } else { String sysProp = System.getProperty("DATACLEANER_HOME"); if (!StringUtils.isNullOrEmpty(sysProp)) { if (sysProp.startsWith("~")) { String userHomePath = System.getProperty("user.home"); sysProp = sysProp.replace("~", userHomePath); } candidate = manager.resolveFile(sysProp); logger.info("Resolved system property DATACLEANER_HOME ({}) to: {}", sysProp, candidate); <START> } <END> } if (isUsable(candidate)) { return candidate; } else { return initializeDataCleanerHome(candidate); } }</code><technical_language>duplication unnecessary</technical_language>

Target:
private static FileObject findDataCleanerHome() throws FileSystemException { final FileSystemManager manager = VFSUtils.getFileSystemManager(); FileObject candidate = null; String path = System.getenv("DATACLEANER_HOME"); if (!StringUtils.isNullOrEmpty(path)) { logger.info("Resolved env. variable DATACLEANER_HOME: {}", path); } else { path = System.getProperty("DATACLEANER_HOME"); if (!StringUtils.isNullOrEmpty(path)) { candidate = manager.resolveFile(path); logger.info("Resolved system property DATACLEANER_HOME: {}", path, candidate); } } if (!StringUtils.isNullOrEmpty(path)) { if (path.startsWith("~")) { String userHomePath = System.getProperty("user.home"); path = path.replace("~", userHomePath); } candidate = manager.resolveFile(path); } if (isUsable(candidate)) { return candidate; } else { return initializeDataCleanerHome(candidate); } }
Source:
<code>InnerPublisherSubscription(ClusterPublisherManagerImpl<K, ?>.SubscriberHandler<I, R> parent, int batchSize, Supplier<Map.Entry<Address, IntSet>> supplier, Map<Address, Set<K>> excludedKeys, int topologyId, Map.Entry<Address, IntSet> specificTarget) { this.parent = parent; this.queue = new SpscArrayQueue<>(batchSize); this.supplier = supplier; this.batchSize = batchSize; this.excludedKeys = excludedKeys; this.topologyId = topologyId; <START> this.currentTarget = Objects.requireNonNull(specificTarget); <END> }</code><technical_language>java this(parent, batchSize, supplier, excludedKeys, topologyId); this.currentTarget = Objects.requireNonNull(specificTarget);</technical_language>

Target:
InnerPublisherSubscription(ClusterPublisherManagerImpl<K, ?>.SubscriberHandler<I, R> parent, int batchSize, Supplier<Map.Entry<Address, IntSet>> supplier, Map<Address, Set<K>> excludedKeys, int topologyId, Map.Entry<Address, IntSet> specificTarget) { this(parent, batchSize, supplier, excludedKeys, topologyId); this.currentTarget = Objects.requireNonNull(specificTarget); }
Source:
<code>public <T> T convertTo(Class<T> type, Exchange exchange, Object value) throws TypeConversionException { if (type.getCanonicalName().startsWith("org.apache")) { return null; } <START> if (type.isAssignableFrom(Map.class) && (value.getClass().isArray() || value instanceof List)) { <END> return null; } for (ConversionService conversionService : conversionServices) { if (conversionService.canConvert(value.getClass(), type)) { return conversionService.convert(value, type); } } return null; }</code><technical_language>I if Collection instead of List capture kind of list structures</technical_language>

Target:
public <T> T convertTo(Class<T> type, Exchange exchange, Object value) throws TypeConversionException { if (type.getCanonicalName().startsWith("org.apache")) { return null; } if (type.isAssignableFrom(Map.class) && (value.getClass().isArray() || value instanceof Collection)) { return null; } for (ConversionService conversionService : conversionServices) { if (conversionService.canConvert(value.getClass(), type)) { return conversionService.convert(value, type); } } return null; }
Source:
<code>public Entry parseWorkflowContent(Entry entry, String content) { ConfigSlurper slurper = new ConfigSlurper(); ConfigObject parse = slurper.parse(content); ConfigObject manifest = (ConfigObject)parse.get("manifest"); if (manifest.containsKey("description")) { entry.setDescription((String)manifest.get("description")); } if (manifest.containsKey("author")) { <START> entry.setDescription((String)manifest.get("author")); <END> } return entry; }</code><technical_language>is entry.setDescription intended</technical_language>

Target:
public Entry parseWorkflowContent(Entry entry, String content) { ConfigSlurper slurper = new ConfigSlurper(); ConfigObject parse = slurper.parse(content); ConfigObject manifest = (ConfigObject)parse.get("manifest"); if (manifest.containsKey("description")) { entry.setDescription((String)manifest.get("description")); } if (manifest.containsKey("author")) { entry.setAuthor((String)manifest.get("author")); } return entry; }
Source:
<code>public static void createFakeDockstoreConfigFile() { String path = System.getProperty("user.home") + File.separator + ".dockstore/config"; File customDir = new File(path); if (customDir.exists()) { <START> System.out.println(customDir + " already exists"); <END> } else if (customDir.mkdirs()) { System.out.println(customDir + " was created"); } else { System.out.println(customDir + " was not created"); } }</code><technical_language>block merge this, System.out handled logging</technical_language>

Target:
public static void createFakeDockstoreConfigFile() { String path = System.getProperty("user.home") + File.separator + ".dockstore/config"; File customDir = new File(path); if (customDir.exists()) { LOG.info(customDir + " already exists"); } else if (customDir.mkdirs()) { LOG.info(customDir + " was created"); } else { LOG.error(customDir + " was not created"); } }
Source:
<code>public <T extends Card> void removeCards(Class<T> type, List<Card> items) { Iterator<Card> iterator = items.iterator(); while (iterator.hasNext()) { Card card = iterator.next(); if (type.isInstance(card)) { <START> items.remove(card); <END> } } }</code><technical_language>Sorry, I wrote this wrong earlier. I want iterator.remove() avoid a ConcurrentModificationException</technical_language>

Target:
public <T extends Card> void removeCards(Class<T> type, List<Card> items) { Iterator<Card> iterator = items.iterator(); while (iterator.hasNext()) { Card card = iterator.next(); if (type.isInstance(card)) { iterator.remove(); } } }
Source:
<code>void fixBlackBackground() { flatGroups.clear(); favoriteGroups.clear(); for (FavouritePoint fp : cachedFavoritePoints) { if (fp.getColor() == 0xFF000000) { fp.setColor(0); } FavoriteGroup group = getOrCreateGroup(fp, 0); group.points.add(fp); } sortAll(); saveCurrentPointsIntoFile(); <START> context.runInUIThread(new Runnable() { <END> @Override public void run() { for (FavoritesListener listener : listeners) { listener.onFavoritesLoaded(); } } }); }</code><technical_language>Is a ready method for updating listeners</technical_language>

Target:
void fixBlackBackground() { flatGroups.clear(); favoriteGroups.clear(); for (FavouritePoint fp : cachedFavoritePoints) { if (fp.getColor() == 0xFF000000 || fp.getColor() == ContextCompat.getColor(context, R.color.color_favorite)) { fp.setColor(0); } if (fp.getBackgroundType() == FavouritePoint.DEFAULT_BACKGROUND_TYPE){ fp.setBackgroundType(null); } if(fp.getIconId()== FavouritePoint.DEFAULT_UI_ICON_ID){ fp.setIconId(0); } FavoriteGroup group = getOrCreateGroup(fp, 0); group.points.add(fp); } sortAll(); saveCurrentPointsIntoFile(); notifyListeners(); }
Source:
<code>public void given__multibranch_with_primary__when__reporting_health__then__non_empty() throws Exception { try (MockSCMController c = MockSCMController.create()) { c.createRepository("foo"); c.createBranch("foo", "stable"); c.setPrimaryBranch("foo", "stable"); HealthReportingMultiBranchProject prj = r.jenkins.createProject(HealthReportingMultiBranchProject.class, "foo"); prj.setCriteria(null); prj.getSourcesList().add(new BranchSource(new MockSCMSource(c, "foo", new MockSCMDiscoverBranches()))); prj.scheduleBuild2(0).getFuture().get(); r.waitUntilNoActivity(); prj.getHealthMetrics().replaceBy(Collections.singletonList(new PrimaryBranchHealthMetric())); prj.invalidateBuildHealthReports(); FreeStyleProject master = prj.getItem("master"); assertThat("We now have the master branch", master, notNullValue()); FreeStyleProject stable = prj.getItem("stable"); assertThat("We now have the stable branch", stable, notNullValue()); <START> assertThat(prj.getBuildHealthReports(), not(containsInAnyOrder( master.getBuildHealthReports().stream().map(Matchers::is).collect(Collectors.toList()) ))); assertThat(prj.getBuildHealthReports(), containsInAnyOrder( stable.getBuildHealthReports().stream().map(Matchers::is).collect(Collectors.toList()) )); <END> } }</code><technical_language>A reason in assertThats explain condition tested for</technical_language>

Target:
public void given__multibranch_with_primary__when__reporting_health__then__non_empty() throws Exception { try (MockSCMController c = MockSCMController.create()) { c.createRepository("foo"); c.createBranch("foo", "stable"); c.setPrimaryBranch("foo", "stable"); HealthReportingMultiBranchProject prj = r.jenkins.createProject(HealthReportingMultiBranchProject.class, "foo"); prj.setCriteria(null); prj.getSourcesList().add(new BranchSource(new MockSCMSource(c, "foo", new MockSCMDiscoverBranches()))); prj.scheduleBuild2(0).getFuture().get(); r.waitUntilNoActivity(); prj.getHealthMetrics().replaceBy(Collections.singletonList(new PrimaryBranchHealthMetric())); prj.invalidateBuildHealthReports(); FreeStyleProject master = prj.getItem("master"); assertThat("We now have the master branch", master, notNullValue()); FreeStyleProject stable = prj.getItem("stable"); assertThat("We now have the stable branch", stable, notNullValue()); assertThat( "none of 'master' branch's reports should be present as it is not the primary branch", prj.getBuildHealthReports(), everyItem(not(is(in(master.getBuildHealthReports().toArray())))) ); assertThat( "'stable' branch's reports should be exactly the reports as it is the primary branch", prj.getBuildHealthReports(), containsInAnyOrder(stable.getBuildHealthReports().toArray()) ); } }
Source:
<code><START> public void testThreadNamePatterns() { <END> ThreadNameInfo name = new ThreadNameInfo(100, 1, 2, "nodeX", "eviction"); String threadName = name.format(Thread.currentThread(), "infinispan-%n-%c-p%f-t%t"); assertEquals("infinispan-nodeX-eviction-p2-t1", threadName); }</code><technical_language>test patterns IMO</technical_language>

Target:
public void testThreadNamePatterns() { ThreadNameInfo name = new ThreadNameInfo(100, 1, 2, "nodeX", "eviction"); String threadName = name.format(Thread.currentThread(), "infinispan-%n-%c-p%f-t%t"); assertEquals("infinispan-nodeX-eviction-p2-t1", threadName); threadName = name.format(Thread.currentThread(), "%%-%g%p%"); assertEquals("%-100system:main", threadName); }
Source:
<code>public static void assertDirectoryIsWritable(final File dir) { if (dir == null) { throw new IllegalArgumentException("Cannot check readability of null file."); } else if (!dir.exists()) { throw new SAMException("Directory does not exist: " + dir.getAbsolutePath()); } else if (!dir.isDirectory()) { throw new SAMException("Cannot write to directory because it is not a directory: " + dir.getAbsolutePath()); } else if (!dir.canWrite()) { throw new SAMException("Directory exists but is not writable: " + dir.getAbsolutePath()); } <START> } <END></code><technical_language>this work files? in case, refactor (File) functions call (Path) functions</technical_language>

Target:
public static void assertDirectoryIsWritable(final File dir) { final Path asPath = (dir == null) ? null : dir.toPath(); assertDirectoryIsWritable(asPath); }
Source:
<code>public boolean isReferencingJSLib(IFile file, String libName) { if(IonicConstants.IONIC_CATEGORY.equals(libName)) { <START> return JSRecognizer.getJSReferenceVersion(file, "ionic") != null; <END> } return false; }</code><technical_language>add a new method IoincRecognizer this IonicVersion.isReferencingJSLib()</technical_language>

Target:
public boolean isReferencingJSLib(IFile file, String libName) { if(IonicConstants.IONIC_CATEGORY.equals(libName)) { return IonicRecognizer.isReferencingIonicLib(file); } return false; }
Source:
<code>protected Integer calculateRecordsGRAPHQL(String response, String table_name) { Integer rec; try { JSONObject j = new JSONObject(response); <START> try { <END> JSONObject j2 = j.getJSONObject("data"); try { JSONObject j3 = j2.getJSONObject(table_name); try { rec = j3.getJSONArray("edges").length(); } catch (JSONException e4) { rec = null; } } catch (JSONException e3) { rec = null; } } catch (JSONException e2) { rec = null; } } catch (JSONException e) { rec = null; } return rec; }</code><technical_language>need for multiple try-catch blocks</technical_language>

Target:
protected Integer calculateRecordsGRAPHQL(String response, String table_name) { Integer rec; try { JSONObject j = new JSONObject(response); JSONObject j2 = j.getJSONObject("data"); JSONObject j3 = j2.getJSONObject(table_name); rec = j3.getJSONArray("edges").length(); } catch (JSONException e) { rec = null; } return rec; }
Source:
<code>private boolean isRequestExpired(SamzaResourceRequest request) { long currTime = Instant.now().toEpochMilli(); boolean requestExpired = currTime - request.getRequestTimestamp().toEpochMilli() > getRequestTimeout(request); if (requestExpired) { LOG.info("Request for Processor ID: on host: with creation time: has expired at current time: after timeout: ms.", <START> request.getProcessorId(), request.getPreferredHost(), request.getRequestTimestamp(), currTime, requestExpiryTimeout); <END> } return requestExpired; }</code><technical_language>this incorrectly log requestExpiryTimeout for control actions. update log expiry timeout computed previous line</technical_language>

Target:
private boolean isRequestExpired(SamzaResourceRequest request) { long currTime = Instant.now().toEpochMilli(); boolean requestExpired = currTime - request.getRequestTimestamp().toEpochMilli() > getRequestTimeout(request).toMillis(); if (requestExpired) { LOG.info("Request for Processor ID: on host: with creation time: has expired at current time: after timeout: ms.", request.getProcessorId(), request.getPreferredHost(), request.getRequestTimestamp(), currTime, getRequestTimeout(request).toMillis()); } return requestExpired; }
Source:
<code>public InputRow parse(Object input) { try { if(thriftClass == null) { thriftClass = getThriftClass(); } } catch (IOException e) { throw new IAE(e, "failed to load jar [%s]", jarPath); } catch (ClassNotFoundException e) { throw new IAE(e, "class [%s] not found in jar", thriftClassName); } catch (InstantiationException e) { throw new IAE(e, "instantiation thrift instance failed"); } catch (IllegalAccessException e) { throw new IAE(e, "instantiation thrift instance failed, IllegalAccessException"); } try { final byte[] bytes; if (input instanceof BytesWritable) { bytes = ((BytesWritable) input).getBytes(); } else if (input instanceof ByteBuffer) { bytes = ((ByteBuffer) input).array(); } else { throw new IAE("unsupport input class of [%s]", input.getClass()); } TBase o = thriftClass.newInstance(); deserializer.deserialize(o, bytes); <START> String json = serializer.toString(o); <END> Map<String, Object> record = parser.parse(json); return new MapBasedInputRow( parseSpec.getTimestampSpec().extractTimestamp(record), parseSpec.getDimensionsSpec().getDimensionNames(), record ); } catch (Exception e) { return null; } }</code><technical_language>if converting thrift Json, dont need pass in a parser, Jsonparser</technical_language>

Target:
public InputRow parse(Object input) { try { if (thriftClass == null) { thriftClass = getThriftClass(); } } catch (IOException e) { throw new IAE(e, "failed to load jar [%s]", jarPath); } catch (ClassNotFoundException e) { throw new IAE(e, "class [%s] not found in jar", thriftClassName); } catch (InstantiationException | IllegalAccessException e) { throw new IAE(e, "instantiation thrift instance failed"); } final String json; try { if (input instanceof ByteBuffer) { final byte[] bytes = ((ByteBuffer) input).array(); TBase o = thriftClass.newInstance(); ThriftDeserialization.detectAndDeserialize(bytes, o); json = ThriftDeserialization.SERIALIZER_SIMPLE_JSON.get().toString(o); } else if (input instanceof BytesWritable) { final byte[] bytes = ((BytesWritable) input).getBytes(); TBase o = thriftClass.newInstance(); ThriftDeserialization.detectAndDeserialize(bytes, o); json = ThriftDeserialization.SERIALIZER_SIMPLE_JSON.get().toString(o); } else if (input instanceof ThriftWritable) { TBase o = (TBase) ((ThriftWritable) input).get(); json = ThriftDeserialization.SERIALIZER_SIMPLE_JSON.get().toString(o); } else { throw new IAE("unsupport input class of [%s]", input.getClass()); } } catch (IllegalAccessException | InstantiationException | TException e) { throw new IAE("some thing wrong with your thrift?"); } Map<String, Object> record = parser.parse(json); return new MapBasedInputRow( parseSpec.getTimestampSpec().extractTimestamp(record), parseSpec.getDimensionsSpec().getDimensionNames(), record ); }
Source:
<code>@Override public void processCrossBreedingMethod(CrossSetting crossSetting, ImportedCrossesList importedCrossesList) { final BreedingMethodSetting methodSetting = crossSetting.getBreedingMethodSetting(); for (ImportedCrosses importedCrosses : importedCrossesList.getImportedCrosses()) { if (!StringUtils.isEmpty(importedCrosses.getRawBreedingMethod())) { final Method breedingMethod = this.germplasmDataManager.getMethodByCode(importedCrosses.getRawBreedingMethod()); <START> <END> if (breedingMethod != null && breedingMethod.getMid() != null && breedingMethod.getMid() != 0) { importedCrosses.setBreedingMethodId(breedingMethod.getMid()); } } if (importedCrosses.isBreedingMethodInformationAvailable()) { continue; } if (methodSetting.isBasedOnStatusOfParentalLines()) { final Integer femaleGid = importedCrosses.getGpid1(); final Integer maleGid = importedCrosses.getGpid2(); Triple<Germplasm, Germplasm, Germplasm> femaleLine = retrieveParentGermplasmObjects(femaleGid); Triple<Germplasm, Germplasm, Germplasm> maleLine = retrieveParentGermplasmObjects(maleGid); importedCrosses.setBreedingMethodId(CrossingUtil.determineBreedingMethodBasedOnParentalLine(femaleLine.getLeft(), maleLine.getLeft(), femaleLine.getMiddle(), femaleLine.getRight(), maleLine.getMiddle(), maleLine.getRight())); } else { importedCrosses.setBreedingMethodId(methodSetting.getMethodId()); } } }</code><technical_language>This is a query in a loop. If importedCrossesList is large, some performance impact. end querying for method code if multiple rows in importedCrossesList method code (raw breeding method) set. A local map based cache avoid repeat querying</technical_language>

Target:
public void processCrossBreedingMethod(CrossSetting crossSetting, ImportedCrossesList importedCrossesList) { final BreedingMethodSetting methodSetting = crossSetting.getBreedingMethodSetting(); for (ImportedCrosses importedCrosses : importedCrossesList.getImportedCrosses()) { if (!StringUtils.isEmpty(importedCrosses.getRawBreedingMethod())) { final Method breedingMethod = this.germplasmDataManager.getMethodByCode(importedCrosses.getRawBreedingMethod()); if (breedingMethod != null && breedingMethod.getMid() != null && breedingMethod.getMid() != 0) { importedCrosses.setBreedingMethodId(breedingMethod.getMid()); } else { importedCrosses.setBreedingMethodId(0); } } if (importedCrosses.isBreedingMethodInformationAvailable()) { continue; } if (methodSetting.getMethodId() == null || methodSetting.getMethodId() == 0) { final Integer femaleGid = Integer.parseInt(importedCrosses.getFemaleGid()); final Integer maleGid = Integer.parseInt(importedCrosses.getMaleGid()); Triple<Germplasm, Germplasm, Germplasm> femaleLine = retrieveParentGermplasmObjects(femaleGid); Triple<Germplasm, Germplasm, Germplasm> maleLine = retrieveParentGermplasmObjects(maleGid); importedCrosses.setBreedingMethodId(CrossingUtil.determineBreedingMethodBasedOnParentalLine(femaleLine.getLeft(), maleLine.getLeft(), femaleLine.getMiddle(), femaleLine.getRight(), maleLine.getMiddle(), maleLine.getRight())); } else { importedCrosses.setBreedingMethodId(methodSetting.getMethodId()); } } }
Source:
<code>public boolean isChildPolicyAllowed(SchedulingPolicy childPolicy) { if (childPolicy instanceof DominantResourceFairnessPolicy) { <START> LOG.info("Queue policies can't be " + DominantResourceFairnessPolicy.NAME <END> + " if the parent policy is " + getName() + ". Please choose " + "other polices for child queues instead."); return false; } return true; }</code><technical_language>s/policies/policy</technical_language>

Target:
public boolean isChildPolicyAllowed(SchedulingPolicy childPolicy) { if (childPolicy instanceof DominantResourceFairnessPolicy) { LOG.error("Queue policy can't be " + DominantResourceFairnessPolicy.NAME + " if the parent policy is " + getName() + ". Choose " + getName() + " or " + FifoPolicy.NAME + " for child queues instead." + " Please note that " + FifoPolicy.NAME + " is only for leaf queues."); return false; } return true; }
Source:
<code>public static File defaultFile(FilterConfig filterConfig) { String configPath = null; <START> if (configPath == null) { <END> configPath = System.getProperty(PROPERTY_NAME, DEFAULT_PATH); } else if (filterConfig != null) { configPath = filterConfig.getInitParameter(FILTER_CONFIG_PARAM); } return new File(configPath); }</code><technical_language>This is completely broken. I I meant do if (filterConfig != null) in place</technical_language>

Target:
public static File defaultFile(FilterConfig filterConfig) { String configPath = System.getProperty(PROPERTY_NAME, DEFAULT_PATH); if (configPath == null && filterConfig != null) { configPath = filterConfig.getInitParameter(FILTER_CONFIG_PARAM); } return new File(configPath); }
Source:
<code>public void processConditional(CharSequence chars, IElementType type) { if (PPIF.equals(type)) { <START> currentContext = new Section(currentContext, type); <END> } else if (PPELSE.equals(type)) { currentContext.startBlock(type); } else if (PPELSEIF.equals(type)) { currentContext.startBlock(type); } else if (PPEND.equals(type)) { currentContext.endBlock(getCurrentBlock()); Section parent = currentContext.getParent(); if (null != parent) { currentContext = parent; } } }</code><technical_language>fix stuff this? I get code is simpler, fixing a bug here. I leave code this in place some point I needed set a breakpoint inspect variable (in this case difference currentContext new Section assignment occurred). I figure if I needed breakpoint in past, need in future. Besides that, is *zero* performance penalty for extra variable -- JIT compiles out</technical_language>

Target:
public void processConditional(CharSequence chars, IElementType type) { if (PPIF.equals(type)) { Section newSection = new Section(currentContext, type); currentContext = newSection; } else if (PPELSE.equals(type)) { currentContext.startBlock(type); } else if (PPELSEIF.equals(type)) { currentContext.startBlock(type); } else if (PPEND.equals(type)) { currentContext.endBlock(getCurrentBlock()); Section parent = currentContext.getParent(); if (null != parent) { currentContext = parent; } } }
Source:
<code>public String getJobCoordinationUtilsFactoryClassName() { String className = get(JOB_COORDINATION_UTILS_FACTORY, DEFAULT_COORDINATION_UTILS_FACTORY); <START> if (Strings.isNullOrEmpty(className)) { <END> throw new SamzaException("Failed to read config value for " + JOB_COORDINATION_UTILS_FACTORY + " = " + className); } try { Class.forName(className); } catch (ClassNotFoundException e) { throw new SamzaException( "Failed to validate config value for " + JOB_COORDINATION_UTILS_FACTORY + " = " + className, e); } return className; }</code><technical_language>className null empty if a default, right</technical_language>

Target:
public String getJobCoordinationUtilsFactoryClassName() { String className = get(JOB_COORDINATION_UTILS_FACTORY, DEFAULT_COORDINATION_UTILS_FACTORY); if (Strings.isNullOrEmpty(className)) { throw new SamzaException("Empty config for " + JOB_COORDINATION_UTILS_FACTORY + " = " + className); } try { Class.forName(className); } catch (ClassNotFoundException e) { throw new SamzaException( "Failed to validate config value for " + JOB_COORDINATION_UTILS_FACTORY + " = " + className, e); } return className; }
Source:
<code>private Map<TableReference, byte[]> filterOutExistingTables( final Map<TableReference, byte[]> tableNamesToTableMetadata) { Map<TableReference, byte[]> filteredTables = Maps.newHashMap(); try { Set<TableReference> existingTablesLowerCased = cassandraTables.getExistingLowerCased().stream() .map(AbstractKeyValueService::fromInternalTableName) .collect(Collectors.toSet()); for (Entry<TableReference, byte[]> tableAndMetadataPair : tableNamesToTableMetadata.entrySet()) { TableReference table = tableAndMetadataPair.getKey(); byte[] metadata = tableAndMetadataPair.getValue(); CassandraVerifier.sanityCheckTableName(table); TableReference tableRefLowerCased = TableReference.createLowerCased(table); if (!existingTablesLowerCased.contains(tableRefLowerCased)) { filteredTables.put(table, metadata); } else { log.debug("Filtering out existing table ({}) that already existed (case insensitive).", LoggingArgs.tableRef(table)); } } } catch (Exception e) { <START> Throwables.unwrapAndThrowDependencyUnavailableException(e); <END> } return filteredTables; }</code><technical_language>this thrown? (I realise in original)</technical_language>

Target:
private Map<TableReference, byte[]> filterOutExistingTables( final Map<TableReference, byte[]> tableNamesToTableMetadata) { Map<TableReference, byte[]> filteredTables = Maps.newHashMap(); try { Set<TableReference> existingTablesLowerCased = cassandraTables.getExistingLowerCased().stream() .map(AbstractKeyValueService::fromInternalTableName) .collect(Collectors.toSet()); for (Entry<TableReference, byte[]> tableAndMetadataPair : tableNamesToTableMetadata.entrySet()) { TableReference table = tableAndMetadataPair.getKey(); byte[] metadata = tableAndMetadataPair.getValue(); CassandraVerifier.sanityCheckTableName(table); TableReference tableRefLowerCased = TableReference.createLowerCased(table); if (!existingTablesLowerCased.contains(tableRefLowerCased)) { filteredTables.put(table, metadata); } else { log.debug("Filtering out existing table ({}) that already existed (case insensitive).", LoggingArgs.tableRef(table)); } } } catch (Exception e) { throw Throwables.unwrapAndThrowDependencyUnavailableException(e); } return filteredTables; }
Source:
<code>public int partitions() { lock.readLock().lock(); try { <START> return partitions.length; <END> } finally { lock.readLock().unlock(); } }</code><technical_language>partitions.length is final, partitions is final, this need lock. adding this get a code analysis tool happy</technical_language>

Target:
public int partitions() { return partitions.length; }
Source:
<code>public static boolean tryActivate(@Nonnull Event e, @Nonnull SlimefunItemStack stack) { <START> return (tryActivateAndGet(e, stack.getItem()) != null); <END> }</code><technical_language>Redundant brackets suggestion return tryActivateAndGet(e, stack.getItem()) != null;</technical_language>

Target:
public static boolean tryActivate(@Nonnull Event e, @Nonnull SlimefunItemStack stack) { return tryActivateAndGet(e, stack.getItem()) != null; }
Source:
<code>public void testMissingLocalDatacenter() { try (CassandraContainer<?> cassandraContainer = new CassandraContainer<>(CASSANDRA_IMAGE)) { cassandraContainer.start(); <START> CqlSession.builder().addContactPoint(cassandraContainer.getContactPoint()).build(); <END> } }</code><technical_language>instead of @Test(expected = IllegalStateException.class), do a more detailed verification catching exception validating exception message contains contact-points string? AssertJ assertThatThrownBy</technical_language>

Target:
public void testMissingLocalDatacenter() { try (CassandraContainer<?> cassandraContainer = new CassandraContainer<>(CASSANDRA_IMAGE)) { cassandraContainer.start(); CqlSession.builder().addContactPoint(cassandraContainer.getContactPoint()).build(); fail("Session build should fail if no local Datacenter provided"); } catch (IllegalStateException ise) { String msg = "Since you provided explicit contact points, the local DC must be explicitly set"; assertThat(ise.getMessage(), containsString(msg)); } }
Source:
<code>private void addGroupTreeItemsField(Composite parent) { Composite groupComposite = createGroup(parent, "Group tree items"); groupEnable = new BooleanFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_ENABLE, "Enable", "This feature handles a new intermediary tree level if the children size is above the threshold.", new Composite(groupComposite, SWT.NONE)); Composite groupTriggerComposite = new Composite(groupComposite, SWT.NONE); groupTriggerComposite.setLayout(new GridLayout(3, false)); groupTriggerComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); groupTrigger = new IntegerFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_TRIGGER, "Threshold", <START> "The threshold needs to be higher or equal to the group size (Else Threshold = Group size).", groupTriggerComposite); <END> groupTrigger.setValidRange(0, Integer.MAX_VALUE); Composite groupSizeComposite = new Composite(groupComposite, SWT.NONE); groupSizeComposite.setLayout(new GridLayout(3, false)); groupSizeComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); groupSize = new IntegerFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_SIZE, "Group size", "Group size needs to be higher than zero.", groupSizeComposite); groupSize.setValidRange(0, Integer.MAX_VALUE); addField(groupEnable); addField(groupTrigger); addField(groupSize); }</code><technical_language>"otherwise" instead of "Else", wording is confusing anyway</technical_language>

Target:
private void addGroupTreeItemsField(Composite parent) { Composite groupComposite = createGroup(parent, "Group tree items"); groupEnable = new BooleanFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_ENABLE, "Enable", "This feature handles a new intermediary tree level if the children size is above the threshold.", new Composite(groupComposite, SWT.NONE)); Composite groupTriggerComposite = new Composite(groupComposite, SWT.NONE); groupTriggerComposite.setLayout(new GridLayout(3, false)); groupTriggerComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); groupTrigger = new IntegerFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_TRIGGER, "Threshold", "The threshold needs to be higher or equal to the group size (otherwise Threshold = Group size).", groupTriggerComposite); groupTrigger.setValidRange(0, Integer.MAX_VALUE); Composite groupSizeComposite = new Composite(groupComposite, SWT.NONE); groupSizeComposite.setLayout(new GridLayout(3, false)); groupSizeComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); groupSize = new IntegerFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_SIZE, "Group size", "Group size needs to be higher than zero.", groupSizeComposite); groupSize.setValidRange(0, Integer.MAX_VALUE); addField(groupEnable); addField(groupTrigger); addField(groupSize); }
Source:
<code><START> public Map<Parameter, MappingOptions> groupBySourceParameter(List<Mapping> mappings) { <END> Map<Parameter, List<Mapping>> mappingsKeyedByParameterType = new HashMap<Parameter, List<Mapping>>(); for ( Mapping mapping : mappings ) { if ( mapping.getSourceReference() != null && mapping.getSourceReference().isValid() ) { Parameter parameter = mapping.getSourceReference().getParameter(); if ( !mappingsKeyedByParameterType.containsKey( parameter ) ) { mappingsKeyedByParameterType.put( parameter, new ArrayList<Mapping>() ); } mappingsKeyedByParameterType.get( parameter ).add( mapping ); } } Map<Parameter, MappingOptions> result = new HashMap<Parameter, MappingOptions>(); for ( Map.Entry<Parameter, List<Mapping>> entry : mappingsKeyedByParameterType.entrySet() ) { result.put( entry.getKey(), MappingOptions.forMappingsOnly( groupByTargetName( entry.getValue() ) ) ); } return result; }</code><technical_language>this method in line (line 154)? Map<Parameter, MappingOptions> groupBySourceParameter(List<Mapping> mappings)</technical_language>

Target:
public Map<Parameter, List<Mapping>> groupBySourceParameter(List<Mapping> mappings) { Map<Parameter, List<Mapping>> mappingsKeyedByParameter = new HashMap<Parameter, List<Mapping>>(); for ( Mapping mapping : mappings ) { if ( mapping.getSourceReference() != null && mapping.getSourceReference().isValid() ) { Parameter parameter = mapping.getSourceReference().getParameter(); if ( !mappingsKeyedByParameter.containsKey( parameter ) ) { mappingsKeyedByParameter.put( parameter, new ArrayList<Mapping>() ); } mappingsKeyedByParameter.get( parameter ).add( mapping ); } } return mappingsKeyedByParameter; }
Source:
<code>public void setSource(MessageSource<?> source) { ProxyFactory pf = new ProxyFactory(source); class ReceiveAdvice implements MethodInterceptor { private final List<ChannelInterceptor> interceptors = new ArrayList<>(); @Override public Object invoke(MethodInvocation invocation) throws Throwable { Object result = invocation.proceed(); if (result instanceof Message) { Message<?> received = (Message<?>) result; for (ChannelInterceptor interceptor : this.interceptors) { received = interceptor.preSend(received, null); if (received == null) { <START> break; <END> } } return received; } return result; } } final ReceiveAdvice advice = new ReceiveAdvice(); advice.interceptors.addAll(this.interceptors); NameMatchMethodPointcutAdvisor sourceAdvisor = new NameMatchMethodPointcutAdvisor(advice); sourceAdvisor.addMethodName("receive"); pf.addAdvisor(sourceAdvisor); this.source = (MessageSource<?>) pf.getProxy(); this.pollingTemplate = new MessageSourcePollingTemplate(this.source); }</code><technical_language>simply return received; instead of break</technical_language>

Target:
public void setSource(MessageSource<?> source) { ProxyFactory pf = new ProxyFactory(source); class ReceiveAdvice implements MethodInterceptor { private final List<ChannelInterceptor> interceptors = new ArrayList<>(); @Override public Object invoke(MethodInvocation invocation) throws Throwable { Object result = invocation.proceed(); if (result instanceof Message) { Message<?> received = (Message<?>) result; for (ChannelInterceptor interceptor : this.interceptors) { received = interceptor.preSend(received, null); if (received == null) { return null; } } return received; } return result; } } final ReceiveAdvice advice = new ReceiveAdvice(); advice.interceptors.addAll(this.interceptors); NameMatchMethodPointcutAdvisor sourceAdvisor = new NameMatchMethodPointcutAdvisor(advice); sourceAdvisor.addMethodName("receive"); pf.addAdvisor(sourceAdvisor); this.source = (MessageSource<?>) pf.getProxy(); }
Source:
<code>public void setPlayer(Player player) { this.player = player; CountryCode countryCode = CountryCode.getByCode(player.getCountry()); usernameLabel.setText(player.getUsername()); userImageView.setImage(IdenticonUtil.createIdenticon(player.getId())); countryFlagService.loadCountryFlag(player.getCountry()).ifPresent(image -> countryImageView.setImage(image)); countryLabel.setText(countryCode == null ? player.getCountry() : countryCode.getName()); JavaFxUtil.addListener(player.globalRatingMeanProperty(), (observable) -> loadReceiverGlobalRatingInformation(player)); JavaFxUtil.addListener(player.globalRatingDeviationProperty(), (observable) -> loadReceiverGlobalRatingInformation(player)); loadReceiverGlobalRatingInformation(player); JavaFxUtil.addListener(player.leaderboardRatingMeanProperty(), (observable) -> loadReceiverLadderRatingInformation(player)); JavaFxUtil.addListener(player.leaderboardRatingDeviationProperty(), (observable) -> loadReceiverLadderRatingInformation(player)); loadReceiverLadderRatingInformation(player); <START> JavaFxUtil.addListener(player.gameProperty(), observable -> onPlayerGameChanged(player.getGame())); <END> onPlayerGameChanged(player.getGame()); gamesPlayedLabel.textProperty().bind(player.numberOfGamesProperty().asString()); populateUnlockedAchievementsLabel(player); }</code><technical_language>THis is a crucial point listener removed</technical_language>

Target:
public void setPlayer(Player player) { CountryCode countryCode = CountryCode.getByCode(player.getCountry()); usernameLabel.setText(player.getUsername()); userImageView.setImage(IdenticonUtil.createIdenticon(player.getId())); countryFlagService.loadCountryFlag(player.getCountry()).ifPresent(image -> countryImageView.setImage(image)); countryLabel.setText(countryCode == null ? player.getCountry() : countryCode.getName()); globalRatingInvalidationListener = (observable) -> loadReceiverGlobalRatingInformation(player); JavaFxUtil.addListener(player.globalRatingMeanProperty(), new WeakInvalidationListener(globalRatingInvalidationListener)); JavaFxUtil.addListener(player.globalRatingDeviationProperty(), new WeakInvalidationListener(globalRatingInvalidationListener)); loadReceiverGlobalRatingInformation(player); leaderboardRatingInvalidationListener = (observable) -> loadReceiverLadderRatingInformation(player); JavaFxUtil.addListener(player.leaderboardRatingMeanProperty(), new WeakInvalidationListener(leaderboardRatingInvalidationListener)); JavaFxUtil.addListener(player.leaderboardRatingDeviationProperty(), new WeakInvalidationListener(leaderboardRatingInvalidationListener)); loadReceiverLadderRatingInformation(player); gameInvalidationListener = observable -> onPlayerGameChanged(player.getGame()); JavaFxUtil.addListener(player.gameProperty(), new WeakInvalidationListener(gameInvalidationListener)); onPlayerGameChanged(player.getGame()); JavaFxUtil.bind(gamesPlayedLabel.textProperty(), player.numberOfGamesProperty().asString()); populateUnlockedAchievementsLabel(player); }
Source:
<code>protected List<RawUsageRecord> getUsageFromPlugin(final LocalDate startDate, final LocalDate endDate, final TenantContext tenantContext) { final Set<String> allServices = pluginRegistry.getAllServices(); if (allServices.isEmpty()) { return null; } for (final String service : allServices) { final UsagePluginApi plugin = pluginRegistry.getServiceForName(service); final List<RawUsageRecord> result = plugin.geUsageForAccount(startDate, endDate, tenantContext); if (result != null) { for (final RawUsageRecord cur : result) { if (cur.getDate().compareTo(startDate) < 0 || cur.getDate().compareTo(endDate) >=0) { <START> logger.warn("Usage plugin returned usage data with date %s, not in the specified range [%s -> %s[", <END> cur.getDate(), startDate, endDate); } } return result; } } return null; }</code><technical_language>%s {}</technical_language>

Target:
protected List<RawUsageRecord> getUsageFromPlugin(final LocalDate startDate, final LocalDate endDate, final TenantContext tenantContext) { final Set<String> allServices = pluginRegistry.getAllServices(); if (allServices.isEmpty()) { return null; } for (final String service : allServices) { final UsagePluginApi plugin = pluginRegistry.getServiceForName(service); final List<RawUsageRecord> result = plugin.geUsageForAccount(startDate, endDate, tenantContext); if (result != null) { for (final RawUsageRecord cur : result) { if (cur.getDate().compareTo(startDate) < 0 || cur.getDate().compareTo(endDate) >=0) { logger.warn("Usage plugin returned usage data with date {}, not in the specified range [{} -> {}[", cur.getDate(), startDate, endDate); } } return result; } } return null; }
Source:
<code>public Object get(Object key) { String strKey = (String) key; if (super.containsKey(strKey)) { return super.get(strKey); } if (parameterMetaObject == null) { return null; } if (fallbackParameterObject) { return parameterMetaObject.hasGetter(strKey) ? <START> parameterMetaObject.getValue(strKey) : parameterMetaObject.getOriginalObject(); <END> } else { return parameterMetaObject.getValue(strKey); } }</code><technical_language>This part slightly simpler. java if (fallbackParameterObject && !parameterMetaObject.hasGetter(strKey)) { return parameterMetaObject.getOriginalObject();</technical_language>

Target:
public Object get(Object key) { String strKey = (String) key; if (super.containsKey(strKey)) { return super.get(strKey); } if (parameterMetaObject == null) { return null; } if (fallbackParameterObject && !parameterMetaObject.hasGetter(strKey)) { return parameterMetaObject.getOriginalObject(); } else { return parameterMetaObject.getValue(strKey); } }
Source:
<code>private boolean updateTaskProgress(TaskExecutionProgress progress, TaskActivity activity) { <START> boolean taskFinished = progress.getActionsSucceeded() + progress.getActionsFiltered() == progress.getTotalActions(); <END> if (taskFinished) { activity.setActivityType(TaskActivityType.SUCCESS); if (progress.getActionsFiltered() > 0) { activity.setMessage(TASK_SUCCEEDED_WITH_FILTERED_ACTIONS); } else { activity.setMessage(TASK_SUCCEEDED); } activity.getFields().clear(); } updateTaskInProgressMessage(activity); taskActivitiesDataService.update(activity); return taskFinished; }</code><technical_language>'+' ? && ||</technical_language>

Target:
private boolean updateTaskProgress(TaskExecutionProgress progress, TaskActivity activity) { boolean taskFinished = (progress.getActionsSucceeded() + progress.getActionsFiltered()) == progress.getTotalActions(); if (taskFinished) { activity.setActivityType(TaskActivityType.SUCCESS); if (progress.getActionsFiltered() > 0) { activity.setMessage(TASK_SUCCEEDED_WITH_FILTERED_ACTIONS); } else { activity.setMessage(TASK_SUCCEEDED); } activity.getFields().clear(); } updateTaskInProgressMessage(activity); taskActivitiesDataService.update(activity); return taskFinished; }
Source:
<code>public DeleteTableCallback(Table table, CompiledCondition compiledCondition, int matchingStreamIndex, boolean convertToStreamEvent, StateEventPool stateEventPool, StreamEventPool streamEventPool, StreamEventConverter streamEventConverter, String queryName) { <START> this.matchingStreamIndex = matchingStreamIndex; <END> this.table = table; this.compiledCondition = compiledCondition; this.convertToStreamEvent = convertToStreamEvent; this.stateEventPool = stateEventPool; this.streamEventPool = streamEventPool; this.streamEventConverter = streamEventConverter; setQueryName(queryName); }</code><technical_language>Is ok introduce API change here? If this method is in OutputParser.java class, is ok</technical_language>

Target:
public DeleteTableCallback(Table table, CompiledCondition compiledCondition, int matchingStreamIndex, boolean convertToStreamEvent, StateEventPool stateEventPool, StreamEventPool streamEventPool, StreamEventConverter streamEventConverter, String queryName) { super(queryName); this.matchingStreamIndex = matchingStreamIndex; this.table = table; this.compiledCondition = compiledCondition; this.convertToStreamEvent = convertToStreamEvent; this.stateEventPool = stateEventPool; this.streamEventPool = streamEventPool; this.streamEventConverter = streamEventConverter; }