auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testOpenEditModal() { final ItemObjectModel model = new ItemObjectModel("Name", "Value", "mvel", ImmutableList.of(new Parameter("Foo", "Bar"))); final DeploymentsSectionPresenter parentPresenter = mock(DeploymentsSectionPresenter.class); namedObjectItemPresenter.setupSectionConfig("header", "nameKey", "vauleKey", model, parentPresenter); namedObjectItemPresenter.openEditModal(); verify(view).setName(any()); verify(doubleValueModal).show(any()); }

Target:
public void testOpenEditModal() { final ItemObjectModel model = mock(ItemObjectModel.class); final DeploymentsSectionPresenter parentPresenter = mock(DeploymentsSectionPresenter.class); final WorkItemHandlersListPresenter listPresenter = mock(WorkItemHandlersListPresenter.class); when(model.getResolver()).thenReturn("REFLECTION"); namedObjectItemPresenter.setupSectionConfig("header", "nameKey", "vauleKey", model, parentPresenter); namedObjectItemPresenter.setListPresenter(listPresenter); namedObjectItemPresenter.openEditModal(); ArgumentCaptor<BiConsumer> captor = ArgumentCaptor.forClass(BiConsumer.class); verify(doubleValueModal).show(captor.capture(), any(), any()); captor.getValue().accept("name", "value"); verify(model).setValue("value"); verify(model).setName("name"); verify(model).setValue("value"); verify(model).setName("name"); verify(parentPresenter).fireChangeEvent(); }
Source:
public String getModifiedIndex() { Objects.requireNonNull(eventIndexName, "null value"); if(!eventIndexName.equals("netflow")) { return String.format("%s-%s", eventIndexName, TYPE); } return TYPE; }

