auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Object[] buildClosedAccountsForItChartArgumentList(Map<String, Date> dateRange) { List<Object> argumentList = new ArrayList<>(); SimpleDateFormat formatter = new SimpleDateFormat(CUKFSConstants.DATE_FORMAT_dd_MMM_yy, Locale.US); argumentList.add(formatter.format(dateRange.get(CuCoaBatchConstants.ClosedAccountsFileCreationConstants.FROM_DATE))); <START> argumentList.add(formatter.format(dateRange.get(CuCoaBatchConstants.ClosedAccountsFileCreationConstants.TO_DATE))); <END> return argumentList.toArray(); }</code><technical_language>query is parameters for dates, do need format strings? I parameter replacement handle dates as-is, long java.sql.Date java.sql.Timestamp type</technical_language>

Target:
private Object[] buildClosedAccountsForItChartArgumentList(Map<String, Date> dateRange) { List<Object> argumentList = new ArrayList<>(); argumentList.add(dateRange.get(CuCoaBatchConstants.ClosedAccountsFileCreationConstants.FROM_DATE)); argumentList.add(dateRange.get(CuCoaBatchConstants.ClosedAccountsFileCreationConstants.TO_DATE)); return argumentList.toArray(); }
Source:
<code>public Consumer verifyAndLookupConsumerWithEntitlements(String consumerUuid) { Consumer consumer = this.findByUuid(consumerUuid); if (consumer == null) { throw new NotFoundException(i18nProvider.get().tr("Unit with ID \"{0}\" could not be found.", consumerUuid)); } for (Entitlement e : consumer.getEntitlements()) { Hibernate.initialize(e.getCertificates()); if (e.getPool() != null) { <START> Hibernate.initialize(e.getPool().getProduct().getBranding()); <END> Hibernate.initialize(e.getPool().getProductAttributes()); Hibernate.initialize(e.getPool().getAttributes()); Hibernate.initialize(e.getPool().getDerivedProductAttributes()); } } return consumer; }</code><technical_language>I this is necessary more, instead, this line removed. I understand, this method is fetching collections Pool model, lazily loaded, do for collections of Pool's Product. e.g. Hibernate.initialize(e.getPool().getProduct().getDependentProductIds()); Hibernate.initialize(e.getPool().getProduct().getProductContent());, is reason do this for branding of product. point of moving branding collection Pool Product, is avoid do weird this in place. branding is pool, collection hydrate</technical_language>

Target:
public Consumer verifyAndLookupConsumerWithEntitlements(String consumerUuid) { Consumer consumer = this.findByUuid(consumerUuid); if (consumer == null) { throw new NotFoundException(i18nProvider.get().tr("Unit with ID \"{0}\" could not be found.", consumerUuid)); } for (Entitlement e : consumer.getEntitlements()) { Hibernate.initialize(e.getCertificates()); if (e.getPool() != null) { Hibernate.initialize(e.getPool().getProductAttributes()); Hibernate.initialize(e.getPool().getAttributes()); Hibernate.initialize(e.getPool().getDerivedProductAttributes()); } } return consumer; }
Source:
<code>public String getLocalizedMessage() { <START> return this.getLocalizedMessage(Locale.getDefault()); <END> }</code><technical_language>I require a this. for method calling. code style?</technical_language>

Target:
public String getLocalizedMessage() { return getLocalizedMessage(Locale.getDefault()); }
Source:
<code>private static String buildPredicate(Column partitionKey, String value) { if (isQuotedType(partitionKey.getType())) { return String.format("(%s='%s')", partitionKey.getName(), value); } <START> else { <END> return String.format("(%s=%s)", partitionKey.getName(), value); } }</code><technical_language>Nit: this "else" is redundant "if" branch returns conditionally. generally prefer write expressions java if (...) { return ...; } return ...;</technical_language>

Target:
private static String buildPredicate(Column partitionKey, String value) { if (isQuotedType(partitionKey.getType())) { return String.format("(%s='%s')", partitionKey.getName(), value); } return String.format("(%s=%s)", partitionKey.getName(), value); }
Source:
<code>public void startRemain() { if (outputEmitter != null) { } else { <START> throw new RuntimeException("OutputEmitter should be set in " + SourceImpl.class.getName()); <END> } }</code><technical_language>SourceImpl</technical_language>

Target:
protected void startRemain() { }
Source:
<code>public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int footerFirstLine = indexOfFirstFooterLine(lines); if (footerFirstLine == lines.length) return -1; int indexOfFooter = 0; <START> for (int i = 0; i < footerFirstLine; ++i) { <END> indexOfFooter += lines[i].length() + delimiter.length(); } return message.indexOf(CHANGE_ID, indexOfFooter); }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int footerFirstLine = indexOfFirstFooterLine(lines); if (footerFirstLine == lines.length) return -1; int indexOfFooter = 0; for (int i = 0; i < footerFirstLine; ++i) indexOfFooter += lines[i].length() + delimiter.length(); return message.indexOf(CHANGE_ID, indexOfFooter); }
Source:
<code>public static JobStatus replaceGeoFile(String blueprint, File file, UserPreferences userPrefs, SocrataConnectionInfo connectionInfo, String datasetID) { JobStatus status = JobStatus.SUCCESS; JSONParser parser = new JSONParser(); try { Object obj = parser.parse(blueprint); JSONObject array = (JSONObject)obj; if (array.containsKey("error")) { boolean error = (boolean) array.get("error"); if (error) { String message = array.get("message").toString(); logging.log(Level.INFO,message); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } } String fileId = array.get("fileId").toString(); String name = file.getName(); String bluepr = array.get("summary").toString(); String query = ""; query = query + "&fileId=" + URLEncoder.encode(fileId,"UTF-8"); query = query + "&name=" + URLEncoder.encode(name,"UTF-8"); query = query + "&blueprint=" + URLEncoder.encode(bluepr,"UTF-8"); query = query + "&viewUid=" + URLEncoder.encode(datasetID,"UTF-8"); URI uri = makeUri(connectionInfo.getUrl(),"replace",query); logging.log(Level.INFO,uri.toString()); status = postReplaceGeoFile(uri, connectionInfo, userPrefs); } catch (ParseException | UnsupportedEncodingException e) { String message = e.getMessage(); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } <START> return status; <END> }</code><technical_language>of branches internal returns; same,</technical_language>

