auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public NamespaceOverrideMapper(String token) { log.info("Creating NamespaceOverrideMapper"); this.token = token; boolean connected = false; do { try { session = createSession(); connected = true; } catch (Exception e) { log.error("Could not connect to Cassandra. This could mean Cassandra is not yet up and running. Will try again."); <START> e.printStackTrace(); <END> try { Thread.sleep(2000); } catch (InterruptedException e1) { e1.printStackTrace(); } } } while (!connected); log.info("Connection to Cassandra establised"); ensureKeyspace("openshift_metrics"); if (hasMappingTable()) { log.info("Mapping table already exists in Cassandra. Using this table"); this.overrides = getMappingTable(); } else { log.info("Mapping table does not exist in Cassandra. Creating Mapping"); Set<String> tenants = getTenants(); Map<String, String> namespaceMapping = getNamespaceMapping(tenants); log.info("Namespace mapping: " + namespaceMapping); this.overrides = namespaceMapping; log.info("Writing the mapping table to Cassandra"); writeMappingTable(this.overrides); log.info("Mapping table stored in Cassandra"); } }</code><technical_language>This spam logs in startup? Lets try avoid e.printStackTrace()</technical_language>

Target:
public NamespaceOverrideMapper(String token) { log.debug("Creating NamespaceOverrideMapper"); this.token = token; boolean connected = false; do { try { session = createSession(); connected = true; } catch (Exception e) { log.info("Could not connect to Cassandra. This could mean Cassandra is not yet up and running. Will try again. Error message: " + e.getLocalizedMessage()); try { Thread.sleep(2000); } catch (InterruptedException e1) { e1.printStackTrace(); } } } while (!connected); log.debug("Connection to Cassandra establised"); ensureKeyspace("openshift_metrics"); if (hasMappingTable()) { log.debug("Mapping table already exists in Cassandra. Using this table"); this.overrides = getMappingTable(); } else { log.debug("Mapping table does not exist in Cassandra. Creating Mapping"); Set<String> tenants = getTenants(); Map<String, String> namespaceMapping = getNamespaceMapping(tenants); log.debug("Namespace mapping: " + namespaceMapping); this.overrides = namespaceMapping; log.debug("Writing the mapping table to Cassandra"); writeMappingTable(this.overrides); log.debug("Mapping table stored in Cassandra"); } }
Source:
<code>public void showFormulaEditorToEditFormula(final View view) { final AppCompatActivity activity = UiUtils.getActivityFromView(view); FragmentManager fragmentManager = activity.getSupportFragmentManager(); Fragment scriptFragment = fragmentManager.findFragmentByTag(ScriptFragment.TAG); if (scriptFragment != null && scriptFragment.isVisible() && (view.getId() == R.id.brick_place_at_edit_text_x || view.getId() == R.id.brick_place_at_edit_text_y)) { <START> AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); <END> String[] optionStrings = {view.getContext().getString(R.string.brick_place_at_option_place_visually), view.getContext().getString(R.string.brick_context_dialog_formula_edit_brick)}; builder.setItems(optionStrings, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: showVisualPlacement(view); break; case 1: PlaceAtBrick.super.showFormulaEditorToEditFormula(view); break; } } }); AlertDialog dialog = builder.create(); dialog.show(); } else { super.showFormulaEditorToEditFormula(view); } }</code><technical_language>shortcut this code snippet to: String[] optionStrings = {view.getContext().getString(R.string.brick_place_at_option_place_visually), view.getContext().getString(R.string.brick_context_dialog_formula_edit_brick)}; new AlertDialog.Builder(view.getContext());.setItems(optionStrings, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: showVisualPlacement(view); break; case 1: PlaceAtBrick.super.showFormulaEditorToEditFormula(view); break; } } }).show();</technical_language>

Target:
public void showFormulaEditorToEditFormula(final View view) { Fragment currentFragment = UiUtils.getActivityFromView(view).getSupportFragmentManager().findFragmentById(R.id.fragment_container); if (currentFragment instanceof ScriptFragment && (view.getId() == R.id.brick_place_at_edit_text_x || view.getId() == R.id.brick_place_at_edit_text_y)) { String[] optionStrings = {view.getContext().getString(R.string.brick_place_at_option_place_visually), view.getContext().getString(R.string.brick_context_dialog_formula_edit_brick)}; new AlertDialog.Builder(view.getContext()).setItems(optionStrings, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: showVisualPlacement(view); break; case 1: PlaceAtBrick.super.showFormulaEditorToEditFormula(view); break; } } }).show(); } else { super.showFormulaEditorToEditFormula(view); } }
Source:
<code>public StackFrame(Project project, Module module, debugger.FrameList frameList) { mFrameNumber = (Integer)frameList.params.__a[1]; mFileName = (String)frameList.params.__a[4]; mLineNumber = (((Integer)frameList.params.__a[5]).intValue()); mClassAndFunctionName = (frameList.params.__a[2] + "." + <START> frameList.params.__a[3]); <END> String fileName = VfsUtil.extractFileName(mFileName); if (fileName == null) { fileName = mFileName; } java.util.Collection<VirtualFile> files = FilenameIndex.getVirtualFilesByName (project, fileName, GlobalSearchScope.moduleScope(module)); if (files.isEmpty()) { files = FilenameIndex.getVirtualFilesByName (project, fileName, GlobalSearchScope.allScope(project)); } VirtualFile file = null; if (!files.isEmpty()) { for (VirtualFile f : files) { if (f.getPath() == mFileName) { file = f; break; } } if (file == null) { file = files.iterator().next(); } } mSourcePosition = XSourcePositionImpl.create(file, mLineNumber - 1); }</code><technical_language>this change</technical_language>

