auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String findAuthorOwnedBy(HazelcastInstance hz) { int ownedKey = 0; Member localMember = hz.getCluster().getLocalMember(); for (int i = 0; i < BOOK_COUNT; i++) { if (localMember.equals(hz.getPartitionService().getPartition(i).getOwner())) { ownedKey = i; break; } } return String.valueOf(ownedKey % 7); }

Target:
private String findAuthorOwnedBy(HazelcastInstance hz) { int ownedKey = 0; Member localMember = hz.getCluster().getLocalMember(); for (int i = 0; i < BOOK_COUNT; i++) { if (localMember.equals(hz.getPartitionService().getPartition(i).getOwner())) { ownedKey = i; break; } } return getAuthorNameByKey(ownedKey); }
Source:
public void createProject() { Script script; brickPosition = 1; ifBrick = new PhiroIfLogicBeginBrick(); IfLogicElseBrick ifLogicElseBrick = new IfLogicElseBrick(ifBrick); IfLogicEndBrick ifLogicEndBrick = new IfLogicEndBrick(ifLogicElseBrick, ifBrick); ifBrick.setIfElseBrick(ifLogicElseBrick); ifBrick.setIfEndBrick(ifLogicEndBrick); script = BrickTestUtils.createProjectAndGetStartScript("PhiroIfBrickTest"); script.addBrick(ifBrick); script.addBrick(ifLogicElseBrick); script.addBrick(ifLogicEndBrick); }

Target:
public void createProject() { brickPosition = 1; ifBrick = new PhiroIfLogicBeginBrick(); IfLogicElseBrick ifLogicElseBrick = new IfLogicElseBrick(ifBrick); IfLogicEndBrick ifLogicEndBrick = new IfLogicEndBrick(ifLogicElseBrick, ifBrick); ifBrick.setIfElseBrick(ifLogicElseBrick); ifBrick.setIfEndBrick(ifLogicEndBrick); Script script = BrickTestUtils.createProjectAndGetStartScript("PhiroIfBrickTest"); script.addBrick(ifBrick); script.addBrick(ifLogicElseBrick); script.addBrick(ifLogicEndBrick); }
Source:
public static AdapterPair adapterTrimIlluminaPairedReads(final SAMRecord read1, final SAMRecord read2, final int minMatchBases, final double maxErrorRate, final AdapterPair ... adapters) { AdapterPair matched = null; for (final AdapterPair adapterPair : adapters) { final int index1 = findIndexOfClipSequence( getReadBases(read1), adapterPair.get3PrimeAdapterBytes(), minMatchBases, maxErrorRate); final int index2 = findIndexOfClipSequence( getReadBases(read2), adapterPair.get5PrimeAdapterBytesInReadOrder(), minMatchBases, maxErrorRate); final int numBasesClipped1 = (NO_MATCH == index1) ? 0 : read1.getReadLength() - index1; final int numBasesClipped2 = (NO_MATCH == index2) ? 0 : read2.getReadLength() - index2; if (numBasesClipped1 == numBasesClipped2) { if (index1 != NO_MATCH) { read1.setAttribute(ReservedTagConstants.XT, index1 + 1); read2.setAttribute(ReservedTagConstants.XT, index2 + 1); return adapterPair; } else { } } else if (index1 == NO_MATCH || index2 == NO_MATCH) { if(attemptOneSidedMatch(read1, read2, numBasesClipped1, numBasesClipped2, 2 * minMatchBases)) { matched = adapterPair; } } else { } } return matched; }

Target:
public static AdapterPair adapterTrimIlluminaPairedReads(final SAMRecord read1, final SAMRecord read2, final int minMatchBases, final double maxErrorRate, final AdapterPair ... adapters) { AdapterPair matched = null; for (final AdapterPair adapterPair : adapters) { final int index1 = findIndexOfClipSequence( getReadBases(read1), adapterPair.get3PrimeAdapterBytes(), minMatchBases, maxErrorRate); final int index2 = findIndexOfClipSequence( getReadBases(read2), adapterPair.get5PrimeAdapterBytesInReadOrder(), minMatchBases, maxErrorRate); if (index1 == index2) { if (index1 != NO_MATCH) { read1.setAttribute(ReservedTagConstants.XT, index1 + 1); read2.setAttribute(ReservedTagConstants.XT, index2 + 1); return adapterPair; } else { } } else if (index1 == NO_MATCH || index2 == NO_MATCH) { if(attemptOneSidedMatch(read1, read2, index1, index2, 2 * minMatchBases)) { matched = adapterPair; } } else { } } return matched; }
Source:
protected boolean canDoAction() { boolean result = super.canDoAction(); if (result && userProfileDao.getByUserId(getUserId()) != null) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__ROLE); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED); result = false; } return result; }

Target:
protected boolean canDoAction() { boolean result = super.canDoAction(); if (result && userProfileDao.getByUserId(getUserId()) != null) { setActionMessageParameters(); result = false; } return result; }
Source:
public static Collection<ImmutableWorkerInfo> getImmutableWorkerFromZK(Collection<ZkWorker> workers) { return Collections2.transform( workers, new Function<ZkWorker, ImmutableWorkerInfo>() { @Override public ImmutableWorkerInfo apply(ZkWorker input) { return input.toImmutable(); } } ); }

Target:
private static ImmutableList<ImmutableWorkerInfo> getImmutableWorkerFromZK(Collection<ZkWorker> workers) { return ImmutableList.copyOf( Collections2.transform( workers, new Function<ZkWorker, ImmutableWorkerInfo>() { @Override public ImmutableWorkerInfo apply(ZkWorker input) { return input.toImmutable(); } } ) ); }
Source:
synchronized void markSequenceUnresolved(ProducerBatch batch) { log.debug("Marking partition unresolved", batch.topicPartition); partitionsWithUnresolvedSequences.put(batch.topicPartition, batch.baseSequence() + batch.recordCount); }