Target:
private String getModifiedIndex() { if (!eventIndexName.isEmpty()) { return String.format("%s-%s", eventIndexName, TYPE); } return TYPE; }
Source:
public void addCallsAddForClient() throws Exception { addActionConfig.addType = Arrays.asList("client"); addActionConfig.name = client.getName(); addActionConfig.description = "description"; addActionConfig.spiffeUri = "spiffe when(keywhizClient.getClientByName(client.getName())).thenThrow(new NotFoundException()); addAction.run(); verify(keywhizClient).createClient(addActionConfig.name, addActionConfig.getDescription(), addActionConfig.getSpiffeUri()); }

Target:
public void addCallsAddForClient() throws Exception { addActionConfig.addType = Arrays.asList("client"); addActionConfig.name = client.getName(); addActionConfig.description = "description"; addActionConfig.spiffeId = "spiffe when(keywhizClient.getClientByName(client.getName())).thenThrow(new NotFoundException()); addAction.run(); verify(keywhizClient).createClient(addActionConfig.name, addActionConfig.getDescription(), addActionConfig.getSpiffeId()); }
Source:
public Table(@Nonnull final String namespace, @Nonnull final String fullyQualifiedTableName, @Nonnull final V valueSchema, @Nullable final M metadataSchema, @Nonnull final CorfuRuntime corfuRuntime, @Nonnull final ISerializer serializer, @Nonnull final Supplier<StreamingMap<K, V>> streamingMapSupplier, @NonNull final ICorfuVersionPolicy.VersionPolicy versionPolicy) { this.corfuRuntime = corfuRuntime; this.namespace = namespace; this.fullyQualifiedTableName = fullyQualifiedTableName; this.streamUUID = UUID.nameUUIDFromBytes(this.fullyQualifiedTableName.getBytes()); this.metadataOptions = Optional.ofNullable(metadataSchema) .map(schema -> MetadataOptions.builder() .metadataEnabled(true) .defaultMetadataInstance(schema) .build()) .orElse(MetadataOptions.builder().build()); this.corfuTable = corfuRuntime.getObjectsView().build() .setTypeToken(CorfuTable.<K, CorfuRecord<V, M>>getTableType()) .setStreamName(this.fullyQualifiedTableName) .setSerializer(serializer) .setArguments(new ProtobufIndexer(valueSchema), streamingMapSupplier, versionPolicy) .open(); }

Target:
public Table(@Nonnull final String namespace, @Nonnull final String fullyQualifiedTableName, @Nonnull final V valueSchema, @Nullable final M metadataSchema, @Nonnull final CorfuRuntime corfuRuntime, @Nonnull final ISerializer serializer, @Nonnull final Supplier<StreamingMap<K, V>> streamingMapSupplier, @NonNull final ICorfuVersionPolicy.VersionPolicy versionPolicy) { this.corfuRuntime = corfuRuntime; this.namespace = namespace; this.fullyQualifiedTableName = fullyQualifiedTableName; this.streamUUID = CorfuRuntime.getStreamID(this.fullyQualifiedTableName); this.metadataOptions = Optional.ofNullable(metadataSchema) .map(schema -> MetadataOptions.builder() .metadataEnabled(true) .defaultMetadataInstance(schema) .build()) .orElse(MetadataOptions.builder().build()); this.corfuTable = corfuRuntime.getObjectsView().build() .setTypeToken(CorfuTable.<K, CorfuRecord<V, M>>getTableType()) .setStreamName(this.fullyQualifiedTableName) .setSerializer(serializer) .setArguments(new ProtobufIndexer(valueSchema), streamingMapSupplier, versionPolicy) .open(); this.metrics = new TableMetrics(this.fullyQualifiedTableName, corfuRuntime.getParameters().getMetricRegistry()); }
Source:
protected void setValue(Object element, Object value) { if (value instanceof String) { String string = (String) value; boolean empty = string.isEmpty(); if (!empty) { Long newVal = Long.parseLong(string); if (element instanceof TraceAndOffset) { TraceAndOffset tao = (TraceAndOffset) element; tao.setOffset(newVal); fViewer.getViewer().update(element, null); } } } }

Target:
protected void setValue(Object element, Object value) { if (value instanceof String) { String string = (String) value; boolean empty = string.isEmpty(); if (!empty) { try { Long newVal = Long.parseLong(string); fOffsetMap.put((TmfTraceElement) element, newVal); } catch (NumberFormatException e) { } fViewer.getViewer().update(element, null); } } }
Source:
public static Map<String, String> labelsToNames(Map<String, String> labels) { Map<String, String> names = new HashMap<>(); if (labels != null) { for (Map.Entry<String, String> label : labels.entrySet()) { if (!hasConversionProblems(label)) { String key = label.getKey(); String value = label.getValue(); key = convertLabelKey(key); value = convertLabelValue(value); key = addPadding(key); value = addPadding(value); if (matchesKubernetesLabelRegex(key) && matchesKubernetesLabelRegex(value)) { names.put(key, value); } else { LOG.error( "Could not convert label into Kubernetes annotation: labels must be alphanumeric with ':' and '/'", label.toString()); } } } } return names; }

Target:
public static Map<String, String> labelsToNames(Map<String, String> labels) { Map<String, String> names = new HashMap<>(); if (labels == null) { return names; } for (Map.Entry<String, String> label : labels.entrySet()) { if (!hasConversionProblems(label)) { String key = label.getKey(); String value = label.getValue(); key = convertLabelKey(key); value = convertLabelValue(value); key = addPadding(key); value = addPadding(value); if (matchesKubernetesLabelRegex(key) && matchesKubernetesLabelRegex(value)) { names.put(key, value); } else { LOG.error( "Could not convert label into Kubernetes annotation: labels must be alphanumeric with ':' and '/'", label.toString()); } } } return names; }
Source:
void detach(Action action) { if (actions != null) { actions.remove(action); } if (this.action == action) { this.action = null; } }

Target:
void detach(Action action) { if (this.action == action) { this.action = null; } else if (actions != null) { actions.remove(action); } }
Source:
public void testDuplicateCodeListTable() { assertThat(testSetColumns.codeListTable.size(), is(14)); verify(mockAppender, times(2)).doAppend(argThat(argument -> argument .getLevel().equals(Level.WARN))); }

Target:
public void testDuplicateCodeListTable() { verify(mockAppender, never()).doAppend(argThat(argument -> argument .getLevel().equals(Level.WARN))); SimpleI18nCodeList testDuplicateCodeListTable = getApplicationContext() .getBean("CL_testDuplicateCodeListTable", SimpleI18nCodeList.class); assertThat(testDuplicateCodeListTable.codeListTable.size(), is(14)); verify(mockAppender, times(2)).doAppend(argThat(argument -> argument .getLevel().equals(Level.WARN))); }
Source:
public static <T> Optional<ParamConverter<T>> getParamConverter(Class<T> pClass, Type genericType, Annotation[] anns, Message message) { if (message != null) { ServerProviderFactory pf = ServerProviderFactory.getInstance(message); ParamConverter<T> pm = pf.createParameterHandler(pClass, genericType, anns, message); if (pm != null) { return Optional.of(pm); } } return Optional.empty(); }

Target:
public static <T> Optional<ParamConverter<T>> getParamConverter(Class<T> pClass, Type genericType, Annotation[] anns, Message message) { if (message != null) { ServerProviderFactory pf = ServerProviderFactory.getInstance(message); ParamConverter<T> pm = pf.createParameterHandler(pClass, genericType, anns, message); return Optional.ofNullable(pm); } return Optional.empty(); }
Source:
void sendRevokedNotifications(Application application, ApplicationComment comment) { Map<String, Object> model = new HashMap<>(); model.put(APPLICATION, application); model.put(COMMENT, comment); if (application.getPerson().equals(application.getCanceller())) { final Mail mailToApplicant = Mail.builder() .withRecipient(application.getPerson()) .withSubject("subject.application.revoked.applicant") .withTemplate("revoked_applicant", model) .build(); mailService.send(mailToApplicant); } else { final Mail mailToNotApplicant = Mail.builder() .withRecipient(application.getPerson()) .withSubject("subject.application.revoked.notApplicant") .withTemplate("revoked_not_applicant", model) .build(); mailService.send(mailToNotApplicant); } final List<Person> relevantRecipientsToInform = applicationRecipientService.getRecipientsForAllowAndRemind(application); final Mail mailToRelevantPersons = Mail.builder() .withRecipient(relevantRecipientsToInform) .withSubject("subject.application.revoked.management") .withTemplate("revoked_management", model) .build(); mailService.send(mailToRelevantPersons); }

Target:
void sendRevokedNotifications(Application application, ApplicationComment comment) { Map<String, Object> model = new HashMap<>(); model.put(APPLICATION, application); model.put(COMMENT, comment); if (application.getPerson().equals(application.getCanceller())) { final Mail mailToApplicant = Mail.builder() .withRecipient(application.getPerson()) .withSubject("subject.application.revoked.applicant") .withTemplate("revoked_applicant", model) .build(); mailService.send(mailToApplicant); } else { final Mail mailToNotApplicant = Mail.builder() .withRecipient(application.getPerson()) .withSubject("subject.application.revoked.notApplicant") .withTemplate("revoked_not_applicant", model) .build(); mailService.send(mailToNotApplicant); } final List<Person> relevantRecipientsToInform = applicationRecipientService.getRecipientsOfInterest(application); final Mail mailToRelevantPersons = Mail.builder() .withRecipient(relevantRecipientsToInform) .withSubject("subject.application.revoked.management") .withTemplate("revoked_management", model) .build(); mailService.send(mailToRelevantPersons); }
Source:
public boolean waitForCreate(String resourceName) { long waitTime = 0; boolean exists; while (!(exists = domainRepository.exists(resourceName)) && waitTime < STATE_CHANGE_TIMEOUT) { try { Thread.sleep(STATE_CHANGE_WAIT_TIME); waitTime += STATE_CHANGE_WAIT_TIME; } catch (InterruptedException e) { Thread.interrupted(); } } return exists; }

Target:
public boolean waitForCreate(String resourceName) { long waitTime = 0; boolean exists; while (!(exists = domainRepository.exists(resourceName)) && waitTime < STATE_CHANGE_TIMEOUT) { try { Thread.sleep(STATE_CHANGE_WAIT_TIME); waitTime += STATE_CHANGE_WAIT_TIME; } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } return exists; }
Source:
public boolean isFirstMilestoneOrPredeterminedInvoiceBySchedule(String billingFrequencyCode, String invoicingOptionCode, Date lastBilledDate) { if (StringUtils.equalsIgnoreCase(ArIntegrationConstants.AwardInvoicingOptions.INV_SCHEDULE, invoicingOptionCode) && (ArIntegrationConstants.BillingFrequencyValues.MILESTONE.equals(billingFrequencyCode) || ArIntegrationConstants.BillingFrequencyValues.PREDETERMINED_BILLING.equals(billingFrequencyCode)) && ObjectUtils.isNull(lastBilledDate)) { return true; } return false; }

Target:
public boolean isFirstMilestoneOrPredeterminedInvoiceBySchedule(String billingFrequencyCode, String invoicingOptionCode, Date lastBilledDate) { return (isInvoiceBySchedule(invoicingOptionCode) && isBillingFrequencyMilesoneOrPredetermined(billingFrequencyCode) && isLastBilledDateNull(lastBilledDate)); }
Source:
Object handle(Message<?> message, T target) throws Exception; <HT> Optional<HT> unwrap(Class<HT> handlerType); default Class<?> declaringClass() { return unwrap(Member.class).map(Member::getDeclaringClass) .orElseThrow(() -> new IllegalStateException( "This implementation of MessageHandlingMember does not wrap a " + "java.lang.reflect.Member. Please provide a different way of " + "getting 'declaringClass' of this MessageHandlingMember.")); }

Target:
Object handle(Message<?> message, T target) throws Exception; <HT> Optional<HT> unwrap(Class<HT> handlerType); default Class<?> declaringClass() { return unwrap(Member.class).map(Member::getDeclaringClass) .orElseThrow(() -> new UnsupportedOperationException( "This implementation of MessageHandlingMember does not wrap a " + "java.lang.reflect.Member. Please provide a different way of " + "getting 'declaringClass' of this MessageHandlingMember.")); }
Source:
protected void doExecute(StepExecution stepExecution) throws Exception { if(reducer != null) { reducer.beginPartitionedStep(); } getPartitionHandler().handle(getStepExecutionSplitter(), stepExecution); stepExecution.upgradeStatus(BatchStatus.COMPLETED); if (stepExecution.getStatus().isUnsuccessful()) { if (reducer != null) { reducer.rollbackPartitionedStep(); reducer.beforePartitionedStepCompletion(); reducer.afterPartitionedStepCompletion(PartitionStatus.ROLLBACK); } throw new JobExecutionException("Partition handler returned an unsuccessful step"); } if (reducer != null) { reducer.beforePartitionedStepCompletion(); reducer.afterPartitionedStepCompletion(PartitionStatus.COMMIT); } }

Target:
protected void doExecute(StepExecution stepExecution) throws Exception { if(hasReducer) { reducer.beginPartitionedStep(); } getPartitionHandler().handle(getStepExecutionSplitter(), stepExecution); stepExecution.upgradeStatus(BatchStatus.COMPLETED); if (stepExecution.getStatus().isUnsuccessful()) { if (hasReducer) { reducer.rollbackPartitionedStep(); reducer.beforePartitionedStepCompletion(); reducer.afterPartitionedStepCompletion(PartitionStatus.ROLLBACK); } throw new JobExecutionException("Partition handler returned an unsuccessful step"); } if (hasReducer) { reducer.beforePartitionedStepCompletion(); reducer.afterPartitionedStepCompletion(PartitionStatus.COMMIT); } }
Source:
public OverthereProcess startProcess(final CmdLine cmd) { checkNotNull(cmd, "Cannot execute null command line"); checkArgument(cmd.getArguments().size() > 0, "Cannot execute empty command line"); final String obfuscatedCmd = cmd.toCommandLine(os, true); logger.info("Starting command on [{}]", obfuscatedCmd, this); final CmdLine winrsCmd = new CmdLine(); winrsCmd.addArgument("winrs"); winrsCmd.addArgument("-remote:" + address + ":" + port); winrsCmd.addArgument("-username:" + username); winrsCmd.addPassword("-password:" + sanitize(password)); if (workingDirectory != null) { winrsCmd.addArgument("-directory:" + workingDirectory.getPath()); } if (options.getBoolean(WINRS_NOECHO, WINRS_NOECHO_DEFAULT)) { winrsCmd.addArgument("-noecho"); } if (options.getBoolean(WINRS_NOPROFILE, WINRS_NOPROFILE_DEFAULT)) { winrsCmd.addArgument("-noprofile"); } if (options.getBoolean(WINRS_ALLOW_DELEGATE, DEFAULT_WINRS_ALLOW_DELEGATE)) { winrsCmd.addArgument("-allowdelegate"); } if (options.getBoolean(WINRS_COMPRESSION, WINRS_COMPRESSION_DEFAULT)) { winrsCmd.addArgument("-compression"); } if (options.getBoolean(WINRS_UNENCRYPTED, WINRS_UNENCRYPTED_DEFAULT)) { winrsCmd.addArgument("-unencrypted"); } if (options.getBoolean(WINRM_ENABLE_HTTPS, WINRM_ENABLE_HTTPS_DEFAULT)) { winrsCmd.addArgument("-usessl"); } winrsCmd.add(cmd.getArguments()); return winrsProxyConnection.startProcess(winrsCmd); }

Target:
public OverthereProcess startProcess(final CmdLine cmd) { checkNotNull(cmd, "Cannot execute null command line"); checkArgument(cmd.getArguments().size() > 0, "Cannot execute empty command line"); final String obfuscatedCmd = cmd.toCommandLine(os, true); logger.info("Starting command on [{}]", obfuscatedCmd, this); final CmdLine winrsCmd = new CmdLine(); winrsCmd.addArgument("winrs"); winrsCmd.addArgument("-remote:" + address + ":" + port); winrsCmd.addArgument("-username:" + sanitizeWinrsCommandLineArgs(username)); winrsCmd.addPassword("-password:" + sanitizeWinrsCommandLineArgs(password)); if (workingDirectory != null) { winrsCmd.addArgument("-directory:" + sanitizeWinrsCommandLineArgs(workingDirectory.getPath())); } if (options.getBoolean(WINRS_NOECHO, WINRS_NOECHO_DEFAULT)) { winrsCmd.addArgument("-noecho"); } if (options.getBoolean(WINRS_NOPROFILE, WINRS_NOPROFILE_DEFAULT)) { winrsCmd.addArgument("-noprofile"); } if (options.getBoolean(WINRS_ALLOW_DELEGATE, DEFAULT_WINRS_ALLOW_DELEGATE)) { winrsCmd.addArgument("-allowdelegate"); } if (options.getBoolean(WINRS_COMPRESSION, WINRS_COMPRESSION_DEFAULT)) { winrsCmd.addArgument("-compression"); } if (options.getBoolean(WINRS_UNENCRYPTED, WINRS_UNENCRYPTED_DEFAULT)) { winrsCmd.addArgument("-unencrypted"); } if (options.getBoolean(WINRM_ENABLE_HTTPS, WINRM_ENABLE_HTTPS_DEFAULT)) { winrsCmd.addArgument("-usessl"); } winrsCmd.add(cmd.getArguments()); return winrsProxyConnection.startProcess(winrsCmd); }
Source:
protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception { if (started) { logger.debug( String.format( "Sending data [%s]:%n%s", ctx.channel().remoteAddress().toString(), msg.toString(StandardCharsets.UTF_8))); byte[] b = new byte[msg.readableBytes()]; msg.readBytes(b); out.writeBytes(connection.encryptResponse(b)); } else { out.writeBytes(msg); } }

Target:
protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception { if (started) { debugData("Sending data", msg, ctx); byte[] b = new byte[msg.readableBytes()]; msg.readBytes(b); out.writeBytes(connection.encryptResponse(b)); } else { out.writeBytes(msg); } }
Source:
public void testQueuedJobIsStoppedAfterShutdownNow() throws InterruptedException { BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(); ExecutorService service = Executors.newSingleThreadExecutor(); try { PartitionedOrderedExecutor executor = new PartitionedOrderedExecutor(queue, service); final Semaphore jobSemaphore = new Semaphore(0); final Semaphore testSemaphore = new Semaphore(0); executor.submit((Callable<Void>) () -> { testSemaphore.release(); jobSemaphore.acquireUninterruptibly(); return null; }); final AtomicBoolean called = new AtomicBoolean(); Callable<?> leftBehind = (Callable<Void>) () -> { called.set(true); return null; }; executor.submit(leftBehind); testSemaphore.acquireUninterruptibly(); assertThat(executor.shutdownNow(), hasSize(1)); assertThat(executor.awaitTermination(100, MILLISECONDS), is(false)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(false)); jobSemaphore.release(); assertThat(executor.awaitTermination(2, MINUTES), is(true)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(true)); assertThat(jobSemaphore.availablePermits(), is(0)); assertThat(called.get(), is(false)); } finally { service.shutdown(); } }

Target:
public void testQueuedJobIsStoppedAfterShutdownNow() throws InterruptedException { BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(); ExecutorService service = Executors.newSingleThreadExecutor(); try { PartitionedOrderedExecutor executor = new PartitionedOrderedExecutor(queue, service); final Semaphore jobSemaphore = new Semaphore(0); final Semaphore testSemaphore = new Semaphore(0); executor.submit(() -> { testSemaphore.release(); jobSemaphore.acquireUninterruptibly(); }); final AtomicBoolean called = new AtomicBoolean(); Callable<?> leftBehind = (Callable<Void>) () -> { called.set(true); return null; }; executor.submit(leftBehind); testSemaphore.acquireUninterruptibly(); assertThat(executor.shutdownNow(), hasSize(1)); assertThat(executor.awaitTermination(100, MILLISECONDS), is(false)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(false)); jobSemaphore.release(); assertThat(executor.awaitTermination(2, MINUTES), is(true)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(true)); assertThat(jobSemaphore.availablePermits(), is(0)); assertThat(called.get(), is(false)); } finally { service.shutdown(); } }
Source:
public static void handleExternalLink(final Context context, final Uri uri) { final WikipediaZeroHandler zeroHandler = WikipediaApp.getInstance() .getWikipediaZeroHandler(); if (!zeroHandler.isZeroEnabled()) { visitInExternalBrowser(context, uri); return; } if (!Prefs.isShowZeroInterstitialEnabled()) { visitInExternalBrowser(context, uri); zeroHandler.getZeroFunnel().logExtLinkAuto(); return; } ZeroConfig zeroConfig = zeroHandler.getZeroConfig(); String customExitTitle = zeroConfig.getExitTitle(); String customExitWarning = zeroConfig.getExitWarning(); String customPartnerInfoText = zeroConfig.getPartnerInfoText(); final String customPartnerInfoUrl = zeroConfig.getPartnerInfoUrl(); AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.setTitle(!(StringUtil.emptyIfNull(customExitTitle).equals("")) ? customExitTitle : context.getString(R.string.zero_interstitial_title)); alert.setMessage(!(StringUtil.emptyIfNull(customExitWarning).equals("")) ? customExitWarning : context.getString(R.string.zero_interstitial_leave_app)); alert.setPositiveButton(context.getString(R.string.zero_interstitial_continue), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { visitInExternalBrowser(context, uri); zeroHandler.getZeroFunnel().logExtLinkConf(); } }); if (customPartnerInfoText != null && customPartnerInfoUrl != null) { alert.setNeutralButton(customPartnerInfoText, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { visitInExternalBrowser(context, Uri.parse(customPartnerInfoUrl)); } }); } alert.setNegativeButton(context.getString(R.string.zero_interstitial_cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { zeroHandler.getZeroFunnel().logExtLinkBack(); } }); AlertDialog ad = alert.create(); ad.show(); zeroHandler.getZeroFunnel().logExtLinkWarn(); }

