auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void checkAndResetGameOnScore(ActivateEvent event, EntityRef entity) { LASTeamComponent baseTeamComponent = entity.getComponent(LASTeamComponent.class); EntityRef player = event.getInstigator(); if (player.hasComponent(HasFlagComponent.class)) { if (player.getComponent(LASTeamComponent.class).team.equals(LASUtils.RED_TEAM)) { flag = LASUtils.BLACK_FLAG_URI; } if (player.getComponent(LASTeamComponent.class).team.equals(LASUtils.BLACK_TEAM)) { flag = LASUtils.RED_FLAG_URI; } EntityRef heldFlag = getHeldFlag(player); if (checkIfTeamScores(baseTeamComponent, heldFlag)) { incrementScore(baseTeamComponent); resetRound(baseTeamComponent, heldFlag); if (redScore == LASUtils.GOAL_SCORE) { logger.info("sending red won"); sendEventToClients(new GameoverEvent(LASUtils.RED_TEAM)); } if (blackScore == LASUtils.GOAL_SCORE) { logger.info("sending black won"); sendEventToClients(new GameoverEvent(LASUtils.BLACK_TEAM)); } } } }

Target:
private void checkAndResetGameOnScore(ActivateEvent event, EntityRef entity) { LASTeamComponent baseTeamComponent = entity.getComponent(LASTeamComponent.class); EntityRef player = event.getInstigator(); if (player.hasComponent(HasFlagComponent.class)) { if (player.getComponent(LASTeamComponent.class).team.equals(LASUtils.RED_TEAM)) { flag = LASUtils.BLACK_FLAG_URI; } if (player.getComponent(LASTeamComponent.class).team.equals(LASUtils.BLACK_TEAM)) { flag = LASUtils.RED_FLAG_URI; } EntityRef heldFlag = getHeldFlag(player); if (checkIfTeamScores(baseTeamComponent, heldFlag)) { incrementScore(baseTeamComponent); resetRound(baseTeamComponent, heldFlag); if (redScore >= LASUtils.GOAL_SCORE) { sendEventToClients(new GameOverEvent(LASUtils.RED_TEAM)); } if (blackScore >= LASUtils.GOAL_SCORE) { sendEventToClients(new GameOverEvent(LASUtils.BLACK_TEAM)); } } } }
Source:
public double getfreeDiskPercent() { Integer usedDiskSize = getused_disk_size() == null ? 0 : getused_disk_size(); Integer availableDiskSize = getavailable_disk_size() == null ? 0 : getavailable_disk_size(); double totalSize = usedDiskSize + availableDiskSize; return totalSize != 0 ? (availableDiskSize / totalSize) * (double) 100 : 0; }

Target:
public double getfreeDiskPercent() { int usedDiskSize = getused_disk_size() == null ? 0 : getused_disk_size(); int availableDiskSize = getavailable_disk_size() == null ? 0 : getavailable_disk_size(); double totalSize = usedDiskSize + availableDiskSize; return totalSize != 0 ? (availableDiskSize / totalSize) * 100 : 0; }
Source:
public List<ICompletionProposal> getCompletionProposals(AnnotationInfo info) { ArrayList<String> proposalNames = new ArrayList<String>(); proposalNames.add("Surround with new element"); ArrayList<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); for(Annotation annotation : info.getAnnotations()){ if(annotation instanceof SimpleMarkerAnnotation){ for (ICompletionProposal proposal : getMarkerProposals((SimpleMarkerAnnotation)annotation, info.getPosition())) { if(!proposalNames.contains(proposal.getDisplayString())){ proposals.add(proposal); proposalNames.add(proposal.getDisplayString()); } } } else if(annotation instanceof TemporaryAnnotation){ for (ICompletionProposal proposal : getProposals((TemporaryAnnotation)annotation, info.getPosition())) { if(!proposalNames.contains(proposal.getDisplayString())){ proposals.add(proposal); proposalNames.add(proposal.getDisplayString()); } } } } return proposals; }

Target:
public List<ICompletionProposal> getCompletionProposals(AnnotationInfo info) { ArrayList<String> proposalNames = new ArrayList<String>(); proposalNames.add(XMLUIMessages.SurroundWithNewElementQuickAssistProposal_1); ArrayList<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); for(Annotation annotation : info.getAnnotations()){ if(annotation instanceof SimpleMarkerAnnotation){ for (ICompletionProposal proposal : getMarkerProposals((SimpleMarkerAnnotation)annotation, info.getPosition())) { if(!proposalNames.contains(proposal.getDisplayString())){ proposals.add(proposal); proposalNames.add(proposal.getDisplayString()); } } } else if(annotation instanceof TemporaryAnnotation){ for (ICompletionProposal proposal : getProposals((TemporaryAnnotation)annotation, info.getPosition())) { if(!proposalNames.contains(proposal.getDisplayString())){ proposals.add(proposal); proposalNames.add(proposal.getDisplayString()); } } } } return proposals; }
Source:
public MetadataTermMapping(MetadataSource metadataSource, String metadataTermCode, OpenmrsMetadata referredObject) { this(); ArgUtil.notNull(metadataSource, "metadataSource"); ArgUtil.notNull(metadataTermCode, "metadataTermCode"); setMetadataSource(metadataSource); setCode(metadataTermCode); if (referredObject != null) { setMappedObject(referredObject); } }

Target:
public MetadataTermMapping(MetadataSource metadataSource, String metadataTermCode, OpenmrsMetadata referredObject) { this(); ArgUtil.notNull(metadataSource, "metadataSource"); ArgUtil.notNull(metadataTermCode, "metadataTermCode"); setMetadataSource(metadataSource); setCode(metadataTermCode); setMappedObject(referredObject); }
Source:
public String toString() { return subscribedPattern != null ? subscribedPattern.toString() : String.join(",", subscription); }

Target:
public String toString() { return "SubscriptionState{" + "type=" + subscriptionType + ", subscribedPattern=" + subscribedPattern + ", subscription=" + String.join(",", subscription) + ", groupSubscription=" + String.join(",", groupSubscription) + ", defaultResetStrategy=" + defaultResetStrategy + ", assignment=" + assignment.partitionStateValues() + " (id=" + assignmentId + ")}"; }
Source:
public Metric(Class<?> tableClass, String fieldName, AggregationDictionary dictionary) { super(tableClass, fieldName, dictionary); com.yahoo.elide.datastores.aggregation.annotation.Metric metric = dictionary.getAttributeOrRelationAnnotation( tableClass, com.yahoo.elide.datastores.aggregation.annotation.Metric.class, fieldName); if (metric == null) { throw new IllegalArgumentException(getId() + " is not a metric field"); } else { try { this.metricFunction = metric.function().newInstance(); metricFunction.setName(getId() + "[" + metricFunction.getName() + "]"); metricFunction.setExpression(String.format( metricFunction.getExpression(), dictionary.getColumnName(tableClass, fieldName))); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException("Can't initialize function for metric " + getId()); } } }

