auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void setup() throws InterruptedException { testUtil = new SparkTestUtil(PORT); server = new Server(); ServerConnector connector = new ServerConnector(server); connector.setIdleTimeout(1000 * 60 * 60); connector.setSoLingerTime(-1); connector.setPort(PORT); server.setConnectors(new Connector[] {connector}); WebAppContext bb = new WebAppContext(); bb.setServer(server); bb.setContextPath(CONTEXT_PATH); bb.setWar("src/test/webapp"); server.setHandler(bb); CountDownLatch latch = new CountDownLatch(1); executorService = Executors.newSingleThreadExecutor(); executorService.submit(() -> { try { LOGGER.info(">>> STARTING EMBEDDED JETTY SERVER for jUnit testing of SparkFilter"); server.start(); latch.countDown(); System.in.read(); } catch (Exception e) { <START> e.printStackTrace(); <END> System.exit(100); } }); latch.await(); }</code><technical_language>Exception.printStackTrace() is _very_ seldom justified. propagate exception instead</technical_language>

Target:
public static void setup() throws InterruptedException { testUtil = new SparkTestUtil(PORT); server = new Server(); ServerConnector connector = new ServerConnector(server); connector.setIdleTimeout(1000 * 60 * 60); connector.setSoLingerTime(-1); connector.setPort(PORT); server.setConnectors(new Connector[] {connector}); WebAppContext bb = new WebAppContext(); bb.setServer(server); bb.setContextPath(CONTEXT_PATH); bb.setWar("src/test/webapp"); server.setHandler(bb); CountDownLatch latch = new CountDownLatch(1); executorService = Executors.newSingleThreadExecutor(); executorService.submit(() -> { try { LOGGER.info(">>> STARTING EMBEDDED JETTY SERVER for jUnit testing of SparkFilter"); server.start(); latch.countDown(); System.in.read(); } catch (Exception e) { try { latch.countDown(); server.stop(); } catch (Exception e1) { throw new RuntimeException(e1); } throw new RuntimeException(e); } }); latch.await(); }
Source:
<code>private double pvbpCompoundedFlat(RatePaymentPeriod paymentPeriod, RatesProvider provider) { int nbCmp = paymentPeriod.getAccrualPeriods().size(); double[] rate = new double[nbCmp]; <START> int i = 0; <END> for (RateAccrualPeriod accrualPeriod : paymentPeriod.getAccrualPeriods()) { rate[i] = rawRate(accrualPeriod, provider); i++; } double df = provider.discountFactor(paymentPeriod.getCurrency(), paymentPeriod.getPaymentDate()); double rBar = 1.0; double[] cpaAccumulatedBar = new double[nbCmp + 1]; cpaAccumulatedBar[nbCmp] = paymentPeriod.getNotional() * df * rBar; double spreadBar = 0.0d; for (int j = nbCmp - 1; j >= 0; j--) { cpaAccumulatedBar[j] = (1.0d + paymentPeriod.getAccrualPeriods().get(j).getYearFraction() * rate[j] * paymentPeriod.getAccrualPeriods().get(j).getGearing()) * cpaAccumulatedBar[j + 1]; spreadBar += paymentPeriod.getAccrualPeriods().get(j).getYearFraction() * cpaAccumulatedBar[j + 1]; } return spreadBar; }</code><technical_language>prefer loops replaced standard "for (int i = 0; ...)" style, declaring 'i' manually incrementing it. A stream work, 'mapToDouble()' 'toArray()'</technical_language>

Target:
private double pvbpCompoundedFlat(RatePaymentPeriod paymentPeriod, RatesProvider provider) { int nbCmp = paymentPeriod.getAccrualPeriods().size(); double[] rate = paymentPeriod.getAccrualPeriods().stream() .mapToDouble(ap -> rawRate(ap, provider)) .toArray(); double df = provider.discountFactor(paymentPeriod.getCurrency(), paymentPeriod.getPaymentDate()); double rBar = 1.0; double[] cpaAccumulatedBar = new double[nbCmp + 1]; cpaAccumulatedBar[nbCmp] = paymentPeriod.getNotional() * df * rBar; double spreadBar = 0.0d; for (int j = nbCmp - 1; j >= 0; j--) { cpaAccumulatedBar[j] = (1.0d + paymentPeriod.getAccrualPeriods().get(j).getYearFraction() * rate[j] * paymentPeriod.getAccrualPeriods().get(j).getGearing()) * cpaAccumulatedBar[j + 1]; spreadBar += paymentPeriod.getAccrualPeriods().get(j).getYearFraction() * cpaAccumulatedBar[j + 1]; } return spreadBar; }
Source:
<code>public static void main(String[] args) throws Exception { LogLevelAdjuster.register(); Lifecycle lifecycle = new Lifecycle(); lifecycle.addManagedInstance(BrokerNode.builder().build()); <START> if (ComplexMetrics.getSerdeForType("hll") == null) { <END> ComplexMetrics.registerSerde("hll", new HLLComplexMericSerde()); } HllAggregatorFactory.context = HllAggregatorFactory.CONTEXT.COMPLEX; try { lifecycle.start(); } catch (Throwable t) { log.info(t, "Throwable caught at startup, committing seppuku"); System.exit(2); } lifecycle.join(); }</code><technical_language>This code is repeated a times. worthwhile a complex metrics utils class register HLL other complex metrics in future</technical_language>

Target:
public static void main(String[] args) throws Exception { LogLevelAdjuster.register(); Lifecycle lifecycle = new Lifecycle(); lifecycle.addManagedInstance(BrokerNode.builder().build()); HLLComplexMericSerde.registerHllSerde(); try { lifecycle.start(); } catch (Throwable t) { log.info(t, "Throwable caught at startup, committing seppuku"); System.exit(2); } lifecycle.join(); }
Source:
<code>public void run() { mUserAccountRepository.login(mCredentials, new IRepositoryCallback<UserAccount>() { @Override public void onSuccess(UserAccount userAccount) { mCallback.onLoginSuccess(); } @Override public void onError(Throwable throwable) { if (throwable instanceof MalformedURLException || throwable instanceof UnknownHostException) { <START> mMainExecutor.run(new Runnable() { <END> @Override public void run() { mCallback.onServerURLNotValid(); } }); } else if (throwable instanceof InvalidCredentialsException) { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onInvalidCredentials(); } }); } else if (throwable instanceof NetworkException) { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onNetworkError(); } }); } } }); }</code><technical_language>Extract notification method notify..</technical_language>

