auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static long logEvent(JSONObject event, final boolean offline) { DatabaseHelper dbHelper = DatabaseHelper.getDatabaseHelper(context); long eventId = dbHelper.addEvent(event.toString()); if (dbHelper.getEventCount() >= Constants.EVENT_MAX_COUNT) { dbHelper.removeEvents(dbHelper.getNthEventId(Constants.EVENT_REMOVE_BATCH_SIZE)); } if (dbHelper.getEventCount() >= Constants.EVENT_UPLOAD_THRESHOLD <START> && !offline) { <END> updateServer(); } else { updateServerLater(Constants.EVENT_UPLOAD_PERIOD_MILLIS); } return eventId; }</code><technical_language>want skip updateServerLater call if offline well</technical_language>

Target:
private static synchronized long logEvent(JSONObject event, final boolean offline) { DatabaseHelper dbHelper = DatabaseHelper.getDatabaseHelper(context); long eventId = dbHelper.addEvent(event.toString()); if (dbHelper.getEventCount() >= Constants.EVENT_MAX_COUNT) { dbHelper.removeEvents(dbHelper.getNthEventId(Constants.EVENT_REMOVE_BATCH_SIZE)); } if(offline) { return eventId; } if (dbHelper.getEventCount() >= Constants.EVENT_UPLOAD_THRESHOLD) { updateServer(); } else { updateServerLater(Constants.EVENT_UPLOAD_PERIOD_MILLIS); } return eventId; }
Source:
<code>private Map<String, Object> executeGraphQLQuery(String sessionId, Query query) throws ServiceException, RestServerException { if (sessionId == null || query == null) return null; SchedulingApiClientGwt client = new SchedulingApiClientGwt(SchedulerConfig.get().getSchedulingApiUrl(), <START> httpClient, <END> threadPool); return client.execute(sessionId, query); }</code><technical_language>please move a class attribute, reused</technical_language>

Target:
private Map<String, Object> executeGraphQLQuery(String sessionId, Query query) throws ServiceException, RestServerException { if (sessionId == null || query == null) return null; return graphQLClient.execute(sessionId, query); }
Source:
<code>public void testAlternateBloomFilterExpiration(){ multiBloomFilter.initializeAllBloomFilters(); try { <START> Thread.sleep(multiBloomFilter.getBloomFilterLifeSpanSeconds() * 1000 + 1); <END> assertThat(multiBloomFilter.hasExpired(DateTime.now(DateTimeZone.UTC), 0), is(true)); assertThat(multiBloomFilter.hasExpired(DateTime.now(DateTimeZone.UTC), 1), is(false)); multiBloomFilter.resetAllBloomExpiredFilters(DateTime.now(DateTimeZone.UTC)); assertThat(multiBloomFilter.hasExpired(DateTime.now(DateTimeZone.UTC), 0), is(false)); assertThat(multiBloomFilter.hasExpired(DateTime.now(DateTimeZone.UTC), 1), is(false)); Thread.sleep(multiBloomFilter.getBloomFilterOffsetSeconds() * 1000 + 1); assertThat(multiBloomFilter.hasExpired(DateTime.now(DateTimeZone.UTC), 0), is(false)); assertThat(multiBloomFilter.hasExpired(DateTime.now(DateTimeZone.UTC), 1), is(true)); multiBloomFilter.resetAllBloomExpiredFilters(DateTime.now(DateTimeZone.UTC)); assertThat(multiBloomFilter.hasExpired(DateTime.now(DateTimeZone.UTC), 0), is(false)); assertThat(multiBloomFilter.hasExpired(DateTime.now(DateTimeZone.UTC), 1), is(false)); } catch (InterruptedException e) { e.printStackTrace(); } }</code><technical_language>crazy sleeping in test cases if avoid it. cleaner is pass time initializeAllBloomFilters method. control created time for of a lot more precision, slow tests sleeps</technical_language>

Target:
public void testAlternateBloomFilterExpiration(){ final DateTime dt = DateTime.now(DateTimeZone.UTC); multiBloomFilter.initializeAllBloomFilters(dt); final DateTime dtCycleOne = dt.plusMillis(multiBloomFilter.getBloomFilterLifeSpanSeconds() * 1000 + 1); assertThat(multiBloomFilter.hasExpired(dtCycleOne, 0), is(true)); assertThat(multiBloomFilter.hasExpired(dtCycleOne, 1), is(false)); multiBloomFilter.resetAllBloomExpiredFilters(dtCycleOne); assertThat(multiBloomFilter.hasExpired(dtCycleOne, 0), is(false)); assertThat(multiBloomFilter.hasExpired(dtCycleOne, 1), is(false)); final DateTime dtCycleOneAndHalf = dtCycleOne.plusMillis(multiBloomFilter.getBloomFilterOffsetSeconds() * 1000 + 1); assertThat(multiBloomFilter.hasExpired(dtCycleOneAndHalf, 0), is(false)); assertThat(multiBloomFilter.hasExpired(dtCycleOneAndHalf, 1), is(true)); multiBloomFilter.resetAllBloomExpiredFilters(dtCycleOneAndHalf); assertThat(multiBloomFilter.hasExpired(dtCycleOneAndHalf, 0), is(false)); assertThat(multiBloomFilter.hasExpired(dtCycleOneAndHalf, 1), is(false)); }
Source:
<code>private Map<String, List<SingularityTaskId>> getInactiveTaskIdsByRequest() { final List<SingularityTaskId> taskIds = new ArrayList<>(taskManager.getAllTaskIds()); taskIds.removeAll(taskManager.getActiveTaskIds()); <START> taskIds.removeAll(taskManager.getLBCleanupTasks()); <END> List<SingularityPendingDeploy> pendingDeploys = deployManager.getPendingDeploys(); return taskIds.stream() .filter((taskId) -> !isPartOfPendingDeploy(pendingDeploys, taskId) && !couldReturnWithRecoveredAgent(taskId)) .sorted(SingularityTaskId.STARTED_AT_COMPARATOR_DESC) .collect(Collectors.groupingBy(SingularityTaskId::getRequestId)); }</code><technical_language>a huge deal, do removeAlls a Set instead of a List</technical_language>

