auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void initPageHeader() { final HorizontalPanel hp = new HorizontalPanel(); hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel()); final Label filterLabel = new Label(Util.C.projectFilter()); filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel()); hp.add(filterLabel); filterTxt = new NpTextBox(); filterTxt.setValue(subname); filterTxt.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { subname = filterTxt.getValue(); onLoad(); } }); hp.add(filterTxt); add(hp); }

Target:
private void initPageHeader() { final HorizontalPanel hp = new HorizontalPanel(); hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel()); final Label filterLabel = new Label(Util.C.projectFilter()); filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel()); hp.add(filterLabel); filterTxt = new NpTextBox(); filterTxt.setValue(subname); filterTxt.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { subname = filterTxt.getValue(); refresh(); } }); hp.add(filterTxt); add(hp); }
Source:
public static <T> PCollection<T> ofDefaultWindow(PCollection<T> in) { if (in.getWindowingStrategy() != WindowingStrategy.globalDefault()) return in; return in.apply("ApplyDefaultWindow", Window.<T> into(FixedWindows.of(DEFAULT_WINDOW_SIZE))); }

Target:
public static <T> PCollection<T> ofDefaultWindow(PCollection<T> in) { if (in.getWindowingStrategy() != WindowingStrategy.globalDefault() && in.getWindowingStrategy() != null) return in; return in.apply("ApplyDefaultWindow", Window.<T> into(FixedWindows.of(DEFAULT_WINDOW_SIZE))); }
Source:
public static List<Bundle> readBundleFromFolder(final String folderPath) throws IOException { final List<Bundle> bundleList = new ArrayList<Bundle>(); logger.info("Loading xmls from directory: " + folderPath); File directory = null; try { directory = new File(BundleUtil.class.getResource("/" + folderPath).toURI()); } catch (URISyntaxException e) { Assert.fail("could not find dir: " + folderPath); } final Collection<File> files = FileUtils.listFiles(directory, new String[] {"xml"}, true); String clusterData = ""; final List<String> dataSets = new ArrayList<String>(); String processData = ""; for (File file : files) { logger.info("Loading data from path: " + file.getAbsolutePath()); final String data = IOUtils.toString(file.toURI()); if (data.contains("uri:ivory:cluster:0.1") || data.contains("uri:falcon:cluster:0.1")) { logger.info("data been added to cluster"); clusterData = data; } else if (data.contains("uri:ivory:feed:0.1") || data.contains("uri:falcon:feed:0.1")) { logger.info("data been added to feed"); dataSets.add(InstanceUtil.setFeedACL(data)); } else if (data.contains("uri:ivory:process:0.1") || data.contains("uri:falcon:process:0.1")) { logger.info("data been added to process"); processData = data; } } Assert.assertNotNull(clusterData, "expecting cluster data to be non-empty"); Assert.assertTrue(!dataSets.isEmpty(), "expecting feed data to be non-empty"); bundleList.add(new Bundle(clusterData, dataSets, processData)); return bundleList; }

Target:
private static Bundle readBundleFromFolder(final String folderPath) throws IOException { LOGGER.info("Loading xmls from directory: " + folderPath); File directory = null; try { directory = new File(BundleUtil.class.getResource("/" + folderPath).toURI()); } catch (URISyntaxException e) { Assert.fail("could not find dir: " + folderPath); } final Collection<File> files = FileUtils.listFiles(directory, new String[] {"xml"}, true); String clusterData = ""; final List<String> dataSets = new ArrayList<String>(); String processData = ""; for (File file : files) { LOGGER.info("Loading data from path: " + file.getAbsolutePath()); final String data = IOUtils.toString(file.toURI()); if (data.contains("uri:ivory:cluster:0.1") || data.contains("uri:falcon:cluster:0.1")) { LOGGER.info("data been added to cluster"); clusterData = data; } else if (data.contains("uri:ivory:feed:0.1") || data.contains("uri:falcon:feed:0.1")) { LOGGER.info("data been added to feed"); dataSets.add(InstanceUtil.setFeedACL(data)); } else if (data.contains("uri:ivory:process:0.1") || data.contains("uri:falcon:process:0.1")) { LOGGER.info("data been added to process"); processData = data; } } Assert.assertNotNull(clusterData, "expecting cluster data to be non-empty"); Assert.assertTrue(!dataSets.isEmpty(), "expecting feed data to be non-empty"); return new Bundle(clusterData, dataSets, processData); }
Source:
void addColumn(final int index) { expression.ifPresent(relation -> { final InformationItem informationItem = new InformationItem(); final RelationColumn relationColumn = makeRelationColumn(informationItem); informationItem.setName(new Name("Column")); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddRelationColumnCommand(relation, informationItem, model, relationColumn, index, uiModelMapper, () -> { resize(); relationColumn.startEditingHeaderCell(0); })); }); }

Target:
void addColumn(final int index) { expression.ifPresent(relation -> { final InformationItem informationItem = new InformationItem(); final RelationColumn relationColumn = makeRelationColumn(informationItem); informationItem.setName(new Name()); final CommandResult<CanvasViolation> result = sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddRelationColumnCommand(relation, informationItem, model, relationColumn, index, uiModelMapper, this::resize)); if (!CommandUtils.isError(result)) { relationColumn.startEditingHeaderCell(0); } }); }
Source:
private Clickable newTaskListLink() { final TreeIndexed<String> tree = new TreeIndexed<String>(); return new Link(_("New List"), _("Check the new task list"), new CheckValidSessionBeforeAction(new ActionShowView(AngularIFrameView.TASK_LISTING_TOKEN, tree))); }

Target:
private Clickable newTaskListLink() { final TreeIndexed<String> tree = new TreeIndexed<String>(); return new Link("New List", "Check the new task list", new CheckValidSessionBeforeAction(new ActionShowView(AngularIFrameView.TASK_LISTING_TOKEN, tree))); }
Source:
private List<VdsNetworkInterface> applyUserConfiguredNics() { List<VdsNetworkInterface> nicsToConfigure = getNicsToConfigureWithoutLabelsUpdates(); updateLabelsOnNicsToConfigure(nicsToConfigure); return new ArrayList<>(nicsToConfigure); }

