auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean isSnapshot() { String version = getVersion(); if (StringUtils.isNotBlank(version)) { if (version.contains("SNAPSHOT")) { return true; } } return false; }

Target:
public boolean isSnapshot() { String version = getVersion(); return StringUtils.isNotBlank(version) && version.contains("SNAPSHOT"); }
Source:
protected void configure() { bind(RequestCleanup.class).in(RequestScoped.class); bind(ReviewDb.class).toProvider(RequestScopedReviewDbProvider.class).in( RequestScoped.class); bind(IdentifiedUser.RequestFactory.class).in(SINGLETON); bind(AccountResolver.class); install(new PredicateModule()); bind(ChangeQueryRewriter.class); bind(ChangeControl.Factory.class).in(SINGLETON); bind(GroupControl.Factory.class).in(SINGLETON); bind(ProjectControl.Factory.class).in(SINGLETON); factory(ChangeQueryBuilder.Factory.class); factory(ReceiveCommits.Factory.class); factory(MergeOp.Factory.class); factory(AddReviewerSender.Factory.class); factory(CreateChangeSender.Factory.class); factory(PublishComments.Factory.class); factory(ReplacePatchSetSender.Factory.class); factory(AbandonedSender.Factory.class); factory(CommentSender.Factory.class); factory(MergedSender.Factory.class); factory(MergeFailSender.Factory.class); factory(RegisterNewEmailSender.Factory.class); }

Target:
protected void configure() { bind(RequestCleanup.class).in(RequestScoped.class); bind(ReviewDb.class).toProvider(RequestScopedReviewDbProvider.class).in( RequestScoped.class); bind(IdentifiedUser.RequestFactory.class).in(SINGLETON); bind(AccountResolver.class); install(new ChangeQueryModule()); bind(ChangeControl.Factory.class).in(SINGLETON); bind(GroupControl.Factory.class).in(SINGLETON); bind(ProjectControl.Factory.class).in(SINGLETON); factory(ReceiveCommits.Factory.class); factory(MergeOp.Factory.class); factory(AddReviewerSender.Factory.class); factory(CreateChangeSender.Factory.class); factory(PublishComments.Factory.class); factory(ReplacePatchSetSender.Factory.class); factory(AbandonedSender.Factory.class); factory(CommentSender.Factory.class); factory(MergedSender.Factory.class); factory(MergeFailSender.Factory.class); factory(RegisterNewEmailSender.Factory.class); }
Source:
public String getText() { String arrayText = ""; if(textArr != null){ for(int i = 0;i < textArr.length;i++) arrayText += textArr[i] + "\n"; } if(text.get() != "") return text.get() + "\n" + arrayText; return text.get() + arrayText; }

Target:
public String getText() { String arrayText = ""; if(linesOfText.length > 0) { arrayText = String.join("\n", linesOfText); } if(text.get() != "") { return text.get() + "\n" + arrayText; } return text.get() + arrayText; }
Source:
public List<T> getNextValues() { if(endOfInput) { return (List<T>) Collections.emptyList(); } int retryAttempt = 0; while(true) { final GetBucketRequest request = new GetBucketRequest(bucket); request.withMaxKeys(maxKeys); if (prefix != null) { request.withPrefix(prefix); } if (truncated) { request.withMarker(nextMarker); } if (delimiter != null) { request.withDelimiter(delimiter); } GetBucketResponse response; try { response = this.client.getBucket(request); } catch (final FailedRequestException e) { throw new RuntimeException("Failed to get the list of objects due to a failed request", e); } catch (final IOException e) { if (retryAttempt >= retryCount) { throw new TooManyRetriesException("Failed to get the next set of objects from the getBucketKey request after " + retryCount + " retries", e); } response = null; } if (response == null) { retryAttempt++; } else { final ListBucketResult result = response.getListBucketResult(); truncated = result.getTruncated(); this.nextMarker = result.getNextMarker(); if (Guard.isStringNullOrEmpty(nextMarker) && !truncated) { endOfInput = true; } return function.apply(result); } } }

Target:
public Iterable<T> getNextValues() { if (endOfInput) { return emptyList; } int retryAttempt = 0; while (retryCount > retryAttempt) { final GetBucketRequest request = prepRequest(); final ListBucketResult result; final GetBucketResponse response; try { response = this.client.getBucket(request); } catch (final FailedRequestException e) { throw new FailedToGetBucketException("Failed to get the list of objects due to a failed request", e); } catch (final IOException e) { retryAttempt++; continue; } result = response.getListBucketResult(); this.truncated = result.getTruncated(); this.nextMarker = result.getNextMarker(); if (Guard.isStringNullOrEmpty(nextMarker) && !truncated) { endOfInput = true; } return function.apply(result); } throw new TooManyRetriesException("Failed to get the next set of objects from the getBucketKey request after " + retryCount + " retries"); }
Source:
public void testCharLiteralSurrogatePair() throws Exception { if (Charset.isSupported("windows-1252")) { verifyAst(getPath("InputCharLiteralSurrogatePair_windows-1252.txt"), getPath("InputCharLiteralSurrogatePair.java")); } else { verifyAst(getPath("InputCharLiteralSurrogatePair.txt"), getPath("InputCharLiteralSurrogatePair.java")); } }

Target:
public void testCharLiteralSurrogatePair() throws Exception { verifyAst(getPath("InputCharLiteralSurrogatePair.txt"), getPath("InputCharLiteralSurrogatePair.java")); }
Source:
public void replaceWithMoreThanMaxItems() { List<Object> items = createItems(); Collection<String> messageItems = ReplacementUtils.replaceWith(PROPERTY_NAME, items); validateMessageContainsProperties(messageItems); Iterator<String> messageIterator = messageItems.iterator(); validateMessageDoesNotContainUnexpectedItems(messageIterator.next(), items); assertTrue(messageIterator.next().contains(String.valueOf(items.size()))); }

