auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void selectObjectRepresentation(PackWriter packer, ObjectToPack otp, WindowCursor curs) throws IOException { PackList pList = packList.get(); SEARCH: for (;;) { for (final PackFile p : pList.packs) { try { LocalObjectRepresentation rep = p.representation(curs, otp); if (rep != null) packer.select(otp, rep); } catch (PackMismatchException e) { pList = scanPacks(pList); continue SEARCH; <START> } catch (CorruptObjectException e) { <END> logPackIOException(e, p, true); removePack(p); } catch (PackInvalidException e) { logPackIOException(e, p, true); removePack(p); } catch (IOException e) { logPackIOException(e, p, false); } } break SEARCH; } for (AlternateHandle h : myAlternates()) h.db.selectObjectRepresentation(packer, otp, curs); }</code><technical_language>factor this out. Arguably uglier instanceof instead of separate catch blocks, I reduced code duplication win. } catch (IOException e) { handlePackError(e, p); } ... private void handlePackError(IOexception e, PackFile p) { String tmpl; if ((e instanceof CorruptObjectException) || (e instanceof PackInvalidException)) { tmpl = JGitText.get().corruptPack; // Assume pack is corrupted, remove list. removePack(p); } else { tmpl = JGitText.get().exceptionWhileReadingPack; // remove pack list, error transient. } StringBuilder buf = new StringBuilder( MessageFormat.format(tmpl, p.getPackFile.getAbsolutePath())); ... }</technical_language>

Target:
void selectObjectRepresentation(PackWriter packer, ObjectToPack otp, WindowCursor curs) throws IOException { PackList pList = packList.get(); SEARCH: for (;;) { for (final PackFile p : pList.packs) { try { LocalObjectRepresentation rep = p.representation(curs, otp); if (rep != null) packer.select(otp, rep); } catch (IOException e) { handlePackError(e, p); } } break SEARCH; } for (AlternateHandle h : myAlternates()) h.db.selectObjectRepresentation(packer, otp, curs); }
Source:
<code>protected List<String> getLdapServers(CLIParser parser, String domainName) throws ManageDomainsResult { String argValue = parser.getArg(Arguments.ldapServers.toString().toLowerCase()); if (StringUtils.isEmpty(argValue)) { LdapSRVLocator locator = new LdapSRVLocator(); DnsSRVResult ldapDnsResult = null; boolean foundServers = true; try { ldapDnsResult = locator.getLdapServers(domainName); if (!foundSrvRecords(ldapDnsResult)) { foundServers = false; } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate LDAP servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_LDAP_SERVERS_FOR_DOMAIN, domainName); } ArrayList<String> result = new ArrayList<String>(); for (int counter = 0; counter < ldapDnsResult.getNumOfValidAddresses(); counter++) { result.add(ldapDnsResult.getAddresses()[counter]); } return result; } else { <START> for (String host: argValue.split(DOMAIN_SEPERATOR)) { <END> try { InetAddress ia = InetAddress.getByName(host); ia.getCanonicalHostName(); } catch (UnknownHostException e) { log.error("Cannot resolve FQDN: " + e.getMessage()); } } } return new ArrayList<String>(Arrays.asList(argValue.split(DOMAIN_SEPERATOR))); }</code><technical_language>check if pass ldapServers parameter cmd line? Do get empty string, null</technical_language>

Target:
protected List<String> getLdapServers(CLIParser parser, String domainName) throws ManageDomainsResult { String argValue = parser.getArg(Arguments.ldapServers.toString().toLowerCase()); if (StringUtils.isEmpty(argValue)) { LdapSRVLocator locator = new LdapSRVLocator(); DnsSRVResult ldapDnsResult = null; boolean foundServers = true; try { ldapDnsResult = locator.getLdapServers(domainName); if (!foundSrvRecords(ldapDnsResult)) { foundServers = false; } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate LDAP servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_LDAP_SERVERS_FOR_DOMAIN, domainName); } ArrayList<String> result = new ArrayList<String>(); for (int counter = 0; counter < ldapDnsResult.getNumOfValidAddresses(); counter++) { result.add(ldapDnsResult.getAddresses()[counter]); } return result; } for (String host: argValue.split(DOMAIN_SEPERATOR)) { try { InetAddress.getByName(host).getCanonicalHostName(); } catch (UnknownHostException e) { String warnMessage = "Warning: Cannot resolve FQDN: " + e.getMessage(); log.warn(warnMessage); System.out.println(warnMessage); } } return new ArrayList<String>(Arrays.asList(argValue.split(DOMAIN_SEPERATOR))); }
Source:
<code>private ArchivedTask matchTaskPattern(String pattern, List<ArchivedTask> tasks) { try { return TaskMatchPattern.compile(pattern).find( tasks .stream() .collect( <START> Collectors.toMap(t -> t.getFullName(), t -> t, (a, b) -> a) <END> )); } catch (TaskMatchPattern.MultipleTaskMatchException | TaskMatchPattern.NoMatchException ex) { throw new IllegalArgumentException(ex); } }</code><technical_language>I ask reason choose</technical_language>

Target:
private ArchivedTask matchTaskPattern(String pattern, List<ArchivedTask> tasks) { try { return TaskMatchPattern.compile(pattern).find( tasks .stream() .collect( Collectors.toMap(t -> t.getFullName(), t -> t, (a, b) -> b) )); } catch (TaskMatchPattern.MultipleTaskMatchException | TaskMatchPattern.NoMatchException ex) { throw new IllegalArgumentException(ex); } }
Source:
<code>private static void validateNestedFilters(Iterable<Filter> filters) { Predicate<Filter> byIsNested = f -> (f.isNested() || f.isDeepNested()); List<Filter> other = StreamSupport .stream(filters::spliterator, Spliterator.ORDERED, false) .filter(byIsNested.negate()).collect(Collectors.toList()); Map<String, List<Filter>> groupedFilters = StreamSupport .stream(filters::spliterator, Spliterator.ORDERED, false) .filter(byIsNested) .collect(Collectors.groupingBy( filter -> { if (filter.isNested()) { return filter.isNestedRelationshipEntity() ? filter.getRelationshipType() : filter.getNestedEntityTypeLabel(); } else if (filter.isDeepNested()) { return filter.getNestedPath().get(filter.getNestedPath().size() - 1).getNestedEntityTypeLabel(); } else { throw new RuntimeException("¯\\_(ツ)_/¯"); } }, TreeMap::new, Collectors.toList() )); <START> Predicate<Filter> hasBooleanOperator = filter -> BooleanOperator.OR == filter.getBooleanOperator(); <END> boolean throwException = false; if (other.isEmpty()) { if (groupedFilters.size() > 1) { throwException = groupedFilters .values().stream() .anyMatch(l -> hasBooleanOperator.test(l.get(0))); } } else if (!groupedFilters.isEmpty()) { throwException = other.stream().anyMatch(hasBooleanOperator) || groupedFilters.values().stream() .map(groupedFilter -> groupedFilter.get(0)) .anyMatch(hasBooleanOperator); } if (throwException) { throw new UnsupportedOperationException( "Filters containing nested paths cannot be combined via the logical OR operator."); } }</code><technical_language>hasOrOperator similar, or</technical_language>