Target:
synchronized void markSequenceUnresolved(ProducerBatch batch) { int nextSequence = batch.lastSequence() + 1; partitionsWithUnresolvedSequences.compute(batch.topicPartition, (k, v) -> v == null ? nextSequence : Math.max(v, nextSequence)); log.debug("Marking partition unresolved with next sequence number {}", batch.topicPartition, partitionsWithUnresolvedSequences.get(batch.topicPartition)); }
Source:
protected String doInBackground(File... params) { Log.d(TAG, "getExifInformation"); if (params[0] == null) { return ""; } try { String exifReturnString = ""; String exifDate = ""; String exifTime = ""; String exifCity = ""; String exifCountry = ""; ExifInterface exif = new ExifInterface(params[0]); String tagDateTime = exif.getAttribute(ExifInterface.TAG_DATETIME); if (tagDateTime != null) { String[] exifDateTime = tagDateTime.split(" "); String[] exifDateSplit = exifDateTime[0].split(":"); exifDate = exifDateSplit[2] + "." + exifDateSplit[1] + "." + exifDateSplit[0]; exifTime = exifDateTime[1]; } if (!exifDate.equals("")) { exifReturnString = exifDate + "\n"; } if (!exifTime.equals("")) { exifReturnString += exifTime + "\n"; } String tagGpsLatitude = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE); String tagGpsLongitude = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE); if (tagGpsLatitude != null && tagGpsLongitude != null) { String[] separatedLat = tagGpsLatitude.split(","); String[] separatedLong = tagGpsLongitude.split(","); Geocoder geocoder = new Geocoder(mContext, Locale.getDefault()); List<Address> addressList = geocoder.getFromLocation( convertArcMinToDegrees(separatedLat), convertArcMinToDegrees(separatedLong), 1 ); if (addressList != null && addressList.size() > 0) { Address address = addressList.get(0); exifCity = address.getLocality(); exifCountry = address.getCountryName(); } } if ((exifCity != null) && (!exifCity.equals(""))) { exifReturnString += exifCity + "\n"; } if ((exifCountry != null) && (!exifCountry.equals(""))) { exifReturnString += exifCountry + "\n"; } return exifReturnString; } catch (IOException | IndexOutOfBoundsException e) { Log.e(TAG, "exception: ", e); return ""; } }

Target:
protected Boolean doInBackground(File... params) { return exifView.getExifView(mContext, params[0], getSecondaryColor()); }
Source:
boolean shouldCheckForStarvation() { long now = scheduler.getClock().getTime(); return now > nextStarvationCheck; }

Target:
boolean shouldCheckForStarvation() { return scheduler.getClock().getTime() >= nextStarvationCheck; }
Source:
public void listDirectory(OCFile directory) { FileDataStorageManager storageManager = mContainerActivity.getStorageManager(); if (storageManager != null) { if(directory == null){ if(mFile != null){ directory = mFile; } else { directory = storageManager.getFileByPath("/"); if (directory == null) return; } } if(!directory.isFolder()){ Log_OC.w(TAG, "You see, that is not a directory -> " + directory.toString()); directory = storageManager.getFileById(directory.getParentId()); } mAdapter.swapDirectory(directory, storageManager); if (mFile == null || !mFile.equals(directory)) { imageView.setSelection(0); } mFile = directory; double countImages = 0; double countFiles = 0; Vector<OCFile> files = storageManager.getFolderContent(directory); for (OCFile file : files){ if (!file.isFolder()){ countFiles++; if (file.isImage()){ countImages++; } } } if ((countImages / countFiles) >= 0.5){ Log_OC.i(TAG, "Image View"); switchImageView(); } else { Log_OC.i(TAG, "Folder View"); switchFileView(); } } }

Target:
public void listDirectory(OCFile directory) { FileDataStorageManager storageManager = mContainerActivity.getStorageManager(); if (storageManager != null) { if(directory == null){ if(mFile != null){ directory = mFile; } else { directory = storageManager.getFileByPath("/"); if (directory == null) return; } } if(!directory.isFolder()){ Log_OC.w(TAG, "You see, that is not a directory -> " + directory.toString()); directory = storageManager.getFileById(directory.getParentId()); } mAdapter.swapDirectory(directory, storageManager); if (mFile == null || !mFile.equals(directory)) { imageView.setSelection(0); } mFile = directory; Vector<OCFile> files = storageManager.getFolderContent(directory); TextView footerText = (TextView) mFooterView.findViewById(R.id.footerText); footerText.setText(generateFooterText(directory)); if (DisplayUtils.decideViewLayout(files)){ switchImageView(); } else { switchFileView(); } } }
Source:
public WorkspaceEdit organizeImports(String path) { CompletableFuture<Object> result = getLanguageServer() .getWorkspaceService() .executeCommand( new ExecuteCommandParams( Commands.ORGANIZE_IMPORTS_COMMAND, ImmutableList.of(prefixURI(path)))); try { return gson.fromJson(gson.toJson(result.get(10, TimeUnit.SECONDS)), WorkspaceEdit.class); } catch (JsonSyntaxException | InterruptedException | ExecutionException | TimeoutException e) { throw new JsonRpcException(-27000, e.getMessage()); } }

Target:
public WorkspaceEdit organizeImports(String path) { Type type = new TypeToken<WorkspaceEdit>() {}.getType(); return doGetOne("java.edit.organizeImports", singletonList(prefixURI(path)), type); }
Source:
public AirShield(final Player player) { super(player); this.maxRadius = getConfig().getDouble("Abilities.Air.AirShield.Radius"); this.isToggledByAvatarState = getConfig().getBoolean("Abilities.Avatar.AvatarState.Air.AirShield.IsAvatarStateToggle"); this.radius = 0; this.cooldown = getConfig().getLong("Abilities.Air.AirShield.Cooldown"); this.duration = getConfig().getLong("Abilities.Air.AirShield.Duration"); this.speed = getConfig().getDouble("Abilities.Air.AirShield.Speed"); this.streams = getConfig().getInt("Abilities.Air.AirShield.Streams"); this.particles = getConfig().getInt("Abilities.Air.AirShield.Particles"); this.random = new Random(); this.angles = new HashMap<>(); if (this.bPlayer.isAvatarState() && hasAbility(player, AirShield.class) && this.isToggledByAvatarState) { getAbility(player, AirShield.class).remove(); return; } int angle = 0; final int di = (int) (this.maxRadius * 2 / this.streams); for (int i = -(int) this.maxRadius + di; i < (int) this.maxRadius; i += di) { this.angles.put(i, angle); angle += 90; if (angle == 360) { angle = 0; } } this.start(); }