Target:
public void replaceWithMoreThanMaxItems() { List<Object> items = createItems(); Collection<String> replacements = ReplacementUtils.replaceWith(PROPERTY_NAME, items); validateReplacementsContainsExpectedProperties(replacements, items); validateReplacementsDoNotContainUnexpectedItems(replacements, items); }
Source:
private <T extends ExecutorService> T createExecutorService(ThreadPoolConfiguration threadPoolConfiguration, String componentName, ExecutorServiceType type) { ThreadFactory threadFactory; ThreadPoolExecutorFactory executorFactory; if (threadPoolConfiguration != null) { threadFactory = threadPoolConfiguration.threadFactory() != null ? threadPoolConfiguration.threadFactory() : createThreadFactoryWithDefaults(globalConfiguration, componentName); executorFactory = threadPoolConfiguration.threadPoolFactory() != null ? threadPoolConfiguration.threadPoolFactory() : createThreadPoolFactoryWithDefaults(componentName, type); } else { threadFactory = createThreadFactoryWithDefaults(globalConfiguration, componentName); executorFactory = createThreadPoolFactoryWithDefaults(componentName, type); } switch (type) { case SCHEDULED: return (T) new LazyInitializingScheduledExecutorService(executorFactory, threadFactory); case BLOCKING: return (T) new LazyInitializingBlockingTaskAwareExecutorService(executorFactory, threadFactory, globalComponentRegistry.getTimeService(), "Controller-" + shortened(componentName) + "-" + globalConfiguration.transport().nodeName()); default: return (T) new LazyInitializingExecutorService(executorFactory, threadFactory); } }

Target:
private <T extends ExecutorService> T createExecutorService(ThreadPoolConfiguration threadPoolConfiguration, String componentName, ExecutorServiceType type) { ThreadFactory threadFactory; ThreadPoolExecutorFactory executorFactory; if (threadPoolConfiguration != null) { threadFactory = threadPoolConfiguration.threadFactory() != null ? threadPoolConfiguration.threadFactory() : createThreadFactoryWithDefaults(globalConfiguration, componentName); executorFactory = threadPoolConfiguration.threadPoolFactory() != null ? threadPoolConfiguration.threadPoolFactory() : createThreadPoolFactoryWithDefaults(componentName, type); } else { threadFactory = createThreadFactoryWithDefaults(globalConfiguration, componentName); executorFactory = createThreadPoolFactoryWithDefaults(componentName, type); } switch (type) { case SCHEDULED: return (T) new LazyInitializingScheduledExecutorService(executorFactory, threadFactory); case BLOCKING: final String controllerName = "Controller-" + shortened(componentName) + "-" + globalConfiguration.transport().nodeName(); return (T) new LazyInitializingBlockingTaskAwareExecutorService(executorFactory, threadFactory, globalComponentRegistry.getTimeService(), controllerName); default: return (T) new LazyInitializingExecutorService(executorFactory, threadFactory); } }
Source:
@Test public void testDu() { Assume.assumeFalse("Skip: the 'du' table does not work on Windows", isWindows()); Assume.assumeTrue(checkProcessExists("du")); sql("select * from du") .returns(r -> { try { assertThat(r.next(), is(true)); assertThat(r.getInt(1), notNullValue()); assertThat(r.getString(2), CoreMatchers.startsWith("./")); assertThat(r.wasNull(), is(false)); } catch (SQLException e) { throw new RuntimeException(e); } }); }

Target:
@Test public void testDu() { Assume.assumeFalse("Skip: the 'du' table does not work on Windows", isWindows()); assumeToolExists("du"); sql("select * from du") .returns(r -> { try { assertThat(r.next(), is(true)); assertThat(r.getInt(1), notNullValue()); assertThat(r.getString(2), CoreMatchers.startsWith("./")); assertThat(r.wasNull(), is(false)); } catch (SQLException e) { throw new RuntimeException(e); } }); }
Source:
public List<Event> asEvents(Any producerId, @Nullable Version version) { checkNotNull(producerId); EventFactory eventFactory = EventFactory.on(origin, producerId); List<Event> result = messages.stream() .map(eventMessage -> eventFactory.createEvent(eventMessage, version)) .collect(Collectors.toList()); return result; }

Target:
public List<Event> asEvents(Any producerId, @Nullable Version version) { checkNotNull(producerId); EventFactory eventFactory = EventFactory.on(origin, producerId); List<Event> result = messages.stream() .map(eventMessage -> eventFactory.createEvent(eventMessage, version)) .collect(toList()); return result; }
Source:
public static NetworkInterfaceCardProperties create(final String provisioningState, final String resourceGuid, final Boolean enableIPForwarding, final List<IpConfiguration> ipConfigurations, final IdReference networkSecurityGroup) { NetworkInterfaceCardProperties.Builder builder = NetworkInterfaceCardProperties.builder() .provisioningState(provisioningState) .resourceGuid(resourceGuid) .enableIPForwarding(enableIPForwarding) .ipConfigurations(ipConfigurations == null ? ImmutableList.<IpConfiguration>of() : ImmutableList.copyOf(ipConfigurations)) .networkSecurityGroup(networkSecurityGroup); return builder.build(); }

Target:
public static NetworkInterfaceCardProperties create(final String provisioningState, final String resourceGuid, final Boolean enableIPForwarding, final List<IpConfiguration> ipConfigurations, final IdReference networkSecurityGroup) { NetworkInterfaceCardProperties.Builder builder = NetworkInterfaceCardProperties.builder() .provisioningState(provisioningState) .resourceGuid(resourceGuid) .enableIPForwarding(enableIPForwarding) .ipConfigurations(ipConfigurations == null ? null : ImmutableList.copyOf(ipConfigurations)) .networkSecurityGroup(networkSecurityGroup); return builder.build(); }
Source:
public Object getParent(Object element) { Object parent = null; if(element instanceof Package) { parent = ((Package)element).getNestingPackage(); } return parent; }

Target:
public Object getParent(Object element) { Object parent = null; if(element instanceof Package) { parent = ((Package)element).getNestingPackage(); } else if(element instanceof ProfileApplication) { parent = ((ProfileApplication)element).getApplyingPackage(); } return parent; }
Source:
public void pruneToSizeTest() { FeatureVector fv = new FeatureVector(); fv.addFeatureWeight("a", 0.2f); fv.addFeatureWeight("a", 0.3f); fv.addFeatureWeight("b", 0.3f); fv.addFeatureWeight("b", 0.5f); fv.addFeatureWeight("c", 0.4f); assertEquals(fv.pruneToSize(2).getFeatures().size(), 2); assertEquals(fv.pruneToSize(1).getFeatures().size(), 1); assertEquals(fv.pruneToSize(2).getFeatures(), new HashSet<>(Arrays.asList(new String[]{"a", "b"}))); }

