auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected AddDiskParameters buildAddDiskParameters(DiskImage image) { image.setVolumeFormat(VolumeFormat.COW); image.setVolumeType(VolumeType.Sparse); AddDiskParameters diskParameters = new AddDiskParameters(image.getDiskVmElementForVm(getVmTemplateId()), image); diskParameters.setStorageDomainId(getParameters().getImageToDestinationDomainMap().get(image.getId())); diskParameters.setParentCommand(getActionType()); diskParameters.setParentParameters(getParameters()); diskParameters.setShouldRemainIllegalOnFailedExecution(true); diskParameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); diskParameters.setUsePassedDiskId(true); diskParameters.setUsePassedImageId(true); return diskParameters; }

Target:
protected AddDiskParameters buildAddDiskParameters(DiskImage image) { AddDiskParameters diskParameters = new AddDiskParameters(image.getDiskVmElementForVm(getVmTemplateId()), image); diskParameters.setStorageDomainId(getParameters().getImageToDestinationDomainMap().get(image.getId())); diskParameters.setParentCommand(getActionType()); diskParameters.setParentParameters(getParameters()); diskParameters.setShouldRemainIllegalOnFailedExecution(true); diskParameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); diskParameters.setUsePassedDiskId(true); diskParameters.setUsePassedImageId(true); return diskParameters; }
Source:
private void perform( Action action ) throws Exception { ExecutorService service = Executors.newFixedThreadPool( lifecycles.size() ); List<Future<?>> futures = new ArrayList<>(); for ( Lifecycle lifecycle : lifecycles ) { futures.add( service.submit( () -> { try { action.act( lifecycle ); } catch ( Throwable e ) { throw new RuntimeException( e ); } } ) ); } service.shutdown(); if ( !service.awaitTermination( timeout, unit ) ) { for ( Future<?> future : futures ) { future.cancel( true ); } } Exception exception = null; for ( Future<?> future : futures ) { try { future.get(); } catch ( InterruptedException | ExecutionException e ) { exception = combine( exception, e ); } } if ( exception != null ) { throw exception; } }

Target:
private void perform( Action action ) throws Exception { ExecutorService service = Executors.newFixedThreadPool( lifecycles.size() ); List<Future<?>> futures = new ArrayList<>(); for ( Lifecycle lifecycle : lifecycles ) { futures.add( service.submit( () -> { try { action.act( lifecycle ); } catch ( Throwable e ) { throw new RuntimeException( e ); } } ) ); } service.shutdown(); if ( !service.awaitTermination( timeout, unit ) ) { for ( Future<?> future : futures ) { future.cancel( true ); } } Exception exception = null; for ( Future<?> future : futures ) { try { future.get(); } catch ( InterruptedException | ExecutionException e ) { if ( exception == null ) { exception = new RuntimeException(); } exception.addSuppressed( e ); } } if ( exception != null ) { throw exception; } }
Source:
private void addColumnName(String columnName, boolean updateUI) { JTextField columnNameField = WidgetFactory.createTextField(); if (columnName != null) { columnNameField.setText(columnName); } _innerPanel.add(columnNameField); if (updateUI) { _innerPanel.updateUI(); } }

Target:
private void addColumnName(String columnName, boolean updateUI) { final JTextField columnNameField = WidgetFactory.createTextField(); if (columnName != null) { columnNameField.setText(columnName); } _innerPanel.add(columnNameField); if (updateUI) { _innerPanel.updateUI(); } }
Source:
public void testSampleExtremeMeanCoverage(final List<SampleCoverageStats> sampleStats, final double minMean, final double maxMean) throws IOException { final File samplesFile = createSampleStatsFile(sampleStats); final List<SampleCoverageStats> leftInSamples = sampleStats.stream() .filter(stats -> stats.mean >= minMean && stats.mean <= maxMean) .collect(Collectors.toList()); final List<SampleCoverageStats> leftOutSamples = sampleStats.stream() .filter(stats -> stats.mean < minMean || stats.mean > maxMean) .collect(Collectors.toList()); final File outputFile = createTempFile("output", ".tab"); final File rejectionFile = createTempFile("reject", ".tab"); runCommandLine(new String[] { "-" + StandardArgumentDefinitions.INPUT_SHORT_NAME, samplesFile.getPath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getPath(), "-" + FilterSamples.MINIMUM_MEAN_COVERAGE_SHORT_NAME, String.valueOf(minMean), "-" + FilterSamples.MAXIMUM_MEAN_COVERAGE_SHORT_NAME, String.valueOf(maxMean), "-" + FilterTargets.REJECT_OUTPUT_FILE_SHORT_NAME, rejectionFile.getPath(), }); checkLeftInTargets(leftInSamples, outputFile); checkRejectedTargets(leftOutSamples, rejectionFile, FilterSamples.SampleFilter.ExtremeCoverageMean); }

