auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static TripsConfig initTripsConfig() { return new TripsConfig( config.getLong("report.trip.minimalTripDistance", 500), config.getLong("report.trip.minimalTripDuration", 300) * 1000, config.getLong("report.trip.minimalParkingDuration", 300) * 1000, config.getLong("report.trip.minimalNoDataDuration", 3600) * 1000, config.getBoolean("report.trip.useIgnition"), <START> config.getBoolean("event.motion.processInvalidPositions")); <END> }</code><technical_language>rename report.trip. consistent other parameters</technical_language>

Target:
public static TripsConfig initTripsConfig() { return new TripsConfig( config.getLong("report.trip.minimalTripDistance", 500), config.getLong("report.trip.minimalTripDuration", 300) * 1000, config.getLong("report.trip.minimalParkingDuration", 300) * 1000, config.getLong("report.trip.minimalNoDataDuration", 3600) * 1000, config.getBoolean("report.trip.useIgnition"), config.getBoolean("event.motion.processInvalidPositions"), config.getDouble("event.motion.speedThreshold", 0.01)); }
Source:
<code>public boolean shouldCaptureBuildInfo(@NotNull TaskContext taskContext) { boolean shouldCaptureBuildInfo = false; if (isCaptureBuildInfo()) { shouldCaptureBuildInfo = true; } else { if (isPublishBuildInfo()) { List<? extends TaskDefinition> taskDefinitions = taskContext.getBuildContext().getRuntimeTaskDefinitions(); if (TaskDefinitionHelper.isBuildPublishTaskExists(taskDefinitions)) { shouldCaptureBuildInfo = true; resetPublishBuildInfo(); } } } return shouldCaptureBuildInfo; <START> } <END></code><technical_language>I suggest simplifying code of method to: if (isCaptureBuildInfo()) { return true; } if (isPublishBuildInfo()) { // check if is a publish build info task. if is aggregation List<? extends TaskDefinition> taskDefinitions = taskContext.getBuildContext().getRuntimeTaskDefinitions(); if (TaskDefinitionHelper.isBuildPublishTaskExists(taskDefinitions)) { resetPublishBuildInfo(); return true; } } return false;</technical_language>

Target:
public boolean shouldCaptureBuildInfo(@NotNull TaskContext taskContext) { if (isCaptureBuildInfo()) { return true; } if (isPublishBuildInfo()) { List<? extends TaskDefinition> taskDefinitions = taskContext.getBuildContext().getRuntimeTaskDefinitions(); if (TaskDefinitionHelper.isBuildPublishTaskExists(taskDefinitions)) { resetPublishBuildInfo(); return true; } } return false; }
Source:
<code>public ItemIterator getItems() throws SQLException { String myQuery ="SELECT item.* FROM item, communities2item WHERE " + "item.item_id=communities2item.item_id AND " + "communities2item.community_id= ? " + "AND item.in_archive='1'"; <START> System.out.println(myQuery); <END> TableRowIterator rows = DatabaseManager.queryTable(ourContext, "item", myQuery, getID()); return new ItemIterator(ourContext, rows); }</code><technical_language>This line debugging code removed</technical_language>

Target:
public ItemIterator getItems() throws SQLException { String in_archive = ""; if (DatabaseManager.isOracle() { in_archive = "item.in_archive='1'"; } else { in_archive = "item.in_archive IS TRUE"; } String myQuery ="SELECT item.* FROM item, communities2item WHERE " + "item.item_id=communities2item.item_id AND " + "communities2item.community_id= ? " + "AND " + in_archive; TableRowIterator rows = DatabaseManager.queryTable(ourContext, "item", myQuery, getID()); return new ItemIterator(ourContext, rows); }
Source:
<code>public void setDefaultValues(final Map<String, String> details) { this.protocol = details.get(Params.PROTOCOL.name()) == null ? Protocol.OSPF : Protocol.valueOf(details.get(Params.PROTOCOL.name())); this.ospfArea = details.get(Params.AREA.name()) == null ? "0" : details.get(Params.AREA.name()); this.helloInterval = Short.valueOf(details.get(Params.HELLO_INTERVAL.name()) == null ? "10" : details.get(Params.HELLO_INTERVAL.name())); this.deadInterval = Short.valueOf(details.get(Params.DEAD_INTERVAL.name()) == null ? "40" : details.get(Params.DEAD_INTERVAL.name())); this.retransmitInterval = Short.valueOf(details.get(Params.RETRANSMIT_INTERVAL.name()) == null ? "5" : details.get(Params.RETRANSMIT_INTERVAL.name())); this.transitDelay = Short.valueOf(details.get(Params.TRANSIT_DELAY.name()) == null ? "1" : details.get(Params.TRANSIT_DELAY.name())); this.authentication = details.get(Params.AUTHENTICATION.name()) == null ? Authentication.MD5 : Authentication.valueOf(details.get(Params.AUTHENTICATION.name())); this.password = details.get(Params.PASSWORD.name()) == null ? "" : details.get(Params.PASSWORD.name()); <START> String cidr_list = details.get(Params.SUPER_CIDR.name()) == null ? "200.100.0.0/20" : details.get(Params.SUPER_CIDR.name()); <END> this.superCIDRList = cidr_list.split(","); this.enabled = details.get(Params.ENABLED.name()) == null ? Boolean.FALSE : Boolean.valueOf(details.get(Params.ENABLED.name())); }</code><technical_language>default of 200.100.0.0/2 determined? this configuration a global option</technical_language>

Target:
public void setDefaultValues(final Map<String, String> details) throws BadCIDRException { this.protocol = details.get(Params.PROTOCOL.name()) == null ? Protocol.OSPF : Protocol.valueOf(details.get(Params.PROTOCOL.name())); this.ospfArea = details.get(Params.AREA.name()) == null ? "0" : details.get(Params.AREA.name()); this.helloInterval = Short.valueOf(details.get(Params.HELLO_INTERVAL.name()) == null ? "10" : details.get(Params.HELLO_INTERVAL.name())); this.deadInterval = Short.valueOf(details.get(Params.DEAD_INTERVAL.name()) == null ? "40" : details.get(Params.DEAD_INTERVAL.name())); this.retransmitInterval = Short.valueOf(details.get(Params.RETRANSMIT_INTERVAL.name()) == null ? "5" : details.get(Params.RETRANSMIT_INTERVAL.name())); this.transitDelay = Short.valueOf(details.get(Params.TRANSIT_DELAY.name()) == null ? "1" : details.get(Params.TRANSIT_DELAY.name())); this.authentication = details.get(Params.AUTHENTICATION.name()) == null ? Authentication.MD5 : Authentication.valueOf(details.get(Params.AUTHENTICATION.name())); this.password = details.get(Params.PASSWORD.name()) == null ? "" : details.get(Params.PASSWORD.name()); this.superCIDRList = details.get(Params.SUPER_CIDR.name()) == null ? new CIDR[0] : NetUtils.convertToCIDR(details.get(Params.SUPER_CIDR.name()).split(",")); this.enabled = details.get(Params.ENABLED.name()) == null ? Boolean.FALSE : Boolean.valueOf(details.get(Params.ENABLED.name())); }
Source:
<code>public void tearDown() throws Exception { if (mRef != null) { <START> mRef.removeValue(); <END> } if (mArray != null) { mArray.cleanup(); } }</code><technical_language>do this root of database time else is happening: mref.getRoot().removeValue()</technical_language>

Target:
public void tearDown() throws Exception { if (mRef != null) { mRef.getRoot().removeValue(); } if (mArray != null) { mArray.cleanup(); } }
Source:
<code>protected AbstractArtifactoryConfiguration(String builderContextPrefix, @Nullable String capabilityPrefix) { serverConfigManager = ServerConfigManager.getInstance(); if (administrationConfiguration == null) { administrationConfiguration = (AdministrationConfiguration) ContainerManager.getComponent("administrationConfiguration"); } this.builderContextPrefix = builderContextPrefix; this.capabilityPrefix = capabilityPrefix; <START> this.taskConfiguratorHelper = new TaskConfiguratorHelperImpl(); <END> }</code><technical_language>initialise instance is declared</technical_language>

Target:
protected AbstractArtifactoryConfiguration(String builderContextPrefix, @Nullable String capabilityPrefix) { serverConfigManager = ServerConfigManager.getInstance(); if (administrationConfiguration == null) { administrationConfiguration = (AdministrationConfiguration) ContainerManager.getComponent("administrationConfiguration"); } this.builderContextPrefix = builderContextPrefix; this.capabilityPrefix = capabilityPrefix; }
Source:
<code>public Map<String, Object> getSpecificEventStyle(ITimeEvent event) { if (event instanceof MarkerEvent) { MarkerEvent markerEvent = (MarkerEvent) event; <START> if(markerEvent.getValue() == 1) { <END> Map<String, Object> ret = new HashMap<>(); ret.put(ITimeEventStyleStrings.fillColor(), RGBAUtil.fromRGBA(markerEvent.getColor())); ret.put(ITimeEventStyleStrings.fillStyle(), "diamond"); ret.put(ITimeEventStyleStrings.label(), markerEvent.getLabel()); return ret; } } return super.getSpecificEventStyle(event); }</code><technical_language>remove markerEvent in this patch marker type</technical_language>

Target:
public Map<String, Object> getSpecificEventStyle(ITimeEvent event) { if (event instanceof SpanMarkerEvent) { SpanMarkerEvent markerEvent = (SpanMarkerEvent) event; Map<String, Object> ret = new HashMap<>(); ret.put(ITimeEventStyleStrings.fillColor(), RGBAUtil.fromRGBA(markerEvent.getColor())); String type = markerEvent.getType(); String fillStyle = ITimeEventStyleStrings.symbolStyle(); if (type.contains(ERROR_KIND)) { ret.put(fillStyle, IYAppearance.SymbolStyle.PLUS); } else if (type.contains(ERROR_OBJECT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CROSS); } else if (type.contains(EVENT)) { ret.put(fillStyle, IYAppearance.SymbolStyle.CIRCLE); } else if (type.contains(MESSAGE)) { ret.put(fillStyle, IYAppearance.SymbolStyle.TRIANGLE); } else if (type.contains(STACK)) { ret.put(fillStyle, IYAppearance.SymbolStyle.INVERTED_TRIANGLE); } else { ret.put(fillStyle, IYAppearance.SymbolStyle.DIAMOND); } ret.put(ITimeEventStyleStrings.heightFactor(), 0.5f); ret.put(ITimeEventStyleStrings.label(), markerEvent.getLabel()); return ret; } return super.getSpecificEventStyle(event); }
Source:
<code>public Set<File> findConfigurableLocations(File root, IProgressMonitor monitor) { Set<File> projectFiles = new <START> HashSet<>(); <END> Set<String> visitedDirectories = new HashSet<>(); WizardProjectsImportPage.collectProjectFilesFromDirectory(projectFiles, root, visitedDirectories, true, monitor); Set<File> res = new HashSet<>(); for (File projectFile : projectFiles) { res.add(projectFile.getParentFile()); } return res; }</code><technical_language>I love LinkedHashSet's :-)</technical_language>

Target:
public Set<File> findConfigurableLocations(File root, IProgressMonitor monitor) { Set<File> projectFiles = new LinkedHashSet<>(); Set<String> visitedDirectories = new LinkedHashSet<>(); WizardProjectsImportPage.collectProjectFilesFromDirectory(projectFiles, root, visitedDirectories, true, monitor); Set<File> res = new HashSet<>(); for (File projectFile : projectFiles) { res.add(projectFile.getParentFile()); } return res; }
Source:
<code>protected void onLoad() { if (fetch == null) { RestApi call = ChangeApi.detail(changeId.get()); <START> ChangeList.addOptions(call, EnumSet.of(ListChangesOption.ALL_REVISIONS, <END> ListChangesOption.DOWNLOAD_COMMANDS)); call.get(new AsyncCallback<ChangeInfo>() { @Override public void onSuccess(ChangeInfo result) { fetch = result.revision(revision).fetch(); renderScheme(); } @Override public void onFailure(Throwable caught) { } }); } }</code><technical_language>[optionally] smarter request revisions, if revision request is current one? I.e. if a change 7 ps current ps is 7, in this specific case enouph request ListChangesOption.CURRENT_REVISION. If needs commands for revision 3 currently need revisions. Additional bonus points introduce new request option: ListChangesOption.SPECIFIC_REVISION pass requested revision number a parameter, position in middle of change's pacth set list include revision in response. For projects is unusual 20-40 patch sets change</technical_language>

Target:
protected void onLoad() { if (fetch == null) { RestApi call = ChangeApi.detail(change.legacy_id().get()); ChangeList.addOptions(call, EnumSet.of( revision.equals(change.current_revision()) ? ListChangesOption.CURRENT_REVISION : ListChangesOption.ALL_REVISIONS, ListChangesOption.DOWNLOAD_COMMANDS)); call.get(new AsyncCallback<ChangeInfo>() { @Override public void onSuccess(ChangeInfo result) { fetch = result.revision(revision).fetch(); renderScheme(); } @Override public void onFailure(Throwable caught) { } }); } }
Source:
<code>public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { if (fMembersOrderPreferenceCache == null) { try { fMembersOrderPreferenceCache = fMembersOrderPreferenceCachePromise.getValue(); } catch (InvocationTargetException e) { log(e); <START> e.printStackTrace(); <END> } catch (InterruptedException e) { log(e); e.printStackTrace(); } } return fMembersOrderPreferenceCache; }</code><technical_language>Please remove it</technical_language>

Target:
public synchronized MembersOrderPreferenceCache getMemberOrderPreferenceCache() { if (fMembersOrderPreferenceCache == null) { try { fMembersOrderPreferenceCache = fMembersOrderPreferenceCachePromise.getValue(); } catch (InvocationTargetException e) { log(e); } catch (InterruptedException e) { log(e); } } return fMembersOrderPreferenceCache; }
Source:
<code>public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { if (requestCode == AuthenticationConstants.UIRequest.BROWSER_FLOW) { if (data == null) { Logger.e(TAG, "onActivityResult BROWSER_FLOW data is null.", "", <START> ADALError.ON_ACTIVITY_RESULT_INTENT_NULL); <END> return; } AuthenticationRequestState waitingRequest; final Bundle extras = data.getExtras(); final int requestId = extras.getInt(AuthenticationConstants.Browser.REQUEST_ID); synchronized (mDelegateMap) { waitingRequest = mDelegateMap.get(requestId); } if (waitingRequest != null) { final AcquireTokenRequest acquireTokenRequest = new AcquireTokenRequest(mContext, this, waitingRequest.getAPIEvent()); acquireTokenRequest.onActivityResult(requestCode, resultCode, data); } else { Logger.e(TAG, "onActivityResult did not find waiting request for RequestId:" + requestId, "", ADALError.ON_ACTIVITY_RESULT_INTENT_NULL); } } }</code><technical_language>ah no. duplication here, remove duplicate part AcquireTokenRequest. #Pending</technical_language>

Target:
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { if (requestCode == AuthenticationConstants.UIRequest.BROWSER_FLOW) { if (data == null) { Logger.e(TAG, "onActivityResult BROWSER_FLOW data is null.", "", ADALError.ON_ACTIVITY_RESULT_INTENT_NULL); return; } AuthenticationRequestState waitingRequest; final Bundle extras = data.getExtras(); final int requestId = extras.getInt(AuthenticationConstants.Browser.REQUEST_ID); synchronized (DELEGATE_MAP) { waitingRequest = DELEGATE_MAP.get(requestId); } if (waitingRequest != null) { final AcquireTokenRequest acquireTokenRequest = new AcquireTokenRequest(mContext, this, waitingRequest.getAPIEvent()); acquireTokenRequest.onActivityResult(requestCode, resultCode, data); } else { Logger.e(TAG, "onActivityResult did not find waiting request for RequestId:" + requestId, "", ADALError.ON_ACTIVITY_RESULT_INTENT_NULL); } } }
Source:
<code>protected void saveTableOrdering() { Logger.debug(this, "saveTableOrdering"); <START> ((DraggableEditableCardsAdapter)adapter).saveNewOrder(getTableController()); <END> }</code><technical_language>casting, ensure adapter is a DraggableEditableCardsAdapter defined</technical_language>

Target:
protected void saveTableOrdering() { Logger.debug(this, "saveTableOrdering"); adapter.saveNewOrder(getTableController()); }
Source:
<code>Connection newConnection() throws Exception { Connection connection = null; try { String username = config.getUsername(); String password = config.getPassword(); connection = (username == null) ? dataSource.getConnection() : dataSource.getConnection(username, password); setupConnection(connection); <START> return connection; <END> } catch (Exception e) { lastConnectionFailure.set(e); quietlyCloseConnection(connection, "(exception during connection creation)"); throw e; } }</code><technical_language>this removed</technical_language>

Target:
Connection newConnection() throws Exception { Connection connection = null; try { String username = config.getUsername(); String password = config.getPassword(); connection = (username == null) ? dataSource.getConnection() : dataSource.getConnection(username, password); setupConnection(connection); lastConnectionFailure.set(null); return connection; } catch (Exception e) { lastConnectionFailure.set(e); String reason = e.getMessage(); quietlyCloseConnection(connection, reason != null ? reason : "(Failed to create/set connection)"); throw e; } }
Source:
<code>public int compareTo(BendableBigDecimalScore other) { validateCompatible(other); if (initScore != other.getInitScore()) { <START> return initScore < other.getInitScore() ? -1 : 1; <END> } for (int i = 0; i < hardScores.length; i++) { int hardScoreComparison = hardScores[i].compareTo(other.getHardScore(i)); if (hardScoreComparison != 0) { return hardScoreComparison; } } for (int i = 0; i < softScores.length; i++) { int softScoreComparison = softScores[i].compareTo(other.getSoftScore(i)); if (softScoreComparison != 0) { return softScoreComparison; } } return 0; }</code><technical_language>(Ok leave another PR): this Integer.compare(int, int)</technical_language>

Target:
public int compareTo(BendableBigDecimalScore other) { validateCompatible(other); if (initScore != other.getInitScore()) { return Integer.compare(initScore, other.getInitScore()); } for (int i = 0; i < hardScores.length; i++) { int hardScoreComparison = hardScores[i].compareTo(other.getHardScore(i)); if (hardScoreComparison != 0) { return hardScoreComparison; } } for (int i = 0; i < softScores.length; i++) { int softScoreComparison = softScores[i].compareTo(other.getSoftScore(i)); if (softScoreComparison != 0) { return softScoreComparison; } } return 0; }
Source:
<code>public final void testUnionAll1() throws Exception { Optional<TajoResultSetBase[]> existing = runSimpleTests(); assertTrue(existing.isPresent()); TajoResultSetBase[] resultSet = existing.get(); QueryId qid = resultSet[0].getQueryId(); QueryInfo queryInfo = testingCluster.getMaster().getContext().getQueryJobManager().getFinishedQuery(qid); TableDesc desc = queryInfo.getResultDesc(); TableStats stats = desc.getStats(); assertEquals(8L, stats.getNumRows().longValue()); <START> assertEquals(96L, stats.getNumBytes().longValue()); <END> }</code><technical_language>resultSets closed a test is finished. QueryTestCaseBase.closeResultSets()</technical_language>

Target:
public final void testUnionAll1() throws Exception { Optional<TajoResultSetBase[]> existing = runSimpleTests(); verifyResultStats(existing, 8L); }
Source:
<code>public HotPlugDiskToVmCommand(T parameters) { super(parameters); <START> disk = getDiskDao().get(getParameters().getDiskId()); <END> }</code><technical_language>constructors a bad place invoke DB operations - hard test this command. a simple lazy getter</technical_language>

Target:
public HotPlugDiskToVmCommand(T parameters) { super(parameters); }
Source:
<code>private void sendLogOut(String pmsId) { String pmsIp = pmsIpConfig.get(pmsId); String url = "http://"+pmsIp; try { URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); logger.trace("energenie: responseCode : {}", responseCode); logger.trace("energenie: logout from ip {}", pmsIp); } catch (Exception e) { logger.error("energenie: failed to logout from ip {}", pmsIp); } <START> } <END></code><technical_language>code duplication of sendXXX methods is huge. of HttpUtil class? reducing amount of code here</technical_language>

Target:
private void sendLogOut(String pmsId) { String pmsIp = pmsIpConfig.get(pmsId); String url = "http://"+pmsIp; try { HttpUtil.executeUrl("POST", url, timeout); logger.trace("logout from ip {}", pmsIp); } catch (Exception e) { logger.error("failed to logout from ip {}", pmsIp); } }
Source:
<code>protected void installLooseConfigWar(MavenProject proj, LooseConfigData config) throws Exception { File dir = new File(proj.getBuild().getOutputDirectory()); if (!dir.exists() && containsJavaSource(proj)) { throw new MojoExecutionException( MessageFormat.format(messages.getString("error.project.not.compile"), proj.getId())); } LooseWarApplication looseWar = new LooseWarApplication(proj, config); looseWar.addSourceDir(proj); looseWar.addOutputDir(looseWar.getDocumentRoot(), new File(proj.getBuild().getOutputDirectory()), "/WEB-INF/classes"); String webResources[] = MavenProjectUtil.getPluginConfiguration(proj, "org.apache.maven.plugins", "maven-war-plugin", "webResources", "resource", "directory"); <START> for (int i = 0; i < webResources.length; i++) { <END> looseWar.addOutputDir(looseWar.getDocumentRoot(), new File(proj.getBasedir().getAbsolutePath(), webResources[i]), "/"); } addEmbeddedLib(looseWar.getDocumentRoot(), proj, looseWar, "/WEB-INF/lib/"); File manifestFile = MavenProjectUtil.getManifestFile(proj, "maven-war-plugin"); looseWar.addManifestFile(manifestFile); }</code><technical_language>check if webResources != null? MavenProjectUtil.getPluginConfiguration possibly return null</technical_language>

Target:
protected void installLooseConfigWar(MavenProject proj, LooseConfigData config) throws Exception { File dir = new File(proj.getBuild().getOutputDirectory()); if (!dir.exists() && containsJavaSource(proj)) { throw new MojoExecutionException( MessageFormat.format(messages.getString("error.project.not.compile"), proj.getId())); } LooseWarApplication looseWar = new LooseWarApplication(proj, config); looseWar.addSourceDir(proj); looseWar.addOutputDir(looseWar.getDocumentRoot(), new File(proj.getBuild().getOutputDirectory()), "/WEB-INF/classes"); String webResources[] = MavenProjectUtil.getPluginConfiguration(proj, "org.apache.maven.plugins", "maven-war-plugin", "webResources", "resource", "directory"); if (webResources != null) { for (int i = 0; i < webResources.length; i++) { looseWar.addOutputDir(looseWar.getDocumentRoot(), new File(proj.getBasedir().getAbsolutePath(), webResources[i]), "/"); } } addEmbeddedLib(looseWar.getDocumentRoot(), proj, looseWar, "/WEB-INF/lib/"); File manifestFile = MavenProjectUtil.getManifestFile(proj, "maven-war-plugin"); looseWar.addManifestFile(manifestFile); }
Source:
<code>public void decrementRemainFiles(FadvisedFileRegion filePart, long fileStartTime) { <START> synchronized(remainFiles) { <END> long fileSendTime = System.currentTimeMillis() - fileStartTime; if (fileSendTime > 20 * 1000) { LOG.info("PullServer send too long time: filePos=" + filePart.getPosition() + ", fileLen=" + filePart.getCount()); numSlowFile++; } if (fileSendTime > maxTime) { maxTime = fileSendTime; } if (fileSendTime < minTime) { minTime = fileSendTime; } int remain = remainFiles.decrementAndGet(); if (remain <= 0) { synchronized(processingStatusMap) { processingStatusMap.remove(requestUri); } LOG.info("PullServer processing status: totalTime=" + (System.currentTimeMillis() - startTime) + " ms, " + "makeFileListTime=" + makeFileListTime + " ms, minTime=" + minTime + " ms, maxTime=" + maxTime + " ms, " + "numFiles=" + numFiles + ", numSlowFile=" + numSlowFile); } } }</code><technical_language>remainFiles is AtomicInteger. please remove synchronized block. synchronized(processingStatusMap)</technical_language>

Target:
public void decrementRemainFiles(FadvisedFileRegion filePart, long fileStartTime) { synchronized(remainFiles) { long fileSendTime = System.currentTimeMillis() - fileStartTime; if (fileSendTime > 20 * 1000) { LOG.info("PullServer send too long time: filePos=" + filePart.getPosition() + ", fileLen=" + filePart.getCount()); numSlowFile++; } if (fileSendTime > maxTime) { maxTime = fileSendTime; } if (fileSendTime < minTime) { minTime = fileSendTime; } int remain = remainFiles.decrementAndGet(); if (remain <= 0) { processingStatusMap.remove(requestUri); LOG.info("PullServer processing status: totalTime=" + (System.currentTimeMillis() - startTime) + " ms, " + "makeFileListTime=" + makeFileListTime + " ms, minTime=" + minTime + " ms, maxTime=" + maxTime + " ms, " + "numFiles=" + numFiles + ", numSlowFile=" + numSlowFile); } } }
Source:
<code>public JUnitResultAssert fails(Class expectedException, String exceptionMessage) { fails(1, expectedException); <START> Failure f = result.getFailures().iterator().next(); <END> assertEquals(filterLineNo(exceptionMessage), filterLineNo(f.getException().getMessage())); return this; }</code><technical_language>I remember some point some Iterator implementations failed if hasNext invoked. careful one. (Better a utility method in org.mockito.internal.util.collections.Iterables)</technical_language>

Target:
public JUnitResultAssert fails(Class expectedException, String exceptionMessage) { fails(1, expectedException); Failure f = firstOf(result.getFailures()); assertEquals(filterLineNo(exceptionMessage), filterLineNo(f.getException().getMessage())); return this; }
Source:
<code>public static Optional<HiveBucketProperty> fromStorageDescriptor(StorageDescriptor storageDescriptor, String tablePartitionName) { boolean bucketColsSet = storageDescriptor.isSetBucketCols() && !storageDescriptor.getBucketCols().isEmpty(); boolean numBucketsSet = storageDescriptor.isSetNumBuckets() && storageDescriptor.getNumBuckets() > 0; if (!numBucketsSet) { return Optional.empty(); } if (!bucketColsSet) { throw new PrestoException(HIVE_INVALID_METADATA, "Table/partition metadata has 'numBuckets' set, but 'bucketCols' is not set: " + tablePartitionName); } checkState( storageDescriptor.getSortCols().stream().allMatch(sortCol -> sortCol.getOrder() == 1 || sortCol.getOrder() == 0), <START> "Expect only 0 or 1 for elements of sortCols in storageDescriptor"); <END> List<HiveSortOrder> sortedBy = storageDescriptor.getSortCols().stream() .map(sortCol -> new HiveSortOrder(sortCol.getCol(), sortCol.getOrder() == 1 ? ASCENDING : DESCENDING)) .collect(toImmutableList()); return Optional.of(new HiveBucketProperty(storageDescriptor.getBucketCols(), storageDescriptor.getNumBuckets(), sortedBy)); }</code><technical_language>Sort column 0 1</technical_language>

Target:
public static Optional<HiveBucketProperty> fromStorageDescriptor(StorageDescriptor storageDescriptor, String tablePartitionName) { boolean bucketColsSet = storageDescriptor.isSetBucketCols() && !storageDescriptor.getBucketCols().isEmpty(); boolean numBucketsSet = storageDescriptor.isSetNumBuckets() && storageDescriptor.getNumBuckets() > 0; if (!numBucketsSet) { return Optional.empty(); } if (!bucketColsSet) { throw new PrestoException(HIVE_INVALID_METADATA, "Table/partition metadata has 'numBuckets' set, but 'bucketCols' is not set: " + tablePartitionName); } checkState( storageDescriptor.getSortCols().stream().allMatch(sortCol -> sortCol.getOrder() == 1 || sortCol.getOrder() == 0), "Order in sorting columns can only be 0 or 1"); List<HiveSortOrder> sortedBy = storageDescriptor.getSortCols().stream() .map(sortCol -> new HiveSortOrder(sortCol.getCol(), sortCol.getOrder() == 1 ? ASCENDING : DESCENDING)) .collect(toImmutableList()); return Optional.of(new HiveBucketProperty(storageDescriptor.getBucketCols(), storageDescriptor.getNumBuckets(), sortedBy)); }
Source:
<code>public void onMessage(WebSocketTextMessage textMessage) { <START> if ("ping".equals(textMessage.getText())) { <END> try { textMessage.getChannelSession().getBasicRemote().sendPing(ByteBuffer.wrap(new byte[]{1, 2, 3, 4, 5})); } catch (IOException e) { errorsQueue.add(e); } } textQueue.add(textMessage.getText()); latch.countDown(); }</code><technical_language>"ping" a constant. Fix in places</technical_language>

Target:
public void onMessage(WebSocketTextMessage textMessage) { if (PING.equals(textMessage.getText())) { try { textMessage.getChannelSession().getBasicRemote().sendPing(ByteBuffer.wrap(new byte[]{1, 2, 3, 4, 5})); } catch (IOException e) { errorsQueue.add(e); } } textQueue.add(textMessage.getText()); latch.countDown(); }
Source:
<code>public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { vlanMgr.deleteRct(this); SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } catch (Exception e) { s_logger.warn(String.format("unable to delete baremetal RCT[%s]", getId()), e); <START> throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); <END> } }</code><technical_language>passing of exception new is thrown</technical_language>

