auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean replaces(@Nullable LookupExtractorFactory other) { if (other != null) { NamespaceLookupExtractorFactory that = (NamespaceLookupExtractorFactory) other; return !extractionNamespace.equals(that.extractionNamespace); } return true; }

Target:
public boolean replaces(@Nullable LookupExtractorFactory other) { if (other != null && other instanceof NamespaceLookupExtractorFactory) { NamespaceLookupExtractorFactory that = (NamespaceLookupExtractorFactory) other; return !extractionNamespace.equals(that.extractionNamespace); } return true; }
Source:
public void checkCreatorLabel(Attribution attribution, List<Agent> agents, Map<String, List<String>> creatorMap) { Map<String, List<String>> finalMap = new HashMap<>(); if(!creatorMap.isEmpty() && !agents.isEmpty()) { for (Map.Entry<String, List<String>> creator : creatorMap.entrySet()) { List<String> creatorValues = new ArrayList<>(); for (String value : creator.getValue()) { if (EuropeanaUriUtils.isUri(value)) { for (Agent agent : agents) { if (StringUtils.equals(value, agent.getAbout())) { creatorValues.addAll(getCreatorFromAgent(agent)); } } } else { creatorValues.add(value); } } ComparatorUtils.removeDuplicates(creatorValues); finalMap.put(creator.getKey(), creatorValues); } } attribution.setCreator(concatLangawareMap(finalMap)); }

Target:
public void checkCreatorLabel(Attribution attribution, List<Agent> agents, Map<String, List<String>> creatorMap) { Map<String, List<String>> finalMap = new HashMap<>(); if (! creatorMap.isEmpty() && ! agents.isEmpty()) { for (Map.Entry<String, List<String>> creator : creatorMap.entrySet()) { List<String> creatorValues = new ArrayList<>(); for (String value : creator.getValue()) { getCreatorLabel(agents, value, creatorValues); } ComparatorUtils.removeDuplicates(creatorValues); finalMap.put(creator.getKey(), creatorValues); } } attribution.setCreator(concatLangawareMap(finalMap)); }
Source:
void closeOnFailure() { try ( Closer<RuntimeException> closer = new Closer<>() ) { closer.push( IdentifierMappingImplementor::close, identifierMapping ); closer.push( RoutingKeyProvider::close, routingKeyProvider ); closer.push( BeanHolder::close, providedIdentifierBridgeHolder ); } }

Target:
void closeOnFailure() { try ( Closer<RuntimeException> closer = new Closer<>() ) { closer.push( IdentifierMappingImplementor::close, identifierMapping ); closer.push( RoutingKeyProvider::close, routingKeyProvider ); } }
Source:
public IIrsServer getIrsProxy() { if (getmIrsProxy() == null) { storage_pool storagePool = DbFacade.getInstance().getStoragePoolDao().get(_storagePoolId); if (storagePool.getstatus() != StoragePoolStatus.Uninitialized) { String host = TransactionSupport.executeInScope(TransactionScopeOption.Suppress, new TransactionMethod<String>() { @Override public String runInTransaction() { return gethostFromVds(); } }); if (host != null) { String clusterVersion = Config.DefaultConfigurationVersion; if (mCurrentVdsId != null) { VDS vds = DbFacade.getInstance().getVdsDao().get(mCurrentVdsId); if (vds != null) { clusterVersion = vds.getvds_group_compatibility_version().getValue(); } } int clientTimeOut = Config.<Integer> GetValue(ConfigValues.vdsTimeout, clusterVersion) * 1000; int connectionTimeOut = Config.<Integer>GetValue(ConfigValues.vdsConnectionTimeout, clusterVersion) * 1000; int clientRetries = Config.<Integer> GetValue(ConfigValues.vdsRetries, clusterVersion); Pair<IrsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(host, getmIrsPort(), clientTimeOut, connectionTimeOut, clientRetries, IrsServerConnector.class, Config.<Boolean> GetValue(ConfigValues.UseSecureConnectionWithServers)); privatemIrsProxy = new IrsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); Class[] inputTypes = new Class[] { storage_pool.class, boolean.class }; Object[] inputParams = new Object[] { storagePool, _isSpmStartCalled }; SchedulerUtilQuartzImpl.getInstance().scheduleAOneTimeJob(this, "StorageEventOnTimer", inputTypes, inputParams, 0, TimeUnit.MILLISECONDS); } } } return getmIrsProxy(); }

Target:
public IIrsServer getIrsProxy() { if (getmIrsProxy() == null) { final storage_pool storagePool = DbFacade.getInstance().getStoragePoolDao().get(_storagePoolId); if (storagePool.getstatus() != StoragePoolStatus.Uninitialized) { String host = TransactionSupport.executeInScope(TransactionScopeOption.Suppress, new TransactionMethod<String>() { @Override public String runInTransaction() { return gethostFromVds(); } }); if (host != null) { int clientTimeOut = Config.<Integer> GetValue(ConfigValues.vdsTimeout) * 1000; int connectionTimeOut = Config.<Integer>GetValue(ConfigValues.vdsConnectionTimeout) * 1000; int clientRetries = Config.<Integer> GetValue(ConfigValues.vdsRetries); Pair<IrsServerConnector, HttpClient> returnValue = XmlRpcUtils.getConnection(host, getmIrsPort(), clientTimeOut, connectionTimeOut, clientRetries, IrsServerConnector.class, Config.<Boolean> GetValue(ConfigValues.UseSecureConnectionWithServers)); privatemIrsProxy = new IrsServerWrapper(returnValue.getFirst(), returnValue.getSecond()); runStoragePoolUpEvent(storagePool); } } } return getmIrsProxy(); }
Source:
public void shouldReturnSessionIdWhenSendCommandAndGetResponseIsCalled() { Response response = chromiumApi.sendCommandAndGetResponse("", ImmutableMap.of()); assertEquals(sessionId.toString(), response.getSessionId()); }