Target:
public Metric(Class<?> tableClass, String fieldName, AggregationDictionary dictionary) { super(tableClass, fieldName, dictionary); com.yahoo.elide.datastores.aggregation.annotation.Metric metric = dictionary.getAttributeOrRelationAnnotation( tableClass, com.yahoo.elide.datastores.aggregation.annotation.Metric.class, fieldName); try { this.metricFunction = metric.function().newInstance(); metricFunction.setName(getId() + "[" + metricFunction.getName() + "]"); metricFunction.setExpression(String.format( metricFunction.getExpression(), dictionary.getColumnName(tableClass, fieldName))); } catch (InstantiationException | IllegalAccessException e) { throw new IllegalArgumentException("Can't initialize function for metric " + getId()); } }
Source:
public File getSegmentFiles(DataSegment segment) throws SegmentLoadingException { Map<String, Object> loadSpec = segment.getLoadSpec(); Path location = Paths.get( MapUtils.getString(loadSpec, "locationsDir"), segment.getDataSource(), loadSpec.get("interval").toString(), MapUtils.getString(loadSpec, "version")); return location.toFile(); }

Target:
public File getSegmentFiles(DataSegment segment) throws SegmentLoadingException { File segmentFile = new File(locations.get(segment.getVersion().hashCode() % locations.size()), DataSegmentPusher.getDefaultStorageDir(segment)); segmentFile.mkdirs(); return segmentFile; }
Source:
void bindModels() { bind(AdElementListModel.class).to(UserPortalAdElementListModel.class); bind(UserPortalBasicListModel.class).in(Singleton.class); bind(VmBasicDiskListModel.class).in(Singleton.class); bind(UserPortalListModel.class).in(Singleton.class); bind(VmGeneralModel.class).in(Singleton.class); bind(PoolGeneralModel.class).in(Singleton.class); bind(VmInterfaceListModel.class).in(Singleton.class); bind(VmDiskListModel.class).in(Singleton.class); bind(PoolDiskListModel.class).in(Singleton.class); bind(UserPortalVmSnapshotListModel.class).in(Singleton.class); bind(new TypeLiteral<UserPortalPermissionListModel<UserPortalListModel>>(){}).in(Singleton.class); bind(UserPortalVmEventListModel.class).in(Singleton.class); bind(new TypeLiteral<VmAppListModel<VM>>() {}).in(Singleton.class); bind(new TypeLiteral<VmGuestContainerListModel>() {}).in(Singleton.class); bind(VmMonitorModel.class).in(Singleton.class); bind(PoolInterfaceListModel.class).in(Singleton.class); bind(VmGuestInfoModel.class).in(Singleton.class); bind(UserPortalTemplateListModel.class).in(Singleton.class); bind(TemplateGeneralModel.class).in(Singleton.class); bind(TemplateInterfaceListModel.class).in(Singleton.class); bind(new TypeLiteral<UserPortalPermissionListModel<VmTemplate>>(){}).in(Singleton.class); bind(UserPortalTemplateDiskListModel.class).in(Singleton.class); bind(UserPortalTemplateEventListModel.class).in(Singleton.class); bind(ResourcesModel.class).in(Singleton.class); }

Target:
void bindModels() { bind(AdElementListModel.class).to(UserPortalAdElementListModel.class); bind(UserPortalBasicListModel.class).in(Singleton.class); bind(VmBasicDiskListModel.class).in(Singleton.class); bind(UserPortalListModel.class).in(Singleton.class); bind(VmGeneralModel.class).in(Singleton.class); bind(PoolGeneralModel.class).in(Singleton.class); bind(VmInterfaceListModel.class).in(Singleton.class); bind(VmDiskListModel.class).in(Singleton.class); bind(PoolDiskListModel.class).in(Singleton.class); bind(UserPortalVmSnapshotListModel.class).in(Singleton.class); bind(new TypeLiteral<UserPortalPermissionListModel<UserPortalListModel>>(){}).in(Singleton.class); bind(UserPortalVmEventListModel.class).in(Singleton.class); bind(new TypeLiteral<VmAppListModel<VM>>() {}).in(Singleton.class); bind(VmGuestContainerListModel.class).in(Singleton.class); bind(VmMonitorModel.class).in(Singleton.class); bind(PoolInterfaceListModel.class).in(Singleton.class); bind(VmGuestInfoModel.class).in(Singleton.class); bind(UserPortalTemplateListModel.class).in(Singleton.class); bind(TemplateGeneralModel.class).in(Singleton.class); bind(TemplateInterfaceListModel.class).in(Singleton.class); bind(new TypeLiteral<UserPortalPermissionListModel<VmTemplate>>(){}).in(Singleton.class); bind(UserPortalTemplateDiskListModel.class).in(Singleton.class); bind(UserPortalTemplateEventListModel.class).in(Singleton.class); bind(ResourcesModel.class).in(Singleton.class); }
Source:
@Override public Pair<RelTraitSet, List<RelTraitSet>> deriveTraits( final RelTraitSet childTraits, final int childId) { assert childId == 0; final RelCollation collation = childTraits.getCollation(); if (collation == null || collation == RelCollations.EMPTY) { return null; } final RelTraitSet traits = traitSet.replace(collation); return Pair.of(traits, ImmutableList.of(traits)); }

Target:
@Override public Pair<RelTraitSet, List<RelTraitSet>> deriveTraits( final RelTraitSet childTraits, final int childId) { assert childId == 0; final RelCollation collation = childTraits.getCollation(); if (collation == null || collation == RelCollations.EMPTY) { return null; } final RelTraitSet traits = traitSet.replace(collation); return Pair.of(traits, ImmutableList.of(traits, right.getTraitSet())); }
Source:
public void run() { resetGlobalProgress(); indexingAll = true; for (ObjectType objectType : ObjectType.values()) { startIndexing(objectType); } try { sleep(pause); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("Thread interrupted: " + e.getMessage()); } currentIndexState = ObjectType.NONE; indexingAll = false; pollingChannel.send(INDEXING_FINISHED_MESSAGE); }