Target:
private Map<String, List<SingularityTaskId>> getInactiveTaskIdsByRequest() { final Set<SingularityTaskId> taskIds = new HashSet<>(taskManager.getAllTaskIds()); taskIds.removeAll(taskManager.getActiveTaskIds()); taskIds.removeAll(taskManager.getLBCleanupTasks()); List<SingularityPendingDeploy> pendingDeploys = deployManager.getPendingDeploys(); return taskIds.stream() .filter((taskId) -> !isPartOfPendingDeploy(pendingDeploys, taskId) && !couldReturnWithRecoveredAgent(taskId)) .sorted(SingularityTaskId.STARTED_AT_COMPARATOR_DESC) .collect(Collectors.groupingBy(SingularityTaskId::getRequestId)); }
Source:
<code>private static boolean noSpacingBetween(SyntaxToken firstToken, SyntaxToken secondToken) { <START> return firstToken.column() + firstToken.text().length() == secondToken.column(); <END> }</code><technical_language>I realized this generate FPs lines: java target = +num; check token sharing line</technical_language>

Target:
private static boolean noSpacingBetween(SyntaxToken firstToken, SyntaxToken secondToken) { return firstToken.line() == secondToken.line() && firstToken.column() + firstToken.text().length() == secondToken.column(); }
Source:
<code>protected void executeCommand() { setVds(null); if (getVds() == null) { setCommandShouldBeLogged(false); log.infoFormat("Host {0}({1}) not fenced since it doesn't exist anymore.", getVdsName(), getVdsId()); getReturnValue().setSucceeded(false); return; } VdsValidator validator = new VdsValidator(getVds()); boolean shouldBeFenced = validator.shouldVdsBeFenced(); if (shouldBeFenced) { getParameters().setParentCommand(VdcActionType.VdsNotRespondingTreatment); ExecutionContext ec = (ExecutionContext) ObjectUtils.clone(this.getExecutionContext()); if (ec != null) { ec.setJob(this.getExecutionContext().getJob()); } super.executeCommand(); if (ec != null) { this.setExecutionContext(ec); <START> } <END> } else { setCommandShouldBeLogged(false); log.infoFormat("Host {0}({1}) not fenced since it's status is ok, or it doesn't exist anymore.", getVdsName(), getVdsId()); } getReturnValue().setSucceeded(shouldBeFenced); }</code><technical_language>I is : if (ec != null) { ec.setJob(this.getExecutionContext().getJob()); super.executeCommand(); this.setExecutionContext(ec); } else { super.executeCommand(); }</technical_language>

Target:
protected void executeCommand() { setVds(null); if (getVds() == null) { setCommandShouldBeLogged(false); log.infoFormat("Host {0}({1}) not fenced since it doesn't exist anymore.", getVdsName(), getVdsId()); getReturnValue().setSucceeded(false); return; } VdsValidator validator = new VdsValidator(getVds()); boolean shouldBeFenced = validator.shouldVdsBeFenced(); if (shouldBeFenced) { getParameters().setParentCommand(VdcActionType.VdsNotRespondingTreatment); ExecutionContext ec = (ExecutionContext) ObjectUtils.clone(this.getExecutionContext()); if (ec != null) { ec.setJob(this.getExecutionContext().getJob()); super.executeCommand(); this.setExecutionContext(ec); } else { super.executeCommand(); } } else { setCommandShouldBeLogged(false); log.infoFormat("Host {0}({1}) not fenced since it's status is ok, or it doesn't exist anymore.", getVdsName(), getVdsId()); } getReturnValue().setSucceeded(shouldBeFenced); }
Source:
<code>private void checkVdsMemoryThreshold(VdsStatistics stat) { Integer minAvailableThreshold = Config.GetValue(ConfigValues.LogPhysicalMemoryThresholdInMB); Integer maxUsedPercentageThreshold = Config.GetValue(ConfigValues.LogMaxPhysicalMemoryUsedThresholdInPercentage); <START> AuditLogType valueToLog = stat.getmem_available() < minAvailableThreshold ? <END> AuditLogType.VDS_LOW_MEM : AuditLogType.VDS_HIGH_MEM_USE; if (stat.getmem_available() < minAvailableThreshold || stat.getusage_mem_percent() > maxUsedPercentageThreshold) { AuditLogableBase logable = new AuditLogableBase(stat.getId()); logable.AddCustomValue("HostName", _vds.getvds_name()); logable.AddCustomValue("AvailableMemory", stat.getmem_available().toString()); logable.AddCustomValue("UsedMemory", stat.getusage_mem_percent().toString()); logable.AddCustomValue("Threshold", stat.getmem_available() < minAvailableThreshold ? minAvailableThreshold.toString() : maxUsedPercentageThreshold.toString()); auditLog(logable, valueToLog); } }</code><technical_language>stat.getXXX returns wrapped primitive values, null. please add null checks over</technical_language>

Target:
private void checkVdsMemoryThreshold(VdsStatistics stat) { Integer minAvailableThreshold = Config.GetValue(ConfigValues.LogPhysicalMemoryThresholdInMB); Integer maxUsedPercentageThreshold = Config.GetValue(ConfigValues.LogMaxPhysicalMemoryUsedThresholdInPercentage); if (stat.getmem_available() == null) { return; } AuditLogType valueToLog = stat.getmem_available() < minAvailableThreshold ? AuditLogType.VDS_LOW_MEM : AuditLogType.VDS_HIGH_MEM_USE; if (stat.getmem_available() < minAvailableThreshold || stat.getusage_mem_percent() > maxUsedPercentageThreshold) { AuditLogableBase logable = new AuditLogableBase(stat.getId()); logable.AddCustomValue("HostName", _vds.getvds_name()); logable.AddCustomValue("AvailableMemory", stat.getmem_available().toString()); logable.AddCustomValue("UsedMemory", stat.getusage_mem_percent().toString()); logable.AddCustomValue("Threshold", stat.getmem_available() < minAvailableThreshold ? minAvailableThreshold.toString() : maxUsedPercentageThreshold.toString()); auditLog(logable, valueToLog); } }
Source:
<code>public BlobSoftRef(String space, BaseEntityRef.OnDelete deleteHandler, boolean supportsURL) { super(space); <START> this.deleteHandler = deleteHandler; <END> this.supportsURL = supportsURL; }</code><technical_language>block delete handler of type Reject</technical_language>

Target:
public BlobSoftRef(String space, BaseEntityRef.OnDelete deleteHandler, boolean supportsURL) { super(space); if (BaseEntityRef.OnDelete.REJECT == deleteHandler) { throw new IllegalArgumentException("BlobSoftRef references do not accept REJECT as deleteHandler."); } this.deleteHandler = deleteHandler; this.supportsURL = supportsURL; }
Source:
<code><START> boolean deregisterCompactorGauges(String storeId) { <END> String prefix = storeId + SEPERATOR; return registry.remove(MetricRegistry.name(BlobStoreCompactor.class, prefix + "CompactionInProgress")); }</code><technical_language>this function private</technical_language>

