auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean getBindToAllInterfaces() { <START> if (getNetworkInterface() != null || getHostAddress() != null) { <END> return false; } else { return true; } }</code><technical_language>![Codacy](<LINK_0> Issue found: [Avoid unnecessary if..then..else statements returning booleans](<LINK_1></technical_language>

Target:
public boolean getBindToAllInterfaces() { return !(getNetworkInterface() != null || getHostAddress() != null); }
Source:
<code>public void blame(BlameInput input, BlameOutput output) { File basedir = input.fileSystem().baseDir(); try (Repository repo = buildRepository(basedir); Git git = Git.wrap(repo)) { File gitBaseDir = repo.getWorkTree(); <START> if (gitBaseDir.toPath().resolve(".git/shallow").toFile().isFile()) { <END> throw MessageException.of("Shallow clone detected, blame information may be incorrect. You can convert to non-shallow with: git fetch --unshallow"); } Stream<InputFile> stream = StreamSupport.stream(input.filesToBlame().spliterator(), true); ForkJoinPool forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors(), new GitThreadFactory(), null, false); forkJoinPool.submit(() -> stream.forEach(inputFile -> blame(output, git, gitBaseDir, inputFile))); try { forkJoinPool.shutdown(); forkJoinPool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.info("Git blame interrupted"); } } }</code><technical_language>Files.isRegularFile</technical_language>

Target:
public void blame(BlameInput input, BlameOutput output) { File basedir = input.fileSystem().baseDir(); try (Repository repo = buildRepository(basedir); Git git = Git.wrap(repo)) { File gitBaseDir = repo.getWorkTree(); if (Files.isRegularFile(gitBaseDir.toPath().resolve(".git/shallow"))) { throw MessageException.of("Shallow clone detected, blame information may be incorrect. " + "You can either convert to non-shallow with 'git fetch --unshallow', or disable the scm."); } Stream<InputFile> stream = StreamSupport.stream(input.filesToBlame().spliterator(), true); ForkJoinPool forkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors(), new GitThreadFactory(), null, false); forkJoinPool.submit(() -> stream.forEach(inputFile -> blame(output, git, gitBaseDir, inputFile))); try { forkJoinPool.shutdown(); forkJoinPool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.info("Git blame interrupted"); } } }
Source:
<code>protected void label(Namespace namespace, Map<String, String> ensureLabels) throws InfrastructureException { if (ensureLabels.isEmpty()) { return; } Map<String, String> currentLabels = namespace.getMetadata().getLabels(); Map<String, String> newLabels = currentLabels != null ? new HashMap<>(currentLabels) : new HashMap<>(); if (newLabels.entrySet().containsAll(ensureLabels.entrySet())) { LOG.debug( "Nothing to do, namespace already has all required labels.", namespace.getMetadata().getName()); return; } try { cheSAClientFactory .create() .namespaces() .createOrReplace( new NamespaceBuilder(namespace) .editMetadata() .addToLabels(ensureLabels) .endMetadata() .build()); } catch (KubernetesClientException kce) { if (kce.getCode() == 403) { LOG.warn( <START> "Can't label the namespace due to lack of permissions. Grant to `che` ServiceAccount " <END> + "cluster-wide permissions to `get` and `update` the `namespaces` " + "(there might be `che-namespace-editor` ClusterRole prepared for this). " + "Or consider disabling the feature with setting " + "`che.infra.kubernetes.namespace.label=false`"); return; } throw new InfrastructureException(kce); } }</code><technical_language>Grammar nazi suggests: > label namespace due lack of permissions. Grant cluster-wide permissions \get\ \update\ \namespaces\ \che\ service account (Che operator prepared a cluster role called \che-namespace-editor\ for this, depending configuration). Alternatively, consider disabling feature setting \che.infra.kubernetes.namepsace.label\ \false\</technical_language>

Target:
protected void label(Namespace namespace, Map<String, String> ensureLabels) throws InfrastructureException { if (ensureLabels.isEmpty()) { return; } Map<String, String> currentLabels = namespace.getMetadata().getLabels(); Map<String, String> newLabels = currentLabels != null ? new HashMap<>(currentLabels) : new HashMap<>(); if (newLabels.entrySet().containsAll(ensureLabels.entrySet())) { LOG.debug( "Nothing to do, namespace already has all required labels.", namespace.getMetadata().getName()); return; } try { cheSAClientFactory .create() .namespaces() .createOrReplace( new NamespaceBuilder(namespace) .editMetadata() .addToLabels(ensureLabels) .endMetadata() .build()); } catch (KubernetesClientException kce) { if (kce.getCode() == 403) { LOG.warn( "Can't label the namespace due to lack of permissions. Grant cluster-wide permissions " + "to `get` and `update` the `namespaces` to the `che` service account " + "(Che operator might have already prepared a cluster role called " + "`che-namespace-editor` for this, depending on its configuration). " + "Alternatively, consider disabling the feature by setting " + "`che.infra.kubernetes.namepsace.label` to `false`."); return; } throw new InfrastructureException(kce); } }
Source:
<code>protected HttpResponse get(String url) { <START> return get(url, Maps.<String,String>newHashMap()); <END> }</code><technical_language>Minor: this is cleanest write this. Consider Collections.emptyMap() ImmutableMap.of(), new HashMap<String, String>(). immutable, I prefer maps immutable default</technical_language>

Target:
protected HttpResponse get(String url) { return get(url, Collections.<String,String>emptyMap()); }
Source:
<code><START> public List<ACGroup> getGroups(SessionId sessionId, ACOrgUnitId orgUnitId) throws ESException { <END> checkForNulls(sessionId, orgUnitId); getAccessControl().getAuthorizationService().checkProjectAdminAccess( sessionId.toAPI(), null); final List<ACGroup> result = new ArrayList<ACGroup>(); final ACOrgUnit<?> orgUnit = getOrgUnit(orgUnitId); for (final ACGroup group : getGroups()) { if (group.getMembers().contains(orgUnit)) { final ACGroup copy = ModelUtil.clone(group); clearMembersFromGroup(copy); result.add(copy); } } return result; }</code><technical_language>Do need call removeInvisibleOrgUnits well</technical_language>

