auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public AbstractFileResolvingResource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; <START> Boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null; <END> if (included != null && included.booleanValue()) { servletPath = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String) request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext = URIUtil.addPaths(servletPath, pathInfo); return getResource(pathInContext); }</code><technical_language>this variable null, personally favor boolean Boolean</technical_language>

Target:
public AbstractFileResolvingResource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null; if (included) { servletPath = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String) request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext = URIUtil.addPaths(servletPath, pathInfo); return getResource(pathInContext); }
Source:
<code>public static VdcReturnValueBase evaluateCorrelationId(VdcActionParametersBase parameters) { VdcReturnValueBase returnValue = null; String correlationId = parameters.getCorrelationId(); if (StringUtils.isEmpty(correlationId)) { correlationId = CorrelationIdTracker.getCorrelationId(); if (StringUtils.isEmpty(correlationId)) { correlationId = LoggedUtils.getObjectId(parameters); } parameters.setCorrelationId(correlationId); } else { <START> List<Class<?>> validationGroups = Arrays.asList(new Class<?>[] { PreRun.class }); <END> List<String> messages = ValidationUtils.validateInputs(validationGroups, parameters); if (!messages.isEmpty()) { VdcReturnValueBase returnErrorValue = new VdcReturnValueBase(); returnErrorValue.setValid(false); returnErrorValue.getValidationMessages().addAll(messages); return returnErrorValue; } } return returnValue; }</code><technical_language>reason validationGroups instance variable initialize in init()? List item created creating method call</technical_language>

Target:
public static VdcReturnValueBase evaluateCorrelationId(VdcActionParametersBase parameters) { VdcReturnValueBase returnValue = null; String correlationId = parameters.getCorrelationId(); if (StringUtils.isEmpty(correlationId)) { correlationId = CorrelationIdTracker.getCorrelationId(); if (StringUtils.isEmpty(correlationId)) { correlationId = LoggedUtils.getObjectId(parameters); } parameters.setCorrelationId(correlationId); } else { List<String> messages = ValidationUtils.validateInputs(validationGroups, parameters); if (!messages.isEmpty()) { VdcReturnValueBase returnErrorValue = new VdcReturnValueBase(); returnErrorValue.setValid(false); returnErrorValue.getValidationMessages().addAll(messages); return returnErrorValue; } } return returnValue; }
Source:
<code>public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final String cqueryStatusFieldId = "org.eclipse.lsp4e.cpp.status"; final int width = 28; <START> StatusLineContributionItem cqueryStatusField; <END> IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow window : workbenchWindows) { StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager(); if (statusLine.find(cqueryStatusFieldId) != null) { cqueryStatusField = (StatusLineContributionItem) statusLine.find(cqueryStatusFieldId); } else { cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width); statusLine.add(cqueryStatusField); } String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs()) : Messages.CqueryStateIdle; cqueryStatusField.setText(msg); } } }); }</code><technical_language>Please move variable for loop</technical_language>

Target:
public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final String cqueryStatusFieldId = "org.eclipse.lsp4e.cpp.status"; final int width = 28; IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow window : workbenchWindows) { StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager(); StatusLineContributionItem cqueryStatusField = (StatusLineContributionItem) statusLine.find(cqueryStatusFieldId); if (cqueryStatusField == null) { cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width); statusLine.add(cqueryStatusField); } String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs()) : Messages.CqueryStateIdle; cqueryStatusField.setText(msg); } } }); }
Source:
<code>private String getDayCharacters(String label) { <START> int labelCPCount = label.codePointCount(0, label.length()); <END> return label.substring(labelCPCount - 2, labelCPCount); }</code><technical_language>need change here, is for Date type</technical_language>

Target:
private String getDayCharacters(String label) { return label.substring(label.length() - 2); }
Source:
<code>public void testNoLocsSymlink() throws Exception { final File metricsFile = File.createTempFile("dual.", ".metrics"); metricsFile.deleteOnExit(); final String[] args = new String[]{ "BASECALLS_DIR=" + noSymlink.getAbsolutePath(), "LANE=" + 1, <START> "METRICS_FILE=" + metricsFile.getPath(), <END> "READ_STRUCTURE=" + "25T8B8B25T", "BARCODE=" + "CAATAGTCCGACTCTC" }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<ExtractIlluminaBarcodes.BarcodeMetric, Integer> result = new MetricsFile<ExtractIlluminaBarcodes.BarcodeMetric, Integer>(); result.read(new FileReader(metricsFile)); Assert.assertEquals(result.getMetrics().get(0).PERFECT_MATCHES, 2, "Got wrong number of perfect matches"); Assert.assertEquals(result.getMetrics().get(0).ONE_MISMATCH_MATCHES, 0, "Got wrong number of one-mismatch matches"); }</code><technical_language>getPath() here</technical_language>

Target:
public void testNoLocsSymlink() throws Exception { final File metricsFile = File.createTempFile("dual.", ".metrics"); metricsFile.deleteOnExit(); final String[] args = new String[]{ "BASECALLS_DIR=" + noSymlink.getAbsolutePath(), "LANE=" + 1, "METRICS_FILE=" + metricsFile, "READ_STRUCTURE=" + "25T8B8B25T", "BARCODE=" + "CAATAGTCCGACTCTC" }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<ExtractIlluminaBarcodes.BarcodeMetric, Integer> result = new MetricsFile<>(); result.read(new FileReader(metricsFile)); Assert.assertEquals(result.getMetrics().get(0).PERFECT_MATCHES, 2, "Got wrong number of perfect matches"); Assert.assertEquals(result.getMetrics().get(0).ONE_MISMATCH_MATCHES, 0, "Got wrong number of one-mismatch matches"); }
Source:
<code>public synchronized void acquireBuffer(boolean metadata) { <START> if (serializedCache != null) { <END> if (metadata) { serializedCache.buffer.resetReaderIndex(); serializedCache.buffer.writerIndex(serializedCache.metadataOffset); doSerializeMetadataInternal(serializedCache.buffer); } serializedCache.buffer.retain(); return; } ByteBuf buf = Unpooled.buffer(); if (metadata) { int metadataOffset = doSerializeInternal(buf); serializedCache = new SerializedCache(buf, metadataOffset); } else { doSerializePayloadInternal(buf); serializedCache = new SerializedCache(buf, buf.writerIndex()); } }</code><technical_language>if invert if condition code a bit more straightforward public synchronized void acquireBuffer(boolean metadata) { if (serializedCache == null) { ByteBuf buf = Unpooled.buffer(); int metadataOffset; if (metadata) { metadataOffset = doSerializeInternal(buf); } else { doSerializePayloadInternal(buf); metadataOffset = buf.writerIndex(); } serializedCache = new SerializedCache(buf, metadataOffset); } else { if (metadata) { serializedCache.buffer.resetReaderIndex(); serializedCache.buffer.writerIndex(serializedCache.metadataOffset); doSerializeMetadataInternal(serializedCache.buffer); } serializedCache.buffer.retain(); } }</technical_language>