Target:
public StackFrame(Project project, Module module, debugger.FrameList frameList) { mFrameNumber = (Integer)frameList.params.__a[1]; mFileName = (String)frameList.params.__a[4]; mLineNumber = (((Integer)frameList.params.__a[5]).intValue()); mClassAndFunctionName = ((String)frameList.params.__a[2] + "." + (String)frameList.params.__a[3]); VirtualFile file = null; String fileName = VfsUtil.extractFileName(mFileName); if (fileName == null) { fileName = mFileName; } java.util.Collection<VirtualFile> files = FilenameIndex.getVirtualFilesByName (project, fileName, GlobalSearchScope.moduleScope(module)); if (files.isEmpty()) { files = FilenameIndex.getVirtualFilesByName (project, fileName, GlobalSearchScope.allScope(project)); } java.util.Collection<VirtualFile> matches = new THashSet<VirtualFile>(); if (!files.isEmpty()) { for (VirtualFile f : files) { if (f.getPath().endsWith(mFileName)) { matches.add(f); } } } if (matches.isEmpty()) { file = HaxelibClasspathUtils.findFileOnClasspath(module, mFileName); } else if (matches.size() == 1) { VirtualFile possible = matches.iterator().next(); file = possible.isValid() ? possible : HaxelibClasspathUtils.findFileOnClasspath(module, possible.toString()); } else { file = HaxelibClasspathUtils.findFirstFileOnClasspath(module, matches); } if (null != file && file.is(VFileProperty.SYMLINK)) { file = file.getCanonicalFile(); } mSourcePosition = XSourcePositionImpl.create(file, mLineNumber - 1); }
Source:
<code>private void encodeMessage(InternalMessage message, ByteBuf out) { if (!addressWritten) { <START> out.writeByte(VERSION); <END> final InetAddress senderIp = address.address(); final byte[] senderIpBytes = senderIp.getAddress(); out.writeByte(senderIpBytes.length); out.writeBytes(senderIpBytes); out.writeInt(address.port()); addressWritten = true; } out.writeByte(message.type().id()); out.writeInt(this.preamble); out.writeLong(message.id()); final byte[] payload = message.payload(); out.writeInt(payload.length); out.writeBytes(payload); }</code><technical_language>short</technical_language>

Target:
private void encodeMessage(InternalMessage message, ByteBuf out) { if (!addressWritten) { out.writeShort(VERSION); final InetAddress senderIp = address.address(); final byte[] senderIpBytes = senderIp.getAddress(); out.writeByte(senderIpBytes.length); out.writeBytes(senderIpBytes); out.writeInt(address.port()); addressWritten = true; } out.writeByte(message.type().id()); out.writeInt(this.preamble); out.writeLong(message.id()); final byte[] payload = message.payload(); out.writeInt(payload.length); out.writeBytes(payload); }
Source:
<code>public void setup() { try { <START> folder.create(); <END> readTestSupport.setup( folder.getRoot(), a -> { } ); } catch ( IOException e ) { fail(); } kernel = readTestSupport.kernelToTest(); session = kernel.beginSession( SecurityContext.AUTH_DISABLED ); System.setProperty( "org.neo4j.kernel.impl.newapi.Read.trackCursors", "true" ); }</code><technical_language>rely @Rule</technical_language>

Target:
public void setup() { readTestSupport.setup( folder.getRoot(), a -> { } ); kernel = readTestSupport.kernelToTest(); session = kernel.beginSession( SecurityContext.AUTH_DISABLED ); }
Source:
<code>public final Response getCurrentUserAuthorisationSettings(@Context final HttpServletRequest request, @PathParam("user_id") Long userId ) { try { RegisteredUserDTO currentRegisteredUser = this.userManager.getCurrentRegisteredUser(request); if (!userId.equals(currentRegisteredUser.getId()) && !currentRegisteredUser.getRole().equals(Role.ADMIN)) { return new SegueErrorResponse(Status.FORBIDDEN, "You must be an admin member to view this setting for another user.") .toResponse(); } if (currentRegisteredUser.getId().equals(userId)) { return Response.ok(this.userManager.getUsersAuthenticationSettings(currentRegisteredUser)).build(); } else { return Response.ok(this.userManager.getUsersAuthenticationSettings(this.userManager.getUserDTOById(userId))).build(); } } catch (NoUserLoggedInException e) { return SegueErrorResponse.getNotLoggedInResponse(); } catch (SegueDatabaseException e) { return new SegueErrorResponse(Status.INTERNAL_SERVER_ERROR, "Unable to remove account due to a problem with the database.", e).toResponse(); } catch (NoUserException e) { <START> return new SegueErrorResponse(Status.NOT_FOUND, "User ID specified cound not be found").toResponse(); <END> } }</code><technical_language>Typo: suggestion return new SegueErrorResponse(Status.NOT_FOUND, "User ID found").toResponse();</technical_language>

Target:
public final Response getCurrentUserAuthorisationSettings(@Context final HttpServletRequest request, @PathParam("user_id") Long userId ) { try { RegisteredUserDTO currentRegisteredUser = this.userManager.getCurrentRegisteredUser(request); if (null == userId) { userId = currentRegisteredUser.getId(); } if (!userId.equals(currentRegisteredUser.getId()) && !this.isUserAnAdmin(userManager, request)) { return new SegueErrorResponse(Status.FORBIDDEN, "You must be an admin member to view this setting for another user.") .toResponse(); } if (currentRegisteredUser.getId().equals(userId)) { return Response.ok(this.userManager.getUsersAuthenticationSettings(currentRegisteredUser)).build(); } else { return Response.ok(this.userManager.getUsersAuthenticationSettings(this.userManager.getUserDTOById(userId))).build(); } } catch (NoUserLoggedInException e) { return SegueErrorResponse.getNotLoggedInResponse(); } catch (SegueDatabaseException e) { return new SegueErrorResponse(Status.INTERNAL_SERVER_ERROR, "Unable to remove account due to a problem with the database.", e).toResponse(); } catch (NoUserException e) { return new SegueErrorResponse(Status.NOT_FOUND, "User ID specified could not be found").toResponse(); } }
Source:
<code>public Class[] getAdapterList() { return new Class[] { <START> IResource.class, IHistoryView.class }; <END> }</code><technical_language>This Repository.class. method is supposed return list of adapterTypes, i.e., types this adapter adapt objects to</technical_language>

