auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void showAd(Context context) { if ((interstitialAd == null) || (context == null)) { ThreadUtils.postOnUiThread(new Runnable() { @Override public void run() { if (mediationAdLoadCallback != null) { mediationAdLoadCallback.onFailure( "Verizon Ads SDK incentivized video interstitial failed to load and cannot be shown"); } } }); return; } interstitialAd.show(context); }

Target:
public void showAd(Context context) { if ((interstitialAd == null) || (context == null)) { if (mediationAdLoadCallback != null) { mediationAdLoadCallback.onFailure("Verizon Ads SDK incentivized video interstitial failed to load and cannot be shown"); } return; } interstitialAd.show(context); }
Source:
public AzureTokenManagerProvider(CBSAuthorizationType authorizationType, String fullyQualifiedNamespace, String activeDirectoryScope) { this.activeDirectoryScope = Objects.requireNonNull(activeDirectoryScope, "'activeDirectoryScope' cannot be null."); this.fullyQualifiedNamespace = Objects.requireNonNull(fullyQualifiedNamespace, "'hostname' cannot be null."); this.authorizationType = Objects.requireNonNull(authorizationType, "'authorizationType' cannot be null."); }

Target:
public AzureTokenManagerProvider(CBSAuthorizationType authorizationType, String fullyQualifiedNamespace, String activeDirectoryScope) { this.activeDirectoryScope = Objects.requireNonNull(activeDirectoryScope, "'activeDirectoryScope' cannot be null."); this.fullyQualifiedNamespace = Objects.requireNonNull(fullyQualifiedNamespace, "'fullyQualifiedNamespace' cannot be null."); this.authorizationType = Objects.requireNonNull(authorizationType, "'authorizationType' cannot be null."); }
Source:
public void setValueFromRow(Row row, Object obj, Serializer serializer) { if (calculatedField()) return; if (row.isNull(col)) return; Object val = PropertyMappingHelper.getCassandraColumnValue(row, col, accessor.getFieldType(), serializer); accessor.setValue(obj, val); }

Target:
public void setValueFromRow(Row row, Object obj, Serializer serializer) { if (calculatedField()) return; Object val = PropertyMappingHelper.getCassandraColumnValue(row, col, accessor.getFieldType(), serializer); accessor.setValue(obj, val); }
Source:
public static Set<Annotation> getQualifiers(AnnotatedElement... elements) { return Arrays.stream(elements) .filter(Objects::nonNull) .map(AnnotatedElement::getAnnotations) .flatMap(Arrays::stream) .filter(anno -> anno.annotationType().isAnnotationPresent(Qualifier.class)) .collect(toSet()); }

Target:
private static Set<Annotation> getQualifiers(AnnotatedElement... elements) { return Collections.unmodifiableSet(Arrays.stream(elements) .filter(Objects::nonNull) .map(AnnotatedElement::getAnnotations) .flatMap(Arrays::stream) .filter(anno -> anno.annotationType().isAnnotationPresent(Qualifier.class)) .collect(toSet())); }
Source:
private String readString() throws IOException, NoOutputException { StringBuilder line = new StringBuilder(); while (true) { String subline = processOut.readLine(); if (subline == null) { StringBuilder errorMessage = new StringBuilder(); errorMessage.append("Pipe to subprocess seems to be broken!"); if (line.length() == 0) { errorMessage.append(" No output read.\n"); } else { errorMessage.append(" Currently read output: " + line.toString() + "\n"); } errorMessage.append("Serializer Exception:\n"); throw new NoOutputException(errorMessage.toString()); } if (subline.equals("end")) { break; } if (line.length() != 0) { line.append("\n"); } line.append(subline); } return line.toString(); }

Target:
private String readString() throws IOException, NoOutputException { StringBuilder line = new StringBuilder(); while (true) { String subline = processOut.readLine(); if (subline == null) { StringBuilder errorMessage = new StringBuilder(); errorMessage.append("Pipe to subprocess seems to be broken!"); if (line.length() == 0) { errorMessage.append(" No output read.\n"); } else { errorMessage.append(" Currently read output: " + line.toString() + "\n"); } throw new NoOutputException(errorMessage.toString()); } if (subline.equals("end")) { break; } if (line.length() != 0) { line.append("\n"); } line.append(subline); } return line.toString(); }
Source:
public ServicePoolBuilder<S> withZooKeeperHostDiscovery(final ZooKeeperConnection connection) { checkNotNull(connection); return withHostDiscoverySource(new HostDiscoverySource() { @Override public HostDiscovery forService(String serviceName) { HostDiscovery hostDiscovery = new ZooKeeperHostDiscovery(connection, serviceName); _closeHostDiscovery = true; return hostDiscovery; } }); }

Target:
public ServicePoolBuilder<S> withZooKeeperHostDiscovery(final ZooKeeperConnection connection) { checkNotNull(connection); HostDiscoverySource hostDiscoverySource = new HostDiscoverySource() { @Override public HostDiscovery forService(String serviceName) { return new ZooKeeperHostDiscovery(connection, serviceName); } }; return withHostDiscoverySourceInternal(hostDiscoverySource, true); }
Source:
public static List<DispoItem> cleanUpPcrTypes(List<DispoItem> items) { List<DispoItem> toModify = new ArrayList<DispoItem>(); for (DispoItem item : items) { JSONArray annotationsList = item.getAnnotationsList(); if (checkForBadReqType(annotationsList)) { try { JSONArray modifiedAnnotations = cleanAnnotationsList(annotationsList); DispoItemData modifiedItem = new DispoItemData(); modifiedItem.setAnnotationsList(modifiedAnnotations); modifiedItem.setGuid(item.getGuid()); toModify.add(modifiedItem); } catch (JSONException ex) { } } else { } } return toModify; }

Target:
public static List<DispoItem> cleanUpPcrTypes(List<DispoItem> items) { List<DispoItem> toModify = new ArrayList<DispoItem>(); for (DispoItem item : items) { JSONArray annotationsList = item.getAnnotationsList(); if (checkForBadReqType(annotationsList)) { try { JSONArray modifiedAnnotations = cleanAnnotationsList(annotationsList); DispoItemData modifiedItem = new DispoItemData(); modifiedItem.setAnnotationsList(modifiedAnnotations); modifiedItem.setGuid(item.getGuid()); toModify.add(modifiedItem); } catch (JSONException ex) { throw new OseeCoreException(ex); } } else { } } return toModify; }
Source:
public static void resolve( CrawlerResult moduleMap ) throws ModuleException { SymbolReferenceResolver resolver = new SymbolReferenceResolver( moduleMap ); try { resolver.resolveExternalSymbols(); } catch( SymbolNotFoundException | IllegalAccessSymbolException | DuplicateSymbolException e ) { throw new ModuleException( e ); } resolver.resolveLinkedType(); }

