auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Connection(CustomUIPane pane) { this.pane = pane; this.isError = new SimpleBooleanProperty(false); <START> this.isErrorProperty().addListener((ObservableValue<? extends Boolean> value, Boolean oldValue, Boolean newValue) -> setError(newValue)); <END> }</code><technical_language>Again, change this a method reference</technical_language>

Target:
public Connection(CustomUIPane pane) { this.pane = pane; this.isError = new SimpleBooleanProperty(false); this.isErrorProperty().addListener(this::checkError); }
Source:
<code>private static void loadXmlFile() { XmlUtils.addXmlFile(TmfXmlTestFiles.CONDITION_FILE.getFile()); XmlUtils.addXmlFile(TmfXmlTestFiles.VALID_TIMEGRAPH_VIEW_ELEMENT_FILE.getFile()); <START> File xmlFile = XmlUtils.getXmlFilesPath().addTrailingSeparator().append(TmfXmlTestFiles.VALID_TIMEGRAPH_VIEW_ELEMENT_FILE.getFile().getName()).toFile(); XmlUtils.preloadXmlAnalysesOutput(xmlFile); <END> XmlAnalysisModuleSource.notifyModuleChange(); }</code><technical_language>bugs is worry file path calling this, this be... able call preload File in addXmlFile</technical_language>

Target:
private static void loadXmlFile() { XmlUtils.addXmlFile(TmfXmlTestFiles.CONDITION_FILE.getFile()); XmlUtils.addXmlFile(TmfXmlTestFiles.VALID_TIMEGRAPH_VIEW_ELEMENT_FILE.getFile()); XmlAnalysisModuleSource.notifyModuleChange(); }
Source:
<code>private void publishMood(MoodElement moodElement) throws SmackException.NotLoggedInException, InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException { <START> if (!connection().isAuthenticated()) { <END> throw new SmackException.NotLoggedInException(); } PubSubManager pubSubManager = PubSubManager.getInstance(connection(), connection().getUser().asBareJid()); LeafNode node = pubSubManager.getOrCreateLeafNode(MOOD_NODE); node.publish(new PayloadItem<>(moodElement)); }</code><technical_language>Manager class provides getAuthenticatedConnectionOrThrow() for this case</technical_language>

Target:
private void publishMood(MoodElement moodElement) throws SmackException.NotLoggedInException, InterruptedException, PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException { if (pubSubManager == null) { pubSubManager = PubSubManager.getInstance(getAuthenticatedConnectionOrThrow(), connection().getUser().asBareJid()); } LeafNode node = pubSubManager.getOrCreateLeafNode(MOOD_NODE); node.publish(new PayloadItem<>(moodElement)); }
Source:
<code>public static CoordinateReferenceSystem get( String href ) { if ( CoordinateReferenceSystem.WGS84.href.equals( href ) ) { return CoordinateReferenceSystem.WGS84; } else if ( CoordinateReferenceSystem.Cartesian.href.equals( href ) ) { return CoordinateReferenceSystem.Cartesian; } else { <START> throw new UnsupportedOperationException( "Unknown CRS: " + href ); <END> } }</code><technical_language>more illegal argument</technical_language>

