auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean canDoAction() { boolean returnValue = CanRemoveVds(getVdsId(), getReturnValue().getCanDoActionMessages()); storage_pool storagePool = getStoragePoolDAO().getForVds(getParameters().getVdsId()); if (returnValue && storagePool != null && storagePool.getstorage_pool_type() == StorageType.LOCALFS) { if (!getStorageDomainDAO().getAllForStoragePool(storagePool.getId()).isEmpty()) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_REMOVE_HOST_WITH_LOCAL_STORAGE); returnValue = false; } } if (isGlusterEnabled() && hasVolumeOnServer()) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_REMOVE_HOST_HAVING_GLUSTER_VOLUME); return false; } addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__HOST); return returnValue; }

Target:
protected boolean canDoAction() { boolean returnValue = CanRemoveVds(getVdsId(), getReturnValue().getCanDoActionMessages()); storage_pool storagePool = getStoragePoolDAO().getForVds(getParameters().getVdsId()); if (returnValue && storagePool != null && storagePool.getstorage_pool_type() == StorageType.LOCALFS) { if (!getStorageDomainDAO().getAllForStoragePool(storagePool.getId()).isEmpty()) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_REMOVE_HOST_WITH_LOCAL_STORAGE); returnValue = false; } } if (isGlusterEnabled() && hasVolumeOnServer()) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_REMOVE_HOST_HAVING_GLUSTER_VOLUME); returnValue = false; } addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__HOST); return returnValue; }
Source:
private List<?> findMissingTokens() { return configuration.getAccessTokenConfigurations() .stream() .map(AccessTokenConfiguration::getTokenId) .filter(tokenId -> !accessTokens.containsKey(tokenId)) .collect(toList()); }

Target:
protected List<?> findMissingTokens() { return configuration.getAccessTokenConfigurations() .stream() .map(AccessTokenConfiguration::getTokenId) .filter(tokenId -> !accessTokens.containsKey(tokenId)) .collect(toList()); }
Source:
protected static SagaLifecycle getInstance() { SagaLifecycle instance = Scope.getCurrentScope(); if (instance == null) { throw new IllegalStateException("Cannot retrieve current SagaLifecycle; none is yet defined"); } return instance; }

Target:
protected static SagaLifecycle getInstance() { return Scope.getCurrentScope(); }
Source:
protected String generateSequenceName( Map<Integer, Long> startPartitions, Optional<DateTime> minimumMessageTime, Optional<DateTime> maximumMessageTime ) { int groupId = getTaskGroupIdForPartition(startPartitions.keySet().iterator().next()); ImmutableMap<Integer, Long> partitionOffsets = ImmutableMap.of(groupId, (long) groupId); final TaskGroup taskGroup = new TaskGroup( partitionOffsets, minimumMessageTime, maximumMessageTime ); return generateSequenceName(taskGroup); }

Target:
protected String generateSequenceName( Map<Integer, Long> startPartitions, Optional<DateTime> minimumMessageTime, Optional<DateTime> maximumMessageTime ) { final int groupId = getTaskGroupIdForPartition(startPartitions.keySet().iterator().next()); return StringUtils.format("sequenceName-%d", groupId); }
Source:
public boolean store(Checkpoint checkpoint) { Path path = new Path(getCheckpointPath(checkpoint)); if (!ensureDirExists(getCheckpointDir(checkpoint))) { LOG.warning("Failed to ensure dir exists: " + getCheckpointDir(checkpoint)); return false; } FSDataOutputStream out = null; try { out = fileSystem.create(path); checkpoint.checkpoint().writeTo(out); } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to persist", e); return false; } finally { SysUtils.closeIgnoringExceptions(out); } return true; }

Target:
public void store(Checkpoint checkpoint) throws StatefulStorageException { Path path = new Path(getCheckpointPath(checkpoint.getTopologyName(), checkpoint.getCheckpointId(), checkpoint.getComponent(), checkpoint.getTaskId())); String checkpointDir = getCheckpointDir(checkpoint.getTopologyName(), checkpoint.getCheckpointId(), checkpoint.getComponent()); createDir(checkpointDir); FSDataOutputStream out = null; try { out = fileSystem.create(path); checkpoint.getCheckpoint().writeTo(out); } catch (IOException e) { throw new StatefulStorageException("Failed to persist", e); } finally { SysUtils.closeIgnoringExceptions(out); } }
Source:
private void closeRecordManager() { if (recMan != null) { try { recMan.close(); } catch (IOException e1) { } } }

Target:
private void closeRecordManager() { if (recMan != null) { try { recMan.close(); } catch (IOException e1) { log.trace("Error when closing record manager", e1); } } }
Source:
public synchronized void initScanner() throws SQLException { if (closed) { return; } ResultIterator delegate = this.scanIterator; if (delegate == UNINITIALIZED_SCANNER) { try { this.scanIterator = new ScanningResultIterator(htable.getScanner(scan), scanMetrics); } catch (IOException e) { if(handleSplitRegionBoundaryFailureDuringInitialization) { try { throw ServerUtil.parseServerException(e); } catch(StaleRegionBoundaryCacheException s) { if(scan.getAttribute(NON_AGGREGATE_QUERY)!=null) { plan.getContext().getConnection().getQueryServices().clearTableRegionCache(htable.getTableName()); this.scanIterator = plan.iterator(DefaultParallelScanGrouper.getInstance(), scan); } } } else { Closeables.closeQuietly(htable); throw ServerUtil.parseServerException(e); } } } }

Target:
public synchronized void initScanner() throws SQLException { if (closed) { return; } ResultIterator delegate = this.scanIterator; if (delegate == UNINITIALIZED_SCANNER) { try { this.scanIterator = new ScanningResultIterator(htable.getScanner(scan), scanMetrics); } catch (IOException e) { Closeables.closeQuietly(htable); throw ServerUtil.parseServerException(e); } } }
Source:
public Map<String, Set<String>> recognise(String text) { Map<String, Set<String>> entities = new HashMap<>(); try { int port = 8881; String url = restHostUrlStr + "/nltk"; Response response = WebClient.create(url).post(text); int responseCode = response.getStatus(); if (responseCode == 200) { String result = response.readEntity(String.class); JSONParser parser = new JSONParser(); JSONObject j = (JSONObject) parser.parse(result); Set s = entities.put("NAMES", new HashSet((Collection) j.get("names"))); } } catch (Exception e) { LOG.debug(e.getMessage(), e); } ENTITY_TYPES.clear(); ENTITY_TYPES.addAll(entities.keySet()); return entities; }

Target:
public Map<String, Set<String>> recognise(String text) { Map<String, Set<String>> entities = new HashMap<>(); try { String url = restHostUrlStr + "/nltk"; Response response = WebClient.create(url).accept(MediaType.TEXT_HTML).post(text); int responseCode = response.getStatus(); if (responseCode == 200) { String result = response.readEntity(String.class); JSONParser parser = new JSONParser(); JSONObject j = (JSONObject) parser.parse(result); Set s = entities.put("NAMES", new HashSet((Collection) j.get("names"))); } } catch (Exception e) { LOG.debug(e.getMessage(), e); } ENTITY_TYPES.clear(); ENTITY_TYPES.addAll(entities.keySet()); return entities; }
Source:
public List<ExtensionEntry> getProvidedExtensions(String provides) { List<ExtensionEntry> results = new ArrayList<>(); for (ExtensionEntry entry : loadedEntries.values()) { if (entry.getProvides().contains(provides)) { results.add(entry); } } return results; }

Target:
public List<ExtensionEntry> getProvidedExtensions(String provides) { List<ExtensionEntry> results = new ArrayList<>(); for (ExtensionEntry entry : loadedEntries.values()) { if (entry.getProvides().contains(provides) && entry.isActivated()) { results.add(entry); } } return results; }
Source:
private List<String> tableOptParser(JSONArray raw) { List<String> ret = new ArrayList<>(); if(raw == null || raw.length() == 0) { return ret; } for(int i = 0 ; i < raw.length() ; i++) { String s = ""; try { s = raw.getString(i).trim().toUpperCase(); } catch (JSONException e) { e.printStackTrace(); } if(s.length() > 0) ret.add(s.toString()); } return ret; }

Target:
private List<String> tableOptParser(JSONArray raw) { List<String> ret = new ArrayList<>(); if(raw == null || raw.length() == 0) { return ret; } for(int i = 0 ; i < raw.length() ; i++) { try { String s = raw.getString(i).trim().toUpperCase(); if(s.length() > 0) { ret.add(s.toString()); } } catch (JSONException e) { throw new RuntimeException(e.getMessage()); } } return ret; }
Source:
protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests(authz -> authz .anyRequest().authenticated() ) .saml2Login(saml2 -> {}); }

