auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Page<String> findInStatusSince( long timestamp, WorkspaceStatus status, int maxItems, long skipCount) { List<String> all = workspaceActivities .values() .stream() .filter(a -> a.getStatus() == status) .filter( a -> { switch (status) { case STOPPED: case STOPPING: case RUNNING: case STARTING: return isGreater(a.getLastStopped(), timestamp); default: return false; } }) .map(WorkspaceActivity::getWorkspaceId) .collect(toList()); int total = all.size(); int from = skipCount > total ? total : (int) skipCount; int to = from + maxItems; if (to > total) { to = total; } List<String> page = all.subList(from, to); return new Page<>(page, skipCount, maxItems, all.size()); }

Target:
public Page<String> findInStatusSince( long timestamp, WorkspaceStatus status, int maxItems, long skipCount) { List<String> all = workspaceActivities .values() .stream() .filter(a -> a.getStatus() == status && isGreater(a.getLastStopped(), timestamp)) .map(WorkspaceActivity::getWorkspaceId) .collect(toList()); int total = all.size(); int from = skipCount > total ? total : (int) skipCount; int to = from + maxItems; if (to > total) { to = total; } List<String> page = all.subList(from, to); return new Page<>(page, skipCount, maxItems, all.size()); }
Source:
private void updateBusText(View view) { final TextView textView = (TextView) view.findViewById(R.id.textViewBusInformation); WifiHelper wifiHelper = new WifiHelper(this.getActivity()); if (this.busManager.isOnBus()) { textView.setText(this.busManager.getCurrentBus().getDGW()); } else if (wifiHelper.isWifiEnabled()) { textView.setText(R.string.loading_looking_for_vehicle); } else { textView.setText(R.string.you_must_activate_wifi); } }

Target:
private void updateBusText(View view) { final TextView textView = (TextView) view.findViewById(R.id.textViewBusInformation); WifiHelper wifiHelper = new WifiHelper(this.getActivity()); if (this.busManager.isOnBus()) { textView.setText(this.busManager.getCurrentBus().getDGW()); } else if (!wifiHelper.isWifiEnabled()) { textView.setText(R.string.you_must_activate_wifi); } else { textView.setText(R.string.no_buses_near); } }
Source:
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { String candidate_str = req.getParameter("candidate"); Vote vote = new Vote(Candidate.valueOf(candidate_str).ordinal()); ofy().save().entity(vote).now(); ArrayList<Vote> fakeVotes = new ArrayList<Vote>(); for (Candidate c: Candidate.values()) { Vote fakeVote = new Vote(c.ordinal()); ofy().save().entity(fakeVote).now(); fakeVotes.add(fakeVote); } req.setAttribute("realVote", vote); req.setAttribute("fakeVotes", fakeVotes); req.setAttribute("numFakeVoteBatches", 1); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/displayVoteKeys.jsp"); try { dispatcher.forward(req, resp); } catch (ServletException e) { e.printStackTrace(); } }

Target:
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { String candidate_str = req.getParameter("candidate"); ArrayList<Vote> votes = new ArrayList<Vote>(); Vote vote = new Vote(Candidate.valueOf(candidate_str).ordinal()); ofy().save().entity(vote).now(); votes.add(vote); for (Candidate c: Candidate.values()) { Vote fakeVote = new Vote(c.ordinal()); ofy().save().entity(fakeVote).now(); votes.add(fakeVote); } req.setAttribute("votes", votes); req.setAttribute("numFakeVoteBatches", 1); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/displayVoteKeys.jsp"); try { dispatcher.forward(req, resp); } catch (ServletException e) { e.printStackTrace(); } }
Source:
public RawStatement(CFName name, boolean ifNotExists) { super(name); this.ifNotExists = ifNotExists; this.isVirtual = false; this.klass = null; assert isVirtual == (klass != null); }

Target:
public RawStatement(CFName name, boolean ifNotExists) { super(name); this.ifNotExists = ifNotExists; this.isVirtual = false; this.klass = null; Preconditions.checkArgument(isVirtual == (klass != null)); }
Source:
public void executeCommand() { Pair<Boolean, VmJob> isMergeRunning = isMergeRunning(); if (isMergeRunning.getFirst()) { log.debug("Merge is already running, job id is: {}", isMergeRunning.getSecond().getId()); continueCommandExecution(isMergeRunning.getSecond().getId()); } else { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters()); if (vdsReturnValue.getSucceeded()) { continueCommandExecution((Guid)vdsReturnValue.getReturnValue()); log.debug("Merge started successfully"); } else { log.error("Failed to start Merge on VDS"); setCommandStatus(CommandStatus.FAILED); } } }

Target:
public void executeCommand() { Pair<Boolean, VmBlockJob> isMergeRunning = isMergeRunning(); if (isMergeRunning.getFirst()) { log.info("Merge is already running, job id is: {}", isMergeRunning.getSecond().getId()); continueCommandExecution(isMergeRunning.getSecond().getId()); } else { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters()); isMergeRunning = isMergeRunning(); if (vdsReturnValue.getSucceeded()) { continueCommandExecution((Guid)vdsReturnValue.getReturnValue()); log.debug("Merge started successfully"); } else { log.error("Failed to start Merge on VDS"); setCommandStatus(CommandStatus.FAILED); } } }
Source:
private static boolean containsRemoteForUrl(Config config, URIish url) throws URISyntaxException { Set<String> remotes = config.getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION); for (String remote : remotes) { String remoteUrl = config.getString( ConfigConstants.CONFIG_REMOTE_SECTION, remote, ConfigConstants.CONFIG_KEY_URL); URIish existingUrl = new URIish(remoteUrl); if (existingUrl.equals(url)) { return true; } } return false; }

