auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void assignServices(PerunSession sess, Resource resource, List<Service> services) throws PrivilegeException, ResourceNotExistsException, ServiceNotExistsException, ServiceAlreadyAssignedException, WrongAttributeValueException, WrongReferenceAttributeValueException { Utils.checkPerunSession(sess); getResourcesManagerBl().checkResourceExists(sess, resource); if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, resource)) { throw new PrivilegeException(sess, "assignServices"); } <START> for (Service service : services) { <END> getPerunBl().getServicesManagerBl().checkServiceExists(sess, service); } getResourcesManagerBl().assignServices(sess, resource, services); }</code><technical_language>nice checks authorization check. new authorization model needs objects exist authorization checks performed</technical_language>

Target:
public void assignServices(PerunSession sess, Resource resource, List<Service> services) throws PrivilegeException, ResourceNotExistsException, ServiceNotExistsException, ServiceAlreadyAssignedException, WrongAttributeValueException, WrongReferenceAttributeValueException { Utils.checkPerunSession(sess); getResourcesManagerBl().checkResourceExists(sess, resource); for (Service service : services) { getPerunBl().getServicesManagerBl().checkServiceExists(sess, service); } if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, resource)) { throw new PrivilegeException(sess, "assignServices"); } getResourcesManagerBl().assignServices(sess, resource, services); }
Source:
<code>private static boolean byteArrayEquals(byte[][] self, byte[][] other) { if (self.length != other.length) { return false; } <START> for (int i = 0; i < self.length; i++) { <END> if (!Bytes.equals(self[i], other[i])) { return false; } } return true; }</code><technical_language>Bytes.memcmp()</technical_language>

Target:
private static boolean byteArrayEquals(byte[][] self, byte[][] other) { if (self.length != other.length) { return false; } for (int i = 0; i < self.length; i++) { if (Bytes.memcmp(self[i], other[i]) != 0) { return false; } } return true; }
Source:
<code>public void update() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) <START> .build(); <END> MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setId(metadataField.getID()); metadataFieldRest.setElement(ELEMENT_UPDATED); metadataFieldRest.setQualifier(QUALIFIER_UPDATED); metadataFieldRest.setScopeNote(SCOPE_NOTE_UPDATED); getClient(getAuthToken(admin.getEmail(), password)) .perform(put("/api/core/metadatafields/" + metadataField.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isOk()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataFieldMatcher.matchMetadataFieldByKeys( metadataSchema.getName(), ELEMENT_UPDATED, QUALIFIER_UPDATED) )); }</code><technical_language>turn auth system creating test data</technical_language>

Target:
public void update() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); context.restoreAuthSystemState(); MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setId(metadataField.getID()); metadataFieldRest.setElement(ELEMENT_UPDATED); metadataFieldRest.setQualifier(QUALIFIER_UPDATED); metadataFieldRest.setScopeNote(SCOPE_NOTE_UPDATED); getClient(getAuthToken(admin.getEmail(), password)) .perform(put("/api/core/metadatafields/" + metadataField.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isOk()); getClient().perform(get("/api/core/metadatafields/" + metadataField.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataFieldMatcher.matchMetadataFieldByKeys( metadataSchema.getName(), ELEMENT_UPDATED, QUALIFIER_UPDATED) )); }
Source:
<code>public Set<Class<?>> getClasses() { HiveConf conf = new HiveConf(); conf.addResource(Thread.currentThread().getContextClassLoader().getResource("grillserver-default.xml")); <START> conf.addResource(Thread.currentThread().getContextClassLoader().getResource("grill-site.xml")); <END> final Set<Class<?>> classes = new HashSet<Class<?>>(); String[] resourceNames = conf.getStrings(GrillConfConstants.GRILL_WS_RESOURCE_NAMES); String[] featureNames = conf.getStrings(GrillConfConstants.GRILL_WS_FEATURE_NAMES); String[] listenerNames = conf.getStrings(GrillConfConstants.GRILL_WS_LISTENER_NAMES); String[] filterNames = conf.getStrings(GrillConfConstants.GRILL_WS_FILTER_NAMES); for(String rName : resourceNames) { Class wsResourceClass = conf.getClass( GrillConfConstants.getWSResourceImplConfKey(rName), null); classes.add(wsResourceClass); LOG.info("Added resource " + wsResourceClass); } for(String fName : featureNames) { Class wsFeatureClass = conf.getClass( GrillConfConstants.getWSFeatureImplConfKey(fName), null); classes.add(wsFeatureClass); LOG.info("Added feature " + wsFeatureClass); } for(String lName : listenerNames) { Class wsListenerClass = conf.getClass( GrillConfConstants.getWSListenerImplConfKey(lName), null); classes.add(wsListenerClass); LOG.info("Added listener " + wsListenerClass); } for(String filterName : filterNames) { Class wsFilterClass = conf.getClass( GrillConfConstants.getWSFilterImplConfKey(filterName), null); classes.add(wsFilterClass); LOG.info("Added filter " + wsFilterClass); } return classes; }</code><technical_language>Get conf GrillServices class. Dont create another here</technical_language>