Target:
public static void resolve( CrawlerResult moduleMap ) throws ModuleException { SymbolReferenceResolver resolver = new SymbolReferenceResolver( moduleMap ); try { resolver.resolveExternalSymbols(); } catch( SymbolNotFoundException | IllegalAccessSymbolException | DuplicateSymbolException e ) { throw new ModuleException( e.getMessage() ); } resolver.resolveLinkedTypes(); }
Source:
public void onPostUploaded(PostStore.OnPostUploaded event) { final PostModel post = event.post; if (isAdded() && event.post != null) { SiteModel site = getSelectedSite(); if (site != null) { if (event.post.getLocalSiteId() == site.getId()) { UploadUtils.onPostUploadedSnackbarHandler(getActivity(), getActivity().findViewById(R.id.coordinator), event.isError(), event.post, null, site, mDispatcher); } } } }

Target:
public void onPostUploaded(PostStore.OnPostUploaded event) { if (isAdded() && event.post != null) { SiteModel site = getSelectedSite(); if (site != null) { if (event.post.getLocalSiteId() == site.getId()) { UploadUtils.onPostUploadedSnackbarHandler(getActivity(), getActivity().findViewById(R.id.coordinator), event.isError(), event.post, null, site, mDispatcher); } } } }
Source:
public static void testModelSerialization(MultiLayerNetwork net){ try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ModelSerializer.writeModel(net, baos, true); byte[] bytes = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); MultiLayerNetwork restored = ModelSerializer.restoreMultiLayerNetwork(bais, true); assertEquals(net.getLayerWiseConfigurations(), restored.getLayerWiseConfigurations()); assertEquals(net.params(), restored.params()); } catch (IOException e){ throw new RuntimeException(e); } }

Target:
public static MultiLayerNetwork testModelSerialization(MultiLayerNetwork net){ try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ModelSerializer.writeModel(net, baos, true); byte[] bytes = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); MultiLayerNetwork restored = ModelSerializer.restoreMultiLayerNetwork(bais, true); assertEquals(net.getLayerWiseConfigurations(), restored.getLayerWiseConfigurations()); assertEquals(net.params(), restored.params()); return restored; } catch (IOException e){ throw new RuntimeException(e); } }
Source:
private CompletableFuture<List<Row>> retrieveRows(ShardRouting activePrimaryRouting, RoutedCollectPhase collectPhase, CollectTask collectTask, ShardCollectorProviderFactory shardCollectorProviderFactory) { Collector<Row, ?, List<Object[]>> listCollector = Collectors.mapping(Row::materialize, Collectors.toList()); CollectingRowConsumer<?, List<Object[]>> consumer = new CollectingRowConsumer<>(listCollector); String nodeId = activePrimaryRouting.currentNodeId(); String localNodeId = clusterService.localNode().getId(); if (localNodeId.equalsIgnoreCase(nodeId)) { var indexShard = indicesService.indexServiceSafe(activePrimaryRouting.index()) .getShard(activePrimaryRouting.shardId().id()); var collectorProvider = shardCollectorProviderFactory.create(indexShard); BatchIterator<Row> it; try { it = collectorProvider.getIterator(collectPhase, consumer.requiresScroll(), collectTask); } catch (Exception e) { return Exceptions.rethrowRuntimeException(e); } consumer.accept(it, null); } else { UUID childJobId = UUID.randomUUID(); RemoteCollector remoteCollector = new RemoteCollector( childJobId, collectTask.txnCtx().sessionSettings(), localNodeId, nodeId, transportActionProvider.transportJobInitAction(), transportActionProvider.transportKillJobsNodeAction(), searchTp, tasksService, collectTask.getRamAccounting(), consumer, createRemoteCollectPhase(childJobId, collectPhase, activePrimaryRouting.shardId(), nodeId) ); remoteCollector.doCollect(); } return consumer.completionFuture() .thenApply(rows -> Lists2.map(rows, Buckets.arrayToSharedRow()::apply)); }

Target:
private CompletableFuture<List<Row>> retrieveRows(ShardRouting activePrimaryRouting, RoutedCollectPhase collectPhase, CollectTask collectTask, ShardCollectorProviderFactory shardCollectorProviderFactory) { Collector<Row, ?, List<Object[]>> listCollector = Collectors.mapping(Row::materialize, Collectors.toList()); CollectingRowConsumer<?, List<Object[]>> consumer = new CollectingRowConsumer<>(listCollector); String nodeId = activePrimaryRouting.currentNodeId(); String localNodeId = clusterService.localNode().getId(); if (localNodeId.equalsIgnoreCase(nodeId)) { var indexShard = indicesService.indexServiceSafe(activePrimaryRouting.index()) .getShard(activePrimaryRouting.shardId().id()); var collectorProvider = shardCollectorProviderFactory.create(indexShard); BatchIterator<Row> it; try { it = collectorProvider.getIterator(collectPhase, consumer.requiresScroll(), collectTask); } catch (Exception e) { return Exceptions.rethrowRuntimeException(e); } consumer.accept(it, null); } else { UUID childJobId = UUID.randomUUID(); RemoteCollector remoteCollector = new RemoteCollector( childJobId, collectTask.txnCtx().sessionSettings(), localNodeId, nodeId, transportActionProvider.transportJobInitAction(), transportActionProvider.transportKillJobsNodeAction(), searchTp, tasksService, collectTask.getRamAccounting(), consumer, createRemoteCollectPhase(childJobId, collectPhase, activePrimaryRouting.shardId(), nodeId) ); remoteCollector.doCollect(); } return consumer .completionFuture() .thenApply(rows -> LazyMapList.of(rows, Buckets.arrayToSharedRow())); }
Source:
public BaseLivyInterpreter(Properties property) { super(property); this.livyURL = property.getProperty("zeppelin.livy.url"); this.displayAppInfo = Boolean.parseBoolean( property.getProperty("zeppelin.livy.displayAppInfo", "true")); this.restartDeadSession = Boolean.parseBoolean( property.getProperty("zeppelin.livy.restart_dead_session", "false")); this.sessionCreationTimeout = Integer.parseInt( property.getProperty("zeppelin.livy.session.create_timeout", 120 + "")); this.pullStatusInterval = Integer.parseInt( property.getProperty("zeppelin.livy.pull_status.interval.millis", 1000 + "")); this.restTemplate = createRestTemplate(); this.restTemplate.getMessageConverters().add(0, new StringHttpMessageConverter(Charset.forName("UTF-8"))); if (!StringUtils.isBlank(property.getProperty("zeppelin.livy.http.headers"))) { String[] headers = property.getProperty("zeppelin.livy.http.headers").split(";"); for (String header : headers) { String[] splits = header.split(":", -1); if (splits.length != 2) { throw new RuntimeException("Invalid format of http headers: " + header + ", valid http header format is HEADER_NAME:HEADER_VALUE"); } customHeaders.put(splits[0].trim(), envSubstitute(splits[1].trim())); } } }

