auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void stopLifeCycle() { final AtomicBoolean isLifeCycleStopped = new AtomicBoolean(false); final AtomicBoolean isTimeout = new AtomicBoolean(false); final Display display = Display.getCurrent(); final Thread shutdownThread = ThreadUtils.runSafeAsync( "dpp-shutdown", log, () -> { try { lifecycle.stop(); } finally { isLifeCycleStopped.set(true); if (display != null) { try { display.wake(); } catch (SWTException ignore) { } } } }); isLifecycleStarted = false; int threadTimeout = 10000; if (display != null && !display.isDisposed()) { display.timerExec( threadTimeout, () -> { isTimeout.set(true); display.wake(); }); while (isLifeCycleStopped.get() == false && isTimeout.get() == false) { if (!display.readAndDispatch()) display.sleep(); } if (isLifeCycleStopped.get()) return; threadTimeout = 1; } try { shutdownThread.join(threadTimeout); } catch (InterruptedException e) { log.warn("interrupted while waiting for the plugin context to shutdown"); Thread.currentThread().interrupt(); } if (shutdownThread.isAlive()) log.error("could not shutdown Saros gracefully"); }

Target:
private void stopLifeCycle() { log.debug("stopping lifecycle..."); if (!isLifecycleStarted) { log.debug("lifecycle is already stopped"); return; } isLifecycleStarted = false; final AtomicBoolean isLifeCycleStopped = new AtomicBoolean(false); final AtomicBoolean isTimeout = new AtomicBoolean(false); final Display display = Display.getCurrent(); final Thread shutdownThread = ThreadUtils.runSafeAsync( "dpp-shutdown", log, () -> { try { lifecycle.stop(); } finally { isLifeCycleStopped.set(true); if (display != null) { try { display.wake(); } catch (SWTException ignore) { } } } }); int threadTimeout = 10000; if (display != null && !display.isDisposed()) { display.timerExec( threadTimeout, () -> { isTimeout.set(true); display.wake(); }); while (!isLifeCycleStopped.get() && !isTimeout.get()) { if (!display.readAndDispatch()) display.sleep(); } if (!isLifeCycleStopped.get()) threadTimeout = 1; } try { shutdownThread.join(threadTimeout); } catch (InterruptedException e) { log.warn("interrupted while waiting for the current lifecycle to stop"); Thread.currentThread().interrupt(); } if (shutdownThread.isAlive()) log.error("timeout while stopping lifecycle"); log.debug("lifecycle stopped"); }
Source:
private GitHubUser(GHUser gitHubUser, GitUser author) throws IOException { if (gitHubUser == null) { this.login = generateLogin(author.getName()); this.name = author.getName(); this.email = author.getEmail(); } else { this.login = gitHubUser.getLogin(); this.name = Objects.firstNonNull(Strings.emptyToNull(gitHubUser.getName()), author.getName()); this.email = Objects.firstNonNull(Strings.emptyToNull(gitHubUser.getEmail()), author.getEmail()); } }

Target:
private GitHubUser(GHUser gitHubUser, GitUser author) throws IOException { this.login = getLogin(gitHubUser).or(generateLogin(author.getName())); this.name = getFullName(gitHubUser).or(author.getName()); this.email = getEMail(gitHubUser).or(author.getEmail()); }
Source:
public List<User> getCollaborators(IRepositoryIdProvider repository) throws IOException { List<User> collaborators = super.getCollaborators(repository); List<User> collaboratorsWithFullDetails = new ArrayList<>(); collaborators.forEach(user -> { try { collaboratorsWithFullDetails.add(userService.getUser(user.getLogin())); } catch (IOException e) { logger.error("Unable to get full details for user " + user.getLogin()); } }); return collaboratorsWithFullDetails; }

Target:
public List<User> getCollaborators(IRepositoryIdProvider repository) throws IOException { return super.getCollaborators(repository).stream() .map(user -> { try { return userService.getUser(user.getLogin()); } catch (IOException e) { logger.warn("Unable to get full details for user " + user.getLogin()); return user; } }).collect(Collectors.toList()); }
Source:
public ChecksumDTO extract(final Jar jar, final Locale locale) { Objects.requireNonNull(jar, "jar"); Objects.requireNonNull(locale, "locale"); ChecksumDTO checksumDTO = new ChecksumDTO(); checksumDTO.md5 = calcChecksum(jar, "MD5"); checksumDTO.sha1 = calcChecksum(jar, "SHA-1"); checksumDTO.sha256 = calcChecksum(jar, "SHA-256"); if (checksumDTO.md5 == null && checksumDTO.sha1 == null && checksumDTO.sha256 == null) { return null; } return checksumDTO; }

Target:
public ChecksumDTO extract(final Jar jar, final Locale locale) { Objects.requireNonNull(jar, "jar"); Objects.requireNonNull(locale, "locale"); ChecksumDTO checksumDTO = new ChecksumDTO(); checksumDTO.md5 = calcChecksum(jar, MD5.ALGORITHM); checksumDTO.sha1 = calcChecksum(jar, SHA1.ALGORITHM); checksumDTO.sha256 = calcChecksum(jar, SHA256.ALGORITHM); checksumDTO.sha512 = calcChecksum(jar, SHA512.ALGORITHM); if (checksumDTO.md5 == null && checksumDTO.sha1 == null && checksumDTO.sha256 == null && checksumDTO.sha512 == null) { return null; } return checksumDTO; }
Source:
private TaskLauncher getReboundTaskLauncherIfStillExist() { TaskLauncher answer = null; boolean nodeConnected = false; boolean isPAMR = taskLauncherNodeUrl.startsWith("pamr://"); long initialTime = System.currentTimeMillis(); String nodeUrl = nodes.get(0).getNodeInformation().getURL(); do { try { logger.debug("List AOs on " + nodeUrl + " (expect only one): "); Object[] aos = NodeFactory.getNode(nodeUrl).getActiveObjects(); nodeConnected = true; logger.debug(Arrays.toString(aos)); answer = (TaskLauncher) aos[0]; } catch (NodeException t) { if (isPAMR) { logger.debug("Failed to access node " + nodeUrl); Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } } catch (Throwable t) { } pamrReconnectionTimeoutSpent = pamrReconnectionTimeoutSpent || (System.currentTimeMillis() - initialTime > 64000); } while (!nodeConnected && isPAMR && !pamrReconnectionTimeoutSpent); if (!nodeConnected || answer == null) { logger.warn("Failed to rebind TaskLauncher of task " + taskId + ". TaskLauncher with node URL: " + nodeUrl + " could not be looked up. Running task cannot be recovered, it will be restarted if possible."); answer = new TaskLauncher(); } return answer; }