Target:
public void testSampleExtremeMeanCoverage(final List<SampleCoverageStats> sampleStats, final double minMean, final double maxMean) throws IOException { final File samplesFile = createSampleStatsFile(sampleStats); final List<SampleCoverageStats> leftInSamples = sampleStats.stream() .filter(stats -> stats.mean >= minMean && stats.mean <= maxMean) .collect(Collectors.toList()); final List<SampleCoverageStats> leftOutSamples = sampleStats.stream() .filter(stats -> stats.mean < minMean || stats.mean > maxMean) .collect(Collectors.toList()); final File outputFile = createTempFile("output", ".tab"); final File rejectionFile = createTempFile("reject", ".tab"); runCommandLine(new String[] { "-" + StandardArgumentDefinitions.INPUT_SHORT_NAME, samplesFile.getPath(), "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getPath(), "-" + FilterSamples.MINIMUM_MEAN_COVERAGE_SHORT_NAME, String.valueOf(minMean), "-" + FilterSamples.MAXIMUM_MEAN_COVERAGE_SHORT_NAME, String.valueOf(maxMean), "-" + FilterSamples.REJECTION_FILE_SHORT_NAME, rejectionFile.getPath(), }); checkLeftInSamples(leftInSamples, outputFile); checkRejectedSamples(leftOutSamples, rejectionFile, FilterSamples.SampleFilter.ExtremeCoverageMean); }
Source:
private void swapHyperLogLogPlus() { if (System.currentTimeMillis() - hyperLogSwapTS.get() > hyperLogLogPlusSwapPeriod && hyperLogSwapLock.compareAndExchange(false, true)) { hyperLog = new HyperLogLogPlus(14, 25); hyperLogSwapTS = new AtomicLong(System.currentTimeMillis()); hyperLogSwapLock.set(false); } }

Target:
private void swapHyperLogLogPlus() { if (System.currentTimeMillis() - hyperLogSwapTS.get() > hyperLogLogPlusSwapPeriodMS && hyperLogSwapLock.compareAndExchange(false, true)) { hyperLog.set(new HyperLogLogPlus( HYPER_LOG_LOG_PLUS_PRECISION_NORMAL, HYPER_LOG_LOG_PLUS_PRECISION_SPARSE)); hyperLogSwapTS.set(System.currentTimeMillis()); hyperLogSwapLock.set(false); } }
Source:
public StramLocalCluster(LogicalPlan dag) throws IOException, ClassNotFoundException { dag.validate(); cloneLogicalPlan(dag); String pathUri = CLUSTER_WORK_DIR.toURI().toString(); try { FileContext.getLocalFSFileContext().delete(new Path(pathUri ), true); } catch (IllegalArgumentException e) { throw e; } catch (IOException e) { throw new RuntimeException("could not cleanup test dir", e); } dag.getAttributes().put(LogicalPlan.APPLICATION_ID, "app_local_" + System.currentTimeMillis()); if (dag.getAttributes().get(LogicalPlan.APPLICATION_PATH) == null) { dag.getAttributes().put(LogicalPlan.APPLICATION_PATH, pathUri); } StorageAgent agent = dag.getAttributes().get(OperatorContext.STORAGE_AGENT); if (agent != null && agent instanceof AppIdAwareStorageAgent) { AppIdAwareStorageAgent ap = (AppIdAwareStorageAgent)dag.getAttributes().get(OperatorContext.STORAGE_AGENT); ap.saveAppId(dag.getAttributes().get(LogicalPlan.APPLICATION_ID)); dag.setAttribute(OperatorContext.STORAGE_AGENT, ap); } if (dag.getAttributes().get(OperatorContext.STORAGE_AGENT) == null) { dag.setAttribute(OperatorContext.STORAGE_AGENT, new AsyncFSStorageAgent(new Path(pathUri, LogicalPlan.SUBDIR_CHECKPOINTS).toString(), null)); } this.dnmgr = new StreamingContainerManager(dag); this.umbilical = new UmbilicalProtocolLocalImpl(); if (!perContainerBufferServer) { StreamingContainer.eventloop.start(); bufferServer = new Server(0, 1024 * 1024,8); bufferServer.setSpoolStorage(new DiskStorage()); SocketAddress bindAddr = bufferServer.run(StreamingContainer.eventloop); this.bufferServerAddress = ((InetSocketAddress)bindAddr); LOG.info("Buffer server started: {}", bufferServerAddress); } }

Target:
public StramLocalCluster(LogicalPlan dag) throws IOException, ClassNotFoundException { dag.validate(); cloneLogicalPlan(dag); String pathUri = CLUSTER_WORK_DIR.toURI().toString(); try { FileContext.getLocalFSFileContext().delete(new Path(pathUri ), true); } catch (IllegalArgumentException e) { throw e; } catch (IOException e) { throw new RuntimeException("could not cleanup test dir", e); } dag.getAttributes().put(LogicalPlan.APPLICATION_ID, "app_local_" + System.currentTimeMillis()); if (dag.getAttributes().get(LogicalPlan.APPLICATION_PATH) == null) { dag.getAttributes().put(LogicalPlan.APPLICATION_PATH, pathUri); } if (dag.getAttributes().get(OperatorContext.STORAGE_AGENT) == null) { dag.setAttribute(OperatorContext.STORAGE_AGENT, new AsyncFSStorageAgent(new Path(pathUri, LogicalPlan.SUBDIR_CHECKPOINTS).toString(), null)); } this.dnmgr = new StreamingContainerManager(dag); this.umbilical = new UmbilicalProtocolLocalImpl(); if (!perContainerBufferServer) { StreamingContainer.eventloop.start(); bufferServer = new Server(0, 1024 * 1024,8); bufferServer.setSpoolStorage(new DiskStorage()); SocketAddress bindAddr = bufferServer.run(StreamingContainer.eventloop); this.bufferServerAddress = ((InetSocketAddress)bindAddr); LOG.info("Buffer server started: {}", bufferServerAddress); } }
Source:
public void onEvent(@NonNull Action action, @NonNull KubernetesSlave node, @NonNull Pod pod) { String ns = pod.getMetadata().getNamespace(); String name = pod.getMetadata().getName(); List<ContainerStatus> backOffContainers = PodUtils.getContainers(pod, cs -> { ContainerStateWaiting waiting = cs.getState().getWaiting(); return waiting != null && waiting.getMessage() != null && waiting.getMessage().contains("Back-off pulling image"); }); if (backOffContainers.isEmpty()) { return; } backOffContainers.forEach(cs -> { TaskListener runListener = node.getTemplate().getListener(); runListener.error("Unable to pull Docker image \""+cs.getImage()+"\". Check if image tag name is spelled correctly."); }); Queue q = Jenkins.get().getQueue(); String runUrl = pod.getMetadata().getAnnotations().get("runUrl"); for (Queue.Item item: q.getItems()) { if (item.task.getUrl().equals(runUrl)) { q.cancel(item); break; } } try { node.terminate(); } catch (Exception x) { LOGGER.log(Level.WARNING, "failed to reap " + ns + "/" + name, x); } }

Target:
public void onEvent(@NonNull Action action, @NonNull KubernetesSlave node, @NonNull Pod pod) throws IOException, InterruptedException { List<ContainerStatus> backOffContainers = PodUtils.getContainers(pod, cs -> { ContainerStateWaiting waiting = cs.getState().getWaiting(); return waiting != null && waiting.getMessage() != null && waiting.getMessage().contains("Back-off pulling image"); }); if (backOffContainers.isEmpty()) { return; } backOffContainers.forEach(cs -> { TaskListener runListener = node.getTemplate().getListener(); runListener.error("Unable to pull Docker image \""+cs.getImage()+"\". Check if image tag name is spelled correctly."); }); Queue q = Jenkins.get().getQueue(); String runUrl = pod.getMetadata().getAnnotations().get("runUrl"); for (Queue.Item item: q.getItems()) { if (item.task.getUrl().equals(runUrl)) { q.cancel(item); break; } } node.terminate(); }
Source:
public void deleteByUnknownId() throws Exception { Cellular3GPPNetwork cellularNetwork = new Cellular3GPPNetwork("name", 359, 55); repository.create(new NewServiceProvider("name1", "Description1", cellularNetwork)); repository.delete(new ID("someID")); List<ServiceProvider> result = repository.findAll(); assertThat(result.size(), is(1)); }

Target:
public void deleteByUnknownId() throws Exception { NewServiceProvider provider = newServiceProvider().build(); repository.create(provider); repository.delete(new ID("someID")); List<ServiceProvider> result = repository.findAll(); assertThat(result.size(), is(1)); }
Source:
public void testJSONBeanValueTypes() throws Exception { JSONBean bean = new JSONBean(); StringWriter stringWriter = new StringWriter(); try ( PrintWriter printWriter = new PrintWriter(stringWriter); JSONBean.Writer jsonWriter = bean.open(printWriter)) { jsonWriter.write(getMockMBeanServer(), null, null, false); } final Gson GSON = GsonUtil.createGson().create(); Type typeOfHashMap = new TypeToken<Map<String, Object>>() {}.getType(); Map<String, Object> expectedJson = GSON.fromJson(getExpectedJSON(), typeOfHashMap); Map<String, Object> actualJson = GSON.fromJson(stringWriter.toString(), typeOfHashMap); assertEquals(expectedJson, actualJson); }

Target:
public void testJSONBeanValueTypes() throws Exception { JSONBean bean = new JSONBean(); StringWriter stringWriter = new StringWriter(); try ( PrintWriter printWriter = new PrintWriter(stringWriter); JSONBean.Writer jsonWriter = bean.open(printWriter)) { jsonWriter.write(getMockMBeanServer(), null, null, false); } final Gson gson = GsonUtil.createGson().create(); Type typeOfHashMap = new TypeToken<Map<String, Object>>() {}.getType(); Map<String, Object> expectedJson = gson.fromJson(getExpectedJSON(), typeOfHashMap); Map<String, Object> actualJson = gson.fromJson(stringWriter.toString(), typeOfHashMap); assertEquals(expectedJson, actualJson); }
Source:
private void addPluginDependenciesAdditionalLibraries(List<BundleDependency> applicationDependencies) { List<BundleDependency> mulePlugins = applicationDependencies .stream() .filter(bundleDependency -> Classifier.MULE_PLUGIN .equals(bundleDependency.getDescriptor().getClassifier().orElse(null))) .collect(Collectors.toList()); Collection<Plugin> additionalDependenciesFromMulePlugins = resolveAdditionalDependenciesFromMulePlugins(mulePlugins); pluginsWithAdditionalDependencies.addAll(additionalDependenciesFromMulePlugins.stream() .filter(notIsRedefinedAtApplicationLevel()) .collect(Collectors.toList())); }

Target:
private void addPluginDependenciesAdditionalLibraries(List<BundleDependency> applicationDependencies) { List<BundleDependency> mulePlugins = applicationDependencies .stream() .filter(bundleDependency -> MULE_PLUGIN .equals(bundleDependency.getDescriptor().getClassifier().orElse(null))) .collect(Collectors.toList()); Collection<Plugin> additionalDependenciesFromMulePlugins = resolveAdditionalDependenciesFromMulePlugins(mulePlugins); pluginsWithAdditionalDependencies.addAll(additionalDependenciesFromMulePlugins.stream() .filter(isNotRedefinedAtApplicationLevel()) .collect(Collectors.toList())); }
Source:
public JavaReferenceCodeMining(IJavaElement element, JavaEditor editor, IDocument document, ICodeMiningProvider provider, boolean showReferencesAtLeastOne) throws JavaModelException, BadLocationException { super(element, document, provider, null); this.showReferencesAtLeastOne= showReferencesAtLeastOne; action= e -> new FindReferencesAction(editor).run(element); }

Target:
public JavaReferenceCodeMining(IJavaElement element, JavaEditor editor, IDocument document, ICodeMiningProvider provider, boolean showReferencesAtLeastOne) throws JavaModelException, BadLocationException { super(element, document, provider, null); this.editor= editor; this.showReferencesAtLeastOne= showReferencesAtLeastOne; }
Source:
public void testOpenIntervalFirstRuleConsistency() throws Exception { final String restPath = RestBaseController.ROOT_PATH + "/sldservice/cite:ClassificationPoints2/" + getServiceUrl() + ".xml?" + "attribute=bar&ramp=red&method=quantile&intervals=2&open=true"; Document dom = getAsDOM(restPath, 200); print(dom); ByteArrayOutputStream baos = new ByteArrayOutputStream(); print(dom, baos); String resultXml = baos.toString().replace("\r", "").replace("\n", ""); Rule[] rules = checkSLD(resultXml.replace("<Rules>", sldPrefix).replace("</Rules>", sldPostfix)); assertTrue(rules.length == 2); assertTrue(rules[0].getFilter() instanceof PropertyIsEqualTo); final String restPathJenks = RestBaseController.ROOT_PATH + "/sldservice/cite:ClassificationPoints2/" + getServiceUrl() + ".xml?" + "attribute=bar&ramp=red&method=jenks&intervals=2&open=true"; Document domJenks = getAsDOM(restPathJenks, 200); print(domJenks); ByteArrayOutputStream baosJenks = new ByteArrayOutputStream(); print(domJenks, baosJenks); String resultXmlJenks = baosJenks.toString().replace("\r", "").replace("\n", ""); Rule[] rulesJenks = checkSLD( resultXmlJenks .replace("<Rules>", sldPrefix) .replace("</Rules>", sldPostfix)); assertTrue(rulesJenks.length == 2); assertTrue(rulesJenks[0].getFilter() instanceof PropertyIsEqualTo); }

Target:
public void testOpenIntervalFirstRuleConsistency() throws Exception { final String restPath = RestBaseController.ROOT_PATH + "/sldservice/cite:ClassificationPoints2/" + getServiceUrl() + ".xml?" + "attribute=bar&ramp=red&method=quantile&intervals=2&open=true"; Document dom = getAsDOM(restPath, 200); print(dom); ByteArrayOutputStream baos = new ByteArrayOutputStream(); print(dom, baos); String resultXml = baos.toString().replace("\r", "").replace("\n", ""); Rule[] rules = checkSLD(resultXml.replace("<Rules>", sldPrefix).replace("</Rules>", sldPostfix)); assertTrue(rules.length == 2); assertTrue(rules[0].getFilter() instanceof PropertyIsEqualTo); assertTrue(rules[1].getFilter() instanceof PropertyIsGreaterThan); checkNotOverlappingRules(rules[0], rules[1]); final String restPathJenks = RestBaseController.ROOT_PATH + "/sldservice/cite:ClassificationPoints2/" + getServiceUrl() + ".xml?" + "attribute=bar&ramp=red&method=jenks&intervals=2&open=true"; Document domJenks = getAsDOM(restPathJenks, 200); print(domJenks); ByteArrayOutputStream baosJenks = new ByteArrayOutputStream(); print(domJenks, baosJenks); String resultXmlJenks = baosJenks.toString().replace("\r", "").replace("\n", ""); Rule[] rulesJenks = checkSLD( resultXmlJenks .replace("<Rules>", sldPrefix) .replace("</Rules>", sldPostfix)); assertTrue(rulesJenks.length == 2); assertTrue(rulesJenks[0].getFilter() instanceof PropertyIsEqualTo); assertTrue(rulesJenks[1].getFilter() instanceof PropertyIsGreaterThan); checkNotOverlappingRules(rulesJenks[0], rulesJenks[1]); }
Source:
public LatestLinkBuilder(File dir) throws IOException { System.out.println(String.format("Writing plugin symlinks and redirects to dir: %s", dir)); index = new IndexHtmlBuilder(dir,"Permalinks to latest files"); htaccess = new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File(dir,".htaccess")), "UTF-8")); htaccess.println("# GENERATED. DO NOT MODIFY."); htaccess.println("RewriteEngine on"); }

