auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void canProcessBatch() { Set<WithSeq<Client>> remoteRequest = ImmutableSet.of( WithSeq.of(CLIENT_1, 10), WithSeq.of(CLIENT_1, 12), WithSeq.of(CLIENT_2, 10), WithSeq.of(CLIENT_1, 15), WithSeq.of(CLIENT_2, 15)); PaxosValue paxosValue1 = paxosValue(10); PaxosValue paxosValue2 = paxosValue(12); SetMultimap<Client, WithSeq<Optional<PaxosValue>>> remoteResponse = ImmutableSetMultimap.<Client, WithSeq<Optional<PaxosValue>>>builder() .put(CLIENT_1, WithSeq.of(Optional.of(paxosValue1), 10)) .put(CLIENT_1, WithSeq.of(Optional.of(paxosValue2), 12)) .put(CLIENT_2, WithSeq.of(Optional.of(paxosValue1), 10)) .put(CLIENT_1, WithSeq.of(Optional.empty(), 15)) .put(CLIENT_2, WithSeq.of(Optional.empty(), 15)) .build(); when(remote.getLearnedValues(remoteRequest)) .thenReturn(remoteResponse); LearnedValuesCoalescingFunction function = new LearnedValuesCoalescingFunction(remote); Map<WithSeq<Client>, PaxosContainer<Optional<PaxosValue>>> results = function.apply(remoteRequest); assertThat(results) .containsEntry(WithSeq.of(CLIENT_1, 10), asResult(paxosValue1)) .containsEntry(WithSeq.of(CLIENT_1, 12), asResult(paxosValue2)) .containsEntry(WithSeq.of(CLIENT_1, 15), EMPTY_RESULT) .containsEntry(WithSeq.of(CLIENT_2, 10), asResult(paxosValue1)) .containsEntry(WithSeq.of(CLIENT_2, 15), EMPTY_RESULT); }

Target:
public void canProcessBatch() { Set<WithSeq<Client>> remoteRequest = ImmutableSet.of( WithSeq.of(CLIENT_1, 10), WithSeq.of(CLIENT_1, 12), WithSeq.of(CLIENT_1, 15), WithSeq.of(CLIENT_2, 10), WithSeq.of(CLIENT_2, 15)); PaxosValue paxosValue1 = paxosValue(10); PaxosValue paxosValue2 = paxosValue(12); SetMultimap<Client, PaxosValue> remoteResponse = ImmutableSetMultimap.<Client, PaxosValue>builder() .putAll(CLIENT_1, paxosValue1, paxosValue2) .put(CLIENT_2, paxosValue1) .build(); when(remote.getLearnedValues(remoteRequest)) .thenReturn(remoteResponse); LearnedValuesCoalescingFunction function = new LearnedValuesCoalescingFunction(remote); Map<WithSeq<Client>, PaxosContainer<Optional<PaxosValue>>> results = function.apply(remoteRequest); assertThat(results).containsOnly( entry(WithSeq.of(CLIENT_2, 10), asResult(paxosValue1)), entry(WithSeq.of(CLIENT_1, 12), asResult(paxosValue2)), entry(WithSeq.of(CLIENT_1, 10), asResult(paxosValue1)), entry(WithSeq.of(CLIENT_1, 15), EMPTY_RESULT), entry(WithSeq.of(CLIENT_2, 15), EMPTY_RESULT)); }
Source:
private void deployArtifactsInGateway() { long retryDuration = 10000; double reconnectionProgressionFactor = 2.0; long maxReconnectDuration = 1000 * 60 * 60; while (true) { boolean isArtifactsDeployed = deployArtifactsAtStartup(); if (isArtifactsDeployed) { log.info("Synapse Artifacts deployed Successfully in the Gateway"); break; } else { retryDuration = (long) (retryDuration * reconnectionProgressionFactor); if (retryDuration > maxReconnectDuration) { retryDuration = maxReconnectDuration; } log.error("Unable to deploy synapse artifacts at gateway. Next retry in " + (retryDuration / 1000) + " seconds"); try { Thread.sleep(retryDuration); } catch (InterruptedException ignore) { } } } }

Target:
private void deployArtifactsInGateway() { long retryDuration = gatewayArtifactSynchronizerProperties.getRetryDuartion(); double reconnectionProgressionFactor = 2.0; long maxReconnectDuration = 1000 * 60 * 60; while (true) { boolean isArtifactsDeployed = deployArtifactsAtStartup(); if (isArtifactsDeployed) { log.info("Synapse Artifacts deployed Successfully in the Gateway"); break; } else { retryDuration = (long) (retryDuration * reconnectionProgressionFactor); if (retryDuration > maxReconnectDuration) { retryDuration = maxReconnectDuration; } log.error("Unable to deploy synapse artifacts at gateway. Next retry in " + (retryDuration / 1000) + " seconds"); try { Thread.sleep(retryDuration); } catch (InterruptedException ignore) { } } } }
Source:
private void reportIssue(ExplodedGraph.Node node, ExceptionalCheckBasedYield yield, SECheck check) { MethodInvocationTree mit = (MethodInvocationTree) node.programPoint.syntaxTree(); ExpressionTree methodSelect = mit.methodSelect(); Set<List<JavaFileScannerContext.Location>> argumentsFlows = flowsForMethodArguments(node, mit); Set<List<JavaFileScannerContext.Location>> exceptionFlows = yield.exceptionFlows(); Set<List<JavaFileScannerContext.Location>> flows = new HashSet<>(); for (List<JavaFileScannerContext.Location> argumentFlow : argumentsFlows) { for (List<JavaFileScannerContext.Location> exceptionFlow : exceptionFlows) { List<JavaFileScannerContext.Location> combinedFlow = new ArrayList<>(argumentFlow.size() + exceptionFlow.size()); combinedFlow.addAll(argumentFlow); combinedFlow.addAll(exceptionFlow); flows.add(combinedFlow); } } Tree reportTree = methodSelect; if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { reportTree = ((MemberSelectExpressionTree) methodSelect).identifier(); } check.reportIssue(reportTree, String.format(message, mit.symbol().name()), flows); }

