auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ImmutableMapValue<BodyPart, Vector3d> partRotation() { <START> return new ImmutableSpongeMapValue<>(Keys.BODY_ROTATIONS, this.rotations); <END> }</code><technical_language>need create new instances of immutable value. Store in a field create in constructor</technical_language>

Target:
public ImmutableMapValue<BodyPart, Vector3d> partRotation() { return this.rotationsValue; }
Source:
<code>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(); <START> onLoad(); <END> } }); hp.add(filterTxt); add(hp); }</code><technical_language>I prefer call of onLoad() again. Instead put ProjectMap invocation parts a refresh() method onLoad call refresh()</technical_language>

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:
<code>public static <T> PCollection<T> ofDefaultWindow(PCollection<T> in) { if (in.getWindowingStrategy() != WindowingStrategy.globalDefault()) <START> return in; <END> return in.apply("ApplyDefaultWindow", Window.<T> into(FixedWindows.of(DEFAULT_WINDOW_SIZE))); }</code><technical_language>I guess in.getWindowingStrategy() is supposed return null if in is unbounded, safer check there</technical_language>

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:
<code><START> public static List<Bundle> readBundleFromFolder(final String folderPath) throws IOException { <END> 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; }</code><technical_language>this change intended ? I this method in other class</technical_language>

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:
<code>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(); <START> relationColumn.startEditingHeaderCell(0); <END> })); }); }</code><technical_language>error bellow appears if you: - Define Decision node Relation - Append columns - Click Undo ![screenshot 2018-07-09 11-01-48](<LINK_0></technical_language>

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:
<code>private Clickable newTaskListLink() { final TreeIndexed<String> tree = new TreeIndexed<String>(); <START> return new Link(_("New List"), _("Check the new task list"), <END> new CheckValidSessionBeforeAction(new ActionShowView(AngularIFrameView.TASK_LISTING_TOKEN, tree))); }</code><technical_language>I remove _() show in crowdin</technical_language>

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:
<code>private List<VdsNetworkInterface> applyUserConfiguredNics() { List<VdsNetworkInterface> nicsToConfigure = getNicsToConfigureWithoutLabelsUpdates(); updateLabelsOnNicsToConfigure(nicsToConfigure); <START> return new ArrayList<>(nicsToConfigure); <END> }</code><technical_language>is this needed</technical_language>

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

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:
<code>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; } <START> return journalEntries; <END> }</code><technical_language>is this removed</technical_language>

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:
<code>private void hideEmptyView() { if (isAdded() && mEmptyView != null) { <START> mFilterRadioGroup.setVisibility(View.VISIBLE); <END> mEmptyView.setVisibility(View.GONE); } }</code><technical_language>Is this line necessary? radio group visible</technical_language>

Target:
private void hideEmptyView() { if (isAdded() && mEmptyView != null) { setFilterViewScrollable(true); mEmptyView.setVisibility(View.GONE); mFilterDivider.setVisibility(View.VISIBLE); } }
Source:
<code>public void dispose() { <START> this.removeCallbacksAndMessages(null); <END> this.phone = null; }</code><technical_language>this.removeCallbacksAndMessages(null) instead. Done in Patch set 2</technical_language>

Target:
public void dispose() { super.dispose(); }
Source:
<code>private <T> Map<String, T> getRepositoriesByType(Class<T> type) { <START> if (type == GroupRepository.class) { <END> 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()); } }</code><technical_language>put repositories in Map<Class<?>, Object> get class key. get operation cast (Map<String, T>) thanks this able remove this big block of ifs</technical_language>

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:
<code>public void destroy() { if (secret != null) { for (int i = 0; i < secret.length; i++) { secret[i] = 0; } } <START> } <END></code><technical_language>This breaks isDestroyed()</technical_language>