Target:
public Set<Class<?>> getClasses() { final Set<Class<?>> classes = new HashSet<Class<?>>(); String[] resourceNames = conf.getStrings(GrillConfConstants.GRILL_WS_RESOURCE_NAMES); String[] featureNames = conf.getStrings(GrillConfConstants.GRILL_WS_FEATURE_NAMES); String[] listenerNames = conf.getStrings(GrillConfConstants.GRILL_WS_LISTENER_NAMES); String[] filterNames = conf.getStrings(GrillConfConstants.GRILL_WS_FILTER_NAMES); for(String rName : resourceNames) { Class wsResourceClass = conf.getClass( GrillConfConstants.getWSResourceImplConfKey(rName), null); classes.add(wsResourceClass); LOG.info("Added resource " + wsResourceClass); } for(String fName : featureNames) { Class wsFeatureClass = conf.getClass( GrillConfConstants.getWSFeatureImplConfKey(fName), null); classes.add(wsFeatureClass); LOG.info("Added feature " + wsFeatureClass); } for(String lName : listenerNames) { Class wsListenerClass = conf.getClass( GrillConfConstants.getWSListenerImplConfKey(lName), null); classes.add(wsListenerClass); LOG.info("Added listener " + wsListenerClass); } for(String filterName : filterNames) { Class wsFilterClass = conf.getClass( GrillConfConstants.getWSFilterImplConfKey(filterName), null); classes.add(wsFilterClass); LOG.info("Added filter " + wsFilterClass); } return classes; }
Source:
<code>private Target createRecordTarget(final TargetCollection<Target> targets, final SimpleInterval where) { final Target target = targets.target(where); <START> if (target == null || targets.location(target).equals(where)) { <END> return target; } else { throw formatException(String.format("mismatching yet overlapping intervals in the input (%s) and the target collection (%s)", where, targets.location(target))); } }</code><technical_language>This is same. code created a copy, is implied a method called create.... good idea here</technical_language>

Target:
private Target createRecordTarget(final TargetCollection<Target> targets, final SimpleInterval where) { final Target target = targets.target(where); if (target == null) { return null; } else if (target.getInterval().equals(where)) { return new Target(target.getName(), target.getInterval()); } else { throw formatException(String.format("mismatching yet overlapping intervals in the input (%s) and the target collection (%s)", where, targets.location(target))); } }
Source:
<code>protected void addStoragePoolToDb() { <START> final StoragePool storagePool = getStoragePool(); <END> storagePool.setId(Guid.newGuid()); storagePool.setStatus(StoragePoolStatus.Uninitialized); Guid requestedMacPoolId = storagePool.getMacPoolId(); Guid macPoolIdToUse = requestedMacPoolId == null ? getMacPoolDao().getDefaultPool().getId() : requestedMacPoolId; storagePool.setMacPoolId(macPoolIdToUse); getStoragePoolDAO().save(storagePool); }</code><technical_language>need extract variable</technical_language>

Target:
protected void addStoragePoolToDb() { getStoragePool().setId(Guid.newGuid()); getStoragePool().setStatus(StoragePoolStatus.Uninitialized); Guid requestedMacPoolId = getStoragePool().getMacPoolId(); Guid macPoolIdToUse = requestedMacPoolId == null ? getMacPoolDao().getDefaultPool().getId() : requestedMacPoolId; getStoragePool().setMacPoolId(macPoolIdToUse); getStoragePoolDAO().save(getStoragePool()); }
Source:
<code>public void init(final ServletConfig config) throws ServletException { this.application = SERVICE_PROVIDER.getInstance(AzkabanWebServer.class); if (this.application == null) { throw new IllegalStateException( "No batch application is defined in the servlet context!"); } final Props props = this.application.getServerProps(); this.name = props.getString("azkaban.name", ""); this.label = props.getString("azkaban.label", ""); this.color = props.getString("azkaban.color", "#FF0000"); <START> this.passwordPlaceholder = props.getString("azkaban.password.placeholder", "password"); <END> if (this.application instanceof AzkabanWebServer) { final AzkabanWebServer server = (AzkabanWebServer) this.application; this.viewerPlugins = PluginRegistry.getRegistry().getViewerPlugins(); this.triggerPlugins = new ArrayList<>(server.getTriggerPlugins().values()); } }</code><technical_language>string "Password" capital letter "P"</technical_language>

Target:
public void init(final ServletConfig config) throws ServletException { this.application = SERVICE_PROVIDER.getInstance(AzkabanWebServer.class); if (this.application == null) { throw new IllegalStateException( "No batch application is defined in the servlet context!"); } final Props props = this.application.getServerProps(); this.name = props.getString("azkaban.name", ""); this.label = props.getString("azkaban.label", ""); this.color = props.getString("azkaban.color", "#FF0000"); this.passwordPlaceholder = props.getString("azkaban.password.placeholder", "Password"); if (this.application instanceof AzkabanWebServer) { final AzkabanWebServer server = (AzkabanWebServer) this.application; this.viewerPlugins = PluginRegistry.getRegistry().getViewerPlugins(); this.triggerPlugins = new ArrayList<>(server.getTriggerPlugins().values()); } }
Source:
<code>protected ActionResult execute() throws EntityDoesNotExistException { String key = getRequestParamValue(Const.ParamsNames.REGKEY); Assumption.assertNotNull(key); String institute = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_INSTITUTION); String instituteParam =""; if(institute !=null && !institute.trim().isEmpty()){ instituteParam = institute; } new GateKeeper().verifyLoggedInUserPrivileges(); try { <START> logic.joinCourseForInstructor(key, account.googleId, instituteParam); <END> } catch (JoinCourseException | InvalidParametersException e) { setStatusForException(e, e.getMessage()); log.info(e.getMessage()); } final String joinedCourseMsg = "Action Instructor Joins Course" + "<br/>Google ID: " + account.googleId + "<br/>Key : " + StringHelper.decrypt(key); if(statusToAdmin != null) { statusToAdmin += "<br/><br/>" + joinedCourseMsg; } else { statusToAdmin = joinedCourseMsg; } RedirectResult response = createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); InstructorAttributes instructor = logic.getInstructorForRegistrationKey(key); if(instructor != null) { response.addResponseParam(Const.ParamsNames.CHECK_PERSISTENCE_COURSE, instructor.courseId); } return response; }</code><technical_language>is OK call methods here. implementation of methods unified in AccountsLogic class</technical_language>