Target:
private List<VdsNetworkInterface> applyUserConfiguredNics() { List<VdsNetworkInterface> nicsToConfigure = getNicsToConfigureWithoutLabelsUpdates(); updateLabelsOnNicsToConfigure(nicsToConfigure); return nicsToConfigure; }
Source:
protected void handleFile(File file, int depth, Collection results) throws IOException { if (excludeFiles.contains(file.getAbsolutePath())) { return; } zipStream.putNextEntry(new ZipEntry(fromRoot(file))); try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));) { IOUtils.copy(in, zipStream); } }

Target:
protected void handleFile(File file, int depth, Collection results) throws IOException { if (excludeFiles.contains(file.getAbsolutePath())) { return; } zipStream.putNextEntry(new ZipEntry(fromRoot(file))); try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(file))) { IOUtils.copy(in, zipStream); } }
Source:
public List<JournalEntry> getEntriesSince(long offset, boolean inclusive) { if (!journal.containsKey(offset)) { return null; } ConcurrentNavigableMap<Long, StoreKey> subsetMap = journal.tailMap(offset, true); int entriesToReturn = Math.min(subsetMap.size(), maxEntriesToReturn); List<JournalEntry> journalEntries = new ArrayList<JournalEntry>(entriesToReturn); int entriesAdded = 0; for (Map.Entry<Long, StoreKey> entries : subsetMap.entrySet()) { if (inclusive || entries.getKey() != offset) { journalEntries.add(new JournalEntry(entries.getKey(), entries.getValue())); entriesAdded++; if (entriesAdded == entriesToReturn) { break; } } } if (!journal.containsKey(offset)) { return null; } return journalEntries; }

Target:
public List<JournalEntry> getEntriesSince(long offset, boolean inclusive) { if (!journal.containsKey(offset)) { return null; } ConcurrentNavigableMap<Long, StoreKey> subsetMap = journal.tailMap(offset, true); int entriesToReturn = Math.min(subsetMap.size(), maxEntriesToReturn); List<JournalEntry> journalEntries = new ArrayList<JournalEntry>(entriesToReturn); int entriesAdded = 0; for (Map.Entry<Long, StoreKey> entries : subsetMap.entrySet()) { if (inclusive || entries.getKey() != offset) { journalEntries.add(new JournalEntry(entries.getKey(), entries.getValue())); entriesAdded++; if (entriesAdded == entriesToReturn) { break; } } } if (!journal.containsKey(offset)) { return null; } logger.trace("Journal : " + dataDir + " entries returned " + journalEntries.size()); return journalEntries; }
Source:
private void hideEmptyView() { if (isAdded() && mEmptyView != null) { mFilterRadioGroup.setVisibility(View.VISIBLE); mEmptyView.setVisibility(View.GONE); } }

Target:
private void hideEmptyView() { if (isAdded() && mEmptyView != null) { setFilterViewScrollable(true); mEmptyView.setVisibility(View.GONE); mFilterDivider.setVisibility(View.VISIBLE); } }
Source:
public void dispose() { this.removeCallbacksAndMessages(null); this.phone = null; }

Target:
public void dispose() { super.dispose(); }
Source:
private <T> Map<String, T> getRepositoriesByType(Class<T> type) { if (type == GroupRepository.class) { return (Map<String, T>) groupRepositoriesByDc; } else if (type == TopicRepository.class) { return (Map<String, T>) topicRepositoriesByDc; } else if (type == SubscriptionRepository.class) { return (Map<String, T>) subscriptionRepositoriesByDc; } else if (type == OAuthProviderRepository.class) { return (Map<String, T>) oAuthProviderRepositoriesByDc; } else if (type == SubscriptionOffsetChangeIndicator.class) { return (Map<String, T>) offsetChangeIndicatorsByDc; } else if (type == MessagePreviewRepository.class) { return (Map<String, T>) messagePreviewRepositoriesByDc; } else if (type == TopicBlacklistRepository.class) { return (Map<String, T>) topicBlacklistRepositoriesByDc; } else if (type == UndeliveredMessageLog.class) { return (Map<String, T>) undeliveredMessageLogsByDc; } else { throw new InternalProcessingException("Could not provide repository of type: " + type.getName()); } }

Target:
private <T> Map<String, T> getRepositoriesByType(Class<T> type) { Object repository = repositoryByType.get(type); if (repository == null) { throw new InternalProcessingException("Could not provide repository of type: " + type.getName()); } return (Map<String, T>) repository; }
Source:
public void destroy() { if (secret != null) { for (int i = 0; i < secret.length; i++) { secret[i] = 0; } } }

Target:
public void destroy() { if (secret != null) { for (int i = 0; i < secret.length; i++) { secret[i] = 0; } secret = null; } }
Source:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateEscalationEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertEscalationEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, ""); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateEscalationEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertEscalationEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, EMPTY_VALUE); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
public boolean shouldOverrideUrlLoading(final WebView view, String url) { Uri callbackUri = Uri.parse(url); Map<String, String> params = UriFragmentParser.parse(callbackUri); String ec = params.get("ec"); String startURL = params.get("startURL"); if (ec != null && (ec.equals("301") || ec.equals("302"))) { SalesforceOAuthPlugin.refresh(ctx, view, startURL); return true; } else { return super.shouldOverrideUrlLoading(view, url); } }

Target:
public boolean shouldOverrideUrlLoading(final WebView view, String url) { String startURL = isLoginRedirect(url); if (startURL != null) { SalesforceOAuthPlugin.refresh(ctx, view, startURL); return true; } else { return super.shouldOverrideUrlLoading(view, url); } }
Source:
private void isSuccessfulScan(RegionInfo region) throws IOException { Scan scan = new Scan().withStartRow(region.getStartKey()).setRaw(true).setOneRowLimit() .setMaxResultSize(1L).setCaching(1).setFilter(new FirstKeyOnlyFilter()) .setCacheBlocks(false); try (Table table = conn.getTable(region.getTable()); ResultScanner scanner = table.getScanner(scan)) { scanner.next(); } catch (IOException e) { LOG.error("Could not scan region:" + region.getEncodedName(), e); throw e; } }