Target:
protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests(authz -> authz .anyRequest().authenticated() ) .saml2Login(withDefaults()); }
Source:
public Principal authenticate(String username, String password) throws SecurityException { AuthorizingCallbackHandler handler = securityRealm.getAuthorizingCallbackHandler(AuthMechanism.PLAIN); NameCallback ncb = new NameCallback("name", username); ncb.setName(username); VerifyPasswordCallback vpcb = new VerifyPasswordCallback(password); try { handler.handle(new Callback[] { ncb, vpcb }); } catch (Exception e) { } if (vpcb.isVerified()) { try { SubjectUserInfo subjectUserInfo = handler.createSubjectUserInfo(Collections.singletonList(new SimpleUserPrincipal(username))); return Security.getSubjectUserPrincipal(subjectUserInfo.getSubject()); } catch (IOException e) { throw new SecurityException("Invalid credentials", e); } } else throw new SecurityException("Invalid credentials"); }

Target:
public Principal authenticate(String username, String password) throws SecurityException { AuthorizingCallbackHandler handler = securityRealm.getAuthorizingCallbackHandler(AuthMechanism.PLAIN); NameCallback ncb = new NameCallback("name", username); ncb.setName(username); VerifyPasswordCallback vpcb = new VerifyPasswordCallback(password); try { handler.handle(new Callback[] { ncb, vpcb }); } catch (Exception e) { ROOT_LOGGER.authenticationError(e); } if (vpcb.isVerified()) { try { SubjectUserInfo subjectUserInfo = handler.createSubjectUserInfo(Collections.singletonList(new SimpleUserPrincipal(username))); return Security.getSubjectUserPrincipal(subjectUserInfo.getSubject()); } catch (IOException e) { throw new SecurityException("Invalid credentials", e); } } else throw new SecurityException("Invalid credentials"); }
Source:
public void infersFromKnownVersionStrings() { Arrays.stream(AtlasDbHttpProtocolVersion.values()) .forEach(value -> { Optional<String> protocolVersionString = Optional.of(value.getProtocolVersionString()); assertThat(AtlasDbHttpProtocolVersion.inferFromString(protocolVersionString)) .isEqualTo(value); }); }

Target:
public void infersFromKnownVersionStrings() { Stream.of(AtlasDbHttpProtocolVersion.LEGACY_OR_UNKNOWN, AtlasDbHttpProtocolVersion.CONJURE_JAVA_RUNTIME) .forEach(value -> { Optional<String> protocolVersionString = Optional.of(value.getProtocolVersionString()); assertThat(AtlasDbHttpProtocolVersion.inferFromString(protocolVersionString)) .isEqualTo(value); }); }
Source:
String getBuilder() default "get*Builder"; String setBuilder() default "set*Builder"; String addBuilder() default "add*Builder"; String addAllBuilder() default "addAll*Builder"; String getBuilderList() default "get*BuilderList"; public enum ImplementationVisibility { PUBLIC, SAME, @Deprecated SAME_NON_RETURNED, PACKAGE, PRIVATE }