Target:
public List<ACGroup> getGroups(SessionId sessionId, ACOrgUnitId orgUnitId) throws ESException { checkForNulls(sessionId, orgUnitId); getAccessControl().getAuthorizationService().checkProjectAdminAccess( sessionId.toAPI(), null); final List<ACGroup> result = new ArrayList<ACGroup>(); final ACOrgUnit<?> orgUnit = getOrgUnit(orgUnitId); for (final ACGroup group : getGroups()) { if (group.getMembers().contains(orgUnit)) { final ACGroup copy = ModelUtil.clone(group); clearMembersFromGroup(copy); result.add(copy); } } return removeInvisibleOrgUnits(result, sessionId.toAPI()); }
Source:
<code>public PropertiesExpander(Properties properties) { if (properties == null) { throw new IllegalArgumentException("cannot pass null"); } values = new HashMap<>(properties.size()); for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) { final String name = (String) e.nextElement(); <START> String val = properties.getProperty(name); <END> val = resolveValue(properties, name, val, new HashSet<>()); values.put(name, val); } }</code><technical_language>val -></technical_language>

Target:
public PropertiesExpander(Properties properties) { if (properties == null) { throw new IllegalArgumentException("cannot pass null"); } values = new HashMap<>(properties.size()); for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) { final String name = (String) e.nextElement(); String value = properties.getProperty(name); value = resolveValue(properties, name, value, new HashSet<>()); values.put(name, value); } }
Source:
<code>public void visitSwitchStatement(SwitchStatementTree tree) { Set<Tree> caseExpressions = new HashSet<>(); CaseClauseTree lastCaseClause = null; for (CaseClauseTree caseClause : Iterables.filter(tree.cases(), CaseClauseTree.class)) { addCaseExpression(caseExpressions, caseClause.expression()); lastCaseClause = caseClause; } Map<Tree, CfgBlock> caseClauseBlocksByTree = caseClauseBlocksByTree(tree); SwitchClauseTree previousClauseWithStatement = null; for (SwitchClauseTree switchClause : tree.cases()) { if (previousClauseWithStatement != null) { CfgBlock caseBlock; if (switchClause.is(Kind.CASE_CLAUSE)) { <START> caseBlock = ControlFlowGraph.trueSuccessorFor(caseClauseBlocksByTree.get(switchClause)); <END> } else { caseBlock = ControlFlowGraph.falseSuccessorFor(caseClauseBlocksByTree.get(lastCaseClause)); } if (canBeFallenInto(switchClause, caseBlock, caseExpressions) || hasOnlyEmptyStatements(previousClauseWithStatement)) { addIssue(previousClauseWithStatement.keyword(), MESSAGE); } } if (!switchClause.statements().isEmpty()) { previousClauseWithStatement = switchClause; } } super.visitSwitchStatement(tree); }</code><technical_language>@pynicolas fixed b6229cc713c75b2a4e8a4e5f378d14e5b03b3eb7</technical_language>

Target:
public void visitSwitchStatement(SwitchStatementTree tree) { Set<Tree> caseExpressions = new HashSet<>(); CaseClauseTree lastCaseClause = null; for (CaseClauseTree caseClause : Iterables.filter(tree.cases(), CaseClauseTree.class)) { addCaseExpression(caseExpressions, caseClause.expression()); lastCaseClause = caseClause; } Map<CaseClauseTree, CfgBranchingBlock> caseClauseBlocksByTree = caseClauseBlocksByTree(tree); SwitchClauseTree previousClauseWithStatement = null; for (SwitchClauseTree switchClause : tree.cases()) { if (previousClauseWithStatement != null) { CfgBlock firstBlockInClauseBody; if (switchClause.is(Kind.CASE_CLAUSE)) { firstBlockInClauseBody = caseClauseBlocksByTree.get(switchClause).trueSuccessor(); } else { firstBlockInClauseBody = caseClauseBlocksByTree.get(lastCaseClause).falseSuccessor(); } if (canBeFallenInto(switchClause, firstBlockInClauseBody, caseExpressions) || hasOnlyEmptyStatements(previousClauseWithStatement)) { addIssue(previousClauseWithStatement.keyword(), MESSAGE); } } if (!switchClause.statements().isEmpty()) { previousClauseWithStatement = switchClause; } } super.visitSwitchStatement(tree); }
Source:
<code>public Filter getFilter() { BooleanQuery query = new BooleanQuery(); <START> BooleanClause.Occur clause = (term.startsWith("-")) ? BooleanClause.Occur.MUST_NOT : BooleanClause.Occur.SHOULD; <END> if (clause == BooleanClause.Occur.MUST_NOT) { query.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST); term = term.substring(1); } if (value instanceof List) { List values = (List) value; for (Object value : values) { query.add(new TermQuery(new Term(term, value.toString())), clause); } } else { query.add(new TermQuery(new Term(term, value.toString())), clause); } return new CachingWrapperFilter(new QueryWrapperFilter(query)); }</code><technical_language>this I feel 2 filters. for inclusion other for exclusion. In other words instead of LuceneQuery.filter LuceneQuery.include LuceneQuery.exclude</technical_language>

Target:
public Filter getFilter() { BooleanQuery query = new BooleanQuery(); for (Map.Entry<String, Object> entry : fieldMap.entrySet()) { String field = entry.getKey(); Object value = entry.getValue(); if (value.getClass().isArray()) { BooleanQuery arrayQuery = new BooleanQuery(); BooleanClause.Occur clause = (field.startsWith("-")) ? BooleanClause.Occur.MUST_NOT : BooleanClause.Occur.SHOULD; if (clause == BooleanClause.Occur.MUST_NOT) { arrayQuery.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST); field = field.substring(1); } Object[] values = (Object[]) value; for (Object val : values) { arrayQuery.add(new TermQuery(new Term(field, val.toString())), clause); } query.add(arrayQuery, BooleanClause.Occur.MUST); } else { query.add(new TermQuery(new Term(field, value.toString())), BooleanClause.Occur.MUST); } } return new CachingWrapperFilter(new QueryWrapperFilter(query)); }
Source:
<code>public void visitJavadocToken(DetailNode detailNode) { final DetailNode textNode; if (detailNode.getType() == JavadocTokenTypes.JAVADOC) { textNode = JavadocUtil.getFirstChild(detailNode); } else { textNode = JavadocUtil.getNextSibling(detailNode); } if (textNode != null && textNode.getType() != JavadocTokenTypes.EOF) { <START> checkWhitespaceAfterAsterisk(textNode); <END> } }</code><technical_language>try encourage Checks do log in visit.... methods. Please refactor this method return boolean a log base result it</technical_language>