Target:
public void pruneToSizeTest() { FeatureVector fv1 = createAndAddFeatureWeights(); assertEquals(fv1.pruneToSize(2).getFeatures().size(), 2); FeatureVector fv2 = createAndAddFeatureWeights(); assertEquals(fv2.pruneToSize(1).getFeatures().size(), 1); FeatureVector fv3 = createAndAddFeatureWeights(); assertEquals(fv3.pruneToSize(2).getFeatures(), new HashSet<>(Arrays.asList(new String[]{"a", "b"}))); }
Source:
@Override public void store(SPProgramID programId, String remoteFileName, File localFile, AuxFileTransferListener listener) throws AuxFileException { try { String token = ""; int chunkIndex = 0; AuxFileChunk chunk; do { chunk = readChunk(localFile, chunkIndex++); token = server.storeChunk(programId, remoteFileName, chunk, token); if (!notifyListener(chunk, programId, remoteFileName, listener)) return; } while (!chunk.isLastChunk()); Collection<String> auxFileNames = Collections.singleton(localFile.getName()); Collection<AuxFile> auxFile = server.list(programId, auxFileNames); if (auxFile.size() > 0 && auxFile.iterator().next().isChecked()) setChecked(programId, Collections.singleton(localFile.getName()), false, true); } catch (IOException ex) { throw AuxFileException.create(ex); } }

