auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void SignUp_008_signupJapaneseUser() { <START> String wikiURLJapanese = "<LINK_0>"; <END> WikiBasePageObject base = new WikiBasePageObject(driver); SignUpPageObject signUp = base.navigateToSpecialSignUpPage(wikiURLJapanese); signUp.disableCaptcha(); String userName = "品質管理" + signUp.getTimeStamp(); String password = "品質管理管理" + signUp.getTimeStamp(); String email = credentials.emailQaart2; String emailPassword = credentials.emailPasswordQaart2; signUp.typeEmail(email); signUp.typeUserName(userName); signUp.typePassword(password); signUp.enterBirthDate(PageContent.WIKI_SIGN_UP_BIRTHMONTH, PageContent.WIKI_SIGN_UP_BIRTHDAY, PageContent.WIKI_SIGN_UP_BIRTHYEAR); AlmostTherePageObject almostTherePage = signUp.submit(email, emailPassword); ConfirmationPageObject confirmPageAlmostThere = almostTherePage.enterActivationLink(email, emailPassword, wikiURLJapanese, "ja"); confirmPageAlmostThere.typeInUserName(userName); confirmPageAlmostThere.typeInPassword(password); UserProfilePageObject userProfile = confirmPageAlmostThere.clickSubmitButton(email, emailPassword); userProfile.verifyUserLoggedIn(userName); CustomizedToolbarComponentObject toolbar = new CustomizedToolbarComponentObject(driver); toolbar.verifyUserToolBar(); PreferencesPageObject preferences = userProfile.openSpecialPreferencesPage(wikiURL); preferences.selectTab(tabNames.EMAIL); preferences.verifyEmailMeSection(); }</code><technical_language>please move this class variable</technical_language>

Target:
public void SignUp_008_signupJapaneseUser() { SignUpPageObject signUp = new WikiBasePageObject(driver).navigateToSpecialSignUpPage(wikiURL); signUp.disableCaptcha(); String userName = "品質管理" + signUp.getTimeStamp(); String password = "品質管理管理" + signUp.getTimeStamp(); String email = credentials.emailQaart2; String emailPassword = credentials.emailPasswordQaart2; signUp.typeEmail(email); signUp.typeUserName(userName); signUp.typePassword(password); signUp.enterBirthDate(PageContent.WIKI_SIGN_UP_BIRTHMONTH, PageContent.WIKI_SIGN_UP_BIRTHDAY, PageContent.WIKI_SIGN_UP_BIRTHYEAR); AlmostTherePageObject almostTherePage = signUp.submit(email, emailPassword); ConfirmationPageObject confirmPageAlmostThere = almostTherePage.enterActivationLink(email, emailPassword, wikiURL, "ja"); confirmPageAlmostThere.typeInUserName(userName); confirmPageAlmostThere.typeInPassword(password); UserProfilePageObject userProfile = confirmPageAlmostThere.clickSubmitButton(email, emailPassword); userProfile.verifyUserLoggedIn(userName); CustomizedToolbarComponentObject toolbar = new CustomizedToolbarComponentObject(driver); toolbar.verifyUserToolBar(); PreferencesPageObject preferences = userProfile.openSpecialPreferencesPage(wikiURL); preferences.selectTab(tabNames.EMAIL); preferences.verifyEmailMeSection(); }
Source:
<code>public static AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(StringBuilder actual) { <START> return new CharSequenceAssert(actual); <END> }</code><technical_language>in AssertionsForClassTypes.assertThat(actual); current code moved AssertionsForClassTypes (as done for assertThat(String actual))</technical_language>

Target:
public static AbstractCharSequenceAssert<?, ? extends CharSequence> assertThat(StringBuilder actual) { return AssertionsForClassTypes.assertThat(actual); }
Source:
<code>private Session getSession(URI sessionModelURI, boolean restore) { Session sessionFromURI; try { sessionFromURI = null; if (restore) { sessionFromURI = SessionManager.INSTANCE.getSession(sessionModelURI, new NullProgressMonitor()); } else { sessionFromURI = SessionManager.INSTANCE.getExistingSession(sessionModelURI); } if (sessionFromURI != null) { if (!sessionFromURI.isOpen()) { sessionFromURI.open(new NullProgressMonitor()); } IEditingSession uiSession = null; if (restore) { uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); } else { uiSession = SessionUIManager.INSTANCE.getUISession(sessionFromURI); } <START> uiSession.open(); <END> } } catch (IllegalStateException e) { sessionFromURI = null; } catch (OperationCanceledException e) { sessionFromURI = null; } return sessionFromURI; }</code><technical_language>nan</technical_language>

Target:
private Session getSession(URI sessionModelURI, boolean restore) { Session sessionFromURI; try { sessionFromURI = null; if (restore) { sessionFromURI = SessionManager.INSTANCE.getSession(sessionModelURI, new NullProgressMonitor()); } else { sessionFromURI = SessionManager.INSTANCE.getExistingSession(sessionModelURI); } if (sessionFromURI != null) { if (!sessionFromURI.isOpen()) { sessionFromURI.open(new NullProgressMonitor()); } IEditingSession uiSession = null; if (restore) { uiSession = SessionUIManager.INSTANCE.getOrCreateUISession(sessionFromURI); } else { uiSession = SessionUIManager.INSTANCE.getUISession(sessionFromURI); } if (uiSession != null && uiSession.isOpen()) { uiSession.open(); } } } catch (IllegalStateException e) { sessionFromURI = null; } catch (OperationCanceledException e) { sessionFromURI = null; } return sessionFromURI; }
Source:
<code>protected boolean AddVmImages() { int numberOfStartedCopyTasks = 0; try { if (!getDiskImagesFromConfiguration().isEmpty()) { lockEntities(); for (DiskImage diskImage : getDiskImagesFromConfiguration()) { if (diskImage.getimageStatus() == ImageStatus.ILLEGAL) { DiskImage snapshotImageInDb = getDiskImageDao().getSnapshotById(diskImage.getId()); if (snapshotImageInDb == null) { <START> saveNewDiskAndImage(diskImage); <END> } } else { copyDiskImage(diskImage, diskImage.getstorage_ids().get(0), imageToDestinationDomainMap.get(diskImage.getId()), VdcActionType.AddVmFromSnapshot); numberOfStartedCopyTasks++; } } } } finally { if (numberOfStartedCopyTasks == 0) { unlockEntities(); } } return true; }</code><technical_language>for clarity saveNewDiskAndImage called 'saveIllegalDisk' thatm want in other case.</technical_language>