Target:
private void reportIssue(ExplodedGraph.Node node, ExceptionalCheckBasedYield yield, SECheck check) { MethodInvocationTree mit = (MethodInvocationTree) node.programPoint.syntaxTree(); ExpressionTree methodSelect = mit.methodSelect(); Set<List<JavaFileScannerContext.Location>> argumentsFlows = flowsForMethodArguments(node, mit); Set<List<JavaFileScannerContext.Location>> exceptionFlows = yield.exceptionFlows(); Set<List<JavaFileScannerContext.Location>> flows = Sets.cartesianProduct(argumentsFlows, exceptionFlows).stream() .map(ExceptionalYieldChecker::concatLists) .collect(Collectors.toCollection(LinkedHashSet::new)); Tree reportTree = methodSelect; if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { reportTree = ((MemberSelectExpressionTree) methodSelect).identifier(); } check.reportIssue(reportTree, String.format(message, mit.symbol().name()), flows); }
Source:
public Connection newConnection(Connector connector, EndPoint realEndPoint) { ReadAheadEndpoint aheadEndpoint = new ReadAheadEndpoint(realEndPoint, 1); byte[] bytes = aheadEndpoint.getBytes(); boolean isSSL; if (bytes == null || bytes.length == 0) { isSSL = true; } else { byte b = bytes[0]; isSSL = b >= 0x7F || (b < 0x20 && b != '\n' && b != '\r' && b != '\t'); } LOG.debug("UnifiedConnectionFactory: newConnection() with SSL = " + isSSL); EndPoint plainEndpoint; SslConnection sslConnection; if (isSSL) { SSLEngine engine = this.sslContextFactory.newSSLEngine(aheadEndpoint.getRemoteAddress()); engine.setUseClientMode(false); sslConnection = this.newSslConnection(connector, aheadEndpoint, engine); sslConnection.setRenegotiationAllowed(this.sslContextFactory.isRenegotiationAllowed()); this.configure(sslConnection, connector, aheadEndpoint); plainEndpoint = sslConnection.getDecryptedEndPoint(); } else { sslConnection = null; plainEndpoint = aheadEndpoint; } ConnectionFactory next = connector.getConnectionFactory(nextProtocol); Connection connection = next.newConnection(connector, plainEndpoint); plainEndpoint.setConnection(connection); return (sslConnection == null) ? connection : sslConnection; }

Target:
public Connection newConnection(Connector connector, EndPoint realEndPoint) { ReadAheadEndpoint aheadEndpoint = new ReadAheadEndpoint(realEndPoint, 1); byte[] bytes = aheadEndpoint.getBytes(); boolean isSSL; if (bytes == null || bytes.length == 0) { isSSL = false; LOG.warn("Incoming connection has no data"); } else { byte b = bytes[0]; isSSL = b == 0x16; } LOG.debug(String.format("UnifiedConnectionFactory: newConnection() with SSL = %b", isSSL)); EndPoint plainEndpoint; SslConnection sslConnection; if (isSSL) { SSLEngine engine = this.sslContextFactory.newSSLEngine(aheadEndpoint.getRemoteAddress()); engine.setUseClientMode(false); sslConnection = this.newSslConnection(connector, aheadEndpoint, engine); sslConnection.setRenegotiationAllowed(this.sslContextFactory.isRenegotiationAllowed()); this.configure(sslConnection, connector, aheadEndpoint); plainEndpoint = sslConnection.getDecryptedEndPoint(); } else { sslConnection = null; plainEndpoint = aheadEndpoint; } ConnectionFactory next = connector.getConnectionFactory(nextProtocol); Connection connection = next.newConnection(connector, plainEndpoint); plainEndpoint.setConnection(connection); return (sslConnection == null) ? connection : sslConnection; }
Source:
public void releaseStore(Store<?, ?> resource) { if (!createdStores.containsKey(resource)) { throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } List<Copier> copiers = createdStores.remove(resource); final OnHeapStore onHeapStore = (OnHeapStore)resource; close(onHeapStore); CopyProvider copyProvider = serviceProvider.getService(CopyProvider.class); for (Copier copier: copiers) { try { copyProvider.releaseCopier(copier); } catch (Exception e) { throw new IllegalStateException("Exception while releasing Copier instance.", e); } } }

Target:
public void releaseStore(Store<?, ?> resource) { List<Copier> copiers = createdStores.remove(resource); if (copiers == null) { throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } final OnHeapStore onHeapStore = (OnHeapStore)resource; close(onHeapStore); CopyProvider copyProvider = serviceProvider.getService(CopyProvider.class); for (Copier copier: copiers) { try { copyProvider.releaseCopier(copier); } catch (Exception e) { throw new IllegalStateException("Exception while releasing Copier instance.", e); } } }
Source:
public DocumentStoreConfiguration(Map<?, ?> configurationValues, int defaultPort) { ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues ); this.host = propertyReader.property( OgmProperties.HOST, String.class ) .withDefault( DEFAULT_HOST ) .getValue(); this.port = propertyReader.property( OgmProperties.PORT, int.class ) .withDefault( defaultPort ) .getValue(); validatePort( port ); this.databaseName = propertyReader.property( OgmProperties.DATABASE, String.class ) .required() .getValue(); this.username = propertyReader.property( OgmProperties.USERNAME, String.class ).getValue(); this.password = propertyReader.property( OgmProperties.PASSWORD, String.class ).getValue(); this.createDatabase = propertyReader.property( OgmProperties.CREATE_DATABASE, boolean.class ) .withDefault( false ) .getValue(); associationStorage = propertyReader.property( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.class ) .withDefault( DEFAULT_ASSOCIATION_STORAGE ) .getValue(); }

Target:
public DocumentStoreConfiguration(Map<?, ?> configurationValues, int defaultPort) { ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues ); this.host = propertyReader.property( OgmProperties.HOST, String.class ) .withDefault( DEFAULT_HOST ) .getValue(); this.port = propertyReader.property( OgmProperties.PORT, int.class ) .withDefault( defaultPort ) .withValidator( Validators.PORT ) .getValue(); this.databaseName = propertyReader.property( OgmProperties.DATABASE, String.class ) .required() .getValue(); this.username = propertyReader.property( OgmProperties.USERNAME, String.class ).getValue(); this.password = propertyReader.property( OgmProperties.PASSWORD, String.class ).getValue(); this.createDatabase = propertyReader.property( OgmProperties.CREATE_DATABASE, boolean.class ) .withDefault( false ) .getValue(); associationStorage = propertyReader.property( DocumentStoreProperties.ASSOCIATIONS_STORE, AssociationStorageType.class ) .withDefault( DEFAULT_ASSOCIATION_STORAGE ) .getValue(); }
Source:
private static String parseScheme(String challenge) throws ResourceAuthenticationChallengeException { final int indexOfFirstSpace = challenge.indexOf(' '); final int indexOfFirstTab = challenge.indexOf('\t'); if (indexOfFirstSpace < 0 && indexOfFirstTab < 0) { return challenge; } if (indexOfFirstSpace > -1 && (indexOfFirstSpace < indexOfFirstTab || indexOfFirstTab < 0)) { return challenge.substring(0, indexOfFirstSpace); } if (indexOfFirstTab > -1 && (indexOfFirstTab < indexOfFirstSpace || indexOfFirstSpace < 0)) { return challenge.substring(0, indexOfFirstTab); } throw new ResourceAuthenticationChallengeException(AUTH_HEADER_INVALID_FORMAT); }