Target:
public void visitJavadocToken(DetailNode detailNode) { final DetailNode textNode; if (detailNode.getType() == JavadocTokenTypes.JAVADOC) { textNode = JavadocUtil.getFirstChild(detailNode); } else { textNode = JavadocUtil.getNextSibling(detailNode); } if (textNode != null && textNode.getType() != JavadocTokenTypes.EOF) { final String text = textNode.getText(); final int lastAsteriskPosition = getLastLeadingAsteriskPosition(text); if (!isLast(lastAsteriskPosition, text) && !Character.isWhitespace(text.charAt(lastAsteriskPosition + 1))) { log(textNode.getLineNumber(), textNode.getColumnNumber(), MSG_KEY); } } }
Source:
<code>private void saveTag(String property, String value) { if (!Core.METACARD_TAGS.equals(property)) { LOGGER.trace("Property \"{}\" and value '{}' do not concern metacard tags", property, value); reportNonTagEncountered(); return; } if (StringUtils.isBlank(value)) { LOGGER.debug("Found blank string in query on metacard tags field \"{}\", ignoring", property); return; } <START> Consumer<String> tagUpdateFunction = <END> ruleDeque.isEmpty() ? tags::add : ruleDeque.peekFirst()::foundTag; tagUpdateFunction.accept(value); }</code><technical_language>This is fine a bit odd this instead of if/else</technical_language>

Target:
private void saveTag(String property, String value) { if (!Core.METACARD_TAGS.equals(property)) { LOGGER.trace("Property \"{}\" and value '{}' do not concern metacard tags", property, value); reportNonTagEncountered(); return; } if (StringUtils.isBlank(value)) { LOGGER.debug("Found blank string in query on metacard tags field \"{}\", ignoring", property); return; } if (rules.isEmpty()) { tags.add(value); } else { rules.peekFirst().foundTag(value); } }
Source:
<code>public boolean subscription() throws IOException { return Boolean.parseBoolean( <START> this.item.get(DyFriends.ATTR_SUBSCRIPTION).getS() <END> ); }</code><technical_language>@erimerturk for existing records, subscription attribute ? returns null what? if add default true</technical_language>

Target:
public boolean subscription() throws IOException { boolean subs = true; if (this.item.has(DyFriends.ATTR_SUBSCRIPTION)) { subs = Boolean.parseBoolean( this.item.get(DyFriends.ATTR_SUBSCRIPTION).getS() ); } return subs; }
Source:
<code>public Optional<ExecutionResult> compare(FileElement localFile, FileElement remoteFile, Optional<String> toolName, Optional<Boolean> prompt, boolean gui, Optional<Boolean> trustExitCode, PromptContinueHandler promptHandler, InformNoToolHandler noToolHandler) throws ToolException { String toolNameToUse; if (toolName.isPresent()) { toolNameToUse = toolName.get(); } else { toolNameToUse = getDefaultToolName(gui); } if (StringUtils.isEmptyOrNull(toolNameToUse)) { throw new ToolException( "No <START> tool provided <END> and no defaults configured."); } @SuppressWarnings("boxing") boolean doPrompt = prompt.orElse(isInteractive()); if (doPrompt) { if (!promptHandler.prompt(toolNameToUse)) { return Optional.empty(); } } @SuppressWarnings("boxing") boolean trust = trustExitCode.orElse(config.isTrustExitCode()); return Optional.of( compare(localFile, remoteFile, getTool(toolNameToUse), trust)); }</code><technical_language>"diff tool"</technical_language>

Target:
public Optional<ExecutionResult> compare(FileElement localFile, FileElement remoteFile, Optional<String> toolName, Optional<Boolean> prompt, boolean gui, Optional<Boolean> trustExitCode, PromptContinueHandler promptHandler, InformNoToolHandler noToolHandler) throws ToolException { String toolNameToUse; if (toolName.isPresent()) { toolNameToUse = toolName.get(); } else { toolNameToUse = getDefaultToolName(gui); } if (StringUtils.isEmptyOrNull(toolNameToUse)) { throw new ToolException(JGitText.get().diffToolNotGivenError); } @SuppressWarnings("boxing") boolean doPrompt = prompt.orElse(isInteractive()); if (doPrompt) { if (!promptHandler.prompt(toolNameToUse)) { return Optional.empty(); } } @SuppressWarnings("boxing") boolean trust = trustExitCode.orElse(config.isTrustExitCode()); return Optional.of( compare(localFile, remoteFile, getTool(toolNameToUse), trust)); }
Source:
<code>public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { final String workspaceId = identity.getWorkspaceId(); if (EphemeralWorkspaceUtility.isEphemeral(k8sEnv.getAttributes())) { ephemeralWorkspaceAdapter.provision(k8sEnv, identity); return; } log.debug("Provisioning PVC strategy for workspace '{}'", workspaceId); final Set<String> subPaths = new HashSet<>(); <START> prefixVolumeMountsSubpaths(k8sEnv, identity.getWorkspaceId(), subPaths); <END> String commonPVCName = getCommonPVCName(identity); final PersistentVolumeClaim commonPVC = newPVC(commonPVCName, pvcAccessMode, pvcQuantity); k8sEnv.getPersistentVolumeClaims().clear(); k8sEnv.getPersistentVolumeClaims().put(commonPVCName, commonPVC); replacePodsVolumesWithCommon(k8sEnv.getPodsData(), commonPVCName); provisionCheVolumes(k8sEnv, workspaceId, commonPVCName, subPaths); if (preCreateDirs && !subPaths.isEmpty()) { commonPVC.setAdditionalProperty( format(SUBPATHS_PROPERTY_FMT, workspaceId), subPaths.toArray(new String[subPaths.size()])); } log.debug("PVC strategy provisioning done for workspace '{}'", workspaceId); }</code><technical_language>idea for code simplification - move new pvc creation replacement a separate method return new pvc for reuse</technical_language>