Target:
protected boolean AddVmImages() { int numberOfStartedCopyTasks = 0; try { if (!getDiskImagesFromConfiguration().isEmpty()) { lockEntities(); for (DiskImage diskImage : getDiskImagesFromConfiguration()) { if (diskImage.getimageStatus() == ImageStatus.ILLEGAL) { DiskImage snapshotImageInDb = getDiskImageDao().getSnapshotById(diskImage.getId()); if (snapshotImageInDb == null) { saveIllegalDisk(diskImage); } } else { copyDiskImage(diskImage, diskImage.getstorage_ids().get(0), imageToDestinationDomainMap.get(diskImage.getId()), VdcActionType.AddVmFromSnapshot); numberOfStartedCopyTasks++; } } } } finally { if (numberOfStartedCopyTasks == 0) { unlockEntities(); } } return true; }
Source:
<code>private void remove(@NonNull final Compilation compilation) { new AlertDialog.Builder(getContext()) .setMessage(R.string.compilation_remove_confirm) .setPositiveButton(R.string.compilation_remove_confirm_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { new File(compilation.path()).delete(); <START> beginUpdate(); <END> } }) .setNegativeButton(R.string.compilation_remove_confirm_no, null) .show(); }</code><technical_language>a awkward removed compilation entry remain in local compilations list new search completes. optimistically remove entry manually recyclerview calling beginUpdate()</technical_language>

Target:
private void remove(@NonNull final Compilation compilation) { getDownloadObserver().removeWithConfirmation(getActivity(), compilation, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { beginUpdate(); } }); }
Source:
<code>private static ResultSegment<ListBlobItem> listBlobsInSegments(CloudBlobDirectory directory, ResultContinuation token) throws IOException { ResultSegment<ListBlobItem> result = null; IOException lastException = null; for (int sleep = 10; sleep <= 10000; sleep *= 10) { try { result = directory.listBlobsSegmented( null, false, EnumSet.of(BlobListingDetails.METADATA), 5000, token, null, null); break; } catch (StorageException | URISyntaxException e) { lastException = new IOException(e); try { Thread.sleep(sleep); } catch (InterruptedException ex) { log.warn("Interrupted", e); } <START> continue; <END> } } if (result == null) { throw lastException; } else { return result; } }</code><technical_language>I "continue" is needed</technical_language>

Target:
private static ResultSegment<ListBlobItem> listBlobsInSegments(CloudBlobDirectory directory, ResultContinuation token) throws IOException { ResultSegment<ListBlobItem> result = null; IOException lastException = null; for (int sleep = 10; sleep <= 10000; sleep *= 10) { try { result = directory.listBlobsSegmented( null, false, EnumSet.of(BlobListingDetails.METADATA), 5000, token, null, null); break; } catch (StorageException | URISyntaxException e) { lastException = new IOException(e); try { Thread.sleep(sleep); } catch (InterruptedException ex) { log.warn("Interrupted", e); } } } if (result == null) { throw lastException; } else { return result; } }
Source:
<code>static private void addTableToProject(VoltProjectBuilder project, int tableId, boolean partitioned) { try { project.addLiteralSchema(String.format(tableDDL, tableId)); <START> project.addStmtProcedure("Insert" + tableId, "INSERT INTO T" + tableId + " VALUES (?)"); <END> if (partitioned) { project.addLiteralSchema(String.format(partitionDDL, tableId)); } } catch (IOException e) { assertFalse(true); } }</code><technical_language>automatically get a CRUD proc called T1.Insert, create table, I procedures unnecessary</technical_language>

Target:
static private void addTableToProject(VoltProjectBuilder project, int tableId, boolean partitioned) { try { project.addLiteralSchema(String.format(tableDDL, tableId)); if (partitioned) { project.addLiteralSchema(String.format(partitionDDL, tableId)); } } catch (IOException e) { assertFalse(true); } }
Source:
<code>public void testShowStatsWithGroupByFails() <START> { <END> assertQueryFails("SHOW STATS FOR (SELECT * FROM orders GROUP BY orderkey, totalprice, categoryid)", ".*GROUP BY is not supported in SHOW STATS SELECT clause"); }</code><technical_language>this change</technical_language>

Target:
public void testShowStatsWithGroupByFails() { assertQueryFails("SHOW STATS FOR (SELECT avg(totalprice) FROM orders GROUP BY orderkey)", ".*GROUP BY is not supported in SHOW STATS SELECT clause"); }
Source:
<code>public static void main(String[] args) throws Exception { ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerCommandLine(); OptionSet options = cmdLine.parser().parse(args); Config orgConfig = cmdLine.loadConfig(options); ApplicationRunnerOperation op = cmdLine.getOperation(options); <START> ApplicationRunnerUtil.invokeApplicationRunner(orgConfig, op); <END> }</code><technical_language>Minor: s/invokeApplicationRunner/invoke Minor: s/orgConfig/originalConfig</technical_language>

Target:
public static void main(String[] args) throws Exception { ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerCommandLine(); OptionSet options = cmdLine.parser().parse(args); Config orgConfig = cmdLine.loadConfig(options); ApplicationRunnerOperation op = cmdLine.getOperation(options); ApplicationRunnerUtil.invoke(orgConfig, op); }
Source:
<code>public static int[] getPKIndices(final Metadata metadata) throws DriverException { final int fc = metadata.getFieldCount(); final List<Integer> tmpPKIndices = new ArrayList<Integer>(); for (int i = 0; i < fc; i++) { final Type type = metadata.getFieldType(i); final Constraint[] constraints = type.getConstraints(); for (Constraint c : constraints) { if (Constraint.PK == c.getConstraintCode()) { tmpPKIndices.add(i); break; } } } final int[] pkIndices = new int[tmpPKIndices.size()]; int i = 0; for (Integer idx : tmpPKIndices) { <START> pkIndices[i++] = idx.intValue(); <END> } return pkIndices; }</code><technical_language>This a mixed foreach/fori... strange one..</technical_language>

