auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void deleteTempPacksIdx() { Path packDir = repo.getObjectDatabase().getPackDirectory().toPath(); try { Files.newDirectoryStream(packDir, "gc_*_tmp") .forEach(t -> { try { <START> long lastModified = Files.getLastModifiedTime(t) .toMillis(); long threshold = lastModified + 24 * 60 * 60 * 1000; if (threshold <= Instant.now().toEpochMilli()) { Files.deleteIfExists(t); } <END> } catch (IOException e) { LOG.error(e.getMessage(), e); } }); } catch (IOException e) { LOG.error(e.getMessage(), e); } }</code><technical_language>I calculate a threshold loop now-(24*60*60*1000). in this loop files lastmodified<threshold deleted. in prune() method delete loose unreferenced objects if enough. calculate a threshold in advance threshold for delete decisions</technical_language>

Target:
private void deleteTempPacksIdx() { Path packDir = repo.getObjectDatabase().getPackDirectory().toPath(); long threshold = Instant.now().toEpochMilli() - 24 * 60 * 60 * 1000; try { Files.newDirectoryStream(packDir, "gc_*_tmp") .forEach(t -> { try { long lastModified = Files.getLastModifiedTime(t) .toMillis(); if (lastModified < threshold) { Files.deleteIfExists(t); } } catch (IOException e) { LOG.error(e.getMessage(), e); } }); } catch (IOException e) { LOG.error(e.getMessage(), e); } }
Source:
<code>public static InputFile inputFile(String moduleKey, File file) { try { return new TestInputFileBuilder(moduleKey, file.getPath()) .setContents(new String(Files.readAllBytes(file.toPath()), UTF_8)) .setCharset(UTF_8) .setLanguage("java") .build(); } catch (Exception e) { <START> throw new IllegalStateException(String.format("Unable to lead file '%s", file.getAbsolutePath())); <END> } }</code><technical_language>typo "lead" -> "read"</technical_language>

Target:
public static InputFile inputFile(String moduleKey, File file) { try { return new TestInputFileBuilder(moduleKey, file.getPath()) .setContents(new String(Files.readAllBytes(file.toPath()), UTF_8)) .setCharset(UTF_8) .setLanguage("java") .build(); } catch (Exception e) { throw new IllegalStateException(String.format("Unable to read file '%s", file.getAbsolutePath())); } }
Source:
<code>private void setupContextListener() { <START> IDebugContextManager contextManager = DebugContextManager.getDefault(); <END> IDebugContextService contextService = contextManager .getContextService(getSite().getWorkbenchWindow()); fDebugContextListener = new IDebugContextListener() { @Override public void debugContextChanged(DebugContextEvent event) { if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) { ISelection s = event.getContext(); setDebugContext(s); } } }; contextService.addDebugContextListener(fDebugContextListener); setDebugContext(contextService.getActiveContext()); }</code><technical_language>Replace IDebugContextManager contextManager = DebugUITools.getDebugContextManager();</technical_language>

Target:
private void setupContextListener() { IDebugContextManager contextManager = DebugUITools.getDebugContextManager(); IDebugContextService contextService = contextManager .getContextService(getSite().getWorkbenchWindow()); fDebugContextListener = new IDebugContextListener() { @Override public void debugContextChanged(DebugContextEvent event) { if ((event.getFlags() & DebugContextEvent.ACTIVATED) != 0) { ISelection s = event.getContext(); setDebugContext(s); } } }; contextService.addDebugContextListener(fDebugContextListener); setDebugContext(contextService.getActiveContext()); }
Source:
<code>public void deleteNoAccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .build(); context.restoreAuthSystemState(); getClient(null).perform(delete("/api/core/bitstreamformats/" + bitstreamFormat.getID())) <START> .andExpect(status().isUnauthorized()); <END> }</code><technical_language>check bitstreamformat is</technical_language>

Target:
public void deleteNoAccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .build(); context.restoreAuthSystemState(); getClient(null).perform(delete("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isUnauthorized()); getClient().perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", Matchers.is( BitstreamFormatMatcher .matchBitstreamFormat(bitstreamFormat.getID(), bitstreamFormat.getMIMEType(), bitstreamFormat.getDescription(), bitstreamFormat.getShortDescription()) ))); }
Source:
<code>public void deleteRealmIfMigrationNeeded_failsWhenAssetFileProvided() { Context context = InstrumentationRegistry.getInstrumentation().getContext(); <START> Realm.deleteRealm(new RealmConfiguration.Builder(context).build()); <END> RealmConfiguration.Builder builder = new RealmConfiguration.Builder(context); try { builder .assetFile(context, "asset_file.realm") .deleteRealmIfMigrationNeeded(); fail(); } catch (IllegalStateException expected) { assertEquals("Realm cannot clear its schema when previously configured to use an asset file.", expected.getMessage()); } }</code><technical_language>This needed testing builder</technical_language>

Target:
public void deleteRealmIfMigrationNeeded_failsWhenAssetFileProvided() { Context context = InstrumentationRegistry.getInstrumentation().getContext(); RealmConfiguration.Builder builder = new RealmConfiguration.Builder(context); try { builder .assetFile(context, "asset_file.realm") .deleteRealmIfMigrationNeeded(); fail(); } catch (IllegalStateException expected) { assertEquals("Realm cannot clear its schema when previously configured to use an asset file by calling assetFile().", expected.getMessage()); } }
Source:
<code>public void setAuthorizationHelper(IXalanAuthorizationHelper authorizationHelper) { <START> logger.warn("BEACH Test: in setAuthorizationHelper and the upAuth helper is: " + authorizationHelper.getClass()); <END> XalanAuthorizationHelper.authorizationHelper = authorizationHelper; }</code><technical_language>warning: Left test log</technical_language>