Target:
private boolean deregisterCompactorGauges(String storeId) { String prefix = storeId + SEPERATOR; return registry.remove(MetricRegistry.name(BlobStoreCompactor.class, prefix + "CompactionInProgress")); }
Source:
<code>private String getProcessedIdToken(ServerAccessToken st) { if (idTokenProvider != null) { IdToken idToken = idTokenProvider.getIdToken(st.getClient().getClientId(), st.getSubject(), OAuthUtils.convertPermissionsToScopeList(st.getScopes())); setAtHashAndNonce(idToken, st); return processJwt(new JwtToken(idToken), st.getClient()); } else if (st.getSubject().getProperties().containsKey(OidcUtils.ID_TOKEN)) { return st.getSubject().getProperties().get(OidcUtils.ID_TOKEN); } else if (st.getSubject() instanceof OidcUserSubject) { OidcUserSubject sub = (OidcUserSubject)st.getSubject(); if (sub.getIdToken() != null) { IdToken idToken = new IdToken(sub.getIdToken()); idToken.setAudience(st.getClient().getClientId()); idToken.setAuthorizedParty(st.getClient().getClientId()); <START> if (null == st.getResponseType()) { final Long iat = st.getIssuedAt(); idToken.setExpiryTime(iat + (idToken.getExpiryTime() - idToken.getIssuedAt())); idToken.setIssuedAt(iat); } <END> setAtHashAndNonce(idToken, st); return processJwt(new JwtToken(idToken), st.getClient()); } } return null; }</code><technical_language>explain logic here? set issued / expiry if st.getResponseType() is null</technical_language>

Target:
private String getProcessedIdToken(ServerAccessToken st) { if (idTokenProvider != null) { IdToken idToken = idTokenProvider.getIdToken(st.getClient().getClientId(), st.getSubject(), OAuthUtils.convertPermissionsToScopeList(st.getScopes())); setAtHashAndNonce(idToken, st); return processJwt(new JwtToken(idToken), st.getClient()); } else if (st.getSubject().getProperties().containsKey(OidcUtils.ID_TOKEN)) { return st.getSubject().getProperties().get(OidcUtils.ID_TOKEN); } else if (st.getSubject() instanceof OidcUserSubject) { OidcUserSubject sub = (OidcUserSubject)st.getSubject(); if (sub.getIdToken() != null) { IdToken idToken = new IdToken(sub.getIdToken()); idToken.setAudience(st.getClient().getClientId()); idToken.setAuthorizedParty(st.getClient().getClientId()); if (OAuthConstants.REFRESH_TOKEN_GRANT.equals(st.getGrantType())) { final Long iat = st.getIssuedAt(); idToken.setExpiryTime(iat + (idToken.getExpiryTime() - idToken.getIssuedAt())); idToken.setIssuedAt(iat); } setAtHashAndNonce(idToken, st); return processJwt(new JwtToken(idToken), st.getClient()); } } return null; }
Source:
<code><START> protected boolean isProbablyJavaCode() { <END> try { String sourceName = getSourceName(); if (sourceName == null || sourceName.endsWith(".java")) { return true; } } catch (DebugException e) { return true; } return false; }</code><technical_language>is purpose of making this protected ? If a language providing JDIStackFrame implement tryToResolveLambdaVariableNames right</technical_language>

Target:
protected boolean isProbablyJavaCode() { try { String sourceName = getSourceName(); if (sourceName == null || JavaCore.isJavaLikeFileName(sourceName)) { return true; } } catch (DebugException e) { return true; } return false; }
Source:
<code>public DateFormat getDateFormat() { return new DateFormat() { private final SimpleDateFormat[] formatters = new SimpleDateFormat[datePatterns.length]; { for (int i = 0; i < datePatterns.length; i++) { <START> formatters[i] = new SimpleDateFormat(datePatterns[i], Locale.US); <END> } } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { for (DateFormat formatter : formatters) { return formatter.format(date, toAppendTo, fieldPosition); } return toAppendTo.append("(date null)"); } @Override public Date parse(String source) throws ParseException { ParseException head = null, tail = null; for (SimpleDateFormat formatter : formatters) { try { return formatter.parse(source); } catch (ParseException ex1) { ex1 = new ParseException( String.format("%s with format \"%s\" and locale \"%s\"", ex1.getMessage(), formatter.toPattern(), Locale.getDefault().toString()), ex1.getErrorOffset() ); if (head == null || tail == null) { head = tail = ex1; } else { tail.initCause(ex1); tail = ex1; } } } throw head != null ? head : new ParseException(String.format("Unparseable date: \"%s\"", source), 0); } @Override public Date parse(String source, ParsePosition pos) { Date d = null; for (DateFormat formatter : formatters) { if ((d = formatter.parse(source, pos)) != null) { return d; } } return d; } }; }</code><technical_language>+1 match locale system is running</technical_language>

Target:
public DateFormat getDateFormat() { return new DateFormat() { private final SimpleDateFormat[] formatters = new SimpleDateFormat[datePatterns.length]; { for (int i = 0; i < datePatterns.length; i++) { formatters[i] = new SimpleDateFormat(datePatterns[i]); } } @Override public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { for (DateFormat formatter : formatters) { return formatter.format(date, toAppendTo, fieldPosition); } return toAppendTo.append("(date null)"); } @Override public Date parse(String source) throws ParseException { ParseException head = null, tail = null; for (SimpleDateFormat formatter : formatters) { try { return formatter.parse(source); } catch (ParseException ex1) { ex1 = new ParseException( String.format("%s with format \"%s\" and locale \"%s\"", ex1.getMessage(), formatter.toPattern(), Locale.getDefault().toString()), ex1.getErrorOffset() ); if (head == null || tail == null) { head = tail = ex1; } else { tail.initCause(ex1); tail = ex1; } } } throw head != null ? head : new ParseException(String.format("Unparseable date: \"%s\"", source), 0); } @Override public Date parse(String source, ParsePosition pos) { Date d = null; for (DateFormat formatter : formatters) { if ((d = formatter.parse(source, pos)) != null) { return d; } } return d; } }; }
Source:
<code>private Object getParameter(ParameterType type) { for (int ii = 0; ii < parameters.size(); ii += PARAMETER_TUPLE_SIZE) { <START> if (((ParameterType)parameters.get(ii + PARAMETER_TUPLE_TYPE_OFFSET)).equals(type)) <END> { return parameters.get(ii + PARAMETER_TUPLE_PARAMETER_OFFSET); } } return null; }</code><technical_language>need typecast ParameterType</technical_language>