Target:
public static int[] getPKIndices(final Metadata metadata) throws DriverException { final int fc = metadata.getFieldCount(); final List<Integer> tmpPKIndices = new ArrayList<Integer>(); for (int i = 0; i < fc; i++) { final Type type = metadata.getFieldType(i); final Constraint[] constraints = type.getConstraints(); for (Constraint c : constraints) { if (Constraint.PK == c.getConstraintCode()) { tmpPKIndices.add(i); break; } } } final int[] pkIndices = new int[tmpPKIndices.size()]; for (int i = 0; i < pkIndices.length; i++) { pkIndices[i] = tmpPKIndices.get(i); } return pkIndices; }
Source:
<code>private Xpp3Dom getConfigXml( final Node node ) throws ManipulationException { final String config = galleyWrapper.toXML( node.getOwnerDocument(), false ) .trim(); try { return Xpp3DomBuilder.build( new StringReader( config ) ); } catch ( final XmlPullParserException | IOException e ) { throw new ManipulationException( <START> "Failed to re-parse plugin configuration into Xpp3Dom: %s%nConfig was:%n%s", <END> e, e.getMessage(), config ); } }</code><technical_language>Another %n</technical_language>

Target:
private Xpp3Dom getConfigXml( final Node node ) throws ManipulationException { final String config = galleyWrapper.toXML( node.getOwnerDocument(), false ) .trim(); try { return Xpp3DomBuilder.build( new StringReader( config ) ); } catch ( final XmlPullParserException | IOException e ) { throw new ManipulationException( "Failed to re-parse plugin configuration into Xpp3Dom: " + e.getMessage() + System.lineSeparator() + "Config was:" + System.lineSeparator() + config, e ); } }
Source:
<code>public List<String> getStrongDependencies() { List<String> strongDependencies = new ArrayList<>(); <START> strongDependencies.add(A_U_D_preferredMail); <END> strongDependencies.add(A_U_D_ISMail); strongDependencies.add(A_U_D_publicAliasMails); strongDependencies.add(A_U_D_privateAliasMails); strongDependencies.add(A_U_D_o365EmailAddressesMU); return strongDependencies; }</code><technical_language>This code is duplicate. Moreover, repeated "add" operations necessary. this: return Arrays.asList( A_U_D_preferredMail, A_U_D_ISMail, A_U_D_publicAliasMails, A_U_D_privateAliasMails, A_U_D_o365EmailAddressesMU);</technical_language>

Target:
public List<String> getStrongDependencies() { return Arrays.asList( A_U_D_preferredMail, A_U_D_ISMail, A_U_D_publicAliasMails, A_U_D_privateAliasMails, A_U_D_o365EmailAddressesMU); }
Source:
<code>public void reconnectDuringDestroyTest() throws Exception { Connection client = CLUSTER.newConnection(); VoltronReadWriteLock voltronReadWriteLock = new VoltronReadWriteLock(client, "crud-cm"); try (VoltronReadWriteLock.Hold localMaintenance = voltronReadWriteLock.tryWriteLock()) { if (localMaintenance == null) { <START> throw new EntityBusyException("Unable to obtain maintenance lease for "); <END> } EntityRef<ClusterTierManagerClientEntity, ClusterTierManagerConfiguration, Void> ref = getEntityRef(client); try { ClusterTierManagerClientEntity entity = ref.fetchEntity(null); entity.prepareForDestroy(); entity.close(); } catch (EntityNotFoundException e) { Assert.fail(); } setDelay(6000, proxies); Thread.sleep(6000); setDelay(0L, proxies); } voltronReadWriteLock = new VoltronReadWriteLock(client, "crud-cm"); try (VoltronReadWriteLock.Hold localMaintenance = voltronReadWriteLock.tryWriteLock()) { if (localMaintenance == null) { throw new EntityBusyException("Unable to obtain maintenance lease for "); } EntityRef<ClusterTierManagerClientEntity, ClusterTierManagerConfiguration, Void> ref = getEntityRef(client); try { ClusterTierManagerClientEntity entity = ref.fetchEntity(null); entity.prepareForDestroy(); entity.close(); } catch (EntityNotFoundException e) { Assert.fail(); } if (!ref.destroy()) { Assert.fail(); } } client.close(); }</code><technical_language>error message is incomplete</technical_language>