Target:
public void setAuthorizationHelper(IXalanAuthorizationHelper authorizationHelper) { XalanAuthorizationHelper.authorizationHelper = authorizationHelper; }
Source:
<code>public TreeDataIndex(double[][] features, double[] labels) { this.features = features; this.labels = labels; int rows = features.length; int cols = features.length == 0 ? 0 : features[0].length; double[][] featuresCopy = new double[rows][cols]; <START> index = new int[rows][cols]; <END> for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { index[row][col] = row; featuresCopy[row][col] = features[row][col]; } } for (int col = 0; col < cols; col++) sortIndex(featuresCopy, col, 0, rows - 1); }</code><technical_language>I sense Arrays.copyOf for featuresCopy Arrays.fill for index. do think? do need copy of features here</technical_language>

Target:
public TreeDataIndex(double[][] features, double[] labels) { this.features = features; this.labels = labels; int rows = features.length; int cols = features.length == 0 ? 0 : features[0].length; double[][] featuresCp = new double[rows][cols]; index = new int[rows][cols]; for (int row = 0; row < rows; row++) { Arrays.fill(index[row], row); featuresCp[row] = Arrays.copyOf(features[row], cols); } for (int col = 0; col < cols; col++) sortIndex(featuresCp, col, 0, rows - 1); }
Source:
<code>public ResolvedExpression parseSqlExpression(String sqlExpression, TableSchema inputSchema) { <START> throw new UnsupportedOperationException("Computed column is only supported by Blink planner."); <END> }</code><technical_language>suggestion throw new UnsupportedOperationException("Computed columns is supported Blink planner.");</technical_language>

Target:
public ResolvedExpression parseSqlExpression(String sqlExpression, TableSchema inputSchema) { throw new UnsupportedOperationException("Computed columns is only supported by the Blink planner."); }
Source:
<code>protected void setStorageService(StorageService storageService) { this.storageService = storageService; setDisabledRuleStorage( <START> storageService.<Boolean>getStorage("automation_rules_disabled", this.getClass().getClassLoader())); <END> }</code><technical_language>a constant out of this string</technical_language>

Target:
protected void setStorageService(StorageService storageService) { this.storageService = storageService; setDisabledRuleStorage( storageService.<Boolean>getStorage(DISABLED_RULE_STORAGE, this.getClass().getClassLoader())); }
Source:
<code>public static List<FilterEntry> parse(String filters) { List<FilterEntry> ret = new LinkedList<>(); Matcher m = parsePattern.matcher(filters); while (m.find()) { log.debug(String.format("parse: handling '%s'", m.group(0))); boolean exclude = "exclude".equals(m.group("exclude")); String event = m.group("event"); String recipient = m.group("recipient"); <START> ret.add(FilterEntry.createEntryFromRecipient(event, exclude, recipient)); <END> } return ret; }</code><technical_language>removed '*' parsing, belongs here... part of parsing, part of format, do java implementation. please put back</technical_language>

Target:
public static List<FilterEntry> parse(String filters) { List<FilterEntry> ret = new LinkedList<>(); Matcher m = PARSE_PATTERN.matcher(filters); while (m.find()) { log.debug(String.format("parse: handling '%s'", m.group(0))); boolean exclude = "exclude".equals(m.group("exclude")); String event = m.group("event"); String recipient = m.group("recipient"); ret.add(FilterEntry.createEntry(event, exclude, recipient)); } return ret; }
Source:
<code>public static CardType[] mergeTypes(CardType[] a, CardType[] b) { HashSet<CardType> cardTypes = new HashSet<>(); for (CardType t: a) { cardTypes.add(t); } for (CardType t: b) { cardTypes.add(t); } <START> return cardTypes.toArray(new CardType[0]); <END> }</code><technical_language>EnumSet here, addAll()</technical_language>

Target:
public static CardType[] mergeTypes(CardType[] a, CardType[] b) { EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class); cardTypes.addAll(Arrays.asList(a)); cardTypes.addAll(Arrays.asList(b)); return cardTypes.toArray(new CardType[0]); }
Source:
<code>public void testRecursiveReadSubModeWithResolveExpression() throws Exception { try { ModelNode operation = createOperation(READ_RESOURCE_OPERATION, "profile", "profileA"); <START> System.setProperty("${expr}", "test-resolve-true"); <END> operation.get(RECURSIVE).set(true); operation.get(RESOLVE_EXPRESSIONS).set(true); ModelNode result = executeForResult(operation); result.get("subsystem", "subsystem2", "expression").set(System.getProperty("${expr}")); assertTrue(result.toString(), result.hasDefined("subsystem", "subsystem2")); checkRecursiveSubsystem2(result.get("subsystem", "subsystem2"), "test-resolve-true"); } finally { System.clearProperty("${expr}"); } }</code><technical_language>correct: name of system property expr, ${expr}</technical_language>

Target:
public void testRecursiveReadSubModeWithResolveExpression() throws Exception { try { ModelNode operation = createOperation(READ_RESOURCE_OPERATION, "profile", "profileA"); System.setProperty("expr", "test-resolve-true"); operation.get(RECURSIVE).set(true); operation.get(RESOLVE_EXPRESSIONS).set(true); ModelNode result = executeForResult(operation); assertTrue(result.toString(), result.hasDefined("subsystem", "subsystem2")); checkRecursiveSubsystem2(result.get("subsystem", "subsystem2"), "test-resolve-true"); } finally { System.clearProperty("expr"); } }
Source:
<code>public StructEncoder int32(String name, int value) { <START> int fieldIndex = fieldSearcher.findFieldIndex(name, Int32Field.class, null); <END> data.add(new Int32DataHolder(value, fieldIndex)); return this; }</code><technical_language>factor out duplicate code please</technical_language>