Target:
@Override public void store(SPProgramID programId, String remoteFileName, File localFile, AuxFileTransferListener listener) throws AuxFileException { try { String token = ""; int chunkIndex = 0; AuxFileChunk chunk; do { chunk = readChunk(localFile, chunkIndex++); token = server.storeChunk(programId, remoteFileName, chunk, token); if (!notifyListener(chunk, programId, remoteFileName, listener)) return; } while (!chunk.isLastChunk()); } catch (IOException ex) { throw AuxFileException.create(ex); } }
Source:
private void loadLogMessages() { try { String pathToJsonFile = TestProperties.TEST_DATA_FOLDER + TYPICAL_LOG_MESSAGE; String jsonString = FileHelper.readFile(pathToJsonFile); Type listType = new TypeToken<List<List<String>>>(){}.getType(); logMessages = JsonUtils.fromJson(jsonString, listType); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private void loadLogMessages() { try { String pathToJsonFile = TestProperties.TEST_DATA_FOLDER + "/typicalLogMessage.json"; String jsonString = FileHelper.readFile(pathToJsonFile); Type listType = new TypeToken<List<List<String>>>(){}.getType(); logMessages = JsonUtils.fromJson(jsonString, listType); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public void configurePipeline(MultiInputPipelineConfigurer pipelineConfigurer) { MultiInputStageConfigurer stageConfigurer = pipelineConfigurer.getMultiInputStageConfigurer(); Map<String, Schema> inputSchemas = stageConfigurer.getInputSchemas(); FailureCollector collector = pipelineConfigurer.getMultiInputStageConfigurer().getFailureCollector(); init(inputSchemas, collector); collector.getOrThrowException(); if (!conf.inputSchemasAvailable(inputSchemas) && !conf.containsMacro(conf.OUTPUT_SCHEMA) && conf.getOutputSchema(collector) == null) { collector.addFailure("Output schema must be specified", null).withConfigProperty(conf.OUTPUT_SCHEMA); } Schema outputSchema = getOutputSchema(inputSchemas, collector); if (outputSchema != null) { stageConfigurer.setOutputSchema(outputSchema); } }

Target:
public void configurePipeline(MultiInputPipelineConfigurer pipelineConfigurer) { MultiInputStageConfigurer stageConfigurer = pipelineConfigurer.getMultiInputStageConfigurer(); Map<String, Schema> inputSchemas = stageConfigurer.getInputSchemas(); FailureCollector collector = pipelineConfigurer.getMultiInputStageConfigurer().getFailureCollector(); init(inputSchemas, collector); collector.getOrThrowException(); if (!conf.inputSchemasAvailable(inputSchemas) && !conf.containsMacro(JoinerConfig.OUTPUT_SCHEMA) && conf.getOutputSchema(collector) == null) { collector.addFailure("Output schema must be specified", null).withConfigProperty(JoinerConfig.OUTPUT_SCHEMA); } Schema outputSchema = getOutputSchema(inputSchemas, collector); if (outputSchema != null) { stageConfigurer.setOutputSchema(outputSchema); } }
Source:
public void flush(RequestScope requestScope) { if (!isOpen()) { return; } try { deferredTasks.forEach(Runnable::run); deferredTasks.clear(); FlushModeType flushMode = em.getFlushMode(); if (flushMode == FlushModeType.AUTO && isOpen()) { em.flush(); } } catch (Exception e) { try { rollback(); } catch (RuntimeException e2) { e.addSuppressed(e2); } finally { log.error("Caught entity manager exception during flush", e); } if (e instanceof ConstraintViolationException) { throw e; } else { throw new TransactionException(e); } } }

Target:
public void flush(RequestScope requestScope) { if (!isOpen()) { return; } try { deferredTasks.forEach(Runnable::run); deferredTasks.clear(); FlushModeType flushMode = em.getFlushMode(); if (flushMode == FlushModeType.AUTO && isOpen()) { em.flush(); } } catch (Exception e) { try { rollback(); } catch (RuntimeException e2) { e.addSuppressed(e2); } finally { log.error("Caught entity manager exception during flush", e); } if (e instanceof ConstraintViolationException) { throw e; } throw new TransactionException(e); } }
Source:
private void send(final String endPointId, final ShuffleControlMessage controlMessage) throws NetworkException { final Connection<ShuffleControlMessage> connection = connectionFactory.newConnection( idFactory.getNewInstance(endPointId)); connection.open(); connection.write(controlMessage); }

Target:
private void send(final String endPointId, final ShuffleControlMessage controlMessage) throws NetworkException { final Connection<ShuffleControlMessage> connection = getConnection(endPointId); connection.open(); connection.write(controlMessage); }
Source:
public void testSuccessfulVersionQuery() throws Exception { setupForTest(); String testVersionName = expectedVersionMap.keySet().iterator().next(); Version expectedVersion = expectedVersionMap.get(testVersionName); Version returnedVersion = versionUtil.getVersion(testVersionName); int failureCount = 0; StringBuilder failureReport = new StringBuilder(); if (expectedVersion == null || returnedVersion == null) { if (expectedVersion == null) { failureReport.append(testVersionName + " : no values in expected version hash (internal error)\n"); } if (returnedVersion == null) { failureReport.append(testVersionName + " : version expected but not returned from versionUtil\n"); } } else { String expectedVersionName = expectedVersion.getVersion(); String returnedVersionName = returnedVersion.getVersion(); if (!testValuesMatch(expectedVersionName, returnedVersionName)) { failureReport.append(makeMismatchMessage(testVersionName, "version", returnedVersionName, expectedVersionName)); failureCount = failureCount + 1; } String expectedGraphURI = expectedVersion.getGraphURI(); String returnedGraphURI = returnedVersion.getGraphURI(); if (!testValuesMatch(expectedGraphURI, returnedGraphURI)) { failureReport.append(makeMismatchMessage(testVersionName, "graphURI", returnedGraphURI, expectedGraphURI)); failureCount = failureCount + 1; } String expectedDescription = expectedVersion.getDescription(); String returnedDescription = returnedVersion.getDescription(); if (!testValuesMatch(expectedDescription, returnedDescription)) { failureReport.append(makeMismatchMessage(testVersionName, "description", returnedDescription, expectedDescription)); failureCount = failureCount + 1; } } if (failureCount > 0) { fail(Integer.toString(failureCount) + " failed test conditions. Details follow... " + failureReport.toString()); } return; }

Target:
public void testSuccessfulVersionQuery() throws Exception { String testVersionName = expectedVersionMap.keySet().iterator().next(); Version expectedVersion = expectedVersionMap.get(testVersionName); Version returnedVersion = versionUtil.getVersion(testVersionName); int failureCount = 0; StringBuilder failureReport = new StringBuilder(); failureCount = failureCount + failuresInReturnedVersionComparison(testVersionName, expectedVersion, returnedVersion, failureReport); if (failureCount > 0) { fail(Integer.toString(failureCount) + " failed test conditions. Details follow... " + failureReport.toString()); } return; }
Source:
public IndexRebuildRegionScanner(final RegionScanner innerScanner, final Region region, final Scan scan, final RegionCoprocessorEnvironment env) throws IOException { super(innerScanner, region, scan, env); this.env = env; try (org.apache.hadoop.hbase.client.Connection connection = HBaseFactoryProvider.getHConnectionFactory().createConnection(env.getConfiguration())) { endKeys = connection.getRegionLocator(indexHTable.getName()).getEndKeys(); } indexRowKey = scan.getAttribute(BaseScannerRegionObserver.INDEX_ROW_KEY); if (indexRowKey != null) { setReturnCodeForSingleRowRebuild(); pageSizeInRows = 1; } if (verify) { viewConstants = IndexUtil.deserializeViewConstantsFromScan(scan); byte[] disableLoggingValueBytes = scan.getAttribute(BaseScannerRegionObserver.INDEX_REBUILD_DISABLE_LOGGING_VERIFY_TYPE); if (disableLoggingValueBytes != null) { disableLoggingVerifyType = IndexTool.IndexDisableLoggingType.fromValue(disableLoggingValueBytes); } verificationOutputRepository = new IndexVerificationOutputRepository(indexMaintainer.getIndexTableName() , hTableFactory, disableLoggingVerifyType); verificationResult = new IndexToolVerificationResult(scan); verificationResultRepository = new IndexVerificationResultRepository(indexMaintainer.getIndexTableName(), hTableFactory); } }

Target:
public IndexRebuildRegionScanner(final RegionScanner innerScanner, final Region region, final Scan scan, final RegionCoprocessorEnvironment env) throws IOException { super(innerScanner, region, scan, env); this.env = env; connection = HBaseFactoryProvider.getHConnectionFactory().createConnection(env.getConfiguration()); endKeys = connection.getRegionLocator(indexHTable.getName()).getEndKeys(); indexRowKey = scan.getAttribute(BaseScannerRegionObserver.INDEX_ROW_KEY); if (indexRowKey != null) { setReturnCodeForSingleRowRebuild(); pageSizeInRows = 1; } if (verify) { viewConstants = IndexUtil.deserializeViewConstantsFromScan(scan); byte[] disableLoggingValueBytes = scan.getAttribute(BaseScannerRegionObserver.INDEX_REBUILD_DISABLE_LOGGING_VERIFY_TYPE); if (disableLoggingValueBytes != null) { disableLoggingVerifyType = IndexTool.IndexDisableLoggingType.fromValue(disableLoggingValueBytes); } verificationOutputRepository = new IndexVerificationOutputRepository(indexMaintainer.getIndexTableName() , hTableFactory, disableLoggingVerifyType); verificationResult = new IndexToolVerificationResult(scan); verificationResultRepository = new IndexVerificationResultRepository(indexMaintainer.getIndexTableName(), hTableFactory); } }
Source:
public String template( @NotNull(message = "Template name can't be NULL") final String name) throws IOException { return this.github().entry().reset(HttpHeaders.ACCEPT) .header(HttpHeaders.ACCEPT, "application/vnd.github.v3.raw") .uri().path( new StringBuilder("/gitignore/templates/").append(name) .toString() ).back().fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .body(); }

Target:
public String template( @NotNull(message = "Template name can't be NULL") final String name) throws IOException { return this.request.reset(HttpHeaders.ACCEPT) .header(HttpHeaders.ACCEPT, "application/vnd.github.v3.raw") .uri().path(name).back().fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .body(); }
Source:
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { final HttpRequest httpRequest = HttpRequest.decorate(req); final Context context = new Context(httpRequest, res).init(); String id = getObjectId(httpRequest); try { String redirect = getDestination(id, httpRequest, res); if (!StringUtil.isDefined(redirect)) { objectNotFound(context); } else { if (!res.isCommitted()) { if (!redirect.startsWith("http")) { redirect = URLUtil.getFullApplicationURL(httpRequest) + "/autoRedirect.jsp?" + redirect; } res.sendRedirect(res.encodeRedirectURL(UriBuilder.fromUri(redirect) .queryParam("fromResponsiveNavigation", context.isFromResponsiveNavigation()).build() .toString())); } } } catch (AccessForbiddenException afe) { accessForbidden(context); } catch (Exception e) { objectNotFound(context); } }

Target:
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { final HttpRequest httpRequest = HttpRequest.decorate(req); final Context context = new Context(httpRequest, res).init(); String id = getObjectId(httpRequest); try { String redirect = getDestination(id, httpRequest, res); if (!StringUtil.isDefined(redirect)) { objectNotFound(context); } else { if (!res.isCommitted()) { if (!redirect.startsWith("http")) { redirect = URLUtil.getFullApplicationURL(httpRequest) + "/autoRedirect.jsp?" + redirect; } res.sendRedirect(res.encodeRedirectURL(UriBuilder.fromUri(redirect) .queryParam("fromResponsiveWindow", context.isFromResponsiveWindow()).build() .toString())); } } } catch (AccessForbiddenException afe) { accessForbidden(context); } catch (Exception e) { objectNotFound(context); } }
Source:
public void postProcessModule(Module module) { ChannelRegistry registry = findRegistry(module); DeploymentMetadata md = module.getDeploymentMetadata(); if (registry != null) { MessageChannel channel = module.getComponent("input", MessageChannel.class); if (channel != null) { registry.createInbound(module.getProperties().getProperty("xd.stream.name"), channel, DEFAULT_ACCEPTED_CONTENT_TYPES, true); } } }

Target:
public void postProcessModule(Module module) { ChannelRegistry registry = findRegistry(module); DeploymentMetadata md = module.getDeploymentMetadata(); if (registry != null) { MessageChannel channel = module.getComponent("input", MessageChannel.class); if (channel != null) { registry.createInbound(md.getGroup(), channel, DEFAULT_ACCEPTED_CONTENT_TYPES, true); } } }
Source:
public void selectByQuery_on_empty_list_of_component_key() { ComponentQuery dbQuery = ComponentQuery.builder().setQualifiers(Qualifiers.PROJECT).setComponentKeys(emptySet()).build(); List<ComponentDto> result = underTest.selectByQuery(dbSession, dbQuery, 0, 10); int count = underTest.countByQuery(dbSession, dbQuery); assertThat(result).isEmpty(); assertThat(count).isEqualTo(0); }

Target:
public void selectByQuery_on_empty_list_of_component_key() { db.components().insertPrivateProject(); ComponentQuery dbQuery = ComponentQuery.builder().setQualifiers(Qualifiers.PROJECT).setComponentKeys(emptySet()).build(); List<ComponentDto> result = underTest.selectByQuery(dbSession, dbQuery, 0, 10); int count = underTest.countByQuery(dbSession, dbQuery); assertThat(result).isEmpty(); assertThat(count).isEqualTo(0); }
Source:
private boolean executeSshSoftFencingCommand(String version) { boolean result = false; EngineSSHClient sshClient = null; try { sshClient = new EngineSSHClient(); sshClient.setVds(getVds()); sshClient.useDefaultKeyPair(); sshClient.connect(); sshClient.authenticate(); } catch (Exception ex) { log.errorFormat("SSH connection to host {0} failed: {1}", getVds().getHostName(), ex); closeSshConnection(sshClient); return result; } ByteArrayOutputStream cmdOut = new ByteArrayOutputStream(); ByteArrayOutputStream cmdErr = new ByteArrayOutputStream(); try { sshClient.executeCommand(Config.<String> GetValue(ConfigValues.SshSoftFencingCommand, version), null, cmdOut, cmdErr); log.infoFormat("SSH Soft Fencing command executed on host {0}", getVds().getHostName()); result = true; } catch (Exception ex) { log.errorFormat("SSH Soft Fencing command failed on host {0}: {1}\nStdout: {2}\nStderr: {3}\nStacktrace: {4}", getVds().getHostName(), ex.getMessage(), cmdOut.toString(), cmdErr.toString(), ex); } finally { closeSshConnection(sshClient); } return result; }

Target:
private boolean executeSshSoftFencingCommand(String version) { boolean result = false; EngineSSHClient sshClient = null; try { sshClient = new EngineSSHClient(); sshClient.setVds(getVds()); sshClient.useDefaultKeyPair(); sshClient.connect(); sshClient.authenticate(); } catch (Exception ex) { log.errorFormat("SSH connection to host {0} failed: {1}", getVds().getHostName(), ex); closeSshConnection(sshClient); return result; } ByteArrayOutputStream cmdOut = new ByteArrayOutputStream(); ByteArrayOutputStream cmdErr = new ByteArrayOutputStream(); try { log.infoFormat("Executing SSH Soft Fencing command on host {0}", getVds().getHostName()); sshClient.executeCommand(Config.<String> GetValue(ConfigValues.SshSoftFencingCommand, version), null, cmdOut, cmdErr); result = true; } catch (Exception ex) { log.errorFormat("SSH Soft Fencing command failed on host {0}: {1}\nStdout: {2}\nStderr: {3}\nStacktrace: {4}", getVds().getHostName(), ex.getMessage(), cmdOut.toString(), cmdErr.toString(), ex); } finally { closeSshConnection(sshClient); } return result; }
Source:
public TransactionToken createApplicabilityForView(ArtifactId viewId, String applicability) { XResultData access = isAccess(); if (access.isErrors()) { return TransactionToken.SENTINEL; } String featureName = applicability.substring(0, applicability.indexOf("=") - 1); String featureValue = applicability.substring(applicability.indexOf("=") + 2); if (applicabilityQuery.getFeatureExistsOnBranch(branch, featureName) && applicabilityQuery.getFeatureValueIsValid(branch, featureName, featureValue)) { String existingAppl = applicabilityQuery.getExistingFeatureApplicability(branch, viewId, featureName); if (existingAppl.equals(applicability)) { access.errorf("Applicability already exists."); return TransactionToken.SENTINEL; } else { TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, account, "Apply " + applicability + " applicability"); if (!existingAppl.isEmpty()) { tx.deleteTuple2(CoreTupleTypes.ViewApplicability, viewId, existingAppl); } tx.createApplicabilityForView(viewId, applicability); return tx.commit(); } } else { access.errorf("Feature not defined."); return TransactionToken.SENTINEL; } }

Target:
public XResultData createApplicabilityForView(ArtifactId viewId, String applicability) { XResultData results = isAccess(); if (results.isErrors()) { return results; } try { String featureName = applicability.substring(0, applicability.indexOf("=") - 1); String featureValue = applicability.substring(applicability.indexOf("=") + 2); if (applicabilityQuery.getFeatureExistsOnBranch(branch, featureName) && applicabilityQuery.getFeatureValueIsValid(branch, featureName, featureValue)) { String existingAppl = applicabilityQuery.getExistingFeatureApplicability(branch, viewId, featureName); if (existingAppl.equals(applicability)) { results.error("Applicability already exists."); } else { TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, account, "Apply " + applicability + " applicability"); if (!existingAppl.isEmpty()) { tx.deleteTuple2(CoreTupleTypes.ViewApplicability, viewId, existingAppl); } tx.createApplicabilityForView(viewId, applicability); tx.commit(); } } else { results.error("Feature not defined."); } } catch (Exception ex) { results.error(Lib.exceptionToString(ex)); } return results; }
Source:
public PGobject convertToDatabaseColumn(ExternalMetadata externalMetadata) { PGobject pgObject = new PGobject(); pgObject.setType("jsonb"); var metaData = externalMetadata == null ? null : externalMetadata.getMetadata(); try { pgObject.setValue(mapper.writeValueAsString(metaData)); } catch (JsonProcessingException | SQLException e) { throw new ExternalMetadataConverterException("Failed to serialise externalMetadata"); } return pgObject; }

Target:
public PGobject convertToDatabaseColumn(ExternalMetadata externalMetadata) { PGobject pgObject = new PGobject(); pgObject.setType("jsonb"); if (externalMetadata == null) { return pgObject; } try { pgObject.setValue(mapper.writeValueAsString(externalMetadata.getMetadata())); } catch (JsonProcessingException | SQLException e) { throw new ExternalMetadataConverterException("Failed to serialise externalMetadata"); } return pgObject; }
Source:
public void testLeaseRenewSocketTimeout() throws Exception { String file1 = "/testFile1"; String file2 = "/testFile2"; conf.setInt(HdfsClientConfigKeys.Retry.WINDOW_BASE_KEY, 10); conf.setInt(DFS_CLIENT_SOCKET_TIMEOUT_KEY, 2 * 1000); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build(); try { cluster.waitActive(); NamenodeProtocols spyNN = spy(cluster.getNameNodeRpc()); Mockito.doThrow(new SocketTimeoutException()).when(spyNN).renewLease( Mockito.anyString()); DFSClient client = new DFSClient(null, spyNN, conf, null); final LeaseRenewer leaseRenewer1 = client.getLeaseRenewer(); leaseRenewer1.setRenewalTime(100); OutputStream out1 = client.create(file1, false); Mockito.verify(spyNN, timeout(10000).times(1)).renewLease( Mockito.anyString()); verifyEmptyLease(leaseRenewer1); GenericTestUtils.waitFor(() -> !(leaseRenewer1.isRunning()), 100, 10000); try { out1.write(new byte[256]); fail("existing output stream should be aborted"); } catch (IOException e) { } client.exists(file2); Mockito.doNothing().when(spyNN).renewLease( Mockito.anyString()); LeaseRenewer leaseRenewer2 = client.getLeaseRenewer(); leaseRenewer2.setRenewalTime(100); OutputStream out2 = client.create(file2, false); Mockito.verify(spyNN, timeout(10000).times(2)).renewLease( Mockito.anyString()); out2.write(new byte[256]); out2.close(); verifyEmptyLease(leaseRenewer2); } finally { cluster.shutdown(); } }

Target:
public void testLeaseRenewSocketTimeout() throws Exception { String file1 = "/testFile1"; String file2 = "/testFile2"; conf.setInt(HdfsClientConfigKeys.Retry.WINDOW_BASE_KEY, 10); conf.setInt(DFS_CLIENT_SOCKET_TIMEOUT_KEY, 2 * 1000); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build(); try { cluster.waitActive(); NamenodeProtocols spyNN = spy(cluster.getNameNodeRpc()); Mockito.doThrow(new SocketTimeoutException()).when(spyNN).renewLease( Mockito.anyString()); DFSClient client = new DFSClient(null, spyNN, conf, null); final LeaseRenewer leaseRenewer1 = client.getLeaseRenewer(); leaseRenewer1.setRenewalTime(100); OutputStream out1 = client.create(file1, false); Mockito.verify(spyNN, timeout(10000).times(1)).renewLease( Mockito.anyString()); verifyEmptyLease(leaseRenewer1); GenericTestUtils.waitFor(() -> !(leaseRenewer1.isRunning()), 100, 10000); try { out1.write(new byte[256]); fail("existing output stream should be aborted"); } catch (IOException e) { } client.exists(file2); Mockito.doNothing().when(spyNN).renewLease( Mockito.anyString()); final LeaseRenewer leaseRenewer2 = client.getLeaseRenewer(); leaseRenewer2.setRenewalTime(100); OutputStream out2 = client.create(file2, false); Mockito.verify(spyNN, timeout(10000).times(2)).renewLease( Mockito.anyString()); out2.write(new byte[256]); out2.close(); verifyEmptyLease(leaseRenewer2); } finally { cluster.shutdown(); } }
Source:
public void injectorCreated(Injector injector, InjectorConfig config) { synchronized(this){ injectorNames.add(config.getName()); } }

Target:
public void injectorCreated(Injector injector, InjectorConfig config) { injectorNames.add(config.getName()); }
Source:
private void updateMediaSessionMetadata() { executor.execute(() -> { Playable p = this.media; MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder(); builder.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, p.getFeedTitle()); builder.putString(MediaMetadataCompat.METADATA_KEY_TITLE, p.getEpisodeTitle()); builder.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, p.getDuration()); builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_TITLE, p.getEpisodeTitle()); builder.putString(MediaMetadataCompat.METADATA_KEY_ALBUM, p.getFeedTitle()); if (p.getImageUri() != null) { if (UserPreferences.setLockscreenBackground()) { builder.putString(MediaMetadataCompat.METADATA_KEY_ART_URI, p.getImageUri().toString()); try { Bitmap art = Glide.with(context) .load(p.getImageUri()) .asBitmap() .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) .get(); builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, art); } catch (Exception e) { Log.e(TAG, Log.getStackTraceString(e)); } } } mediaSession.setMetadata(builder.build()); }); }