Target:
public LatestLinkBuilder(File dir) throws IOException { System.out.println(String.format("Writing plugin symlinks and redirects to dir: %s", dir)); index = new IndexHtmlBuilder(dir,"Permalinks to latest files"); htaccess = new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File(dir,".htaccess"), true), "UTF-8")); htaccess.println("# GENERATED. DO NOT MODIFY."); htaccess.println("RewriteEngine on"); }
Source:
private long calculateWaitTimeMillis(ExponentialBackOff backoff, Optional<TDClientException> rootCause) { long waitTimeMillis = backoff.nextWaitTimeMillis(); if (rootCause.isPresent() && rootCause.get() instanceof TDClientHttpTooManyRequestsException) { TDClientHttpTooManyRequestsException tooManyRequestsException = (TDClientHttpTooManyRequestsException) rootCause.get(); Optional<Long> retryAfterSeconds = tooManyRequestsException.getRetryAfterSeconds(); if (retryAfterSeconds.isPresent()) { long maxWaitMillis = config.retryLimit * config.retryMaxIntervalMillis; long retryAfterMillis = SECONDS.toMillis(retryAfterSeconds.get()); if (retryAfterMillis > maxWaitMillis) { throw tooManyRequestsException; } waitTimeMillis = Math.max(waitTimeMillis, retryAfterMillis); } } return waitTimeMillis; }