Target:
private void isSuccessfulScan(RegionInfo region) throws IOException { Scan scan = new Scan().withStartRow(region.getStartKey()).setRaw(true).setOneRowLimit() .setMaxResultSize(1L).setCaching(1).setFilter(new FirstKeyOnlyFilter()) .setCacheBlocks(false); try (Table table = conn.getTable(region.getTable()); ResultScanner scanner = table.getScanner(scan)) { scanner.next(); } catch (IOException e) { LOG.error("Could not scan region: {}", region.getEncodedName(), e); throw e; } }
Source:
public void processElement(ProcessContext context) { Map<String, Object> selectedFields = new HashMap<>(); List<Schema.Field> fieldSchemas = new ArrayList<>(); for (SelectorProperties selector : properties.selectors.subProperties) { String path = selector.path.getValue(); String field = selector.field.getValue(); if (StringUtils.isNotEmpty(field) && StringUtils.isNotEmpty(path)) { List<Evaluator.Ctx> avPathContexts = FieldSelectorUtil.getInputFields(context.element(), path); if (outputSchema == null) { if (avPathContexts.isEmpty()) { fieldSchemas.add(inferSchema(context.element(), path, field)); } else { fieldSchemas.add(retrieveSchema(avPathContexts, path, field)); } } if (!avPathContexts.isEmpty()) { if (avPathContexts.size() > 1 || FieldSelectorUtil.canRetrieveMultipleElements(selector.path.getValue())) { selectedFields.put(selector.field.getValue(), FieldSelectorUtil.extractValuesFromContext(avPathContexts)); } else { selectedFields.put(selector.field.getValue(), avPathContexts.get(0).value()); } } } } if (!selectedFields.isEmpty()) { if (outputSchema == null) { outputSchema = Schema.createRecord(fieldSchemas); } context.output(FieldSelectorUtil.generateIndexedRecord(selectedFields, outputSchema)); } }

Target:
public void processElement(ProcessContext context) { Map<String, Object> selectedFields = new HashMap<>(); List<Schema.Field> fieldSchemas = new ArrayList<>(); for (SelectorProperties selector : properties.selectors.subProperties) { String path = selector.path.getValue(); String field = selector.field.getValue(); if (StringUtils.isNotEmpty(field) && StringUtils.isNotEmpty(path)) { List<Evaluator.Ctx> avPathContexts = FieldSelectorUtil.getInputFields(context.element(), path); if (outputSchema == null) { if (avPathContexts.isEmpty()) { fieldSchemas.add(inferSchema(context.element(), path, field)); } else { fieldSchemas.add(retrieveSchema(avPathContexts, path, field)); } } if (!avPathContexts.isEmpty()) { selectedFields.put(field, FieldSelectorUtil.extractValuesFromContext(avPathContexts, path)); } } } if (!selectedFields.isEmpty()) { if (outputSchema == null) { outputSchema = Schema.createRecord("output_" + context.element().getSchema().getName(), "", "", false, fieldSchemas); } context.output(FieldSelectorUtil.generateIndexedRecord(selectedFields, outputSchema)); } }
Source:
public CallBatcher add(W input) { requireNotStopped(); initialize(); CallManagerImpl.CallArgsImpl args = null; if (input == null) { if(inputType == Void.class) throw new IllegalArgumentException("Input type is void"); args = makeDefaultArgs(); } else if (queue != null) { queue.add(input); boolean timeToCallBatch = (queue.size() % getBatchSize()) == 0; if (!timeToCallBatch) return this; List<W> batch = new ArrayList<>(); int batchSize = queue.drainTo(batch, getBatchSize()); if (batchSize < 1) return this; RESTServices.CallField field = (batchSize == 1) ? fieldifier.field(batch.get(0)) : fieldifier.field(batch.stream()); args = addDefaultArgs(field); } else if (fieldifier != null) { RESTServices.CallField field = fieldifier.field(input); args = addDefaultArgs(field); } else if (input instanceof CallManager.CallArgs) { if (!(input instanceof CallManagerImpl.CallArgsImpl)) { throw new IllegalArgumentException("unsupported implementation of call arguments: " + input.getClass().getCanonicalName()); } args = addDefaultArgs((CallManagerImpl.CallArgsImpl) input); } else { throw new MarkLogicInternalException("Unknown input"); } caller.checkArgs(args); submitCall(args); return this; }

Target:
public CallBatcher add(W input) { requireNotStopped(); initialize(); CallManagerImpl.CallArgsImpl args = null; if (input == null) { if(inputType == Void.class) throw new IllegalArgumentException("Cannot call add() when supplying arguments with generator."); args = makeDefaultArgs(); } else if (queue != null) { queue.add(input); boolean timeToCallBatch = (queue.size() % getBatchSize()) == 0; if (!timeToCallBatch) return this; List<W> batch = new ArrayList<>(); int batchSize = queue.drainTo(batch, getBatchSize()); if (batchSize < 1) return this; RESTServices.CallField field = (batchSize == 1) ? fieldifier.field(batch.get(0)) : fieldifier.field(batch.stream()); args = addDefaultArgs(field); } else if (fieldifier != null) { RESTServices.CallField field = fieldifier.field(input); args = addDefaultArgs(field); } else if (input instanceof CallManager.CallArgs) { if (!(input instanceof CallManagerImpl.CallArgsImpl)) { throw new IllegalArgumentException("unsupported implementation of call arguments: " + input.getClass().getCanonicalName()); } args = addDefaultArgs((CallManagerImpl.CallArgsImpl) input); } else { throw new MarkLogicInternalException("Unknown input"); } caller.checkArgs(args); submitCall(args); return this; }
Source:
public void onFinishInflate() { super.onFinishInflate(); Locale locale = getResources().getConfiguration().locale; if (!"fa".equals(locale.getLanguage())) { locale = new Locale.Builder() .setLocale(locale) .setUnicodeLocaleKeyword("nu", "latn") .build(); } final NumberFormat nf = DecimalFormat.getInstance(locale); final DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale); for (int childIndex = getChildCount() - 1; childIndex >= 0; --childIndex) { final View v = getChildAt(childIndex); if (v instanceof Button) { final Button b = (Button) v; switch (b.getId()) { case R.id.digit_0: b.setText(nf.format(0)); break; case R.id.digit_1: b.setText(nf.format(1)); break; case R.id.digit_2: b.setText(nf.format(2)); break; case R.id.digit_3: b.setText(nf.format(3)); break; case R.id.digit_4: b.setText(nf.format(4)); break; case R.id.digit_5: b.setText(nf.format(5)); break; case R.id.digit_6: b.setText(nf.format(6)); break; case R.id.digit_7: b.setText(nf.format(7)); break; case R.id.digit_8: b.setText(nf.format(8)); break; case R.id.digit_9: b.setText(nf.format(9)); break; case R.id.dec_point: b.setText(String.valueOf(symbols.getDecimalSeparator())); break; } } } }

