auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public long getCountUsersByName(String filter) throws DotDataException { filter = SQLUtil.sanitizeParameter(filter); DotConnect dotConnect = new DotConnect(); boolean isFilteredByName = UtilMethods.isSet(filter); filter = (isFilteredByName ? filter : ""); StringBuffer baseSql = new StringBuffer("select count(*) as count from user_ where companyid = ? and userid <> 'system' "); String userFullName = dotConnect.concat( new String[]{ "firstname", "' '", "lastname" } ); if( isFilteredByName ) { baseSql.append(" and lower("); baseSql.append(userFullName); baseSql.append(") like ?"); } baseSql.append(" and delete_in_progress = "); baseSql.append(DbConnectionFactory.getDBFalse()); String sql = baseSql.toString(); dotConnect.setSQL(sql); Logger.debug( UserFactoryLiferayImpl.class,"::getCountUsersByName -> query: " + dotConnect.getSQL() ); dotConnect.addParam(PublicCompanyFactory.getDefaultCompanyId()); if(isFilteredByName) { dotConnect.addParam("%"+filter.toLowerCase()+"%"); } <START> return dotConnect.getInt("count"); <END> }</code><technical_language>![CRITICAL](<LINK_0> 'Severity: CRITICAL') Define a constant instead of duplicating this literal "count" 3 times. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public long getCountUsersByName(String filter) throws DotDataException { filter = SQLUtil.sanitizeParameter(filter); DotConnect dotConnect = new DotConnect(); boolean isFilteredByName = UtilMethods.isSet(filter); filter = (isFilteredByName ? filter : ""); StringBuilder baseSql = new StringBuilder("select count(*) as count from user_ where companyid = ? and userid <> 'system' "); String userFullName = dotConnect.concat( new String[]{ "firstname", "' '", "lastname" } ); if( isFilteredByName ) { baseSql.append(" and lower("); baseSql.append(userFullName); baseSql.append(") like ?"); } baseSql.append(" and delete_in_progress = "); baseSql.append(DbConnectionFactory.getDBFalse()); String sql = baseSql.toString(); dotConnect.setSQL(sql); Logger.debug( UserFactoryLiferayImpl.class,"::getCountUsersByName -> query: " + dotConnect.getSQL() ); dotConnect.addParam(PublicCompanyFactory.getDefaultCompanyId()); if(isFilteredByName) { dotConnect.addParam("%"+filter.toLowerCase()+"%"); } return dotConnect.getInt("count"); }
Source:
<code>public void testSetUnaryTestsWhenUnaryTestsIsNull() { final ItemDefinition wb = mock(ItemDefinition.class); final UnaryTests wbAllowedValues = mock(UnaryTests.class); final org.kie.dmn.model.api.ItemDefinition dmn = mock(org.kie.dmn.model.api.ItemDefinition.class); final org.kie.dmn.model.api.UnaryTests dmnAllowedValues = null; when(dmn.getAllowedValues()).thenReturn(dmnAllowedValues); setUnaryTests(wb, dmn); <START> verify(wb, never()).setAllowedValues(any()); <END> verify(wbAllowedValues, never()).setParent(any()); }</code><technical_language>I changing _nature_ of test; explicit instances _any_</technical_language>

Target:
public void testSetUnaryTestsWhenUnaryTestsIsNull() { final ItemDefinition wb = mock(ItemDefinition.class); final UnaryTests wbAllowedValues = mock(UnaryTests.class); final org.kie.dmn.model.api.ItemDefinition dmn = mock(org.kie.dmn.model.api.ItemDefinition.class); final org.kie.dmn.model.api.UnaryTests dmnAllowedValues = null; when(dmn.getAllowedValues()).thenReturn(dmnAllowedValues); setUnaryTests(wb, dmn); verify(wb, never()).setAllowedValues(wbAllowedValues); verify(wbAllowedValues, never()).setParent(wb); }
Source:
<code>public PackFile(File packFile, int extensions) { <START> this.packFile = <END> new PackFileName(packFile); this.packLastModified = (int) (packFile.lastModified() >> 10); this.extensions = extensions; hash = System.identityHashCode(this) * 31; length = Long.MAX_VALUE; }</code><technical_language>this field name is confusing parameter passed constructor is a File this is a PackFileName, packFileName</technical_language>

Target:
public PackFile(File packFile, int extensions) { this.packFileName = new PackFileName(packFile); this.packLastModified = (int) (packFileName.lastModified() >> 10); this.extensions = extensions; hash = System.identityHashCode(this) * 31; length = Long.MAX_VALUE; }
Source:
<code>public <START> BackendClusterEnabledFeaturesResource(ClusterResource parent, String <END> clusterId) { this(); this.clusterId = clusterId; }</code><technical_language>This needed. I constructor is enough, put here: super(ClusterFeature.class, ...); this.clusterId = clusterId; consider Guid instead of String for type of "clusterId" field. caller of this constructor converted already</technical_language>

Target:
public BackendClusterEnabledFeaturesResource(ClusterResource parent, String clusterId) { super(ClusterFeature.class, org.ovirt.engine.core.common.businessentities.AdditionalFeature.class); this.clusterId = clusterId; }
Source:
<code>public Integer call() throws Exception { final ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); final TProtocol streamProtocol = new TBinaryProtocol.Factory().getProtocol(new TIOStreamTransport(baos)); do { final Span span = queue.poll(5, TimeUnit.SECONDS); if (span != null) { baos.reset(); try { span.write(streamProtocol); final KeyedMessage<byte[], byte[]> message = new KeyedMessage<>("zipkin", baos.toByteArray()); producer.send(message); numProcessedSpans++; } catch (TException e) { <START> LOGGER.log(Level.WARNING, "TException when writing span.", e); <END> } } } while(!stop); return numProcessedSpans; }</code><technical_language>generally, libraries careful logging WARNING level</technical_language>