Target:
private static boolean containsRemoteForUrl(Config config, URIish url) throws URISyntaxException { Set<String> remotes = config.getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION); for (String remote : remotes) { String remoteUrl = config.getString( ConfigConstants.CONFIG_REMOTE_SECTION, remote, ConfigConstants.CONFIG_KEY_URL); URIish existingUrl = new URIish(remoteUrl); if (existingUrl.equals(url)) return true; } return false; }
Source:
public void testPartitionMergePolicy() throws Throwable { final List<ViewChangedHandler> listeners = new ArrayList<>(); for (int i = 0; i < caches().size(); i++) { ViewChangedHandler listener = new ViewChangedHandler(); cache(i).getCacheManager().addListener(listener); listeners.add(listener); } beforeSplit(); splitCluster(new int[]{0, 1}, new int[]{2, 3}); eventually(() -> { for (ViewChangedHandler l : listeners) if (!l.isNotified()) return false; return true; }); eventuallyEquals(2, () -> advancedCache(0).getRpcManager().getTransport().getMembers().size()); eventually(() -> clusterAndChFormed(0, 2)); eventually(() -> clusterAndChFormed(1, 2)); eventually(() -> clusterAndChFormed(2, 2)); eventually(() -> clusterAndChFormed(3, 2)); duringSplit(); partition(0).merge(partition(1)); assertTrue(clusterAndChFormed(0, 4)); assertTrue(clusterAndChFormed(1, 4)); assertTrue(clusterAndChFormed(2, 4)); assertTrue(clusterAndChFormed(3, 4)); TestingUtil.waitForNoRebalance(caches()); afterMerge(); }

Target:
public void testPartitionMergePolicy() throws Throwable { final List<ViewChangedHandler> listeners = new ArrayList<>(); for (int i = 0; i < caches().size(); i++) { ViewChangedHandler listener = new ViewChangedHandler(); cache(i).getCacheManager().addListener(listener); listeners.add(listener); } beforeSplit(); splitCluster(new int[]{0, 1}, new int[]{2, 3}); eventually(() -> listeners.stream().allMatch(ViewChangedHandler::isNotified)); eventuallyEquals(2, () -> advancedCache(0).getRpcManager().getTransport().getMembers().size()); eventually(() -> clusterAndChFormed(0, 2)); eventually(() -> clusterAndChFormed(1, 2)); eventually(() -> clusterAndChFormed(2, 2)); eventually(() -> clusterAndChFormed(3, 2)); duringSplit(); performMerge(); afterMerge(); }
Source:
public void refresh() throws IOException { synchronized (lock) { JsonWebSignature.Header header = new JsonWebSignature.Header(); header.setAlgorithm("RS256"); header.setType("JWT"); header.setKeyId(privateKeyId); JsonWebToken.Payload payload = new JsonWebToken.Payload(); long currentTime = clock.currentTimeMillis(); payload.setAudience(claims.getAudience()); payload.setIssuer(claims.getIssuer()); payload.setSubject(claims.getSubject()); payload.setIssuedAtTimeSeconds(currentTime / 1000); expiryInSeconds = currentTime / 1000 + lifeSpanSeconds; payload.setExpirationTimeSeconds(expiryInSeconds); JsonFactory jsonFactory = OAuth2Utils.JSON_FACTORY; try { jwt = JsonWebSignature.signUsingRsaSha256(privateKey, jsonFactory, header, payload); } catch (GeneralSecurityException e) { throw new IOException("Error signing service account JWT access header with private key.", e); } } }

Target:
public void refresh() throws IOException { JsonWebSignature.Header header = new JsonWebSignature.Header(); header.setAlgorithm("RS256"); header.setType("JWT"); header.setKeyId(privateKeyId); JsonWebToken.Payload payload = new JsonWebToken.Payload(); payload.setAudience(jwtClaims.getAudience()); payload.setIssuer(jwtClaims.getIssuer()); payload.setSubject(jwtClaims.getSubject()); long currentTime = clock.currentTimeMillis(); payload.setIssuedAtTimeSeconds(currentTime / 1000); payload.setExpirationTimeSeconds(currentTime / 1000 + lifeSpanSeconds); synchronized (lock) { this.expiryInSeconds = payload.getExpirationTimeSeconds(); try { this.jwt = JsonWebSignature.signUsingRsaSha256( privateKey, OAuth2Utils.JSON_FACTORY, header, payload); } catch (GeneralSecurityException e) { throw new IOException( "Error signing service account JWT access header with private key.", e); } } }
Source:
public OngoingConfiguration respondsWithDefaultStatus(final int defaultStatus) { jadlerMockerContainer.get().setDefaultStatus(defaultStatus); return this; }

Target:
public OngoingConfiguration respondsWithDefaultStatus(final int defaultStatus) { return this.withDefaultResponseStatus(defaultStatus); }
Source:
public void should_print_deprecation_warning_if_legacy_properties_used_from_6_2() throws Exception { context.setRuntime(SONAR_QUBE_6_2); context.settings().setProperty(COVERAGE_KEY, "coverage report"); assertThat(importersFactory.deprecationWarnings()).containsExactly( String.format(DEPRECATION_WARNING_TEMPLATE, COVERAGE_KEY)); context.settings().setProperty(IT_COVERAGE_KEY, "integration coverage report"); context.settings().setProperty(OVERALL_COVERAGE_KEY, "overall coverage report"); assertThat(importersFactory.deprecationWarnings()).containsExactly( String.format(DEPRECATION_WARNING_TEMPLATE, COVERAGE_KEY), String.format(DEPRECATION_WARNING_TEMPLATE, IT_COVERAGE_KEY), String.format(DEPRECATION_WARNING_TEMPLATE, OVERALL_COVERAGE_KEY)); }

Target:
public void should_print_deprecation_warning_if_legacy_properties_used_from_6_2() throws Exception { context.setRuntime(SONARQUBE_6_2); context.settings().setProperty(COVERAGE_KEY, "coverage report"); assertThat(importersFactory.deprecationWarnings()).containsExactly( String.format(DEPRECATION_WARNING_TEMPLATE, COVERAGE_KEY)); context.settings().setProperty(IT_COVERAGE_KEY, "integration coverage report"); context.settings().setProperty(OVERALL_COVERAGE_KEY, "overall coverage report"); assertThat(importersFactory.deprecationWarnings()).containsExactly( String.format(DEPRECATION_WARNING_TEMPLATE, COVERAGE_KEY), String.format(DEPRECATION_WARNING_TEMPLATE, IT_COVERAGE_KEY), String.format(DEPRECATION_WARNING_TEMPLATE, OVERALL_COVERAGE_KEY)); }
Source:
public void setup() throws Exception { SpatialCRSSchemaIndex.Supplier indexSupplier = mock( SpatialCRSSchemaIndex.Supplier.class ); IndexDescriptor descriptor = IndexDescriptorFactory.forLabel( 42, 1337 ); for ( CoordinateReferenceSystem crs : asList( CoordinateReferenceSystem.WGS84, CoordinateReferenceSystem.Cartesian, CoordinateReferenceSystem.Cartesian_3D ) ) { indexMap.put( crs, mock( SpatialCRSSchemaIndex.class ) ); when( indexSupplier.get( descriptor, indexMap, 0, crs ) ).thenReturn( indexMap.get( crs ) ); } IndexSamplingConfig samplingConfig = mock( IndexSamplingConfig.class ); when( samplingConfig.sampleSizeLimit() ).thenReturn( 8_000_000 ); fusionIndexPopulator = new SpatialFusionIndexPopulator( indexMap, 0, descriptor, samplingConfig, indexSupplier ); }