Target:
public BaseLivyInterpreter(Properties property) { super(property); this.livyURL = property.getProperty("zeppelin.livy.url"); this.displayAppInfo = Boolean.parseBoolean( property.getProperty("zeppelin.livy.displayAppInfo", "true")); this.restartDeadSession = Boolean.parseBoolean( property.getProperty("zeppelin.livy.restart_dead_session", "false")); this.sessionCreationTimeout = Integer.parseInt( property.getProperty("zeppelin.livy.session.create_timeout", 120 + "")); this.pullStatusInterval = Integer.parseInt( property.getProperty("zeppelin.livy.pull_status.interval.millis", 1000 + "")); this.restTemplate = createRestTemplate(); if (!StringUtils.isBlank(property.getProperty("zeppelin.livy.http.headers"))) { String[] headers = property.getProperty("zeppelin.livy.http.headers").split(";"); for (String header : headers) { String[] splits = header.split(":", -1); if (splits.length != 2) { throw new RuntimeException("Invalid format of http headers: " + header + ", valid http header format is HEADER_NAME:HEADER_VALUE"); } customHeaders.put(splits[0].trim(), envSubstitute(splits[1].trim())); } } }
Source:
public boolean shouldChangesRequireResponseDeletion(FeedbackQuestionDetails newDetails) { assert newDetails instanceof FeedbackTextQuestionDetails; return !((FeedbackTextQuestionDetails) newDetails).allowRichText && allowRichText; }

Target:
public boolean shouldChangesRequireResponseDeletion(FeedbackQuestionDetails newDetails) { Assumption.assertTrue(newDetails instanceof FeedbackTextQuestionDetails); return !((FeedbackTextQuestionDetails) newDetails).shouldAllowRichText && shouldAllowRichText; }
Source:
protected ConfigNodeComplexValue indentText(AbstractConfigNode indentation) { ArrayList<AbstractConfigNode> childrenCopy = new ArrayList<AbstractConfigNode>(children); for (int i = 0; i < childrenCopy.size(); i++) { if (childrenCopy.get(i) instanceof ConfigNodeSingleToken && Tokens.isNewline(((ConfigNodeSingleToken) childrenCopy.get(i)).token())) { childrenCopy.add(i + 1, indentation); i++; } else if (childrenCopy.get(i) instanceof ConfigNodeField) { AbstractConfigNode value = ((ConfigNodeField) childrenCopy.get(i)).value(); if (value instanceof ConfigNodeComplexValue) { childrenCopy.set(i, ((ConfigNodeField) childrenCopy.get(i)).replaceValue(((ConfigNodeComplexValue) value).indentText(indentation))); } } else if (childrenCopy.get(i) instanceof ConfigNodeComplexValue) { childrenCopy.set(i, ((ConfigNodeComplexValue) childrenCopy.get(i)).indentText(indentation)); } } if (this instanceof ConfigNodeArray) { return new ConfigNodeArray(childrenCopy); } else if (this instanceof ConfigNodeObject) { return new ConfigNodeObject(childrenCopy); } else { return new ConfigNodeConcatenation(childrenCopy); } }

Target:
protected ConfigNodeComplexValue indentText(AbstractConfigNode indentation) { ArrayList<AbstractConfigNode> childrenCopy = new ArrayList<AbstractConfigNode>(children); for (int i = 0; i < childrenCopy.size(); i++) { AbstractConfigNode child = childrenCopy.get(i); if (child instanceof ConfigNodeSingleToken && Tokens.isNewline(((ConfigNodeSingleToken) child).token())) { childrenCopy.add(i + 1, indentation); i++; } else if (child instanceof ConfigNodeField) { AbstractConfigNode value = ((ConfigNodeField) child).value(); if (value instanceof ConfigNodeComplexValue) { childrenCopy.set(i, ((ConfigNodeField) child).replaceValue(((ConfigNodeComplexValue) value).indentText(indentation))); } } else if (child instanceof ConfigNodeComplexValue) { childrenCopy.set(i, ((ConfigNodeComplexValue) child).indentText(indentation)); } } return newNode(childrenCopy); }
Source:
ReportPointHandlerImpl(final HandlerKey handlerKey, final int blockedItemsPerBatch, @Nullable final Collection<SenderTask<String>> senderTasks, @Nonnull final ValidationConfiguration validationConfig, final boolean setupMetrics, @Nullable final Consumer<Long> receivedRateSink, @Nullable final Logger blockedItemLogger, @Nullable final Logger validItemsLogger, @Nullable final Function<Histogram, Histogram> recompressor) { super(handlerKey, blockedItemsPerBatch, new ReportPointSerializer(), senderTasks, setupMetrics, receivedRateSink, blockedItemLogger); this.validationConfig = validationConfig; this.validItemsLogger = validItemsLogger; this.recompressor = recompressor; MetricsRegistry registry = setupMetrics ? Metrics.defaultRegistry() : LOCAL_REGISTRY; this.receivedPointLag = registry.newHistogram(new MetricName(handlerKey.toString() + ".received", "", "lag"), false); this.pointTagCount = registry.newHistogram(new MetricName(handlerKey.toString(), "", "pointTagCount"), false); this.histogramTagCount = registry.newHistogram(new MetricName(handlerKey.toString(), "", "histogramTagCount"), false); this.discardedCounterSupplier = Utils.lazySupplier(() -> Metrics.newCounter(new MetricName(handlerKey.toString(), "", "discarded"))); }