Target:
private TaskLauncher getReboundTaskLauncherIfStillExist() { TaskLauncher answer = null; boolean nodeConnected = false; boolean isPAMR = taskLauncherNodeUrl.startsWith(PAMRRemoteObjectFactory.PROTOCOL_ID + "://"); long initialTime = System.currentTimeMillis(); String nodeUrl = nodes.get(0).getNodeInformation().getURL(); boolean taskLauncherFound = false; do { try { logger.debug("List AOs on " + nodeUrl + " (expect only one): "); Object[] aos = NodeFactory.getNode(nodeUrl).getActiveObjects(); nodeConnected = true; logger.debug(Arrays.toString(aos)); taskLauncherFound = aos.length > 0; if (!taskLauncherFound) { break; } answer = (TaskLauncher) aos[0]; } catch (NodeException t) { if (isPAMR) { logger.debug("Failed to access node " + nodeUrl); Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } } catch (Throwable t) { logger.warn("Error while retrieving task launcher", t); } pamrReconnectionTimeoutSpent = pamrReconnectionTimeoutSpent || (System.currentTimeMillis() - initialTime > Agent.MAXIMUM_RETRY_DELAY_MS); } while (!nodeConnected && isPAMR && !pamrReconnectionTimeoutSpent); if (!nodeConnected || answer == null) { logger.warn("Failed to rebind TaskLauncher of task " + taskId + ". TaskLauncher with node URL: " + nodeUrl + " could not be looked up. Running task cannot be recovered, it will be restarted if possible."); answer = new TaskLauncher(); } return answer; }
Source:
public ContentProtos.SegmentEvent.Builder serialize(SegmentEvent event) { Builder builder = ContentProtos.SegmentEvent.newBuilder(); if (event.getCanonicalUri() != null) { builder.setUri(event.getCanonicalUri()); } if (event.getIsChapter() != null) { builder.setChapter(event.getIsChapter()); } if (event.getOffset() != null) { builder.setOffset(event.getOffset().getMillis()); } if (event.getPosition() != null) { builder.setPosition(event.getPosition()); } if (event.getSegment() != null) { builder.setSegment(event.getId().toString()); } Description desc = event.getDescription(); if (desc != null) { if (desc.getTitle() != null) { builder.setTitle(desc.getTitle()); } if (desc.getSynopsis() != null) { builder.setDescription(desc.getSynopsis()); } if (desc.getImage() != null) { builder.setImage(desc.getImage()); } if (desc.getThumbnail() != null) { builder.setThumbnail(desc.getThumbnail()); } } return builder; }

Target:
public ContentProtos.SegmentEvent.Builder serialize(SegmentEvent event) { Builder builder = ContentProtos.SegmentEvent.newBuilder(); if (event.getCanonicalUri() != null) { builder.setUri(event.getCanonicalUri()); } if (event.getIsChapter() != null) { builder.setChapter(event.getIsChapter()); } if (event.getOffset() != null) { builder.setOffset(event.getOffset().getMillis()); } if (event.getPosition() != null) { builder.setPosition(event.getPosition()); } if (event.getSegment() != null) { builder.setSegmentRef(event.getSegment().getId().longValue()); } Description desc = event.getDescription(); if (desc != null) { if (desc.getTitle() != null) { builder.setTitle(desc.getTitle()); } if (desc.getSynopsis() != null) { builder.setDescription(desc.getSynopsis()); } if (desc.getImage() != null) { builder.setImage(desc.getImage()); } if (desc.getThumbnail() != null) { builder.setThumbnail(desc.getThumbnail()); } } return builder; }
Source:
public void onCompletion(String result, Exception exception) { callbackTracker.markOperationEnd(); ReadableStreamChannel response = null; if (result == null && exception == null) { throw new IllegalStateException("Both result and exception cannot be null"); } else if (exception == null) { try { RestMethod restMethod = restRequest.getRestMethod(); logger.trace("Forwarding of to the router", restMethod, result); switch (restMethod) { case GET: RestUtils.SubResource subresource = RestUtils.getBlobSubResource(restRequest); if (subresource == null || subresource.equals(RestUtils.SubResource.BlobInfo) || subresource .equals(RestUtils.SubResource.UserMetadata)) { getCallback.markStartTime(); GetOperationType getOperationType = getCallback.subResource != null ? GetOperationType.BlobInfo : GetOperationType.All; router.getBlob(result, new GetBlobOptions(getOperationType, null), getCallback); } else { switch (subresource) { case Replicas: response = getReplicasHandler.getReplicas(result, restResponseChannel); break; } } break; case HEAD: headCallback.markStartTime(); router.getBlob(result, new GetBlobOptions(GetOperationType.BlobInfo, null), headCallback); break; case DELETE: deleteCallback.markStartTime(); router.deleteBlob(result, deleteCallback); break; default: exception = new IllegalStateException("Unrecognized RestMethod: " + restMethod); } } catch (Exception e) { exception = e; } } if (response != null || exception != null) { submitResponse(restRequest, restResponseChannel, response, exception); } callbackTracker.markCallbackProcessingEnd(); }