Target:
public void setup() throws Exception { SpatialCRSSchemaIndex.Supplier indexSupplier = mock( SpatialCRSSchemaIndex.Supplier.class ); SchemaIndexDescriptor descriptor = SchemaIndexDescriptorFactory.forLabel( 42, 1337 ); for ( CoordinateReferenceSystem crs : asList( CoordinateReferenceSystem.WGS84, CoordinateReferenceSystem.Cartesian, CoordinateReferenceSystem.Cartesian_3D ) ) { indexMap.put( crs, mock( SpatialCRSSchemaIndex.class ) ); when( indexSupplier.get( descriptor, indexMap, 0, crs ) ).thenReturn( indexMap.get( crs ) ); } IndexSamplingConfig samplingConfig = mock( IndexSamplingConfig.class ); when( samplingConfig.sampleSizeLimit() ).thenReturn( 8_000_000 ); fusionIndexPopulator = new SpatialFusionIndexPopulator( indexMap, 0, descriptor, samplingConfig, indexSupplier ); }
Source:
public void testParseModeEnum() { assertEquals("Plain Java", ParseMode.PLAIN_JAVA.toString()); assertEquals("Java with comments", ParseMode.JAVA_WITH_COMMENTS.toString()); assertEquals("Java with comments and Javadocs", ParseMode.JAVA_WITH_JAVADOC_AND_COMMENTS.toString()); final int expectedEnumerations = 3; assertEquals(expectedEnumerations, ParseMode.values().length); }

Target:
public void testParseModeEnum() { for (final ParseMode parseMode : ParseMode.values()) { switch (parseMode) { case PLAIN_JAVA: assertEquals("Plain Java", parseMode.toString()); break; case JAVA_WITH_COMMENTS: assertEquals("Java with comments", parseMode.toString()); break; case JAVA_WITH_JAVADOC_AND_COMMENTS: assertEquals("Java with comments and Javadocs", parseMode.toString()); break; default: fail("Unexpected enum value"); } } }
Source:
public View getCurrentView(OptionsProvider options) throws BrokenDiffAwarenessException { boolean watchFs = options.getOptions(Options.class).watchFS && (OS.getCurrent() != OS.WINDOWS || options.getOptions(Options.class).windowsWatchFS); if (watchFs && watchService == null) { init(); } else if (!watchFs && (watchService != null)) { close(); throw new BrokenDiffAwarenessException("Switched off --watchfs again"); } if (watchService == null) { return EVERYTHING_MODIFIED; } Set<Path> modifiedAbsolutePaths; if (isFirstCall()) { try { if(OS.getCurrent() == OS.WINDOWS) { WatchKey key = watchRootPath.register( watchService, new WatchEvent.Kind[] { StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE, }, ExtendedWatchEventModifier.FILE_TREE); watchKeyToDirBiMap.put(key, watchRootPath); } else { registerSubDirectoriesAndReturnContents(watchRootPath); } } catch (IOException e) { close(); throw new BrokenDiffAwarenessException( "Error encountered with local file system watcher " + e); } modifiedAbsolutePaths = ImmutableSet.of(); } else { try { modifiedAbsolutePaths = collectChanges(); } catch (BrokenDiffAwarenessException e) { close(); throw e; } catch (IOException e) { close(); throw new BrokenDiffAwarenessException( "Error encountered with local file system watcher " + e); } catch (ClosedWatchServiceException e) { throw new BrokenDiffAwarenessException( "Internal error with the local file system watcher " + e); } } return newView(modifiedAbsolutePaths); }

Target:
public View getCurrentView(OptionsProvider options) throws BrokenDiffAwarenessException { boolean watchFs = options.getOptions(Options.class).watchFS && (!isWindows || options.getOptions(Options.class).windowsWatchFS); if (watchFs && watchService == null) { init(); } else if (!watchFs && (watchService != null)) { close(); throw new BrokenDiffAwarenessException("Switched off --watchfs again"); } if (watchService == null) { return EVERYTHING_MODIFIED; } Set<Path> modifiedAbsolutePaths; if (isFirstCall()) { try { if(isWindows) { WatchKey key = watchRootPath.register( watchService, new Kind<?>[] { StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE, }, ExtendedWatchEventModifier.FILE_TREE); watchKeyToDirBiMap.put(key, watchRootPath); } else { registerSubDirectoriesAndReturnContents(watchRootPath); } } catch (IOException e) { close(); throw new BrokenDiffAwarenessException( "Error encountered with local file system watcher " + e); } modifiedAbsolutePaths = ImmutableSet.of(); } else { try { modifiedAbsolutePaths = collectChanges(); } catch (BrokenDiffAwarenessException e) { close(); throw e; } catch (IOException e) { close(); throw new BrokenDiffAwarenessException( "Error encountered with local file system watcher " + e); } catch (ClosedWatchServiceException e) { throw new BrokenDiffAwarenessException( "Internal error with the local file system watcher " + e); } } return newView(modifiedAbsolutePaths); }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { super.configurePipeline(pipelineConfigurer); Preconditions.checkArgument(tableSinkConfig.containsMacro(Properties.Table.PROPERTY_SCHEMA_ROW_FIELD) || !Strings.isNullOrEmpty(tableSinkConfig.getRowField()), "Row field must be given as a property."); Schema outputSchema = SchemaValidator.validateOutputSchemaAndInputSchemaIfPresent(tableSinkConfig.getSchemaStr(), tableSinkConfig.getRowField(), pipelineConfigurer); if (outputSchema != null) { if (outputSchema.getFields().size() == 1) { String fieldName = outputSchema.getFields().get(0).getName(); if (fieldName.equals(tableSinkConfig.getRowField())) { throw new IllegalArgumentException( String.format("Output schema should have columns other than rowkey.")); } } else if (outputSchema.getField(tableSinkConfig.getRowField()) == null) { throw new IllegalArgumentException( String.format("Output schema should contain the rowkey column.")); } } pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { super.configurePipeline(pipelineConfigurer); Preconditions.checkArgument(tableSinkConfig.containsMacro(Properties.Table.PROPERTY_SCHEMA_ROW_FIELD) || !Strings.isNullOrEmpty(tableSinkConfig.getRowField()), "Row field must be given as a property."); Schema outputSchema = SchemaValidator.validateOutputSchemaAndInputSchemaIfPresent(tableSinkConfig.getSchemaStr(), tableSinkConfig.getRowField(), pipelineConfigurer); if (outputSchema != null) { if (outputSchema.getField(tableSinkConfig.getRowField()) == null) { throw new IllegalArgumentException("Output schema should contain the rowkey column."); } if (outputSchema.getFields().size() == 1) { throw new IllegalArgumentException("Output schema should have columns other than rowkey."); } } pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); }
Source:
public void initialize() { themeChoiceBox.getItems().addAll(UiTheme.applicableValues()); if (!themeChoiceBox.getItems().contains(settings.theme().get())) { settings.theme().set(UiTheme.LIGHT); } themeChoiceBox.valueProperty().bindBidirectional(settings.theme()); themeChoiceBox.setConverter(new UiThemeConverter(resourceBundle)); startHiddenCheckbox.selectedProperty().bindBidirectional(settings.startHidden()); debugModeCheckbox.selectedProperty().bindBidirectional(settings.debugMode()); autoStartStrategy.ifPresent(autoStart -> { CompletableFuture.completedFuture(autoStart.isEnabled()).thenAccept(enabled -> { Platform.runLater(() -> autoStartCheckbox.setSelected(enabled)); }); }); nodeOrientationLtr.setSelected(settings.userInterfaceOrientation().get() == NodeOrientation.LEFT_TO_RIGHT); nodeOrientationRtl.setSelected(settings.userInterfaceOrientation().get() == NodeOrientation.RIGHT_TO_LEFT); nodeOrientation.selectedToggleProperty().addListener(this::toggleNodeOrientation); keychainBackendChoiceBox.getItems().addAll(getAvailableBackends()); keychainBackendChoiceBox.setConverter(new KeychainBackendConverter(resourceBundle)); keychainBackendChoiceBox.valueProperty().bindBidirectional(settings.keychainBackend()); }