Target:
String getBuilder() default "*Builder"; String setBuilder() default "*Builder"; String addBuilder() default "add*Builder"; String addAllBuilder() default "addAll*Builder"; String getBuilderList() default "*Builders"; public enum ImplementationVisibility { PUBLIC, SAME, @Deprecated SAME_NON_RETURNED, PACKAGE, PRIVATE }
Source:
public String generateMatcher() { String output = new String(); final int numConstants = this.enumConstants.size(); for (int currentIndex = 0; currentIndex < numConstants; currentIndex++) { output += " "; if (currentIndex > 0) { output += "} else "; } final String currentEnumString = this.enumConstants.get(currentIndex).getName(); output += "if (xmlStrcmp(text, (const xmlChar*) \"" + currentEnumString + "\") == 0) {" + System.lineSeparator(); output += " return " + currentEnumString + ";" + System.lineSeparator(); } output += " } else {" + System.lineSeparator(); output += " ds3_log_message(log, DS3_ERROR, \"ERROR: Unknown " + getNameUnderscores() + " value of '%s'. Returning " + getEnumConstants().get(0).getName() + " for safety." + System.lineSeparator(); output += " " + "return " + getEnumConstants().get(0).getName() + ";" + System.lineSeparator(); output += " }" + System.lineSeparator(); return output; }

Target:
public String generateMatcher() { final StringBuilder outputBuilder = new StringBuilder(); final int numConstants = this.enumConstants.size(); for (int currentIndex = 0; currentIndex < numConstants; currentIndex++) { outputBuilder.append(CHelper.indent(1)); if (currentIndex > 0) { outputBuilder.append("} else "); } final String currentEnumString = this.enumConstants.get(currentIndex).getName(); outputBuilder.append("if (xmlStrcmp(text, (const xmlChar*) \"").append(currentEnumString).append("\") == 0) {").append(System.lineSeparator()); outputBuilder.append(CHelper.indent(2)).append("return ").append(currentEnumString).append(";").append(System.lineSeparator()); } outputBuilder.append(CHelper.indent(1)).append("} else {").append(System.lineSeparator()); outputBuilder.append(CHelper.indent(2)).append("ds3_log_message(log, DS3_ERROR, \"ERROR: Unknown ").append(getNameUnderscores()).append(" value of '%s'. Returning ").append(getEnumConstants().get(0).getName()).append(" for safety.").append(System.lineSeparator()); outputBuilder.append(CHelper.indent(2)).append("return ").append(getEnumConstants().get(0).getName()).append(";").append(System.lineSeparator()); outputBuilder.append(CHelper.indent(1)).append("}").append(System.lineSeparator()); return outputBuilder.toString(); }
Source:
public static String getFailureMessage(Job failedJob, ObjectMapper jsonMapper) { try { Map<String, String> taskDiagsMap = Maps.newHashMap(); TaskCompletionEvent[] completionEvents = failedJob.getTaskCompletionEvents(0, 100); for (TaskCompletionEvent tce : completionEvents) { String[] taskDiags = failedJob.getTaskDiagnostics(tce.getTaskAttemptId()); String combinedTaskDiags = ""; for (String taskDiag : taskDiags) { combinedTaskDiags += taskDiag; } taskDiagsMap.put(tce.getTaskAttemptId().toString(), combinedTaskDiags); } return jsonMapper.writeValueAsString(taskDiagsMap); } catch (IOException | InterruptedException ie) { log.error("couldn't get failure cause for job."); return null; } }

Target:
public static String getFailureMessage(Job failedJob, ObjectMapper jsonMapper) { try { Map<String, String> taskDiagsMap = Maps.newHashMap(); TaskCompletionEvent[] completionEvents = failedJob.getTaskCompletionEvents(0, 100); for (TaskCompletionEvent tce : completionEvents) { String[] taskDiags = failedJob.getTaskDiagnostics(tce.getTaskAttemptId()); String combinedTaskDiags = ""; for (String taskDiag : taskDiags) { combinedTaskDiags += taskDiag; } taskDiagsMap.put(tce.getTaskAttemptId().toString(), combinedTaskDiags); } return jsonMapper.writeValueAsString(taskDiagsMap); } catch (IOException | InterruptedException ie) { log.error(ie, "couldn't get failure cause for job [%s]", failedJob.getJobName()); return null; } }
Source:
public Response tokenRequest(JwtPayload payload) { hiveValidator.validate(payload); JwtTokenVO responseTokenVO = new JwtTokenVO(); UserVO user = userService.findById(payload.getUserId()); if (user == null) { logger.warn("JwtToken: User with specified id was not found"); return ResponseFactory .response(Response.Status.BAD_REQUEST, new ErrorResponse(BAD_REQUEST.getStatusCode(), Messages.INVALID_REQUEST_PARAMETERS)); } if (!user.getStatus().equals(UserStatus.ACTIVE)) { logger.warn("JwtToken: User with specified id is not active"); return ResponseFactory .response(Response.Status.BAD_REQUEST, new ErrorResponse(BAD_REQUEST.getStatusCode(), Messages.INVALID_REQUEST_PARAMETERS)); } logger.debug("JwtToken: generate access and refresh token"); responseTokenVO.setAccessToken(tokenService.generateJwtAccessToken(payload)); responseTokenVO.setRefreshToken(tokenService.generateJwtRefreshToken(payload)); return ResponseFactory.response(CREATED, responseTokenVO, JsonPolicyDef.Policy.JWT_REFRESH_TOKEN_SUBMITTED); }