Target:
public void run() { resetGlobalProgress(); indexingAll = true; for (ObjectType objectType : ObjectType.values()) { startIndexing(objectType); } try { sleep(pause); } catch (InterruptedException e) { logger.error("Thread interrupted: " + e.getMessage()); Thread.currentThread().interrupt(); } currentIndexState = ObjectType.NONE; indexingAll = false; pollingChannel.send(INDEXING_FINISHED_MESSAGE); }
Source:
public RqWithoutHeader(final Request req, final CharSequence name) { super( new RqOf( () -> { final Text prefix = new FormattedText( "%s:", new EnglishLowerCase( name.toString() ).string() ); return new Filtered<>( header -> !new EnglishLowerCase(header).string() .startsWith(prefix.asString()), req.head() ); }, req::body ) ); }

Target:
public RqWithoutHeader(final Request req, final CharSequence name) { super( new RequestOf( () -> { final Text prefix = new FormattedText( "%s:", new Lowered(name.toString()).asString() ); return new Filtered<>( header -> !new Lowered(header).asString() .startsWith(prefix.asString()), req.head() ); }, req::body ) ); }
Source:
public void testTerminationBeforeCacheCreate() throws Exception { CacheManagerBuilder<PersistentCacheManager> clusteredCacheManagerBuilder = CacheManagerBuilder.newCacheManagerBuilder() .with(ClusteringServiceConfigurationBuilder.cluster(cluster.getConnectionURI().resolve("/MyCacheManagerName")) .autoCreate() .defaultServerResource("primary-server-resource")); PersistentCacheManager cacheManager = clusteredCacheManagerBuilder.build(false); cacheManager.init(); cluster.getClusterControl().terminateAllServers(); assertExceptionOccurred(IllegalStateException.class, new TimeLimitedTask<Cache<Long, String>>(1000, TimeUnit.SECONDS) { @Override Cache<Long, String> runTask() throws Exception { return cacheManager.createCache("simple-cache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, ResourcePoolsBuilder.newResourcePoolsBuilder() .with(ClusteredResourcePoolBuilder.clusteredDedicated(4, MemoryUnit.MB)))); } }) .withRootCauseInstanceOf(TimeoutException.class); }

Target:
public void testTerminationBeforeCacheCreate() throws Exception { CacheManagerBuilder<PersistentCacheManager> clusteredCacheManagerBuilder = CacheManagerBuilder.newCacheManagerBuilder() .with(ClusteringServiceConfigurationBuilder.cluster(cluster.getConnectionURI().resolve("/MyCacheManagerName")) .autoCreate() .defaultServerResource("primary-server-resource")); PersistentCacheManager cacheManager = clusteredCacheManagerBuilder.build(false); cacheManager.init(); cluster.getClusterControl().terminateAllServers(); assertExceptionOccurred(IllegalStateException.class, new TimeLimitedTask<Cache<Long, String>>(10, TimeUnit.SECONDS) { @Override Cache<Long, String> runTask() throws Exception { return cacheManager.createCache("simple-cache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, ResourcePoolsBuilder.newResourcePoolsBuilder() .with(ClusteredResourcePoolBuilder.clusteredDedicated(4, MemoryUnit.MB)))); } }) .withRootCauseInstanceOf(TimeoutException.class); }
Source:
private void validateFormatOptions(ReadableConfig tableOptions) { boolean failOnMissingField = tableOptions.getOptional(FAIL_ON_MISSING_FIELD) .orElse(false); boolean ignoreParseErrors = tableOptions.getOptional(IGNORE_PARSE_ERRORS) .orElse(false); if (ignoreParseErrors && failOnMissingField) { throw new ValidationException(FAIL_ON_MISSING_FIELD.key() + " and " + IGNORE_PARSE_ERRORS.key() + " shouldn't both be true."); } }

Target:
private void validateFormatOptions(ReadableConfig tableOptions) { boolean failOnMissingField = tableOptions.get(FAIL_ON_MISSING_FIELD); boolean ignoreParseErrors = tableOptions.get(IGNORE_PARSE_ERRORS); if (ignoreParseErrors && failOnMissingField) { throw new ValidationException(FAIL_ON_MISSING_FIELD.key() + " and " + IGNORE_PARSE_ERRORS.key() + " shouldn't both be true."); } }
Source:
public void setSnippetType(SnippetType type) { switch (type) { case CAMELCASE: snippetGenerator = new CamelCaseSnippetGenerator(new JavaSnippet()); break; default: snippetGenerator = new SnippetGenerator(new JavaSnippet()); break; } this.snippetType = type; }

Target:
public void setSnippetType(SnippetType type) { switch (type) { case CAMELCASE: snippetGenerator = new SnippetGenerator(new JavaSnippet(), new CamelCaseFunctionNameSanitizer()); break; case UNDERSCORE: snippetGenerator = new SnippetGenerator(new JavaSnippet(), new UnderscoreFunctionNameSanitizer()); break; default: throw new CucumberException(String.format("Unsupported Snippet Type: %s", type.toString())); } }
Source:
protected void doRun() throws IOException { Jenkins instance = Jenkins.get(); if (instance.clouds != null) { for (Cloud cloud : instance.clouds) { if (cloud instanceof EC2Cloud) { EC2Cloud ec2_cloud = (EC2Cloud) cloud; LOGGER.finer("Checking EC2 Connection on: " + ec2_cloud.getDisplayName()); try { if(ec2_cloud.connection != null) { ec2_cloud.connection.describeInstances(); } } catch (AmazonClientException e) { LOGGER.finer("Reconnecting to EC2 on: " + ec2_cloud.getDisplayName()); ec2_cloud.reconnectToEc2(); } } } } }

Target:
protected void doRun() throws IOException { Jenkins instance = Jenkins.get(); if (instance.clouds != null) { for (Cloud cloud : instance.clouds) { if (cloud instanceof EC2Cloud) { EC2Cloud ec2_cloud = (EC2Cloud) cloud; LOGGER.finer(() -> "Checking EC2 Connection on: " + ec2_cloud.getDisplayName()); try { if(ec2_cloud.connection != null) { ec2_cloud.connection.describeInstances(); } } catch (AmazonClientException e) { LOGGER.finer(() -> "Reconnecting to EC2 on: " + ec2_cloud.getDisplayName()); ec2_cloud.reconnectToEc2(); } } } } }
Source:
void setState(ParseObject.State newState) { if (isCurrentUser() && getSessionToken() != null && newState.get(KEY_SESSION_TOKEN) == null) { newState = newState.newBuilder().put(KEY_SESSION_TOKEN, getSessionToken()).build(); } if (isCurrentUser() && getAuthData() != null && newState.get(KEY_AUTH_DATA) == null) { newState = newState.newBuilder().put(KEY_AUTH_DATA, getAuthData()).build(); } super.setState(newState); }

Target:
void setState(ParseObject.State newState) { if (isCurrentUser()) { State.Builder newStateBuilder = newState.newBuilder(); if (getSessionToken() != null && newState.get(KEY_SESSION_TOKEN) == null) { newStateBuilder.put(KEY_SESSION_TOKEN, getSessionToken()); } if (getAuthData() != null && newState.get(KEY_AUTH_DATA) == null) { newStateBuilder.put(KEY_AUTH_DATA, getAuthData()); } newState = newStateBuilder.build(); } super.setState(newState); }
Source:
protected StudentAttributes getStudentOfCourseFromRequest(String courseId) { if (userInfo == null && StringHelper.isEmpty(getRequestParamValue(Const.ParamsNames.REGKEY))) { throw new UnauthorizedAccessException("Student account is required to access this resource."); } String moderatedPerson = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON); String previewAsPerson = getRequestParamValue(Const.ParamsNames.PREVIEWAS); if (!StringHelper.isEmpty(moderatedPerson)) { return logic.getStudentForEmail(courseId, moderatedPerson); } else if (!StringHelper.isEmpty(previewAsPerson)) { return logic.getStudentForEmail(courseId, previewAsPerson); } else { return getUnregisteredStudent().orElseGet(() -> logic.getStudentForGoogleId(courseId, userInfo.getId())); } }

Target:
protected StudentAttributes getStudentOfCourseFromRequest(String courseId) { String moderatedPerson = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON); String previewAsPerson = getRequestParamValue(Const.ParamsNames.PREVIEWAS); if (!StringHelper.isEmpty(moderatedPerson)) { return logic.getStudentForEmail(courseId, moderatedPerson); } else if (!StringHelper.isEmpty(previewAsPerson)) { return logic.getStudentForEmail(courseId, previewAsPerson); } else { return getUnregisteredStudent().orElseGet(() -> { gateKeeper.verifyLoggedInUserPrivileges(); return logic.getStudentForGoogleId(courseId, userInfo.getId()); }); } }
Source:
public <T> void serialize(T event, @Nullable String token, JsonGenerator jsonGenerator) throws IOException { requireNonNull(event, "event is null"); requireNonNull(jsonGenerator, "jsonGenerator is null"); TraceToken traceToken = null; if (token != null) { try (TraceTokenScope scope = registerRequestToken(token)) { traceToken = getCurrentTraceToken(); } } JsonSerializer<T> serializer = getSerializer(event, traceToken); if (serializer == null) { throw new InvalidEventException("Event class [%s] has not been registered as an event", event.getClass().getName()); } serializer.serialize(event, jsonGenerator, null); }

Target:
public <T> void serialize(T event, @Nullable String token, JsonGenerator jsonGenerator) throws IOException { requireNonNull(event, "event is null"); requireNonNull(jsonGenerator, "jsonGenerator is null"); TraceToken traceToken = null; if (token != null) { try (TraceTokenScope scope = registerRequestToken(token)) { traceToken = getCurrentTraceToken(); } } serialize(event, traceToken, jsonGenerator); }
Source:
public void testGetRows_manyColumnRows() { TableReference tableReference = TableReference.createFromFullyQualifiedName("test." + RandomStringUtils.randomAlphanumeric(16)); keyValueService.createTable(tableReference, AtlasDbConstants.GENERIC_TABLE_METADATA); byte[] data = PtBytes.toBytes("data"); ImmutableListMultimap.Builder builder = ImmutableListMultimap.<Cell, Value>builder(); IntStream stream = IntStream.rangeClosed(1, 1000); byte[] row1 = row(1); Map<Cell, Value> tableValues = stream.mapToObj( col -> Cell.create(row1, column(col))) .collect(Collectors.toMap( cell -> cell, cell -> Value.create(data, 1L))); keyValueService.putWithTimestamps(tableReference, KeyedStream.stream(tableValues).collectToSetMultimap()); Map<Cell, Value> result = keyValueService.getRows( tableReference, ImmutableList.of(row1), ColumnSelection.all(), STARTING_ATLAS_TIMESTAMP - 1); assertThat(result).isEqualTo(tableValues); }

Target:
public void testGetRows_manyColumnRows() { TableReference tableReference = TableReference.createFromFullyQualifiedName("test." + RandomStringUtils.randomAlphanumeric(16)); keyValueService.createTable(tableReference, AtlasDbConstants.GENERIC_TABLE_METADATA); byte[] data = PtBytes.toBytes("data"); IntStream stream = IntStream.rangeClosed(1, 1000); byte[] row1 = row(1); Map<Cell, Value> tableValues = stream.mapToObj( col -> Cell.create(row1, column(col))) .collect(Collectors.toMap( cell -> cell, cell -> Value.create(data, 1L))); keyValueService.putWithTimestamps(tableReference, KeyedStream.stream(tableValues).collectToSetMultimap()); Map<Cell, Value> result = keyValueService.getRows( tableReference, ImmutableList.of(row1), ColumnSelection.all(), STARTING_ATLAS_TIMESTAMP - 1); assertThat(result).isEqualTo(tableValues); }
Source:
private OrganizationDto insertOrganization(DbSession dbSession, NewOrganization newOrganization, Consumer<OrganizationDto>... extendCreation) { OrganizationDto res = new OrganizationDto() .setUuid(uuidFactory.create()) .setName(newOrganization.getName()) .setKey(newOrganization.getKey()) .setDescription(newOrganization.getDescription()) .setUrl(newOrganization.getUrl()) .setDefaultQualityGateUuid(qualityGateFinder.getBuiltInQualityGate(dbSession).getUuid()) .setAvatarUrl(newOrganization.getAvatar()); Arrays.stream(extendCreation).forEach(c -> c.accept(res)); dbClient.organizationDao().insert(dbSession, res, false); return res; }

Target:
private OrganizationDto insertOrganization(DbSession dbSession, NewOrganization newOrganization, Consumer<OrganizationDto>... extendCreation) { OrganizationDto res = new OrganizationDto() .setUuid(uuidFactory.create()) .setName(newOrganization.getName()) .setKey(newOrganization.getKey()) .setDescription(newOrganization.getDescription()) .setUrl(newOrganization.getUrl()) .setAvatarUrl(newOrganization.getAvatar()); Arrays.stream(extendCreation).forEach(c -> c.accept(res)); dbClient.organizationDao().insert(dbSession, res, false); return res; }
Source:
public void testIncrementalOAuth() throws Exception { DbxPKCEWebAuth auth = new DbxPKCEWebAuth(CONFIG, APP); String authUrl = auth.authorize( DbxWebAuth.newRequestBuilder() .withNoRedirect() .withScope("account.info.read") .withIncludeGrantedScopes(IncludeGrantedScopes.USER) .build() ); Map<String, List<String>> params = toParamsMap(new URL(authUrl)); assertEquals(params.get("include_granted_scopes"), Collections.singletonList("user")); }

Target:
public void testIncrementalOAuth() throws Exception { DbxPKCEWebAuth auth = new DbxPKCEWebAuth(CONFIG, APP); String authUrl = auth.authorize( DbxWebAuth.newRequestBuilder() .withNoRedirect() .withScope("account.info.read") .withIncludeGrantedScopes(IncludeGrantedScopes.USER) .build() ); Map<String, List<String>> params = toParamsMap(new URL(authUrl)); assertEquals(params.get("client_id"), Collections.singletonList(APP.getKey())); assertEquals(params.get("response_type"), Collections.singletonList("code")); assertEquals(params.get("scope"), Collections.singletonList("account.info.read")); assertEquals(params.get("include_granted_scopes"), Collections.singletonList("user")); assertFalse(params.containsKey("redirect_uri")); assertFalse(params.containsKey("state")); assertFalse(params.containsKey("require_role")); assertFalse(params.containsKey("force_reapprove")); assertFalse(params.containsKey("disable_signup")); assertFalse(params.containsKey("token_access_type")); assertNotNull(params.get("code_challenge")); assertEquals(params.get("code_challenge_method"), Collections.singletonList("S256")); }
Source:
public static Class<? extends Datum> getDatumClass(Type type) { switch (type) { case BOOLEAN: return BooleanDatum.class; case INT2: return Int2Datum.class; case INT4: return Int4Datum.class; case INT8: return Int8Datum.class; case FLOAT4: return Float4Datum.class; case FLOAT8: return Float8Datum.class; case CHAR: return CharDatum.class; case TEXT: return TextDatum.class; case TIMESTAMP: return TimestampDatum.class; case INTERVAL: return IntervalDatum.class; case DATE: return DateDatum.class; case TIME: return TimeDatum.class; case BIT: return BitDatum.class; case BLOB: return BlobDatum.class; case INET4: return Inet4Datum.class; case ANY: return AnyDatum.class; case NULL_TYPE: return NullDatum.class; default: throw new TajoRuntimeException(Errors.ResultCode.UNSUPPORTED_DATATYPE, type.name()); } }

Target:
public static Class<? extends Datum> getDatumClass(Type type) { switch (type) { case BOOLEAN: return BooleanDatum.class; case INT2: return Int2Datum.class; case INT4: return Int4Datum.class; case INT8: return Int8Datum.class; case FLOAT4: return Float4Datum.class; case FLOAT8: return Float8Datum.class; case CHAR: return CharDatum.class; case TEXT: return TextDatum.class; case TIMESTAMP: return TimestampDatum.class; case INTERVAL: return IntervalDatum.class; case DATE: return DateDatum.class; case TIME: return TimeDatum.class; case BIT: return BitDatum.class; case BLOB: return BlobDatum.class; case INET4: return Inet4Datum.class; case ANY: return AnyDatum.class; case NULL_TYPE: return NullDatum.class; default: throw new TajoRuntimeException(new UnsupportedDataTypeException(type.name())); } }
Source:
public boolean isFileDeletable(FileStatus fStat) { try { lock.readLock().lock(); if (this.fs == null) return false; Path filePath = fStat.getPath(); if (HFileLink.isHFileLink(filePath)) return true; Path parentDir = filePath.getParent(); if (HFileLink.isBackReferencesDir(parentDir)) { Path hfilePath = null; try { hfilePath = HFileLink.getHFileFromBackReference(new Path(CommonFSUtils.getRootDir(getConf()), HConstants.HBASE_TEMP_DIRECTORY), filePath); if (fs.exists(hfilePath)) { return false; } hfilePath = HFileLink.getHFileFromBackReference(MobUtils.getMobHome(getConf()), filePath); if (fs.exists(hfilePath)) { return false; } hfilePath = HFileLink.getHFileFromBackReference(CommonFSUtils.getRootDir(getConf()), filePath); return !fs.exists(hfilePath); } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug("Couldn't verify if the referenced file still exists, keep it just in case: " + hfilePath); } return false; } } Path backRefDir = null; try { backRefDir = HFileLink.getBackReferencesDir(parentDir, filePath.getName()); return CommonFSUtils.listStatus(fs, backRefDir) == null; } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug( "Couldn't get the references, not deleting file, just in case. filePath=" + filePath + ", backRefDir=" + backRefDir); } return false; } } finally { lock.readLock().unlock(); } }

Target:
public boolean isFileDeletable(FileStatus fStat) { lock.readLock().lock(); try { if (this.fs == null) { return false; } Path filePath = fStat.getPath(); if (HFileLink.isHFileLink(filePath)) { return true; } Path parentDir = filePath.getParent(); if (HFileLink.isBackReferencesDir(parentDir)) { Path hfilePath = null; try { hfilePath = HFileLink.getHFileFromBackReference(new Path( CommonFSUtils.getRootDir(getConf()), HConstants.HBASE_TEMP_DIRECTORY), filePath); if (fs.exists(hfilePath)) { return false; } hfilePath = HFileLink.getHFileFromBackReference(MobUtils.getMobHome(getConf()), filePath); if (fs.exists(hfilePath)) { return false; } hfilePath = HFileLink.getHFileFromBackReference(CommonFSUtils.getRootDir(getConf()), filePath); return !fs.exists(hfilePath); } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug("Couldn't verify if the referenced file still exists, keep it just in case: " + hfilePath); } return false; } } Path backRefDir = null; try { backRefDir = HFileLink.getBackReferencesDir(parentDir, filePath.getName()); return CommonFSUtils.listStatus(fs, backRefDir) == null; } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug( "Couldn't get the references, not deleting file, just in case. filePath=" + filePath + ", backRefDir=" + backRefDir); } return false; } } finally { lock.readLock().unlock(); } }
Source:
public XAStore(Class<K> keyType, Class<V> valueType, Store<K, SoftLock<V>> underlyingStore, TransactionManagerWrapper transactionManagerWrapper, TimeSource timeSource, Journal<K> journal, String uniqueXAResourceId, StatisticsService statisticsService) { super(keyType, valueType, true, statisticsService); this.underlyingStore = underlyingStore; this.transactionManagerWrapper = transactionManagerWrapper; this.timeSource = timeSource; this.journal = journal; this.uniqueXAResourceId = uniqueXAResourceId; this.transactionContextFactory = new XATransactionContextFactory<>(timeSource); this.recoveryXaResource = new EhcacheXAResource<>(underlyingStore, journal, transactionContextFactory); this.eventSourceWrapper = new StoreEventSourceWrapper<>(underlyingStore.getStoreEventSource()); this.statisticsService.registerWithParent(underlyingStore, this); }