Target:
public void initialize() { themeChoiceBox.getItems().addAll(UiTheme.applicableValues()); if (!themeChoiceBox.getItems().contains(settings.theme().get())) { settings.theme().set(UiTheme.LIGHT); } themeChoiceBox.valueProperty().bindBidirectional(settings.theme()); themeChoiceBox.setConverter(new UiThemeConverter(resourceBundle)); startHiddenCheckbox.selectedProperty().bindBidirectional(settings.startHidden()); debugModeCheckbox.selectedProperty().bindBidirectional(settings.debugMode()); autoStartProvider.ifPresent(realProvider -> autoStartCheckbox.setSelected(realProvider.isEnabled())); nodeOrientationLtr.setSelected(settings.userInterfaceOrientation().get() == NodeOrientation.LEFT_TO_RIGHT); nodeOrientationRtl.setSelected(settings.userInterfaceOrientation().get() == NodeOrientation.RIGHT_TO_LEFT); nodeOrientation.selectedToggleProperty().addListener(this::toggleNodeOrientation); keychainBackendChoiceBox.getItems().addAll(getAvailableBackends()); keychainBackendChoiceBox.setConverter(new KeychainBackendConverter(resourceBundle)); keychainBackendChoiceBox.valueProperty().bindBidirectional(settings.keychainBackend()); }
Source:
public LocalWorkspaceFolderPathProvider(@Named("che.workspace.storage") String workspacesMountPoint, Provider<WorkspaceManager> workspaceManager) throws IOException { this.workspacesMountPoint = workspacesMountPoint; this.workspaceManager = workspaceManager; this.isWindows = SystemInfo.isWindows(); String allowFoldersCreationEnvVar = System.getenv(ALLOW_FOLDERS_CREATION_ENV_VARIABLE); if (allowFoldersCreationEnvVar != null) { if ("false".equalsIgnoreCase(allowFoldersCreationEnvVar)) { createFolders = false; } } }

Target:
public LocalWorkspaceFolderPathProvider(@Named("che.workspace.storage") String workspacesMountPoint, Provider<WorkspaceManager> workspaceManager) throws IOException { this.workspacesMountPoint = workspacesMountPoint; this.workspaceManager = workspaceManager; this.isWindows = SystemInfo.isWindows(); }
Source:
public List<AntiCsrfToken> getTokensFromResponse(HttpMessage msg, Source source) { List<AntiCsrfToken> list = new ArrayList<>(); List<Element> formElements = source.getAllElements(HTMLElementName.FORM); if (formElements != null && formElements.size() > 0) { log.debug("Found " + formElements.size() + " forms"); int formIndex = 0; for (Element formElement : formElements) { List<Element> inputElements = formElement.getAllElements(HTMLElementName.INPUT); if (inputElements != null && inputElements.size() > 0) { log.debug("Found " + inputElements.size() + " inputs"); for (Element inputElement : inputElements) { String value = inputElement.getAttributeValue("VALUE"); if (value == null) { continue; } String attId = inputElement.getAttributeValue("ID"); boolean found = false; if (attId != null && isKnownAntiCsrfToken(attId)) { list.add(new AntiCsrfToken(msg, attId, value, formIndex)); found = true; } if (!found) { String name = inputElement.getAttributeValue("NAME"); if (name != null && isKnownAntiCsrfToken(name)) { list.add(new AntiCsrfToken(msg, name, value, formIndex)); } } } } formIndex++; } } return list; }

Target:
public List<AntiCsrfToken> getTokensFromResponse(HttpMessage msg, Source source) { List<AntiCsrfToken> list = new ArrayList<>(); List<Element> formElements = source.getAllElements(HTMLElementName.FORM); if (formElements != null && formElements.size() > 0) { log.debug("Found " + formElements.size() + " forms"); int formIndex = 0; for (Element formElement : formElements) { List<Element> inputElements = formElement.getAllElements(HTMLElementName.INPUT); if (inputElements != null && inputElements.size() > 0) { log.debug("Found " + inputElements.size() + " inputs"); for (Element inputElement : inputElements) { String value = inputElement.getAttributeValue("VALUE"); if (value == null) { continue; } String attId = inputElement.getAttributeValue("ID"); boolean found = false; if (isKnownAntiCsrfToken(attId)) { list.add(new AntiCsrfToken(msg, attId, value, formIndex)); found = true; } if (!found) { String name = inputElement.getAttributeValue("NAME"); if (isKnownAntiCsrfToken(name)) { list.add(new AntiCsrfToken(msg, name, value, formIndex)); } } } } formIndex++; } } return list; }
Source:
public static Book random() { return new Book("title" + uuid(), "isbn" + uuid()); }

