auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static SchedulingPolicyUnit map(PolicyUnit entity, SchedulingPolicyUnit template) { SchedulingPolicyUnit model = template != null ? template : new SchedulingPolicyUnit(); model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setDescription(entity.getDescription()); model.setType(entity.getPolicyUnitType().name().toLowerCase()); model.setEnabled(entity.isEnabled()); model.setInternal(entity.isInternal()); if (entity.getParameterRegExMap() != null && !entity.getParameterRegExMap().isEmpty()) { model.setRegexValidationMap(CustomPropertiesParser.fromMap(entity.getParameterRegExMap())); } return model; }

Target:
public static SchedulingPolicyUnit map(PolicyUnit entity, SchedulingPolicyUnit template) { SchedulingPolicyUnit model = template != null ? template : new SchedulingPolicyUnit(); model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setDescription(entity.getDescription()); String policyUnitTypeName = null; switch (entity.getPolicyUnitType()) { case FILTER: policyUnitTypeName = org.ovirt.engine.api.model.PolicyUnitType.FILTER.name().toLowerCase(); break; case WEIGHT: policyUnitTypeName = org.ovirt.engine.api.model.PolicyUnitType.WEIGHT.name().toLowerCase(); break; case LOAD_BALANCING: policyUnitTypeName = org.ovirt.engine.api.model.PolicyUnitType.LOAD_BALANCING.name().toLowerCase(); break; default: assert (false) : "unknown Policy Unit Type value: " + model.toString(); return null; } model.setType(policyUnitTypeName); model.setEnabled(entity.isEnabled()); model.setInternal(entity.isInternal()); if (entity.getParameterRegExMap() != null && !entity.getParameterRegExMap().isEmpty()) { model.setPropertiesMetaData(CustomPropertiesParser.fromMap(entity.getParameterRegExMap())); } return model; }
Source:
public void load() { cache.clear(); nameMap.clear(); for (NormalAchievements value : NormalAchievements.values()) { if (mainConfig.contains(value.getCategoryName())) { cache.addAll(loadInner(value.getCategoryName(), value.getCategoryName())); } } for (MultipleAchievements value : MultipleAchievements.values()) { cache.addAll(loadMulti(value.getCategoryName())); } nameMap.putAll(cache.stream().collect(Collectors.toMap(a -> a.getName().toLowerCase(), i -> i))); categoryMap .putAll(cache.stream() .collect(Collectors.groupingBy(a -> a.getCategory().toLowerCase(), Collectors.toSet()))); }

Target:
public void load() { cache.clear(); nameMap.clear(); for (NormalAchievements value : NormalAchievements.values()) { if (mainConfig.contains(value.getCategoryName())) { cache.addAll(loadInner(value.getCategoryName(), value.getCategoryName())); } } for (MultipleAchievements value : MultipleAchievements.values()) { if (mainConfig.contains(value.getCategoryName())) { cache.addAll(loadMulti(value.getCategoryName())); } } if (mainConfig.contains(CommandAchievements.COMMANDS.toString())) { cache.addAll(loadInner(CommandAchievements.COMMANDS.toString(), CommandAchievements.COMMANDS.toString())); } nameMap.putAll(cache.stream().collect(Collectors.toMap(a -> a.getName().toLowerCase(), i -> i))); categoryMap .putAll(cache.stream() .collect(Collectors.groupingBy(a -> a.getCategory().toLowerCase(), Collectors.toSet()))); }
Source:
public void testIncorrectQueryField() throws Exception { try { startGrid(); } catch (Exception exception) { if (exception.getMessage().contains( GridQueryProcessor.propertyInitializationExceptionMessage( Object.class, Object.class, "exceptionOid", Object.class))) { } else { fail("property initialization exception must be thrown, but got " + exception.getMessage()); } } }

Target:
public void testIncorrectQueryField() throws Exception { try { startGrid(); } catch (Exception exception) { if (!exception.getMessage().contains( GridQueryProcessor.propertyInitializationExceptionMessage( Object.class, Object.class, "exceptionOid", Object.class))) { fail("property initialization exception must be thrown, but got " + exception.getMessage()); } } }
Source:
private Flux<ShareItem> listShares(String marker, ListSharesOptions options) { String prefix = null; Integer maxResults = null; List<ListSharesIncludeType> include = new ArrayList<>(); if (options != null) { prefix = options.prefix(); maxResults = options.maxResults(); if (options.includeMetadata()) { include.add(ListSharesIncludeType.fromString(ListSharesIncludeType.METADATA.toString())); } if (options.includeSnapshots()) { include.add(ListSharesIncludeType.fromString(ListSharesIncludeType.SNAPSHOTS.toString())); } } return client.services().listSharesSegmentWithRestResponseAsync(prefix, marker, maxResults, include, null, Context.NONE) .flatMapMany(response -> Flux.fromIterable(response.value().shareItems())); }

Target:
private Flux<ShareItem> listShares(String marker, ListSharesOptions options) { String prefix = null; Integer maxResults = null; List<ListSharesIncludeType> include = new ArrayList<>(); if (options != null) { prefix = options.prefix(); maxResults = options.maxResults(); if (options.includeMetadata()) { include.add(ListSharesIncludeType.fromString(ListSharesIncludeType.METADATA.toString())); } if (options.includeSnapshots()) { include.add(ListSharesIncludeType.fromString(ListSharesIncludeType.SNAPSHOTS.toString())); } } return azureFileStorageClient.services().listSharesSegmentWithRestResponseAsync(prefix, marker, maxResults, include, null, Context.NONE) .flatMapMany(response -> Flux.fromIterable(response.value().shareItems())); }
Source:
private FormattedDomain parseDomain(Domain domain) { ImmutableSet.Builder<FormattedRange> formattedRanges = ImmutableSet.builder(); Type type = domain.getType(); domain.getValues().getValuesProcessor().consume( ranges -> formattedRanges.addAll( ranges.getOrderedRanges().stream() .map(range -> new FormattedRange(formatMarker(range.getLow()), formatMarker(range.getHigh()))) .collect(toImmutableSet())), discreteValues -> formattedRanges.addAll( discreteValues.getValues().stream() .map(value -> getVarcharValue(type, value)) .filter(Objects::nonNull) .map(value -> new FormattedMarker(Optional.of(value), EXACTLY)) .map(marker -> new FormattedRange(marker, marker)) .collect(toImmutableSet())), allOrNone -> { throw new IllegalStateException("Unreachable AllOrNone consumer"); }); return new FormattedDomain(domain.isNullAllowed(), formattedRanges.build()); }