Target:
public AirShield(final Player player) { super(player); this.maxRadius = getConfig().getDouble("Abilities.Air.AirShield.MaxRadius"); this.initialRadius = getConfig().getDouble("Abilities.Air.AirShield.InitialRadius"); this.isToggledByAvatarState = getConfig().getBoolean("Abilities.Avatar.AvatarState.Air.AirShield.IsAvatarStateToggle"); this.radius = initialRadius; this.cooldown = getConfig().getLong("Abilities.Air.AirShield.Cooldown"); this.duration = getConfig().getLong("Abilities.Air.AirShield.Duration"); this.speed = getConfig().getDouble("Abilities.Air.AirShield.Speed"); this.streams = getConfig().getInt("Abilities.Air.AirShield.Streams"); this.particles = getConfig().getInt("Abilities.Air.AirShield.Particles"); this.random = new Random(); this.angles = new HashMap<>(); if (this.bPlayer.isAvatarState() && hasAbility(player, AirShield.class) && this.isToggledByAvatarState) { getAbility(player, AirShield.class).remove(); return; } int angle = 0; final int di = (int) (this.maxRadius * 2 / this.streams); for (int i = -(int) this.maxRadius + di; i < (int) this.maxRadius; i += di) { this.angles.put(i, angle); angle += 90; if (angle == 360) { angle = 0; } } this.start(); }
Source:
public static String displayRub3(Context context, int page) { int rub3 = QuranInfo.getRub3FromPage(page); int hizb = (rub3 / 4) + 1; StringBuilder sb = new StringBuilder(); if (rub3 == -1) { return ""; } int remainder = rub3 % 4; if (remainder == 1) { sb.append(context.getString(R.string.quran_rob3)).append(' '); } else if (remainder == 2) { sb.append(context.getString(R.string.quran_nos)).append(' '); } else if (remainder == 3) { sb.append(context.getString(R.string.quran_talt_arb3)).append(' '); } sb.append(context.getString(R.string.quran_hizb)).append(' ') .append(QuranUtils.getLocalizedNumber(context, hizb)); return sb.toString(); }

Target:
public static String displayRub3(Context context, int page){ int rub3 = QuranInfo.getRub3FromPage(page); if (rub3 == -1) { return ""; } int hizb = (rub3 / 4) + 1; StringBuilder sb = new StringBuilder(); sb.append(" , "); int remainder = rub3 % 4; if (remainder == 1) { sb.append(context.getString(R.string.quran_rob3)).append(' '); } else if (remainder == 2) { sb.append(context.getString(R.string.quran_nos)).append(' '); } else if (remainder == 3) { sb.append(context.getString(R.string.quran_talt_arb3)).append(' '); } sb.append(context.getString(R.string.quran_hizb)).append(' ') .append(QuranUtils.getLocalizedNumber(context, hizb)); return sb.toString(); }
Source:
private void requestEvents(int month, int date) { progressBar.setVisibility(VISIBLE); eventsRecycler.setVisibility(GONE); errorView.setVisibility(GONE); disposables.add(ServiceFactory.getRest(wiki).getOnThisDay(month + 1, date) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doAfterTerminate(() -> { progressBar.setVisibility(GONE); eventsRecycler.postDelayed(() -> { if (positionToScrollTo != -1 && yearClickedOnCardView != -1) { eventsRecycler.scrollToPosition(positionToScrollTo); } }, 500); }) .subscribe(response -> { onThisDay = response; eventsRecycler.setVisibility(VISIBLE); eventsRecycler.setAdapter(new RecyclerAdapter(onThisDay.events(), wiki)); List<OnThisDay.Event> events = onThisDay.events(); for (int i = 0; i < events.size(); i++) { if (yearClickedOnCardView == events.get(i).year()) { positionToScrollTo = i; break; } } int beginningYear = events.get(events.size() - 1).year(); dayInfoTextView.setText(String.format(getString(R.string.events_count_text), Integer.toString(events.size()), DateUtil.yearToStringWithEra(beginningYear), events.get(0).year())); }, throwable -> { L.e(throwable); errorView.setError(throwable); errorView.setVisibility(VISIBLE); eventsRecycler.setVisibility(GONE); })); }

Target:
private void requestEvents(int month, int date) { progressBar.setVisibility(VISIBLE); eventsRecycler.setVisibility(GONE); errorView.setVisibility(GONE); disposables.add(ServiceFactory.getRest(wiki).getOnThisDay(month + 1, date) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doAfterTerminate(() -> { if (!isAdded()) { return; } progressBar.setVisibility(GONE); eventsRecycler.postDelayed(() -> { if (positionToScrollTo != -1 && yearOnCardView != -1) { eventsRecycler.scrollToPosition(positionToScrollTo); } }, 500); }) .subscribe(response -> { onThisDay = response; eventsRecycler.setVisibility(VISIBLE); eventsRecycler.setAdapter(new RecyclerAdapter(onThisDay.events(), wiki)); List<OnThisDay.Event> events = onThisDay.events(); for (int i = 0; i < events.size(); i++) { if (yearOnCardView == events.get(i).year()) { positionToScrollTo = i; break; } } int beginningYear = events.get(events.size() - 1).year(); dayInfoTextView.setText(String.format(getString(R.string.events_count_text), Integer.toString(events.size()), DateUtil.yearToStringWithEra(beginningYear), events.get(0).year())); }, throwable -> { L.e(throwable); errorView.setError(throwable); errorView.setVisibility(VISIBLE); eventsRecycler.setVisibility(GONE); })); }
Source:
public Map<String, ContainerRaw> getContainersMap() { final Map<String, ContainerRaw> containerRawMap = new HashMap<>(); containers.stream().forEach(containerRaw -> { final Container container = containerRaw.getContainer(); if (container instanceof FileAssetContainer) { try { final Host host = APILocator.getHostAPI().findParentHost(container, APILocator.systemUser(), false); String path = null; if (host == null || this.site.getIdentifier().equals(host.getIdentifier())) { path = FileAssetContainer.class.cast(container).getPath(); } else { path = FileAssetContainerUtil.getInstance().getFullPath((FileAssetContainer) container); } containerRawMap.put(path, containerRaw); } catch (DotDataException | DotSecurityException e) { Logger.debug(PageView.class, e.getMessage()); } } else { final String identifier = container.getIdentifier(); containerRawMap.put(identifier, containerRaw); } }); return containerRawMap; }