Target:
public void run() { mUserAccountRepository.login(mCredentials, new IRepositoryCallback<UserAccount>() { @Override public void onSuccess(UserAccount userAccount) { notifyOnSuccess(); } @Override public void onError(Throwable throwable) { if (throwable instanceof MalformedURLException || throwable instanceof UnknownHostException) { notifyOnServerURLNotValid(); } else if (throwable instanceof InvalidCredentialsException) { notifyOnInvalidCredentials(); } else if (throwable instanceof NetworkException) { notifyOnNetworkError(); } } }); }
Source:
<code>protected void zoomEntries(@NonNull Iterable<@NonNull TimeGraphEntry> entries, long zoomStartTime, long zoomEndTime, long resolution, @NonNull IProgressMonitor monitor) { if <START> (zoomEndTime < zoomStartTime || <END> resolution < 0) { return; } boolean isZoomThread = Thread.currentThread() instanceof ZoomThread; List<@NonNull Long> times = StateSystemUtils.getTimes(zoomStartTime, zoomEndTime, resolution); Map<Long, ControlFlowEntry> controlFlowEntries = filterGroup(entries, zoomStartTime, zoomEndTime); SelectionTimeQueryFilter filter = new SelectionTimeQueryFilter(times , controlFlowEntries.keySet()); for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { ControlFlowDataProvider dataProvider = DataProviderManager.getInstance(). getDataProvider(trace, ControlFlowDataProvider.ID, ControlFlowDataProvider.class); if (dataProvider == null) { continue; } TmfModelResponse<List<ITimeGraphRowModel>> fetchRowModel = dataProvider.fetchRowModel(filter, monitor); List<ITimeGraphRowModel> model = fetchRowModel.getModel(); if (model != null) { for (ITimeGraphRowModel rowModel : model) { ControlFlowEntry controlFlowEntry = controlFlowEntries.get(rowModel.getEntryID()); if (controlFlowEntry != null) { List<ITimeEvent> events = createTimeEvents(controlFlowEntry, rowModel.getStates()); if (isZoomThread) { applyResults(() -> controlFlowEntry.setZoomedEventList(events)); } else { controlFlowEntry.setEventList(events); } } } } } }</code><technical_language>min/max this instead, I dunno</technical_language>

Target:
protected void zoomEntries(@NonNull Iterable<@NonNull TimeGraphEntry> entries, long zoomStartTime, long zoomEndTime, long resolution, @NonNull IProgressMonitor monitor) { boolean isZoomThread = Thread.currentThread() instanceof ZoomThread; List<@NonNull Long> times = StateSystemUtils.getTimes(Long.min(zoomStartTime, zoomEndTime), Long.max(zoomStartTime, zoomEndTime), resolution); Map<Long, ControlFlowEntry> controlFlowEntries = filterGroup(entries, zoomStartTime, zoomEndTime); SelectionTimeQueryFilter filter = new SelectionTimeQueryFilter(times , controlFlowEntries.keySet()); for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { ControlFlowDataProvider dataProvider = DataProviderManager.getInstance(). getDataProvider(trace, ControlFlowDataProvider.ID, ControlFlowDataProvider.class); if (dataProvider == null) { continue; } TmfModelResponse<List<ITimeGraphRowModel>> fetchRowModel = dataProvider.fetchRowModel(filter, monitor); List<ITimeGraphRowModel> model = fetchRowModel.getModel(); if (model != null) { for (ITimeGraphRowModel rowModel : model) { ControlFlowEntry controlFlowEntry = controlFlowEntries.get(rowModel.getEntryID()); if (controlFlowEntry != null) { List<ITimeEvent> events = createTimeEvents(controlFlowEntry, rowModel.getStates()); if (isZoomThread) { applyResults(() -> controlFlowEntry.setZoomedEventList(events)); } else { controlFlowEntry.setEventList(events); } } } } } }
Source:
<code>public void testACLNotSupported() throws Exception { Configuration conf = new Configuration(); conf.setBoolean(DFSConfigKeys.DFS_PROVIDED_ACLS_IMPORT_ENABLED, true); FileSystem fs = mock(FileSystem.class); when(fs.getAclStatus(any())).thenThrow(new UnsupportedOperationException()); Path root = mock(Path.class); when(root.getFileSystem(conf)).thenReturn(fs); FileStatus rootFileStatus = new FileStatus(0, true, 0, 0, 1, root); when(fs.getFileStatus(root)).thenReturn(rootFileStatus); FSTreeWalk fsTreeWalk = new FSTreeWalk(root, conf); for (TreePath treePath : fsTreeWalk) { <START> fail("Unexpected successful traversal of remote FS: " + treePath); <END> } }</code><technical_language>check this is empty then</technical_language>

Target:
public void testACLNotSupported() throws Exception { Configuration conf = new Configuration(); conf.setBoolean(DFSConfigKeys.DFS_PROVIDED_ACLS_IMPORT_ENABLED, true); FileSystem fs = mock(FileSystem.class); when(fs.getAclStatus(any())).thenThrow(new UnsupportedOperationException()); Path root = mock(Path.class); when(root.getFileSystem(conf)).thenReturn(fs); FileStatus rootFileStatus = new FileStatus(0, true, 0, 0, 1, root); when(fs.getFileStatus(root)).thenReturn(rootFileStatus); FSTreeWalk fsTreeWalk = new FSTreeWalk(root, conf); TreeWalk.TreeIterator iter = fsTreeWalk.iterator(); fail("Unexpected successful creation of iter: " + iter); }
Source:
<code>public void restart() { visit("restart"); clickButton("Yes"); try { waitFor(driver, not(hasContent("Please wait")), JenkinsController.STARTUP_TIMEOUT); }catch(TimeoutException e) { visit(driver.getCurrentUrl()); <START> waitFor(driver, hasContent("New Item"), 10); <END> } }</code><technical_language>if a secured instance (not if ATHs this restart?) "New Item" part</technical_language>

Target:
public void restart() { visit("restart"); clickButton("Yes"); try { waitFor(driver, not(hasContent("Please wait")), JenkinsController.STARTUP_TIMEOUT); }catch(TimeoutException e) { visit(driver.getCurrentUrl()); waitFor(driver, hasElement(By.className("breadcrumbBarAnchor")), 10); } }
Source:
<code>public boolean next(Void info) { Span currentSpan = traceAccessor.getCurrentSpan(); if (currentSpan == null) { return false; } String traceId = currentSpan.getTraceId(); <START> UUID traceUuid = UUID.fromString(traceId); <END> BigInteger traceAsInt = UuidToBigIntegerConverter.uuidToBigInt(traceUuid); BigInteger mod = traceAsInt.mod(MOD_DIVISOR); return mod.compareTo(percentageAsBigInteger()) <= 0; }</code><technical_language>non-blocking, fold steps (as want UUID type). Ex. TraceIdToBigIntegerConverter mention is UUID formatted instead. This math together, separate id decoding</technical_language>