Target:
public static void handleExternalLink(final Context context, final Uri uri) { final WikipediaZeroHandler zeroHandler = WikipediaApp.getInstance() .getWikipediaZeroHandler(); if (!zeroHandler.isZeroEnabled()) { visitInExternalBrowser(context, uri); return; } if (!Prefs.isShowZeroInterstitialEnabled()) { visitInExternalBrowser(context, uri); zeroHandler.getZeroFunnel().logExtLinkAuto(); return; } showZeroExitInterstitialDialog(context, uri); }
Source:
private int distance(String pattern) { String example; if (RefControl.isRE(pattern)) { example = shortestExampleCache.get(pattern); if (example == null) { example = RefControl.shortestExample(pattern); shortestExampleCache.put(pattern, example); } } else if (pattern.endsWith("/*")) { example = pattern.substring(0, pattern.length() - 1) + '1'; } else if (pattern.equals(refName)) { return 0; } else { return Math.max(pattern.length(), refName.length()); } return StringUtils.getLevenshteinDistance(example, refName); }

Target:
private int distance(String pattern) { String example; if (RefControl.isRE(pattern)) { example = cache.getUnchecked(pattern); } else if (pattern.endsWith("/*")) { example = pattern.substring(0, pattern.length() - 1) + '1'; } else if (pattern.equals(refName)) { return 0; } else { return Math.max(pattern.length(), refName.length()); } return StringUtils.getLevenshteinDistance(example, refName); }
Source:
private void populateTransactionEdits() throws IOException { int numEntries = fetchMarker(); for (int i = 0; i < numEntries; i++) { TransactionEdit edit = new TransactionEdit(); try { if (reader.next(key, edit)) { transactionEdits.add(edit); } else { throw new EOFException("Attempt to read TransactionEdit failed."); } } catch (EOFException e) { LOG.warn("Reached EOF in log before reading entries. Ignoring all edits since the last marker", numEntries, transactionEdits.size(), e); transactionEdits.clear(); } } }