Target:
private long calculateWaitTimeMillis(ExponentialBackOff backoff, Optional<TDClientException> rootCause) { long waitTimeMillis = backoff.nextWaitTimeMillis(); if (rootCause.isPresent() && rootCause.get() instanceof TDClientHttpException) { TDClientHttpException httpException = (TDClientHttpException) rootCause.get(); Optional<Date> retryAfter = httpException.getRetryAfter(); if (retryAfter.isPresent()) { long maxWaitMillis = config.retryLimit * config.retryMaxIntervalMillis; long now = System.currentTimeMillis(); long retryAfterMillis = retryAfter.get().getTime() - now; if (retryAfterMillis > maxWaitMillis) { throw httpException; } waitTimeMillis = Math.max(waitTimeMillis, retryAfterMillis); } } return waitTimeMillis; }
Source:
default <U> U fold(Function<Seq<? extends E>, ? extends U> fInvalid, Function<? super T, ? extends U> fValid) { Objects.requireNonNull(fInvalid, "fInvalid is null"); Objects.requireNonNull(fValid, "fValid is null"); if (isInvalid()) { final Seq<? extends E> error = this.getErrors(); return fInvalid.apply(error); } else { final T value = this.get(); return fValid.apply(value); } }

Target:
default <U> U fold(Function<Seq<? extends E>, ? extends U> fInvalid, Function<? super T, ? extends U> fValid) { Objects.requireNonNull(fInvalid, "fInvalid is null"); Objects.requireNonNull(fValid, "fValid is null"); if (isInvalid()) { return fInvalid.apply(this.getErrors()); } else { final T value = this.get(); return fValid.apply(value); } }
Source:
private boolean isInvariantTypeCastSafe( AnnotatedTypeMirror castType, AnnotatedTypeMirror exprType, AnnotationMirror top) { if (!isTypeCastSafe(castType, exprType)) { return false; } AnnotationMirror castTypeAnno = castType.getEffectiveAnnotationInHierarchy(top); AnnotationMirror exprTypeAnno = exprType.getEffectiveAnnotationInHierarchy(top); ; if (atypeFactory.hasQualifierParameterInHierarchy(exprType, top)) { return atypeFactory.getQualifierHierarchy().isSubtype(castTypeAnno, exprTypeAnno); } AnnotationMirror bottom = atypeFactory.getQualifierHierarchy().getBottomAnnotation(top); return AnnotationUtils.areSame(castTypeAnno, bottom) && AnnotationUtils.areSame(exprTypeAnno, bottom); }

Target:
private boolean isInvariantTypeCastSafe( AnnotatedTypeMirror castType, AnnotatedTypeMirror exprType, AnnotationMirror top) { if (!isTypeCastSafe(castType, exprType)) { return false; } AnnotationMirror castTypeAnno = castType.getEffectiveAnnotationInHierarchy(top); AnnotationMirror exprTypeAnno = exprType.getEffectiveAnnotationInHierarchy(top); if (atypeFactory.hasQualifierParameterInHierarchy(exprType, top)) { return atypeFactory.getQualifierHierarchy().isSubtype(castTypeAnno, exprTypeAnno); } AnnotationMirror bottom = atypeFactory.getQualifierHierarchy().getBottomAnnotation(top); return AnnotationUtils.areSame(castTypeAnno, bottom) && AnnotationUtils.areSame(exprTypeAnno, bottom); }
Source:
public MessageEncoder visit(AstExpressionValue<?> value, Void parameter) { Supplier<Object> supplier = () -> value.getValue(Object.class); return new WriteExpressionEncoder(supplier, value.getExpression()); }

Target:
public MessageEncoder visit(AstExpressionValue<?> value, Void parameter) { return new WriteExpressionEncoder(value::getValue, value.getExpression()); }
Source:
ThrowingEvaluator(String message, Throwable cause) { this.exception = new ScriptEvaluationException(message, cause); }

