auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void run() throws Exception { if (localName != null && gitdir != null) throw die(CLIText.get().conflictingUsageOf_git_dir_andArguments); final URIish uri = new URIish(sourceUri); if (localName == null) { try { localName = uri.getHumanishName(); } catch (IllegalArgumentException e) { throw die(MessageFormat.format(CLIText.get().cannotGuessLocalNameFrom, sourceUri)); } } if (branch == null) branch = Constants.HEAD; CloneCommand command = Git.cloneRepository(); command.setURI(sourceUri).setRemote(remoteName) .setNoCheckout(noCheckout).setBranch(branch); command.setGitDir(gitdir == null ? null : new File(gitdir)); command.setDirectory(localName == null ? null : new File(localName)); try { db = command.call().getRepository(); outw.println(MessageFormat.format(CLIText.get().cloningInto, command.getDirectory().getPath())); if (db.resolve(Constants.HEAD) == null) outw.println(CLIText.get().clonedEmptyRepository); } catch (InvalidRemoteException e) { throw die(MessageFormat.format(CLIText.get().doesNotExist, sourceUri)); } finally { if (db != null) db.close(); } outw.println(); outw.flush(); }

Target:
protected void run() throws Exception { if (localName != null && gitdir != null) throw die(CLIText.get().conflictingUsageOf_git_dir_andArguments); final URIish uri = new URIish(sourceUri); File localNameF; if (localName == null) { try { localNameF = new File(SystemReader.getInstance().getProperty( Constants.OS_USER_DIR), uri.getHumanishName()); } catch (IllegalArgumentException e) { throw die(MessageFormat.format(CLIText.get().cannotGuessLocalNameFrom, sourceUri)); } } else localNameF = new File(localName); if (branch == null) branch = Constants.HEAD; CloneCommand command = Git.cloneRepository(); command.setURI(sourceUri).setRemote(remoteName) .setNoCheckout(noCheckout).setBranch(branch); command.setGitDir(gitdir == null ? null : new File(gitdir)); command.setDirectory(localNameF); try { db = command.call().getRepository(); outw.println(MessageFormat.format(CLIText.get().cloningInto, command.getDirectory().getPath())); if (db.resolve(Constants.HEAD) == null) outw.println(CLIText.get().clonedEmptyRepository); } catch (InvalidRemoteException e) { throw die(MessageFormat.format(CLIText.get().doesNotExist, sourceUri)); } finally { if (db != null) db.close(); } outw.println(); outw.flush(); }
Source:
Mono<PhoneNumberSearch>> purchaseSearchActivationOperation(String searchId) { return (pollingContext) -> { Mono<PhoneNumberSearch> res = purchaseSearch(searchId).flatMap(agh -> { return getSearchById(searchId); }); return res; }; }