Target:
private Object getParameter(ParameterType type) { for (int ii = 0; ii < parameters.size(); ii += PARAMETER_TUPLE_SIZE) { if ((parameters.get(ii + PARAMETER_TUPLE_TYPE_OFFSET)).equals(type)) { return parameters.get(ii + PARAMETER_TUPLE_PARAMETER_OFFSET); } } return null; }
Source:
<code>public void exerciseIsCorrectTypeIfItContainsTestthatFile() { Path testCasesRoot = TestUtils.getPath(getClass(), "recognition_test_cases"); Path project = testCasesRoot.resolve("testthat_folder") .resolve("tests"); <START> File testThatR = new File(project.toAbsolutePath().toString() + "/testthat.R"); <END> assertTrue(testThatR.exists()); }</code><technical_language>java.nio alternative instead I suggested before</technical_language>

Target:
public void exerciseIsCorrectTypeIfItContainsTestthatFile() { Path testCasesRoot = TestUtils.getPath(getClass(), "recognition_test_cases"); Path project = testCasesRoot.resolve("testthat_folder") .resolve("tests"); assertTrue(Files.exists(project.resolve("testthat.R"))); }
Source:
<code>public static Task<?> getLoadCopyTask(ReplicationSpec replicationSpec, Path srcPath, Path dstPath, HiveConf conf, boolean isAutoPurge, boolean needRecycle, boolean copyToMigratedTxnTable) { Task<?> copyTask = null; LOG.debug("ReplCopyTask:getLoadCopyTask: {}=>{}", srcPath, dstPath); if ((replicationSpec != null) && replicationSpec.isInReplicationScope()){ ReplCopyWork rcwork = new ReplCopyWork(srcPath, dstPath, false); if (replicationSpec.isReplace() && (conf.getBoolVar(REPL_ENABLE_MOVE_OPTIMIZATION) || copyToMigratedTxnTable)) { rcwork.setDeleteDestIfExist(true); rcwork.setAutoPurge(isAutoPurge); <START> rcwork.setNeedRecycle(needRecycle); <END> } rcwork.setCopyToMigratedTxnTable(copyToMigratedTxnTable); rcwork.setCheckDuplicateCopy(replicationSpec.needDupCopyCheck()); LOG.debug("ReplCopyTask:\trcwork"); if (replicationSpec.isLazy()) { LOG.debug("ReplCopyTask:\tlazy"); rcwork.setReadSrcAsFilesList(true); String distCpDoAsUser = conf.getVar(HiveConf.ConfVars.HIVE_DISTCP_DOAS_USER); rcwork.setDistCpDoAsUser(distCpDoAsUser); } copyTask = TaskFactory.get(rcwork, conf); } else { LOG.debug("ReplCopyTask:\tcwork"); copyTask = TaskFactory.get(new CopyWork(srcPath, dstPath, false), conf); } return copyTask; }</code><technical_language>needDupCopyCheck a generic flag handle for migration case. Instead, change isFirstIncAfterBootstrap clear for some flow, need handle this case differently</technical_language>

Target:
public static Task<?> getLoadCopyTask(ReplicationSpec replicationSpec, Path srcPath, Path dstPath, HiveConf conf, boolean isAutoPurge, boolean needRecycle, boolean copyToMigratedTxnTable) { Task<?> copyTask = null; LOG.debug("ReplCopyTask:getLoadCopyTask: {}=>{}", srcPath, dstPath); if ((replicationSpec != null) && replicationSpec.isInReplicationScope()){ ReplCopyWork rcwork = new ReplCopyWork(srcPath, dstPath, false); if (replicationSpec.isReplace() && (conf.getBoolVar(REPL_ENABLE_MOVE_OPTIMIZATION) || copyToMigratedTxnTable)) { rcwork.setDeleteDestIfExist(true); rcwork.setAutoPurge(isAutoPurge); rcwork.setNeedRecycle(needRecycle); } rcwork.setCopyToMigratedTxnTable(copyToMigratedTxnTable); rcwork.setCheckDuplicateCopy(replicationSpec.needDupCopyCheck() && !replicationSpec.isReplace()); LOG.debug("ReplCopyTask:\trcwork"); if (replicationSpec.isLazy()) { LOG.debug("ReplCopyTask:\tlazy"); rcwork.setReadSrcAsFilesList(true); String distCpDoAsUser = conf.getVar(HiveConf.ConfVars.HIVE_DISTCP_DOAS_USER); rcwork.setDistCpDoAsUser(distCpDoAsUser); } copyTask = TaskFactory.get(rcwork, conf); } else { LOG.debug("ReplCopyTask:\tcwork"); copyTask = TaskFactory.get(new CopyWork(srcPath, dstPath, false), conf); } return copyTask; }
Source:
<code>public SInvokable(final SSymbol signature, final AccessModifier accessModifier, final Invokable invokable, final SInvokable[] embeddedBlocks) { this.signature = signature; this.accessModifier = accessModifier; this.invokable = invokable; this.callTarget = invokable.createCallTarget(); this.embeddedBlocks = embeddedBlocks; <START> if (VmSettings.TRACK_SNAPSHOT_ENTITIES) { <END> SnapshotBackend.registerInvokable(Symbols.symbolFor(this.getIdentifier()), this); } }</code><technical_language>Is this necessary? StructuralProbe mechanism in parser. instead? Structural probes recordNewMethod(SInvokable method)</technical_language>

Target:
public SInvokable(final SSymbol signature, final AccessModifier accessModifier, final Invokable invokable, final SInvokable[] embeddedBlocks) { this.signature = signature; this.accessModifier = accessModifier; this.invokable = invokable; this.callTarget = invokable.createCallTarget(); this.embeddedBlocks = embeddedBlocks; }
Source:
<code>public void testInvalidProjectByFetchProjectByName() { if (!isTestSetup()) { return; } ProjectLoader loader = createLoader(); try { loader.fetchProjectByName("NonExistantProject"); } catch (ProjectManagerException ex) { System.out.println("Test true"); } <START> Assert.fail("No exception"); <END> }</code><technical_language>this message more clear i.e "Expecting exception, get one"</technical_language>