Target:
private FormattedDomain parseDomain(Domain domain) { ImmutableSet.Builder<FormattedRange> formattedRanges = ImmutableSet.builder(); Type type = domain.getType(); domain.getValues().getValuesProcessor().consume( ranges -> formattedRanges.addAll( ranges.getOrderedRanges().stream() .map(range -> new FormattedRange(formatMarker(range.getLow()), formatMarker(range.getHigh()))) .collect(toImmutableSet())), discreteValues -> formattedRanges.addAll( discreteValues.getValues().stream() .map(value -> getVarcharValue(type, value)) .map(value -> new FormattedMarker(Optional.of(value), EXACTLY)) .map(marker -> new FormattedRange(marker, marker)) .collect(toImmutableSet())), allOrNone -> { throw new IllegalStateException("Unreachable AllOrNone consumer"); }); return new FormattedDomain(domain.isNullAllowed(), formattedRanges.build()); }
Source:
public void settingPrimaryKeyWithObjectSchema() { RealmConfiguration originalConfig = configFactory.createConfigurationBuilder() .schema(AllTypes.class) .build(); Realm.getInstance(originalConfig).close(); RealmMigration migration = new RealmMigration() { @Override public void migrate(DynamicRealm realm, long oldVersion, long newVersion) { RealmSchema schema = realm.getSchema(); schema.create("AnnotationTypes") .addField("id", long.class) .addPrimaryKey("id") .addField("indexString", String.class) .addIndex("indexString") .addField("notIndexString", String.class); } }; RealmConfiguration realmConfig = configFactory.createConfigurationBuilder() .schemaVersion(1) .schema(AllTypes.class, AnnotationTypes.class) .migration(migration) .build(); realm = Realm.getInstance(realmConfig); RealmObjectSchema schema = realm.getSchema().getSchemaForClass(AnnotationTypes.class); assertTrue(schema.hasPrimaryKey()); assertTrue(schema.hasIndex("id")); realm.close(); }

Target:
public void settingPrimaryKeyWithObjectSchema() { RealmConfiguration originalConfig = configFactory.createConfigurationBuilder() .schema(AllTypes.class) .build(); Realm.getInstance(originalConfig).close(); RealmMigration migration = new RealmMigration() { @Override public void migrate(DynamicRealm realm, long oldVersion, long newVersion) { RealmSchema schema = realm.getSchema(); schema.create("AnnotationTypes") .addField("id", long.class) .addPrimaryKey("id") .addField("indexString", String.class) .addIndex("indexString") .addField("notIndexString", String.class); } }; RealmConfiguration realmConfig = configFactory.createConfigurationBuilder() .schemaVersion(1) .schema(AllTypes.class, AnnotationTypes.class) .migration(migration) .build(); realm = Realm.getInstance(realmConfig); RealmObjectSchema schema = realm.getSchema().get("AnnotationTypes"); assertTrue(schema.hasPrimaryKey()); assertTrue(schema.hasIndex("id")); realm.close(); }
Source:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { return new ArrayList<>(); }

Target:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { return Collections.EMPTY_SET; }
Source:
public Cell checkLevelAABB(AABB aabb, Point motion) { Grid<Cell> cells = level.getCells(); int minx = (int) Math.max(Math.floor(aabb.getStart().getX()), 0); int miny = (int) Math.max(Math.floor(aabb.getStart().getY()), 0); int maxx = (int) Math.min(Math.ceil(aabb.getEnd().getX()), cells.getWidth()); int maxy = (int) Math.min(Math.ceil(aabb.getEnd().getY()), cells.getHeight()); for(int y = miny; y < maxy; y++) { for(int x = minx; x < maxx; x++) { Point c = new Point(x, y); Cell cell = cells.get(x, y); Point aabbo = cell.getAABBOffset(); AABB tile = new AABB(c.add(aabbo), c.add(aabbo).add(cell.getAABBDimensions())); if (cell.collides(motion) && aabb.overlaps(tile)) { if(cell.getType() == Cell.WALL) { return Cell.WALL; } return Cell.PLATFORM; } } } return Cell.EMPTY; }

Target:
public Cell checkLevelAABB(AABB aabb, Point motion) { Grid<Cell> cells = level.getCells(); int minx = (int) Math.max(Math.floor(aabb.getStart().getX()), 0); int miny = (int) Math.max(Math.floor(aabb.getStart().getY()), 0); int maxx = (int) Math.min(Math.ceil(aabb.getEnd().getX()), cells.getWidth()); int maxy = (int) Math.min(Math.ceil(aabb.getEnd().getY()), cells.getHeight()); for(int y = miny; y < maxy; y++) { for(int x = minx; x < maxx; x++) { Point c = new Point(x, y); Cell cell = cells.get(x, y); Point aabbo = cell.getAABBOffset(); AABB tile = new AABB(c.add(aabbo), c.add(aabbo).add(cell.getAABBDimensions())); if (cell.collides(motion) && aabb.overlaps(tile)) { return cell; } } } return Cell.EMPTY; }
Source:
protected List<FeedbackSessionAttributes> loadFeedbackSessionsList( List<InstructorAttributes> instructorList) { List<FeedbackSessionAttributes> sessions = logic.getFeedbackSessionsListForInstructor(instructorList); return sessions; }

Target:
protected List<FeedbackSessionAttributes> loadFeedbackSessionsList(List<InstructorAttributes> instructorList) { return logic.getFeedbackSessionsListForInstructor(instructorList); }
Source:
private void getDeprecatedContainers() { deprecatedContainers.clear(); if (accountService != null) { accountService.getContainersByStatus(Container.ContainerStatus.DELETE_IN_PROGRESS).forEach((container) -> { if (container.getLastUpdateTime() + TimeUnit.DAYS.toMillis(14) >= System.currentTimeMillis()) { deprecatedContainers.add(new Pair<>(container.getParentAccountId(), container.getId())); } }); accountService.getContainersByStatus(Container.ContainerStatus.INACTIVE).forEach((container) -> { deprecatedContainers.add(new Pair<>(container.getParentAccountId(), container.getId())); }); } }