Target:
public void shouldReturnSessionIdWhenSendCommandAndGetResponseIsCalled() { Response response = chromiumApi.sendCommandAndGetResponse("", ImmutableMap.of()); assertThat(sessionId.toString()).isEqualTo(response.getSessionId()); }
Source:
private GoogleAuthenticatorKey generateKey() throws TOTPException { KeyRepresentation encoding = KeyRepresentation.BASE32; try { if ("Base64".equals(TOTPUtil.getEncodingMethod())) { encoding = KeyRepresentation.BASE64; } } catch (IdentityApplicationManagementException e) { throw new TOTPException("Error when reading the encoding method for tenant",e); } GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder gacb = new GoogleAuthenticatorConfig .GoogleAuthenticatorConfigBuilder() .setKeyRepresentation(encoding); GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator(gacb.build()); GoogleAuthenticatorKey key = googleAuthenticator.createCredentials(); return key; }

Target:
private GoogleAuthenticatorKey generateKey() throws TOTPException { KeyRepresentation encoding = KeyRepresentation.BASE32; try { if (Constants.BASE64.equals(TOTPUtil.getEncodingMethod())) { encoding = KeyRepresentation.BASE64; } } catch (IdentityApplicationManagementException e) { throw new TOTPException("Error when reading the encoding method for tenant",e); } GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder gacb = new GoogleAuthenticatorConfig .GoogleAuthenticatorConfigBuilder() .setKeyRepresentation(encoding); GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator(gacb.build()); GoogleAuthenticatorKey key = googleAuthenticator.createCredentials(); return key; }
Source:
public String getParameterJsonWithUrlEncoded() { try { List<String> placeholders = parsePlaceHolders(getCommand()); assurePlaceholdersAreBound(placeholders, params); String jsonParameterObject = createJsonObject(params); String urlEncodedJsonParameterObject = encode(jsonParameterObject); return urlEncodedJsonParameterObject; } catch (IOException e) { throw new RuntimeException("Couldn't create parameter JSON object", e); } }

Target:
public String getParameterJsonWithUrlEncoded() { try { String jsonParameterObject = createJsonObject(params); String urlEncodedJsonParameterObject = encode(jsonParameterObject); return urlEncodedJsonParameterObject; } catch (IOException e) { throw new InfluxDBIOException(e); } }
Source:
private <T> boolean compareValues(final T v1, final T v2, final String label) { boolean eq = Objects.equals(v1, v2); if (eq) { return true; } else { reportDifference(v1, v2, label); return false; } }

Target:
private static <T> boolean compareValues(final T v1, final T v2, final String label) { boolean eq = Objects.equals(v1, v2); if (eq) { return true; } else { reportDifference(v1, v2, label); return false; } }
Source:
public boolean setValue(Object value) throws OseeCoreException { ByteBuffer toSet = null; if (value != null && value instanceof String) { try { toSet = ByteBuffer.wrap(((String) value).getBytes("UTF-8")); } catch (UnsupportedEncodingException ex) { OseeCoreException.wrapAndThrow(ex); } } return setValue(toSet); }

Target:
public boolean setValue(Object value) throws OseeCoreException { ByteBuffer toSet = null; if (value != null && value instanceof String) { try { toSet = ByteBuffer.wrap(((String) value).getBytes("UTF-8")); } catch (UnsupportedEncodingException ex) { OseeCoreException.wrapAndThrow(ex); } } else if (value != null) { OseeCoreException.wrapAndThrow(new UnsupportedEncodingException( String.format("Unsupported type [%s]", value.getClass().toGenericString()))); } return setValue(toSet); }
Source:
private SiriusServerSectionDto convertSection(Session session, SectionDescription sectionDescription) { String sectionIdentifier = sectionDescription.getName(); DAnalysis self = ((DAnalysisSessionImpl) session).getAnalyses().get(0); Map<String, Object> variables = new HashMap<>(); variables.put(SELF, self); IEvaluationResult result = new SiriusBackendInterpreter(session).evaluateExpression(variables, sectionDescription.getTitleExpression()); String sectionName = result.asString(); List<SiriusServerActivityDto> activities = sectionDescription.getActivities().stream() .map(activityDescription -> this.convertActivity(session, activityDescription)) .collect(Collectors.toList()); return new SiriusServerSectionDto(sectionIdentifier, sectionName, activities); }

Target:
private SiriusServerSectionDto convertSection(Session session, SectionDescription sectionDescription) { String sectionIdentifier = sectionDescription.getName(); DAnalysis self = ((DAnalysisSessionImpl) session).allAnalyses().stream().findFirst().orElse(null); Map<String, Object> variables = new HashMap<>(); variables.put(SELF, self); IEvaluationResult result = new SiriusBackendInterpreter(session).evaluateExpression(variables, sectionDescription.getTitleExpression()); String sectionName = result.asString(); List<SiriusServerActivityDto> activities = sectionDescription.getActivities().stream() .map(activityDescription -> this.convertActivity(session, activityDescription)) .collect(Collectors.toList()); return new SiriusServerSectionDto(sectionIdentifier, sectionName, activities); }
Source:
public void testAddColLabelOutOfRangeThrowsException() { int columnIndex = 5; try { pivotTable.addColLabel(columnIndex); } catch(IndexOutOfBoundsException e) { return; } fail(); }

Target:
public void testAddColLabelOutOfRangeThrowsException() { int columnIndex = 5; try { pivotTable.addColLabel(columnIndex); fail("expected IndexOutOfBoundsException for column: " + columnIndex); } catch(IndexOutOfBoundsException e) { } }
Source:
private void adaptQualifiedNameToNamespaceLevel(IASTFunctionDefinition new_definition, List<ICPPASTNamespaceDefinition> namespaces) { if (new_definition.getDeclarator().getName() instanceof ICPPASTQualifiedName && !namespaces.isEmpty()) { ICPPNodeFactory nodeFactory = ASTNodeFactoryFactory.getDefaultCPPNodeFactory(); ICPPASTQualifiedName qname = (ICPPASTQualifiedName) new_definition.getDeclarator().getName(); ICPPASTName lastNameCopy = nodeFactory.newName(qname.getLastName().toCharArray()); ICPPASTQualifiedName qname_new = nodeFactory.newQualifiedName(lastNameCopy); boolean start = false; ICPPASTNameSpecifier[] qualifiers = qname.getQualifier(); for (int i = 0; i < qualifiers.length; i++) { String qualifierName = qualifiers[i].toString(); if (i < namespaces.size() && qualifierName.equals(namespaces.get(i).getName().toString())) { start = true; } else if (start) qname_new.addNameSpecifier(qualifiers[i]); } if (start) { new_definition.getDeclarator().setName(qname_new); } } }