Target:
public boolean next(Void info) { Span currentSpan = traceAccessor.getCurrentSpan(); if (currentSpan == null) { return false; } return new UuidTraceIdToThresholdComparable(configuration.getPercentage(), converter) .compareTo(currentSpan.getTraceId()) <= 0; }
Source:
<code>private List<LogMessage> getMessages(Severity severity){ activate(); ArrayList<LogMessage> messages = new ArrayList<>(); <START> for(TreeItem item : new DefaultTree().getItems()){ <END> if(severityMatch(item, severity)) { messages.add(new LogMessage(item, severity.getIStatus())); } } return messages; }</code><technical_language>LogViewTest.testClearAndRestore failed. is a possibility Tree exist LogView messages</technical_language>

Target:
private List<LogMessage> getMessages(Severity severity) { activate(); WidgetIsFound isTreeFound = new WidgetIsFound(org.eclipse.swt.widgets.Tree.class, cTabItem.getFolder().getSWTWidget()); new WaitUntil(isTreeFound, TimePeriod.SHORT, false); Widget tree = isTreeFound.getWidget(); return tree != null ? getMessagesFromTree(tree, severity) : new ArrayList<>(); }
Source:
<code>public Collection<Observation> addObservation(String registrationId, Observation observation) { List<Observation> removed = new ArrayList<>(); <START> for (Observation obs : getObservations(registrationId)) { <END> if (observation.getPath().equals(obs.getPath()) && !Arrays.equals(observation.getId(), obs.getId())) { removed.add(obs); } } if (!removed.isEmpty()) { try (Jedis j = pool.getResource()) { byte[] ep = j.get(toRegIdKey(registrationId)); if (ep == null) { return null; } byte[] lockValue = null; byte[] lockKey = toLockKey(ep); try { lockValue = RedisLock.acquire(j, lockKey); for (Observation obs : removed) { unsafeRemoveObservation(j, registrationId, obs.getId()); } } finally { RedisLock.release(j, lockKey, lockValue); } } } return removed; }</code><technical_language>here, moving for statement in RedisLock block</technical_language>

Target:
public Collection<Observation> addObservation(String registrationId, Observation observation) { List<Observation> removed = new ArrayList<>(); if (!removed.isEmpty()) { try (Jedis j = pool.getResource()) { byte[] ep = j.get(toRegIdKey(registrationId)); if (ep == null) { return null; } byte[] lockValue = null; byte[] lockKey = toLockKey(ep); try { lockValue = RedisLock.acquire(j, lockKey); for (Observation obs : getObservations(j, registrationId)) { if (observation.getPath().equals(obs.getPath()) && !Arrays.equals(observation.getId(), obs.getId())) { removed.add(obs); unsafeRemoveObservation(j, registrationId, obs.getId()); } } } finally { RedisLock.release(j, lockKey, lockValue); } } } return removed; }
Source:
<code>public Object methodException(Context context, Class claz, String method, Exception e, Info info) { log.debug("Claz: " + claz.getName() + " method: " + method, e); if ("format".equals(method)) { return null; } <START> <END> try { throw e; } catch (Exception x) { x.printStackTrace(); } return info; }</code><technical_language>@gitcliff , leave out this change</technical_language>

Target:
public Object methodException(Context context, Class claz, String method, Exception e, Info info) { log.debug("Claz: " + claz.getName() + " method: " + method, e); if ("format".equals(method)) { return null; } return info; }
Source:
<code>private void consumeFluid(Block fluid) { <START> if (fluid.getType() == Material.STATIONARY_WATER) { <END> fluid.setType(Material.AIR); return; } List<Block> list = Vein.find(fluid, RANGE, block -> isLiquid(block) && block.getType() == fluid.getType()); list.get(list.size() - 1).setType(Material.AIR); }</code><technical_language>I dont STATIONARY_WATER exists anymore</technical_language>

Target:
private void consumeFluid(Block fluid) { if (!fluid.isLiquid()) return; if (fluid.getType() == Material.WATER) { fluid.setType(Material.AIR); return; } List<Block> list = Vein.find(fluid, RANGE, block -> isLiquid(block) && block.getType() == fluid.getType()); list.get(list.size() - 1).setType(Material.AIR); }
Source:
<code>public void getColumnCount() { assertThat(cursor.getColumnCount()).isEqualTo(2); <START> cursor.setColumnNames(new ArrayList<String>()); <END> assertThat(cursor.getColumnCount()).isEqualTo(0); cursor.setColumnNames(null); try { cursor.getColumnCount(); fail(); } catch (NullPointerException ignored) { } }</code><technical_language>For future reference Collections.emptyList() for this</technical_language>

Target:
public void getColumnCount() { cursor.setResults(ALL_COLUMNS, new Object[0][ALL_COLUMNS.size()]); assertThat(cursor.getColumnCount()).isEqualTo(ALL_COLUMNS.size()); cursor.setResults(new ArrayList<String>(), new Object[0][0]); assertThat(cursor.getColumnCount()).isEqualTo(0); }
Source:
<code>public void countLostEvent(TmfTimeRange timeRange, long nbLostEvents, boolean fullRange) { if (timeRange.getStartTime().getValue() < 0 || timeRange.getEndTime().getValue() < 0) { return; } int indexStart = (int) ((timeRange.getStartTime().getValue() - fFirstBucketTime) / fBucketDuration); int indexEnd = (int) ((timeRange.getEndTime().getValue() - fFirstBucketTime) / fBucketDuration); <START> if (!fullRange) { <END> if (timeRange.getEndTime().getValue() > fTimeLimit) { indexEnd = (int) ((fTimeLimit - fFirstBucketTime) / fBucketDuration); } indexEnd = Math.min(indexEnd, fLastBucket); } int nbBucketRange = (indexEnd - indexStart) + 1; int lostEventPerBucket = (int) Math.ceil((double) nbLostEvents / nbBucketRange); long lastLostCol = nbLostEvents - lostEventPerBucket * (nbBucketRange - 1); if (fullRange) { while (timeRange.getEndTime().getValue() >= fTimeLimit) { mergeBuckets(); } } for (int index = indexStart; index <= indexEnd && index < fLostEventsBuckets.length; index++) { if (index == (indexStart + nbBucketRange - 1)) { fLostEventsBuckets[index] += lastLostCol; } else { fLostEventsBuckets[index] += lostEventPerBucket; } } fNbEvents++; fireModelUpdateNotification(nbLostEvents); }</code><technical_language>all, turns out bucket of requested time range, bucket contains a real event (fLastBucket) time of bucket in array (fTimeLimit). scaling is done accommodate real event (fLastBucket) if area right of bucket bar is requested time range not. in end count draw lost events bucket in array</technical_language>