Target:
public static JobStatus replaceGeoFile(String blueprint, File file, UserPreferences userPrefs, SocrataConnectionInfo connectionInfo, String datasetID) { JobStatus status = JobStatus.SUCCESS; JSONParser parser = new JSONParser(); try { Object obj = parser.parse(blueprint); JSONObject array = (JSONObject)obj; if (array.containsKey("error")) { boolean error = (boolean) array.get("error"); if (error) { String message = array.get("message").toString(); logging.log(Level.INFO,message); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } } String fileId = array.get("fileId").toString(); String name = file.getName(); String bluepr = array.get("summary").toString(); String query = ""; query = query + "&fileId=" + URLEncoder.encode(fileId,"UTF-8"); query = query + "&name=" + URLEncoder.encode(name,"UTF-8"); query = query + "&blueprint=" + URLEncoder.encode(bluepr,"UTF-8"); query = query + "&viewUid=" + URLEncoder.encode(datasetID,"UTF-8"); URI uri = makeUri(connectionInfo.getUrl(),"replace",query); logging.log(Level.INFO,uri.toString()); status = postReplaceGeoFile(uri, connectionInfo, userPrefs); return status; } catch (ParseException | UnsupportedEncodingException e) { String message = e.getMessage(); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } }
Source:
<code>public FileMode getMode(File f, FS.Attributes attributes) { <START> if (attributes.isSymbolicLink()) <END> return FileMode.SYMLINK; else if (attributes.isDirectory()) { return FileMode.TREE; } else if (attributes.isExecutable()) return FileMode.EXECUTABLE_FILE; else return FileMode.REGULAR_FILE; }</code><technical_language>style nit: missing braces</technical_language>

Target:
public FileMode getMode(File f, FS.Attributes attributes) { if (attributes.isSymbolicLink()) { return FileMode.SYMLINK; } else if (attributes.isDirectory()) { return FileMode.TREE; } else if (attributes.isExecutable()) { return FileMode.EXECUTABLE_FILE; } else { return FileMode.REGULAR_FILE; } }
Source:
<code><START> public synchronized Optional<DynamicFilterSummary> getSummary(String queryId, String source) <END> { DynamicFilterSummaryWithSenders dynamicFilterSummaryWithSenders = dynamicFilterSummaries.get(SourceDescriptor.of(queryId, source)); return dynamicFilterSummaryWithSenders.getSummaryIfReady(); }</code><technical_language>getSummaryIfReady</technical_language>

Target:
public synchronized ListenableFuture<DynamicFilterSummary> getSummary(String queryId, String source) { SettableFuture<DynamicFilterSummary> future = futures.get(SourceDescriptor.of(queryId, source)); if (future == null) { future = SettableFuture.create(); futures.put(SourceDescriptor.of(queryId, source), future); } DynamicFilterSummaryWithSenders dynamicFilterSummaryWithSenders = dynamicFilterSummaries.get(SourceDescriptor.of(queryId, source)); if (dynamicFilterSummaryWithSenders.getSummaryIfReady().isPresent()) { future.set(dynamicFilterSummaryWithSenders.getSummaryIfReady().get()); } return future; }
Source:
<code>public void setLocale(Locale locale) { if (!Objects.equals(_locale, locale)) { _locale = locale; if (getFormat() == null) { <START> if ("en_IN".equals(locale.toString())) { <END> setFormat("en-IN"); } else { setFormat(getDefaultFormat()); } } invalidate(); } }</code><technical_language>Hard-coded. if add another format in future</technical_language>

Target:
public void setLocale(Locale locale) { if (!Objects.equals(_locale, locale)) { _locale = locale; if (getFormat() == null) setFormat(getDefaultFormat()); invalidate(); } }
Source:
<code>public void showInformationDialogTest() { Platform.runLater(() -> DialogMessage.showInformationDialog("Information", "Test Information Dialog")); <START> sleep(1000); <END> assertNodeExists(hasText("Test Information Dialog")); click("OK"); }</code><technical_language>wait hasText returns true instead synchronise</technical_language>

Target:
public void showInformationDialogTest() { Platform.runLater(() -> DialogMessage.showInformationDialog("Information", "Test Information Dialog")); waitUntilNodeAppears(hasText("Test Information Dialog")); assertNodeExists(hasText("Test Information Dialog")); click("OK"); }
Source:
<code>public boolean isInterpolated() { <START> return prefix().contains("F") || prefix().contains("f"); <END> }</code><technical_language>contains instead of equalsIgnoreCase</technical_language>

Target:
public boolean isInterpolated() { return prefix().equalsIgnoreCase("F"); }
Source:
<code>public void enqueue(Callback callback) { AsyncTracer tracer = new AsyncTracer("OkHttp: acquire-limiter"); ListenableFuture<Limiter.Listener> limiterListener = limiter.acquire(); request().tag(ConcurrencyLimiterListener.class).setLimiterListener(limiterListener); Futures.addCallback(limiterListener, new FutureCallback<Limiter.Listener>() { @Override public void onSuccess(Limiter.Listener listener) { <START> tracer.withTrace(() -> { <END> Tracer.fastCompleteSpan(); request().tag(AsyncTracerTag.class).setAsyncTracer(new AsyncTracer("OkHttp: execute")); enqueueInternal(callback); Tracer.startSpan("ignored"); return null; }); } @Override public void onFailure(Throwable throwable) { callback.onFailure( RemotingOkHttpCall.this, new IOException(new AssertionError("This should never happen, since it implies " + "we failed when using the concurrency limiter", throwable))); } }, MoreExecutors.directExecutor()); }</code><technical_language>I merging this nice a solution require include acquire-limiter-run ignore span hacks</technical_language>

Target:
public void enqueue(Callback callback) { AsyncTracer tracer = new AsyncTracer("OkHttp: acquire-limiter"); ListenableFuture<Limiter.Listener> limiterListener = limiter.acquire(); request().tag(ConcurrencyLimiterListener.class).setLimiterListener(limiterListener); Futures.addCallback(limiterListener, new FutureCallback<Limiter.Listener>() { @Override public void onSuccess(Limiter.Listener listener) { tracer.withTrace(() -> { Tracer.fastCompleteSpan(); request().tag(AsyncTracerTag.class).setAsyncTracer(new AsyncTracer("OkHttp: execute")); enqueueInternal(callback); Tracer.startSpan("ignored-span"); return null; }); } @Override public void onFailure(Throwable throwable) { callback.onFailure( RemotingOkHttpCall.this, new IOException(new AssertionError("This should never happen, since it implies " + "we failed when using the concurrency limiter", throwable))); } }, MoreExecutors.directExecutor()); }
Source:
<code>public String toString() { <START> return "Offset: " + offset + ", Size: " + getSize() + ", Flags: " + getFlags() + ", ExpiresAtMs: " <END> + getExpiresAtMs() + ", Original Message Offset: " + getOriginalMessageOffset(); }</code><technical_language>isFlagSet(Flags.Delete_Index) sense compared getFlags()</technical_language>