Target:
public static CoordinateReferenceSystem get( String href ) { if ( CoordinateReferenceSystem.WGS84.href.equals( href ) ) { return CoordinateReferenceSystem.WGS84; } else if ( CoordinateReferenceSystem.Cartesian.href.equals( href ) ) { return CoordinateReferenceSystem.Cartesian; } else { throw new IllegalArgumentException( "Unknown CRS: " + href ); } }
Source:
<code>public List<String> bulkIndex(final List<Map.Entry<IndexSet, Message>> messageList, boolean isSystemTraffic) { if (messageList.isEmpty()) { return Collections.emptyList(); } final List<IndexingRequest> indexingRequestList = messageList.stream() .map(entry -> IndexingRequest.create(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); final List<IndexFailure> indexFailures = messagesAdapter.bulkIndex(indexingRequestList); final Set<String> failedIds = indexFailures.stream().map(IndexFailure::letterId).collect(Collectors.toSet()); <START> final List<IndexingRequest> successfullRequests = indexingRequestList.stream() <END> .filter(indexingRequest -> !failedIds.contains(indexingRequest.message().getId())) .collect(Collectors.toList()); recordTimestamp(successfullRequests); accountTotalMessageSizes(indexingRequestList, isSystemTraffic); return propagateFailure(indexFailures); }</code><technical_language>IntelliJ this is a typo renamed successfulRequests l. I blindly</technical_language>

Target:
public List<String> bulkIndex(final List<Map.Entry<IndexSet, Message>> messageList, boolean isSystemTraffic) { if (messageList.isEmpty()) { return Collections.emptyList(); } final List<IndexingRequest> indexingRequestList = messageList.stream() .map(entry -> IndexingRequest.create(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); final List<IndexFailure> indexFailures = messagesAdapter.bulkIndex(indexingRequestList); final Set<String> failedIds = indexFailures.stream().map(IndexFailure::letterId).collect(Collectors.toSet()); final List<IndexingRequest> successfulRequests = indexingRequestList.stream() .filter(indexingRequest -> !failedIds.contains(indexingRequest.message().getId())) .collect(Collectors.toList()); recordTimestamp(successfulRequests); accountTotalMessageSizes(indexingRequestList, isSystemTraffic); return propagateFailure(indexFailures); }
Source:
<code>protected boolean executeAnalysis(@NonNull IProgressMonitor monitor) throws TmfAnalysisException { ITmfTrace trace = getTrace(); if (trace == null) { initialize(false); return false; } <START> IStatus status1 = fSegmentStoreModule.schedule(); <END> IStatus status2 = fStateSystemModule.schedule(); if (!(status1.isOK() && status2.isOK())) { cancelSubAnalyses(); initialize(false); return false; } if (!fStateSystemModule.waitForInitialization()) { initialize(false); return false; } ITmfStateSystem stateSystem = fStateSystemModule.getStateSystem(); if (stateSystem == null) { initialize(false); return false; } initialize(true); if (!(fStateSystemModule.waitForCompletion(monitor) && fSegmentStoreModule.waitForCompletion(monitor))) { return false; } return true; }</code><technical_language>segmentStoreStatus</technical_language>

Target:
protected boolean executeAnalysis(@NonNull IProgressMonitor monitor) throws TmfAnalysisException { ITmfTrace trace = getTrace(); if (trace == null) { initialize(false); return false; } IStatus segmentStoreStatus = fSegmentStoreModule.schedule(); IStatus stateSystemStatus = fStateSystemModule.schedule(); if (!(segmentStoreStatus.isOK() && stateSystemStatus.isOK())) { cancelSubAnalyses(); initialize(false); return false; } if (!fStateSystemModule.waitForInitialization()) { initialize(false); return false; } ITmfStateSystem stateSystem = fStateSystemModule.getStateSystem(); if (stateSystem == null) { initialize(false); return false; } initialize(true); return fStateSystemModule.waitForCompletion(monitor) && fSegmentStoreModule.waitForCompletion(monitor); }
Source:
<code>private static SessionFactory getSessionFactory() { if (sessionFactory == null) { try { registry = new StandardServiceRegistryBuilder().configure().build(); MetadataSources sources = new MetadataSources(registry); Metadata metadata = sources.getMetadataBuilder().build(); sessionFactory = metadata.getSessionFactoryBuilder().build(); } catch (RuntimeException e) { logger.error( <START> "Probably you have forgotten to adjust your Hibernate configuration! Error: " + e.getMessage(), e); <END> shutdown(); } } return sessionFactory; }</code><technical_language>RuntimeException based exception is fetched kind of error raised this exception class. error reason adjusted Hibernate configuration. logged message misleading more confusing</technical_language>

Target:
private static SessionFactory getSessionFactory() { if (Objects.isNull(sessionFactory)) { try { registry = new StandardServiceRegistryBuilder().configure().build(); MetadataSources sources = new MetadataSources(registry); Metadata metadata = sources.getMetadataBuilder().build(); sessionFactory = metadata.getSessionFactoryBuilder().build(); } catch (RuntimeException e) { shutdown(); throw new RuntimeException(e.getMessage(), e); } } return sessionFactory; }
Source:
<code>private static void updateDescription(@NonNull final I_I_BankStatement importRecord) { final String lineDescription = Joiner.on(" / ") .skipNulls() <START> .join(importRecord.getLineDescription(), <END> importRecord.getLineDescriptionExtra_1(), importRecord.getLineDescriptionExtra_2(), importRecord.getLineDescriptionExtra_3(), importRecord.getLineDescriptionExtra_4()); importRecord.setLineDescription(lineDescription); }</code><technical_language>de.metas.util.StringUtils#trimBlankToNull of of list descriptions parts. i.e. .join( StringUtils.trimBlankToNull(importRecord.getLineDescription()), StringUtils.trimBlankToNull(importRecord.getLineDescriptionExtra_1()), .... );</technical_language>

Target:
private static void updateDescription(@NonNull final I_I_BankStatement importRecord) { final String lineDescription = Joiner.on(" / ") .skipNulls() .join(StringUtils.trimBlankToNull(importRecord.getLineDescription()), StringUtils.trimBlankToNull(importRecord.getLineDescriptionExtra_1()), StringUtils.trimBlankToNull(importRecord.getLineDescriptionExtra_2()), StringUtils.trimBlankToNull(importRecord.getLineDescriptionExtra_3()), StringUtils.trimBlankToNull(importRecord.getLineDescriptionExtra_4())); importRecord.setLineDescription(lineDescription); }
Source:
<code>public static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex) { Attribute ownIdAttr = entityType.getOwnIdAttribute(); if (ownIdAttr != null && ownIdAttr.isVisible()) { ownIdAttr.setLookupAttributeIndex(lookupAttributeIndex); lookupAttributeIndex++; } Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null && ownIdAttr != null && !ownIdAttr.getName().equals(ownLabelAttr.getName())) { ownLabelAttr.setLookupAttributeIndex(lookupAttributeIndex); <START> lookupAttributeIndex++; <END> } }</code><technical_language>Sonar reports error this line: - Remove this useless assignment local variable "lookupAttributeIndex"</technical_language>

Target:
public static void setDefaultLookupAttributes(EntityType entityType, int lookupAttributeIndex) { Attribute ownIdAttr = entityType.getOwnIdAttribute(); if (ownIdAttr != null && ownIdAttr.isVisible()) { ownIdAttr.setLookupAttributeIndex(lookupAttributeIndex); lookupAttributeIndex++; } Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null && ownIdAttr != null && !ownIdAttr.getName().equals(ownLabelAttr.getName())) { ownLabelAttr.setLookupAttributeIndex(lookupAttributeIndex); } }
Source:
<code>public List<String> getPanelNames() { List<String> openPanelNames = new ArrayList<>(); for (int i = 0; i < openPanels.size(); i++) { openPanelNames.add(openPanels.get(i).getPanelName()); } return openPanelNames; <START> } <END></code><technical_language>methods unnecessary. a get PanelInfo. in tests, map in tests instead</technical_language>

Target:
public List<String> getPanelNames() { return lastSessionPanels.stream().map(PanelInfo::getPanelName).collect(Collectors.toList()); }
Source:
<code>private static LinearRing toJtsLinearRing(List<GeoPoint> geoPoints, boolean counterClockwise, boolean lenient) { if (geoPoints.size() < 4) { throw new VertexiumException("A polygon must specify at least 4 points for each boundary and hole."); } <START> <END> Coordinate[] shellCoordinates = geoPoints.stream() .map(geoPoint -> new Coordinate(geoPoint.getLongitude(), geoPoint.getLatitude())) .toArray(Coordinate[]::new); if (!shellCoordinates[0].equals(shellCoordinates[shellCoordinates.length - 1])) { if (lenient) { LOGGER.info("Closing an unclosed GeoShape by appending the beginning coordinate"); shellCoordinates = org.apache.commons.lang3.ArrayUtils.add(shellCoordinates, shellCoordinates[0].copy()); } else { throw new VertexiumException("All polygon boundaries and holes must begin and end at the same point."); } } if (Orientation.isCCW(shellCoordinates) != counterClockwise) { if (lenient) { LOGGER.info("Reversing the coordinates of a ring that has a backwards orientation"); ArrayUtils.reverse(shellCoordinates); } else { throw new VertexiumException("The outer shell of a polygon must be specified in counter-clockwise " + "orientation and all holes must be specified in the clockwise direction."); } } return GEOMETRY_FACTORY.createLinearRing(shellCoordinates); }</code><technical_language>this else if change else if if. I personally if return statements inside</technical_language>