Target:
public Class[] getAdapterList() { return new Class[] { Repository.class }; }
Source:
<code>public Response getClientToken(@PathParam("clientId") String clientId, @PathParam("nxuser") String nxuser, @Context HttpServletRequest request) { checkPermission(nxuser); <START> OAuth2Client client = Framework.getService(OAuth2ClientService.class).getClient(clientId); <END> return Response.ok(getToken(client, nxuser)).build(); }</code><technical_language>WDYT returning a 404 for a non-existing client done for providers? If happens, end a 5xx a server issue all</technical_language>

Target:
public Response getClientToken(@PathParam("clientId") String clientId, @PathParam("nxuser") String nxuser, @Context HttpServletRequest request) { checkPermission(nxuser); OAuth2Client client = getClient(clientId); return Response.ok(getToken(client, nxuser)).build(); }
Source:
<code><START> private String getLookAndFeelClassname(String lookAndFeelName) { <END> UIManager.LookAndFeelInfo[] looks = UIManager.getInstalledLookAndFeels(); String lookAndFeelClassname = ""; for (UIManager.LookAndFeelInfo look : looks) { if (look.getName().equals(lookAndFeelName)) { lookAndFeelClassname = look.getClassName(); break; } } return lookAndFeelClassname; }</code><technical_language>static</technical_language>

Target:
private static String getLookAndFeelClassname(String lookAndFeelName) { UIManager.LookAndFeelInfo[] looks = UIManager.getInstalledLookAndFeels(); String lookAndFeelClassname = ""; for (UIManager.LookAndFeelInfo look : looks) { if (look.getName().equals(lookAndFeelName)) { lookAndFeelClassname = look.getClassName(); break; } } return lookAndFeelClassname; }
Source:
<code>private Set<StaleBroadcast> getStaleBroadcasts( Set<BroadcastRef> updateBroadcastRefs, Set<BroadcastRef> currentBroadcastRefs ) { <START> ImmutableMultimap<Date, BroadcastRef> updateBroadcastsPerDay = getBroadcastsPerDay( <END> updateBroadcastRefs ); ImmutableMultimap<Date, BroadcastRef> currentBroadcastsPerDay = getBroadcastsPerDay( currentBroadcastRefs ); ImmutableSet.Builder<StaleBroadcast> staleBroadcasts = ImmutableSet.builder(); for (Date day : currentBroadcastsPerDay.keySet()) { ImmutableCollection<BroadcastRef> currentBroadcastsInDay = currentBroadcastsPerDay .get(day); ImmutableSet<String> updateBroadcastIdsInDay = updateBroadcastsPerDay .get(day) .stream() .map(BroadcastRef::getSourceId) .collect(MoreCollectors.toImmutableSet()); ImmutableSet<StaleBroadcast> staleBroadcastsInDay = currentBroadcastsInDay .stream() .filter(broadcast -> !updateBroadcastIdsInDay.contains(broadcast.getSourceId())) .map(broadcast -> StaleBroadcast.create(day, broadcast)) .collect(MoreCollectors.toImmutableSet()); staleBroadcasts.addAll(staleBroadcastsInDay); } return staleBroadcasts.build(); }</code><technical_language>j.u.Date for keys Java 8 LocalDates</technical_language>