Target:
private void getDeprecatedContainers() { deprecatedContainers.clear(); if (accountService != null) { accountService.getContainersByStatus(Container.ContainerStatus.DELETE_IN_PROGRESS).forEach((container) -> { if (container.getDeleteTriggerTime() + TimeUnit.DAYS.toMillis(config.storeContainerDeletionRetentionDays) >= System.currentTimeMillis()) { deprecatedContainers.add(new Pair<>(container.getParentAccountId(), container.getId())); } }); accountService.getContainersByStatus(Container.ContainerStatus.INACTIVE).forEach((container) -> { deprecatedContainers.add(new Pair<>(container.getParentAccountId(), container.getId())); }); } }
Source:
private List<String> validateCli(ParseResult parseResult, List<File> filesToProcess) { final List<String> result = new ArrayList<>(); final boolean hasConfigurationFile = configurationFile != null; final boolean hasSuppressionLineColumnNumber = suppressionLineColumnNumber != null; if (filesToProcess.isEmpty()) { result.add("Files to process must be specified, found 0."); } else if (printAst || printAstWithComments || printJavadocTree || printTreeWithJavadoc || xpath != null) { if (suppressionLineColumnNumber != null || configurationFile != null || propertiesFile != null || outputPath != null || parseResult.hasMatchedOption(OUTPUT_FORMAT_OPTION)) { result.add("Option '-t' cannot be used with other options."); } else if (filesToProcess.size() > 1) { result.add("Printing AST is allowed for only one file."); } } else if (hasSuppressionLineColumnNumber) { if (configurationFile != null || propertiesFile != null || outputPath != null || parseResult.hasMatchedOption(OUTPUT_FORMAT_OPTION)) { result.add("Option '-s' cannot be used with other options."); } else if (filesToProcess.size() > 1) { result.add("Printing xpath suppressions is allowed for only one file."); } } else if (hasConfigurationFile) { try { CommonUtil.getUriByFilename(configurationFile); } catch (CheckstyleException ignored) { final String msg = "Could not find config XML file '%s'."; result.add(String.format(Locale.ROOT, msg, configurationFile)); } result.addAll(validateOptionalCliParameters()); } else { result.add("Must specify a config XML file."); } return result; }

Target:
private List<String> validateCli(ParseResult parseResult, List<File> filesToProcess) { final List<String> result = new ArrayList<>(); final boolean hasConfigurationFile = configurationFile != null; final boolean hasSuppressionLineColumnNumber = suppressionLineColumnNumber != null; if (filesToProcess.isEmpty()) { result.add("Files to process must be specified, found 0."); } else if (printAst || printAstWithComments || printJavadocTree || printTreeWithJavadoc || xpath != null) { if (suppressionLineColumnNumber != null || configurationFile != null || propertiesFile != null || outputPath != null || parseResult.hasMatchedOption(OUTPUT_FORMAT_OPTION)) { result.add("Option '-t' cannot be used with other options."); } else if (filesToProcess.size() > 1) { result.add("Printing AST is allowed for only one file."); } } else if (hasSuppressionLineColumnNumber) { if (configurationFile != null || propertiesFile != null || outputPath != null || parseResult.hasMatchedOption(OUTPUT_FORMAT_OPTION)) { result.add("Option '-s' cannot be used with other options."); } else if (filesToProcess.size() > 1) { result.add("Printing xpath suppressions is allowed for only one file."); } } else if (hasConfigurationFile) { try { CommonUtil.getUriByFilename(configurationFile); } catch (CheckstyleException ignored) { final String msg = "Could not find config XML file '%s'."; result.add(String.format(Locale.ROOT, msg, configurationFile)); } result.addAll(validateOptionalCliParametersIfConfigDefined()); } else { result.add("Must specify a config XML file."); } return result; }
Source:
private void checkConnection () throws SQLException { Statement statement = null; try { statement = connection.createStatement(); @SuppressWarnings("unused") ResultSet r = statement.executeQuery("select null"); } finally { if (statement != null) { statement.close(); } } }

Target:
private void checkConnection () throws SQLException { if (!connection.isValid(0)) { throw new SQLException("The connection has been closed or invalid."); } }
Source:
private void updateShareableDiskEnabled() { StorageDomain storageDomain = getStorageDomain().getSelectedItem(); if (storageDomain != null && (StorageType.GLUSTERFS == storageDomain.getStorageType() || storageDomain.getStorageType().equals(StorageType.MANAGED_BLOCK_STORAGE))) { getIsShareable().setEntity(false); getIsShareable().setIsChangeable(false, constants.shareableDiskNotSupported()); } else if (getVolumeType().getSelectedItem() == VolumeType.Sparse && storageDomain != null && storageDomain.getStorageType().isBlockDomain()) { getIsShareable().setEntity(false); getIsShareable().setIsChangeable(false, constants.shareableDiskNotSupportedByConfiguration()); } else { getIsShareable().setIsChangeable(isEditEnabled(), constants.shareableDiskNotSupportedOnRunningVM()); } Frontend.getInstance() .runQuery(QueryType.GetClustersByStoragePoolId, new IdQueryParameters(storageDomain.getStoragePoolId()), new AsyncQuery<QueryReturnValue>( value -> enablePreallocatedAsDefaultforHC((List<Cluster>) value.getReturnValue()))); }