Target:
private static LinearRing toJtsLinearRing(List<GeoPoint> geoPoints, boolean counterClockwise, boolean lenient) { if (geoPoints.size() < 4) { throw new VertexiumInvalidShapeException("A polygon must specify at least 4 points for each boundary and hole."); } Coordinate[] shellCoordinates = geoPoints.stream() .map(geoPoint -> new Coordinate(geoPoint.getLongitude(), geoPoint.getLatitude())) .toArray(Coordinate[]::new); if (!shellCoordinates[0].equals(shellCoordinates[shellCoordinates.length - 1])) { if (lenient) { LOGGER.info("Closing an unclosed GeoShape by appending the beginning coordinate"); shellCoordinates = org.apache.commons.lang3.ArrayUtils.add(shellCoordinates, shellCoordinates[0].copy()); } else { throw new VertexiumInvalidShapeException("All polygon boundaries and holes must begin and end at the same point."); } } if (Orientation.isCCW(shellCoordinates) != counterClockwise) { if (lenient) { LOGGER.info("Reversing the coordinates of a ring that has a backwards orientation"); ArrayUtils.reverse(shellCoordinates); } else { throw new VertexiumInvalidShapeException("The outer shell of a polygon must be specified in counter-clockwise " + "orientation and all holes must be specified in the clockwise direction."); } } return GEOMETRY_FACTORY.createLinearRing(shellCoordinates); }
Source:
<code>private double getClassMembersCount(int numClasses, List<Double> breaks, double[] arClassMembers, HistogramClassification.Bucket b) { int bucketCount = b.getCount(); double assignedElements = 0.0; for (int i = 0; i < numClasses; i++) { double current = breaks.get(i); double next = breaks.get(i + 1); <START> boolean last = i + 1 == numClasses; <END> Double overlapping; if (last) { overlapping = getOverlappingPercentages(current, next, b.getMin(), b.getMax()); } else { overlapping = getOverlappingPercentages(current, Math.nextDown(next), b.getMin(), b.getMax()); } if (overlapping.doubleValue() == 1.0 || overlapping.equals(NaN)) { arClassMembers[i] += bucketCount; assignedElements = bucketCount; } else if (overlapping.doubleValue() == 0.0) { arClassMembers[i] += 0.0; } else { double classMembers = overlapping * bucketCount; arClassMembers[i] += classMembers; assignedElements += classMembers; } } return bucketCount - assignedElements; }</code><technical_language>guessing this NaN out of buckets min==max? NaN out of operations, getOverlappingPercentages (we a guess)... more readable if getOverlappingPercentages returns a valid, below</technical_language>

Target:
private void getClassMembersCount(int numClasses, List<Double> breaks, double[] arClassMembers, HistogramClassification.Bucket b) { int bucketCount = b.getCount(); for (int i = 0; i < numClasses; i++) { double current = breaks.get(i); double next = breaks.get(i + 1); boolean last = i + 1 == numClasses; Double overlapping; if (last) { overlapping = getOverlappingPercentages(current, next, b.getMin(), b.getMax()); } else { overlapping = getOverlappingPercentages(current, Math.nextDown(next), b.getMin(), b.getMax()); } if (overlapping.doubleValue() == 1.0) { arClassMembers[i] += bucketCount; } else if (overlapping.doubleValue() == 0.0) { arClassMembers[i] += 0.0; } else { double classMembers = overlapping * bucketCount; arClassMembers[i] += classMembers; } } }
Source:
<code><START> public void onScreenLoad(ScreenLoadEvent event) { <END> if (event.getScreen().getToken().equals(getTargetHistoryToken())){ Gerrit.currentMenu = null; addStyleName(Gerrit.RESOURCES.css().activeRow()); } else { removeStyleName(Gerrit.RESOURCES.css().activeRow()); } }</code><technical_language>good idea is this event setup coloring. menu item is listening current screen event event bus. If current screen matches menu item, automatically select parent menu color menu item. End of story. This magically work for user configures in (ignoring pagination). Projects a bit more fuzzy. Projects > List work. other tabs work trivially. do they? tabs (Info, Access) anchor names for current project? In case "just work". Project dashboards fuzzy one. kind of want Projects > Dashboards selected in this case. override this method menu item do a more wildcard matching token</technical_language>

Target:
public void onScreenLoad(ScreenLoadEvent event) { if (match(event.getScreen().getToken())) { Gerrit.selectMenu(bar); addStyleName(Gerrit.RESOURCES.css().activeRow()); } else { removeStyleName(Gerrit.RESOURCES.css().activeRow()); } }
Source:
<code>public void testConvertToDataModelTypeWithoutStats() { file.getSamplesData().clear(); List<String> sampleNames = null; <START> uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantSourceEntryConverter converter = new uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantSourceEntryConverter( <END> VariantStorageManager.IncludeSrc.FULL, new DBObjectToSamplesConverter(sampleNames)); VariantSourceEntry converted = converter.convert(mongoFile); assertEquals(file, converted); converter = new uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantSourceEntryConverter( VariantStorageManager.IncludeSrc.FULL, new DBObjectToSamplesConverter(sampleNames)); converted = converter.convert(mongoFile); assertEquals(file, converted); }</code><technical_language>Full qualification needed</technical_language>

