auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void populateViewHolder(@NonNull Config config, @NonNull IAuthorData authorData, @NonNull ProfileImageProvider provider, <START> long initialTimeStampMs, <END> @NonNull final Runnable listener) { final Context context = profileImageView.getContext(); final ProfileImage profileImage; { if (provider.getProfileImage() != null) { profileImage = provider.getProfileImage(); } else { ProfileModel profileModel = userPrefs.getProfile(); if (profileModel != null && authorData.getAuthor().equals(profileModel.username)) { profileImage = userPrefs.getProfileImage(); } else { profileImage = null; } } if (profileImage != null && profileImage.hasImage()) { Glide.with(context).load(profileImage.getImageUrlMedium()) .into(profileImageView); } else { profileImageView.setImageResource(R.drawable.xsie); } } DiscussionTextUtils.setAuthorText(authorTextView, authorData); if (authorData.getCreatedAt() != null) { CharSequence relativeTime = DiscussionTextUtils.getRelativeTimeSpanString(context, initialTimeStampMs, authorData.getCreatedAt().getTime()); dateTextView.setText(relativeTime); } else { dateTextView.setVisibility(View.GONE); } if (config.isUserProfilesEnabled() && !authorData.isAuthorAnonymous()) { profileRow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.run(); } }); } }</code><technical_language>this argument optional for convenience, current time if provided? adapters persist initial time views static consistent, this view holder is header views in fragments, provide current time</technical_language>

Target:
public void populateViewHolder(@NonNull Config config, @NonNull IAuthorData authorData, @NonNull ProfileImageProvider provider, long initialTimeStampMs, @NonNull final Runnable listener) { final Context context = profileImageView.getContext(); final ProfileImage profileImage; { if (provider.getProfileImage() != null && provider.getProfileImage().hasImage()) { profileImage = provider.getProfileImage(); } else { ProfileModel profileModel = userPrefs.getProfile(); if (profileModel != null && authorData.getAuthor().equals(profileModel.username)) { profileImage = userPrefs.getProfileImage(); } else { profileImage = null; } } if (profileImage != null && profileImage.hasImage()) { Glide.with(context) .load(profileImage.getImageUrlMedium()) .into(profileImageView); } else { profileImageView.setImageResource(R.drawable.profile_photo_placeholder); } } DiscussionTextUtils.setAuthorText(authorTextView, authorData); if (authorData.getCreatedAt() != null) { CharSequence relativeTime = DiscussionTextUtils.getRelativeTimeSpanString(context, initialTimeStampMs, authorData.getCreatedAt().getTime()); dateTextView.setText(relativeTime); } else { dateTextView.setVisibility(View.GONE); } if (config.isUserProfilesEnabled() && !authorData.isAuthorAnonymous()) { profileRow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.run(); } }); } }
Source:
<code>private void migratePatchSetApprovals(ReviewDb db, LegacyLabelTypes labelTypes) throws SQLException { PreparedStatement stmt = ((JdbcSchema) db).getConnection().prepareStatement( "UPDATE patch_set_approvals SET category_id = ? WHERE category_id = ?"); try { for (LegacyLabelType type : labelTypes.getLegacyLabelTypes()) { <START> stmt.clearParameters(); <END> stmt.setString(1, type.getName()); stmt.setString(2, type.getId()); stmt.addBatch(); } stmt.executeBatch(); } finally { stmt.close(); } }</code><technical_language>Is this a bug squashed earlier Schema_77 created</technical_language>

Target:
private void migratePatchSetApprovals(ReviewDb db, LegacyLabelTypes labelTypes) throws SQLException { PreparedStatement stmt = ((JdbcSchema) db).getConnection().prepareStatement( "UPDATE patch_set_approvals SET category_id = ? WHERE category_id = ?"); try { for (LegacyLabelType type : labelTypes.getLegacyLabelTypes()) { stmt.setString(1, type.getName()); stmt.setString(2, type.getId()); stmt.addBatch(); } stmt.executeBatch(); } finally { stmt.close(); } }
Source:
<code>public boolean performOk() { boolean result = super.performOk(); if (coreFields != null) { Iterator<FieldEditor> e = coreFields.iterator(); while (e.hasNext()) { FieldEditor pe = e.next(); <START> pe.store(); <END> } } return result; }</code><technical_language>default preference flushed in preference store closing eclipse. I is done automatically for UIPlugin AbstractUIPlugin class. do for UI plugin</technical_language>

Target:
public boolean performOk() { boolean result = super.performOk(); if (coreFields != null) { Iterator<FieldEditor> e = coreFields.iterator(); while (e.hasNext()) { FieldEditor pe = e.next(); pe.store(); if (pe instanceof SpecificFieldEditor) { ((SpecificFieldEditor) pe).setPresentsDefaultValue(false); } } } return result; }
Source:
<code>protected boolean isCPOEValid() { for (String crit : CPOE_CRITERIA_OR) { if (null != criteriaMet.get(crit)) { this.counts.put("criteriaCpoeRequiredMet", 1); return true; } } <START> SortedSet<String> missing1 = new TreeSet<String>(); <END> missing1.addAll(CPOE_CRITERIA_OR); missingOr.add(missing1); return false; }</code><technical_language>variable name this format. other variable in this method named missing, drop "1"</technical_language>

Target:
protected boolean isCPOEValid() { for (String crit : CPOE_CRITERIA_OR) { if (null != criteriaMet.get(crit)) { this.counts.put("criteriaCpoeRequiredMet", 1); return true; } } ArrayList<String> missing = new ArrayList<String>(); missing.addAll(CPOE_CRITERIA_OR); missingOr.add(missing); return false; }
Source:
<code>public boolean saveOrAppendFile(File dest, InputStream stream) { String destPath = dest.getAbsolutePath(); try { <START> LOGGER.trace("Appending file [" + destPath + "]"); <END> systemService.streamToFile(stream, dest); LOGGER.trace("File [" + destPath + "] appended."); return true; } catch (IOException e) { LOGGER.error("Failed to save the file to : [" + destPath + "]", e); return false; } }</code><technical_language>change</technical_language>