Target:
private void updateShareableDiskEnabled() { StorageDomain storageDomain = getStorageDomain().getSelectedItem(); if (storageDomain != null && (StorageType.GLUSTERFS == storageDomain.getStorageType() || storageDomain.getStorageType().equals(StorageType.MANAGED_BLOCK_STORAGE))) { getIsShareable().setEntity(false); getIsShareable().setIsChangeable(false, constants.shareableDiskNotSupported()); } else if (getVolumeType().getSelectedItem() == VolumeType.Sparse && storageDomain != null && storageDomain.getStorageType().isBlockDomain()) { getIsShareable().setEntity(false); getIsShareable().setIsChangeable(false, constants.shareableDiskNotSupportedByConfiguration()); } else { getIsShareable().setIsChangeable(isEditEnabled(), constants.shareableDiskNotSupportedOnRunningVM()); } Frontend.getInstance() .runQuery(QueryType.GetClusterById, new IdQueryParameters(getHost().getSelectedItem().getClusterId()), new AsyncQuery<QueryReturnValue>( value -> enablePreallocatedAsDefaultforHC((Cluster) value.getReturnValue()))); }
Source:
private void decodeCallRequest(ChannelHandlerContext ctx, CallRequestFrame frame, List<Object> out) { assert this.messageMap.get(frame.getId()) == null; assert this.defragmentationState.get(frame.getId()) == null; ArgScheme scheme = ArgScheme.toScheme(frame.getHeaders().get(TransportHeaders.ARG_SCHEME_KEY)); if (!ArgScheme.isSupported(scheme)) { ErrorFrame error = sendError(ErrorType.BadRequest, "Invalid arg schema", frame.getId(), ctx); this.errorMap.put(frame.getId(), error); return; } ByteBuf arg1 = this.readArg(frame); ByteBuf arg2 = this.readArg(frame); ByteBuf arg3 = this.readArg(frame); Request req = Request.build( scheme, frame.getId(), frame.getTTL(), frame.getService(), frame.getHeaders(), arg1, arg2, arg3); this.messageMap.put(frame.getId(), req); }

Target:
private void decodeCallRequest(ChannelHandlerContext ctx, CallRequestFrame frame, List<Object> out) { ArgScheme scheme = ArgScheme.toScheme(frame.getHeaders().get(TransportHeaders.ARG_SCHEME_KEY)); if (!ArgScheme.isSupported(scheme)) { ErrorFrame error = sendError(ErrorType.BadRequest, "Invalid arg schema", frame.getId(), ctx); this.errorMap.put(frame.getId(), error); return; } ByteBuf arg1 = this.readArg(frame); ByteBuf arg2 = this.readArg(frame); ByteBuf arg3 = this.readArg(frame); Request req = Request.build( scheme, frame.getId(), frame.getTTL(), frame.getService(), frame.getHeaders(), arg1, arg2, arg3); this.messageMap.put(frame.getId(), req); }
Source:
private <T> void handleServiceAsync(final CompletableFuture<T> fut, ClientOperation op, Consumer<PayloadOutputChannel> payloadWriter, Function<PayloadInputChannel, T> payloadReader, int attemptsLimit, ClientConnectionException failure) { T2<ClientChannel, Integer> chAndAttempts; try { chAndAttempts = applyOnDefaultChannel(channel -> channel, attemptsLimit); } catch (Throwable ex) { fut.completeExceptionally(ex); return; } ClientChannel ch = chAndAttempts.getKey(); ch .serviceAsync(op, payloadWriter, payloadReader) .handle((res, err) -> { if (err == null) { fut.complete(res); return null; } ClientConnectionException failure0 = failure; if (err instanceof ClientConnectionException) { try { onChannelFailure(ch); } catch (Throwable ex) { fut.completeExceptionally(ex); return null; } if (failure0 == null) failure0 = (ClientConnectionException)err; else failure0.addSuppressed(err); int leftAttempts = attemptsLimit - chAndAttempts.getValue(); if (failure == null) leftAttempts = getRetryLimit() - 1; if (leftAttempts > 0) { handleServiceAsync(fut, op, payloadWriter, payloadReader, leftAttempts, failure0); return null; } } else { fut.completeExceptionally(err instanceof ClientException ? err : new ClientException(err)); return null; } fut.completeExceptionally(failure0); return null; }); }

Target:
private <T> void handleServiceAsync(final CompletableFuture<T> fut, ClientOperation op, Consumer<PayloadOutputChannel> payloadWriter, Function<PayloadInputChannel, T> payloadReader, int attemptsLimit, ClientConnectionException failure) { ClientChannel ch; int attemptsCnt[] = new int[1]; try { ch = applyOnDefaultChannel(channel -> channel, attemptsLimit, v -> attemptsCnt[0] = v ); } catch (Throwable ex) { if (failure != null) { failure.addSuppressed(ex); fut.completeExceptionally(failure); return; } fut.completeExceptionally(ex); return; } ch .serviceAsync(op, payloadWriter, payloadReader) .handle((res, err) -> { if (err == null) { fut.complete(res); return null; } ClientConnectionException failure0 = failure; if (err instanceof ClientConnectionException) { try { onChannelFailure(ch); } catch (Throwable ex) { fut.completeExceptionally(ex); return null; } if (failure0 == null) failure0 = (ClientConnectionException)err; else failure0.addSuppressed(err); int leftAttempts = attemptsLimit - attemptsCnt[0]; if (failure == null) leftAttempts = getRetryLimit() - 1; if (leftAttempts > 0) { handleServiceAsync(fut, op, payloadWriter, payloadReader, leftAttempts, failure0); return null; } } else { fut.completeExceptionally(err instanceof ClientException ? err : new ClientException(err)); return null; } fut.completeExceptionally(failure0); return null; }); }
Source:
public PrefabData load(ResourceUrn resourceUrn, List<AssetDataFile> inputs) throws IOException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputs.get(0).openStream(), Charsets.UTF_8))) { EntityData.Prefab prefabData = EntityDataJSONFormat.readPrefab(reader); if (prefabData != null) { logger.info("Attempting to deserialize prefab with inputs {}", resourceUrn, inputs); PrefabSerializer serializer = new PrefabSerializer(componentLibrary, typeSerializationLibrary); return serializer.deserialize(prefabData); } else { logger.error("Failed to read prefab for '" + resourceUrn + "'"); return null; } } }