Target:
ReportPointHandlerImpl(final HandlerKey handlerKey, final int blockedItemsPerBatch, @Nullable final Collection<SenderTask<String>> senderTasks, @Nonnull final ValidationConfiguration validationConfig, final boolean setupMetrics, @Nullable final Consumer<Long> receivedRateSink, @Nullable final Logger blockedItemLogger, @Nullable final Logger validItemsLogger, @Nullable final Function<Histogram, Histogram> recompressor) { super(handlerKey, blockedItemsPerBatch, new ReportPointSerializer(), senderTasks, setupMetrics, receivedRateSink, blockedItemLogger); this.validationConfig = validationConfig; this.validItemsLogger = validItemsLogger; this.recompressor = recompressor; MetricsRegistry registry = setupMetrics ? Metrics.defaultRegistry() : LOCAL_REGISTRY; this.receivedPointLag = registry.newHistogram(new MetricName(handlerKey.toString() + ".received", "", "lag"), false); this.receivedTagCount = registry.newHistogram(new MetricName(handlerKey.toString() + ".received", "", "tagCount"), false); this.discardedCounterSupplier = Utils.lazySupplier(() -> Metrics.newCounter(new MetricName(handlerKey.toString(), "", "discarded"))); }
Source:
public static Job createWorkingBranch_Create(final TeamWorkFlowArtifact teamArt, final IOseeBranch parentBranch, boolean pend) throws OseeCoreException { final String branchName = Strings.truncate(TeamWorkFlowManager.getBranchName(teamArt), 195, true); Conditions.checkNotNull(teamArt, "Parent Team Workflow"); Conditions.checkNotNull(parentBranch, "Parent Branch"); IExceptionableRunnable runnable = new IExceptionableRunnable() { @Override public IStatus run(IProgressMonitor monitor) throws OseeCoreException { teamArt.setWorkingBranchCreationInProgress(true); BranchManager.createWorkingBranch(parentBranch, branchName, teamArt); teamArt.setWorkingBranchCreationInProgress(false); SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), "Create Reviews upon Transition"); createNecessaryBranchEventReviews(StateEventType.CreateBranch, teamArt, new Date(), AtsUsers.getSystemUser(), transaction); transaction.execute(); for (IAtsStateItemCore item : AtsStateItemCoreManager.getStateItems()) { item.workingBranchCreated(teamArt); } return Status.OK_STATUS; } }; Job job = Jobs.startJob(new CatchAndReleaseJob("Create Branch", runnable, Activator.class, Activator.PLUGIN_ID), true); if (pend) { try { job.join(); } catch (InterruptedException ex) { throw new OseeWrappedException(ex); } } return job; }

Target:
public static Job createWorkingBranch_Create(final TeamWorkFlowArtifact teamArt, final IOseeBranch parentBranch, boolean pend) throws OseeCoreException { final String branchName = Strings.truncate(TeamWorkFlowManager.getBranchName(teamArt), 195, true); Conditions.checkNotNull(teamArt, "Parent Team Workflow"); Conditions.checkNotNull(parentBranch, "Parent Branch"); IExceptionableRunnable runnable = new IExceptionableRunnable() { @Override public IStatus run(IProgressMonitor monitor) throws OseeCoreException { teamArt.setWorkingBranchCreationInProgress(true); BranchManager.createWorkingBranch(parentBranch, branchName, teamArt); teamArt.setWorkingBranchCreationInProgress(false); performPostBranchCreationTasks(teamArt); return Status.OK_STATUS; } }; Job job = Jobs.startJob(new CatchAndReleaseJob("Create Branch", runnable, Activator.class, Activator.PLUGIN_ID), true); if (pend) { try { job.join(); } catch (InterruptedException ex) { throw new OseeWrappedException(ex); } } return job; }
Source:
public void execute(RealmAnalytics analytics) { try { URL url = getUrl(analytics); logger.debug("submitting: " + url); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.connect(); logger.debug("submitted: " + connection.getResponseCode() + " " + url); connection.getResponseCode(); } catch (Exception ignored) { logger.debug("ignoring: ", ignored); } }

Target:
public void execute(RealmAnalytics analytics) { try { URL url = getUrl(analytics); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.connect(); connection.getResponseCode(); } catch (Exception ignored) { } }
Source:
public void restarts_running_backgroundClearTask_when_lifecycleState_turns_to_MERGED() { Config config = new Config(); config.setProperty(taskPeriodSecondsPropName(), "1"); HazelcastInstance node = createHazelcastInstance(config); final AtomicInteger expirationCounter = new AtomicInteger(); IMap map = node.getMap("test"); map.addEntryListener(new EntryExpiredListener() { @Override public void entryExpired(EntryEvent event) { expirationCounter.incrementAndGet(); } }, true); map.put(1, 1, 3, TimeUnit.SECONDS); ((LifecycleServiceImpl) node.getLifecycleService()).fireLifecycleEvent(MERGING); ((LifecycleServiceImpl) node.getLifecycleService()).fireLifecycleEvent(MERGED); assertTrueEventually(new AssertTask() { @Override public void run() throws Exception { int expirationCount = expirationCounter.get(); assertEquals(format("Expecting 1 expiration but found:%d", expirationCount), 1, expirationCount); } }); }

Target:
public void restarts_running_backgroundClearTask_when_lifecycleState_turns_to_MERGED() { Config config = new Config(); config.setProperty(taskPeriodSecondsPropName(), "1"); HazelcastInstance node = createHazelcastInstance(config); final AtomicInteger expirationCounter = new AtomicInteger(); IMap<Integer, Integer> map = node.getMap("test"); map.addEntryListener(new EntryExpiredListener() { @Override public void entryExpired(EntryEvent event) { expirationCounter.incrementAndGet(); } }, true); map.put(1, 1, 3, TimeUnit.SECONDS); ((LifecycleServiceImpl) node.getLifecycleService()).fireLifecycleEvent(MERGING); ((LifecycleServiceImpl) node.getLifecycleService()).fireLifecycleEvent(MERGED); assertTrueEventually(new AssertTask() { @Override public void run() throws Exception { int expirationCount = expirationCounter.get(); assertEquals(format("Expecting 1 expiration but found:%d", expirationCount), 1, expirationCount); } }); }
Source:
String getCommittedOffsetsString() { StringBuilder sb = new StringBuilder(); sb.append("Channel ").append(this.uuid) .append(" committed: "); for (TopicPartition tp : this.consumer.assignment()) { try { sb.append("[").append(tp).append(",") .append(this.consumer.committed(tp).offset()) .append("] "); } catch (NullPointerException npe) { if (logger.isDebugEnabled()) { logger.debug("Committed {}", tp); } } } return sb.toString(); }

Target:
private String getCommittedOffsetsString() { StringBuilder sb = new StringBuilder(); sb.append(getName()).append(" committed: "); for (TopicPartition tp : consumer.assignment()) { try { sb.append("[").append(tp).append(",") .append(consumer.committed(tp).offset()) .append("] "); } catch (NullPointerException npe) { logger.debug("Committed {}", tp); } } return sb.toString(); }
Source:
public static ManagedChannel createNettyChannel(String host, BigtableOptions options, ClientInterceptor ... interceptors) throws SSLException { LOG.info("Creating new channel for %s", host); LOG.debug(Throwables.getStackTraceAsString(new Throwable())); ManagedChannelBuilder<?> builder = ManagedChannelBuilder .forAddress(host, options.getPort()); if (options.usePlaintextNegotiation()) { builder.usePlaintext(); } return builder .idleTimeout(Long.MAX_VALUE, TimeUnit.SECONDS) .maxInboundMessageSize(MAX_MESSAGE_SIZE) .userAgent(BigtableVersionInfo.CORE_USER_AGENT + "," + options.getUserAgent()) .intercept(interceptors) .build(); }