Target:
public void reconnectDuringDestroyTest() throws Exception { cacheManager.close(); Connection client = null; try { client = LeasedConnectionFactory.connect(connectionURI, new Properties()); VoltronReadWriteLock voltronReadWriteLock = new VoltronReadWriteLock(client, "crud-cm"); try (VoltronReadWriteLock.Hold localMaintenance = voltronReadWriteLock.tryWriteLock()) { if (localMaintenance == null) { throw new EntityBusyException("Unable to obtain maintenance lease for " + "crud-cm"); } EntityRef<ClusterTierManagerClientEntity, ClusterTierManagerConfiguration, Void> ref = getEntityRef(client); try { ClusterTierManagerClientEntity entity = ref.fetchEntity(null); entity.prepareForDestroy(); entity.close(); } catch (EntityNotFoundException e) { Assert.fail(); } } setDelay(6000, proxies); Thread.sleep(6000); setDelay(0L, proxies); client = LeasedConnectionFactory.connect(connectionURI, new Properties()); voltronReadWriteLock = new VoltronReadWriteLock(client, "crud-cm"); try (VoltronReadWriteLock.Hold localMaintenance = voltronReadWriteLock.tryWriteLock()) { if (localMaintenance == null) { throw new EntityBusyException("Unable to obtain maintenance lease for " + "crud-cm"); } EntityRef<ClusterTierManagerClientEntity, ClusterTierManagerConfiguration, Void> ref = getEntityRef(client); try { ClusterTierManagerClientEntity entity = ref.fetchEntity(null); entity.prepareForDestroy(); entity.close(); } catch (EntityNotFoundException e) { Assert.fail("Unexpected exception " + e.getMessage()); } if (!ref.destroy()) { Assert.fail("Unexpected exception while trying to destroy cache manager"); } } } finally { client.close(); } }
Source:
<code>public void init(Map<String, String> paramMap) { constantDelay = Utils.getLong(paramMap.get("constantDelay")); randomDelay = Utils.getLong(paramMap.get("randomDelay")); networkLoad = Utils.splitString(paramMap.get("networkLoad")); cpuLoadList = Utils.splitString(paramMap.get("cpuLoad")); memLoad = Utils.splitString(paramMap.get("memLoad")); storageDelay = Utils.splitString(paramMap.get("storageDelay")); networkBridgeName = paramMap.get("networkBridgeName"); cacheDir = paramMap.get("cacheDir"); logDir = paramMap.get("logDir") + "/" + System.currentTimeMillis(); forwardVdsmServer = paramMap.get("forwardVdsmServer"); vdsmPort = paramMap.get("vdsmPort"); vmConfAndStatsConstants = paramMap.get("vmConfAndStatsConstants"); vmConfAndStatsUpdateIntervals = paramMap.get("vmConfAndStatsUpdateIntervals"); jsonHandlersThreadsPool = Integer.valueOf(paramMap.get("jsonHandlersThreadsPool")); <START> architectureType = paramMap.get("architectureType"); <END> final String notLoggedMethods = paramMap.get("notLoggedMethods"); if (notLoggedMethods != null && notLoggedMethods.trim().length() > 0) { final String[] methodNames = notLoggedMethods.split(","); for (String methodName : methodNames) { notLoggedMethodSet.add(methodName.trim()); } } makeDir(cacheDir); makeDir(logDir); if (isProxyActive()) { targetServerUrl = getForwardVdsmServer() + ":" + getVdsmPort() + "/"; } }</code><technical_language>move SystemProperty detection code AppLIfecycleLIstener AppConfig#init is called put selected enum parameter map</technical_language>

Target:
public void init(Map<String, String> paramMap) { constantDelay = Utils.getLong(paramMap.get("constantDelay")); randomDelay = Utils.getLong(paramMap.get("randomDelay")); networkLoad = Utils.splitString(paramMap.get("networkLoad")); cpuLoadList = Utils.splitString(paramMap.get("cpuLoad")); memLoad = Utils.splitString(paramMap.get("memLoad")); storageDelay = Utils.splitString(paramMap.get("storageDelay")); networkBridgeName = paramMap.get("networkBridgeName"); cacheDir = paramMap.get("cacheDir"); logDir = paramMap.get("logDir") + "/" + System.currentTimeMillis(); forwardVdsmServer = paramMap.get("forwardVdsmServer"); vdsmPort = paramMap.get("vdsmPort"); vmConfAndStatsConstants = paramMap.get("vmConfAndStatsConstants"); vmConfAndStatsUpdateIntervals = paramMap.get("vmConfAndStatsUpdateIntervals"); jsonHandlersThreadsPool = Integer.valueOf(paramMap.get("jsonHandlersThreadsPool")); architectureType = ArchitectureType.valueOf(paramMap.get("architectureType").toUpperCase()); final String notLoggedMethods = paramMap.get("notLoggedMethods"); if (notLoggedMethods != null && notLoggedMethods.trim().length() > 0) { final String[] methodNames = notLoggedMethods.split(","); for (String methodName : methodNames) { notLoggedMethodSet.add(methodName.trim()); } } makeDir(cacheDir); makeDir(logDir); if (isProxyActive()) { targetServerUrl = getForwardVdsmServer() + ":" + getVdsmPort() + "/"; } }
Source:
<code>public void notifyParentItemChanged(int parentPosition) { ParentListItem parentListItem = mParentItemList.get(parentPosition); int wrapperIndex = getParentWrapperIndex(parentPosition); ParentWrapper parentWrapper = (ParentWrapper) mItemList.get(wrapperIndex); parentWrapper.setParentListItem(parentListItem); int sizeChanged = 1; if (parentWrapper.isExpanded()) { List<?> childItems = parentWrapper.getChildItemList(); int childListSize = childItems.size(); for (int i = 0; i < childListSize; i++) { <START> Object child = childItems.get(i); <END> mItemList.set(wrapperIndex + i + 1, child); sizeChanged++; } } notifyItemRangeChanged(wrapperIndex, sizeChanged); }</code><technical_language>Allocation in a loop</technical_language>

Target:
public void notifyParentItemChanged(int parentPosition) { ParentListItem parentListItem = mParentItemList.get(parentPosition); int wrapperIndex = getParentWrapperIndex(parentPosition); ParentWrapper parentWrapper = (ParentWrapper) mItemList.get(wrapperIndex); parentWrapper.setParentListItem(parentListItem); int sizeChanged = 1; if (parentWrapper.isExpanded()) { List<?> childItems = parentWrapper.getChildItemList(); int childListSize = childItems.size(); Object child; for (int i = 0; i < childListSize; i++) { child = childItems.get(i); mItemList.set(wrapperIndex + i + 1, child); sizeChanged++; } } notifyItemRangeChanged(wrapperIndex, sizeChanged); }
Source:
<code>private boolean determineIfIsObjectFactory(ExecutableElement executable) { <START> return executable.getAnnotation(ObjectFactory.class) != null || getTargetTypeParameter() != null || parameters.isEmpty(); <END> }</code><technical_language>ObjectFactoryPrism determine if executable is annotated ObjectFactory. Rule of thumb: classes annotation modules (mapstruct mapstruct-jdk8) in processor (with exception of reference in generator class for prisms). processor run annotations classpath. them, explain NoClassDefFound errors</technical_language>