Target:
public String toString() { return "Offset: " + offset + ", Size: " + getSize() + ", Deleted: " + isFlagSet(Flags.Delete_Index) + ", ExpiresAtMs: " + getExpiresAtMs() + ", Original Message Offset: " + getOriginalMessageOffset(); }
Source:
<code>void showCommitList(final Job j, final SWTCommitList list, final SWTCommit[] asArray, final boolean incomplete) { if (trace) GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation(), new Object[] { list, asArray }); if (job != j || graph.getControl().isDisposed()) return; graph.getControl().getDisplay().asyncExec(new Runnable() { public void run() { if (!graph.getControl().isDisposed() && job == j) { <START> if (getFollowRenames()) { <END> updateFollowFilter(); } graph.setInput(highlightFlag, list, asArray, input); if (trace) GitTraceLocation.getTrace().trace( GitTraceLocation.HISTORYVIEW.getLocation(), "Setting input to table"); findToolbar.setInput(highlightFlag, graph.getTableView() .getTable(), asArray); if (incomplete) setWarningText(UIText.GitHistoryPage_ListIncompleteWarningMessage); else setWarningText(null); setErrorMessage(null); } } }); if (trace) GitTraceLocation.getTrace().traceExit( GitTraceLocation.HISTORYVIEW.getLocation()); }</code><technical_language>style-nit; surplus braces</technical_language>

Target:
void showCommitList(final Job j, final SWTCommitList list, final SWTCommit[] asArray, final boolean incomplete) { if (trace) GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation(), new Object[] { list, asArray }); if (job != j || graph.getControl().isDisposed()) return; graph.getControl().getDisplay().asyncExec(new Runnable() { public void run() { if (!graph.getControl().isDisposed() && job == j) { if (getFollowRenames()) updateFollowFilter(); graph.setInput(highlightFlag, list, asArray, input); if (trace) GitTraceLocation.getTrace().trace( GitTraceLocation.HISTORYVIEW.getLocation(), "Setting input to table"); findToolbar.setInput(highlightFlag, graph.getTableView() .getTable(), asArray); if (incomplete) setWarningText(UIText.GitHistoryPage_ListIncompleteWarningMessage); else setWarningText(null); setErrorMessage(null); } } }); if (trace) GitTraceLocation.getTrace().traceExit( GitTraceLocation.HISTORYVIEW.getLocation()); }
Source:
<code>public BaseEdit deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { if (json.isJsonNull()) { return null; } if (!json.isJsonArray()) { throw new JsonParseException("Expected array for Edit type"); } final JsonArray o = (JsonArray) json; final int cnt = o.size(); if (cnt < 4 || cnt % 4 != 0) { throw new JsonParseException("Expected array of 4 for Edit type"); } if (4 == cnt) { return new BaseEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3)); } List<BaseEdit> l = new ArrayList<BaseEdit>((cnt / 4) - 1); for (int i = 4; i < cnt;) { int as = get(o, i++); int ae = get(o, i++); int bs = get(o, i++); int be = get(o, i++); <START> l.add(new BaseEdit(as, ae, bs, be)); <END> } return new LineEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3), l); }</code><technical_language>a new LineEdit(...., null)</technical_language>

Target:
public LineEdit deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { if (json.isJsonNull()) { return null; } if (!json.isJsonArray()) { throw new JsonParseException("Expected array for Edit type"); } final JsonArray o = (JsonArray) json; final int cnt = o.size(); if (cnt < 4 || cnt % 4 != 0) { throw new JsonParseException("Expected array of 4 for Edit type"); } if (4 == cnt) { return new LineEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3)); } List<BaseEdit> l = new ArrayList<BaseEdit>((cnt / 4) - 1); for (int i = 4; i < cnt;) { int as = get(o, i++); int ae = get(o, i++); int bs = get(o, i++); int be = get(o, i++); l.add(new BaseEdit(as, ae, bs, be)); } return new LineEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3), l); }
Source:
<code>public void testForceFreeMemory() throws Throwable { ArbitraryOutputBuffer buffer = createArbitraryBuffer(createInitialEmptyOutputBuffers(ARBITRARY), sizeOfPages(10)); for (int i = 0; i < 3; i++) { addPage(buffer, createPage(i)); } OutputBufferMemoryManager memoryManager = buffer.getMemoryManager(); assertTrue(memoryManager.getBufferedBytes() > 0); buffer.forceFreeMemory(); assertEquals(memoryManager.getBufferedBytes(), 0); try { addPage(buffer, createPage(1)); fail("Adding a page to a closed memoryManager should have failed"); } catch (IllegalStateException e) { <START> } <END> }</code><technical_language>validate assertEquals(memoryManager.getBufferedBytes(), 0); incase add pages bumped memory threw</technical_language>

Target:
public void testForceFreeMemory() throws Throwable { ArbitraryOutputBuffer buffer = createArbitraryBuffer(createInitialEmptyOutputBuffers(ARBITRARY), sizeOfPages(10)); for (int i = 0; i < 3; i++) { addPage(buffer, createPage(i)); } OutputBufferMemoryManager memoryManager = buffer.getMemoryManager(); assertTrue(memoryManager.getBufferedBytes() > 0); buffer.forceFreeMemory(); assertEquals(memoryManager.getBufferedBytes(), 0); addPage(buffer, createPage(1)); assertEquals(memoryManager.getBufferedBytes(), 0); }
Source:
<code><START> private void makeAttribute(final AttributeCol52 column) throws ConversionException { <END> if (Objects.equals("negate", column.getAttribute().toLowerCase())) { throw new ConversionException("Conversion of the negate attribute is not supported."); } else { headerRow.createCell(columnIndex) .setCellValue(getAttribute(column)); } }</code><technical_language>### Manual Review Note 1 export other boolean attributes (for example **enabled**) 0/1, is expected want throw exception for boolean attributes</technical_language>