Target:
public static ManagedChannel createNettyChannel(String host, BigtableOptions options, ClientInterceptor ... interceptors) throws SSLException { LOG.info("Creating new channel for %s", host); if (LOG.getLog().isDebugEnabled()) { LOG.debug(Throwables.getStackTraceAsString(new Throwable())); } ManagedChannelBuilder<?> builder = ManagedChannelBuilder .forAddress(host, options.getPort()); if (options.usePlaintextNegotiation()) { builder.usePlaintext(); } return builder .idleTimeout(Long.MAX_VALUE, TimeUnit.SECONDS) .maxInboundMessageSize(MAX_MESSAGE_SIZE) .userAgent(BigtableVersionInfo.CORE_USER_AGENT + "," + options.getUserAgent()) .intercept(interceptors) .build(); }
Source:
public static VariableType mapFromPhenotype(PhenotypicType phenotypicType, String propertyName){ VariableType variableType = null; if (PhenotypicType.STUDY == phenotypicType || PhenotypicType.DATASET == phenotypicType) { variableType = VariableType.STUDY_DETAIL; } else if (PhenotypicType.TRIAL_ENVIRONMENT == phenotypicType) { variableType = VariableType.ENVIRONMENT_DETAIL; } else if (PhenotypicType.GERMPLASM == phenotypicType) { variableType = VariableType.GERMPLASM_DESCRIPTOR; } else if (PhenotypicType.TRIAL_DESIGN == phenotypicType) { variableType = VariableType.EXPERIMENTAL_DESIGN; } else if (PhenotypicType.VARIATE == phenotypicType) { boolean isSelectionMethod = "Inventory amount".equals(propertyName) || "Selections".equals(propertyName) || "Breeding method".equals(propertyName); variableType = isSelectionMethod ? VariableType.SELECTION_METHOD : VariableType.TRAIT; } return variableType; }

Target:
public static VariableType mapFromPhenotype(PhenotypicType phenotypicType, String propertyName){ VariableType variableType = null; if (PhenotypicType.STUDY == phenotypicType || PhenotypicType.DATASET == phenotypicType) { variableType = VariableType.STUDY_DETAIL; } else if (PhenotypicType.TRIAL_ENVIRONMENT == phenotypicType) { variableType = VariableType.ENVIRONMENT_DETAIL; } else if (PhenotypicType.GERMPLASM == phenotypicType) { variableType = VariableType.GERMPLASM_DESCRIPTOR; } else if (PhenotypicType.TRIAL_DESIGN == phenotypicType) { variableType = VariableType.EXPERIMENTAL_DESIGN; } else if (PhenotypicType.VARIATE == phenotypicType) { boolean isSelectionMethod = INVENTORY_AMOUNT.equals(propertyName) || SELECTIONS.equals(propertyName) || BREEDING_METHOD.equals(propertyName); variableType = isSelectionMethod ? VariableType.SELECTION_METHOD : VariableType.TRAIT; } return variableType; }
Source:
public void testGetGlusterGeoRepSessionUnSetConfig() { GlusterGeoRepSessionConfiguration sessionConfig = getGlusterGeoRepSessionConfig(); dao.saveConfig(sessionConfig); List<GlusterGeoRepSessionConfiguration> unsetSessionConfig = dao.getGlusterGeoRepSessionUnSetConfig(FixturesTool.GLUSTER_GEOREP_SESSION_ID); assertEquals(1, unsetSessionConfig.size()); assertEquals("use_meta_volume", unsetSessionConfig.get(0).getKey()); }

Target:
public void testGetGlusterGeoRepSessionUnSetConfig() { GlusterGeoRepSessionConfiguration sessionConfig = getGlusterGeoRepSessionConfig(); dao.saveConfig(sessionConfig); List<GlusterGeoRepSessionConfiguration> unsetSessionConfig = dao.getGlusterGeoRepSessionUnSetConfig(FixturesTool.GLUSTER_GEOREP_SESSION_ID); assertEquals("use_meta_volume", unsetSessionConfig.get(0).getKey()); }
Source:
private void setDefaultCategoryIcons(List<CategoryDTO> categories) { Platform.runLater(() -> { try { StringBuilder cssBuilder = new StringBuilder(); for (CategoryDTO category : categories) { cssBuilder.append( "#" + ApplicationSidebarToggleGroupSkin.getToggleButtonId(category.getId()) + "{\n"); URI categoryIcon = category.getIcon(); if (categoryIcon == null) { cssBuilder .append("-fx-background-image: url('/org/phoenicis/javafx/views/common/phoenicis.png');\n"); } else { cssBuilder.append("-fx-background-image: url('" + categoryIcon + "');\n"); } cssBuilder.append("}\n"); } String css = cssBuilder.toString(); Path temp = Files.createTempFile("defaultCategoryIcons", ".css").toAbsolutePath(); File tempFile = temp.toFile(); tempFile.deleteOnExit(); Files.write(temp, css.getBytes()); String defaultCategoryIconsCss = temp.toUri().toString(); this.themeManager.setDefaultCategoryIconsCss(defaultCategoryIconsCss); } catch (IOException e) { LOGGER.warn("Could not set default category icons.", e); } }); }

Target:
private void setDefaultCategoryIcons(List<CategoryDTO> categories) { Platform.runLater(() -> { try { StringBuilder cssBuilder = new StringBuilder(); for (CategoryDTO category : categories) { cssBuilder.append( "#" + ApplicationSidebarToggleGroupSkin.getToggleButtonId(category.getId()) + "{\n"); final String categoryIconPath = Optional.ofNullable(category.getIcon()) .map(categoryIcon -> categoryIcon.toString()) .orElse("/org/phoenicis/javafx/views/common/phoenicis.png"); cssBuilder.append(String.format("-fx-background-image: url('%s');\n", categoryIconPath)); cssBuilder.append("}\n"); } String css = cssBuilder.toString(); Path temp = Files.createTempFile("defaultCategoryIcons", ".css").toAbsolutePath(); File tempFile = temp.toFile(); tempFile.deleteOnExit(); Files.write(temp, css.getBytes()); String defaultCategoryIconsCss = temp.toUri().toString(); this.themeManager.setDefaultCategoryIconsCss(defaultCategoryIconsCss); } catch (IOException e) { LOGGER.warn("Could not set default category icons.", e); } }); }
Source:
public void onCreate() { super.onCreate(); log.info("WalletApplication.onCreate()"); config = new Configuration(PreferenceManager.getDefaultSharedPreferences(this), getResources()); walletFile = getFileStreamPath(Constants.Files.WALLET_FILENAME_PROTOBUF); if (walletFileExists()) { if (config.getEnsureWipe()) { walletFile.delete(); config.clear(false); File blockChainFile = new File(getDir("blockstore", Context.MODE_PRIVATE), Constants.Files.BLOCKCHAIN_FILENAME); if (blockChainFile.exists()) { blockChainFile.delete(); } } fullInitialization(); } }