Target:
public static Book random() { return new Book(uuid(), uuid()); }
Source:
public Persister createPersister(ServiceParameters params, RrdRepository repository, boolean dontPersistCounters, boolean forceStoreByGroup, boolean dontReorderAttributes) { delegate = SERVICE_LOOKUP.lookup(PersisterFactory.class, "(strategy=kafka)"); if (delegate != null) { Persister persister = delegate.createPersister(params, repository); return persister; } return null; }

Target:
public Persister createPersister(ServiceParameters params, RrdRepository repository, boolean dontPersistCounters, boolean forceStoreByGroup, boolean dontReorderAttributes) { final PersisterFactory delegate = getDelegate(); if (delegate == null) { LOG.info("Unable to find any persister factory from osgi registry, use NullPersister"); return new NullPersister(); } return delegate.createPersister(params, repository, dontPersistCounters, forceStoreByGroup, dontReorderAttributes); }
Source:
static <I> AggregateEventRecord newEventRecord(I aggregateId, Snapshot snapshot) { checkNotNull(aggregateId); checkNotNull(snapshot); Timestamp value = checkValid(snapshot.getTimestamp()); String stringId = Stringifiers.toString(aggregateId); String snapshotTimestamp = Timestamps.toString(snapshot.getTimestamp()); String snapshotColumnName = AggregateEventRecordColumn.snapshot.name() .value(); String snapshotId = format("%s_%s_%s", snapshotColumnName, stringId, snapshotTimestamp); AggregateEventRecordId recordId = eventRecordId(snapshotId); return AggregateEventRecord .newBuilder() .setId(recordId) .setAggregateId(Identifier.pack(aggregateId)) .setTimestamp(value) .setSnapshot(snapshot) .build(); }

Target:
static <I> AggregateEventRecord newEventRecord(I aggregateId, Snapshot snapshot) { checkNotNull(aggregateId); checkNotNull(snapshot); Timestamp value = checkValid(snapshot.getTimestamp()); String stringId = Stringifiers.toString(aggregateId); String snapshotTimestamp = Timestamps.toString(snapshot.getTimestamp()); String snapshotColumnName = AggregateEventRecordColumn.snapshot.name() .value(); String snapshotId = format("%s_%s_%s", snapshotColumnName, stringId, snapshotTimestamp); AggregateEventRecordId recordId = eventRecordId(snapshotId); AggregateEventRecord result = AggregateEventRecord .newBuilder() .setId(recordId) .setAggregateId(Identifier.pack(aggregateId)) .setTimestamp(value) .setSnapshot(snapshot) .vBuild(); return result; }
Source:
public static void register(TestGroups groups) { groups.media.add(JavaBuiltIn.mediaTransformer, new GenericSerializer<MediaContent>("json/fastjson_array/databind", MediaContent.class), new SerFeatures( SerFormat.BINARY, SerGraph.FLAT_TREE, SerClass.ZERO_KNOWLEDGE, "" ) ); }

Target:
public static void register(TestGroups groups) { groups.media.add(JavaBuiltIn.mediaTransformer, new GenericSerializer<MediaContent>("json-array/fastjson/databind", MediaContent.class), new SerFeatures( SerFormat.JSON, SerGraph.FLAT_TREE, SerClass.ZERO_KNOWLEDGE, "" ) ); }
Source:
public void shareStoreWithMapTest() { CompilerHelper helper = new CompilerHelper(); Map<String, Object> kieMap = new HashMap<>(); String compilationID = UUID.randomUUID().toString(); kieMap.put("compilation.ID", compilationID); ProjectClassLoader pcl = ProjectClassLoader.createProjectClassLoader(); String hexContent = "e04fd020ea3a6910a2d808002b30309d"; String className = "org/my/Clazz"; pcl.storeClass(className, hexStringToByteArray(hexContent)); helper.shareStoreWithMap(pcl, compilationID, kieMap, log); StringBuilder sbTypes = new StringBuilder(compilationID).append(".").append("ProjectClassloaderStore"); kieMap.get(sbTypes.toString()); Map store = (Map) kieMap.get(sbTypes.toString()); assertThat(store).isNotNull(); assertThat(store.size()).isEqualTo(1); byte[] bytez = (byte[]) store.get(className + ".class"); assertThat(bytez).isNotNull(); String hex = toHexString(bytez); assertThat(hex).isEqualTo(hexContent); }

Target:
public void shareStoreWithMapTest() { CompilerHelper helper = new CompilerHelper(); Map<String, Object> kieMap = new HashMap<>(); String compilationID = UUID.randomUUID().toString(); kieMap.put("compilation.ID", compilationID); ProjectClassLoader pcl = ProjectClassLoader.createProjectClassLoader(); String hexContent = "e04fd020ea3a6910a2d808002b30309d"; String className = "org/my/Clazz"; pcl.storeClass(className, hexStringToByteArray(hexContent)); helper.shareStoreWithMap(pcl, compilationID, kieMap, log); StringBuilder sbTypes = new StringBuilder(compilationID).append(".").append("ProjectClassloaderStore"); kieMap.get(sbTypes.toString()); Map store = (Map) kieMap.get(sbTypes.toString()); assertThat(store).isNotNull(); assertThat(store).hasSize(1); byte[] bytez = (byte[]) store.get(className + ".class"); assertThat(bytez).isNotNull(); String hex = toHexString(bytez); assertThat(hex).isEqualTo(hexContent); }
Source:
public void should_pick_skip_pattern_from_sleuth_properties() throws Exception { contextRunner.withPropertyValues("spring.sleuth.web.skip-pattern=foo.*|bar.*") .run(context -> { SkipPatternProvider skipPatternProvider = context .getBean(SkipPatternProvider.class); Pattern pattern = skipPatternProvider.skipPattern(); then(pattern.pattern()).isEqualTo("foo.*|bar.*"); }); }