Target:
private static String parseScheme(String challenge) throws ResourceAuthenticationChallengeException { final String methodName = ":parseScheme"; if (StringExtensions.isNullOrBlank(challenge)) { Logger.w(TAG + methodName, "Cannot parse an empty/blank challenge"); throw new ResourceAuthenticationChallengeException(AUTH_HEADER_MISSING); } final int indexOfFirstSpace = challenge.indexOf(' '); final int indexOfFirstTab = challenge.indexOf('\t'); if (indexOfFirstSpace < 0 && indexOfFirstTab < 0) { Logger.w(TAG + methodName, "Couldn't locate space/tab char - returning input String"); return challenge; } Logger.v(TAG + methodName, "Parsing scheme with indices: indexOfFirstSpace[" + indexOfFirstSpace + "] indexOfFirstTab[" + indexOfFirstTab + "]"); if (indexOfFirstSpace > -1 && (indexOfFirstSpace < indexOfFirstTab || indexOfFirstTab < 0)) { return challenge.substring(0, indexOfFirstSpace); } if (indexOfFirstTab > -1 && (indexOfFirstTab < indexOfFirstSpace || indexOfFirstSpace < 0)) { return challenge.substring(0, indexOfFirstTab); } Logger.w(TAG + methodName, "Unexpected/malformed/missing scheme."); throw new ResourceAuthenticationChallengeException(AUTH_HEADER_INVALID_FORMAT); }
Source:
public static void main(String[] args) { try { String authorizationCode = ""; String correlationId = ""; for (int i = 0; i < args.length; ++i) { if (args[i].startsWith("authorization_code")) { authorizationCode = args[i].split("=")[1]; } else if (args[i].startsWith("correlationId")) { correlationId = args[i].split("=")[1]; } } FuturePaymentSample fps = new FuturePaymentSample(); Payment payment = fps.create(correlationId, authorizationCode); } catch (Exception e) { e.printStackTrace(); System.out.println(Payment.getLastRequest()); System.out.println(Payment.getLastResponse()); } }

Target:
public static void main(String[] args) { try { String authorizationCode = ""; String correlationId = ""; for (int i = 0; i < args.length; ++i) { if (args[i].startsWith("authorization_code")) { authorizationCode = args[i].split("=")[1]; } else if (args[i].startsWith("correlationId")) { correlationId = args[i].split("=")[1]; } } FuturePaymentSample fps = new FuturePaymentSample(); Payment payment = fps.create(correlationId, authorizationCode); System.out.println(Payment.getLastResponse()); } catch (Exception e) { e.printStackTrace(); System.out.println(Payment.getLastRequest()); System.out.println(Payment.getLastResponse()); } }
Source:
public void run() { while (!isScanFinished.get() || filesDownloaded.intValue() != filesNeedDownload) { try { Object downloadItem = downloadItemDeque.poll(1, TimeUnit.SECONDS); if (downloadItem != null) { if (downloadItem instanceof CloudBlob) { downloadBlob((CloudBlob) downloadItem); filesDownloaded.addAndGet(1); } else if (downloadItem instanceof CloudFile) { downloadSingleFile((CloudFile) downloadItem); filesDownloaded.addAndGet(1); } } } catch (InterruptedException | WAStorageException e) { final String message = Messages.AzureStorageBuilder_download_err( getServiceData().getStorageAccountInfo().getStorageAccName()) + ":" + e.getMessage(); e.printStackTrace(error(message)); println(message); setRunUnstable(); } } }

Target:
public void run() { try { if (downloadItem instanceof CloudBlob) { downloadBlob((CloudBlob) downloadItem); } else { downloadSingleFile((CloudFile) downloadItem); } filesDownloaded.addAndGet(1); } catch (WAStorageException e) { final String message = Messages.AzureStorageBuilder_download_err( getServiceData().getStorageAccountInfo().getStorageAccName()) + ":" + e.getMessage(); e.printStackTrace(error(message)); println(message); setRunUnstable(); } }
Source:
protected boolean needRetry(int rc) { try { if (KeeperException.Code.get(rc) == Code.CONNECTIONLOSS) { return true; } return false; } catch (ClassCastException | NullPointerException ex) { LOG.error("Session failed to handle unknown return code {}. Skip retrying. ex {}", _sessionId, rc, ex); return false; } }

Target:
protected boolean needRetry(int rc) { try { switch (KeeperException.Code.get(rc)) { case CONNECTIONLOSS: return true; default: return false; } } catch (ClassCastException | NullPointerException ex) { LOG.error("Session failed to handle unknown return code {}. Skip retrying. ex {}", _sessionId, rc, ex); return false; } }
Source:
protected void ExecuteVdsBrokerCommand() { storage_pool storagePool = getStoragePoolDAO().get(getVds().getstorage_pool_id()); boolean filteringLUNsEnabled = Config.<Boolean> GetValue( ConfigValues.FilteringLUNsEnabled, storagePool.getcompatibility_version().getValue()); XmlRpcStruct options = new XmlRpcStruct(); if (!filteringLUNsEnabled) { options.add(VdsProperties.includePartitioned, "true"); } int storageType = (int) getParameters().getStorageType().getValue(); _result = getBroker().getDeviceList(storageType, options); ProceedProxyReturnValue(); setReturnValue(ParseLUNList(_result.lunList)); }