Target:
public StructEncoder int32(String name, int value) { Int32Field field = fieldSearcher.findField(name, Int32Field.class, null); data.add(new Int32DataHolder(value, field.index())); return this; }
Source:
<code>private ListenableFuture<?> stashOrSubmitTask(RunnableWithES runnable, final boolean callExecute, final boolean setupTask) { if (m_executor==null) { synchronized (m_executorLock) { if (m_executor==null) { if (m_queuedActions.size() > 50) { StringBuilder builder = new StringBuilder(); <START> builder.append("Export task queue is filled up to: " + m_queuedActions.size() + ", beyond 50. Not queueing anymore events for generation " <END> + m_generation + ". The queue contains the following tasks:\n"); for (RunnableWithES queuedR : m_queuedActions) { builder.append(queuedR.getTaskName() + "\t"); } exportLog.error(builder.toString()); return Futures.immediateFuture(null); } if (setupTask) { m_firstAction = runnable; } else { m_queuedActions.add(runnable); } return Futures.immediateFuture(null); } } } runnable.setExecutorService(m_executor); if (m_executor.isShutdown()) { return Futures.immediateFuture(null); } if (callExecute) { m_executor.execute(runnable); return Futures.immediateFuture(null); } else { return m_executor.submit(runnable); } }</code><technical_language>print generation table talking connector</technical_language>

Target:
private ListenableFuture<?> stashOrSubmitTask(RunnableWithES runnable, final boolean callExecute, final boolean setupTask) { if (m_executor==null) { synchronized (m_executorLock) { if (m_executor==null) { if (m_queuedActions.size() > 50) { StringBuilder builder = new StringBuilder(); builder.append("Export task queue is filled up to: " + m_queuedActions.size()); builder.append(". Not queueing anymore events beyond 50 for generation " + m_generation); builder.append(" and table " + m_tableName + ". The queue contains the following tasks:\n"); for (RunnableWithES queuedR : m_queuedActions) { builder.append(queuedR.getTaskName() + "\t"); } exportLog.error(builder.toString()); return Futures.immediateFuture(null); } if (setupTask) { m_firstAction = runnable; } else { m_queuedActions.add(runnable); } return Futures.immediateFuture(null); } } } runnable.setExecutorService(m_executor); if (m_executor.isShutdown()) { return Futures.immediateFuture(null); } if (callExecute) { m_executor.execute(runnable); return Futures.immediateFuture(null); } else { return m_executor.submit(runnable); } }
Source:
<code>public boolean isMatch(String relativeTarget, boolean isDirectory) { <START> String target = relativeTarget; <END> if (!target.startsWith("/")) target = "/" + target; if (matcher == null) { if (target.equals(pattern)) { if (dirOnly && !isDirectory) return false; else return true; } if (target.startsWith(pattern + "/")) return true; if (nameOnly) { int segmentStart = 0; int segmentEnd = target.indexOf('/'); while (true) { if (segmentEnd > segmentStart && target.regionMatches(segmentStart, pattern, 0, segmentEnd - segmentStart) && doesMatchDirectoryExpectations(isDirectory, false)) return true; else if (segmentEnd == -1 && target.regionMatches(segmentStart, pattern, 0, target.length() - segmentStart) && doesMatchDirectoryExpectations(isDirectory, true)) return true; if (segmentEnd == -1 || segmentStart >= target.length()) break; segmentStart = segmentEnd + 1; segmentEnd = target.indexOf('/', segmentStart); } } } else { return matcher.matches(target, isDirectory); } return false; }</code><technical_language>simplification of code of this method (similar FastIgnoreRule) is coming in another patch</technical_language>

Target:
public boolean isMatch(String relativeTarget, boolean isDirectory) { if (relativeTarget == null) return false; if (relativeTarget.length() == 0) return false; boolean match = matcher.matches(relativeTarget, isDirectory); return match; }
Source:
<code>protected void updateData(long start, long end, int nb, @Nullable IProgressMonitor monitor) { double x[] = getXAxis(start, end, nb); setXAxis(x); final double y[] = new double[nb]; final long yLong[] = new long[nb]; Arrays.fill(y, 0.0); for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { final TmfStatisticsModule statsMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } statsMod.waitForInitialization(); <START> final ITmfStatistics stats = statsMod.getStatistics(); Objects.requireNonNull(stats); <END> List<Long> values = stats.histogramQuery(start, end, nb); for (int i = 0; i < nb; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < nb; i++) { y[i] += yLong[i]; } setSeries("Number of events", y); updateDisplay(); }</code><technical_language>line, final: ITmfStatistics stats = Objects.requireNonNull(statsMod.getStatistics())</technical_language>