Target:
private void adaptQualifiedNameToNamespaceLevel(IASTFunctionDefinition new_definition, List<ICPPASTNamespaceDefinition> namespaces) { if (new_definition.getDeclarator().getName() instanceof ICPPASTQualifiedName && !namespaces.isEmpty()) { ICPPNodeFactory nodeFactory = ASTNodeFactoryFactory.getDefaultCPPNodeFactory(); ICPPASTQualifiedName qname = (ICPPASTQualifiedName) new_definition.getDeclarator().getName(); ICPPASTName lastNameCopy = nodeFactory.newName(qname.getLastName().toCharArray()); ICPPASTQualifiedName qname_new = nodeFactory.newQualifiedName(lastNameCopy); boolean start = false; ICPPASTNameSpecifier[] qualifiers = qname.getQualifier(); for (int i = 0; i < qualifiers.length; i++) { String qualifierName = qualifiers[i].toString(); if (i < namespaces.size() && qualifierName.equals(namespaces.get(i).getName().toString())) { start = true; } else if (start) { qname_new.addNameSpecifier(qualifiers[i]); } } if (start) { new_definition.getDeclarator().setName(qname_new); } } }
Source:
public JacksonSerializerHelper() { numberTypes = new HashSet<>(); numberTypes.add(Long.class.getCanonicalName()); numberTypes.add(Float.class.getCanonicalName()); numberTypes.add(Double.class.getCanonicalName()); }

Target:
public JacksonSerializerHelper() { }
Source:
public static Set<String> listDeploymentNames(OperationContext context, PathAddress deploymentRootAddress, Set<Pattern> patterns) { Set<String> deploymentNames = new HashSet<>(); Resource deploymentRootResource = context.readResourceFromRoot(deploymentRootAddress); if (deploymentRootResource.hasChildren(DEPLOYMENT)) { for (Resource.ResourceEntry deploymentResource : deploymentRootResource.getChildren(DEPLOYMENT)) { if (isAcceptableDeployment(deploymentResource.getModel(), patterns)) { deploymentNames.add(deploymentResource.getName()); } else if (deploymentResource.hasChildren(SUBDEPLOYMENT)) { for (Resource.ResourceEntry subdeploymentResource : deploymentResource.getChildren(SUBDEPLOYMENT)) { if (isAcceptableDeployment(subdeploymentResource.getModel(), patterns)) { deploymentNames.add(deploymentResource.getName()); } } } } } return deploymentNames; }