Target:
public void onCreate() { super.onCreate(); log.info("WalletApplication.onCreate()"); config = new Configuration(PreferenceManager.getDefaultSharedPreferences(this), getResources()); walletFile = getFileStreamPath(Constants.Files.WALLET_FILENAME_PROTOBUF); if (walletFileExists()) { if (config.getEnsureWipe()) { walletFile.delete(); config.clear(false); } fullInitialization(); } }
Source:
public void validSample() { Matcher m = Dimensions.DIMENSIONS_PATTERN.matcher("100x200"); Assert.assertTrue(m.matches()); Assert.assertEquals("100", m.group(1)); Assert.assertEquals("200", m.group(2)); }

Target:
public void validSample() { WebDriverConfiguration mockedConfiguration = getMockedConfiguration("100x200"); Dimensions dimensions = new Dimensions(mockedConfiguration); Assert.assertEquals(100, dimensions.getWidth()); Assert.assertEquals(200, dimensions.getHeight()); }
Source:
public static AbstractTask getTaskByUrl(String taskUrl) { if (!Strings.isNullOrEmpty(taskUrl)) { Collection<AbstractTask> tasks = TasksUiPlugin.getTaskList().getAllTasks(); List<AbstractTask> sortedTasks = sortTasksByRepositoryUrl(tasks); AbstractRepositoryConnector connector = null; TaskRepository repository = null; for (AbstractTask task : sortedTasks) { if (taskUrl.equals(task.getUrl())) { return task; } else { String repositoryUrl = task.getRepositoryUrl(); if (repository == null || (repositoryUrl != null && !repositoryUrl.equals(repository.getUrl()))) { connector = TasksUi.getRepositoryManager().getRepositoryConnector(task.getConnectorKind()); repository = getRepository(task); } if (connector != null) { URL url = connector.getBrowserUrl(repository, task); if (url != null && taskUrl.equals(url.toString())) { return task; } } } } } return null; }

Target:
public static AbstractTask getTaskByUrl(String taskUrl) { if (!Strings.isNullOrEmpty(taskUrl)) { Collection<AbstractTask> tasks = TasksUiPlugin.getTaskList().getAllTasks(); List<AbstractTask> sortedTasks = sortTasksByRepositoryUrl(tasks); AbstractRepositoryConnector connector = null; TaskRepository repository = null; for (AbstractTask task : sortedTasks) { if (taskUrl.equals(task.getUrl())) { return task; } else { String repositoryUrl = task.getRepositoryUrl(); if (repositoryUrl != null) { if (repository == null || !repositoryUrl.equals(repository.getUrl())) { connector = TasksUi.getRepositoryManager().getRepositoryConnector(task.getConnectorKind()); repository = getRepository(task); } if (connector != null) { URL url = connector.getBrowserUrl(repository, task); if (url != null && taskUrl.equals(url.toString())) { return task; } } } } } } return null; }
Source:
public ConnectorAwareSplitSource( ConnectorId connectorId, ConnectorTransactionHandle transactionHandle, ConnectorSplitSource source, SplitSchedulingStrategy splitSchedulingStrategy) { this.connectorId = requireNonNull(connectorId, "connectorId is null"); this.transactionHandle = requireNonNull(transactionHandle, "transactionHandle is null"); this.source = requireNonNull(source, "source is null"); this.splitSchedulingStrategy = requireNonNull(splitSchedulingStrategy, "pipelineExecutionFlow is null"); }

Target:
public ConnectorAwareSplitSource( ConnectorId connectorId, ConnectorTransactionHandle transactionHandle, ConnectorSplitSource source, SplitSchedulingStrategy splitSchedulingStrategy) { this.connectorId = requireNonNull(connectorId, "connectorId is null"); this.transactionHandle = requireNonNull(transactionHandle, "transactionHandle is null"); this.source = requireNonNull(source, "source is null"); this.splitSchedulingStrategy = requireNonNull(splitSchedulingStrategy, "splitSchedulingStrategy is null"); }
Source:
public Factory(FileSystemContext context, WorkerNetAddress address, long blockId, long localReaderChunkSize, InStreamOptions options) throws IOException { AlluxioConfiguration conf = context.getClusterConf(); mBlockId = blockId; mLocalReaderChunkSize = localReaderChunkSize; mReadBufferSize = conf.getInt(PropertyKey.USER_STREAMING_READER_BUFFER_SIZE_MESSAGES); mDataTimeoutMs = conf.getMs(PropertyKey.USER_STREAMING_DATA_TIMEOUT); boolean isDirectMemoryIOEnabled = conf.getBoolean(PropertyKey.USER_DIRECT_MEMORY_IO_ENABLED); if (isDirectMemoryIOEnabled) { mBlockWorker = null; mStream = null; PropertyKey tierDirPathConf = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_PATH.format(0); String ramdiskPath = conf.get(tierDirPathConf).split(",")[0]; String workerDir = conf.get(PropertyKey.WORKER_DATA_FOLDER); mPath = Paths.get(ramdiskPath, workerDir, Long.toString(blockId)).toString(); return; } boolean isPromote = ReadType.fromProto(options.getOptions().getReadType()).isPromote(); OpenLocalBlockRequest request = OpenLocalBlockRequest.newBuilder() .setBlockId(mBlockId).setPromote(isPromote).build(); mBlockWorker = context.acquireBlockWorkerClient(address); try { mStream = new GrpcBlockingStream<>(mBlockWorker.get()::openLocalBlock, mReadBufferSize, MoreObjects.toStringHelper(LocalFileDataReader.class) .add("request", request) .add("address", address) .toString()); mStream.send(request, mDataTimeoutMs); OpenLocalBlockResponse response = mStream.receive(mDataTimeoutMs); Preconditions.checkState(response.hasPath()); mPath = response.getPath(); } catch (Exception e) { mBlockWorker.close(); throw e; } }