Target:
public synchronized void acquireBuffer(boolean metadata) { if (serializedCache == null) { acquireBufferInternal(metadata); } else { if (metadata) { serializedCache.buffer.resetReaderIndex(); serializedCache.buffer.writerIndex(serializedCache.metadataOffset); doSerializeMetadataInternal(serializedCache.buffer); } serializedCache.buffer.retain(); } }
Source:
<code><START> public List<Query> getQueries() { <END> return _queries; }</code><technical_language>ImmutableList</technical_language>

Target:
public ImmutableList<Query> getQueries() { return _queries; }
Source:
<code><START> private List<SegmentDescriptor> getMissingSegments(final ResponseContext context) <END> { final Object maybeMissingSegments = context.get(ResponseContext.CTX_MISSING_SEGMENTS_KEY); if (maybeMissingSegments == null) { return new ArrayList<>(); } return jsonMapper.convertValue( maybeMissingSegments, new TypeReference<List<SegmentDescriptor>>() { } ); }</code><technical_language>explore if this method belong ResponseContext</technical_language>

Target:
private List<SegmentDescriptor> getMissingSegments(final ResponseContext context) { final Object maybeMissingSegments = context.get(ResponseContext.CTX_MISSING_SEGMENTS); if (maybeMissingSegments == null) { return new ArrayList<>(); } return jsonMapper.convertValue( maybeMissingSegments, new TypeReference<List<SegmentDescriptor>>() { } ); }
Source:
<code>default Iterator<T> dropWhile(Predicate<? super T> predicate) { Objects.requireNonNull(predicate, "predicate is null"); if (!hasNext()) { return empty(); } else { final Iterator<T> that = this; return new AbstractIterator<T>() { private T next; private boolean cached = false; <START> private boolean test = true; <END> @Override public boolean hasNext() { if (cached) { return true; } else if (test) { test = false; while (that.hasNext()) { next = that.next(); if (!predicate.test(next)) { cached = true; return true; } } return false; } else if (that.hasNext()) { next = that.next(); cached = true; return true; } else { return false; } } @Override public T getNext() { cached = false; return next; } }; } }</code><technical_language>please rename test reflect intent ... isFirstValue something</technical_language>

Target:
default Iterator<T> dropWhile(Predicate<? super T> predicate) { Objects.requireNonNull(predicate, "predicate is null"); if (!hasNext()) { return empty(); } else { final Iterator<T> that = this; return new AbstractIterator<T>() { private T next; private boolean cached = false; private boolean first = true; @Override public boolean hasNext() { if (cached) { return true; } else if (first) { first = false; while (that.hasNext()) { next = that.next(); if (!predicate.test(next)) { cached = true; return true; } } return false; } else if (that.hasNext()) { next = that.next(); cached = true; return true; } else { return false; } } @Override public T getNext() { cached = false; return next; } }; } }
Source:
<code>public SiteTasker take() throws InterruptedException { SiteTasker task = m_tasks.poll(); if (task == null) { m_starvationTracker.beginStarvation(); } else { m_queueDepthTracker.pollUpdate(task.getTimestamp()); return task; } try { task = CoreUtils.queueSpinTake(m_tasks); <START> if (task != null) { <END> m_queueDepthTracker.pollUpdate(task.getTimestamp()); } return task; } finally { m_starvationTracker.endStarvation(); } }</code><technical_language>queueSpinTake() return a null</technical_language>

Target:
public SiteTasker take() throws InterruptedException { SiteTasker task = m_tasks.poll(); if (task == null) { m_starvationTracker.beginStarvation(); } else { m_queueDepthTracker.pollUpdate(task.getQueueOfferTime()); return task; } try { task = CoreUtils.queueSpinTake(m_tasks); m_queueDepthTracker.pollUpdate(task.getQueueOfferTime()); return task; } finally { m_starvationTracker.endStarvation(); } }
Source:
<code>public static ValueStringFixed get(String s, int precision, Mode mode) { <START> if (mode != null && mode.padFixedStrings && precision < Integer.MAX_VALUE) { <END> s = rightPadWithSpaces(s, precision); } else if (precision != PRECISION_DO_NOT_TRIM) { s = trimRight(s); } if (s.length() == 0) { return EMPTY; } ValueStringFixed obj = new ValueStringFixed(StringUtils.cache(s)); if (s.length() > SysProperties.OBJECT_CACHE_MAX_PER_ELEMENT_SIZE) { return obj; } return (ValueStringFixed) Value.cache(obj); }</code><technical_language>whats precision < Integer.MAX_VALUE true, a bug</technical_language>