Target:
private boolean determineIfIsObjectFactory(ExecutableElement executable) { boolean hasFactoryAnnotation = ObjectFactoryPrism.getInstanceOn( executable ) != null; boolean isFactoryWithTargeTypeAnnotation = getTargetTypeParameter() != null && getSourceParameters().isEmpty(); return !returnType.isVoid() && ( hasFactoryAnnotation || isFactoryWithTargeTypeAnnotation || parameters.isEmpty() ); }
Source:
<code>private long logStoreFiles( Logger logger, String prefix, File dir ) { if ( !dir.isDirectory() ) { return 0; } File[] files = dir.listFiles(); if ( files == null ) { logger.log( prefix + "<INACCESSIBLE>" ); return 0; } long total = 0; List<File> fileList = Arrays.asList( files ); if ( fileList.size() > MAX_DIRECTORY_LISTING_THRESHOLD ) { <START> Collections.sort( fileList, ( o1, o2 ) -> Long.compare( totalSize( o1 ), totalSize( o2 ) ) ); <END> } else { Collections.sort( fileList, new Comparator<File>() { @Override public int compare( File o1, File o2 ) { return o1.getName().compareTo( o2.getName() ); } } ); } int count = 0; for ( File file : fileList ) { long size; String filename = file.getName(); if ( file.isDirectory() ) { logger.log( prefix + filename + ":" ); size = logStoreFiles( logger, prefix + " ", file ); filename = "- Total"; } else { size = file.length(); } String fileModificationDate = getFileModificationDate( file ); String bytes = Format.bytes( size ); String fileInformation = String.format( "%s%s: %s - %s", prefix, filename, fileModificationDate, bytes ); logger.log( fileInformation ); total += size; if ( ++count == MAX_DIRECTORY_LISTING_THRESHOLD ) { logger.log( "%s%d smaller files or directories left out for brevity...", prefix, fileList.size() - count ); logger = NullLogger.getInstance(); } } return total; }</code><technical_language>fileList.sort( Comparator.comparingLong( this::totalSize ) );</technical_language>

Target:
private long logStoreFiles( Logger logger, String prefix, File dir ) { if ( !dir.isDirectory() ) { return 0; } File[] files = dir.listFiles(); if ( files == null ) { logger.log( prefix + "<INACCESSIBLE>" ); return 0; } long total = 0; List<File> fileList = Arrays.asList( files ); Collections.sort( fileList, new Comparator<File>() { @Override public int compare( File o1, File o2 ) { return o1.getName().compareTo( o2.getName() ); } } ); for ( File file : fileList ) { long size; String filename = file.getName(); if ( file.isDirectory() ) { logger.log( prefix + filename + ":" ); size = logStoreFiles( logger, prefix + " ", file ); filename = "- Total"; } else { size = file.length(); } String fileModificationDate = getFileModificationDate( file ); String bytes = Format.bytes( size ); String fileInformation = String.format( "%s%s: %s - %s", prefix, filename, fileModificationDate, bytes ); logger.log( fileInformation ); total += size; } return total; }
Source:
<code>public void showDocument(String url) { if (url.startsWith(IRC_JOIN_PROTOCOL)) { <START> eventBus.post(new JoinChannelEvent(url.substring(IRC_JOIN_PROTOCOL.length() + 3))); <END> return; } hostServices.showDocument(url); }</code><technical_language>hmm, 3 is a bit weird, work CHANNEL_URL_FORMAT making public</technical_language>

Target:
public void showDocument(String url) { hostServices.showDocument(url); }
Source:
<code><START> public boolean equals(Object o) { <END> if (this == o) return true; if (!(o instanceof EncodingMapping)) return false; EncodingMapping that = (EncodingMapping) o; return getName().equals(that.getName()); }</code><technical_language>This is wrong, compareTo compares priority while equals compares name, inconsistent</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof EncodingMapping)) return false; EncodingMapping that = (EncodingMapping) o; return this.compareTo(that) == 0; }
Source:
<code>public Collection<DSemanticDecorator> getSelection(DialectEditor editor) { Collection<DSemanticDecorator> selection = Sets.newLinkedHashSet(); if (editor instanceof DTableEditor) { DTableEditor dEditor = (DTableEditor) editor; <START> ISelection sel = dEditor.getSite().getSelectionProvider().getSelection(); <END> if (sel instanceof IStructuredSelection) { Iterables.addAll(selection, Iterables.filter(((IStructuredSelection) sel).toList(), DSemanticDecorator.class)); } } return selection; }</code><technical_language>remove tests potentials NPE</technical_language>

Target:
public Collection<DSemanticDecorator> getSelection(DialectEditor editor) { Collection<DSemanticDecorator> selection = Sets.newLinkedHashSet(); if (editor instanceof DTableEditor) { DTableEditor dEditor = (DTableEditor) editor; if (editor.getSite() != null && editor.getSite().getSelectionProvider() != null) { ISelection sel = dEditor.getSite().getSelectionProvider().getSelection(); if (sel instanceof IStructuredSelection) { Iterables.addAll(selection, Iterables.filter(((IStructuredSelection) sel).toList(), DSemanticDecorator.class)); } } } return selection; }
Source:
<code>public int hashCode() { <START> return 31 * getResource().hashCode(); <END> }</code><technical_language>need for *31 here</technical_language>

Target:
public int hashCode() { return getResource().hashCode(); }
Source:
<code>public BucketNodeMap(ToIntFunction<Split> splitToBucket) { <START> this.splitToBucket = splitToBucket; <END> }</code><technical_language>requireNonNull</technical_language>

Target:
public BucketNodeMap(ToIntFunction<Split> splitToBucket) { this.splitToBucket = requireNonNull(splitToBucket, "splitToBucket is null"); }
Source:
<code><START> private static final int getFreePort() { <END> try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } catch (IOException e) { throw new AssertionError("Can not find free port.", e); } }</code><technical_language>Extract this modules. "final" is necessary private methods</technical_language>