Target:
public XAStore(Class<K> keyType, Class<V> valueType, Store<K, SoftLock<V>> underlyingStore, TransactionManagerWrapper transactionManagerWrapper, TimeSource timeSource, Journal<K> journal, String uniqueXAResourceId, StatisticsService statisticsService) { super(keyType, valueType, true, statisticsService); this.underlyingStore = underlyingStore; this.transactionManagerWrapper = transactionManagerWrapper; this.timeSource = timeSource; this.journal = journal; this.uniqueXAResourceId = uniqueXAResourceId; this.transactionContextFactory = new XATransactionContextFactory<>(timeSource); this.recoveryXaResource = new EhcacheXAResource<>(underlyingStore, journal, transactionContextFactory); this.eventSourceWrapper = new StoreEventSourceWrapper<>(underlyingStore.getStoreEventSource()); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; final String token = tokenExtractor.getToken(httpRequest); if (shouldSkipAuthentication(httpRequest, token)) { filterChain.doFilter(request, response); return; } final HttpSession session = httpRequest.getSession(); Subject subject = (Subject) session.getAttribute("che_subject"); if (subject == null || !subject.getToken().equals(token)) { Jwt jwtToken = (Jwt) httpRequest.getAttribute("token"); if (jwtToken == null) { throw new ServletException("Cannot detect or instantiate user."); } Claims claims = (Claims) jwtToken.getBody(); try { User user = getOrCreateUser( claims.getSubject(), claims.get("email", String.class), claims.get("preferred_username", String.class)); subject = new AuthorizedSubject( new SubjectImpl(user.getName(), user.getId(), token, false), permissionChecker); workspaceSubjectRegistry.updateSubject(subject); session.setAttribute("che_subject", subject); } catch (ServerException | ConflictException e) { throw new ServletException( "Unable to identify user " + claims.getSubject() + " in Che database", e); } } putIdentityIdToMDC(subject); try { EnvironmentContext.getCurrent().setSubject(subject); filterChain.doFilter(addUserInRequest(httpRequest, subject), response); } finally { EnvironmentContext.reset(); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; final String token = tokenExtractor.getToken(httpRequest); if (shouldSkipAuthentication(httpRequest, token)) { filterChain.doFilter(request, response); return; } final HttpSession session = httpRequest.getSession(); Subject subject = (Subject) session.getAttribute("che_subject"); if (subject == null || !subject.getToken().equals(token)) { Jwt jwtToken = (Jwt) httpRequest.getAttribute("token"); if (jwtToken == null) { throw new ServletException("Cannot detect or instantiate user."); } Claims claims = (Claims) jwtToken.getBody(); try { User user = getOrCreateUser( claims.getSubject(), claims.get("email", String.class), claims.get("preferred_username", String.class)); subject = new AuthorizedSubject( new SubjectImpl(user.getName(), user.getId(), token, false), permissionChecker); workspaceSubjectRegistry.updateSubject(subject); session.setAttribute("che_subject", subject); } catch (ServerException | ConflictException e) { throw new ServletException( "Unable to identify user " + claims.getSubject() + " in Che database", e); } } try { EnvironmentContext.getCurrent().setSubject(subject); filterChain.doFilter(addUserInRequest(httpRequest, subject), response); } finally { EnvironmentContext.reset(); } }
Source:
public List<PartitionEndStatistics> loadTopicEndStatistics(final Collection<Timeline> timelines) throws ServiceTemporarilyUnavailableException { try { return Retryer.executeWithRetry(() -> { return loadTopicEndStatisticsInternal(timelines); }, new RetryForSpecifiedCountStrategy(3) .withWaitBetweenEachTry(5000) .withExceptionsThatForceRetry(org.apache.kafka.common.errors.TimeoutException.class)); } catch (final Exception e) { throw new ServiceTemporarilyUnavailableException("Error occurred when fetching partitions offsets", e); } }

Target:
public List<PartitionEndStatistics> loadTopicEndStatistics(final Collection<Timeline> timelines) throws ServiceTemporarilyUnavailableException { try { return Retryer.executeWithRetry(() -> { return loadTopicEndStatisticsInternal(timelines); }, new RetryForSpecifiedCountStrategy(3) .withWaitBetweenEachTry(5000) .withExceptionsThatForceRetry(org.apache.kafka.common.errors.TimeoutException.class)); } catch (final RuntimeException e) { throw new ServiceTemporarilyUnavailableException("Error occurred when fetching partitions offsets", e); } }
Source:
public AccelerationCap(PDP pdp, double hardStopVoltage, int... channels) { this.pdp = pdp; this.hardStopVoltage = hardStopVoltage; this.channels = channels; disableCurrent = pdp.getTotalCurrent() > AccelerationCap.REASONABLE_RESTING_CURRENT; currentSpeed = 0; voltageDrop = 0; lastUpdate = System.currentTimeMillis(); }

Target:
public AccelerationCap(PDP pdp, double hardStopVoltage, int... channels) { this.pdp = pdp; this.hardStopVoltage = hardStopVoltage; this.channels = channels; disableCurrent = pdp.getTotalCurrent() > AccelerationCap.REASONABLE_RESTING_CURRENT; if (disableCurrent) { LogKitten.w("Disabling current for AccelerationCap, PDP seems unreliable"); } currentSpeed = 0; voltageDrop = 0; lastVoltageDrop = 0; lastUpdate = System.currentTimeMillis(); }
Source:
public boolean canFlipToNextPage() { if (getNextPage() == null) return false; try { if (!fragment.isComplete()) return false; } catch (Exception e) { return false; } return true; }

Target:
public boolean canFlipToNextPage() { if (getNextPage() == null) return false; try { if (!fragment.isComplete()) return false; } catch (Exception e) { Trace.trace(Trace.STRING_WARNING, "Exception caught checking if page is complete", e); return false; } return true; }
Source:
public void testAUserCannotCreateMeetingWithStartTimeLessOfEndTime() { HomeTabletPage home = new HomeTabletPage(); home.clickScheduleBtn() .setOrganizerTxtBox(organizer) .setSubjectTxtBox(subject) .setStartTimeDate(startTime) .setEndTimeDate(endTime) .setAttendeeTxtBoxPressingEnter(attendee) .setBodyTxtBox(body) .clickCreateBtn(); Assert.assertTrue(schedule.isMessageOfTimeErrorDisplayed()); }

Target:
public void testAUserCannotCreateMeetingWithStartTimeLessOfEndTime() { ExcelReader excelReader = new ExcelReader(EXCEL_INPUT_DATA); List<Map<String, String>> meetingData = excelReader.getMapValues("MeetingData"); String organizer = meetingData.get(8).get("Organizer"); String subject = meetingData.get(8).get("Subject"); String startTime = meetingData.get(8).get("Start time"); String endTime = meetingData.get(8).get("End time"); String attendee = meetingData.get(8).get("Attendee"); String body = meetingData.get(8).get("Body"); HomeTabletPage homePage = new HomeTabletPage(); SchedulePage schedulePage = homePage.clickScheduleBtn() .setOrganizerTxtBox(organizer) .setSubjectTxtBox(subject) .setStartTimeDate(startTime) .setEndTimeDate(endTime) .setAttendeeTxtBoxPressingEnter(attendee) .setBodyTxtBox(body) .clickCreateBtn(); Assert.assertTrue(schedulePage.isMessageOfTimeErrorDisplayed()); }
Source:
public String getRule() { return "Whenever a source you control other than {this} deals damage to another player, " + super.getRule(); }

Target:
public String getRule() { return "Whenever a source you control other than {this} deals damage to an opponent, " + super.getRule(); }
Source:
void setRevisionSupported(NotebookRepo repo) { if (repo instanceof NotebookRepoWithVersionControl) { getConfig().put("isRevisionSupported", true); } else { getConfig().put("isRevisionSupported", false); } }

Target:
void setRevisionSupported(NotebookRepo repo) { if (repo instanceof NotebookRepoSync) { getConfig() .put("isRevisionSupported", ((NotebookRepoSync) repo).isRevisionSupportedInDefaultRepo()); } else if (repo instanceof NotebookRepoWithVersionControl) { getConfig().put("isRevisionSupported", true); } else { getConfig().put("isRevisionSupported", false); } }
Source:
public Void call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); ac.getGroupsManager().moveGroup(ac.getSession(), ac.getGroupById(parms.readInt("destinationGroup")), ac.getGroupById(parms.readInt("movingGroup"))); return null; }