Target:
public static ValueStringFixed get(String s, int precision, Mode mode) { if (mode != null && mode.padFixedLengthStrings) { if (precision == Integer.MAX_VALUE) { precision = 1; } if (s.length() < precision) { s = rightPadWithSpaces(s, precision); } else { s = trimRight(s, precision); } } else if (precision != PRECISION_DO_NOT_TRIM) { s = trimRight(s); } if (s.length() == 0) { return EMPTY; } ValueStringFixed obj = new ValueStringFixed(StringUtils.cache(s)); if (s.length() > SysProperties.OBJECT_CACHE_MAX_PER_ELEMENT_SIZE) { return obj; } return (ValueStringFixed) Value.cache(obj); }
Source:
<code><START> public Builder keyMarker(String keyMarker) { <END> operations.add(args -> args.keyMarker = keyMarker); return this; }</code><technical_language>keyMarker ""; null. validateNullOrNotEmpty()</technical_language>

Target:
public Builder keyMarker(String keyMarker) { validateNullOrNotEmptyString(keyMarker, "keyMarker"); operations.add(args -> args.keyMarker = keyMarker); return this; }
Source:
<code>public void shouldThrowExceptionWhenPassingMoreArgsThanMethodSupports() throws Throwable { String a = "test"; int b = 3; String c = "anotherTest"; try { invoke(handler.get(new DefaultBeanClass(TestController.class)), "anotherMethod", a, b, c); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), startsWith("wrong number of arguments")); } <START> } <END></code><technical_language>s/wrong/Wrong/ OCD happy</technical_language>

Target:
public void shouldThrowExceptionWhenPassingMoreArgsThanMethodSupports() throws Throwable { String a = "test"; int b = 3; String c = "anotherTest"; try { invoke(handler.get(new DefaultBeanClass(TestController.class)), "anotherMethod", a, b, c); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage().toLowerCase(), startsWith("wrong number of arguments")); } }
Source:
<code>BlockOutputStreamEntry allocateBlockIfNeeded() throws IOException { int succeededAllocates = 0; BlockOutputStreamEntry streamEntry = getCurrentStreamEntry(); if (streamEntry != null && streamEntry.isClosed()) { if (streamEntry.getCurrentPosition() == 0) { <START> streamEntries.remove(currentStreamIndex); <END> } else { currentStreamIndex++; } } if (streamEntries.size() <= currentStreamIndex) { Preconditions.checkNotNull(omClient); try { allocateNewBlock(); succeededAllocates += 1; } catch (IOException ioe) { LOG.error("Try to allocate more blocks for write failed, already " + "allocated " + succeededAllocates + " blocks for this write."); throw ioe; } } Preconditions.checkArgument(currentStreamIndex < streamEntries.size()); BlockOutputStreamEntry current = streamEntries.get(currentStreamIndex); return current; }</code><technical_language>I remove streamEntry here. easier for debugging, code readability. empty entries pruned time of reporting OM, logged block written all</technical_language>

Target:
BlockOutputStreamEntry allocateBlockIfNeeded() throws IOException { BlockOutputStreamEntry streamEntry = getCurrentStreamEntry(); if (streamEntry != null && streamEntry.isClosed()) { currentStreamIndex++; } if (streamEntries.size() <= currentStreamIndex) { Preconditions.checkNotNull(omClient); int succeededAllocates = 0; try { allocateNewBlock(); succeededAllocates += 1; } catch (IOException ioe) { LOG.error("Try to allocate more blocks for write failed, already " + "allocated " + succeededAllocates + " blocks for this write."); throw ioe; } } Preconditions.checkArgument(currentStreamIndex < streamEntries.size()); BlockOutputStreamEntry current = streamEntries.get(currentStreamIndex); return current; }
Source:
<code>protected void populateComboBox() { String projName = null; try { ILaunchConfiguration launchConfiguration = LaunchHelper.findHibernateLaunchConfig(this.consoleConfigName); projName = launchConfiguration.getAttribute(IConsoleConfigurationLaunchConstants.PROJECT_NAME, ""); } catch (CoreException e) { HibernateSearchConsolePlugin.getDefault().log(e); } IJavaProject project = ProjectUtils.findJavaProject(projName); final IType analyzersType = ProjectUtils.findType(project, "org.apache.lucene.analysis.Analyzer"); comboControl.getDisplay().syncExec(new Runnable() { public void run() { try { IType[] types = analyzersType.newTypeHierarchy(new NullProgressMonitor()).getAllSubtypes(analyzersType); List<String> typesList = new LinkedList<String>(); for (IType type : types) { try { if (type.getMethod(type.getElementName(), new String[0]).isConstructor()) { typesList.add(type.getFullyQualifiedName()); continue; } <START> } catch (JavaModelException e) { <END> } try { if (type.getMethod(type.getElementName(), new String[] {"Lorg.apache.lucene.util.Version;"}).isConstructor()) { typesList.add(type.getFullyQualifiedName()); continue; } } catch (JavaModelException e) { } } comboControl.setItems(typesList.toArray(new String[0])); comboControl.setText(DEFAULT_ANALYZER); } catch (JavaModelException e) { HibernateConsolePlugin.getDefault().log(e); } } }); }</code><technical_language>exceptions need logged? people understand wrong, enough diagnostic data, some bugfixes reported</technical_language>