Target:
public void onCompletion(String result, Exception exception) { callbackTracker.markOperationEnd(); ReadableStreamChannel response = null; if (result == null && exception == null) { throw new IllegalStateException("Both result and exception cannot be null"); } else if (exception == null) { try { RestMethod restMethod = restRequest.getRestMethod(); logger.trace("Forwarding of to the router", restMethod, result); switch (restMethod) { case GET: RestUtils.SubResource subresource = RestUtils.getBlobSubResource(restRequest); if (subresource == null || subresource.equals(RestUtils.SubResource.BlobInfo) || subresource .equals(RestUtils.SubResource.UserMetadata)) { getCallback.markStartTime(); GetBlobOptions.OperationType getOperationType = subresource != null ? GetBlobOptions.OperationType.BlobInfo : GetBlobOptions.OperationType.All; router.getBlob(result, new GetBlobOptions(getOperationType, null), getCallback); } else { switch (subresource) { case Replicas: response = getReplicasHandler.getReplicas(result, restResponseChannel); break; } } break; case HEAD: headCallback.markStartTime(); router.getBlob(result, new GetBlobOptions(GetBlobOptions.OperationType.BlobInfo, null), headCallback); break; case DELETE: deleteCallback.markStartTime(); router.deleteBlob(result, deleteCallback); break; default: exception = new IllegalStateException("Unrecognized RestMethod: " + restMethod); } } catch (Exception e) { exception = e; } } if (response != null || exception != null) { submitResponse(restRequest, restResponseChannel, response, exception); } callbackTracker.markCallbackProcessingEnd(); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setPresenter(mPresenter); setHasOptionsMenu(true); ((PatientDashboardDetailsPresenter) mPresenter).updatePatientDataFromServer(); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setPresenter(mPresenter); setHasOptionsMenu(true); }
Source:
public double eventElapsedTime(final String eventName) { final long currentTime = System.currentTimeMillis(); long startTime; synchronized (mEventTimings) { startTime = mEventTimings.get(eventName); } return (double)((currentTime - startTime) / 1000); }

Target:
public double eventElapsedTime(final String eventName) { final long currentTime = System.currentTimeMillis(); Long startTime; synchronized (mEventTimings) { startTime = mEventTimings.get(eventName); } return startTime == null ? 0 : (double)((currentTime - startTime) / 1000); }
Source:
default T create(JobContext jobContext, ContainerContext containerContext) { throw new UnsupportedOperationException("Please implement #create(ExternalContext, JobContext, ContainerContext) " + "directly, or at least override this version of create."); }

Target:
default T create(JobContext jobContext, ContainerContext containerContext) { throw new UnsupportedOperationException("Please implement a version of create for the factory implementation."); }
Source:
public ExceptionSupplier<DirContext, NamingException> create() { SocketFactory socketFactory; try { try { File workingDirCA = new File(CA_JKS_LOCATION); File trustFile = new File(workingDirCA, "ca.truststore"); if (trustFile.exists() == false) { setUp(); } } catch (Exception e) KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); keyStore.load(new FileInputStream(getClass().getResource("/ca/jks/ca.truststore").getFile()), PASSWORD); TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustFactory.init(keyStore); SSLContext context = SSLContext.getInstance("TLS"); context.init(null, trustFactory.getTrustManagers(), null); socketFactory = context.getSocketFactory(); } catch (Exception e) { throw new IllegalStateException(e); } return () -> SimpleDirContextFactoryBuilder.builder() .setProviderUrl(String.format("ldap://localhost:%d/", LDAP_PORT)) .setSecurityPrincipal(SERVER_DN) .setSecurityCredential(SERVER_CREDENTIAL) .setSocketFactory(socketFactory) .build().obtainDirContext(DirContextFactory.ReferralMode.IGNORE); }

Target:
public ExceptionSupplier<DirContext, NamingException> create() { SocketFactory socketFactory; try { File workingDirCA = new File(CA_JKS_LOCATION); File trustFile = new File(workingDirCA, "ca.truststore"); if (trustFile.exists() == false) { setUp(); } KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); keyStore.load(new FileInputStream(getClass().getResource("/ca/jks/ca.truststore").getFile()), PASSWORD); TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustFactory.init(keyStore); SSLContext context = SSLContext.getInstance("TLS"); context.init(null, trustFactory.getTrustManagers(), null); socketFactory = context.getSocketFactory(); } catch (Exception e) { throw new IllegalStateException(e); } return () -> SimpleDirContextFactoryBuilder.builder() .setProviderUrl(String.format("ldap://localhost:%d/", LDAP_PORT)) .setSecurityPrincipal(SERVER_DN) .setSecurityCredential(SERVER_CREDENTIAL) .setSocketFactory(socketFactory) .build().obtainDirContext(DirContextFactory.ReferralMode.IGNORE); }
Source:
public OracleMillisecondDiffFunction() { super("1000 * (extract(second from cast(?2 as timestamp) - cast(?1 as timestamp))\n" + " + 60 * (extract(minute from cast(?2 as timestamp) - cast(?1 as timestamp))\n" + " + 60 * (extract(hour from cast(?2 as timestamp) - cast(?1 as timestamp))\n" + " + 24 * (extract(day from cast(?2 as timestamp) - cast(?1 as timestamp))))))"); this.bothParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from t2 - t1)\n" + " + 60 * (extract(minute from t2 - t1)\n" + " + 60 * (extract(hour from t2 - t1)\n" + " + 24 * (extract(day from t2 - t1))))) " + "from (select cast(?1 as timestamp) as t1, cast(?2 as timestamp) as t2 from dual))"); this.firstParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from cast(?2 as timestamp) - t1)\n" + " + 60 * (extract(minute from cast(?2 as timestamp) - t1)\n" + " + 60 * (extract(hour from cast(?2 as timestamp) - t1)\n" + " + 24 * (extract(day from cast(?2 as timestamp) - t1))))) " + "from (select cast(?1 as timestamp) as t1 from dual))"); this.secondParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from t2 - cast(?1 as timestamp))\n" + " + 60 * (extract(minute from t2 - cast(?1 as timestamp))\n" + " + 60 * (extract(hour from t2 - cast(?1 as timestamp))\n" + " + 24 * (extract(day from t2 - cast(?1 as timestamp)))))) " + "from (select cast(?2 as timestamp) as t2 from dual))"); }