Target:
public void countLostEvent(TmfTimeRange timeRange, long nbLostEvents, boolean fullRange) { if (timeRange.getStartTime().getValue() < 0 || timeRange.getEndTime().getValue() < 0) { return; } if (fullRange) { while (timeRange.getEndTime().getValue() >= fTimeLimit) { mergeBuckets(); } } int indexStart = (int) ((timeRange.getStartTime().getValue() - fFirstBucketTime) / fBucketDuration); int indexEnd = (int) ((timeRange.getEndTime().getValue() - fFirstBucketTime) / fBucketDuration); int nbBucketRange = (indexEnd - indexStart) + 1; int lostEventPerBucket = (int) Math.ceil((double) nbLostEvents / nbBucketRange); long lastLostCol = Math.max(1, nbLostEvents - lostEventPerBucket * (nbBucketRange - 1)); for (int index = indexStart; index <= indexEnd && index < fLostEventsBuckets.length; index++) { if (index == (indexStart + nbBucketRange - 1)) { fLostEventsBuckets[index] += lastLostCol; } else { fLostEventsBuckets[index] += lostEventPerBucket; } } fNbEvents++; fireModelUpdateNotification(nbLostEvents); }
Source:
<code>public void testForBrokenSaslHandshakeVersionBump() { <START> assertEquals("It is not possible to easily bump SASL_HANDSHAKE schema without " <END> + "due to improper version negotiation for clients < 2.5. " + "Please see <LINK_0>", ApiKeys.SASL_HANDSHAKE.latestVersion(), 1); }</code><technical_language>is easily bump SASL_HANDSHAKE schema due to... (remove "without")</technical_language>

Target:
public void testForBrokenSaslHandshakeVersionBump() { assertEquals("It is not possible to easily bump SASL_HANDSHAKE schema" + " due to improper version negotiation in clients < 2.5." + " Please see <LINK_0>", ApiKeys.SASL_HANDSHAKE.latestVersion(), 1); }
Source:
<code><START> private static Set<Directive> expandDirective(@Nonnull Directive<? extends DirectiveValue> directive) { <END> if (!(directive instanceof FetchDirective)) { return Collections.singleton(directive); } Set<Directive> directives = new LinkedHashSet<>(); directives.add(directive); Stream<SourceExpression> stream = (Stream<SourceExpression>) directive.values(); Set<SourceExpression> sources = stream.collect(Collectors.toCollection(LinkedHashSet::new)); if (directive instanceof ChildSrcDirective) { directives.add(new FrameSrcDirective(sources)); } else if (directive instanceof ScriptSrcDirective) { directives.add(new ScriptSrcElemDirective(sources)); directives.add(new ScriptSrcAttrDirective(sources)); directives.add(new WorkerSrcDirective(sources)); } else if (directive instanceof StyleSrcDirective) { directives.add(new StyleSrcElemDirective(sources)); directives.add(new StyleSrcAttrDirective(sources)); } return directives; }</code><technical_language>this is correct? If a CSP script-src '<LINK_0>' script-src-elem '<LINK_1>', <script src="<LINK_1>"></script> allowed? This (if reading correctly) implies not, spec says. Another example: script-src a b; script-src-elem a; allow <script src="b"></script></technical_language>

Target:
private static Set<Directive> expandDirective(@Nonnull Directive<? extends DirectiveValue> directive) { if (!(directive instanceof FetchDirective)) { return Collections.singleton(directive); } Set<Directive> directives = new LinkedHashSet<>(); directives.add(directive); Stream<SourceExpression> stream = (Stream<SourceExpression>) directive.values(); Set<SourceExpression> sources = stream.collect(Collectors.toCollection(LinkedHashSet::new)); if (directive instanceof ChildSrcDirective) { directives.add(new FrameSrcDirective(sources)); directives.add(new WorkerSrcDirective(sources)); } else if (directive instanceof ScriptSrcDirective) { directives.add(new ScriptSrcElemDirective(sources)); directives.add(new ScriptSrcAttrDirective(sources)); directives.add(new WorkerSrcDirective(sources)); } else if (directive instanceof StyleSrcDirective) { directives.add(new StyleSrcElemDirective(sources)); directives.add(new StyleSrcAttrDirective(sources)); } return directives; }
Source:
<code>public ResponseEntity<List<ExpenseDTO>> listAllExpensesByCategoryNameAndTimeInterval( @PathVariable("category_name") String categoryName, @PathVariable("currency") String currency, @PathVariable("start_time_millis") long startTimeMillis, @PathVariable("end_time_millis") long endTimeMillis) { <START> <END> AppUser user = userUtil.extractLoggedAppUserFromDatabase(); List<Expense> expenses = null; if (categoryName.equals("*")) { expenses = expenseDao.findByTimeInterval(user.getUsername(), new Timestamp(startTimeMillis), new Timestamp(endTimeMillis)); } else { expenses = expenseDao.findByTimeIntervalAndCategory(user.getUsername(), categoryName, new Timestamp(startTimeMillis), new Timestamp(endTimeMillis)); } if (expenses.isEmpty()) { return new ResponseEntity<List<ExpenseDTO>>(HttpStatus.NO_CONTENT); } return new ResponseEntity<List<ExpenseDTO>>(createExpenseDTOs(expenses), HttpStatus.OK); }</code><technical_language>Add a validation clause for currency. If Currency code is valid throw BadRequestException</technical_language>