Target:
private static int getFreePort() { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } catch (IOException e) { throw new AssertionError("Can not find free port.", e); } }
Source:
<code>public void replication_conflict() throws Exception { String docId = generateUUID(); Foo foodb1 = new Foo(docId, "title"); Foo foodb2 = null; foodb1 = new Foo(docId, "titleX"); db1.save(foodb1); Response response = account.replicator().source(db1URI) .target(db2URI).replicatorDocId(docId) .save(); Utils.waitForReplicatorToComplete(account, response); foodb2 = db2.find(Foo.class, docId); foodb2.setTitle("titleY"); db2.update(foodb2); foodb1 = db1.find(Foo.class, docId); foodb1.setTitle("titleZ"); db1.update(foodb1); Response secondResponse = account.replicator().source(db1URI) .target(db2URI).save(); <START> Utils.waitForReplicatorToComplete(account, response); <END> ViewResult<String[], String, Foo> conflicts = db2.view("conflicts/conflict") .includeDocs(true).queryView(String[].class, String.class, Foo.class); assertThat(conflicts.getRows().size(), is(not(0))); Utils.removeReplicatorTestDoc(account, response); Utils.removeReplicatorTestDoc(account, secondResponse); }</code><technical_language>this need waitForReplicatorToComplete(account, secondResponse)</technical_language>

Target:
public void replication_conflict() throws Exception { String docId = Utils.generateUUID(); Foo foodb1 = new Foo(docId, "title"); Foo foodb2 = null; foodb1 = new Foo(docId, "titleX"); db1.save(foodb1); Response response = account.replicator().source(db1URI) .target(db2URI).replicatorDocId(docId) .save(); Utils.waitForReplicatorToComplete(account, response.getId()); foodb2 = db2.find(Foo.class, docId); foodb2.setTitle("titleY"); db2.update(foodb2); foodb1 = db1.find(Foo.class, docId); foodb1.setTitle("titleZ"); db1.update(foodb1); Response secondResponse = account.replicator().source(db1URI) .target(db2URI).save(); Utils.waitForReplicatorToComplete(account, secondResponse.getId()); ViewResult<String[], String, Foo> conflicts = db2.view("conflicts/conflict") .includeDocs(true).queryView(String[].class, String.class, Foo.class); assertThat(conflicts.getRows().size(), is(not(0))); Utils.removeReplicatorTestDoc(account, response.getId()); Utils.removeReplicatorTestDoc(account, secondResponse.getId()); }
Source:
<code>protected void initialize () { super.initialize(); writeEnters = true; linesBreak = new IntArray(); cursorLine = 0; firstLineShowing = 0; moveOffset = -1; linesShowing = 0; <START> focusTraversal = false; <END> }</code><technical_language>reason for disabling focus traversal default in TextArea</technical_language>

Target:
protected void initialize () { super.initialize(); writeEnters = true; linesBreak = new IntArray(); cursorLine = 0; firstLineShowing = 0; moveOffset = -1; linesShowing = 0; }
Source:
<code>public void start() { long startupBeginTime = System.currentTimeMillis(); try { if (!isRunning()) { <START> if (requestWorkersCount > 0 && blobStorageService == null) { <END> throw new IllegalStateException("BlobStorageService has not been set"); } logger.info("Starting AsyncRequestResponseHandler with request workers", requestWorkersCount); for (int i = 0; i < requestWorkersCount; i++) { long workerStartupBeginTime = System.currentTimeMillis(); AsyncRequestWorker asyncRequestWorker = new AsyncRequestWorker(restServerMetrics, blobStorageService); asyncRequestWorkers.add(asyncRequestWorker); Thread workerThread = new Thread(asyncRequestWorker); requestWorkerThreads.add(workerThread); workerThread.start(); long workerStartupTime = System.currentTimeMillis() - workerStartupBeginTime; restServerMetrics.requestWorkerStartTimeInMs.update(workerStartupTime); logger.info("AsyncRequestWorker startup took ms", workerStartupTime); } asyncResponseHandler = new AsyncResponseHandler(restServerMetrics); isRunning = true; } } finally { long startupTime = System.currentTimeMillis() - startupBeginTime; restServerMetrics.requestResponseHandlerStartTimeInMs.update(startupTime); logger.info("AsyncRequestResponseHandler start took ms", startupTime); } }</code><technical_language>requestWorkerCount > 0 is error state? this members important for handler start, I suggest add constructor instead of separate "setRequestWorkersCount" "setBlobStorageService" apis. caller code concise</technical_language>

Target:
public void start() { long startupBeginTime = System.currentTimeMillis(); try { if (!isRunning()) { logger.info("Starting AsyncRequestResponseHandler with request workers", requestWorkersCount); for (int i = 0; i < requestWorkersCount; i++) { long workerStartupBeginTime = System.currentTimeMillis(); AsyncRequestWorker asyncRequestWorker = new AsyncRequestWorker(restServerMetrics, blobStorageService); asyncRequestWorkers.add(asyncRequestWorker); Utils.newThread("RequestWorker-" + i, asyncRequestWorker, false).start(); long workerStartupTime = System.currentTimeMillis() - workerStartupBeginTime; restServerMetrics.requestWorkerStartTimeInMs.update(workerStartupTime); logger.info("AsyncRequestWorker startup took ms", workerStartupTime); } asyncResponseHandler = new AsyncResponseHandler(restServerMetrics); isRunning = true; } } finally { long startupTime = System.currentTimeMillis() - startupBeginTime; restServerMetrics.requestResponseHandlerStartTimeInMs.update(startupTime); logger.info("AsyncRequestResponseHandler start took ms", startupTime); } }
Source:
<code>private void requestLocationUpdates() { setRefreshingState(true); if (!locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER) && !locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setMessage(getString(R.string.nearby_dialog_goto_settings)); alert.setPositiveButton(getString(R.string.nearby_dialog_goto_settings_ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent myIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(myIntent); } }); alert.setNegativeButton(getString(R.string.nearby_dialog_goto_settings_cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { finish(); } }); alert.setCancelable(false); AlertDialog ad = alert.create(); <START> ad.show(); <END> } successes = 0; requestLocation(LocationManager.NETWORK_PROVIDER); requestLocation(LocationManager.GPS_PROVIDER); if (successes == 0) { Crouton.makeText(NearbyActivity.this, R.string.nearby_no_location, Style.ALERT).show(); setRefreshingState(false); } }</code><technical_language>This block (starting line 188) method</technical_language>