Target:
public Map<String, ContainerRaw> getContainersMap() { final Map<String, ContainerRaw> containerRawMap = new HashMap<>(); containers.stream().forEach(containerRaw -> { final Container container = containerRaw.getContainer(); if (container instanceof FileAssetContainer) { final Host host = ((FileAssetContainer) container).getHost(); String path = null; if (host == null || this.site.getIdentifier().equals(host.getIdentifier())) { path = FileAssetContainer.class.cast(container).getPath(); } else { path = FileAssetContainerUtil.getInstance().getFullPath((FileAssetContainer) container); } containerRawMap.put(path, containerRaw); } else { final String identifier = container.getIdentifier(); containerRawMap.put(identifier, containerRaw); } }); return containerRawMap; }
Source:
public String getEmulatorEndpoint() { return getContainerIpAddress() + ":" + getMappedPort(PORT); }

Target:
public String getEmulatorEndpoint() { return getHost() + ":" + getEmulatorPort(); }
Source:
private void showComments(HNPostComments comments) { if (comments.getHeaderHtml() != null && mCommentHeaderText.getVisibility() != View.VISIBLE) { mCommentHeaderText.setVisibility(View.VISIBLE); mCommentHeaderText.setText(Html.fromHtml(comments.getHeaderHtml()).toString().trim()); Linkify.addLinks(mCommentHeaderText, Pattern.compile("((h|H)ttps?:\\/\\/)([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?(\\?(\\w+\\=\\w+&?)+)?"), ""); } mComments = comments; if (mComments.getComments().size() == 0) mCommentsList.setEmptyView(null); mCommentsListAdapter.notifyDataSetChanged(); }

Target:
private void showComments(HNPostComments comments) { if (comments.getHeaderHtml() != null && mCommentHeaderText.getVisibility() != View.VISIBLE) { mCommentHeaderText.setVisibility(View.VISIBLE); mCommentHeaderText.setText(Html.fromHtml(comments.getHeaderHtml()).toString().trim()); Linkify.addLinks(mCommentHeaderText, Linkify.WEB_URLS); } mComments = comments; if (mComments.getComments().size() == 0) mCommentsList.setEmptyView(null); mCommentsListAdapter.notifyDataSetChanged(); }
Source:
public void init(FilterConfig filterConfig) throws ServletException { try { KeyStore ks = KeyStore.getInstance(EngineLocalConfig.getInstance().getPKITrustStoreType()); try (InputStream is = new FileInputStream(EngineLocalConfig.getInstance().getPKITrustStore())) { ks.load(is, EngineLocalConfig.getInstance().getPKITrustStorePassword().toCharArray()); } ticketDecoder = new TicketDecoder(ks, EngineLocalConfig.getInstance().getSsoStoreEku()); } catch (Exception e) { throw new RuntimeException("Unable to instantiate TicketDecoder", e); } }

Target:
public void init(FilterConfig filterConfig) throws ServletException { }
Source:
private boolean findChildren(CalledFunction node, int depth, ITmfStateSystem ss, int maxQuark, IProgressMonitor monitor) { fStore.add(node); long curTime = node.getStart(); long limit = node.getEnd(); ITmfStateInterval interval = null; while (curTime < limit) { if (monitor.isCanceled()) { return false; } try { if (depth + 1 < fCurrentQuarks.size()) { interval = ss.querySingleState(curTime, fCurrentQuarks.get(depth + 1)); } else { return true; } } catch (StateSystemDisposedException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); if (intervalStart < node.getStart() || intervalEnd > limit) { return true; } CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, stateValue.unboxLong(), node.getDepth() + 1); findChildren(segment, depth + 1, ss, maxQuark, monitor); node.addChild(segment); } curTime = interval.getEndTime() + 1; } return true; }

Target:
private boolean findChildren(CalledFunction node, int depth, ITmfStateSystem ss, int maxQuark, IProgressMonitor monitor) { fStore.add(node); long curTime = node.getStart(); long limit = node.getEnd(); ITmfStateInterval interval = null; while (curTime < limit) { if (monitor.isCanceled()) { return false; } try { if (depth + 1 < fCurrentQuarks.size()) { interval = ss.querySingleState(curTime, fCurrentQuarks.get(depth + 1)); } else { return true; } } catch (StateSystemDisposedException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); if (intervalStart < node.getStart() || intervalEnd > limit) { return true; } CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, stateValue, node.getDepth() + 1); findChildren(segment, depth + 1, ss, maxQuark, monitor); node.addChild(segment); } curTime = interval.getEndTime() + 1; } return true; }
Source:
public void cancelJob() throws IOException, SignatureException, XmlProcessingException { final String bucketName = "test_cancel_job"; try { client.putBucket(new PutBucketRequest(bucketName)); final List<Ds3Object> objectsOne = new ArrayList<>(); final Ds3Object obj = new Ds3Object("testOne", 2); objectsOne.add(obj); final Ds3ClientHelpers.Job job = wrap(client).startWriteJob(bucketName, objectsOne); final CancelJobSpectraS3Response response = client .cancelJobSpectraS3(new CancelJobSpectraS3Request(job.getJobId())); response.checkStatusCode(204); assertTrue(client.getActiveJobsSpectraS3(new GetActiveJobsSpectraS3Request()) .getActiveJobListResult().getActiveJobs().isEmpty()); } finally { deleteAllContents(client, bucketName); } }

Target:
public void cancelJob() throws IOException, SignatureException, XmlProcessingException { try { final Ds3ClientHelpers.Job job = HELPERS.startWriteJob(BUCKET_NAME, Lists.newArrayList(new Ds3Object("testOne", 2))); final CancelJobSpectraS3Response response = client .cancelJobSpectraS3(new CancelJobSpectraS3Request(job.getJobId())); assertEquals(response.getStatusCode(),204); assertTrue(client.getActiveJobsSpectraS3(new GetActiveJobsSpectraS3Request()) .getActiveJobListResult().getActiveJobs().isEmpty()); } finally { deleteAllContents(client, BUCKET_NAME); } }
Source:
private boolean needsOverflow(byte[] tableMetadata) { boolean needsOverflow = false; TableMetadata metadata = TableMetadata.BYTES_HYDRATOR.hydrateFromBytes(tableMetadata); if (metadata != null) { needsOverflow = metadata.getColumns().getMaxValueSize() > AtlasDbConstants.ORACLE_OVERFLOW_THRESHOLD; } return needsOverflow; }