Target:
ThrowingEvaluator(String message, Throwable cause) { this.exception = new ExtensionConfigurationException(message, cause); }
Source:
private org.eclipse.emf.common.util.EList<Port> getAllInheritedPorts(org.eclipse.uml2.uml.Class aClass) { org.eclipse.emf.common.util.BasicEList<Port> ports = new org.eclipse.emf.common.util.BasicEList<Port>(); ports.addAll(aClass.getOwnedPorts()); for (org.eclipse.uml2.uml.Classifier parent : aClass.allParents()) { if (parent instanceof org.eclipse.uml2.uml.Class) { ports.addAll(getAllInheritedPorts((org.eclipse.uml2.uml.Class)parent)); } } return ports; }

Target:
private List<Port> getAllInheritedPorts(org.eclipse.uml2.uml.Class aClass) { ArrayList<Port> ports = new ArrayList<Port>(); ports.addAll(aClass.getOwnedPorts()); for (org.eclipse.uml2.uml.Classifier parent : aClass.allParents()) { if (parent instanceof org.eclipse.uml2.uml.Class) { ports.addAll(getAllInheritedPorts((org.eclipse.uml2.uml.Class)parent)); } } return ports; }
Source:
public static LocalDate getClosestExpirationFromStaticDate(Matcher matcher) { int day = Integer.valueOf(matcher.group(1)); int month = Integer.valueOf(matcher.group(2)); int year = LocalDate.now().getYear(); boolean extensionInNextYear; LocalDate extensionDate = LocalDate.of(year, month, day); extensionInNextYear = extensionDate.isBefore(LocalDate.now()); LocalDate localDate = LocalDate.of(year, month, day); if (extensionInNextYear) { localDate = localDate.plusYears(1); } return localDate; }

Target:
public static LocalDate getClosestExpirationFromStaticDate(Matcher matcher) { int day = Integer.valueOf(matcher.group(1)); int month = Integer.valueOf(matcher.group(2)); int year = LocalDate.now().getYear(); LocalDate extensionDate = LocalDate.of(year, month, day); boolean extensionThisYear = LocalDate.now().isBefore(extensionDate); if (!extensionThisYear) { extensionDate = extensionDate.plusYears(1); } return extensionDate; }
Source:
abstract void storeCommand() throws PersistenceException; protected String createCql(String user, String cql) { if (StringUtils.isBlank(user)) return ""; if (StringUtils.isNotBlank(cql)) { cql = "( " + cql + ") AND user='" + user + "'"; } else { cql = "user='" + user + "'"; } return cql; }

Target:
abstract void storeCommand() throws PersistenceException; protected String addUserConstraintToCql(String user, String cql) { if (StringUtils.isNotBlank(user)) { if (StringUtils.isNotBlank(cql)) { cql = cql + " AND user='" + user + "'"; } else { cql = "user='" + user + "'"; } } return cql; }
Source:
public void putCount(final CountCategory category, final int value) { if (value < 0) { throw new IllegalArgumentException("Count value must be greater than zero"); } counts.put(category, value); }

Target:
public void putCount(final CountCategory category, final int value) { if (value < 0) { throw new IllegalArgumentException("Count value must be greater than or equals to zero"); } counts.put(category, value); }
Source:
public void testInboundAdapterWithMessageConverterDefaults() { @SuppressWarnings("unchecked") List<HttpMessageConverter<?>> messageConverters = TestUtils.getPropertyValue(postOnlyAdapterWithCustomConverter, "messageConverters", List.class); assertThat(messageConverters.size() > 1 , is(true)); assertThat(messageConverters.get(0), instanceOf(SerializingHttpMessageConverter.class)); }

Target:
public void testInboundAdapterWithMessageConverterDefaults() { @SuppressWarnings("unchecked") List<HttpMessageConverter<?>> messageConverters = TestUtils.getPropertyValue(adapterWithCustomConverterWithDefaults, "messageConverters", List.class); assertTrue("There should be more than 1 message converter. The customized one and the defaults", messageConverters.size() > 1); assertThat(messageConverters.get(0), instanceOf(SerializingHttpMessageConverter.class)); }
Source:
private ArrayList<Long> getPathIDsForType(BlackboardArtifact.ARTIFACT_TYPE type) throws TskCoreException { ArrayList<Long> idList = new ArrayList(); for (BlackboardArtifact artifact : currentCase.getSleuthkitCase().getBlackboardArtifacts(type)) { BlackboardAttribute pathIDAttribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID)); if (pathIDAttribute != null) { long contentID = pathIDAttribute.getValueLong(); if (contentID != -1) { idList.add(contentID); } } } return idList; }

Target:
private Set<Long> getPathIDsForType(BlackboardArtifact.ARTIFACT_TYPE type) throws TskCoreException { Set<Long> idList = new HashSet<>(); for (BlackboardArtifact artifact : currentCase.getSleuthkitCase().getBlackboardArtifacts(type)) { BlackboardAttribute pathIDAttribute = artifact.getAttribute(new BlackboardAttribute.Type(TSK_PATH_ID)); if (pathIDAttribute != null) { long contentID = pathIDAttribute.getValueLong(); if (contentID != -1) { idList.add(contentID); } } } return idList; }
Source:
public void shouldPreserveAddressOrderOnInsertions() { Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy(); List<String> addresses = new ArrayList<>(proxy.getLocalAddresses()); for (int i = 1 ; i <= 3; i++) { String addr = Integer.toString(i); if (!addresses.contains(addr)) { addresses.add(addr); } } for (String address : addresses) { proxy.addLocalAddress(address); } List<String> localAddresses = proxy.getLocalAddresses(); for (int i = 0; i < addresses.size(); i++) { assertEquals(addresses.get(i), localAddresses.get(i)); } }

Target:
public void shouldPreserveAddressOrderOnInsertions() { Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy(); LinkedHashSet<String> addresses = new LinkedHashSet<>(proxy.getLocalAddresses()); for (int i = 1 ; i <= 3; i++) { addresses.add(Integer.toString(i)); } for (String address : addresses) { proxy.addLocalAddress(address); } List<String> localAddresses = proxy.getLocalAddresses(); Iterator<String> iterator = addresses.iterator(); for (int i = 0; i < addresses.size(); i++) { assertEquals(iterator.next(), localAddresses.get(i)); } }
Source:
public void beforeMethod() throws Exception { subConsumers = new LineConsumer[] { lineConsumer1, lineConsumer2, lineConsumer3 }; concurrentCompositeLineConsumer = new ConcurrentCompositeLineConsumer(subConsumers); executor = Executors.newFixedThreadPool(5); }