Target:
public Group call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); if (parms.contains("parentGroup")) { return ac.getGroupsManager().createGroup(ac.getSession(), ac.getGroupById(parms.readInt("parentGroup")), parms.read("group", Group.class)); } else if (parms.contains("vo")) { Group group = parms.read("group", Group.class); if (group.getParentGroupId() == null) { return ac.getGroupsManager().createGroup(ac.getSession(), ac.getVoById(parms.readInt("vo")), group); } else { throw new RpcException(RpcException.Type.WRONG_PARAMETER, "Top-level groups can't have parentGroupId set!"); } } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "vo or parentGroup"); } }
Source:
public HttpHandler createHttpHandler(Predicate predicate, final HttpHandler next) { final HttpHandler mcmp = managementAccessPredicate != null ? Handlers.predicate(managementAccessPredicate, config.create(modCluster, next), next) : config.create(modCluster, next); final HttpHandler proxyHandler = modCluster.getProxyHandler(); HttpHandler theHandler = new HttpHandler() { @Override public void handleRequest(HttpServerExchange exchange) throws Exception { proxyHandler.handleRequest(exchange); if(!exchange.isDispatched() && !exchange.isComplete()) { exchange.setResponseCode(200); mcmp.handleRequest(exchange); } } }; UndertowLogger.ROOT_LOGGER.modClusterMCMPHttpHandlerCreated(); if (predicate != null) { return new PredicateHandler(predicate, theHandler, next); } else { return theHandler; } }