Target:
private void updateMediaSessionMetadata() { executor.execute(() -> { final Playable p = this.media; if(p == null) { return; } MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder(); builder.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, p.getFeedTitle()); builder.putString(MediaMetadataCompat.METADATA_KEY_TITLE, p.getEpisodeTitle()); builder.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, p.getDuration()); builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_TITLE, p.getEpisodeTitle()); builder.putString(MediaMetadataCompat.METADATA_KEY_ALBUM, p.getFeedTitle()); if (p.getImageUri() != null) { if (UserPreferences.setLockscreenBackground()) { builder.putString(MediaMetadataCompat.METADATA_KEY_ART_URI, p.getImageUri().toString()); try { Bitmap art = Glide.with(context) .load(p.getImageUri()) .asBitmap() .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) .get(); builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, art); } catch (Exception e) { Log.e(TAG, Log.getStackTraceString(e)); } } } mediaSession.setMetadata(builder.build()); }); }
Source:
public static URI createURI(URI baseURI, java.lang.Class< ? > resourceClass, java.lang.Object... pathElements) { UriBuilder uriBuilder = UriBuilder.fromUri(baseURI).path(resourceClass); List<String> pathVariableNames = null; if (pathElements.length > 0) { pathVariableNames = getVariableNamesFromPathTemplate(uriBuilder.toString()); } Object[] encodedPathElements = new String[pathElements.length]; for (int i = 0; i < pathElements.length; i++) { Object pathElement = pathElements[i]; if (pathElement != null) { try { if (i < pathVariableNames.size() && "spaceName".equals(pathVariableNames.get(i))) { if (!(pathElement instanceof List)) { throw new RuntimeException("The 'spaceName' parameter must be a list!"); } encodedPathElements[i] = generateEncodedSpacesURISegment((List) pathElements[i]); } else if (i < pathVariableNames.size() && "jobId".equals(pathVariableNames.get(i))) { if (!(pathElement instanceof List)) { throw new RuntimeException("The 'jobId' parameter must be a list!"); } encodedPathElements[i] = generateEncodedJobIdURISegment((List) pathElements[i]); } else if (pathElement instanceof EncodedElement) { encodedPathElements[i] = pathElement.toString(); } else { encodedPathElements[i] = URIUtil.encodePath(pathElement.toString()).replaceAll("/", "%2F"); } } catch (URIException e) { throw new RuntimeException("Failed to encode path element: " + pathElements[i], e); } } else { encodedPathElements[i] = null; } } return uriBuilder.buildFromEncoded(encodedPathElements); }