Target:
private static void validateNestedFilters(Iterable<Filter> filters) { Predicate<Filter> byIsNested = f -> (f.isNested() || f.isDeepNested()); List<Filter> other = StreamSupport .stream(filters::spliterator, Spliterator.ORDERED, false) .filter(byIsNested.negate()).collect(Collectors.toList()); Map<String, List<Filter>> groupedFilters = StreamSupport .stream(filters::spliterator, Spliterator.ORDERED, false) .filter(byIsNested) .collect(Collectors.groupingBy( filter -> { if (filter.isNested()) { return filter.isNestedRelationshipEntity() ? filter.getRelationshipType() : filter.getNestedEntityTypeLabel(); } else { return filter.getNestedPath().get(filter.getNestedPath().size() - 1).getNestedEntityTypeLabel(); } }, TreeMap::new, Collectors.toList() )); Predicate<Filter> hasOrOperator = filter -> BooleanOperator.OR == filter.getBooleanOperator(); boolean throwException = false; if (other.isEmpty()) { if (groupedFilters.size() > 1) { throwException = groupedFilters .values().stream() .anyMatch(l -> hasOrOperator.test(l.get(0))); } } else if (!groupedFilters.isEmpty()) { throwException = other.stream().anyMatch(hasOrOperator) || groupedFilters.values().stream() .map(groupedFilter -> groupedFilter.get(0)) .anyMatch(hasOrOperator); } if (throwException) { throw new UnsupportedOperationException( "Filters containing nested paths cannot be combined via the logical OR operator."); } }
Source:
<code>private static double sanitize(double d) { final double dd = Math.abs(d % 1); <START> if ((dd != 0 && dd < 0.0000001) || (dd != 1 && dd > 0.9999999)) { <END> return Math.round(d); } else { return d; } }</code><technical_language>GenericMath.DBL_EPSILON here</technical_language>

Target:
private static double sanitize(double d) { final double dd = Math.abs(d % 1); if ((dd != 0 && dd < GenericMath.DBL_EPSILON * 2) || (dd != 1 && dd > 1 - GenericMath.DBL_EPSILON * 2)) { return Math.round(d); } else { return d; } }
Source:
<code>public void testCallNeedsPermissionMethod() throws Exception { CallNeedsPermissionDetector.METHODS = Collections.singletonList("fooBar"); StringBuilder foo = new StringBuilder("package com.example;\n"); foo.append("public class Foo {\n"); foo.append("public void someMethod() {"); foo.append("Baz baz = new Baz();\n"); foo.append("baz.fooBar(); "); foo.append("}\n"); foo.append("}"); StringBuilder baz = new StringBuilder("package com.example;\n"); baz.append("public class Baz {\n"); baz.append("public void fooBar() {\n"); baz.append("}\n"); <START> baz.append("}"); <END> String result = lintProject( java("src/com/example/Foo.java", foo.toString()), java("src/com/example/Baz.java", baz.toString())); StringBuilder error = new StringBuilder( "src/com/example/Foo.java:4: Error: Trying to access permission-protected method directly "); error.append("["); error.append(CallNeedsPermissionDetector.ISSUE.getId()); error.append("]\n"); error.append("baz.fooBar(); }\n"); error.append("~~~~~~~~~~~~\n"); error.append("1 errors, 0 warnings\n"); assertEquals(result, error.toString()); }</code><technical_language>need a StringBuilder here. concatenate strings</technical_language>

Target:
public void testCallNeedsPermissionMethod() throws Exception { CallNeedsPermissionDetector.methods = Collections.singletonList("fooBar"); @Language("JAVA") String foo = "" + "package com.example;\n" + "public class Foo {\n" + "public void someMethod() {" + "Baz baz = new Baz();\n" + "baz.fooBar(); " + "}\n" + "}"; @Language("JAVA") String baz = "" + "package com.example;\n" + "public class Baz {\n" + "public void fooBar() {\n" + "}\n" + "}"; String result = lintProject( java("src/com/example/Foo.java", foo), java("src/com/example/Baz.java", baz)); String error = "" + "src/com/example/Foo.java:4: Error: Trying to access permission-protected method directly " + "[" + CallNeedsPermissionDetector.ISSUE.getId() + "]\n" + "baz.fooBar(); }\n" + "~~~~~~~~~~~~\n" + "1 errors, 0 warnings\n"; assertEquals(result, error.toString()); }
Source:
<code>private void changeOptionsMenu(Menu menu) { MenuInflater menuInflater = this.getMenuInflater(); if (activeScreenType == ScreenType.WEBVIEW_SCREEN) { menuInflater.inflate(R.menu.web_view_activity, menu); } else if (activeScreenType == ScreenType.TABLE_MANAGER_SCREEN) { menuInflater.inflate(R.menu.table_manager, menu); <START> String defaultValue = Constants.TABLE_SORT_ORDER.SORT_ASC.getCorrespondingName(); <END> String sortingOrder = defaultValue; if(mPropSingleton.getProperty(CommonToolProperties.KEY_PREF_TABLES_SORT_BY_ORDER) != null || (!mPropSingleton.getProperty(CommonToolProperties.KEY_PREF_TABLES_SORT_BY_ORDER).equals("")) ) sortingOrder = mPropSingleton.getProperty(CommonToolProperties.KEY_PREF_TABLES_SORT_BY_ORDER); if( Constants.TABLE_SORT_ORDER.getCorrespondingEnum(sortingOrder) == Constants.TABLE_SORT_ORDER.SORT_ASC ) menu.findItem(R.id.menu_sort_name_asc).setChecked(true); else menu.findItem(R.id.menu_sort_name_desc).setChecked(true); } lastMenuType = activeScreenType; ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.show(); } }</code><technical_language>here, do need worry a default</technical_language>