Target:
Mono<Void>> purchaseSearchActivationOperation(String searchId) { return (pollingContext) -> { return purchaseSearch(searchId); }; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_additives_explorer); recyclerView = findViewById(R.id.additiveRecyclerView); progressBar = findViewById(R.id.additives_progress_bar); fastScroller = findViewById(R.id.additives_fast_scroller); progressBar.setVisibility(View.VISIBLE); OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("<LINK_0>") .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { final String myResponse = response.body().string(); List<Additives> names = new ArrayList<>(); try { names = parseJson(myResponse); } catch (JSONException e) { e.printStackTrace(); } final List<Additives> additives = names; AdditivesExplorer.this.runOnUiThread(new Runnable() { @Override public void run() { progressBar.setVisibility(View.INVISIBLE); recyclerView.setLayoutManager(new LinearLayoutManager(AdditivesExplorer.this)); recyclerView.setAdapter(new AdditivesAdapter(additives, AdditivesExplorer.this)); recyclerView.addItemDecoration(new DividerItemDecoration(AdditivesExplorer.this, DividerItemDecoration.VERTICAL)); fastScroller.setVisibility(View.VISIBLE); fastScroller.setRecyclerView(recyclerView); } }); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_additives_explorer); recyclerView = findViewById(R.id.additiveRecyclerView); productRepository = ProductRepository.getInstance(); toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Additives"); additiveNameDao = Utils.getAppDaoSession(this).getAdditiveNameDao(); List<AdditiveName> additivesNames = additiveNameDao.loadAll(); String languageCode = Locale.getDefault().getLanguage(); additives = new ArrayList<>(); Set<AdditiveName> hs = new HashSet<>(); for (int i = 0; i < additivesNames.size(); i++) { if (additivesNames.get(i).getName().startsWith("E")) { String tag = additivesNames.get(i).getAdditiveTag(); hs.add(productRepository.getAdditiveByTagAndLanguageCode(tag, languageCode)); } } additives.addAll(hs); Collections.sort(additives, new Comparator<AdditiveName>() { @Override public int compare(AdditiveName additiveName, AdditiveName t1) { String s1 = additiveName.getName().toLowerCase().replace('x', '0').split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)")[1]; String s2 = t1.getName().toLowerCase().replace('x', '0').split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)")[1]; return Integer.valueOf(s1).compareTo(Integer.valueOf(s2)); } }); recyclerView.setLayoutManager(new LinearLayoutManager(AdditivesExplorer.this)); recyclerView.setAdapter(new AdditivesAdapter(additives, AdditivesExplorer.this)); recyclerView.addItemDecoration(new DividerItemDecoration(AdditivesExplorer.this, DividerItemDecoration.VERTICAL)); }
Source:
public void startCopyFromURL() { final Poller<BlobCopyInfo, Void> poller = client.beginCopyFromUrl(url); poller.getObserver().subscribe(response -> { System.out.printf("Copy identifier: %s%n", response.getValue().getCopyId()); }); END: com.azure.storage.blob.specialized.BlobClientBase.beginCopyFromUrl#URL }

Target:
public void startCopyFromURL() { final Poller<BlobCopyInfo, Void> poller = client.beginCopy(url, Duration.ofSeconds(2)); poller.getObserver().subscribe(response -> { System.out.printf("Copy identifier: %s%n", response.getValue().getCopyId()); }); END: com.azure.storage.blob.specialized.BlobClientBase.beginCopy#String-Duration }
Source:
public void testAssignUniqueId() { String unionLineitem50Times = IntStream.range(0, 25) .mapToObj(i -> "SELECT * FROM lineitem") .collect(joining(" UNION ALL ")); assertQuery( "SELECT count(*) FROM (" + "SELECT * FROM (" + " SELECT (SELECT count(*) WHERE c = 1) " + " FROM (SELECT CASE orderkey WHEN 1 THEN orderkey ELSE 1 END " + " FROM (" + unionLineitem50Times + ")) o(c)) result(a) " + "WHERE a = 1)", "VALUES 1504375"); }

Target:
public void testAssignUniqueId() { String unionLineitem25Times = IntStream.range(0, 25) .mapToObj(i -> "SELECT * FROM lineitem") .collect(joining(" UNION ALL ")); assertQuery( "SELECT count(*) FROM (" + "SELECT * FROM (" + " SELECT (SELECT count(*) WHERE c = 1) " + " FROM (SELECT CASE orderkey WHEN 1 THEN orderkey ELSE 1 END " + " FROM (" + unionLineitem25Times + ")) o(c)) result(a) " + "WHERE a = 1)", "VALUES 1504375"); }
Source:
public DescribableList<NodeProperty<?>, NodePropertyDescriptor> getNodeProperties() { assert nodeProperties != null; return nodeProperties; }

Target:
public DescribableList<NodeProperty<?>, NodePropertyDescriptor> getNodeProperties() { return Objects.requireNonNull(nodeProperties); }
Source:
public static FunctionDefinition.Kind determineFromString(final String code) { return code == null ? null : (FEEL.code.equals(code) ? FEEL : (JAVA.code.equals(code) ? JAVA : (PMML.code.equals(code) ? PMML : null))); }

Target:
public static FunctionDefinition.Kind determineFromString(final String code) { return code == null ? null : Objects.equals(FEEL.code, code) ? FEEL : (Objects.equals(JAVA.code, code) ? JAVA : (Objects.equals(PMML.code, code) ? PMML : null)); }
Source:
public static GCRule buildGarbageCollectionRule(HColumnDescriptor columnDescriptor) { int maxVersions = columnDescriptor.getMaxVersions(); int minVersions = columnDescriptor.getMinVersions(); int ttlSeconds = columnDescriptor.getTimeToLive(); Preconditions.checkState(minVersions < maxVersions, "HColumnDescriptor min versions must be less than max versions."); if (ttlSeconds == HColumnDescriptor.DEFAULT_TTL) { if (maxVersions == Integer.MAX_VALUE) { return null; } else { return GCRules.GCRULES.maxVersions(maxVersions); } } GCRule ageRule = GCRULES.maxAge(org.threeten.bp.Duration.ofSeconds(ttlSeconds)); if (minVersions != HColumnDescriptor.DEFAULT_MIN_VERSIONS) { ageRule = GCRULES.intersection().rule(ageRule).rule(GCRULES.maxVersions(minVersions)); } if (maxVersions == Integer.MAX_VALUE) { return ageRule; } else { return GCRULES.union().rule(ageRule).rule(GCRULES.maxVersions(maxVersions)); } }

Target:
public static GCRule buildGarbageCollectionRule(HColumnDescriptor columnDescriptor) { int maxVersions = columnDescriptor.getMaxVersions(); int minVersions = columnDescriptor.getMinVersions(); int ttlSeconds = columnDescriptor.getTimeToLive(); Preconditions.checkState(minVersions < maxVersions, "HColumnDescriptor min versions must be less than max versions."); if (ttlSeconds == HColumnDescriptor.DEFAULT_TTL) { if (maxVersions == Integer.MAX_VALUE) { return null; } else { return GCRULES.maxVersions(maxVersions); } } GCRule ageRule = GCRULES.maxAge(Duration.ofSeconds(ttlSeconds)); if (minVersions != HColumnDescriptor.DEFAULT_MIN_VERSIONS) { ageRule = GCRULES.intersection().rule(ageRule).rule(GCRULES.maxVersions(minVersions)); } if (maxVersions == Integer.MAX_VALUE) { return ageRule; } else { return GCRULES.union().rule(ageRule).rule(GCRULES.maxVersions(maxVersions)); } }
Source:
public void run() { try { System.out.println("Echo server started."); while (true) { final Socket socket = serverSocket.accept(); sockets.add(socket); Thread thread = new Thread() { @Override public void run() { try { DataInputStream input = new DataInputStream(socket.getInputStream()); DataOutputStream output = new DataOutputStream(socket.getOutputStream()); while (socket.isConnected() && !socket.isClosed()) { long size = input.readLong(); if (renegotiate.get()) { renegotiate.set(false); ((SSLSocket) socket).startHandshake(); } byte[] bytes = new byte[(int) size - 8]; input.readFully(bytes); output.writeLong(size); output.write(bytes); output.flush(); } } catch (IOException e) { System.out.println(e.getMessage()); } finally { try { socket.close(); } catch (IOException e) { System.out.println(e.getMessage()); } } } }; thread.start(); threads.add(thread); } } catch (IOException e) { System.out.println(e.getMessage()); } }

Target:
public void run() { try { System.out.println("Echo server started."); while (true) { final Socket socket = serverSocket.accept(); sockets.add(socket); Thread thread = new Thread() { @Override public void run() { try { DataInputStream input = new DataInputStream(socket.getInputStream()); DataOutputStream output = new DataOutputStream(socket.getOutputStream()); while (socket.isConnected() && !socket.isClosed()) { long size = input.readLong(); if (renegotiate.compareAndSet(true, false)) { ((SSLSocket) socket).startHandshake(); } byte[] bytes = new byte[(int) size - 8]; input.readFully(bytes); output.writeLong(size); output.write(bytes); output.flush(); } } catch (IOException e) { } finally { try { socket.close(); } catch (IOException e) { exceptions.add(e); } } } }; thread.start(); threads.add(thread); } } catch (IOException e) { exceptions.add(e); } }
Source:
protected void initialize(Object... args) { super.initialize(args); final HttpServletRequest request = ctx.getRequest(); userId = request.getParameter("userId"); workflowInstanceId = request.getParameter("workflowInstanceId"); workflowModelName = request.getParameter("workflowModelName"); }

Target:
protected void initialize(Object... args) { super.initialize(args); HttpServletRequest request = ctx.getRequest(); userId = request.getParameter("userId"); workflowInstanceId = request.getParameter("workflowInstanceId"); workflowModelName = request.getParameter("workflowModelName"); }
Source:
public void setCopyRatioCallingMetadata(@Nonnull final CopyRatioCallingMetadata copyRatioCallingMetadata) { this.copyRatioCallingMetadata = Utils.nonNull(copyRatioCallingMetadata, "The metadata must be non-null"); Utils.validateArg(copyRatioCallingMetadata.hasSampleCoverageDepth(), "The metadata must contain depth of coverage field"); Utils.validateArg(copyRatioCallingMetadata.hasSampleSexGenotypeData(), "The metadata must contain sex genotype data"); }

Target:
public void setCopyRatioCallingMetadata(@Nonnull final CopyRatioCallingMetadata copyRatioCallingMetadata) { this.copyRatioCallingMetadata = Utils.nonNull(copyRatioCallingMetadata, "The metadata must be non-null"); Utils.validateArg(copyRatioCallingMetadata.hasSampleCoverageDepth(), "The metadata must contain depth of coverage field"); Utils.validateArg(copyRatioCallingMetadata.hasSampleSexGenotypeData(), "The metadata must contain sex genotype field"); Utils.validateArg(copyRatioCallingMetadata.hasEmissionCalculationStrategy(), "The metadata must contain emission calculation strategy field"); }
Source:
public void testPost() throws Exception { MockHttpServletResponse response = postAsServletResponse("/rest/sessions/js", ""); assertEquals(201, response.getStatus()); assertNotNull(response.getHeader("Location")); long sessionId = Long.valueOf(response.getContentAsString()); assertTrue(response.getHeader("Location").endsWith("sessions/js/" + sessionId)); }

Target:
public void testPost() throws Exception { MockHttpServletResponse response = postAsServletResponse("/script/sessions/js", ""); assertEquals(201, response.getStatus()); assertNotNull(response.getHeader("Location")); long sessionId = Long.valueOf(response.getContentAsString()); assertTrue(response.getHeader("Location").endsWith("sessions/js/" + sessionId)); }
Source:
protected boolean canDoAction() { if (getParameters().getRngDevice().getVmId() == null || !entityExists()) { return failCanDoAction(getParameters().isVm() ? VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND : VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } if (!isRngAllowedInEngine()) { return failCanDoAction(VdcBllMessages.RNG_NOT_ENABLED_IN_ENGINE); } VDSGroup cluster = getClusterForEntity(); if (cluster == null || Version.v3_3.compareTo(cluster.getcompatibility_version()) > 0) { return failCanDoAction(VdcBllMessages.ACTION_NOT_SUPPORTED_FOR_CLUSTER_LEVEL); } return true; }

Target:
protected boolean canDoAction() { if (getParameters().getRngDevice().getVmId() == null || !entityExists()) { return failCanDoAction(getParameters().isVm() ? VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND : VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } VDSGroup cluster = getClusterForEntity(); if (cluster == null || !FeatureSupported.virtIoRngSupported(cluster.getcompatibility_version())) { return failCanDoAction(VdcBllMessages.ACTION_NOT_SUPPORTED_FOR_CLUSTER_LEVEL); } return true; }
Source:
public static JsonPathContext jsonApiCommonSyntax(JsonValueContext input, String pathSpec) { PathMode mode; String pathWff; try { Matcher matcher = JSON_PATH_BASE.matcher(pathSpec); if (!matcher.matches()) { mode = PathMode.STRICT; pathWff = pathSpec; } else { mode = PathMode.valueOf(matcher.group(1).toUpperCase(Locale.ROOT)); pathWff = matcher.group(2); } DocumentContext ctx; switch (mode) { case STRICT: if (input.hasException()) { return JsonPathContext.withStrictException(pathSpec, input.exc); } ctx = JsonPath.parse(input.obj, Configuration .builder() .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build()); break; case LAX: if (input.hasException()) { return JsonPathContext.withJavaObj(PathMode.LAX, null); } ctx = JsonPath.parse(input.obj, Configuration .builder() .options(Option.SUPPRESS_EXCEPTIONS) .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build()); break; default: throw RESOURCE.illegalJsonPathModeInPathSpec(mode.toString(), pathSpec).ex(); } try { return JsonPathContext.withJavaObj(mode, ctx.read(pathWff)); } catch (Exception e) { return JsonPathContext.withStrictException(pathSpec, e); } } catch (Exception e) { return JsonPathContext.withUnknownException(e); } }

Target:
public static JsonPathContext jsonApiCommonSyntax(JsonValueContext input, String pathSpec) { PathMode mode; String pathStr; try { Matcher matcher = JSON_PATH_BASE.matcher(pathSpec); if (!matcher.matches()) { mode = PathMode.STRICT; pathStr = pathSpec; } else { mode = PathMode.valueOf(matcher.group(1).toUpperCase(Locale.ROOT)); pathStr = matcher.group(2); } DocumentContext ctx; switch (mode) { case STRICT: if (input.hasException()) { return JsonPathContext.withStrictException(pathSpec, input.exc); } ctx = JsonPath.parse(input.obj, Configuration .builder() .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build()); break; case LAX: if (input.hasException()) { return JsonPathContext.withJavaObj(PathMode.LAX, null); } ctx = JsonPath.parse(input.obj, Configuration .builder() .options(Option.SUPPRESS_EXCEPTIONS) .jsonProvider(JSON_PATH_JSON_PROVIDER) .mappingProvider(JSON_PATH_MAPPING_PROVIDER) .build()); break; default: throw RESOURCE.illegalJsonPathModeInPathSpec(mode.toString(), pathSpec).ex(); } try { return JsonPathContext.withJavaObj(mode, ctx.read(pathStr)); } catch (Exception e) { return JsonPathContext.withStrictException(pathSpec, e); } } catch (Exception e) { return JsonPathContext.withUnknownException(e); } }
Source:
private synchronized boolean isPossibleToIssueNewBuffer() { Runtime rt = Runtime.getRuntime(); int bufferCountByMaxFreeBuffers = maxBuffersToPool + rt.availableProcessors(); if (numBuffersInUse >= bufferCountByMaxFreeBuffers) { return false; } double freeMemory = rt.maxMemory() - (rt.totalMemory() - rt.freeMemory()); int bufferCountByMemory = (int) ceil( (freeMemory * maxMemUsagePercentage / HUNDRED) / bufferSize); int maxBuffersThatCanBeInUse = min(bufferCountByMemory, bufferCountByMaxFreeBuffers); if (maxBuffersThatCanBeInUse < 2) { maxBuffersThatCanBeInUse = 2; } return numBuffersInUse < maxBuffersThatCanBeInUse; }

Target:
private synchronized boolean isPossibleToIssueNewBuffer() { setMaxBuffersThatCanBeInUse(); return numBuffersInUse < MAX_BUFFERS_THAT_CAN_BE_IN_USE; }
Source:
public static void copyToClipboard(final Context context, final String text) { ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); if (clipboardManager == null) { Toast.makeText(context, R.string.permission_denied, Toast.LENGTH_LONG).show(); return; } clipboardManager.setPrimaryClip(ClipData.newPlainText(null, text)); Toast.makeText(context, R.string.msg_copied, Toast.LENGTH_SHORT) .show(); }

Target:
public static void copyToClipboard(final Context context, final String text) { final ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); if (clipboardManager == null) { Toast.makeText(context, R.string.permission_denied, Toast.LENGTH_LONG).show(); return; } clipboardManager.setPrimaryClip(ClipData.newPlainText(null, text)); Toast.makeText(context, R.string.msg_copied, Toast.LENGTH_SHORT) .show(); }
Source:
public static <T> String toJson(T input) { Objects.requireNonNull(input); final ObjectMapper mapper = new ObjectMapper(); final AnnotationIntrospector introspectorPair = AnnotationIntrospector.pair( new JacksonAnnotationIntrospector(), new JaxbAnnotationIntrospector()); mapper.setDeserializationConfig(mapper.getDeserializationConfig().withAnnotationIntrospector(introspectorPair)); mapper.setSerializationConfig(mapper.getSerializationConfig().withAnnotationIntrospector(introspectorPair)); try { return mapper.writeValueAsString(input); } catch (IOException io) { throw Throwables.propagate(io); } }

Target:
public static <T> String toJson(T input) { Objects.requireNonNull(input); try { return JacksonUtils.createDefaultObjectMapper().writeValueAsString(input); } catch (IOException io) { throw Throwables.propagate(io); } }
Source:
public void slicesOfOneFromOne() { Series series = new Series("1"); List<String> expected = Arrays.asList("1"); List<String> actual = series.slices(1); assertEquals(expected, actual); }

Target:
public void slicesOfOneFromOne() { Series series = new Series("1"); List<String> expected = Collections.singletonList("1"); List<String> actual = series.slices(1); assertEquals(expected, actual); }
Source:
protected void refresh(final boolean isFirst) { final int rpcseq = ++rpcSequence; script = null; comments = null; if (Gerrit.isSignedIn()) { updateReviewedStatus(1); } PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, scriptSettings, new GerritCallback<PatchScript>() { public void onSuccess(final PatchScript result) { if (rpcSequence == rpcseq) { script = result; onResult(); } } @Override public void onFailure(final Throwable caught) { if (rpcSequence == rpcseq) { if (isNoDifferences(caught) && !isFirst) { historyTable.enableAll(true); showPatch(false); } else { super.onFailure(caught); } } } private boolean isNoDifferences(final Throwable caught) { if (caught instanceof NoDifferencesException) { return true; } return caught instanceof RemoteJsonException && caught.getMessage().equals(NoDifferencesException.MESSAGE); } }); PatchUtil.DETAIL_SVC.patchComments(patchKey, idSideA, idSideB, new GerritCallback<CommentDetail>() { public void onSuccess(final CommentDetail result) { if (rpcSequence == rpcseq) { comments = result; onResult(); } } @Override public void onFailure(Throwable caught) { if (!isNoSuchEntity(caught) && rpcSequence == rpcseq) { super.onFailure(caught); } } }); }

Target:
protected void refresh(final boolean isFirst) { final int rpcseq = ++rpcSequence; script = null; comments = null; if (Gerrit.isSignedIn() && isFirst) { setReviewedByCurrentUser(true ); } PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, scriptSettings, new GerritCallback<PatchScript>() { public void onSuccess(final PatchScript result) { if (rpcSequence == rpcseq) { script = result; onResult(); } } @Override public void onFailure(final Throwable caught) { if (rpcSequence == rpcseq) { if (isNoDifferences(caught) && !isFirst) { historyTable.enableAll(true); showPatch(false); } else { super.onFailure(caught); } } } private boolean isNoDifferences(final Throwable caught) { if (caught instanceof NoDifferencesException) { return true; } return caught instanceof RemoteJsonException && caught.getMessage().equals(NoDifferencesException.MESSAGE); } }); PatchUtil.DETAIL_SVC.patchComments(patchKey, idSideA, idSideB, new GerritCallback<CommentDetail>() { public void onSuccess(final CommentDetail result) { if (rpcSequence == rpcseq) { comments = result; onResult(); } } @Override public void onFailure(Throwable caught) { if (!isNoSuchEntity(caught) && rpcSequence == rpcseq) { super.onFailure(caught); } } }); }
Source:
private void addTreeViewerEntries(ITmfStateSystem stateSystem, TmfTreeViewerEntry parentBranch, int quark) { for (int q : stateSystem.getSubAttributes(quark, false)) { TmfTreeViewerEntry childBranch = stateSystem.getSubAttributes(q, false).isEmpty() ? new CounterTreeViewerEntry(stateSystem.getAttributeName(q), q) : new TmfTreeViewerEntry(stateSystem.getAttributeName(q)); parentBranch.addChild(childBranch); addTreeViewerEntries(stateSystem, childBranch, q); } }