Target:
public Factory(FileSystemContext context, WorkerNetAddress address, long blockId, long localReaderChunkSize, InStreamOptions options) throws IOException { AlluxioConfiguration conf = context.getClusterConf(); mBlockId = blockId; mLocalReaderChunkSize = localReaderChunkSize; mReadBufferSize = conf.getInt(PropertyKey.USER_STREAMING_READER_BUFFER_SIZE_MESSAGES); mDataTimeoutMs = conf.getMs(PropertyKey.USER_STREAMING_DATA_TIMEOUT); if (conf.getBoolean(PropertyKey.USER_DIRECT_MEMORY_IO_ENABLED)) { mBlockWorker = null; mStream = null; PropertyKey tierDirPathConf = PropertyKey.Template.WORKER_TIERED_STORE_LEVEL_DIRS_PATH.format(0); String storageDir = conf.get(tierDirPathConf).split(",")[0]; String workerDir = conf.get(PropertyKey.WORKER_DATA_FOLDER); mPath = Paths.get(storageDir, workerDir, Long.toString(blockId)).toString(); return; } boolean isPromote = ReadType.fromProto(options.getOptions().getReadType()).isPromote(); OpenLocalBlockRequest request = OpenLocalBlockRequest.newBuilder() .setBlockId(mBlockId).setPromote(isPromote).build(); mBlockWorker = context.acquireBlockWorkerClient(address); try { mStream = new GrpcBlockingStream<>(mBlockWorker.get()::openLocalBlock, mReadBufferSize, MoreObjects.toStringHelper(LocalFileDataReader.class) .add("request", request) .add("address", address) .toString()); mStream.send(request, mDataTimeoutMs); OpenLocalBlockResponse response = mStream.receive(mDataTimeoutMs); Preconditions.checkState(response.hasPath()); mPath = response.getPath(); } catch (Exception e) { mBlockWorker.close(); throw e; } }
Source:
@NonNull public PreparedDeleteObject<T> prepare() { if (deleteResolver == null) { deleteResolver = DefaultDeleteResolver.INSTANCE; } Checks.checkNotNull(mapFunc, "Please specify map function"); return new PreparedDeleteObject<>( storIOSQLiteDb, object, mapFunc, deleteResolver ); }

Target:
@NonNull public PreparedDeleteObject<T> prepare() { if (deleteResolver == null) { deleteResolver = DefaultDeleteResolver.INSTANCE; } checkNotNull(mapFunc, "Please specify map function"); return new PreparedDeleteObject<>( storIOSQLiteDb, object, mapFunc, deleteResolver ); }
Source:
protected void handleToNonVisibleButton(Event e) { if (visibleViewer.getControl().isFocusControl() && getVisible().size() <= 1) { handleStatusUdpate(IStatus.INFO, MarkerMessages.MarkerPreferences_AtLeastOneVisibleColumn); return; } IStructuredSelection selection = visibleViewer.getStructuredSelection(); @SuppressWarnings("unchecked") List<T> selVCols = selection.toList(); getVisible().removeAll(selVCols); getNonVisible().addAll(selVCols); updateVisibility(selVCols, false); updateIndices(getVisible()); updateIndices(getNonVisible()); nonVisibleViewer.refresh(); nonVisibleViewer.setSelection(selection); visibleViewer.refresh(); handleVisibleSelection(visibleViewer.getStructuredSelection()); handleNonVisibleSelection(nonVisibleViewer.getStructuredSelection()); }

Target:
protected void handleToNonVisibleButton(Event e) { if (visibleViewer.getControl().isFocusControl() && getVisible().size() <= 1) { handleStatusUdpate(IStatus.INFO, MarkerMessages.MarkerPreferences_AtLeastOneVisibleColumn); return; } IStructuredSelection structuredSelection = visibleViewer.getStructuredSelection(); @SuppressWarnings("unchecked") List<T> selVCols = structuredSelection.toList(); getVisible().removeAll(selVCols); getNonVisible().addAll(selVCols); updateVisibility(selVCols, false); updateIndices(getVisible()); updateIndices(getNonVisible()); nonVisibleViewer.refresh(); nonVisibleViewer.setSelection(structuredSelection); visibleViewer.refresh(); handleVisibleSelection(structuredSelection); handleNonVisibleSelection(structuredSelection); }
Source:
public static VpnProfile decode(String key, byte[] value) { try { if (key == null) { return null; } String[] values = new String(value, StandardCharsets.UTF_8).split("\0", -1); if (values.length < 14 || values.length > 17) { return null; } VpnProfile profile = new VpnProfile(key); profile.name = values[0]; profile.type = Integer.parseInt(values[1]); if (profile.type < 0 || profile.type > TYPE_MAX) { return null; } profile.server = values[2]; profile.username = values[3]; profile.password = values[4]; profile.dnsServers = values[5]; profile.searchDomains = values[6]; profile.routes = values[7]; profile.mppe = Boolean.parseBoolean(values[8]); profile.l2tpSecret = values[9]; profile.ipsecIdentifier = values[10]; profile.ipsecSecret = values[11]; profile.ipsecUserCert = values[12]; profile.ipsecCaCert = values[13]; profile.ipsecServerCert = (values.length > 14) ? values[14] : ""; String host = (values.length > 15) ? values[15] : ""; String port = (values.length > 16) ? values[16] : ""; profile.proxy = new ProxyInfo(host, port.isEmpty() ? 0 : Integer.parseInt(port), null); profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty(); return profile; } catch (Exception e) { } return null; }

Target:
public static VpnProfile decode(String key, byte[] value) { try { if (key == null) { return null; } String[] values = new String(value, StandardCharsets.UTF_8).split("\0", -1); if (values.length < 14 || values.length > 19) { return null; } VpnProfile profile = new VpnProfile(key); profile.name = values[0]; profile.type = Integer.parseInt(values[1]); if (profile.type < 0 || profile.type > TYPE_MAX) { return null; } profile.server = values[2]; profile.username = values[3]; profile.password = values[4]; profile.dnsServers = values[5]; profile.searchDomains = values[6]; profile.routes = values[7]; profile.mppe = Boolean.parseBoolean(values[8]); profile.l2tpSecret = values[9]; profile.ipsecIdentifier = values[10]; profile.ipsecSecret = values[11]; profile.ipsecUserCert = values[12]; profile.ipsecCaCert = values[13]; profile.ipsecServerCert = (values.length > 14) ? values[14] : ""; String host = (values.length > 15) ? values[15] : ""; String port = (values.length > 16) ? values[16] : ""; String exclList = (values.length > 17) ? values[17] : ""; String pacFileUrl = (values.length > 18) ? values[18] : ""; if (pacFileUrl.isEmpty()) { profile.proxy = new ProxyInfo(host, port.isEmpty() ? 0 : Integer.parseInt(port), exclList); } else { profile.proxy = new ProxyInfo(pacFileUrl); } profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty(); return profile; } catch (Exception e) { } return null; }
Source:
public void waitUntilReceived() { await().atMost(Duration.ONE_MINUTE).until(() -> { for (String metric : expectedMetrics.keySet()) { if (assertedMetrics.get(metric) == null || !assertedMetrics.get(metric)) { LOGGER.debug("mismatch metric {}", metric); return false; } } LOGGER.info("Asserted metrics"); return true; }); }