Target:
public void testConvertToDataModelTypeWithoutStats() { file.getSamplesData().clear(); List<String> sampleNames = new ArrayList<String>(); DBObjectToVariantSourceEntryConverter converter = new DBObjectToVariantSourceEntryConverter( new DBObjectToSamplesConverter(sampleNames)); VariantSourceEntry converted = converter.convert(mongoFile); assertEquals(file, converted); converter = new DBObjectToVariantSourceEntryConverter( new DBObjectToSamplesConverter(sampleNames)); converted = converter.convert(mongoFile); assertEquals(file, converted); }
Source:
<code>private void initStreamLogDirectory() { try { if (!logDir.toFile().exists()) { Files.createDirectories(logDir); } String corfuDir = logDir.getParent().toString(); FileStore fs = Files.getFileStore(Paths.get(corfuDir)); if (fs.isReadOnly()) { throw new IllegalArgumentException("Cannot start Corfu on a read-only filesystem:" +corfuDir); } <START> if (logSizeLimit != Long.MAX_VALUE && logSizeLimit > fs.getTotalSpace()) { <END> String msg = String.format("Invalid quota: quota(%d) is greater than the file store size (%d)", logSizeLimit, fs.getTotalSpace()); throw new IllegalArgumentException(msg); } File corfuDirFile = new File(corfuDir); if (!corfuDirFile.canWrite()) { throw new IllegalArgumentException("Corfu directory is not writable " + corfuDir); } File logDirectory = new File(logDir.toString()); if (!logDirectory.canWrite()) { throw new IllegalArgumentException("Stream log directory not writable in "+corfuDir); } } catch (IOException ioe) { throw new LogUnitException(ioe); } log.info("initStreamLogDirectory: initialized {}", logDir); }</code><technical_language>this if a node is quota for some reason restarts, ? this a cluster restart get blocked</technical_language>

Target:
private void initStreamLogDirectory() { try { if (!logDir.toFile().exists()) { Files.createDirectories(logDir); } String corfuDir = logDir.getParent().toString(); FileStore corfuDirBackend = Files.getFileStore(Paths.get(corfuDir)); if (corfuDirBackend.isReadOnly()) { throw new LogUnitException("Cannot start Corfu on a read-only filesystem:" + corfuDir); } if (logSizeLimit != -1 && logSizeLimit > corfuDirBackend.getTotalSpace()) { String msg = String.format("Invalid quota: quota(%d) is greater than the file store size (%d)", logSizeLimit, corfuDirBackend.getTotalSpace()); throw new LogUnitException(msg); } File corfuDirFile = new File(corfuDir); if (!corfuDirFile.canWrite()) { throw new LogUnitException("Corfu directory is not writable " + corfuDir); } File logDirectory = new File(logDir.toString()); if (!logDirectory.canWrite()) { throw new LogUnitException("Stream log directory not writable in " + corfuDir); } } catch (IOException ioe) { throw new LogUnitException(ioe); } log.info("initStreamLogDirectory: initialized {}", logDir); }
Source:
<code>public void run() { if (isInterruptedOrCanceled(monitor)) { return; } final Resource resource = resourceSet.loadResource(uri); Diagnostic resourceDiagnostic = EcoreUtil.computeDiagnostic(resource, true); if (resourceDiagnostic.getSeverity() >= Diagnostic.WARNING) { safeMergeDiagnostic(resourceDiagnostic); } if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final Set<URI> crossReferencedResources = resourceSet.discoverCrossReferences(resource, monitor); for (URI crossRef : crossReferencedResources) { <START> if (Thread.currentThread().isInterrupted() || monitor.isCanceled()) { <END> break; } demandRemoteResolve(resourceSet, crossRef, monitor); } } demandUnload(resourceSet, resource, monitor); }</code><technical_language>"isInterruptedOrCanceled"</technical_language>

Target:
public void run() { if (isInterruptedOrCanceled(monitor)) { demandResolvingAndUnloadingPoolShutdown(); return; } final Resource resource = resourceSet.loadResource(uri); Diagnostic resourceDiagnostic = EcoreUtil.computeDiagnostic(resource, true); if (resourceDiagnostic.getSeverity() >= Diagnostic.WARNING) { safeMergeDiagnostic(resourceDiagnostic); } if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final Set<URI> crossReferencedResources = resourceSet.discoverCrossReferences(resource, monitor); for (URI crossRef : crossReferencedResources) { if (isInterruptedOrCanceled(monitor)) { demandResolvingAndUnloadingPoolShutdown(); break; } demandRemoteResolve(resourceSet, crossRef, monitor); } } demandUnload(resourceSet, resource, monitor); }
Source:
<code><START> public BalanceTopImpl getBalanceTop() { <END> return balanceTop; }</code><technical_language>return BalanceTop people Essentials import API class impl</technical_language>

Target:
public BalanceTop getBalanceTop() { return balanceTop; }
Source:
<code>private static boolean attemptToCreateKeyspaceOnHost(InetSocketAddress host, CassandraKeyValueServiceConfig config) throws TException { try { CassandraClient client = CassandraClientFactory.getClientInternal(host, config); KsDef ksDef = createKsDefForFresh(client, config); client.system_add_keyspace(ksDef); <START> log.info("Created keyspace: {}", UnsafeArg.of("keyspace", config.getKeyspaceOrThrow())); <END> CassandraKeyValueServices.waitForSchemaVersions( config, client, "(adding the initial empty keyspace)", true); return true; } catch (InvalidRequestException e) { return keyspaceAlreadyExists(host, config); } }</code><technical_language>keyspace (which is necessarily a part of Atlas config) safe</technical_language>