Target:
public Integer call() throws Exception { final ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); final TProtocol streamProtocol = new TBinaryProtocol.Factory().getProtocol(new TIOStreamTransport(baos)); do { final Span span = queue.poll(5, TimeUnit.SECONDS); if (span == null) { continue; } baos.reset(); try { span.write(streamProtocol); final ProducerRecord<byte[], byte[]> message = new ProducerRecord<>("zipkin", baos.toByteArray()); producer.send(message); numProcessedSpans++; } catch (TException e) { LOGGER.log(Level.WARNING, "TException when writing span.", e); } } while (!stop); return numProcessedSpans; }
Source:
<code>public static void register(final DataProviderRegistrator registrator) { registrator .asImmutable(BlockState.class) .create(Keys.IS_POWERED) .get(h -> h.get(AbstractButtonBlock.POWERED)) .set((h, v) -> h.with(AbstractButtonBlock.POWERED, v)) <START> .supports(AbstractButtonBlock.class::isInstance); <END> }</code><technical_language>Do buttons store attached direction in state? powered</technical_language>

Target:
public static void register(final DataProviderRegistrator registrator) { registrator .asImmutable(BlockState.class) .create(Keys.IS_POWERED) .get(h -> h.get(AbstractButtonBlock.POWERED)) .set((h, v) -> h.with(AbstractButtonBlock.POWERED, v)) .supports(h -> h.getBlock() instanceof AbstractButtonBlock); }
Source:
<code>public Expr apply(final List<Expr> args) { if (args.size() < 2 || args.size() > 4) { <START> throw new IAE("'%s' must have 2 to 4 arguments", name()); <END> } final Expr arg = args.get(0); if (args.stream().skip(1).allMatch(Expr::isLiteral)) { final PeriodGranularity granularity = getGranularity(args, ExprUtils.nilBindings()); class TimestampFloorExpr implements Expr { @Nonnull @Override public ExprEval eval(final ObjectBinding bindings) { return ExprEval.of(granularity.bucketStart(new DateTime(arg.eval(bindings).asLong())).getMillis()); } @Override public void visit(final Visitor visitor) { arg.visit(visitor); visitor.visit(this); } } return new TimestampFloorExpr(); } else { class TimestampFloorDynamicExpr implements Expr { @Nonnull @Override public ExprEval eval(final ObjectBinding bindings) { final PeriodGranularity granularity = getGranularity(args, bindings); return ExprEval.of(granularity.bucketStart(new DateTime(arg.eval(bindings).asLong())).getMillis()); } @Override public void visit(final Visitor visitor) { arg.visit(visitor); visitor.visit(this); } } return new TimestampFloorDynamicExpr(); } }</code><technical_language>ticks</technical_language>

Target:
public Expr apply(final List<Expr> args) { if (args.size() < 2 || args.size() > 4) { throw new IAE("Function[%s] must have 2 to 4 arguments", name()); } if (args.stream().skip(1).allMatch(Expr::isLiteral)) { return new TimestampFloorExpr(args); } else { return new TimestampFloorDynamicExpr(args); } }
Source:
<code>public static void testSetByte() { <START> final byte[] destination = new byte[POSITIONS_PER_PAGE]; <END> byte[] sourceBytes = new byte[POSITIONS_PER_PAGE]; RANDOM.nextBytes(sourceBytes); List<Byte> source = Bytes.asList(sourceBytes); testSequential( source, ARRAY_BYTE_INDEX_SCALE, destination, (bytes, index, value) -> setByte((byte[]) bytes, (int) index, (byte) value), (bytes, index) -> getByte((byte[]) bytes, (int) index)); source = new ArrayList<Byte>(Collections.nCopies(POSITIONS_PER_PAGE, (byte) 0)); testRandom( source, ARRAY_BYTE_INDEX_SCALE, destination, (bytes, index, value) -> setByte((byte[]) bytes, (int) index, (byte) value), (bytes, index) -> getByte((byte[]) bytes, (int) index)); }</code><technical_language>final local variables is in Presto codebase</technical_language>

Target:
public static void testSetByte() { byte[] source = new byte[POSITIONS_PER_PAGE]; ThreadLocalRandom.current().nextBytes(source); testSequential(Bytes.asList(source), ARRAY_BYTE_INDEX_SCALE, UncheckedByteArrays::setByteUnchecked, UncheckedByteArrays::getByteUnchecked); testRandom(Bytes.asList(source), ARRAY_BYTE_INDEX_SCALE, UncheckedByteArrays::setByteUnchecked, UncheckedByteArrays::getByteUnchecked); }
Source:
<code>protected Vector<URL> filterResources(Vector<URL> urlList) { <START> if (m_useResourceFiltering) { <END> Vector<URL> newUrlList = new Vector<URL>(); Vector<URL> customUrlList = new Vector<URL>(); Enumeration<URL> elements = urlList.elements(); while (elements.hasMoreElements()) { URL resource = elements.nextElement(); newUrlList.add(resource); if (isUrlFromBundlePrefixes(resource)) { customUrlList.add(resource); } } if (!customUrlList.isEmpty()) { urlList = customUrlList; } else { urlList = newUrlList; } } return urlList; }</code><technical_language>Making methods protected overridable is good, member variables private. If override filterResources(), variable m_useResourceFiltering accessed. consider making some private members protected, well. do think</technical_language>

Target:
protected Vector<URL> filterResources(Vector<URL> urlList) { if (isUseResourceFilteringEnabled()) { Vector<URL> newUrlList = new Vector<URL>(); Vector<URL> customUrlList = new Vector<URL>(); Enumeration<URL> resources = urlList.elements(); while (resources != null && resources.hasMoreElements()) { URL resource = resources.nextElement(); newUrlList.add(resource); if (isUrlFromBundlePrefixes(resource)) { customUrlList.add(resource); } } if (!customUrlList.isEmpty()) { urlList = customUrlList; } else { urlList = newUrlList; } } return urlList; }
Source:
<code>private String getValueForRegex(String replacement, Matcher matcher){ String value = replacement; for (String substitution : splitRegexBackReferences(replacement)) { <START> int i = <END> Integer.valueOf(substitution.substring(1)); String _replacement = matcher.groupCount() >= i && matcher.group(i) != null ? Matcher.quoteReplacement(matcher.group(i)) : ""; value = value.replaceFirst("\\" + substitution, _replacement); } return value.trim(); }</code><technical_language>a more descriptive variable name i sort of implies index of for loop</technical_language>