Target:
public void should_pick_skip_pattern_from_sleuth_properties() throws Exception { contextRunner.withPropertyValues("spring.sleuth.web.skip-pattern=foo.*|bar.*") .run(context -> { final String pattern = extractPattern(context); then(pattern).isEqualTo("foo.*|bar.*"); }); }
Source:
public IndexRDFCollection(Args args) throws Exception { this.args = args; String defaultAnalyzerName = "org.apache.lucene.analysis.standard.StandardAnalyzer"; ANALYZER = (Analyzer) Class.forName(defaultAnalyzerName).newInstance(); LOG.info("Collection path: " + args.input); LOG.info("Index path: " + args.index); if (args.predicatesToIndex != null && args.predicatesToIndex.size() > 0) { LOG.info("Predicates to index: " + String.join(",", args.predicatesToIndex)); } else { LOG.info("Predicates to index: None"); } this.indexPath = Paths.get(args.index); if (!Files.exists(this.indexPath)) { Files.createDirectories(this.indexPath); } collectionPath = Paths.get(args.input); if (!Files.exists(collectionPath) || !Files.isReadable(collectionPath)) { throw new IllegalArgumentException("Document file/directory " + collectionPath.toString() + " does not exist or is not readable, please check the path"); } this.transformerClass = Class.forName("io.anserini.index.generator." + args.generatorClass); this.collectionClass = Class.forName("io.anserini.collection." + args.collectionClass); collection = (Collection) this.collectionClass.newInstance(); collection.setCollectionPath(collectionPath); this.counters = new Counters(); }

Target:
public IndexRDFCollection(Args args) throws Exception { this.args = args; LOG.info("Collection path: " + args.input); LOG.info("Index path: " + args.index); if (args.predicatesToIndex != null && args.predicatesToIndex.size() > 0) { LOG.info("Predicates to index: " + String.join(",", args.predicatesToIndex)); } else { LOG.info("Predicates to index: None"); } this.indexPath = Paths.get(args.index); if (!Files.exists(this.indexPath)) { Files.createDirectories(this.indexPath); } collectionPath = Paths.get(args.input); if (!Files.exists(collectionPath) || !Files.isReadable(collectionPath)) { throw new IllegalArgumentException("Document file/directory " + collectionPath.toString() + " does not exist or is not readable, please check the path"); } this.collectionClass = Class.forName("io.anserini.collection." + args.collectionClass); collection = (Collection) this.collectionClass.newInstance(); collection.setCollectionPath(collectionPath); this.counters = new Counters(); }
Source:
private String changeUserPasswd(HttpServletRequest request, Credentials userCredentials) throws AuthenticationException { log.debug("Calling Authn to change password for user '{}@{}'.", userCredentials.getUsername(), userCredentials.getProfile()); AuthenticationUtils.changePassword(request, userCredentials); SSOUtils.getSsoSession(request).setLoginMessage("Change password succeeded, enter new credentials to login."); SSOUtils.getSsoSession(request).setTempCredentials(null); if (SSOUtils.isUserAuthenticated(request)) { log.debug("User is authenticated updating password in SSOSession for password-access scope"); SSOUtils.persistUserPassword(request, SSOUtils.getSsoSession(request), userCredentials.getNewPassword1()); } return request.getContextPath() + SSOConstants.INTERACTIVE_LOGIN_URI; }

Target:
private String changeUserPasswd(HttpServletRequest request, Credentials userCredentials) throws AuthenticationException { log.debug("Calling Authn to change password for user '{}@{}'.", userCredentials.getUsername(), userCredentials.getProfile()); AuthenticationUtils.changePassword(ssoContext, request, userCredentials); SSOUtils.getSsoSession(request).setChangePasswdCredentials(null); if (SSOUtils.isUserAuthenticated(request)) { log.debug("User is authenticated updating password in SSOSession for password-access scope."); SSOUtils.persistUserPassword(request, SSOUtils.getSsoSession(request), userCredentials.getCredentialsNew1()); } else { log.debug("User password change succeeded, redirecting to login page."); SSOUtils.getSsoSession(request).setLoginMessage("Change password succeeded, enter new credentials to login."); } return request.getContextPath() + SSOConstants.INTERACTIVE_LOGIN_URI; }
Source:
public IRenderRunnable[] getRenderRunnables() { return renderRunnables == null ? new IRenderRunnable[ 0 ] : renderRunnables; }

Target:
public Runnable[] getRenderRunnables() { return renderRunnables == null ? EMPTY : renderRunnables; }
Source:
public void shouldInvalidReturnNotNull() { assertThat(invalid(new Error("error"))).isNotNull(); }

Target:
public void shouldInvalidReturnNotNull() { assertThat(Invalid(new Error())).isNotNull(); }
Source:
public String getProperty(String name) { switch (name) { case ConfigurationProperties.COMPATIBLE_MODE: return Boolean.toString(compatibleModeEnabled); case ConfigurationProperties.RETURNING_CLAUSE_CASE_SENSITIVE: return Boolean.toString(returningClauseCaseSensitive); case ConfigurationProperties.SIZE_TO_COUNT_TRANSFORMATION: return Boolean.toString(sizeToCountTransformationEnabled); case ConfigurationProperties.IMPLICIT_GROUP_BY_FROM_SELECT: return Boolean.toString(implicitGroupByFromSelectEnabled); case ConfigurationProperties.IMPLICIT_GROUP_BY_FROM_HAVING: return Boolean.toString(implicitGroupByFromHavingEnabled); case ConfigurationProperties.IMPLICIT_GROUP_BY_FROM_ORDER_BY: return Boolean.toString(implicitGroupByFromOrderByEnabled); case ConfigurationProperties.EXPRESSION_OPTIMIZATION: return Boolean.toString(expressionOptimizationEnabled); case ConfigurationProperties.EXPRESSION_CACHE_CLASS: return expressionCacheClass; case ConfigurationProperties.VALUES_CLAUSE_FILTER_NULLS: return Boolean.toString(valuesClauseFilterNullsEnabled); case ConfigurationProperties.PARAMETER_AS_LITERAL_RENDERING: return Boolean.toString(parameterAsLiteralRenderingEnabled); default: return null; } }