Target:
private void requestLocationUpdates() { setRefreshingState(true); boolean atLeastOneEnabled = false; if (!locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME_MILLIS, MIN_DISTANCE_METERS, locationListener); atLeastOneEnabled = true; } if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MIN_TIME_MILLIS, MIN_DISTANCE_METERS, locationListener); atLeastOneEnabled = true; } if (!atLeastOneEnabled) { showDialogForSettings(); } }
Source:
<code>public PrefixProvider getPrefixProvider(String prefix) { if (StringUtils.isBlank(prefix)) { return null; } if (prefix.startsWith(CONFIGURATION_PREFIX)) { String prefixProviderBean = ""; try { <START> prefixProviderBean = prefix.substring(prefix.indexOf(":") + 1).trim(); <END> return Context.getRegisteredComponent(prefixProviderBean, PrefixProvider.class); } catch (IndexOutOfBoundsException e) { log.error("Invalid Prefix Configuration. PrefixProvider bean name not provided", e); } catch (APIException e) { log.error("Failed to retrieve PrefixProvider:" + prefixProviderBean, e); } } return null; }</code><technical_language>is correct, a big fan reusability. java prefixProviderBean = StringUtils.substringBefore(prefix, ":");</technical_language>

Target:
public PrefixProvider getPrefixProvider(String prefix) throws APIException { if (StringUtils.isBlank(prefix)) { return new ConstantPrefixProvider(""); } if (prefix.startsWith(CONFIGURATION_PREFIX)) { String beanName = StringUtils.substringAfter(prefix, ":"); try { return Context.getRegisteredComponent(beanName, PrefixProvider.class); } catch (Exception e) { throw new APIException( "Invalid prefix configuration. The " + PrefixProvider.class.getSimpleName() + " bean name ('" + beanName + "') could not be resolved.", e); } } return new ConstantPrefixProvider(prefix); }
Source:
<code>public FileMailQueue(MailQueueItemDecoratorFactory mailQueueItemDecoratorFactory, File parentDir, String queuename, boolean sync) throws IOException { this.mailQueueItemDecoratorFactory = mailQueueItemDecoratorFactory; this.sync = sync; this.queueName = queuename; this.queueDir = new File(parentDir, queueName); this.queueDirName = queueDir.getAbsolutePath(); StandardAnalyzer analyzer = new StandardAnalyzer(); <START> this.indexWriter = new IndexWriter(FSDirectory.open(new File(queueDir, "index").toPath()), <END> new IndexWriterConfig(analyzer)); init(); }</code><technical_language>name field is indexed</technical_language>

Target:
public FileMailQueue(MailQueueItemDecoratorFactory mailQueueItemDecoratorFactory, File parentDir, String queuename, boolean sync) throws IOException { this.mailQueueItemDecoratorFactory = mailQueueItemDecoratorFactory; this.sync = sync; this.queueName = queuename; this.queueDir = new File(parentDir, queueName); this.queueDirName = queueDir.getAbsolutePath(); this.mailQueueIndex = new MailQueueIndex(new File(queueDir, "index")); init(); }
Source:
<code>void setupBuilder() throws IOException { final int numReads = 10000; final String flowCellBarcode = "TESTBARCODE"; final int maxX = 10000; final int maxY = 20000; final int minX = 1000; <START> final int minY = 2000; <END> final String separator = ":"; final int lane = 1; final int tile = 2203; final Random rg = new Random(31); setBuilder.setReadGroup(readGroupRecord); setBuilder.setUseNmFlag(true); for (int i = 0; i < numReads; i++) { final int x = rg.nextInt(maxX) + minX; final int y = rg.nextInt(maxY) + minY; final String readName = flowCellBarcode + separator + lane + separator + tile + separator + x + separator + y; setBuilder.addPair(readName, 1, 1, 100); } tempDir = IOUtil.createTempDir("pds_test", "PositionalDownsampling"); tempSamFile = File.createTempFile("PositionalDownsampleSam", ".bam", tempDir); BufferedLineReader bufferedLineReader = null; try { bufferedLineReader = new BufferedLineReader(new FileInputStream(dict)); } catch (FileNotFoundException e) { e.printStackTrace(); } final SAMTextHeaderCodec codec = new SAMTextHeaderCodec(); final SAMFileHeader header = codec.decode(bufferedLineReader, dict.toString()); readGroupRecord.setSample(sample); readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library); header.setSortOrder(SAMFileHeader.SortOrder.coordinate); header.addReadGroup(readGroupRecord); setBuilder.setHeader(header); final SAMFileWriter writer = new SAMFileWriterFactory() .setCreateIndex(true).makeBAMWriter(header, false, tempSamFile); for (final SAMRecord record : setBuilder) { writer.addAlignment(record); } writer.close(); }</code><technical_language>Is a share code tests? DownsampleSam X:Y coordinates account this necessary</technical_language>

Target:
void setupBuilder() throws IOException { final int numReads = 10000; final String flowCellBarcode = "TESTBARCODE"; final String separator = ":"; final int lane = 1; final int tile = 2203; final Random rg = new Random(31); setBuilder.setReadGroup(readGroupRecord); setBuilder.setUseNmFlag(true); for (int i = 0; i < numReads; i++) { final String readName = flowCellBarcode + separator + lane + separator + tile + separator + i; setBuilder.addPair(readName, 1, 1, 100); } tempDir = IOUtil.createTempDir("ds_test", "Downsampling"); tempSamFile = File.createTempFile("DownsampleSam", ".bam", tempDir); BufferedLineReader bufferedLineReader = null; try { bufferedLineReader = new BufferedLineReader(new FileInputStream(dict)); } catch (FileNotFoundException e) { e.printStackTrace(); } final SAMTextHeaderCodec codec = new SAMTextHeaderCodec(); final SAMFileHeader header = codec.decode(bufferedLineReader, dict.toString()); readGroupRecord.setSample(sample); readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library); header.setSortOrder(SAMFileHeader.SortOrder.coordinate); header.addReadGroup(readGroupRecord); setBuilder.setHeader(header); final SAMFileWriter writer = new SAMFileWriterFactory() .setCreateIndex(true).makeBAMWriter(header, false, tempSamFile); for (final SAMRecord record : setBuilder) { writer.addAlignment(record); } writer.close(); }
Source:
<code>public void start(AbstractProject project, boolean newInstance) { logger.debug("Start project: {}", project); super.start(project, newInstance); initializeTriggerOnEvents(); this.myProject = project; try { if (PluginImpl.getInstance() != null) { <START> PluginImpl.getInstance().getServer(serverName).addListener(this); <END> } else { logger.warn("The server instance could not be found! Project will not be triggered!", project.getFullDisplayName()); } } catch (IllegalStateException e) { logger.error("I am too early!", e); } if (dynamicTriggerConfiguration) { gerritTriggerTimerTask = new GerritTriggerTimerTask(this); } }</code><technical_language>NPE</technical_language>