Target:
protected void populateComboBox() { String projName = null; try { ILaunchConfiguration launchConfiguration = LaunchHelper.findHibernateLaunchConfig(this.consoleConfigName); projName = launchConfiguration.getAttribute(IConsoleConfigurationLaunchConstants.PROJECT_NAME, ""); } catch (CoreException e) { HibernateSearchConsolePlugin.getDefault().logError(e); } IJavaProject project = ProjectUtils.findJavaProject(projName); final IType analyzersType = ProjectUtils.findType(project, "org.apache.lucene.analysis.Analyzer"); comboControl.getDisplay().syncExec(new Runnable() { public void run() { try { IType[] types = analyzersType.newTypeHierarchy(new NullProgressMonitor()).getAllSubtypes(analyzersType); List<String> typesList = new LinkedList<String>(); for (IType type : types) { try { if (type.getMethod(type.getElementName(), new String[0]).isConstructor()) { typesList.add(type.getFullyQualifiedName()); continue; } } catch (JavaModelException e) { HibernateSearchConsolePlugin.getDefault().logInfo( "Analuzer " + type.getFullyQualifiedName() + " doesn't have constrcutor with no parameters", e); } try { if (type.getMethod(type.getElementName(), new String[] {"Lorg.apache.lucene.util.Version;"}).isConstructor()) { typesList.add(type.getFullyQualifiedName()); continue; } } catch (JavaModelException e) { HibernateSearchConsolePlugin.getDefault().logWarning( "Analuzer " + type.getFullyQualifiedName() + " doesn't have constrcutor with Version as a parameter", e); } } comboControl.setItems(typesList.toArray(new String[0])); comboControl.setText(DEFAULT_ANALYZER); } catch (JavaModelException e) { HibernateConsolePlugin.getDefault().log(e); } } }); }
Source:
<code>public final synchronized void removeMediaSourceRange( int fromIndex, int toIndex, @Nullable Runnable actionOnCompletion) { if (fromIndex < 0 || fromIndex >= mediaSourcesPublic.size()) { throw new IndexOutOfBoundsException(String.format("Cannot remove source range: initial index (%d) out of bounds", fromIndex)); } if (toIndex < 0 || toIndex > mediaSourcesPublic.size()) { throw new IndexOutOfBoundsException(String.format("Cannot remove source range: final index (%d) out of bounds", toIndex)); } if (fromIndex > toIndex) { throw new IndexOutOfBoundsException(String.format("Cannot remove source range: range malformed (%d, %d)", fromIndex, toIndex)); } if (fromIndex == toIndex) { if (actionOnCompletion != null) { actionOnCompletion.run(); } return; } <START> mediaSourcesPublic.subList(fromIndex, toIndex).clear(); <END> if (player != null) { player .createMessage(this) .setType(MSG_REMOVE_RANGE) .setPayload(new MessageData<>(fromIndex, toIndex, actionOnCompletion)) .send(); } else if (actionOnCompletion != null) { actionOnCompletion.run(); } }</code><technical_language>replace Util.removeRange(mediaSourcesPublic, fromIndex, toIndex)? calls method is slightly more readable. move if(fromIndex == toIndex) check ensure exceptions thrown first</technical_language>

Target:
public final synchronized void removeMediaSourceRange( int fromIndex, int toIndex, @Nullable Runnable actionOnCompletion) { Util.removeRange(mediaSourcesPublic, fromIndex, toIndex); if (fromIndex == toIndex) { if (actionOnCompletion != null) { actionOnCompletion.run(); } return; } if (player != null) { player .createMessage(this) .setType(MSG_REMOVE_RANGE) .setPayload(new MessageData<>(fromIndex, toIndex, actionOnCompletion)) .send(); } else if (actionOnCompletion != null) { actionOnCompletion.run(); } }
Source:
<code>public void setUp() throws Exception { super.setUp(); try (Git git = new Git(db)) { JGitTestUtil.writeTrashFile(db, "hello", "world"); git.add().addFilepattern("hello").call(); git.commit().setMessage("Initial commit").call(); JGitTestUtil.writeTrashFile(db, "hello2", "hello"); git.add().addFilepattern("hello2").call(); git.commit().setMessage("hello2").call(); JGitTestUtil.writeTrashFile(db, "staged", "x"); git.add().addFilepattern("staged").call(); <START> JGitTestUtil.writeTrashFile(db, "untracked", "untracked"); <END> } }</code><technical_language>check for entries: - exisiting in HEAD missing in index (files executed 'git rm' comitted that) - symbolic links - submodules if support bells whistles of native git's ls-files silently ignore links submodules</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); try (Git git = new Git(db)) { JGitTestUtil.writeTrashFile(db, "hello", "hello"); JGitTestUtil.writeTrashFile(db, "dir", "world", "world"); git.add().addFilepattern("dir").call(); git.commit().setMessage("Initial commit").call(); JGitTestUtil.writeTrashFile(db, "hello2", "hello"); git.add().addFilepattern("hello2").call(); FileUtils.createSymLink(new File(db.getWorkTree(), "link"), "target"); FileUtils.mkdir(new File(db.getWorkTree(), "target")); writeTrashFile("target/file", "someData"); git.add().addFilepattern("target").addFilepattern("link").call(); git.commit().setMessage("hello2").call(); JGitTestUtil.writeTrashFile(db, "staged", "x"); JGitTestUtil.deleteTrashFile(db, "hello2"); git.add().addFilepattern("staged").call(); JGitTestUtil.writeTrashFile(db, "untracked", "untracked"); } }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); sb.append(kind.shortString()).append("("); for (int i = 0; i < fields.length; i++) { if (i != 0) { sb.append(","); } <START> sb.append(StringUtils.arrayAwareToString(fields[i])); <END> } sb.append(")"); return sb.toString(); }</code><technical_language>org.apache.flink.table.utils.EncodingUtils#objectToString</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(kind.shortString()).append("("); for (int i = 0; i < fields.length; i++) { if (i != 0) { sb.append(","); } sb.append(EncodingUtils.objectToString(fields[i])); } sb.append(")"); return sb.toString(); }
Source:
<code>@Override public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure) { final int operandCount = callBinding.getOperandCount(); <START> assert operandCount >= 2; <END> if (!OperandTypes.ANY.checkSingleOperandType( callBinding, callBinding.operand(0), 0, throwOnFailure)) { return false; } for (int i = 1; i < operandCount; i++) { if (!OperandTypes.CHARACTER.checkSingleOperandType( callBinding, callBinding.operand(i), 0, throwOnFailure)) { return false; } } return true; }</code><technical_language>do this check overriding checkOperandCount</technical_language>

Target:
@Override public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFailure) { final int operandCount = callBinding.getOperandCount(); if (!OperandTypes.ANY.checkSingleOperandType( callBinding, callBinding.operand(0), 0, throwOnFailure)) { return false; } for (int i = 1; i < operandCount; i++) { if (!OperandTypes.CHARACTER.checkSingleOperandType( callBinding, callBinding.operand(i), 0, throwOnFailure)) { return false; } } return true; }
Source:
<code>public List<Rule> getRules(String dataSource) { List<Rule> retVal = Lists.newArrayList(); <START> retVal.addAll((rules.get(dataSource) == null) ? Lists.<Rule>newArrayList() : rules.get(dataSource)); <END> retVal.addAll(defaultRules); return retVal; }</code><technical_language>add empty list here? wrap in if</technical_language>