Target:
protected ActionResult execute() throws EntityDoesNotExistException { String key = getRequestParamValue(Const.ParamsNames.REGKEY); Assumption.assertNotNull(key); String institute = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_INSTITUTION); new GateKeeper().verifyLoggedInUserPrivileges(); try { if (institute != null) { logic.joinCourseForInstructor(key, account.googleId, institute); } else { logic.joinCourseForInstructor(key, account.googleId); } } catch (JoinCourseException | InvalidParametersException e) { setStatusForException(e, e.getMessage()); log.info(e.getMessage()); } final String joinedCourseMsg = "Action Instructor Joins Course" + "<br/>Google ID: " + account.googleId + "<br/>Key : " + StringHelper.decrypt(key); if(statusToAdmin != null) { statusToAdmin += "<br/><br/>" + joinedCourseMsg; } else { statusToAdmin = joinedCourseMsg; } RedirectResult response = createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); InstructorAttributes instructor = logic.getInstructorForRegistrationKey(key); if(instructor != null) { response.addResponseParam(Const.ParamsNames.CHECK_PERSISTENCE_COURSE, instructor.courseId); } return response; }
Source:
<code>public Serializable copy(Node source, Serializable parentId, String name, Consumer<Serializable> afterRecordCopy) { Serializable id = source.getId(); SimpleFragment hierFragment = source.getHierFragment(); Serializable oldParentId = hierFragment.get(Model.HIER_PARENT_KEY); if (oldParentId != null && !oldParentId.equals(parentId)) { checkNotUnder(parentId, id, "copy"); } checkFreeName(parentId, name, complexProp(hierFragment)); Long pos = getNextPos(parentId, false); boolean excludeSpecialChildren = true; CopyResult copyResult = mapper.copy(new IdWithTypes(source), parentId, name, null, excludeSpecialChildren); Serializable newId = copyResult.copyId; SimpleFragment copy = getHier(newId, false); markInvalidated(copyResult.invalidations); List<RowId> rowIds = new ArrayList<>(); for (Serializable proxyId : copyResult.proxyIds) { rowIds.add(new RowId(Model.PROXY_TABLE_NAME, proxyId)); } List<Fragment> fragments = getMulti(rowIds, true); for (Fragment fragment : fragments) { seriesProxies.recordExisting((SimpleFragment) fragment, true); targetProxies.recordExisting((SimpleFragment) fragment, true); } if (source.isVersion()) { copy.put(Model.MAIN_IS_VERSION_KEY, null); } copy.put(Model.HIER_CHILD_POS_KEY, pos); for (Serializable recordId : copyResult.recordIds) { if (afterRecordCopy != null) { afterRecordCopy.accept(recordId); } <START> } <END> return newId; }</code><technical_language>replaced by: if (afterRecordCopy != null) { for (Serializable recordId : copyResult.recordIds) { afterRecordCopy.accept(recordId); } }</technical_language>

Target:
public Serializable copy(Node source, Serializable parentId, String name, Consumer<Serializable> afterRecordCopy) { Serializable id = source.getId(); SimpleFragment hierFragment = source.getHierFragment(); Serializable oldParentId = hierFragment.get(Model.HIER_PARENT_KEY); if (oldParentId != null && !oldParentId.equals(parentId)) { checkNotUnder(parentId, id, "copy"); } checkFreeName(parentId, name, complexProp(hierFragment)); Long pos = getNextPos(parentId, false); boolean excludeSpecialChildren = true; CopyResult copyResult = mapper.copy(new IdWithTypes(source), parentId, name, null, excludeSpecialChildren); Serializable newId = copyResult.copyId; SimpleFragment copy = getHier(newId, false); markInvalidated(copyResult.invalidations); List<RowId> rowIds = new ArrayList<>(); for (Serializable proxyId : copyResult.proxyIds) { rowIds.add(new RowId(Model.PROXY_TABLE_NAME, proxyId)); } List<Fragment> fragments = getMulti(rowIds, true); for (Fragment fragment : fragments) { seriesProxies.recordExisting((SimpleFragment) fragment, true); targetProxies.recordExisting((SimpleFragment) fragment, true); } if (source.isVersion()) { copy.put(Model.MAIN_IS_VERSION_KEY, null); } copy.put(Model.HIER_CHILD_POS_KEY, pos); if (afterRecordCopy != null) { for (Serializable recordId : copyResult.recordIds) { afterRecordCopy.accept(recordId); } } return newId; }
Source:
<code>public Subscription build() { final Subscription subscription = new Subscription(); subscription.setId(id); subscription.setCreatedAt(createdAt); <START> subscription.setUpdatedAt(createdAt); <END> subscription.setOwningApplication(owningApplication); subscription.setEventTypes(eventTypes); subscription.setConsumerGroup(consumerGroup); subscription.setReadFrom(startFrom); subscription.setInitialCursors(initialCursors); return subscription; }</code><technical_language>well. introduces some hidden trick bring problems in future</technical_language>

Target:
public Subscription build() { final Subscription subscription = new Subscription(); subscription.setId(id); subscription.setCreatedAt(createdAt); subscription.setOwningApplication(owningApplication); subscription.setEventTypes(eventTypes); subscription.setConsumerGroup(consumerGroup); subscription.setReadFrom(startFrom); subscription.setInitialCursors(initialCursors); return subscription; }
Source:
<code>public static Arguments buildArgs() { return new Arguments() .withArgument( new OptionalNamedArg( ARG_MEMORY, "8g", OsBeanUtil.getTotalPhysicalMemory() + "", "Recommend memory settings with respect to the given amount of memory, " + "instead of the total memory of the system running the command." ) ) .withArgument( new OptionalBooleanArg( ARG_PRINT_CONF, false, "Print what an updated neo4j.conf file would look like to standard out. Does not change " + "existing settings unless --overwrite is specified." ) ) .withArgument( new OptionalBooleanArg( ARG_UPDATE_CONF, false, "Update the neo4j.conf file, or the given --conf-file, in-place by adding the recommended " + "memory settings, unless they are already specified. " + "Specify --overwrite to also update existing settings." ) ) .withArgument( new OptionalBooleanArg( ARG_OVERWRITE, false, "Causes --print-conf and --update-conf to overwrite existing settings, if set." ) ) <START> .withArgument( new OptionalNamedArg( ARG_CONF_FILE, "conf" + File.separator + "neo4j.conf", "", <END> "An alternative path to the configuration file, for use with --print-conf and --update-conf. " + "If left unspecified, the default neo4j.conf file location will be used." ) ); }</code><technical_language>This default path is incorrect for tarball. I easier for if a default value</technical_language>