Target:
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { vlanMgr.deleteRct(this); SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } catch (Exception e) { s_logger.warn(String.format("unable to delete baremetal RCT[%s]", getId()), e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage(), e); } }
Source:
<code>public void clickStartNewWiki(){ <START> startNewWikiButton.click(); <END> }</code><technical_language>Please button is visible clickable</technical_language>

Target:
public CreateNewWikiPageObjectStep1 clickStartNewWiki(){ startNewWikiButton.click(); return new CreateNewWikiPageObjectStep1(driver); }
Source:
<code>private PaymentWithAllLinks aSuccessfullyCreatedPayment() { final Address cardholderAddress = new Address("123 Acacia Ave", "", "", "London", "GB"); return new PaymentWithAllLinks( "abc123", 100L, new PaymentState("created", false), "<LINK_0>", "New Passport", "my_ref", "made.up@example.com", "sandbox", "2018-01-01T11:12:13Z", SupportedLanguage.ENGLISH, false, new RefundSummary(), new SettlementSummary(), new CardDetails("9876", "482393", "Anne Onymous", "12/20", cardholderAddress, "visa"), Collections.emptyList(), URI.create(paymentUri), URI.create(paymentUri + "/events"), URI.create(paymentUri + "/cancel"), URI.create(paymentUri + "/refunds"), <START> null, <END> null, null ); }</code><technical_language>above, please do URI.create(paymentUri + "/capture")</technical_language>