Target:
private static boolean attemptToCreateKeyspaceOnHost(InetSocketAddress host, CassandraKeyValueServiceConfig config) throws TException { try { CassandraClient client = CassandraClientFactory.getClientInternal(host, config); KsDef ksDef = createKsDefForFresh(client, config); client.system_add_keyspace(ksDef); log.info("Created keyspace: {}", SafeArg.of("keyspace", config.getKeyspaceOrThrow())); CassandraKeyValueServices.waitForSchemaVersions( config, client, "(adding the initial empty keyspace)", true); return true; } catch (InvalidRequestException e) { return keyspaceAlreadyExists(host, config); } }
Source:
<code>@Override public <T> Collection<T> services(String name) { if (!enterBusy()) return null; try { ctx.security().authorize(name, SecurityPermission.SERVICE_INVOKE, null); Collection<ServiceContextImpl> ctxs = serviceContexts(name); <START> if (F.isEmpty(ctxs)) <END> return null; Collection<T> res = new ArrayList<>(ctxs.size()); synchronized (ctxs) { for (ServiceContextImpl ctx : ctxs) { Service srvc = ctx.service(); if (srvc != null) res.add((T)srvc); } } return res; } finally { leaveBusy(); } }</code><technical_language>Missing synchronization. 3 lines bellow</technical_language>

Target:
@Override public <T> Collection<T> services(String name) { if (!enterBusy()) return null; try { ctx.security().authorize(name, SecurityPermission.SERVICE_INVOKE, null); Collection<ServiceContextImpl> ctxs = serviceContexts(name); if (ctxs == null) return null; synchronized (ctxs) { if (F.isEmpty(ctxs)) return null; Collection<T> res = new ArrayList<>(ctxs.size()); for (ServiceContextImpl ctx : ctxs) { Service srvc = ctx.service(); if (srvc != null) res.add((T)srvc); } return res; } } finally { leaveBusy(); } }
Source:
<code>public void init() throws SlickException { if (!initialized) { this.map.init(); initialized = true; try { float moveSpeed = 16.0F; Vector2D viewPortDrawingPosition = Vector2D.zero(); final Viewport newViewport; newViewport = new Viewport(Game.SCREEN_WIDTH, Game.SCREEN_HEIGHT, this.map); DrawableViewPort drawableViewPort = new DrawableViewPort(newViewport, viewPortDrawingPosition, Vector2D.zero(), graphics, moveSpeed); input.addMouseListener(new DrawableViewPortMoverListener(drawableViewPort)); drawableViewPorts.add(drawableViewPort); } catch (SlickException e) { <START> throw new IllegalStateException("Unable to create new viewport!"); <END> } } }</code><technical_language>forgot add original exception newly thrown exception</technical_language>

Target:
public void init() throws SlickException { if (!initialized) { this.map.init(); initialized = true; try { float moveSpeed = 16.0F; Vector2D viewportDrawingPosition = Vector2D.zero(); Viewport viewport = new Viewport(screenResolution, viewportDrawingPosition, Vector2D.zero(), graphics, this.map, moveSpeed); input.addMouseListener(new ViewportMovementListener(viewport, screenResolution)); viewports.add(viewport); } catch (SlickException e) { throw new IllegalStateException("Unable to create new viewport!", e); } } }
Source:
<code>public static boolean isDefault(Message object) { checkNotNull(object); <START> return object.getDefaultInstanceForType().equals(object); <END> }</code><technical_language>Please result variable</technical_language>

Target:
public static boolean isDefault(Message object) { checkNotNull(object); final boolean result = object.getDefaultInstanceForType().equals(object); return result; }
Source:
<code>protected List<Folder> findFoldersByHost(Host host) throws DotHibernateException { List<Folder> folderList= getSubFolders(null, "/", host.getIdentifier(), null); <START> Collections.sort(folderList, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName())); <END> return folderList; }</code><technical_language>I method reference as: Collections.sort(folderList, Folder::getName:: compareToIgnoreCase) try</technical_language>

Target:
protected List<Folder> findFoldersByHost(Host host) throws DotHibernateException { List<Folder> folderList = getSubFolders(null, "/", host.getIdentifier(), null); Collections.sort(folderList, (Folder folder1, Folder folder2) -> folder1.getName() .compareToIgnoreCase(folder2.getName())); return folderList; }
Source:
<code>public CRFetchArtifactTask fetchTaskToCRFetchTask(FetchTask task) { CRFetchArtifactTask fetchTask = new CRFetchArtifactTask( task.getStage().toString(), task.getJob().toString(), task.getSrc()); fetchTask.setDestination(task.getDest()); fetchTask.setPipelineName(task.getPipelineName().toString()); <START> fetchTask.setSourceIsDirectory(task.isSourceAFile()); <END> commonCRTaskMembers(fetchTask, task); return fetchTask; }</code><technical_language>This _seems_ wrong</technical_language>

Target:
private CRFetchArtifactTask fetchTaskToCRFetchTask(FetchTask task) { CRFetchArtifactTask fetchTask = new CRFetchArtifactTask( task.getStage().toString(), task.getJob().toString(), task.getSrc()); fetchTask.setDestination(task.getDest()); fetchTask.setPipelineName(task.getPipelineName().toString()); fetchTask.setSourceIsDirectory(!task.isSourceAFile()); commonCRTaskMembers(fetchTask, task); return fetchTask; }
Source:
<code>public void testNullPartitionValues() { assertUpdate("" + "CREATE TABLE test_null_partition (test VARCHAR, part VARCHAR)\n" + "WITH (partitioned_by = ARRAY['part'])"); assertUpdate("INSERT INTO test_null_partition VALUES ('hello', 'test'), ('world', null)", 2); assertQuery( "SELECT * FROM test_null_partition", "VALUES ('hello', 'test'), ('world', null)"); assertQuery( "SELECT * FROM \"test_null_partition$partitions\"", <START> "VALUES ('test'), (null)"); <END> assertUpdate("DROP TABLE test_null_partition"); }</code><technical_language>( ) braces redundant</technical_language>