Target:
public List<Rule> getRules(String dataSource) { List<Rule> retVal = Lists.newArrayList(); if (dataSource != null) { retVal.addAll(rules.get(dataSource)); } if (defaultRules != null) { retVal.addAll(defaultRules); } return retVal; }
Source:
<code>public double priority(IResource r) { if (r!=null && r.isAccessible()) { if (ignoreDerived && r.isDerived()) { return PRIORITY_IGNORE; } if <START> (isLinkedProject(r)) <END> { return PRIORITY_IGNORE; } String name = r.getName(); for (String ext : ignoredExtensions) { if (name.regionMatches(true, name.length() - ext.length(), ext, 0, ext.length())) { return PRIORITY_IGNORE; } } for (String pre : ignoredPrefixes) { if (name.startsWith(pre)) { return PRIORITY_IGNORE; } } for (String n : ignoredNames) { if (name.equals(n)) { return PRIORITY_IGNORE; } } return PRIORITY_DEFAULT; } return PRIORITY_IGNORE; }</code><technical_language>I isLinkedContainer()</technical_language>

Target:
public double priority(IResource r) { if (r!=null && r.isAccessible()) { if (ignoreDerived && r.isDerived()) { return PRIORITY_IGNORE; } if (isIgnoredLinkedContainer(r)) { return PRIORITY_IGNORE; } String name = r.getName(); for (String ext : ignoredExtensions) { if (name.regionMatches(true, name.length() - ext.length(), ext, 0, ext.length())) { return PRIORITY_IGNORE; } } for (String pre : ignoredPrefixes) { if (name.startsWith(pre)) { return PRIORITY_IGNORE; } } for (String n : ignoredNames) { if (name.equals(n)) { return PRIORITY_IGNORE; } } return PRIORITY_DEFAULT; } return PRIORITY_IGNORE; }
Source:
<code>public void before() { SWTBotUtils.openView(KernelMemoryUsageView.ID); fViewBotKernelMemory = fBot.viewById(KernelMemoryUsageView.ID); fViewBotKernelMemory.show(); Matcher<Chart> widgetOfType = WidgetOfType.widgetOfType(Chart.class); fChart = fViewBotKernelMemory.bot().widget(widgetOfType); try { <START> SWTBotUtils.openTrace(TRACE_PROJECT_NAME, <END> Paths.get(FileLocator.toFileURL(CtfTestTrace.KERNEL_VM.getTraceURL()).toURI()).toString(), KERNEL_TRACE_TYPE); } catch (IOException | URISyntaxException e) { fail(e.getMessage()); } SWTBotUtils.activateEditor(fBot, "kernel_vm"); }</code><technical_language>Also, if open a trace, forget close editor dispose trace project and... need a clean job (@after @afterClass)</technical_language>

Target:
public void before() { super.before(); File file = new File(CtfTmfTestTraceUtils.getTrace(CtfTestTrace.KERNEL_VM).getPath()); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, file.getAbsolutePath(), KERNEL_TRACE_TYPE); SWTBotUtils.activateEditor(fBot, "kernel_vm"); }
Source:
<code>protected void startCompaction(CorfuRuntime rt, LogUnitServer logUnitServer) { rt.getGarbageInformer().stop(); rt.getGarbageInformer().waitUntilAllTasksFinish(); <START> while (rt.getGarbageInformer().getGarbageReceivingQueue().size() > 0) { rt.getGarbageInformer().gcUnsafe(); } <END> logUnitServer.runCompaction(); rt.getAddressSpaceView().resetCaches(); rt.getAddressSpaceView().invalidateServerCaches(); }</code><technical_language>Put this logic GarbageInformer waitUntilAllTasksFinish discussed</technical_language>