Target:
private void addTreeViewerEntries(ITmfStateSystem stateSystem, TmfTreeViewerEntry parentBranch, int quark) { for (int childQuark : stateSystem.getSubAttributes(quark, false)) { TmfTreeViewerEntry childBranch = stateSystem.getSubAttributes(childQuark, false).isEmpty() ? new CounterTreeViewerEntry(stateSystem.getAttributeName(childQuark), childQuark) : new TmfTreeViewerEntry(stateSystem.getAttributeName(childQuark)); parentBranch.addChild(childBranch); addTreeViewerEntries(stateSystem, childBranch, childQuark); } }
Source:
public boolean shouldRerun() { return !dto.getHealthType().isDone() && Duration.between(created, Instant.now()).toMinutes() < 10; }

Target:
public boolean shouldRerun() { return !dto.getHealthType().isDone() && Duration.between(created, Instant.now()).toMinutes() > 10; }
Source:
private BlobId(DataInputStream stream, ClusterMap clusterMap, boolean ensureFullyRead) throws IOException { this.version = stream.readShort(); if (version == 1) { partitionId = clusterMap.getPartitionIdFromStream(stream); if (partitionId == null) { throw new IllegalArgumentException("Partition ID cannot be null"); } uuid = Utils.readIntString(stream); if (uuid == null) { throw new IllegalArgumentException("Could not parse uuid"); } if (ensureFullyRead && stream.available() > 0) { throw new IllegalArgumentException("Stream should have no more available bytes to read"); } } else { throw new IllegalArgumentException("version " + version + " not supported for blob id"); } }

