auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected static int[] toIntPortArray(Object v) { Collection<String> inboundPortEntries = toListOfStrings(v); PortRange portRange = PortRanges.fromCollection(inboundPortEntries); int[] portArray = ArrayUtils.toPrimitive(Iterables.toArray(portRange, Integer.class)); return portArray; }

Target:
static int[] toIntPortArray(Object v) { PortRange portRange = PortRanges.fromIterable(Collections.singletonList(v)); int[] portArray = ArrayUtils.toPrimitive(Iterables.toArray(portRange, Integer.class)); return portArray; }
Source:
public TestContainer[] create(ExamSystem system) { if (system.getOptions(CarbonDistributionBaseOption.class).length > 1) { logger.warn("Multiple distribution options are specified in the configuration!!!"); } List<TestContainer> containers = Arrays.asList(system.getOptions(CarbonDistributionBaseOption.class)).stream() .map(option -> new CarbonTestContainer(system, option)).collect(Collectors.toList()); if (containers.isEmpty()) { containers.add(new CarbonTestContainer(system, getDefaultConfiguration())); } return containers.toArray(new TestContainer[containers.size()]); }

Target:
public TestContainer[] create(ExamSystem system) { if (system.getOptions(CarbonDistributionBaseOption.class).length > 1) { logger.warn("Multiple distribution options are specified in the configuration!!!"); } List<TestContainer> containers = Arrays.stream(system.getOptions(CarbonDistributionBaseOption.class)) .map(option -> new CarbonTestContainer(system, option)) .collect(Collectors.toList()); if (containers.isEmpty()) { containers.add(new CarbonTestContainer(system, getDefaultConfiguration())); } return containers.toArray(new TestContainer[containers.size()]); }
Source:
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"); } for (Service service : services) { getPerunBl().getServicesManagerBl().checkServiceExists(sess, service); } getResourcesManagerBl().assignServices(sess, resource, services); }

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:
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.equals(self[i], other[i])) { return false; } } return true; }

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:
public void update() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); 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) )); }

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:
public Set<Class<?>> getClasses() { HiveConf conf = new HiveConf(); conf.addResource(Thread.currentThread().getContextClassLoader().getResource("grillserver-default.xml")); conf.addResource(Thread.currentThread().getContextClassLoader().getResource("grill-site.xml")); 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; }

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:
private Target createRecordTarget(final TargetCollection<Target> targets, final SimpleInterval where) { final Target target = targets.target(where); if (target == null || targets.location(target).equals(where)) { return target; } else { throw formatException(String.format("mismatching yet overlapping intervals in the input (%s) and the target collection (%s)", where, targets.location(target))); } }

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:
protected void addStoragePoolToDb() { final StoragePool storagePool = getStoragePool(); 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); }

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:
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()); } }

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:
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 { logic.joinCourseForInstructor(key, account.googleId, instituteParam); } 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; }

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:
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); } } return newId; }

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:
public Subscription build() { final Subscription subscription = new Subscription(); subscription.setId(id); subscription.setCreatedAt(createdAt); subscription.setUpdatedAt(createdAt); subscription.setOwningApplication(owningApplication); subscription.setEventTypes(eventTypes); subscription.setConsumerGroup(consumerGroup); subscription.setReadFrom(startFrom); subscription.setInitialCursors(initialCursors); return subscription; }

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:
public void testSimplePreferredPool() throws InterruptedException, IOException { MockIface iface1 = new Response1Iface(); MockIface iface2 = new Response1Iface(); startMockPartitionServerThread1(iface1, 1); startMockPartitionServerThread2(iface2, 1); Map<Host, List<HostConnection>> hostToConnectionsMap = new HashMap<Host, List<HostConnection>>(); int tryLockTimeoutMs = 0; int establishConnectionTimeoutMs = 0; int queryTimeoutMs = 0; int bulkQueryTimeoutMs = 0; mockHost1.setEnvironmentFlags(Collections.singletonMap("REGION", "REG1")); mockHost2.setEnvironmentFlags(Collections.singletonMap("REGION", "REG2")); hostToConnectionsMap.put(mockHost1, Collections.singletonList(new HostConnection(mockHost1, tryLockTimeoutMs, establishConnectionTimeoutMs, queryTimeoutMs, bulkQueryTimeoutMs))); hostToConnectionsMap.put(mockHost2, Collections.singletonList(new HostConnection(mockHost2, tryLockTimeoutMs, establishConnectionTimeoutMs, queryTimeoutMs, bulkQueryTimeoutMs))); HostConnectionPool hostConnectionPool = new HostConnectionPool(hostToConnectionsMap, null, Sets.newHashSet(mockHost1)); mockHost1.setState(HostState.SERVING); mockHost2.setState(HostState.SERVING); int numHits = 0; for (int i = 0; i < 10; ++i) { HankResponse response = hostConnectionPool.get(mockDomain, KEY_1, 1, null); if (response.is_set_value()) { assertEquals(RESPONSE_1, response); ++numHits; } } assertEquals("Gets should be distributed accross hosts", 10, iface1.numGets); assertEquals("Gets should be distributed accross hosts", 0, iface2.numGets); assertEquals("Half the keys should have been found", 10, numHits); }