Target:
private boolean needsOverflow(byte[] tableMetadata) { TableMetadata metadata = TableMetadata.BYTES_HYDRATOR.hydrateFromBytes(tableMetadata); return (metadata != null) && (metadata.getColumns().getMaxValueSize() > AtlasDbConstants.ORACLE_OVERFLOW_THRESHOLD); }
Source:
public static <T> MutableMessageBuilder<T> fromMessage(Message<T> message) { Assert.notNull(message, "message must not be null"); if (message instanceof CloneableMessage) { logger.warn("For CloneableMessages consider to use regular MessageBuilder. " + "Otherwise custom Message context may be lost."); } return new MutableMessageBuilder<T>(message); }

Target:
public static <T> MutableMessageBuilder<T> fromMessage(Message<T> message) { Assert.notNull(message, "message must not be null"); return new MutableMessageBuilder<T>(message); }
Source:
public void testTranslateDedicatedResourcePoolConfiguration() { ClusteredResourceConfigurationParser configTranslator = new ClusteredResourceConfigurationParser(); DedicatedClusteredResourcePoolImpl dedicatedClusteredResourcePool = new DedicatedClusteredResourcePoolImpl("from", 12, MemoryUnit.GB); Node retElement = configTranslator.unparseResourcePool(dedicatedClusteredResourcePool); assertThat(retElement, is(notNullValue())); assertThat(retElement.getNodeName(), is("ehcache:resources")); assertThat(retElement.getAttributes(), is(notNullValue())); assertThat(retElement.getAttributes().getLength(), is(1)); assertThat(retElement.getAttributes().item(0).getNodeName(), is("xmlns:ehcache")); assertThat(retElement.getAttributes().item(0).getNodeValue(), is("<LINK_0>")); Node clusterElement = retElement.getFirstChild(); assertThat(clusterElement, is(notNullValue())); assertThat(clusterElement.getAttributes(), is(notNullValue())); assertThat(clusterElement.getAttributes().getLength(), is(3)); assertThat(clusterElement.getAttributes().item(0).getNodeName(), is("from")); assertThat(clusterElement.getAttributes().item(0).getNodeValue(), is("from")); assertThat(clusterElement.getAttributes().item(1).getNodeName(), is("unit")); assertThat(clusterElement.getAttributes().item(1).getNodeValue(), is("GB")); assertThat(clusterElement.getAttributes().item(2).getNodeName(), is("xmlns:tc")); assertThat(clusterElement.getAttributes().item(2).getNodeValue(), is("<LINK_0>/clustered")); assertThat(clusterElement.getNodeName(), is("tc:clustered-dedicated")); assertThat(clusterElement.getFirstChild().getNodeValue(), is("12")); }

Target:
public void testTranslateDedicatedResourcePoolConfiguration() { ClusteredResourceConfigurationParser configTranslator = new ClusteredResourceConfigurationParser(); DedicatedClusteredResourcePoolImpl dedicatedClusteredResourcePool = new DedicatedClusteredResourcePoolImpl("from", 12, MemoryUnit.GB); Node retElement = configTranslator.unparseResourcePool(dedicatedClusteredResourcePool); assertThat(retElement, is(notNullValue())); assertThat(retElement.getNodeName(), is("ehcache:resources")); checkAttributeItems(retElement); Node clusterElement = retElement.getFirstChild(); assertThat(clusterElement, is(notNullValue())); assertThat(clusterElement.getNodeName(), is("tc:clustered-dedicated")); checkAttributeItems(clusterElement); assertThat(clusterElement.getFirstChild().getNodeValue(), is("12")); }
Source:
public DataAccount getDataAccount(Long id, Boolean deleted) throws DataAccessException { DataAccount dataAccount = null; IDatabaseService databaseService = DatabaseServiceProvider.provide(); Connection dataAccountConnection = databaseService.getNamedConnection(DatabaseType.DatabaseTypeDataAccount.toString()); String getDataAccountQuery = String.format( "SELECT *, convert(aes_decrypt(`password`,UNHEX('%s')), CHAR(1000)) AS `clearpassword` FROM `dataaccount` WHERE `id`='%d' %s LIMIT 1", key(), id.longValue(), (deleted) ? "" : "AND `deleted`='n'"); try { dataAccountConnection.connect(); dataAccountConnection.executeQuery(getDataAccountQuery); if (dataAccountConnection.fetchNextRow()) { dataAccount = toDataAccount(dataAccountConnection); } } finally { if (dataAccountConnection != null) { dataAccountConnection.disconnect(); } } return dataAccount; }

Target:
public DataAccount getDataAccount(Long id, Boolean deleted) throws DataAccessException { DataAccount dataAccount = null; IDatabaseService databaseService = DatabaseServiceProvider.provide(); Connection dataAccountConnection = databaseService.getNamedConnection(DatabaseType.DatabaseTypeDataAccount.toString()); String getDataAccountQuery = String.format( "SELECT *, convert(aes_decrypt(`password`,UNHEX('%s')), CHAR(1000)) AS `clearpassword` FROM `dataaccount` WHERE `id`='%d' %s LIMIT 1", key(), id.longValue(), deleted ? "" : "AND `deleted`='n'"); try { dataAccountConnection.connect(); dataAccountConnection.executeQuery(getDataAccountQuery); if (dataAccountConnection.fetchNextRow()) { dataAccount = toDataAccount(dataAccountConnection); } } finally { if (dataAccountConnection != null) { dataAccountConnection.disconnect(); } } return dataAccount; }
Source:
public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("[MessageInfo:").append("Key-").append(key).append("Size-").append(size) .append("ExpirationTimeInMs-").append(expirationTimeInMs).append("IsDeleted-").append(isDeleted).append("]"); return stringBuilder.toString(); }

Target:
public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("[MessageInfo:").append("Key-").append(key).append(",").append("Size-").append(size) .append(",").append("ExpirationTimeInMs-").append(expirationTimeInMs).append(",").append("IsDeleted-") .append(isDeleted).append("]"); return stringBuilder.toString(); }
Source:
public A value() { return trampoline().run(); }