Target:
private PaymentWithAllLinks aSuccessfullyCreatedPayment() { final Address cardholderAddress = new Address("123 Acacia Ave", "", "", "London", "GB"); return new PaymentWithAllLinks( "abc123", 100L, new PaymentState("created", false), "<LINK_0>", "New Passport", "my_ref", "made.up@example.com", "sandbox", "2018-01-01T11:12:13Z", SupportedLanguage.ENGLISH, false, new RefundSummary(), new SettlementSummary(), new CardDetails("9876", "482393", "Anne Onymous", "12/20", cardholderAddress, "visa"), Collections.emptyList(), URI.create(paymentUri), URI.create(paymentUri + "/events"), URI.create(paymentUri + "/cancel"), URI.create(paymentUri + "/refunds"), URI.create(paymentUri + "/capture"), null, null ); }
Source:
<code>public void subscribe(String topic, FAsyncCallback callback) throws TException { if (conn.getStatus() != Status.CONNECTED) { throw new TTransportException(TTransportExceptionType.NOT_OPEN, "NATS not connected, has status " + conn.getStatus()); } subject = topic; if ("".equals(subject)) { throw new TTransportException("Subject cannot be empty."); } dispatcher = conn.createDispatcher(msg -> { if (msg.getData().length < 4) { LOGGER.warn("discarding invalid scope message frame"); return; } try { callback.onMessage( new TMemoryInputTransport(Arrays.copyOfRange(msg.getData(), 4, msg.getData().length)) ); } catch (TException ignored) { } }); <START> if (queue.equals("")) { <END> dispatcher.subscribe(getFormattedSubject()); } else { dispatcher.subscribe(getFormattedSubject(), queue); } }</code><technical_language>check for null too</technical_language>