Target:
public PrefabData load(ResourceUrn resourceUrn, List<AssetDataFile> inputs) throws IOException { try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputs.get(0).openStream(), Charsets.UTF_8))) { EntityData.Prefab prefabData = EntityDataJSONFormat.readPrefab(reader); if (prefabData != null) { logger.info("Attempting to deserialize prefab with inputs {}", resourceUrn, inputs); PrefabSerializer serializer = new PrefabSerializer(componentLibrary, typeSerializationLibrary); return serializer.deserialize(prefabData); } else { throw new IOException("Failed to read prefab for '" + resourceUrn + "'"); } } }
Source:
public PlanNode visitAggregation(AggregationNode node, RewriteContext<Set<VariableReferenceExpression>> context) { ImmutableSet.Builder<VariableReferenceExpression> expectedInputs = ImmutableSet.<VariableReferenceExpression>builder() .addAll(node.getGroupingKeys()); if (node.getHashVariable().isPresent()) { expectedInputs.add(node.getHashVariable().get()); } ImmutableMap.Builder<VariableReferenceExpression, Aggregation> aggregations = ImmutableMap.builder(); for (Map.Entry<VariableReferenceExpression, Aggregation> entry : node.getAggregations().entrySet()) { VariableReferenceExpression variable = entry.getKey(); if (context.get().contains(variable)) { Aggregation aggregation = entry.getValue(); expectedInputs.addAll( extractUniqueVariables(aggregation, symbolAllocator.getTypes()) .stream() .collect(toImmutableList())); aggregation.getMask().ifPresent(mask -> expectedInputs.add(mask)); aggregations.put(variable, aggregation); } } PlanNode source = context.rewrite(node.getSource(), expectedInputs.build()); return new AggregationNode(node.getId(), source, aggregations.build(), node.getGroupingSets(), ImmutableList.of(), node.getStep(), node.getHashVariable(), node.getGroupIdVariable()); }

Target:
public PlanNode visitAggregation(AggregationNode node, RewriteContext<Set<VariableReferenceExpression>> context) { ImmutableSet.Builder<VariableReferenceExpression> expectedInputs = ImmutableSet.<VariableReferenceExpression>builder() .addAll(node.getGroupingKeys()); if (node.getHashVariable().isPresent()) { expectedInputs.add(node.getHashVariable().get()); } ImmutableMap.Builder<VariableReferenceExpression, Aggregation> aggregations = ImmutableMap.builder(); for (Map.Entry<VariableReferenceExpression, Aggregation> entry : node.getAggregations().entrySet()) { VariableReferenceExpression variable = entry.getKey(); if (context.get().contains(variable)) { Aggregation aggregation = entry.getValue(); expectedInputs.addAll(extractAggregationUniqueVariables(aggregation, symbolAllocator.getTypes())); aggregation.getMask().ifPresent(mask -> expectedInputs.add(mask)); aggregations.put(variable, aggregation); } } PlanNode source = context.rewrite(node.getSource(), expectedInputs.build()); return new AggregationNode(node.getId(), source, aggregations.build(), node.getGroupingSets(), ImmutableList.of(), node.getStep(), node.getHashVariable(), node.getGroupIdVariable()); }
Source:
public IndexReference indexCreate( SchemaDescriptor descriptor, String providerName ) throws SchemaKernelException { acquireExclusiveLabelLock( descriptor.keyId() ); ktx.assertOpen(); assertValidDescriptor( descriptor, SchemaKernelException.OperationContext.INDEX_CREATION ); assertIndexDoesNotExist( SchemaKernelException.OperationContext.INDEX_CREATION, descriptor ); SchemaIndexDescriptor indexDescriptor = SchemaIndexDescriptorFactory.forSchema( descriptor ); IndexProvider.Descriptor providerDescriptor = null; if ( providerName != null ) { IndexProviderDescriptorByName candidates = new IndexProviderDescriptorByName( providerName ); indexProviderMap.accept( candidates ); providerDescriptor = candidates.single(); } ktx.txState().indexRuleDoAdd( indexDescriptor, providerDescriptor ); return DefaultIndexReference.fromDescriptor( indexDescriptor ); }

Target:
public IndexReference indexCreate( SchemaDescriptor descriptor, String providerName ) throws SchemaKernelException { acquireExclusiveLabelLock( descriptor.keyId() ); ktx.assertOpen(); assertValidDescriptor( descriptor, SchemaKernelException.OperationContext.INDEX_CREATION ); assertIndexDoesNotExist( SchemaKernelException.OperationContext.INDEX_CREATION, descriptor ); SchemaIndexDescriptor indexDescriptor = SchemaIndexDescriptorFactory.forSchema( descriptor ); IndexProvider.Descriptor providerDescriptor = providerByName( providerName ); ktx.txState().indexRuleDoAdd( indexDescriptor, providerDescriptor ); return DefaultIndexReference.fromDescriptor( indexDescriptor ); }
Source:
public void scheduleJobs() { SchedulerUtil sched = getSchedulUtil(); int refreshRate = Config.<Integer> getValue(ConfigValues.VdsRefreshRate) * 1000; registeredJobs.add(sched.scheduleAFixedDelayJob( this, "onTimer", new Class[0], new Object[0], refreshRate, refreshRate, TimeUnit.MILLISECONDS)); double availableUpdatesRefreshRate = Config.<Double> getValue(ConfigValues.HostPackagesUpdateTimeInHours); final int HOURS_TO_MINUTES = 60; long rateInMinutes = Math.round(availableUpdatesRefreshRate * HOURS_TO_MINUTES); registeredJobs.add(sched.scheduleAFixedDelayJob( this, "availableUpdates", new Class[0], new Object[0], RandomUtils.nextInt(HOURS_TO_MINUTES) + 1, rateInMinutes, TimeUnit.MINUTES)); vmsRefresher = getRefresherFactory().create(this); vmsRefresher.startMonitoring(); new RefreshHostOnHostConnectionChangeEvent(this).subscribe(); }

Target:
public void scheduleJobs() { SchedulerUtil sched = getSchedulUtil(); int refreshRate = Config.<Integer> getValue(ConfigValues.VdsRefreshRate) * 1000; registeredJobs.add(sched.scheduleAFixedDelayJob( this, "onTimer", new Class[0], new Object[0], refreshRate, refreshRate, TimeUnit.MILLISECONDS)); double availableUpdatesRefreshRate = Config.<Double> getValue(ConfigValues.HostPackagesUpdateTimeInHours); final int HOURS_TO_MINUTES = 60; long rateInMinutes = Math.round(availableUpdatesRefreshRate * HOURS_TO_MINUTES); registeredJobs.add(sched.scheduleAFixedDelayJob( this, "availableUpdates", new Class[0], new Object[0], RandomUtils.nextInt(HOURS_TO_MINUTES) + 1, rateInMinutes, TimeUnit.MINUTES)); vmsRefresher = getRefresherFactory().create(this); vmsRefresher.startMonitoring(); hostRefresher = new RefreshHostOnHostConnectionChangeEvent(this); hostRefresher.startMonitoring(); }
Source:
private void unregisterRegion(final String encodedName) { LOG.info("Unregister region {}", encodedName); if (primaryRegionsUnderReplication.get(encodedName) == null) { LOG.warn("Try to unregister a unregistered region {}", encodedName); return; } CatalogReplicaShipper[] replicaShippers = primaryRegionsUnderReplication.remove(encodedName); for (CatalogReplicaShipper s : replicaShippers) { s.setRunning(false); } }