Target:
private void populateTransactionEdits() throws IOException { int numEntries = 0; try { numEntries = commitMarkerCodec.readMarker(reader); } catch (EOFException e) { LOG.warn("Reached EOF in log while trying to read commit marker", e); } for (int i = 0; i < numEntries; i++) { TransactionEdit edit = new TransactionEdit(); try { if (reader.next(key, edit)) { transactionEdits.add(edit); } else { throw new EOFException("Attempt to read TransactionEdit failed."); } } catch (EOFException e) { LOG.warn("Reached EOF in log before reading entries. Ignoring all edits since the last marker", numEntries, transactionEdits.size(), e); transactionEdits.clear(); } } }
Source:
public void enableElytronSubsystem() throws IOException, InterruptedException, TimeoutException { ops.add(ELYTRON_EXTENSION_ADDRESS, Values.of("module", ELYTRON_EXTENSION_NAME)); ops.add(ELYTRON_SUBSYSTEM_ADDRESS); adminOps.reloadIfRequired(); }

Target:
public void enableElytronSubsystem() throws IOException, InterruptedException, TimeoutException { ops.add(ELYTRON_EXTENSION_ADDRESS, Values.of("module", ELYTRON_EXTENSION_NAME)).assertSuccess(); ops.add(ELYTRON_SUBSYSTEM_ADDRESS).assertSuccess(); adminOps.reloadIfRequired(); }
Source:
public LocalDate getLastAppearance() { if (super.isEmpty()) { return null; } LocalDate lastAppearance = super.get(0).getLastAppearance(); for (int index = 1; index < super.size(); index++) { LocalDate lastAppearance = super.get(index).getLastAppearance(); if (lastAppearance.isAfter(lastAppearance)) { lastAppearance = lastAppearance; } } return lastAppearance; }