Target:
private static Set<String> listDeploymentNames(OperationContext context, PathAddress deploymentRootAddress, Set<Pattern> patterns) { Set<String> deploymentNames = new HashSet<>(); Resource deploymentRootResource = context.readResourceFromRoot(deploymentRootAddress); if (deploymentRootResource.hasChildren(DEPLOYMENT)) { for (Resource.ResourceEntry deploymentResource : deploymentRootResource.getChildren(DEPLOYMENT)) { if (isAcceptableDeployment(deploymentResource.getModel(), patterns)) { deploymentNames.add(deploymentResource.getName()); } else if (deploymentResource.hasChildren(SUBDEPLOYMENT)) { for (Resource.ResourceEntry subdeploymentResource : deploymentResource.getChildren(SUBDEPLOYMENT)) { if (isAcceptableDeployment(subdeploymentResource.getModel(), patterns)) { deploymentNames.add(deploymentResource.getName()); } } } } } return deploymentNames; }
Source:
private static Thread asyncProcessStream(final InputStream input, final StringBuilder out) { Thread thread = new Thread() { @Override public void run() { try { out.append(inputstreamToString(input)); } finally { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } }; thread.setDaemon(true); thread.start(); return thread; }

Target:
private static Thread asyncProcessStream(final InputStream input, final StringBuilder out) { Thread thread = new Thread() { @Override public void run() { try { out.append(inputstreamToString(input)); } finally { try { input.close(); } catch (IOException e) { LOG.log(Level.WARNING, "Failed to close the input stream", e); } } } }; thread.setDaemon(true); thread.start(); return thread; }
Source:
public Function<Result<TimeseriesResultValue>, Result<TimeseriesResultValue>> makePostComputeManipulatorFn( TimeseriesQuery query, MetricManipulationFn fn ) { boolean shouldFinalize = MetricManipulatorFns.finalizing().equals(fn); return makeComputeManipulatorFn(query, fn, shouldFinalize); }

Target:
public Function<Result<TimeseriesResultValue>, Result<TimeseriesResultValue>> makePostComputeManipulatorFn( TimeseriesQuery query, MetricManipulationFn fn ) { return makeComputeManipulatorFn(query, fn, true); }
Source:
public Response send(final Request req, final String home, final String method, final Collection<Entry<String, String>> headers, final byte[] content) throws IOException { Response response = null; int attempts = 0; do { try { TimeUnit.SECONDS.sleep(1 * attempts); } catch (final InterruptedException ex) { throw new IOException(ex); } response = this.origin.send(req, home, method, headers, content); attempts += 1; } while ( response.status() >= 300 && response.status() <= 399 && attempts < this.max ); return response; }

Target:
public Response send(final Request req, final String home, final String method, final Collection<Entry<String, String>> headers, final byte[] content) throws IOException { Response response = null; int attempts = 0; do { try { TimeUnit.SECONDS.sleep(1 * attempts); } catch (final InterruptedException ex) { throw new IOException(ex); } response = this.origin.send(req, home, method, headers, content); attempts += 1; } while ( response.status() >= HttpURLConnection.HTTP_MULT_CHOICE && response.status() <= HttpURLConnection.HTTP_USE_PROXY && attempts < this.max ); return response; }
Source:
boolean disableCompactionForBlobStore(PartitionId id) { BlobStore store = (BlobStore) getStore(id); return store != null && compactionManager.disableCompactionForBlobStore(store); }

Target:
boolean disableCompactionForBlobStore(PartitionId id) { BlobStore store = stores.get(id); return store != null && compactionManager.disableCompactionForBlobStore(store); }
Source:
public void testGetCarbonConfiguration() throws Exception { String backupRepoLocation = System.getProperty(Constants.CARBON_REPOSITORY); System.setProperty(Constants.CARBON_REPOSITORY, getTestResourceFile("xsd").getAbsolutePath()); CarbonConfiguration carbonConfiguration = xmlBasedConfigProvider.getCarbonConfiguration(); Assert.assertEquals(carbonConfiguration.getId(), "carbon-kernel"); Assert.assertEquals(carbonConfiguration.getName(), "WSO2 Carbon Kernel"); Assert.assertEquals(carbonConfiguration.getVersion(), "5.0.0-SNAPSHOT"); Assert.assertEquals(carbonConfiguration.getPortsConfig().getOffset(), 0); DeploymentConfig deploymentConfig = carbonConfiguration.getDeploymentConfig(); Assert.assertEquals(deploymentConfig.getUpdateInterval(), 15); Assert.assertEquals(deploymentConfig.getRepositoryLocation(), "test-repo-location"); Assert.assertEquals(deploymentConfig.getMode(), DeploymentModeEnum.scheduled); if (backupRepoLocation != null) { System.setProperty(Constants.CARBON_REPOSITORY, backupRepoLocation); } else { System.clearProperty(Constants.CARBON_REPOSITORY); } }

Target:
public void testGetCarbonConfiguration() throws Exception { String backupRepoLocation = System.getProperty(Constants.CARBON_REPOSITORY); System.setProperty(Constants.CARBON_REPOSITORY, getTestResourceFile("xsd").getAbsolutePath()); CarbonConfiguration carbonConfiguration = xmlBasedConfigProvider.getCarbonConfiguration(); Assert.assertEquals(carbonConfiguration.getId(), "carbon-kernel"); Assert.assertEquals(carbonConfiguration.getName(), "WSO2 Carbon Kernel"); Assert.assertEquals(carbonConfiguration.getVersion(), "1.2.3"); Assert.assertEquals(carbonConfiguration.getPortsConfig().getOffset(), 0); DeploymentConfig deploymentConfig = carbonConfiguration.getDeploymentConfig(); Assert.assertEquals(deploymentConfig.getUpdateInterval(), 15); Assert.assertEquals(deploymentConfig.getRepositoryLocation(), "test-repo-location"); Assert.assertEquals(deploymentConfig.getMode(), DeploymentModeEnum.scheduled); if (backupRepoLocation != null) { System.setProperty(Constants.CARBON_REPOSITORY, backupRepoLocation); } else { System.clearProperty(Constants.CARBON_REPOSITORY); } }
Source:
public final void skipIfCantResolve(Method method, Object[] params) { String accession = null; if (params.length > 0) { Object firstParam = params[0]; if (firstParam instanceof String) { accession = (String)firstParam; } else if (firstParam instanceof SRAAccession) { accession = firstParam.toString(); } } if (accession != null && accession.matches(SRAAccession.REMOTE_ACCESSION_PATTERN) && !canResolveNetworkAccession) { throw new SkipException("Skipping network SRA Test because cannot resolve SRA accession."); } }

Target:
public final void skipIfCantResolve(Method method, Object[] params) { String accession = null; if (params.length > 0) { Object firstParam = params[0]; if (firstParam instanceof String) { accession = (String)firstParam; } else if (firstParam instanceof SRAAccession) { accession = firstParam.toString(); } } if (accession != null && accession.matches(SRAAccession.REMOTE_ACCESSION_PATTERN) && !canResolveNetworkAccession) { throw new SkipException("Skipping network SRA Test because cannot resolve remote SRA accession '" + checkAccession + "'."); } }
Source:
public AuthzDecisionStatement createAuthzDecisionStatement(final String resource, final String decisionTxt, final String action, final Evidence evidence) { final AuthDecisionStatementBean authzBean = new AuthDecisionStatementBean(); final ActionBean actionBean = new ActionBean(); actionBean.setActionNamespace("urn:oasis:names:tc:SAML:1.0:action:rwedc"); actionBean.setContents(action); authzBean.setActions(Collections.singletonList(actionBean)); authzBean.setResource(resource); authzBean.setDecision(AuthDecisionStatementBean.Decision.valueOf(decisionTxt.toUpperCase())); authzBean.setEvidence(evidence); return SAML2ComponentBuilder.createAuthorizationDecisionStatement(Collections.singletonList(authzBean)).get(0); }

Target:
public AuthzDecisionStatement createAuthzDecisionStatement(final String resource, final String decisionTxt, final String action, final Evidence evidence) { final AuthDecisionStatementBean authzBean = new AuthDecisionStatementBean(); final ActionBean actionBean = new ActionBean(); actionBean.setActionNamespace(NhincConstants.ACTION_NAMESPACE_STRING); actionBean.setContents(action); authzBean.setActions(Collections.singletonList(actionBean)); authzBean.setResource(resource); authzBean.setDecision(AuthDecisionStatementBean.Decision.valueOf(decisionTxt.toUpperCase())); authzBean.setEvidence(evidence); return SAML2ComponentBuilder.createAuthorizationDecisionStatement(Collections.singletonList(authzBean)).get(0); }
Source:
public Throwable initCause(Throwable cause) { if (cause == null) { throw new NullPointerException(); } if (cause == this) { throw new IllegalArgumentException("cannot add to self"); } if (cause instanceof MultiCacheException) { for (Throwable t2 : ((MultiCacheException)cause).getThrowables()) { throwables.add(t2); } } else { throwables.add(0, cause); } return this; }

Target:
public Throwable initCause(Throwable cause) { throw new UnsupportedOperationException(); }
Source:
public void testSimulatePackfileReplacement() throws Exception { File f1 = createFile("file"); File f2 = createFile("fool"); waitNextSec(f1); FileTime timestamp = Files.getLastModifiedTime(f1.toPath()); FileSnapshot save = FileSnapshot.save(f1); Files.move(f2.toPath(), f1.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); Files.setLastModifiedTime(f1.toPath(), timestamp); assertTrue(save.isModified(f1)); }

Target:
public void testSimulatePackfileReplacement() throws Exception { File f1 = createFile("file"); File f2 = createFile("fool"); waitNextSec(f1); waitNextSec(f1); FileTime timestamp = Files.getLastModifiedTime(f1.toPath()); FileSnapshot save = FileSnapshot.save(f1); Files.move(f2.toPath(), f1.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); Files.setLastModifiedTime(f1.toPath(), timestamp); assertTrue(save.isModified(f1)); }
Source:
public final NotInBitmapFilter clone() { return this; }

Target:
public final NotInBitmapFilter clone() { throw new UnsupportedOperationException(); }
Source:
public static ClientConfig createConfig() { ClientConfig clientConfig = new ClientConfig(); clientConfig.property(ClientProperties.ASYNC_THREADPOOL_SIZE, 10); clientConfig.property(ClientProperties.CONNECT_TIMEOUT, 50000); clientConfig.property(ClientProperties.READ_TIMEOUT, 200000); return clientConfig; }

Target:
static ClientConfig createConfig() { ClientConfig clientConfig = new ClientConfig(); clientConfig.property(ClientProperties.ASYNC_THREADPOOL_SIZE, 10); clientConfig.property(ClientProperties.CONNECT_TIMEOUT, 5000); clientConfig.property(ClientProperties.READ_TIMEOUT, 20000); return clientConfig; }
Source:
protected Boolean isValidId(String id) { return !id.contains("N") && !id.contains("-") && !id.contains("undefined") && id.split(":")[1].matches(".*\\d+.*"); }

Target:
protected Boolean isValidId(String id) { return !id.contains("N") && !id.contains("-") && !id.contains("undefined") && id.contains(":") && id.split(":")[1].matches(".*\\d+.*"); }
Source:
public void doStopJobExecution() throws Exception { String jobName = generateJobName(); executeJobCreate(jobName, JOB_WITH_STEP_EXECUTIONS); checkForJobInList(jobName, JOB_WITH_STEP_EXECUTIONS, true); triggerJobWithDelay(jobName, "5"); Thread.sleep(5000); String executionId = getJobExecutionId(jobName); System.out.println("ExecutionId: " + executionId); String executionStatus = getJobExecutionStatus(jobName); System.out.println("ExecutionStatus: " + executionStatus); long timeout = System.currentTimeMillis() + 10000; while ((executionStatus.equals("STARTING") || executionStatus.equals("STARTED")) && System.currentTimeMillis() < timeout) { executionStatus = getJobExecutionStatus(jobName); executionId = getJobExecutionId(jobName); } executeCommand("job execution stop " + executionId); Thread.sleep(3000); Table table; int n = 0; do { table = (Table) executeCommand("job execution list").getResult(); for (TableRow tr : table.getRows()) { if (tr.getValue(1).equals(executionId)) { executionStatus = tr.getValue(5); break; } } if (!"STOPPED".equals(executionStatus)) { Thread.sleep(100); } } while (!"STOPPED".equals(executionStatus) && n++ < 100); assertEquals("STOPPED", executionStatus); }

Target:
public void doStopJobExecution() throws Exception { String jobName = generateJobName(); executeJobCreate(jobName, JOB_WITH_STEP_EXECUTIONS); checkForJobInList(jobName, JOB_WITH_STEP_EXECUTIONS, true); triggerJobWithDelay(jobName, "5"); Thread.sleep(5000); String executionId = getJobExecutionId(jobName); String executionStatus = getJobExecutionStatus(jobName); long timeout = System.currentTimeMillis() + 10000; while ((executionStatus.equals("STARTING") || executionStatus.equals("STARTED")) && System.currentTimeMillis() < timeout) { executionStatus = getJobExecutionStatus(jobName); executionId = getJobExecutionId(jobName); } executeCommand("job execution stop " + executionId); Thread.sleep(3000); Table table; int n = 0; do { table = (Table) executeCommand("job execution list").getResult(); for (TableRow tr : table.getRows()) { if (tr.getValue(1).equals(executionId)) { executionStatus = tr.getValue(5); break; } } if (!"STOPPED".equals(executionStatus)) { Thread.sleep(100); } } while (!"STOPPED".equals(executionStatus) && n++ < 100); assertEquals("STOPPED", executionStatus); }
Source:
public Saveable[] getSaveables() { Saveable[] saveables = super.getSaveables(); if (saveables == null || saveables.length == 0) { ISaveablePart saveablePart = getSite().getPage().getActiveEditor(); if (saveablePart instanceof ISaveablesSource) { return ((ISaveablesSource) saveablePart).getSaveables(); } } return saveables; }

Target:
public Saveable[] getSaveables() { if (!hasSaveablesProvider()) { ISaveablePart saveablePart = getSite().getPage().getActiveEditor(); if (saveablePart instanceof ISaveablesSource) { return ((ISaveablesSource) saveablePart).getSaveables(); } } return super.getSaveables(); }
Source:
public void addWorkflowEntry(WorkflowDTO workflow) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; String query = SQLConstants.ADD_WORKFLOW_ENTRY_SQL; try { Timestamp cratedDateStamp = new Timestamp(workflow.getCreatedTime()); connection = APIMgtDBUtil.getConnection(); connection.setAutoCommit(false); prepStmt = connection.prepareStatement(query); prepStmt.setString(1, workflow.getWorkflowReference()); prepStmt.setString(2, workflow.getWorkflowType()); prepStmt.setString(3, workflow.getStatus().toString()); prepStmt.setTimestamp(4, cratedDateStamp); prepStmt.setString(5, workflow.getWorkflowDescription()); prepStmt.setInt(6, workflow.getTenantId()); prepStmt.setString(7, workflow.getTenantDomain()); prepStmt.setString(8, workflow.getExternalWorkflowReference()); if(workflow.getMetadata() != null) { byte[] metadataByte = workflow.getMetadata().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(9, new ByteArrayInputStream(metadataByte) ); } else { prepStmt.setBlob(9, (Blob)null); } if(workflow.getProperties() != null) { byte[] propertiesByte = workflow.getProperties().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(10, new ByteArrayInputStream(propertiesByte)); } else { prepStmt.setBlob(10, (Blob)null); } prepStmt.execute(); connection.commit(); } catch (SQLException | UnsupportedEncodingException e) { handleException("Error while adding Workflow : " + workflow.getExternalWorkflowReference() + " to the " + "database", e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, null); } }