Target:
public void testNullPartitionValues() { assertUpdate("" + "CREATE TABLE test_null_partition (test VARCHAR, part VARCHAR)\n" + "WITH (partitioned_by = ARRAY['part'])"); assertUpdate("INSERT INTO test_null_partition VALUES ('hello', 'test'), ('world', null)", 2); assertQuery( "SELECT * FROM test_null_partition", "VALUES ('hello', 'test'), ('world', null)"); assertQuery( "SELECT * FROM \"test_null_partition$partitions\"", "VALUES 'test', null"); assertUpdate("DROP TABLE test_null_partition"); }
Source:
<code>public void createControl(Composite parent) { Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_HORIZONTAL); setControl(comp); <START> SWTFactory.createWrapLabel(comp, "What is your source for this baseline?", 1); END> locationIsDirectory = SWTFactory.createRadioButton(comp, "An existing Eclipse installation directory"); locationIsTarget = SWTFactory.createRadioButton(comp, "A target platform"); locationIsDirectory.setSelection(true); SelectionListener typeListener = new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }; MouseListener mouseClickListener = new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { update(); getContainer().showPage(getNextPage()); } }; locationIsTarget.addSelectionListener(typeListener); locationIsTarget.addMouseListener(mouseClickListener); locationIsDirectory.addSelectionListener(typeListener); locationIsDirectory.addMouseListener(mouseClickListener); update(); PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IApiToolsHelpContextIds.APIPROFILES_WIZARD_PAGE); Dialog.applyDialogFont(comp); }</code><technical_language>externalized - a huge fan of question form. "Select a source for baseline:"</technical_language>

Target:
public void createControl(Composite parent) { Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_HORIZONTAL); setControl(comp); SWTFactory.createWrapLabel(comp, WizardMessages.SelectApiBaselineTypeWizardPage_SelectBaselineSource, 1); locationIsDirectory = SWTFactory.createRadioButton(comp, WizardMessages.SelectApiBaselineTypeWizardPage_SourceInstallationDirectory); locationIsTarget = SWTFactory.createRadioButton(comp, WizardMessages.SelectApiBaselineTypeWizardPage_SourceTargetPlatform); locationIsDirectory.setSelection(true); SelectionListener typeListener = new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }; MouseListener mouseClickListener = new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { update(); getContainer().showPage(getNextPage()); } }; locationIsTarget.addSelectionListener(typeListener); locationIsTarget.addMouseListener(mouseClickListener); locationIsDirectory.addSelectionListener(typeListener); locationIsDirectory.addMouseListener(mouseClickListener); update(); PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IApiToolsHelpContextIds.APIPROFILES_WIZARD_PAGE); Dialog.applyDialogFont(comp); }
Source:
<code>private void addConfigAttributesClasses(ContextConfigurationAttributes configAttributes, Class<?>[] classes) { <START> Set<Class<?>> combined = new HashSet<>(Arrays.asList(classes)); <END> if (configAttributes.getClasses() != null) { combined.addAll(Arrays.asList(configAttributes.getClasses())); } configAttributes.setClasses(ClassUtils.toClassArray(combined)); }</code><technical_language>I if this a LinkedHashSet similar? Assuming ordering is preserved elsewhere, losing switching a HashSet could, in theory, effect beans defined change order in processed refresh</technical_language>

Target:
private void addConfigAttributesClasses(ContextConfigurationAttributes configAttributes, Class<?>[] classes) { Set<Class<?>> combined = new LinkedHashSet<>(Arrays.asList(classes)); if (configAttributes.getClasses() != null) { combined.addAll(Arrays.asList(configAttributes.getClasses())); } configAttributes.setClasses(ClassUtils.toClassArray(combined)); }
Source:
<code>public void canPerformLockAndRefreshLock() throws InterruptedException { <START> lockWithFullResponse(requestForWriteLock(LOCK_A), TEST_CLIENT); <END> LockRefreshToken token = lockWithFullResponse(requestForWriteLock(LOCK_A), TEST_CLIENT).getLockRefreshToken(); Set<LockRefreshToken> lockRefreshTokens = cluster.lockService().refreshLockRefreshTokens( ImmutableList.of(token)); assertThat(lockRefreshTokens).contains(token); }</code><technical_language>Is this line needed</technical_language>

Target:
public void canPerformLockAndRefreshLock() throws InterruptedException { HeldLocksToken token1 = lockWithFullResponse(requestForWriteLock(LOCK_A), TEST_CLIENT); LockRefreshToken token = token1.getLockRefreshToken(); Set<LockRefreshToken> lockRefreshTokens = cluster.lockService().refreshLockRefreshTokens( ImmutableList.of(token)); assertThat(lockRefreshTokens).contains(token); unlock(token1); }
Source:
<code>public Summary gatherDeps(BuildRule root) { if (!(root instanceof JavaLibrary)) { throw new RuntimeException("Boom"); } Set<JavaLibrary> toPackage = new HashSet<>(); Set<HasMavenCoordinates> mavenDeps; toPackage.addAll(((HasClasspathEntries) root).getTransitiveClasspathDeps()); mavenDeps = toPackage.stream() .filter(HasMavenCoordinates::isMavenCoordsPresent) .filter(lib -> !lib.equals(root)) .collect(Collectors.toSet()); for (HasMavenCoordinates mavenDep : mavenDeps) { ImmutableSet<JavaLibrary> transitive = ((HasClasspathEntries) mavenDep).getTransitiveClasspathDeps(); toPackage.removeAll(transitive); mavenDeps.removeAll( transitive.stream() .filter(dep -> !dep.equals(mavenDep)) .collect(Collectors.toSet())); } return new Summary( toPackage, <START> ((HasClasspathEntries) root).getTransitiveClasspathDeps(), <END> mavenDeps); }</code><technical_language>call this twice, extract a variable</technical_language>

Target:
public Summary gatherDeps(BuildRule root) { if (!(root instanceof JavaLibrary)) { throw new HumanReadableException( "Maven jars can only be constructed from java_library targets: %s", root.getFullyQualifiedName()); } Set<JavaLibrary> toPackage = new HashSet<>(); ImmutableSet<JavaLibrary> classpathDeps = ((HasClasspathEntries) root).getTransitiveClasspathDeps(); toPackage.addAll(classpathDeps); Set<HasMavenCoordinates> mavenDeps = toPackage.stream() .filter(HasMavenCoordinates::isMavenCoordsPresent) .filter(lib -> !lib.equals(root)) .collect(Collectors.toSet()); Set<JavaLibrary> toRemoveFromMavenDeps = new HashSet<>(); for (HasMavenCoordinates mavenDep : mavenDeps) { ImmutableSet<JavaLibrary> transitive = ((HasClasspathEntries) mavenDep).getTransitiveClasspathDeps(); toPackage.removeAll(transitive); toRemoveFromMavenDeps.addAll( transitive.stream() .filter(dep -> !dep.equals(mavenDep)) .collect(Collectors.toSet())); } mavenDeps.removeAll(toRemoveFromMavenDeps); return new Summary( toPackage, classpathDeps, mavenDeps); }
Source:
<code>public ColumnFamilyStep row(final CharSequence row) { <START> return row(new Text(row.toString())); <END> }</code><technical_language>nice circumvent creation of Text straight String byte[]. applies other Step interface methods</technical_language>

