auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
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."); e.printStackTrace(); 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"); } }

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:
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)) { AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); 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); } }

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:
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] + "." + frameList.params.__a[3]); 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); }

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:
private void encodeMessage(InternalMessage message, ByteBuf out) { if (!addressWritten) { out.writeByte(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); }

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:
public void setup() { try { folder.create(); 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" ); }

Target:
public void setup() { readTestSupport.setup( folder.getRoot(), a -> { } ); kernel = readTestSupport.kernelToTest(); session = kernel.beginSession( SecurityContext.AUTH_DISABLED ); }
Source:
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) { return new SegueErrorResponse(Status.NOT_FOUND, "User ID specified cound not be found").toResponse(); } }

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:
public Class[] getAdapterList() { return new Class[] { IResource.class, IHistoryView.class }; }

Target:
public Class[] getAdapterList() { return new Class[] { Repository.class }; }
Source:
public Response getClientToken(@PathParam("clientId") String clientId, @PathParam("nxuser") String nxuser, @Context HttpServletRequest request) { checkPermission(nxuser); OAuth2Client client = Framework.getService(OAuth2ClientService.class).getClient(clientId); return Response.ok(getToken(client, nxuser)).build(); }

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:
private 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; }

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:
private Set<StaleBroadcast> getStaleBroadcasts( Set<BroadcastRef> updateBroadcastRefs, Set<BroadcastRef> currentBroadcastRefs ) { ImmutableMultimap<Date, BroadcastRef> updateBroadcastsPerDay = getBroadcastsPerDay( 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(); }

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:
public static SSLContext getTruststoreSSLContext(KeystoreService keystoreService) { SSLContext sslContext = null; try { SSLContextBuilder sslContextBuilder = SSLContexts.custom(); 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; }

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:
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", password); connect(connectionString, props); }

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:
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(annotationModel -> { Annotation annotation = new AnnotationImpl(); Comments.documentModelToExternalAnnotation().accept(annotationModel, annotation); return annotation; }) .collect(Collectors.toList()); }

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:
public DoxygenSingleAutoEditStrategy() { super(); }

Target:
public DoxygenSingleAutoEditStrategy() { super(true); }
Source:
@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 same"); usageCache( logger, VALIDATE_INDEXES, description, map, optional(CACHES), OP_NODE_ID, optional(or(CHECK_FIRST + " N", CHECK_THROUGH + " K", CHECK_CRC, CHECK_SIZES)) ); }

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:
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); this.terminated = false; }

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:
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); List<Interval> intervalList_onePair = new ArrayList<>(); intervalList_onePair.add(interval); return new Object[][]{ {intervalList_twoPair, 4}, {intervalList_noMatch, 0}, {intervalList_onePair, 2} }; }

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:
public EntityType(Type type, Set<Supertype> superTypes) { super(type); this.superTypes = superTypes; this.modifiedSimpleName = new DefaultVariableNameFunction().apply(this); }

Target:
public EntityType(Type type, Set<Supertype> superTypes) { this(type, superTypes, new DefaultVariableNameFunction()); }
Source:
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) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } default: throw new IllegalArgumentException("Invalid Browser specified"); } }

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:
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 + " cannot be parse, wrong in pattern"); } catch (java.text.ParseException ex) { assertTrue(!ex.getMessage().contains("This header doesn't allow parameters")); } }

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:
private void addGlusterBricksFeature(Features features) { Feature feature = new Feature(); feature.setName("Gluster Bricks management"); feature.setDescription("Ability to delete gluster bricks with data migration"); features.getFeature().add(feature); }

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:
protected void updateVmDeviceAddress(final String address, final VmDevice vmDevice) { vmDevice.setAddress(address); DbFacade.getInstance().getVmDeviceDao().update(vmDevice); }