Target:
public void addWorkflowEntry(WorkflowDTO workflow) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; String query = SQLConstants.ADD_WORKFLOW_ENTRY_SQL; try { Timestamp cratedDateStamp = new Timestamp(workflow.getCreatedTime()); connection = APIMgtDBUtil.getConnection(); connection.setAutoCommit(false); prepStmt = connection.prepareStatement(query); prepStmt.setString(1, workflow.getWorkflowReference()); prepStmt.setString(2, workflow.getWorkflowType()); prepStmt.setString(3, workflow.getStatus().toString()); prepStmt.setTimestamp(4, cratedDateStamp); prepStmt.setString(5, workflow.getWorkflowDescription()); prepStmt.setInt(6, workflow.getTenantId()); prepStmt.setString(7, workflow.getTenantDomain()); prepStmt.setString(8, workflow.getExternalWorkflowReference()); if (workflow.getMetadata() != null) { byte[] metadataByte = workflow.getMetadata().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(9, new ByteArrayInputStream(metadataByte)); } else { prepStmt.setNull(9, java.sql.Types.BLOB); } if (workflow.getProperties() != null) { byte[] propertiesByte = workflow.getProperties().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(10, new ByteArrayInputStream(propertiesByte)); } else { prepStmt.setNull(10, java.sql.Types.BLOB); } prepStmt.execute(); connection.commit(); } catch (SQLException | UnsupportedEncodingException e) { handleException("Error while adding Workflow : " + workflow.getExternalWorkflowReference() + " to the " + "database", e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, null); } }
Source:
public Mono<Void> uploadFromFile(String uploadFilePath) { AsynchronousFileChannel channel = channelSetup(uploadFilePath); return Flux.fromIterable(sliceFile(uploadFilePath)) .flatMap(chunk -> upload(FluxUtil.readFile(channel, chunk.start(), chunk.end() - chunk.start() + 1), chunk.end() - chunk.start() + 1, chunk.start()) .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException)) .then() .doOnTerminate(() -> channelCleanUp(channel)); }