Target:
public boolean saveOrAppendFile(File dest, InputStream stream) { String destPath = dest.getAbsolutePath(); try { LOGGER.trace("Appending file [{}]", destPath); systemService.streamToFile(stream, dest); LOGGER.trace("File appended.", destPath); return true; } catch (IOException e) { LOGGER.error("Failed to save the file to : [{}]", destPath, e); return false; } }
Source:
<code>public IEventBus receive(IMessage message) { CheckUtil.checkArg(message instanceof BaseMessage, "Accepts only BaseMessage instances"); receiveMessage((BaseMessage) message); <START> queue(message); <END> return this; }</code><technical_language>This method invoked sending message for processing in doReceive() method here</technical_language>

Target:
public IEventBus receive(IMessage message) { CheckUtil.checkArg(message instanceof BaseMessage, "Accepts only BaseMessage instances"); receiveMessage((BaseMessage) message); return this; }
Source:
<code>public void dragStart(DragSourceEvent event) { <START> event.doit = !((event.data instanceof IPath) || (event.data instanceof Variable)); <END> final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); LocalSelectionTransfer.getTransfer().setSelection(selection); }</code><technical_language>cases this evaluates false</technical_language>

Target:
public void dragStart(DragSourceEvent event) { final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); LocalSelectionTransfer.getTransfer().setSelection(selection); }
Source:
<code><START> public static <E extends Endpoints<E>> E resolveWriteConflictsInPending(E natural, E pending) <END> { return pending.without(natural.endpoints()); }</code><technical_language>anymore</technical_language>

Target:
private static <E extends Endpoints<E>> E resolveWriteConflictsInPending(E natural, E pending) { return pending.without(natural.endpoints()); }
Source:
<code>public void stop() { for (TestContextManager contextManager : contextManagerMap.values()) { try { contextManager.afterTestClass(); } catch (Exception e) { throw new CucumberException(e.getMessage(), e); } } contextManagerMap.clear(); <START> <END> GlueCodeContext.INSTANCE.stop(); applicationContext.getBeanFactory().destroySingletons(); }</code><technical_language>extract new added lines a separate method in order overload context of stop method</technical_language>

Target:
public void stop() { notifyContextManagersAboutTestClassFinished(); GlueCodeContext.INSTANCE.stop(); applicationContext.getBeanFactory().destroySingletons(); }
Source:
<code>public Status validateProjectResolverHandle(IProjectHandleResolver resolver, boolean setResolverValidation) { String resolvedHandle = resolver.buildResolvedHandle(resolver.getHandleExample()); if ((resolver.getResolvedHandleExample()).equals(resolvedHandle)) { setResolverStatus(resolver, setResolverValidation, Status.PASSED); return Status.PASSED; } else { setResolverStatus(resolver, setResolverValidation, Status.FAILED); return Status.FAILED; <START> } <END> }</code><technical_language>instead of calling extra method for if statement (seems a overkill), do if statement determine validation status Status status = condition ? passed : failed more line for setting status if needs set => 3 lines of code</technical_language>

Target:
public Status validateProjectResolverHandle(IProjectHandleResolver resolver, boolean setResolverValidation) { String resolvedHandle; try { resolvedHandle = resolver.buildResolvedHandle(resolver.getHandleExample()); } catch (PatternSyntaxException e) { return Status.FAILED; } Status status = (resolver.getResolvedHandleExample()).equals(resolvedHandle) ? Status.PASSED : Status.FAILED; if (setResolverValidation) { resolver.setValidation(status); saveProjectHandleResolver(resolver, resolver.getUsername()); } return status; }
Source:
<code>protected AbstractTreeIterator[] mergeBases() throws IOException { final int numsourceTrees = sourceTrees.length; int commitIdx = 0; RevTree tempTrees[] = new RevTree[MAX_BASES]; AbstractTreeIterator tempIterators[] = new AbstractTreeIterator[MAX_BASES]; if (baseTrees == null) { baseTrees = new RevTree[MAX_BASES]; baseTreeIterators = new AbstractTreeIterator[MAX_BASES]; } for (int aIdx = 0; aIdx < numsourceTrees; aIdx++) { for (int bIdx = aIdx + 1; bIdx < numsourceTrees; bIdx++) { List<RevCommit> baseCommits = getBaseCommits(aIdx, bIdx); for (RevCommit baseCommit : baseCommits) { if (commitIdx < MAX_BASES) { tempTrees[commitIdx] = baseCommit.getTree(); tempIterators[commitIdx] = openTree(baseCommit .getTree()); commitIdx++; } else { throw new IOException( MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, <START> "TOO_MANY_BASES", <END> sourceCommits[aIdx].name(), sourceCommits[bIdx].name(), Integer.valueOf(commitIdx), baseCommit.name())); } } } } if (commitIdx == 0) { baseTreeIterators[commitIdx] = new EmptyTreeIterator(); commitIdx++; } else { baseTrees = copyOf(tempTrees, commitIdx); baseTreeIterators = copyOf(tempIterators, commitIdx); } return copyOf(baseTreeIterators, baseTreeIterators.length); }</code><technical_language>is this text "TOO_MANY_BASES" good for</technical_language>