Target:
private void makeAttribute(final AttributeCol52 column) { if (Objects.equals("negate", column.getAttribute().toLowerCase())) { throw new UnsupportedOperationException("Conversion of the negate attribute is not supported."); } else { headerRow.createCell(columnIndex) .setCellValue(getAttribute(column)); } }
Source:
<code><START> public synchronized void scheduleNext() { <END> if (!isShutdown()) { if (fActiveTask == null) { schedule(); } else if (fActiveTask.getExecType() == ExecutionType.FOREGROUND) { if (fActiveTask.getThread().isCompleted()) { schedule(); } else { if (hasTasks()) { fActiveTask.getThread().suspend(); fForegroundTasks.add(fActiveTask); schedule(); } } } else if (fActiveTask.getExecType() == ExecutionType.BACKGROUND) { if (fActiveTask.getThread().isCompleted()) { schedule(); } else { if (hasTasks()) { fActiveTask.getThread().suspend(); fBackgroundTasks.add(fActiveTask); schedule(); } } } } }</code><technical_language>this private. This is called internal classes/methods. super comfortable keeping synchronized keyword in case. 'synchronized' is more for external entities want get a lock complete object. this for internal only, a separate lock (or end deadlocks). do "proper" way, a ReentrantLock for example. do quick-and-dirty way: private final Object schedulingLock = new Object(); ... public void scheduleNext() { synchronized(schedulingLock) { <stuff here> } } basically spawn a dummy Object monitor, this oh-so-familiar synchronized keyword</technical_language>

Target:
private synchronized void scheduleNext() { if (!isShutdown()) { if (fActiveTask == null) { schedule(); } else if (fActiveTask.getExecType() == ExecutionType.FOREGROUND) { if (fActiveTask.getThread().isCompleted()) { schedule(); } else { if (hasTasks()) { fActiveTask.getThread().suspend(); fForegroundTasks.add(fActiveTask); schedule(); } } } else if (fActiveTask.getExecType() == ExecutionType.BACKGROUND) { if (fActiveTask.getThread().isCompleted()) { schedule(); } else { if (hasTasks()) { fActiveTask.getThread().suspend(); fBackgroundTasks.add(fActiveTask); schedule(); } } } } }
Source:
<code>public String getQuestionWithoutExistingResponseSubmissionFormHtml( boolean sessionIsOpen, int qnIdx, int responseIdx, String courseId, int totalNumRecipients) { return Templates.populateTemplate( FormTemplates.TEXT_SUBMISSION_FORM, <START> Slots.IS_SESSION_CLOSED, sessionIsOpen ? "false" : "true", <END> Slots.FEEDBACK_RESPONSE_TEXT, Const.ParamsNames.FEEDBACK_RESPONSE_TEXT, Slots.QUESTION_INDEX, Integer.toString(qnIdx), Slots.RESPONSE_INDEX, Integer.toString(responseIdx), "${recommendedLengthDisplay}", recommendedLength == 0 ? "style=\"display:none\"" : "", "${recommendedLength}", Integer.toString(recommendedLength), Slots.TEXT_EXISTING_RESPONSE, ""); }</code><technical_language>want change this line code instead. Java Slots.IS_SESSION_CLOSED, !sessionIsOpen ? "true" : "false", This is I system. read case in a Ternary logical outcome of a true evaluation of condition. However, this is of a special case (as outcomes switched), ask @damithc weigh in ask another senior dev give opinion</technical_language>

Target:
public String getQuestionWithoutExistingResponseSubmissionFormHtml( boolean sessionIsOpen, int qnIdx, int responseIdx, String courseId, int totalNumRecipients) { return Templates.populateTemplate( FormTemplates.TEXT_SUBMISSION_FORM, Slots.IS_SESSION_OPEN, Boolean.toString(sessionIsOpen), Slots.FEEDBACK_RESPONSE_TEXT, Const.ParamsNames.FEEDBACK_RESPONSE_TEXT, Slots.QUESTION_INDEX, Integer.toString(qnIdx), Slots.RESPONSE_INDEX, Integer.toString(responseIdx), "${recommendedLengthDisplay}", recommendedLength == 0 ? "style=\"display:none\"" : "", "${recommendedLength}", Integer.toString(recommendedLength), Slots.TEXT_EXISTING_RESPONSE, ""); }
Source:
<code>public static CompletableFuture<FileWrapper> addReadOnlySharingLinkTo(FileWrapper sharedDir, AbsoluteCapability capability, NetworkAccess network, SafeRandom random, Fragmenter fragmenter) { <START> return addSharingLinkTo(sharedDir, capability, network, random, fragmenter, CapabilityStore.READ_SHARING_FILE_PREFIX, <END> CapabilityStore.READ_CAPABILITY_SIZE, CapabilityStore.SHARING_READ_FILE_MAX_SIZE); }</code><technical_language>reason .readOnly() moved caller of this function? safer here</technical_language>

Target:
public static CompletableFuture<FileWrapper> addReadOnlySharingLinkTo(FileWrapper sharedDir, AbsoluteCapability capability, NetworkAccess network, SafeRandom random, Fragmenter fragmenter) { return addSharingLinkTo(sharedDir, capability.readOnly(), network, random, fragmenter, CapabilityStore.READ_SHARING_FILE_PREFIX, CapabilityStore.READ_CAPABILITY_SIZE, CapabilityStore.SHARING_READ_FILE_MAX_SIZE); }
Source:
<code>public void hostsFailed(Set<Integer> failedHosts) { scheduleWork(new Runnable() { <START> @Override <END> public void run() { for (int hostId : failedHosts) { VoltZK.removeRejoinNodeIndicatorForHost(m_messenger.getZK(), hostId); } } }, 0, 0, TimeUnit.MILLISECONDS); }</code><technical_language>getSES(true).submit( new Runnable()</technical_language>

Target:
public void hostsFailed(Set<Integer> failedHosts) { getSES(true).submit(new Runnable() { @Override public void run() { for (int hostId : failedHosts) { VoltZK.removeRejoinNodeIndicatorForHost(m_messenger.getZK(), hostId); } } }); }
Source:
<code>public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SelectorSpec)) { return false; } SelectorSpec that = (SelectorSpec) other; boolean metadataGroupsEqual; if (groups.getMetadata().isPresent()) { metadataGroupsEqual = that.groups.getMetadata().isPresent() && that.groups.getMetadata().get().equals(groups.getMetadata().get()); } else { metadataGroupsEqual = !that.groups.getMetadata().isPresent(); } return (groups.getData().equals(that.groups.getData()) && <START> metadataGroupsEqual && <END> userRegex.map(Pattern::pattern).equals(that.userRegex.map(Pattern::pattern)) && userRegex.map(Pattern::flags).equals(that.userRegex.map(Pattern::flags)) && sourceRegex.map(Pattern::pattern).equals(that.sourceRegex.map(Pattern::pattern))) && sourceRegex.map(Pattern::flags).equals(that.sourceRegex.map(Pattern::flags)); }</code><technical_language>groups.getMetadata().equals(that.groups.getMetadata()) equivalent if-else</technical_language>