Target:
public String getProperty(String name) { switch (name) { case ConfigurationProperties.COMPATIBLE_MODE: return Boolean.toString(compatibleModeEnabled); case ConfigurationProperties.RETURNING_CLAUSE_CASE_SENSITIVE: return Boolean.toString(returningClauseCaseSensitive); case ConfigurationProperties.SIZE_TO_COUNT_TRANSFORMATION: return Boolean.toString(sizeToCountTransformationEnabled); case ConfigurationProperties.IMPLICIT_GROUP_BY_FROM_SELECT: return Boolean.toString(implicitGroupByFromSelectEnabled); case ConfigurationProperties.IMPLICIT_GROUP_BY_FROM_HAVING: return Boolean.toString(implicitGroupByFromHavingEnabled); case ConfigurationProperties.IMPLICIT_GROUP_BY_FROM_ORDER_BY: return Boolean.toString(implicitGroupByFromOrderByEnabled); case ConfigurationProperties.EXPRESSION_OPTIMIZATION: return Boolean.toString(expressionOptimizationEnabled); case ConfigurationProperties.EXPRESSION_CACHE_CLASS: return expressionCacheClass; case ConfigurationProperties.VALUES_CLAUSE_FILTER_NULLS: return Boolean.toString(valuesClauseFilterNullsEnabled); case ConfigurationProperties.PARAMETER_AS_LITERAL_RENDERING: return Boolean.toString(parameterAsLiteralRenderingEnabled); case ConfigurationProperties.OPTIMIZED_KEYSET_PREDICATE_RENDERING: return Boolean.toString(optimizedKeysetPredicateRenderingEnabled); default: return null; } }
Source:
public void introspectAccessToken(String opHost, String redirectUrl) throws Exception { DevelopersApi client = Tester.api(); RegisterSiteResponseData setupResponse = RegisterSiteTest.registerSite(client, opHost, redirectUrl); GetClientTokenResponseData tokenResponse = getGetClientTokenResponseData(opHost, client, setupResponse); assertNotNull(tokenResponse); final String accessToken = tokenResponse.getAccessToken(); Tester.notEmpty(accessToken); IntrospectAccessTokenParams introspectParams = new IntrospectAccessTokenParams(); introspectParams.setOxdId(setupResponse.getOxdId()); introspectParams.setAccessToken(accessToken); final String authorization = "Bearer " + accessToken; final IntrospectAccessTokenResponse iaTokenResponse = client.introspectAccessToken(authorization, introspectParams); IntrospectAccessTokenResponseData iatResponseData = iaTokenResponse.getData(); assertNotNull(iatResponseData); assertTrue(iatResponseData.isActive()); final Long issuedAt = iatResponseData.getIat(); assertNotNull(issuedAt); Long expiresAt = iatResponseData.getExp(); assertNotNull(expiresAt); assertTrue(expiresAt >= issuedAt); final Long nbf = iatResponseData.getNbf(); if (nbf != null) { assertTrue(nbf > issuedAt); assertTrue(nbf < expiresAt); } }

Target:
public void introspectAccessToken(String opHost, String redirectUrl) throws Exception { DevelopersApi client = Tester.api(); RegisterSiteResponseData setupResponse = RegisterSiteTest.registerSite(client, opHost, redirectUrl); GetClientTokenResponseData tokenResponse = getGetClientTokenResponseData(opHost, client, setupResponse); assertNotNull(tokenResponse); final String accessToken = tokenResponse.getAccessToken(); Tester.notEmpty(accessToken); IntrospectAccessTokenParams introspectParams = new IntrospectAccessTokenParams(); introspectParams.setOxdId(setupResponse.getOxdId()); introspectParams.setAccessToken(accessToken); final String authorization = "Bearer " + accessToken; final IntrospectAccessTokenResponse iaTokenResponse = client.introspectAccessToken(authorization, introspectParams); assertNotNull(iaTokenResponse.getData()); assertTrue(iaTokenResponse.getData().isActive()); assertNotNull(iaTokenResponse.getData().getIat()); assertNotNull(iaTokenResponse.getData().getExp()); assertTrue(iaTokenResponse.getData().getExp() >= iaTokenResponse.getData().getIat()); final Long nbf = iaTokenResponse.getData().getNbf(); if (nbf != null) { assertTrue(nbf > iaTokenResponse.getData().getIat()); assertTrue(nbf < iaTokenResponse.getData().getExp()); } }
Source:
public void replaceBrick(GlusterBrickEntity oldBrick, GlusterBrickEntity newBrick) { getCallsHandler().executeModification("UpdateGlusterVolumeBrick", getCustomMapSqlParameterSource().addValue("id", oldBrick.getId()) .addValue("new_id", newBrick.getId()) .addValue("new_server_id", newBrick.getServerId()) .addValue("new_brick_dir", newBrick.getBrickDirectory()) .addValue("new_brick_order", oldBrick.getBrickOrder()) .addValue("new_status", EnumUtils.nameOrNull(newBrick.getStatus()))); }

Target:
public void replaceBrick(GlusterBrickEntity oldBrick, GlusterBrickEntity newBrick) { getCallsHandler().executeModification("UpdateGlusterVolumeBrick", getCustomMapSqlParameterSource().addValue("id", oldBrick.getId()) .addValue("new_id", newBrick.getId()) .addValue("new_server_id", newBrick.getServerId()) .addValue("new_status", EnumUtils.nameOrNull(newBrick.getStatus()))); }
Source:
private OskariLayer getWFSLayer(String version) { OskariLayer layer = new OskariLayer(); layer.setType("WFS"); layer.setId(1); layer.setUrl(LAYER_URL); layer.setName(LAYER_NAME); layer.setUsername(USERNAME); layer.setPassword(PASSWORD); layer.setVersion(version); return layer; }

Target:
private OskariLayer getWFSLayer(String version) { OskariLayer layer = new OskariLayer(); layer.setType(OskariLayer.TYPE_WFS); layer.setId(1); layer.setUrl(LAYER_URL); layer.setName(LAYER_NAME); layer.setUsername(USERNAME); layer.setPassword(PASSWORD); layer.setVersion(version); return layer; }
Source:
public VdsFenceOptions(String agent, String fencingOptions) { if (!StringUtils.isEmpty(agent)) { this.fenceAgent = agent; this.fencingOptions = fencingOptions; } InitCache(); Init(); }

Target:
public VdsFenceOptions(String agent, String fencingOptions) { if (StringUtils.isNotEmpty(agent)) { this.fenceAgent = agent; this.fencingOptions = fencingOptions; } InitCache(); Init(); }
Source:
public Properties getPageProperties(final APISession apiSession, final byte[] zipContent, final boolean checkIfItAlreadyExists, final Long processDefinitionId) throws InvalidPageZipMissingPropertiesException, InvalidPageZipMissingIndexException, InvalidPageZipInconsistentException, InvalidPageZipMissingAPropertyException, InvalidPageTokenException, AlreadyExistsException, BonitaException { final PageAPI pageAPI = getPageAPI(apiSession); Properties properties; if (processDefinitionId == null) { properties = pageAPI.getPageProperties(zipContent, checkIfItAlreadyExists); } else { properties = pageAPI.getPageProperties(zipContent, false); if (checkIfItAlreadyExists) { final String pageName = properties.getProperty(NAME_PROPERTY); try { pageAPI.getPageByNameAndProcessDefinitionId(pageName, processDefinitionId); throw new AlreadyExistsException("A page with name " + pageName + " already exists for the process " + processDefinitionId); } catch (final PageNotFoundException e) { try { pageAPI.getPageByName(pageName); throw new AlreadyExistsException("A page with name " + pageName + " already exists for the process " + processDefinitionId); } catch (final PageNotFoundException e1) { } } } } return properties; }

