auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>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(); <START> verify(view).setName(any()); <END> verify(doubleValueModal).show(any()); }</code><technical_language>please verify "Name" set instead of _any()_</technical_language>

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:
<code>public String getModifiedIndex() { <START> Objects.requireNonNull(eventIndexName, "null value"); <END> if(!eventIndexName.equals("netflow")) { return String.format("%s-%s", eventIndexName, TYPE); } return TYPE; }</code><technical_language>non-null check needs in setter, getter. omit message "null value" add context</technical_language>

Target:
private String getModifiedIndex() { if (!eventIndexName.isEmpty()) { return String.format("%s-%s", eventIndexName, TYPE); } return TYPE; }
Source:
<code>public void addCallsAddForClient() throws Exception { addActionConfig.addType = Arrays.asList("client"); addActionConfig.name = client.getName(); addActionConfig.description = "description"; <START> addActionConfig.spiffeUri = "spiffe END> when(keywhizClient.getClientByName(client.getName())).thenThrow(new NotFoundException()); addAction.run(); verify(keywhizClient).createClient(addActionConfig.name, addActionConfig.getDescription(), addActionConfig.getSpiffeUri()); }</code><technical_language>minor nit, example.org is choice for test data, is explicitly set for purposes of testing -- matters in cases this</technical_language>

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:
<code>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; <START> this.streamUUID = UUID.nameUUIDFromBytes(this.fullyQualifiedTableName.getBytes()); <END> 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(); }</code><technical_language>CorfuRuntime.getStreamID(tableName)</technical_language>

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:
<code>protected void setValue(Object element, Object value) { if (value instanceof String) { String string = (String) value; boolean empty = string.isEmpty(); if (!empty) { <START> Long newVal = Long.parseLong(string); <END> if (element instanceof TraceAndOffset) { TraceAndOffset tao = (TraceAndOffset) element; tao.setOffset(newVal); fViewer.getViewer().update(element, null); } } } }</code><technical_language>This throw exception if entered is a number</technical_language>

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:
<code>public static Map<String, String> labelsToNames(Map<String, String> labels) { Map<String, String> names = new HashMap<>(); <START> if (labels != null) { <END> 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; }</code><technical_language>Avoiding nest for loop if more readable: java if (labels == null) { returns names; } for (Map.Entry<String, String> label : labels.entrySet()) { ... }</technical_language>

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:
<code>void detach(Action action) { <START> if (actions != null) { <END> actions.remove(action); } if (this.action == action) { this.action = null; } }</code><technical_language>else if this</technical_language>

Target:
void detach(Action action) { if (this.action == action) { this.action = null; } else if (actions != null) { actions.remove(action); } }
Source:
<code>public void testDuplicateCodeListTable() { <START> assertThat(testSetColumns.codeListTable.size(), is(14)); END> verify(mockAppender, times(2)).doAppend(argThat(argument -> argument .getLevel().equals(Level.WARN))); }</code><technical_language>[x] testDuplicateCodeListTable want check</technical_language>

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:
<code>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); } <START> } <END> return Optional.empty(); }</code><technical_language>Minor suggestion - replace if-check this line return Optional.ofNullable(pm);</technical_language>

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:
<code>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 { <START> <END> 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); }</code><technical_language>Is this case possible</technical_language>

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:
<code>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) { <START> Thread.interrupted(); <END> } } return exists; }</code><technical_language>reset interrupt flag Thread.currentThread().interrupt() instead? This is optional, I is reasonable for a method named wait... throw InterruptedException allow caller decide do if wait is interrupted</technical_language>

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:
<code>public boolean isFirstMilestoneOrPredeterminedInvoiceBySchedule(String billingFrequencyCode, String invoicingOptionCode, Date lastBilledDate) { if (StringUtils.equalsIgnoreCase(ArIntegrationConstants.AwardInvoicingOptions.INV_SCHEDULE, invoicingOptionCode) && (ArIntegrationConstants.BillingFrequencyValues.MILESTONE.equals(billingFrequencyCode) <START> || ArIntegrationConstants.BillingFrequencyValues.PREDETERMINED_BILLING.equals(billingFrequencyCode)) <END> && ObjectUtils.isNull(lastBilledDate)) { return true; } return false; }</code><technical_language>For consistency I suggest StringUtils for this String comparison, is above. indentation of this if statement hard read. break private methods isFirstMilestoneBill isFirstPredeterminedInvoiceByScheduleBill. I suggest returning boolean expression, "if (true) return true else return false"</technical_language>