Target:
private String getValueForRegex(String replacement, Matcher matcher){ String value = replacement; for (String substitution : splitRegexBackReferences(replacement)) { int backreference = Integer.valueOf(substitution.substring(1)); String _replacement = matcher.groupCount() >= backreference && matcher.group(backreference) != null ? Matcher.quoteReplacement(matcher.group(backreference)) : ""; value = value.replaceFirst("\\" + substitution, _replacement); } return value.trim(); }
Source:
<code>public void cleanup() { System.out.println("L="); for (int i = 0; i < numRows; ++i) { <START> for (final VectorEntry valueEntry : parameterWorker.pull(i)) { <END> System.out.print(" " + valueEntry.value()); } System.out.println(); } System.out.println("R="); for (int i = 0; i < numColumns; ++i) { for (final VectorEntry valueEntry : parameterWorker.pull(i)) { System.out.print(" " + valueEntry.value()); } System.out.println(); } workload.clear(); }</code><technical_language>parameterWorker.pull(-i) get rows parameter server</technical_language>

Target:
public void cleanup() { System.out.println("L="); for (int i = 1; i <= numRows; ++i) { for (final VectorEntry valueEntry : parameterWorker.pull(-i)) { System.out.print(" " + valueEntry.value()); } System.out.println(); } System.out.println("R'="); for (int i = 1; i <= numColumns; ++i) { for (final VectorEntry valueEntry : parameterWorker.pull(i)) { System.out.print(" " + valueEntry.value()); } System.out.println(); } workload.clear(); }
Source:
<code>public List<TaskState> getTasksPaginated(final int offset, final int limit) { int _offset = 0; <START> int _limit = getTasks().size(); <END> if (offset > 0 && offset < _limit) _offset = offset; if (limit > 0 && limit < _limit) _limit = limit; if (_offset > _limit) { int tmp = _offset; _offset = _limit; _limit = tmp; } return getTasks().subList(_offset, _limit); }</code><technical_language>nice factorize offset limit computation is next method</technical_language>

Target:
public TaskStatesPage getTasksPaginated(final int offset, final int limit) { int total_size = getTasks().size(); PageBoundaries pb = sanitizeBoundaries(getTasks(), offset, limit); return new TaskStatesPage(getTasks().subList(pb.getOffset(), pb.getLimit()), total_size); }
Source:
<code><START> public long <END> getCountOfLoadedCommits() { return countOfLoadedCommits; }</code><technical_language>s/public// This type is visible, methods visible if declared public. In cases avoid public confusing</technical_language>

Target:
long getCountOfLoadedCommits() { return countOfLoadedCommits; }
Source:
<code>public void testDelete() throws InterruptedException { server.enqueue(response202WithHeader()); final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup); <START> vmssAPI.delete(vmssname); <END> assertSent(server, "DELETE", "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/providers/" + "Microsoft.Compute" + "/VirtualMachineScaleSets/jclouds-vmssname?api-version=2017-03-30"); }</code><technical_language>Verify returns a non-null URI</technical_language>