Target:
public void subscribe(String topic, FAsyncCallback callback) throws TException { if (conn.getStatus() != Status.CONNECTED) { throw new TTransportException(TTransportExceptionType.NOT_OPEN, "NATS not connected, has status " + conn.getStatus()); } subject = topic; if ("".equals(subject)) { throw new TTransportException("Subject cannot be empty."); } dispatcher = conn.createDispatcher(msg -> { if (msg.getData().length < 4) { LOGGER.warn("discarding invalid scope message frame"); return; } try { callback.onMessage( new TMemoryInputTransport(Arrays.copyOfRange(msg.getData(), 4, msg.getData().length)) ); } catch (TException ignored) { } }); if (queue != null && !queue.isEmpty()) { dispatcher.subscribe(getFormattedSubject(), queue); } else { dispatcher.subscribe(getFormattedSubject()); } }
Source:
<code>void assertValidUserFields(UserDto userResource, UserPurpose userPurpose) { if (StringUtils.isBlank(userResource.getFirstName())) { throw InvalidDataException.blankFirstName(); } if (StringUtils.isBlank(userResource.getLastName())) { throw InvalidDataException.blankLastName(); } if (userPurpose == UserPurpose.USER && StringUtils.isBlank(userResource.getPrivateData().getNickname())) { throw InvalidDataException.blankNickname(); } if (StringUtils.isBlank(userResource.getMobileNumber())) { throw InvalidDataException.blankMobileNumber(); } assertValidMobileNumber(userResource.getMobileNumber()); if (userPurpose == UserPurpose.BUDDY) { if (StringUtils.isBlank(userResource.getEmailAddress())) { throw InvalidDataException.blankEmailAddress(); } <START> assertValidEmailAddress(userResource.getEmailAddress()); <END> } }</code><technical_language>Asserting is valid done UserPurpose.USER e-mail address is blank</technical_language>