Target:
public Response tokenRequest(JwtPayload payload) { hiveValidator.validate(payload); JwtTokenVO responseTokenVO = new JwtTokenVO(); UserVO user = userService.findById(payload.getUserId()); if (user == null) { logger.warn("JwtToken: User with specified id was not found", payload.getUserId()); return ResponseFactory .response(Response.Status.BAD_REQUEST, new ErrorResponse(BAD_REQUEST.getStatusCode(), Messages.INVALID_REQUEST_PARAMETERS)); } if (!user.getStatus().equals(UserStatus.ACTIVE)) { logger.warn("JwtToken: User with specified id is not active", payload.getUserId()); return ResponseFactory .response(Response.Status.BAD_REQUEST, new ErrorResponse(BAD_REQUEST.getStatusCode(), Messages.INVALID_REQUEST_PARAMETERS)); } logger.debug("JwtToken: generate access and refresh token"); responseTokenVO.setAccessToken(tokenService.generateJwtAccessToken(payload)); responseTokenVO.setRefreshToken(tokenService.generateJwtRefreshToken(payload)); return ResponseFactory.response(CREATED, responseTokenVO, JsonPolicyDef.Policy.JWT_REFRESH_TOKEN_SUBMITTED); }
Source:
public static GeometryType getGeometryType(Slice shape) { GeometrySerializationType serType = deserializeType(shape); switch (serType) { case POINT: return GeometryType.POINT; case LINE_STRING: return GeometryType.LINE_STRING; case POLYGON: case ENVELOPE: return GeometryType.POLYGON; case MULTI_POINT: return GeometryType.MULTI_POINT; case MULTI_LINE_STRING: return GeometryType.MULTI_LINE_STRING; case MULTI_POLYGON: return GeometryType.MULTI_POLYGON; case GEOMETRY_COLLECTION: return GeometryType.GEOMETRY_COLLECTION; default: throw new IllegalArgumentException("Unexpected type: " + serType); } }

Target:
public static GeometryType getGeometryType(Slice shape) { return deserializeType(shape).geometryType(); }
Source:
public void testBloomFilterVirtualColumn() throws Exception { BloomKFilter filter = new BloomKFilter(1500); filter.addString("a-foo"); filter.addString("-foo"); if (!NullHandling.replaceWithDefault()) { filter.addBytes(null, 0, 0); } byte[] bytes = BloomFilterSerializersModule.bloomKFilterToBytes(filter); String base64 = Base64.encodeBase64String(bytes); testQuery( StringUtils.format("SELECT COUNT(*) FROM druid.foo WHERE bloom_filter_test(concat(dim2, '-foo'), '%s')", base64), ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(QSS(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns() .filters( new ExpressionDimFilter( StringUtils.format("bloom_filter_test(concat(\"dim2\",'-foo'),'%s')", base64), createExprMacroTable() ) ) .aggregators(AGGS(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{5L} ) ); }

Target:
public void testBloomFilterVirtualColumn() throws Exception { BloomKFilter filter = new BloomKFilter(1500); filter.addString("a-foo"); filter.addString("-foo"); if (!NullHandling.replaceWithDefault()) { filter.addBytes(null, 0, 0); } byte[] bytes = BloomFilterSerializersModule.bloomKFilterToBytes(filter); String base64 = StringUtils.encodeBase64String(bytes); testQuery( StringUtils.format("SELECT COUNT(*) FROM druid.foo WHERE bloom_filter_test(concat(dim2, '-foo'), '%s')", base64), ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(QSS(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns() .filters( new ExpressionDimFilter( StringUtils.format("bloom_filter_test(concat(\"dim2\",'-foo'),'%s')", base64), createExprMacroTable() ) ) .aggregators(AGGS(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{5L} ) ); }
Source:
public FileBasedConfig openUserConfig(Config parent, FS fs) { File home = fs.userHome(); userConfig.compareAndSet(null, new FileBasedConfig(parent, new File(home, ".gitconfig"), fs)); return userConfig.get(); }

Target:
public FileBasedConfig openUserConfig(Config parent, FS fs) { FileBasedConfig c = userConfig.get(); if (c == null) { File home = fs.userHome(); userConfig.compareAndSet(null, new FileBasedConfig(parent, new File(home, ".gitconfig"), fs)); c = userConfig.get(); } return c; }
Source:
private List<String> tsConfigs(SensorContext context) { if (tsconfigs == null) { Optional<String> tsConfigProperty = context.config().get(JavaScriptPlugin.TSCONFIG_PATH); if (tsConfigProperty.isPresent()) { Path tsconfig = Paths.get(tsConfigProperty.get()); tsconfig = tsconfig.isAbsolute() ? tsconfig : context.fileSystem().baseDir().toPath().resolve(tsconfig); if (!tsconfig.toFile().exists()) { String msg = format("Provided tsconfig.json path doesn't exists. Path: '%s'", tsconfig); LOG.error(msg); throw new IllegalStateException(msg); } tsconfigs = Collections.singletonList(tsconfig.toString()); LOG.info("Using from property", tsconfig, JavaScriptPlugin.TSCONFIG_PATH); } else { tsconfigs = lookupTsConfig(context); LOG.info("Found " + tsconfigs.size() + " tsconfig.json files: " + tsconfigs); } } return tsconfigs; }

Target:
private List<String> tsConfigs(SensorContext context) throws IOException { if (tsconfigs == null) { Optional<String> tsConfigProperty = context.config().get(JavaScriptPlugin.TSCONFIG_PATH); if (tsConfigProperty.isPresent()) { Path tsconfig = Paths.get(tsConfigProperty.get()); tsconfig = tsconfig.isAbsolute() ? tsconfig : context.fileSystem().baseDir().toPath().resolve(tsconfig); if (!tsconfig.toFile().exists()) { String msg = format("Provided tsconfig.json path doesn't exist. Path: '%s'", tsconfig); LOG.error(msg); throw new IllegalStateException(msg); } tsconfigs = Collections.singletonList(tsconfig.toString()); LOG.info("Using from property", tsconfig, JavaScriptPlugin.TSCONFIG_PATH); } else { tsconfigs = lookupTsConfig(context); LOG.info("Found " + tsconfigs.size() + " tsconfig.json file(s): " + tsconfigs); } } return tsconfigs; }
Source:
public void notifyChanged(Notification notification) { StackedchartsPackage pckg = StackedchartsPackage.eINSTANCE; Object feature = notification.getFeature(); ArrayList<EAttribute> visualUpdates = new ArrayList<EAttribute>(); visualUpdates.add(pckg.getChart_Name()); visualUpdates.add(pckg.getStyling_LineStyle()); visualUpdates.add(pckg.getStyling_LineThickness()); visualUpdates.add(pckg.getStyling_MarkerSize()); visualUpdates.add(pckg.getStyling_MarkerStyle()); visualUpdates.add(pckg.getPlainStyling_Color()); for (final EAttribute thisA : visualUpdates) { if (feature == thisA) { refreshVisuals(); break; } } ArrayList<EReference> childrenUpdates = new ArrayList<EReference>(); childrenUpdates.add(pckg.getChart_MaxAxes()); childrenUpdates.add(pckg.getChart_MinAxes()); for (final EReference thisA : childrenUpdates) { if (feature == thisA) { refreshChildren(); break; } } }

Target:
public void notifyChanged(Notification notification) { Object feature = notification.getFeature(); for (final EAttribute thisA : _visualUpdates) { if (feature == thisA) { refreshVisuals(); break; } } for (final EReference thisA : _childrenUpdates) { if (feature == thisA) { refreshChildren(); break; } } }
Source:
public static void main(String[] args) throws NoFatWarDeploymentSupportedException { throw new NoFatWarDeploymentSupportedException(); }

Target:
public static void main(String[] args) { SpringApplication.run(SelfAdministration.class, args); }
Source:
public void testConcurrentAccess() throws Exception { SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class); sfsb1.createEmployee("MultiTasker", "314 Littleton Rd, Westford, MA 01886", 500); assertEquals(sfsb1.queryEmployeeNameNoTX(500),"MultiTasker"); final int numThreads = 10; ExecutorService executorService = Executors.newFixedThreadPool(numThreads); Future[] results = new Future[numThreads]; for(int i = 0; i < numThreads; ++i) { results[i] = executorService.submit(new CallingClass()); } for(int i = 0; i < numThreads; ++i) { results[i].get(); } }

Target:
public void testConcurrentAccess() throws Exception { SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class); sfsb1.createEmployee("MultiTasker", "314 Littleton Rd, Westford, MA 01886", 500); assertEquals(sfsb1.queryEmployeeNameNoTX(500),"MultiTasker"); final int numThreads = 10; ExecutorService executorService = Executors.newFixedThreadPool(numThreads); Future[] results = new Future[numThreads]; for(int i = 0; i < numThreads; ++i) { results[i] = executorService.submit(new CallingClass()); } for(int i = 0; i < numThreads; ++i) { results[i].get(); } executorService.shutdown(); }
Source:
protected boolean canDoAction() { boolean retVal = true; if (getVmTemplate() == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } if (retVal && !VmTemplateHandler.verifyVmTemplateStatusForUse(getVmTemplateId(), false)) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); retVal = false; } if (retVal) { DiskImageList images = templatesFromExport.get(LinqUtils.firstOrNull(templatesFromExport.keySet(), new Predicate<VmTemplate>() { @Override public boolean eval(VmTemplate t) { return t.getId().equals(getParameters().getVmTemplateId()); } })); if (images != null) { getParameters().setImages(Arrays.asList(images.getDiskImages())); } else { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } } if (retVal) { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retVal = validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); } if (retVal && getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); retVal = false; } if (retVal) { VmTemplate tmpl = DbFacade.getInstance().getVmTemplateDAO().get(getVmTemplateId()); if (tmpl != null) { retVal = (tmpl.getstatus() != VmTemplateStatus.Locked); if (!retVal) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } } } return retVal; }