Target:
public void waitUntilReceived() { await().atMost(adjust(TEN_SECONDS)).until(() -> { for (String metric : expectedMetrics.keySet()) { if (assertedMetrics.get(metric) == null || !assertedMetrics.get(metric)) { LOGGER.debug("mismatch metric {}", metric); return false; } } LOGGER.info("Asserted metrics"); return true; }); }
Source:
public UnitFlagDrawMode nextDrawMode() { final var values = UnitsDrawer.UnitFlagDrawMode.values(); return values[(ordinal() + 1) % values.length]; }

Target:
public UnitFlagDrawMode nextDrawMode() { final var values = values(); return values[(ordinal() + 1) % values.length]; }
Source:
private Maybe<Image> getImage(Element element) { Elements imageElements = element.getFirstChildElement("images").getChildElements("image"); if (imageElements.size() > 0) { String image = imageElements.get(0).getValue(); Matcher genericImageUrlMatcher = GENERIC_PATTERN.matcher(image); if(genericImageUrlMatcher.matches()) { Image imageObj = new Image("http://" + image); imageObj.setType(ImageType.GENERIC); return Maybe.just(imageObj); } if (!image.contains("api-images.channel5.com/images/default")) { Image imageObj = new Image("http://" + image); return Maybe.just(imageObj); } } return Maybe.nothing(); }

Target:
private Maybe<Image> getImage(Element element) { Elements imageElements = element.getFirstChildElement("images").getChildElements("image"); if (imageElements.size() > 0) { String image = imageElements.get(0).getValue(); if(!image.contains("http://")) { image = "http://" + image; } Image imageObj = new Image(image); if (image.contains("api-images.channel5.com/images/default")) { imageObj.setType(ImageType.GENERIC_IMAGE_CONTENT_PLAYER); } return Maybe.just(imageObj); } return Maybe.nothing(); }
Source:
public WebSocketsProxyConnectionHandler(String connectionId, String amqpHostname, ProxyConfiguration proxyConfiguration) { super(connectionId, amqpHostname); this.amqpHostname = Objects.requireNonNull(amqpHostname, "'amqpHostname' cannot be null."); this.proxyConfiguration = Objects.requireNonNull(proxyConfiguration, "'proxyConfiguration' is required."); }

Target:
public WebSocketsProxyConnectionHandler(String connectionId, String amqpHostname, ProxyConfiguration proxyConfiguration) { super(connectionId, amqpHostname); this.amqpHostname = Objects.requireNonNull(amqpHostname, "'amqpHostname' cannot be null."); this.proxyConfiguration = Objects.requireNonNull(proxyConfiguration, "'proxyConfiguration' cannot be null."); }
Source:
private boolean overcatch(CatchTree catchTree, VisitorState state) { String caughtException = catchTree.getParameter().getType().toString(); if (caughtException.equals("Throwable") || caughtException.equals("Exception")) { return true; } return false; }

Target:
private boolean overcatch(CatchTree catchTree, VisitorState state) { Types types = state.getTypes(); Symtab symtab = state.getSymtab(); Type paramType = ASTHelpers.getType(catchTree.getParameter().getType()); return (types.isSameType(paramType, symtab.throwableType) || types.isSameType(paramType, symtab.exceptionType)); }
Source:
public YearMonthDay getNextPossibleSummaryDate() { YearMonthDay currentDate = new YearMonthDay(); HourMinuteSecond now = new HourMinuteSecond(); Summary lastSummary = getLastSummary(); if (lastSummary != null) { SortedSet<YearMonthDay> datesEvenToday = getAllLessonDatesUntil(currentDate); SortedSet<YearMonthDay> possibleDates = datesEvenToday.tailSet(lastSummary.getSummaryDateYearMonthDay()); possibleDates.remove(lastSummary.getSummaryDateYearMonthDay()); if (!possibleDates.isEmpty()) { YearMonthDay nextPossibleDate = possibleDates.first(); return isTimeValidToInsertSummary(now, nextPossibleDate) ? nextPossibleDate : null; } } else { SortedSet<YearMonthDay> validLessonDates = getAllValidLessonDatesWithoutInstancesDates(getLessonStartDay(), getLessonEndDay()); YearMonthDay nextValidDate = validLessonDates.size() > 0 ? validLessonDates.first() : null; YearMonthDay nextPossibleDate = hasAnyLessonInstances() ? getFirstLessonInstance().getDay() : nextValidDate; return isTimeValidToInsertSummary(now, nextPossibleDate) ? nextPossibleDate : null; } return null; }

Target:
public YearMonthDay getNextPossibleSummaryDate() { YearMonthDay currentDate = new YearMonthDay(); HourMinuteSecond now = new HourMinuteSecond(); Summary lastSummary = getLastSummary(); if (lastSummary != null) { SortedSet<YearMonthDay> datesEvenToday = getAllLessonDatesUntil(currentDate); SortedSet<YearMonthDay> possibleDates = datesEvenToday.tailSet(lastSummary.getSummaryDateYearMonthDay()); possibleDates.remove(lastSummary.getSummaryDateYearMonthDay()); if (!possibleDates.isEmpty()) { YearMonthDay nextPossibleDate = possibleDates.first(); return isTimeValidToInsertSummary(now, nextPossibleDate) ? nextPossibleDate : null; } } else { YearMonthDay nextPossibleDate; if (hasAnyLessonInstances()) { nextPossibleDate = getFirstLessonInstance().getDay(); } else { SortedSet<YearMonthDay> validLessonDates = getAllValidLessonDatesWithoutInstancesDates(getLessonStartDay(), getLessonEndDay()); nextPossibleDate = validLessonDates.size() > 0 ? validLessonDates.first() : null; } return isTimeValidToInsertSummary(now, nextPossibleDate) ? nextPossibleDate : null; } return null; }