Target:
private BlobId(DataInputStream stream, ClusterMap clusterMap, boolean ensureFullyRead) throws IOException { this.version = stream.readShort(); if (version == 1) { partitionId = clusterMap.getPartitionIdFromStream(stream); if (partitionId == null) { throw new IllegalArgumentException("Partition ID cannot be null"); } uuid = Utils.readIntString(stream); if (ensureFullyRead && stream.read() != -1) { throw new IllegalArgumentException("Stream should have no more available bytes to read"); } } else { throw new IllegalArgumentException("version " + version + " not supported for blob id"); } }
Source:
public synchronized void load() { try { Map.Entry<ManagerSpec, Map<ResourceGroupIdTemplate, ResourceGroupSpec>> specsFromDb = buildSpecsFromDb(); ManagerSpec managerSpec = specsFromDb.getKey(); Map<ResourceGroupIdTemplate, ResourceGroupSpec> resourceGroupSpecs = specsFromDb.getValue(); Set<ResourceGroupIdTemplate> changedSpecs = new HashSet<>(); Set<ResourceGroupIdTemplate> deletedSpecs = Sets.difference(this.resourceGroupSpecs.keySet(), resourceGroupSpecs.keySet()); for (Map.Entry<ResourceGroupIdTemplate, ResourceGroupSpec> entry : resourceGroupSpecs.entrySet()) { if (!entry.getValue().sameConfig(this.resourceGroupSpecs.get(entry.getKey()))) { changedSpecs.add(entry.getKey()); } } this.resourceGroupSpecs = resourceGroupSpecs; this.cpuQuotaPeriod.set(managerSpec.getCpuQuotaPeriod()); this.rootGroups.set(managerSpec.getRootGroups()); List<ResourceGroupSelector> selectors = buildSelectors(managerSpec); if (enableExactMatchSelector) { ImmutableList.Builder<ResourceGroupSelector> builder = ImmutableList.builder(); builder.add(new DbSourceExactMatchSelector(environment, dao)); builder.addAll(selectors); this.selectors.set(builder.build()); } else { this.selectors.set(selectors); } configureChangedGroups(changedSpecs); disableDeletedGroups(deletedSpecs); } catch (Throwable e) { log.error(e, "Error loading configuration from db"); } }