Target:
protected AbstractTreeIterator[] mergeBases() throws IOException { final int numsourceTrees = sourceTrees.length; int commitIdx = 0; RevTree tempTrees[] = new RevTree[MAX_BASES]; AbstractTreeIterator tempIterators[] = new AbstractTreeIterator[MAX_BASES]; if (baseTrees == null) { baseTrees = new RevTree[MAX_BASES]; baseTreeIterators = new AbstractTreeIterator[MAX_BASES]; } for (int aIdx = 0; aIdx < numsourceTrees; aIdx++) { for (int bIdx = aIdx + 1; bIdx < numsourceTrees; bIdx++) { List<RevCommit> baseCommits = getBaseCommits(aIdx, bIdx); for (RevCommit baseCommit : baseCommits) { if (commitIdx < MAX_BASES) { tempTrees[commitIdx] = baseCommit.getTree(); tempIterators[commitIdx] = openTree(baseCommit .getTree()); commitIdx++; } else { throw new IOException( MessageFormat.format( JGitText.get().mergeRecursiveTooManyMergeBasesFor, Integer.valueOf(MAX_BASES), sourceCommits[aIdx].name(), sourceCommits[bIdx].name(), Integer.valueOf(commitIdx), baseCommit.name())); } } } } if (commitIdx == 0) { baseTreeIterators[commitIdx] = new EmptyTreeIterator(); commitIdx++; } else { baseTrees = copyOf(tempTrees, commitIdx); baseTreeIterators = copyOf(tempIterators, commitIdx); } return copyOf(baseTreeIterators, baseTreeIterators.length); }
Source:
<code>private boolean doAccept() { boolean accepted = false; SocketChannel sc = null; try { sc = acceptSocket.accept(); accepted = true; <START> if (limitTotalNumberOfCnxns()) { accepted = false; return accepted; <END> } InetAddress ia = sc.socket().getInetAddress(); int cnxncount = getClientCnxnCount(ia); if (maxClientCnxns > 0 && cnxncount >= maxClientCnxns) { throw new IOException("Too many connections from " + ia + " - max is " + maxClientCnxns); } LOG.debug("Accepted socket connection from {}", sc.socket().getRemoteSocketAddress()); sc.configureBlocking(false); if (!selectorIterator.hasNext()) { selectorIterator = selectorThreads.iterator(); } SelectorThread selectorThread = selectorIterator.next(); if (!selectorThread.addAcceptedConnection(sc)) { throw new IOException("Unable to add connection to selector queue" + (stopped ? " (shutdown in progress)" : "")); } acceptErrorLogger.flush(); } catch (IOException e) { ServerMetrics.getMetrics().CONNECTION_REJECTED.add(1); acceptErrorLogger.rateLimitLog("Error accepting new connection: " + e.getMessage()); fastCloseSock(sc); } return accepted; }</code><technical_language>Hey, thanks for picking this issue! :smile: I finish years due other commitments (shame me). PR nice better, congratulations. :+1: I question: returning method leaking resources closing sc channel? lines 283-285 throw exception if a specific client exceeds max connections. This exception is catch line 301. increment ServerMetrics.getMetrics().CONNECTION_REJECTED counter close channel fastCloseSock(sc);. I recommend do similar (throw exception), removing increment of counter limitTotalNumberOfCnxns (IMO, a query method, incrementing counter lead miscalculations if other code elsewhere). This require add counter in NettyServerCnxnFactory too. Wdyt</technical_language>

Target:
private boolean doAccept() { boolean accepted = false; SocketChannel sc = null; try { sc = acceptSocket.accept(); accepted = true; if (limitTotalNumberOfCnxns()) { throw new IOException("Too many connections max allowed is " + maxCnxns); } InetAddress ia = sc.socket().getInetAddress(); int cnxncount = getClientCnxnCount(ia); if (maxClientCnxns > 0 && cnxncount >= maxClientCnxns) { throw new IOException("Too many connections from " + ia + " - max is " + maxClientCnxns); } LOG.debug("Accepted socket connection from {}", sc.socket().getRemoteSocketAddress()); sc.configureBlocking(false); if (!selectorIterator.hasNext()) { selectorIterator = selectorThreads.iterator(); } SelectorThread selectorThread = selectorIterator.next(); if (!selectorThread.addAcceptedConnection(sc)) { throw new IOException("Unable to add connection to selector queue" + (stopped ? " (shutdown in progress)" : "")); } acceptErrorLogger.flush(); } catch (IOException e) { ServerMetrics.getMetrics().CONNECTION_REJECTED.add(1); acceptErrorLogger.rateLimitLog("Error accepting new connection: " + e.getMessage()); fastCloseSock(sc); } return accepted; }
Source:
<code>public void testCopyDirectoryTree() throws IOException { final Path copyToDir = Files.createTempDirectory("copyToDir"); copyToDir.toFile().deleteOnExit(); IOUtil.copyDirectoryTree(TEST_VARIANT_DIR.toFile(), copyToDir.toFile()); final Stream<Path> fileStream = Files.walk(TEST_VARIANT_DIR); final Stream<Path> copyFileStream = Files.walk(copyToDir); <START> final Iterator<Path> itFileStream = fileStream.iterator(); <END> final Iterator<Path> itCopyFileStream = copyFileStream.iterator(); final List<String> listFiles = new ArrayList<String>(); final List<String> listCopyFiles = new ArrayList<String>(); while (itFileStream.hasNext()) { final Path thisPath = itFileStream.next(); if (!thisPath.equals(TEST_VARIANT_DIR)) { listFiles.add(thisPath.getFileName().toString()); } } while (itCopyFileStream.hasNext()) { final Path thisPath = itCopyFileStream.next(); thisPath.toFile().deleteOnExit(); if (!thisPath.equals(copyToDir)) { listCopyFiles.add(thisPath.getFileName().toString()); } } Assert.assertEqualsNoOrder(listFiles.toArray(new String[listFiles.size()]), listCopyFiles.toArray(new String[listCopyFiles.size()])); }</code><technical_language>inline stream iterator</technical_language>

Target:
public void testCopyDirectoryTree() throws IOException { final Path copyToDir = Files.createTempDirectory("copyToDir"); copyToDir.toFile().deleteOnExit(); IOUtil.copyDirectoryTree(TEST_VARIANT_DIR.toFile(), copyToDir.toFile()); final List<Path> collect = Files.walk(TEST_VARIANT_DIR).filter(f -> !f.equals(TEST_VARIANT_DIR)).map(p -> p.getFileName()).collect(Collectors.toList()); final List<Path> collectCopy = Files.walk(copyToDir).filter(f -> !f.equals(copyToDir)).map(p -> p.getFileName()).collect(Collectors.toList()); Assert.assertEqualsNoOrder(collect.toArray(), collectCopy.toArray()); }
Source:
<code>public boolean equals(@Nullable Object object) { if (!(object instanceof IntegerStateValue)) { return false; } IntegerStateValue other = (IntegerStateValue) object; <START> return this.unboxInt() == other.unboxInt(); <END> }</code><technical_language>this.value == other.value here, in other classes too. save function call, I guess</technical_language>