Target:
public LocalDate getLastAppearance() { if (super.isEmpty()) { return null; } LocalDate lastAppearance = super.get(0).getLastAppearance(); for (int index = 1; index < super.size(); index++) { LocalDate otherLastAppearance = super.get(index).getLastAppearance(); if (otherLastAppearance.isAfter(lastAppearance)) { lastAppearance = otherLastAppearance; } } return lastAppearance; }
Source:
protected void lastListenerRemoved() { if (getRealm().isCurrent()) { stopListeningInternal(); } else { getRealm().asyncExec(() -> { if (!hasListeners && isListening) { stopListeningInternal(); } }); } hasListeners = false; super.lastListenerRemoved(); }

Target:
protected final void lastListenerRemoved() { if (getRealm().isCurrent()) { stopListeningInternal(); } else { getRealm().asyncExec(() -> { if (!hasListeners && isListening) { stopListeningInternal(); } }); } hasListeners = false; super.lastListenerRemoved(); }
Source:
@Test public void testDecorrelateUnion1() { final String sql = "SELECT * FROM emp A where (deptno, sal) in \n" + "(SELECT deptno, sal FROM emp\n" + "UNION ALL\n" + "SELECT deptno, sal FROM emp B where A.mgr = B.empno)"; sql(sql) .withLateDecorrelation(true) .withTrim(true) .with(HepProgram.builder().build()) .checkUnchanged(); }

Target:
@Test public void testDecorrelateUnion1() { final String sql = "SELECT * FROM emp where exists \n" + "(SELECT 1 FROM dept where deptno = emp.deptno\n" + "UNION ALL\n" + "SELECT 1 FROM dept where deptno + 1 = emp.deptno)"; sql(sql) .withLateDecorrelation(true) .withTrim(true) .with(HepProgram.builder().build()) .check(); }
Source:
public Parameter getSourceParameter() { for ( Parameter parameter : getParameters() ) { if ( !parameter.isMappingTarget() ) { return parameter; } } throw new IllegalStateException( "Method " + this + " has no source parameter." ); }

Target:
public Parameter getSourceParameter() { for ( Parameter parameter : getParameters() ) { if ( !parameter.isMappingTarget() && !parameter.isMappingContext() ) { return parameter; } } throw new IllegalStateException( "Method " + this + " has no source parameter." ); }
Source:
public boolean matches(ClusteringConfiguration other) { if (attributes == null) { if (other.attributes != null) return false; } else if (!attributes.matches(other.attributes)) return false; if (hashConfiguration == null) { if (other.hashConfiguration != null) return false; } else if (!hashConfiguration.matches(other.hashConfiguration)) return false; if (l1Configuration == null) { if (other.l1Configuration != null) return false; } else if (!l1Configuration.matches(other.l1Configuration)) return false; if (partitionHandlingConfiguration == null) { if (other.partitionHandlingConfiguration != null) return false; } else if (!partitionHandlingConfiguration.matches(other.partitionHandlingConfiguration)) return false; if (stateTransferConfiguration == null) { if (other.stateTransferConfiguration != null) return false; } else if (!stateTransferConfiguration.matches(other.stateTransferConfiguration)) return false; if (syncConfiguration == null) { if (other.syncConfiguration != null) return false; } else if (!syncConfiguration.matches(other.syncConfiguration)) return false; return true; }

Target:
public boolean matches(ClusteringConfiguration other) { return (attributes.matches(other.attributes) && hashConfiguration.matches(other.hashConfiguration) && l1Configuration.matches(other.l1Configuration) && partitionHandlingConfiguration.matches(other.partitionHandlingConfiguration) && stateTransferConfiguration.matches(other.stateTransferConfiguration) && syncConfiguration.matches(other.syncConfiguration)); }
Source:
public void shouldGetAllergyByUuid() throws Exception { Allergy allergy = Context.getPatientService().getAllergyByUuid(getUuid()); Patient patient = allergy.getPatient(); SimpleObject so = deserialize(handle(newGetRequest(getURI() + "/" + getUuid()))); Assert.assertEquals(allergy.getComment(), Util.getByPath(so, "comment")); Assert.assertEquals(allergy.getSeverity().getUuid(), Util.getByPath(so, "severity/uuid")); if (allergy.getAllergen().isCoded()) { Assert.assertEquals(allergy.getAllergen().getCodedAllergen().getUuid(), Util.getByPath(so, "allergen/codedAllergen/uuid")); } else { Assert.assertEquals(allergy.getAllergen().getCodedAllergen().getUuid(), Util.getByPath(so, "allergen/codedAllergen/uuid")); Assert.assertEquals(allergy.getAllergen(), Util.getByPath(so, "allergen/nonCodedAllergen")); } Assert.assertEquals(allergy.getAllergen().getAllergenType().toString(), Util.getByPath(so, "allergen/allergenType")); }

