auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void execute(JobExecutionContext context) throws JobExecutionException { try { startManagedResources(); if(this.consumer instanceof ScheduledComponent) { JobDetail jobDetail = ((ScheduledComponent<JobDetail>)consumer).getJobDetail(); Trigger trigger = newTrigger() .withIdentity(triggerKey(jobDetail.getKey().getName(), jobDetail.getKey().getGroup() )) .startNow() .withSchedule(simpleSchedule().withMisfireHandlingInstructionNextWithRemainingCount()) .build(); Date scheduledDate = scheduler.scheduleJob(jobDetail, trigger); if(logger.isDebugEnabled()) { logger.debug("RecoveryManager scheduled callback on consumer flow [" + trigger.getKey().getName() + "] module [" + trigger.getKey().getGroup() + "] for [" + scheduledDate + "]"); } } else { this.consumer.start(); if(!isEventBaseRecovery) { <START> recoveryAttempts = 0; <END> } } } catch(Throwable throwable) { this.recover(this.previousComponentName, throwable); } }</code><technical_language>I call cancelRecovery(null) a cleaner. surely do in consumer is a scheduled consumer</technical_language>

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { try { startManagedResources(); if(this.consumer instanceof ScheduledComponent) { JobDetail jobDetail = ((ScheduledComponent<JobDetail>)consumer).getJobDetail(); Trigger trigger = newTrigger() .withIdentity(triggerKey(jobDetail.getKey().getName(), jobDetail.getKey().getGroup() )) .startNow() .withSchedule(simpleSchedule().withMisfireHandlingInstructionNextWithRemainingCount()) .build(); Date scheduledDate = scheduler.scheduleJob(jobDetail, trigger); if(logger.isDebugEnabled()) { logger.debug("RecoveryManager scheduled callback on consumer flow [" + trigger.getKey().getName() + "] module [" + trigger.getKey().getGroup() + "] for [" + scheduledDate + "]"); } } else { this.consumer.start(); } if(!isEventBaseRecovery) { cancelAll(); } } catch(Throwable throwable) { this.recover(this.previousComponentName, throwable); } }
Source:
<code>private void updateTransactionsWithRetry(long paymentRequestId, long retries) { try { setCreatedDateOnTransactions(paymentRequestId); } catch (Exception exc) { if (retries < 3) { <START> logger.error("Problem migrating [" + paymentRequestId + "] " + exc.getMessage() + " retry count [" + retries + "]"); <END> updateTransactionsWithRetry(paymentRequestId, retries + 1); } else { throw exc; } } }</code><technical_language>putting adding exc logger (2nd argument) message? full stacktrace</technical_language>

Target:
private void updateTransactionsWithRetry(long paymentRequestId, long retries) { try { setCreatedDateOnTransactions(paymentRequestId); } catch (Exception exc) { if (retries < 3) { logger.error("Problem migrating [" + paymentRequestId + "] " + " retry count [" + retries + "]", exc ); updateTransactionsWithRetry(paymentRequestId, retries + 1); } else { throw exc; } } }
Source:
<code>public static boolean isNetworkActive(Context context) { boolean isNetworkActive = true; ConnectivityManager cm = (ConnectivityManager)context. getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); <START> if (activeNetwork == null || (activeNetwork!= null && <END> !activeNetwork.isConnectedOrConnecting())) { isNetworkActive = false; } return isNetworkActive; }</code><technical_language>I simplify return (activeNetwork != null && activeNetwork.isConnectedOrConnecting()) . isActiveNetwork variable declared assigned, easier condition</technical_language>

Target:
public static boolean isNetworkActive(Context context) { ConnectivityManager cm = (ConnectivityManager)context. getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); return (activeNetwork != null && activeNetwork.isConnectedOrConnecting()); }
Source:
<code>public void commit(final Xid xid, final boolean arg1) throws XAException { System.out.println("DummyXAResource commit() called, fault: " + fault + " xid: " + xid); commitCalled = true; commitRequests += 1; if (fault != null) { <START> if (fault.equals(faultType.EX)) { <END> throw new XAException(XAException.XA_RBTRANSIENT); } else if (fault.equals(faultType.HALT)) { recoveryXids = new Xid[1]; recoveryXids[0] = xid; Runtime.getRuntime().halt(1); } } }</code><technical_language>I this facility clearest remove faultType.EX this handling</technical_language>

Target:
public void commit(final Xid xid, final boolean arg1) throws XAException { System.out.println("[" + Thread.currentThread().getName() + "] DummyXAResource XA_COMMIT [" + xid + "] with fault " + fault); commitRequests += 1; if (fault != null) { if (fault.equals(faultType.HALT)) { Runtime.getRuntime().halt(1); } } System.out.println("[" + Thread.currentThread().getName() + "] DummyXAResource commitRequests = " + commitRequests); if (file != null) { if (!file.delete()) { throw new XAException(XAException.XA_RETRY); } } this.xid = null; }
Source:
<code>private void checkSnapshotReadiness(AuthenticatedContext ac, AmazonEC2Client client, CreateSnapshotResult snapshotResult) { Waiter<DescribeSnapshotsRequest> snapshotWaiter = client.waiters().snapshotCompleted(); DescribeSnapshotsRequest describeSnapshotsRequest = new DescribeSnapshotsRequest().withSnapshotIds(snapshotResult.getSnapshot().getSnapshotId()); StackCancellationCheck stackCancellationCheck = new StackCancellationCheck(ac.getCloudContext().getId()); <START> run(snapshotWaiter, describeSnapshotsRequest, stackCancellationCheck, "Snapshot creation failed"); <END> }</code><technical_language>mention snapshot id relevant info</technical_language>