Target:
public Properties getPageProperties(final APISession apiSession, final byte[] zipContent, final boolean checkIfItAlreadyExists, final Long processDefinitionId) throws InvalidPageZipMissingPropertiesException, InvalidPageZipMissingIndexException, InvalidPageZipInconsistentException, InvalidPageZipMissingAPropertyException, InvalidPageTokenException, AlreadyExistsException, BonitaException { final PageAPI pageAPI = getPageAPI(apiSession); Properties properties; if (processDefinitionId == null) { properties = pageAPI.getPageProperties(zipContent, checkIfItAlreadyExists); } else { properties = pageAPI.getPageProperties(zipContent, false); if (checkIfItAlreadyExists) { final String pageName = properties.getProperty(NAME_PROPERTY); try { pageAPI.getPageByNameAndProcessDefinitionId(pageName, processDefinitionId); throw new AlreadyExistsException("A page with name " + pageName + " already exists for the process " + processDefinitionId); } catch (final PageNotFoundException e) { try { pageAPI.getPageByName(pageName); throw new AlreadyExistsException("A page with name " + pageName + " already exists for the tenant"); } catch (final PageNotFoundException e1) { } } } } return properties; }
Source:
protected IResource getResource() { Object element = getElement(); IResource resource = null; if (element instanceof IResource) { resource = (IResource) element; } else if (element != null) { resource = ((IAdaptable)element).getAdapter(IResource.class); } return resource; }

Target:
protected IResource getResource() { IAdaptable element = getElement(); IResource resource = null; if (element instanceof IResource) { resource = (IResource) element; } else if (element != null) { resource = element.getAdapter(IResource.class); } return resource; }
Source:
public void clickDeleteAllDesktopDisplaysConfirmationDialog() { DeleteDialog confirmationDialog = getDeleteAllButton(UserWithPosts.getUserId()).click(); Assertion.assertTrue(confirmationDialog.isVisible()); }

Target:
public void clickDeleteAllDesktopDisplaysConfirmationDialog() { DeleteDialog confirmationDialog = getDeleteAllButton(userWithPosts.getUserId()).click(); assertTrue(confirmationDialog.isVisible()); }
Source:
public void test445675_autobuild() throws Exception { setAutobuilding(false); project = importProject("projects/updateProject/simple/pom.xml"); copyContent(project, "pom.xml", "pomWithOneDependency.xml"); assertEventsFromProjects(events, project); project.close(monitor); waitForJobsToComplete(); assertNull(manager.getProject(project)); project.open(monitor); waitForJobsToComplete(); assertNotNull(manager.getProject(project)); events.clear(); copyContent(project, "pomWithSecondDependency.xml", "pom.xml"); waitForJobsToComplete(); assertEquals(0, events.size()); copyContent(project, "pomWithOneDependency.xml", "pom.xml"); setAutobuilding(true); waitForJobsToComplete(); assertEventsFromProjects(events, project); events.clear(); copyContent(project, "pomWithSecondDependency.xml", "pom.xml"); waitForJobsToComplete(); assertEventsFromProjects(events, project); }

Target:
public void test445675_autobuild() throws Exception { project = importProject("projects/updateProject/simple/pom.xml"); assertContainsOnly(getProjectsFromEvents(events), project); copyContent(project, "pom.xml", "pomWithOneDependency.xml"); project.close(monitor); waitForJobsToComplete(); assertNull(manager.getProject(project)); project.open(monitor); waitForJobsToComplete(); assertNotNull(manager.getProject(project)); events.clear(); copyContent(project, "pomWithSecondDependency.xml", "pom.xml", false); waitForJobsToComplete(); assertEquals(0, events.size()); setAutoBuilding(true); waitForJobsToComplete(); assertContainsOnly(getProjectsFromEvents(events), project); events.clear(); copyContent(project, "pomWithOneDependency.xml", "pom.xml", false); waitForJobsToComplete(); assertContainsOnly(getProjectsFromEvents(events), project); }
Source:
private Map<String, PrivateKeyEntry> getPrivateKeyEntries() throws CertificateManagerException { Map<String, PrivateKeyEntry> pkEntries = new HashMap<>(); final String password = getKeyStoreSystemProperties().get(KEY_STORE_PASSWORD_KEY); if (password != null) { try { Enumeration enumeration = keyStore.aliases(); while(enumeration.hasMoreElements()) { String alias = (String)enumeration.nextElement(); PrivateKeyEntry pkEntry = (PrivateKeyEntry) keyStore.getEntry(alias, new KeyStore.PasswordProtection(password.toCharArray())); pkEntries.put(alias, pkEntry); } } catch (final NoSuchAlgorithmException | KeyStoreException | UnrecoverableEntryException ex) { LOG.error("Error initializing Private Keys: {}", ex.getLocalizedMessage(), ex); throw new CertificateManagerException(ex.getLocalizedMessage(), ex); } } else { LOG.error("{} is not a defined system property.", KEY_STORE_PASSWORD_KEY); } return pkEntries; }

Target:
private Map<String, PrivateKeyEntry> getPrivateKeyEntries() throws CertificateManagerException { Map<String, PrivateKeyEntry> pkEntries = new HashMap<>(); final String password = getKeyStoreSystemProperties().get(KEY_STORE_PASSWORD_KEY); if (password != null) { try { Enumeration enumeration = keyStore.aliases(); while(enumeration.hasMoreElements()) { String alias = (String)enumeration.nextElement(); PrivateKeyEntry pkEntry = (PrivateKeyEntry) keyStore.getEntry(alias, new KeyStore.PasswordProtection(password.toCharArray())); pkEntries.put(alias, pkEntry); } } catch (final NoSuchAlgorithmException | KeyStoreException | UnrecoverableEntryException ex) { throw new CertificateManagerException(ex.getLocalizedMessage(), ex); } } else { LOG.error("{} is not a defined system property.", KEY_STORE_PASSWORD_KEY); } return pkEntries; }