Target:
public void destroy() { if (secret != null) { for (int i = 0; i < secret.length; i++) { secret[i] = 0; } secret = null; } }
Source:
<code>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); <START> assertEscalationEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, ""); <END> assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertEscalationEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, EMPTY_VALUE);</technical_language>

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:
<code>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"); <START> if (ec != null && (ec.equals("301") || ec.equals("302"))) { <END> SalesforceOAuthPlugin.refresh(ctx, view, startURL); return true; } else { return super.shouldOverrideUrlLoading(view, url); } }</code><technical_language>this overly broad. Is fair assume this parameter is sufficient for differentiation</technical_language>

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:
<code>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)) { <START> scanner.next(); <END> } catch (IOException e) { LOG.error("Could not scan region:" + region.getEncodedName(), e); throw e; } }</code><technical_language>scanner closed call</technical_language>

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:
<code>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 { <START> selectedFields.put(selector.field.getValue(), avPathContexts.get(0).value()); <END> } } } } if (!selectedFields.isEmpty()) { if (outputSchema == null) { outputSchema = Schema.createRecord(fieldSchemas); } context.output(FieldSelectorUtil.generateIndexedRecord(selectedFields, outputSchema)); } }</code><technical_language>FieldSelectorUtil.extractValuesFromContext(avPathContexts) deal cases (avPathContexts empty/non empty, more element etc...), instead of multiples if/else</technical_language>

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:
<code>public CallBatcher add(W input) { requireNotStopped(); initialize(); CallManagerImpl.CallArgsImpl args = null; if (input == null) { if(inputType == Void.class) <START> throw new IllegalArgumentException("Input type is void"); <END> 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; }</code><technical_language>A more useful error message like: "cannot call add() supplying arguments generator"</technical_language>

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:
<code>public void onFinishInflate() { super.onFinishInflate(); Locale locale = getResources().getConfiguration().locale; <START> if (!"fa".equals(locale.getLanguage())) { <END> 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; } } } }</code><technical_language>This config is done xml resource, hardcoded. e.g. values-fa/config.xml: <resources> <bool name="use_localized_digits">true</bool> </resources> values/config.xml: <resources> <bool name="use_localized_digits">false</bool> </resources> if (!context.getResources().getBoolean(R.bool.use_localized_digits)) { locale = new Locale.Builder() .setLocale(locale) .setUnicodeLocaleKeyword("nu", "latn") .build(); }</technical_language>

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:
<code>public void increaseActualCachesFound() { <START> if (getActualCachesFound() >= 0) { <END> setActualCachesFound(getActualCachesFound() + 1); } }</code><technical_language>Introduce a local variable for getActualCachesFound()</technical_language>

Target:
public void increaseActualCachesFound() { if (actualCachesFound >= 0) { actualCachesFound++; } }
Source:
<code>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;"}, <START> {"&lt;", "&amp;lt;"}, <END> {"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(); }</code><technical_language>change is expected.... if content is encoded/escaped ("&lt;") skip escaping. for other changes ...</technical_language>

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:
<code>private static List<technology.tabula.Pair<Integer, Rectangle>> whichAreas(CommandLine line) throws ParseException { if (!line.hasOption('a')) { return new ArrayList<>(); } <START> System.out.println("What I'm getting..."); <END> 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; }</code><technical_language>writes stdout</technical_language>

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:
<code>public MMSEndpoint(String baseUri) { try { uriBuilder = new URIBuilder(baseUri); this.baseUri = baseUri; <START> } catch (URISyntaxException e) { <END> Application.getInstance().getGUILog().log("[ERROR] Unexpected error in generation of MMS URL for project. Reason: " + e.getMessage()); e.printStackTrace(); } }</code><technical_language>I suppress this exception, especially considering methods in this class, e.g. buildRequest, throw usages handling it</technical_language>