Target:
public void shouldGetAllergyByUuid() throws Exception { Allergy allergy = Context.getPatientService().getAllergyByUuid(getUuid()); Patient patient = allergy.getPatient(); SimpleObject savedAllergy = deserialize(handle(newGetRequest(getURI() + "/" + getUuid()))); Assert.assertEquals(allergy.getComment(), Util.getByPath(savedAllergy, "comment")); Assert.assertEquals(allergy.getSeverity().getUuid(), Util.getByPath(savedAllergy, "severity/uuid")); Assert.assertEquals(allergy.getAllergen().getCodedAllergen().getUuid(), Util.getByPath(savedAllergy, "allergen/codedAllergen/uuid")); Assert.assertEquals(allergy.getAllergen().getAllergenType().toString(), Util.getByPath(savedAllergy, "allergen/allergenType")); }
Source:
private InputStream getInputStream(HttpResponse response) { HttpEntity entity = response.getEntity(); if (entity != null) { try { PushbackInputStream in = new PushbackInputStream(entity.getContent()); int firstByte = in.read(); if (firstByte != -1) { in.unread(firstByte); return in; } } catch (IOException e) { throw new ContainedException("Failed to read response"); } } return null; }

Target:
private InputStream getInputStream(HttpResponse response) throws IOException { HttpEntity entity = response.getEntity(); if (entity != null) { PushbackInputStream in = new PushbackInputStream(entity.getContent()); int firstByte = in.read(); if (firstByte != -1) { in.unread(firstByte); return in; } } return null; }
Source:
public void testDefaultGeometry() throws IOException { FeatureTypeInfo featureType = getCatalog().getResourceByName("cdf", "Nulls", FeatureTypeInfo.class); GeometryDescriptor schemaDefaultGeometry = featureType.getFeatureType().getGeometryDescriptor(); FeatureIterator i = featureType.getFeatureSource(null, null).getFeatures().features(); GeometryDescriptor featureDefaultGeometry = i.next().getDefaultGeometryProperty().getDescriptor(); assertNotNull(schemaDefaultGeometry); assertNotNull(featureDefaultGeometry); assertEquals(schemaDefaultGeometry, featureDefaultGeometry); }

Target:
public void testDefaultGeometry() throws IOException { FeatureTypeInfo featureType = getCatalog().getResourceByName("cdf", "Nulls", FeatureTypeInfo.class); GeometryDescriptor schemaDefaultGeometry = featureType.getFeatureType().getGeometryDescriptor(); FeatureIterator i = featureType.getFeatureSource(null, null).getFeatures().features(); GeometryDescriptor featureDefaultGeometry = i.next().getDefaultGeometryProperty().getDescriptor(); assertNotNull(schemaDefaultGeometry); assertNotNull(featureDefaultGeometry); assertEquals("pointProperty", schemaDefaultGeometry.getLocalName()); assertEquals(schemaDefaultGeometry, featureDefaultGeometry); }
Source:
public void createInitialLayout(IPageLayout layout) { layout.addView(RepositoriesView.VIEW_ID, IPageLayout.LEFT, (float) 0.5, layout.getEditorArea()); IFolderLayout bottom = layout.createFolder( "bottom", IPageLayout.BOTTOM, (float) 0.5, layout.getEditorArea()); bottom.addView(IPageLayout.ID_PROP_SHEET); bottom.addView(IHistoryView.VIEW_ID); bottom.addView(StagingView.VIEW_ID); bottom.addView(ReflogView.VIEW_ID); layout.addPlaceholder("org.eclipse.jdt.ui.PackageExplorer", IPageLayout.BOTTOM, (float) 0.7, RepositoriesView.VIEW_ID); layout.addShowViewShortcut("org.eclipse.jdt.ui.PackageExplorer"); layout.addShowViewShortcut(IHistoryView.VIEW_ID); layout.addShowViewShortcut(ISynchronizeView.VIEW_ID); layout.addShowViewShortcut(StagingView.VIEW_ID); layout.addShowViewShortcut(ReflogView.VIEW_ID); layout.addActionSet("org.eclipse.egit.ui.navigation"); }

Target:
public void createInitialLayout(IPageLayout layout) { layout.addView(RepositoriesView.VIEW_ID, IPageLayout.LEFT, (float) 0.5, layout.getEditorArea()); IFolderLayout bottom = layout.createFolder( "bottom", IPageLayout.BOTTOM, (float) 0.5, layout.getEditorArea()); bottom.addView(IPageLayout.ID_PROP_SHEET); bottom.addView(IHistoryView.VIEW_ID); bottom.addView(ISynchronizeView.VIEW_ID); bottom.addView(StagingView.VIEW_ID); bottom.addView(ReflogView.VIEW_ID); layout.addPlaceholder("org.eclipse.jdt.ui.PackageExplorer", IPageLayout.BOTTOM, (float) 0.7, RepositoriesView.VIEW_ID); layout.addShowViewShortcut("org.eclipse.jdt.ui.PackageExplorer"); layout.addShowViewShortcut(IHistoryView.VIEW_ID); layout.addShowViewShortcut(ISynchronizeView.VIEW_ID); layout.addShowViewShortcut(StagingView.VIEW_ID); layout.addShowViewShortcut(ReflogView.VIEW_ID); layout.addActionSet("org.eclipse.egit.ui.navigation"); }
Source:
public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory.getUrl().getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || "false".equalsIgnoreCase(value)) { result = this.invoker.invoke(invocation); } else if (value.startsWith("force")) { if (logger.isWarnEnabled()) { logger.warn("force-mock: " + invocation.getMethodName() + " force-mock enabled , url : " + directory.getUrl()); } result = doMockInvoke(invocation, null); } else { try { result = this.invoker.invoke(invocation); } catch (RpcException e) { if (e.isBiz()) { throw e; } if (logger.isWarnEnabled()) { logger.warn("fail-mock: " + invocation.getMethodName() + " fail-mock enabled , url : " + directory.getUrl(), e); } result = doMockInvoke(invocation, e); } } return result; }