Target:
public ResponseEntity<List<ExpenseDTO>> listAllExpensesByCategoryNameAndTimeInterval( @PathVariable("category_name") String categoryName, @PathVariable("currency") String currency, @PathVariable("start_time_millis") long startTimeMillis, @PathVariable("end_time_millis") long endTimeMillis) { AppUser user = userUtil.extractLoggedAppUserFromDatabase(); List<Expense> expenses = null; if (categoryName.equals("*")) { expenses = expenseDao.findByTimeInterval(user.getUsername(), new Timestamp(startTimeMillis), new Timestamp(endTimeMillis)); } else { expenses = expenseDao.findByTimeIntervalAndCategory(user.getUsername(), categoryName, new Timestamp(startTimeMillis), new Timestamp(endTimeMillis)); } if (expenses.isEmpty()) { return new ResponseEntity<List<ExpenseDTO>>(HttpStatus.NO_CONTENT); } convertExpenseCurrencies(expenses, currency); return new ResponseEntity<List<ExpenseDTO>>(createExpenseDTOs(expenses), HttpStatus.OK); }
Source:
<code>private void addComponentDescriptorButtons(JToolBar toolBar) { final DescriptorProvider descriptorProvider = _analysisJobBuilder.getConfiguration().getDescriptorProvider(); final Set<ComponentSuperCategory> superCategories = descriptorProvider.getComponentSuperCategories(); for (ComponentSuperCategory superCategory : superCategories) { final String name = superCategory.getName(); final String description = "<html><b>" + name + "</b><br/>" + superCategory.getDescription() + "</html>"; final PopupButton popupButton = new PopupButton(name); applyMenuPopupButttonStyling(popupButton); DCPopupBubble popupBubble = new DCPopupBubble(_glassPane, description, 0, 0, IconUtils.getComponentSuperCategoryIcon(superCategory)); popupBubble.attachTo(popupButton, new DCPopupBubble.PopupCallback() { @Override public boolean onBeforeShow() { for(PopupButton scButton : _superCategoryButtons) { if(scButton.isSelected()){ return false; } } return true; } }); final JPopupMenu menu = popupButton.getMenu(); final DescriptorMenuBuilder menuBuilder = new DescriptorMenuBuilder(_analysisJobBuilder, _usageLogger, superCategory, null); menuBuilder.addItemsToPopupMenu(menu); <START> if (menu.isVisible()) { <END> popupBubble.hide(); } toolBar.add(popupButton); _superCategoryButtons.add(popupButton); } }</code><technical_language>Is this needed? this evaluate true menu is built this point in time</technical_language>

Target:
private void addComponentDescriptorButtons(JToolBar toolBar) { final DescriptorProvider descriptorProvider = _analysisJobBuilder.getConfiguration().getDescriptorProvider(); final Set<ComponentSuperCategory> superCategories = descriptorProvider.getComponentSuperCategories(); for (ComponentSuperCategory superCategory : superCategories) { final String name = superCategory.getName(); final String description = "<html><b>" + name + "</b><br/>" + superCategory.getDescription() + "</html>"; final PopupButton popupButton = new PopupButton(name); applyMenuPopupButttonStyling(popupButton); DCPopupBubble popupBubble = new DCPopupBubble(_glassPane, description, 0, 0, IconUtils.getComponentSuperCategoryIcon(superCategory)); popupBubble.attachTo(popupButton, new DCPopupBubble.PopupCallback() { @Override public boolean onBeforeShow() { for(PopupButton scButton : _superCategoryButtons) { if(scButton.isSelected()){ return false; } } return true; } }); final JPopupMenu menu = popupButton.getMenu(); final DescriptorMenuBuilder menuBuilder = new DescriptorMenuBuilder(_analysisJobBuilder, _usageLogger, superCategory, null); menuBuilder.addItemsToPopupMenu(menu); toolBar.add(popupButton); _superCategoryButtons.add(popupButton); } }
Source:
<code>public void testStateIsCleared() throws Exception { <START> final File fileToProcess = new File(getPath("messages_test_de.properties")); <END> final String charset = StandardCharsets.UTF_8.name(); final TranslationCheck check = new TranslationCheck(); check.beginProcessing(charset); check.processFiltered(fileToProcess, new FileText(fileToProcess, charset)); check.beginProcessing(charset); final Field field = check.getClass().getDeclaredField("filesToProcess"); field.setAccessible(true); assertTrue("Stateful field is not cleared on beginProcessiong", ((Collection<File>) field.get(check)).isEmpty()); }</code><technical_language>I starting finish issue re-organized inputs. Please rename new input files InputTranslation.... If file renamed, please give a reason why</technical_language>

Target:
public void testStateIsCleared() throws Exception { final File fileToProcess = new File( getPath("InputTranslationCheckFireErrors_de.properties") ); final String charset = StandardCharsets.UTF_8.name(); final TranslationCheck check = new TranslationCheck(); check.beginProcessing(charset); check.processFiltered(fileToProcess, new FileText(fileToProcess, charset)); check.beginProcessing(charset); final Field field = check.getClass().getDeclaredField("filesToProcess"); field.setAccessible(true); assertTrue("Stateful field is not cleared on beginProcessing", ((Collection<File>) field.get(check)).isEmpty()); }
Source:
<code>public void visitBinaryComparisonType(VisitableXmlElement<BinaryComparisonOpType> visitable) { JAXBElement<BinaryComparisonOpType> element = visitable.getElement(); String localPart = element.getName().getLocalPart(); <START> LOGGER.debug(localPart); <END> String operator = BINARY_COMPARE_MAPPING.get(localPart); if (operator == null) { throw new IllegalArgumentException( "Cannot find mapping for binary comparison operator: " + localPart); } builder.beginBinaryComparisonType(operator); element.getValue().getExpression().forEach(jax -> makeVisitable(jax).accept(this)); builder.endBinaryComparisonType(); }</code><technical_language>a of logging statements in this class possibly cleaned</technical_language>

Target:
public void visitBinaryComparisonType(VisitableXmlElement<BinaryComparisonOpType> visitable) { JAXBElement<BinaryComparisonOpType> element = visitable.getElement(); String localPart = element.getName().getLocalPart(); traceLocalPart(localPart); String operator = BINARY_COMPARE_MAPPING.get(localPart); if (operator == null) { throw new IllegalArgumentException( "Cannot find mapping for binary comparison operator: " + localPart); } builder.beginBinaryComparisonType(operator); element.getValue().getExpression().forEach(jax -> makeVisitable(jax).accept(this)); builder.endTerminalType(); }
Source:
<code><START> public Optional<List<FieldSchema>> getFields(String databaseName, String tableName) <END> { try { return retry() .stopOn(MetaException.class, UnknownTableException.class, UnknownDBException.class) .stopOnIllegalExceptions() .run("getFields", stats.getGetFields().wrap(() -> { try (HiveMetastoreClient client = clientProvider.createMetastoreClient()) { return Optional.of(ImmutableList.copyOf(client.getFields(databaseName, tableName))); } })); } catch (NoSuchObjectException e) { return Optional.empty(); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw Throwables.propagate(e); } }</code><technical_language>Missing @Override</technical_language>