Target:
void assertValidUserFields(UserDto userResource, UserPurpose userPurpose) { if (StringUtils.isBlank(userResource.getFirstName())) { throw InvalidDataException.blankFirstName(); } if (StringUtils.isBlank(userResource.getLastName())) { throw InvalidDataException.blankLastName(); } if (userPurpose == UserPurpose.USER && StringUtils.isBlank(userResource.getPrivateData().getNickname())) { throw InvalidDataException.blankNickname(); } if (StringUtils.isBlank(userResource.getMobileNumber())) { throw InvalidDataException.blankMobileNumber(); } assertValidMobileNumber(userResource.getMobileNumber()); if (userPurpose == UserPurpose.BUDDY) { if (StringUtils.isBlank(userResource.getEmailAddress())) { throw InvalidDataException.blankEmailAddress(); } assertValidEmailAddress(userResource.getEmailAddress()); } else { if (!StringUtils.isBlank(userResource.getEmailAddress())) { throw InvalidDataException.excessEmailAddress(); } } }
Source:
<code>public void testPutDictionaryFile() throws Exception { final File file = new File("src/test/resources/testdictionary"); final MockMultipartFile multipartFile = new MockMultipartFile("file", "testDictionary", "text/plain", new FileInputStream(file)); final MvcResult mvcResult = _mockMvc.perform( fileUpload("/test/referencedata/dictionary/testDictionary").file(multipartFile).with(withPut()) <START> .contentType(MediaType.MULTIPART_FORM_DATA).param("casesensitive", "false")).andExpect(status().isCreated()).andExpect( <END> header().string("Location", is("http://localhost/test/referencedata/dictionary/testDictionary"))) .andReturn(); final String location = mvcResult.getResponse().getHeader("Location"); _mockMvc.perform(get(location)).andExpect(status().isOk()).andExpect(jsonPath("$.name", is("testDictionary"))) .andExpect(jsonPath("$.entries", hasSize(3))).andExpect(jsonPath("$.entries[2]", is("baz"))) .andExpect(jsonPath("$.caseSensitive", is(false))); }</code><technical_language>Line is longer 130 characters (found 143)</technical_language>