Target:
protected void updateData(long start, long end, int nb, @Nullable IProgressMonitor monitor) { double x[] = getXAxis(start, end, nb); setXAxis(x); final double y[] = new double[nb]; final long yLong[] = new long[nb]; Arrays.fill(y, 0.0); for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { final TmfStatisticsModule statsMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } statsMod.waitForInitialization(); final ITmfStatistics stats = Objects.requireNonNull(statsMod.getStatistics()); List<Long> values = stats.histogramQuery(start, end, nb); for (int i = 0; i < nb; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < nb; i++) { y[i] += yLong[i]; } setSeries("Number of events", y); updateDisplay(); }
Source:
<code>private String JSON(Music music) { return new StringBuilder("{\"id\":").append(music.getId()) .append(",\"title\":\"").append(music.getTitle()) .append("\",\"description\":\"").append(music.getDescription()) .append("\",\"type\":\"").append(music.getType().toString()) <START> .append("\"}").toString(); <END> }</code><technical_language>kinda hard read... maybe: java String.format("{\"id\": %s, "title": \"%s\"%....)</technical_language>

Target:
private String JSON(Music music) { return String.format("{\"id\":%s,\"title\":\"%s\",\"description\":\"%s\",\"type\":\"%s\"}", music.getId(), music.getTitle(), music.getDescription(), music.getType().toString()); }
Source:
<code>public LookupExtractor get() { <START> return new MapLookupExtractor(map, isOneToOne); <END> }</code><technical_language>avoid returning a new instance time</technical_language>

Target:
public LookupExtractor get() { return lookupExtractor; }
Source:
<code>public static FilterExpression replaceMilestoneAliases(IModel model, FilterExpression expr) { List<String> repoIds = getMetaQualifierContent(expr, QualifierType.REPO).stream() .map(String::toLowerCase) .collect(Collectors.toList()); if (repoIds.isEmpty()) { repoIds.add(model.getDefaultRepo().toLowerCase()); } List<TurboMilestone> allMilestones = model.getMilestones().stream() .filter(ms -> ms.getDueDate().isPresent()) .filter(ms -> repoIds.contains(ms.getRepoId().toLowerCase())) .sorted((a, b) -> getMilestoneDueDateComparator().compare(a, b)) .collect(Collectors.toList()); <START> model.getMilestones().stream().filter(ms ->ms.isOpen()).count(); <END> Optional<Integer> currentMilestoneIndex = getCurrentMilestoneIndex(allMilestones); if (!currentMilestoneIndex.isPresent()) { return expr; } return expr.map(q -> { if (Qualifier.isMilestoneQualifier(q)) { return q.convertMilestoneAliasQualifier(allMilestones, currentMilestoneIndex.get()); } else { return q; } }); }</code><technical_language>Leftover else</technical_language>

Target:
public static FilterExpression replaceMilestoneAliases(IModel model, FilterExpression expr) { List<String> repoIds = getMetaQualifierContent(expr, QualifierType.REPO).stream() .map(String::toLowerCase) .collect(Collectors.toList()); if (repoIds.isEmpty()) { repoIds.add(model.getDefaultRepo().toLowerCase()); } List<TurboMilestone> milestonesOfReposInPanel = TurboMilestone.filterMilestonesOfRepos( model.getMilestones(), repoIds); List<TurboMilestone> aliasableMilestones = getAliasableMilestones(milestonesOfReposInPanel); Map<Integer, TurboMilestone> milestoneAliasIndex = getMilestoneAliasIndex(aliasableMilestones); if (milestoneAliasIndex.isEmpty()) { return expr; } return expr.map(q -> { if (Qualifier.isMilestoneQualifier(q)) { return q.convertMilestoneAliasQualifier(milestoneAliasIndex); } else { return q; } }); }
Source:
<code>public void test() { WebDriver driver = connect(); JQuery menu = jq(".z-menu"); Point menuLocation = toElement(menu).getLocation(); click(menu); waitResponse(); Assert.assertTrue(menuLocation.getY() < getMenupopupLocation().getY()); click(jq(".z-button")); waitResponse(); click(menu); waitResponse(); Assert.assertTrue(menuLocation.getX() < getMenupopupLocation().getX()); click(jq("body")); waitResponse(); WebDriver.Window window = driver.manage().window(); <START> window.setSize(new Dimension(500, window.getSize().getHeight())); <END> waitResponse(); click(menu); waitResponse(); Assert.assertTrue(menuLocation.getX() > getMenupopupLocation().getX()); }</code><technical_language>is 500 fit for themes</technical_language>

Target:
public void test() { WebDriver driver = connect(); JQuery menu = jq(".z-menu"); Point menuLocation = toElement(menu).getLocation(); click(menu); waitResponse(); Assert.assertTrue(menuLocation.getY() < getMenupopupLocation().getY()); click(jq(".z-button")); waitResponse(); click(menu); waitResponse(); Assert.assertTrue(menuLocation.getX() < getMenupopupLocation().getX()); click(jq("body")); waitResponse(); WebDriver.Window window = driver.manage().window(); window.setSize(new Dimension(400, window.getSize().getHeight())); waitResponse(); click(menu); waitResponse(); Assert.assertTrue(menuLocation.getX() > getMenupopupLocation().getX()); }
Source:
<code>private static Server getServerFromMap(Map<String, String[]> parameters) { boolean jenkinsAltUrl = parameters.get("jenkinsAltUrl") != null && "on".equals(parameters.get("jenkinsAltUrl")[0]) ? true : false; boolean jenkinsCSRF = false; try { jenkinsCSRF = parameters.get("jenkinsCSRF") != null && "on".equals(parameters.get("jenkinsCSRF")[0]) ? true : false; <START> } catch (Exception e) { <END> } return new Server(parameters.get("jenkinsUrl")[0], parameters.get("jenkinsUser")[0], parameters.get("jenkinsToken")[0], jenkinsAltUrl, jenkinsCSRF ); }</code><technical_language>Empty catch (Exception e) blocks scare me. sort of exception do expect occur? If possible, I error caught more explicit add some logging happened</technical_language>

Target:
private static Server getServerFromMap(Map<String, String[]> parameters) { boolean jenkinsAltUrl = parameters.get("jenkinsAltUrl") != null && "on".equals(parameters.get("jenkinsAltUrl")[0]) ? true : false; boolean jenkinsCSRF = parameters.get("jenkinsCSRF") != null && "on".equals(parameters.get("jenkinsCSRF")[0]) ? true : false; return new Server(parameters.get("jenkinsUrl")[0], parameters.get("jenkinsUser")[0], parameters.get("jenkinsToken")[0], jenkinsAltUrl, jenkinsCSRF ); }
Source:
<code>protected void whenFailToAuthenticateThrowExceptionOrRedirectToUrl(final Map<String, Object[]> params, final String responseType, final HttpServletResponse resp, Issuer issuer, UserAccount userAccount) throws IOException { if (userAccount == null || userAccount.getExternalEntity() == null || !_samlAuthManager.isUserAuthorized(userAccount.getId(), issuer.getValue())) { <START> String saml2FailedLoginRedirectUrl = (String)getConfigKeys()[0].value(); <END> if (StringUtils.isBlank(saml2FailedLoginRedirectUrl)) { throw new ServerApiException(ApiErrorCode.ACCOUNT_ERROR, _apiServer.getSerializedApiError(ApiErrorCode.ACCOUNT_ERROR.getHttpCode(), "Your authenticated user is not authorized for SAML Single Sign-On, please contact your administrator", params, responseType)); } else { resp.sendRedirect(saml2FailedLoginRedirectUrl); } } }</code><technical_language>Saml2FailedLoginRedirectUrl.value() instead of getConfigKeys()[0].value()</technical_language>

Target:
protected void whenFailToAuthenticateThrowExceptionOrRedirectToUrl(final Map<String, Object[]> params, final String responseType, final HttpServletResponse resp, Issuer issuer, UserAccount userAccount) throws IOException { if (userAccount == null || userAccount.getExternalEntity() == null || !samlAuthManager.isUserAuthorized(userAccount.getId(), issuer.getValue())) { String saml2RedirectUrl = saml2FailedLoginRedirectUrl.value(); if (StringUtils.isBlank(saml2RedirectUrl)) { throw new ServerApiException(ApiErrorCode.ACCOUNT_ERROR, apiServer.getSerializedApiError(ApiErrorCode.ACCOUNT_ERROR.getHttpCode(), "Your authenticated user is not authorized for SAML Single Sign-On, please contact your administrator", params, responseType)); } else { resp.sendRedirect(saml2RedirectUrl); } } }
Source:
<code>private void updateExistingVm(UserPortalListModel userPortalListModel, final boolean applyCpuChangesLater) { final UnitVmModel model = (UnitVmModel) getWindow(); UserPortalItemModel selectedItem = (UserPortalItemModel) userPortalListModel.getSelectedItem(); Guid oldClusterID = ((VM) selectedItem.getEntity()).getVdsGroupId(); Guid newClusterID = model.getSelectedCluster().getId(); if (oldClusterID.equals(newClusterID) == false) { Frontend.getInstance().runAction(VdcActionType.ChangeVMCluster, new ChangeVMClusterParameters(newClusterID, gettempVm().getId()), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { VdcReturnValueBase returnValueBase = result.getReturnValue(); final UserPortalListModel userPortalListModel = (UserPortalListModel) result.getState(); if (returnValueBase != null && returnValueBase.getSucceeded()) { VmManagementParametersBase param = getUpdateVmParameters(applyCpuChangesLater); Frontend.getInstance() .runAction(VdcActionType.UpdateVm, param, new UnitVmModelNetworkAsyncCallback(model, defaultNetworkCreatingManager, gettempVm().getId()), this); } else { <START> userPortalListModel.getWindow().stopProgress(); <END> } } }, this); } else { VmManagementParametersBase param = getUpdateVmParameters(applyCpuChangesLater); Frontend.getInstance().runAction(VdcActionType.UpdateVm, param, new UnitVmModelNetworkAsyncCallback(model, defaultNetworkCreatingManager, gettempVm().getId()), this); } }</code><technical_language>'userPortalListModel' is needed, call 'getWindow()' directly</technical_language>