Target:
public HttpHandler createHttpHandler(Predicate predicate, final HttpHandler next) { final HttpHandler mcmp = managementAccessPredicate != null ? Handlers.predicate(managementAccessPredicate, config.create(modCluster, next), next) : config.create(modCluster, next); final HttpHandler proxyHandler = modCluster.getProxyHandler(); HttpHandler theHandler = new HttpHandler() { @Override public void handleRequest(HttpServerExchange exchange) throws Exception { proxyHandler.handleRequest(exchange); if(!exchange.isDispatched() && !exchange.isComplete()) { exchange.setResponseCode(200); mcmp.handleRequest(exchange); } } }; UndertowLogger.ROOT_LOGGER.debug("HttpHandler for mod_cluster MCMP created."); if (predicate != null) { return new PredicateHandler(predicate, theHandler, next); } else { return theHandler; } }
Source:
public String getExecutable(final Launcher launcher) throws IOException, InterruptedException { final File exe = launcher.getChannel().call(new MasterToSlaveCallable<File, IOException>() { private static final long serialVersionUID = 5572701806697595613L; @Override public File call() throws IOException { return getExeFile(); } }); final boolean existis = launcher.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() { private static final long serialVersionUID = 5572701806697595613L; @Override public Boolean call() throws IOException { return exe.exists(); } }); if (!existis) { launcher.getListener().error("Gradle executable does not exist: " + exe.getPath()); return null; } else { return exe.getPath(); } }