Target:
public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { final String workspaceId = identity.getWorkspaceId(); if (EphemeralWorkspaceUtility.isEphemeral(k8sEnv.getAttributes())) { ephemeralWorkspaceAdapter.provision(k8sEnv, identity); return; } log.debug("Provisioning PVC strategy for workspace '{}'", workspaceId); prefixVolumeMountsSubpaths(k8sEnv, identity.getWorkspaceId()); PersistentVolumeClaim commonPVC = replacePVCsWithCommon(k8sEnv, identity); replacePodsVolumesWithCommon(k8sEnv.getPodsData(), commonPVC.getMetadata().getName()); provisionCheVolumes(k8sEnv, workspaceId, commonPVC.getMetadata().getName()); if (preCreateDirs) { Set<String> subPaths = combineVolumeMountsSubpaths(k8sEnv); if (!subPaths.isEmpty()) { commonPVC.setAdditionalProperty( format(SUBPATHS_PROPERTY_FMT, workspaceId), subPaths.toArray(new String[subPaths.size()])); } } log.debug("PVC strategy provisioning done for workspace '{}'", workspaceId); }
Source:
<code>protected String runTask() throws Exception { List<String> compactionKeyspaces = new ArrayList<String>(); final Map<String, List<String>> columnFamilyFilter = updateCompactionCFList(config); if (columnFamilyFilter == null || columnFamilyFilter.isEmpty()) { logger.warn("No op on requested \"compaction\" as there are no keyspaces."); return compactionKeyspaces.toString(); } for (Map.Entry<String, List<String>> entry : columnFamilyFilter.entrySet()) { String keyspace = entry.getKey(); List<String> columnfamilies = entry.getValue(); if (!cassandraOperations.getKeyspaces().contains(keyspace)) { logger.error("Keyspace: configured for compaction does not exist!", keyspace); continue; } if (SchemaConstant.isSystemKeyspace(keyspace)) continue; try { if (columnfamilies == null || columnfamilies.isEmpty()) <START> cassandraOperations.forceKeyspaceCompaction(keyspace, null); <END> else for (String columnfamily : columnfamilies) { try { cassandraOperations.forceKeyspaceCompaction(keyspace, columnfamily); } catch (IOException | InterruptedException | ExecutionException e) { throw new Exception("Exception while compacting keyspace: " + keyspace + ", columnfamily: " + columnfamily, e); } } compactionKeyspaces.add(keyspace); } catch (Exception e) { throw new Exception("Exception while compacting keyspace: " + keyspace, e); } } return compactionKeyspaces.toString(); }</code><technical_language>get this code path, considering updateCompactionCFList logic above</technical_language>

Target:
protected String runTask() throws Exception { final Map<String, List<String>> columnfamilies = getCompactionFilterCfs(config); if (!columnfamilies.isEmpty()) for (Map.Entry<String, List<String>> entry : columnfamilies.entrySet()) { cassandraOperations.forceKeyspaceCompaction(entry.getKey(), entry.getValue().toArray(new String[0])); } return columnfamilies.toString(); }
Source:
<code>static void finishOperation(final long extraDataCounter) { if (!trackTime) { return; } final Queue<TimerEntry> queue = TIMER_ENTRIES.get(); final TimerEntry timerEntry = queue.remove(); TimedResult result = ACCUMULATED_RESULTS.get(timerEntry.operation); if (result == null) { ACCUMULATED_RESULTS.putIfAbsent(timerEntry.operation, new TimedResult()); <START> result = ACCUMULATED_RESULTS.get(timerEntry.operation); <END> } final long delta = result.accumulate(timerEntry, extraDataCounter); if (!queue.isEmpty()) { queue.peek().inNestedOperations += delta; } }</code><technical_language>Is assign putIfAbsent call a get</technical_language>

Target:
static void finishOperation(final long extraDataCounter) { if (!trackTime) { return; } final Queue<TimerEntry> queue = TIMER_ENTRIES.get(); final TimerEntry timerEntry = queue.remove(); TimedResult result = ACCUMULATED_RESULTS.get(timerEntry.operation); if (result == null) { ACCUMULATED_RESULTS.putIfAbsent(timerEntry.operation, new TimedResult()); result = ACCUMULATED_RESULTS.get(timerEntry.operation); } final long delta = result.accumulate(timerEntry, extraDataCounter); if (!queue.isEmpty()) { queue.peek().inNestedOperationsNanos += delta; } }
Source:
<code><START> public GeoNearOperation(NearQuery nearQuery, String distanceField) { <END> Assert.notNull(nearQuery); Assert.notNull(distanceField, "DistanceField must not be null."); this.nearQuery = nearQuery; this.distanceField = distanceField; }</code><technical_language>I overload constructor break existing clients constructor. I suggest add a hint favor Aggregation.geoNear( ) constructors directly. do for of operation constructors a static factory method equivalent in Aggregation</technical_language>

Target:
public GeoNearOperation(NearQuery nearQuery, String distanceField) { Assert.notNull(nearQuery, "NearQuery must not be null."); Assert.hasLength(distanceField, "DistanceField must not be null or empty."); this.nearQuery = nearQuery; this.distanceField = distanceField; }
Source:
<code>public void testBug477090() throws CorruptObjectException { checker.setSafeForMacOS(true); <START> final byte[] <END> bytes = { (byte) 0xE2, (byte) 0x88, (byte) 0x9E, 0x2E, 0x68, 0x74, 0x6D, 0x6C }; checker.checkPathSegment(bytes, 0, bytes.length); }</code><technical_language>is JGit community consensus final variables? -used -only member variables final -... I looked in contribution guide I find final variables</technical_language>