Target:
public boolean isFirstMilestoneOrPredeterminedInvoiceBySchedule(String billingFrequencyCode, String invoicingOptionCode, Date lastBilledDate) { return (isInvoiceBySchedule(invoicingOptionCode) && isBillingFrequencyMilesoneOrPredetermined(billingFrequencyCode) && isLastBilledDateNull(lastBilledDate)); }
Source:
<code>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) <START> .orElseThrow(() -> new IllegalStateException( <END> "This implementation of MessageHandlingMember does not wrap a " + "java.lang.reflect.Member. Please provide a different way of " + "getting 'declaringClass' of this MessageHandlingMember.")); }</code><technical_language>I suggest throwing UnsupportedOperationException instead</technical_language>

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:
<code>protected void doExecute(StepExecution stepExecution) throws Exception { <START> if(reducer != null) { <END> 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); } }</code><technical_language>minor; hasReducer() replace multiple null checks</technical_language>

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:
<code>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); <START> winrsCmd.addArgument("-username:" + username); <END> 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); }</code><technical_language>["Little Bobby Tables"](<LINK_0> get login</technical_language>

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:
<code>protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception { if (started) { logger.debug( String.format( "Sending data [%s]:%n%s", <START> ctx.channel().remoteAddress().toString(), msg.toString(StandardCharsets.UTF_8))); <END> byte[] b = new byte[msg.readableBytes()]; msg.readBytes(b); out.writeBytes(connection.encryptResponse(b)); } else { out.writeBytes(msg); } }</code><technical_language>This is unnecessarily creating objects debug logging is off</technical_language>

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:
<code>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); <START> executor.submit((Callable<Void>) () -> { <END> 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(); } }</code><technical_language>Runnable</technical_language>

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:
<code>public static void handleExternalLink(final Context context, final Uri uri) { final WikipediaZeroHandler zeroHandler = WikipediaApp.getInstance() .getWikipediaZeroHandler(); if (!zeroHandler.isZeroEnabled()) { visitInExternalBrowser(context, uri); return; } <START> <END> 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(); }</code><technical_language>this method a bit smaller? excise a method builds a dialog it</technical_language>

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:
<code>private int distance(String pattern) { String example; if (RefControl.isRE(pattern)) { example = shortestExampleCache.get(pattern); <START> <END> 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); }</code><technical_language>this empty line line 97</technical_language>

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:
<code>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) { <START> LOG.warn("Reached EOF in log before reading entries. Ignoring all edits since the last marker", <END> numEntries, transactionEdits.size(), e); transactionEdits.clear(); } } }</code><technical_language>a good idea entries read here</technical_language>

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:
<code>public void enableElytronSubsystem() throws IOException, InterruptedException, TimeoutException { <START> ops.add(ELYTRON_EXTENSION_ADDRESS, Values.of("module", ELYTRON_EXTENSION_NAME)); <END> ops.add(ELYTRON_SUBSYSTEM_ADDRESS); adminOps.reloadIfRequired(); }</code><technical_language>please add ModelNodeResult#assertSuccess() operation adding Elytron subsystem well</technical_language>

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:
<code>public LocalDate getLastAppearance() { if (super.isEmpty()) { return null; } LocalDate lastAppearance = super.get(0).getLastAppearance(); for (int index = 1; index < super.size(); index++) { <START> LocalDate lastAppearance = super.get(index).getLastAppearance(); <END> if (lastAppearance.isAfter(lastAppearance)) { lastAppearance = lastAppearance; } } return lastAppearance; }</code><technical_language>This compile: lastAppearance is defined</technical_language>

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:
<code><START> protected void lastListenerRemoved() { <END> if (getRealm().isCurrent()) { stopListeningInternal(); } else { getRealm().asyncExec(() -> { if (!hasListeners && isListening) { stopListeningInternal(); } }); } hasListeners = false; super.lastListenerRemoved(); }</code><technical_language>final</technical_language>