Target:
public String getExecutable(final Launcher launcher) throws IOException, InterruptedException { final File exe = launcher.getChannel().call(new MasterToSlaveCallable<File, IOException>() { @Override public File call() throws IOException { return getExeFile(); } }); final boolean existis = launcher.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() { @Override public Boolean call() throws IOException { return exe.exists(); } }); if (!existis) { launcher.getListener().error("Gradle executable does not exist: " + exe.getPath()); return null; } else { return exe.getPath(); } }
Source:
public List<BibEntry> performSearch(String query) { return fetchers.stream().flatMap(searchBasedFetcher -> { try { return searchBasedFetcher.performSearch(query).stream(); } catch (FetcherException e) { LOGGER.warn(String.format("%s API request failed", searchBasedFetcher.getName()), e); return Stream.empty(); } }).parallel().collect(Collectors.toList()); }

Target:
public List<BibEntry> performSearch(String query) { return fetchers.stream().flatMap(searchBasedFetcher -> { try { return searchBasedFetcher.performSearch(query).stream(); } catch (FetcherException e) { LOGGER.warn(String.format("%s API request failed", searchBasedFetcher.getName()), e); return Stream.empty(); } }).parallel() .limit(maximumNumberOfReturnedResults) .collect(Collectors.toList()); }
Source:
public static boolean isExcludedColumn(VerifyTreeData tree, int ind) { List<Integer> excludedColumns = tree.getExcludedColumns(); for (Integer excludedColumn : excludedColumns) { if (excludedColumn.equals(ind)) { return true; } } return false; }