Target:
protected boolean canDoAction() { boolean retVal = true; if (getVmTemplate() == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } if (retVal && !VmTemplateHandler.isTemplateStatusIsNotLocked(getVmTemplateId())) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); retVal = false; } if (retVal) { DiskImageList images = templatesFromExport.get(LinqUtils.firstOrNull(templatesFromExport.keySet(), new Predicate<VmTemplate>() { @Override public boolean eval(VmTemplate t) { return t.getId().equals(getParameters().getVmTemplateId()); } })); if (images != null) { getParameters().setImages(Arrays.asList(images.getDiskImages())); } else { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } } if (retVal) { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retVal = validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); } if (retVal && getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); retVal = false; } if (retVal) { VmTemplate tmpl = DbFacade.getInstance().getVmTemplateDAO().get(getVmTemplateId()); if (tmpl != null) { retVal = (tmpl.getstatus() != VmTemplateStatus.Locked); if (!retVal) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } } } return retVal; }
Source:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } List<QuotaConsumptionParameter> consumptionParameters = new ArrayList<QuotaConsumptionParameter>(); try { switch (this.getActionType().getQuotaDependency()) { case NONE: return true; case STORAGE: addInternalStorageParameters(consumptionParameters); break; case VDS: addInternalVdsParameters(consumptionParameters); break; case BOTH: addInternalStorageParameters(consumptionParameters); addInternalVdsParameters(consumptionParameters); break; } } catch (ClassCastException e) { log.error("Command: " + this.getClass().getName() + ". Quota handling was expected - class does not implement the expected interface"); } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper; if (getStoragePool() != null) { quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper( this.getStoragePool(), this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParametersWrapper.setParameters(consumptionParameters); } else { quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper( null,this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParametersWrapper.setParameters(consumptionParameters); log.error("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } if (!consumptionParameters.isEmpty()) { return QuotaManager.getInstance().consume(quotaConsumptionParametersWrapper); } else { return true; } }

Target:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } List<QuotaConsumptionParameter> consumptionParameters = new ArrayList<QuotaConsumptionParameter>(); switch (this.getActionType().getQuotaDependency()) { case NONE: return true; case STORAGE: consumptionParameters.addAll(((QuotaStorageDependent) this).getQuotaStorageConsumptionParameters()); break; case VDS: consumptionParameters.addAll(((QuotaVdsDependent) this).getQuotaVdsConsumptionParameters()); break; case BOTH: consumptionParameters.addAll(((QuotaStorageDependent) this).getQuotaStorageConsumptionParameters()); consumptionParameters.addAll(((QuotaVdsDependent) this).getQuotaVdsConsumptionParameters()); break; } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper; if (getStoragePool() != null) { quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper( this.getStoragePool(), this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParametersWrapper.setParameters(consumptionParameters); } else { quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper( null,this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParametersWrapper.setParameters(consumptionParameters); log.error("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } return consumptionParameters.isEmpty() || getQuotaManager().consume(quotaConsumptionParametersWrapper); }
Source:
public String scheduleAOneTimeJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, long initialDelay, TimeUnit timeUnit) { String jobName = generateUniqueNameForInstance(instance, methodName); JobDetail job = new JobDetail(jobName, Scheduler.DEFAULT_GROUP, JobWrapper.class); JobDataMap data = job.getJobDataMap(); setBasicMapValues(data, instance, methodName, inputTypes, inputParams); Date runTime = getFutureDate(initialDelay, timeUnit); String triggerName = generateUniqueNameForInstance(instance, TRIGGER_PREFIX); SimpleTrigger trigger = new SimpleTrigger(triggerName, Scheduler.DEFAULT_GROUP, runTime); try { sched.scheduleJob(job, trigger); } catch (SchedulerException se) { log.error("failed to schedule job", se); } return jobName; }

Target:
public String scheduleAOneTimeJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, long initialDelay, TimeUnit timeUnit) { JobDetail job = createJobWithBasicMapValues(instance, methodName, inputTypes, inputParams); SimpleTrigger trigger = createSimpleTrigger(initialDelay, timeUnit, instance); try { sched.scheduleJob(job, trigger); } catch (SchedulerException se) { log.error("failed to schedule job", se); } return job.getName(); }
Source:
protected Control createDialogArea(Composite parent) { final Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new GridLayout(2, false)); getShell().setText( changeCredentials ? UIText.LoginDialog_changeCredentials : UIText.LoginDialog_login); Label uriLabel = new Label(composite, SWT.NONE); uriLabel.setText(UIText.LoginDialog_repository); Text uriText = new Text(composite, SWT.READ_ONLY); uriText.setText(uri.toString()); Label userLabel = new Label(composite, SWT.NONE); userLabel.setText(UIText.LoginDialog_user); if (isUserSet) { user = new Text(composite, SWT.BORDER | SWT.READ_ONLY); user.setText(uri.getUser()); } else { user = new Text(composite, SWT.BORDER); } GridDataFactory.fillDefaults().grab(true, false).applyTo(user); Label passwordLabel = new Label(composite, SWT.NONE); passwordLabel.setText(UIText.LoginDialog_password); password = new Text(composite, SWT.PASSWORD | SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(password); if (isUserSet) password.setFocus(); else user.setFocus(); return composite; }

Target:
protected Control createDialogArea(Composite parent) { final Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new GridLayout(2, false)); getShell().setText( changeCredentials ? UIText.LoginDialog_changeCredentials : UIText.LoginDialog_login); Label uriLabel = new Label(composite, SWT.NONE); uriLabel.setText(UIText.LoginDialog_repository); Text uriText = new Text(composite, SWT.READ_ONLY); uriText.setText(uri.toString()); Label userLabel = new Label(composite, SWT.NONE); userLabel.setText(UIText.LoginDialog_user); if (isUserSet) { user = new Text(composite, SWT.BORDER | SWT.READ_ONLY); user.setText(uri.getUser()); } else user = new Text(composite, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(user); Label passwordLabel = new Label(composite, SWT.NONE); passwordLabel.setText(UIText.LoginDialog_password); password = new Text(composite, SWT.PASSWORD | SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(password); if (isUserSet) password.setFocus(); else user.setFocus(); return composite; }
Source:
public long restoreMessagesFromDeadLetterQueue(long[] messageIDs, String destinationQueueName) throws QueueManagerException { long unavailableMessageCount = 0L; MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); try { ObjectName objectName = new ObjectName("org.wso2.andes:type=QueueManagementInformation,name=QueueManagementInformation"); String operationName = "restoreMessagesFromDeadLetterQueue"; Object[] parameters = new Object[]{messageIDs, destinationQueueName}; String[] signature = new String[]{long[].class.getName(), String.class.getName()}; Object result = mBeanServer.invoke( objectName, operationName, parameters, signature); if (result != null) { unavailableMessageCount = (Long) result; } return unavailableMessageCount; } catch (MalformedObjectNameException | ReflectionException | MBeanException | InstanceNotFoundException e) { throw new QueueManagerException("Error restoring messages from Dead Letter Queue : " + destinationQueueName, e); } }

Target:
public long restoreMessagesFromDeadLetterQueue(long[] messageIDs, String destinationQueueName) throws QueueManagerException { long unavailableMessageCount = 0L; MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); try { ObjectName objectName = new ObjectName("org.wso2.andes:type=QueueManagementInformation,name=QueueManagementInformation"); String operationName = "restoreMessagesFromDeadLetterQueue"; Object[] parameters = new Object[]{messageIDs, destinationQueueName}; String[] signature = new String[]{long[].class.getName(), String.class.getName()}; Object result = mBeanServer.invoke( objectName, operationName, parameters, signature); if (null != result) { unavailableMessageCount = (Long) result; } return unavailableMessageCount; } catch (MalformedObjectNameException | ReflectionException | MBeanException | InstanceNotFoundException e) { throw new QueueManagerException("Error restoring messages from Dead Letter Queue : " + destinationQueueName, e); } }
Source:
public String onPlaceholderRequest(Player p, String identifier) { if (identifier.equalsIgnoreCase("total_achievements")) { return getTotalAchievements(); } if (p == null) { return null; } UUID uuid = p.getUniqueId(); if (identifier.equalsIgnoreCase("achievements")) { return getAchievements(uuid); } if (identifier.equalsIgnoreCase("achievements_percentage")) { return getAchievementsPercentage(uuid); } if (identifier.toLowerCase().startsWith("unlocked_")) { return unlockedPlaceholder(uuid, identifier.replaceFirst("(?i)unlocked_", "")); } String returnValue = getNormalAchievements(identifier, uuid); if (returnValue == null) { returnValue = getMultipleAchievements(identifier, uuid); } return returnValue; }

Target:
public String onPlaceholderRequest(Player p, String identifier) { if (globalPlaceholders.containsKey(identifier)) { return globalPlaceholders.get(identifier).get(); } if (p == null) { return null; } UUID uuid = p.getUniqueId(); String[] splitId = identifier.split("_"); if (placeholderWithArgs.containsKey(splitId[0])) { return placeholderWithArgs.get(splitId[0]).apply(uuid, Arrays.copyOfRange(splitId, 1, splitId.length)); } else if (placeholderWithoutArgs.containsKey(identifier)) { return placeholderWithoutArgs.get(identifier).apply(uuid); } String returnValue = getNormalAchievements(identifier, uuid); if (returnValue == null) { returnValue = getMultipleAchievements(identifier, uuid); } return returnValue; }
Source:
protected void ExecuteVdsBrokerCommand() { if (Config.<Boolean> GetValue(ConfigValues.SendVmTicketUID, getVds().getVdsGroupCompatibilityVersion().toString())) { Map<String, String> params = new HashMap<String, String>(); params.put("userName", getParameters().getUserName()); params.put("userId", getParameters().getUserId().toString()); status = getBroker().setVmTicket(mVmId.toString(), mTicket, (Integer.valueOf(mValidTime)).toString(), connectionAction, params); } else { status = getBroker().setVmTicket(mVmId.toString(), mTicket, (Integer.valueOf(mValidTime)).toString()); } ProceedProxyReturnValue(); }

Target:
protected void ExecuteVdsBrokerCommand() { if (Config.<Boolean> GetValue(ConfigValues.SendVmTicketUID, getVds().getVdsGroupCompatibilityVersion().toString())) { Map<String, String> params = new HashMap<String, String>(); params.put("userName", getParameters().getUserName()); params.put("userId", getParameters().getUserId().toString()); status = getBroker().setVmTicket(mVmId.toString(), mTicket, String.valueOf(mValidTime), connectionAction, params); } else { status = getBroker().setVmTicket(mVmId.toString(), mTicket, String.valueOf(mValidTime)); } ProceedProxyReturnValue(); }
Source:
public InternalAccess internalAccess() { Security.allowOnlyFrameworkServer(); return this.internalAccess; }

Target:
public final InternalAccess internalAccess() { Security.allowOnlyFrameworkServer(); return this.internalAccess; }
Source:
public void invalidLoginTest() throws InterruptedException { find("#repoOwnerField"); selectAll(); push(KeyCode.BACK_SPACE).type("abc").push(KeyCode.TAB); push(KeyCode.BACK_SPACE).type("abc").push(KeyCode.TAB); push(KeyCode.BACK_SPACE).type("abc").push(KeyCode.TAB); push(KeyCode.BACK_SPACE).type("abc"); click("Sign in"); sleep(1000); assertNodeExists(hasText("Failed to sign in. Please try again.")); click("OK"); }

Target:
public void invalidLoginTest() throws InterruptedException { selectAll(); push(KeyCode.BACK_SPACE).type("abc").push(KeyCode.TAB); push(KeyCode.BACK_SPACE).type("abc").push(KeyCode.TAB); push(KeyCode.BACK_SPACE).type("abc").push(KeyCode.TAB); push(KeyCode.BACK_SPACE).type("abc"); click("Sign in"); sleep(1000); assertNodeExists(hasText("Failed to sign in. Please try again.")); click("OK"); }
Source:
public boolean isNoDiscard() { ICPPClassType clazz = getSpecializedBinding(); if (clazz != null) { return clazz.isNoDiscard(); } return false; }

Target:
public boolean isNoDiscard() { ICPPASTCompositeTypeSpecifier typeSpecifier = getCompositeTypeSpecifier(); if (typeSpecifier != null) { return AttributeUtil.hasNodiscardAttribute(typeSpecifier); } ICPPClassType clazz = getSpecializedBinding(); if (clazz != null) { return clazz.isNoDiscard(); } return false; }
Source:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (getSucceeded()) { if (getParameters().getSnapshotAction() == SnapshotActionEnum.UNDO) { return AuditLogType.USER_UNDO_RESTORE_FROM_SNAPSHOT_START; } else { return AuditLogType.USER_COMMIT_RESTORE_FROM_SNAPSHOT_START; } } else { if (getParameters().getSnapshotAction() == SnapshotActionEnum.UNDO) { return AuditLogType.USER_UNDO_RESTORE_FROM_SNAPSHOT_FINISH_FAILURE; } else { return AuditLogType.USER_COMMIT_RESTORE_FROM_SNAPSHOT_FINISH_FAILURE; } } default: if (getParameters().getSnapshotAction() == SnapshotActionEnum.UNDO) { return AuditLogType.USER_UNDO_RESTORE_FROM_SNAPSHOT_FINISH_SUCCESS; } else { return AuditLogType.USER_COMMIT_RESTORE_FROM_SNAPSHOT_FINISH_SUCCESS; } } }

Target:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (getSucceeded()) { if (getParameters().getSnapshotAction() == SnapshotActionEnum.UNDO) { return AuditLogType.USER_UNDO_RESTORE_FROM_SNAPSHOT_START; } return AuditLogType.USER_COMMIT_RESTORE_FROM_SNAPSHOT_START; } if (getParameters().getSnapshotAction() == SnapshotActionEnum.UNDO) { return AuditLogType.USER_UNDO_RESTORE_FROM_SNAPSHOT_FINISH_FAILURE; } return AuditLogType.USER_COMMIT_RESTORE_FROM_SNAPSHOT_FINISH_FAILURE; default: if (getParameters().getSnapshotAction() == SnapshotActionEnum.UNDO) { return AuditLogType.USER_UNDO_RESTORE_FROM_SNAPSHOT_FINISH_SUCCESS; } return AuditLogType.USER_COMMIT_RESTORE_FROM_SNAPSHOT_FINISH_SUCCESS; } }
Source:
private static void appendComposite(UriComponentsBuilder builder, String name, Object value) { if (value instanceof List) { for (Object valuePart : (List) value) { builder.queryParam(name, valuePart); } } else if (value instanceof Map) { Set<Map.Entry> valueEntries = ((Map) value).entrySet(); for (Map.Entry queryParam : valueEntries) { builder.queryParam(queryParam.getKey().toString(), queryParam.getValue()); } } }