Target:
public void testPutDictionaryFile() throws Exception { final byte[] bytes = Files.readAllBytes(Paths.get("src/test/resources/testdictionary")); final MvcResult mvcResult = _mockMvc.perform( put("/test/referencedata/dictionary/testDictionary").content(bytes).param("casesensitive", "false")) .andExpect(status().isCreated()).andExpect(header().string("Location", is("http://localhost/test/referencedata/dictionary/testDictionary"))).andReturn(); final String location = mvcResult.getResponse().getHeader("Location"); _mockMvc.perform(get(location)).andExpect(status().isOk()).andExpect(jsonPath("$.name", is("testDictionary"))) .andExpect(jsonPath("$.entries", hasSize(3))).andExpect(jsonPath("$.entries[2]", is("baz"))) .andExpect(jsonPath("$.caseSensitive", is(false))); }
Source:
<code>private static Supplier<ClientRegistration.Builder> getRfc8414Builder(URI issuer, URI uri) { return () -> { RequestEntity<Void> request = RequestEntity.get(uri).build(); Map<String, Object> configuration = rest.exchange(request, typeReference).getBody(); AuthorizationServerMetadata metadata = parse(configuration, AuthorizationServerMetadata::parse); ClientRegistration.Builder builder = withProviderConfiguration(metadata, issuer.toASCIIString()) <START> .jwkSetUri(metadata.getJWKSetURI() != null ? metadata.getJWKSetURI().toASCIIString() : null); <END> String userinfoEndpoint = (String) configuration.get("userinfo_endpoint"); if (userinfoEndpoint != null) { builder.userInfoUri(userinfoEndpoint); } return builder; }; }</code><technical_language>follow a similar construct done userInfoEndpoint. I a bit easier read. suggestion URI jwkSetUri = metadata.getJWKSetURI(); if (jwkSetUri != null) { builder.jwkSetUri(jwkSetUri.toASCIIString()); }</technical_language>