Target:
public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof SelectorSpec)) { return false; } SelectorSpec that = (SelectorSpec) other; return (group.equals(that.group) && queryType.equals(that.queryType) && userRegex.map(Pattern::pattern).equals(that.userRegex.map(Pattern::pattern)) && userRegex.map(Pattern::flags).equals(that.userRegex.map(Pattern::flags)) && sourceRegex.map(Pattern::pattern).equals(that.sourceRegex.map(Pattern::pattern))) && sourceRegex.map(Pattern::flags).equals(that.sourceRegex.map(Pattern::flags)); }
Source:
<code>private CompletableFuture<WebSocket> connectAsync() { return httpClient <START> .newWebSocketBuilder() <END> .connectTimeout(Duration.ofMillis(DEFAULT_CONNECT_TIMEOUT_MILLIS)) .buildAsync(serverUri, webSocketListener); }</code><technical_language>This builder is kinda nice, this library gains a point IMO for this</technical_language>

Target:
private CompletableFuture<WebSocket> connectAsync() { return httpClient .newWebSocketBuilder() .connectTimeout(Duration.ofMillis(DEFAULT_CONNECT_TIMEOUT_MILLIS)) .buildAsync(serverUri, internalListener); }
Source:
<code>public <T> MessageHandlingMember<T> wrapHandler(MessageHandlingMember<T> original) { Optional<Method> unwrappedMethod = original.unwrap(Method.class); return unwrappedMethod.map(method -> Arrays.stream(method.getParameters()) .filter(parameter -> parameter.getType() .equals(QueryUpdateEmitter.class)) .findFirst() <START> .map(parameter -> original.annotationAttributes(QueryHandler.class) <END> .map(attr -> (MessageHandlingMember<T>) new MethodQueryMessageHandlerDefinition.MethodSubscriptionQueryMessageHandlingMember( original, attr, parameter)) .orElse(original)) .orElse(original.annotationAttributes(QueryHandler.class) .map(attr -> (MessageHandlingMember<T>) new MethodQueryMessageHandlerDefinition.MethodQueryMessageHandlingMember( original, attr)) .orElse(original))) .orElse(original); }</code><technical_language>mind putting lambda/function call in this map() function line 52 in a private function? I a more readable</technical_language>

Target:
public <T> MessageHandlingMember<T> wrapHandler(MessageHandlingMember<T> original) { Optional<Method> unwrappedMethod = original.unwrap(Method.class); return unwrappedMethod.map(method -> Arrays.stream(method.getParameters()) .filter(parameter -> parameter.getType() .equals(QueryUpdateEmitter.class)) .findFirst() .map(parameter -> wrapToSubscriptionQueryMessageHandlingMember( original, parameter)) .orElse(wrapToQueryMessageHandlingMember(original))) .orElse(original); }
Source:
<code>private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { runnable.run(); <START> LOG.debug("Action: completed successfully.", actionName); <END> if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } } catch (Exception exception) { LOG.error("Execution of action: failed.", new Object[]{actionName, exception}); doCleanUpOnTaskException(exception); } }; }</code><technical_language>minor suggestion: is simpler set a local variable for storing exception value. Inspect in finally clause then, action</technical_language>

Target:
private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { runnable.run(); if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } else { LOG.debug("Action: completed successfully.", actionName); } } catch (Exception exception) { LOG.error("Execution of action: failed.", actionName, exception); doCleanUpOnTaskException(exception); } }; }
Source:
<code>private void validateGatewayAccount(ValidatableResponse response) { response .body("containsKey('gateway_account')", is(true)) .body("gateway_account.gateway_account_id", is(Long.valueOf(accountId))) .body("gateway_account.containsKey('credentials')", is(false)) .body("gateway_account.service_name", is(serviceName)) .body("gateway_account.payment_provider", is(paymentProvider)) .body("gateway_account.type", is(type)) .body("gateway_account.analytics_id", is(analyticsId)) .body("gateway_account.corporate_credit_card_surcharge_amount", isNumber(0)) <START> .body("gateway_account.corporate_debit_card_surcharge_amount", isNumber(0)) <END> .body("gateway_account.card_types", is(notNullValue())) .body("gateway_account.card_types[0].id", is(notNullValue())) .body("gateway_account.card_types[0].label", is("MasterCard")) .body("gateway_account.card_types[0].type", is("DEBIT")) .body("gateway_account.card_types[0].brand", is("mastercard")) .body("gateway_account.card_types[1].id", is(notNullValue())) .body("gateway_account.card_types[1].label", is("Visa")) .body("gateway_account.card_types[1].type", is("CREDIT")) .body("gateway_account.card_types[1].brand", is("visa")); }</code><technical_language>values other 0 passing values long default</technical_language>