Target:
public ColumnFamilyStep row(final CharSequence row) { return row(encodeCharSequence(row)); }
Source:
<code>public LearnedConstraint(SymbolicValue sv, @Nullable Constraint constraint) { <START> Objects.requireNonNull(sv); <END> this.sv = sv; this.constraint = constraint; }</code><technical_language>unrelated this commit</technical_language>

Target:
public LearnedConstraint(SymbolicValue sv, @Nullable Constraint constraint) { this.sv = sv; this.constraint = constraint; }
Source:
<code>public long check(final AbstractCloudComputer c) { if (c.isIdle()) { <START> done(c); <END> } return 1; }</code><technical_language>This is bypassing idleMinutes condition previously done in superclass, other benefits, correct. I suspect meant this method java if (c.isIdle() && !disabled) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleMinutes)) { LOGGER.log(LEVEL.FINE, "Disconnecting {0}", c.getName()); done(c); } } return 1; a workaround for fact CloudRetentionStrategy.idleMinutes is private, shadowing field here, extending RetentionStrategy<AbstractCloudComputer> (and inlining super.start)</technical_language>

Target:
public long check(final AbstractCloudComputer c) { if (c.isIdle() && !disabled) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > TimeUnit2.MINUTES.toMillis(idleMinutes)) { LOGGER.log(Level.FINE, "Disconnecting {0}", c.getName()); done(c); } } return 1; }
Source:
<code>public void testDistinctCountPushdown() { PlanNode justScan = buildPlan(planBuilder -> tableScan(planBuilder, pinotTable, regionId, secondsSinceEpoch, city, fare)); <START> PlanNode distinctAggregation = buildPlan(planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(justScan).singleGroupingSet(v("regionid")))); <END> testPQL(planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(distinctAggregation).globalGrouping().addAggregation(v("count_regionid"), getRowExpression("count(regionid)", defaultSessionHolder))), "SELECT DISTINCTCOUNT(regionId) FROM realtimeOnly"); }</code><technical_language>rename function v variable...</technical_language>

Target:
public void testDistinctCountPushdown() { PlanNode justScan = buildPlan(planBuilder -> tableScan(planBuilder, pinotTable, regionId, secondsSinceEpoch, city, fare)); PlanNode distinctAggregation = buildPlan(planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(justScan).singleGroupingSet(variable("regionid")))); testPQL( planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(distinctAggregation).globalGrouping().addAggregation(variable("count_regionid"), getRowExpression("count(regionid)", defaultSessionHolder))), "SELECT DISTINCTCOUNT(regionId) FROM realtimeOnly"); }
Source:
<code>public boolean equals(Object obj) { if (!(obj instanceof Sample)) { return false; } Sample other = (Sample) obj; <START> boolean timestampEquals = true; <END> if ((timestamp != null && other.timestamp == null) || (timestamp == null && other.timestamp != null)) { timestampEquals = false; } if (timestamp != null && other.timestamp != null) { timestampEquals = timestamp.equals(other.timestamp); } return other.name.equals(name) && other.labelNames.equals(labelNames) && other.labelValues.equals(labelValues) && other.value == value && timestampEquals; }</code><technical_language>This is Java 7 java.utils.Objects.equals. This project maintains Java 6 compatibility tidier paste in this method compare member objects this method. static boolean equals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); }</technical_language>

Target:
public boolean equals(Object obj) { if (!(obj instanceof Sample)) { return false; } Sample other = (Sample) obj; return other.name.equals(name) && other.labelNames.equals(labelNames) && other.labelValues.equals(labelValues) && other.value == value && ((timestampMs == null && other.timestampMs == null) || (other.timestampMs != null) && (other.timestampMs.equals(timestampMs))); }
Source:
<code>public void updateCacheWithHostNames() { JGitFileSystemsCache fc = fsManager.getFsCache(); <START> List<JGitFileSystem> jGitFileSystems = fc.getFileSystems().stream() .map(fsName -> ((JGitFileSystemProxy) fsManager.get(fsName)).getRealJGitFileSystem()).collect(Collectors.toList()); <END> for (JGitFileSystem fs : jGitFileSystems) { JGitFileSystemImpl fsImpl = (JGitFileSystemImpl) fs; fs.setPublicURI(fullHostNames); fsManager.replaceFSCacheEntry(fs.getName(), fsImpl); } }</code><technical_language>a suggestion. replace collect() a forEach content of for loop below. This need create a List<JGitFileSystem></technical_language>

Target:
public void updateCacheWithHostNames() { JGitFileSystemsCache fc = fsManager.getFsCache(); fc.getFileSystems() .stream() .map(fsName -> ((JGitFileSystemProxy) fsManager.get(fsName)).getRealJGitFileSystem()) .forEach(fs -> { JGitFileSystemImpl fsImpl = (JGitFileSystemImpl) fs; fs.setPublicURI(fullHostNames); fsManager.updateFSCacheEntry(fs.getName(), fsImpl); }); }
Source:
<code>public static void createAndStart(String keyfile, char[] passphrase, int port, SocialNetwork social, MutablePointers mutable, Args args) { try { String hostname = args.getArg("domain", "localhost"); System.out.println("Starting social network server listening on: " + hostname+":"+port +" proxying to "+social); InetSocketAddress address = new InetSocketAddress(hostname, port); HttpSocialNetworkServer server = new HttpSocialNetworkServer(social, mutable, address); server.start(); } catch (Exception e) { e.printStackTrace(); <START> System.out.println("Couldn't start Corenode server!"); <END> } }</code><technical_language>corenode ref</technical_language>