Target:
public void testBug477090() throws CorruptObjectException { checker.setSafeForMacOS(true); final byte[] bytes = { (byte) 0xe2, (byte) 0x88, (byte) 0x9e, 0x2e, 0x68, 0x74, 0x6d, 0x6c }; checker.checkPathSegment(bytes, 0, bytes.length); }
Source:
<code>protected abstract String[] doGetExternalRoleListOfUser(String userName, String filter) throws UserStoreException; protected abstract String[] doGetSharedRoleListOfUser(String userName, String tenantDomain, String filter) throws UserStoreException; protected abstract void doAddRole(String roleName, String[] userList, boolean shared) throws UserStoreException; protected abstract void doDeleteRole(String roleName) throws UserStoreException; protected abstract void doUpdateRoleName(String roleName, String newRoleName) throws UserStoreException; protected abstract String[] doGetRoleNames(String filter, int maxItemLimit) throws UserStoreException; protected abstract String[] doListUsers(String filter, int maxItemLimit) throws UserStoreException; <START> public abstract Long doCountClaims(String claimURI, String valueFilter) throws UserStoreException; <END> protected abstract String[] doGetDisplayNamesForInternalRole(String[] userNames) throws UserStoreException; private boolean validateUserNameAndCredential(String userName, Object credential) throws UserStoreException { boolean isValid = true; if (userName == null || credential == null) { String message = String.format(ErrorMessages.ERROR_CODE_ERROR_WHILE_PRE_AUTHENTICATION.getMessage(), "Authentication failure. Either Username or Password is null"); handleOnAuthenticateFailure(ErrorMessages.ERROR_CODE_ERROR_WHILE_PRE_AUTHENTICATION.getCode(), message, userName, credential); log.error(message); isValid = false; } return isValid; }</code><technical_language>If introduce new abstract methods AbstractUserStoreManager break existing implementations. implement method preserve compatibility</technical_language>

Target:
protected abstract String[] doGetExternalRoleListOfUser(String userName, String filter) throws UserStoreException; protected abstract String[] doGetSharedRoleListOfUser(String userName, String tenantDomain, String filter) throws UserStoreException; protected abstract void doAddRole(String roleName, String[] userList, boolean shared) throws UserStoreException; protected abstract void doDeleteRole(String roleName) throws UserStoreException; protected abstract void doUpdateRoleName(String roleName, String newRoleName) throws UserStoreException; protected abstract String[] doGetRoleNames(String filter, int maxItemLimit) throws UserStoreException; protected abstract String[] doListUsers(String filter, int maxItemLimit) throws UserStoreException; public long doCountUsersWithClaims(String claimURI, String valueFilter) throws UserStoreException { throw new UserStoreException("Operation is not supported"); }
Source:
<code>private void updateDisplay() { if (!isAdded() || getView() == null) { return; } boolean hasThemes = getAdapter().getUnfilteredCount() > 0; boolean hasVisibleThemes = getAdapter().getCount() > 0; boolean hasNoMatchingThemes = hasThemes && !hasVisibleThemes; <START> mNoThemesView.setVisibility(!hasThemes ? RelativeLayout.VISIBLE : RelativeLayout.GONE); <END> if (!hasThemes && !NetworkUtils.isNetworkAvailable(getActivity())) { mNoThemesText.setText(R.string.no_network_title); } mGridView.setVisibility(hasVisibleThemes ? RelativeLayout.VISIBLE : RelativeLayout.GONE); mNoMatchesView.setVisibility(hasNoMatchingThemes ? RelativeLayout.VISIBLE : RelativeLayout.GONE); }</code><technical_language>I original code RelativeLayout.VISIBLE/GONE, do mind switching View.GONE/VISIBLE for consistency rest of codebase</technical_language>

Target:
private void updateDisplay() { if (!isAdded() || getView() == null) { return; } boolean hasThemes = getAdapter().getUnfilteredCount() > 0; boolean hasVisibleThemes = getAdapter().getCount() > 0; boolean hasNoMatchingThemes = hasThemes && !hasVisibleThemes; mEmptyView.setVisibility(!hasThemes ? View.VISIBLE : View.GONE); if (!hasThemes && !NetworkUtils.isNetworkAvailable(getActivity())) { mEmptyTextView.setText(R.string.no_network_title); } mGridView.setVisibility(hasVisibleThemes ? View.VISIBLE : View.GONE); mActionableEmptyView.setVisibility(hasNoMatchingThemes ? View.VISIBLE : View.GONE); }
Source:
<code>public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { Object object= getCompareConfiguration().getProperty(CompareConfiguration.USE_OUTLINE_VIEW); if (object instanceof Boolean && ((Boolean)object).booleanValue()) { if (fOutlinePage != null) { if (fOutlinePage.getControl() != null && fOutlinePage.getControl().isDisposed()) { fOutlinePage = null; } else { return (T) fOutlinePage; } } fOutlinePage= new CompareOutlinePage(this); return (T) fOutlinePage; } } if (key == IShowInSource.class || key == OutlineViewerCreator.class || key == IFindReplaceTarget.class) { Object input = getEditorInput(); if (input != null) { return Adapters.adapt(input, key); } } if (key == IEditorInput.class) { <START> return (T) getEditorInput().getAdapter(IEditorInput.class); <END> } if (key == ITextEditorExtension3.class) { return (T) getEditorInput().getAdapter(ITextEditorExtension3.class); } return super.getAdapter(key); }</code><technical_language>Adapters.adapt(getEditorInput(), IEditorInput.class)</technical_language>

Target:
public <T> T getAdapter(Class<T> key) { if (key.equals(IContentOutlinePage.class)) { Object object= getCompareConfiguration().getProperty(CompareConfiguration.USE_OUTLINE_VIEW); if (object instanceof Boolean && ((Boolean)object).booleanValue()) { if (fOutlinePage != null) { if (fOutlinePage.getControl() != null && fOutlinePage.getControl().isDisposed()) { fOutlinePage = null; } else { return (T) fOutlinePage; } } fOutlinePage= new CompareOutlinePage(this); return (T) fOutlinePage; } } if (key == IShowInSource.class || key == OutlineViewerCreator.class || key == IFindReplaceTarget.class) { Object input = getEditorInput(); if (input != null) { return Adapters.adapt(input, key); } } if (key == IEditorInput.class) { return (T) Adapters.adapt(getEditorInput(), IEditorInput.class); } if (key == ITextEditorExtension3.class) { return (T) Adapters.adapt(getEditorInput(), ITextEditorExtension3.class); } return super.getAdapter(key); }
Source:
<code>private void initializeHandler(Thing thing) { if (isInitializable(thing)) { ThingStatusInfo statusInfo = buildStatusInfo(ThingStatus.INITIALIZING, ThingStatusDetail.NONE); setThingStatus(thing, statusInfo); initializeHandler(thing, thing.getHandler()); } else { <START> logger.debug("Thing '{}' not initializeable, check required configuration parameters.", thing.getUID()); <END> ThingStatusInfo statusInfo = buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.HANDLER_CONFIGURATION_PENDING); setThingStatus(thing, statusInfo); } }</code><technical_language>typo: initializable</technical_language>