Target:
private void updateExistingVm(UserPortalListModel userPortalListModel, final boolean applyCpuChangesLater) { final UnitVmModel model = (UnitVmModel) getWindow(); UserPortalItemModel selectedItem = (UserPortalItemModel) userPortalListModel.getSelectedItem(); Guid oldClusterID = ((VM) selectedItem.getEntity()).getVdsGroupId(); Guid newClusterID = model.getSelectedCluster().getId(); if (oldClusterID.equals(newClusterID) == false) { Frontend.getInstance().runAction(VdcActionType.ChangeVMCluster, new ChangeVMClusterParameters(newClusterID, gettempVm().getId()), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { VdcReturnValueBase returnValueBase = result.getReturnValue(); if (returnValueBase != null && returnValueBase.getSucceeded()) { VmManagementParametersBase param = getUpdateVmParameters(applyCpuChangesLater); Frontend.getInstance() .runAction(VdcActionType.UpdateVm, param, new UnitVmModelNetworkAsyncCallback(model, defaultNetworkCreatingManager, gettempVm().getId()), this); } else { getWindow().stopProgress(); } } }, this); } else { VmManagementParametersBase param = getUpdateVmParameters(applyCpuChangesLater); Frontend.getInstance().runAction(VdcActionType.UpdateVm, param, new UnitVmModelNetworkAsyncCallback(model, defaultNetworkCreatingManager, gettempVm().getId()), this); } }
Source:
<code>protected ArrayList<Theme> doInBackground(JSONObject... args) { if (args[0] == null) { return null; } final JSONArray array = args[0].optJSONArray("themes"); if (array == null) { return null; } final ArrayList<Theme> themes = new ArrayList<>(); <START> final int count = array.length(); <END> for (int i = 0; i < count; i++) { try { JSONObject object = array.getJSONObject(i); Theme theme = Theme.fromJSONV1_2(object, mSite.getSiteId()); if (theme != null) { WordPress.wpDB.saveTheme(theme); themes.add(theme); } } catch (JSONException e) { AppLog.e(T.THEMES, e); } } fetchCurrentTheme(); return themes.size() > 0 ? themes : null; }</code><technical_language>array's length is altered, I need introduce this variable. I wrong this, I this, assume array is altered. a personal preference though</technical_language>

Target:
protected ArrayList<Theme> doInBackground(JSONObject... args) { if (args[0] == null) { return null; } final JSONArray array = args[0].optJSONArray("themes"); if (array == null) { return null; } final ArrayList<Theme> themes = new ArrayList<>(); for (int i = 0; i < array.length(); i++) { try { JSONObject object = array.getJSONObject(i); Theme theme = Theme.fromJSONV1_2(object, mSite); if (theme != null) { ThemeTable.saveTheme(WordPress.wpDB.getDatabase(), theme); themes.add(theme); } } catch (JSONException e) { AppLog.e(T.THEMES, e); } } fetchCurrentTheme(); return themes.size() > 0 ? themes : null; }
Source:
<code>public static void main(String[] args) throws Exception { ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerCommandLine(); OptionSet options = cmdLine.parser().parse(args); Config config = cmdLine.loadConfig(options); ApplicationRunnerOperation op = cmdLine.getOperation(options); if (config.containsKey(STREAM_APPLICATION_CLASS_CONFIG)) { ApplicationRunner runner = ApplicationRunner.fromConfig(config); StreamApplication app = (StreamApplication) Class.forName(config.get(STREAM_APPLICATION_CLASS_CONFIG)).newInstance(); switch (op) { case RUN: runner.run(app); break; case KILL: runner.kill(app); break; case STATUS: <START> System.out.println(runner.status(app)); <END> break; default: throw new IllegalArgumentException("Unrecognized operation: " + op); } } else { JobRunner$.MODULE$.main(args); } }</code><technical_language>this output? RM user console</technical_language>