Target:
protected void ExecuteVdsBrokerCommand() { boolean filteringLUNsEnabled = Config.<Boolean> GetValue( ConfigValues.FilteringLUNsEnabled, getParameters().getcompatibility_version().getValue()); XmlRpcStruct options = new XmlRpcStruct(); if (!filteringLUNsEnabled) { options.add(VdsProperties.includePartitioned, Boolean.TRUE.toString()); } int storageType = (int) getParameters().getStorageType().getValue(); _result = getBroker().getDeviceList(storageType, options); ProceedProxyReturnValue(); setReturnValue(ParseLUNList(_result.lunList)); }
Source:
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) { Map<String, FileRegistries.BlockProperty> properties = CLIWorldEdit.inst.getFileRegistries().getDataFile().blocks.get(blockType.getId()).properties; Map<String, Property<?>> worldEditProperties = new HashMap<>(); properties.forEach((name, prop) -> worldEditProperties.put(name, createProperty(prop.type, name, prop.values))); return worldEditProperties; }

Target:
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) { Map<String, FileRegistries.BlockProperty> properties = CLIWorldEdit.inst.getFileRegistries().getDataFile().blocks.get(blockType.getId()).properties; return ImmutableMap.copyOf(Maps.transformEntries(properties, (Maps.EntryTransformer<String, FileRegistries.BlockProperty, Property<?>>) (key, value) -> createProperty(value.type, key, value.values))); }
Source:
public SqlStatementCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Object arg) { if (! (arg instanceof Type)) { throw new UnsupportedOperationException("@MapTo must take a Type, got a " + arg.getClass().getName()); } return s -> { ResultReturner returner = ResultReturner.forMethod(sqlObjectType, method); s.getConfig(SqlObjectStatementConfiguration.class).setReturner( () -> returner.result(((ResultSetIterable) s).mapTo((Type) arg))); }; }

Target:
public SqlStatementCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Object arg) { final Type type; if (arg instanceof GenericType) { type = ((GenericType<?>) arg).getType(); } else if (! (arg instanceof Type)) { throw new UnsupportedOperationException("@MapTo must take a Type, got a " + arg.getClass().getName()); } else { type = (Type) arg; } return s -> { ResultReturner returner = ResultReturner.forMethod(sqlObjectType, method); s.getConfig(SqlObjectStatementConfiguration.class).setReturner( () -> returner.result(((ResultSetIterable) s).mapTo(type), s.getContext())); }; }
Source:
public final String[] getRoleListOfUserFromDatabase(String username, String filter) throws UserStoreException { if (!isSecureCall.get()) { Class argTypes[] = new Class[]{String.class, String.class}; Object object = callSecure("getRoleListOfUserFromDatabase", new Object[]{username, filter}, argTypes); return (String[]) object; } if (isUniqueUserIdEnabledInUserStore(getUserStore(username))) { String userID = getUserIDFromUserName(username); if (userID == null) { return new String[]{realmConfig.getEveryOneRoleName()}; } return getUserRolesWithID(userID, "*").toArray(new String[0]); } else { return getUserRoles(username, "*"); } }

Target:
public final String[] getRoleListOfUserFromDatabase(String username, String filter) throws UserStoreException { if (!isSecureCall.get()) { Class argTypes[] = new Class[]{String.class, String.class}; Object object = callSecure("getRoleListOfUserFromDatabase", new Object[]{username, filter}, argTypes); return (String[]) object; } if (isUniqueUserIdEnabledInUserStore(getUserStore(username))) { String userID = getUserIDFromUserName(username); if (userID == null) { return new String[]{realmConfig.getEveryOneRoleName()}; } return getUserRolesWithID(userID, filter).toArray(new String[0]); } else { return getUserRoles(username, filter); } }
Source:
public void addFailedAttempts() { if (isLoginEnabled()) { failedLoginAttempts++; if (failedLoginAttempts >= NUMBER_ATTEMPTS) { enableLoginTime = new Date().getTime() + DISABLE_TIME; failedLoginAttempts = 0; } } }

Target:
public void addFailedAttempts() throws ActionNotAllowed { if (isLoginEnabled()) { failedLoginAttempts++; if (failedLoginAttempts >= NUMBER_ATTEMPTS) { enableLoginTime = new Date().getTime() + disableTime; failedLoginAttempts = 0; } } else { throw new ActionNotAllowed("Add new attempt if login is disable is not allowed."); } }
Source:
public void example() { collector.checkSucceeds(new Callable<Object>() { public Object call() throws Exception { throw new RuntimeException("first!"); } }); collector.checkSucceeds(new Callable<Integer>() { public Integer call() throws Exception { throw new RuntimeException("second!"); } }); }

Target:
public void example() { collector.checkSucceeds(new Callable<Object>() { public Object call() throws Exception { throw new RuntimeException("first!"); } }); collector.checkSucceeds(new Callable<Integer>() { public Integer call() throws Exception { throw new RuntimeException("second!"); } }); Integer result = collector.checkSucceeds(new Callable<Integer>() { public Integer call() throws Exception { return 1; } }); assertEquals(Integer.valueOf(1), result); }
Source:
private TimeLockServices createNewClient(String namespace) { Preconditions.checkArgument(!namespace.equals(PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE), "The client name '%s' is reserved for the leader election service, and may not be " + "used.", PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE); if (servicesByNamespace.size() >= maxNumberOfNamespaces.get()) { log.error( "Unable to create timelock services for client {}, as it would exceed the maximum number of " + "allowed clients ({}). If this is intentional, the maximum number of clients can be " + "increased via the maximum-number-of-clients runtime config property.", SafeArg.of("client", namespace), SafeArg.of("maxNumberOfNamespaces", maxNumberOfNamespaces)); throw new IllegalStateException("Maximum number of clients exceeded"); } return clientServicesFactory.apply(namespace); }

Target:
private TimeLockServices createNewClient(String namespace) { Preconditions.checkArgument(!namespace.equals(PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE), "The client name '%s' is reserved for the leader election service, and may not be " + "used.", PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE); if (servicesByNamespace.size() >= maxNumberOfClients.get()) { log.error( "Unable to create timelock services for client {}, as it would exceed the maximum number of " + "allowed clients ({}). If this is intentional, the maximum number of clients can be " + "increased via the maximum-number-of-clients runtime config property.", SafeArg.of("client", namespace), SafeArg.of("maxNumberOfClients", maxNumberOfClients)); throw new IllegalStateException("Maximum number of clients exceeded"); } return clientServicesFactory.apply(namespace); }
Source:
public String filePath() { return String.format("%s", fileName); }