Target:
public void onFinishInflate() { super.onFinishInflate(); Locale locale = getResources().getConfiguration().locale; if (!getResources().getBoolean(R.bool.use_localized_digits)) { locale = new Locale.Builder() .setLocale(locale) .setUnicodeLocaleKeyword("nu", "latn") .build(); } final DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale); final char zeroDigit = symbols.getZeroDigit(); for (int childIndex = getChildCount() - 1; childIndex >= 0; --childIndex) { final View v = getChildAt(childIndex); if (v instanceof Button) { final Button b = (Button) v; switch (b.getId()) { case R.id.digit_0: b.setText(String.valueOf(zeroDigit)); break; case R.id.digit_1: b.setText(String.valueOf((char) (zeroDigit + 1))); break; case R.id.digit_2: b.setText(String.valueOf((char) (zeroDigit + 2))); break; case R.id.digit_3: b.setText(String.valueOf((char) (zeroDigit + 3))); break; case R.id.digit_4: b.setText(String.valueOf((char) (zeroDigit + 4))); break; case R.id.digit_5: b.setText(String.valueOf((char) (zeroDigit + 5))); break; case R.id.digit_6: b.setText(String.valueOf((char) (zeroDigit + 6))); break; case R.id.digit_7: b.setText(String.valueOf((char) (zeroDigit + 7))); break; case R.id.digit_8: b.setText(String.valueOf((char) (zeroDigit + 8))); break; case R.id.digit_9: b.setText(String.valueOf((char) (zeroDigit + 9))); break; case R.id.dec_point: b.setText(String.valueOf(symbols.getDecimalSeparator())); break; } } } }
Source:
public void increaseActualCachesFound() { if (getActualCachesFound() >= 0) { setActualCachesFound(getActualCachesFound() + 1); } }

Target:
public void increaseActualCachesFound() { if (actualCachesFound >= 0) { actualCachesFound++; } }
Source:
public void testEncode() throws IOException { final XMLLogger test = new XMLLogger(outStream, false); assertNotNull("should be able to create XMLLogger without issue", test); final String[][] encodings = { {"<", "&lt;"}, {">", "&gt;"}, {"'", "&apos;"}, {"\"", "&quot;"}, {"&", "&amp;"}, {"&lt;", "&amp;lt;"}, {"abc;", "abc;"}, {"&#0;", "&amp;#0;"}, {"&#0", "&amp;#0"}, {"&#X0;", "&amp;#X0;"}, }; for (String[] encoding : encodings) { final String encoded = XMLLogger.encode(encoding[0]); assertEquals("\"" + encoding[0] + "\"", encoding[1], encoded); } outStream.close(); }

Target:
public void testEncode() throws IOException { final XMLLogger test = new XMLLogger(outStream, false); assertNotNull("should be able to create XMLLogger without issue", test); final String[][] encodings = { {"<", "&lt;"}, {">", "&gt;"}, {"'", "&apos;"}, {"\"", "&quot;"}, {"&", "&amp;"}, {"&lt;", "&amp;lt;"}, {"abc;", "abc;"}, {"&#0;", "&amp;#0;"}, {"&#0", "&amp;#0"}, {"&#X0;", "&amp;#X0;"}, {"\u0001", "#x1;"}, {"\u0080", "#x80;"}, }; for (String[] encoding : encodings) { final String encoded = XMLLogger.encode(encoding[0]); assertEquals("\"" + encoding[0] + "\"", encoding[1], encoded); } outStream.close(); }
Source:
private static List<technology.tabula.Pair<Integer, Rectangle>> whichAreas(CommandLine line) throws ParseException { if (!line.hasOption('a')) { return new ArrayList<>(); } System.out.println("What I'm getting..."); String[] areaArgs = line.getOptionValues('a'); ArrayList<String> sanitizedAreaArgs = new ArrayList<String>(); ArrayList<Integer> areaType = new ArrayList<Integer>(); for(int index=0; index<areaArgs.length; index++){ System.out.println(areaArgs[index]); if(areaArgs[index].startsWith("%")){ System.out.println("RELATIVE ARGUMENT"); areaType.add(RELATIVE_AREA_CALCULATION_MODE); sanitizedAreaArgs.add(areaArgs[index].substring(1)); } else{ System.out.println("ABSOLUTE ARGUMENT"); areaType.add(ABSOLUTE_AREA_CALCULATION_MODE); sanitizedAreaArgs.add(areaArgs[index]); } } System.out.println("Sanitized Options..."); System.out.println(sanitizedAreaArgs.toString()); List<Float> f = parseFloatList(sanitizedAreaArgs.toString()); if((f.size()%4)!=0){ throw new ParseException("area parameters must be top,left,bottom,right"); } ArrayList<technology.tabula.Pair<Integer,Rectangle>> pageAreas = new ArrayList<>(); for(Integer i=0; i<f.size(); i+=4){ pageAreas.add(new technology.tabula.Pair<Integer,Rectangle>( areaType.remove(0), new Rectangle(f.get(i),f.get(i+1),f.get(i+3)-f.get(i+1),f.get(i+2)-f.get(i)))); } System.out.println("Specified Page Areas:"); System.out.println(pageAreas); return pageAreas; }

Target:
private static List<technology.tabula.Pair<Integer, Rectangle>> whichAreas(CommandLine line) throws ParseException { if (!line.hasOption('a')) { return new ArrayList<>(); } String[] areaArgs = line.getOptionValues('a'); ArrayList<String> sanitizedAreaArgs = new ArrayList<String>(); ArrayList<Integer> areaType = new ArrayList<Integer>(); for(int index=0; index<areaArgs.length; index++){ if(areaArgs[index].startsWith("%")){ areaType.add(RELATIVE_AREA_CALCULATION_MODE); sanitizedAreaArgs.add(areaArgs[index].substring(1)); } else{ areaType.add(ABSOLUTE_AREA_CALCULATION_MODE); sanitizedAreaArgs.add(areaArgs[index]); } } List<Float> f = parseFloatList(sanitizedAreaArgs.toString()); if((f.size()%4)!=0){ throw new ParseException("area parameters must be top,left,bottom,right"); } ArrayList<technology.tabula.Pair<Integer,Rectangle>> pageAreas = new ArrayList<>(); for(Integer i=0; i<f.size(); i+=4){ pageAreas.add(new technology.tabula.Pair<Integer,Rectangle>( areaType.remove(0), new Rectangle(f.get(i),f.get(i+1),f.get(i+3)-f.get(i+1),f.get(i+2)-f.get(i)))); } return pageAreas; }
Source:
public MMSEndpoint(String baseUri) { try { uriBuilder = new URIBuilder(baseUri); this.baseUri = baseUri; } catch (URISyntaxException e) { Application.getInstance().getGUILog().log("[ERROR] Unexpected error in generation of MMS URL for project. Reason: " + e.getMessage()); e.printStackTrace(); } }