Target:
public static void main(String[] args) throws Exception { ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerCommandLine(); OptionSet options = cmdLine.parser().parse(args); Config orgConfig = cmdLine.loadConfig(options); Config config = Util.rewriteConfig(orgConfig); ApplicationRunnerOperation op = cmdLine.getOperation(options); if (config.containsKey(STREAM_APPLICATION_CLASS_CONFIG)) { ApplicationRunner runner = ApplicationRunner.fromConfig(config); StreamApplication app = (StreamApplication) Class.forName(config.get(STREAM_APPLICATION_CLASS_CONFIG)).newInstance(); switch (op) { case RUN: runner.run(app); break; case KILL: runner.kill(app); break; case STATUS: System.out.println(runner.status(app)); break; default: throw new IllegalArgumentException("Unrecognized operation: " + op); } } else { JobRunner$.MODULE$.main(args); } }
Source:
<code>public void test000_openrepo_default_absolute_workdirconfig() throws IOException { File repo1Parent = new File(trash.getParentFile(), "r1"); File workdir = new File(trash.getParentFile(), "rw"); <START> assertTrue(workdir.mkdir()); <END> FileRepository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT)); repo1initial.create(); final FileBasedConfig cfg = repo1initial.getConfig(); cfg.setString("core", null, "worktree", workdir.getAbsolutePath()); cfg.save(); repo1initial.close(); File theDir = new File(repo1Parent, Constants.DOT_GIT); FileRepository r = new FileRepositoryBuilder().setGitDir(theDir) .build(); assertEqualsPath(theDir, r.getDirectory()); assertEqualsPath(workdir, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); assertEqualsPath(new File(theDir, "objects"), r.getObjectDatabase() .getDirectory()); }</code><technical_language>FileUtils.mkdirs</technical_language>

Target:
public void test000_openrepo_default_absolute_workdirconfig() throws IOException { File repo1Parent = new File(trash.getParentFile(), "r1"); File workdir = new File(trash.getParentFile(), "rw"); FileUtils.mkdir(workdir); FileRepository repo1initial = new FileRepository(new File(repo1Parent, Constants.DOT_GIT)); repo1initial.create(); final FileBasedConfig cfg = repo1initial.getConfig(); cfg.setString("core", null, "worktree", workdir.getAbsolutePath()); cfg.save(); repo1initial.close(); File theDir = new File(repo1Parent, Constants.DOT_GIT); FileRepository r = new FileRepositoryBuilder().setGitDir(theDir) .build(); assertEqualsPath(theDir, r.getDirectory()); assertEqualsPath(workdir, r.getWorkTree()); assertEqualsPath(new File(theDir, "index"), r.getIndexFile()); assertEqualsPath(new File(theDir, "objects"), r.getObjectDatabase() .getDirectory()); }
Source:
<code>public void validate(Element element, ElementValidation validation) { super.validate(element, validation); <START> validatorHelper.param.inOrder() END> .type(CanonicalNameConstants.VIEW_PAGER).optional() .primitiveOrWrapper(TypeKind.INT).optional() .validate((ExecutableElement) element, validation); }</code><technical_language>anyOrder()</technical_language>

Target:
public void validate(Element element, ElementValidation validation) { super.validate(element, validation); validatorHelper.param.anyOrder() .type(CanonicalNameConstants.VIEW_PAGER).optional() .primitiveOrWrapper(TypeKind.INT).optional() .validate((ExecutableElement) element, validation); }
Source:
<code>public static void init(Vector<String> pathsToClusterFiles, Vector<Integer> thresholds, Vector<Boolean> isLowercaseBrownClusters) { brownclusters = new BrownClusters(); brownclusters.isLowercaseBrownClustersByResource = new boolean[isLowercaseBrownClusters.size()]; brownclusters.wordToPathByResource = new ArrayList<>(); brownclusters.resources = new ArrayList<>(); for (int i = 0; i < pathsToClusterFiles.size(); i++) { THashMap<String, String> h = new THashMap<>(); InFile in = new InFile(ResourceUtilities.loadResource(pathsToClusterFiles.elementAt(i))); String line = in.readLine(); int wordsAdded = 0; while (line != null) { StringTokenizer st = new StringTokenizer(line); String path = st.nextToken(); String word = st.nextToken(); int occ = Integer.parseInt(st.nextToken()); if (occ >= thresholds.elementAt(i)) { h.put(word, path); wordsAdded++; } line = in.readLine(); } if (ParametersForLbjCode.currentParameters.debug) { logger.info(wordsAdded + " words added"); } brownclusters.wordToPathByResource.add(h); brownclusters.isLowercaseBrownClustersByResource[i] = isLowercaseBrownClusters.elementAt(i); brownclusters.resources.add(pathsToClusterFiles.elementAt(i)); in.close(); } <START> } <END></code><technical_language>revert changes in #285 for synchronizing brown cluster access</technical_language>