Target:
public String filePath() { return fileName; }
Source:
public TopNNumericResultBuilder addEntry( String dimName, Object dimValIndex, Object[] metricVals ) { final Map<String, Object> metricValues = Maps.newLinkedHashMap(); metricValues.put(dimSpec.getOutputName(), dimName); Iterator<AggregatorFactory> aggFactoryIter = aggFactories.iterator(); for (Object metricVal : metricVals) { metricValues.put(aggFactoryIter.next().getName(), metricVal); } for (PostAggregator postAgg : postAggs) { metricValues.put(postAgg.getName(), postAgg.compute(metricValues)); } Object topNMetricVal = metricValues.get(metricName); if (shouldAdd(topNMetricVal)) { DimValHolder dimValHolder = new DimValHolder.Builder() .withTopNMetricVal(topNMetricVal) .withDirName(dimName) .withDimValIndex(dimValIndex) .withMetricValues(metricValues) .build(); pQueue.add(dimValHolder); } if (this.pQueue.size() > this.threshold) { pQueue.poll(); } return this; }

Target:
public TopNNumericResultBuilder addEntry( String dimName, Object dimValIndex, Object[] metricVals ) { final Map<String, Object> metricValues = new LinkedHashMap<>(metricVals.length + postAggs.size()); metricValues.put(dimSpec.getOutputName(), dimName); Iterator<AggregatorFactory> aggFactoryIter = aggFactories.iterator(); for (Object metricVal : metricVals) { metricValues.put(aggFactoryIter.next().getName(), metricVal); } for (PostAggregator postAgg : postAggs) { metricValues.put(postAgg.getName(), postAgg.compute(metricValues)); } Object topNMetricVal = metricValues.get(metricName); if (shouldAdd(topNMetricVal)) { DimValHolder dimValHolder = new DimValHolder.Builder() .withTopNMetricVal(topNMetricVal) .withDirName(dimName) .withDimValIndex(dimValIndex) .withMetricValues(metricValues) .build(); pQueue.add(dimValHolder); } if (this.pQueue.size() > this.threshold) { pQueue.poll(); } return this; }
Source:
public Date created() throws IOException { return DateUtils.cloneDate( (Date) this.ocket.meta().getRawMetadata().get("Date") ); }

Target:
public Date created() throws IOException { return DateUtils.cloneDate( (Date) this.meta.getRawMetadataValue(Headers.DATE) ); }
Source:
protected void markModuleRequiresRestart(IPath deployPath, IModule[] moduleTree, IJBossServerPublishMethod method, IPublishCopyCallbackHandler handler) throws CoreException { boolean useAS7Behavior = DeploymentMarkerUtils.supportsJBoss7MarkerDeployment(server.getServer()); System.out.println("Mark " + deployPath + " for restart"); if( !useAS7Behavior) { JSTPublisherXMLToucher.getInstance().touch(deployPath, moduleTree[moduleTree.length-1], handler); } else { doDeployRequired(method, this.server, moduleTree, new NullProgressMonitor()); } }

Target:
protected void markModuleRequiresRestart(IPath deployPath, IModule[] moduleTree, IJBossServerPublishMethod method, IPublishCopyCallbackHandler handler) throws CoreException { boolean useAS7Behavior = DeploymentMarkerUtils.supportsJBoss7MarkerDeployment(server.getServer()); if( !useAS7Behavior) { JSTPublisherXMLToucher.getInstance().touch(deployPath, moduleTree[moduleTree.length-1], handler); } else { doDeployRequired(method, this.server, moduleTree, new NullProgressMonitor()); } }
Source:
public void setUpdatedAt(final Timestamp value) { this._updatedAt = value; }

Target:
public void setUpdatedAt(final Timestamp value) { _updatedAt = value; }
Source:
public void deleteAll() { Cursor cursor = null; ContentProviderClient db = clientProvider.get(); try { cursor = db.query( RecentSearchesContentProvider.BASE_URI, Table.ALL_FIELDS, null, new String[]{}, Table.COLUMN_LAST_USED + " DESC"); while (cursor != null && cursor.moveToNext() ) { try { RecentSearch recentSearch = find(fromCursor(cursor).getQuery()); if (recentSearch.getContentUri() == null) { throw new RuntimeException("tried to delete item with no content URI"); } else { Timber.d("QUERY_NAME %s - delete tried", recentSearch.getContentUri()); db.delete(recentSearch.getContentUri(), null, null); Timber.d("QUERY_NAME %s - query deleted", recentSearch.getQuery()); } } catch (RemoteException e) { Timber.e(e, "query deleted"); throw new RuntimeException(e); } finally { db.release(); } } } catch (RemoteException e) { throw new RuntimeException(e); } finally { cursor.close(); } }

Target:
public void deleteAll() { Cursor cursor = null; ContentProviderClient db = clientProvider.get(); try { cursor = db.query( RecentSearchesContentProvider.BASE_URI, Table.ALL_FIELDS, null, new String[]{}, Table.COLUMN_LAST_USED + " DESC" ); while (cursor != null && cursor.moveToNext()) { try { RecentSearch recentSearch = find(fromCursor(cursor).getQuery()); if (recentSearch.getContentUri() == null) { throw new RuntimeException("tried to delete item with no content URI"); } else { Timber.d("QUERY_NAME %s - delete tried", recentSearch.getContentUri()); db.delete(recentSearch.getContentUri(), null, null); Timber.d("QUERY_NAME %s - query deleted", recentSearch.getQuery()); } } catch (RemoteException e) { Timber.e(e, "query deleted"); throw new RuntimeException(e); } finally { db.release(); } } } catch (RemoteException e) { throw new RuntimeException(e); } finally { if (cursor != null) { cursor.close(); } } }
Source:
public void batchInsertRollback() throws DatabaseEngineException { final CountDownLatch latch = new CountDownLatch(1); final DbEntity entity = dbEntity() .name("TEST") .addColumn("COL1", INT) .build(); new MockUp<AbstractDatabaseEngine>() { @Mock public synchronized void flush(final Invocation invocation) throws DatabaseEngineException { if (latch.getCount() == 1) { throw new DatabaseEngineException(""); } invocation.proceed(); } }; DatabaseEngineException expectedException = null; engine.addEntity(entity); engine.beginTransaction(); try { final EntityEntry entry = entry().set("COL1", 1).build(); engine.addBatch("TEST", entry); engine.flush(); } catch (final DatabaseEngineException e) { expectedException = e; } finally { if (engine.isTransactionActive()) { engine.rollback(); } } assertNotNull("DB returned exception when flushing", expectedException); latch.countDown(); engine.beginTransaction(); engine.flush(); engine.commit(); final List<Map<String, ResultColumn>> query = engine.query(select(all()).from(table("TEST")).orderby(column("COL1").asc())); assertEquals("There is no rows on table TEST", query.size(), 0); }