Target:
public MMSEndpoint(String baseUri) throws URISyntaxException { uriBuilder = new URIBuilder(baseUri); this.baseUri = baseUri; }
Source:
public void testWrongMethod() throws Exception { try { getApi().action("login").get().asObject(); assertFalse(true); } catch (ApiException e) { assertEquals("mustbeposted", e.getCode()); } }

Target:
public void testWrongMethod() throws Exception { try { getApi().action("login").get().asObject(); fail("Expected ApiException wasn't thrown."); } catch (ApiException e) { assertEquals("mustbeposted", e.getCode()); } }
Source:
public static User map(DbUser entity, User template) { User model = template != null ? template : new User(); model.setName(entity.getname()); model.setUserName(entity.getusername()); model.setId(entity.getuser_id().toString()); model.setLastName(entity.getsurname()); model.setEmail(entity.getemail()); model.setDepartment(entity.getdepartment()); if (entity.getgroups() != null) { model.setGroups(new Groups()); if (entity.getgroups().trim().length() > 0) { for (String name : entity.getgroups().split(",")) { Group group = new Group(); group.setName(name); model.getGroups().getGroups().add(group); } } } if(!StringHelper.isNullOrEmpty(entity.getdomain())){ Domain dom = new Domain(); dom.setName(entity.getdomain()); dom.setId(new NGuid(entity.getdomain().getBytes(), true).toString()); model.setDomain(dom); } return model; }

Target:
public static User map(DbUser entity, User template) { User model = template != null ? template : new User(); model.setName(entity.getname()); model.setUserName(entity.getusername()); model.setId(entity.getuser_id().toString()); model.setLastName(entity.getsurname()); model.setEmail(entity.getemail()); model.setDepartment(entity.getdepartment()); if (entity.getgroups() != null) { if (entity.getgroups().trim().length() > 0) { model.setGroups(new Groups()); for (String name : entity.getgroups().split(",")) { Group group = new Group(); group.setName(name); model.getGroups().getGroups().add(group); } } } if(!StringHelper.isNullOrEmpty(entity.getdomain())){ Domain dom = new Domain(); dom.setName(entity.getdomain()); dom.setId(new NGuid(entity.getdomain().getBytes(), true).toString()); model.setDomain(dom); } return model; }
Source:
protected Object createObject(String className, List<String> genericClasses) { if (ScenarioSimulationSharedUtils.isMap(className)) { return new HashMap(); } else { try { if (SIMPLE_TYPES_LIST.contains(className)) { return null; } return classLoader.loadClass(className).newInstance(); } catch (Exception e) { throw new IllegalArgumentException("Impossible to instantiate " + className, e); } } }

Target:
protected Object createObject(String className, List<String> genericClasses) { if (ScenarioSimulationSharedUtils.isMap(className)) { return new HashMap(); } else { try { return classLoader.loadClass(className).newInstance(); } catch (Exception e) { throw new IllegalArgumentException("Impossible to instantiate " + className, e); } } }
Source:
public void should_support_setting_and_retrieving_udt_fields() { String table = "unfrozen_udt_table"; String udt = "person"; session().execute(createType(udt).addColumn("first", DataType.text()).addColumn("last", DataType.text())); UserType userType = cluster().getMetadata().getKeyspace(keyspace).getUserType(udt); assertThat(userType).isNotNull(); session().execute(createTable(table).addPartitionKey("k", DataType.text()) .addUDTColumn("u", udtLiteral(udt)) ); UDTValue value = userType.newValue(); value.setString("first", "Bob"); value.setString("last", "Smith"); session().execute(insertInto(table).value("k", "key").value("u", value)); session().execute(update(table).with(set("u.last", "Jones")).where(eq("k", "key"))); Row r = session().execute(select("u.last").from(table).where(eq("k", "key"))).one(); assertThat(r.getString("u.last")).isEqualTo("Jones"); }

Target:
public void should_support_setting_and_retrieving_udt_fields() { String table = "unfrozen_udt_table"; String udt = "person"; session().execute(createType(udt).addColumn("first", DataType.text()).addColumn("last", DataType.text())); UserType userType = cluster().getMetadata().getKeyspace(keyspace).getUserType(udt); assertThat(userType).isNotNull(); session().execute(createTable(table).addPartitionKey("k", DataType.text()) .addUDTColumn("u", udtLiteral(udt)) ); UDTValue value = userType.newValue(); value.setString("first", "Bob"); value.setString("last", "Smith"); session().execute(insertInto(table).value("k", "key").value("u", value)); session().execute(update(table).with( set(path("u", "first"), "Rick")) .and(set(raw("u.last"), "Jones")) .where(eq("k", "key"))); Row r = session().execute(select() .path("u", "first") .raw("u.last") .from(table) .where(eq("k", "key"))).one(); assertThat(r.getString("u.first")).isEqualTo("Rick"); assertThat(r.getString("u.last")).isEqualTo("Jones"); }
Source:
private void verifySendReceive(final DefaultEventLoop el) throws IOException, InterruptedException { ServerImpl si = new ServerImpl(); ClientImpl ci = new ClientImpl(); new Thread(el).start(); el.start("localhost", 0, si); synchronized (si) { si.wait(); } SocketAddress address = si.getServerAddress(); logger.debug("Bound to address {}", address); Assert.assertEquals("Inet Socket Created", InetSocketAddress.class, address.getClass()); el.connect((InetSocketAddress)address, ci); ByteBuffer outboundBuffer = ByteBuffer.allocate(ClientImpl.BUFFER_CAPACITY); LongBuffer lb = outboundBuffer.asLongBuffer(); int i = 0; while (lb.hasRemaining()) { lb.put(i++); } boolean odd = false; outboundBuffer.position(i * 8); while (outboundBuffer.hasRemaining()) { outboundBuffer.put((byte)(odd ? 0x55 : 0xaa)); odd = !odd; } byte[] array = outboundBuffer.array(); while (!ci.send(array, 0, array.length)) { sleep(5); } sleep(100); el.disconnect(ci); el.stop(si); el.stop(); Assert.assertTrue(ci.read); }