Target:
public synchronized void load() { try { Map.Entry<ManagerSpec, Map<ResourceGroupIdTemplate, ResourceGroupSpec>> specsFromDb = buildSpecsFromDb(); ManagerSpec managerSpec = specsFromDb.getKey(); Map<ResourceGroupIdTemplate, ResourceGroupSpec> resourceGroupSpecs = specsFromDb.getValue(); Set<ResourceGroupIdTemplate> changedSpecs = new HashSet<>(); Set<ResourceGroupIdTemplate> deletedSpecs = Sets.difference(this.resourceGroupSpecs.keySet(), resourceGroupSpecs.keySet()); for (Map.Entry<ResourceGroupIdTemplate, ResourceGroupSpec> entry : resourceGroupSpecs.entrySet()) { if (!entry.getValue().sameConfig(this.resourceGroupSpecs.get(entry.getKey()))) { changedSpecs.add(entry.getKey()); } } this.resourceGroupSpecs = resourceGroupSpecs; this.cpuQuotaPeriod.set(managerSpec.getCpuQuotaPeriod()); this.rootGroups.set(managerSpec.getRootGroups()); List<ResourceGroupSelector> selectors = buildSelectors(managerSpec); if (exactMatchSelectorEnabled) { ImmutableList.Builder<ResourceGroupSelector> builder = ImmutableList.builder(); builder.add(new DbSourceExactMatchSelector(environment, dao)); builder.addAll(selectors); this.selectors.set(builder.build()); } else { this.selectors.set(selectors); } configureChangedGroups(changedSpecs); disableDeletedGroups(deletedSpecs); } catch (Throwable e) { log.error(e, "Error loading configuration from db"); } }
Source:
public static String getThreadIdentifier(Thread thread) { return String.format("{}({})", thread.getId(), thread.getName()); }

Target:
public static String getThreadIdentifier(Thread thread) { return String.format("%d(%s)", thread.getId(), thread.getName()); }
Source:
private void formatInternal(String pattern, ZoneInfo.WallTime wallTime, ZoneInfo zoneInfo) { if (pattern.length() == 0) { return; } CharBuffer formatBuffer = CharBuffer.wrap(pattern); while (formatBuffer.remaining() > 0) { boolean outputCurrentChar = true; char currentChar = formatBuffer.get(formatBuffer.position()); if (currentChar == '%') { outputCurrentChar = handleToken(formatBuffer, wallTime, zoneInfo); } if (outputCurrentChar) { outputBuilder.append(formatBuffer.get(formatBuffer.position())); } formatBuffer.position(formatBuffer.position() + 1); } }