Target:
public final A value() { return trampoline().run(); }
Source:
public String save() { try { this.serviceManager.getClientService().save(this.client); return "/pages/clients?faces-redirect=true"; } catch (DataException e) { Helper.setFehlerMeldung("Error, could not save client", e.getMessage()); return null; } }

Target:
public String save() { try { this.serviceManager.getClientService().save(this.client); return "/pages/clients?" + REDIRECT_PARAMETER; } catch (DataException e) { Helper.setFehlerMeldung("Error, could not save client", e.getMessage()); return null; } }
Source:
private void retrieveModuleFields() throws IOException { if (sourceType.getValue() == SourceType.MODULE_SELECTION && StringUtils.isNotEmpty(moduleName.getValue())) { ClassLoader classLoader = this.getClass().getClassLoader(); RuntimeInfo runtimeInfo = new JarRuntimeInfo("mvn:org.talend.components/components-salesforce-runtime", DependenciesReader.computeDependenciesFilePath("org.talend.components", "components-salesforce-runtime"), "org.talend.components.salesforce.runtime.dataprep.SalesforceDataprepSource"); try (SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, classLoader)) { SalesforceRuntimeSourceOrSink runtime = (SalesforceRuntimeSourceOrSink) sandboxedInstance.getInstance(); SalesforceInputProperties properties = new SalesforceInputProperties("model"); properties.setDatasetProperties(this); runtime.initialize(null, properties); runtime.validate(null); List<NamedThing> moduleNames = runtime.getSchemaNames(null); moduleName.setPossibleNamedThingValues(moduleNames); Schema schema = runtime.getEndpointSchema(null, moduleName.getValue()); List<NamedThing> columns = new ArrayList<>(); for (Schema.Field field : schema.getFields()) { columns.add(new SimpleNamedThing(field.name(), field.name())); } selectColumnIds.setPossibleValues(columns); } } }

Target:
private void retrieveModuleFields() throws IOException { if (sourceType.getValue() == SourceType.MODULE_SELECTION && StringUtils.isNotEmpty(moduleName.getValue())) { Consumer consumer = new Consumer() { @Override public void accept(SalesforceRuntimeSourceOrSink runtime) throws IOException { List<NamedThing> moduleNames = runtime.getSchemaNames(null); moduleName.setPossibleNamedThingValues(moduleNames); Schema schema = runtime.getEndpointSchema(null, moduleName.getValue()); List<NamedThing> columns = new ArrayList<>(); for (Schema.Field field : schema.getFields()) { columns.add(new SimpleNamedThing(field.name(), field.name())); } selectColumnIds.setPossibleValues(columns); } }; runtimeTask(consumer); } }
Source:
private static ExpressionRewriter createRewrite() { return (expression, context) -> DesugarCurrentUserRewriter.rewrite(expression); }

Target:
private static ExpressionRewriter createRewrite() { return (expression, context) -> ExpressionTreeRewriter.rewriteWith(new com.facebook.presto.sql.tree.ExpressionRewriter<Void>() { @Override public Expression rewriteCurrentUser(CurrentUser node, Void context, ExpressionTreeRewriter<Void> treeRewriter) { return DesugarCurrentUser.getCall(node); } }, expression); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } MyPojo myPojo = (MyPojo) o; return name != null ? name.equals(myPojo.name) : myPojo.name == null; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final MyPojo myPojo = (MyPojo) o; return Objects.equals(name, myPojo.name); }
Source:
protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getReturnValue().getInternalVdsmTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }

Target:
protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); getReturnValue().getVdsmTaskIdList().add(taskId); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }
Source:
public static ObjectListAttributeDefinition.Builder of(final String name, final ObjectTypeAttributeDefinition valueType) { return new ObjectListAttributeDefinition.Builder(name, valueType); }

Target:
public static ObjectMapAttributeDefinition.Builder of(final String name, final ObjectTypeAttributeDefinition valueType) { return new ObjectMapAttributeDefinition.Builder(name, valueType); }
Source:
public Collection<EObject> getInverseReferences(final String featureName) { Preconditions.checkNotNull(featureName); return getInverseReferences(new Predicate<EStructuralFeature.Setting>() { @Override public boolean apply(Setting input) { return input != null && input.getEStructuralFeature() != null ? featureName.equals(input.getEStructuralFeature().getName()) : false; } }); }

Target:
public Collection<EObject> getInverseReferences(final String featureName) { Preconditions.checkNotNull(featureName); return getInverseReferences(new Predicate<EStructuralFeature.Setting>() { @Override public boolean apply(Setting input) { return input != null && input.getEStructuralFeature() != null && featureName.equals(input.getEStructuralFeature().getName()); } }); }
Source:
private void trySendBounce(Mail originalMail) throws MessagingException { MailImpl newMail = new MailImpl(originalMail); try { newMail.setRemoteHost(getRemoteHost()); newMail.setRemoteAddr(getRemoteAddr()); newMail.setRecipients(getSenderAsList(originalMail)); if (getInitParameters().isDebug() && LOGGER.isDebugEnabled()) { LOGGER.debug("New mail - sender: " + newMail.getSender() + ", recipients: " + StringUtils.arrayToString(newMail.getRecipients().toArray()) + ", name: " + newMail.getName() + ", remoteHost: " + newMail.getRemoteHost() + ", remoteAddr: " + newMail.getRemoteAddr() + ", state: " + newMail.getState() + ", lastUpdated: " + newMail.getLastUpdated() + ", errorMessage: " + newMail.getErrorMessage()); } newMail.setMessage(createBounceMessage(originalMail)); MailModifier mailModifier = MailModifier.builder() .mailet(this) .mail(newMail) .dns(dns) .build(); mailModifier.setRecipients(getRecipients(originalMail)); mailModifier.setTo(getTo(originalMail)); mailModifier.setSubjectPrefix(originalMail); mailModifier.setReplyTo(getReplyTo(originalMail), originalMail); mailModifier.setReversePath(getReversePath(originalMail), originalMail); mailModifier.setIsReply(getInitParameters().isReply(), originalMail); mailModifier.setSender(getSender(originalMail), originalMail); newMail.getMessage().setHeader(RFC2822Headers.DATE, getDateHeader(originalMail)); newMail.getMessage().saveChanges(); getMailetContext().sendMail(newMail); } finally { newMail.dispose(); } }