Target:
private void changeOptionsMenu(Menu menu) { MenuInflater menuInflater = this.getMenuInflater(); if (activeScreenType == ScreenType.WEBVIEW_SCREEN) { menuInflater.inflate(R.menu.web_view_activity, menu); } else if (activeScreenType == ScreenType.TABLE_MANAGER_SCREEN) { menuInflater.inflate(R.menu.table_manager, menu); String sortingOrder = mPropSingleton.getProperty(CommonToolProperties.KEY_PREF_TABLES_SORT_BY_ORDER); if( sortingOrder != null && sortingOrder.equalsIgnoreCase( Constants.TABLE_SORT_ORDER.SORT_DESC.name() ) ) menu.findItem(R.id.menu_sort_name_desc).setChecked(true); else menu.findItem(R.id.menu_sort_name_asc).setChecked(true); } lastMenuType = activeScreenType; ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.show(); } }
Source:
<code>private <T> QueryRunner<T> buildAndDecorateQueryRunner( final QueryRunnerFactory<T, Query<T>> factory, final QueryToolChest<T, Query<T>> toolChest, final ReferenceCountingSegment adapter, final SegmentDescriptor segmentDescriptor ) { SpecificSegmentSpec segmentSpec = new SpecificSegmentSpec(segmentDescriptor); return new SpecificSegmentQueryRunner<T>( new MetricsEmittingQueryRunner<T>( emitter, new Function<Query<T>, ServiceMetricEvent.Builder>() { @Override public ServiceMetricEvent.Builder apply(@Nullable final Query<T> input) { return toolChest.makeMetricBuilder(input); } }, new BySegmentQueryRunner<T>( adapter.getIdentifier(), adapter.getDataInterval().getStart(), new CachingQueryRunner<T>( adapter.getIdentifier(), segmentDescriptor, objectMapper, cache, toolChest, new MetricsEmittingQueryRunner<T>( emitter, new Function<Query<T>, ServiceMetricEvent.Builder>() { @Override public ServiceMetricEvent.Builder apply(@Nullable final Query<T> input) { return toolChest.makeMetricBuilder(input); } }, new ReferenceCountingSegmentQueryRunner<T>(factory, adapter), <START> "segment/scan/time" <END> ), cachingExec, cacheConfig ) ) ).withWaitMeasuredFromNow(), segmentSpec ); }</code><technical_language>query related metrics start query? e.g. query/segment/time, query/cache/time more consistent query metrics</technical_language>

Target:
private <T> QueryRunner<T> buildAndDecorateQueryRunner( final QueryRunnerFactory<T, Query<T>> factory, final QueryToolChest<T, Query<T>> toolChest, final ReferenceCountingSegment adapter, final SegmentDescriptor segmentDescriptor ) { SpecificSegmentSpec segmentSpec = new SpecificSegmentSpec(segmentDescriptor); return new SpecificSegmentQueryRunner<T>( new MetricsEmittingQueryRunner<T>( emitter, new Function<Query<T>, ServiceMetricEvent.Builder>() { @Override public ServiceMetricEvent.Builder apply(@Nullable final Query<T> input) { return toolChest.makeMetricBuilder(input); } }, new BySegmentQueryRunner<T>( adapter.getIdentifier(), adapter.getDataInterval().getStart(), new CachingQueryRunner<T>( adapter.getIdentifier(), segmentDescriptor, objectMapper, cache, toolChest, new MetricsEmittingQueryRunner<T>( emitter, new Function<Query<T>, ServiceMetricEvent.Builder>() { @Override public ServiceMetricEvent.Builder apply(@Nullable final Query<T> input) { return toolChest.makeMetricBuilder(input); } }, new ReferenceCountingSegmentQueryRunner<T>(factory, adapter), "query/segment/time", ImmutableMap.of("segment", adapter.getIdentifier()) ), cachingExec, cacheConfig ) ), "query/segmentAndCache/time", ImmutableMap.of("segment", adapter.getIdentifier()) ).withWaitMeasuredFromNow(), segmentSpec ); }
Source:
<code>private void UpdateVmNetworks() { if (!getVm().getVdsGroupId().equals(getParameters().getVmStaticData().getvds_group_id())) { List<Network> networks = DbFacade .getInstance() .getNetworkDao() .getAllForCluster( getParameters().getVmStaticData().getvds_group_id()); List<VmNetworkInterface> interfaces = DbFacade.getInstance() .getVmNetworkInterfaceDao() .getAllForVm(getParameters().getVmStaticData().getId()); for (final VmNetworkInterface iface : interfaces) { Network net = LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network n) { <START> return n.getname().equals(iface.getNetworkName()); <END> } }); if (net == null) { iface.setNetworkName(null); DbFacade.getInstance().getVmNetworkInterfaceDao().update(iface); } } } }</code><technical_language>please n.getName() some cleanup patch get rid of Network.getname()</technical_language>

Target:
private void UpdateVmNetworks() { if (!getVm().getVdsGroupId().equals(getParameters().getVmStaticData().getvds_group_id())) { List<Network> networks = DbFacade .getInstance() .getNetworkDao() .getAllForCluster( getParameters().getVmStaticData().getvds_group_id()); List<VmNetworkInterface> interfaces = DbFacade.getInstance() .getVmNetworkInterfaceDao() .getAllForVm(getParameters().getVmStaticData().getId()); for (final VmNetworkInterface iface : interfaces) { Network net = LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network n) { return n.getName().equals(iface.getNetworkName()); } }); if (net == null) { iface.setNetworkName(null); DbFacade.getInstance().getVmNetworkInterfaceDao().update(iface); } } } }
Source:
<code>public int getEstimatedSizeInBytes() { int result = INSTANCE_SIZE; <START> result += SizeOf.sizeOfObjectArray(addresses.size()); <END> for (HostAddress address : addresses) { result += HOST_ADDRESS_INSTANCE_SIZE + address.getHostText().length() * Character.BYTES; } return result; }</code><technical_language>Static import</technical_language>