Target:
public static Arguments buildArgs() { String memory = bytesToString( OsBeanUtil.getTotalPhysicalMemory() ); return new Arguments() .withArgument( new OptionalNamedArg( ARG_MEMORY, memory, memory, "Recommend memory settings with respect to the given amount of memory, " + "instead of the total memory of the system running the command." ) ); }
Source:
<code><START> public static final boolean isEmptyTrimmed(String input) <END> { return input == null || input.trim().equals(""); }</code><technical_language>Lets remove final for</technical_language>

Target:
public static boolean isEmptyTrimmed(String input) { return input == null || input.trim().equals(""); }
Source:
<code>public void undo(CommandContext context) { <START> context.getAdminManager().invokeActionRequiringRestart(new ActionRequiringRestart() { <END> @Override public boolean execute() { return assignHostsToDefault(context); } }); }</code><technical_language>do a fun lambda</technical_language>

Target:
public void undo(CommandContext context) { context.getAdminManager().invokeActionRequiringRestart(() -> assignHostsToDefault(context)); }
Source:
<code>public Method getOnPongMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); if (methods == null) { return null; } <START> for (Method method : methods) { <END> if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(PongMessage.class)) { return method; } } } return null; }</code><technical_language>Consider Java 8 streams</technical_language>

Target:
public Optional<Method> getOnPongMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); Method returnMethod = null; for (Method method : methods) { if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(PongMessage.class)) { returnMethod = method; } } } return Optional.ofNullable(returnMethod); }
Source:
<code>protected static CacheException handleMissingSuccessfulResponse(Map<Address, Response> responses) { if (responses.values().stream().anyMatch(UnsureResponse.class::isInstance)) { return OutdatedTopologyException.getCachedInstance(); } else { return AllOwnersLostException.INSTANCE; <START> } <END> }</code><technical_language>throw AllOwnersLostException if responses target nodes missing. If owner threw internal exception, wrap exception return caller. add a getCachedInstance() method match OutdatedTopologyException. Thinking more this, is a point in a separate AllOwnersLostException. PartitionHandlingInterceptor do partition check for OutdatedTopologyExceptions, I performance impact minimal</technical_language>

Target:
protected static CacheException handleMissingSuccessfulResponse(Map<Address, Response> responses) { if (responses.values().stream().anyMatch(UnsureResponse.class::isInstance)) { return OutdatedTopologyException.INSTANCE; } else { return AllOwnersLostException.INSTANCE; } }
Source:
<code><START> public void testTokenInvalidException() throws DotSecurityException, NoSuchUserException, DotInvalidTokenException, DotDataException { <END> UserManager userManager = getUserManagerThrowingException( new DotInvalidTokenException("") ); final User user = APILocator.getUserAPI().loadUserById("dotcms.org.1"); final JsonWebTokenService jsonWebTokenService = mock(JsonWebTokenService.class); final UserToken jwtBean = new UserToken(UUID.randomUUID().toString(), "dotcms.org.1", new Date(), 100000, user.getRememberMeToken()); when(jsonWebTokenService.parseToken(eq("token1"))).thenReturn(jwtBean); ResetPasswordResource resetPasswordResource = new ResetPasswordResource(userManager, responseUtil, jsonWebTokenService); Response response = resetPasswordResource.resetPassword(request, resetPasswordForm); RestUtilTest.verifyErrorResponse(response, Response.Status.BAD_REQUEST.getStatusCode(), "reset-password-token-invalid"); }</code><technical_language>![Codacy](<LINK_0> Issue found: [JUnit tests include assert() fail()](<LINK_1></technical_language>

Target:
public void testTokenInvalidException() throws DotSecurityException, NoSuchUserException, DotInvalidTokenException, DotDataException { UserManager userManager = getUserManagerThrowingException( new DotInvalidTokenException("") ); final User user = APILocator.getUserAPI().loadUserById(DOTCMS_ORG_1); final JsonWebTokenService jsonWebTokenService = mock(JsonWebTokenService.class); final UserToken jwtBean = new UserToken.Builder().id(user.getRememberMeToken()) .subject(DOTCMS_ORG_1) .modificationDate(new Date()) .expiresDate(100000).build(); when(jsonWebTokenService.parseToken(eq("token1"))).thenReturn(jwtBean); ResetPasswordResource resetPasswordResource = new ResetPasswordResource(userManager, responseUtil, jsonWebTokenService); Response response = resetPasswordResource.resetPassword(request, resetPasswordForm); RestUtilTest.verifyErrorResponse(response, Response.Status.BAD_REQUEST.getStatusCode(), "reset-password-token-invalid"); }
Source:
<code>public String toString() { <START> return "HealthPolicyConfigReader{" <END> + "configFilename='" + configFilename + '\'' + '}'; }</code><technical_language>consolidate unnecessary string concatenation pls. of this fit line</technical_language>

Target:
public String toString() { return "HealthPolicyConfigReader {configFilename=" + configFilename + "}"; }
Source:
<code>protected Set<ConstraintCheckError> doCheck(Element element, AnnotationMirror annotation) { Integer min = annotationApiHelper.getAnnotationValue( annotation, "min" ) != null ? (Integer) annotationApiHelper.getAnnotationValue( annotation, "min" ).getValue() : 0; Integer max = annotationApiHelper.getAnnotationValue( annotation, "max" ) != null ? (Integer) annotationApiHelper.getAnnotationValue( annotation, "max" ).getValue() : Integer.MAX_VALUE; <START> if ( ( min != null && min < 0 ) || ( max != null && max < 0 ) || ( max != null && min != null && min > max ) ) { <END> return CollectionHelper.asSet( new ConstraintCheckError( element, annotation, "INVALID_SIZE_LENGTH_ANNOTATION_PARAMETERS" ) ); } return Collections.emptySet(); }</code><technical_language>min/max null this point</technical_language>

Target:
protected Set<ConstraintCheckError> doCheck(Element element, AnnotationMirror annotation) { Integer min = annotationApiHelper.getAnnotationValue( annotation, "min" ) != null ? (Integer) annotationApiHelper.getAnnotationValue( annotation, "min" ).getValue() : 0; Integer max = annotationApiHelper.getAnnotationValue( annotation, "max" ) != null ? (Integer) annotationApiHelper.getAnnotationValue( annotation, "max" ).getValue() : Integer.MAX_VALUE; if ( ( min < 0 ) || ( max < 0 ) || ( min > max ) ) { return CollectionHelper.asSet( new ConstraintCheckError( element, annotation, "INVALID_SIZE_LENGTH_ANNOTATION_PARAMETERS" ) ); } return Collections.emptySet(); }
Source:
<code>public void testBlockSettingHaOnHostedEngine() { prepareVmToPassCanDoAction(); <START> group.setCompatibilityVersion(Version.v3_3); <END> vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); vmStatic.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); command.getParameters().getVm().setAutoStartup(true); Map<Integer, Map<Version, List<Pair<GraphicsType, DisplayType>>>> displayTypeMap = new HashMap<>(); displayTypeMap.put(0, new HashMap<Version, List<Pair<GraphicsType, DisplayType>>>()); displayTypeMap.get(0).put(Version.v3_3, Arrays.asList(new Pair<>(GraphicsType.SPICE, DisplayType.qxl))); when(osRepository.getGraphicsAndDisplays()).thenReturn(displayTypeMap); boolean validInput = command.canDoAction(); assertFalse(validInput); assertTrue(command.getReturnValue().getCanDoActionMessages().contains(ACTION_TYPE_FAILED_VM_CANNOT_BE_HIGHLY_AVAILABLE_AND_HOSTED_ENGINE.name())); }</code><technical_language>If version is set v3_3 remove that</technical_language>