Target:
private Set<StaleBroadcast> getStaleBroadcasts( Set<BroadcastRef> updateBroadcastRefs, Set<BroadcastRef> currentBroadcastRefs ) { ImmutableMultimap<LocalDate, BroadcastRef> updateBroadcastsByDay = getBroadcastsByDay( updateBroadcastRefs ); ImmutableMultimap<LocalDate, BroadcastRef> currentBroadcastsByDay = getBroadcastsByDay( currentBroadcastRefs ); ImmutableSet.Builder<StaleBroadcast> staleBroadcasts = ImmutableSet.builder(); for (LocalDate day : currentBroadcastsByDay.keySet()) { ImmutableCollection<BroadcastRef> currentBroadcastsInDay = currentBroadcastsByDay .get(day); ImmutableSet<String> updateBroadcastIdsInDay = updateBroadcastsByDay .get(day) .stream() .map(BroadcastRef::getSourceId) .collect(MoreCollectors.toImmutableSet()); ImmutableSet<StaleBroadcast> staleBroadcastsInDay = currentBroadcastsInDay .stream() .filter(broadcast -> !updateBroadcastIdsInDay.contains(broadcast.getSourceId())) .map(broadcast -> StaleBroadcast.create(day, broadcast)) .collect(MoreCollectors.toImmutableSet()); staleBroadcasts.addAll(staleBroadcastsInDay); } return staleBroadcasts.build(); }
Source:
<code>public static SSLContext getTruststoreSSLContext(KeystoreService keystoreService) { SSLContext sslContext = null; try { <START> SSLContextBuilder sslContextBuilder = SSLContexts.custom(); <END> if(keystoreService != null) { KeyStore truststore = keystoreService.getTruststoreForHttpClient(); if (truststore != null) { sslContextBuilder.loadTrustMaterial(truststore, null); sslContext = sslContextBuilder.build(); } } } catch (KeystoreServiceException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { LOGGER.failedToLoadTruststore(e.getMessage(), e); } return sslContext; }</code><technical_language>nit: create this instance if needed (keystoreService != null && truststore != null)</technical_language>

Target:
public static SSLContext getTruststoreSSLContext(KeystoreService keystoreService) { SSLContext sslContext = null; try { if(keystoreService != null) { KeyStore truststore = keystoreService.getTruststoreForHttpClient(); if (truststore != null) { SSLContextBuilder sslContextBuilder = SSLContexts.custom(); sslContextBuilder.loadTrustMaterial(truststore, null); sslContext = sslContextBuilder.build(); } } } catch (KeystoreServiceException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { LOGGER.failedToLoadTruststore(e.getMessage(), e); } return sslContext; }
Source:
<code>public void connect(String dataSource, String username, String password, String database) throws SQLException { String connectionString = (database == null) ? getConnectionString(dataSource) : getConnectionString(dataSource, database); Properties props = new Properties(); props.put("user", username); <START> props.put("password", password); <END> connect(connectionString, props); }</code><technical_language>wait, I missing something, encrypted passwords longer work this change? password password = new PropertiesLoader().parseValue(password);</technical_language>

Target:
public void connect(String dataSource, String username, String password, String database) throws SQLException { String connectionString = (database == null) ? getConnectionString(dataSource) : getConnectionString(dataSource, database); Properties props = new Properties(); props.put("user", username); props.put("password", new PropertiesLoader().parseValue(password)); connect(connectionString, props); }
Source:
<code>public List<Annotation> getAnnotations(CoreSession session, String documentId, String xpath) { DocumentRef docRef = new IdRef(documentId); if (!session.exists(docRef)) { throw new IllegalArgumentException("The document " + documentId + " does not exist."); } DocumentModel annotatedDoc = session.getDocument(docRef); return Framework.getService(CommentManager.class) <START> .getComments(session, annotatedDoc) <END> .stream() .filter(annotationModel -> xpath.equals( annotationModel.getPropertyValue(ANNOTATION_XPATH_PROPERTY))) .map(annotationModel -> { Annotation annotation = new AnnotationImpl(); Comments.documentModelToExternalAnnotation().accept(annotationModel, annotation); return annotation; }) .collect(Collectors.toList()); }</code><technical_language>migration state switch page provider this method <LINK_0></technical_language>

Target:
public List<Annotation> getAnnotations(CoreSession session, String documentId, String xpath) { DocumentRef docRef = new IdRef(documentId); if (!session.exists(docRef)) { throw new IllegalArgumentException("The document " + documentId + " does not exist."); } DocumentModel annotatedDoc = session.getDocument(docRef); return Framework.getService(CommentManager.class) .getComments(session, annotatedDoc) .stream() .filter(annotationModel -> xpath.equals( annotationModel.getPropertyValue(ANNOTATION_XPATH_PROPERTY))) .map(Comments::newAnnotation) .collect(Collectors.toList()); }
Source:
<code>public DoxygenSingleAutoEditStrategy() { <START> super(); <END> }</code><technical_language>personal style part - constructor do super() - this do this(true false)</technical_language>

Target:
public DoxygenSingleAutoEditStrategy() { super(true); }
Source:
<code>@Override public void printUsage(Logger logger) { String CACHES = "cacheName1,...,cacheNameN"; String description = "Verify counters and hash sums of primary and backup partitions for the specified " + "caches/cache groups on an idle cluster and print out the differences, if any. " + "Cache filtering options configure the set of caches that will be processed by " + IDLE_VERIFY + " command. " + "Default value for the set of cache names (or cache group names) is all cache groups. Default value for " + EXCLUDE_CACHES + " is empty set. Default value for " + CACHE_FILTER + " is no filtering. Therefore, " + "the set of all caches is sequently filtered by cache name " + "regexps, by cache type and after all by exclude regexps."; Map<String, String> map = U.newLinkedHashMap(16); map.put(CHECK_FIRST + " N", "validate only the first N keys"); map.put(CHECK_THROUGH + " K", "validate every Kth key"); map.put(CHECK_CRC.toString(), "check the CRC-sum of pages stored on disk"); <START> map.put(CHECK_SIZES.toString(), "check that index size and cache size are same"); <END> usageCache( logger, VALIDATE_INDEXES, description, map, optional(CACHES), OP_NODE_ID, optional(or(CHECK_FIRST + " N", CHECK_THROUGH + " K", CHECK_CRC, CHECK_SIZES)) ); }</code><technical_language>Please fix type: "cache index size cache size *the* same"</technical_language>

Target:
@Override public void printUsage(Logger logger) { String CACHES = "cacheName1,...,cacheNameN"; String description = "Verify counters and hash sums of primary and backup partitions for the specified " + "caches/cache groups on an idle cluster and print out the differences, if any. " + "Cache filtering options configure the set of caches that will be processed by " + IDLE_VERIFY + " command. " + "Default value for the set of cache names (or cache group names) is all cache groups. Default value for " + EXCLUDE_CACHES + " is empty set. Default value for " + CACHE_FILTER + " is no filtering. Therefore, " + "the set of all caches is sequently filtered by cache name " + "regexps, by cache type and after all by exclude regexps."; Map<String, String> map = U.newLinkedHashMap(16); map.put(CHECK_FIRST + " N", "validate only the first N keys"); map.put(CHECK_THROUGH + " K", "validate every Kth key"); map.put(CHECK_CRC.toString(), "check the CRC-sum of pages stored on disk"); map.put(CHECK_SIZES.toString(), "check that index size and cache size are the same"); usageCache( logger, VALIDATE_INDEXES, description, map, optional(CACHES), OP_NODE_ID, optional(or(CHECK_FIRST + " N", CHECK_THROUGH + " K", CHECK_CRC, CHECK_SIZES)) ); }
Source:
<code>public CollectResultFetcher( CompletableFuture<OperatorID> operatorIdFuture, TypeSerializer<T> serializer, String accumulatorName, int retryMillis) { this.operatorIdFuture = operatorIdFuture; this.accumulatorName = accumulatorName; this.retryMillis = retryMillis; this.buffer = new ResultBuffer(serializer); <START> this.terminated = false; <END> }</code><technical_language>init closed variable</technical_language>

Target:
CollectResultFetcher( CompletableFuture<OperatorID> operatorIdFuture, TypeSerializer<T> serializer, String accumulatorName, int retryMillis) { this.operatorIdFuture = operatorIdFuture; this.accumulatorName = accumulatorName; this.retryMillis = retryMillis; this.buffer = new ResultBuffer(serializer); this.jobTerminated = false; this.closed = false; }
Source:
<code>private Object[][] testData() { Interval interval = new Interval("chr1", 1, 999); List<Interval> intervalList_twoPair = new ArrayList<>(); intervalList_twoPair.add(interval); interval = new Interval("chr3", 1, 2); List<Interval> intervalList_noMatch = new ArrayList<>(); intervalList_noMatch.add(interval); interval = new Interval("chr2", 1, 2); <START> List<Interval> intervalList_onePair = new ArrayList<>(); <END> intervalList_onePair.add(interval); return new Object[][]{ {intervalList_twoPair, 4}, {intervalList_noMatch, 0}, {intervalList_onePair, 2} }; }</code><technical_language>finals. Check if IntelliJ IDE warnings stuff this</technical_language>

Target:
private Object[][] testData() { Interval interval = new Interval("chr1", 1, 999); final List<Interval> intervalList_twoPair = new ArrayList<>(); intervalList_twoPair.add(interval); interval = new Interval("chr3", 1, 2); final List<Interval> intervalList_noMatch = new ArrayList<>(); intervalList_noMatch.add(interval); interval = new Interval("chr2", 1, 2); final List<Interval> intervalList_onePair = new ArrayList<>(); intervalList_onePair.add(interval); interval = new Interval("chr4", 1, 2); final List<Interval> intervalList_unmapped = new ArrayList<>(); intervalList_unmapped.add(interval); return new Object[][]{ {intervalList_twoPair, 4}, {intervalList_noMatch, 0}, {intervalList_onePair, 2}, {intervalList_unmapped, 4} }; }
Source:
<code>public EntityType(Type type, Set<Supertype> superTypes) { super(type); this.superTypes = superTypes; <START> this.modifiedSimpleName = new DefaultVariableNameFunction().apply(this); <END> }</code><technical_language>if this removed? I new DefaultVariableNameFunction().apply(this). handled in other constructor</technical_language>

Target:
public EntityType(Type type, Set<Supertype> superTypes) { this(type, superTypes, new DefaultVariableNameFunction()); }
Source:
<code>private Driver createDriverImpl(Browser browser) { switch (browser) { case FIREFOX: return new FirefoxImpl(); case LEGACYFIREFOX: return new LegacyFirefoxImpl(); case CHROME: return new ChromeImpl(); case OPERA: return new OperaImpl(); case IE: return new InternetExplorerImpl(); case PHANTOMJS: return new PhantomJSImpl(); case SAFARI: return new SafariImpl(); case ELECTRON: return new ElectronImpl(); case CUSTOM: String customBrowserImpl = Property.CUSTOM_BROWSER_IMPL.getValue(); try { return getCustomBrowserImpl(customBrowserImpl).newInstance(); } catch (InstantiationException e) { <START> e.printStackTrace(); <END> } catch (IllegalAccessException e) { e.printStackTrace(); } default: throw new IllegalArgumentException("Invalid Browser specified"); } }</code><technical_language>combine re-throw</technical_language>

Target:
private Driver createDriverImpl(Browser browser) { switch (browser) { case FIREFOX: return new FirefoxImpl(); case LEGACYFIREFOX: return new LegacyFirefoxImpl(); case CHROME: return new ChromeImpl(); case OPERA: return new OperaImpl(); case IE: return new InternetExplorerImpl(); case PHANTOMJS: return new PhantomJSImpl(); case SAFARI: return new SafariImpl(); case ELECTRON: return new ElectronImpl(); case CUSTOM: String customBrowserImpl = Property.CUSTOM_BROWSER_IMPL.getValue(); try { return getCustomBrowserImpl(customBrowserImpl).newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException( "Unable to use custom browser implementation - " + customBrowserImpl, e); } default: throw new IllegalArgumentException("Invalid Browser specified"); } }
Source:
<code>public void testInvalidHeaderParam() { String preferredID = "P-Charging-Vector: icid-value=[2a02:ed0:1000:3033::249k];orig-ioi=1223abc4;icid-generated-at=[2a02:ed0:1000:3033::249]\n"; try { HeaderParser hp = createParser(PChargingVectorParser.class, preferredID); hp.parse(); <START> fail("Header:"+ preferredID + " cannot be parse, wrong in pattern"); <END> } catch (java.text.ParseException ex) { assertTrue(!ex.getMessage().contains("This header doesn't allow parameters")); } }</code><technical_language>in valid IPv6 parsed..</technical_language>

Target:
public void testInvalidHeaderParam() { String preferredID = "P-Charging-Vector: icid-value=[2a02:ed0:1000:3033::249k];orig-ioi=1223abc4;icid-generated-at=[2a02:ed0:1000:3033::249]\n"; try { HeaderParser hp = createParser(PChargingVectorParser.class, preferredID); hp.parse(); fail("Header:"+ preferredID + "Invalid IPv6 parsing expected to fail"); } catch (java.text.ParseException ex) }
Source:
<code>private void addGlusterBricksFeature(Features features) { Feature feature = new Feature(); feature.setName("Gluster Bricks management"); <START> feature.setDescription("Ability to delete gluster bricks with data migration"); <END> features.getFeature().add(feature); }</code><technical_language>I Michael meant adding like: "...using 'migrate' 'stopmigration' actions..." (Michael said: "I'd mention actual action for that")</technical_language>

Target:
private void addGlusterBricksFeature(Features features) { Feature feature = new Feature(); feature.setName("Gluster Bricks management"); feature.setDescription("Ability to delete gluster bricks with data migration using the actions migrate and commit. Action migrate in combination with stop migrates the data and brick can be reused further."); features.getFeature().add(feature); }
Source:
<code>protected void updateVmDeviceAddress(final String address, final VmDevice vmDevice) { vmDevice.setAddress(address); <START> DbFacade.getInstance().getVmDeviceDao().update(vmDevice); <END> }</code><technical_language>please injection for VmDeviceDao</technical_language>

Target:
protected void updateVmDeviceAddress(final String address, final VmDevice vmDevice) { vmDevice.setAddress(address); vmDeviceDAO.update(vmDevice); }
Source:
<code>public void updateListBox() { final ListView listListView = (ListView) view.findViewById(R.id.list_list); if (cache.isOffline()) { listListView.setVisibility(View.VISIBLE); final ListListAdapter adapter = new ListListAdapter(CacheDetailActivity.this, cache, this); listListView.setAdapter(adapter); final int numberOfItems = adapter.getCount(); int totalItemsHeight = 0; for (int itemPos = 0; itemPos < numberOfItems; itemPos++) { final View item = adapter.getView(itemPos, null, listListView); item.measure(0, 0); totalItemsHeight += item.getMeasuredHeight(); } final int totalDividersHeight = listListView.getDividerHeight() * (numberOfItems - 1); final ViewGroup.LayoutParams params = listListView.getLayoutParams(); <START> params.height = totalItemsHeight + totalDividersHeight; <END> listListView.setLayoutParams(params); listListView.requestLayout(); } else { listListView.setVisibility(View.GONE); } }</code><technical_language>do need this manual measuring pixelwise layouting? Generally, I avoid that</technical_language>

Target:
public void updateListBox() { final LinearLayout listListView = (LinearLayout) view.findViewById(R.id.list_list); if (cache.isOffline()) { listListView.removeAllViews();; for (final Integer listId : cache.getLists()) { final View listItemView = getLayoutInflater().inflate(R.layout.list_list_item, listListView, false); final ListItemViewHolder holder = new ListItemViewHolder(listItemView); final StoredList list = DataStore.getList(listId); holder.name.setText(list.getTitle()); holder.remove.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DataStore.removeFromList(Collections.singletonList(cache), listId); updateListBox(); } }); listListView.addView(listItemView); } } else { listListView.setVisibility(View.GONE); } }
Source:
<code>protected void registerCommands() { registerCommand("ps", new ShellCommand(new String[]{"ps", "-ef", "|grep alluxio*"}), null); registerCommand("env", new ShellCommand(new String[]{"env"}), null); registerCommand("top", new ShellCommand(new String[]{"atop", "-b", "-n", "1"}), new ShellCommand(new String[]{"top", "-b", "-n", "1"})); registerCommand("mount", new ShellCommand(new String[]{"mount"}), null); registerCommand("df", new ShellCommand(new String[]{"df", "-H"}), null); registerCommand("ulimit", new ShellCommand(new String[]{"ulimit -Ha"}), null); registerCommand("uname", new ShellCommand(new String[]{"uname", "-a"}), null); registerCommand("hostname", new ShellCommand(new String[]{"hostname"}), null); registerCommand("host ip", new ShellCommand(new String[]{"hostname", "-i"}), null); <START> registerCommand("host fqdn", new ShellCommand(new String[]{"hostname", "-v"}), null); <END> registerCommand("list Alluxio home", new ShellCommand(new String[]{String.format("ls -al -R %s", mFsContext.getClusterConf().get(PropertyKey.HOME))}), null); registerCommand("dig", new ShellCommand(new String[]{"dig $(hostname -i)"}), null); registerCommand("nslookup", new ShellCommand(new String[]{"nslookup", "$(hostname -i)"}), null); registerCommand("dstat", new ShellCommand(new String[]{"dstat", "-cdgilmnprsty"}), null); }</code><technical_language>this "hostname -f"</technical_language>