Target:
public void testInvalidProjectByFetchProjectByName() { if (!isTestSetup()) { return; } ProjectLoader loader = createLoader(); try { loader.fetchProjectByName("NonExistantProject"); } catch (ProjectManagerException ex) { System.out.println("Test true"); } Assert.fail("Expecting exception, but didn't get one"); }
Source:
<code>protected void applyGlobalLogRotators( Job<?,?> job, List<LogRotatorMapping> rotators ) throws IOException, InterruptedException { for( LogRotatorMapping mapping : rotators ) { if( job.getFullName().matches( mapping.getJobNameRegex() ) ) { mapping.getLogRotator().perform( job ); return; } } <START> <END> LOGGER.log( FINE, Messages.LogRotatorPeriodicTask_noGlobalMatch( job.getFullName() ) ); }</code><technical_language>suggestion LOGGER.log( FINE, () -> Messages.LogRotatorPeriodicTask_noGlobalMatch( job.getFullName() ) );</technical_language>

Target:
protected void applyGlobalLogRotators( Job<?,?> job, List<LogRotatorMapping> rotators ) throws IOException, InterruptedException { for( LogRotatorMapping mapping : rotators ) { if( job.getFullName().matches( mapping.getJobNameRegex() ) ) { mapping.getLogRotator().perform( job ); return; } } LOGGER.log( FINE, () -> Messages.LogRotatorPeriodicTask_noGlobalMatch( job.getFullName() ) ); }
Source:
<code>public long remove(Type type, String value) throws MailQueueException { <START> try (IndexReader indexReader = DirectoryReader.open(indexWriter)) { <END> int maxCount = Math.max(1, indexReader.maxDoc()); IndexSearcher searcher = new IndexSearcher(indexReader); MutableLong count = new MutableLong(); Term term; Query query; switch (type) { case Name: case Sender: case Recipient: term = new Term(type.name(), value); query = new TermQuery(term); break; default: throw new MailQueueException("Not supported yet"); } Optional.ofNullable(searcher.search(query, maxCount).scoreDocs) .filter(hits -> hits.length > 0) .map(Stream::of) .ifPresent(scoreDocStream -> scoreDocStream .mapToInt(scoreDoc -> scoreDoc.doc) .forEach(id -> Optional.ofNullable(Throwing.supplier(() -> searcher.doc(id, FIELDS_TO_LOAD)).get()) .map(doc -> doc.getField(FILE_PATH_KEY)) .map(IndexableField::stringValue) .map(keyMappings::remove) .ifPresent(fileItem -> { Throwing.runnable(fileItem::delete).run(); Throwing.<Query>consumer(indexWriter::deleteDocuments).accept(query); count.increment(); }) )); return count.longValue(); } catch (IOException e) { throw new MailQueueException("Cannot perform remove operation.", e); } }</code><technical_language>split this method, I find long</technical_language>

Target:
public long remove(Type type, String value) throws MailQueueException { try { return mailQueueIndex.pop(type, value) .stream() .map(keyMappings::remove) .peek(fileItem -> Throwing.runnable(fileItem::delete).run()) .count(); } catch (IOException e) { throw new MailQueueException("Cannot perform remove operation.", e); } }
Source:
<code>public void createControl(Composite parent, final FormToolkit toolkit) { if (taskReviewStore != null) { Collection<String> reviewUrls = taskReviewStore.getReviewUrls(getTaskEditorPage().getTask().getUrl()); getReviewsFromUrls(reviewUrls); } if (reviews == null || reviews.size() == 0) { return; } reviewContainers = new ArrayList<TaskReview>(); populateReviews(reviewContainers); selectionProvider = new SelectionProviderAdapter(); section = createSection(parent, toolkit, true); section.setText(section.getText()); createContents(toolkit, section); section.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent event) { <START> if (reviewContainers == null) { <END> createContents(toolkit, section); getTaskEditorPage().reflow(); } } }); setSection(toolkit, section); }</code><technical_language>I this null. initialized set null</technical_language>

Target:
public void createControl(Composite parent, final FormToolkit toolkit) { if (taskReviewStore != null) { Collection<String> reviewUrls = taskReviewStore.getReviewUrls(getTaskEditorPage().getTask().getUrl()); getReviewsFromUrls(reviewUrls); } if (reviews == null || reviews.size() == 0) { return; } reviewContainers = new ArrayList<TaskReview>(); populateReviews(reviewContainers); selectionProvider = new SelectionProviderAdapter(); section = createSection(parent, toolkit, true); section.setText(section.getText()); createContents(toolkit, section); section.addExpansionListener(new ExpansionAdapter()); setSection(toolkit, section); }
Source:
<code>private void processRemovedClient(Client client) { if (client instanceof NetClient) { ServerConnectListManager serverConnectListManager = ServerConnectListManager.getInstance(); if (!serverConnectListManager.isClientAllowedToConnect(client.getId())) { return; } NetClient netClient = (NetClient) client; netClientList.remove(netClient); } clientList.remove(client); clientPlayerLookup.remove(client.getEntity()); logger.info("Client disconnected: " + client.getName()); storageManager.deactivatePlayer(client); client.getEntity().send(new DisconnectedEvent()); client.disconnect(); <START> } <END></code><technical_language>Note wrong leaving logging in debug problems later. Loggers enabled/disabled while program is running. If calculating arguments expensive, prefix if (logger.isInfoEnabled()) "</technical_language>

Target:
private void processRemovedClient(Client client) { if (client instanceof NetClient) { ServerConnectListManager serverConnectListManager = context.get(ServerConnectListManager.class); if (!serverConnectListManager.isClientAllowedToConnect(client.getId())) { return; } NetClient netClient = (NetClient) client; netClientList.remove(netClient); } clientList.remove(client); clientPlayerLookup.remove(client.getEntity()); logger.info("Client disconnected: " + client.getName()); storageManager.deactivatePlayer(client); client.getEntity().send(new DisconnectedEvent()); client.disconnect(); }
Source:
<code>public void testConstructor () throws IOException { BloomFilter bloomFilter1 = new BlockSplitBloomFilter(0); assertEquals(bloomFilter1.getBitsetSize(), BlockSplitBloomFilter.MINIMUM_BLOOM_FILTER_BYTES); <START> BloomFilter bloomFilter2 = new BlockSplitBloomFilter(256 * 1024 * 1024); <END> assertEquals(bloomFilter2.getBitsetSize(), BlockSplitBloomFilter.MAXIMUM_BLOOM_FILTER_BYTES); BloomFilter bloomFilter3 = new BlockSplitBloomFilter(1000); assertEquals(bloomFilter3.getBitsetSize(), 1024); }</code><technical_language>suggestion BloomFilter bloomFilter2 = new BlockSplitBloomFilter(BlockSplitBloomFilter, MAXIMUM_BLOOM_FILTER_BYTES + 1);</technical_language>