Target:
public Optional<List<FieldSchema>> getFields(String databaseName, String tableName) { try { return retry() .stopOn(MetaException.class, UnknownTableException.class, UnknownDBException.class) .stopOnIllegalExceptions() .run("getFields", stats.getGetFields().wrap(() -> { try (HiveMetastoreClient client = clientProvider.createMetastoreClient()) { return Optional.of(ImmutableList.copyOf(client.getFields(databaseName, tableName))); } })); } catch (NoSuchObjectException e) { return Optional.empty(); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw propagate(e); } }
Source:
<code><START> public AsyncQueryResultStorage getResultsByID(String asyncQueryID) { <END> log.debug("getResultsByID"); AsyncQueryResultStorage asyncQueryResultStorages = null; try { asyncQueryResultStorages = (AsyncQueryResultStorage) EIT.executeInTransaction(elide, dataStore, (tx, scope) -> { EntityProjection asyncQueryCollection = EntityProjection.builder() .type(AsyncQueryResultStorage.class) .build(); Object loaded = tx.loadObject(asyncQueryCollection, asyncQueryID, scope); return loaded; }); } catch (Exception e) { log.error("Exception: {}", e); } return asyncQueryResultStorages; }</code><technical_language>Instead of returning AsyncQueryResultStorage return byte[] code extensible</technical_language>

Target:
public byte[] getResultsByID(String asyncQueryID) { log.debug("getAsyncResultsByID"); AsyncQuery asyncQuery = null; byte[] byteResult = null; try { asyncQuery = (AsyncQuery) DBUtil.executeInTransaction(elideSettings, dataStore, (tx, scope) -> { EntityProjection asyncQueryCollection = EntityProjection.builder() .type(AsyncQuery.class) .build(); Object loaded = tx.loadObject(asyncQueryCollection, asyncQueryID, scope); return loaded; }); if (asyncQuery != null && asyncQuery.getResult().getAttachment() != null) { Blob result = asyncQuery.getResult().getAttachment(); byteResult = result.getBytes(1, (int) result.length()); } } catch (SQLException e) { log.error("Exception: {}", e); throw new IllegalStateException(e); } return byteResult; }
Source:
<code>public static void queueStart(String baseUrl, Report r) { Queue queue = QueueFactory.getDefaultQueue(); TaskOptions options = getTaskOptions(baseUrl, r); <START> log.info("Forking to task with options: " + options.toString()); <END> queue.add(options); }</code><technical_language>I switch debug logging</technical_language>

Target:
public static void queueStart(String baseUrl, Report r) { Queue queue = QueueFactory.getDefaultQueue(); TaskOptions options = getTaskOptions(baseUrl, r); log.fine("Forking to task with options: " + options.toString()); queue.add(options); }
Source:
<code>private VenueEntity adapt(Venue venue) { List<VenueNameInformationEntity> informationEntities = Lists.newArrayList(); <START> for (VenueNameInformation duple : venue.nameInformation) { <END> informationEntities.add(new VenueNameInformationEntity(duple.nameInformation, duple.language.code)); } return new VenueEntity(venue.group.name, venue.type.name, informationEntities); }</code><technical_language>rename duple info</technical_language>

Target:
private VenueEntity adapt(Venue venue) { List<VenueNameEntity> nameEntities = Lists.newArrayList(); for (VenueName info : venue.names) { nameEntities.add(new VenueNameEntity(info.name, info.language.code)); } return new VenueEntity(venue.group.name, venue.type.name, nameEntities); }
Source:
<code>private void placeItemsOnBoard() { int numberOfItems = 0; while (((double) numberOfItems) / grid.size() < NUMBER_OF_GRENADES) { Coordinate position = Coordinate.random(width, height); if (canPlaceItem(position)) { ((Square) grid.get(position)).addItem(new LightGrenade()); numberOfItems++; } } numberOfItems = 0; List<Teleporter> teleporters = new ArrayList<>(); while (((double) numberOfItems) / grid.size() < NUMBER_OF_TELEPORTERS) { Coordinate position = Coordinate.random(width, height); if (canPlaceItem(position)) { Teleporter teleporter = new Teleporter(getTeleporterDestination(teleporters), grid.get(position)); ((Square) grid.get(position)).addItem(teleporter); teleporters.add(teleporter); numberOfItems++; } } teleporters.remove(0); teleporters.get(0).setDestination(getTeleporterDestination(teleporters)); numberOfItems = 0; while (((double) numberOfItems) / grid.size() < NUMBER_OF_IDENTITY_DISKS) { Coordinate position = Coordinate.random(width, height); if (canPlaceItem(position)) { <START> ((Square) grid.get(position)).addItem(new ChargedIdentityDisk()); <END> numberOfItems++; } } }</code><technical_language>this UnchargedIdentityDisk</technical_language>

Target:
private void placeItemsOnBoard() { int numberOfItems = 0; while (((double) numberOfItems) / grid.size() < NUMBER_OF_GRENADES) { Coordinate position = Coordinate.random(width, height); if (canPlaceItem(position)) { ((Square) grid.get(position)).addItem(new LightGrenade()); numberOfItems++; } } numberOfItems = 0; List<Teleporter> teleporters = new ArrayList<>(); while (((double) numberOfItems) / grid.size() < NUMBER_OF_TELEPORTERS) { Coordinate position = Coordinate.random(width, height); if (canPlaceItem(position)) { Teleporter teleporter = new Teleporter(getTeleporterDestination(teleporters), grid.get(position)); ((Square) grid.get(position)).addItem(teleporter); teleporters.add(teleporter); numberOfItems++; } } teleporters.remove(0); teleporters.get(0).setDestination(getTeleporterDestination(teleporters)); numberOfItems = 0; while (((double) numberOfItems) / grid.size() < NUMBER_OF_IDENTITY_DISKS) { Coordinate position = Coordinate.random(width, height); if (canPlaceItem(position)) { ((Square) grid.get(position)).addItem(new UnchargedIdentityDisk()); numberOfItems++; } } }
Source:
<code>public void run() { m_trigger.triggered(m_calendar); <START> synchronized (m_leasedThread) { <END> m_leasedThread.set(Thread.currentThread()); } try { if (isExpired()) { cancel(true); } else if (isFinalRun()) { super.run(); } else { super.runAndReset(); } } finally { synchronized (m_leasedThread) { m_leasedThread.set(null); } finishInternal(); releasePermit(); } }</code><technical_language>Synchronization this point is required cancelled method reads volatile field a local variable (either becuase replace AtomicReference original volatile variable suggested wrapped AtomicReference is stored in a volatile field well). Due volatile, read in cancelled is atomic. m_leasedThread ben set not. Synchornization change anything</technical_language>