Target:
public Mono<Void> uploadFromFile(String uploadFilePath) { return Mono.using(() -> channelSetup(uploadFilePath, StandardOpenOption.READ), channel -> Flux.fromIterable(sliceFile(uploadFilePath)).flatMap(chunk -> upload(FluxUtil.readFile(channel, chunk.start(), chunk.end() - chunk.start() + 1), chunk.end() - chunk.start() + 1, chunk.start()) .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException)) .then(), this::channelCleanUp); }
Source:
public void testPatternSubscribe() { MockSubscriber mockSubscriber = new MockSubscriber(); Runnable runnable = () -> { subscriber.psubscribe(mockSubscriber, "sal*s"); }; Thread subscriberThread = new Thread(runnable); subscriberThread.start(); waitFor(() -> mockSubscriber.getSubscribedChannels() == 1); String message = "hello-" + System.currentTimeMillis(); Long result = publisher.publish("salutations", message); assertThat(result).isEqualTo(1); assertThat(mockSubscriber.getReceivedMessages()).isEmpty(); GeodeAwaitility.await().until(() -> mockSubscriber.getReceivedPMessages().size() != 0); assertThat(mockSubscriber.getReceivedPMessages()).containsExactly(message); mockSubscriber.punsubscribe("sal*s"); waitFor(() -> mockSubscriber.getSubscribedChannels() == 0); waitFor(() -> !subscriberThread.isAlive()); }

Target:
public void testPatternSubscribe() { MockSubscriber mockSubscriber = new MockSubscriber(); Runnable runnable = () -> { subscriber.psubscribe(mockSubscriber, "sal*s"); }; Thread subscriberThread = new Thread(runnable); subscriberThread.start(); waitFor(() -> mockSubscriber.getSubscribedChannels() == 1); String message = "hello-" + System.currentTimeMillis(); Long result = publisher.publish("salutations", message); assertThat(result).isEqualTo(1); assertThat(mockSubscriber.getReceivedMessages()).isEmpty(); GeodeAwaitility.await().until(() -> !mockSubscriber.getReceivedPMessages().isEmpty()); assertThat(mockSubscriber.getReceivedPMessages()).containsExactly(message); mockSubscriber.punsubscribe("sal*s"); waitFor(() -> mockSubscriber.getSubscribedChannels() == 0); waitFor(() -> !subscriberThread.isAlive()); }
Source:
public void setup(TestContext context) throws Exception { this.context = context; if (writePercentage < 0) { throw new IllegalArgumentException("Write percentage can't be smaller than 0"); } if (writePercentage > 100) { throw new IllegalArgumentException("Write percentage can't be larger than 100"); } targetInstance = context.getTargetInstance(); TestUtils.warmupPartitions(log, targetInstance); totalCounter = targetInstance.getAtomicLong(context.getTestId() + ":TotalCounter"); counters = new IAtomicLong[countersLength]; for (int k = 0; k < counters.length; k++) { String key; if(preventLocalCalls){ key = StringUtils.generateNotKeyOwnedBy(8, targetInstance); }else{ key = StringUtils.makeString(8); } counters[k] = targetInstance.getAtomicLong(key); } }

Target:
public void setup(TestContext context) throws Exception { this.context = context; if (writePercentage < 0) { throw new IllegalArgumentException("Write percentage can't be smaller than 0"); } if (writePercentage > 100) { throw new IllegalArgumentException("Write percentage can't be larger than 100"); } targetInstance = context.getTargetInstance(); TestUtils.warmupPartitions(log, targetInstance); totalCounter = targetInstance.getAtomicLong(context.getTestId() + ":TotalCounter"); counters = new IAtomicLong[countersLength]; for (int k = 0; k < counters.length; k++) { String key = StringUtils.generateKey(8, preventLocalCalls, targetInstance); counters[k] = targetInstance.getAtomicLong(key); } }
Source:
protected void addHints(Set<Hints.Key> hints) { hints.add(Hints.GEOMETRY_SIMPLIFICATION); hints.add(Hints.GEOMETRY_GENERALIZATION); hints.add(Hints.REMOVE_BUFFER_PIXEL); }

Target:
protected void addHints(Set<Hints.Key> hints) { hints.add(Hints.GEOMETRY_SIMPLIFICATION); hints.add(Hints.GEOMETRY_GENERALIZATION); hints.add(Hints.GEOMETRY_CLIP); }
Source:
public void testRemoveAll(){ ObservableArrayList<String> list = new ObservableArrayList<>(); list.onChanged(new ListChangeListener<String>() { @Override public void listChanged(ListChangeEvent<? extends String> evt) { System.out.println(evt.getChanges().get(0).getFrom()+" - "+evt.getChanges().get(0).getFrom()); } }); Assert.assertTrue(list.isEmpty()); Assert.assertEquals(list.size(), 0); list.addAll("1", "2", "3", "4", "5", "6", "7" ,"8" , "9", "10"); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(list.size(), 10); list.removeAll(Arrays.asList("1", "2", "3", "4", "5")); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(list.size(), 5); assertSameContent(list, Arrays.asList("6", "7" ,"8" , "9", "10")); list.clear(); }