Target:
private static void appendComposite(UriComponentsBuilder builder, String name, Object value) { if (value instanceof Iterable) { for (Object valuePart : (Iterable) value) { builder.queryParam(name, valuePart); } } else if (value instanceof Map) { Set<Map.Entry> valueEntries = ((Map) value).entrySet(); for (Map.Entry queryParam : valueEntries) { builder.queryParam(queryParam.getKey().toString(), queryParam.getValue()); } } else { builder.queryParam(name, value); } }
Source:
private User(Parcel in) { this.userID = in.readInt(); this.fullName = in.readString(); this.gender = in.readInt(); this.age = in.readInt(); this.phoneNumber = in.readString(); this.email = in.readString(); this.status = in.readInt(); this.housingPrice = in.readDouble(); this.bio = in.readString(); this.favoritesUserIDS = new ArrayList<Integer>(); in.readList(favoritesUserIDS, null); }

Target:
private User(Parcel in) { this.userID = in.readInt(); this.fullName = in.readString(); this.gender = in.readInt(); this.age = in.readInt(); this.phoneNumber = in.readString(); this.email = in.readString(); this.status = in.readInt(); this.housingPrice = in.readDouble(); this.bio = in.readString(); this.favoritedUserIDS = new ArrayList<Integer>(); in.readList(favoritedUserIDS, null); }
Source:
public String getAllReleasePlanWithAllItem() throws SQLException { List<IReleasePlanDesc> releaseDescs = mReleasePlanHelper.loadReleasePlansList(); List<ReleasePlanObject> releases = new ArrayList<ReleasePlanObject>(); for (IReleasePlanDesc releaseDesc : releaseDescs) { ReleasePlanObject releaseObject = new ReleasePlanObject(releaseDesc); List<SprintObject> sprints = releaseObject.getSprintPlan(); List<SprintObject> sprintsWithAllItem = new ArrayList<SprintObject>(); for (SprintObject sprint : sprints) { sprintsWithAllItem.add(mSprintPlanHelper.getSprint(sprint.mId)); } releaseObject.setSprintPlan(sprintsWithAllItem); releases.add(releaseObject); } return new Gson().toJson(releases); }