Target:
public void run() { m_trigger.triggered(m_calendar); m_leasedThread = Thread.currentThread(); try { if (isExpired()) { cancel(true); } else if (isFinalRun()) { super.run(); } else { super.runAndReset(); } } finally { synchronized (m_leasedThreadLock) { m_leasedThread = null; } finishInternal(); releasePermit(); } }
Source:
<code>private void generateRequires(StringBuilder buffer) { <START> buffer.append("BuildRequires: maven-local\n"); <END> }</code><technical_language>removed much. RPM generate BuildRequires need generated. Requires needed</technical_language>

Target:
private void generateRequires(StringBuilder buffer) { for (Map.Entry<String, String> entry : model.getDependencies() .entrySet()) { buffer.append("BuildRequires: mvn(" + entry.getKey() + ":" + entry.getValue() + ")\n"); } buffer.append("BuildRequires: maven-local\n"); }
Source:
<code>private void initOffsets(String toParse) { <START> boolean hasByteOrderMark = toParse.startsWith(Character.toString(JavaScriptNodeBuilder.BYTE_ORDER_MARK)); <END> lineStartOffsets.add(hasByteOrderMark ? -1 : 0); int i = 0; while (i < length) { if (toParse.charAt(i) == '\n' || toParse.charAt(i) == '\r') { int nextLineStartOffset = i + 1; if (i < (length - 1) && toParse.charAt(i) == '\r' && toParse.charAt(i + 1) == '\n') { nextLineStartOffset = i + 2; i++; } lineStartOffsets.add(nextLineStartOffset); } i++; } }</code><technical_language>@pynicolas I logic in JavaScriptNodeBuilder: need subtract 1 column if token is line 1. current solution, getColumn() a token is line 1 a BOM UTF-8 character return incorrect value</technical_language>