Target:
private void validateGatewayAccount(ValidatableResponse response) { response .body("containsKey('gateway_account')", is(true)) .body("gateway_account.gateway_account_id", is(Long.valueOf(accountId))) .body("gateway_account.containsKey('credentials')", is(false)) .body("gateway_account.service_name", is(serviceName)) .body("gateway_account.payment_provider", is(paymentProvider)) .body("gateway_account.type", is(type)) .body("gateway_account.analytics_id", is(analyticsId)) .body("gateway_account.corporate_credit_card_surcharge_amount", isNumber(corporateCreditCardSurchargeAmount)) .body("gateway_account.corporate_debit_card_surcharge_amount", isNumber(corporateDebitCardSurchargeAmount)) .body("gateway_account.card_types", is(notNullValue())) .body("gateway_account.card_types[0].id", is(notNullValue())) .body("gateway_account.card_types[0].label", is("MasterCard")) .body("gateway_account.card_types[0].type", is("DEBIT")) .body("gateway_account.card_types[0].brand", is("mastercard")) .body("gateway_account.card_types[1].id", is(notNullValue())) .body("gateway_account.card_types[1].label", is("Visa")) .body("gateway_account.card_types[1].type", is("CREDIT")) .body("gateway_account.card_types[1].brand", is("visa")); }
Source:
<code>public Image getImage(final String imageIdOrName) { Optional<Image> image = tryFind(listImages(), new Predicate<Image>() { @Override public boolean apply(Image input) { return input.id().equals(imageIdOrName); } }); if (image.isPresent()) return image.get(); <START> api.getImageApi().createImage(CreateImageOptions.Builder.fromImage(imageIdOrName)); <END> return api.getImageApi().inspectImage(imageIdOrName); }</code><technical_language>if passes SHA1 here</technical_language>

Target:
public Image getImage(final String imageIdOrName) { checkNotNull(imageIdOrName); if (imageIdOrName.startsWith("sha256")) { return find(listImages(), new Predicate<Image>() { @Override public boolean apply(Image input) { return input.id().equals(imageIdOrName); } }, null); } api.getImageApi().createImage(CreateImageOptions.Builder.fromImage(imageIdOrName)); return find(listImages(), new Predicate<Image>() { @Override public boolean apply(Image input) { for (String tag : input.repoTags()) { if (tag.equals(imageIdOrName) || tag.equals(imageIdOrName + ":latest")) { return true; } } return false; } }, null); }
Source:
<code>public static EngineError forValue(int value) { <START> return mappings.getOrDefault(value, ERROR_CODE_NOT_FOUND); <END> }</code><technical_language>getOrDefault introduced in java 8 - this class is compiled gwt supports 1.7. implement behavior yourself</technical_language>

Target:
public static EngineError forValue(int value) { return mappings.containsKey(value) ? mappings.get(value) : ERROR_CODE_NOT_FOUND; }
Source:
<code>public static void addHeatRecipe(ILiquidStack output, ILiquidStack input, int temp) { init(); ModTweaker.LATE_ADDITIONS <START> .add(new HighOven.AddHeat(InputHelper.toFluid(output), InputHelper.toFluid(input), temp + 300)); <END> }</code><technical_language>add 300 inconsistent melter smeltery recipes Kelvin in ModTweaker. is a Tinkers Construct config option show temperatures in Kelvin match ModTweaker recipes for pack makers, is whats shown in GUI/JEI</technical_language>

Target:
public static void addHeatRecipe(ILiquidStack output, ILiquidStack input, int temp) { init(); ModTweaker.LATE_ADDITIONS .add(new HighOven.AddHeat(InputHelper.toFluid(output), InputHelper.toFluid(input), temp)); }
Source:
<code><START> public final Provider<List<Configuration>> getConfigurations() { <END> return getProject() .provider(() -> getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().stream() .filter(ss -> !ss.getName().equals(IGNORE_MAIN_CONFIGURATION)) .map(SourceSet::getRuntimeClasspathConfigurationName) .map(getProject().getConfigurations()::getByName) .collect(toList())); }</code><technical_language>I gradle get angry for Provider<List<>> instead of ListProperty. If want dynamic set of inputs do getInputs() similarly handle outputs</technical_language>

Target:
public final Provider<List<Configuration>> getConfigurations() { return getProject().provider(() -> getProbablyTestSourceSets() .map(SourceSet::getRuntimeClasspathConfigurationName) .map(getProject().getConfigurations()::getByName) .collect(toList())); }
Source:
<code><START> public void testSslWithClientAuthenticationMixed() { <END> TrustStoreConfiguration serverTrustStoreConfig = TrustStoreConfiguration.builder() .path(TestConstants.CA_TRUST_STORE_PATH) .build(); KeyStoreConfiguration serverKeyStoreConfig = KeyStoreConfiguration.builder() .path(TestConstants.SERVER_KEY_STORE_JKS_PATH) .password(TestConstants.SERVER_KEY_STORE_JKS_PASSWORD) .build(); SslConfiguration serverConfig = SslConfiguration.builder() .trust(serverTrustStoreConfig) .key(serverKeyStoreConfig) .build(); TrustStoreConfiguration clientTrustStoreConfig = TrustStoreConfiguration.builder() .path(TestConstants.CA_TRUST_STORE_PATH) .build(); KeyStoreConfiguration clientKeyStoreConfig = KeyStoreConfiguration.builder() .path(TestConstants.CLIENT_KEY_STORE_P12_PATH) .type(TestConstants.CLIENT_KEY_STORE_P12_TYPE) .password(TestConstants.CLIENT_KEY_STORE_P12_PASSWORD) .build(); SslConfiguration clientConfig = SslConfiguration.builder() .trust(clientTrustStoreConfig) .key(clientKeyStoreConfig) .build(); runSslConnectionTest(serverConfig, clientConfig, ClientAuth.WITH_CLIENT_AUTH); }</code><technical_language>love this test a dropwizard/feign stack (since is default use-case for this library). a other sub-projects for a simple test setup</technical_language>

Target:
public void testSslWithClientAuthenticationMixed() { TrustStoreConfiguration serverTrustStoreConfig = TrustStoreConfiguration.of(TestConstants.CA_TRUST_STORE_PATH); KeyStoreConfiguration serverKeyStoreConfig = KeyStoreConfiguration.of( TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PASSWORD); SslConfiguration serverConfig = SslConfiguration.of(serverTrustStoreConfig, serverKeyStoreConfig); TrustStoreConfiguration clientTrustStoreConfig = TrustStoreConfiguration.of(TestConstants.CA_TRUST_STORE_PATH); KeyStoreConfiguration clientKeyStoreConfig = KeyStoreConfiguration.builder() .path(TestConstants.CLIENT_KEY_STORE_P12_PATH) .type(TestConstants.CLIENT_KEY_STORE_P12_TYPE) .password(TestConstants.CLIENT_KEY_STORE_P12_PASSWORD) .build(); SslConfiguration clientConfig = SslConfiguration.of(clientTrustStoreConfig, clientKeyStoreConfig); runSslConnectionTest(serverConfig, clientConfig, ClientAuth.WITH_CLIENT_AUTH); }
Source:
<code>private void setMargins() { <START> int topMargin = mRenderer.getChartTitle().equals("") ? 0 : 30; <END> int rightMargin = 20; int leftMargin = mRenderer.getYTitle().equals("") ? 50 : 70; int bottomMargin = mRenderer.getXTitle().equals("") ? 0 : 50; mRenderer.setMargins(new int[]{topMargin, leftMargin, bottomMargin, rightMargin}); }</code><technical_language>pull margins pixel values a styles file adjust per-device viewport</technical_language>