Target:
private void verifySendReceive(final DefaultEventLoop el) throws IOException, InterruptedException { ServerImpl si = new ServerImpl(); ClientImpl ci = new ClientImpl(); new Thread(el).start(); el.start(new InetSocketAddress("localhost", 0), si); SocketAddress address; synchronized (si) { if ((address = si.getServerAddress()) == null) { si.wait(); address = si.getServerAddress(); } } el.connect((InetSocketAddress)address, ci); ByteBuffer outboundBuffer = ByteBuffer.allocate(ClientImpl.BUFFER_CAPACITY); LongBuffer lb = outboundBuffer.asLongBuffer(); int i = 0; while (lb.hasRemaining()) { lb.put(i++); } boolean odd = false; outboundBuffer.position(i * 8); while (outboundBuffer.hasRemaining()) { outboundBuffer.put((byte)(odd ? 0x55 : 0xaa)); odd = !odd; } byte[] array = outboundBuffer.array(); while (!ci.send(array, 0, array.length)) { sleep(5); } sleep(100); el.disconnect(ci); el.stop(si); el.stop(); Assert.assertTrue(ci.read); }
Source:
public void onSendMessage(View v) throws MessageActivityException { TextView inputField = (TextView) findViewById(R.id.inputMessageField); String inputMessage = inputField.getText().toString(); inputField.setText(""); Content content; if (mSendImage){ if (mImage == null){ throw new MessageActivityException("Error, attempting to send a null image."); } try { content = new ImageContent(mImage, inputMessage); } catch (ContentException e) { throw new MessageActivityException("Error im message activity, couldn't create ImageContent."); } mSendImage = false; } else { content = new TextContent(inputMessage); } Message message = null; try { message = new Message("message", new Id(1230), mUser, content); } catch (MessageException e) { throw new MessageActivityException("Error in message activity, couldn't create message"); } catch (NodeException e) { throw new MessageActivityException("Error in message activity, couldn't create message"); } mMessages.add(message); mAdapter.notifyDataSetChanged(); ListView lv = (ListView) findViewById(R.id.messageScrollLayout); lv.setSelection(lv.getAdapter().getCount() - 1); }

Target:
public void onSendMessage(View v) throws MessageActivityException { String inputMessage = mInputField.getText().toString(); mInputField.setText(""); Content content; if (mSendImage){ content = new ImageContent(mImage, inputMessage); mSendImage = false; } else { content = new TextContent(inputMessage); } Message message = new Message("message", new Id(1230), mUser, content); mMessages.add(message); mAdapter.notifyDataSetChanged(); ListView lv = (ListView) findViewById(R.id.messageScrollLayout); lv.setSelection(lv.getAdapter().getCount() - 1); }
Source:
public CommandResult<V> execute(final C context, final Command<C, V> command) { if (null != getDelegate()) { final CommandResult<V> r = getDelegate().execute(context, command); postExecute(context, command, r); return r; } return null; }

Target:
public CommandResult<V> execute(final C context, final Command<C, V> command) { if (null != getDelegate()) { preExecute(context, command); final CommandResult<V> result = getDelegate().execute(context, command); postExecute(context, command, result); return result; } return null; }
Source:
void setClean(boolean clean) throws Exception { this.clean = clean; }

Target:
void setClean(boolean clean) { this.clean = clean; }
Source:
protected Future<Boolean> updateFlushWait(long id, CyclicBarrier loadBarrier, CountDownLatch preFlushLatch, CountDownLatch flushLatch, CountDownLatch commitLatch) throws Exception { return executor.submit(() -> withTxSessionApply(s -> { try { Item item = s.load(Item.class, id); item.getName(); if (loadBarrier != null) { loadBarrier.await(WAIT_TIMEOUT, TimeUnit.SECONDS); } item.setDescription("Updated item"); s.update(item); if (preFlushLatch != null) { awaitOrThrow(preFlushLatch); } s.flush(); } catch (StaleStateException e) { log.info("Exception thrown: ", e); markRollbackOnly(s); return false; } catch (OptimisticLockException e) { log.info("Exception thrown: ", e); markRollbackOnly(s); return false; } catch (PessimisticLockException | org.hibernate.PessimisticLockException e) { log.info("Exception thrown: ", e); markRollbackOnly(s); return false; } finally { if (flushLatch != null) { flushLatch.countDown(); } } if (commitLatch != null) { awaitOrThrow(commitLatch); } return true; })); }

Target:
protected Future<Boolean> updateFlushWait(long id, CyclicBarrier loadBarrier, CountDownLatch preFlushLatch, CountDownLatch flushLatch, CountDownLatch commitLatch) throws Exception { return executor.submit(() -> withTxSessionApply(s -> { try { Item item = s.load(Item.class, id); item.getName(); if (loadBarrier != null) { loadBarrier.await(WAIT_TIMEOUT, TimeUnit.SECONDS); } item.setDescription("Updated item"); s.update(item); if (preFlushLatch != null) { awaitOrThrow(preFlushLatch); } s.flush(); } catch (StaleStateException | OptimisticLockException | PessimisticLockException | org.hibernate.PessimisticLockException e) { log.info("Exception thrown: ", e); markRollbackOnly(s); return false; } finally { if (flushLatch != null) { flushLatch.countDown(); } } if (commitLatch != null) { awaitOrThrow(commitLatch); } return true; })); }
Source:
protected SearchResult run() throws Exception { if(failedExecutionException instanceof NamingException) { SearchResult searchResult = LDAPCache.getLDAPCacheSession().getIfPresent(cacheKey); if (searchResult == null) { searchResult = LDAPCache.getLDAPCacheSession().get(cacheKey); } return searchResult; } else if(failedExecutionException instanceof Exception) { throw ((Exception)failedExecutionException); } else { LOGGER.fatal("a Throwable instance (which is not instance of Exception) was thrown and it can't be handled.",failedExecutionException); System.exit(-1); return null; } }