Target:
public boolean equals(@Nullable Object object) { if (!(object instanceof IntegerStateValue)) { return false; } IntegerStateValue other = (IntegerStateValue) object; return this.value == other.value; }
Source:
<code>void findDocWhichDoesNotExist() { <START> couchbaseTemplate.findById(User.class).one(UUID.randomUUID().toString()); <END> }</code><technical_language>NIT: assert this returns null</technical_language>

Target:
void findDocWhichDoesNotExist() { assertNull(couchbaseTemplate.findById(User.class).one(UUID.randomUUID().toString())); }
Source:
<code>public Rectangle getBoundingBox() { <START> return (Rectangle) getValue("boundingBox"); <END> }</code><technical_language>convention field names in solr lowercase separated underscore "bounding_box" ... Also, field names pulled out constants defined top of file. (eventually, want consolidate enum of FieldNames</technical_language>

Target:
public Rectangle getBoundingBox() { return (Rectangle) getValue("bounding_box"); }
Source:
<code>private Optional<TableToSweep> getTableToSweep() { return specificTableSweeper.getTxManager().runTaskWithRetry( new TransactionTask<Optional<TableToSweep>, RuntimeException>() { @Override public Optional<TableToSweep> execute(Transaction tx) { Optional<SweepProgress> progress = specificTableSweeper.getSweepProgressStore().loadProgress( tx); if (progress.isPresent()) { <START> log.info("Sweeping another batch of table: {}.", <END> LoggingArgs.tableRef("table name", progress.get().tableRef())); return Optional.of(new TableToSweep(progress.get().tableRef(), progress.get())); } else { Optional<TableReference> nextTable = nextTableToSweepProvider.chooseNextTableToSweep( tx, specificTableSweeper.getSweepRunner().getConservativeSweepTimestamp()); if (nextTable.isPresent()) { log.info("Now starting to sweep next table: {}.", LoggingArgs.tableRef("table name", nextTable.get())); return Optional.of(new TableToSweep(nextTable.get(), null)); } else { return Optional.empty(); } } } }); }</code><technical_language>This printed frequently. "started a table" information table is swept. This doesnt give extra info. log start row get rid of it</technical_language>

Target:
private Optional<TableToSweep> getTableToSweep() { return specificTableSweeper.getTxManager().runTaskWithRetry( new TransactionTask<Optional<TableToSweep>, RuntimeException>() { @Override public Optional<TableToSweep> execute(Transaction tx) { Optional<SweepProgress> progress = specificTableSweeper.getSweepProgressStore().loadProgress( tx); if (progress.isPresent()) { log.info("Sweeping another batch of table: {}. Batch starts on row {}", LoggingArgs.tableRef("table name", progress.get().tableRef()), UnsafeArg.of("startRow", progress.get().startRow())); return Optional.of(new TableToSweep(progress.get().tableRef(), progress.get())); } else { Optional<TableReference> nextTable = nextTableToSweepProvider.chooseNextTableToSweep( tx, specificTableSweeper.getSweepRunner().getConservativeSweepTimestamp()); if (nextTable.isPresent()) { log.info("Now starting to sweep next table: {}.", LoggingArgs.tableRef("table name", nextTable.get())); return Optional.of(new TableToSweep(nextTable.get(), null)); } else { return Optional.empty(); } } } }); }
Source:
<code>public void showOrUpdateNotification(int id, int progressInPercent) { NotificationData notificationData = notificationDataMap.get(id); if (notificationData == null) { return; <START> } <END> notificationData.setProgressInPercent(progressInPercent); if (progressInPercent < 100) { notificationManager.notify(id, notificationData.toNotification(context, CHANNEL_ID)); } else { notificationData.setProgressInPercent(0); notificationData.setMaxProgress(0); notificationData.setAutoCancel(true); notificationData.setOngoing(false); notificationManager.notify(id, notificationData.toNotification(context, CHANNEL_ID)); } }</code><technical_language>is / wise give some error information log something</technical_language>

Target:
public void showOrUpdateNotification(int id, int progressInPercent) { NotificationData notificationData = notificationDataMap.get(id); if (notificationData == null) { Log.w(TAG, "Notification with id " + id + "not present in notificationDataMap"); return; } notificationData.setProgressInPercent(progressInPercent); if (progressInPercent < MAX_PERCENT) { notificationManager.notify(id, notificationData.toNotification(context, CHANNEL_ID)); } else { notificationData.setProgressInPercent(0); notificationData.setMaxProgress(0); notificationData.setAutoCancel(true); notificationData.setOngoing(false); notificationManager.notify(id, notificationData.toNotification(context, CHANNEL_ID)); } }
Source:
<code>public boolean hasPermission(final String owner, final String activity, final String target) { if (owner == null || activity == null) { return false; } final HttpServletRequest currentRequest = portalRequestUtils.getCurrentPortalRequest(); final IPerson currentUser = personManager.getPerson((HttpServletRequest) currentRequest); final IAuthorizationPrincipal authPrincipal = this.getUserPrincipal(currentUser.getUserName()); final boolean rslt = authPrincipal != null ? authPrincipal.hasPermission(owner, activity, target) : false; <START> logger.info(String.format("BEACH Test: in XAHBean.hasPermission: owner=[%s], activity=[%s], target=[%s], result=[%s] ", owner, activity, target, rslt)); <END> return rslt; }</code><technical_language>warning: Left test log</technical_language>

Target:
public boolean hasPermission(final String owner, final String activity, final String target) { if (owner == null || activity == null) { return false; } final HttpServletRequest currentRequest = portalRequestUtils.getCurrentPortalRequest(); final IPerson currentUser = personManager.getPerson((HttpServletRequest) currentRequest); final IAuthorizationPrincipal authPrincipal = this.getUserPrincipal(currentUser.getUserName()); final boolean rslt = authPrincipal != null ? authPrincipal.hasPermission(owner, activity, target) : false; if (this.logger.isTraceEnabled()) { logger.trace( String.format( "In hasPermission() - owner=[%s], activity=[%s], target=[%s], result=[%s] ", owner, activity, target, rslt)); } return rslt; }
Source:
<code>public ActionForward render(final ActionMapping mapping, final ActionForm form, final PortletConfig config, final RenderRequest req, final RenderResponse res) throws Exception { Logger.debug(ViewContentletAction.class, "Running ViewContentletsAction!!!!"); try { final User user = _getUser(req); _viewContentlets(req, user); return mapping.findForward("portlet.ext.contentlet.view_contentlets"); } catch (final Exception e) { <START> req.setAttribute(PageContext.EXCEPTION, e); <END> return mapping.findForward(Constants.COMMON_ERROR); } }</code><technical_language>a log added here</technical_language>

Target:
public ActionForward render(final ActionMapping mapping, final ActionForm form, final PortletConfig config, final RenderRequest req, final RenderResponse res) throws Exception { Logger.debug(ViewContentletAction.class, "Running ViewContentletsAction!!!!"); try { final User user = _getUser(req); _viewContentlets(req, user); return mapping.findForward("portlet.ext.contentlet.view_contentlets"); } catch (final Exception e) { Logger.debug(this,e.getMessage()); req.setAttribute(PageContext.EXCEPTION, e); return mapping.findForward(Constants.COMMON_ERROR); } }
Source:
<code>} catch (final IOException e) { <START> e.printStackTrace(); <END> }</code><technical_language>add a more detailed log set currentProductVersion null</technical_language>