Target:
public static URI createURI(URI baseURI, java.lang.Class< ? > resourceClass, java.lang.Object... pathElements) { UriBuilder uriBuilder = UriBuilder.fromUri(baseURI).path(resourceClass); List<String> pathVariableNames = null; if (pathElements.length > 0) { pathVariableNames = getVariableNamesFromPathTemplate(uriBuilder.toString()); } Object[] encodedPathElements = new String[pathElements.length]; for (int i = 0; i < pathElements.length; i++) { Object pathElement = pathElements[i]; if (pathElement != null) { try { if (i < pathVariableNames.size() && "spaceName".equals(pathVariableNames.get(i))) { if (!(pathElement instanceof List)) { throw new RuntimeException("The 'spaceName' parameter must be a list!"); } encodedPathElements[i] = generateEncodedSpacesURISegment((List) pathElements[i]); } else if (pathElement instanceof List) { encodedPathElements[i] = generateEncodedListURISegment((List) pathElements[i]); } else if (pathElement instanceof EncodedElement) { encodedPathElements[i] = pathElement.toString(); } else { encodedPathElements[i] = URIUtil.encodePath(pathElement.toString()).replaceAll("/", "%2F"); } } catch (URIException e) { throw new RuntimeException("Failed to encode path element: " + pathElements[i], e); } } else { encodedPathElements[i] = null; } } return uriBuilder.buildFromEncoded(encodedPathElements); }
Source:
public int andCardinality(BitmapContainer x) { int card = this.getCardinality(); int cardinality=0; if (card <= ArrayContainer.DEFAULT_MAX_SIZE) { if(card > x.cardinality) card = x.cardinality; cardinality=0; for (int rlepos=0; rlepos < this.nbrruns; ++rlepos) { int runStart = Util.toIntUnsigned(this.getValue(rlepos)); int runEnd = runStart + Util.toIntUnsigned(this.getLength(rlepos)); for (int runValue = runStart; runValue <= runEnd; ++runValue) { if ( x.contains((short) runValue)) { cardinality++; } } } return cardinality; } BitmapContainer answer = x.clone(); int start = 0; for(int rlepos = 0; rlepos < this.nbrruns; ++rlepos ) { int end = Util.toIntUnsigned(this.getValue(rlepos)); Util.resetBitmapRange(answer.bitmap, start, end); start = end + Util.toIntUnsigned(this.getLength(rlepos)) + 1; } Util.resetBitmapRange(answer.bitmap, start, Util.maxLowBitAsInteger() + 1); answer.computeCardinality(); return answer.getCardinality(); }