Target:
public MMSEndpoint(String baseUri) throws URISyntaxException { uriBuilder = new URIBuilder(baseUri); this.baseUri = baseUri; }
Source:
<code>public void testWrongMethod() throws Exception { try { getApi().action("login").get().asObject(); <START> assertFalse(true); <END> } catch (ApiException e) { assertEquals("mustbeposted", e.getCode()); } }</code><technical_language>Consider this: fail("expected ApiException");</technical_language>

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:
<code>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) { <START> model.setGroups(new Groups()); <END> 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; }</code><technical_language>^ in this case need set empty <group/> element, please move line 26 line 28</technical_language>

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:
<code>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; <START> } <END> return classLoader.loadClass(className).newInstance(); } catch (Exception e) { throw new IllegalArgumentException("Impossible to instantiate " + className, e); } } }</code><technical_language>className null? If I rewrite [1], do think? point is nesting expression try catch, if exception thrown. [1] java if (ScenarioSimulationSharedUtils.isMap(className)) { return new HashMap(); } else if (SIMPLE_TYPES_LIST.contains(className)) { return null; } else { try { return classLoader.loadClass(className).newInstance(); } catch (Exception e) { throw new IllegalArgumentException("Impossible instantiate " + className, e); } }</technical_language>

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:
<code>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()) <START> .addUDTColumn("u", udtLiteral(udt)) <END> ); 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"); }</code><technical_language>name refers expressing type a string literal, I this holds if type is unfrozen</technical_language>

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:
<code>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); <START> synchronized (si) { <END> 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); }</code><technical_language>while if(si.getServerAddress() == null) { si.wait(); }</technical_language>

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:
<code>public void onSendMessage(View v) throws MessageActivityException { <START> TextView inputField = (TextView) findViewById(R.id.inputMessageField); <END> 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); }</code><technical_language>want store view a field in class if multiple time. findViewById a negligible cost</technical_language>

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:
<code>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); <START> return r; <END> } return null; }</code><technical_language>Minor thing, please result instead of r</technical_language>

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:
<code>void setClean(boolean clean) throws Exception { this.clean = clean; <START> } <END></code><technical_language>is necessary call "clean()" method clean session information creating a connection. If is cleaned up, cleanSession of MQTT consumer is false, cleanSession of connected MQTT consumer is true, message in queue consumed, is allowed. I this is calling "clean()" in "setIsClean(boolean isClean)" method</technical_language>

Target:
void setClean(boolean clean) { this.clean = clean; }
Source:
<code>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; <START> } catch (OptimisticLockException e) { <END> 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; })); }</code><technical_language>condense clause for exceptions |</technical_language>

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:
<code><START> protected SearchResult run() throws Exception { <END> 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; } }</code><technical_language>1. is this attempting reach out ldap? 2. this returning is cached? I a retry of request good, in fallback. some level of duplication of logic public command reuse is a problem. preference simple. Meaning, fallback for LdapFindUserByUidCommand simply returns is cached. If is cached fails in some way. throw original exception, a new exception, return null</technical_language>

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:
<code>public default Path subPath(final String fromLabel, final String toLabel) { if (null == fromLabel && null == toLabel) return this; else { Path subPath = MutablePath.make(); <START> int size = this.size(); <END> 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); } }</code><technical_language>Missed a final size - variable re-assigned elsewhere</technical_language>

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:
<code>private String getDatastoreDirectory(String dbName) { <START> return FilenameUtils.concat(this.path, dbName.replace("/","%2F")); <END> }</code><technical_language>@mikerhodes do percent encoding slashes in db name sense? matter encoding long transparent user. map / other forbidden character</technical_language>

Target:
private String getDatastoreDirectory(String dbName) { return FilenameUtils.concat(this.path, dbName.replace("/",".")); }
Source:
<code>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(); <START> return pcapPacketData; <END> }</code><technical_language>packet data, this contains partial NRB data amputated read in 28 bytes of packet header (incorrectly)</technical_language>

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:
<code>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"; <START> logger.error(msg); <END> throw new CarbonUtilsException(msg); } System.setProperty(Constants.CARBON_HOME, carbonHome); } return Paths.get(carbonHome); }</code><technical_language>need log throw. throwing exception enough</technical_language>

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:
<code>public RsFork(final Request req, final Iterable<Fork> list) { super( <START> new RsOf( <END> () -> RsFork.pick(req, list).head(), () -> RsFork.pick(req, list).body() ) ); }</code><technical_language>@fanifieiev above</technical_language>

Target:
public RsFork(final Request req, final Iterable<Fork> list) { super( new ResponseOf( () -> RsFork.pick(req, list).head(), () -> RsFork.pick(req, list).body() ) ); }