Target:
public void testRemoveAll(){ final ObservableArrayList<String> list = new ObservableArrayList<>(); Assert.assertTrue(list.isEmpty()); Assert.assertEquals(list.size(), 0); list.addAll("1", "2", "3", "4", "5", "6", "7" ,"8" , "9", "10"); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(list.size(), 10); list.removeAll(Arrays.asList("1", "2", "3", "4", "5")); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(list.size(), 5); assertSameContent(list, Arrays.asList("6", "7" ,"8" , "9", "10")); list.clear(); }
Source:
public static DevicePropertiesUtils getInstance() { if (devicePropertiesUtils == null) { synchronized (DevicePropertiesUtils.class) { if (devicePropertiesUtils == null) { devicePropertiesUtils = new DevicePropertiesUtils(); } } } return devicePropertiesUtils; }

Target:
public static DevicePropertiesUtils getInstance() { return devicePropertiesUtils; }
Source:
public void shouldSendPasswordResetReminder() throws Exception { when(templateParser.mergeTemplateIntoString(matches(PASSWORD_CHANGE_REMINDER_TEMPLATE), eq(params))) .thenReturn(EMAIL_MESSAGE); emailSender.sendPasswordResetReminder(user, expirationDate); verify(templateParser, times(1)) .mergeTemplateIntoString(matches(PASSWORD_CHANGE_REMINDER_TEMPLATE), eq(params)); verify(eventRelay, times(1)).sendEventMessage(eq(event)); }

Target:
public void shouldSendPasswordResetReminder() throws Exception { when(templateParser.mergeTemplateIntoString(matches(PASSWORD_CHANGE_REMINDER_TEMPLATE), eq(params))) .thenReturn(EMAIL_MESSAGE); emailSender.sendPasswordResetReminder(params); verify(templateParser).mergeTemplateIntoString(matches(PASSWORD_CHANGE_REMINDER_TEMPLATE), eq(params)); verify(eventRelay).sendEventMessage(eq(event)); }
Source:
public void testCompleteTransactionRejected(boolean isCommit) { final Rejected outcome = new Rejected(); final AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono.just(outcome)).when(sendLink).send(any(byte[].class), anyInt(), anyInt(), isNull()); StepVerifier.create(transactionCoordinator.completeTransaction(transaction, isCommit)) .verifyError(IllegalArgumentException.class); verify(sendLink, times(1)).send(any(byte[].class), anyInt(), eq(DeliveryImpl.DEFAULT_MESSAGE_FORMAT), isNull()); }

Target:
public void testCompleteTransactionRejected(boolean isCommit) { final Rejected outcome = new Rejected(); final AmqpTransaction transaction = new AmqpTransaction(ByteBuffer.wrap("1".getBytes())); TransactionCoordinator transactionCoordinator = new TransactionCoordinator(sendLink, messageSerializer); doReturn(Mono.just(outcome)).when(sendLink).send(any(byte[].class), anyInt(), eq(DeliveryImpl.DEFAULT_MESSAGE_FORMAT), isNull()); StepVerifier.create(transactionCoordinator.completeTransaction(transaction, isCommit)) .verifyError(IllegalArgumentException.class); verify(sendLink, times(1)).send(any(byte[].class), anyInt(), eq(DeliveryImpl.DEFAULT_MESSAGE_FORMAT), isNull()); }
Source:
public Stream(int column, StreamKind streamKind, int length, boolean useVInts, int sequence, Optional<Long> offset) { this.column = column; this.streamKind = requireNonNull(streamKind, "streamKind is null"); this.length = length; this.useVInts = useVInts; this.sequence = sequence; this.offset = offset; }

Target:
public Stream(int column, StreamKind streamKind, int length, boolean useVInts, int sequence, Optional<Long> offset) { this.column = column; this.streamKind = requireNonNull(streamKind, "streamKind is null"); this.length = length; this.useVInts = useVInts; this.sequence = sequence; this.offset = requireNonNull(offset, "offset is null"); }
Source:
public boolean merge(DBObject oldDoc,DBObject newDoc) { boolean ret=false; try { LOGGER.debug("Merge start"); DocComparator.Difference<Object> diff=compareNodes(oldDoc,newDoc); LOGGER.debug("Diff:{}"+diff); for(DocComparator.Delta<Object> delta:diff.getDelta()) { if(delta instanceof DocComparator.Removal) { DocComparator.Removal<Object> removal=(DocComparator.Removal<Object>)delta; Path removedField=removal.getField1(); boolean hidden=true; int numSegments=removedField.numSegments(); if(numSegments>1&&removedField.isIndex(numSegments-1)) { hidden=false; } if(hidden) { try { if (!removedField.equals(Translator.HIDDEN_SUB_PATH)) { md.resolve(removedField); hidden=false; } else { hidden = true; } } catch (Exception e) { hidden=true; } if(hidden) { LOGGER.debug("Field is hidden but removed, adding it back",removedField); addField(newDoc,diff.getDelta(),removal); ret=true; } } } } } catch (Exception e) { throw new RuntimeException(e); } return ret; }

Target:
public boolean merge(DBObject oldDoc,DBObject newDoc) { boolean ret=false; try { LOGGER.debug("Merge start"); DocComparator.Difference<Object> diff=compareNodes(oldDoc,newDoc); LOGGER.debug("Diff:{}"+diff); for(DocComparator.Delta<Object> delta:diff.getDelta()) { if(delta instanceof DocComparator.Removal) { DocComparator.Removal<Object> removal=(DocComparator.Removal<Object>)delta; Path removedField=removal.getField1(); boolean hidden=true; int numSegments=removedField.numSegments(); if(numSegments>1&&removedField.isIndex(numSegments-1)) { hidden=false; } if(hidden) { try { if (!hasHiddenField(removedField)) { md.resolve(removedField); hidden=false; } else { hidden = true; } } catch (Exception e) { hidden=true; } if(hidden) { LOGGER.debug("Field is hidden but removed, adding it back",removedField); addField(newDoc,diff.getDelta(),removal); ret=true; } } } } } catch (Exception e) { throw new RuntimeException(e); } return ret; }
Source:
public void start(long checkpointId, CheckpointOptions checkpointOptions) { results.keySet().forEach(oldCheckpointId -> abort(oldCheckpointId, new Exception("Starting new checkpoint " + checkpointId))); LOG.debug("{} starting checkpoint ({})", taskName, checkpointId, checkpointOptions); ChannelStateWriteResult result = new ChannelStateWriteResult(); ChannelStateWriteResult put = results.computeIfAbsent(checkpointId, id -> { Preconditions.checkState(results.size() < maxCheckpoints, String.format("can't start %d, results.size() > maxCheckpoints: %d, %d, %s", checkpointId, results.size(), maxCheckpoints, taskName)); enqueue(new CheckpointStartRequest(checkpointId, result, checkpointOptions.getTargetLocation()), false); return result; }); Preconditions.checkArgument(put == result, "result future already present for checkpoint " + checkpointId + ", " + taskName); }