Target:
public void batchInsertRollback() throws DatabaseEngineException { final CountDownLatch latch = new CountDownLatch(1); final DbEntity entity = dbEntity() .name("TEST") .addColumn("COL1", INT) .build(); new MockUp<AbstractDatabaseEngine>() { @Mock public synchronized void flush(final Invocation invocation) throws DatabaseEngineException { if (latch.getCount() == 1) { throw new DatabaseEngineException(""); } invocation.proceed(); } }; DatabaseEngineException expectedException = null; engine.addEntity(entity); engine.beginTransaction(); try { final EntityEntry entry = entry().set("COL1", 1).build(); engine.addBatch("TEST", entry); engine.flush(); fail("Was expecting the flush operation to fail"); } catch (final DatabaseEngineException e) { expectedException = e; } finally { if (engine.isTransactionActive()) { engine.rollback(); } } assertNotNull("DB returned exception when flushing", expectedException); latch.countDown(); engine.beginTransaction(); engine.flush(); engine.commit(); final List<Map<String, ResultColumn>> query = engine.query(select(all()) .from(table("TEST")) .orderby(column("COL1").asc())); assertEquals("There are no rows on table TEST", 0, query.size()); }
Source:
public void visitExpressionStatement(ExpressionStatementTree tree) { slingQueries.putIfAbsent(tree.firstToken().text(), slingQueryStates.NOTUSED); slingQueryName = tree.firstToken().text(); super.visitExpressionStatement(tree); if (findWasUsedOnSlingQuery()) { context.reportIssue(this, tree, RULE_MESSAGE); slingQueries.put(slingQueryName, slingQueryStates.ISSUERETURNED); } }

Target:
public void visitExpressionStatement(ExpressionStatementTree tree) { currentSlingQueryVariableName = tree.firstToken().text(); if (isThisANewSlingQuery()) { slingQueries.putIfAbsent(currentSlingQueryVariableName, SlingQueryStates.NOT_USED); } super.visitExpressionStatement(tree); reportIssueIfStrategyNotUsed(tree, currentSlingQueryVariableName); }
Source:
@Test public void detachMutlipleRequests() throws Exception { Action action = mockAction(URI_KEY_1, URI_1, mockImageViewTarget()); Action action2 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget()); BitmapHunter hunter = new TestableBitmapHunter(picasso, dispatcher, cache, stats, action); hunter.attach(action2); hunter.detach(action2); assertThat(hunter.action).isNotNull(); assertThat(hunter.actions).isNotNull(); assertThat(hunter.actions).isEmpty(); hunter.detach(action); assertThat(hunter.action).isNull(); }

Target:
@Test public void detachMutlipleRequests() throws Exception { Action action = mockAction(URI_KEY_1, URI_1, mockImageViewTarget()); Action action2 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget()); BitmapHunter hunter = new TestableBitmapHunter(picasso, dispatcher, cache, stats, action); hunter.attach(action2); hunter.detach(action2); assertThat(hunter.action).isNotNull(); assertThat(hunter.actions).isNotNull().isEmpty(); hunter.detach(action); assertThat(hunter.action).isNull(); }
Source:
public void doNotSalvageUnit(int i) { getLeftoverSalvage().add(getPotentialSalvage().get(i)); }

Target:
public void doNotSalvageUnit(int i) { if (i < getPotentialSalvage().size()) { getLeftoverSalvage().add(getPotentialSalvage().get(i)); } }
Source:
public double getProcessCpuLoad() throws MalformedObjectNameException, ReflectionException, InstanceNotFoundException { if (attrList == null || attrList.isEmpty()) { return Double.NaN; } Attribute att = (Attribute)attrList.get(0); Double value = (Double)att.getValue(); if (value == -1.0) { return Double.NaN; } return ((int)(value * 1000) / 10.0); }

Target:
public double getProcessCpuLoad() { if (attr == null) { return Double.NaN; } Double value = (Double)attr.getValue(); if (value == null || value == -1.0) { return Double.NaN; } return ((int)(value * 1000) / 10.0); }
Source:
private Events executeTests(Class<? extends ClassOrderer> classOrderer) { return EngineTestKit .engine("junit-jupiter") .configurationParameter(CLASS_ORDERING_STRATEGY_PROPERTY_NAME, "custom") .configurationParameter(CUSTOM_CLASS_ORDERER_PROPERTY_NAME, classOrderer.getName()) .configurationParameter(DEFAULT_TEST_METHOD_ORDER_PROPERTY_NAME, MethodOrderer.MethodName.class.getName()) .selectors(selectClass(A_TestCase.class), selectClass(B_TestCase.class), selectClass(C_TestCase.class)) .execute() .testEvents(); }

Target:
private Events executeTests(Class<? extends ClassOrderer> classOrderer) { return EngineTestKit .engine("junit-jupiter") .configurationParameter(DEFAULT_TEST_CLASS_ORDER_PROPERTY_NAME, classOrderer.getName()) .selectors(selectClass(A_TestCase.class), selectClass(B_TestCase.class), selectClass(C_TestCase.class)) .execute() .testEvents(); }
Source:
public Properties loadStoreProperties(String configPath) { File configFile = new File(configPath); if (!configFile.exists() || !configFile.isFile()) { throw new ConfigurationException( "Target store configuration file does not exist" + configPath); } Properties properties = new Properties(); try (InputStream is = new FileInputStream(configFile)) { properties.load(is); } catch (IOException e) { throw new ConfigurationException( "Could not load the store configuration from " + configPath, e); } try { final DataStore dataStore = getDataStore(properties); if (dataStore == null) { throw new ConfigurationException( "No datastore could be loaded with the given properties, make sure you have all the required jars for it in the classpath. Tried to use " + configPath); } dataStore.dispose(); } catch (Exception e) { throw new ConfigurationException( "Failed to load data store from configuration at " + configPath + ": " + e.getMessage(), e); } return properties; }