Target:
private void checkSnapshotReadiness(AuthenticatedContext ac, AmazonEC2Client client, CreateSnapshotResult snapshotResult) { Waiter<DescribeSnapshotsRequest> snapshotWaiter = client.waiters().snapshotCompleted(); DescribeSnapshotsRequest describeSnapshotsRequest = new DescribeSnapshotsRequest().withSnapshotIds(snapshotResult.getSnapshot().getSnapshotId()); StackCancellationCheck stackCancellationCheck = new StackCancellationCheck(ac.getCloudContext().getId()); run(snapshotWaiter, describeSnapshotsRequest, stackCancellationCheck, String.format("Snapshot creation failed (snapshot id: %s)", snapshotResult.getSnapshot().getSnapshotId())); }
Source:
<code>public ArrayList<IPartWork> getSalvageableParts(boolean onlyNotBeingWorkedOn) { ArrayList<IPartWork> salvageParts = new ArrayList<IPartWork>(); for(Part part: parts) { if(part.isSalvaging() && (!onlyNotBeingWorkedOn || (onlyNotBeingWorkedOn && !part.isBeingWorkedOn()))) { salvageParts.add(part); } } for (PodSpace pod : podSpace) { <START> if (pod.hasSalvageableParts() && (!onlyNotBeingWorkedOn || (onlyNotBeingWorkedOn && !pod.isBeingWorkedOn()))) { <END> salvageParts.add(pod); } } return salvageParts; }</code><technical_language>do (!onlyNotBeingWorkedOn || (onlyNotBeingWorkedOn && !pod.isBeingWorkedOn())) check enough turn a method</technical_language>

Target:
public ArrayList<IPartWork> getSalvageableParts(boolean onlyNotBeingWorkedOn) { ArrayList<IPartWork> salvageParts = new ArrayList<IPartWork>(); for(Part part: parts) { if(part.isSalvaging() && isPartAvailableForRepairs(part, onlyNotBeingWorkedOn)) { salvageParts.add(part); } } for (PodSpace pod : podSpace) { if (pod.hasSalvageableParts() && isPartAvailableForRepairs(pod, onlyNotBeingWorkedOn)) { salvageParts.add(pod); } } return salvageParts; }
Source:
<code>public String relationship() { <START> if (relationship == null) { <END> initRelationship(); } return relationship.orElse(null); }</code><technical_language>I prefer method double-checked-locking pattern applied in pair of convertedType/computeConvertedType, fact for a volatile optional already. Thanks</technical_language>

Target:
public String relationship() { Optional<String> localRelationshipType = relationshipType; if (localRelationshipType == null) { synchronized (this) { localRelationshipType = relationshipType; if (localRelationshipType == null) { localRelationshipType = initRelationship(); relationshipType = localRelationshipType; } } } return localRelationshipType.orElse(null); }
Source:
<code>public static void createSecret(KubernetesClient client, String namespace) { Secret secret = new SecretBuilder() .withStringData(ImmutableMap.of(SECRET_KEY, CONTAINER_ENV_VAR_FROM_SECRET_VALUE)).withNewMetadata() .withName("container-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created container secret: {0}", secret); secret = new SecretBuilder().withStringData(ImmutableMap.of(SECRET_KEY, POD_ENV_VAR_FROM_SECRET_VALUE)) .withNewMetadata().withName("pod-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created pod secret: {0}", secret); <START> secret = new SecretBuilder().withStringData(ImmutableMap.of(SECRET_KEY, EMPTY_POD_ENV_VAR_FROM_SECRET_VALUE)) <END> .withNewMetadata().withName("empty-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created pod secret: {0}", secret); }</code><technical_language>This limited test case, is a pretty specific bug</technical_language>

Target:
public static void createSecret(KubernetesClient client, String namespace) { Secret secret = new SecretBuilder() .withStringData(ImmutableMap.of(SECRET_KEY, CONTAINER_ENV_VAR_FROM_SECRET_VALUE)).withNewMetadata() .withName("container-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created container secret: {0}", secret); secret = new SecretBuilder().withStringData(ImmutableMap.of(SECRET_KEY, POD_ENV_VAR_FROM_SECRET_VALUE)) .withNewMetadata().withName("pod-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created pod secret: {0}", secret); secret = new SecretBuilder().withStringData(ImmutableMap.of(SECRET_KEY, "")) .withNewMetadata().withName("empty-secret").endMetadata().build(); secret = client.secrets().inNamespace(namespace).createOrReplace(secret); LOGGER.log(Level.INFO, "Created pod secret: {0}", secret); }
Source:
<code>public void shouldSetModel() throws Exception { ModelAndView responseModel = authorizationController.login(false, request, response); Map<String, Object> modelMap = responseModel.getModel(); <START> assertEquals(modelMap.get("login_error"), false); <END> assertEquals(modelMap.get("l"), localizer); assertEquals(modelMap.get("authentication_plugin_registry"), authenticationPluginRegistry); }</code><technical_language>assertThat instead assertEquals e.g. assertThat(modelMap.get("login_error"), is(false));</technical_language>

Target:
public void shouldSetModel() throws Exception { ModelAndView responseModel = authorizationController.login(false, response); Map<String, Object> modelMap = new ModelMap() {{ put("login_error", false); put("l", localizer); put("authentication_plugin_registry", authenticationPluginRegistry); }}; Map<String, Object> responseModelMap = responseModel.getModel(); assertThat(responseModelMap, is(modelMap)); }
Source:
<code><START> public State getWizardState() { <END> return new State(isWizardClosed() ? InnerState.CLOSED : InnerState.OPEN); }</code><technical_language>I suggest private modifier for this method</technical_language>