Target:
private void unregisterRegion(final String encodedName) { LOG.info("Unregister region {}", encodedName); if (primaryRegionsUnderReplication.get(encodedName) == null) { LOG.warn("Try to unregister a unregistered region {}", encodedName); return; } CatalogReplicaShipper[] replicaShippers = primaryRegionsUnderReplication.remove(encodedName); for (CatalogReplicaShipper s : replicaShippers) { s.stopShipper(); } }
Source:
public ConstraintViolationProblem(final List<Violation> violations) { this(Optional.empty(), violations); }

Target:
public ConstraintViolationProblem(final List<Violation> violations) { this(Optional.empty(), new ArrayList<>(violations)); }
Source:
public void testConcurrentWKBFootprintsLoading() throws Exception { WKBLoaderSPI loaderSPI = new WKBLoaderSPI(); FootprintLoader loader = loaderSPI.createLoader(); File newFolder = folder.newFolder(); File footprintFile = TestData.file(this, "footprint_wkbs/r1c1.wkb"); String footprintPath = footprintFile.getAbsolutePath(); String fileName = FilenameUtils.getName(footprintPath); footprintPath = footprintPath.substring(0, footprintPath.length() - 4); Geometry footprint = loader.loadFootprint(footprintPath); int numberOfSamples = 60; String[] testFiles = new String[numberOfSamples]; for (int i = 0; i < numberOfSamples; i++) { String newName = fileName.replace("c1", String.format("c%03d", i)); File ithFile = new File(newFolder, newName); FileUtils.copyFile(footprintFile, ithFile); File ithFootprintFile = new File(newFolder, FilenameUtils.getBaseName(newName)); testFiles[i] = ithFootprintFile.getAbsolutePath(); } ExecutorService service = Executors.newFixedThreadPool(numberOfSamples / 2); CountDownLatch latch = new CountDownLatch(numberOfSamples); List<Geometry> geometries = new ArrayList<>(numberOfSamples); AtomicInteger errors = new AtomicInteger(); try { for (int i = 0; i < numberOfSamples; i++) { int finalI = i; service.submit( () -> { try { geometries.add(loader.loadFootprint(testFiles[finalI])); } catch (InterruptedException e) { } catch (Exception e) { errors.getAndIncrement(); } latch.countDown(); }); } latch.await(); } catch (InterruptedException e) { } finally { folder.delete(); } assertEquals(0, errors.get()); for (Geometry geometry : geometries) { assertEquals(geometry, footprint); } }

Target:
public void testConcurrentWKBFootprintsLoading() throws Exception { WKBLoaderSPI loaderSPI = new WKBLoaderSPI(); FootprintLoader loader = loaderSPI.createLoader(); File newFolder = folder.newFolder(); File footprintFile = TestData.file(this, "footprint_wkbs/r1c1.wkb"); String footprintPath = footprintFile.getAbsolutePath(); String fileName = FilenameUtils.getName(footprintPath); footprintPath = footprintPath.substring(0, footprintPath.length() - 4); Geometry footprint = loader.loadFootprint(footprintPath); int numberOfSamples = 60; String[] testFiles = new String[numberOfSamples]; for (int i = 0; i < numberOfSamples; i++) { String newName = fileName.replace("c1", String.format("c%03d", i)); File ithFile = new File(newFolder, newName); FileUtils.copyFile(footprintFile, ithFile); File ithFootprintFile = new File(newFolder, FilenameUtils.getBaseName(newName)); testFiles[i] = ithFootprintFile.getAbsolutePath(); } ExecutorService service = Executors.newFixedThreadPool(numberOfSamples / 2); CountDownLatch latch = new CountDownLatch(numberOfSamples); List<Geometry> geometries = new ArrayList<>(numberOfSamples); AtomicInteger errors = new AtomicInteger(); try { for (int i = 0; i < numberOfSamples; i++) { int finalI = i; service.submit( () -> { try { geometries.add(loader.loadFootprint(testFiles[finalI])); } catch (Exception e) { errors.getAndIncrement(); } latch.countDown(); }); } latch.await(); } finally { folder.delete(); } assertEquals(0, errors.get()); for (Geometry geometry : geometries) { assertEquals(geometry, footprint); } }
Source:
public static String joinParticipantTypes(List<FeedbackParticipantType> participants, String delimiter) { if (participants.isEmpty()) { return ""; } else { String result = ""; for (FeedbackParticipantType fpt: participants) { result += fpt + delimiter; } return result.substring(0, result.length() - delimiter.length()); } }

Target:
public static String joinParticipantTypes(List<FeedbackParticipantType> participants, String delimiter) { String result = ""; if (!participants.isEmpty()) { for (FeedbackParticipantType fpt : participants) { result += fpt + delimiter; } result = result.substring(0, result.length() - delimiter.length()); } return result; }
Source:
private int matchResultColour(MatchResult result) { int colour; switch (result) { case WON: colour = R.color.battlereport_won; break; case LOST: colour = R.color.battlereport_lost; break; case DRAW: colour = R.color.battlereport_draw; break; default: return R.color.black; } return context.getResources().getColor(colour); }

Target:
private int matchResultColour(MatchResult result) { int colour; switch (result) { case WON: colour = R.color.battlereport_won; break; case LOST: colour = R.color.battlereport_lost; break; case DRAW: colour = R.color.battlereport_draw; break; default: colour = R.color.black; break; } return context.getResources().getColor(colour); }
Source:
public void test447460MultipleUpdateConfiguration() throws Exception { IProject project = importProject("projects/447460_MultipleUpdateConfiguration/pom.xml"); IJavaProject javaProject = JavaCore.create(project); List<IClasspathEntry> cpEntries = filterClasspath(javaProject.getRawClasspath(), IClasspathEntry.CPE_SOURCE); assertNotNull(cpEntries); assertEquals("Invalid number of classpath entries", 4, cpEntries.size()); for(IClasspathEntry cpEntry : cpEntries) { IPath[] exclusions = cpEntry.getExclusionPatterns(); assertNotNull(exclusions); assertEquals("Classpath entry contains an exclusion pattern.", 0, exclusions.length); } }