Target:
public Properties loadStoreProperties(String configPath) { File configFile = new File(configPath); if (!configFile.exists() || !configFile.isFile()) { throw new ConfigurationException( "Target store configuration file does not exist: " + configPath); } Properties properties = new Properties(); try (InputStream is = new FileInputStream(configFile)) { properties.load(is); } catch (IOException e) { throw new ConfigurationException( "Could not load the store configuration from: " + configPath, e); } try { final DataStore dataStore = getDataStore(properties); if (dataStore == null) { throw new ConfigurationException( "No datastore could be loaded with the given properties, make sure you have all the required jars for it in the classpath. Tried to use: " + configPath); } dataStore.dispose(); } catch (Exception e) { throw new ConfigurationException( "Failed to load data store from configuration at " + configPath + ": " + e.getMessage(), e); } return properties; }
Source:
public static final List<List<DeviceData>> splitDeviceDataByDay(List<DeviceData> data) { List<List<DeviceData>> res = new ArrayList<>(); int beg = 0; for (int i = 0; i < data.size(); i++) { if (i > 0 && !sameDay(data.get(i), data.get(i-1))) { res.add(data.subList(beg, i)); beg = i; } } return res; }

Target:
public static final List<List<DeviceData>> splitDeviceDataByDay(List<DeviceData> data) { final List<List<DeviceData>> res = Lists.newArrayList(); int beg = 0; for (int i = 1; i < data.size(); i++) { if (!sameDay(data.get(i), data.get(i-1))) { res.add(data.subList(beg, i)); beg = i; } else if (i == data.size() - 1) { res.add(data.subList(beg, data.size())); } } LOGGER.debug("Split deviceData and got days", res.size()); return res; }
Source:
public void startAndWait() { Preconditions.checkState(!server.isPresent()); Preconditions.checkState( s3Configuration.getS3AccessKey().isPresent(), "s3AccessKey not set!" ); Preconditions.checkState( s3Configuration.getS3SecretKey().isPresent(), "s3SecretKey not set!" ); Preconditions.checkState( s3Configuration.getLocalDownloadHttpPort().isPresent() || s3Configuration.getLocalDownloadSocket().isPresent(), "Must specify either unix socket (localDownloadSocket) or port (localDownloadHttpPort)" ); Server server = new Server(); if (s3Configuration.getLocalDownloadHttpPort().isPresent()) { ServerConnector http = new ServerConnector(server); http.setHost("localhost"); http.setPort(s3Configuration.getLocalDownloadHttpPort().get()); http.setIdleTimeout(configuration.getHttpServerTimeout()); server.addConnector(http); } if (s3Configuration.getLocalDownloadSocket().isPresent()) { UnixSocketConnector unix = new UnixSocketConnector(server); unix.setAcceptQueueSize(128); unix.setUnixSocket(s3Configuration.getLocalDownloadSocket().get()); server.addConnector(unix); } server.setHandler(handler); try { LOG.info( "Starting server on (configuration: {})", s3Configuration.getLocalDownloadHttpPort(), configuration ); server.start(); this.server = Optional.of(server); server.join(); } catch (Throwable t) { throw new RuntimeException(t); } }

Target:
public void startAndWait() { Preconditions.checkState(!server.isPresent()); Preconditions.checkState( s3Configuration.getS3AccessKey().isPresent(), "s3AccessKey not set!" ); Preconditions.checkState( s3Configuration.getS3SecretKey().isPresent(), "s3SecretKey not set!" ); Preconditions.checkState( s3Configuration.getLocalDownloadHttpPort().isPresent() || s3Configuration.getLocalDownloadSocket().isPresent(), "Must specify either unix socket (localDownloadSocket) or port (localDownloadHttpPort)" ); Server server = new Server(); if (s3Configuration.getLocalDownloadHttpPort().isPresent()) { ServerConnector http = new ServerConnector(server); http.setHost("localhost"); http.setPort(s3Configuration.getLocalDownloadHttpPort().get()); http.setIdleTimeout(configuration.getHttpServerTimeout()); server.addConnector(http); } if (s3Configuration.getLocalDownloadSocket().isPresent()) { UnixSocketConnector unix = new UnixSocketConnector(server); unix.setAcceptQueueSize(configuration.getUnixAcceptQueueSize()); unix.setUnixSocket(s3Configuration.getLocalDownloadSocket().get()); server.addConnector(unix); } server.setHandler(handler); try { LOG.info( "Starting server on (configuration: {})", s3Configuration.getLocalDownloadHttpPort(), configuration ); server.start(); this.server = Optional.of(server); server.join(); } catch (Throwable t) { throw new RuntimeException(t); } }
Source:
private Object process0(long cntr, CacheContinuousQueryEntry entry, boolean backup) { assert cntr >= 0 : cntr; Batch batch; Object res = null; for (;;) { batch = initBatch(entry.topologyVersion(), backup); if (batch == null || cntr < batch.startCntr) { if (backup) { backupQ.add(entry); return null; } return entry; } if (cntr <= batch.endCntr) { res = batch.processEntry0(null, cntr, entry, backup); if (res == RETRY) continue; } else { if (batch.endCntr < ackedUpdCntr) batch.tryRollOver(entry.topologyVersion()); if (pendingSize.get() > MAX_PENDING_BUFF_SIZE) { LT.warn(log, "Buffer for pending events reached max of its size " + "[cacheId=" + entry.cacheId() + ", maxSize=" + MAX_PENDING_BUFF_SIZE + ", partId=" + entry.partition() + ']'); int keysToRemove = BUF_SIZE; Iterator<Map.Entry<Long, CacheContinuousQueryEntry>> iter = pending.entrySet().iterator(); res = new ArrayList<>(); while (iter.hasNext() && keysToRemove > 0) { res = addResult(res, iter.next().getValue(), false); iter.remove(); pendingSize.decrementAndGet(); keysToRemove--; } } pendingSize.incrementAndGet(); pending.put(cntr, entry); } break; } Batch batch0 = curBatch.get(); if (batch0 != batch) { do { batch = batch0; res = processPending(res, batch, backup); batch0 = curBatch.get(); } while (batch != batch0); } return res; }