Target:
private State getWizardState() { return new State(isWizardClosed() ? InnerState.CLOSED : InnerState.OPEN); }
Source:
<code>public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { assert (authProvider != null); if (authenticated) { super.channelRead(ctx, msg); } else if (msg instanceof BookkeeperProtocol.Response) { BookkeeperProtocol.Response resp = (BookkeeperProtocol.Response) msg; if (null == resp.getHeader().getOperation()) { LOG.info("dropping received malformed message from bookie {}", msg, ctx.channel()); <START> } else switch (resp.getHeader().getOperation()) { <END> case START_TLS: super.channelRead(ctx, msg); break; case AUTH: if (resp.getStatus() != BookkeeperProtocol.StatusCode.EOK) { authenticationError(ctx, resp.getStatus().getNumber()); } else { assert (resp.hasAuthResponse()); BookkeeperProtocol.AuthMessage am = resp.getAuthResponse(); if (AuthProviderFactoryFactory.authenticationDisabledPluginName.equals(am.getAuthPluginName())){ SocketAddress remote = ctx.channel().remoteAddress(); LOG.info("Authentication is not enabled." + "Considering this client {0} authenticated", remote); AuthHandshakeCompleteCallback authHandshakeCompleteCallback = new AuthHandshakeCompleteCallback(ctx); authHandshakeCompleteCallback.operationComplete(BKException.Code.OK, null); return; } byte[] payload = am.getPayload().toByteArray(); authProvider.process(AuthToken.wrap(payload), new AuthRequestCallback(ctx, authProviderFactory.getPluginName())); } break; default: LOG.warn("dropping received message from bookie {}", msg, ctx.channel()); break; } } }</code><technical_language>else { switch (...) { } }</technical_language>

Target:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { assert (authProvider != null); if (authenticated) { super.channelRead(ctx, msg); } else if (msg instanceof BookkeeperProtocol.Response) { BookkeeperProtocol.Response resp = (BookkeeperProtocol.Response) msg; if (null == resp.getHeader().getOperation()) { LOG.info("dropping received malformed message from bookie {}", msg, ctx.channel()); } else { switch (resp.getHeader().getOperation()) { case START_TLS: super.channelRead(ctx, msg); break; case AUTH: if (resp.getStatus() != BookkeeperProtocol.StatusCode.EOK) { authenticationError(ctx, resp.getStatus().getNumber()); } else { assert (resp.hasAuthResponse()); BookkeeperProtocol.AuthMessage am = resp.getAuthResponse(); if (AuthProviderFactoryFactory.AUTHENTICATION_DISABLED_PLUGIN_NAME.equals(am.getAuthPluginName())){ SocketAddress remote = ctx.channel().remoteAddress(); LOG.info("Authentication is not enabled." + "Considering this client {0} authenticated", remote); AuthHandshakeCompleteCallback authHandshakeCompleteCallback = new AuthHandshakeCompleteCallback(ctx); authHandshakeCompleteCallback.operationComplete(BKException.Code.OK, null); return; } byte[] payload = am.getPayload().toByteArray(); authProvider.process(AuthToken.wrap(payload), new AuthRequestCallback(ctx, authProviderFactory.getPluginName())); } break; default: LOG.warn("dropping received message from bookie {}", msg, ctx.channel()); break; } } } }
Source:
<code>public static void assertCompletesEventually(String message, ProgressCheckerTask task, long stallToleranceSeconds) { long taskStartTimestamp = System.currentTimeMillis(); int sleepMillis = 200; List<TaskProgress> progresses = new LinkedList<TaskProgress>(); long lastProgressTimestamp = System.currentTimeMillis(); float lastProgress = 0; while (true) { try { TaskProgress progress = task.checkProgress(); if (progress.isCompleted()) { return; } <START> long lastProgressTimestampCompare = lastProgressTimestamp; <END> boolean toleranceExceeded = progress.timestamp() > lastProgressTimestampCompare + SECONDS.toMillis(stallToleranceSeconds); if (progress.progress() > lastProgress || toleranceExceeded) { progresses.add(progress); lastProgressTimestamp = progress.timestamp(); lastProgress = progress.progress(); } if (toleranceExceeded) { StringBuilder sb = new StringBuilder("Stall tolerance " + stallToleranceSeconds + " seconds has been " + "exceeded without completing the task. Track of progress:\n"); for (TaskProgress historicProgress : progresses) { long elapsedMillis = historicProgress.timestamp() - taskStartTimestamp; String elapsedMillisPadded = String.format("%1$5s", elapsedMillis); sb.append("\t") .append(elapsedMillisPadded).append("ms: ") .append(progress.getProgressString()) .append("\n"); } LOGGER.severe(sb.toString()); fail("Stall tolerance " + stallToleranceSeconds + " seconds has been exceeded without completing the task. " + message); } sleepMillis(sleepMillis); } catch (Exception e) { throw rethrow(e); } } }</code><technical_language>do need this variable</technical_language>

Target:
public static void assertCompletesEventually(String message, ProgressCheckerTask task, long stallToleranceSeconds) { long taskStartTimestamp = System.currentTimeMillis(); int sleepMillis = 200; List<TaskProgress> progresses = new LinkedList<TaskProgress>(); long lastProgressTimestamp = System.currentTimeMillis(); float lastProgress = 0; while (true) { try { TaskProgress progress = task.checkProgress(); if (progress.isCompleted()) { return; } boolean toleranceExceeded = progress.timestamp() > lastProgressTimestamp + SECONDS.toMillis(stallToleranceSeconds); if (progress.progress() > lastProgress || toleranceExceeded) { progresses.add(progress); lastProgressTimestamp = progress.timestamp(); lastProgress = progress.progress(); } if (toleranceExceeded) { StringBuilder sb = new StringBuilder("Stall tolerance " + stallToleranceSeconds + " seconds has been " + "exceeded without completing the task. Track of progress:\n"); for (TaskProgress historicProgress : progresses) { long elapsedMillis = historicProgress.timestamp() - taskStartTimestamp; String elapsedMillisPadded = String.format("%1$5s", elapsedMillis); sb.append("\t") .append(elapsedMillisPadded).append("ms: ") .append(historicProgress.getProgressString()) .append("\n"); } LOGGER.severe(sb.toString()); fail("Stall tolerance " + stallToleranceSeconds + " seconds has been exceeded without completing the task. " + message != null ? message : ""); } sleepMillis(sleepMillis); } catch (Exception e) { throw rethrow(e); } } }
Source:
<code>public void save(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); BaseObject xwikiDataObject = doc.getXObject(Patient.CLASS_REFERENCE); if (xwikiDataObject == null) { <START> throw new NullPointerException(ERROR_MESSAGE_NO_PATIENT_CLASS); <END> } PatientData<String> data = patient.<String>getData(this.getName()); if (!data.isNamed()) { return; } for (String property : this.getProperties()) { xwikiDataObject.setStringValue(property, data.get(property)); } XWikiContext context = (XWikiContext) this.execution.getContext().getProperty("xwikicontext"); String comment = String.format("Updated %s from JSON", this.getName()); context.getWiki().saveDocument(doc, comment, true, context); } catch (Exception e) { this.logger.error("Failed to save {}: [{}]", this.getName(), e.getMessage()); } }</code><technical_language>this IlegalArgumentException. I if a custom exception (InvalidPatientException), I ERROR_MESSAGE_NO_PATIENT_CLASS</technical_language>