Target:
} catch (final IOException e) { LOGGER.error("Failed to retrieve product version", e); }
Source:
<code>public Iterable<HTInterval> iterable2D(IntegerRangeCondition quarks, TimeRangeCondition times) { fRwl.readLock().lock(); <START> try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINEST, "HTNode:query2D", END> "quarks", quarks, "times", times)) { if (getNodeStart() > getNodeEnd()) { return Collections.emptyList(); } long start = times.min(); return Iterables.filter(fIntervals.subList(getStartIndexFor(start), fIntervals.size()), interval -> quarks.test(interval.getAttribute()) && times.intersects(interval.getStartTime(), interval.getEndTime())); } finally { fRwl.readLock().unlock(); } }</code><technical_language>This is part of 2D query ht backend, do link in logs, pass iterable some other thread, do some other query in in parallel, need check arguments match HTNode:query2D HistoryTreeBackend:query2D, so, some other queries quark/times arguments. This is a case for flow scope, pass putting in api..</technical_language>

Target:
public Iterable<HTInterval> iterable2D(IntegerRangeCondition quarks, TimeRangeCondition times) { fRwl.readLock().lock(); try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINEST, "HTNode:query2D", "quarks", quarks, "times", times)) { IntegerRangeCondition subQuarks = quarks.subCondition(fMinQuark, fMaxQuark); if (subQuarks == null) { return Collections.emptyList(); } TimeRangeCondition subTimes = times.subCondition(fNodeStart, fNodeEnd); if (subTimes == null) { return Collections.emptyList(); } long start = subTimes.min(); List<HTInterval> intervals = new ArrayList<>(); for (HTInterval interval : fIntervals.subList(getStartIndexFor(start), fIntervals.size())) { if (subQuarks.test(interval.getAttribute()) && subTimes.intersects(interval.getStartTime(), interval.getEndTime())) { intervals.add(interval); } } return intervals; } finally { fRwl.readLock().unlock(); } }
Source:
<code>public static void cleanup() { QueryManager queryMgr = IOTestUtil.db.newQueryManager(); DeleteQueryDefinition deletedef = queryMgr.newDeleteDefinition(); deletedef.setCollections(collectionName); queryMgr.delete(deletedef); <START> IOTestUtil.db.release(); <END> }</code><technical_language>I releasing client effect of breaking other tests run time. test work if release() call is deleted</technical_language>

Target:
public static void cleanup() { QueryManager queryMgr = IOTestUtil.db.newQueryManager(); DeleteQueryDefinition deletedef = queryMgr.newDeleteDefinition(); deletedef.setCollections(collectionName); queryMgr.delete(deletedef); }
Source:
<code>public void testThereCanBeOnlyOne() throws IOException, InterruptedException { ExecutorService service = Executors.newFixedThreadPool(20); <START> Collection<Callable<Boolean>> list = Lists.newArrayList(); <END> final Set<Integer> testSet = Sets.newHashSet(); for (int i = 0; i < 40; i++) { list.add(new Callable<Boolean>() { @Override public Boolean call() throws Exception { CompressionCodec codec = Compression.Algorithm.GZ.getCodec(); Assert.assertNotNull(codec); testSet.add(System.identityHashCode(codec)); return true; } }); } service.invokeAll(list); Assert.assertEquals(1, testSet.size()); service.shutdown(); }</code><technical_language>This line, newHashSet breaks build (modernizer plugin). Prefer Java 7+ diamond operator</technical_language>

Target:
public void testThereCanBeOnlyOne() throws IOException, InterruptedException { ExecutorService service = Executors.newFixedThreadPool(20); ArrayList<Callable<Boolean>> list = Lists.newArrayList(); final HashSet<Integer> testSet = Sets.newHashSet(); for (int i = 0; i < 40; i++) { list.add(new Callable<Boolean>() { @Override public Boolean call() throws Exception { CompressionCodec codec = Compression.Algorithm.GZ.getCodec(); Assert.assertNotNull(codec); testSet.add(System.identityHashCode(codec)); return true; } }); } service.invokeAll(list); Assert.assertEquals(1, testSet.size()); service.shutdown(); }
Source:
<code>public GitSubscriberMergeContext(final GitResourceVariantTreeSubscriber subscriber, ISynchronizationScopeManager manager, GitSynchronizeDataSet gsds) { super(subscriber, manager); this.gsds = gsds; repoChangeListener = new RepositoryChangeListener() { public void repositoryChanged(RepositoryMapping which) { handleRepositoryChange(subscriber, which); } }; resourceChangeListener = new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { if (event.getDelta() == null) return; int mask = IResourceDelta.ADDED | IResourceDelta.CHANGED <START> | IResourceDelta.REMOVED | IResourceDelta.CONTENT; <END> IResourceDelta[] affectedChildren = event.getDelta() .getAffectedChildren(mask); RepositoryMapping repo = null; for (IResourceDelta delta : affectedChildren) { if (repo == null) repo = RepositoryMapping.getMapping(delta.getResource()); if (repo != null) handleResourceChange(subscriber, repo, delta.getResource()); } } }; GitProjectData.addRepositoryChangeListener(repoChangeListener); ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener); initialize(); }</code><technical_language>IResourceDelta.CONTENT is a kind constant, illustrated of ALL_WITH_PHANTOMS</technical_language>