Target:
private Object process0(long cntr, CacheContinuousQueryEntry entry, boolean backup) { assert cntr >= 0 : cntr; Batch batch; Object res = null; for (;;) { batch = initBatch(entry.topologyVersion(), backup); if (batch == null || cntr < batch.startCntr) { if (backup) { backupQ.add(entry); return null; } return entry; } if (cntr <= batch.endCntr) { res = batch.processEntry0(null, cntr, entry, backup); if (res == RETRY) continue; } else { if (batch.endCntr < ackedUpdCntr.get() && batch.tryRollOver(entry.topologyVersion()) == RETRY) continue; pendingCurrSize.incrementAndGet(); pending.put(cntr, entry); if (pendingCurrSize.get() > MAX_PENDING_BUFF_SIZE) { synchronized (pending) { if (pendingCurrSize.get() <= MAX_PENDING_BUFF_SIZE) break; LT.warn(log, "Buffer for pending events reached max of its size " + "[cacheId=" + entry.cacheId() + ", maxSize=" + MAX_PENDING_BUFF_SIZE + ", partId=" + entry.partition() + ']'); int keysToRemove = BUF_SIZE; Iterator<Map.Entry<Long, CacheContinuousQueryEntry>> iter = pending.entrySet().iterator(); while (iter.hasNext() && keysToRemove > 0) { CacheContinuousQueryEntry entry0 = iter.next().getValue(); if (!backup) res = addResult(res, entry0.copyWithDataReset(), backup); iter.remove(); pendingCurrSize.decrementAndGet(); keysToRemove--; } } } } break; } Batch batch0 = curBatch.get(); if (batch0 != batch) { do { batch = batch0; res = processPending(res, batch, backup); batch0 = curBatch.get(); } while (batch != batch0); } return res; }
Source:
public PatchSetAttribute asPatchSetAttribute(final PatchSet patchSet) { PatchSetAttribute p = new PatchSetAttribute(); p.revision = patchSet.getRevision().get(); p.number = Integer.toString(patchSet.getPatchSetId()); p.ref = patchSet.getRefName(); p.uploader = asAccountAttribute(patchSet.getUploader()); p.createdOn = patchSet.getCreatedOn().getTime() / 1000L; final PatchSet.Id pId = patchSet.getId(); try { final ReviewDb db = schema.open(); try { p.parents = new ArrayList<String>(); for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf( patchSet.getId())) { p.parents.add(a.getAncestorRevision().get()); } Account.Id authoId = psInfoFactory.get(db, pId).getAuthor().getAccount(); if (authoId == null) { p.author = new AccountAttribute(); p.author.email = ""; p.author.name = "[Forge Author or non-gerrit User]"; p.author.username = ""; } else { p.author = asAccountAttribute(authoId); } Change change = db.changes().get(pId.getParentKey()); List<Patch> list = patchListCache.get(change, patchSet).toPatchList(pId); for (Patch pe : list) { if (!Patch.COMMIT_MSG.equals(pe.getFileName())) { p.sizeDeletions -= pe.getDeletions(); p.sizeInsertions += pe.getInsertions(); } } } finally { db.close(); } } catch (OrmException e) { log.error("Cannot load patch set data for " + patchSet.getId(), e); } catch (PatchSetInfoNotAvailableException e) { log.error(String.format("Cannot get authorEmail for %s.", pId), e); } catch (PatchListNotAvailableException e) { log.error(String.format("Cannot get size information for %s.", pId), e); } return p; }

Target:
public PatchSetAttribute asPatchSetAttribute(final PatchSet patchSet) { PatchSetAttribute p = new PatchSetAttribute(); p.revision = patchSet.getRevision().get(); p.number = Integer.toString(patchSet.getPatchSetId()); p.ref = patchSet.getRefName(); p.uploader = asAccountAttribute(patchSet.getUploader()); p.createdOn = patchSet.getCreatedOn().getTime() / 1000L; final PatchSet.Id pId = patchSet.getId(); try { final ReviewDb db = schema.open(); try { p.parents = new ArrayList<String>(); for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf( patchSet.getId())) { p.parents.add(a.getAncestorRevision().get()); } Account.Id authorId = psInfoFactory.get(db, pId).getAuthor().getAccount(); if (authorId == null) { p.author = new AccountAttribute(); p.author.email = ""; p.author.name = "[Forge Author or non-Gerrit User]"; p.author.username = ""; } else { p.author = asAccountAttribute(authorId); } Change change = db.changes().get(pId.getParentKey()); List<Patch> list = patchListCache.get(change, patchSet).toPatchList(pId); for (Patch pe : list) { if (!Patch.COMMIT_MSG.equals(pe.getFileName())) { p.sizeDeletions -= pe.getDeletions(); p.sizeInsertions += pe.getInsertions(); } } } finally { db.close(); } } catch (OrmException e) { log.error("Cannot load patch set data for " + patchSet.getId(), e); } catch (PatchSetInfoNotAvailableException e) { log.error(String.format("Cannot get authorEmail for %s.", pId), e); } catch (PatchListNotAvailableException e) { log.error(String.format("Cannot get size information for %s.", pId), e); } return p; }
Source:
public void postStartup() { CliParser.getInstance().handleLateOptions(); }

Target:
public void postStartup() { Display.getDefault().asyncExec(() -> CliParser.getInstance().handleLateOptions()); }
Source:
public void testTwoWaySSLv2HelloNotEnabled() throws Exception { List<Protocol> list = new ArrayList<>(); list.add(Protocol.forName("TLSv1")); list.add(Protocol.forName("TLSv1.1")); SSLContext serverContext = new SSLContextBuilder() .setSecurityDomain(securityDomain) .setKeyManager(getKeyManager("/ca/jks/scarab.keystore")) .setTrustManager(getCATrustManager()) .setNeedClientAuth(true) .setProtocolSelector(ProtocolSelector.empty().add(EnumSet.copyOf(list))) .build().create(); String[] enabledProtocols = new String[]{"TLSv1", "TLSv1.1"}; SecurityIdentity identity = performConnectionTest(serverContext, "protocol://two-way-no-sslv2hello.org", "wildfly-ssl-test-config-v1_6.xml", enabledProtocols, "TLSv1.1"); assertNotNull(identity); assertEquals("Principal Name", "ladybird", identity.getPrincipal().getName()); }

Target:
public void testTwoWaySSLv2HelloNotEnabled() throws Exception { SSLContext serverContext = new SSLContextBuilder() .setSecurityDomain(securityDomain) .setKeyManager(getKeyManager("/ca/jks/scarab.keystore")) .setTrustManager(getCATrustManager()) .setNeedClientAuth(true) .build().create(); String[] enabledProtocols = IS_IBM ? new String[]{"TLSv1", "TLSv1.1", "TLSv1.2"} : new String[]{"TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"}; SecurityIdentity identity = performConnectionTest(serverContext, "protocol://two-way-no-sslv2hello.org", "wildfly-ssl-test-config-v1_6.xml", enabledProtocols, "TLSv1.2"); assertNotNull(identity); assertEquals("Principal Name", "ladybird", identity.getPrincipal().getName()); }