Target:
public int getEstimatedSizeInBytes() { int result = INSTANCE_SIZE; result += sizeOfObjectArray(addresses.size()); for (HostAddress address : addresses) { result += HOST_ADDRESS_INSTANCE_SIZE + address.getHostText().length() * Character.BYTES; } return result; }
Source:
<code>public void waitForAnnotatedElementVisibility(Object pageObject) { Class <? extends Object> clazz = pageObject.getClass(); final List<Field> allFields = new ArrayList<Field>(Arrays.asList(clazz.getDeclaredFields())); for(clazz = clazz.getSuperclass(); ((clazz != null) && (clazz != BasePage.class) && (clazz != HtmlElement.class)); clazz = clazz.getSuperclass()) { Stream.of(clazz.getDeclaredFields()). <START> forEach(f->allFields.add(f)); <END> } allFields.stream() .filter(this::validateFieldVisibilityAnnotations) .forEach(field -> invokeWaitFunctionForField(field, pageObject)); }</code><technical_language>I easier read if modify allFields variable. create a new variable called superClassFields rename allFields classFields do Stream.concat(classFields, superClassFields) (line 75)</technical_language>

Target:
public void waitForAnnotatedElementVisibility(Object pageObject) { Class <?> clazz = pageObject.getClass(); final List<Field> allFields = new ArrayList<>(Arrays.asList(clazz.getDeclaredFields())); final List<Field> superClassFields = getDeclaredFieldsFromSuperClasses(clazz); Stream.concat(allFields.stream(),superClassFields.stream()) .filter(this::validateFieldVisibilityAnnotations) .forEach(field -> invokeWaitFunctionForField(field, pageObject)); }
Source:
<code>protected static Optional<RingTime> getProgressiveRingTime(final long accountId, final DateTime nowAlignedToStartOfMinute, final RingTime nextRingTimeFromWorker, final TrackerMotionDAO trackerMotionDAO){ final DateTime dataCollectionBeginTime = nowAlignedToStartOfMinute.minusMinutes(PROGRESSIVE_MOTION_WINDOW_MIN); final List<TrackerMotion> motionWithinProgressiveWindow = trackerMotionDAO.getBetween(accountId, dataCollectionBeginTime, nowAlignedToStartOfMinute.plusMinutes(1)); if(motionWithinProgressiveWindow.size() == 0){ LOGGER.info("No motion data in last minutes for Account ID: {}. Not computing progressive alarm.", PROGRESSIVE_MOTION_WINDOW_MIN, accountId); return Optional.absent(); } final List<AmplitudeData> amplitudeData = TrackerMotionUtils.trackerMotionToAmplitudeData(motionWithinProgressiveWindow); final List<AmplitudeData> kickOffCounts = TrackerMotionUtils.trackerMotionToKickOffCounts(motionWithinProgressiveWindow); if(SleepCycleAlgorithm.isUserAwakeInGivenDataSpan(amplitudeData, kickOffCounts)){ final RingTime progressiveRingTime = new RingTime( nowAlignedToStartOfMinute.plusMinutes(PROGRESSIVE_SAFE_GAP_MIN).getMillis(), nextRingTimeFromWorker.expectedRingTimeUTC, nextRingTimeFromWorker.soundIds, true); return Optional.of(progressiveRingTime); } <START> LOGGER.info("User deemed 'not awake' in last 5 minutes for Account ID: {}. Not computing progressive alarm."); <END> return Optional.absent(); }</code><technical_language>missing replace {}</technical_language>

Target:
protected static Optional<RingTime> getProgressiveRingTime(final long accountId, final DateTime nowAlignedToStartOfMinute, final RingTime nextRingTimeFromWorker, final TrackerMotionDAO trackerMotionDAO){ final DateTime dataCollectionBeginTime = nowAlignedToStartOfMinute.minusMinutes(PROGRESSIVE_MOTION_WINDOW_MIN); final List<TrackerMotion> motionWithinProgressiveWindow = trackerMotionDAO.getBetween(accountId, dataCollectionBeginTime, nowAlignedToStartOfMinute.plusMinutes(1)); if(motionWithinProgressiveWindow.isEmpty()){ LOGGER.info("No motion data in last minutes for Account ID: {}. Not computing progressive alarm.", PROGRESSIVE_MOTION_WINDOW_MIN, accountId); return Optional.absent(); } final List<AmplitudeData> amplitudeData = TrackerMotionUtils.trackerMotionToAmplitudeData(motionWithinProgressiveWindow); final List<AmplitudeData> kickOffCounts = TrackerMotionUtils.trackerMotionToKickOffCounts(motionWithinProgressiveWindow); if(SleepCycleAlgorithm.isUserAwakeInGivenDataSpan(amplitudeData, kickOffCounts)){ final RingTime progressiveRingTime = new RingTime( nowAlignedToStartOfMinute.plusMinutes(PROGRESSIVE_SAFE_GAP_MIN).getMillis(), nextRingTimeFromWorker.expectedRingTimeUTC, nextRingTimeFromWorker.soundIds, true); return Optional.of(progressiveRingTime); } LOGGER.info("User deemed 'not awake' in last minutes for Account ID: {}. Not computing progressive alarm.", PROGRESSIVE_MOTION_WINDOW_MIN, accountId); return Optional.absent(); }
Source:
<code>@Test public void emptyUrlThrows() { try { <START> Endpoint.createFixed(null); <END> } catch (NullPointerException expected) { assertThat(expected).hasMessage("url == null"); } }</code><technical_language>Missing fail()</technical_language>

Target:
@Test public void emptyUrlThrows() { try { Endpoint.createFixed(" "); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("Empty URL"); } }
Source:
<code>public void loadAddressSpace() { for (IndexedLogEntry indexedEntry : this) { LogData logData = getLogData(indexedEntry.logEntry); <START> SMRGarbageEntry garbageInfo = (SMRGarbageEntry) logData.getPayload(null); <END> mergeGarbageEntry(logData.getGlobalAddress(), garbageInfo); } compactionMetaData.updateGarbageSize(new ArrayList<>(garbageEntryMap.values())); }</code><technical_language>garbageInfo -> garbageEntry</technical_language>