Target:
public OracleMillisecondDiffFunction() { super("1000 * (extract(second from cast(?2 as timestamp) - cast(?1 as timestamp))" + " + 60 * (extract(minute from cast(?2 as timestamp) - cast(?1 as timestamp))" + " + 60 * (extract(hour from cast(?2 as timestamp) - cast(?1 as timestamp))" + " + 24 * (extract(day from cast(?2 as timestamp) - cast(?1 as timestamp))))))"); this.bothParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from t2 - t1)" + " + 60 * (extract(minute from t2 - t1)" + " + 60 * (extract(hour from t2 - t1)" + " + 24 * (extract(day from t2 - t1))))) " + "from (select cast(?1 as timestamp) as t1, cast(?2 as timestamp) as t2 from dual))"); this.firstParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from cast(?2 as timestamp) - t1)" + " + 60 * (extract(minute from cast(?2 as timestamp) - t1)" + " + 60 * (extract(hour from cast(?2 as timestamp) - t1)" + " + 24 * (extract(day from cast(?2 as timestamp) - t1))))) " + "from (select cast(?1 as timestamp) as t1 from dual))"); this.secondParamRenderer = new TemplateRenderer("(select 1000 * (extract(second from t2 - cast(?1 as timestamp))" + " + 60 * (extract(minute from t2 - cast(?1 as timestamp))" + " + 60 * (extract(hour from t2 - cast(?1 as timestamp))" + " + 24 * (extract(day from t2 - cast(?1 as timestamp)))))) " + "from (select cast(?2 as timestamp) as t2 from dual))"); }
Source:
protected void killSpawnedThreads() { List<Runnable> runnables = defaultExecutorService.shutdownNow(); log.errorf("There were runnables %s left uncompleted in test %s", runnables, getClass().getSimpleName()); for (TrackingThreadFactory factory : requestedThreadFactories) { checkFactoryForLeaks(factory); } }

Target:
protected void killSpawnedThreads() { List<Runnable> runnables = defaultExecutorService.shutdownNow(); if (!runnables.isEmpty()) { log.errorf("There were runnables %s left uncompleted in test %s", runnables, getClass().getSimpleName()); } for (TrackingThreadFactory factory : requestedThreadFactories) { checkFactoryForLeaks(factory); } }
Source:
private void initView(Context context) { inflate(context, R.layout.reader_related_posts_view, this); mFeaturedImageWidth = DisplayUtils.dpToPx(getContext(), getResources().getDimensionPixelSize(R.dimen.reader_related_post_image_width)); }

Target:
private void initView(Context context) { inflate(context, R.layout.reader_related_posts_view, this); mFeaturedImageWidth = DisplayUtils.dpToPx(context, context.getResources().getDimensionPixelSize(R.dimen.reader_related_post_image_width)); }
Source:
void start() { long start_ms = System.currentTimeMillis(); long delta_s = 0; FileInputStream sd_pipe = null; try { sd_pipe = new FileInputStream(appConfig.getServiceDiscoveryPipe()); } catch (FileNotFoundException e) { LOGGER.warn("Unable to open named pipe - Service Discovery disabled."); sd_pipe = null; } while (true) { if (appConfig.getExitWatcher().shouldExit()){ LOGGER.info("Exit file detected: stopping JMXFetch."); System.exit(0); } try { if(sd_pipe != null && sd_pipe.available() > 0) { int len = sd_pipe.available(); byte[] buffer = new byte[len]; sd_pipe.read(buffer); reinit.set(process_service_discovery(buffer)); } } catch(IOException e) { LOGGER.warn("Unable to read from pipe - Service Discovery configuration may have been skipped."); } long start = System.currentTimeMillis(); if (this.reinit.get()) { init(true); } if (instances.size() > 0) { doIteration(); } else { LOGGER.warn("No instance could be initiated. Retrying initialization."); appConfig.getStatus().flush(); configs = getConfigs(appConfig); init(true); } long length = System.currentTimeMillis() - start; LOGGER.debug("Iteration ran in " + length + " ms"); try { int loopPeriod = appConfig.getCheckPeriod(); LOGGER.debug("Sleeping for " + loopPeriod + " ms."); Thread.sleep(loopPeriod); } catch (InterruptedException e) { LOGGER.warn(e.getMessage(), e); } } }

Target:
void start() { long start_ms = System.currentTimeMillis(); long delta_s = 0; FileInputStream sdPipe = null; try { sdPipe = new FileInputStream(appConfig.getServiceDiscoveryPipe()); } catch (FileNotFoundException e) { LOGGER.warn("Unable to open named pipe - Service Discovery disabled."); sdPipe = null; } while (true) { if (appConfig.getExitWatcher().shouldExit()){ LOGGER.info("Exit file detected: stopping JMXFetch."); System.exit(0); } try { if(sdPipe != null && sdPipe.available() > 0) { int len = sdPipe.available(); byte[] buffer = new byte[len]; sdPipe.read(buffer); setReinit(processServiceDiscovery(buffer)); } } catch(IOException e) { LOGGER.warn("Unable to read from pipe - Service Discovery configuration may have been skipped."); } long start = System.currentTimeMillis(); if (this.reinit.get()) { init(true); } if (instances.size() > 0) { doIteration(); } else { LOGGER.warn("No instance could be initiated. Retrying initialization."); appConfig.getStatus().flush(); configs = getConfigs(appConfig); init(true); } long length = System.currentTimeMillis() - start; LOGGER.debug("Iteration ran in " + length + " ms"); try { int loopPeriod = appConfig.getCheckPeriod(); LOGGER.debug("Sleeping for " + loopPeriod + " ms."); Thread.sleep(loopPeriod); } catch (InterruptedException e) { LOGGER.warn(e.getMessage(), e); } } }
Source:
public boolean isAttachedLabel(String user, String labelId) throws APIManagementException { APIProviderImpl apiProvider = new APIProviderImpl(user); List<API> apiList = apiProvider.getAllAPIs(); List<Label> allLabelsWithID = getAllLabels(MultitenantUtils.getTenantDomain(user)); String labelName = null; for (Label label : allLabelsWithID) { if (labelId.equalsIgnoreCase(label.getLabelId())) { labelName = label.getName(); break; } } if (labelName != null && !labelName.isEmpty()) { UserAwareAPIProvider userAwareAPIProvider = new UserAwareAPIProvider(user); for (API api : apiList) { String uuid = api.getUUID(); API lightweightAPIByUUID = userAwareAPIProvider.getLightweightAPIByUUID(uuid, apiProvider.tenantDomain); List<Label> attachedLabelsWithoutID = lightweightAPIByUUID.getGatewayLabels(); for (Label labelWithoutId : attachedLabelsWithoutID) { if (labelName.equalsIgnoreCase(labelWithoutId.getName())) { return true; } } } } return false; }