Target:
public void testConstructor () throws IOException { BloomFilter bloomFilter1 = new BlockSplitBloomFilter(0); assertEquals(bloomFilter1.getBitsetSize(), BlockSplitBloomFilter.MINIMUM_BYTES); BloomFilter bloomFilter2 = new BlockSplitBloomFilter(BlockSplitBloomFilter.MAXIMUM_BYTES + 1); assertEquals(bloomFilter2.getBitsetSize(), BlockSplitBloomFilter.MAXIMUM_BYTES); BloomFilter bloomFilter3 = new BlockSplitBloomFilter(1000); assertEquals(bloomFilter3.getBitsetSize(), 1024); }
Source:
<code>synchronized Response afterLRA(URI lraId, LRAStatus lraStatus) { invokeMethod(AFTER, afterLRAMethod, getInstance(), lraId, lraStatus); <START> return Response.ok().build(); <END> }</code><technical_language>If invokeMethod call fails implementation needs retrying afterLRA notification</technical_language>

Target:
synchronized Response afterLRA(URI lraId, LRAStatus lraStatus) { Object result = invokeMethod(AFTER, afterLRAMethod, getInstance(), lraId, lraStatus); return result instanceof Response ? (Response) result : Response.ok().build(); }
Source:
<code>public void load(GlowFallingBlock entity, CompoundTag tag) { super.load(entity, tag); <START> if (tag.isString("Material")) { <END> entity.setMaterial(Material.getMaterial(tag.getString("Material"))); } }</code><technical_language>this Block</technical_language>

Target:
public void load(GlowFallingBlock entity, CompoundTag tag) { super.load(entity, tag); if (tag.isString("Block")) { entity.setMaterial(ItemIds.getBlock(tag.getString("Block"))); } if (tag.isByte("Data")) { entity.setBlockData(tag.getByte("Data")); } entity.setHurtEntities(tag.getBool("HurtEntities")); entity.setDropItem(tag.getBool("DropItem")); if (tag.isCompound("TileEntityData")) { entity.setTileEntityCompoundTag(tag.getCompound("TileEntityData")); } }
Source:
<code>public void addProvider(ITimeGraphDataProvider<?> provider) { synchronized (fProviders) { <START> fProviders.add(provider); <END> } }</code><technical_language>Here, reset fStylesMap null styles computed again. fStateTable set null</technical_language>

Target:
public void addProvider(ITimeGraphDataProvider<?> provider) { synchronized (fProviders) { fProviders.add(provider); fStylesMap = null; fStateTable = null; } }
Source:
<code>public List<Lesson> getLessonsByProperties(Map<String, String> properties) { List lessons = lessonDataService.executeQuery(new QueryExecution<List<Lesson>>() { @Override <START> public List<Lesson> execute(Query query, InstanceSecurityRestriction restriction) { <END> query.setFilter(buildParametersFilter(properties)); return (List) QueryExecutor.execute(query, restriction); } }); return new ArrayList<>(lessons); }</code><technical_language>create a separate, generic class for this execution, body of method is same</technical_language>

Target:
public List<Lesson> getLessonsByProperties(Map<String, String> properties) { return lessonDataService.executeQuery(new PropertiesMapQueryExecution<>(properties)); }
Source:
<code>public void sendSuccessEdgeNotification(final MonitoredMessage trackMessage) { LOG.debug("Inside Message Monitoring API sendSuccessEdgeNotification() method."); final String subject = MessageMonitoringUtil.getSuccessfulMessageSubjectPrefix() + trackMessage.getSubject(); final String emailText = MessageMonitoringUtil.getSuccessfulMessageEmailText() + trackMessage.getRecipients(); final String postmasterEmailId = MessageMonitoringUtil.getDomainPostmasterEmailId() + "@" + MessageMonitoringUtil.getDomainFromEmail(trackMessage.getSenderemailid()); final DirectEdgeProxy proxy = MessageMonitoringUtil.getDirectEdgeProxy(); MimeMessage message = null; String errorMsg = null; try { message = MessageMonitoringUtil.createMimeMessage(postmasterEmailId, subject, trackMessage.getSenderemailid(), emailText, trackMessage.getMessageid()); proxy.provideAndRegisterDocumentSetB(message); getDirectEventLogger().log(DirectEventType.DIRECT_EDGE_NOTIFICATION_SUCCESSFUL, message); <<<<<<< HEAD } catch (final MessagingException ex) { ======= } catch (MessagingException ex) { <START> >>>>>>> 3018470ef5... CONN_2297: PR Feedback <END> errorMsg = ex.getLocalizedMessage(); LOG.error(errorMsg,ex); } LOG.debug("Exiting Message Monitoring API sendSuccessEdgeNotification() method."); }</code><technical_language>correct rebased code</technical_language>