Target:
public void test447460MultipleUpdateConfiguration() throws Exception { IProject project = importProject("projects/447460_MultipleUpdateConfiguration/pom.xml"); IJavaProject javaProject = JavaCore.create(project); List<IClasspathEntry> cpEntries = filterClasspath(javaProject.getRawClasspath(), IClasspathEntry.CPE_SOURCE); assertNotNull(cpEntries); assertEquals("Invalid number of classpath entries", 4, cpEntries.size()); for(IClasspathEntry cpEntry : cpEntries) { String[] path = cpEntry.getPath().segments(); if("java".equals(path[path.length - 1])) { IPath[] exclusions = cpEntry.getExclusionPatterns(); assertNotNull(exclusions); assertEquals("Classpath source entry isn't supposed to contain any exclusion pattern.", 0, exclusions.length); } else { IPath[] exclusions = cpEntry.getExclusionPatterns(); assertNotNull(exclusions); assertEquals("Classpath resource entry contains more or less than one exclusion pattern.", 1, exclusions.length); assertEquals("Exclusion pattern is supposed to be '**' !", new Path("**"), exclusions[0]); } } }
Source:
private Map<String, Object> getMap(List<String> fields, Aggregations aggregations) { final String field = fields.get(0); final List<String> remainingFields = (fields.size() > 1) ? fields.subList(1, fields.size()) : new ArrayList<>(); Terms terms = aggregations.get(Utils.sanitizeFieldForAggregation(field)); Map<String, Object> levelCount = new HashMap<>(); for (Terms.Bucket bucket : terms.getBuckets()) { if (fields.size() == 1) { levelCount.put(bucket.getKey(), bucket.getDocCount()); } else { levelCount.put(bucket.getKey(), getMap(remainingFields, bucket.getAggregations())); } } return levelCount; }

Target:
private Map<String, Object> getMap(List<String> fields, Aggregations aggregations) { final String field = fields.get(0); final List<String> remainingFields = (fields.size() > 1) ? fields.subList(1, fields.size()) : new ArrayList<>(); Terms terms = aggregations.get(Utils.sanitizeFieldForAggregation(field)); Map<String, Object> levelCount = Maps.newHashMap(); for (Terms.Bucket bucket : terms.getBuckets()) { if (fields.size() == 1) { levelCount.put(bucket.getKey(), bucket.getDocCount()); } else { levelCount.put(bucket.getKey(), getMap(remainingFields, bucket.getAggregations())); } } return levelCount; }
Source:
MantaObjectOutputStream(final String path, final HttpHelper httpHelper, final MantaHttpHeaders mantaHttpHeaders, final MantaMetadata metadata, final ContentType contentType) { this.httpContent = new EmbeddedHttpContent(contentType.toString(), closed); this.path = path; final MantaHttpHeaders headers; if (mantaHttpHeaders == null) { headers = new MantaHttpHeaders(); } else { headers = mantaHttpHeaders; } if (contentType != null) { headers.setContentType(contentType.toString()); } this.completed = EXECUTOR.submit(() -> httpHelper.httpPut(path, headers, httpContent, metadata)); synchronized (this.httpContent) { while (!isClosed() && !httpContent.isClosed() && httpContent.getWriter() == null) { try { this.httpContent.wait(CLOSED_CHECK_INTERVAL); } catch (InterruptedException e) { return; } } } }

Target:
MantaObjectOutputStream(final String path, final HttpHelper httpHelper, final MantaHttpHeaders mantaHttpHeaders, final MantaMetadata metadata, final ContentType contentType) { this.httpContent = new EmbeddedHttpContent(contentType.toString(), closed); this.path = path; final MantaHttpHeaders headers; if (mantaHttpHeaders == null) { headers = new MantaHttpHeaders(); } else { headers = mantaHttpHeaders; } if (contentType != null) { headers.setContentType(contentType.toString()); } this.completed = EXECUTOR.submit(() -> httpHelper.httpPut(path, headers, httpContent, metadata)); synchronized (this.httpContent) { while (httpContent.getWriter() == null && !isClosed()) { try { this.httpContent.wait(CLOSED_CHECK_INTERVAL); } catch (InterruptedException e) { return; } } } }
Source:
public static Map<String, Object> dictionaryToMap(Dictionary<String, Object> dictionary, OCD ocd) { if (dictionary == null) { return null; } Map<String, AD> ads = new HashMap<String, AD>(); if (ocd != null) { for (AD ad : ocd.getAD()) { ads.put(ad.getId(), ad); } } Map<String, Object> map = new HashMap<String, Object>(); Enumeration<String> keys = dictionary.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); Object value = dictionary.get(key); AD ad = ads.get(key); if (ad != null && ad.getType() != null && Scalar.PASSWORD.equals(ad.getType())) { if (value instanceof char[]) { map.put(key, new Password((char[]) value)); } if (value instanceof String[]) { map.put(key, convertStringsToPasswords((String[]) value)); } else { map.put(key, new Password(value.toString())); } } else { map.put(key, value); } } return map; }

Target:
public static Map<String, Object> dictionaryToMap(Dictionary<String, Object> dictionary, OCD ocd) { if (dictionary == null) { return null; } Map<String, AD> ads = new HashMap<String, AD>(); if (ocd != null) { for (AD ad : ocd.getAD()) { ads.put(ad.getId(), ad); } } Map<String, Object> map = new HashMap<String, Object>(); Enumeration<String> keys = dictionary.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); Object value = dictionary.get(key); AD ad = ads.get(key); if (ad != null && ad.getType() != null && Scalar.PASSWORD.equals(ad.getType())) { if (value instanceof char[]) { map.put(key, new Password((char[]) value)); } else if (value instanceof String[]) { map.put(key, convertStringsToPasswords((String[]) value)); } else { map.put(key, new Password(value.toString())); } } else { map.put(key, value); } } return map; }
Source:
public void tearDown() throws Exception { super.tearDown(); if (origApp != null) Entities.destroyAll(newApp.getManagementContext()); if (mementoDir != null) RebindTestUtils.deleteMementoDir(mementoDir); }