Target:
private void trySendBounce(Mail originalMail) throws MessagingException { MailImpl newMail = MailImpl.duplicate(originalMail); try { newMail.setRemoteHost(getRemoteHost()); newMail.setRemoteAddr(getRemoteAddr()); newMail.setRecipients(getSenderAsList(originalMail)); if (getInitParameters().isDebug()) { LOGGER.debug("New mail - sender: {}, recipients: {}, name: {}, remoteHost: {}, remoteAddr: {}, state: {}, lastUpdated: {}, errorMessage: {}", newMail.getSender(), newMail.getRecipients(), newMail.getName(), newMail.getRemoteHost(), newMail.getRemoteAddr(), newMail.getState(), newMail.getLastUpdated(), newMail.getErrorMessage()); } newMail.setMessage(createBounceMessage(originalMail)); MailModifier mailModifier = MailModifier.builder() .mailet(this) .mail(newMail) .dns(dns) .build(); mailModifier.setRecipients(getRecipients(originalMail)); mailModifier.setTo(getTo(originalMail)); mailModifier.setSubjectPrefix(originalMail); mailModifier.setReplyTo(getReplyTo(originalMail), originalMail); mailModifier.setReversePath(getReversePath(originalMail), originalMail); mailModifier.setIsReply(getInitParameters().isReply(), originalMail); mailModifier.setSender(getSender(originalMail), originalMail); newMail.getMessage().setHeader(RFC2822Headers.DATE, getDateHeader(originalMail)); newMail.getMessage().saveChanges(); getMailetContext().sendMail(newMail); } finally { newMail.dispose(); } }
Source:
public COMLateBindingBaseObject(IDispatch dispatch) { Native.setProtected(true); this.iDispatch = dispatch; }

Target:
public COMLateBindingBaseObject(IDispatch dispatch) { this.iDispatch = dispatch; }
Source:
synchronized void update(DBObject fromMe) { MediaFile mf = (MediaFile) fromMe; files.removeAllElements(); files.addAll(mf.files); long oldStart = (times.length > 0 ? times[0] : 0); times = mf.times.clone(); long newStart = (times.length > 0 ? times[0] : 0); if (oldStart != newStart && isPicture() && Sage.client) { if (Sage.DBG) System.out.println("Clearing MetaImage from cache due to picture file update:" + this); MetaImage.clearFromCache(this); } archive = mf.archive; if (infoAiringID != mf.infoAiringID) myAiring = null; infoAiringID = mf.infoAiringID; if (SageConstants.PVR) videoDirectory = new String(mf.videoDirectory); host = mf.host; encodedBy = mf.encodedBy; generalType = mf.generalType; acquisitionTech = mf.acquisitionTech; forcedComplete = mf.forcedComplete; thumbnailFile = mf.thumbnailFile; thumbnailOffset = mf.thumbnailOffset; thumbnailSize = mf.thumbnailSize; name = mf.name; createWatchCount = mf.createWatchCount; fileFormat = mf.fileFormat; super.update(fromMe); }

Target:
synchronized void update(DBObject fromMe) { MediaFile mf = (MediaFile) fromMe; files.removeAllElements(); files.addAll(mf.files); long oldStart = (times.length > 0 ? times[0] : 0); times = mf.times.clone(); long newStart = (times.length > 0 ? times[0] : 0); if (oldStart != newStart && isPicture() && Sage.client) { if (Sage.DBG) System.out.println("Clearing MetaImage from cache due to picture file update:" + this); MetaImage.clearFromCache(this); } archive = mf.archive; if (infoAiringID != mf.infoAiringID) myAiring = null; infoAiringID = mf.infoAiringID; videoDirectory = new String(mf.videoDirectory); host = mf.host; encodedBy = mf.encodedBy; generalType = mf.generalType; acquisitionTech = mf.acquisitionTech; forcedComplete = mf.forcedComplete; thumbnailFile = mf.thumbnailFile; thumbnailOffset = mf.thumbnailOffset; thumbnailSize = mf.thumbnailSize; name = mf.name; createWatchCount = mf.createWatchCount; fileFormat = mf.fileFormat; super.update(fromMe); }
Source:
public void testRollBackAfterOperationfailure() throws Exception { container.start(); try { try (ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient()) { final File deploymentOne = new File(deployDir, "deployment-one.jar"); createDeployment(deploymentOne, "org.jboss.modules"); addDeploymentScanner(client); prepareRollback(client); try { assertThat(exists(client, DEPLOYMENT_ONE), is(false)); runFailingScan(client); long timeout = System.currentTimeMillis() + TimeoutUtil.adjust(30000); while (!exists(client, DEPLOYMENT_ONE) && System.currentTimeMillis() < timeout) { Thread.sleep(100); } assertThat(exists(client, DEPLOYMENT_ONE), is(false)); String[] files = deployDir.list(); assertThat(files.length, is(1)); assertThat(files[0], is("deployment-one.jar")); deploymentOne.delete(); } finally { removeDeploymentScanner(client); cleanRollback(client); } } } finally { container.stop(); } }

Target:
public void testRollBackAfterOperationfailure() throws Exception { container.start(); try { try (ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient()) { final File deploymentOne = new File(deployDir, "deployment-one.jar"); createDeployment(deploymentOne, "org.jboss.modules"); addDeploymentScanner(client); prepareRollback(client); try { assertThat(exists(client, DEPLOYMENT_ONE), is(false)); runFailingScan(client); long timeout = System.currentTimeMillis() + TimeoutUtil.adjust(FAILING_TIMEOUT); while (!exists(client, DEPLOYMENT_ONE) && System.currentTimeMillis() < timeout) { Thread.sleep(DELAY); } assertThat(exists(client, DEPLOYMENT_ONE), is(false)); String[] files = deployDir.list(); assertThat(files.length, is(1)); assertThat(files[0], is("deployment-one.jar")); deploymentOne.delete(); } finally { removeDeploymentScanner(client); cleanRollback(client); } } } finally { container.stop(); } }
Source:
public boolean isRepeatedProperty(String entityType, List<String> propertyPath) { Descriptor messageDescriptor; try { messageDescriptor = serializationContext.getMessageDescriptor(entityType); } catch (Exception e) { throw new IllegalStateException("Unknown entity name " + entityType); } int i = 0; for (String p : propertyPath) { FieldDescriptor field = messageDescriptor.findFieldByName(p); if (field == null) { break; } if (field.isRepeated()) { return true; } if (++i == propertyPath.size() || field.getJavaType() != JavaType.MESSAGE) { break; } messageDescriptor = field.getMessageType(); } return false; }