Target:
private static Supplier<ClientRegistration.Builder> getRfc8414Builder(URI issuer, URI uri) { return () -> { RequestEntity<Void> request = RequestEntity.get(uri).build(); Map<String, Object> configuration = rest.exchange(request, typeReference).getBody(); AuthorizationServerMetadata metadata = parse(configuration, AuthorizationServerMetadata::parse); ClientRegistration.Builder builder = withProviderConfiguration(metadata, issuer.toASCIIString()); URI jwkSetUri = metadata.getJWKSetURI(); if (jwkSetUri != null) { builder.jwkSetUri(jwkSetUri.toASCIIString()); } String userinfoEndpoint = (String) configuration.get("userinfo_endpoint"); if (userinfoEndpoint != null) { builder.userInfoUri(userinfoEndpoint); } return builder; }; }
Source:
<code>public void askForFile(Controller controller, final FileChooserListener listener) { Gdx.input.getTextInput(new TextInputListener() { @Override public void input(final String text) { Gdx.app.postRunnable(new Runnable() { @Override public void run() { <START> listener.fileChosen(text, null); <END> } }); } @Override public void canceled() { } }, "File path!", "", ""); }</code><technical_language>Result.SUCCESS</technical_language>

Target:
public void askForFile(Controller controller, final FileChooserListener listener) { Gdx.input.getTextInput(new TextInputListener() { @Override public void input(final String text) { Gdx.app.postRunnable(new Runnable() { @Override public void run() { listener.fileChosen(text, FileChooserListener.Result.SUCCESS); } }); } @Override public void canceled() { } }, "File path!", "", ""); }
Source:
<code>private EntryPoint toEntryPoint(MachineConfig machineConfig) throws WorkspaceExportException { try { <START> EntryPointParser entryPointParser = new EntryPointParser(); <END> return entryPointParser.parse(machineConfig.getAttributes()); } catch (InfrastructureException e) { throw new WorkspaceExportException(e.getMessage()); } }</code><technical_language>put parser a field</technical_language>

Target:
private EntryPoint toEntryPoint(MachineConfig machineConfig) throws WorkspaceExportException { try { return entryPointParser.parse(machineConfig.getAttributes()); } catch (InfrastructureException e) { throw new WorkspaceExportException(e.getMessage()); } }
Source:
<code>public CodeModelGenerator(Filer filer, String aaVersion) { this.filer = filer; <START> this.header = "DO NOT EDIT THIS FILE, IT HAS BEEN GENERATED USING AndroidAnnotations " + aaVersion + ".\n " + <END> "You can create a larger work that contains this file and distribute that work under terms of your choice.\n"; }</code><technical_language>another \n separate unrelated statements</technical_language>

Target:
public CodeModelGenerator(Filer filer, String aaVersion) { this.filer = filer; this.header = "DO NOT EDIT THIS FILE." + "Generated using AndroidAnnotations " + aaVersion + ".\n " + "You can create a larger work that contains this file and distribute that work under terms of your choice.\n"; }
Source:
<code>public Writer(BlockFileWriter bfw, int blockSize) throws IOException { this(bfw, blockSize, (int) DefaultConfiguration.getInstance().getAsBytes(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX), null, null); long indexBlockSize = DefaultConfiguration.getInstance().getAsBytes(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX); <START> if (indexBlockSize > Integer.MAX_VALUE || indexBlockSize < 0) { <END> throw new IllegalArgumentException("table.file.compress.blocksize.index must be greater than 0 and no more than " + Integer.MAX_VALUE); } }</code><technical_language>This appears checking default value... is hard-coded. A check in unit test for Property ensure a stupid mistake for default. I a validate method in Property.java, also, do a quick verification a is good a user sets process starts reads config for time</technical_language>