Target:
public boolean isAttachedLabel(String user, String labelId) throws APIManagementException { APIProviderImpl apiProvider = new APIProviderImpl(user); List<API> apiList = apiProvider.getAllAPIs(); List<Label> allLabelsWithID = getAllLabels(MultitenantUtils.getTenantDomain(user)); String labelName = null; for (Label label : allLabelsWithID) { if (labelId.equalsIgnoreCase(label.getLabelId())) { labelName = label.getName(); break; } } if (labelName != null && StringUtils.isEmpty(labelName)) { UserAwareAPIProvider userAwareAPIProvider = new UserAwareAPIProvider(user); for (API api : apiList) { String uuid = api.getUUID(); API lightweightAPIByUUID = userAwareAPIProvider.getLightweightAPIByUUID(uuid, apiProvider. tenantDomain); List<Label> attachedLabelsWithoutID = lightweightAPIByUUID.getGatewayLabels(); for (Label labelWithoutId : attachedLabelsWithoutID) { if (labelName.equalsIgnoreCase(labelWithoutId.getName())) { return true; } } } } return false; }
Source:
protected ZonedDateTime parseDatestamp(String line, ParseInformation pos) { ZonedDateTime zonedDateTime = null; if (nextIsDatestamp(line, pos)) { zonedDateTime = ZonedDateTime.parse(line.substring(pos.getIndex(), pos.getIndex()+LENGTH_OF_DATESTAMP-1), DATE_TIME_FORMATTER); pos.setIndex(pos.getIndex() + LENGTH_OF_DATESTAMP); if (pos.getFirstDateStamp() == null) { pos.setFirstDateStamp(zonedDateTime); } } return zonedDateTime; }

Target:
protected ZonedDateTime parseDatestamp(String line, ParseInformation pos) throws ParseException { ZonedDateTime zonedDateTime = null; if (nextIsDatestamp(line, pos)) { try { zonedDateTime = ZonedDateTime.parse(line.substring(pos.getIndex(), pos.getIndex() + LENGTH_OF_DATESTAMP - 1), DATE_TIME_FORMATTER); pos.setIndex(pos.getIndex() + LENGTH_OF_DATESTAMP); if (pos.getFirstDateStamp() == null) { pos.setFirstDateStamp(zonedDateTime); } } catch (DateTimeParseException e){ throw new ParseException(e.toString(), line); } } return zonedDateTime; }
Source:
public DataSize getWrittenDataSize() { return succinctBytes( operatorSummaries.stream() .filter(stats -> stats.getOperatorType().equals(TableWriterOperator.class.getSimpleName())) .map(stats -> stats.getInputDataSize().toBytes()) .reduce(0L, Long::sum)); }

Target:
public DataSize getWrittenDataSize() { return succinctBytes( operatorSummaries.stream() .filter(stats -> stats.getOperatorType().equals(TableWriterOperator.class.getSimpleName())) .mapToLong(stats -> stats.getInputDataSize().toBytes()) .sum()); }
Source:
private void processRegister(final UserConfigurationResponse response) { try { TransactionManager.callInTransaction(app.getDatabaseHelper() .getConnectionSource(), new Callable<Void>() { public Void call() throws Exception { List<Stream> subscriptions = response.getSubscriptions(); app.addToMutedTopics(response.getMutedTopics()); RuntimeExceptionDao<Stream, Object> streamDao = app .getDao(Stream.class); Log.i("stream", "" + subscriptions.size() + " streams"); streamDao.updateBuilder().updateColumnValue( Stream.SUBSCRIBED_FIELD, false); for (int i = 0; i < subscriptions.size(); i++) { Stream stream = subscriptions.get(i); stream.getParsedColor(); stream.setSubscribed(true); try { streamDao.createOrUpdate(stream); } catch(Exception e) { ZLog.logException(e); } } List<Person> people = response.getRealmUsers(); RuntimeExceptionDao<Person, Object> personDao = app .getDao(Person.class); personDao.updateBuilder().updateColumnValue( Person.ISACTIVE_FIELD, false); for (int i = 0; i < people.size(); i++) { Person person = people.get(i); person.setActive(true); try { personDao.createOrUpdate(person); } catch(Exception e) { ZLog.logException(e); } } return null; } }); activity.runOnUiThread(new Runnable() { @Override public void run() { that.activity.getPeopleAdapter().refresh(); activity.onReadyToDisplay(true); activity.checkAndSetupStreamsDrawer(); } }); } catch (SQLException e) { ZLog.logException(e); } }

Target:
private void processRegister(final UserConfigurationResponse response) { try { TransactionManager.callInTransaction(app.getDatabaseHelper() .getConnectionSource(), new Callable<Void>() { public Void call() throws Exception { List<Stream> subscriptions = response.getSubscriptions(); RuntimeExceptionDao<Stream, Object> streamDao = app .getDao(Stream.class); Log.i("stream", "" + subscriptions.size() + " streams"); streamDao.updateBuilder().updateColumnValue( Stream.SUBSCRIBED_FIELD, false); for (int i = 0; i < subscriptions.size(); i++) { Stream stream = subscriptions.get(i); stream.getParsedColor(); stream.setSubscribed(true); try { streamDao.createOrUpdate(stream); } catch(Exception e) { ZLog.logException(e); } } app.addToMutedTopics(response.getMutedTopics()); List<Person> people = response.getRealmUsers(); RuntimeExceptionDao<Person, Object> personDao = app .getDao(Person.class); personDao.updateBuilder().updateColumnValue( Person.ISACTIVE_FIELD, false); for (int i = 0; i < people.size(); i++) { Person person = people.get(i); person.setActive(true); try { personDao.createOrUpdate(person); } catch(Exception e) { ZLog.logException(e); } } return null; } }); if (!calledFromWidget) { activity.runOnUiThread(new Runnable() { @Override public void run() { that.activity.getPeopleAdapter().refresh(); activity.onReadyToDisplay(true); activity.checkAndSetupStreamsDrawer(); } }); } } catch (SQLException e) { ZLog.logException(e); } }
Source:
public DetailView() { BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(layout); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); }