Target:
private void initializeHandler(Thing thing) { if (isInitializable(thing)) { ThingStatusInfo statusInfo = buildStatusInfo(ThingStatus.INITIALIZING, ThingStatusDetail.NONE); setThingStatus(thing, statusInfo); initializeHandler(thing, thing.getHandler()); } else { logger.debug("Thing '{}' not initializable, check required configuration parameters.", thing.getUID()); ThingStatusInfo statusInfo = buildStatusInfo(ThingStatus.UNINITIALIZED, ThingStatusDetail.HANDLER_CONFIGURATION_PENDING); setThingStatus(thing, statusInfo); } }
Source:
<code>protected String[] addUserIdToParams(String userId, String[] params) { <START> List<String> list = new ArrayList<String>(); <END> list.add(Const.ParamsNames.USER_ID); list.add(userId); for (String s : params) { list.add(s); } return list.toArray(new String[list.size()]); }</code><technical_language>Revert this line</technical_language>

Target:
protected String[] addUserIdToParams(String userId, String[] params) { List<String> list = new ArrayList<>(); list.add(Const.ParamsNames.USER_ID); list.add(userId); for (String s : params) { list.add(s); } return list.toArray(new String[list.size()]); }
Source:
<code>public String getDisplayName() { <START> String s = ""; <END> if(getMetadataBlock() == null){ s = title; } else { s = BundleUtil.getStringFromPropertyFile( "datasetfieldtype."+getName()+".title" , getMetadataBlock().getName() ); } if (isHasParent() && !parentDatasetFieldType.getTitle().equals(s)) { return parentDatasetFieldType.getTitle() + " " + s; } else { return s; } }</code><technical_language>a variable name "s" (also places, metadatablock null? if nowhere, I simplify logic here)</technical_language>

Target:
public String getDisplayName() { String _title = ""; if(getMetadataBlock() == null){ _title = title; } else { _title = BundleUtil.getStringFromPropertyFile( "datasetfieldtype."+getName()+".title" , getMetadataBlock().getName() ); } if (isHasParent() && !parentDatasetFieldType.getTitle().equals(_title)) { return parentDatasetFieldType.getTitle() + " " + _title; } else { return _title; } }
Source:
<code>public void arrayType() { Type type = parseType("int[]"); assertTrue(type.isArrayType()); ArrayType arrayType = type.asArrayType(); final ArrayType[] s = new ArrayType[1]; <START> type.ifArrayType(t -> s[0] = (ArrayType)t); <END> assertNotNull(s[0]); }</code><technical_language>Huh? point is a cast necessary</technical_language>

Target:
public void arrayType() { Type type = parseType("int[]"); assertTrue(type.isArrayType()); ArrayType arrayType = type.asArrayType(); final ArrayType[] s = new ArrayType[1]; type.ifArrayType(t -> s[0] = t); assertNotNull(s[0]); }
Source:
<code>protected CertificateAndPrivateKey createCertificateAndPrivateKey() { final CertificateAndKeyPair certificateAndKeyPair = X509CertificateFactory.get(agentProxy, identity, getUser()); try { Files.createDirectories(HELIOS_HOME); final String certData = X509CertificateFactory.CERT_ENCODING .encode(certificateAndKeyPair.getCertificate().getEncoded()); <START> final String certPem = String.format("%1$s\n%2$s\n%3$s", <END> "-----BEGIN CERTIFICATE-----", certData, "-----END CERTIFICATE-----"); final String keyData = X509CertificateFactory.CERT_ENCODING .encode(certificateAndKeyPair.getKeyPair().getPrivate().getEncoded()); final String keyPem = String.format("%1$s\n%2$s\n%3$s", "-----BEGIN PRIVATE KEY-----", keyData, "-----END PRIVATE KEY-----"); final Set<StandardOpenOption> options = ImmutableSet.of(CREATE, WRITE); final Set<PosixFilePermission> perms = ImmutableSet.of(PosixFilePermission.OWNER_READ, PosixFilePermission.OWNER_WRITE); final FileAttribute<Set<PosixFilePermission>> attrs = PosixFilePermissions.asFileAttribute(perms); try (final SeekableByteChannel sbc = Files.newByteChannel(cacheCertrificatePath, options, attrs)) { sbc.write(ByteBuffer.wrap(certPem.getBytes())); } try (final SeekableByteChannel sbc = Files.newByteChannel(cacheKeyPath, options, attrs)) { sbc.write(ByteBuffer.wrap(keyPem.getBytes())); } log.debug("cached generated certificate to {}", cacheCertrificatePath); } catch (IOException | CertificateEncodingException e) { log.warn("error caching generated certificate - {}", e); } return CertificateAndPrivateKey.from(certificateAndKeyPair); }</code><technical_language>ordinary indexing here, %s\n%s\n%s? I explicit indexing syntax, ordinary indexing is more readable</technical_language>

Target:
protected CertificateAndPrivateKey createCertificateAndPrivateKey() { return x509CertificateFactory.get(agentProxy, identity, getUser()); }
Source:
<code>public void goToNewsDetail(final News news) { final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity()); Intent intent; boolean shouldOpenLink = pref.getBoolean(Constants.CONFIG_SHOW_LINK, true); if (pref.getBoolean(Constants.CONFIG_EXTERNAL_BROWSER, false)) { intent = new Intent(getActivity(), NewsCommentsActivity.class); boolean isURLValid = news.getUrl() != null && !news.getUrl().isEmpty(); if (shouldOpenLink && isURLValid) { new Handler().postDelayed(new Runnable() { @Override public void run() { ActionUtil.open(getActivity(), news); } }, 300); <START> } else if (!shouldOpenLink) { <END> intent = new Intent(getActivity(), NewsCommentsActivity.class); } } else { intent = new Intent(getActivity(), NewsDetailActivity.class); } openedNews = news; intent.putExtra(Constants.NEWS, Parcels.wrap(news)); startActivity(intent); }</code><technical_language>I realized, this else is unused</technical_language>