Target:
public void beforeMethod() throws Exception { subConsumers = new LineConsumer[] { lineConsumer1, lineConsumer2, lineConsumer3 }; concurrentCompositeLineConsumer = new ConcurrentCompositeLineConsumer(subConsumers); executor = Executors.newFixedThreadPool(3); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_google_login); mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(new Scope(Scopes.PROFILE)) .addScope(new Scope(Scopes.EMAIL)) .build(); findViewById(R.id.sign_in_button).setOnClickListener(this); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_google_login); mGoogleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Plus.API) .addScope(new Scope(Scopes.PROFILE)) .addScope(new Scope(Scopes.EMAIL)) .build(); mGoogleSingInButton = (SignInButton) findViewById(R.id.googleSignInButton); mButtonCancelGoogleConnection = (Button) findViewById(R.id.buttonCancelGoogleConnection); mProgressBarGoogleConnection = (ProgressBar) findViewById(R.id.progressBarGoogleConnection); mTextViewGoogleConnecting = (TextView) findViewById(R.id.textViewGoogleConnecting); mGoogleSingInButton.setOnClickListener(this); }
Source:
public NonBlockingStatsDClient build() throws StatsDClientException { Callable<SocketAddress> lookup = addressLookup; Callable<SocketAddress> telemetryLookup = null; if (lookup == null) { lookup = staticStatsDAddressResolution(hostname, port); } if (telemetryLookup == null) { if (telemetryHostname == null) { telemetryLookup = lookup; } else { telemetryLookup = staticStatsDAddressResolution(telemetryHostname, telemetryPort); } } return new NonBlockingStatsDClient(prefix, queueSize, constantTags, errorHandler, lookup, telemetryLookup, timeout, socketBufferSize, maxPacketSizeBytes, entityID, bufferPoolSize, processorWorkers, senderWorkers, blocking, enableTelemetry, telemetryFlushInterval); }

Target:
public NonBlockingStatsDClient build() throws StatsDClientException { Callable<SocketAddress> lookup = addressLookup; Callable<SocketAddress> telemetryLookup = telemetryAddressLookup; if (lookup == null) { lookup = staticStatsDAddressResolution(hostname, port); } if (telemetryLookup == null) { if (telemetryHostname == null) { telemetryLookup = lookup; } else { telemetryLookup = staticStatsDAddressResolution(telemetryHostname, telemetryPort); } } return new NonBlockingStatsDClient(prefix, queueSize, constantTags, errorHandler, lookup, telemetryLookup, timeout, socketBufferSize, maxPacketSizeBytes, entityID, bufferPoolSize, processorWorkers, senderWorkers, blocking, enableTelemetry, telemetryFlushInterval); }
Source:
public void associateCookie(final AgentIdentifier agentIdentifier, final String cookie) { final String uuid = agentIdentifier.getUuid(); final String key = agentCacheKey(uuid); List<String> uuids = singletonList(agentIdentifier.getUuid()); AgentMutex mutex = agentMutexes.acquire(uuids); synchronized (mutex) { transactionTemplate.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus status) { Agent agent = fetchAgentFromDBByUUID(uuid); if (agent == null) { agent = new Agent(uuid, agentIdentifier.getHostName(), agentIdentifier.getIpAddress(), cookie); } else { agent.setFieldValues(cookie, agentIdentifier.getHostName(), agentIdentifier.getIpAddress()); } getHibernateTemplate().saveOrUpdate(agent); final Agent updatedAgent = agent; registerCommitCallback(() -> clearCacheAndNotifyAgentEntityChangeListeners(key, updatedAgent)); } }); agentMutexes.release(uuids, mutex); } }

Target:
public void associateCookie(final AgentIdentifier agentIdentifier, final String cookie) { final String uuid = agentIdentifier.getUuid(); final String key = agentCacheKey(uuid); List<String> uuids = singletonList(agentIdentifier.getUuid()); AgentMutex mutex = agentMutexes.acquire(uuids); synchronized (mutex) { transactionTemplate.execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus status) { Agent agent = fetchAgentFromDBByUUID(uuid); if (agent == null) { throw new UnregisteredAgentException(format("Agent [%s] is not registered.", uuid), uuid); } agent.setFieldValues(cookie, agentIdentifier.getHostName(), agentIdentifier.getIpAddress()); getHibernateTemplate().saveOrUpdate(agent); final Agent updatedAgent = agent; registerAfterCommitCallback(() -> clearCacheAndNotifyAgentEntityChangeListeners(key, updatedAgent)); } }); agentMutexes.release(uuids, mutex); } }
Source:
public static String getCertKeyIdSubject(X509Certificate cert) { if (null == cert) { return null; } byte[] subjectKeyID = cert.getExtensionValue(SUBJECT_KEY_ID); String ski = null; try { if (subjectKeyID != null) { DERDecoder extVal = new DERDecoder(subjectKeyID); extVal.expect(DERDecoder.TYPE_OCTET_STRING); extVal.getLength(); extVal.expect(DERDecoder.TYPE_OCTET_STRING); int keyIDLen = extVal.getLength(); byte[] hexValue = extVal.getBytes(keyIDLen); ski = Hex.encodeHexString(hexValue); } } catch (WSSecurityException e) { LOG.error("Unable to convert SKI into human readable {}", e.getLocalizedMessage(), e); } return ski; }

Target:
public static String getCertKeyIdSubject(X509Certificate cert) { String ski = null; if (null != cert) { byte[] subjectKeyID = cert.getExtensionValue(SUBJECT_KEY_ID); try { if (subjectKeyID != null) { DERDecoder extVal = new DERDecoder(subjectKeyID); extVal.expect(DERDecoder.TYPE_OCTET_STRING); extVal.getLength(); extVal.expect(DERDecoder.TYPE_OCTET_STRING); int keyIDLen = extVal.getLength(); byte[] hexValue = extVal.getBytes(keyIDLen); ski = Hex.encodeHexString(hexValue); } } catch (WSSecurityException e) { LOG.error("Unable to decode certificate subject: {}", e.getLocalizedMessage(), e); } } return ski; }
Source:
public static boolean hasUnresolvedReferences(@NotNull List<GoExpression> expressionList) { for (GoExpression expression : expressionList) { if (expression instanceof GoReferenceExpression) { if (expression.getReference() == null || expression.getReference().resolve() == null) { return true; } if (isIllegalUseOfTypeAsExpression(expression)) { return true; } } } return false; }