Target:
protected final void lastListenerRemoved() { if (getRealm().isCurrent()) { stopListeningInternal(); } else { getRealm().asyncExec(() -> { if (!hasListeners && isListening) { stopListeningInternal(); } }); } hasListeners = false; super.lastListenerRemoved(); }
Source:
<code>@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" <START> + "SELECT deptno, sal FROM emp B where A.mgr = B.empno)"; <END> sql(sql) .withLateDecorrelation(true) .withTrim(true) .with(HepProgram.builder().build()) .checkUnchanged(); }</code><technical_language>this a valid case decorrelate</technical_language>

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:
<code>public Parameter getSourceParameter() { for ( Parameter parameter : getParameters() ) { if ( !parameter.isMappingTarget() ) { return parameter; } } <START> throw new IllegalStateException( "Method " + this + " has no source parameter." ); <END> }</code><technical_language>Is this a "regular" error situation? If so, raise a proper compiler error instead</technical_language>

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:
<code>public boolean matches(ClusteringConfiguration other) { if (attributes == null) { if (other.attributes != null) return false; } else if (!attributes.matches(other.attributes)) return false; <START> if (hashConfiguration == null) { <END> 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; }</code><technical_language>is *Configuration null</technical_language>

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:
<code>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")); <START> Assert.assertEquals(allergy.getSeverity().getUuid(), Util.getByPath(so, "severity/uuid")); <END> 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")); }</code><technical_language>I preferred original version of this method assertions allergy object instead of SimpleObject</technical_language>

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:
<code>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) { <START> throw new ContainedException("Failed to read response"); <END> } } return null; }</code><technical_language>Spotbug error read this again. letting exception bubble up? this IOE handled correctly retrying, catched line 357. Is a reason for retrying IOE if here? Side note: if sense exception bubble up, fine ignoring spotbug warning in this method</technical_language>

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:
<code>public void testDefaultGeometry() throws IOException { FeatureTypeInfo featureType = <START> getCatalog().getResourceByName("cdf", "Nulls", FeatureTypeInfo.class); <END> 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); }</code><technical_language>@tbarsballe is SimpleFeatureType for "cdf" defined</technical_language>

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:
<code>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); <START> bottom.addView(ReflogView.VIEW_ID); <END> 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"); }</code><technical_language>I add synchronize view</technical_language>

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:
<code>public Result invoke(Invocation invocation) throws RpcException { Result result = null; String value = directory.getUrl().getMethodParameter(invocation.getMethodName(), Constants.MOCK_KEY, Boolean.FALSE.toString()).trim(); <START> if (value.length() == 0 || "false".equalsIgnoreCase(value)) { <END> 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; }</code><technical_language>I is define a constant here</technical_language>

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:
<code>public void validate() { if (!Strings.isNullOrEmpty(timeZone) && <START> (Strings.isNullOrEmpty(filePathFormat) && !containsMacro("filePathFormat"))) { <END> 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."); } } }</code><technical_language>do !containsMacro("filePathFormat") check first</technical_language>

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:
<code>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(); <START> Class<T> specializedClass = (Class<T>) DefineClassUtils.defineClass( <END> prototypeClass, specializedClassBytecode, specializedClassName ); specializedClassCounter.incrementAndGet(); return specializedClass.newInstance(); } catch (InstantiationException | IllegalAccessException | IOException e) { throw new RuntimeException(e); } }</code><technical_language>Please put @SuppressWarnings("unchecked") this statement, method</technical_language>

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:
<code>public static GroupingSetDescriptor singleGroupingSet(List<VariableReferenceExpression> groupingKeys) { Set<Integer> globalGroupingSets; if (groupingKeys.isEmpty()) { globalGroupingSets = unmodifiableSet(Collections.singleton(0)); } else { <START> globalGroupingSets = unmodifiableSet(new HashSet<>()); <END> } return new GroupingSetDescriptor(groupingKeys, 1, globalGroupingSets); }</code><technical_language>emptySet()</technical_language>

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:
<code>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); <START> EasyMock.expect(offsetResponse.hasError()).andReturn(false).anyTimes(); <END> return offsetResponse; }</code><technical_language>passing expected return argument mockOffsetResponse(), this control mock object return true false</technical_language>

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; }