Target:
protected void updateVmDeviceAddress(final String address, final VmDevice vmDevice) { vmDevice.setAddress(address); vmDeviceDAO.update(vmDevice); }
Source:
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(); params.height = totalItemsHeight + totalDividersHeight; listListView.setLayoutParams(params); listListView.requestLayout(); } else { listListView.setVisibility(View.GONE); } }

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:
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); registerCommand("host fqdn", new ShellCommand(new String[]{"hostname", "-v"}), 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); }

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:
private Locale getLocaleFromCookies(final Cookie[] cookies) { Locale locale = null; if (null != cookies) { for (Cookie cookie: cookies) { if (LOCALE.equalsIgnoreCase(cookie.getName())) { locale = LocaleUtils.getLocaleFromString(cookie.getValue()); break; } } } return locale; }

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:
public void clickOnInputFieldTag(String tagName) { seleniumWebDriverHelper.waitAndClick(By.xpath(format(" }

Target:
public void clickOnInputFieldTag(String tagName) { seleniumWebDriverHelper.waitAndClick( By.xpath(format(FILTERS_INPUT_TAG_XPATH_TEMPLATE, tagName))); }
Source:
private void getRoutes(Router router) { router.get(String.format("/api/%s", getServiceName())).handler(this::getBookings); router.post(String.format("/api/%s/:seats", getServiceName())).handler(this::makeBooking); }

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:
public void setUp() throws Exception { 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(); }

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:
public static boolean isPowerOf2(long value) { return (value & value - 1) == 0; }

Target:
public static boolean isPowerOf2(long value) { Preconditions.checkArgument(value > 0, "value must be positive"); return (value & (value - 1)) == 0; }
Source:
public void benchWavTrack() throws Exception { WavTrack wavTrack = new WavTrack(url); boolean isEOMReached = false; while (!isEOMReached) { Frame process = wavTrack.process(0); isEOMReached = process.isEOM(); } wavTrack.close(); }

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:
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> gradeHistroy = clone.getGradeHistoryBuilderList(); 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()); }

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:
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(new Random().nextInt(config.uris().size())); }

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:
public NettyServer(NettyConfig nettyConfig, NettyMetrics nettyMetrics, ChannelInitializer<SocketChannel> channelInitializer) { this.nettyConfig = nettyConfig; this.nettyMetrics = nettyMetrics; this.channelInitializer = channelInitializer; NettyRequest.bufferWatermark = nettyConfig.nettyServerRequestBufferWatermark; NettyRequest.maxBytesPerRead = nettyConfig.nettyServerMaxBytesPerRead; logger.trace("Instantiated NettyServer"); }

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:
public synchronized int registerEvaluator(final String contextId) { if (evalPartitionMap.containsKey(contextId)) { throw new RuntimeException("This evaluator is already registered"); } 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; }

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:
public void writeToPacketNBT(CompoundNBT cmp) { super.writeToPacketNBT(cmp); ListNBT flowerList = new ListNBT(); for (Block flower : lastFlowers) { flowerList.add(StringNBT.valueOf(flower.getRegistryName().toString())); } cmp.put(TAG_LAST_FLOWERS, flowerList); cmp.putInt(TAG_LAST_FLOWER_TIMES, lastFlowerCount); cmp.putInt(TAG_STREAK_LENGTH, streakLength); }

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:
public static ZoneOffset getDefault() { final int seconds = TimeZone.getDefault().getRawOffset()/1000; return ZoneOffset.newBuilder() .setAmountSeconds(seconds) .build(); }

Target:
public static ZoneOffset getDefault() { final int seconds = TimeZone.getDefault() .getRawOffset() / (int) MILLIS_PER_SECOND; return ZoneOffset.newBuilder() .setAmountSeconds(seconds) .build(); }
Source:
public void testSimple() throws Exception { assumeTrue(SystemUtils.IS_OS_UNIX); File tmpCpio = null; File tmpDir1 = null; File tmpDir2 = null; try { tmpCpio = File.createTempFile("test1", "tar"); 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(); } } } }

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(); } } } }
Source:
public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource config) { super.registerBeansForRoot(registry, config); Object source = config.getSource(); this.sessionBeanName = registerWithSuggestedNameOrGenerateNewName(createSharedSessionCreatorBeanDefinition(config), registry, DEFAULT_SESSION_BEAN_NAME, source); this.neo4jMappingContextBeanName = registerWithSuggestedNameOrGenerateNewName( createNeo4jMappingContextFactoryBeanDefinition(config), registry, DEFAULT_NEO4J_MAPPING_CONTEXT_BEAN_NAME, source); registerIfNotAlreadyRegistered(new RootBeanDefinition(Neo4jPersistenceExceptionTranslator.class), registry, NEO4J_PERSISTENCE_EXCEPTION_TRANSLATOR_NAME, source); if (HAS_ENTITY_INSTANTIATOR_FEATURE) { AbstractBeanDefinition rootBeanDefinition = BeanDefinitionBuilder .rootBeanDefinition(Neo4jOgmEntityInstantiatorConfigurationBean.class) .setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE) .addConstructorArgReference(this.getSessionFactoryBeanName(config)) .addConstructorArgReference(this.neo4jMappingContextBeanName) .getBeanDefinition(); registerIfNotAlreadyRegistered(rootBeanDefinition, registry, ENTITY_INSTANTIATOR_CONFIGURATION_BEAN_NAME, source); } }