Target:
public void start(AbstractProject project, boolean newInstance) { logger.debug("Start project: {}", project); super.start(project, newInstance); initializeTriggerOnEvents(); this.myProject = project; try { if (PluginImpl.getInstance() != null && PluginImpl.getInstance().getServer(serverName) != null) { PluginImpl.getInstance().getServer(serverName).addListener(this); } else { logger.warn("The server could not be found! Project will not be triggered!", serverName, project.getFullDisplayName()); } } catch (IllegalStateException e) { logger.error("I am too early!", e); } if (dynamicTriggerConfiguration) { gerritTriggerTimerTask = new GerritTriggerTimerTask(this); } GerritProjectList.removeTriggerFromProjectList(this); if (allowTriggeringUnreviewedPatches) { for (GerritProject p : gerritProjects) { GerritProjectList.addProject(p, this); } } }
Source:
<code><START> protected void rotateOutputFile () throws IOException { <END> synchronized (lock) { cleanup(); rotation++; Path path = new Path(this.path, this.name + "-" + rotation); this.out = this.fileSystem.create(path); } }</code><technical_language>Wrap this in a RotationPolicy extended size based rotation</technical_language>

Target:
protected void rotateOutputFile () throws IOException { cleanup(); rotation++; Path path = new Path(this.path, this.name + "-" + rotation); this.out = this.fileSystem.create(path); }
Source:
<code>public static <TResult> Task<TResult> callInBackground(Callable<TResult> callable) { <START> return callInBackground(callable, null); <END> }</code><technical_language>3-arg call IMMEDIATE_EXECUTOR lessen call depth</technical_language>

Target:
public static <TResult> Task<TResult> callInBackground(Callable<TResult> callable) { return call(callable, BACKGROUND_EXECUTOR, null); }
Source:
<code>public void testWithNoParameterProvidedInRequest() throws Exception { servlet.doGet(context.request(), context.response()); assertEquals(context.response().getStatus(), 200); String output = context.response().getOutputAsString(); <START> LOG.info("output = {}",output); <END> CSVParser parser = CSVParser.parse(output, CSVFormat.DEFAULT.withHeader()); assertAllUsersPresent(parser.getRecords(), "alice","bob","charly","admin","anonymous"); }</code><technical_language>need LOG test</technical_language>

Target:
public void testWithNoParameterProvidedInRequest() throws Exception { servlet.doGet(context.request(), context.response()); assertEquals(context.response().getStatus(), 200); String output = context.response().getOutputAsString(); CSVParser parser = CSVParser.parse(output, CSVFormat.DEFAULT.withHeader()); assertAllUsersPresent(parser.getRecords(), "alice","bob","charly","admin","anonymous"); }
Source:
<code>public static void process(@Nonnull Options options) { File binaryFile = options.getBinaryFile(); JavaTransformer jt = new JavaTransformer(getVersion().getVersion(), options); if (binaryFile.isFile()) { if (FileUtils.isJavaBinaryFile(binaryFile)) { List<File> javaBinaryFiles = new ArrayList<File>(); javaBinaryFiles.add(binaryFile); jt.transform(javaBinaryFiles); } else if (FileUtils.isJarFile(binaryFile)) { JarFile jarFile = null; try { jarFile = new JarFile(binaryFile); jt.transform(jarFile); } catch (IOException e) { throw new JillException("Failed to create jar file " + binaryFile.getName(), e); } finally { if (jarFile != null) { try { jarFile.close(); } catch (IOException e) { <START> throw new JillException("Error closing jar " + binaryFile.getName(), e); <END> } } } } else { throw new JillException("Unsupported file type: " + binaryFile.getName()); } } else { List<File> javaBinaryFiles = new ArrayList<File>(); try { FileUtils.getJavaBinaryFiles(binaryFile, javaBinaryFiles); } catch (ListDirException e) { throw new JillException(e); } jt.transform(javaBinaryFiles); } }</code><technical_language>I ignore closing exception if file is read. log somewhere</technical_language>

Target:
public static void process(@Nonnull Options options) { File binaryFile = options.getBinaryFile(); JavaTransformer jt = new JavaTransformer(getVersion().getVersion(), options); if (binaryFile.isFile()) { if (FileUtils.isJavaBinaryFile(binaryFile)) { List<File> javaBinaryFiles = new ArrayList<File>(); javaBinaryFiles.add(binaryFile); jt.transform(javaBinaryFiles); } else if (FileUtils.isJarFile(binaryFile)) { JarFile jarFile = null; try { jarFile = new JarFile(binaryFile); jt.transform(jarFile); } catch (IOException e) { throw new JillException("Failed to create jar file " + binaryFile.getName(), e); } finally { if (jarFile != null) { try { jarFile.close(); } catch (IOException e) { } } } } else { throw new JillException("Unsupported file type: " + binaryFile.getName()); } } else { List<File> javaBinaryFiles = new ArrayList<File>(); try { FileUtils.getJavaBinaryFiles(binaryFile, javaBinaryFiles); } catch (ListDirException e) { throw new JillException(e); } jt.transform(javaBinaryFiles); } }