Target:
public void testBlockSettingHaOnHostedEngine() { prepareVmToPassCanDoAction(); vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); vmStatic.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); command.getParameters().getVm().setAutoStartup(true); boolean validInput = command.canDoAction(); assertFalse(validInput); assertTrue(command.getReturnValue().getCanDoActionMessages().contains(ACTION_TYPE_FAILED_VM_CANNOT_BE_HIGHLY_AVAILABLE_AND_HOSTED_ENGINE.name())); }
Source:
<code>public void save(GlowElderGuardian entity, CompoundTag compound) { super.save(entity, compound); <START> compound.putBool("Elder", true); <END> }</code><technical_language>Elder tag removed guardian elder_guardian stores, is longer necessary save it</technical_language>

Target:
public void save(GlowElderGuardian entity, CompoundTag compound) { super.save(entity, compound); }
Source:
<code>protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_indoor_3d_map); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { map = mapboxMap; mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { GeoJsonSource roomDataSource = new GeoJsonSource("room-data", loadJsonFromAsset("indoor-3d-map.geojson")); <START> map.getStyle().addSource(roomDataSource); <END> FillExtrusionLayer roomExtrusionLayer = new FillExtrusionLayer("room-extrusion", "room-data"); roomExtrusionLayer.setProperties( fillExtrusionColor(get("color")), fillExtrusionHeight(get("height")), fillExtrusionBase(get("base_height")), fillExtrusionOpacity(0.5f) ); map.getStyle().addLayer(roomExtrusionLayer); } }); } }); }</code><technical_language>style provided callback instead</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_indoor_3d_map); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { style.addSource( new GeoJsonSource("room-data", loadJsonFromAsset("indoor-3d-map.geojson"))); style.addLayer(new FillExtrusionLayer( "room-extrusion", "room-data").withProperties( fillExtrusionColor(get("color")), fillExtrusionHeight(get("height")), fillExtrusionBase(get("base_height")), fillExtrusionOpacity(0.5f) )); } }); } }); }
Source:
<code>public synchronized void close(SocketChannel socketChannel) { if (closed) { return; } try { if (!engine.isOutboundDone()) { ByteBuffer empty = ByteBuffer.wrap(new byte[0]); engine.closeOutbound(); myNetData.clear(); SSLEngineResult result = engine.wrap(empty, myNetData); if (result.getStatus() != SSLEngineResult.Status.CLOSED) { throw new SSLHandshakeException( "Error closing SSL session. Status=" + result.getStatus()); } myNetData.flip(); while (myNetData.hasRemaining()) { socketChannel.write(myNetData); } } } catch (ClosedChannelException e) { } catch (IOException e) { throw new GemFireIOException("exception closing SSL session", e); } finally { <START> logger.info("NioSSLEngine releasing two buffers myNetData={}({}), peerAppData={}({})", <END> Integer.toHexString(System.identityHashCode(myNetData)), (myNetData.isDirect()? "direct":"heap"), Integer.toHexString(System.identityHashCode(peerAppData)), (myNetData.isDirect()? "direct":"heap")); ByteBuffer netData = myNetData; ByteBuffer appData = peerAppData; myNetData = null; peerAppData = EMPTY_BUFFER; bufferPool.releaseBuffer(TRACKED_SENDER, netData); bufferPool.releaseBuffer(TRACKED_RECEIVER, appData); this.closed = true; } }</code><technical_language>This info debug level log? checking..</technical_language>