Target:
public void testSimplePreferredPool() throws InterruptedException, IOException { MockIface iface1 = new Response1Iface(); MockIface iface2 = new Response1Iface(); startMockPartitionServerThread1(iface1, 1); startMockPartitionServerThread2(iface2, 1); Map<Host, List<HostConnection>> hostToConnectionsMap = new HashMap<Host, List<HostConnection>>(); int tryLockTimeoutMs = 0; int establishConnectionTimeoutMs = 0; int queryTimeoutMs = 0; int bulkQueryTimeoutMs = 0; mockHost1.setEnvironmentFlags(Collections.singletonMap("REGION", "REG1")); mockHost2.setEnvironmentFlags(Collections.singletonMap("REGION", "REG2")); hostToConnectionsMap.put(mockHost1, Collections.singletonList(new HostConnection(mockHost1, tryLockTimeoutMs, establishConnectionTimeoutMs, queryTimeoutMs, bulkQueryTimeoutMs))); hostToConnectionsMap.put(mockHost2, Collections.singletonList(new HostConnection(mockHost2, tryLockTimeoutMs, establishConnectionTimeoutMs, queryTimeoutMs, bulkQueryTimeoutMs))); HostConnectionPool hostConnectionPool = new HostConnectionPool(hostToConnectionsMap, null, Sets.newHashSet(mockHost1)); mockHost1.setState(HostState.SERVING); mockHost2.setState(HostState.SERVING); int numHits = 0; for (int i = 0; i < 10; ++i) { HankResponse response = hostConnectionPool.get(mockDomain, KEY_1, 1, null); if (response.is_set_value()) { assertEquals(RESPONSE_1, response); ++numHits; } } assertEquals("Gets should all hit first host", 10, iface1.numGets); assertEquals("Gets should not hit second host", 0, iface2.numGets); assertEquals("All keys should have been found", 10, numHits); }
Source:
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." ) ) .withArgument( new OptionalNamedArg( ARG_CONF_FILE, "conf" + File.separator + "neo4j.conf", "", "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." ) ); }

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:
public static final boolean isEmptyTrimmed(String input) { return input == null || input.trim().equals(""); }

Target:
public static boolean isEmptyTrimmed(String input) { return input == null || input.trim().equals(""); }
Source:
public void undo(CommandContext context) { context.getAdminManager().invokeActionRequiringRestart(new ActionRequiringRestart() { @Override public boolean execute() { return assignHostsToDefault(context); } }); }

Target:
public void undo(CommandContext context) { context.getAdminManager().invokeActionRequiringRestart(() -> assignHostsToDefault(context)); }
Source:
public Method getOnPongMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); if (methods == null) { return 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)) { return method; } } } return null; }

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:
protected static CacheException handleMissingSuccessfulResponse(Map<Address, Response> responses) { if (responses.values().stream().anyMatch(UnsureResponse.class::isInstance)) { return OutdatedTopologyException.getCachedInstance(); } else { return AllOwnersLostException.INSTANCE; } }

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:
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(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"); }

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:
public String toString() { return "HealthPolicyConfigReader{" + "configFilename='" + configFilename + '\'' + '}'; }

Target:
public String toString() { return "HealthPolicyConfigReader {configFilename=" + configFilename + "}"; }
Source:
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 != null && min < 0 ) || ( max != null && max < 0 ) || ( max != null && min != null && min > max ) ) { return CollectionHelper.asSet( new ConstraintCheckError( element, annotation, "INVALID_SIZE_LENGTH_ANNOTATION_PARAMETERS" ) ); } return Collections.emptySet(); }

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:
public void testBlockSettingHaOnHostedEngine() { prepareVmToPassCanDoAction(); group.setCompatibilityVersion(Version.v3_3); 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())); }

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:
public void save(GlowElderGuardian entity, CompoundTag compound) { super.save(entity, compound); compound.putBool("Elder", true); }

Target:
public void save(GlowElderGuardian entity, CompoundTag compound) { super.save(entity, compound); }
Source:
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")); map.getStyle().addSource(roomDataSource); 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); } }); } }); }

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:
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 { logger.info("NioSSLEngine releasing two buffers myNetData={}({}), peerAppData={}({})", 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; } }

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:
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]; } }); } return PsiTreeUtil.findChildrenOfType(this, ErlangCallbackFunction.class); }

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:
private void showNearbyPages(NearbyResult result) { getActivity().invalidateOptionsMenu(); mMarkerList.clear(); mapView.removeAllAnnotations(); List<MarkerOptions> optionsList = new ArrayList<>(); 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)); }

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:
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("~", "/"); } catch(NullPointerException e) { } 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; }

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:
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()); super.widgetSelected(e); } }); checkName(); control.getVisibiltyGroup().setVisible(showVisibilityPane); setControl(control); }

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:
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); return i++ != 2; } }, 0); assertEquals(3, list.size()); assertEquals(list, Arrays.asList("zero", "one", "two")); assertEquals(2, nextIndex); }

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:
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; }); System.out.println(softConstraints); return new ConstraintBasedAlgorithm(hardConstraints, softConstraints); }

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:
public void subscribe() { eventService.subscribe(workspaceEventsSubscriber); }

Target:
void subscribe() { eventService.subscribe(workspaceEventsSubscriber); }
Source:
public static String textToRLiteral(String value) { String escaped = value.replaceAll("([\"\\\n\\r\\t\\b\\f\\\\])", "\\\\$1"); return '"' + escaped + '"'; }

Target:
public static String textToRLiteral(String value) { String escaped = value.replaceAll("([\"\\n\\r\\t\\b\\f\\\\])", "\\\\$1"); return '"' + escaped + '"'; }
Source:
public String getCurrentUser() { if (isBrokerAccountServiceSupported()) { verifyNotOnMainThread(); final UserInfo[] users; try { users = BrokerAccountServiceHandler.getInstance().getBrokerUsers(mContext); } catch (final IOException 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; }

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; }