Target:
public void testDelete() throws InterruptedException { server.enqueue(response202WithHeader()); final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup); assertNotNull(vmssAPI.delete(vmssname)); assertSent(server, "DELETE", "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/providers/" + "Microsoft.Compute" + "/VirtualMachineScaleSets/jclouds-vmssname?api-version=2017-03-30"); }
Source:
<code>public boolean isCheckboxEnabled(String sampleName) { String checkboxId = format(CHECKBOX_BY_SAMPLE_NAME_ID_TEMPLATE, sampleName); String checkboxLocator = format(" return seleniumWebDriverHelper <START> .waitVisibilityAndGetAttribute(By.xpath(checkboxLocator), "aria-checked") <END> .equals("true"); }</code><technical_language>"aria-checked" unclear here. Is kind of checkboxCheckedAttribute</technical_language>

Target:
public boolean isCheckboxEnabled(String sampleName) { final String checkboxId = format(CHECKBOX_BY_SAMPLE_NAME_ID_TEMPLATE, sampleName); final String checkboxLocator = format(" final String checkboxStateAttribute = "aria-checked"; return seleniumWebDriverHelper .waitVisibilityAndGetAttribute(By.xpath(checkboxLocator), checkboxStateAttribute) .equals("true"); }
Source:
<code>private void addDefaultProperties(DelegatingResourceDescription description) { description.addProperty("uuid"); description.addProperty("radiologyOrder", Representation.REF); description.addProperty("reportDate"); description.addProperty("reportStatus"); description.addProperty("reportBody"); <START> description.addProperty("principalResultsInterpreter", Representation.REF); <END> description.addProperty("display"); }</code><technical_language>@Schwasrz94 move principalResultsInterpreter reportStatus order in object itself: <LINK_0></technical_language>

Target:
private void addDefaultProperties(DelegatingResourceDescription description) { description.addProperty("uuid"); description.addProperty("radiologyOrder", Representation.REF); description.addProperty("reportDate"); description.addProperty("principalResultsInterpreter", Representation.REF); description.addProperty("reportStatus"); description.addProperty("reportBody"); description.addProperty("display"); }
Source:
<code>public void restrictedGroupAccessForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson memberRestrictGroup = EPersonBuilder.createEPerson(context) .withEmail("eperson1@mail.com") .withPassword("qwerty01") .build(); Group restrictGroup = GroupBuilder.createGroup(context) .addMember(memberRestrictGroup) .build(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .build(); Item itemRestrictedByGroup = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2011-11-13") .withAuthor("Smith, Donald") .withReaderGroup(restrictGroup) .build(); context.restoreAuthSystemState(); String tokenMemberRestrictedGroup = getAuthToken(memberRestrictGroup.getEmail(), "qwerty01"); getClient(tokenMemberRestrictedGroup).perform(get("/api/core/items/" + itemRestrictedByGroup.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", is(ItemMatcher.matchItemProperties(itemRestrictedByGroup)))); String tokenEPerson = getAuthToken(eperson.getEmail(), password); getClient(tokenEPerson).perform(get("/api/core/items/" + itemRestrictedByGroup.getID())) <START> .andExpect(status().isForbidden()); <END> }</code><technical_language>a test verify anonymous users Forbidden</technical_language>

Target:
public void restrictedGroupAccessForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson memberRestrictGroup = EPersonBuilder.createEPerson(context) .withEmail("eperson1@mail.com") .withPassword("qwerty01") .build(); Group restrictGroup = GroupBuilder.createGroup(context) .addMember(memberRestrictGroup) .build(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1") .build(); Item itemRestrictedByGroup = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2011-11-13") .withAuthor("Smith, Donald") .withReaderGroup(restrictGroup) .build(); context.restoreAuthSystemState(); String tokenMemberRestrictedGroup = getAuthToken(memberRestrictGroup.getEmail(), "qwerty01"); getClient(tokenMemberRestrictedGroup).perform(get("/api/core/items/" + itemRestrictedByGroup.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", is(ItemMatcher.matchItemProperties(itemRestrictedByGroup)))); String tokenEPerson = getAuthToken(eperson.getEmail(), password); getClient(tokenEPerson).perform(get("/api/core/items/" + itemRestrictedByGroup.getID())) .andExpect(status().isForbidden()); getClient().perform(get("/api/core/items/" + itemRestrictedByGroup.getID())) .andExpect(status().isUnauthorized()); }
Source:
<code>public TmfModelResponse<List<TmfEventTableColumnDataModel>> fetchTree(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { List<TmfEventTableColumnDataModel> model = new ArrayList<>(); for (ITmfEventAspect<?> aspect : getTraceAspects(getTrace())) { <START> long id = fAspectToIdMap.computeIfAbsent(aspect, a -> fAtomicLong.getAndIncrement()); <END> fIdToAspectMap.putIfAbsent(id, aspect); model.add(new TmfEventTableColumnDataModel(id, -1, aspect.getName(), aspect.getHelpText(), aspect.isHiddenByDefault())); } return new TmfModelResponse<>(model, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); }</code><technical_language>methods computeIfAbsent() putIfAbsent() thread-safe. If threads call fetchTree() concurrently, get ids for aspect. a synchronized block lines, synchronization of maps (they final)</technical_language>

Target:
public TmfModelResponse<List<TmfEventTableColumnDataModel>> fetchTree(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { List<TmfEventTableColumnDataModel> model = new ArrayList<>(); for (ITmfEventAspect<?> aspect : getTraceAspects(getTrace())) { synchronized (fAspectToIdMap) { long id = fAspectToIdMap.computeIfAbsent(aspect, a -> fAtomicLong.getAndIncrement()); fIdToAspectMap.putIfAbsent(id, aspect); model.add(new TmfEventTableColumnDataModel(id, -1, aspect.getName(), aspect.getHelpText(), aspect.isHiddenByDefault())); } } return new TmfModelResponse<>(model, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); }
Source:
<code>private boolean isBuiltInCheckRequired(UpgradeCheck upgradeCheck, UpgradeType upgradeType) { if (upgradeType == null) { return true; } UpgradeCheckInfo annotation = upgradeCheck.getClass().getAnnotation(UpgradeCheckInfo.class); if (null == annotation) { return false; } UpgradeType[] upgradeTypes = annotation.required(); if (ArrayUtils.contains(upgradeTypes, upgradeType)) { <START> return true; <END> } return false; }</code><technical_language>simplify: return ArrayUtils.contains(...)</technical_language>

Target:
private boolean isBuiltInCheckRequired(UpgradeCheck upgradeCheck, UpgradeType upgradeType) { if (upgradeType == null) { return true; } UpgradeCheckInfo annotation = upgradeCheck.getClass().getAnnotation(UpgradeCheckInfo.class); if (null == annotation) { return false; } UpgradeType[] upgradeTypes = annotation.required(); return ArrayUtils.contains(upgradeTypes, upgradeType); }
Source:
<code>private void addDefaultGroup(DbSession dbSession, UserDto userDto) { String defaultGroupName = settings.getString(CoreProperties.CORE_DEFAULT_GROUP); if (defaultGroupName == null) { return; } String defOrgUuid = defaultOrganizationProvider.get().getUuid(); List<GroupDto> userGroups = dbClient.groupDao().selectByUserLogin(dbSession, userDto.getLogin()); <START> if (userGroups.stream().anyMatch(g -> defOrgUuid.equals(g.getOrganizationUuid()) && g.getName().equals(defaultGroupName))) { <END> return; } Optional<GroupDto> groupDto = dbClient.groupDao().selectByName(dbSession, defOrgUuid, defaultGroupName); if (!groupDto.isPresent()) { throw new ServerException(HttpURLConnection.HTTP_INTERNAL_ERROR, format("The default group '%s' for new users does not exist. Please update the general security settings to fix this issue.", defaultGroupName)); } dbClient.userGroupDao().insert(dbSession, new UserGroupDto().setUserId(userDto.getId()).setGroupId(groupDto.get().getId())); }</code><technical_language>suggestion: extract method describe purpose. I write this code</technical_language>

Target:
private void addDefaultGroup(DbSession dbSession, UserDto userDto) { String defaultGroupName = settings.getString(CoreProperties.CORE_DEFAULT_GROUP); if (defaultGroupName == null) { return; } String defOrgUuid = defaultOrganizationProvider.get().getUuid(); List<GroupDto> userGroups = dbClient.groupDao().selectByUserLogin(dbSession, userDto.getLogin()); if (isUserAlreadyMemberOfDefaultGroup(defaultGroupName, defOrgUuid, userGroups)) { return; } Optional<GroupDto> groupDto = dbClient.groupDao().selectByName(dbSession, defOrgUuid, defaultGroupName); if (!groupDto.isPresent()) { throw new ServerException(HttpURLConnection.HTTP_INTERNAL_ERROR, format("The default group '%s' for new users does not exist. Please update the general security settings to fix this issue.", defaultGroupName)); } dbClient.userGroupDao().insert(dbSession, new UserGroupDto().setUserId(userDto.getId()).setGroupId(groupDto.get().getId())); }
Source:
<code>public void testGetWebhook() { for (String zone : api.getConfiguredZones()) { Group g = created.get(zone).get(0); WebhookApi webhookApi; boolean foundWebhook = false; for (ScalingPolicyResponse sp : g.getScalingPolicies()) { webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), sp.getId()); <START> WebhookResponse webhookList = webhookApi.list().first().get(); <END> if (webhookList != null) { WebhookResponse webhookGet = webhookApi.get(webhookList.getId()); assertEquals(webhookList, webhookGet); foundWebhook = true; } } assertTrue(foundWebhook, "No webhooks were found, and some were expected"); } }</code><technical_language>Rename webhookList webhookResponse</technical_language>

Target:
public void testGetWebhook() { for (String zone : api.getConfiguredZones()) { Group g = created.get(zone).get(0); WebhookApi webhookApi; boolean foundWebhook = false; for (ScalingPolicyResponse sp : g.getScalingPolicies()) { webhookApi = api.getWebhookApiForZoneAndGroupAndPolicy(zone, g.getId(), sp.getId()); WebhookResponse webhookResponse = webhookApi.list().first().get(); if (webhookResponse != null) { WebhookResponse webhookGet = webhookApi.get(webhookResponse.getId()); assertEquals(webhookResponse, webhookGet); foundWebhook = true; } } assertTrue(foundWebhook, "No webhooks were found, and some were expected"); } }
Source:
<code>public @Nullable ITmfTreeDataProvider<? extends ITmfTreeDataModel> createProvider(ITmfTrace trace, String secondaryId) { ITmfTreeDataProvider<? extends ITmfTreeDataModel> provider = create(trace, secondaryId); if (provider != null) { return provider; } Collection<ITmfTrace> traces = TmfTraceManager.getTraceSet(trace); if (traces.size() > 1) { <START> return TmfTreeXYCompositeDataProvider.create(traces, Objects.requireNonNull("FlameChart"), FlameChartDataProvider.ID, secondaryId); END> } return null; }</code><technical_language>This externalized</technical_language>

Target:
public @Nullable ITmfTreeDataProvider<? extends ITmfTreeDataModel> createProvider(ITmfTrace trace, String secondaryId) { ITmfTreeDataProvider<? extends ITmfTreeDataModel> provider = create(trace, secondaryId); if (provider != null) { return provider; } Collection<ITmfTrace> traces = TmfTraceManager.getTraceSet(trace); if (traces.size() > 1) { return TmfTreeXYCompositeDataProvider.create(traces, Objects.requireNonNull(Messages.FlameChartDataProvider_Title), FlameChartDataProvider.ID, secondaryId); } return null; }
Source:
<code><START> public void start() { <END> if (!consumerPollThread.isAlive()) { LOG.info("Starting KafkaConsumerProxy polling thread for system " + systemName + " " + this.toString()); consumerPollThread.start(); while (!isRunning) { try { consumerPollThreadStartLatch.await(3000, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOG.info("Got InterruptedException", e); } } } else { LOG.debug("Tried to start an already started KafkaConsumerProxy (%s). Ignoring.", this.toString()); } }</code><technical_language>Do need handle interrupt in consumer poll thread? Existing implementation handle consumer poll thread is interrupted KafkaSystemConsumer.stop()</technical_language>

Target:
public void start() { if (!consumerPollThread.isAlive()) { LOG.info("Starting KafkaConsumerProxy polling thread for " + this.toString()); consumerPollThread.start(); while (!isRunning && failureCause == null) { try { consumerPollThreadStartLatch.await(3000, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOG.info("Ignoring InterruptedException while waiting for consumer poll thread to start.", e); } } } else { LOG.warn("Tried to start an already started KafkaConsumerProxy (%s). Ignoring.", this.toString()); } if (topicPartitionToSSP.size() == 0) { String msg = String.format("Cannot start KafkaConsumerProxy without any registered TopicPartitions for %s", systemName); LOG.error(msg); throw new SamzaException(msg); } }
Source:
<code>public static String fileToBase64String(File isoFile) throws IOException { byte[] encoded = Base64.encodeBase64(FileUtils.readFileToByteArray(isoFile)); <START> return new String(encoded, com.cloud.utils.StringUtils.getPreferredCharset()); <END> }</code><technical_language>default charset MS host. want force in a test</technical_language>

Target:
public static String fileToBase64String(File isoFile) throws IOException { byte[] encoded = Base64.encodeBase64(FileUtils.readFileToByteArray(isoFile)); return new String(encoded, StandardCharsets.US_ASCII); }
Source:
<code>public void testDocumentRemovedCommentEventListener() throws Exception { DocumentModel doc = doCreateADocWithComments(); assertNotNull(doc); List<Comment> comments = commentManager.getComments(session, doc.getId()); assertFalse(comments.isEmpty()); session.removeDocument(doc.getRef()); session.save(); if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } waitForAsyncExec(); <START> DocumentModelList documents = session.query(String.format("Select * From Comment Where %s = '%s'", NXQL.ECM_ANCESTORID, doc.getId())); <END> assertTrue(documents.isEmpty()); }</code><technical_language>write SQL keywords in CAPS</technical_language>

Target:
public void testDocumentRemovedCommentEventListener() throws Exception { DocumentModel doc = doCreateADocWithComments(); assertNotNull(doc); List<Comment> comments = commentManager.getComments(session, doc.getId()); assertFalse(comments.isEmpty()); session.removeDocument(doc.getRef()); session.save(); if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } waitForAsyncExec(); comments = commentManager.getComments(session, doc.getId()); assertTrue(comments.isEmpty()); }
Source:
<code>public List<VDS> listFailedAutorecoverables() { <START> return new SimpleJdbcTemplate(jdbcTemplate).query("select * from vds where recoverable and status = " <END> + VDSStatus.NonOperational.getValue(), VdsRowMapper.instance); }</code><technical_language>please stored procedure here</technical_language>

Target:
public List<VDS> listFailedAutorecoverables() { return getCallsHandler().executeReadList("GetFailingVdss", VdsRowMapper.instance, null); }
Source:
<code>public static PreparedStatement prepareTableSelectStatement(Connection c, String storageKey, String[] fields, String[] values, <START> Persistable p) throws IllegalArgumentException{ <END> org.commcare.modern.database.TableBuilder mTableBuilder = new org.commcare.modern.database.TableBuilder(storageKey); mTableBuilder.addData(p); Pair<String, String[]> mPair = DatabaseHelper.createWhere(fields, values, p); try { String queryString = "SELECT * FROM " + storageKey + " WHERE " + mPair.first + ";"; PreparedStatement preparedStatement = c.prepareStatement(queryString); for (int i = 0; i < mPair.second.length; i++) { preparedStatement.setString(i + 1, mPair.second[i]); } return preparedStatement; } catch (SQLException e) { throw new RuntimeException(e); } }</code><technical_language>IllegalArgumentException is a runtime exception, part of method signatures</technical_language>

Target:
public static PreparedStatement prepareTableSelectStatement(Connection c, String storageKey, String[] fields, String[] values, Persistable p) { org.commcare.modern.database.TableBuilder mTableBuilder = new org.commcare.modern.database.TableBuilder(storageKey); mTableBuilder.addData(p); Pair<String, String[]> mPair = DatabaseHelper.createWhere(fields, values, p); try { String queryString = "SELECT * FROM " + storageKey + " WHERE " + mPair.first + ";"; PreparedStatement preparedStatement = c.prepareStatement(queryString); for (int i = 0; i < mPair.second.length; i++) { preparedStatement.setString(i + 1, mPair.second[i]); } return preparedStatement; } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
<code>public Optional<ValueT> invalidate(final IdT id) { final Optional<ValueT> value = get(id); cache.invalidate(id); <START> value.ifPresent(valueT -> removalListener.accept(new CacheEntry<>(id, valueT))); <END> return value; }</code><technical_language>missing something, is removalListener called explicitly here? invalidate trigger listener already</technical_language>

Target:
public Optional<ValueT> invalidate(final IdT id) { final Optional<ValueT> value = Optional.ofNullable(cache.asMap().remove(id)); value.ifPresent(valueT -> removalListener.accept(id, valueT)); return value; }
Source:
<code>private static AbstractLongAssert<?> assertThatGetConnectonTimeoutForTarget(WebTarget webTarget) { final long startTime = System.currentTimeMillis(); ProcessingException processingException = null; try { webTarget .request() .get(Response.class); } catch (ProcessingException e) { processingException = e; } <START> final long endTime = System.currentTimeMillis(); <END> assertThat(processingException).isNotNull(); assertThat(processingException.getCause()).isNotNull(); assertThat(processingException.getCause()).isInstanceOf(ConnectTimeoutException.class); return assertThat(endTime - startTime); }</code><technical_language>I move this logic exception block throw AssertionError if excption happened. this: java final long startTime = System.currentTimeMillis(); try { webTarget .request() .get(Response.class); throw new AssertionError("Should fail ProcessingException"); } catch (ProcessingException e) { final long endTime = System.currentTimeMillis(); assertThat(e).isNotNull(); //noinspection ConstantConditions assertThat(e.getCause()).isNotNull(); assertThat(e.getCause()).isInstanceOf(ConnectTimeoutException.class); return assertThat(endTime - startTime); }</technical_language>

Target:
private static AbstractLongAssert<?> assertThatGetConnectonTimeoutForTarget(WebTarget webTarget) { final long startTime = System.nanoTime(); try { webTarget .request() .get(Response.class); } catch (ProcessingException e) { final long endTime = System.nanoTime(); assertThat(e).isNotNull(); assertThat(e.getCause()).isNotNull(); assertThat(e.getCause()).isInstanceOf(ConnectTimeoutException.class); return assertThat((endTime - startTime)/1000000); } throw new AssertionError("ProcessingException expected but not thrown"); }
Source:
<code>public Reply<?> findQueryList(@Named("id") String id) { Optional<Operator> operator = repository.findAssociatedOperator(id); if (!operator.isPresent()) { <START> return Reply.saying().notFound(); <END> } IpAddressType type = operator.get().ipAddressType; Integer response = catalog.get(type); return Reply.with(response).ok(); }</code><technical_language>add a message</technical_language>

Target:
public Reply<?> findQueryList(@Named("id") String id) { QueryList queryList = repository.findQueryList(id); QueryListDTO dto = new QueryListDTO(queryList.values); return Reply.with(dto).as(Json.class).ok(); }
Source:
<code>public void testShouldRetainImplicitlyWaitFromTheReturnedWebDriverOfFrameSwitchTo() { <START> driver.manage().timeouts().implicitlyWait(3, SECONDS); <END> driver.get(pages.xhtmlTestPage); driver.findElement(By.name("windowOne")).click(); String handle = (String)driver.getWindowHandles().toArray()[1]; WebDriver newWindow = driver.switchTo().window(handle); long start = System.currentTimeMillis(); newWindow.findElements(By.id("This crazy thing doesn't exist")); long end = System.currentTimeMillis(); long time = end - start; assertTrue(time >= 3000); }</code><technical_language>do a smaller timeout, 1 sufficient</technical_language>

Target:
public void testShouldRetainImplicitlyWaitFromTheReturnedWebDriverOfFrameSwitchTo() { driver.manage().timeouts().implicitlyWait(1, SECONDS); driver.get(pages.xhtmlTestPage); driver.findElement(By.name("windowOne")).click(); String handle = (String)driver.getWindowHandles().toArray()[1]; WebDriver newWindow = driver.switchTo().window(handle); long start = System.currentTimeMillis(); newWindow.findElements(By.id("This crazy thing doesn't exist")); long end = System.currentTimeMillis(); long time = end - start; assertTrue(time >= 1000); }
Source:
<code>public ImmutableSet<E> getTreeFrom(E root, Set<E> endPoints) { final ImmutableSet.Builder<E> builder = ImmutableSet.builder(); builder.addAll(graph.getTreeFrom(root, endPoints)); <START> return builder.build(); <END> }</code><technical_language>question</technical_language>

Target:
public ImmutableSet<E> getTreeFrom(E root, Set<E> endPoints) { return ImmutableSet.copyOf(graph.getTreeFrom(root, endPoints)); }
Source:
<code><START> protected void sharedPeriodic(){ <END> xScheduler.run(); this.updateTelemetrySubsystems(); }</code><technical_language>Space brace</technical_language>

Target:
protected void sharedPeriodic() { xScheduler.run(); this.updateTelemetrySources(); }
Source:
<code>private CreateImageVDSCommandParameters getCreateVDSCommandParameters() { CreateVolumeVDSCommandParameters parameters = new CreateVolumeVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupID(), getParameters().getSrcImageId(), getParameters().getSize(), getType(), getParameters().getVolumeFormat(), getParameters().getSrcImageGroupId(), getParameters().getImageId(), getParameters().getDescription(), getStoragePool().getCompatibilityVersion(), DiskContentType.DATA); if (getType() != VolumeType.Preallocated && getStorageDomain().getStorageType().isBlockDomain()) { parameters.setImageInitialSizeInBytes(Optional.ofNullable(getParameters().getInitialSize()).orElse(0L)); } else if ( <START> FeatureSupported.isDeferringFileVolumePreallocationSupported(getStoragePool().getCompatibilityVersion()) && getType() == VolumeType.Preallocated && getStorageDomain().getStorageType().isFileDomain()) { <END> parameters.setImageInitialSizeInBytes(Optional.ofNullable(getParameters().getInitialSize()).orElse(1L)); } return parameters; }</code><technical_language>This is completely unreadable. like: if (supportsDeferredPrallocation()) { }</technical_language>

Target:
private CreateImageVDSCommandParameters getCreateVDSCommandParameters() { CreateVolumeVDSCommandParameters parameters = new CreateVolumeVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupID(), getParameters().getSrcImageId(), getParameters().getSize(), getType(), getParameters().getVolumeFormat(), getParameters().getSrcImageGroupId(), getParameters().getImageId(), getParameters().getDescription(), getStoragePool().getCompatibilityVersion(), DiskContentType.DATA); if (getType() != VolumeType.Preallocated && getStorageDomain().getStorageType().isBlockDomain()) { parameters.setImageInitialSizeInBytes(Optional.ofNullable(getParameters().getInitialSize()).orElse(0L)); } else if (supportsDeferredPrallocation()) { Long initialSize = Optional.ofNullable(getParameters().getInitialSize()).orElse(1L); parameters.setImageInitialSizeInBytes(initialSize); } return parameters; }
Source:
<code>public void close() { try { recoverableZooKeeper.close(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); <START> } <END> zkEventProcessor.shutdownNow(); }</code><technical_language>wait, put shutdownNow() finally block? executed in case in future, more Exception handling lined if ZK client close throws some runtime exception, perform shutdown of threadpool in finally</technical_language>

Target:
public void close() { try { recoverableZooKeeper.close(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { zkEventProcessor.shutdownNow(); } }
Source:
<code>public void testMessagingGateway() { String payload = "bar"; assertEquals(payload.toUpperCase(), this.testGateway.echo(payload)); assertEquals(payload.toUpperCase() + "2", this.testGateway2.echo2(payload)); StopWatch stopWatch = new StopWatch(); stopWatch.start(); this.testGateway.sendAsync("foo"); stopWatch.stop(); <START> assertThat(stopWatch.getTotalTimeMillis(), Matchers.lessThan(1000L)); <END> }</code><technical_language>verify flow invoked correctly - send a CountDownLatch in payload, AtomicReference<Thread> verify is Thread.currentThread()</technical_language>

Target:
public void testMessagingGateway() throws InterruptedException { String payload = "bar"; assertEquals(payload.toUpperCase(), this.testGateway.echo(payload)); assertEquals(payload.toUpperCase() + "2", this.testGateway2.echo2(payload)); this.testGateway.sendAsync("foo"); assertTrue(this.asyncAnnotationProcessLatch.await(1, TimeUnit.SECONDS)); assertNotSame(Thread.currentThread(), this.asyncAnnotationProcessThread.get()); }
Source:
<code>private static Slice scaleQuantileDigest(Slice input, double scale) { <START> if (scale < 0) { <END> throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "scale factor must be > 0"); } QuantileDigest digest = new QuantileDigest(input); digest.scale(scale); return digest.serialize(); }</code><technical_language>Nit: <= 0 (or < 1e-5 is constant in data structure)</technical_language>

Target:
private static Slice scaleQuantileDigest(Slice input, double scale) { if (scale <= 0) throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Scale factor should be positive."); QuantileDigest digest = new QuantileDigest(input); digest.scale(scale); return digest.serialize(); }
Source:
<code>public void testRemoveIfEmpty() { <START> Collection<Integer> collection = new ArrayList<>(); collection.removeIf(truth); <END> assertTrue(collection.isEmpty()); }</code><technical_language>this is supposed test ? assertion hold of removeIf</technical_language>

Target:
public void testRemoveIfEmpty() { for (Supplier<Collection<Integer>> impl : collectionImpls) { Collection<Integer> collection = impl.get(); collection.removeIf(truth); assertTrue(collection.isEmpty()); } }
Source:
<code>protected String getPreviousPath(Repository repository, ObjectReader reader, RevCommit headCommit, RevCommit previousCommit, String path) throws IOException { <START> TreeWalk walk = new TreeWalk(reader); <END> walk.addTree(previousCommit.getTree()); walk.addTree(headCommit.getTree()); List<DiffEntry> entries = DiffEntry.scan(walk); if (entries.size() < 2) return path; for (DiffEntry diff : entries) if (diff.getChangeType() == ChangeType.MODIFY && path.equals(diff.getNewPath())) return path; RenameDetector detector = new RenameDetector(repository); detector.addAll(entries); List<DiffEntry> renames = detector.compute(walk.getObjectReader(), NullProgressMonitor.INSTANCE); for (DiffEntry diff : renames) if (diff.getChangeType() == ChangeType.RENAME && path.equals(diff.getNewPath())) return diff.getOldPath(); return path; }</code><technical_language>need a recursive tree walk this work for renames in root of repository, if rename e.g. "a/x" "a/y" "a/x" "b/y" a non-recursive tree walk rename</technical_language>

Target:
protected String getPreviousPath(Repository repository, ObjectReader reader, RevCommit headCommit, RevCommit previousCommit, String path) throws IOException { TreeWalk walk = new TreeWalk(reader); walk.setRecursive(true); walk.addTree(previousCommit.getTree()); walk.addTree(headCommit.getTree()); List<DiffEntry> entries = DiffEntry.scan(walk); if (entries.size() < 2) return path; for (DiffEntry diff : entries) if (diff.getChangeType() == ChangeType.MODIFY && path.equals(diff.getNewPath())) return path; RenameDetector detector = new RenameDetector(repository); detector.addAll(entries); List<DiffEntry> renames = detector.compute(walk.getObjectReader(), NullProgressMonitor.INSTANCE); for (DiffEntry diff : renames) if (diff.getChangeType() == ChangeType.RENAME && path.equals(diff.getNewPath())) return diff.getOldPath(); return path; }
Source:
<code>RexNode simplifyAnd2(List<RexNode> terms, List<RexNode> notTerms) { for (RexNode term : terms) { if (term.isAlwaysFalse()) { return rexBuilder.makeLiteral(false); } } if (terms.isEmpty() && notTerms.isEmpty()) { return rexBuilder.makeLiteral(true); } List<RexNode> notSatisfiableNullables = null; for (RexNode notDisjunction : notTerms) { final List<RexNode> terms2 = RelOptUtil.conjunctions(notDisjunction); if (!terms.containsAll(terms2)) { continue; } if (!notDisjunction.getType().isNullable()) { return rexBuilder.makeLiteral(false); } if (notSatisfiableNullables == null) { notSatisfiableNullables = new ArrayList<>(); } notSatisfiableNullables.add(notDisjunction); } if (notSatisfiableNullables != null) { terms.removeAll(notSatisfiableNullables); notTerms.removeAll(notSatisfiableNullables); <START> List<RexNode> nullAndIsNullTerms = new ArrayList<>(); <END> nullAndIsNullTerms.add(rexBuilder.makeNullLiteral(notSatisfiableNullables.get(0).getType())); for (RexNode notSatisfiableNullable : notSatisfiableNullables) { nullAndIsNullTerms.add( simplifyIs((RexCall) rexBuilder.makeCall(SqlStdOperatorTable.IS_NULL, notSatisfiableNullable))); } terms.addAll(nullAndIsNullTerms); } for (RexNode notDisjunction : notTerms) { terms.add( simplify_( rexBuilder.makeCall(SqlStdOperatorTable.NOT, notDisjunction))); } return RexUtil.composeConjunction(rexBuilder, terms, false); }</code><technical_language>Please remove this list. existing terms is fine</technical_language>

Target:
RexNode simplifyAnd2(List<RexNode> terms, List<RexNode> notTerms) { for (RexNode term : terms) { if (term.isAlwaysFalse()) { return rexBuilder.makeLiteral(false); } } if (terms.isEmpty() && notTerms.isEmpty()) { return rexBuilder.makeLiteral(true); } List<RexNode> notSatisfiableNullables = null; for (RexNode notDisjunction : notTerms) { final List<RexNode> terms2 = RelOptUtil.conjunctions(notDisjunction); if (!terms.containsAll(terms2)) { continue; } if (!notDisjunction.getType().isNullable()) { return rexBuilder.makeLiteral(false); } if (notSatisfiableNullables == null) { notSatisfiableNullables = new ArrayList<>(); } notSatisfiableNullables.add(notDisjunction); } if (notSatisfiableNullables != null) { terms.removeAll(notSatisfiableNullables); notTerms.removeAll(notSatisfiableNullables); terms.add(rexBuilder.makeNullLiteral(notSatisfiableNullables.get(0).getType())); for (RexNode notSatisfiableNullable : notSatisfiableNullables) { terms.add( simplifyIs((RexCall) rexBuilder.makeCall(SqlStdOperatorTable.IS_NULL, notSatisfiableNullable))); } } for (RexNode notDisjunction : notTerms) { terms.add( simplify_( rexBuilder.makeCall(SqlStdOperatorTable.NOT, notDisjunction))); } return RexUtil.composeConjunction(rexBuilder, terms, false); }
Source:
<code>public boolean isAccepted(LocalSearchMoveScope moveScope) { Score moveScore = moveScope.getScore(); double[] moveScoreLevels = ScoreUtils.extractLevelDoubles(moveScore); for (int i = 0; i < levelsLength; i++) { double moveScoreLevel = moveScoreLevels[i]; double levelScoreLevel = levelScoreLevels[i]; if (moveScoreLevel > -levelScoreLevel) { return true; } else if (!(Math.abs(moveScoreLevel + levelScoreLevel) < THRESHOLD)) { return false; <START> } else if (i == levelsLength -1){ <END> return true; } } return true; }</code><technical_language>levelsLength - 1, note extra space. is a code style file KIE Github import IDE use</technical_language>

Target:
public boolean isAccepted(LocalSearchMoveScope moveScope) { Score moveScore = moveScope.getScore(); return moveScore.compareTo(currentWaterLevel.negate()) >= 0; }
Source:
<code>public IntervalList padded(final int before, final int after) { if (before < 0 || after < 0) throw new IllegalArgumentException("Padding values must be >= 0."); <START> final IntervalList padded = new IntervalList(this.getHeader()); <END> final SAMSequenceDictionary dict = padded.getHeader().getSequenceDictionary(); for (final Interval i : this) { final int start = Math.max(1, i.getStart()-before); final int end = Math.min(dict.getSequence(i.getContig()).getSequenceLength(), i.getEnd()+after); padded.add(new Interval(i.getContig(), start, end, i.isNegativeStrand(), i.getName())); } return padded; }</code><technical_language>clone header avoid changing header</technical_language>

Target:
public IntervalList padded(final int before, final int after) { if (before < 0 || after < 0) throw new IllegalArgumentException("Padding values must be >= 0."); final IntervalList padded = new IntervalList(this.getHeader().clone()); final SAMSequenceDictionary dict = padded.getHeader().getSequenceDictionary(); for (final Interval i : this) { final SAMSequenceRecord seq = dict.getSequence(i.getContig()); final int start = Math.max(1, i.getStart() - before); final int end = Math.min((seq == null ? Integer.MAX_VALUE : seq.getSequenceLength()), i.getEnd()+after); padded.add(new Interval(i.getContig(), start, end, i.isNegativeStrand(), i.getName())); } return padded; }