Target:
public synchronized void close(SocketChannel socketChannel) { if (closed) { return; } try { if (!engine.isOutboundDone()) { ByteBuffer empty = ByteBuffer.wrap(new byte[0]); engine.closeOutbound(); myNetData.clear(); SSLEngineResult result = engine.wrap(empty, myNetData); if (result.getStatus() != SSLEngineResult.Status.CLOSED) { throw new SSLHandshakeException( "Error closing SSL session. Status=" + result.getStatus()); } myNetData.flip(); while (myNetData.hasRemaining()) { socketChannel.write(myNetData); } } } catch (ClosedChannelException e) { } catch (IOException e) { throw new GemFireIOException("exception closing SSL session", e); } finally { ByteBuffer netData = myNetData; ByteBuffer appData = peerAppData; myNetData = null; peerAppData = EMPTY_BUFFER; bufferPool.releaseBuffer(TRACKED_SENDER, netData); bufferPool.releaseBuffer(TRACKED_RECEIVER, appData); this.closed = true; } }
Source:
<code>private Collection<ErlangCallbackFunction> calcOptionalCallbacks() { ErlangFileStub stub = getStub(); if (stub != null) { return getChildrenByType(stub, ErlangTypes.ERL_CALLBACK_FUNCTION, new ArrayFactory<ErlangCallbackFunction>() { @NotNull @Override public ErlangCallbackFunction[] create(int count) { return new ErlangCallbackFunction[count]; } <START> }); <END> } return PsiTreeUtil.findChildrenOfType(this, ErlangCallbackFunction.class); }</code><technical_language>Please, preserve code style. other calc*** methods reference stub type's ARRAY_FACTORY field. in org.intellij.erlang.stubs.types.ErlangCallbackStubElementType. reuse existing object, improve code readability</technical_language>

Target:
private Collection<ErlangCallbackFunction> calcOptionalCallbacks() { ErlangFileStub stub = getStub(); if (stub != null) { return getChildrenByType(stub, ErlangTypes.ERL_CALLBACK_FUNCTION, ErlangCallbackFunctionStubElementType.ARRAY_FACTORY); } return PsiTreeUtil.findChildrenOfType(this, ErlangCallbackFunction.class); }
Source:
<code>private void showNearbyPages(NearbyResult result) { getActivity().invalidateOptionsMenu(); mMarkerList.clear(); mapView.removeAllAnnotations(); <START> List<MarkerOptions> optionsList = new ArrayList<>(); <END> for (NearbyPage item : result.getList()) { Location location = item.getLocation(); if (location != null) { MarkerOptions options = new MarkerOptions() .position(new LatLng(location.getLatitude(), location.getLongitude())) .title(item.getTitle()) .icon(markerIconPassive); optionsList.add(options); } } mMarkerList.addAll(mapView.addMarkers(optionsList)); }</code><technical_language>This converts NearbyPages MarkerOptions. Consider extracting a method methods small point</technical_language>

Target:
private void showNearbyPages(NearbyResult result) { getActivity().invalidateOptionsMenu(); mMarkerList.clear(); mapView.removeAllAnnotations(); List<MarkerOptions> optionsList = new ArrayList<>(); for (NearbyPage item : result.getList()) { if (item.getLocation() != null) { optionsList.add(createMarkerOptions(item)); } } mMarkerList.addAll(mapView.addMarkers(optionsList)); }
Source:
<code>public DSpaceCSV exportMetadata(Context context, Map objectModel, String query, String scopeString, String filters) throws IOException, UIException, SearchServiceException, SQLException { DiscoverResult qResults = new DiscoverResult(); DiscoverQuery qArgs = new DiscoverQuery(); try { scopeString = scopeString.replace("~", "/"); } <START> catch(NullPointerException e) { } <END> DSpaceObject scope; if (scopeString == null || "".equals(scopeString)) { scope = HandleUtil.obtainHandle(objectModel); } else { scope = handleService.resolveToObject(context, scopeString); } simpleSearch.objectModel = objectModel; qArgs = simpleSearch.prepareQuery(scope); qArgs.setStart(0); qArgs.setMaxResults(10); qResults = SearchUtils.getSearchService().search(context, scope, qArgs); qArgs.setMaxResults(safeLongToInt(qResults.getTotalSearchResults())); qResults = SearchUtils.getSearchService().search(context, scope, qArgs); ArrayList<Item> items = new ArrayList<Item>(); for (DSpaceObject resultDSO : qResults.getDspaceObjects()) { if (resultDSO instanceof Item) { items.add((Item) resultDSO); } } log.info(LogManager.getHeader(context, "metadataexport", "exporting_search")); MetadataExport exporter = new MetadataExport(context, items.iterator(), false); DSpaceCSV csv = exporter.export(); log.info(LogManager.getHeader(context, "metadataexport", "exported_file:search-results.csv")); return csv; }</code><technical_language>Check if scopeString Null opposed catching exception</technical_language>

Target:
public DSpaceCSV exportMetadata(Context context, Map objectModel, String query, String scopeString, String filters) throws IOException, UIException, SearchServiceException, SQLException { DiscoverResult qResults = new DiscoverResult(); DiscoverQuery qArgs = new DiscoverQuery(); DSpaceObject scope; if(scopeString != null && scopeString.length() > 0) { scopeString = scopeString.replace("~", "/"); scope = handleService.resolveToObject(context, scopeString); } else { scope = HandleUtil.obtainHandle(objectModel); } simpleSearch.objectModel = objectModel; String[] fqs = filters != null ? filters.split(",") : new String[0]; qArgs = simpleSearch.prepareQuery(scope, query, fqs); qArgs.setStart(0); qArgs.setMaxResults(10); qResults = SearchUtils.getSearchService().search(context, scope, qArgs); qArgs.setMaxResults(safeLongToInt(qResults.getTotalSearchResults())); qResults = SearchUtils.getSearchService().search(context, scope, qArgs); ArrayList<Item> items = new ArrayList<Item>(); for (DSpaceObject resultDSO : qResults.getDspaceObjects()) { if (resultDSO instanceof Item) { items.add((Item) resultDSO); } } log.info(LogManager.getHeader(context, "metadataexport", "exporting_search")); MetadataExport exporter = new MetadataExport(context, items.iterator(), false); DSpaceCSV csv = exporter.export(); log.info(LogManager.getHeader(context, "metadataexport", "exported_file:search-results.csv")); return csv; }
Source:
<code>public void createControl(Composite parent) { this.info = ((ExtractConstantRefactoring) getRefactoring()).getRefactoringInfo(); this.showVisibilityPane = info.getMethodContext().getType() == ContextType.METHOD; control = new NameAndVisibilityComposite(parent, Messages.InputPage_ConstName, info.getName()); setTitle(getName()); setPageComplete(false); control.getConstantNameText().addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { info.setName(control.getConstantNameText().getText()); checkName(); } }); for (Control buttons : control.getVisibiltyGroup().getChildren()) { buttons.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { String text = ((Button)e.getSource()).getText(); visibilityChange(text); } }); } Button replaceAllOccurencesButton = new Button(control, SWT.CHECK); replaceAllOccurencesButton.setSelection(info.isReplaceAllOccurences()); replaceAllOccurencesButton.setText(Messages.InputPage_ReplaceAllOccurrences); replaceAllOccurencesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { info.setReplaceAllLiterals(replaceAllOccurencesButton.getSelection()); <START> super.widgetSelected(e); <END> } }); checkName(); control.getVisibiltyGroup().setVisible(showVisibilityPane); setControl(control); }</code><technical_language>necessary call super subclassing SelectionAdapter</technical_language>