Target:
public void save(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); BaseObject xwikiDataObject = doc.getXObject(Patient.CLASS_REFERENCE); if (xwikiDataObject == null) { throw new IllegalArgumentException(ERROR_MESSAGE_NO_PATIENT_CLASS); } PatientData<String> data = patient.<String>getData(this.getName()); if (!data.isNamed()) { return; } for (String property : this.getProperties()) { xwikiDataObject.setStringValue(property, data.get(property)); } XWikiContext context = contextProvider.get(); String comment = String.format("Updated %s from JSON", this.getName()); context.getWiki().saveDocument(doc, comment, true, context); } catch (Exception e) { this.logger.error("Failed to save {}: [{}]", this.getName(), e.getMessage()); } }
Source:
<code>public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); if (bindingConfig == null || item == null) { logger.error( "invalid null input, item={}, bindingConfig={}", item, bindingConfig); return; } String strippedBindingConfig = bindingConfig.replace("[", "") .replace("]", "").trim(); String[] configpart = strippedBindingConfig.split(":"); SallegraBindingConfig config = null; SallegraCommand cmdId = null; try { <START> cmdId = SallegraCommand.valueOf(configpart[1].toUpperCase()); <END> } catch (IllegalArgumentException e) { throw new BindingConfigParseException("Unknown command: " + configpart[1]); } if (configpart.length == 3) { config = new SallegraBindingConfig(item, configpart[0], cmdId, configpart[2]); } else { throw new BindingConfigParseException( "Configuration must have at at least 2 or 3 configpart separated by ':'"); } logger.debug( "Found \"{}\" binding config for deviceId \"{}\". Command is \"{}\" and value is \"{}\"", configpart[0], configpart[1], configpart.length > 2 ? configpart[2] : "-"); addBindingConfig(item, config); }</code><technical_language>Please check for length of configpart[] accessing cmdId, lead ArrayIndexOutOfBoundsException</technical_language>

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); if (bindingConfig == null || item == null) { logger.error( "invalid null input, item={}, bindingConfig={}", item, bindingConfig); return; } String strippedBindingConfig = bindingConfig.replace("[", "") .replace("]", "").trim(); String[] configpart = strippedBindingConfig.split(":"); SallegraBindingConfig config = null; if (configpart.length == 3) { SallegraCommand cmdId = null; try { cmdId = SallegraCommand.valueOf(configpart[1].toUpperCase()); } catch (IllegalArgumentException e) { throw new BindingConfigParseException("Unknown command: " + configpart[1]); } config = new SallegraBindingConfig(configpart[0], cmdId, configpart[2]); config.setItem(item.getName()); } else { throw new BindingConfigParseException( "Configuration must have at at least 2 or 3 configpart separated by ':'"); } logger.debug( "Found \"{}\" binding config for deviceId \"{}\". Command is \"{}\" and value is \"{}\"", configpart[0], configpart[1], configpart.length > 2 ? configpart[2] : "-"); addBindingConfig(item, config); }
Source:
<code>static String printToString(Url url) { if (url.getValueCase() == Url.ValueCase.RAW) { return url.getRaw(); } <START> final StringBuilder sb = new StringBuilder(); <END> final Url.Record record = url.getRecord(); appendProtocol(record, sb); appendAuth(record, sb); appendHost(record, sb); appendPort(record, sb); appendPath(record, sb); appendQueries(record, sb); appendFragment(record, sb); return sb.toString(); }</code><technical_language>this issue? If IDEA highlights this e.g. a _warning_, please suppress @Suppress("...") annotation</technical_language>

Target:
static String printToString(Url url) { if (url.getValueCase() == Url.ValueCase.RAW) { return url.getRaw(); } @SuppressWarnings("StringBufferWithoutInitialCapacity") final StringBuilder sb = new StringBuilder(); final Url.Record record = url.getRecord(); appendProtocol(record, sb); appendAuth(record, sb); appendHost(record, sb); appendPort(record, sb); appendPath(record, sb); appendQueries(record, sb); appendFragment(record, sb); return sb.toString(); }
Source:
<code>public final Response saveLanguage(@Context final HttpServletRequest request, @Context final HttpServletResponse response, final LanguageForm languageForm) { this.webResource.init(null, request, response, true, PortletID.LANGUAGES.toString()); try { DotPreconditions.notNull(languageForm,"Expected Request body was empty."); final Language language = saveOrUpdateLanguage(null, languageForm); return Response.ok(new ResponseEntityView(language)).build(); <START> } catch (Exception e) { <END> final String langCode = languageForm == null ? "" : languageForm.getLanguageCode(); Logger.error(this.getClass(), "Exception on save, Language code: " + langCode + ", exception message: " + e.getMessage(), e); return ResponseUtil.mapExceptionResponse(e); } }</code><technical_language>exceptions handle Mappers</technical_language>