Target:
public void sendSuccessEdgeNotification(final MonitoredMessage trackMessage) { LOG.debug("Inside Message Monitoring API sendSuccessEdgeNotification() method."); final String subject = MessageMonitoringUtil.getSuccessfulMessageSubjectPrefix() + trackMessage.getSubject(); final String emailText = MessageMonitoringUtil.getSuccessfulMessageEmailText() + trackMessage.getRecipients(); final String postmasterEmailId = MessageMonitoringUtil.getDomainPostmasterEmailId() + "@" + MessageMonitoringUtil.getDomainFromEmail(trackMessage.getSenderemailid()); final DirectEdgeProxy proxy = MessageMonitoringUtil.getDirectEdgeProxy(); MimeMessage message = null; String errorMsg = null; try { message = MessageMonitoringUtil.createMimeMessage(postmasterEmailId, subject, trackMessage.getSenderemailid(), emailText, trackMessage.getMessageid()); proxy.provideAndRegisterDocumentSetB(message); getDirectEventLogger().log(DirectEventType.DIRECT_EDGE_NOTIFICATION_SUCCESSFUL, message); } catch (final MessagingException ex) { errorMsg = ex.getLocalizedMessage(); LOG.error(errorMsg,ex); } LOG.debug("Exiting Message Monitoring API sendSuccessEdgeNotification() method."); }
Source:
<code>private SaslServer getIndirectSaslServer(final String mechanism, final String protocol, final String serverName, final Map<String, Object> props, final String bindingType, final byte[] bindingData) throws SaslException { try { <START> return Subject.doAs(clientSubject, new PrivilegedExceptionAction<SaslServer>() { <END> public SaslServer run() throws SaslException { CallbackHandler cbh = new IndirectCallbackHandler(bindingType, bindingData); return Sasl.createSaslServer(mechanism, protocol, serverName, props, cbh); } }); } catch (PrivilegedActionException e) { if (e.getCause() instanceof SaslException) { throw (SaslException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } }</code><technical_language>This serverSubject</technical_language>

Target:
private SaslServer getIndirectSaslServer(final String mechanism, final String protocol, final String serverName, final Map<String, Object> props, final String bindingType, final byte[] bindingData) throws SaslException { try { return Subject.doAs(serverSubject, new PrivilegedExceptionAction<SaslServer>() { public SaslServer run() throws SaslException { CallbackHandler cbh = new IndirectCallbackHandler(bindingType, bindingData); return Sasl.createSaslServer(mechanism, protocol, serverName, props, cbh); } }); } catch (PrivilegedActionException e) { if (e.getCause() instanceof SaslException) { throw (SaslException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } }
Source:
<code>private void persistRp(String siteId, RegisterSiteParams params) { try { final RegisterRequest registerRequest = createRegisterClientRequest(params, siteId); rp = createRp(registerRequest); rp.setOxdId(siteId); rp.setApplicationType("web"); rp.setOpHost(params.getOpHost()); rp.setOpDiscoveryPath(params.getOpDiscoveryPath()); rp.setUiLocales(params.getUiLocales()); if (!hasClient(params)) { LOG.info("Save RegisterRequest object to register in OP ..."); final RegisterResponse registerResponse = registerClient(params, registerRequest); rp.setClientId(registerResponse.getClientId()); rp.setClientSecret(registerResponse.getClientSecret()); rp.setClientRegistrationAccessToken(registerResponse.getRegistrationAccessToken()); rp.setClientRegistrationClientUri(registerResponse.getRegistrationClientUri()); rp.setClientIdIssuedAt(registerResponse.getClientIdIssuedAt()); rp.setClientSecretExpiresAt(registerResponse.getClientSecretExpiresAt()); } <START> LOG.info("Saving Relying Party object in oxd ..."); <END> getRpService().create(rp); } catch (HttpException e) { throw e; } catch (Exception e) { LOG.error("Failed to persist site configuration, params: " + params, e); throw new RuntimeException(e); } }</code><technical_language>want external log for saving. If want log create method</technical_language>

Target:
private void persistRp(String siteId, RegisterSiteParams params) { try { final RegisterRequest registerRequest = createRegisterClientRequest(params, siteId); rp = createRp(registerRequest); rp.setOxdId(siteId); rp.setApplicationType("web"); rp.setOpHost(params.getOpHost()); rp.setOpDiscoveryPath(params.getOpDiscoveryPath()); rp.setUiLocales(params.getUiLocales()); if (!hasClient(params)) { final RegisterResponse registerResponse = registerClient(params, registerRequest); rp.setClientId(registerResponse.getClientId()); rp.setClientSecret(registerResponse.getClientSecret()); rp.setClientRegistrationAccessToken(registerResponse.getRegistrationAccessToken()); rp.setClientRegistrationClientUri(registerResponse.getRegistrationClientUri()); rp.setClientIdIssuedAt(registerResponse.getClientIdIssuedAt()); rp.setClientSecretExpiresAt(registerResponse.getClientSecretExpiresAt()); } getRpService().create(rp); } catch (HttpException e) { throw e; } catch (Exception e) { LOG.error("Failed to persist site configuration, params: " + params, e); throw new RuntimeException(e); } }
Source:
<code>private boolean checkNull(ExpressionTree expression) { <START> if (expression.is(Kind.NULL_LITERAL)) { <END> context.reportIssue(NullShouldNotBeUsedWithOptionalCheck.this, expression.firstToken(), "Methods with an \"Optional\" return type should never return null."); return true; } return false; }</code><technical_language>expression.is(Tree.Kind.NULL_LITERAL) replaced isNull(expression) in order reuse method</technical_language>

Target:
private void checkNull(ExpressionTree expression) { if (isNull(expression)) { context.reportIssue(NullShouldNotBeUsedWithOptionalCheck.this, expression, "Methods with an \"Optional\" return type should never return null."); } }
Source:
<code>public static List<Storage> getAllStorageLocations(Context context) { Collection<String> mounts = new ArrayList<>(); final File[] mountPoints = ContextCompat.getExternalFilesDirs(context, null); if (mountPoints != null && mountPoints.length > 1) { for (int i = 0; i < mountPoints.length; i++) { mounts.add(mountPoints[i].getAbsolutePath()); } } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { mounts = readMountsFile(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { Collection<String> vold = readVoldsFile(); List<String> toRemove = new ArrayList<String>(); <START> for (Iterator<String> iter = mounts.iterator(); iter.hasNext(); ) { <END> String mount = iter.next(); if (!vold.contains(mount)) { toRemove.add(mount); } } for (String s : toRemove) { mounts.remove(s); } } else { Log.d(TAG, "Android version: " + Build.VERSION.SDK_INT + ", skip reading vold.fstab file"); } } Log.d(TAG, "mounts list is: " + mounts); return buildMountsList(context, mounts); }</code><technical_language>foreach (String mount : mounts) {</technical_language>

Target:
public static List<Storage> getAllStorageLocations(Context context) { Collection<String> mounts = new ArrayList<>(); final File[] mountPoints = ContextCompat.getExternalFilesDirs(context, null); if (mountPoints != null && mountPoints.length > 1) { for (File mountPoint : mountPoints) { mounts.add(mountPoint.getAbsolutePath()); } } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { mounts = readMountsFile(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { Collection<String> vold = readVoldsFile(); List<String> toRemove = new ArrayList<>(); for (String mount : mounts) { if (!vold.contains(mount)) { toRemove.add(mount); } } for (String s : toRemove) { mounts.remove(s); } } else { Log.d(TAG, "Android version: " + Build.VERSION.SDK_INT + ", skip reading vold.fstab file"); } } Log.d(TAG, "mounts list is: " + mounts); return buildMountsList(context, mounts); }
Source:
<code>public boolean canExecute() { if (canceled) { return false; } <START> synchronized (queueSet.scheduleQueue.getModificationLock()) { <END> if (queueSet.scheduleQueue.remove(this)) { executing = true; queueSet.scheduleQueue.addLast(this); return true; } else { return false; } } }</code><technical_language>I feel this doable w/o lock. assuming remove is atomic return true for call removes</technical_language>

Target:
public boolean canExecute() { synchronized (queueSet.scheduleQueue.getModificationLock()) { int index = queueSet.scheduleQueue.indexOf(this); if (index < 0) { return false; } else { queueSet.scheduleQueue.reposition(index, queueSet.scheduleQueue.size()); executing = true; return true; } } }
Source:
<code>public void findOne() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, "ATest", "ANamespace") .build(); <START> <END> getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", is( matchEntry(metadataSchema) ))); }</code><technical_language>turning *on* AuthorizationSystem here, we? need temporarily in order create test data</technical_language>

Target:
public void findOne() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, "ATest", "ANamespace") .build(); context.restoreAuthSystemState(); getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", is( matchEntry(metadataSchema) ))); }
Source:
<code>public void testMetaspaceCompleteness() { final InterceptingOperatorMetricGroup metaspaceMetrics = new InterceptingOperatorMetricGroup(); final InterceptingOperatorMetricGroup parentMetrics = new InterceptingOperatorMetricGroup() { @Override public MetricGroup addGroup(String name) { <START> return metaspaceMetrics; <END> } }; MetricUtils.instantiateMetaspaceMemoryMetrics(parentMetrics); Assert.assertNotNull(metaspaceMetrics.get(MetricNames.MEMORY_USED)); Assert.assertNotNull(metaspaceMetrics.get(MetricNames.MEMORY_COMMITTED)); Assert.assertNotNull(metaspaceMetrics.get(MetricNames.MEMORY_MAX)); }</code><technical_language>return this</technical_language>

Target:
public void testMetaspaceCompleteness() { final InterceptingOperatorMetricGroup metaspaceMetrics = new InterceptingOperatorMetricGroup() { @Override public MetricGroup addGroup(String name) { return this; } }; MetricUtils.instantiateMetaspaceMemoryMetrics(metaspaceMetrics); Assert.assertNotNull(metaspaceMetrics.get(MetricNames.MEMORY_USED)); Assert.assertNotNull(metaspaceMetrics.get(MetricNames.MEMORY_COMMITTED)); Assert.assertNotNull(metaspaceMetrics.get(MetricNames.MEMORY_MAX)); }
Source:
<code>@Override public RelNode transform(int ruleSetIndex, RelTraitSet requiredOutputTraits, RelNode rel) throws RelConversionException { ensure(State.STATE_3_CONVERTED); Program program = m_config.getPrograms().get(ruleSetIndex); <START> return program.run( <END> m_relPlanner, rel, requiredOutputTraits, ImmutableList.of() , ImmutableList.of() ); }</code><technical_language>lack of transform is Volcano Planner. build a HEP Planner is reuse m_config. I HEP Planner useful in cases. 1. a bottom-up match order, while volcano top down. MPFallBack it. 2. apply rule in list in order. inline rules advantage of this feature. 3. is faster Volcano</technical_language>

Target:
@Override public RelNode transform(int ruleSetIndex, RelTraitSet requiredOutputTraits, RelNode rel) throws RelConversionException { ensure(State.STATE_3_CONVERTED); requiredOutputTraits = requiredOutputTraits.simplify(); Program program = m_config.getPrograms().get(ruleSetIndex); return program.run( m_relPlanner, rel, requiredOutputTraits, ImmutableList.of() , ImmutableList.of() ); }
Source:
<code>protected BigDecimal parseToBigDecimalInternal(String text) { BigDecimal retVal = null; if (text == null) { text = ""; } else { text = text.trim(); } if (text.length() > 0) { text = ensureSuffix(text); ParsePosition p = new ParsePosition(0); BigDecimal valBeforeRounding = null; DecimalFormat f = getFormat(); List<Character> groupingSeparators = getConfiguredLenientGroupingSeparators(); <START> groupingSeparators.add(0, f.getDecimalFormatSymbols().getGroupingSeparator()); <END> for (char c : groupingSeparators) { p.setIndex(0); DecimalFormatSymbols dfs = f.getDecimalFormatSymbols(); dfs.setGroupingSeparator(c); f.setDecimalFormatSymbols(dfs); BigDecimal parsedVal = (BigDecimal) f.parse(text, p); if (p.getErrorIndex() == -1 && p.getIndex() == text.length()) { valBeforeRounding = parsedVal; break; } } if (valBeforeRounding == null) { throw new ProcessingException(TEXTS.get("InvalidNumberMessageX", text)); } try { retVal = roundParsedValue(valBeforeRounding); } catch (ArithmeticException e) { throw new ProcessingException(TEXTS.get("InvalidNumberMessageX", text)); } if (getMinPossibleValue() != null && retVal.compareTo(NumberUtility.numberToBigDecimal(getMinPossibleValue())) < 0) { throwNumberTooSmall(); } if (getMaxPossibleValue() != null && retVal.compareTo(NumberUtility.numberToBigDecimal(getMaxPossibleValue())) > 0) { throwNumberTooLarge(); } } return retVal; }</code><technical_language>I manipulate collection returned property (it immutable). Set<Character> separators = new HashSet<>(getLenientGroupingSeparators()); a set solves problem of duplicates</technical_language>

Target:
protected BigDecimal parseToBigDecimalInternal(String text) { BigDecimal retVal = null; if (text == null) { text = ""; } else { text = text.trim(); } if (text.length() > 0) { text = ensureSuffix(text); ParsePosition p = new ParsePosition(0); BigDecimal valBeforeRounding = null; BigDecimal parsedVal = (BigDecimal) getFormatInternal().parse(text, p); if (p.getErrorIndex() == -1 && p.getIndex() == text.length()) { valBeforeRounding = parsedVal; } if (valBeforeRounding == null) { valBeforeRounding = parseLenient(text); } if (valBeforeRounding == null) { throw new ProcessingException(TEXTS.get("InvalidNumberMessageX", text)); } try { retVal = roundParsedValue(valBeforeRounding); } catch (ArithmeticException e) { throw new ProcessingException(TEXTS.get("InvalidNumberMessageX", text)); } if (getMinPossibleValue() != null && retVal.compareTo(NumberUtility.numberToBigDecimal(getMinPossibleValue())) < 0) { throwNumberTooSmall(); } if (getMaxPossibleValue() != null && retVal.compareTo(NumberUtility.numberToBigDecimal(getMaxPossibleValue())) > 0) { throwNumberTooLarge(); } } return retVal; }