Target:
private void formatInternal(String pattern, ZoneInfo.WallTime wallTime, ZoneInfo zoneInfo) { CharBuffer formatBuffer = CharBuffer.wrap(pattern); while (formatBuffer.remaining() > 0) { boolean outputCurrentChar = true; char currentChar = formatBuffer.get(formatBuffer.position()); if (currentChar == '%') { outputCurrentChar = handleToken(formatBuffer, wallTime, zoneInfo); } if (outputCurrentChar) { outputBuilder.append(formatBuffer.get(formatBuffer.position())); } formatBuffer.position(formatBuffer.position() + 1); } }
Source:
private void deleteEntity() { TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder() .connectionString("connectionString") .buildAsyncClient(); TableAsyncClient tableAsyncClient = tableServiceAsyncClient.getTableAsyncClient("OfficeSupplies"); QueryOptions queryOptions = new QueryOptions(); queryOptions.setFilter("RowKey eq crayolaMarkers"); tableAsyncClient.queryEntity(queryOptions).flatMap(tableEntity -> { logger.info("Table Entity: " + tableEntity); Mono<Void> deleteEntityMono = tableAsyncClient.deleteEntity(tableEntity); return deleteEntityMono; }).subscribe(Void -> { logger.info("Delete Entity Successful."); }, error -> { logger.error("There was an error deleting the Entity. Error: " + error); }); }

Target:
private void deleteEntity() { TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder() .connectionString("connectionString") .buildAsyncClient(); TableAsyncClient tableAsyncClient = tableServiceAsyncClient.getTableAsyncClient("OfficeSupplies"); String rowKey = "crayolaMarkers"; String partitionKey = "markers"; tableAsyncClient.get(rowKey, partitionKey).flatMap(tableEntity -> { System.out.println("Table Entity: " + tableEntity); return tableAsyncClient.deleteEntity(tableEntity); }).subscribe( Void -> { }, error -> System.err.println("There was an error deleting the Entity. Error: " + error), () -> System.out.println("Delete Entity Successful.")); }
Source:
private IPath getBundleLocation(String aBundleId, VersionRange aVersionRange, boolean isSourceBundle) { BundleInfo bundleInfo = P2Utils.findBundle(aBundleId, aVersionRange, isSourceBundle); if (bundleInfo != null) { resolvedVersion = bundleInfo.getVersion(); return P2Utils.getBundleLocationPath(bundleInfo); } else { Bundle[] bundles= Platform.getBundles(aBundleId, aVersionRange.toString()); Bundle bestMatch = null; if (bundles != null) { for (Bundle bundle : bundles) { if (bestMatch == null || bundle.getState() > bestMatch.getState()) { bestMatch= bundle; } } } if (bestMatch == null) { return null; } resolvedVersion = bestMatch.getVersion().toString(); try { if (bundleRoot == null) { return new Path(FileLocator.getBundleFile(bestMatch).getAbsolutePath()); } else { resolvedVersion = bestMatch.getVersion().toString(); URL rootUrl= bestMatch.getEntry("/"); URL fileRootUrl= FileLocator.toFileURL(rootUrl); return new Path(fileRootUrl.getPath()); } } catch (IOException ex) { JUnitCorePlugin.log(ex); } } return null; }

Target:
private IPath getBundleLocation(String aBundleId, VersionRange aVersionRange, boolean isSourceBundle) { BundleInfo bundleInfo = P2Utils.findBundle(aBundleId, aVersionRange, isSourceBundle); if (bundleInfo != null) { resolvedVersion = bundleInfo.getVersion(); return P2Utils.getBundleLocationPath(bundleInfo); } else { Bundle[] bundles= Platform.getBundles(aBundleId, aVersionRange.toString()); Bundle bestMatch = null; if (bundles != null) { for (Bundle bundle : bundles) { if (bestMatch == null || bundle.getState() > bestMatch.getState()) { bestMatch= bundle; } } } if (bestMatch == null) { return null; } resolvedVersion = bestMatch.getVersion().toString(); try { if (bundleRoot == null) { return new Path(FileLocator.getBundleFile(bestMatch).getAbsolutePath()); } else { URL rootUrl= bestMatch.getEntry("/"); URL fileRootUrl= FileLocator.toFileURL(rootUrl); return new Path(fileRootUrl.getPath()); } } catch (IOException ex) { JUnitCorePlugin.log(ex); } } return null; }
Source:
private static List<GoNamedElement> getFieldDefinitions(@NotNull GoFieldDeclaration declaration) { GoNamedElement anonymousDefinition = ObjectUtils.tryCast(declaration.getAnonymousFieldDefinition(), GoNamedElement.class); return anonymousDefinition != null ? list(anonymousDefinition) : map(declaration.getFieldDefinitionList(), definition -> ObjectUtils.tryCast(definition, GoNamedElement.class)); }

Target:
private static List<? extends GoNamedElement> getFieldDefinitions(@NotNull GoFieldDeclaration declaration) { GoAnonymousFieldDefinition anonymousDefinition = declaration.getAnonymousFieldDefinition(); return anonymousDefinition != null ? list(anonymousDefinition) : declaration.getFieldDefinitionList(); }
Source:
private Collection<CommandAssociatedEntity> buildCommandAssociatedEntities(Guid cmdId, SubjectEntity... subjectEntities) { if (subjectEntities.length == 0) { return Collections.emptyList(); } Set<CommandAssociatedEntity> results = new HashSet<>(subjectEntities.length); for (SubjectEntity subjectEntity : subjectEntities) { results.add(new CommandAssociatedEntity(cmdId, subjectEntity.getEntityType(), subjectEntity.getEntityId())); } return results; }

Target:
private Collection<CommandAssociatedEntity> buildCommandAssociatedEntities(Guid cmdId, SubjectEntity... subjectEntities) { if (subjectEntities.length == 0) { return Collections.emptyList(); } Set<SubjectEntity> entities = new HashSet<>(Arrays.asList(subjectEntities)); List<CommandAssociatedEntity> results = new ArrayList<>(entities.size()); for (SubjectEntity subjectEntity : entities) { results.add(new CommandAssociatedEntity(cmdId, subjectEntity.getEntityType(), subjectEntity.getEntityId())); } return results; }
Source:
public void scaleService(String service, Integer instances) throws Exception { if (ThreadProperty.get("deploy_api_id") == null) { fail("deploy_api_id variable is not set. Check deploy-api is installed and @dcos annotation is working properly."); } String endPoint = "/service/" + ThreadProperty.get("deploy_api_id") + "/deploy/scale?instances=" + instances + "&serviceName=" + service; Future<Response> response; response = commonspec.generateRequest("PUT", false, null, null, endPoint, "", null, ""); commonspec.setResponse("PUT", response.get()); if (!(commonspec.getResponse().getStatusCode() != 200 && commonspec.getResponse().getStatusCode() != 201)) { logger.error("Request failed to endpoint: " + endPoint + " with status code: " + commonspec.getResponse().getStatusCode() + " and response: " + commonspec.getResponse().getResponse()); throw new Exception("Request failed to endpoint: " + endPoint + " with status code: " + commonspec.getResponse().getStatusCode() + " and response: " + commonspec.getResponse().getResponse()); } }