Target:
public final Response saveLanguage(@Context final HttpServletRequest request, @Context final HttpServletResponse response, final LanguageForm languageForm) { this.webResource.init(null, request, response, true, PortletID.LANGUAGES.toString()); DotPreconditions.notNull(languageForm,"Expected Request body was empty."); final Language language = saveOrUpdateLanguage(null, languageForm); return Response.ok(new ResponseEntityView(language)).build(); }
Source:
<code>public int getAndIncrementCounter() { int oldVal = counter; counter++; <START> return oldVal; <END> }</code><technical_language>nit: simplified return counter++;</technical_language>

Target:
public int getAndIncrementCounter() { return counter++; }
Source:
<code>private void populateReviews(List<ReviewContainer> reviewContainers) { for (String reviewUrl : reviewUrls) { AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl); <START> if (connector == null) { <END> continue; } String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(reviewUrl); String reviewId = connector.getTaskIdFromTaskUrl(reviewUrl); if (repositoryUrl == null || reviewId == null) { continue; } ITask task = taskList.getTask(repositoryUrl, reviewId); TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl) .getTaskIdFromTaskUrl(reviewUrl); reviewContainers.add(new ReviewContainer(task.getSummary(), task.getAttribute("CODE_REVIEW"), task.getAttribute("VERIFIED"), "")); } }</code><technical_language>In case is this? case Bugzilla is setup a connector for this</technical_language>

Target:
private void populateReviews(List<ReviewContainer> reviewContainers) { for (ITask review : reviews) { reviewContainers.add(new ReviewContainer(review.getSummary(), review.getAttribute("CODE_REVIEW"), review.getAttribute("VERIFIED"), "")); } }
Source:
<code><START> public SavedStateRegistry<Bundle> <END> getBundleSavedStateRegistry() { return mSavedStateRegistry; }</code><technical_language>this final</technical_language>

Target:
public final SavedStateRegistry<Bundle> getBundleSavedStateRegistry() { return mSavedStateRegistry; }
Source:
<code>public void run() { try { while(true) { <START> long nextCheck = System.nanoTime() + (interval * 1000L); <END> ping(); long diff; while((diff = nextCheck - System.nanoTime()) > 0) { Thread.sleep(diff / 1000L); } } } catch (ChannelClosedException e) { LOGGER.fine(getName()+" is closed. Terminating"); } catch (IOException e) { onDead(e); } catch (InterruptedException e) { LOGGER.fine(getName()+" is interrupted. Terminating"); } }</code><technical_language>1ms=1e6ns</technical_language>

Target:
public void run() { try { while(true) { long nextCheck = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(interval); ping(); long diff; while((diff = nextCheck - System.nanoTime()) > 0) { Thread.sleep(TimeUnit.NANOSECONDS.toMillis(diff)); } } } catch (ChannelClosedException e) { LOGGER.fine(getName()+" is closed. Terminating"); } catch (IOException e) { onDead(e); } catch (InterruptedException e) { LOGGER.fine(getName()+" is interrupted. Terminating"); } }
Source:
<code>public void cleanup() { JavaCudnn.destroyTensorDesc(inputDesc); JavaCudnn.destroyFilterDesc(filterDesc); JavaCudnn.destroyConvDesc(convDesc); JavaCudnn.destroyTensorDesc(activationDesc); JavaCudnn.destroyTensorDesc(biasDesc); JavaCudnn.destroyAlgo(forwardAlgo); JavaCudnn.destroyAlgo(backwardDataAlgo); <START> JavaCudnn.destroyAlgo(backwardDataAlgo); <END> JavaCudnn.destroyWorkspace(workspace); }</code><technical_language>Duplicate</technical_language>