Target:
public static boolean isExcludedColumn(VerifyTreeData tree, int ind) { List<Integer> excludedColumns = tree.getExcludedColumns(); return excludedColumns.contains(ind); }
Source:
public void execInitClipboardForm(ClipboardForm form) { }

Target:
protected void execInitClipboardForm(ClipboardForm form) { }
Source:
public void setUp() throws Exception { DefaultClockModel.updateClockTimerTask.setPaused(true); xsb = Mockito.mock(XmlScoreBoard.class); sbm = new DefaultScoreBoardModel(xsb); sm = sbm.getStatsModel(); sbepm = ScoreBoardEventProviderManager.getSingleton(); }

Target:
public void setUp() throws Exception { DefaultClockModel.updateClockTimerTask.setPaused(true); ScoreBoardManager.setPropertyOverride(JettyServletScoreBoardController.class.getName() + ".html.dir", "html"); sbm = new DefaultScoreBoardModel(); sm = sbm.getStatsModel(); sbepm = ScoreBoardEventProviderManager.getSingleton(); for(String tid : Arrays.asList(Team.ID_1, Team.ID_2)) { TeamModel tm = sbm.getTeamModel(tid); for (int i = 0; i <= 15; i++) { String number = String.format("%s%02d", tid, i); tm.addSkaterModel(ID_PREFIX + number, "name-" + number, number, ""); } } team1 = sbm.getTeamModel(Team.ID_1); }
Source:
private Inventory getInventory(YamlConfiguration playerFile, int size, int number, String title) { String data = playerFile.getString(String.format(VAULTKEY, number)); if (Base64Serialization.fromBase64(data) == null) { return null; } Inventory inventory = Bukkit.createInventory(null, size, title); for (ItemStack itemStack : Base64Serialization.fromBase64(data).getContents()) { if (itemStack != null) { inventory.addItem(itemStack); } } return inventory; }

Target:
private Inventory getInventory(YamlConfiguration playerFile, int size, int number, String title) { String data = playerFile.getString(String.format(VAULTKEY, number)); Inventory deserializedData = Base64Serialization.fromBase64(data); if (deserializedData == null) { return null; } Inventory inventory = Bukkit.createInventory(null, size, title); for (ItemStack itemStack : deserializedData.getContents()) { if (itemStack != null) { inventory.addItem(itemStack); } } return inventory; }
Source:
public void testCreateDBAuditObj() { AuditRepositoryOrchImpl auditRepo = new AuditRepositoryOrchImpl(); AssertionType assertion = createAssertion(); LogEventSecureRequestType auditObj = createLogEventSecureObj(assertion); AuditRepositoryRecord dbRec = auditRepo.createDBAuditObj(auditObj, assertion); assertEquals("AuditRepositoryRecord.Direction mismatch", dbRec.getDirection(), auditObj.getDirection()); assertEquals("AuditRepositoryRecord.EventType mismatch", dbRec.getEventType(), EVENT_TYPE); assertEquals("AuditRepositoryRecord.EventId mismatch", dbRec.getEventId(), EVENT_ID_CODE_DISP_NAME); assertEquals("AuditRepositoryRecord.RelatesTo", dbRec.getRelatesTo(), RELATES_TO_1); }

Target:
public void testCreateDBAuditObj() { AuditRepositoryOrchImpl auditRepo = new AuditRepositoryOrchImpl(); AssertionType assertion = createAssertion(); LogEventSecureRequestType auditObj = createLogEventSecureObj(assertion); AuditRepositoryRecord dbRec = auditRepo.createDBAuditObj(auditObj, assertion); assertEquals("AuditRepositoryRecord.Direction mismatch", dbRec.getDirection(), auditObj.getDirection()); assertEquals("AuditRepositoryRecord.EventType mismatch", dbRec.getEventType(), EVENT_TYPE); assertEquals("AuditRepositoryRecord.EventId mismatch", dbRec.getEventId(), EVENT_ID_CODE_DISP_NAME); assertEquals("AuditRepositoryRecord.RelatesTo", dbRec.getRelatesTo(), RELATES_TO_1); assertNotNull("AuditRepositoryRecord.MessageId", dbRec.getMessageId()); }
Source:
private static void assertDataSketchesAvailable() { try { new StringSketch(); } catch (Throwable t) { throw new ISE(t, "DataSketches is unvailable. Try adding the druid-datasketches extension to the classpath."); } }

Target:
private static void assertDataSketchesAvailable() { try { new StringSketch(); } catch (NoClassDefFoundError e) { throw new ISE( e, "DataSketches is unvailable." + " Try loading the druid-datasketches extension from the classpath for the overlord and middleManagers/indexers." ); } }
Source:
public Permission getRequiredPermission() { return Jenkins.CONFIGURE; }

Target:
public Permission getRequiredPermission() { return Jenkins.MANAGE; }
Source:
private RollingHistogram getOrAddBucket(String name) { lock.writeLock().lock(); try { RollingHistogram hist = statBuckets.get(name); if (hist == null) { hist = new RollingHistogram(NUM_ROLLING_HISTOGRAMS); statBuckets.put(name, hist); } return hist; } finally { lock.writeLock().unlock(); } }

Target:
private RollingHistogram getOrAddBucket(String name) { return statBuckets.computeIfAbsent(name, (n) -> new RollingHistogram(NUM_ROLLING_HISTOGRAMS)); }