Target:
public int andCardinality(BitmapContainer x) { int cardinality=0; for (int rlepos=0; rlepos < this.nbrruns; ++rlepos) { int runStart = Util.toIntUnsigned(this.getValue(rlepos)); int runEnd = runStart + Util.toIntUnsigned(this.getLength(rlepos)); for (int runValue = runStart; runValue <= runEnd; ++runValue) { if ( x.contains((short) runValue)) { cardinality++; } } } return cardinality; }
Source:
public void handleSuccess() { super.handleSuccess(); if (isCompleteTrace(trace)) { disposeProvider(false); } else { fNbRead += getNbRead(); synchronized (fRequestSyncObj) { final TmfTimeRange timeRange = fTimeRange; if (timeRange != null) { if (getRange().getEndTime().getValue() > timeRange.getEndTime().getValue()) { startRequest(); } } } } }

Target:
public void handleSuccess() { super.handleSuccess(); if (isCompleteTrace(trace)) { disposeProvider(false); } else { fNbRead += getNbRead(); synchronized (fRequestSyncObj) { final TmfTimeRange timeRange = fTimeRange; if (timeRange != null) { if (getRange().getEndTime().getValue() < timeRange.getEndTime().getValue()) { startRequest(); } } } } }
Source:
public final <T> void unsafeSubscribe(final Subscriber<T> s) { requireNonNull(s); try { unsafeSubscribe(new CompletableSubscriber() { @Override public void onCompleted() { s.onCompleted(); } @Override public void onError(Throwable e) { s.onError(e); } @Override public void onSubscribe(Subscription d) { s.add(d); } }); RxJavaPlugins.getInstance().getObservableExecutionHook().onSubscribeReturn(s); } catch (NullPointerException ex) { throw ex; } catch (Throwable ex) { Exceptions.throwIfFatal(ex); ex = HOOK.onSubscribeError(ex); ERROR_HANDLER.handleError(ex); throw toNpe(ex); } }