Target:
protected void startCompaction(CorfuRuntime rt, LogUnitServer logUnitServer) { rt.getGarbageInformer().stop(); rt.getGarbageInformer().waitUntilAllTasksFinish(); logUnitServer.runCompaction(); rt.getAddressSpaceView().resetCaches(); rt.getAddressSpaceView().invalidateServerCaches(); }
Source:
<code>private static void setSessionVisibleSettings(FeedbackSessionAttributes feedbackSession, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings) { boolean hasSessionVisibleDate = !TimeHelper.isSpecialTime(feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisibleAtOpenChecked = Const.TIME_REPRESENTS_FOLLOW_OPENING.equals( feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisiblePrivateChecked = Const.TIME_REPRESENTS_NEVER.equals( feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisibleDateButtonChecked = hasSessionVisibleDate; additionalSettings.sessionVisibleDateValue = hasSessionVisibleDate ? TimeHelper.formatDateForSessionsForm( <START> feedbackSession.getSessionVisibleFromTime()) <END> : ""; additionalSettings.isSessionVisibleDateDisabled = !hasSessionVisibleDate; additionalSettings.sessionVisibleTimeOptions = PageData.getTimeOptionsAsElementTags( hasSessionVisibleDate ? feedbackSession.getSessionVisibleFromTime() : null); }</code><technical_language>local date right</technical_language>

Target:
private static void setSessionVisibleSettings(FeedbackSessionAttributes feedbackSession, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings) { boolean hasSessionVisibleDate = !TimeHelper.isSpecialTime(feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisibleAtOpenChecked = Const.TIME_REPRESENTS_FOLLOW_OPENING.equals( feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisiblePrivateChecked = Const.TIME_REPRESENTS_NEVER.equals( feedbackSession.getSessionVisibleFromTime()); additionalSettings.isSessionVisibleDateButtonChecked = hasSessionVisibleDate; additionalSettings.sessionVisibleDateValue = hasSessionVisibleDate ? TimeHelper.formatDateForSessionsForm( feedbackSession.getSessionVisibleFromTimeLocal()) : ""; additionalSettings.isSessionVisibleDateDisabled = !hasSessionVisibleDate; additionalSettings.sessionVisibleTimeOptions = PageData.getTimeOptionsAsElementTags( hasSessionVisibleDate ? feedbackSession.getSessionVisibleFromTimeLocal() : null); }
Source:
<code>private boolean inheritsFromBaseException(@Nullable Symbol symbol) { if (symbol == null) { return true; } if (BuiltinSymbols.builtinExceptions().contains(symbol.name()) || BuiltinSymbols.builtinExceptionsPython2().contains(symbol.name())) { return true; } for (Usage usage : symbol.usages()) { if (usage.isBindingUsage()) { if (usage.kind().equals(Usage.Kind.IMPORT)) { return true; } Tree tree = usage.tree(); Tree parent = tree.parent(); <START> if (parent.is(Tree.Kind.CLASSDEF)) { <END> return classInheritsFromBaseException((ClassDef) parent); } } } return !isABuiltinNonExceptionType(symbol.name()); }</code><technical_language>checking for usage.kind().equals(Usage.Kind.CLASS_DEF)? if more binding usages</technical_language>

Target:
private boolean inheritsFromBaseException(@Nullable Symbol symbol) { if (symbol == null) { return true; } if (BuiltinSymbols.EXCEPTIONS.contains(symbol.name()) || BuiltinSymbols.EXCEPTIONS_PYTHON2.contains(symbol.name())) { return true; } List<Usage> bindingUsages = symbol.usages().stream().filter(Usage::isBindingUsage).collect(Collectors.toList()); if (bindingUsages.size() > 1) { return true; } if (bindingUsages.size() == 1) { Usage usage = bindingUsages.get(0); if (usage.kind().equals(Usage.Kind.IMPORT)) { return true; } if (usage.kind().equals(Usage.Kind.CLASS_DECLARATION)) { return classInheritsFromBaseException((ClassDef) usage.tree().parent()); } } return !BuiltinSymbols.all().contains(symbol.name()); }
Source:
<code>public void testMultiMdRef() throws Exception { String[] csv = {"id,relationship.type,relation.isAuthorOfPublication,collection,dc.identifier.other", "+,Person,," + col1.getHandle() + ",0", "+,Person,," + col1.getHandle() + ",1", "+,Publication,dc.identifier.other:0||dc.identifier.other:1," + col1.getHandle() + ",2"}; Item[] items = runImport(csv); <START> assertRelationship(items[2], items[0], 1); <END> assertRelationship(items[2], items[1], 1); }</code><technical_language>verify order matches</technical_language>

Target:
public void testMultiMdRef() throws Exception { String[] csv = {"id,relationship.type,relation.isAuthorOfPublication,collection,dc.identifier.other", "+,Person,," + col1.getHandle() + ",0", "+,Person,," + col1.getHandle() + ",1", "+,Publication,dc.identifier.other:0||dc.identifier.other:1," + col1.getHandle() + ",2"}; Item[] items = runImport(csv); assertRelationship(items[2], items[0], 1, "left", 0); assertRelationship(items[2], items[1], 1, "left", 1); }
Source:
<code>private static void appendTime(StringBuilder sb, int hours, int minutes, int seconds, int nanos) { sb.append(NUMBERS[hours]); sb.append(':'); sb.append(NUMBERS[minutes]); sb.append(':'); sb.append(NUMBERS[seconds]); if (nanos == 0) { return; } sb.append('.'); int len = sb.length(); int micros = nanos / 1000; int microsDigits = 0; for (int i = 0; i < 6; i++) { <START> if (micros % POWERS10[i + 1] != 0) { <END> sb.append(micros / POWERS10[i]); microsDigits = i + (sb.length() - len); break; } } int needZeros = 6 - microsDigits; if (needZeros > 0) { sb.insert(len, ZEROS, 0, needZeros); } }</code><technical_language>Frankly speaking, I append nanos is, walk remove zeros one</technical_language>

Target:
private static void appendTime(StringBuilder sb, int hours, int minutes, int seconds, int nanos) { sb.append(NUMBERS[hours]); sb.append(':'); sb.append(NUMBERS[minutes]); sb.append(':'); sb.append(NUMBERS[seconds]); if (nanos == 0) { return; } sb.append('.'); int len = sb.length(); sb.append(nanos / 1000); int needZeros = 6 - (sb.length() - len); if (needZeros > 0) { sb.insert(len, ZEROS, 0, needZeros); } int end = sb.length() - 1; while (sb.charAt(end) == '0') { sb.deleteCharAt(end); end--; } }
Source:
<code>protected void createFields(final Composite parent) { final Label listenFeatureLabel = new Label(parent, SWT.NONE); <START> listenFeatureLabel.setText(org.eclipse.papyrus.customization.nattableconfiguration.messages.Messages.FeatureFillingConfigurationDialog_listenFeature); <END> listenFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); listenFeatureText = new CLabel(parent, SWT.BORDER); listenFeatureText.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); browseValuesButton = new Button(parent, SWT.PUSH); browseValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.BROWSE_ICON_PATH)); browseValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_EditValue); browseValuesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { browseAction(modifiedFeatureFillingConf.getListenFeature()); } }); deleteValuesButton = new Button(parent, SWT.PUSH); deleteValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH)); deleteValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_UnsetValue); deleteValuesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { setListenFeature(null); } }); setListenFeature(modifiedFeatureFillingConf.getListenFeature()); }</code><technical_language>import class</technical_language>