Target:
protected SearchResult run() throws Exception { SearchResult searchResult = LDAPCache.getLDAPCacheSession().getIfPresent(cacheKey); if (searchResult == null) { CachedLDAPUserNotFoundException e = new CachedLDAPUserNotFoundException(); LOGGER.error("Failed to connect to the server and no result found roles for user: " + cacheKey.uid, e); throw e; } return searchResult; }
Source:
public default Path subPath(final String fromLabel, final String toLabel) { if (null == fromLabel && null == toLabel) return this; else { Path subPath = MutablePath.make(); int size = this.size(); boolean record = false; for (int i = 0; i < size; i++) { final Set<String> labels = this.labels().get(i); if (!record && (labels.contains(fromLabel) || null == fromLabel)) record = true; if (record) subPath = subPath.extend(this.get(i), labels); if (labels.contains(toLabel)) { if (!record) throw Path.Exceptions.couldNotLocalPathFromLabel(fromLabel); else return subPath; } } if (null == toLabel) return subPath; else throw Path.Exceptions.couldNotLocalPathToLabel(toLabel); } }

Target:
public default Path subPath(final String fromLabel, final String toLabel) { if (null == fromLabel && null == toLabel) return this; else { Path subPath = MutablePath.make(); final int size = this.size(); int fromIndex = -1; int toIndex = -1; for (int i = size - 1; i >= 0; i--) { final Set<String> labels = this.labels().get(i); if (-1 == fromIndex && labels.contains(fromLabel)) fromIndex = i; if (-1 == toIndex && labels.contains(toLabel)) toIndex = i; } if (null != fromLabel && -1 == fromIndex) throw Path.Exceptions.couldNotLocatePathFromLabel(fromLabel); if (null != toLabel && -1 == toIndex) throw Path.Exceptions.couldNotLocatePathToLabel(toLabel); if (fromIndex == -1) fromIndex = 0; if (toIndex == -1) toIndex = size-1; if (fromIndex > toIndex) throw Path.Exceptions.couldNotIsolatedSubPath(fromLabel, toLabel); for (int i = fromIndex; i <= toIndex; i++) { final Set<String> labels = this.labels().get(i); subPath.extend(this.get(i), labels); } return subPath; } }
Source:
private String getDatastoreDirectory(String dbName) { return FilenameUtils.concat(this.path, dbName.replace("/","%2F")); }

Target:
private String getDatastoreDirectory(String dbName) { return FilenameUtils.concat(this.path, dbName.replace("/",".")); }
Source:
private ByteBuffer parsePacketNRB(ByteBuffer pcapPacketHeader, int blockLength) throws IOException { ByteBuffer pcapPacketData; pcapPacketData = ByteBuffer.allocate(blockLength - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapPacketHeader.getShort(); pcapPacketHeader.getShort(); pcapPacketData.clear(); SeekableByteChannel fFileChannel; ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); try { fFileChannel = getFileChannel(); fFileChannel.read(pcapPacketData); } catch (BadPcapFileException e1) { } pcapPacketData.flip(); return pcapPacketData; }

Target:
private ByteBuffer parsePacketNRB(ByteBuffer pcapPacketHeader, int blockLength) throws IOException { ByteBuffer pcapPacketData; pcapPacketData = ByteBuffer.allocate(blockLength - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapPacketHeader.getShort(); pcapPacketHeader.getShort(); pcapPacketData.clear(); SeekableByteChannel fileChannel; ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); try { fileChannel = getFileChannel(); fileChannel.read(pcapPacketData); } catch (BadPcapFileException e1) { } pcapPacketData.flip(); return pcapPacketData; }
Source:
public static Path getCarbonHome() { String carbonHome = System.getProperty(Constants.CARBON_HOME); if (carbonHome == null) { carbonHome = System.getenv(Constants.CARBON_HOME_ENV); if (carbonHome == null) { String msg = "Required property '" + Constants.CARBON_HOME_ENV + "' has not been specified"; logger.error(msg); throw new CarbonUtilsException(msg); } System.setProperty(Constants.CARBON_HOME, carbonHome); } return Paths.get(carbonHome); }

Target:
public static Path getCarbonHome() { String carbonHome = System.getProperty(Constants.CARBON_HOME); if (carbonHome == null) { carbonHome = System.getenv(Constants.CARBON_HOME_ENV); if (carbonHome == null) { String msg = "Required property '" + Constants.CARBON_HOME_ENV + "' has not been specified"; throw new CarbonUtilsException(msg); } System.setProperty(Constants.CARBON_HOME, carbonHome); } return Paths.get(carbonHome); }
Source:
public RsFork(final Request req, final Iterable<Fork> list) { super( new RsOf( () -> RsFork.pick(req, list).head(), () -> RsFork.pick(req, list).body() ) ); }

Target:
public RsFork(final Request req, final Iterable<Fork> list) { super( new ResponseOf( () -> RsFork.pick(req, list).head(), () -> RsFork.pick(req, list).body() ) ); }
Source:
public final Object doSObject(final Object receiver) { if (VmSettings.SNAPSHOTS_ENABLED) { SnapshotBuffer sb = new SnapshotBuffer(); if (!sb.containsObject(receiver)) { SClass sc = Types.getClassOf(receiver); sc.getSerializer().serialize(receiver, sb); ByteBuffer bb = sb.getBuffer(); short cId = bb.getShort(); SClass clazz = SnapshotBackend.lookupClass(cId); Object o = clazz.getSerializer().deserialize(bb); return o; } } return null; }

Target:
public final Object doSObject(final Object receiver) { if (VmSettings.SNAPSHOTS_ENABLED) { SnapshotBuffer sb = new SnapshotBuffer(); if (!sb.containsObject(receiver)) { SClass clazz = Types.getClassOf(receiver); clazz.serialize(receiver, sb); ByteBuffer bb = sb.getBuffer(); short cId = bb.getShort(); Object o = SnapshotBackend.lookupClass(cId).getSerializer().deserialize(bb); assert Types.getClassOf(o) == clazz; return o; } } return null; }
Source:
void stop() { try { AmazonEC2 ec2 = getCloud().connect(); StopInstancesRequest request = new StopInstancesRequest(Collections.singletonList(getInstanceId())); LOGGER.fine("Sending stop request for " + getInstanceId()); ec2.stopInstances(request); LOGGER.info("EC2 instance stop request sent for " + getInstanceId()); toComputer().disconnect(null); } catch (AmazonClientException e) { Instance i = null; try { i = CloudHelper.getInstanceWithRetry(getInstanceId(), getCloud()); LOGGER.log(Level.WARNING, "Failed to stop EC2 instance: " + getInstanceId() + " info: " + ((i != null) ? i : ""), e); } catch (InterruptedException ie) { LOGGER.fine("InterruptedException while get " + getInstanceId() + " Exception: " + ie); return; } } }