Target:
public boolean isRepeatedProperty(String entityType, List<String> propertyPath) { Descriptor messageDescriptor; try { messageDescriptor = serializationContext.getMessageDescriptor(entityType); } catch (Exception e) { throw new IllegalStateException("Unknown entity name " + entityType); } for (String p : propertyPath) { FieldDescriptor field = messageDescriptor.findFieldByName(p); if (field == null) { break; } if (field.isRepeated()) { return true; } if (field.getJavaType() != JavaType.MESSAGE) { break; } messageDescriptor = field.getMessageType(); } return false; }
Source:
public MemoryInfo getCurrentMemory(@RequestParam(name = "token", required = true) String token) throws InvalidMonitoringTokenException { if (StringUtils.isNotEmpty(token) && StringUtils.equals(token, getConfiguredToken())) { return MemoryInfo.getCurrentMemory(); } else { throw new InvalidMonitoringTokenException("Invalid token for monitoring authorization"); } }

Target:
public MemoryInfo getCurrentMemory(@RequestParam(name = "token", required = true) String token) throws InvalidManagementTokenException { if (StringUtils.isNotEmpty(token) && StringUtils.equals(token, getConfiguredToken())) { return MemoryInfo.getCurrentMemory(); } else { throw new InvalidManagementTokenException("Management authorization failed, invalid token."); } }
Source:
public void iCanCreateClientWithRequiredFieldsOnly() throws IOException { String data = "{\n" + " \"entity-type\": \"oauth2Client\",\n" + " \"id\": \"nuxeo-client-11\",\n" + " \"secret\": \"4321\",\n" + " \"name\": \"Nuxeo Client 11\",\n" + " \"redirectURIs\": [\n" + " \"nuxeo://authorize\",\"nuxeo://authorize2\", \"nuxeo://authorize3\"\n" + " ]\n" + "}"; String expected = "{\n" + " \"entity-type\": \"oauth2Client\",\n" + " \"id\": \"nuxeo-client-11\",\n" + " \"name\": \"Nuxeo Client 11\",\n" + " \"isEnabled\": false,\n" + " \"secret\": \"4321\",\n" + " \"isAutoGrant\": false,\n" + " \"redirectURIs\": [\n" + " \"nuxeo://authorize2\", \"nuxeo://authorize\",\"nuxeo://authorize3\"\n" + " ]\n" + "}"; makeOperationAndVerify(TEST_OAUTH2_USER, CLIENT_PATH, RequestType.POST, data, Response.Status.CREATED, mapper.readTree(expected)); }

Target:
public void iCanCreateClientWithRequiredFieldsOnly() throws IOException { String data = "{\n" + " \"entity-type\": \"oauth2Client\",\n" + " \"id\": \"nuxeo-client-11\",\n" + " \"name\": \"Nuxeo Client 11\",\n" + " \"redirectURIs\": [\n" + " \"nuxeo://authorize\",\"nuxeo://authorize2\", \"nuxeo://authorize3\"\n" + " ]\n" + "}"; String expected = "{\n" + " \"entity-type\": \"oauth2Client\",\n" + " \"id\": \"nuxeo-client-11\",\n" + " \"name\": \"Nuxeo Client 11\",\n" + " \"isEnabled\": false,\n" + " \"secret\": null,\n" + " \"isAutoGrant\": false,\n" + " \"redirectURIs\": [\n" + " \"nuxeo://authorize2\", \"nuxeo://authorize\",\"nuxeo://authorize3\"\n" + " ]\n" + "}"; makeOperationAndVerify(TEST_OAUTH2_USER, CLIENT_PATH, RequestType.POST, data, Response.Status.CREATED, mapper.readTree(expected)); }
Source:
protected List<ProcessInfo> getProcessInfo(String[] cmd, String delimiter, OSPlatform platform) throws IOException, InterruptedException { LOGGER.info("Fetching process information using the command : " + Arrays.toString(cmd)); Process process = Runtime.getRuntime().exec(cmd); StreamGobbler output = new StreamGobbler(process.getInputStream()); StreamGobbler error = new StreamGobbler(process.getErrorStream()); output.start(); error.start(); process.waitFor(); output.join(); error.join(); process.destroy(); List<ProcessInfo> processToBeKilled = new ArrayList<ProcessInfo>(); for (String eachLine : output.getContents()) { String[] eachProcessData = eachLine.split(delimiter); if (eachProcessData != null && eachProcessData.length >= 2) { ProcessInfo tProcess = null; switch (platform) { case UNIX: tProcess = new ProcessInfo(eachProcessData[0], eachProcessData[1]); break; default: tProcess = new ProcessInfo(eachProcessData[1], eachProcessData[2]); break; } if (matches(tProcess.getProcessName().toLowerCase())) { processToBeKilled.add(tProcess); } } } return processToBeKilled; }

Target:
protected List<ProcessInfo> getProcessInfo(String[] cmd, String delimiter, OSPlatform platform) throws IOException, InterruptedException { LOGGER.info("Fetching process information using the command : " + Arrays.toString(cmd)); Process process = Runtime.getRuntime().exec(cmd); StreamGobbler output = new StreamGobbler(process.getInputStream()); StreamGobbler error = new StreamGobbler(process.getErrorStream()); output.start(); error.start(); process.waitFor(); output.join(); error.join(); process.destroy(); List<ProcessInfo> processToBeKilled = new ArrayList<ProcessInfo>(); for (String eachLine : output.getContents()) { String[] eachProcessData = eachLine.split(delimiter); if (eachProcessData != null && eachProcessData.length >= 2) { ProcessInfo tProcess = null; switch (platform) { case UNIX: tProcess = new ProcessInfo(eachProcessData[0], eachProcessData[1]); break; default: tProcess = new ProcessInfo(eachProcessData[1], eachProcessData[2]); break; } if (matches(tProcess.getProcessName())) { processToBeKilled.add(tProcess); } } } return processToBeKilled; }