Target:
public DetailView() { BoxLayout layout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(layout); setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER)); }
Source:
public static AbstractRecord create (int type) { try { Class recordClass = RecordType.typeToClass(type); return (AbstractRecord) recordClass.newInstance(); } catch (final NullPointerException ex) { tsLogger.i18NLogger.warn_coordinator_AbstractRecord_npe(Integer.toString(type)); return null; } catch (final Throwable ex) { try { Class rt = RecordType.typeToClass(type); String className = (rt == null) ? "null" : rt.getName(); int mb = 1024 * 1024; Runtime runtime = Runtime.getRuntime(); long used = (runtime.totalMemory() - runtime.freeMemory()) / mb; long free = runtime.freeMemory() / mb; tsLogger.i18NLogger.warn_coordinator_AbstractRecord_create_failure( type, className, used, free, ex); } catch (final Throwable t) { ex.printStackTrace(); } return null; } }

Target:
public static AbstractRecord create (int type) { try { Class recordClass = RecordType.typeToClass(type); return (AbstractRecord) recordClass.newInstance(); } catch (final NullPointerException ex) { tsLogger.i18NLogger.warn_coordinator_AbstractRecord_npe(Integer.toString(type)); return null; } catch (final Throwable ex) { Class rt = RecordType.typeToClass(type); String className = (rt == null) ? "null" : rt.getName(); tsLogger.i18NLogger.warn_coordinator_AbstractRecord_create_failure(type, className); ex.printStackTrace(); return null; } }
Source:
public String getDescription() { return description; }

Target:
public EntityModel<String> getDescription() { return privateDescription; }
Source:
public void setSeek(SeekCommand seekCommand) { this.fSeek = seekCommand; }

Target:
public void setSeek(SeekCommand seekCommand) { fSeek = seekCommand; }
Source:
public void setDosingInstructions_shouldBeSetCorrectly() { DrugOrder drugOrder = new DrugOrder(); ChemoDosingInstructions chemoDosingInstructions = new ChemoDosingInstructions(); chemoDosingInstructions.setDosageAdjustmentPercentage(20.04); chemoDosingInstructions.setDosageDilutionInstructions("10% diluted"); String shouldBeResult = "Dosage Adjustment Percentage : 20.04\nDosage Dilution Instructions : 10% diluted\n"; chemoDosingInstructions.setDosingInstructions(drugOrder); Assert.assertEquals(drugOrder.getDosingType(), ChemoDosingInstructions.class); Assert.assertEquals(drugOrder.getDosingInstructions(), shouldBeResult); }

Target:
public void setDosingInstructions_shouldBeSetCorrectly() { DrugOrder drugOrder = new DrugOrder(); ChemoDosingInstructions chemoDosingInstructions = new ChemoDosingInstructions(); chemoDosingInstructions.setDosageAdjustmentPercentage(ADJUSTMENT_PERCENTAGE_CONSTANT); chemoDosingInstructions.setDosageDilutionInstructions(DILUTION_INSTRUCTIONS_CONSTANT); String shouldBeResult = ADJUSTMENT_PERCENTAGE + ADJUSTMENT_PERCENTAGE_CONSTANT + "\n" + DILUTION_INSTRUCTIONS + DILUTION_INSTRUCTIONS_CONSTANT + "\n"; chemoDosingInstructions.setDosingInstructions(drugOrder); Assert.assertEquals(drugOrder.getDosingType(), ChemoDosingInstructions.class); Assert.assertEquals(drugOrder.getDosingInstructions(), shouldBeResult); }
Source:
Map getObjectsToBeDispatched() { return mObjectsToBeDispatched; }

Target:
Map<String, List<IEvents>> getObjectsToBeDispatched() { return mObjectsToBeDispatched; }
Source:
private SelectionScript replaceBindings(SelectionScript script, Map<String, Serializable> bindings) { String scriptContent = script.getScript(); if (bindings != null) { for (Map.Entry<String, Serializable> entry : bindings.entrySet()) { String reservedKeyword = entry.getKey(); Serializable binding = entry.getValue(); if (binding instanceof Map) { scriptContent = replaceBindingKeysByTheirValue(scriptContent, (Map<String, Serializable>) binding); } else { scriptContent = scriptContent.replace(reservedKeyword, binding.toString()); } } } try { return new SelectionScript(scriptContent, script.getEngineName(), script.getParameters(), script.isDynamic()); } catch (InvalidScriptException e) { logger.warn("Error when replacing bindings of script (revert to use original script):" + System.lineSeparator() + script.toString(), e); return script; } }

Target:
private SelectionScript replaceBindings(SelectionScript script, Map<String, Serializable> bindings) { String scriptContent = script.getScript(); if (bindings != null) { for (Map.Entry<String, Serializable> entry : bindings.entrySet()) { String reservedKeyword = entry.getKey(); Serializable binding = entry.getValue(); if (binding instanceof Map) { scriptContent = replaceBindingKeysByTheirValue(scriptContent, (Map<String, Serializable>) binding); } else { if (binding != null) { scriptContent = scriptContent.replace(reservedKeyword, binding.toString()); } } } } try { return new SelectionScript(scriptContent, script.getEngineName(), script.getParameters(), script.isDynamic()); } catch (InvalidScriptException e) { logger.warn("Error when replacing bindings of script (revert to use original script):" + System.lineSeparator() + script.toString(), e); return script; } }
Source:
public boolean apply(Map.Entry mapEntry) { Thread.dumpStack(); PREDICATE_APPLY_COUNT.incrementAndGet(); return true; }