Target:
public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory.getUrl().getMethodParameter(invocation.getMethodName(), MOCK_KEY, Boolean.FALSE.toString()).trim(); if (value.length() == 0 || value.equalsIgnoreCase("false")) { result = this.invoker.invoke(invocation); } else if (value.startsWith("force")) { if (logger.isWarnEnabled()) { logger.warn("force-mock: " + invocation.getMethodName() + " force-mock enabled , url : " + directory.getUrl()); } result = doMockInvoke(invocation, null); } else { try { result = this.invoker.invoke(invocation); } catch (RpcException e) { if (e.isBiz()) { throw e; } if (logger.isWarnEnabled()) { logger.warn("fail-mock: " + invocation.getMethodName() + " fail-mock enabled , url : " + directory.getUrl(), e); } result = doMockInvoke(invocation, e); } } return result; }
Source:
public void validate() { if (!Strings.isNullOrEmpty(timeZone) && (Strings.isNullOrEmpty(filePathFormat) && !containsMacro("filePathFormat"))) { throw new IllegalArgumentException("The filePathFormat setting must be set in order to set timeZone."); } if (partitionOffset != null) { TimeParser.parseDuration(partitionOffset); } if (cleanPartitionsOlderThan != null) { long oldTime = TimeParser.parseDuration(cleanPartitionsOlderThan); if (oldTime < TimeUnit.MINUTES.toMillis(1)) { throw new IllegalArgumentException("Cannot clean partitions from less than 1 minute ago."); } } }

Target:
public void validate() { if (!containsMacro("filePathFormat") && !Strings.isNullOrEmpty(timeZone) && Strings.isNullOrEmpty(filePathFormat)) { throw new IllegalArgumentException("The filePathFormat setting must be set in order to set timeZone."); } if (partitionOffset != null) { TimeParser.parseDuration(partitionOffset); } if (cleanPartitionsOlderThan != null) { long oldTime = TimeParser.parseDuration(cleanPartitionsOlderThan); if (oldTime < TimeUnit.MINUTES.toMillis(1)) { throw new IllegalArgumentException("Cannot clean partitions from less than 1 minute ago."); } } }
Source:
T specialize(ImmutableMap<Class<?>, Class<?>> classRemapping) { String specializedClassName = specializedClassNamePrefix + specializedClassCounter.get(); ClassWriter specializedClassWriter = new ClassWriter(0); SimpleRemapper remapper = new SimpleRemapper(createRemapping(classRemapping, specializedClassName)); ClassVisitor classTransformer = new ClassRemapper(specializedClassWriter, remapper); try { ClassReader prototypeClassReader = new ClassReader(getPrototypeClassBytecode()); prototypeClassReader.accept(classTransformer, 0); byte[] specializedClassBytecode = specializedClassWriter.toByteArray(); Class<T> specializedClass = (Class<T>) DefineClassUtils.defineClass( prototypeClass, specializedClassBytecode, specializedClassName ); specializedClassCounter.incrementAndGet(); return specializedClass.newInstance(); } catch (InstantiationException | IllegalAccessException | IOException e) { throw new RuntimeException(e); } }

Target:
T specialize(ImmutableMap<Class<?>, Class<?>> classRemapping) { String specializedClassName = specializedClassNamePrefix + specializedClassCounter.get(); ClassWriter specializedClassWriter = new ClassWriter(0); SimpleRemapper remapper = new SimpleRemapper(createRemapping(classRemapping, specializedClassName)); ClassVisitor classTransformer = new ClassRemapper(specializedClassWriter, remapper); try { ClassReader prototypeClassReader = new ClassReader(getPrototypeClassBytecode()); prototypeClassReader.accept(classTransformer, 0); byte[] specializedClassBytecode = specializedClassWriter.toByteArray(); @SuppressWarnings("unchecked") Class<T> specializedClass = (Class<T>) DefineClassUtils.defineClass( prototypeClass, specializedClassBytecode, specializedClassName ); specializedClassCounter.incrementAndGet(); return specializedClass.newInstance(); } catch (InstantiationException | IllegalAccessException | IOException e) { throw new RuntimeException(e); } }
Source:
public static GroupingSetDescriptor singleGroupingSet(List<VariableReferenceExpression> groupingKeys) { Set<Integer> globalGroupingSets; if (groupingKeys.isEmpty()) { globalGroupingSets = unmodifiableSet(Collections.singleton(0)); } else { globalGroupingSets = unmodifiableSet(new HashSet<>()); } return new GroupingSetDescriptor(groupingKeys, 1, globalGroupingSets); }

Target:
public static GroupingSetDescriptor singleGroupingSet(List<VariableReferenceExpression> groupingKeys) { Set<Integer> globalGroupingSets; if (groupingKeys.isEmpty()) { globalGroupingSets = unmodifiableSet(Collections.singleton(0)); } else { globalGroupingSets = unmodifiableSet(emptySet()); } return new GroupingSetDescriptor(groupingKeys, 1, globalGroupingSets); }
Source:
private OffsetResponse mockOffsetResponse(List<MyMessage> myMessages) { OffsetResponse offsetResponse = EasyMock.createMock(OffsetResponse.class); _mocks.add(offsetResponse); EasyMock.expect(offsetResponse.offsets(EasyMock.anyString(), EasyMock.anyInt())).andReturn(new long[]{myMessages.size()}).times(1); EasyMock.expect(offsetResponse.offsets(EasyMock.anyString(), EasyMock.anyInt())).andReturn(new long[]{0}).times(1); EasyMock.expect(offsetResponse.hasError()).andReturn(false).anyTimes(); return offsetResponse; }