Target:
public static void init(Vector<String> pathsToClusterFiles, Vector<Integer> thresholds, Vector<Boolean> isLowercaseBrownClusters) { synchronized (INIT_SYNC) { brownclusters = new BrownClusters(); brownclusters.isLowercaseBrownClustersByResource = new boolean[isLowercaseBrownClusters.size()]; brownclusters.wordToPathByResource = new ArrayList<>(); brownclusters.resources = new ArrayList<>(); for (int i = 0; i < pathsToClusterFiles.size(); i++) { THashMap<String, String> h = new THashMap<>(); InFile in = new InFile(ResourceUtilities.loadResource(pathsToClusterFiles.elementAt(i))); String line = in.readLine(); int wordsAdded = 0; while (line != null) { StringTokenizer st = new StringTokenizer(line); String path = st.nextToken(); String word = st.nextToken(); int occ = Integer.parseInt(st.nextToken()); if (occ >= thresholds.elementAt(i)) { h.put(word, path); wordsAdded++; } line = in.readLine(); } if (ParametersForLbjCode.currentParameters.debug) { logger.info(wordsAdded + " words added"); } brownclusters.wordToPathByResource.add(h); brownclusters.isLowercaseBrownClustersByResource[i] = isLowercaseBrownClusters.elementAt(i); brownclusters.resources.add(pathsToClusterFiles.elementAt(i)); in.close(); } } }
Source:
<code>public String toString() { return getName() + ";" + getJavaType().getName() + ";" + guid.toString(); <START> } <END></code><technical_language>question: forced toString() serialization? if not, I prefer methods: serialize() deserialize(s) instead of asymmetric toString() getValue(s)</technical_language>

Target:
public String toString() { return "version=" + VERSION + ";guid="+ guid.toString(); }
Source:
<code>private static final boolean isSupportedValue(Object value) { <START> Class c = value.getClass(); <END> return SUPPORTED_BASIC_TYPES.contains(c); }</code><technical_language>c --> clazz (google style is abbreviations)</technical_language>

Target:
private static final boolean isSupportedValue(Object value) { Class clazz = value.getClass(); return SUPPORTED_BASIC_TYPES.contains(clazz); }
Source:
<code>private List<ClouderaManagerProduct> getClouderaManagerProductsFromStack(Stack stack) { Stream<ClusterComponent> clusterCompStream = Optional.ofNullable(stack).map(Stack::getCluster).map(Cluster::getComponents).orElse(Set.of()).stream(); <START> boolean datalake = stack == null ? false : stack.isDatalake(); <END> Stream<ClusterComponent> cmProductStream = datalake ? clusterCompStream.filter(clusterComponent -> clusterComponent.getName().equals(StackType.CDH.name())) : clusterCompStream.filter(clusterComponent -> ComponentType.CDH_PRODUCT_DETAILS.equals(clusterComponent.getComponentType())); return cmProductStream .map(ClusterComponent::getAttributes) .map(toAttributeClass(ClouderaManagerProduct.class)) .collect(Collectors.toList()); }</code><technical_language>simplify: boolean datalake = stack != null && stack.isDatalake();</technical_language>

Target:
private List<ClouderaManagerProduct> getClouderaManagerProductsFromStack(Stack stack) { return getClusterComponents(stack).stream() .filter(createClusterComponentFilter(stack)) .map(ClusterComponent::getAttributes) .map(toAttributeClass(ClouderaManagerProduct.class)) .collect(Collectors.toList()); }
Source:
<code>public Optional<EndGatewayData> fill(DataContainer container, EndGatewayData data) { <START> return Optional.empty(); <END> }</code><technical_language>empty</technical_language>

Target:
public Optional<EndGatewayData> fill(DataContainer container, EndGatewayData data) { checkNotNull(data, "data"); Optional<Vector3i> exitPosition = container.getObject(Keys.EXIT_POSITION.getQuery(), Vector3i.class); if (exitPosition.isPresent()) { data = data.set(Keys.EXIT_POSITION, exitPosition.get()); } Optional<Boolean> exactTeleport = container.getBoolean(Keys.EXACT_TELEPORT.getQuery()); if (exactTeleport.isPresent()) { data = data.set(Keys.EXACT_TELEPORT, exactTeleport.get()); } Optional<Long> age = container.getLong(Keys.END_GATEWAY_AGE.getQuery()); if (age.isPresent()) { data = data.set(Keys.END_GATEWAY_AGE, age.get()); } Optional<Integer> teleportCooldown = container.getInt(Keys.END_GATEWAY_TELEPORT_COOLDOWN.getQuery()); if (teleportCooldown.isPresent()) { data = data.set(Keys.END_GATEWAY_TELEPORT_COOLDOWN, teleportCooldown.get()); } return Optional.of(data); }
Source:
<code>public String getExpiryColorCoding() { if (expiryColorCoding == null) { Date CertExpiryDate = x509Cert.getNotAfter(); SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date today = new Date(); long DateDiff = CertExpiryDate.getTime() - today.getTime(); <START> long ExpiresInDays = DateDiff / (24 * 60 * 60 * 1000); <END> if (ExpiresInDays <= 30) { setExpiryColorCoding("RED"); } else if (ExpiresInDays > 30 && ExpiresInDays <= 90) { setExpiryColorCoding("YELLOW"); } else { setExpiryColorCoding("GREEN"); } } return expiryColorCoding; }</code><technical_language>Consider enum instead of constant string</technical_language>

Target:
public String getExpiryColorCoding() { if (expiryColorCoding == null) { Date certExpiryDate = x509Cert.getNotAfter(); Date today = new Date(); long dateDiff = certExpiryDate.getTime() - today.getTime(); expiresInDays = dateDiff / (24 * 60 * 60 * 1000); if (expiresInDays <= 30) { setExpiryColorCoding(CERT_EXPIRY_COLOR_CODING.RED.toString()); } else if (expiresInDays > 30 && expiresInDays <= 90) { setExpiryColorCoding(CERT_EXPIRY_COLOR_CODING.YELLOW.toString()); } else { setExpiryColorCoding(CERT_EXPIRY_COLOR_CODING.GREEN.toString()); } } return expiryColorCoding; }
Source:
<code>public static void initDimension(int dim) { WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } WorldServer alterantiveDimension = null; try { DimensionType type = DimensionManager.getProviderType(dim); if (dim != 0) { DimensionPreloadEvent adEvent = new DimensionPreloadEvent(dim, type); MinecraftForge.EVENT_BUS.post(adEvent); alterantiveDimension = adEvent.getAlternativeDimension(); } } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; } MinecraftServer mcServer = overworld.getMinecraftServer(); <START> WorldServer world = (dim == 0 ? overworld : ( alterantiveDimension != null ? alterantiveDimension : ((WorldServer)(new WorldServerMulti(mcServer, overworld.getSaveHandler(), dim, overworld, mcServer.theProfiler).init())))); <END> world.addEventListener(new ServerWorldEventHandler(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty()); }</code><technical_language>This line ternary statements in now, break if / else if / else</technical_language>