Target:
public static boolean hasUnresolvedReferences(@NotNull List<GoExpression> expressionList) { for (GoExpression expression : expressionList) { if (expression instanceof GoReferenceExpression) { PsiReference ref = expression.getReference(); if (ref == null || ref.resolve() == null || isIllegalUseOfTypeAsExpression(expression)) return true; } } return false; }
Source:
public void initTopologyId() { if (persistenceManager.isPreloaded()) { if (preloadedTopologyId > 0) { clusterTopologyManager.setInitialCacheTopologyId(componentRegistry.getCacheName(), preloadedTopologyId + 1); } return; } AtomicInteger maxTopologyId = new AtomicInteger(preloadedTopologyId); Publisher<MarshalledEntry<Object, Object>> publisher = persistenceManager.publishEntries(false, true); Flowable.fromPublisher(publisher).map(MarshalledEntry::getMetadata).blockingForEach(metadata -> { EntryVersion entryVersion = metadata.version(); if (entryVersion instanceof SimpleClusteredVersion) { int entryTopologyId = ((SimpleClusteredVersion) entryVersion).topologyId; if (maxTopologyId.get() < entryTopologyId) { maxTopologyId.updateAndGet(current -> Math.max(current, entryTopologyId)); } } }); if (maxTopologyId.get() > 0) { clusterTopologyManager.setInitialCacheTopologyId(componentRegistry.getCacheName(), maxTopologyId.get() + 1); } }

Target:
public void initTopologyId() { if (persistenceManager.isPreloaded()) { if (preloadedTopologyId > 0) { clusterTopologyManager.setInitialCacheTopologyId(componentRegistry.getCacheName(), preloadedTopologyId + 1); } return; } AtomicInteger maxTopologyId = new AtomicInteger(preloadedTopologyId); Publisher<MarshalledEntry<Object, Object>> publisher = persistenceManager.publishEntries(false, true); Flowable.fromPublisher(publisher).blockingForEach(me -> { Metadata metadata = me.getMetadata(); EntryVersion entryVersion = metadata.version(); if (entryVersion instanceof SimpleClusteredVersion) { int entryTopologyId = ((SimpleClusteredVersion) entryVersion).topologyId; if (maxTopologyId.get() < entryTopologyId) { maxTopologyId.updateAndGet(current -> Math.max(current, entryTopologyId)); } } }); if (maxTopologyId.get() > 0) { clusterTopologyManager.setInitialCacheTopologyId(componentRegistry.getCacheName(), maxTopologyId.get() + 1); } }
Source:
private List<FeedbackSession> getFeedbackSessionEntitiesNeedingClosedEmail() { Query q = getPm().newQuery(FeedbackSession.class); q.declareParameters("boolean sentParam, boolean enableParam, Enum notTypeParam"); q.setFilter("sentClosedEmail == sentParam && isClosedEmailEnabled == enableParam " + "&& feedbackSessionType != notTypeParam"); return (List<FeedbackSession>) q.execute(false, false, FeedbackSessionType.PRIVATE); }

Target:
private List<FeedbackSession> getFeedbackSessionEntitiesNeedingClosedEmail() { Query q = getPm().newQuery(FeedbackSession.class); q.declareParameters("boolean sentParam, boolean enableParam, Enum notTypeParam"); q.setFilter("sentClosedEmail == sentParam && isClosingEmailEnabled == enableParam " + "&& feedbackSessionType != notTypeParam"); return (List<FeedbackSession>) q.execute(false, true, FeedbackSessionType.PRIVATE); }
Source:
public boolean validate(String value, String digest) { String salt = StringUtils.substringBefore(digest, delimiter); return saltValue(value, salt).equals(digest); }