Target:
protected void createFields(final Composite parent) { final Label listenFeatureLabel = new Label(parent, SWT.NONE); listenFeatureLabel.setText(Messages.FeatureFillingConfigurationDialog_listenFeature); listenFeatureLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); listenFeatureText = new CLabel(parent, SWT.BORDER); listenFeatureText.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); browseValuesButton = new Button(parent, SWT.PUSH); browseValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.BROWSE_ICON_PATH)); browseValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_EditValue); browseValuesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { browseAction(modifiedFeatureFillingConf.getListenFeature()); } }); deleteValuesButton = new Button(parent, SWT.PUSH); deleteValuesButton.setImage(Activator.getDefault().getImage(NattableConfigurationConstants.DELETE_ICON_PATH)); deleteValuesButton.setToolTipText(org.eclipse.papyrus.infra.widgets.messages.Messages.ReferenceDialog_UnsetValue); deleteValuesButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { setListenFeature(null); } }); setListenFeature(modifiedFeatureFillingConf.getListenFeature()); }
Source:
<code>public ScheduledExecutorService build() { final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(this.poolSize, this.threadFactory, this.handler); <START> if (this.removeOnCancel != null) { <END> executor.setRemoveOnCancelPolicy(this.removeOnCancel.booleanValue()); } this.environment.manage(new ExecutorServiceManager(executor, this.shutdownTime, this.nameFormat)); return executor; }</code><technical_language>If removeOnCancel a boolean primitive avoid a condition block</technical_language>

Target:
public ScheduledExecutorService build() { final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(this.poolSize, this.threadFactory, this.handler); executor.setRemoveOnCancelPolicy(this.removeOnCancel); this.environment.manage(new ExecutorServiceManager(executor, this.shutdownTime, this.nameFormat)); return executor; }
Source:
<code>public Emitter getEmitter(GraphiteEmitterConfig graphiteEmitterConfig, ObjectMapper mapper, final Injector injector) { List<Emitter> emitters = Lists.transform( graphiteEmitterConfig.getAlertEmitters(), new Function<String, Emitter>() { @Override public Emitter apply(String s) { return injector.getInstance(Key.get(Emitter.class, Names.named(s))); } } ); List<Emitter> requestLogEmitters = Lists.transform( graphiteEmitterConfig.getRequestLogEmitters(), new Function<String, Emitter>() { @Override public Emitter apply(String s) { <START> return injector.getInstance(Key.get(Emitter.class, Names.named(s))); <END> } } ); return new GraphiteEmitter(graphiteEmitterConfig, emitters, requestLogEmitters); }</code><technical_language>This potential fail late. Suggest eagerly creating list ImmutableList.copyOf</technical_language>

Target:
public Emitter getEmitter(GraphiteEmitterConfig graphiteEmitterConfig, ObjectMapper mapper, final Injector injector) { List<Emitter> emitters = ImmutableList.copyOf( Lists.transform( graphiteEmitterConfig.getAlertEmitters(), alertEmitterName -> { return injector.getInstance(Key.get(Emitter.class, Names.named(alertEmitterName))); } ) ); List<Emitter> requestLogEmitters = ImmutableList.copyOf( Lists.transform( graphiteEmitterConfig.getRequestLogEmitters(), requestLogEmitterName -> { return injector.getInstance(Key.get(Emitter.class, Names.named(requestLogEmitterName))); } ) ); return new GraphiteEmitter(graphiteEmitterConfig, emitters, requestLogEmitters); }
Source:
<code>public static Set<Symbol> extractWindowFunctionUnique(WindowNode.Function function) { ImmutableSet.Builder<Symbol> builder = ImmutableSet.builder(); for (RowExpression argument : function.getFunctionCall().getArguments()) { if (isExpression(argument)) { builder.addAll(SymbolsExtractor.extractAll(castToExpression(argument))); } else { <START> builder.addAll(SymbolsExtractor.extractAll(argument).stream().map(variable -> new Symbol(variable.getName())).collect(toSet())); <END> } } return builder.build(); }</code><technical_language>I guess this matter toImmutableSet consistent</technical_language>

Target:
public static Set<Symbol> extractWindowFunctionUnique(WindowNode.Function function) { ImmutableSet.Builder<Symbol> builder = ImmutableSet.builder(); for (RowExpression argument : function.getFunctionCall().getArguments()) { if (isExpression(argument)) { builder.addAll(SymbolsExtractor.extractAll(castToExpression(argument))); } else { builder.addAll(SymbolsExtractor.extractAll(argument).stream().map(variable -> new Symbol(variable.getName())).collect(toImmutableSet())); } } return builder.build(); }
Source:
<code>public JSONObject getContainerStackTrace(@PathParam("containerId") String containerId) throws Exception { init(); if (containerId.equals(System.getenv(ApplicationConstants.Environment.CONTAINER_ID.toString()))) { <START> return new JSONObject(StackTrace.getJsonFormat()); <END> } StreamingContainerAgent sca = dagManager.getContainerAgent(containerId); if (sca == null) { throw new NotFoundException(); } if (!sca.getContainerInfo().state.equals("ACTIVE")) { throw new RuntimeException("Container is not active"); } int timeOut = 1000; for (int i = 0; i < 10; ++i) { String result = sca.getStackTrace(); if (result != null) { return new JSONObject(result); } Thread.sleep(timeOut); } throw new TimeoutException("Not able to get the stack trace"); }</code><technical_language>save parsing of JSON if getJsonFormat() returns a JSONObject</technical_language>