Target:
private void setMargins() { int textAllowance = (int) mContext.getResources().getDimension(R.dimen.graph_text_margin); int topMargin = (int) mContext.getResources().getDimension(R.dimen.graph_y_margin); if (!mRenderer.getChartTitle().equals("")) { topMargin += textAllowance; } int rightMargin = (int) mContext.getResources().getDimension(R.dimen.graph_x_margin); int leftMargin = (int) mContext.getResources().getDimension(R.dimen.graph_x_margin); if (!mRenderer.getYTitle().equals("")) { leftMargin += textAllowance; } int bottomMargin = (int) mContext.getResources().getDimension(R.dimen.graph_y_margin); if (!mRenderer.getXTitle().equals("")) { bottomMargin += textAllowance; } mRenderer.setMargins(new int[]{topMargin, leftMargin, bottomMargin, rightMargin}); }
Source:
<code>public String toString() { <START> if (degubName == null) { <END> degubName = getTokenType().toString(); if (!ApplicationManager.getApplication().isUnitTestMode()) { degubName += " " + getDebugName(); } } return degubName; }</code><technical_language>cache this? for debugging, anyway</technical_language>

Target:
public String toString() { String out = getTokenType().toString(); if (!ApplicationManager.getApplication().isUnitTestMode()) { out += " " + getDebugName(); } return out; }
Source:
<code>public Object getValueAndReset() { <START> Map<String, Object> ret = new ConcurrentHashMap<>(); <END> for (Map.Entry<String, CountMetric> e : value.entrySet()) { ret.put(e.getKey(), e.getValue().getValueAndReset()); } return ret; }</code><technical_language>HashMap good I think</technical_language>

Target:
public Object getValueAndReset() { Map<String, Object> ret = new HashMap<>(); for (Map.Entry<String, CountMetric> e : value.entrySet()) { ret.put(e.getKey(), e.getValue().getValueAndReset()); } return ret; }
Source:
<code>public String getOvnCentralByClusterId(Guid clusterId) { List<Network> <START> clusterNetworks = <END> networkDao.getAllForCluster(clusterId); for (Provider provider : providerDao.getAllByTypes(ProviderType.EXTERNAL_NETWORK)) { for (Network network : clusterNetworks) { ProviderNetwork providerNetwork = network.getProvidedBy(); if (providerNetwork != null && providerNetwork.getProviderId().equals(provider.getId())) { return NetworkUtils.getIpAddress(provider.getUrl()); } } } return null; }</code><technical_language>case if network imported created ? i.e. dealing host installation in system, network created imported provider? this return null</technical_language>

Target:
public String getOvnCentralByClusterId(Guid clusterId) { List<Network> clusterNetworks = networkDao.getAllForCluster(clusterId); for (Provider provider : providerDao.getAllByTypes(ProviderType.EXTERNAL_NETWORK)) { for (Network network : clusterNetworks) { if (network.isExternal() && network.getProvidedBy().getProviderId().equals(provider.getId())) { return NetworkUtils.getIpAddress(provider.getUrl()); } } } return null; }
Source:
<code>private ArrayList<String> deleteNotesWithWrongFieldCounts(Runnable notifyProgress, JSONObject m) throws JSONException { Timber.d("deleteNotesWithWrongFieldCounts"); ArrayList<String> problems = new ArrayList<>(); ArrayList<Long> ids; ids = new ArrayList<>(); Cursor cur = null; try { notifyProgress.run(); cur = mDb.getDatabase().query("select id, flds from notes where mid = " + m.getLong("id"), null); Timber.d("cursor size: %d", cur.getCount()); int rowCount = 0; while (cur.moveToNext()) { try { Timber.d("Handling row: %d. Columns: %d", rowCount, cur.getColumnCount()); String flds = cur.getString(1); long id = cur.getLong(0); int fldsCount = 0; for (int i = 0; i < flds.length(); i++) { if (flds.charAt(i) == 0x1f) { fldsCount++; } } if (fldsCount + 1 != m.getJSONArray("flds").length()) { ids.add(id); } } catch (IllegalStateException ex) { <START> AnkiDroidApp.sendExceptionReport(ex, "deleteNotesWithWrongFieldCounts"); <END> } rowCount++; } notifyProgress.run(); if (ids.size() > 0) { problems.add("Deleted " + ids.size() + " note(s) with wrong field count."); _remNotes(Utils.arrayList2array(ids)); } } finally { if (cur != null && !cur.isClosed()) { cur.close(); } } return problems; }</code><technical_language>I this advance "it's OOM / fields greater limit" theory include total row count row on. Idea if a non-zero row count row time, structural on, if of non-zero working problematic rows out more overflow similar templates needed a conversion chunk loading</technical_language>