Target:
public boolean apply(Map.Entry mapEntry) { PREDICATE_APPLY_COUNT.incrementAndGet(); return true; }
Source:
private String[] addFilePathToArgs(String actualFilePath, String[] configuredArgs) { int argCount = configuredArgs.length; String[] allArgs = new String[argCount + 1]; System.arraycopy(configuredArgs, 0, allArgs, 1, argCount); allArgs[0] = actualFilePath; return allArgs; }

Target:
private String[] addFilePathToArgs(String actualFilePath, String[] configuredArgs) { int argCount = configuredArgs.length; String[] allArgs = new String[argCount + 1]; allArgs[0] = actualFilePath; System.arraycopy(configuredArgs, 0, allArgs, 1, argCount); return allArgs; }
Source:
public void createNamespaceWithNamespaceLengthLimit() throws AccumuloException, AccumuloSecurityException, NamespaceExistsException { StringBuilder namespaceBuilder = new StringBuilder(); for (int i = 0; i <= MAX_NAMESPACE_LEN; i++) { namespaceBuilder.append('a'); } String namespace = namespaceBuilder.toString(); c.namespaceOperations().create(namespace); assertTrue(!c.namespaceOperations().exists(namespace)); }

Target:
public void createNamespaceWithNamespaceLengthLimit() throws AccumuloException, AccumuloSecurityException, NamespaceExistsException { StringBuilder namespaceBuilder = new StringBuilder(); for (int i = 0; i <= MAX_NAMESPACE_LEN; i++) { namespaceBuilder.append('a'); } String namespace = namespaceBuilder.toString(); try { c.namespaceOperations().create(namespace); fail("IllegalArgumentException was not thrown"); } catch (IllegalArgumentException exc) { assertTrue(!c.namespaceOperations().exists(namespace)); } }
Source:
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { if (!StringUtils.hasText(element.getAttribute(CHANNEL_ATTRIBUTE))) { parserContext.getReaderContext().error( "'" + CHANNEL_ATTRIBUTE + "' attribute is required.", element); } else if (!StringUtils.hasText(element.getAttribute(CACHE_ATTRIBUTE))) { parserContext.getReaderContext().error( "'" + CACHE_ATTRIBUTE + "' attribute is required.", element); } else if (!StringUtils.hasText(element.getAttribute(CACHE_EVENTS_ATTRIBUTE))) { parserContext.getReaderContext().error( "'" + CACHE_EVENTS_ATTRIBUTE + "' attribute is required.", element); } else if (!StringUtils.hasText(element.getAttribute(CACHE_LISTENING_POLICY_ATTRIBUTE))) { parserContext.getReaderContext().error( "'" + CACHE_LISTENING_POLICY_ATTRIBUTE + "' attribute is required.", element); } Assert.isTrue(HazelcastIntegrationDefinitionValidator.validateEnumType( CacheEventType.class, element.getAttribute(CACHE_EVENTS_ATTRIBUTE))); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, CHANNEL_ATTRIBUTE, OUTPUT_CHANNEL); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, CACHE_ATTRIBUTE, DISTRIBUTED_OBJECT); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, CACHE_EVENTS_ATTRIBUTE, CACHE_EVENT_TYPES); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, CACHE_LISTENING_POLICY_ATTRIBUTE, CACHE_LISTENING_POLICY); }

Target:
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { String channelName = element.getAttribute(CHANNEL_ATTRIBUTE); if (!StringUtils.hasText(channelName)) { channelName = IntegrationNamespaceUtils.createDirectChannel(element, parserContext); } if (!StringUtils.hasText(element.getAttribute(CACHE_ATTRIBUTE))) { parserContext.getReaderContext().error("'" + CACHE_ATTRIBUTE + "' attribute is required.", element); } else if (!StringUtils.hasText(element.getAttribute(CACHE_EVENTS_ATTRIBUTE))) { parserContext.getReaderContext().error("'" + CACHE_EVENTS_ATTRIBUTE + "' attribute is required.", element); } else if (!StringUtils.hasText(element.getAttribute(CACHE_LISTENING_POLICY_ATTRIBUTE))) { parserContext.getReaderContext().error("'" + CACHE_LISTENING_POLICY_ATTRIBUTE + "' attribute is required.", element); } builder.addPropertyReference(OUTPUT_CHANNEL, channelName); builder.addConstructorArgReference(element.getAttribute(CACHE_ATTRIBUTE)); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, CACHE_EVENTS_ATTRIBUTE, CACHE_EVENT_TYPES); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, CACHE_LISTENING_POLICY_ATTRIBUTE); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IntegrationNamespaceUtils.AUTO_STARTUP); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, IntegrationNamespaceUtils.PHASE); }
Source:
public void completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage) { initialize(); validateExitInformation(executionId, exitCode, endTime); exitMessage = trimExitMessage(exitMessage); taskExecutionDao.completeTaskExecution(executionId, exitCode, endTime, exitMessage); logger.info("Updating: TaskExecution with executionId="+executionId + " with the following {" + "exitCode=" + exitCode + ", endTime=" + endTime + ", exitMessage='" + exitMessage + '\'' + '}'); }