Target:
public void createControl(Composite parent) { this.info = ((ExtractConstantRefactoring) getRefactoring()).getRefactoringInfo(); this.showVisibilityPane = info.getMethodContext().getType() == ContextType.METHOD; control = new NameAndVisibilityComposite(parent, Messages.InputPage_ConstName, info.getName()); setTitle(getName()); setPageComplete(false); control.getConstantNameText().addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { info.setName(control.getConstantNameText().getText()); checkName(); } }); for (Control buttons : control.getVisibiltyGroup().getChildren()) { buttons.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { String text = ((Button)e.getSource()).getText(); visibilityChange(text); } }); } Button replaceAllOccurencesButton = new Button(control, SWT.CHECK); replaceAllOccurencesButton.setSelection(info.isReplaceAllOccurences()); replaceAllOccurencesButton.setText(Messages.InputPage_ReplaceAllOccurrences); replaceAllOccurencesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { info.setReplaceAllLiterals(replaceAllOccurencesButton.getSelection()); } }); checkName(); control.getVisibiltyGroup().setVisible(showVisibilityPane); setControl(control); }
Source:
<code>public void testForEachWithIndex() { IndexedRingBuffer<String> buffer = IndexedRingBuffer.getInstance(); buffer.add("zero"); buffer.add("one"); buffer.add("two"); buffer.add("three"); final ArrayList<String> list = new ArrayList<String>(); int nextIndex = buffer.forEach(accumulate(list)); assertEquals(4, list.size()); assertEquals(list, Arrays.asList("zero", "one", "two", "three")); assertEquals(0, nextIndex); list.clear(); nextIndex = buffer.forEach(accumulate(list), 0); assertEquals(4, list.size()); assertEquals(list, Arrays.asList("zero", "one", "two", "three")); assertEquals(0, nextIndex); list.clear(); nextIndex = buffer.forEach(accumulate(list), 2); assertEquals(4, list.size()); assertEquals(list, Arrays.asList("two", "three", "zero", "one")); assertEquals(2, nextIndex); list.clear(); nextIndex = buffer.forEach(accumulate(list), 3); assertEquals(4, list.size()); assertEquals(list, Arrays.asList("three", "zero", "one", "two")); assertEquals(3, nextIndex); list.clear(); nextIndex = buffer.forEach(new Func1<String, Boolean>() { @Override public Boolean call(String t1) { list.add(t1); return false; } }, 3); assertEquals(1, list.size()); assertEquals(list, Arrays.asList("three")); assertEquals(3, nextIndex); list.clear(); nextIndex = buffer.forEach(new Func1<String, Boolean>() { int i = 0; @Override public Boolean call(String t1) { list.add(t1); <START> return i++ != 2; <END> } }, 0); assertEquals(3, list.size()); assertEquals(list, Arrays.asList("zero", "one", "two")); assertEquals(2, nextIndex); }</code><technical_language>Programming side effects :crying_cat_face:</technical_language>

Target:
public void testForEachWithIndex() { IndexedRingBuffer<String> buffer = IndexedRingBuffer.getInstance(); buffer.add("zero"); buffer.add("one"); buffer.add("two"); buffer.add("three"); final ArrayList<String> list = new ArrayList<String>(); int nextIndex = buffer.forEach(accumulate(list)); assertEquals(4, list.size()); assertEquals(list, Arrays.asList("zero", "one", "two", "three")); assertEquals(0, nextIndex); list.clear(); nextIndex = buffer.forEach(accumulate(list), 0); assertEquals(4, list.size()); assertEquals(list, Arrays.asList("zero", "one", "two", "three")); assertEquals(0, nextIndex); list.clear(); nextIndex = buffer.forEach(accumulate(list), 2); assertEquals(4, list.size()); assertEquals(list, Arrays.asList("two", "three", "zero", "one")); assertEquals(2, nextIndex); list.clear(); nextIndex = buffer.forEach(accumulate(list), 3); assertEquals(4, list.size()); assertEquals(list, Arrays.asList("three", "zero", "one", "two")); assertEquals(3, nextIndex); list.clear(); nextIndex = buffer.forEach(new Func1<String, Boolean>() { @Override public Boolean call(String t1) { list.add(t1); return false; } }, 3); assertEquals(1, list.size()); assertEquals(list, Arrays.asList("three")); assertEquals(3, nextIndex); list.clear(); nextIndex = buffer.forEach(new Func1<String, Boolean>() { int i = 0; @Override public Boolean call(String t1) { list.add(t1); i++; return i != 3; } }, 0); assertEquals(3, list.size()); assertEquals(list, Arrays.asList("zero", "one", "two")); assertEquals(2, nextIndex); }
Source:
<code>public static RebalanceAlgorithm getInstance( Map<ClusterConfig.GlobalRebalancePreferenceKey, Integer> preferences) { List<HardConstraint> hardConstraints = ImmutableList.of(new FaultZoneAwareConstraint(), new NodeCapacityConstraint(), new ReplicaActivateConstraint(), new NodeMaxPartitionLimitConstraint(), new ValidGroupTagConstraint(), new SamePartitionOnInstanceConstraint()); int evennessPreference = preferences.getOrDefault(ClusterConfig.GlobalRebalancePreferenceKey.EVENNESS, 1); int movementPreference = preferences.getOrDefault(ClusterConfig.GlobalRebalancePreferenceKey.LESS_MOVEMENT, 1); float evennessRatio = (float) evennessPreference / (evennessPreference + movementPreference); float movementRatio = (float) movementPreference / (evennessPreference + movementPreference); List<SoftConstraint> l = ImmutableList.of(new PartitionMovementConstraint(), new InstancePartitionsCountConstraint(), new ResourcePartitionAntiAffinityConstraint(), new ResourceTopStateAntiAffinityConstraint(), new MaxCapacityUsageInstanceConstraint()); Map<SoftConstraint, Float> softConstraints = Maps.toMap(l, key -> { String name = key.getClass().getSimpleName(); float weight = MODEL.get(name); return name.equals(PARTITION_MOVEMENT_CONSTRAINT) ? movementRatio * weight : evennessRatio * weight; }); <START> System.out.println(softConstraints); <END> return new ConstraintBasedAlgorithm(hardConstraints, softConstraints); }</code><technical_language>System.out??</technical_language>