Target:
public String getAllReleasePlanWithAllItem() throws SQLException { List<IReleasePlanDesc> releaseDescs = mReleasePlanHelper.loadReleasePlansList(); List<ReleasePlanObject> releases = new ArrayList<ReleasePlanObject>(); for (IReleasePlanDesc releaseDesc : releaseDescs) { ReleasePlanObject releaseObject = new ReleasePlanObject(releaseDesc); List<SprintObject> sprints = releaseObject.getSprintPlan(); List<SprintObject> sprintsWithAllItem = new ArrayList<SprintObject>(); for (SprintObject sprint : sprints) { sprintsWithAllItem.add(mSprintPlanHelper.getSprint(String.valueOf(sprint.getId()))); } releaseObject.setSprintPlan(sprintsWithAllItem); releases.add(releaseObject); } return new Gson().toJson(releases); }
Source:
private String getGMTOffsetString(long millis) { long absmillis = (millis < 0) ? -millis : millis; int minutes = (int) ((absmillis / (1000 * 60)) % 60); int hours = (int) ((absmillis / (1000 * 60 * 60)) % 24); String builder = "(GMT" + ((millis >= 0) ? '+' : '-') + String.format("%02d:%02d", hours, minutes) + ") "; return builder; }

Target:
private String getGMTOffsetString(long millis) { long absmillis = (millis < 0) ? -millis : millis; int minutes = (int) ((absmillis / (1000 * 60)) % 60); int hours = (int) ((absmillis / (1000 * 60 * 60)) % 24); return String.format("(GMT%c%02d:%02d) ", millis >= 0 ? '+' : '-', hours, minutes); }
Source:
private int computeMessageScore(int messageNo, IMessage message) { return messageNo * (TransferSongMessage.class.isAssignableFrom( message.getClass()) ? TRANSFER_SONG_SCORE_MULTIPLIER : NORMAL_SCORE_MULTIPLIER); }