Target:
public void goToNewsDetail(final News news) { final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity()); Intent intent; boolean shouldOpenLink = pref.getBoolean(Constants.CONFIG_SHOW_LINK, true); if (pref.getBoolean(Constants.CONFIG_EXTERNAL_BROWSER, false)) { intent = new Intent(getActivity(), NewsCommentsActivity.class); boolean isURLValid = news.getUrl() != null && !news.getUrl().isEmpty(); if (shouldOpenLink && isURLValid) { new Handler().postDelayed(new Runnable() { @Override public void run() { ActionUtil.open(getActivity(), news); } }, 300); } } else { intent = new Intent(getActivity(), NewsDetailActivity.class); } openedNews = news; intent.putExtra(Constants.NEWS, Parcels.wrap(news)); startActivity(intent); }
Source:
<code>public PlaintextAuthenticateRequest(final String username, final String password) { super(KEY); <START> this.username = username; <END> this.password = password; }</code><technical_language>Null check</technical_language>

Target:
public PlaintextAuthenticateRequest(final String username, final String password) { super(KEY); this.username = checkNotNull(username); this.password = checkNotNull(password); }
Source:
<code>public Image getSizedWebImage(URI sourceUri, int width) throws IOException { if (!new File(sourceUri).exists()) { throw new FileNotFoundException("sourceUri must exist: " + sourceUri.getRawPath()); } if (width <= 0) { throw new IllegalArgumentException("width must be > 0, but was " + Integer.toString(width)); } File tempFile = File.createTempFile("sizedWebImage-", WEB_IMAGE_FORMAT, TMPDIR); try { <START> tempFile.deleteOnExit(); <END> URI webImageUri = tempFile.toURI(); ImageConverter imageConverter = new ImageConverter(sourceUri); imageConverter.addResult(webImageUri).resizeToWidth(width); logger.info("Generating sized web image from as {}, width px", sourceUri, tempFile, width); imageConverter.run(); logger.trace("Loading {}", tempFile); Image buffer = ImageIO.read(tempFile); logger.trace("{} successfully loaded", tempFile); return buffer; } finally { logger.debug("Deleting {}", tempFile); tempFile.delete(); logger.trace("Successfully deleted {}", tempFile); } }</code><technical_language>question above</technical_language>

Target:
public Image getSizedWebImage(URI sourceUri, int width) throws IOException { if (!new File(sourceUri).exists()) { throw new FileNotFoundException("sourceUri must exist: " + sourceUri.getRawPath()); } if (width <= 0) { throw new IllegalArgumentException("width must be > 0, but was " + Integer.toString(width)); } return summarize("sizedWebImage-", WEB_IMAGE_FORMAT, sourceUri, λ -> λ.resizeToWidth(width), "Generating sized web image from as {}, width px", width); }
Source:
<code>private static void checkPrintfStyle(SubscriptionContext ctx) { BinaryExpression expression = (BinaryExpression) ctx.syntaxNode(); StringLiteral formatString = extractStringLiteral(expression.leftOperand()); if (formatString == null) { return; } Optional<StringFormat> formatOptional = StringFormat.createFromPrintfStyle(ctx, expression.leftOperand(), formatString); if (!formatOptional.isPresent()) { return; } StringFormat format = formatOptional.get(); Expression rhs = expression.rightOperand(); <START> if (format.numExpectedArguments() == 0 && (isMapping(rhs) || rhs.type().canOnlyBe("list"))) { <END> return; } if (format.hasNamedFields()) { checkNamed(ctx, format, rhs); } else { checkPositional(ctx, format, rhs); } }</code><technical_language>minor: for "list" BuiltinTypes.LIST</technical_language>

Target:
private static void checkPrintfStyle(SubscriptionContext ctx) { BinaryExpression expression = (BinaryExpression) ctx.syntaxNode(); StringLiteral formatString = extractStringLiteral(expression.leftOperand()); if (formatString == null) { return; } Optional<StringFormat> formatOptional = StringFormat.createFromPrintfStyle(ctx, expression.leftOperand(), formatString); if (!formatOptional.isPresent()) { return; } StringFormat format = formatOptional.get(); Expression rhs = expression.rightOperand(); if (format.numExpectedArguments() == 0 && (isMapping(rhs) || rhs.type().canOnlyBe(BuiltinTypes.LIST))) { return; } if (format.hasNamedFields()) { checkNamed(ctx, format, rhs); } else { checkPositional(ctx, format, rhs); } }
Source:
<code>public ClusteringServiceConfiguration(URI clusterUri, boolean autoCreate, ServerSideConfiguration serverConfig) { <START> this(clusterUri, DEFAULT_OPERATION_TIMEOUT, autoCreate, serverConfig); <END> }</code><technical_language>calling a deprecated constructor a non-deprecated one</technical_language>

Target:
public ClusteringServiceConfiguration(URI clusterUri, boolean autoCreate, ServerSideConfiguration serverConfig) { this(clusterUri, Timeouts.DEFAULT, autoCreate, serverConfig); }
Source:
<code>protected void connectAllHostsToStorage(List<String> connectionIds) { List<StorageServerConnections> connections = getDbFacade().getStorageServerConnectionDao().getByIds(connectionIds); List<VDS> hosts = getVdsDAO().getAllForStoragePool(getIscsiBond().getStoragePoolId()); <START> <END> for (VDS host : hosts) { if (host.getStatus() == VDSStatus.Up) { List<StorageServerConnections> conns = ISCSIStorageHelper.updateIfaces(connections, host.getId()); runVdsCommand(VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(host.getId(), Guid.Empty, StorageType.ISCSI, conns) ); } } }</code><technical_language>method getVdsDAO().getAllForStoragePoolAndStatus</technical_language>

Target:
protected void connectAllHostsToStorage(List<String> connectionIds) { List<Callable<Void>> tasks = new ArrayList<>(); List<StorageServerConnections> connections = getDbFacade().getStorageServerConnectionDao().getByIds(connectionIds); List<VDS> hosts = getVdsDAO().getAllForStoragePoolAndStatus(getIscsiBond().getStoragePoolId(), VDSStatus.Up); for (final VDS host : hosts) { final List<StorageServerConnections> conns = ISCSIStorageHelper.updateIfaces(connections, host.getId()); tasks.add(new Callable<Void>() { @Override public Void call() throws Exception { runVdsCommand(VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(host.getId(), Guid.Empty, StorageType.ISCSI, conns) ); return null; } }); } ThreadPoolUtil.invokeAll(tasks); }
Source:
<code>public void evictExpiredEntries(int expirationPercentage) { long now = Clock.currentTimeMillis(); int maxIterationCount = getMaxIterationCount(size(), expirationPercentage); int evictedCount = 0; int maxRetry = 3; int loop = 0; <START> while (true) { <END> evictedCount += evictExpiredInternal(maxIterationCount, now); if (evictedCount >= maxIterationCount) { break; } loop++; if (loop > maxRetry) { break; } } }</code><technical_language>while (loop < maxRetry) get rid of extra if break condition</technical_language>