Target:
public void completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage) { initialize(); validateExitInformation(executionId, exitCode, endTime); exitMessage = trimExitMessage(exitMessage); taskExecutionDao.completeTaskExecution(executionId, exitCode, endTime, exitMessage); logger.debug("Updating: TaskExecution with executionId="+executionId + " with the following {" + "exitCode=" + exitCode + ", endTime=" + endTime + ", exitMessage='" + exitMessage + '\'' + '}'); }
Source:
public long writeTo(WritableByteChannel channel) throws IOException { long written = 0; if (sentBytes < sizeInBytes()) { if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.position(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.serializeBlobProperties(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.putShort((short) blobType.ordinal()); if (getVersionId() == PUT_REQUEST_VERSION_V4) { short keyLength = blobKey == null ? 0 : (short) blobKey.length; bufferToSend.putShort(keyLength); if (keyLength > 0) { bufferToSend.put(blobKey); } } bufferToSend.putLong(blobSize); crc.update(bufferToSend.array(), bufferToSend.arrayOffset() + crcStart, bufferToSend.position() - crcStart); crc.update(blob.array(), blob.arrayOffset(), blob.remaining()); crcBuf.putLong(crc.getValue()); crcBuf.flip(); bufferToSend.flip(); } if (bufferToSend.hasRemaining()) { written = channel.write(bufferToSend); } if (!bufferToSend.hasRemaining()) { written += channel.write(blob); okayToWriteCrc = !blob.hasRemaining(); } if (okayToWriteCrc && crcBuf.hasRemaining()) { written += channel.write(crcBuf); } sentBytes += written; } return written; }

Target:
public long writeTo(WritableByteChannel channel) throws IOException { long written = 0; if (sentBytes < sizeInBytes()) { if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.position(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.serializeBlobProperties(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.putShort((short) blobType.ordinal()); if (getVersionId() == PUT_REQUEST_VERSION_V4) { short keyLength = blobKey == null ? 0 : (short) blobKey.remaining(); bufferToSend.putShort(keyLength); if (keyLength > 0) { bufferToSend.put(blobKey); } } bufferToSend.putLong(blobSize); crc.update(bufferToSend.array(), bufferToSend.arrayOffset() + crcStart, bufferToSend.position() - crcStart); crc.update(blob.array(), blob.arrayOffset(), blob.remaining()); crcBuf.putLong(crc.getValue()); crcBuf.flip(); bufferToSend.flip(); } if (bufferToSend.hasRemaining()) { written = channel.write(bufferToSend); } if (!bufferToSend.hasRemaining()) { written += channel.write(blob); okayToWriteCrc = !blob.hasRemaining(); } if (okayToWriteCrc && crcBuf.hasRemaining()) { written += channel.write(crcBuf); } sentBytes += written; } return written; }
Source:
private Map<Guid, List<VM>> mapVmToHost(List<VM> vms) { Map<Guid, List<VM>> hostToHaVmsMapping = new HashMap<Guid, List<VM>>(); for (VM vm : vms) { if (vm.getRunOnVds() != null) { if (!hostToHaVmsMapping.containsKey(vm.getRunOnVds())) { List<VM> vmsOfHost = new ArrayList<VM>(); vmsOfHost.add(vm); hostToHaVmsMapping.put(vm.getRunOnVds(), vmsOfHost); } else { hostToHaVmsMapping.get(vm.getRunOnVds()).add(vm); } } } return hostToHaVmsMapping; }

Target:
public static Map<Guid, List<VM>> mapVmToHost(List<VM> vms) { Map<Guid, List<VM>> hostToHaVmsMapping = new HashMap<>(); for (VM vm : vms) { if (!Guid.isNullOrEmpty(vm.getRunOnVds())) { if (!hostToHaVmsMapping.containsKey(vm.getRunOnVds())) { List<VM> vmsOfHost = new ArrayList<VM>(); vmsOfHost.add(vm); hostToHaVmsMapping.put(vm.getRunOnVds(), vmsOfHost); } else { hostToHaVmsMapping.get(vm.getRunOnVds()).add(vm); } } } return hostToHaVmsMapping; }
Source:
public void shortCircuitingEnabledWithExplicitModuleCounts() throws InterruptedException { String streamName = "shortCircuitingEnabledWithExplicitModuleCounts"; StreamDefinition sd = new StreamDefinition(streamName, "http | log"); integrationSupport.streamDefinitionRepository().save(sd); Map<String, String> props = new HashMap<String, String>(); props.put("module.http.count", "0"); props.put("module.log.count", "0"); integrationSupport.deployStream(sd, props); List<Binding> bindings = getMessageBusBindingsForStream(streamName); System.out.println(bindings); assertEquals(2, bindings.size()); Binding consumerBinding = bindings.get(0); Binding producerBinding = bindings.get(1); assertEquals("consumer", consumerBinding.getType()); assertEquals("direct", producerBinding.getType()); }

Target:
public void shortCircuitingEnabledWithExplicitModuleCounts() throws InterruptedException { String streamName = "shortCircuitingEnabledWithExplicitModuleCounts"; StreamDefinition sd = new StreamDefinition(streamName, "http | log"); integrationSupport.streamDefinitionRepository().save(sd); Map<String, String> props = new HashMap<String, String>(); props.put("module.http.count", "0"); props.put("module.log.count", "0"); integrationSupport.deployStream(sd, props); List<Binding> bindings = getMessageBusBindingsForStream(streamName); assertEquals(2, bindings.size()); Binding consumerBinding = bindings.get(0); Binding producerBinding = bindings.get(1); assertEquals("consumer", consumerBinding.getType()); assertEquals("direct", producerBinding.getType()); }
Source:
public static int compareRpmPart(String part1, String part2) { String[] comps1 = part1.split("\\."); String[] comps2 = part2.split("\\."); int i = 0; while (i < comps1.length && i < comps2.length && comps1[i].equals(comps2[i])) { i++; } if (i == comps1.length && i == comps2.length) { return 0; } else if (i == comps1.length) { return -1; } else if (i == comps2.length) { return 1; } else { try { Long result1 = Long.parseLong(comps1[i]); Long result2 = Long.parseLong(comps2[i]); return result1.compareTo(result2); } catch (NumberFormatException ex) { return comps1[i].compareTo(comps2[i]); } } }

Target:
public static int compareRpmPart(String part1, String part2) { StringBuilder[] comps1 = fillCompsArray(part1); StringBuilder[] comps2 = fillCompsArray(part2); int counter = 0; while (comps1[counter] != null && comps2[counter] != null && comps1[counter].toString().equals(comps2[counter].toString())) { counter++; } if (counter == comps2.length) { return 1; } if (counter == comps1.length) { return -1; } Long longVal1 = parseLong(comps1[counter].toString()); Long longVal2 = parseLong(comps2[counter].toString()); if (longVal1 == null && longVal2 == null) { return comps1[counter].toString().compareTo(comps2[counter].toString()); } if (longVal1 != null && longVal2 != null) { return longVal1.compareTo(longVal2); } if (longVal1 == null) { return -1; } if (longVal2 == null) { return 1; } return 0; }
Source:
protected AddCinderStorageDomainCommand(Guid commandId) { super(commandId); }

Target:
public AddCinderStorageDomainCommand(Guid commandId) { super(commandId); }