Target:
private OffsetResponse mockOffsetResponse(List<MyMessage> myMessages) { OffsetResponse offsetResponse = EasyMock.createMock(OffsetResponse.class); _mocks.add(offsetResponse); EasyMock.expect(offsetResponse.offsets(EasyMock.anyString(), EasyMock.anyInt())).andReturn(new long[]{myMessages.size()}).times(1); EasyMock.expect(offsetResponse.offsets(EasyMock.anyString(), EasyMock.anyInt())).andReturn(new long[]{0}).times(1); EasyMock.expect(offsetResponse.hasError()).andReturn(false).times(2); return offsetResponse; }
Source:
public void generateInsights(final Long accountId, final DateTime accountCreated, final RolloutClient featureFlipper) { final int accountAge = DateTimeUtil.getDateDiffFromNowInDays(accountCreated); if (accountAge < 1) { return; } if (accountAge <= NEW_ACCOUNT_THRESHOLD) { this.generateNewUserInsights(accountId, accountAge); return; } final Optional<DeviceAccountPair> deviceAccountPairOptional = deviceReadDAO.getMostRecentSensePairByAccountId(accountId); if (!deviceAccountPairOptional.isPresent()) { return; } final Long internalDeviceId = deviceAccountPairOptional.get().internalDeviceId; if (featureFlipper.userFeatureActive(FeatureFlipper.DYNAMODB_DEVICE_DATA_INSIGHTS, accountId, Collections.EMPTY_LIST)) { LOGGER.info("Generating insights with DynamoDB for account {}", accountId); try { final String externalDeviceId = deviceAccountPairOptional.get().externalDeviceId; this.generateGeneralInsights(accountId, DeviceId.create(externalDeviceId), deviceDataDAODynamoDB, featureFlipper); return; } catch (Exception ex) { LOGGER.error("Caught exception generating insight for account using DynamoDB {}. {}", accountId, ex); } } if (featureFlipper.userFeatureActive(FeatureFlipper.INSIGHT_SCHEDULE_CBTI_V1, accountId, Collections.EMPTY_LIST)) { this.generateInsightCoach(accountId, DeviceId.create(internalDeviceId), deviceDataDAO); } this.generateGeneralInsights(accountId, DeviceId.create(internalDeviceId), deviceDataDAO, featureFlipper); }

Target:
public void generateInsights(final Long accountId, final DateTime accountCreated, final RolloutClient featureFlipper) { final int accountAge = DateTimeUtil.getDateDiffFromNowInDays(accountCreated); if (accountAge < 1) { return; } if (accountAge <= NEW_ACCOUNT_THRESHOLD) { this.generateNewUserInsights(accountId, accountAge); return; } final Optional<DeviceAccountPair> deviceAccountPairOptional = deviceReadDAO.getMostRecentSensePairByAccountId(accountId); if (!deviceAccountPairOptional.isPresent()) { return; } final Long internalDeviceId = deviceAccountPairOptional.get().internalDeviceId; if (featureFlipper.userFeatureActive(FeatureFlipper.DYNAMODB_DEVICE_DATA_INSIGHTS, accountId, Collections.EMPTY_LIST)) { LOGGER.info("Generating insights with DynamoDB for account {}", accountId); try { final String externalDeviceId = deviceAccountPairOptional.get().externalDeviceId; this.generateGeneralInsights(accountId, DeviceId.create(externalDeviceId), deviceDataDAODynamoDB, featureFlipper); return; } catch (Exception ex) { LOGGER.error("Caught exception generating insight for account using DynamoDB {}. {}", accountId, ex); } } if (featureFlipper.userFeatureActive(FeatureFlipper.INSIGHT_SCHEDULE_CBTI_V1, accountId, Collections.EMPTY_LIST)) { } else { this.generateGeneralInsights(accountId, DeviceId.create(internalDeviceId), deviceDataDAO, featureFlipper); } }
Source:
protected void createClass(BaseClass xclass) { xclass.addTextField(PARAMETER_NAME_PROPERTY, "Parameter name", 30); xclass.addTextAreaField(PARAMETER_DESCRIPTION_PROPERTY, "Parameter description", 40, 5); xclass.addBooleanField(PARAMETER_MANDATORY_PROPERTY, "Parameter mandatory", "yesno"); xclass.addTextField(PARAMETER_DEFAULT_VALUE_PROPERTY, "Parameter default value", 30); xclass.addTextField(PARAMETER_TYPE_PROPERTY, "Parameter type", 30); }

Target:
protected void createClass(BaseClass xclass) { xclass.addTextField(PARAMETER_NAME_PROPERTY, "Parameter name", 30); xclass.addTextAreaField(PARAMETER_DESCRIPTION_PROPERTY, "Parameter description", 40, 5); xclass.addBooleanField(PARAMETER_MANDATORY_PROPERTY, "Parameter mandatory", "yesno"); xclass.addTextField(PARAMETER_DEFAULT_VALUE_PROPERTY, "Parameter default value", 30); xclass.addTextField(PARAMETER_TYPE_PROPERTY, "Parameter type", 60); }
Source:
public void execute() throws MojoExecutionException { DockerClient client = null; try { final DefaultDockerClient.Builder builder = DefaultDockerClient.fromEnv() .readTimeoutMillis(NO_TIMEOUT); final String dockerHost = dockerHost(); if (!isNullOrEmpty(dockerHost)) { builder.uri(dockerHost); } client = builder.build(); execute(client); } catch (Exception e) { throw new MojoExecutionException("Exception caught", e); } finally { if (client != null) { client.close(); } } }

Target:
public void execute() throws MojoExecutionException { DockerClient client = null; try { final DefaultDockerClient.Builder builder = DefaultDockerClient.fromEnv() .readTimeoutMillis(NO_TIMEOUT); final String dockerHost = rawDockerHost(); if (!isNullOrEmpty(dockerHost)) { builder.uri(dockerHost); } client = builder.build(); execute(client); } catch (Exception e) { throw new MojoExecutionException("Exception caught", e); } finally { if (client != null) { client.close(); } } }
Source:
protected IFile[] locateFiles(IProject p, final String fileName) throws CoreException { final ArrayList<IFile> ret = new ArrayList<IFile>(); if( p != null && p.isAccessible() && p.isOpen()) { p.accept(new IResourceVisitor(){ public boolean visit(IResource resource) throws CoreException { if( resource.getName().toLowerCase().equals(fileName)) { if( resource instanceof IFile) { ret.add((IFile)resource); } } return true; }}); } return (IFile[]) ret.toArray(new IFile[ret.size()]); }

Target:
protected IFile[] locateFiles(IProject p, final String fileName) throws CoreException { final ArrayList<IFile> ret = new ArrayList<IFile>(); if( p != null && p.isAccessible()) { p.accept(new IResourceVisitor(){ public boolean visit(IResource resource) throws CoreException { if( resource.getName().toLowerCase().equals(fileName)) { if( resource instanceof IFile) { ret.add((IFile)resource); } } return true; }}); } return (IFile[]) ret.toArray(new IFile[ret.size()]); }