Target:
public GitSubscriberMergeContext(final GitResourceVariantTreeSubscriber subscriber, ISynchronizationScopeManager manager, GitSynchronizeDataSet gsds) { super(subscriber, manager); this.gsds = gsds; repoChangeListener = new RepositoryChangeListener() { public void repositoryChanged(RepositoryMapping which) { handleRepositoryChange(subscriber, which); } }; resourceChangeListener = new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { if (event.getDelta() == null) return; int mask = IResourceDelta.ADDED | IResourceDelta.CHANGED | IResourceDelta.REMOVED; IResourceDelta[] affectedChildren = event.getDelta() .getAffectedChildren(mask); for (IResourceDelta delta : affectedChildren) { IResource resource = delta.getResource(); RepositoryMapping repo = RepositoryMapping.getMapping(resource); if (repo != null) handleResourceChange(subscriber, repo, resource); } } }; GitProjectData.addRepositoryChangeListener(repoChangeListener); ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener); initialize(); }
Source:
<code>public void writeTime( long nanosOfDayUTC, int offsetSeconds ) throws IOException { packStructHeader( 2, TIME ); <START> pack( TimeConstants.asValidLocalTime( nanosOfDayUTC ) ); <END> pack( offsetSeconds ); }</code><technical_language>I this change serialized format UTC local time, correct? Is want for BOLT format? I a feeling easier for clients if localtime offset</technical_language>

Target:
public void writeTime( long nanosOfDayUTC, int offsetSeconds ) throws IOException { packStructHeader( 2, TIME ); pack( TimeUtil.nanosOfDayToLocal( nanosOfDayUTC, offsetSeconds ) ); pack( offsetSeconds ); }
Source:
<code>private void issueIfLineMismatch(SyntaxToken curlyBrace, SyntaxToken target) { CodeLine curlyBraceLine = new CodeLine(curlyBrace.line()); if (curlyBraceLine.isJustBelow(target.line())) { addIssue(new PreciseIssue(this, new IssueLocation(curlyBrace, "Move this open curly brace to the end of the previous line."))); } <START> if (curlyBraceLine.isFarBelow(target.line())) { <END> addIssue(new PreciseIssue(this, new IssueLocation(curlyBrace, "Move this open curly brace to the end of line " + target.line() + "."))); } }</code><technical_language>@inverno "else" here? "else", reading implementation of methods isJust/FarBelow, cases covered, is, hit of 2 cases. advantage: of methods isJust/FarBelow removed</technical_language>

Target:
private void issueIfLineMismatch(SyntaxToken curlyBrace, SyntaxToken target) { CodeLine curlyBraceLine = new CodeLine(curlyBrace.line()); if (curlyBraceLine.isJustBelow(target.line())) { addIssue(new PreciseIssue(this, new IssueLocation(curlyBrace, "Move this open curly brace to the end of the previous line."))); } else if (curlyBraceLine.isFarBelow(target.line())) { addIssue(new PreciseIssue(this, new IssueLocation(curlyBrace, "Move this open curly brace to the end of line " + target.line() + "."))); } }
Source:
<code>public String getUrl(int requestId, CheckerInfo checkerInfo) { String pairId = checkerInfo.getCurrencyPairId(); if(checkerInfo.getCurrencyPairId() == null) { pairId = String.format("%1$s-%2$s", checkerInfo.getCurrencyCounterLowerCase(), checkerInfo.getCurrencyBaseLowerCase()); } <START> return String.format(URL, pairId); <END> }</code><technical_language>do return String.format(URL, checkerInfo.getCurrencyPairId())</technical_language>

Target:
public String getUrl(int requestId, CheckerInfo checkerInfo) { return String.format(URL, checkerInfo.getCurrencyPairId()); }
Source:
<code>public void onEventMainThread(@NonNull AccountDataLoadedEvent event) { <START> if (imageView != null) { <END> final Account account = event.getAccount(); if (account.getUsername().equalsIgnoreCase(profile.username)) { profileImage = account.getProfileImage(); loadProfileImage(account.getProfileImage(), imageView); } } }</code><technical_language>This null check applied loadProfileImage() call. profileImage variable assigned regardless, point of is store image for view is initialized</technical_language>

Target:
public void onEventMainThread(@NonNull AccountDataLoadedEvent event) { final Account account = event.getAccount(); if (account.getUsername().equalsIgnoreCase(profile.username)) { profileImage = account.getProfileImage(); if (imageView != null) { loadProfileImage(account.getProfileImage(), imageView); } } }
Source:
<code>public String post(String url, String postBody, Bundle headers, boolean isPatchRequest) throws ParseException, ClientProtocolException, IOException { HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpPost post = null; if (isPatchRequest) { post = new HttpPatch(url); } else { post = new HttpPost(url); } AndroidHttpClient.modifyRequestToAcceptGzipResponse(post); if (headers != null) { for (String key : headers.keySet()) { post.addHeader(key, headers.getString(key)); } } StringEntity se = new StringEntity(postBody); se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); post.setEntity(se); HttpResponse response = client.execute(post); int statusCode = response.getStatusLine().getStatusCode(); <START> if (statusCode != 200 ){ END> logger.debug("Response of HTTP " + statusCode); JSONObject json = new JSONObject(); try { json.put("error", String.valueOf(statusCode)); } catch (JSONException e) { logger.error(e); } client.getConnectionManager().shutdown(); return json.toString(); } InputStream inputStream = AndroidHttpClient .getUngzippedContent(response.getEntity()); String strRes = IOUtils.toString(inputStream); client.getConnectionManager().shutdown(); return strRes; }</code><technical_language>I a list HTTP status code constants</technical_language>