Target:
protected void registerCommands() { registerCommand("Alluxio ps", new ShellCommand(new String[]{"bash", "-c", "'ps -ef | grep alluxio'"}), null); registerCommand("Spark ps", new ShellCommand(new String[]{"bash", "-c", "'ps -ef | grep spark'"}), null); registerCommand("Yarn ps", new ShellCommand(new String[]{"bash", "-c", "'ps -ef | grep yarn'"}), null); registerCommand("Hdfs ps", new ShellCommand(new String[]{"bash", "-c", "'ps -ef | grep hdfs'"}), null); registerCommand("Presto ps", new ShellCommand(new String[]{"bash", "-c", "'ps -ef | grep presto'"}), null); registerCommand("env", new ShellCommand(new String[]{"env"}), null); registerCommand("top", new ShellCommand(new String[]{"atop", "-b", "-n", "1"}), new ShellCommand(new String[]{"top", "-b", "-n", "1"})); registerCommand("mount", new ShellCommand(new String[]{"mount"}), null); registerCommand("df", new ShellCommand(new String[]{"df", "-H"}), null); registerCommand("ulimit", new ShellCommand(new String[]{"ulimit -Ha"}), null); registerCommand("uname", new ShellCommand(new String[]{"uname", "-a"}), null); registerCommand("hostname", new ShellCommand(new String[]{"hostname"}), null); registerCommand("host ip", new ShellCommand(new String[]{"hostname", "-i"}), null); registerCommand("host fqdn", new ShellCommand(new String[]{"hostname", "-f"}), null); registerCommand("list Alluxio home", new ShellCommand(new String[]{String.format("ls -al -R %s", mFsContext.getClusterConf().get(PropertyKey.HOME))}), null); registerCommand("dig", new ShellCommand(new String[]{"dig $(hostname -i)"}), null); registerCommand("nslookup", new ShellCommand(new String[]{"nslookup", "$(hostname -i)"}), null); registerCommand("dstat", new ShellCommand(new String[]{"dstat", "-cdgilmnprsty"}), null); }
Source:
<code>private Locale getLocaleFromCookies(final Cookie[] cookies) { Locale locale = null; <START> if (null != cookies) { <END> for (Cookie cookie: cookies) { if (LOCALE.equalsIgnoreCase(cookie.getName())) { locale = LocaleUtils.getLocaleFromString(cookie.getValue()); break; } } } return locale; }</code><technical_language>Minor thing: please "something <operator> null" convention</technical_language>