Target:
public JSONObject getContainerStackTrace(@PathParam("containerId") String containerId) throws Exception { init(); if (containerId.equals(System.getenv(ApplicationConstants.Environment.CONTAINER_ID.toString()))) { return StramUtils.getStackTrace(); } StreamingContainerAgent sca = dagManager.getContainerAgent(containerId); if (sca == null) { throw new NotFoundException("Container not found."); } if (!sca.getContainerInfo().state.equals("ACTIVE")) { throw new NotFoundException("Container is not active."); } for (int i = 0; i < STACK_TRACE_ATTEMPTS; ++i) { String result = sca.getStackTrace(); if (result != null) { return new JSONObject(result); } Thread.sleep(STACK_TRACE_WAIT_TIME); } throw new TimeoutException("Not able to get the stack trace"); }
Source:
<code>protected String findAutodiscoverHostFromSrv(String domain) throws XMLStreamException, IOException { String domainToMatch = AutoDiscoverSrvPrefix + domain; DnsSrvRecord dnsSrvRecord = this .findBestMatchingSrvRecord(domainToMatch); if ((dnsSrvRecord == null) || dnsSrvRecord.getNameTarget() == null || dnsSrvRecord.getNameTarget().isEmpty()) { this.service.traceMessage(TraceFlags.AutodiscoverConfiguration, "No appropriate SRV record was found."); return null; } else { String hostName = dnsSrvRecord.getNameTarget(); <START> if (hostName.length() > 0 && hostName.charAt(hostName.length()-1)=='.') { <END> hostName = hostName.substring(0, hostName.length()-1); } this.service.traceMessage(TraceFlags.AutodiscoverConfiguration, String.format("DNS query for SRV record for domain %s found %s", domain, hostName)); return hostName; } }</code><technical_language>please StringUtils.endsWith(.., ..) clearer</technical_language>

Target:
protected String findAutodiscoverHostFromSrv(String domain) throws XMLStreamException, IOException { String domainToMatch = AutoDiscoverSrvPrefix + domain; DnsSrvRecord dnsSrvRecord = this .findBestMatchingSrvRecord(domainToMatch); if (dnsSrvRecord != null) { String hostName = extractHostnameFromDnsSrv(dnsSrvRecord.getNameTarget()); if (hostName != null) { this.service.traceMessage(TraceFlags.AutodiscoverConfiguration, String .format("DNS query for SRV record for domain %s found %s", domain, hostName)); return hostName; } } this.service.traceMessage(TraceFlags.AutodiscoverConfiguration, "No appropriate SRV record was found."); return null; }
Source:
<code>public void testLiveQueryDelay() throws CouchbaseLiteException, InterruptedException { final Query query = QueryBuilder .select(SelectResult.expression(Meta.id)) .from(DataSource.database(db)) .where(Expression.property("number1").greaterThanOrEqualTo(Expression.intValue(0))) .orderBy(Ordering.property("number1").ascending()); latch1 = new CountDownLatch(2); ListenerToken token = query.addChangeListener(executor, change -> { latch1.countDown(); }); createDocNumbered(12); createDocNumbered(13); createDocNumbered(14); createDocNumbered(15); createDocNumbered(16); <START> latch1.await(5, TimeUnit.SECONDS); <END> query.removeChangeListener(token); }</code><technical_language>Do need assertTrue here</technical_language>

Target:
public void testLiveQueryDelay() throws CouchbaseLiteException, InterruptedException { final Query query = QueryBuilder .select(SelectResult.expression(Meta.id)) .from(DataSource.database(db)) .where(Expression.property("number1").greaterThanOrEqualTo(Expression.intValue(0))) .orderBy(Ordering.property("number1").ascending()); latch1 = new CountDownLatch(2); ListenerToken token = query.addChangeListener(executor, change -> { latch1.countDown(); }); createDocNumbered(12); createDocNumbered(13); createDocNumbered(14); createDocNumbered(15); createDocNumbered(16); assertTrue(latch1.await(5, TimeUnit.SECONDS)); query.removeChangeListener(token); }
Source:
<code>public boolean canMine(Material type) { <START> return type.name().endsWith("_ORE") || (canMineAncientDebris.getValue() && type == Material.ANCIENT_DEBRIS); <END> }</code><technical_language>a small micro-optimization here: If swap ItemSetting Material check, this statement execute a tiny bit quicker Enum comparisons sped compiler. Other this is good go</technical_language>

Target:
public boolean canMine(Material type) { return type.name().endsWith("_ORE") || (type == Material.ANCIENT_DEBRIS && canMineAncientDebris.getValue()); }
Source:
<code>public Coordinate getLatestReleaseOf(final CoordinateBuilder coord) { List<Coordinate> availableVersions = depsResolver.resolveVersions(DependencyQueryBuilder.create(coord)); for(int i = availableVersions.size()-1; i >= 0; i--) { Coordinate availableCoord = availableVersions.get(i); String versionStr = availableCoord.getVersion() == null ? "" : availableCoord.getVersion(); <START> <END> if(!availableCoord.isSnapshot() && !versionStr.matches(".*CR[0-9]$")) return availableVersions.get(i); } return null; }</code><technical_language>case version null</technical_language>

Target:
public Coordinate getLatestReleaseOf(final CoordinateBuilder coord) { List<Coordinate> availableVersions = depsResolver.resolveVersions(DependencyQueryBuilder.create(coord)); for(int i = availableVersions.size()-1; i >= 0; i--) { Coordinate availableCoord = availableVersions.get(i); String versionStr = availableCoord.getVersion(); if(versionStr != null && !availableCoord.isSnapshot() && !versionStr.matches(".*CR[0-9]$")) return availableCoord; } return null; }
Source:
<code>public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) { if (loader == null || shouldIgnore(className)) { return null; } final ClassReader reader = new ClassReader(classfileBuffer); <START> final ClassWriter writer = new ClassWriter(0); <END> reader.accept(new DefinalizingClassVisitor(writer), 0); return writer.toByteArray(); }</code><technical_language>constant instead "magic" number 0</technical_language>

Target:
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) { if (loader == null || shouldIgnore(className)) { return null; } final ClassReader reader = new ClassReader(classfileBuffer); final ClassWriter writer = new ClassWriter(NO_FLAGS_OR_OPTIONS); reader.accept(new DefinalizingClassVisitor(writer), NO_FLAGS_OR_OPTIONS); return writer.toByteArray(); }
Source:
<code><START> public boolean hasFileTypes() { <END> return getComponentModel().fileTypes != null && getComponentModel().fileTypes.size() > 0; }</code><technical_language>This method name a lot better</technical_language>

Target:
public boolean hasFileTypes() { FileWidgetModel fileWidgetModel = getComponentModel(); return fileWidgetModel.fileTypes != null && fileWidgetModel.fileTypes.size() > 0; }