Target:
public static void initDimension(int dim) { WorldServer overworld = getWorld(0); if (overworld == null) { throw new RuntimeException("Cannot Hotload Dim: Overworld is not Loaded!"); } WorldServer alternativeDimension = null; try { DimensionType type = DimensionManager.getProviderType(dim); if (dim != 0) { DimensionPreloadEvent adEvent = new DimensionPreloadEvent(dim, type); MinecraftForge.EVENT_BUS.post(adEvent); alternativeDimension = adEvent.getAlternativeDimension(); } } catch (Exception e) { System.err.println("Cannot Hotload Dim: " + e.getMessage()); return; } MinecraftServer mcServer = overworld.getMinecraftServer(); WorldServer world; if (dim == 0) { world = overworld; } else if (alternativeDimension != null) { world = alternativeDimension; } else { world = new WorldServerMulti(mcServer, overworld.getSaveHandler(), dim, overworld, mcServer.theProfiler); world.init(); } world.addEventListener(new ServerWorldEventHandler(mcServer, world)); MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world)); if (!mcServer.isSinglePlayer()) { world.getWorldInfo().setGameType(mcServer.getGameType()); } mcServer.setDifficultyForAllWorlds(mcServer.getDifficulty()); }
Source:
<code>public PaymentPluginApi getPaymentPluginApi() throws PaymentApiException { final String pluginName = getPaymentProviderPluginName(true); <START> return getPaymentPluginApi(pluginName); <END> }</code><technical_language>I expected opposite: this is called [running payment operations](<LINK_0>, _only_ want fetch deleted payment method for GET operations, this false</technical_language>

Target:
public PaymentPluginApi getPaymentPluginApi() throws PaymentApiException { final String pluginName = getPaymentProviderPluginName(false); return getPaymentPluginApi(pluginName); }
Source:
<code>T select( ValueGroup valueGroup ) throws IOException { return uncheckedSelect( valueGroup ); <START> } <END></code><technical_language>do remove this catch clause is left intact in SpatialIndexCache</technical_language>

Target:
T select( ValueGroup valueGroup ) throws IOException { try { return uncheckedSelect( valueGroup ); } catch ( UncheckedIOException e ) { throw e.getCause(); } }
Source:
<code>public Builder addStep(String classname) { try { Object newInstance = Thread.currentThread().getContextClassLoader().loadClass(classname).newInstance(); if (newInstance instanceof Step) { states.add((Step)newInstance); } } catch (InstantiationException | IllegalAccessException | ClassNotFoundException ex) { <START> LogManager.getLogger(StepIterator.class).error("Failurer instatiating step for " + classname,ex); <END> } return this; }</code><technical_language>of log4j-api java.util.logging preferred</technical_language>

Target:
public Builder addStep(String classname) { try { Object newInstance = Thread.currentThread().getContextClassLoader().loadClass(classname).newInstance(); if (newInstance instanceof Step) { states.add((Step)newInstance); } else { LogManager.getLogger(StepIterator.class).error("Class cannot be cast to Step " + classname + ". Skipping adding the step."); } } catch (InstantiationException | IllegalAccessException | ClassNotFoundException ex) { LogManager.getLogger(StepIterator.class).error("Failure instatiating step for " + classname,ex); } return this; }
Source:
<code>public static void publishDraftPatchSet(final ReviewDb db, final PatchSet.Id patchSetId) throws OrmException, NoSuchChangeException{ final Change.Id changeId = patchSetId.getParentKey(); final PatchSet patch = db.patchSets().get(patchSetId); if (patch == null || !patch.isDraft()) { throw new NoSuchChangeException(changeId); } <START> final PatchSet updatedPatchSet = db.patchSets().atomicUpdate(patchSetId, <END> new AtomicUpdate<PatchSet>() { @Override public PatchSet update(PatchSet patchset) { if (patchset.isDraft()) { patchset.setDraft(false); } return null; } }); final Change change = db.changes().get(changeId); if (change.getStatus() == Change.Status.DRAFT) { db.changes().atomicUpdate(changeId, new AtomicUpdate<Change>() { @Override public Change update(Change change) { if (change.getStatus() == Change.Status.DRAFT && change.currentPatchSetId().equals(patchSetId)) { change.setStatus(Change.Status.NEW); ChangeUtil.updated(change); return change; } else { return null; } } }); } }</code><technical_language>I variable updatedPatchSet if useful here. atomicUpdate returns update method of AtomicUpdate class returns... is null</technical_language>

Target:
public static void publishDraftPatchSet(final ReviewDb db, final PatchSet.Id patchSetId) throws OrmException, NoSuchChangeException{ final Change.Id changeId = patchSetId.getParentKey(); final PatchSet patch = db.patchSets().get(patchSetId); if (patch == null || !patch.isDraft()) { throw new NoSuchChangeException(changeId); } db.patchSets().atomicUpdate(patchSetId, new AtomicUpdate<PatchSet>() { @Override public PatchSet update(PatchSet patchset) { if (patchset.isDraft()) { patchset.setDraft(false); } return null; } }); final Change change = db.changes().get(changeId); if (change.getStatus() == Change.Status.DRAFT) { db.changes().atomicUpdate(changeId, new AtomicUpdate<Change>() { @Override public Change update(Change change) { if (change.getStatus() == Change.Status.DRAFT && change.currentPatchSetId().equals(patchSetId)) { change.setStatus(Change.Status.NEW); ChangeUtil.updated(change); return change; } else { return null; } } }); } }