Target:
public void start(long checkpointId, CheckpointOptions checkpointOptions) { LOG.debug("{} starting checkpoint ({})", taskName, checkpointId, checkpointOptions); ChannelStateWriteResult result = new ChannelStateWriteResult(); ChannelStateWriteResult put = results.computeIfAbsent(checkpointId, id -> { Preconditions.checkState(results.size() < maxCheckpoints, String.format("%s can't start %d, results.size() > maxCheckpoints: %d > %d", taskName, checkpointId, results.size(), maxCheckpoints)); enqueue(new CheckpointStartRequest(checkpointId, result, checkpointOptions.getTargetLocation()), false); return result; }); Preconditions.checkArgument(put == result, taskName + " result future already present for checkpoint " + checkpointId); }
Source:
private static String unescape(String s) throws URISyntaxException { if (s == null) return null; if (s.indexOf('%') < 0) return s; byte[] bytes; try { bytes = s.getBytes(Constants.CHARACTER_ENCODING); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } byte[] os = new byte[bytes.length]; int j = 0; for (int i = 0; i < bytes.length; ++i) { byte c = bytes[i]; if (c == '%') { if (i + 2 > bytes.length) throw new URISyntaxException(s, JGitText.get().cannotParseGitURIish); int val = (RawParseUtils.parseHexInt4(bytes[i + 1]) << 4) | RawParseUtils.parseHexInt4(bytes[i + 2]); os[j++] = (byte) val; i += 2; } else os[j++] = c; } return RawParseUtils.decode(os, 0, j); }

Target:
private static String unescape(String s) throws URISyntaxException { if (s == null) return null; if (s.indexOf('%') < 0) return s; byte[] bytes; try { bytes = s.getBytes(Constants.CHARACTER_ENCODING); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } byte[] os = new byte[bytes.length]; int j = 0; for (int i = 0; i < bytes.length; ++i) { byte c = bytes[i]; if (c == '%') { if (i + 2 >= bytes.length) throw new URISyntaxException(s, JGitText.get().cannotParseGitURIish); int val = (RawParseUtils.parseHexInt4(bytes[i + 1]) << 4) | RawParseUtils.parseHexInt4(bytes[i + 2]); os[j++] = (byte) val; i += 2; } else os[j++] = c; } return RawParseUtils.decode(os, 0, j); }
Source:
public Map<String, String> getSortedRecipientList(String feedbackQuestionId) { List<Map.Entry<String, String>> sortedList = new ArrayList<>(this.recipientList .get(feedbackQuestionId).entrySet()); Collections.sort(sortedList, new Comparator<Map.Entry<String, String>>() { @Override public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) { int compare = o1.getValue().compareTo(o2.getValue()); return compare == 0 ? o1.getKey().compareTo(o2.getKey()) : compare; } }); Map<String, String> result = new LinkedHashMap<>(); for (Map.Entry<String, String> entry : sortedList) { result.put(entry.getKey(), entry.getValue()); } return result; }

Target:
public Map<String, String> getSortedRecipientList(String feedbackQuestionId) { List<Map.Entry<String, String>> sortedList = new ArrayList<>(recipientList.get(feedbackQuestionId).entrySet()); Collections.sort(sortedList, new Comparator<Map.Entry<String, String>>() { @Override public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) { int compare = o1.getValue().compareTo(o2.getValue()); return compare == 0 ? o1.getKey().compareTo(o2.getKey()) : compare; } }); Map<String, String> result = new LinkedHashMap<>(); for (Map.Entry<String, String> entry : sortedList) { result.put(entry.getKey(), entry.getValue()); } return result; }
Source:
public void testOpenLedgerNoRecovery() throws Exception { LedgerMetadata ledgerMetadata = generateLedgerMetadata(ensembleSize, writeQuorumSize, ackQuorumSize, password, customMetadata); registerMockLedgerMetadata(ledgerId, ledgerMetadata); ledgerMetadata.getEnsembles().values().forEach(bookieAddressList -> { bookieAddressList.forEach(bookieAddress -> { try { registerMockEntryForRead(ledgerId, BookieProtocol.LAST_ADD_CONFIRMED, bookieAddress, entryData, -1); registerMockEntryForRead(ledgerId, 0, bookieAddress, entryData, -1); } catch (BKException bke) { fail("Add entry fail for in testOpenLedgerNoRecovery"); } }); }); result(newOpenLedgerOp() .withPassword(ledgerMetadata.getPassword()) .withDigestType(DigestType.CRC32) .withLedgerId(ledgerId) .withRecovery(false) .execute()); }

Target:
public void testOpenLedgerNoRecovery() throws Exception { LedgerMetadata ledgerMetadata = generateLedgerMetadata(ensembleSize, writeQuorumSize, ackQuorumSize, password, customMetadata); registerMockLedgerMetadata(ledgerId, ledgerMetadata); ledgerMetadata.getEnsembles().values().forEach(bookieAddressList -> { bookieAddressList.forEach(bookieAddress -> { registerMockEntryForRead(ledgerId, BookieProtocol.LAST_ADD_CONFIRMED, bookieAddress, entryData, -1); registerMockEntryForRead(ledgerId, 0, bookieAddress, entryData, -1); }); }); result(newOpenLedgerOp() .withPassword(ledgerMetadata.getPassword()) .withDigestType(DigestType.CRC32) .withLedgerId(ledgerId) .withRecovery(false) .execute()); }