Target:
public final <T> void unsafeSubscribe(final Subscriber<T> s) { unsafeSubscribe(s, true); }
Source:
private DatePicker.OnDateChangedListener buildDateListener() { final Handler mainHandler = new Handler(getContext().getMainLooper()); final Runnable updateFormRelevancyRunnable = new Runnable() { @Override public void run() { widgetEntryChanged(); isRelevancyUpdateScheduled = false; blockingActionsManager.registerActionCompletion( BlockingActionsManager.BlockingActionIdentifier.OnDateChanged); } }; return new DatePicker.OnDateChangedListener() { @Override public void onDateChanged(DatePicker view, int year, int month, int day) { if (mPrompt.isReadOnly()) { setAnswer(); } else { Calendar c = Calendar.getInstance(); c.set(year, month, 1); int max = c.getActualMaximum(Calendar.DAY_OF_MONTH); if (day > max) { mDatePicker.updateDate(year, month, max); } else { if (!(mDatePicker.getDayOfMonth() == day && mDatePicker.getMonth() == month && mDatePicker.getYear() == year)) { mDatePicker.updateDate(year, month, day); } } } if (!isRelevancyUpdateScheduled) { blockingActionsManager.registerActionStart( BlockingActionsManager.BlockingActionIdentifier.OnDateChanged); isRelevancyUpdateScheduled = true; mainHandler.postDelayed(updateFormRelevancyRunnable, 750); } } }; }

Target:
private DatePicker.OnDateChangedListener buildDateListener() { return new DatePicker.OnDateChangedListener() { @Override public void onDateChanged(DatePicker view, int year, int month, int day) { if (mPrompt.isReadOnly()) { setAnswer(); } else { Calendar c = Calendar.getInstance(); c.set(year, month, 1); int max = c.getActualMaximum(Calendar.DAY_OF_MONTH); if (day > max) { mDatePicker.updateDate(year, month, max); } else { if (!(mDatePicker.getDayOfMonth() == day && mDatePicker.getMonth() == month && mDatePicker.getYear() == year)) { mDatePicker.updateDate(year, month, day); } } } widgetEntryChangedDelayed(); } }; }
Source:
private void fillVMOrTemplateDetailOptions(final Map<String, List<String>> options, final HypervisorType hypervisorType) { if (options == null) { throw new CloudRuntimeException("Invalid/null detail-options response object passed"); } options.put(VmDetailConstants.KEYBOARD, Arrays.asList("uk", "us", "jp", "fr")); options.put(VmDetailConstants.CPU_CORE_PER_SOCKET, Collections.emptyList()); if (HypervisorType.KVM.equals(hypervisorType)) { options.put(VmDetailConstants.ROOT_DISK_CONTROLLER, Arrays.asList("ide", "scsi", "virtio")); } if (HypervisorType.VMware.equals(hypervisorType)) { options.put(VmDetailConstants.NIC_ADAPTER, Arrays.asList("E1000", "PCNet32", "Vmxnet2", "Vmxnet3")); options.put(VmDetailConstants.ROOT_DISK_CONTROLLER, Arrays.asList("osdefault", "ide", "scsi", "lsilogic", "lsisas1068", "buslogic", "pvscsi")); options.put(VmDetailConstants.DATA_DISK_CONTROLLER, Arrays.asList("osdefault", "ide", "scsi", "lsilogic", "lsisas1068", "buslogic", "pvscsi")); options.put(VmDetailConstants.NESTED_VIRTUALIZATION_FLAG, Arrays.asList("true", "false")); options.put(VmDetailConstants.SVGA_VRAM_SIZE, Collections.emptyList()); } }

Target:
private void fillVMOrTemplateDetailOptions(final Map<String, List<String>> options, final HypervisorType hypervisorType) { if (options == null) { throw new CloudRuntimeException("Invalid/null detail-options response object passed"); } options.put(VmDetailConstants.KEYBOARD, Arrays.asList("uk", "us", "jp", "fr")); options.put(VmDetailConstants.CPU_CORE_PER_SOCKET, Collections.emptyList()); options.put(VmDetailConstants.ROOT_DISK_SIZE, Collections.emptyList()); if (HypervisorType.KVM.equals(hypervisorType)) { options.put(VmDetailConstants.ROOT_DISK_CONTROLLER, Arrays.asList("osdefault", "ide", "scsi", "virtio")); } if (HypervisorType.VMware.equals(hypervisorType)) { options.put(VmDetailConstants.NIC_ADAPTER, Arrays.asList("E1000", "PCNet32", "Vmxnet2", "Vmxnet3")); options.put(VmDetailConstants.ROOT_DISK_CONTROLLER, Arrays.asList("osdefault", "ide", "scsi", "lsilogic", "lsisas1068", "buslogic", "pvscsi")); options.put(VmDetailConstants.DATA_DISK_CONTROLLER, Arrays.asList("osdefault", "ide", "scsi", "lsilogic", "lsisas1068", "buslogic", "pvscsi")); options.put(VmDetailConstants.NESTED_VIRTUALIZATION_FLAG, Arrays.asList("true", "false")); options.put(VmDetailConstants.SVGA_VRAM_SIZE, Collections.emptyList()); } }
Source:
public static EsLocation fromMap(Map<String, Object> map) { EsLocation esLocation = new EsLocation(); if (map.get(AVAILABILITY_TIME) != null) { esLocation.availabilityTime(new DateTime(map.get(AVAILABILITY_TIME)).toDate()); } if (map.get(AVAILABILITY_END_TIME) != null) { esLocation.availabilityEndTime(new DateTime(map.get(AVAILABILITY_END_TIME)).toDate()); } if (map.get(ALIASES) != null) { if(((Iterable)map.get(ALIASES)).iterator().next().getClass() != Alias.class) { esLocation.aliasesFromEs((List<EsAlias>) ((List<Map>)map.get(ALIASES)).stream() .map(EsAlias::fromMap) .collect(Collectors.toList()) ); } else { esLocation.aliases((Iterable)map.get(ALIASES)); } } return esLocation; }

Target:
public static EsLocation fromMap(Map<String, Object> map) { EsLocation esLocation = new EsLocation(); if (map.get(AVAILABILITY_TIME) != null) { esLocation.availabilityTime(new DateTime(map.get(AVAILABILITY_TIME)).toDate()); } if (map.get(AVAILABILITY_END_TIME) != null) { esLocation.availabilityEndTime(new DateTime(map.get(AVAILABILITY_END_TIME)).toDate()); } if (map.get(ALIASES) != null) { esLocation.aliasesFromEs( (List<EsAlias>) ((List<Map>)map.get(ALIASES)).stream() .map(EsAlias::fromMap) .collect(Collectors.toList()) ); } return esLocation; }