Target:
public void scaleService(String service, Integer instances) throws Exception { if (ThreadProperty.get("deploy_api_id") == null) { fail("deploy_api_id variable is not set. Check deploy-api is installed and @dcos annotation is working properly."); } String endPoint = "/service/" + ThreadProperty.get("deploy_api_id") + "/deploy/scale?instances=" + instances + "&serviceName=" + service; Future<Response> response; response = commonspec.generateRequest("PUT", false, null, null, endPoint, "", null, ""); commonspec.setResponse("PUT", response.get()); if (commonspec.getResponse().getStatusCode() != 200 && commonspec.getResponse().getStatusCode() != 201) { logger.error("Request failed to endpoint: " + endPoint + " with status code: " + commonspec.getResponse().getStatusCode() + " and response: " + commonspec.getResponse().getResponse()); throw new Exception("Request failed to endpoint: " + endPoint + " with status code: " + commonspec.getResponse().getStatusCode() + " and response: " + commonspec.getResponse().getResponse()); } }
Source:
public void creates_table_on_empty_db() throws SQLException { underTest.execute(); assertThat(dbTester.countRowsOfTable(TABLE_RULES_METADATA)).isEqualTo(0); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "rule_id", Types.INTEGER, null, false); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "organization_uuid", Types.VARCHAR, 40, false); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "note_data", Types.CLOB, null, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "note_user_login", Types.VARCHAR, 255, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "note_created_at", Types.BIGINT, null, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "note_updated_at", Types.BIGINT, null, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "remediation_function", Types.VARCHAR, 20, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "remediation_gap_mult", Types.VARCHAR, 20, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "remediation_base_effort", Types.VARCHAR, 20, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "TAGS", Types.VARCHAR, 4000, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "created_at", Types.BIGINT, null, false); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "updated_at", Types.BIGINT, null, false); dbTester.assertPrimaryKey(TABLE_RULES_METADATA, "pk_rules_metadata", "rule_id", "organization_uuid"); }

Target:
public void creates_table_on_empty_db() throws SQLException { underTest.execute(); assertThat(dbTester.countRowsOfTable(TABLE_RULES_METADATA)).isEqualTo(0); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "rule_id", Types.INTEGER, null, false); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "organization_uuid", Types.VARCHAR, 40, false); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "note_data", Types.CLOB, null, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "note_user_login", Types.VARCHAR, 255, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "note_created_at", Types.BIGINT, null, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "note_updated_at", Types.BIGINT, null, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "remediation_function", Types.VARCHAR, 20, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "remediation_gap_mult", Types.VARCHAR, 20, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "remediation_base_effort", Types.VARCHAR, 20, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "tags", Types.VARCHAR, 4000, true); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "created_at", Types.BIGINT, null, false); dbTester.assertColumnDefinition(TABLE_RULES_METADATA, "updated_at", Types.BIGINT, null, false); dbTester.assertPrimaryKey(TABLE_RULES_METADATA, "pk_rules_metadata", "rule_id", "organization_uuid"); }
Source:
public void updateIdentifiersCreatesExternalIdWithAssignment() { mockAccountNoEmail(); when(accountDao.authenticate(STUDY, PHONE_PASSWORD_SIGN_IN)).thenReturn(account); STUDY.setEmailVerificationEnabled(false); STUDY.setAutoVerificationEmailSuppressed(false); IdentifierUpdate update = new IdentifierUpdate(PHONE_PASSWORD_SIGN_IN, null, null, "extid"); participantService.updateIdentifiers(STUDY, CONTEXT, update); assertEquals("extid", account.getExternalId()); verify(externalIdService).beginAssignExternalId(account, "extid"); }

Target:
public void updateIdentifiersCreatesExternalIdWithAssignment() { ExternalIdentifier differentExternalId = ExternalIdentifier.create(TestConstants.TEST_STUDY, "extid"); mockAccountNoEmail(); when(accountDao.authenticate(STUDY, PHONE_PASSWORD_SIGN_IN)).thenReturn(account); when(externalIdService.getExternalId(any(), eq("extid"), eq(false))).thenReturn(differentExternalId); STUDY.setEmailVerificationEnabled(false); STUDY.setAutoVerificationEmailSuppressed(false); IdentifierUpdate update = new IdentifierUpdate(PHONE_PASSWORD_SIGN_IN, null, null, "extid"); participantService.updateIdentifiers(STUDY, CONTEXT, update); assertEquals("extid", account.getExternalId()); verify(externalIdService).commitAssignExternalId(differentExternalId); }
Source:
public PipeRunResult doPipe(Message input, IPipeLineSession session, IOutputStreamingSupport nextProvider) throws PipeRunException { if (input==null) { throw new PipeRunException(this, getLogPrefix(session)+"got null input"); } Message message = new Message(input); try { if (StringUtils.isNotEmpty(getSessionKey())) { nextProvider=null; } else { if (nextProvider==null) { nextProvider = getStreamTarget(); } } PipeRunResult prr = sender.sendMessage(message, session, nextProvider); Object result = prr.getResult(); if (result instanceof StringWriter) { result = result.toString(); } PipeForward forward = prr.getPipeForward(); if (forward==null) { forward=getForward(); } if (StringUtils.isEmpty(getSessionKey())) { return new PipeRunResult(forward, result); } session.put(getSessionKey(), result); return new PipeRunResult(getForward(), input); } catch (Exception e) { throw new PipeRunException(this, getLogPrefix(session) + " Exception on transforming input", e); } }

Target:
public PipeRunResult doPipe(Message input, IPipeLineSession session, IOutputStreamingSupport nextProvider) throws PipeRunException { if (input==null) { throw new PipeRunException(this, getLogPrefix(session)+"got null input"); } try { if (StringUtils.isNotEmpty(getSessionKey())) { nextProvider=null; } else { if (nextProvider==null) { nextProvider = getStreamTarget(); } } PipeRunResult prr = sender.sendMessage(input, session, nextProvider); Object result = prr.getResult(); if (result instanceof StringWriter) { result = result.toString(); } PipeForward forward = prr.getPipeForward(); if (forward==null) { forward=getForward(); } if (StringUtils.isEmpty(getSessionKey())) { return new PipeRunResult(forward, result); } session.put(getSessionKey(), result); return new PipeRunResult(getForward(), input); } catch (Exception e) { throw new PipeRunException(this, getLogPrefix(session) + " Exception on transforming input", e); } }
Source:
public int hashCode() { return (int)getId(); }