Target:
public void cleanup() { JavaCudnn.destroyTensorDesc(inputDesc); JavaCudnn.destroyFilterDesc(filterDesc); JavaCudnn.destroyConvDesc(convDesc); JavaCudnn.destroyTensorDesc(activationDesc); JavaCudnn.destroyTensorDesc(biasDesc); JavaCudnn.destroyAlgo(forwardAlgo); JavaCudnn.destroyAlgo(backwardDataAlgo); JavaCudnn.destroyAlgo(backwardFilterAlgo); JavaCuda.deviceFree(workspace); }
Source:
<code>private boolean doRequest(HttpRequestBase requestBase) { HttpClient client = new DefaultHttpClient(); HttpConnectionParams.setConnectionTimeout(client.getParams(), mTimeOut); HttpResponse response; if (mPiwik.isDryRun()) { Logy.d(LOGGER_TAG, "DryRun, stored HttpRequest, now " + mDryRunOutput.size()); mDryRunOutput.add(requestBase); } else { <START> mDryRunOutput.clear(); <END> try { response = client.execute(requestBase); int statusCode = response.getStatusLine().getStatusCode(); Logy.d(LOGGER_TAG, String.format("status code %s", statusCode)); return statusCode == HttpStatus.SC_NO_CONTENT || statusCode == HttpStatus.SC_OK; } catch (IOException e) { Logy.w(LOGGER_TAG, "Cannot send request", e); } } return false; }</code><technical_language>check if mDryRUnOutput is empty clearing (mainly bc of [this](<LINK_0></technical_language>

Target:
private boolean doRequest(HttpRequestBase requestBase) { HttpClient client = new DefaultHttpClient(); HttpConnectionParams.setConnectionTimeout(client.getParams(), mTimeOut); HttpResponse response; if (mPiwik.isDryRun()) { Logy.d(LOGGER_TAG, "DryRun, stored HttpRequest, now " + mDryRunOutput.size()); mDryRunOutput.add(requestBase); } else { if (!mDryRunOutput.isEmpty()) mDryRunOutput.clear(); try { response = client.execute(requestBase); int statusCode = response.getStatusLine().getStatusCode(); Logy.d(LOGGER_TAG, String.format("status code %s", statusCode)); return statusCode == HttpStatus.SC_NO_CONTENT || statusCode == HttpStatus.SC_OK; } catch (IOException e) { Logy.w(LOGGER_TAG, "Cannot send request", e); } } return false; }
Source:
<code>public void testDefaultModifier() throws Exception { MethodSource<JavaInterfaceSource> method = Roaster.create(JavaInterfaceSource.class).addMethod( "public void test()"); Assert.assertFalse(method.isDefault()); method.setDefault(true); Assert.assertTrue(method.isDefault()); Assert.assertThat(method.toString(), containsString("public default void test()")); Assert.assertThat(method.getBody(), equalTo("")); String body = "int a=2;"; method.setDefault(true).setBody(body); <START> Assert.assertTrue(method.isDefault()); <END> Assert.assertEquals(body, method.getBody()); }</code><technical_language>Sorry, this test untouched. setDefault(false) is called assert method is longer set a default method, :-1: this change</technical_language>

Target:
public void testDefaultModifier() throws Exception { MethodSource<JavaInterfaceSource> method = Roaster.create(JavaInterfaceSource.class).addMethod( "public void test()"); Assert.assertFalse(method.isDefault()); method.setDefault(true); Assert.assertTrue(method.isDefault()); Assert.assertThat(method.toString(), containsString("public default void test()")); Assert.assertThat(method.getBody(), equalTo("")); String body = "int a=2;"; method.setDefault(false).setBody(body); }
Source:
<code>public void testLaunchAppPackagePrecedenceWithConfigPackage() throws Exception { ApexCli.LaunchCommandLineInfo commandLineInfo = ApexCli .getLaunchCommandLineInfo(new String[]{"-D", "dt.test.1=launch-define", "-apconf", "my-app-conf1.xml", "-conf", configFile.getAbsolutePath()}); DTConfiguration props = cli.getLaunchAppPackageProperties(ap, cp, commandLineInfo, null); Assert.assertEquals("launch-define", props.get("dt.test.1")); Assert.assertEquals("config-package", props.get("dt.test.2")); Assert.assertEquals("app-package-config", props.get("dt.test.3")); Assert.assertEquals("user-home-config", props.get("dt.test.4")); Assert.assertEquals("package-default", props.get("dt.test.5")); <START> Assert.assertEquals("fromConfigPackage", props.get("dt.test.7")); <END> props = cli.getLaunchAppPackageProperties(ap, cp, commandLineInfo, "MyFirstApplication"); Assert.assertEquals("launch-define", props.get("dt.test.1")); Assert.assertEquals("config-package-appname", props.get("dt.test.2")); Assert.assertEquals("app-package-config", props.get("dt.test.3")); Assert.assertEquals("user-home-config", props.get("dt.test.4")); Assert.assertEquals("app-default", props.get("dt.test.5")); Assert.assertEquals("package-default", props.get("dt.test.6")); }</code><technical_language>Please try convention for property in this test</technical_language>

Target:
public void testLaunchAppPackagePrecedenceWithConfigPackage() throws Exception { ApexCli.LaunchCommandLineInfo commandLineInfo = ApexCli .getLaunchCommandLineInfo(new String[]{"-D", "dt.test.1=launch-define", "-apconf", "my-app-conf1.xml", "-conf", configFile.getAbsolutePath()}); DTConfiguration props = cli.getLaunchAppPackageProperties(ap, cp, commandLineInfo, null); Assert.assertEquals("launch-define", props.get("dt.test.1")); Assert.assertEquals("config-package", props.get("dt.test.2")); Assert.assertEquals("app-package-config", props.get("dt.test.3")); Assert.assertEquals("user-home-config", props.get("dt.test.4")); Assert.assertEquals("package-default", props.get("dt.test.5")); props = cli.getLaunchAppPackageProperties(ap, cp, commandLineInfo, "MyFirstApplication"); Assert.assertEquals("launch-define", props.get("dt.test.1")); Assert.assertEquals("config-package-appname", props.get("dt.test.2")); Assert.assertEquals("app-package-config", props.get("dt.test.3")); Assert.assertEquals("user-home-config", props.get("dt.test.4")); Assert.assertEquals("app-default", props.get("dt.test.5")); Assert.assertEquals("package-default", props.get("dt.test.6")); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ToStringFriendlyJsonNode that = (ToStringFriendlyJsonNode) o; <START> return !(node != null ? !node.equals(that.node) : that.node != null); <END> }</code><technical_language>I node null</technical_language>

Target:
public boolean equals(Object o) { return this == o || !(o == null || getClass() != o.getClass()) && this.node.equals(((ToStringFriendlyJsonNode) o).node); }
Source:
<code>public void testMembers() { EtcdMembersResponse members = etcd.getMembers(); <START> assertNotNull(members); <END> }</code><technical_language>If possible, nice test expected result of a call instead of response is null</technical_language>

Target:
public void testMembers() { EtcdMembersResponse members = etcd.getMembers(); assertNotNull(members); assertTrue(members.getMembers().size() >= 1); }
Source:
<code>public SerializableVoid runTask(CompactConfig config, ArrayList<CompactTask> tasks, RunTaskContext context) throws Exception { for (CompactTask task : tasks) { ArrayList<String> inputs = task.getInputs(); if (inputs.isEmpty()) { continue; } AlluxioURI output = new AlluxioURI(task.getOutput()); TableSchema schema; try (TableReader reader = TableReader.create(new AlluxioURI(inputs.get(0)), config.getPartitionInfo())) { schema = reader.getSchema(); } try (TableWriter writer = TableWriter.create(schema, output)) { for (String input : inputs) { try (TableReader reader = TableReader.create(new AlluxioURI(input), config.getPartitionInfo())) { for (TableRow row = reader.read(); row != null; row = reader.read()) { writer.write(row); } } } } finally { <START> context.getFileSystem().delete(output); END> } } return null; }</code><technical_language>output deleted time</technical_language>

Target:
public SerializableVoid runTask(CompactConfig config, ArrayList<CompactTask> tasks, RunTaskContext context) throws Exception { for (CompactTask task : tasks) { ArrayList<String> inputs = task.getInputs(); if (inputs.isEmpty()) { continue; } AlluxioURI output = new AlluxioURI(task.getOutput()); TableSchema schema; try (TableReader reader = TableReader.create(new AlluxioURI(inputs.get(0)), config.getPartitionInfo())) { schema = reader.getSchema(); } try (TableWriter writer = TableWriter.create(schema, output)) { for (String input : inputs) { try (TableReader reader = TableReader.create(new AlluxioURI(input), config.getPartitionInfo())) { for (TableRow row = reader.read(); row != null; row = reader.read()) { writer.write(row); } } } } catch (Throwable e) { try { context.getFileSystem().delete(output); } catch (Throwable t) { e.addSuppressed(t); } throw e; } } return null; }
Source:
<code>protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { IAnalysisModule segmentStoreProviderModule = fSegmentStoreProviderModule; ITmfTrace trace = getTrace(); <START> if ((segmentStoreProviderModule == null) || !(segmentStoreProviderModule instanceof ISegmentStoreProvider) || (trace == null)) { <END> return false; } segmentStoreProviderModule.waitForCompletion(); ISegmentStore<ISegment> segStore = ((ISegmentStoreProvider) segmentStoreProviderModule).getSegmentStore(); if (segStore != null) { boolean result = calculateTotalManual(segStore, monitor); if (!result) { return false; } result = calculateTotalPerSyscall(segStore, monitor); if (!result) { return false; } } return true; }</code><technical_language>null check needed if instanceof check</technical_language>

Target:
protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { IAnalysisModule segmentStoreProviderModule = fSegmentStoreProviderModule; ITmfTrace trace = getTrace(); if (!(segmentStoreProviderModule instanceof ISegmentStoreProvider) || (trace == null)) { return false; } segmentStoreProviderModule.waitForCompletion(); ISegmentStore<ISegment> segStore = ((ISegmentStoreProvider) segmentStoreProviderModule).getSegmentStore(); if (segStore != null) { boolean result = calculateTotalManual(segStore, monitor); if (!result) { return false; } result = calculateTotalPerType(segStore, monitor); if (!result) { return false; } } return true; }
Source:
<code>public V put(K key, ExpiringCache<V> item) { if (key == null) { throw new IllegalArgumentException("Item cannot be added as key is null."); } if (item == null) { throw new IllegalArgumentException("Item cannot be added as item is null."); } items.put(key, item); <START> return item.getValue(); <END> }</code><technical_language>I if put method trigger a cache refresh (that slow)</technical_language>

Target:
public void put(K key, ExpiringCache<V> item) { if (key == null) { throw new IllegalArgumentException("Item cannot be added as key is null."); } if (item == null) { throw new IllegalArgumentException("Item cannot be added as item is null."); } items.put(key, item); }
Source:
<code>public void shouldSetDockerfileContentInsteadOfUrlIfUrlPointsToCheApiOnEnvironmentStart() throws Exception { EnvironmentImpl env = createEnv(); String machineName = "machineWithDockerfileFromApi"; String additionalServiceComposeFilePart = "\n " + machineName + ":\n build:\n context: /recipe/12345"; env.getRecipe().setContent(env.getRecipe().getContent() + additionalServiceComposeFilePart); <START> String dockerfileContent = "this is dockerfile content"; <END> when(recipeDownloader.getRecipe(anyString())).thenReturn(dockerfileContent); startEnv(env); ArgumentCaptor<CheServiceImpl> captor = ArgumentCaptor.forClass(CheServiceImpl.class); verify(machineProvider).startService(anyString(), anyString(), anyString(), eq(machineName), eq(false), anyString(), captor.capture(), any(LineConsumer.class)); CheServiceImpl actualService = captor.getValue(); assertNull(actualService.getBuild().getContext()); assertNull(actualService.getBuild().getDockerfilePath()); assertEquals(actualService.getBuild().getDockerfileContent(), dockerfileContent); }</code><technical_language>I assume changes influence tests</technical_language>

Target:
public void shouldSetDockerfileContentInsteadOfUrlIfUrlPointsToCheApiOnEnvironmentStart() throws Exception { EnvironmentImpl env = createEnv(); String machineName = "machineWithDockerfileFromApi"; String additionalServiceComposeFilePart = "\n " + machineName + ":\n build:\n context: " + API_ENDPOINT + "/recipe/12345"; env.getRecipe().setContent(env.getRecipe().getContent() + additionalServiceComposeFilePart); String dockerfileContent = "this is dockerfile content"; when(recipeDownloader.getRecipe(anyString())).thenReturn(dockerfileContent); startEnv(env); ArgumentCaptor<CheServiceImpl> captor = ArgumentCaptor.forClass(CheServiceImpl.class); verify(machineProvider).startService(anyString(), anyString(), anyString(), eq(machineName), eq(false), anyString(), captor.capture(), any(LineConsumer.class)); CheServiceImpl actualService = captor.getValue(); assertNull(actualService.getBuild().getContext()); assertNull(actualService.getBuild().getDockerfilePath()); assertEquals(actualService.getBuild().getDockerfileContent(), dockerfileContent); }
Source:
<code>public boolean valid(IConfigurationElement element, IPreferenceNode node) { <START> return Boolean.valueOf(System.getProperty("runtime.lineage", Boolean.FALSE.toString())); END> }</code><technical_language>EE product runtime lineage</technical_language>

Target:
public boolean valid(IConfigurationElement element, IPreferenceNode node) { return PluginChecker.isTIS() && Boolean.valueOf(System.getProperty("runtime.lineage", Boolean.FALSE.toString())); }
Source:
<code>public static Collection<File> selectFilesByContainerId(int id) { fileLock.acquire(); try { Map<Integer, File> files = filesByContainer.get(id); if (files != null) { <START> return files.values(); <END> } return null; } finally { fileLock.release(); } }</code><technical_language>btw, return a copy here, internal data structure is exposed. For binary compatibility, I suggest @Deprecated + new ArrayList() a new method returning File[]</technical_language>

Target:
public static Collection<File> selectFilesByContainerId(int id) { fileLock.acquire(); try { Map<Integer, File> files = filesByContainer.get(id); if (files != null) { return files.values(); } return Collections.emptyList(); } finally { fileLock.release(); } }
Source:
<code>protected void drawBorder(GC gc) { Rectangle bounds = getBounds(); <START> gc.drawRoundRectangle(bounds.x-1, bounds.y-1, bounds.width+2, bounds.height+2, fArc, <END> fArc); }</code><technical_language>Original code increased bounds? also, spaces</technical_language>

Target:
protected void drawBorder(GC gc) { Rectangle bounds = getBounds(); gc.drawRoundRectangle(bounds.x, bounds.y, bounds.width, bounds.height, fArc, fArc); }
Source:
<code><START> public void destroy() { <END> if (this.roleController != null) { this.roleController.removeLifecycle(this); } }</code><technical_language>do this - breaking change for subclassed implemented destroy(). I suggest // NOSONAR TODO: remove throws in 5.2, removing subclasses</technical_language>

Target:
public void destroy() throws Exception { if (this.roleController != null) { this.roleController.removeLifecycle(this); } }
Source:
<code>public EarlyStartupJob(JobGroup group) { <START> super("Workbench early stattup job"); END> setSystem(true); setJobGroup(group); }</code><technical_language>typo: starttup -> startup</technical_language>

Target:
public EarlyStartupJob(JobGroup group) { super("Workbench early startup job"); setSystem(true); setJobGroup(group); }
Source:
<code>public void shouldFilterTransactionsByCardHolderName() { addChargeAndCardDetails(CREATED, ServicePaymentReference.of("ref-1"), now()); addChargeAndCardDetails(AUTHORISATION_READY, ServicePaymentReference.of("ref-2"), now()); addChargeAndCardDetails(CAPTURED, ServicePaymentReference.of("ref-3"), now().minusDays(2)); getChargeApi .withAccountId(accountId) .withQueryParam("cardholder_name", "McPayment") .withHeader(HttpHeaders.ACCEPT, APPLICATION_JSON) .getTransactionsAPI() .statusCode(OK.getStatusCode()) .contentType(JSON) .body("results.size()", is(3)) .body("results[0].card_details.cardholder_name", is("Mr. McPayment")); <START> } <END></code><technical_language>Test for digits well</technical_language>

Target:
public void shouldFilterTransactionsByCardHolderName() { addChargeAndCardDetails(CREATED, ServicePaymentReference.of("ref-1"), now()); addChargeAndCardDetails(AUTHORISATION_READY, ServicePaymentReference.of("ref-2"), now()); addChargeAndCardDetails(CAPTURED, ServicePaymentReference.of("ref-3"), now().minusDays(2)); getChargeApi .withAccountId(accountId) .withQueryParam("cardholder_name", "McPayment") .withHeader(HttpHeaders.ACCEPT, APPLICATION_JSON) .getTransactionsAPI() .statusCode(OK.getStatusCode()) .contentType(JSON) .body("results.size()", is(3)) .body("results[0].card_details.cardholder_name", is("Mr. McPayment")) .body("results[0].card_details.last_digits_card_number", is("1234")); }
Source:
<code>public Property getProperty(String propertyName) { if (propertyName.equals("row")) return new Property(cell.y); else if (propertyName.equals("column")) return new Property(cell.x); <START> if (propertyName.equals("name")) <END> return new Property(objectName); else if (propertyName.equals("class")) return new Property(wordsClass.getClassName()); Property property = getOwnProperty(propertyName); if (property != null) return property; else return wordsClass.getProperty(propertyName); }</code><technical_language>Alex suggested, this a continuation of if (as another else if) a new if</technical_language>

Target:
public Property getProperty(String propertyName) { if (propertyName.equals("row")) return new Property(cell.y); else if (propertyName.equals("column")) return new Property(cell.x); else if (propertyName.equals("name")) return new Property(objectName); else if (propertyName.equals("class")) return new Property(wordsClass.getClassName()); Property property = getOwnProperty(propertyName); if (property != null) return property; else return wordsClass.getProperty(propertyName); }
Source:
<code>private void initBreakpointOrganizers(IMemento memento) { if (memento != null) { IMemento node = memento.getChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS); if (node == null) { fOrganizers = null; } else { String value = node.getString(KEY_VALUE); if (value != null) { BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault(); List<IBreakpointOrganizer> organziers = new ArrayList<>(); for (String id : value.split(",")) { IBreakpointOrganizer organizer = manager.getOrganizer(id); if (organizer != null) { organziers.add(organizer); } } fOrganizers = organziers.toArray(new IBreakpointOrganizer[organziers.size()]); for (IBreakpointOrganizer organizer : <START> organziers) { <END> organizer.addPropertyChangeListener(this); } } } } }</code><technical_language>fOrganizers. This is a fatal mistake</technical_language>

Target:
private void initBreakpointOrganizers(IMemento memento) { if (memento != null) { IMemento node = memento.getChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS); if (node == null) { fOrganizers = null; } else { String value = node.getString(KEY_VALUE); if (value != null) { BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault(); List<IBreakpointOrganizer> organizers = new ArrayList<>(); for (String id : value.split(",")) { IBreakpointOrganizer organizer = manager.getOrganizer(id); if (organizer != null) { organizers.add(organizer); } } fOrganizers = organizers.toArray(new IBreakpointOrganizer[organizers.size()]); for (IBreakpointOrganizer organizer : fOrganizers) { organizer.addPropertyChangeListener(this); } } } } }