Target:
private Locale getLocaleFromCookies(final Cookie[] cookies) { Locale locale = null; if (cookies != null) { for (Cookie cookie: cookies) { if (LOCALE.equalsIgnoreCase(cookie.getName())) { locale = LocaleUtils.getLocaleFromString(cookie.getValue()); break; } } } return locale; }
Source:
<code>public void clickOnInputFieldTag(String tagName) { <START> seleniumWebDriverHelper.waitAndClick(By.xpath(format(" END> }</code><technical_language>"//div[text()='%s']" simple reliably prevent confusing wrong element</technical_language>

Target:
public void clickOnInputFieldTag(String tagName) { seleniumWebDriverHelper.waitAndClick( By.xpath(format(FILTERS_INPUT_TAG_XPATH_TEMPLATE, tagName))); }
Source:
<code>private void getRoutes(Router router) { <START> router.get(String.format("/api/%s", getServiceName())).handler(this::getBookings); <END> router.post(String.format("/api/%s/:seats", getServiceName())).handler(this::makeBooking); }</code><technical_language>I if is annotation for routes added getBooking/makeBooking methods</technical_language>

Target:
private void getRoutes(Router router) { router.get(String.format("/api/%s", SERVICE_NAME)).handler(this::getBookings); router.post(String.format("/api/%s/:seats", SERVICE_NAME)).handler(this::makeBooking); }
Source:
<code>public void setUp() <START> throws Exception <END> { super.setUp(); disk_with_snapshots_id = diskWithSnapshots.getId(); disk_without_snapshots_id = diskWithoutSnapshots.getId(); ovf_disk_id = ovfImage.getId(); cinder_disk_id = cinderDisk.getId(); lun_disk_id = lunDisk.getId(); setUpDaoMocks(); }</code><technical_language>it</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); diskWithSnapshotsId = diskWithSnapshots.getId(); diskWithoutSnapshotsId = diskWithoutSnapshots.getId(); ovfDiskId = ovfImage.getId(); cinderDiskId = cinderDisk.getId(); lunDiskId = lunDisk.getId(); setUpDaoMocks(); }
Source:
<code>public static boolean isPowerOf2(long value) { <START> return (value & value - 1) == 0; <END> }</code><technical_language>Add parens (value - 1)</technical_language>

Target:
public static boolean isPowerOf2(long value) { Preconditions.checkArgument(value > 0, "value must be positive"); return (value & (value - 1)) == 0; }
Source:
<code>public void benchWavTrack() throws Exception { WavTrack wavTrack = new WavTrack(url); boolean isEOMReached = false; while (!isEOMReached) { Frame process = wavTrack.process(0); isEOMReached = process.isEOM(); } <START> wavTrack.close(); <END> }</code><technical_language>If exception thrown, wrap wavTrack.close() in a try-finally block, guarantee resources properly closed</technical_language>

Target:
public void benchWavTrack() throws Exception { try { wavTrack = new WavTrack(url); boolean isEOMReached = false; while (!isEOMReached) { Frame process = wavTrack.process(0); isEOMReached = process.isEOM(); } }finally { wavTrack.close(); } }
Source:
<code>public static void gradingUpsertHandler(final Institution institution, final Data.ItemSend itemSet, final String authId, final long gradedTime) throws AuthenticationException, DatabaseAccessException, InvalidProtocolBufferException { final Grading.ProtoGrade grade = Grading.ProtoGrade.parseFrom(itemSet.getData()); final Grading.ProtoGrade.Builder clone = Grading.ProtoGrade.newBuilder(grade); <START> final List<Grading.GradeHistory.Builder> gradeHistroy = clone.getGradeHistoryBuilderList(); <END> if (gradeHistroy.size() == 1) { final Grading.GradeHistory.Builder newestHistroy = gradeHistroy.get(0); final Util.DateTime.Builder date = Util.DateTime.newBuilder(); date.setMillisecond(gradedTime); newestHistroy.setGradedDate(date); newestHistroy.setWhoChanged(authId); } institution.addGrade(authId, clone.build()); }</code><technical_language>misspelled History, wrote: "Histroy"</technical_language>

Target:
public static void gradingUpsertHandler(final Institution institution, final Data.ItemSend itemSet, final String authId, final long gradedTime) throws AuthenticationException, DatabaseAccessException, InvalidProtocolBufferException { final Grading.ProtoGrade grade = Grading.ProtoGrade.parseFrom(itemSet.getData()); final Grading.ProtoGrade.Builder clone = Grading.ProtoGrade.newBuilder(grade); final List<Grading.GradeHistory.Builder> gradeHistory = clone.getGradeHistoryBuilderList(); if (gradeHistory.size() == 1) { final Grading.GradeHistory.Builder newestHistory = gradeHistory.get(0); final Util.DateTime.Builder date = Util.DateTime.newBuilder(); date.setMillisecond(gradedTime); newestHistory.setGradedDate(date); newestHistory.setWhoChanged(authId); } institution.addGrade(authId, clone.build()); }
Source:
<code>AbstractFeignJaxRsClientBuilder(ClientConfiguration config) { Preconditions.checkArgument(config.maxNumRetries() == 0, "Connection-level retries are not supported by %s", JaxRsClient.class.getSimpleName()); <START> Preconditions.checkArgument(!config.uris().isEmpty(), "Must provide at least one service URI"); <END> this.config = config; this.primaryUri = config.uris().get(new Random().nextInt(config.uris().size())); }</code><technical_language>require this earlier email initial uri lists empty</technical_language>

Target:
AbstractFeignJaxRsClientBuilder(ClientConfiguration config) { Preconditions.checkArgument(config.maxNumRetries() == 0, "Connection-level retries are not supported by %s", JaxRsClient.class.getSimpleName()); Preconditions.checkArgument(!config.uris().isEmpty(), "Must provide at least one service URI"); this.config = config; this.primaryUri = config.uris().get(0); }
Source:
<code>public NettyServer(NettyConfig nettyConfig, NettyMetrics nettyMetrics, ChannelInitializer<SocketChannel> channelInitializer) { this.nettyConfig = nettyConfig; this.nettyMetrics = nettyMetrics; this.channelInitializer = channelInitializer; NettyRequest.bufferWatermark = nettyConfig.nettyServerRequestBufferWatermark; <START> NettyRequest.maxBytesPerRead = nettyConfig.nettyServerMaxBytesPerRead; <END> logger.trace("Instantiated NettyServer"); }</code><technical_language>this needed</technical_language>

Target:
public NettyServer(NettyConfig nettyConfig, NettyMetrics nettyMetrics, ChannelInitializer<SocketChannel> channelInitializer) { this.nettyConfig = nettyConfig; this.nettyMetrics = nettyMetrics; this.channelInitializer = channelInitializer; NettyRequest.bufferWatermark = nettyConfig.nettyServerRequestBufferWatermark; logger.trace("Instantiated NettyServer"); }
Source:
<code>public synchronized int registerEvaluator(final String contextId) { if (evalPartitionMap.containsKey(contextId)) { <START> throw new RuntimeException("This evaluator is already registered"); <END> } final int partitionId = numEvalCounter.getAndIncrement(); LOG.log(Level.INFO, "contextId: {0}, partitionId: {1}", new Object[]{contextId, partitionId}); evalPartitionMap.put(contextId, Integer.valueOf(partitionId)); return partitionId; }</code><technical_language>printing contextId in message helpful for debugging</technical_language>

Target:
public synchronized int registerEvaluator(final String contextId) { if (evalPartitionMap.containsKey(contextId)) { throw new RuntimeException("This evaluator is already registered. Its context Id is " + contextId); } final int partitionId = numEvalCounter.getAndIncrement(); LOG.log(Level.INFO, "contextId: {0}, partitionId: {1}", new Object[]{contextId, partitionId}); evalPartitionMap.put(contextId, Integer.valueOf(partitionId)); return partitionId; }
Source:
<code>public void writeToPacketNBT(CompoundNBT cmp) { super.writeToPacketNBT(cmp); ListNBT flowerList = new ListNBT(); for (Block flower : lastFlowers) { <START> flowerList.add(StringNBT.valueOf(flower.getRegistryName().toString())); <END> } cmp.put(TAG_LAST_FLOWERS, flowerList); cmp.putInt(TAG_LAST_FLOWER_TIMES, lastFlowerCount); cmp.putInt(TAG_STREAK_LENGTH, streakLength); }</code><technical_language>Registry.getKey, portability</technical_language>

Target:
public void writeToPacketNBT(CompoundNBT cmp) { super.writeToPacketNBT(cmp); ListNBT flowerList = new ListNBT(); for (Block flower : lastFlowers) { flowerList.add(StringNBT.valueOf(Registry.BLOCK.getKey(flower).toString())); } cmp.put(TAG_LAST_FLOWERS, flowerList); cmp.putInt(TAG_LAST_FLOWER_TIMES, lastFlowerCount); cmp.putInt(TAG_STREAK_LENGTH, streakLength); }
Source:
<code>public static ZoneOffset getDefault() { <START> final int seconds = TimeZone.getDefault().getRawOffset()/1000; <END> return ZoneOffset.newBuilder() .setAmountSeconds(seconds) .build(); }</code><technical_language>constant mean</technical_language>

Target:
public static ZoneOffset getDefault() { final int seconds = TimeZone.getDefault() .getRawOffset() / (int) MILLIS_PER_SECOND; return ZoneOffset.newBuilder() .setAmountSeconds(seconds) .build(); }
Source:
<code>public void testSimple() throws Exception { assumeTrue(SystemUtils.IS_OS_UNIX); File tmpCpio = null; File tmpDir1 = null; File tmpDir2 = null; try { <START> tmpCpio = File.createTempFile("test1", "tar"); <END> tmpDir1 = File.createTempFile("test1", "tmp"); tmpDir1.delete(); tmpDir1.mkdir(); tmpDir2 = File.createTempFile("test1", "tmp"); tmpDir2.delete(); tmpDir2.mkdir(); _writeFile(new File(tmpDir1, "script1"), "script1", true); _writeFile(new File(tmpDir1, "script2"), "script2", true); _writeFile(new File(tmpDir1, "file1"), "file1", false); _writeFile(new File(tmpDir1, "file2"), "file2", false); _writeFile(new File(tmpDir1, "dir1/file3"), "file2", false); _writeFile(new File(tmpDir1, "dir1/dir2/file4"), "file4", false); try (OutputStream os = new FileOutputStream(tmpCpio)) { Cpio.doArchive(os, tmpDir1); } ProcessBuilder cpio = new ProcessBuilder("cpio", "--extract", "--make-directories", "--file", tmpCpio.getPath()); cpio.directory(tmpDir2); cpio.start().waitFor(); MessageDigest md1 = MessageDigest.getInstance("SHA"); MessageDigest md2 = MessageDigest.getInstance("SHA"); digestDirectory(md1, tmpDir1, new File(".")); digestDirectory(md2, tmpDir2, new File(".")); assertArrayEquals(md1.digest(), md2.digest()); assertTrue(new File(tmpDir2, "script1").canExecute()); assertFalse(new File(tmpDir2, "file1").canExecute()); } finally { for (File file : new File[] {tmpDir1, tmpDir2, tmpCpio}) { if (file != null) { file.delete(); } } } }</code><technical_language>If this is a cpio file extension "tar"</technical_language>

Target:
public void testSimple() throws Exception { assumeTrue(SystemUtils.IS_OS_UNIX); File tmpCpio = null; File tmpDir1 = null; File tmpDir2 = null; try { tmpCpio = File.createTempFile("test1", ".cpio"); tmpDir1 = File.createTempFile("test1", "tmp"); tmpDir1.delete(); tmpDir1.mkdir(); tmpDir2 = File.createTempFile("test1", "tmp"); tmpDir2.delete(); tmpDir2.mkdir(); _writeFile(new File(tmpDir1, "script1"), "script1", true); _writeFile(new File(tmpDir1, "script2"), "script2", true); _writeFile(new File(tmpDir1, "file1"), "file1", false); _writeFile(new File(tmpDir1, "file2"), "file2", false); _writeFile(new File(tmpDir1, "dir1/file3"), "file2", false); _writeFile(new File(tmpDir1, "dir1/dir2/file4"), "file4", false); try (OutputStream os = new FileOutputStream(tmpCpio)) { Cpio.doArchive(os, tmpDir1); } ProcessBuilder cpio = new ProcessBuilder("cpio", "--extract", "--make-directories", "--file", tmpCpio.getPath()); cpio.directory(tmpDir2); cpio.start().waitFor(); MessageDigest md1 = MessageDigest.getInstance("SHA"); MessageDigest md2 = MessageDigest.getInstance("SHA"); digestDirectory(md1, tmpDir1, new File(".")); digestDirectory(md2, tmpDir2, new File(".")); assertArrayEquals(md1.digest(), md2.digest()); assertTrue(new File(tmpDir2, "script1").canExecute()); assertFalse(new File(tmpDir2, "file1").canExecute()); } finally { for (File file : new File[] {tmpDir1, tmpDir2, tmpCpio}) { if (file != null) { file.delete(); } } } }