Target:
public int hashCode() { if (hash != null) return hash; final int prime = 31; int h = 1; int id = (int)getId(); h = prime * h + (int) (id ^ (id >>> 32)); hash = h; return hash; }
Source:
private void clearAsyncTasksWithOutVdsmId() { for (Guid asyncTaskId : getReturnValue().getAsyncTaskIdList()) { AsyncTasks task = DbFacade.getInstance().getAsyncTaskDao().get(asyncTaskId); if (task.getVdsmTaskId().equals(NGuid.Empty)) { AsyncTaskManager.failTaskWithoutVdsmId(task); } } }

Target:
private void clearAsyncTasksWithOutVdsmId() { for (Guid asyncTaskId : getReturnValue().getAsyncTaskIdList()) { AsyncTasks task = getAsyncTaskDao().get(asyncTaskId); if (task.getVdsmTaskId().equals(NGuid.Empty)) { AsyncTaskManager.failTaskWithoutVdsmId(task); } } }
Source:
public @NonNull List<@NonNull String> getMarkerCategories() { ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace(); if (activeTrace == null) { return Collections.emptyList(); } UUID uuid = activeTrace.getUUID(); Collection<String> collection = fCategories.computeIfAbsent(uuid, new Function<Object, Collection<String>>() { @Override public Collection<String> apply(Object t) { ContextDataSource dataProvider = DataProviderManager.getInstance().getDataProvider(activeTrace, ContextDataSource.ID, ContextDataSource.class); if (dataProvider == null) { return Collections.emptyList(); } TmfModelResponse<@NonNull List<@NonNull TmfTreeDataModel>> tree = dataProvider.fetchTree(new TimeQueryFilter(Collections.emptyList()), new NullProgressMonitor()); List<@NonNull TmfTreeDataModel> model = tree.getModel(); if (model == null) { return Collections.emptyList(); } Set<String> data = new HashSet<>(); for (TmfTreeDataModel elem : model) { data.add(elem.getName()); } return data; } }); List<String> retVal = new ArrayList<>(collection); retVal.sort(null); return retVal; }

Target:
public @NonNull List<@NonNull String> getMarkerCategories() { ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace(); if (activeTrace == null) { return Collections.emptyList(); } UUID uuid = activeTrace.getUUID(); Collection<String> collection = fCategories.computeIfAbsent(uuid, t -> { ContextDataSource dataProvider = DataProviderManager.getInstance().getDataProvider(activeTrace, ContextDataSource.ID, ContextDataSource.class); if (dataProvider == null) { return Collections.emptyList(); } TmfModelResponse<@NonNull List<@NonNull TimeGraphEntryModel>> tree = dataProvider.fetchTree(new TimeQueryFilter(Collections.emptyList()), new NullProgressMonitor()); List<@NonNull TimeGraphEntryModel> model = tree.getModel(); if (model == null) { return Collections.emptyList(); } Set<String> data = new HashSet<>(); for (TmfTreeDataModel elem : model) { data.add(elem.getName()); } List<String> dataList = Lists.newArrayList(data); dataList.sort(null); return dataList; }); List<String> retVal = new ArrayList<>(collection); retVal.sort(null); return retVal; }
Source:
public Receive createReceive() { return receiveBuilder() .match(Execute.class, e -> { getSelf().tell(PoisonPill.getInstance(), getSelf()); final Job j = e.getRepo().get(e.getJobId()); if (j == null) { LOGGER.error() .setMessage("repository has no job with given id") .addData("repo", e.getRepo()) .addData("jobId", e.getJobId()) .log(); e.getNotifiee().tell(new Failure(new NoSuchElementException(e.getJobId())), getSelf()); return; } j.start().handle((result, err) -> { e.getNotifiee().tell( err == null ? Success.INSTANCE : new Failure(err), getSelf() ); return null; }); }) .build(); }

Target:
public Receive createReceive() { return receiveBuilder() .match(Execute.class, e -> { getSelf().tell(PoisonPill.getInstance(), getSelf()); final Optional<Job> job = e.getRepo().getJob(e.getJobId()); if (!job.isPresent()) { e.getNotifiee().tell(new Failure(new NoSuchElementException(e.getJobId().toString())), getSelf()); return; } PatternsCS.pipe( job.get().start().handle((r, err) -> err == null ? Success.INSTANCE : new Failure(err)), getContext().dispatcher() ).to(e.getNotifiee()); }) .build(); }
Source:
public void setUp() { this.model = new SortedListModel<TestItem>() { @Override protected Configurator lookupConfigurator() { return null; } @Override protected ILogger lookupLogger() { return null; } }; model.comparator = makeValueAscComparator(); }

Target:
public void setUp() { testedModel = new SortedListModel<TestItem>() { @Override protected Configurator lookupConfigurator() { return null; } @Override protected ILogger lookupLogger() { return null; } }; }
Source:
public void onReady(IPCClient client) { if (reconnecting) { getLogger().info("Discord RPC >> Reconnected!"); reconnectTries = 1; } else { getLogger().info("Discord RPC >> Connected!"); connectedBefore = true; } this.ipcClient = client; if (!ready) { ready = true; } if (lastRichPresence == null) { RichPresence.Builder builder = new RichPresence.Builder(); builder.setLargeImage("ss_6"); lastRichPresence = builder.build(); } client.sendRichPresence(lastRichPresence); }

Target:
public void onReady(IPCClient client) { if (reconnecting) { logger.info("Discord RPC >> Reconnected!"); reconnectTries = 1; } else { logger.info("Discord RPC >> Connected!"); connectedBefore = true; } this.ipcClient = client; if (!ready) { ready = true; } if (lastRichPresence == null) { RichPresence.Builder builder = new RichPresence.Builder(); builder.setLargeImage(DISCORD_APP_LARGE_IMAGE); lastRichPresence = builder.build(); } client.sendRichPresence(lastRichPresence); }