Target:
public static RebalanceAlgorithm getInstance( Map<ClusterConfig.GlobalRebalancePreferenceKey, Integer> preferences) { List<HardConstraint> hardConstraints = ImmutableList.of(new FaultZoneAwareConstraint(), new NodeCapacityConstraint(), new ReplicaActivateConstraint(), new NodeMaxPartitionLimitConstraint(), new ValidGroupTagConstraint(), new SamePartitionOnInstanceConstraint()); int evennessPreference = preferences.getOrDefault(ClusterConfig.GlobalRebalancePreferenceKey.EVENNESS, 1) * EVENNESS_PREFERENCE_NORMALIZE_FACTOR; int movementPreference = preferences.getOrDefault(ClusterConfig.GlobalRebalancePreferenceKey.LESS_MOVEMENT, 1); float evennessRatio = (float) evennessPreference / (evennessPreference + movementPreference); float movementRatio = (float) movementPreference / (evennessPreference + movementPreference); List<SoftConstraint> softConstraints = ImmutableList.of(new PartitionMovementConstraint(), new InstancePartitionsCountConstraint(), new ResourcePartitionAntiAffinityConstraint(), new ResourceTopStateAntiAffinityConstraint(), new MaxCapacityUsageInstanceConstraint()); Map<SoftConstraint, Float> softConstraintsWithWeight = Maps.toMap(softConstraints, key -> { String name = key.getClass().getSimpleName(); float weight = MODEL.get(name); return name.equals(PartitionMovementConstraint.class.getSimpleName()) ? movementRatio * weight : evennessRatio * weight; }); return new ConstraintBasedAlgorithm(hardConstraints, softConstraintsWithWeight); }
Source:
<code><START> public void subscribe() { <END> eventService.subscribe(workspaceEventsSubscriber); }</code><technical_language>I package private scope is enough for tests</technical_language>

Target:
void subscribe() { eventService.subscribe(workspaceEventsSubscriber); }
Source:
<code>public static String textToRLiteral(String value) { <START> String escaped = value.replaceAll("([\"\\\n\\r\\t\\b\\f\\\\])", "\\\\$1"); <END> return '"' + escaped + '"'; }</code><technical_language>newline backslashes in front of it, other control characters two</technical_language>

Target:
public static String textToRLiteral(String value) { String escaped = value.replaceAll("([\"\\n\\r\\t\\b\\f\\\\])", "\\\\$1"); return '"' + escaped + '"'; }
Source:
<code>public String getCurrentUser() { if (isBrokerAccountServiceSupported()) { verifyNotOnMainThread(); final UserInfo[] users; try { users = BrokerAccountServiceHandler.getInstance().getBrokerUsers(mContext); } catch (final IOException e) { <START> return null; <END> } return users.length == 0 ? null : users[0].getDisplayableId(); } else { Account[] accountList = mAcctManager.getAccountsByType(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE); if (accountList.length > 0) { return accountList[0].name; } } return null; }</code><technical_language>null [](start = 23, length = 4) Log? #Resolved</technical_language>

Target:
public String getCurrentUser() { if (isBrokerAccountServiceSupported()) { verifyNotOnMainThread(); final UserInfo[] users; try { users = BrokerAccountServiceHandler.getInstance().getBrokerUsers(mContext); } catch (final IOException e) { Logger.e(TAG, "No current user could be retrieved.", "", null, e); return null; } return users.length == 0 ? null : users[0].getDisplayableId(); } else { Account[] accountList = mAcctManager.getAccountsByType(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE); if (accountList.length > 0) { return accountList[0].name; } } return null; }
Source:
<code>public void log(Enumeration.Value level, Function0<String> message) { String s = message.apply(); String prefix = "[" + level.toString().toLowerCase() + "] "; <START> if (s.substring(0, prefix.length()).toLowerCase().equals(prefix)) { <END> s = s.substring(prefix.length()); } if (level.equals(Level.Error())) { log.error(s); } else if (level.equals(Level.Warn())) { log.warn(s); } else if (level.equals(Level.Info())) { log.info(s); } else if (level.equals(Level.Debug())) { log.debug(s); } }</code><technical_language>Please remove toLowerCase [String#regionMatches](<LINK_0>,%20int,%20java.lang.String,%20int,%20int))</technical_language>

Target:
public void log(Enumeration.Value level, Function0<String> message) { String s = message.apply(); String prefix = "[" + level.toString() + "] "; if (s.regionMatches(true, 0, prefix, 0, prefix.length())) { s = s.substring(prefix.length()); } if (level.equals(Level.Error())) { log.error(s); } else if (level.equals(Level.Warn())) { log.warn(s); } else if (level.equals(Level.Info())) { log.info(s); } else if (level.equals(Level.Debug())) { log.debug(s); } }