Target:
void stop() { try { AmazonEC2 ec2 = getCloud().connect(); StopInstancesRequest request = new StopInstancesRequest(Collections.singletonList(getInstanceId())); LOGGER.fine("Sending stop request for " + getInstanceId()); ec2.stopInstances(request); LOGGER.info("EC2 instance stop request sent for " + getInstanceId()); toComputer().disconnect(null); } catch (AmazonClientException e) { LOGGER.log(Level.WARNING, "Failed to stop EC2 instance: " + getInstanceId(), e); } }
Source:
public void clientCallback(final ClientResponse response) throws InterruptedException { if (response.getStatus() != ClientResponse.SUCCESS) { m_es.execute(new Runnable() { @Override public void run() { try { reinsertFailed(m_batchRowList); } catch (Exception e) { loaderLog.error("Failed to re-insert failed batch", e); } } }); } else { m_es.execute(new Runnable() { @Override public void run() { try { for (VoltBulkLoaderRow r : m_batchRowList) { r.m_loader.m_notificationCallBack.callback(r.m_rowHandle, null, response); } } catch (Exception e) { loaderLog.error("Failed to re-insert failed batch", e); } } }); m_batchRowList.get(0).m_loader.m_loaderCompletedCnt.addAndGet(m_batchRowList.size()); m_batchRowList.get(0).m_loader.m_outstandingRowCount.addAndGet(-1 * m_batchRowList.size()); } }

Target:
public void clientCallback(final ClientResponse response) throws InterruptedException { if (response.getStatus() != ClientResponse.SUCCESS) { m_es.execute(new Runnable() { @Override public void run() { try { reinsertFailed(m_batchRowList); } catch (Exception e) { loaderLog.error("Failed to re-insert failed batch", e); } } }); } else { if (m_successCallback != null) { m_es.execute(new Runnable() { @Override public void run() { for (VoltBulkLoaderRow r : m_batchRowList) { m_successCallback.success(r.m_rowHandle, response); } } }); } for (Map.Entry<VoltBulkLoader, Long> e : m_batchSizes.entrySet()) { e.getKey().m_loaderCompletedCnt.addAndGet(e.getValue()); e.getKey().m_outstandingRowCount.addAndGet(-1 * e.getValue()); } } }
Source:
protected ListenableFuture<Map<Long, Long>> getCommitTimestamps( @Nullable TableReference tableRef, Iterable<Long> startTimestamps, boolean shouldWaitForCommitterToComplete, AsyncTransactionService asyncTransactionService) { if (Iterables.isEmpty(startTimestamps)) { return Futures.immediateFuture(ImmutableMap.of()); } Map<Long, Long> startToCommitTimestampMap = Maps.newHashMap(); Set<Long> gets = Sets.newHashSet(); for (long startTs : startTimestamps) { Long cached = timestampValidationReadCache.getCommitTimestampIfPresent(startTs); if (cached != null) { startToCommitTimestampMap.put(startTs, cached); } else { gets.add(startTs); } } if (gets.isEmpty()) { return Futures.immediateFuture(startToCommitTimestampMap); } if (shouldWaitForCommitterToComplete) { waitForCommitterToComplete(tableRef, startTimestamps); } traceGetCommitTimestamps(tableRef, gets); if (gets.size() > transactionConfig.get().getThresholdForLoggingLargeNumberOfTransactionLookups()) { logLargeNumberOfTransactions(tableRef, gets); } getHistogram(AtlasDbMetricNames.NUMBER_OF_TRANSACTIONS_READ_FROM_DB, tableRef).update(gets.size()); return Futures.transform(loadCommitTimestamps(asyncTransactionService, gets), rawResults -> { for (Map.Entry<Long, Long> e : rawResults.entrySet()) { if (e.getValue() != null) { long startTs = e.getKey(); long commitTs = e.getValue(); startToCommitTimestampMap.put(startTs, commitTs); timestampValidationReadCache.putAlreadyCommittedTransaction(startTs, commitTs); } } return startToCommitTimestampMap; }, MoreExecutors.directExecutor()); }

Target:
protected ListenableFuture<Map<Long, Long>> getCommitTimestamps( @Nullable TableReference tableRef, Iterable<Long> startTimestamps, boolean shouldWaitForCommitterToComplete, AsyncTransactionService asyncTransactionService) { if (Iterables.isEmpty(startTimestamps)) { return Futures.immediateFuture(ImmutableMap.of()); } Map<Long, Long> startToCommitTimestamps = Maps.newHashMap(); Set<Long> gets = Sets.newHashSet(); for (long startTs : startTimestamps) { Long cached = timestampValidationReadCache.getCommitTimestampIfPresent(startTs); if (cached != null) { startToCommitTimestamps.put(startTs, cached); } else { gets.add(startTs); } } if (gets.isEmpty()) { return Futures.immediateFuture(startToCommitTimestamps); } if (shouldWaitForCommitterToComplete) { waitForCommitterToComplete(tableRef, startTimestamps); } traceGetCommitTimestamps(tableRef, gets); if (gets.size() > transactionConfig.get().getThresholdForLoggingLargeNumberOfTransactionLookups()) { logLargeNumberOfTransactions(tableRef, gets); } getHistogram(AtlasDbMetricNames.NUMBER_OF_TRANSACTIONS_READ_FROM_DB, tableRef).update(gets.size()); return Futures.transform(loadCommitTimestamps(asyncTransactionService, gets), rawResults -> { for (Map.Entry<Long, Long> e : rawResults.entrySet()) { if (e.getValue() != null) { long startTs = e.getKey(); long commitTs = e.getValue(); startToCommitTimestamps.put(startTs, commitTs); timestampValidationReadCache.putAlreadyCommittedTransaction(startTs, commitTs); } } return startToCommitTimestamps; }, MoreExecutors.directExecutor()); }