Target:
private ArrayList<String> deleteNotesWithWrongFieldCounts(Runnable notifyProgress, JSONObject m) throws JSONException { Timber.d("deleteNotesWithWrongFieldCounts"); ArrayList<String> problems = new ArrayList<>(); ArrayList<Long> ids; ids = new ArrayList<>(); Cursor cur = null; try { notifyProgress.run(); cur = mDb.getDatabase().query("select id, flds from notes where mid = " + m.getLong("id"), null); Timber.i("cursor size: %d", cur.getCount()); int currentRow = 0; @Nullable Exception firstException = null; while (cur.moveToNext()) { try { String flds = cur.getString(1); long id = cur.getLong(0); int fldsCount = 0; for (int i = 0; i < flds.length(); i++) { if (flds.charAt(i) == 0x1f) { fldsCount++; } } if (fldsCount + 1 != m.getJSONArray("flds").length()) { ids.add(id); } } catch (IllegalStateException ex) { Timber.i(ex, "deleteNotesWithWrongFieldCounts - Exception on row %d. Columns: %d", currentRow, cur.getColumnCount()); if (firstException == null) { String details = String.format(Locale.ROOT, "deleteNotesWithWrongFieldCounts row: %d col: %d", currentRow, cur.getColumnCount()); AnkiDroidApp.sendExceptionReport(ex, details); firstException = ex; } } currentRow++; } Timber.i("deleteNotesWithWrongFieldCounts - completed successfully"); notifyProgress.run(); if (ids.size() > 0) { problems.add("Deleted " + ids.size() + " note(s) with wrong field count."); _remNotes(Utils.arrayList2array(ids)); } } finally { if (cur != null && !cur.isClosed()) { cur.close(); } } return problems; }
Source:
<code>static QualifiedColumnMapperFactory adapt(ColumnMapperFactory factory) { <START> Set<Annotation> qualifiers = new Qualifiers().qualifiers(factory.getClass()); <END> return (type, config) -> type.getQualifiers().equals(qualifiers) ? factory.build(type.getType(), config) : Optional.empty(); }</code><technical_language>Ditto other factory: fetch qualifiers cache lambda below</technical_language>

Target:
static QualifiedColumnMapperFactory adapt(ColumnMapperFactory factory) { return (type, config) -> type.getQualifiers().equals( config.get(Qualifiers.class).findFor(factory.getClass())) ? factory.build(type.getType(), config) : Optional.empty(); }
Source:
<code>public void acceptRecord(final SAMRecord rec, final ReferenceSequence ref) { if (!this.includeSecondaryAlignments && rec.getNotPrimaryAlignmentFlag()) return; if (!this.includeSupplementalAlignments && rec.getSupplementaryAlignmentFlag()) return; final int length = rec.getReadLength(); metrics.TOTAL_READS++; metrics.TOTAL_BASES += length; final boolean isPfRead = !rec.getReadFailsVendorQualityCheckFlag(); if (isPfRead) { metrics.PF_READS++; metrics.PF_BASES += length; } final byte[] quals; if (this.useOriginalQualities) { byte[] tmp = rec.getOriginalBaseQualities(); if (tmp == null) tmp = rec.getBaseQualities(); quals = tmp; } else { quals = rec.getBaseQualities(); } for (final int qual : quals) { metrics.Q20_EQUIVALENT_YIELD += qual; if (qual >= 20) metrics.Q20_BASES++; <START> if (qual >= 30) metrics.Q30_BASES++; <END> if (isPfRead) { metrics.PF_Q20_EQUIVALENT_YIELD += qual; if (qual >= 20) metrics.PF_Q20_BASES++; if (qual >= 30) metrics.PF_Q30_BASES++; } } }</code><technical_language>if(qual >= 30) { metrics.Q20_BASES++; metrics.Q30_BASES++; } else if (qual >=20) { metrics.Q20_BASES++; } slightly faster for qualities 30 if readable</technical_language>

Target:
public void acceptRecord(final SAMRecord rec, final ReferenceSequence ref) { if (!this.includeSecondaryAlignments && rec.getNotPrimaryAlignmentFlag()) return; if (!this.includeSupplementalAlignments && rec.getSupplementaryAlignmentFlag()) return; final int length = rec.getReadLength(); metrics.TOTAL_READS++; metrics.TOTAL_BASES += length; final boolean isPfRead = !rec.getReadFailsVendorQualityCheckFlag(); if (isPfRead) { metrics.PF_READS++; metrics.PF_BASES += length; } final byte[] quals; if (this.useOriginalQualities) { byte[] tmp = rec.getOriginalBaseQualities(); if (tmp == null) tmp = rec.getBaseQualities(); quals = tmp; } else { quals = rec.getBaseQualities(); } for (final int qual : quals) { metrics.Q20_EQUIVALENT_YIELD += qual; if (qual >= 30) { metrics.Q20_BASES++; metrics.Q30_BASES++; } else if (qual >= 20) { metrics.Q20_BASES++; } if (isPfRead) { metrics.PF_Q20_EQUIVALENT_YIELD += qual; if (qual >= 30) { metrics.PF_Q20_BASES++; metrics.PF_Q30_BASES++; } else if (qual >= 20) { metrics.PF_Q20_BASES++; } } } }
Source:
<code>public void shouldRemoveConceptDescriptionIfRemovedFromUI() throws Exception { ConceptService cs = Context.getConceptService(); Concept concept = cs.getConcept(3); assertNotNull(concept); assertNotNull(concept.getDescription()); ConceptFormController conceptFormController = (ConceptFormController) applicationContext.getBean("conceptForm"); MockHttpServletRequest mockRequest = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); mockRequest.setMethod("POST"); mockRequest.setParameter("action", ""); mockRequest.setParameter("conceptId", concept.getConceptId().toString()); mockRequest.setParameter("descriptionsByLocale[en].description", ""); ModelAndView mav = conceptFormController.handleRequest(mockRequest, response); assertNotNull(mav); assertTrue(mav.getModel().isEmpty()); <START> updateSearchIndex(); <END> Concept actualConcept = cs.getConcept(3); assertNotNull(actualConcept); assertNull(concept.getDescription()); }</code><technical_language>Is this call necessary</technical_language>

Target:
public void shouldRemoveConceptDescriptionIfRemovedFromUI() throws Exception { ConceptService cs = Context.getConceptService(); Concept concept = cs.getConcept(3); assertNotNull(concept); assertNotNull(concept.getDescription()); ConceptFormController conceptFormController = (ConceptFormController) applicationContext.getBean("conceptForm"); MockHttpServletRequest mockRequest = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); mockRequest.setMethod("POST"); mockRequest.setParameter("action", ""); mockRequest.setParameter("conceptId", concept.getConceptId().toString()); mockRequest.setParameter("descriptionsByLocale[en].description", ""); ModelAndView mav = conceptFormController.handleRequest(mockRequest, response); assertNotNull(mav); assertTrue(mav.getModel().isEmpty()); Concept actualConcept = cs.getConcept(3); assertNotNull(actualConcept); assertNull(concept.getDescription()); }
Source:
<code>public void setFilename(String filename) { ObjectUtil.checkNotNull(filename, "filename"); <START> this.filename = filename; <END> }</code><technical_language>consider merging lines</technical_language>

Target:
public void setFilename(String filename) { this.filename = ObjectUtil.checkNotNull(filename, "filename"); }