Target:
public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource config) { super.registerBeansForRoot(registry, config); Object source = config.getSource(); String configuredSessionBeanName = Optional.of("sessionBeanName").flatMap(config::getAttribute) .orElse(GENERATE_BEAN_NAME); this.sessionBeanName = registerWithGeneratedNameOrUseConfigured(createSharedSessionCreatorBeanDefinition(config), registry, configuredSessionBeanName, source); String configuredMappingContextBeanName = Optional.of("mappingContextBeanName").flatMap(config::getAttribute) .orElse(GENERATE_BEAN_NAME); this.neo4jMappingContextBeanName = registerWithGeneratedNameOrUseConfigured( createNeo4jMappingContextFactoryBeanDefinition(config), registry, configuredMappingContextBeanName, source); registerIfNotAlreadyRegistered(new RootBeanDefinition(Neo4jPersistenceExceptionTranslator.class), registry, NEO4J_PERSISTENCE_EXCEPTION_TRANSLATOR_NAME, source); if (HAS_ENTITY_INSTANTIATOR_FEATURE) { AbstractBeanDefinition rootBeanDefinition = BeanDefinitionBuilder .rootBeanDefinition(Neo4jOgmEntityInstantiatorConfigurationBean.class) .setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE) .addConstructorArgReference(getSessionFactoryBeanName(config)) .addConstructorArgReference(this.neo4jMappingContextBeanName).getBeanDefinition(); registerIfNotAlreadyRegistered(rootBeanDefinition, registry, ENTITY_INSTANTIATOR_CONFIGURATION_BEAN_NAME, source); } }
Source:
public void testSetDutyCycleConnectionClosed() { Mockito.when(mockedPort.isOpen()).thenReturn(false); try { xbeeDevice.setPWMDutyCycle(IOLine.DIO10_PWM0, 75); fail("Duty cycle shouldn't have been set."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }

Target:
public void testSetDutyCycleConnectionClosed() throws InvalidOperatingModeException, XBeeException { Mockito.when(mockedPort.isOpen()).thenReturn(false); xbeeDevice.setPWMDutyCycle(IOLine.DIO10_PWM0, DUTY_CYCLE_VALID_VALUE); }
Source:
private void configurationElement(XNode context) { try { String namespace = context.getStringAttribute("namespace"); if (namespace == null || namespace.equals("")) { throw new BuilderException("Mapper's namespace cannot be empty"); } builderAssistant.setCurrentNamespace(namespace); cacheRefElement(context.evalNode("cache-ref")); cacheElement(context.evalNode("cache")); parameterMapElement(context.evalNodes("/mapper/parameterMap")); resultMapElements(context.evalNodes("/mapper/resultMap")); sqlElement(context.evalNodes("/mapper/sql")); buildStatementFromContext(context.evalNodes("select|insert|update|delete")); } catch (Exception e) { throw new BuilderException("Error parsing Mapper XML." + ErrorContext.instance() + " Cause: " + e, e); } }

Target:
private void configurationElement(XNode context) { try { String namespace = context.getStringAttribute("namespace"); if (namespace == null || namespace.equals("")) { throw new BuilderException("Mapper's namespace cannot be empty"); } builderAssistant.setCurrentNamespace(namespace); cacheRefElement(context.evalNode("cache-ref")); cacheElement(context.evalNode("cache")); parameterMapElement(context.evalNodes("/mapper/parameterMap")); resultMapElements(context.evalNodes("/mapper/resultMap")); sqlElement(context.evalNodes("/mapper/sql")); buildStatementFromContext(context.evalNodes("select|insert|update|delete")); } catch (Exception e) { throw new BuilderException("Error parsing Mapper XML.The XML location is " + resource + " Cause: " + e, e); } }
Source:
private StoreFindToken(Type type, Offset offset, StoreKey key, UUID sessionId, UUID incarnationId, boolean inclusive, short version) { if (version != VERSION_0 && version != VERSION_1 && version != VERSION_2) { throw new IllegalArgumentException("Unsupported version " + version + " for StoreFindToken "); } if (!type.equals(Type.Uninitialized)) { if (offset == null || sessionId == null) { throw new IllegalArgumentException("Offset [" + offset + "] or SessionId [" + sessionId + "] cannot be null"); } else if (type.equals(Type.IndexBased) && key == null) { throw new IllegalArgumentException("StoreKey cannot be null for an index based token"); } } this.type = type; this.offset = offset; this.storeKey = key; this.sessionId = sessionId; this.inclusive = inclusive ? (byte) 1 : 0; this.incarnationId = incarnationId; this.bytesRead = -1; this.version = version; }

Target:
private StoreFindToken(Type type, Offset offset, StoreKey key, UUID sessionId, UUID incarnationId, boolean inclusive, short version) { if (!type.equals(Type.Uninitialized)) { if (offset == null || sessionId == null) { throw new IllegalArgumentException("Offset [" + offset + "] or SessionId [" + sessionId + "] cannot be null"); } else if (type.equals(Type.IndexBased) && key == null) { throw new IllegalArgumentException("StoreKey cannot be null for an index based token"); } if (version == VERSION_2 && incarnationId == null) { throw new IllegalArgumentException("IncarnationId cannot be null for StoreFindToken of version 2"); } } this.type = type; this.offset = offset; this.storeKey = key; this.sessionId = sessionId; this.inclusive = inclusive ? (byte) 1 : 0; this.incarnationId = incarnationId; this.bytesRead = -1; this.version = version; }
Source:
private boolean matchDefinition(Definition definition, InetAddress inetAddress, String location) { String locationFromDefinition = definition.getLocation(); if(DEFAULT_LOCATION.equals(location)) { location = null; } if(DEFAULT_LOCATION.equals(definition.getLocation())) { locationFromDefinition = null; } boolean locationMatched = Objects.equals(location, locationFromDefinition); if(locationMatched) { return matchingIpAddress(inetAddress, definition); } return false; }

Target:
private boolean matchDefinition(Definition definition, InetAddress inetAddress, String location) { boolean locationMatched = LocationUtils.doesLocationsMatch(location, definition.getLocation()); return locationMatched && matchingIpAddress(inetAddress, definition); }