Target:
public static void createAndStart(String keyfile, char[] passphrase, int port, SocialNetwork social, MutablePointers mutable, Args args) { try { String hostname = args.getArg("domain", "localhost"); System.out.println("Starting social network server listening on: " + hostname+":"+port +" proxying to "+social); InetSocketAddress address = new InetSocketAddress(hostname, port); HttpSocialNetworkServer server = new HttpSocialNetworkServer(social, mutable, address); server.start(); } catch (Exception e) { e.printStackTrace(); System.out.println("Couldn't start Social Network server!"); } }
Source:
<code>private void freeLockForValidationPassedCommands() { for (CommandBase<?> command : getCommands()) { if (command.getReturnValue().isValid()) { command.freeLock(); } } <START> } <END></code><technical_language>stream API? cleaner</technical_language>

Target:
private void freeLockForValidationPassedCommands() { getCommands().stream().filter(command->command.getReturnValue().isValid()).forEach(command->command.freeLock()); }
Source:
<code>public void setUp() throws Exception { Resource instanceResource = new Resource( 1.0, ByteAmount.fromGigabytes(3), ByteAmount.fromGigabytes(1)); Resource requiredResource = new Resource( 5.0, ByteAmount.fromGigabytes(11), ByteAmount.fromGigabytes(5)); Set<InstancePlan> instancesOne = new HashSet<>(); instancesOne.add(new InstancePlan( new InstanceId("exclaim1", 1, 0), instanceResource)); instancesOne.add(new InstancePlan( new InstanceId("exclaim1", 3, 0), instanceResource)); instancesOne.add(new InstancePlan( new InstanceId("word", 5, 0), instanceResource)); containerOnePlan = new ContainerPlan(1, instancesOne, requiredResource); Set<InstancePlan> instancesTwo = new HashSet<>(); instancesTwo.add(new InstancePlan( new InstanceId("exclaim1", 4, 0), instanceResource)); instancesTwo.add(new InstancePlan( new InstanceId("exclaim1", 2, 0), instanceResource)); instancesTwo.add(new InstancePlan( new InstanceId("word", 6, 0), instanceResource)); containerTwoPlan = new ContainerPlan(2, instancesTwo, requiredResource); Set<ContainerPlan> containerPlans = new HashSet<>(); containerPlans.add(containerOnePlan); containerPlans.add(containerTwoPlan); <START> plan = new PackingPlan("A", containerPlans); <END> }</code><technical_language>PackingTestUtils contains test helpers create a test packing plan container plan for need assemble of this manually. instead, extend needed</technical_language>

Target:
public void setUp() throws Exception { final String COMPONENT_A = "exclaim1"; final String COMPONENT_B = "word"; ContainerPlan containerPlanA = PackingTestUtils.testContainerPlan( 1, new Pair<>(COMPONENT_A, 1), new Pair<>(COMPONENT_A, 3), new Pair<>(COMPONENT_B, 5)); ContainerPlan containerPlanB = PackingTestUtils.testContainerPlan( 2, new Pair<>(COMPONENT_A, 2), new Pair<>(COMPONENT_A, 4), new Pair<>(COMPONENT_B, 6)); Set<ContainerPlan> containerPlans = new HashSet<>(); containerPlans.add(containerPlanA); containerPlans.add(containerPlanB); plan = new PackingPlan("A", containerPlans); }
Source:
<code>public Observable<String> searchCategories(String filter, int itemLimit, int offset) { <START> return responseToCategoryName(CategoryInterface.searchCategories(filter.toLowerCase(), itemLimit, offset)); <END> }</code><technical_language>change CategoryClient directly. Change top layer method is passing filter value. In this case fragment</technical_language>

Target:
public Observable<String> searchCategories(String filter, int itemLimit, int offset) { return responseToCategoryName(CategoryInterface.searchCategories(filter, itemLimit, offset)); }
Source:
<code>public LongSumAggregatorFactory( @JsonProperty("name") String name, @JsonProperty("fieldName") final String fieldName ) { <START> Preconditions.checkNotNull(name, "Must have a valid, nonl null aggregator name"); <END> Preconditions.checkNotNull(fieldName, "Must have a valid, non null fieldName"); this.name = name; this.fieldName = fieldName; }</code><technical_language>Typo! C&Pd this you? cheater! :P</technical_language>

Target:
public LongSumAggregatorFactory( @JsonProperty("name") String name, @JsonProperty("fieldName") final String fieldName ) { Preconditions.checkNotNull(name, "Must have a valid, non-null aggregator name"); Preconditions.checkNotNull(fieldName, "Must have a valid, non-null fieldName"); this.name = name; this.fieldName = fieldName; }
Source:
<code>public void putRecord(Data key, Record record) { markRecordStoreExpirable(record.getTtl()); storage.put(key, record); <START> mutationObserver.onPutRecord(key, record); <END> updateStatsOnPut(record.getHits()); }</code><technical_language>this onReplicationPutRecord</technical_language>

Target:
public void putRecord(Data key, Record record) { markRecordStoreExpirable(record.getTtl()); storage.put(key, record); mutationObserver.onReplicationPutRecord(key, record); updateStatsOnPut(record.getHits()); }
Source:
<code>public List<RemoteSiteConfiguration> getRemoteSites() { List<RemoteSiteConfiguration> list = new ArrayList<>(); <START> for (ValueDependency<RemoteSiteConfiguration> site : this.sites) { <END> RemoteSiteConfiguration value = site.getValue(); list.add(value); } return list; }</code><technical_language>ArrayList constructed fixed capacity</technical_language>

Target:
public List<RemoteSiteConfiguration> getRemoteSites() { List<RemoteSiteConfiguration> list = new ArrayList<>(this.sites.size()); for (ValueDependency<RemoteSiteConfiguration> site : this.sites) { RemoteSiteConfiguration value = site.getValue(); list.add(value); } return list; }