Target:
public void tearDown() throws Exception { super.tearDown(); if (origApp != null) Entities.destroyAll(origApp.getManagementContext()); if (mementoDir != null) RebindTestUtils.deleteMementoDir(mementoDir); }
Source:
private void internalStep(final float delta) { if (delta <= 0) { return; } doAddRemoves(); occupiedSpaces.clear(); dynamicBodies.stream().forEach(body -> { if (body.active) { updateDynamics(body, delta); updateInput(body, delta); moveBody(body, delta); updateOccupiedSpaces(body); resetCollisions(body); } }); kineticBodies.stream().forEach(body -> { if (body.active) { updateKinetics(body); moveBody(body, delta); updateOccupiedSpaces(body); resetCollisions(body); } }); staticBodies.stream().forEach(body -> { if (body.active) { updateOccupiedSpaces(body); } }); dynamicBodies.stream().filter(body -> body.active).forEach(body -> { buildLevelCollisions(body); expireContact(body); findNewContact(body); }); kineticBodies.stream().filter(body -> body.active).forEach(body -> buildKineticCollections(body)); resolveAndApplyPendingResolutions(); dynamicBodies.parallelStream().filter(body -> body.active && body.stateWatcher != null).forEach(body -> body.stateWatcher.update(body)); }

Target:
private void internalStep(final float delta) { if (delta <= 0) { return; } doAddRemoves(); occupiedSpaces.clear(); dynamicBodies.stream().forEach(body -> { if (body.active) { updateDynamics(body, delta); updateInput(body, delta); moveBody(body, delta); updateOccupiedSpaces(body); resetCollisions(body); } }); kineticBodies.stream().forEach(body -> { if (body.active) { updateKinetics(body); moveBody(body, delta); updateOccupiedSpaces(body); resetCollisions(body); } }); staticBodies.stream().forEach(body -> { if (body.active) { updateOccupiedSpaces(body); } }); dynamicBodies.stream().forEach(body -> { if (body.active) { buildLevelCollisions(body); expireContact(body); findNewContact(body); } }); resolveAndApplyPendingResolutions(); dynamicBodies.parallelStream().filter(body -> body.active && body.stateWatcher != null).forEach(body -> body.stateWatcher.update(body)); }
Source:
public <T> T getObject(String columnLabel, Class<T> type) throws SQLException { return null; }

Target:
public <T> T getObject(String columnLabel, Class<T> type) throws SQLException { throw new UnsupportedOperationException("HPCCResultSet: getPseudoColumns Not supported yet."); }
Source:
public void testTriggerBucketBalancer() { assertUpdate("CREATE TABLE test_bucket_balancer (c1 bigint, c2 bigint)"); assertUpdate("INSERT INTO test_bucket_balancer VALUES (1, 1), (1, 2), (1, 3), (1, 4), (11, 1), (11, 2)", 6); assertUpdate("CALL system.trigger_bucket_balancer()"); assertUpdate("DROP TABLE test_bucket_balancer"); }

Target:
public void testTriggerBucketBalancer() { assertUpdate("CALL system.trigger_bucket_balancer()"); }
Source:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartMessageEvent emptyTop = getStartNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, StartMessageEvent.class); assertGeneralSet(emptyTop.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptyTop.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, ""); assertDataIOSet(emptyTop.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartMessageEvent emptyTop = getStartNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, StartMessageEvent.class); assertGeneralSet(emptyTop.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptyTop.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, EMPTY_VALUE); assertDataIOSet(emptyTop.getDataIOSet(), EMPTY_VALUE); }
Source:
private void defineErrorRethrower(List<Statement> stats) { stats.add(0, new ExpressionStatement( new DeclarationExpression( new VariableExpression(SpockNames.ERROR_COLLECTOR, nodeCache.ErrorCollector), Token.newSymbol(Types.ASSIGN, -1, -1), new VariableExpression(SpockNames.ERROR_COLLECTOR)))); }

Target:
private void defineErrorRethrower(List<Statement> stats) { stats.add(0, new ExpressionStatement( new DeclarationExpression( new VariableExpression(SpockNames.ERROR_COLLECTOR, nodeCache.ErrorCollector), Token.newSymbol(Types.ASSIGN, -1, -1), new PropertyExpression(new ClassExpression(nodeCache.ErrorRethrower), "INSTANCE")))); }
Source:
public JournalFile openFile() throws InterruptedException, IOException { if (JournalFilesRepository.trace) { JournalFilesRepository.trace("enqueueOpenFile with openedFiles.size=" + openedFiles.size()); } if (openFilesExecutor == null) { pushOpenRunnable.run(); } else { openFilesExecutor.execute(pushOpenRunnable); } JournalFile nextFile = openedFiles.poll(5, TimeUnit.SECONDS); if (nextFile == null) { fileFactory.onIOError(ActiveMQJournalBundle.BUNDLE.fileNotOpened(), "unable to open ", null); } if (nextFile == null) { fileFactory.activateBuffer(journal.getCurrentFile().getFile()); throw new IOException("unable to open file"); } if (JournalFilesRepository.trace) { JournalFilesRepository.trace("Returning file " + nextFile); } return nextFile; }

Target:
public JournalFile openFile() throws InterruptedException, ActiveMQIOErrorException { if (JournalFilesRepository.trace) { JournalFilesRepository.trace("enqueueOpenFile with openedFiles.size=" + openedFiles.size()); } if (openFilesExecutor == null) { pushOpenRunnable.run(); } else { openFilesExecutor.execute(pushOpenRunnable); } JournalFile nextFile = openedFiles.poll(5, TimeUnit.SECONDS); if (nextFile == null) { fileFactory.onIOError(ActiveMQJournalBundle.BUNDLE.fileNotOpened(), "unable to open ", null); fileFactory.activateBuffer(journal.getCurrentFile().getFile()); throw ActiveMQJournalBundle.BUNDLE.fileNotOpened(); } if (JournalFilesRepository.trace) { JournalFilesRepository.trace("Returning file " + nextFile); } return nextFile; }
Source:
public static String readResourceFile(String file) { InputStream is = getResourceAsStream(file); try (Scanner scanner = new Scanner(is, Const.SystemParams.ENCODING)) { return scanner.useDelimiter("\\Z").next(); } }

Target:
public static String readResourceFile(String file) { try (Scanner scanner = new Scanner(getResourceAsStream(file), Const.SystemParams.ENCODING)) { return scanner.useDelimiter("\\Z").next(); } }