Target:
public void loadAddressSpace() { for (IndexedLogEntry indexedEntry : this) { LogData logData = getLogData(indexedEntry.logEntry); SMRGarbageEntry garbageEntry = (SMRGarbageEntry) logData.getPayload(null); mergeGarbageEntry(logData.getGlobalAddress(), garbageEntry); } compactionMetaData.updateGarbageSize(new ArrayList<>(garbageEntryMap.values())); }
Source:
<code>public Index parseIndex(T object) { Error.push("parseIndex"); try { if (object != null) { Index index = new Index(); String name = getStringProperty(object, STR_NAME); Object unique = getValueProperty(object, STR_UNIQUE); List<T> fields = getObjectList(object, STR_FIELDS); if (null != name) { index.setName(name); } if (null != unique) { index.setUnique(Boolean.parseBoolean(unique.toString())); } if (null != fields && !fields.isEmpty()) { List<IndexSortKey> f = new ArrayList<>(); for (T s : fields) { String fld = getRequiredStringProperty(s, "field"); String dir = getStringProperty(s, "dir"); <START> String ci = getStringProperty(s, "caseInsensitive"); <END> if (dir == null) { dir = "$asc"; } IndexSortKey sort = new IndexSortKey(new Path(fld), "$desc".equals(dir), Boolean.valueOf(ci)); f.add(sort); } index.setFields(f); } else { throw Error.get(MetadataConstants.ERR_PARSE_MISSING_ELEMENT, STR_FIELDS); } return index; } else { return null; } } catch (Error e) { throw e; } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage()); } finally { Error.pop(); } }</code><technical_language>getValueProperty, typecast Boolean</technical_language>

Target:
public Index parseIndex(T object) { Error.push("parseIndex"); try { if (object != null) { Index index = new Index(); String name = getStringProperty(object, STR_NAME); Object unique = getValueProperty(object, STR_UNIQUE); List<T> fields = getObjectList(object, STR_FIELDS); if (null != name) { index.setName(name); } if (null != unique) { index.setUnique(Boolean.parseBoolean(unique.toString())); } if (null != fields && !fields.isEmpty()) { List<IndexSortKey> f = new ArrayList<>(); for (T s : fields) { String fld = getRequiredStringProperty(s, "field"); String dir = getStringProperty(s, "dir"); Optional<Boolean> ci = Optional.ofNullable((Boolean) getValueProperty(s, "caseInsensitive")); if (dir == null) { dir = "$asc"; } IndexSortKey sort = new IndexSortKey(new Path(fld), "$desc".equals(dir), ci.orElse(false)); f.add(sort); } index.setFields(f); } else { throw Error.get(MetadataConstants.ERR_PARSE_MISSING_ELEMENT, STR_FIELDS); } return index; } else { return null; } } catch (Error e) { throw e; } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage()); } finally { Error.pop(); } }
Source:
<code>public void verifyNo71MediaAds() { AdsComparison adsComparison = new AdsComparison(); boolean combinationFound = false; PageObjectLogging.log("PageOpened", "Page opened", true, driver); for (HashMap<String,Object> combination: combinations) { List<String> combinationSlots = (List)combination.get("slots"); if (!checkIfCombinationOnPage(combinationSlots)) { PageObjectLogging.log( "Combination not present", "Combination not present: " + combination.get("name"), true ); return; } else { for (String elementSelector: combinationSlots) { WebElement combinationElement = driver.findElement(By.cssSelector(elementSelector)); if (combinationElement.isDisplayed()) { PageObjectLogging.log( "Combination present", "Combination present: " + combination.get("name"), false ); <START> throw new NoSuchElementException("Ads found on page"); <END> } } } } }</code><technical_language>Consider throwing a exception. Throwing a NoSuchElementException is a bit misleading element is found</technical_language>