Target:
private void initOffsets(String toParse) { boolean hasByteOrderMark = toParse.startsWith(Character.toString(JavaScriptNodeBuilder.BYTE_ORDER_MARK)); lineStartOffsets.add(0); int i = 0; while (i < length) { if (toParse.charAt(i) == '\n' || toParse.charAt(i) == '\r') { int nextLineStartOffset = i + 1; if (i < (length - 1) && toParse.charAt(i) == '\r' && toParse.charAt(i + 1) == '\n') { nextLineStartOffset = i + 2; i++; } lineStartOffsets.add(nextLineStartOffset - (hasByteOrderMark ? 1 : 0)); } i++; } }
Source:
<code>public Response deleteToken(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Token id to delete", required = true) @PathParam("tokenId") Long tokenId) { Token token = tokenDAO.findById(tokenId); checkUser(user, token.getUserId()); cachingAuthenticator.invalidate(token.getContent()); tokenDAO.delete(token); if (token.getTokenSource() == TokenType.ORCID_ORG) { User byId = userDAO.findById(user.getId()); <START> byId.setOrcid(""); <END> } token = tokenDAO.findById(tokenId); if (token == null) { return Response.noContent().build(); } else { return Response.serverError().build(); } }</code><technical_language>I this null, empty string</technical_language>

Target:
public Response deleteToken(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Token id to delete", required = true) @PathParam("tokenId") Long tokenId) { Token token = tokenDAO.findById(tokenId); checkUser(user, token.getUserId()); cachingAuthenticator.invalidate(token.getContent()); tokenDAO.delete(token); if (token.getTokenSource() == TokenType.ORCID_ORG) { User byId = userDAO.findById(user.getId()); byId.setOrcid(null); } token = tokenDAO.findById(tokenId); if (token == null) { return Response.noContent().build(); } else { return Response.serverError().build(); } }
Source:
<code>private Supplier<DruidFloatPredicate> getFloatPredicateSupplier() { return new Supplier<DruidFloatPredicate>() { private final Object initLock = new Object(); private DruidFloatPredicate predicate; private void initFloatValues() { if (predicate != null) { return; } synchronized (initLock) { if (predicate != null) { return; } List<Float> floats = new ArrayList<>(); for (String value : values) { Float floatValue = Floats.tryParse(value); if (floatValue != null) { floats.add(floatValue); } } if (floats.size() > FLOAT_HASHING_THRESHOLD) { <START> final HashSet<Float> floatHashSet = new HashSet<>(floats); <END> predicate = new DruidFloatPredicate() { @Override public boolean applyFloat(float input) { return floatHashSet.contains(input); } }; } else { final float[] floatArray; floatArray = new float[floats.size()]; for (int i = 0; i < floats.size(); i++) { floatArray[i] = floats.get(i).floatValue(); } Arrays.sort(floatArray); predicate = new DruidFloatPredicate() { @Override public boolean applyFloat(float input) { return Arrays.binarySearch(floatArray, input) >= 0; } }; } } } @Override public DruidFloatPredicate get() { initFloatValues(); return predicate; } }; }</code><technical_language>Consider converting this IntOpenHashSet fastutil storing Float.floatToIntBits() results. is match NaNs</technical_language>

Target:
private Supplier<DruidFloatPredicate> getFloatPredicateSupplier() { return new Supplier<DruidFloatPredicate>() { private final Object initLock = new Object(); private DruidFloatPredicate predicate; private void initFloatValues() { if (predicate != null) { return; } synchronized (initLock) { if (predicate != null) { return; } IntArrayList floatBits = new IntArrayList(values.size()); for (String value : values) { Float floatValue = Floats.tryParse(value); if (floatValue != null) { floatBits.add(Float.floatToIntBits(floatValue)); } } if (floatBits.size() > NUMERIC_HASHING_THRESHOLD) { final IntOpenHashSet floatBitsHashSet = new IntOpenHashSet(floatBits); predicate = new DruidFloatPredicate() { @Override public boolean applyFloat(float input) { return floatBitsHashSet.contains(Float.floatToIntBits(input)); } }; } else { final int[] floatBitsArray = floatBits.toIntArray(); Arrays.sort(floatBitsArray); predicate = new DruidFloatPredicate() { @Override public boolean applyFloat(float input) { return Arrays.binarySearch(floatBitsArray, Float.floatToIntBits(input)) >= 0; } }; } } } @Override public DruidFloatPredicate get() { initFloatValues(); return predicate; } }; }
Source:
<code>DashboardInfo(String ref, String name) throws UnsupportedEncodingException { this.ref = ref; this.path = name; <START> this.id = Joiner.on(':').join(ref, path); <END> }</code><technical_language>Is safe assume is ':' in of strings? line 181 special handling for decoding %3A ':'. is expectation client send encoded strings</technical_language>

Target:
DashboardInfo(String ref, String name) throws UnsupportedEncodingException { this.ref = ref; this.path = name; this.id = Joiner.on(':').join(Url.encode(ref), Url.encode(path)); }
Source:
<code>void postConstruct() { Events events = getFromServiceHandle(Globals.getDefaultBaseServiceLocator(), Events.class); if (events != null) { events.register(this); <START> } <END> }</code><technical_language>I means fail here. I assume correct behaviour of this service kind of depends receiving events. logging a warning good manners</technical_language>

Target:
void postConstruct() { Events events = getFromServiceHandle(Globals.getDefaultBaseServiceLocator(), Events.class); if (events != null) { events.register(this); } else { logger.log(Level.WARNING, "OpenTracing service not registered to Payara Events: " + "The Tracer for an application won't be removed upon undeployment"); } }
Source:
<code>private static void closeMissingProject(IProject p, File projectFile, IProgressMonitor monitor) throws CoreException { boolean closeFailed = false; File projectRoot = projectFile.getParentFile(); if (!projectRoot.isFile()) { boolean hasRoot = projectRoot.exists(); if (!hasRoot) <START> projectRoot.mkdirs(); <END> try { if (projectFile.createNewFile()) p.close(new SubProgressMonitor(monitor, 1)); else closeFailed = true; } catch (IOException e) { closeFailed = true; } finally { try { FileUtils.delete(projectFile, FileUtils.RETRY | FileUtils.SKIP_MISSING); } catch (IOException e) { closeFailed = true; } if (hasRoot) try { FileUtils.delete(projectRoot, FileUtils.RETRY | FileUtils.SKIP_MISSING | FileUtils.RECURSIVE); } catch (IOException e) { closeFailed = true; } } } else closeFailed = true; if (closeFailed) p.delete(false, true, new SubProgressMonitor(monitor, 1)); }</code><technical_language>findBugs: this is ignoring mkdir()'s return value, instead FileUtils.mkdirs()</technical_language>

Target:
private static void closeMissingProject(IProject p, File projectFile, IProgressMonitor monitor) throws CoreException { boolean closeFailed = false; File projectRoot = projectFile.getParentFile(); if (!projectRoot.isFile()) { boolean hasRoot = projectRoot.exists(); try { if (!hasRoot) FileUtils.mkdirs(projectRoot, true); if (projectFile.createNewFile()) p.close(new SubProgressMonitor(monitor, 1)); else closeFailed = true; } catch (IOException e) { closeFailed = true; } finally { try { FileUtils.delete(projectFile, FileUtils.RETRY | FileUtils.SKIP_MISSING); } catch (IOException e) { closeFailed = true; } if (hasRoot) try { FileUtils.delete(projectRoot, FileUtils.RETRY | FileUtils.SKIP_MISSING | FileUtils.RECURSIVE); } catch (IOException e) { closeFailed = true; } } } else closeFailed = true; if (closeFailed) p.delete(false, true, new SubProgressMonitor(monitor, 1)); }
Source:
<code>static Map<String, Consumer<Object>> setAttributeConsumers(AzureBlobFileAttributeView view) { Map<String, Consumer<Object>> map = new HashMap<>(); map.put("blobHttpHeaders", obj -> { try { view.setBlobHttpHeaders((BlobHttpHeaders) obj); } catch (IOException e) { throw LoggingUtility.logError(view.logger, new UncheckedIOException(ATTR_CONSUMER_ERROR, e)); } }); map.put("metadata", obj -> { try { Map<String, String> m = (Map<String, String>) obj; if (m == null) { throw LoggingUtility.logError(view.logger, new ClassCastException()); } <START> view.setMetadata((Map<String, String>) obj); <END> } catch (IOException e) { throw LoggingUtility.logError(view.logger, new UncheckedIOException(ATTR_CONSUMER_ERROR, e)); } }); map.put("tier", obj -> { try { view.setTier((AccessTier) obj); } catch (IOException e) { throw LoggingUtility.logError(view.logger, new UncheckedIOException(ATTR_CONSUMER_ERROR, e)); } }); return map; }</code><technical_language>able pass m here</technical_language>

Target:
static Map<String, Consumer<Object>> setAttributeConsumers(AzureBlobFileAttributeView view) { Map<String, Consumer<Object>> map = new HashMap<>(); map.put("blobHttpHeaders", obj -> { try { view.setBlobHttpHeaders((BlobHttpHeaders) obj); } catch (IOException e) { throw LoggingUtility.logError(view.logger, new UncheckedIOException(ATTR_CONSUMER_ERROR, e)); } }); map.put("metadata", obj -> { try { Map<String, String> m = (Map<String, String>) obj; if (m == null) { throw LoggingUtility.logError(view.logger, new ClassCastException()); } view.setMetadata(m); } catch (IOException e) { throw LoggingUtility.logError(view.logger, new UncheckedIOException(ATTR_CONSUMER_ERROR, e)); } }); map.put("tier", obj -> { try { view.setTier((AccessTier) obj); } catch (IOException e) { throw LoggingUtility.logError(view.logger, new UncheckedIOException(ATTR_CONSUMER_ERROR, e)); } }); return map; }
Source:
<code>public boolean isFull() { <START> return ctx.inventory.select().size() > Constants.INVENTORY_SIZE-1; <END> }</code><technical_language>I suggest improve readability changing ctx.inventory.select().size() >= Constants.INVENTORY_SIZE</technical_language>

Target:
public boolean isFull() { return ctx.inventory.select().size() >= Constants.INVENTORY_SIZE; }
Source:
<code>public AuthenticatorAsyncTask(Activity activity) { mContext = activity.getApplicationContext(); mListener = new WeakReference<OnAuthenticatorTaskListener>((OnAuthenticatorTaskListener)activity); <START> mActivity = activity; <END> }</code><technical_language>This attributie is used, needed; please remove it</technical_language>

Target:
public AuthenticatorAsyncTask(Activity activity) { mContext = activity.getApplicationContext(); mListener = new WeakReference<OnAuthenticatorTaskListener>((OnAuthenticatorTaskListener)activity); }