Target:
public void evictExpiredEntries(int expirationPercentage) { long now = Clock.currentTimeMillis(); int maxIterationCount = getMaxIterationCount(size(), expirationPercentage); int evictedCount = 0; int maxRetry = 3; int loop = 0; while (loop < maxRetry) { evictedCount += evictExpiredInternal(maxIterationCount, now); if (evictedCount >= maxIterationCount) { break; } loop++; } }
Source:
<code>public ReadLine(final String line, final String... lineTokens) { this.line = line; String[] tokens = lineTokens; if (!tokens[0].isEmpty() && tokens[0].charAt(0) == '@') { final int tsEnd = tokens[0].indexOf('@', 1); if (tsEnd > -1) { try { final long ts = Long.parseLong(tokens[0].substring(1, tsEnd)); tags.put("tsirc date", tokens[0].substring(1, tsEnd)); tokens[0] = tokens[0].substring(tsEnd + 1); } catch (final NumberFormatException nfe) { } } } if (!tokens[0].isEmpty() && tokens[0].charAt(0) == '@') { final String[] lineTags = tokens[0].substring(1).split(";"); for (final String keyVal : lineTags) { if (!keyVal.isEmpty()) { final String[] keyValue = keyVal.split("=", 2); tags.put(keyValue[0], keyValue.length > 1 ? keyValue[1] : ""); } } tokens = new String[lineTokens.length - 1]; System.arraycopy(lineTokens, 1, tokens, 0, lineTokens.length - 1); } <START> if (!tokens[0].isEmpty() && tokens[0].charAt(0) == '@') { <END> final int tsEnd = tokens[0].indexOf('@', 1); if (tsEnd > -1) { try { final long ts = Long.parseLong(tokens[0].substring(1, tsEnd)); tags.put("tsirc date", tokens[0].substring(1, tsEnd)); tokens[0] = tokens[0].substring(tsEnd + 1); } catch (final NumberFormatException nfe) { } } } this.tokens = tokens; }</code><technical_language>Repeating this is icky :( a tryParseTimestamp() method a tryParseMessageTags() method call</technical_language>

Target:
public ReadLine(final String line, final String... lineTokens) { this.line = line; this.tokens = checkTSIRC(checkMessageTags(checkTSIRC(lineTokens))); }
Source:
<code>public static void main(String[] args) throws IOException, EmbeddingLDAPException { ApacheDirectoryServerActivator apacheDS = new ApacheDirectoryServerActivator(); apacheDS.start(); HTTPMonitoringInterceptor httpMonitoringInterceptor = new HTTPMonitoringInterceptor(); <START> MetricsInterceptor MetricsInterceptor = new MetricsInterceptor(); <END> new MicroservicesRunner() .addGlobalRequestInterceptor(httpMonitoringInterceptor, MetricsInterceptor) .addGlobalResponseInterceptor(httpMonitoringInterceptor, MetricsInterceptor) .deploy(new UserAuthenticationService()) .start(); }</code><technical_language>Variable MetricsInterceptor need start a lowercase letter</technical_language>

Target:
public static void main(String[] args) throws IOException, EmbeddingLDAPException { ApacheDirectoryServerActivator apacheDS = new ApacheDirectoryServerActivator(); apacheDS.start(); HTTPMonitoringInterceptor httpMonitoringInterceptor = new HTTPMonitoringInterceptor(); MetricsInterceptor metricsInterceptor = new MetricsInterceptor(); new MicroservicesRunner() .addGlobalRequestInterceptor(httpMonitoringInterceptor, metricsInterceptor) .addGlobalResponseInterceptor(httpMonitoringInterceptor, metricsInterceptor) .deploy(new UserAuthenticationService()) .start(); }
Source:
<code><START> public static void cancelHadoopTokens(HadoopSecurityManager hadoopSecurityManager, <END> String userToProxy, File tokenFile, Logger log) { try { hadoopSecurityManager.cancelTokens(tokenFile, userToProxy, log); } catch (HadoopSecurityManagerException e) { e.printStackTrace(); log.error(e.getCause() + e.getMessage()); } catch (Exception e) { e.printStackTrace(); log.error(e.getCause() + e.getMessage()); } }</code><technical_language>This method throw exception caller decide do exception. is necessary in Logger</technical_language>

Target:
public static void cancelHadoopTokens(HadoopSecurityManager hadoopSecurityManager, String userToProxy, File tokenFile, Logger log) { try { hadoopSecurityManager.cancelTokens(tokenFile, userToProxy, log); } catch (HadoopSecurityManagerException e) { log.error(e.getCause() + e.getMessage()); } catch (Exception e) { log.error(e.getCause() + e.getMessage()); } }
Source:
<code><START> boolean isGlusterSupportEnabled() { <END> return getVdsGroup().supportsGlusterService() && getParameters().isGlusterPeerProbeNeeded(); }</code><technical_language>protected access modifier instead of default (all-over)</technical_language>

Target:
protected boolean isGlusterSupportEnabled() { return getVdsGroup().supportsGlusterService() && getParameters().isGlusterPeerProbeNeeded(); }
Source:
<code>public void testGetRangeOfTimestampsThrowsOnError() { try { <START> assertFalse("getRangeOfTimestamps must throw on failure", <END> keyValueService.getRangeOfTimestamps(TEST_NONEXISTING_TABLE, RangeRequest.all(), AtlasDbConstants.MAX_TS).hasNext()); } catch (RuntimeException e) { } }</code><technical_language>This change misses case hasNext returns false longer failing test. I right is test return remove catch replace expected=RuntimeException.class Test annotation</technical_language>

Target:
public void testGetRangeOfTimestampsThrowsOnError() { keyValueService.getRangeOfTimestamps(TEST_NONEXISTING_TABLE, RangeRequest.all(), AtlasDbConstants.MAX_TS) .hasNext(); }