Target:
public boolean validate(String value, String digest) { if (delimiter == NO_DELIMITER) { return (digestSource.digest(value, new byte[0])).equals(digest); } try { if (digest.indexOf(delimiter) < 0) { throw new IllegalArgumentException("No delimiter found in digest."); } final String saltBase64 = StringUtils.substringBefore(digest, valueOf(delimiter)); final byte[] salt = decode(saltBase64.getBytes(EncodingUtils.ENCODING)); return (saltBase64 + delimiter + digestSource.digest(value, salt)).equals(digest); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
Source:
public void testIteratorContents() { Deque<Character> expected = new LinkedList<>(); assertFalse(charQueue.iterator().hasNext()); for (int i = 0; i < 50; i++) { char c = testString.charAt(i); charQueue.put(c); expected.addFirst(c); } LinkedList<Character> actual = new LinkedList<>(); Iterators.addAll(actual, charQueue.iterator()); assertTrue(containsSameElements(expected, actual)); for (int i = 50; i < 60; i++) { char c = testString.charAt(i); charQueue.put(c); charQueue.flushInputBuffer(); expected.addFirst(c); } actual = new LinkedList<>(); Iterators.addAll(actual, charQueue.iterator()); assertTrue(containsSameElements(expected, actual)); for (int i = 0; i < 30; i++) { charQueue.take(); expected.removeLast(); } actual = new LinkedList<>(); Iterators.addAll(actual, charQueue.iterator()); assertTrue(containsSameElements(expected, actual)); while (!charQueue.isEmpty()) { charQueue.take(); expected.removeLast(); } assertFalse(charQueue.iterator().hasNext()); }

Target:
public void testIteratorContents() { Deque<String> expected = new LinkedList<>(); assertFalse(fStringQueue.iterator().hasNext()); for (int i = 0; i < 50; i++) { String element = TEST_STRING.get(i); fStringQueue.put(NonNullUtils.checkNotNull(element)); expected.addFirst(element); } LinkedList<String> actual = new LinkedList<>(); Iterators.addAll(actual, fStringQueue.iterator()); containsSameElements(expected, actual); for (int i = 50; i < 60; i++) { String c = TEST_STRING.get(i); fStringQueue.put(NonNullUtils.checkNotNull(c)); fStringQueue.flushInputBuffer(); expected.addFirst(c); } actual = new LinkedList<>(); Iterators.addAll(actual, fStringQueue.iterator()); containsSameElements(expected, actual); for (int i = 0; i < 30; i++) { fStringQueue.take(); expected.removeLast(); } actual = new LinkedList<>(); Iterators.addAll(actual, fStringQueue.iterator()); containsSameElements(expected, actual); while (!fStringQueue.isEmpty()) { fStringQueue.take(); expected.removeLast(); } assertFalse(fStringQueue.iterator().hasNext()); }
Source:
public static void fillTableWithIdx(BenchmarkConfiguration cfg, IgniteEx ignite, String tblName, long range, CacheAtomicityMode atomicMode) { IgniteSemaphore sem = ignite.semaphore("sql-setup", 1, true, true); try { if (sem.tryAcquire()) { println(cfg, "Create table..."); StringBuilder qry = new StringBuilder(String.format("CREATE TABLE %s (", tblName) + "id LONG PRIMARY KEY, " + "DEC_COL DECIMAL, " + "DATE_COL DATE, " + "BIG_INT_COL BIGINT" + ") WITH \"wrap_value=true"); if (atomicMode != null) qry.append(", atomicity=").append(atomicMode.name()); qry.append("\";"); String qryStr = qry.toString(); println(cfg, "Creating table with schema: " + qryStr); GridQueryProcessor qProc = ignite.context().query(); qProc.querySqlFields(new SqlFieldsQuery(qryStr), true); println(cfg, "Populate data..."); for (long l = 1; l < range; ++l) { qProc.querySqlFields( new SqlFieldsQuery(String.format("INSERT INTO %s VALUES (?, ?, ?, ?)", tblName)) .setArgs(l, new BigDecimal(l + 1), LocalDate.ofEpochDay(l), l + 2), true); if (l % 10000 == 0) println(cfg, "Populate " + l); } qProc.querySqlFields(new SqlFieldsQuery(String.format("CREATE INDEX idx1 ON %s (DEC_COL, " + "DATE_COL) inline_size 16", tblName)), true); qProc.querySqlFields(new SqlFieldsQuery(String.format("CREATE INDEX idx2 ON %s (DATE_COL, " + "BIG_INT_COL) inline_size 16", tblName)), true); println(cfg, "Finished populating data"); } else { println(cfg, "Waits for setup..."); sem.acquire(); } } finally { sem.release(); } }

Target:
public static void fillTableWithIdx(BenchmarkConfiguration cfg, IgniteEx ignite, String tblName, long range, CacheAtomicityMode atomicMode) { IgniteSemaphore sem = ignite.semaphore("sql-setup", 1, true, true); try { if (sem.tryAcquire()) { println(cfg, "Create table..."); StringBuilder qry = new StringBuilder(String.format("CREATE TABLE %s (", tblName) + "id LONG PRIMARY KEY, " + "DEC_COL DECIMAL, " + "DATE_COL DATE, " + "BIG_INT_COL BIGINT" + ") WITH \"wrap_value=true"); if (atomicMode != null) qry.append(", atomicity=").append(atomicMode.name()); qry.append("\";"); String qryStr = qry.toString(); println(cfg, "Creating table with schema: " + qryStr); GridQueryProcessor qProc = ignite.context().query(); qProc.querySqlFields(new SqlFieldsQuery(qryStr), true); println(cfg, "Populate data..."); for (long r = 1; r < range; ++r) { qProc.querySqlFields( new SqlFieldsQuery(String.format("INSERT INTO %s VALUES (?, ?, ?, ?)", tblName)) .setArgs(r, new BigDecimal(r + 1), LocalDate.ofEpochDay(r), r + 2), true); if (r % 10000 == 0) println(cfg, "Populate " + r); } qProc.querySqlFields(new SqlFieldsQuery(String.format("CREATE INDEX idx1 ON %s (DEC_COL, " + "DATE_COL) inline_size 16", tblName)), true); qProc.querySqlFields(new SqlFieldsQuery(String.format("CREATE INDEX idx2 ON %s (DATE_COL, " + "BIG_INT_COL) inline_size 16", tblName)), true); println(cfg, "Finished populating data"); } else { println(cfg, "Waits for setup..."); sem.acquire(); } } finally { sem.release(); } }
Source:
public Result getAppResponse() { try { if (responseFuture.isDone()) { return responseFuture.get(); } } catch (Exception e) { logger.error("Got exception when trying to fetch the underlying result from AsyncRpcResult.", e); } ConsumerModel consumerModel = ApplicationModel.getConsumerModel(invocation.getTargetServiceUniqueName()); String methodName = invocation.getMethodName(); String params = ReflectUtils.getDesc(invocation.getParameterTypes()); MethodDescriptor method = consumerModel.getServiceModel().getMethod(methodName, params); return new AppResponse(ReflectUtils.defaultReturn(method.getReturnClass())); }

Target:
public Result getAppResponse() { try { if (responseFuture.isDone()) { return responseFuture.get(); } } catch (Exception e) { logger.error("Got exception when trying to fetch the underlying result from AsyncRpcResult.", e); } return createDefaultValue(invocation); }
Source:
public UiAction.Description getDescription(RevisionResource resource) { PatchSet.Id current = resource.getChange().currentPatchSetId(); Map<String, String> params = ImmutableMap.of( "patchSetNumber", String.valueOf(resource.getPatchSet().getPatchSetId()), "branch", resource.getChange().getDest().getShortName()); return new UiAction.Description() .setLabel(label) .setTitle(tooltipPattern.replace(params)) .setVisible(!resource.getPatchSet().isDraft() && resource.getChange().getStatus().isOpen() && resource.getPatchSet().getId().equals(current) && resource.getControl().canSubmit()); }

Target:
public UiAction.Description getDescription(RevisionResource resource) { PatchSet.Id current = resource.getChange().currentPatchSetId(); Map<String, String> params = ImmutableMap.of( "patchSet", String.valueOf(resource.getPatchSet().getPatchSetId()), "branch", resource.getChange().getDest().getShortName()); return new UiAction.Description() .setLabel(label) .setTitle(Strings.emptyToNull(titlePattern.replace(params))) .setVisible(!resource.getPatchSet().isDraft() && resource.getChange().getStatus().isOpen() && resource.getPatchSet().getId().equals(current) && resource.getControl().canSubmit()); }
Source:
public boolean configure(StaplerRequest req, JSONObject json) throws FormException { try { configuredBuildDiscarders.rebuildHetero(req, json, BackgroundBuildDiscarderStrategyDescriptor.all(), "configuredBuildDiscarders"); return true; } catch (IOException x) { throw new FormException(x, "artifactManagerFactories"); } }

Target:
public boolean configure(StaplerRequest req, JSONObject json) throws FormException { try { configuredBuildDiscarders.rebuildHetero(req, json, GlobalBuildDiscarderStrategyDescriptor.all(), "configuredBuildDiscarders"); return true; } catch (IOException x) { throw new FormException(x, "configuredBuildDiscarders"); } }
Source:
public static void invokeMethod(Method method, Object methodObj, Object methodParam) { try { method.invoke(methodObj, methodParam); } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) { debug("Could not update config via %s: %s", method.getName(), e.getMessage()); } }

Target:
public static Object invokeMethod(Method method, Object methodObj, Object methodParam) { try { return method.invoke(methodObj, methodParam); } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) { debug("Could not invoke method %s: %s", method.getName(), e.getMessage()); } return null; }