Target:
public String post(String url, String postBody, Bundle headers, boolean isPatchRequest) throws ParseException, ClientProtocolException, IOException { HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); HttpPost post = null; if (isPatchRequest) { post = new HttpPatch(url); } else { post = new HttpPost(url); } AndroidHttpClient.modifyRequestToAcceptGzipResponse(post); if (headers != null) { for (String key : headers.keySet()) { post.addHeader(key, headers.getString(key)); } } StringEntity se = new StringEntity(postBody); se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); post.setEntity(se); HttpResponse response = client.execute(post); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK ){ logger.debug("Response of HTTP " + statusCode); JSONObject json = new JSONObject(); try { json.put("error", String.valueOf(statusCode)); } catch (JSONException e) { logger.error(e); } client.getConnectionManager().shutdown(); return json.toString(); } InputStream inputStream = AndroidHttpClient .getUngzippedContent(response.getEntity()); String strRes = IOUtils.toString(inputStream); client.getConnectionManager().shutdown(); return strRes; }
Source:
<code>public DiscoveryClient(ApplicationInfoManager applicationInfoManager, EurekaClientConfig config, DiscoveryClientOptionalArgs args) { <START> this(applicationInfoManager, config, args, new Provider<BackupRegistry>() { <END> @Override public BackupRegistry get() { String backupRegistryClassName = clientConfig.getBackupRegistryImpl(); if (null != backupRegistryClassName) { try { return (BackupRegistry) Class.forName(backupRegistryClassName).newInstance(); } catch (InstantiationException e) { logger.error("Error instantiating BackupRegistry.", e); } catch (IllegalAccessException e) { logger.error("Error instantiating BackupRegistry.", e); } catch (ClassNotFoundException e) { logger.error("Error instantiating BackupRegistry.", e); } } logger.warn("Using default backup registry implementation which does not do anything."); return new NotImplementedRegistryImpl(); } }); }</code><technical_language>Is BackupRegistry supposed a singleton? If so, cache reference in get()</technical_language>

Target:
public DiscoveryClient(ApplicationInfoManager applicationInfoManager, EurekaClientConfig config, DiscoveryClientOptionalArgs args) { this(applicationInfoManager, config, args, new Provider<BackupRegistry>() { private volatile BackupRegistry backupRegistryInstance; @Override public synchronized BackupRegistry get() { if (backupRegistryInstance == null) { String backupRegistryClassName = clientConfig.getBackupRegistryImpl(); if (null != backupRegistryClassName) { try { backupRegistryInstance = (BackupRegistry) Class.forName(backupRegistryClassName).newInstance(); } catch (InstantiationException e) { logger.error("Error instantiating BackupRegistry.", e); } catch (IllegalAccessException e) { logger.error("Error instantiating BackupRegistry.", e); } catch (ClassNotFoundException e) { logger.error("Error instantiating BackupRegistry.", e); } } logger.warn("Using default backup registry implementation which does not do anything."); backupRegistryInstance = new NotImplementedRegistryImpl(); } return backupRegistryInstance; } }); }
Source:
<code>public void testOptionalConfigurationOptions() { String configStr = "config.amqp {" + " host = \"" + host + "\"\n" + " port = \"" + port + "\"\n" + " groupId = \"" + groupId + "\"\n" + " durable = " + durable + "\n" + " consumerThreadPoolSize = " + consumerThreadPoolSize + "\n" + "}"; Config amqpConfig = ConfigFactory.parseString(configStr).getConfig("config.amqp"); <START> ; <END> AmqpBrokerConfigBuilder brokerConfigBuilder = new AmqpBrokerConfigBuilder(amqpConfig); AmqpBrokerConfig brokerConfig = brokerConfigBuilder.build(); assertFalse(brokerConfig.getUsername().isPresent()); assertFalse(brokerConfig.getPassword().isPresent()); assertFalse(brokerConfig.getVirtualHost().isPresent()); }</code><technical_language>extra semicolon</technical_language>

Target:
public void testOptionalConfigurationOptions() { String configStr = "config.amqp {" + " host = \"" + host + "\"\n" + " port = \"" + port + "\"\n" + " groupId = \"" + groupId + "\"\n" + " durable = " + durable + "\n" + " consumerThreadPoolSize = " + consumerThreadPoolSize + "\n" + "}"; Config amqpConfig = ConfigFactory.parseString(configStr).getConfig("config.amqp"); AmqpBrokerConfigBuilder brokerConfigBuilder = new AmqpBrokerConfigBuilder(amqpConfig); AmqpBrokerConfig brokerConfig = brokerConfigBuilder.build(); assertFalse(brokerConfig.getUsername().isPresent()); assertFalse(brokerConfig.getPassword().isPresent()); assertFalse(brokerConfig.getVirtualHost().isPresent()); }
Source:
<code>public static void initializeSourceViewerColors(ISourceViewer viewer) { IPreferenceStore store = getPreferenceStore(); if <START> (store != null) { <END> StyledText styledText = viewer.getTextWidget(); Color color = store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT) ? null : getColor(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND); styledText.setForeground(color); color = store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) ? null : getColor(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND); styledText.setBackground(color); color = store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT) ? null : getColor(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND); styledText.setSelectionForeground(color); color = store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT) ? null : getColor(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND); styledText.setSelectionBackground(color); IFindReplaceTarget target = viewer.getFindReplaceTarget(); if (target instanceof IFindReplaceTargetExtension) ((IFindReplaceTargetExtension) target) .setScopeHighlightColor(getColor(AbstractTextEditor.PREFERENCE_COLOR_FIND_SCOPE)); } }</code><technical_language>lhs null != store</technical_language>