Target:
private int computeMessageScore(int messageNo, IMessage message) { int mult = NORMAL_SCORE_MULTIPLIER; if (TransferSongMessage.class.isAssignableFrom( message.getClass())) { mult = TRANSFER_SONG_SCORE_MULTIPLIER; } return messageNo * mult; }
Source:
protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder c = TestCacheManagerFactory.getDefaultCacheConfiguration(true); c.transaction().cacheStopTimeout(10000); c.memory().storageType(StorageType.OFF_HEAP); return TestCacheManagerFactory.createCacheManager(c); }

Target:
protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder c = TestCacheManagerFactory.getDefaultCacheConfiguration(true); c.transaction().cacheStopTimeout(10000); c.memory().storageType(storage); return TestCacheManagerFactory.createCacheManager(c); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((entityId == null) ? 0 : entityId.hashCode()); result = prime * result + ((entityType == null) ? 0 : entityType.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Objects.hashCode(entityId); result = prime * result + Objects.hashCode(entityType); return result; }
Source:
public String toString() { if (name.isPresent()) { String pattern = delimited ? "\"%s\" %s" : "%s %s"; return format(pattern, name.get(), typeSignature); } return typeSignature.toString(); }

Target:
public String toString() { if (fieldName.isPresent()) { return format("%s %s", fieldName.get(), typeSignature); } return typeSignature.toString(); }