Target:
public Writer(BlockFileWriter bfw, int blockSize) throws IOException { this(bfw, blockSize, (int) DefaultConfiguration.getInstance().getAsBytes(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX), null, null); }
Source:
<code>private int[] propertyIds() { <START> int props[] = new int[numberOfProps]; <END> for ( int i = 0; i < numberOfProps; i++ ) { props[i] = i; } return props; }</code><technical_language>int[] props including style checker happier</technical_language>

Target:
private int[] propertyIds() { int[] props = new int[numberOfProps]; for ( int i = 0; i < numberOfProps; i++ ) { props[i] = i; } return props; }
Source:
<code>Payload(String payloadAsString) { this.payloadAsString = payloadAsString; <START> this.payloadAsJSONObject = JSONObject.fromObject(payloadAsString); <END> }</code><technical_language>store a JSONObject instead of fields needed</technical_language>

Target:
Payload(String payloadAsString) { JSONObject json = JSONObject.fromObject(payloadAsString); this.payloadAsString = payloadAsString; this.taskId = json.getString("taskId"); this.taskStatus = json.getString("status"); if (CETask.STATUS_SUCCESS.equals(getTaskStatus())) { this.qualityGateStatus = json.has("qualityGate") ? json.getJSONObject("qualityGate").getString("status") : "NONE"; } else { this.qualityGateStatus = null; } }
Source:
<code>CacheHolder(List<HRegionLocation> all) { this.all = Collections.unmodifiableList(all); NavigableMap<byte[], SortedSet<HRegionLocation>> startKeyToLocs = new TreeMap<>(Bytes.BYTES_COMPARATOR); for (HRegionLocation loc : all) { if (loc.getRegion().isSplitParent()) { continue; } startKeyToLocs.computeIfAbsent(loc.getRegion().getStartKey(), k -> new TreeSet<>((l1, l2) -> l1.getRegion().compareTo(l2.getRegion()))).add(loc); } this.cache = startKeyToLocs.entrySet().stream().collect(Collectors.collectingAndThen( Collectors.toMap(Map.Entry::getKey, e -> new RegionLocations(e.getValue()), (u, v) -> { throw new IllegalStateException(); <START> }, () -> new TreeMap<>(Bytes.BYTES_COMPARATOR)), Collections::unmodifiableNavigableMap)); <END> }</code><technical_language>Needs meta comparator</technical_language>

Target:
CacheHolder(List<HRegionLocation> all) { this.all = Collections.unmodifiableList(all); NavigableMap<byte[], SortedSet<HRegionLocation>> startKeyToLocs = new TreeMap<>(CellComparatorImpl.MetaCellComparator.ROW_COMPARATOR); for (HRegionLocation loc : all) { if (loc.getRegion().isSplitParent()) { continue; } startKeyToLocs.computeIfAbsent(loc.getRegion().getStartKey(), k -> new TreeSet<>((l1, l2) -> l1.getRegion().compareTo(l2.getRegion()))).add(loc); } this.cache = startKeyToLocs.entrySet().stream().collect(Collectors.collectingAndThen( Collectors.toMap(Map.Entry::getKey, e -> new RegionLocations(e.getValue()), (u, v) -> { throw new IllegalStateException(); }, () -> new TreeMap<>(CellComparatorImpl.MetaCellComparator.ROW_COMPARATOR)), Collections::unmodifiableNavigableMap)); }
Source:
<code><START> protected void assertEventuallyStateTransferNotRunning() { <END> eventually(() -> adminOperations().getRunningStateTransfer().isEmpty(), 30, TimeUnit.SECONDS); }</code><technical_language>unneeded change</technical_language>

Target:
void assertEventuallyStateTransferNotRunning() { eventually(() -> adminOperations().getRunningStateTransfer().isEmpty(), 30, TimeUnit.SECONDS); }
Source:
<code>public void init() throws Exception { initMocks(this); processor = new AddDerivativeProcessor(fileExtension, moveDir.getRoot().getAbsolutePath()); file = tmpDir.newFile(fileName + ".PNG"); <START> file.deleteOnExit(); <END> when(exchange.getIn()).thenReturn(message); when(message.getHeader(eq(FCREPO_URI))) .thenReturn("http://fedora/test/original_file"); when(message.getHeader(eq(CdrBinaryMimeType))) .thenReturn("image/png"); try (BufferedWriter writeFile = new BufferedWriter(new FileWriter(file))) { writeFile.write("fake image"); } extensionlessPath = file.getAbsolutePath().split("\\.")[0]; when(message.getHeader(eq(CdrBinaryPath))) .thenReturn(extensionlessPath); when(message.getHeader(eq(CdrBinarySubPath))) .thenReturn(derivativeSubPath); extensionlessName = new File(extensionlessPath).getName(); when(result.getStdout()).thenReturn(new ByteArrayInputStream(extensionlessPath.getBytes())); when(message.getBody()).thenReturn(result); }</code><technical_language>need call deleteOnExit</technical_language>

Target:
public void init() throws Exception { initMocks(this); TestHelper.setContentBase(FEDORA_BASE); finalDir = moveDir.getRoot(); processor = new AddDerivativeProcessor(fileExtension, finalDir.getAbsolutePath()); pathId = PIDs.get(RESC_ID).getId(); file = tmpDir.newFile(pathId + "." + fileExtension); String derivTmpPath = file.getAbsolutePath(); derivTmpPath = derivTmpPath.substring(0, derivTmpPath.length() - fileExtension.length() - 1); when(exchange.getIn()).thenReturn(message); when(message.getHeader(eq(FCREPO_URI))) .thenReturn(RESC_ID); when(message.getHeader(eq(CdrBinaryMimeType))) .thenReturn("image/png"); try (BufferedWriter writeFile = new BufferedWriter(new FileWriter(file))) { writeFile.write("fake image"); } when(result.getStdout()).thenReturn(new ByteArrayInputStream( derivTmpPath.getBytes() )); when(message.getBody()).thenReturn(result); }