Target:
public static void initializeSourceViewerColors(ISourceViewer viewer) { IPreferenceStore store = getPreferenceStore(); if (null != store) { StyledText styledText = viewer.getTextWidget(); Color color = store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT) ? null : getColor(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND); styledText.setForeground(color); color = store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) ? null : getColor(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND); styledText.setBackground(color); color = store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT) ? null : getColor(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND); styledText.setSelectionForeground(color); color = store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT) ? null : getColor(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND); styledText.setSelectionBackground(color); IFindReplaceTarget target = viewer.getFindReplaceTarget(); if (target instanceof IFindReplaceTargetExtension) { ((IFindReplaceTargetExtension) target) .setScopeHighlightColor(getColor(AbstractTextEditor.PREFERENCE_COLOR_FIND_SCOPE)); } } }
Source:
<code>private JsonCreateReceiptsResponse toJsonCreateReceiptsResponse(@NonNull final List<InOutId> receiptIds, @NonNull final List<InOutId> returnIds) { final List<JsonMetasfreshId> jsonReceiptIds = receiptIds .stream() .map(InOutId::getRepoId) .map(JsonMetasfreshId::of) <START> .collect(Collectors.toList()); <END> final List<JsonMetasfreshId> jsonReturnIds = returnIds .stream() .map(InOutId::getRepoId) .map(JsonMetasfreshId::of) .collect(Collectors.toList()); return JsonCreateReceiptsResponse.builder() .createdReceiptIdList(jsonReceiptIds) .createdReturnIdList(jsonReturnIds) .build(); }</code><technical_language>a minor thing: i prefer ImmutableList immutable collections default, explicitly want mutable</technical_language>

Target:
private JsonCreateReceiptsResponse toJsonCreateReceiptsResponse(@NonNull final List<InOutId> receiptIds, @NonNull final List<InOutId> returnIds) { final List<JsonMetasfreshId> jsonReceiptIds = receiptIds .stream() .map(InOutId::getRepoId) .map(JsonMetasfreshId::of) .collect(ImmutableList.toImmutableList()); final List<JsonMetasfreshId> jsonReturnIds = returnIds .stream() .map(InOutId::getRepoId) .map(JsonMetasfreshId::of) .collect(ImmutableList.toImmutableList()); return JsonCreateReceiptsResponse.builder() .createdReceiptIdList(jsonReceiptIds) .createdReturnIdList(jsonReturnIds) .build(); }
Source:
<code>public void testDeserializeWithParams() throws Exception { String content = IOUtils.toString(resource("auditevents/auditEventWithParam.json")); final AuditEvent deserializedObject = json.readValue(content, AuditEvent.class); <START> assertThat(deserializedObject.getParams(), is(not(Collections.emptyMap()))); <END> }</code><technical_language>This check params null. I suggest Matchers.hasEntry()</technical_language>

Target:
public void testDeserializeWithParams() throws Exception { final AuditEvent deserializedObject = readObjectFromResource("/auditevents/auditEventWithParam.json", AuditEvent.class); assertThat(deserializedObject.getParams(), hasEntry("KEY", "VALUE")); }
Source:
<code>public void executeUpgrade() throws DotDataException, DotRuntimeException { dc = new DotConnect(); try { systemRootRoleId = getSystemRootRoleId(); <START> } catch (DotDataException e) { <END> Logger.info(this, "Task not executing seems the roles has not been upgraded yet"); return; } List<Map<String, String>> systemRoles = getSystemRoles(); if (!containsRole(AnyoneWhoCanReadRole, systemRoles)) { insertRole(AnyoneWhoCanReadRole, AnyoneWhoCanReadRoleId, RoleAPI.WORKFLOW_ANY_WHO_CAN_VIEW_ROLE_KEY); } if (!containsRole(AnyoneWhoCanEditRole, systemRoles)) { insertRole(AnyoneWhoCanEditRole, AnyoneWhoCanEditRoleId, RoleAPI.WORKFLOW_ANY_WHO_CAN_EDIT_ROLE_KEY); } if (!containsRole(AnyoneWhoCanPublishRole, systemRoles)) { insertRole(AnyoneWhoCanPublishRole, AnyoneWhoCanPublishRoleId, RoleAPI.WORKFLOW_ANY_WHO_CAN_PUBLISH_ROLE_KEY); } if (!containsRole(AnyoneWhoCanEditPermissionsRole, systemRoles)) { insertRole(AnyoneWhoCanEditPermissionsRole, AnyoneWhoCanEditPermissionsRoleId, RoleAPI.WORKFLOW_ANY_WHO_CAN_EDIT_PERMISSIONS_ROLE_KEY); } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') log rethrow this exception. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public void executeUpgrade() throws DotDataException { dc = new DotConnect(); try { systemRootRoleId = getSystemRootRoleId(); } catch (DotDataException e) { Logger.info(this, "Task not executing seems the roles has not been upgraded yet"); return; } final List<Map<String, String>> systemRoles = getSystemRoles(); if (!containsRole(AnyoneWhoCanReadRole, systemRoles)) { insertRole(AnyoneWhoCanReadRole, AnyoneWhoCanReadRoleId, RoleAPI.WORKFLOW_ANY_WHO_CAN_VIEW_ROLE_KEY); } if (!containsRole(AnyoneWhoCanEditRole, systemRoles)) { insertRole(AnyoneWhoCanEditRole, AnyoneWhoCanEditRoleId, RoleAPI.WORKFLOW_ANY_WHO_CAN_EDIT_ROLE_KEY); } if (!containsRole(AnyoneWhoCanPublishRole, systemRoles)) { insertRole(AnyoneWhoCanPublishRole, AnyoneWhoCanPublishRoleId, RoleAPI.WORKFLOW_ANY_WHO_CAN_PUBLISH_ROLE_KEY); } if (!containsRole(AnyoneWhoCanEditPermissionsRole, systemRoles)) { insertRole(AnyoneWhoCanEditPermissionsRole, AnyoneWhoCanEditPermissionsRoleId, RoleAPI.WORKFLOW_ANY_WHO_CAN_EDIT_PERMISSIONS_ROLE_KEY); } }
Source:
<code><START> private Long <END> parseSafeLong(Map<String, Object> innerMap, String key) { return innerMap.containsKey(key) && StringUtils.isNumeric(key) ? Long.parseLong(innerMap.get(key).toString()) : null; }</code><technical_language>I remember this method in of Anmol's patch well. move this some common location, useful for others well</technical_language>

Target:
private Long parseSafeLong(Map<String, Object> innerMap, String key) { return innerMap.containsKey(key) && StringUtils.isNumeric(innerMap.get(key).toString()) ? Long.parseLong(innerMap.get(key).toString()) : null; }