Target:
public void verifyNo71MediaAds() { AdsComparison adsComparison = new AdsComparison(); boolean combinationFound = false; PageObjectLogging.log("PageOpened", "Page opened", true, driver); for (HashMap<String,Object> combination: combinations) { List<String> combinationSlots = (List)combination.get("slots"); if (!checkIfCombinationOnPage(combinationSlots)) { PageObjectLogging.log( "Combination not present", "Combination not present: " + combination.get("name"), true ); return; } else { for (String elementSelector: combinationSlots) { WebElement combinationElement = driver.findElement(By.cssSelector(elementSelector)); if (combinationElement.isDisplayed()) { PageObjectLogging.log( "Combination present", "Combination present: " + combination.get("name"), false ); throw new WebDriverException("Ads found on page"); } } } } }
Source:
<code>public void initialize() { if (getContext().getUserPayload() == null) { throw new TezUncheckedException("user payload cannot be null for VertexManagerWithConcurrentInput"); } managedTasks = getContext().getVertexNumTasks(getContext().getVertexName()); Map<String, EdgeProperty> edges = getContext().getInputVertexEdgeProperties(); for (Map.Entry<String, EdgeProperty> entry : edges.entrySet()) { <START> if (!CONCURRENT.equals(entry.getValue().getSchedulingType())){ <END> throw new TezUncheckedException("All input edges to vertex " + vertexName + " must be CONCURRENT."); } String srcVertex = entry.getKey(); srcVerticesConfigured.put(srcVertex, false); getContext().registerForVertexStateUpdates(srcVertex, EnumSet.of(VertexState.CONFIGURED)); } try { vertexConfig = TezUtils.createConfFromUserPayload(getContext().getUserPayload()); } catch (IOException e) { throw new TezUncheckedException(e); } edgeTriggerType = ConcurrentEdgeTriggerType.valueOf( vertexConfig.get(TezConfiguration.TEZ_CONCURRENT_EDGE_TRIGGER_TYPE, TezConfiguration.TEZ_CONCURRENT_EDGE_TRIGGER_TYPE_DEFAULT)); if (!ConcurrentEdgeTriggerType.SOURCE_VERTEX_CONFIGURED.equals(edgeTriggerType)) { throw new TezUncheckedException("Only support SOURCE_VERTEX_CONFIGURED triggering type for now."); } LOG.info("VertexManagerWithConcurrentInput initialized with edgeTriggerType {}.", edgeTriggerType); vertexName = getContext().getVertexName(); completedUpstreamTasks = 0; }</code><technical_language>suggestion if (!CONCURRENT.equals(entry.getValue().getSchedulingType())) {</technical_language>

Target:
public void initialize() { UserPayload userPayload = getContext().getUserPayload(); if (userPayload == null || userPayload.getPayload() == null || userPayload.getPayload().limit() == 0) { throw new TezUncheckedException("Could not initialize VertexManagerWithConcurrentInput" + " from provided user payload"); } managedTasks = getContext().getVertexNumTasks(getContext().getVertexName()); Map<String, EdgeProperty> edges = getContext().getInputVertexEdgeProperties(); for (Map.Entry<String, EdgeProperty> entry : edges.entrySet()) { if (!CONCURRENT.equals(entry.getValue().getSchedulingType())) { throw new TezUncheckedException("All input edges to vertex " + vertexName + " must be CONCURRENT."); } String srcVertex = entry.getKey(); srcVerticesConfigured.put(srcVertex, false); getContext().registerForVertexStateUpdates(srcVertex, EnumSet.of(VertexState.CONFIGURED)); } try { vertexConfig = TezUtils.createConfFromUserPayload(getContext().getUserPayload()); } catch (IOException e) { throw new TezUncheckedException(e); } edgeTriggerType = ConcurrentEdgeTriggerType.valueOf( vertexConfig.get(TezConfiguration.TEZ_CONCURRENT_EDGE_TRIGGER_TYPE, TezConfiguration.TEZ_CONCURRENT_EDGE_TRIGGER_TYPE_DEFAULT)); if (!ConcurrentEdgeTriggerType.SOURCE_VERTEX_CONFIGURED.equals(edgeTriggerType)) { throw new TezUncheckedException("Only support SOURCE_VERTEX_CONFIGURED triggering type for now."); } LOG.info("VertexManagerWithConcurrentInput initialized with edgeTriggerType {}.", edgeTriggerType); vertexName = getContext().getVertexName(); completedUpstreamTasks = 0; }
Source:
<code>public void realmSet$columnRealmList(RealmList<some.test.AllTypes> value) { if (proxyState.isUnderConstruction()) { if (!proxyState.getAcceptDefaultValue$realm()) { return; } if (proxyState.getExcludeFields$realm().contains("columnRealmList")) { return; } if (value != null && !value.isManaged()) { final Realm realm = (Realm) proxyState.getRealm$realm(); final RealmList<some.test.AllTypes> original = value; value = new RealmList<some.test.AllTypes>(); for (some.test.AllTypes item : original) { if (item == null || RealmObject.isManaged(item)) { value.add(item); } else { value.add(realm.copyToRealm(item)); } } } } proxyState.getRealm$realm().checkIfValid(); OsList osList = proxyState.getRow$realm().getModelList(columnInfo.columnRealmListIndex); if (value != null && value.size() == osList.size()) { <START> for (int i = 0; i < value.size(); i++) { <END> some.test.AllTypes linkedObject = value.get(i); osList.setRow(i, ((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex()); } } else { osList.removeAll(); if (value == null) { return; } for (RealmModel linkedObject : value) { proxyState.checkValidObject(linkedObject); osList.addRow(((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex()); } } }</code><technical_language>faster a temp var store size avoid multiple JNI calls here</technical_language>

Target:
public void realmSet$columnRealmList(RealmList<some.test.AllTypes> value) { if (proxyState.isUnderConstruction()) { if (!proxyState.getAcceptDefaultValue$realm()) { return; } if (proxyState.getExcludeFields$realm().contains("columnRealmList")) { return; } if (value != null && !value.isManaged()) { final Realm realm = (Realm) proxyState.getRealm$realm(); final RealmList<some.test.AllTypes> original = value; value = new RealmList<some.test.AllTypes>(); for (some.test.AllTypes item : original) { if (item == null || RealmObject.isManaged(item)) { value.add(item); } else { value.add(realm.copyToRealm(item)); } } } } proxyState.getRealm$realm().checkIfValid(); OsList osList = proxyState.getRow$realm().getModelList(columnInfo.columnRealmListIndex); if (value != null && value.size() == osList.size()) { int objects = value.size(); for (int i = 0; i < objects; i++) { some.test.AllTypes linkedObject = value.get(i); proxyState.checkValidObject(linkedObject); osList.setRow(i, ((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex()); } } else { osList.removeAll(); if (value == null) { return; } int objects = value.size(); for (int i = 0; i < objects; i++) { some.test.AllTypes linkedObject = value.get(i); proxyState.checkValidObject(linkedObject); osList.addRow(((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex()); } } }
Source:
<code>public void testUnblockedFacetsDontBlockDeletion() throws IOException { createFolderStructure(); TestTaskListener testTaskListener = new TestTaskListener(); Fingerprint fp = new TestFingerprint(false); fp.facets.setOwner(Saveable.NOOP); TestFingperprintFacet facet = new TestFingperprintFacet(fp, System.currentTimeMillis(), false); fp.facets.add(facet); FingerprintCleanupThread cleanupThread = new TestFingerprintCleanupThread(fp); cleanupThread.execute(testTaskListener); <START> assertFalse("Should have deleted obsolete file.", fpFile.toFile().exists()); <END> }</code><technical_language>Hamcrest assertion for easier diagnosis of failures? suggestion assertThat(fpFile.toFile()., is(not(aReadableFile()))); assertFalse("Should deleted obsolete file.", fpFile.toFile().exists());</technical_language>

Target:
public void testUnblockedFacetsDontBlockDeletion() throws IOException { createFolderStructure(); TestTaskListener testTaskListener = new TestTaskListener(); Fingerprint fp = new TestFingerprint(false); fp.facets.setOwner(Saveable.NOOP); TestFingperprintFacet facet = new TestFingperprintFacet(fp, System.currentTimeMillis(), false); fp.facets.add(facet); FingerprintCleanupThread cleanupThread = new TestFingerprintCleanupThread(fp); cleanupThread.execute(testTaskListener); assertThat(fpFile.toFile(), is(not(aReadableFile()))); }
Source:
<code>public JavascriptTestExecutor login(JavascriptStateValidator validator) { <START> return login((JSObjectBuilder)null, validator); <END> }</code><technical_language>suggestion return login((String)null, validator);</technical_language>

Target:
public JavascriptTestExecutor login(JavascriptStateValidator validator) { return login((String)null, validator); }
Source:
<code>public static Set<Collaboration> getSystemProtocols(Resource resource) { if (resource != null && resource.getContents().size() > 0) { Set<Collaboration> result = new HashSet<>(); for (EObject eObject : resource.getContents()) { <START> if (eObject instanceof Collaboration && ProtocolUtils.isProtocol(eObject)) { <END> if (isSystemProtocol((Collaboration) eObject)) { result.add((Collaboration) eObject); } } } return result; } else { Activator.log.error("Impossible to get content of the Model Library", null); } return Collections.emptySet(); }</code><technical_language>I this work: collaborations roots of resource. Some kind of package root of resource. a resource.getAllContents() iterator is is needed</technical_language>

Target:
public static Set<Collaboration> getSystemProtocols(Resource resource) { if (resource != null && resource.getContents().size() > 0) { Set<Collaboration> result = new HashSet<>(); TreeIterator<EObject> allContents = resource.getAllContents(); while (allContents.hasNext()) { EObject eObject = allContents.next(); if (eObject instanceof Collaboration && ProtocolUtils.isProtocol(eObject)) { if (isSystemProtocol((Collaboration) eObject)) { result.add((Collaboration) eObject); } } } return result; } else { Activator.log.error("Impossible to get content of the Model Library", null); } return Collections.emptySet(); }
Source:
<code>Config(@NonNull Context context, PersistableBundle carrierConfig, int entryType) { <START> if (entryType != EmergencyDialer.ENTRY_TYPE_POWER_MENU) { Log.d(LOG_TAG, "Disables shortcut view since it's not launched from power menu"); mCanEnableShortcutView = false; } else if (carrierConfig == null || !carrierConfig.getBoolean( CarrierConfigManager.KEY_SUPPORT_EMERGENCY_DIALER_SHORTCUT_BOOL)) { Log.d(LOG_TAG, "Disables shortcut view by carrier requirement"); mCanEnableShortcutView = false; } else { mCanEnableShortcutView = true; } <END> refresh(context); }</code><technical_language>I I suggest change in canEnableShortcutView() method simplify logic, for example, In Constructor: mCanEnableShortcutView = canEnableShortcutView(); if(mCanEnableShortcutView) { mPhoneInfo = ShortcutViewUtils.pickPreferredPhone(context); } In method: private boolean canEnableShortcutView() { if (entryType != EmergencyDialer.ENTRY_TYPE_POWER_MENU) { return false; } if (carrierConfig == null || !carrierConfig.getBoolean( CarrierConfigManager.KEY_SUPPORT_EMERGENCY_DIALER_SHORTCUT_BOOL)) { return false; } return true; }</technical_language>

Target:
Config(@NonNull Context context, PersistableBundle carrierConfig, int entryType) { mCanEnableShortcutView = canEnableShortcutView(carrierConfig, entryType); refresh(context); }
Source:
<code>private Summary copyExistingSummary(String copyType, String copyVal, ItemManager itemMan, AliasManager aliasMan) { Summary newSummary = null; Item summaryItem = null; if ("item".equalsIgnoreCase(copyType)) { summaryItem = itemMan.load(copyVal); <START> } else if ("alias".contains(copyType)) { <END> summaryItem = itemMan.load(aliasMan.load(copyVal).getItemId()); } else { log.error("Attempted to copy existing summary from invalid copy type: " + copyType); } if(summaryItem == null) { log.error("Item provided to copy summary from (" + copyType + " | " + copyVal + ") could not be loaded."); } else { newSummary = Summary.copyValues(summaryItem.getSummary(), new Summary()); } return newSummary; }</code><technical_language>curious usage of .contains instead of .equalsIgnoreCase above</technical_language>

Target:
private Summary copyExistingSummary(String copyType, String copyVal, ItemManager itemMan, AliasManager aliasMan) { Summary newSummary = null; Item summaryItem = null; if ("item".equalsIgnoreCase(copyType)) { summaryItem = itemMan.load(copyVal); } else if ("alias".equalsIgnoreCase(copyType)) { summaryItem = itemMan.load(aliasMan.load(copyVal).getItemId()); } else { log.error("Attempted to copy existing summary from invalid copy type: " + copyType); } if(summaryItem == null) { log.error("Item provided to copy summary from (" + copyType + " | " + copyVal + ") could not be loaded."); } else { newSummary = Summary.copyValues(summaryItem.getSummary(), new Summary()); } return newSummary; }
Source:
<code>public void verifySectionInvisibility(){ waitForElementByElement(sectionInvisibilityElement); <START> PageObjectLogging.log("verifySectionInvisibility", "section is not visible", true, driver); <END> }</code><technical_language>remove 'driver' parameter (yes, a write this line, please change :) )</technical_language>

Target:
public void verifySectionInvisibility(){ waitForElementByElement(sectionInvisibilityElement); PageObjectLogging.log("verifySectionInvisibility", "section is not visible", true); }
Source:
<code>private double getTotalSizeForClonedDisks(Collection<DiskImage> diskImages) { double totalSizeForDisks = 0.0; <START> if (null != diskImages) { <END> for (DiskImage diskImage : diskImages) { double diskCapacity = diskImage.getSize(); double sizeForDisk = diskCapacity; if ((storageDomain.getStorageType().isFileDomain() && diskImage.getVolumeType() == VolumeType.Sparse) || storageDomain.getStorageType().isBlockDomain() && diskImage.getVolumeFormat() == VolumeFormat.COW) { double usedSapce = diskImage.getActualDiskWithSnapshotsSizeInBytes(); sizeForDisk = Math.min(diskCapacity, usedSapce); } if (diskImage.getVolumeFormat() == VolumeFormat.COW) { sizeForDisk = Math.ceil(QCOW_OVERHEAD_FACTOR * sizeForDisk); } totalSizeForDisks += sizeForDisk; } } return totalSizeForDisks; }</code><technical_language>please put null right hand side of expression, project conventions</technical_language>

Target:
private double getTotalSizeForClonedDisks(Collection<DiskImage> diskImages) { double totalSizeForDisks = 0.0; if (diskImages != null) { for (DiskImage diskImage : diskImages) { double diskCapacity = diskImage.getSize(); double sizeForDisk = diskCapacity; if ((storageDomain.getStorageType().isFileDomain() && diskImage.getVolumeType() == VolumeType.Sparse) || storageDomain.getStorageType().isBlockDomain() && diskImage.getVolumeFormat() == VolumeFormat.COW) { double usedSapce = diskImage.getActualDiskWithSnapshotsSizeInBytes(); sizeForDisk = Math.min(diskCapacity, usedSapce); } if (diskImage.getVolumeFormat() == VolumeFormat.COW) { sizeForDisk = Math.ceil(QCOW_OVERHEAD_FACTOR * sizeForDisk); } totalSizeForDisks += sizeForDisk; } } return totalSizeForDisks; }
Source:
<code>private void connectStorageServer(StorageType type, List<StorageServerConnections> connections) { if (connections != null && connections.size() > 0) { Map<String, String> retValues = (HashMap<String, String>) Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.ConnectStorageServer, new ConnectStorageServerVDSCommandParameters(getVds().getId(), getStoragePool().getId(), type, connections)).getReturnValue(); <START> } <END> }</code><technical_language>StorageHelperDirector.getInstance().getItem(type).isConnectSucceeded - this left for log messages, name changed, result is important anymore</technical_language>

Target:
private boolean connectStorageServer(StorageType type, List<StorageServerConnections> connections) { boolean connectSucceeded = true; if (connections != null && connections.size() > 0) { Map<String, String> retValues = (HashMap<String, String>) Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.ConnectStorageServer, new ConnectStorageServerVDSCommandParameters(getVds().getId(), getStoragePool().getId(), type, connections)).getReturnValue(); connectSucceeded = StorageHelperDirector.getInstance().getItem(type).isConnectSucceeded(retValues, connections); log.infoFormat("Host {0} storage connection was {1} ", getVds().getName(), connectSucceeded ? "succeeded" : "failed"); } return connectSucceeded; }
Source:
<code>public void sanity() { profile.define(context); Map<String, BuiltInActiveRule> activeRules = getActiveRulesByRuleKey(context); assertThat(activeRules.size()).isEqualTo(3); assertThat(activeRules.keySet()).contains("HTL-0"); <START> <END> }</code><technical_language>This line is needed</technical_language>

Target:
public void sanity() { profile.define(context); Map<String, BuiltInActiveRule> activeRules = getActiveRulesByRuleKey(context); assertThat(activeRules.size()).isEqualTo(4); assertThat(activeRules.keySet()).contains("HTL-0"); }
Source:
<code>public boolean add( long[] value ) { <START> assert value.length == width : "all elements must have the same size"; <END> int slotNr = slotFor( value ); while ( true ) { int offset = slotNr * width; if ( table.inner[offset] == NOT_IN_USE ) { if ( table.timeToResize() ) { resize(); slotNr = slotFor( value ); } else { table.setValue( slotNr, value ); return true; } } else { for ( int i = 0; i < width; i++ ) { if ( table.inner[offset + i] != value[i] ) { slotNr = (slotNr + 1) & table.tableMask; break; } else if ( i == width - 1 ) { return false; } } } } }</code><technical_language>adding another assert here, checking unsupported values (e.g. < 0 == 0xF000000000000000L)</technical_language>

Target:
public boolean add( long[] value ) { assert validValue( value ); int slotNr = slotFor( value ); while ( true ) { int offset = slotNr * width; if ( table.inner[offset] == NOT_IN_USE ) { if ( table.timeToResize() ) { resize(); slotNr = slotFor( value ); } else { table.setValue( slotNr, value ); return true; } } else { for ( int i = 0; i < width; i++ ) { if ( table.inner[offset + i] != value[i] ) { slotNr = (slotNr + 1) & table.tableMask; break; } else if ( i == width - 1 ) { return false; } } } } }
Source:
<code>public static boolean launch(Context context, String pin) { if (!PinManager.get().isPin(pin)) { return false; } VisibilityManager.showApplication(context); try { Intent stealthCall = new Intent(context, HomeActivity.class); stealthCall.addCategory(Intent.CATEGORY_LAUNCHER); stealthCall.putExtra(PinManager.EXTRA_PIN, pin.trim()); stealthCall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(stealthCall); return true; } catch (Exception e) { <START> VisibilityManager.hideApplication(context); <END> Utils.d("Could not launch stealth app"); } return false; }</code><technical_language>put this here? this get app close? return false? is onDestroy called</technical_language>

Target:
public static boolean launch(Context context, String pin) { if (!PinManager.get().isPin(pin)) { return false; } VisibilityManager.showApplication(context); Intent stealthCall = new Intent(context, HomeActivity.class); stealthCall.addCategory(Intent.CATEGORY_LAUNCHER); stealthCall.putExtra(PinManager.EXTRA_PIN, pin.trim()); stealthCall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(stealthCall); return true; }
Source:
<code>public void execute(Player player, String[] arg) { SimpleClans plugin = SimpleClans.getInstance(); if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.ban")) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions")); return; } if (arg.length != 1) { ChatBlock.sendMessage(player, MessageFormat.format(plugin.getLang("usage.ban.unban"), ChatColor.RED, plugin.getSettingsManager().getCommandClan())); return; } UUID uuid = UUIDMigration.getForcedPlayerUUID(arg[0]); if (uuid == null) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched")); return; } if (plugin.getSettingsManager().isBanned(uuid)) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.already.banned")); return; } <START> <END> ClanPlayer cp = plugin.getClanManager().getClanPlayer(uuid); if (cp == null) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched")); return; } plugin.getClanManager().ban(cp); ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.added.to.banned.list")); Player pl = SimpleClans.getInstance().getServer().getPlayer(uuid); if (pl != null) { ChatBlock.sendMessage(pl, ChatColor.AQUA + plugin.getLang("you.banned")); } }</code><technical_language>I understand ban command. ban a player a clan, ban plugin. is, banned, commands a part of a clan anymore. This check for a ClanPlayer banned</technical_language>

Target:
public void execute(Player player, String[] arg) { SimpleClans plugin = SimpleClans.getInstance(); if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.ban")) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions")); return; } if (arg.length != 1) { ChatBlock.sendMessage(player, MessageFormat.format(plugin.getLang("usage.ban.unban"), ChatColor.RED, plugin.getSettingsManager().getCommandClan())); return; } UUID uuid = UUIDMigration.getForcedPlayerUUID(arg[0]); if (uuid == null) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched")); return; } if (plugin.getSettingsManager().isBanned(uuid)) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.already.banned")); return; } plugin.getClanManager().ban(uuid); ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.added.to.banned.list")); Player pl = SimpleClans.getInstance().getServer().getPlayer(uuid); if (pl != null) { ChatBlock.sendMessage(pl, ChatColor.AQUA + plugin.getLang("you.banned")); } }