auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testServiceStart() throws Exception { String basedir = System.getProperty("basedir"); if (basedir == null) { basedir = new File(".").getCanonicalPath(); } GatewayConfig config = EasyMock.createMock(GatewayConfig.class); EasyMock.expect(config.getGatewayKeystoreDir()).andReturn(basedir + "/target/test-classes/keystores").atLeastOnce(); EasyMock.expect(config.getSigningKeystorePath()).andReturn(basedir + "/target/test-classes/keystores/server-keystore.jks").atLeastOnce(); EasyMock.expect(config.getSigningKeystoreType()).andReturn("jks").atLeastOnce(); EasyMock.expect(config.getSigningKeystorePasswordAlias()).andReturn(GatewayConfig.DEFAULT_SIGNING_KEYSTORE_PASSWORD_ALIAS).anyTimes(); EasyMock.expect(config.getSigningKeyAlias()).andReturn("server").anyTimes(); MasterService ms = EasyMock.createMock(MasterService.class); EasyMock.expect(ms.getMasterSecret()).andReturn("horton".toCharArray()).atLeastOnce(); AliasService as = EasyMock.createMock(AliasService.class); EasyMock.expect(as.getSigningKeyPassphrase()).andReturn("horton".toCharArray()).atLeastOnce(); EasyMock.replay(config, ms, as); DefaultKeystoreService ks = new DefaultKeystoreService(); ks.setMasterService(ms); ks.init(config, new HashMap<>()); ks.start(); DefaultTokenAuthorityService ta = new DefaultTokenAuthorityService(); ta.setAliasService(as); ta.setKeystoreService(ks); ta.init(config, new HashMap<>()); ta.start(); EasyMock.verify(config, ms, as); }

Target:
public void testServiceStart() throws Exception { String basedir = System.getProperty("basedir"); if (basedir == null) { basedir = new File(".").getCanonicalPath(); } GatewayConfig config = EasyMock.createMock(GatewayConfig.class); EasyMock.expect(config.getGatewayKeystoreDir()).andReturn(basedir + "/target/test-classes/keystores").atLeastOnce(); EasyMock.expect(config.getSigningKeystorePath()).andReturn(basedir + "/target/test-classes/keystores/server-keystore.jks").atLeastOnce(); EasyMock.expect(config.getSigningKeystoreType()).andReturn("jks").atLeastOnce(); EasyMock.expect(config.getSigningKeystorePasswordAlias()).andReturn(GatewayConfig.DEFAULT_SIGNING_KEYSTORE_PASSWORD_ALIAS).anyTimes(); EasyMock.expect(config.getSigningKeyAlias()).andReturn("server").anyTimes(); MasterService ms = EasyMock.createMock(MasterService.class); EasyMock.expect(ms.getMasterSecret()).andReturn("horton".toCharArray()).atLeastOnce(); AliasService as = EasyMock.createMock(AliasService.class); EasyMock.expect(as.getSigningKeyPassphrase()).andReturn("horton".toCharArray()).atLeastOnce(); EasyMock.replay(config, ms, as); DefaultKeystoreService ks = new DefaultKeystoreService(); ks.setMasterService(ms); ks.init(config, new HashMap<>()); ks.start(); DefaultTokenAuthorityService ta = new DefaultTokenAuthorityService(); ta.setAliasService(as); ta.setKeystoreService(ks); ta.init(config, new HashMap<>()); ta.start(); ta.stop(); ks.stop(); EasyMock.verify(config, ms, as); }
Source:
private void init(Config config, URIish uri) { int postBufferSize = config.getInt(HTTP, POST_BUFFER_KEY, 1 * 1024 * 1024); boolean sslVerifyFlag = config.getBoolean(HTTP, SSL_VERIFY_KEY, true); HttpRedirectMode followRedirectsMode = config.getEnum( HttpRedirectMode.values(), HTTP, null, FOLLOW_REDIRECTS_KEY, HttpRedirectMode.INITIAL); int redirectLimit = config.getInt(HTTP, MAX_REDIRECTS_KEY, MAX_REDIRECTS); if (redirectLimit < 0) { redirectLimit = MAX_REDIRECTS; } String match = findMatch(config.getSubsections(HTTP), uri); if (match != null) { postBufferSize = config.getInt(HTTP, match, POST_BUFFER_KEY, postBufferSize); sslVerifyFlag = config.getBoolean(HTTP, match, SSL_VERIFY_KEY, sslVerifyFlag); followRedirectsMode = config.getEnum(HttpRedirectMode.values(), HTTP, match, FOLLOW_REDIRECTS_KEY, followRedirectsMode); int newMaxRedirects = config.getInt(HTTP, match, MAX_REDIRECTS_KEY, redirectLimit); if (newMaxRedirects >= 0) { redirectLimit = newMaxRedirects; } cookieFile = config.getString(HTTP, match, COOKIE_FILE_KEY); saveCookies = config.getBoolean(HTTP, match, SAVE_COOKIES_KEY, false); } else { cookieFile = config.getString(HTTP, null, COOKIE_FILE_KEY); saveCookies = config.getBoolean(HTTP, SAVE_COOKIES_KEY, false); } postBuffer = postBufferSize; sslVerify = sslVerifyFlag; followRedirects = followRedirectsMode; maxRedirects = redirectLimit; }

Target:
private void init(Config config, URIish uri) { int postBufferSize = config.getInt(HTTP, POST_BUFFER_KEY, 1 * 1024 * 1024); boolean sslVerifyFlag = config.getBoolean(HTTP, SSL_VERIFY_KEY, true); HttpRedirectMode followRedirectsMode = config.getEnum( HttpRedirectMode.values(), HTTP, null, FOLLOW_REDIRECTS_KEY, HttpRedirectMode.INITIAL); int redirectLimit = config.getInt(HTTP, MAX_REDIRECTS_KEY, MAX_REDIRECTS); if (redirectLimit < 0) { redirectLimit = MAX_REDIRECTS; } cookieFile = config.getString(HTTP, null, COOKIE_FILE_KEY); saveCookies = config.getBoolean(HTTP, SAVE_COOKIES_KEY, false); String match = findMatch(config.getSubsections(HTTP), uri); if (match != null) { postBufferSize = config.getInt(HTTP, match, POST_BUFFER_KEY, postBufferSize); sslVerifyFlag = config.getBoolean(HTTP, match, SSL_VERIFY_KEY, sslVerifyFlag); followRedirectsMode = config.getEnum(HttpRedirectMode.values(), HTTP, match, FOLLOW_REDIRECTS_KEY, followRedirectsMode); int newMaxRedirects = config.getInt(HTTP, match, MAX_REDIRECTS_KEY, redirectLimit); if (newMaxRedirects >= 0) { redirectLimit = newMaxRedirects; } String urlSpecificCookieFile = config.getString(HTTP, match, COOKIE_FILE_KEY); if (urlSpecificCookieFile != null) { cookieFile = urlSpecificCookieFile; } saveCookies = config.getBoolean(HTTP, match, SAVE_COOKIES_KEY, saveCookies); } postBuffer = postBufferSize; sslVerify = sslVerifyFlag; followRedirects = followRedirectsMode; maxRedirects = redirectLimit; }
Source:
public void messageConsumerTests() { final String url = "tcp://123.123.123.123"; final String name = "TestName12@!"; MqttBrokerConnection a; try { a = new MqttBrokerConnection(name, url, false); } catch (ConfigurationException e) { fail(); return; } assertFalse(a.isConsumers()); MqttMessageSubscriber subscriber = new MqttMessageSubscriber() { @Override public void processMessage(String topic, byte[] payload) { } @Override public String getTopic() { return "topic"; } }; try { a.addConsumer(subscriber); } catch (MqttException e) { fail("addConsumer failed"); } assertTrue(a.isConsumers()); a.removeConsumer(subscriber); assertFalse(a.isConsumers()); }

Target:
public void messageConsumerTests() throws ConfigurationException, MqttException { final String url = "tcp://123.123.123.123"; final String name = "TestName12@!"; MqttBrokerConnection a = new MqttBrokerConnection(name, url, false); assertFalse(a.isConsumers()); MqttMessageSubscriber subscriber = mock(MqttMessageSubscriber.class); when(subscriber.getTopic()).thenAnswer(i -> "topic"); a.addConsumer(subscriber); assertTrue(a.isConsumers()); a.removeConsumer(subscriber); assertFalse(a.isConsumers()); }
Source:
public void run() { if (getConfig().getProjectListRefreshInterval() <= 0) { return; } boolean loadProjectList = getConfig().isLoadProjectListOnStartup(); while (!shutdown) { try { if (loadProjectList) { if (isConnected()) { IGerritHudsonTriggerConfig activeConfig = getConfig(); SshConnection sshConnection = SshConnectionFactory.getConnection( activeConfig.getGerritHostName(), activeConfig.getGerritSshPort(), activeConfig.getGerritProxy(), activeConfig.getGerritAuthentication() ); setGerritProjects(readProjects(sshConnection.executeCommandReader(GERRIT_LS_PROJECTS))); sshConnection.disconnect(); } } else { loadProjectList = true; } } catch (SshException ex) { logger.warn("Could not connect to Gerrit server when updating Gerrit project list: ", ex); } catch (IOException ex) { logger.error("Could not read stream with Gerrit projects: ", ex); } try { synchronized (this) { wait(TimeUnit.SECONDS.toMillis(getConfig().getProjectListRefreshInterval())); } } catch (InterruptedException ex) { logger.warn("InterruptedException: ", ex); break; } } GerritServer server = PluginImpl.getServer_(serverName); if (server != null) { server.removeListener(this); } else { logger.error("Could not find server {}", serverName); } }

Target:
public void run() { if (getConfig().getProjectListRefreshInterval() <= 0) { return; } boolean loadProjectList = getConfig().isLoadProjectListOnStartup(); while (!shutdown) { try { if (loadProjectList) { if (isConnected()) { IGerritHudsonTriggerConfig activeConfig = getConfig(); SshConnection sshConnection = SshConnectionFactory.getConnection( activeConfig.getGerritHostName(), activeConfig.getGerritSshPort(), activeConfig.getGerritProxy(), activeConfig.getGerritAuthentication() ); setGerritProjects(readProjects(sshConnection.executeCommandReader(GERRIT_LS_PROJECTS))); sshConnection.disconnect(); } } else { loadProjectList = true; } } catch (SshException ex) { logger.warn("Could not connect to Gerrit server when updating Gerrit project list: ", ex); } catch (IOException ex) { logger.error("Could not read stream with Gerrit projects: ", ex); } try { synchronized (this) { long startTime = System.nanoTime(); while (System.nanoTime() - startTime < TimeUnit.SECONDS.toNanos(getConfig().getProjectListRefreshInterval()) && !shutdown) { wait(TimeUnit.SECONDS.toMillis(1)); } } } catch (InterruptedException ex) { logger.warn("InterruptedException: ", ex); break; } } GerritServer server = PluginImpl.getServer_(serverName); if (server != null) { server.removeListener(this); } else { logger.error("Could not find server {}", serverName); } }
Source:
protected Object computeServiceProblems() { Map<Entity, Lifecycle> values = getValues(SERVICE_STATE_ACTUAL); int numRunning=0; List<Entity> onesNotHealthy=MutableList.of(); Set<Lifecycle> ignoreStates = getConfig(IGNORE_ENTITIES_WITH_THESE_SERVICE_STATES); for (Map.Entry<Entity,Lifecycle> state: values.entrySet()) { if (state.getValue()==Lifecycle.RUNNING) numRunning++; else if (!ignoreStates.contains(state.getValue())) onesNotHealthy.add(state.getKey()); } QuorumCheck qc = getConfig(RUNNING_QUORUM_CHECK); if (qc!=null) { if (qc.isQuorate(numRunning, onesNotHealthy.size()+numRunning)) return null; if (onesNotHealthy.size()==0) return "Not enough entities running to be quorate"; } else { if (onesNotHealthy.size()==0) return null; } return "Required entit"+Strings.ies(onesNotHealthy.size())+" not healthy: "+ (onesNotHealthy.size()>3 ? onesNotHealthy.get(0)+" and "+(onesNotHealthy.size()-1)+" others" : Strings.join(onesNotHealthy, ", ")); }

Target:
protected Object computeServiceProblems() { Map<Entity, Lifecycle> values = getValues(SERVICE_STATE_ACTUAL); int numRunning=0; List<Entity> onesNotHealthy=MutableList.of(); Set<Lifecycle> ignoreStates = getConfig(IGNORE_ENTITIES_WITH_THESE_SERVICE_STATES); for (Map.Entry<Entity,Lifecycle> state: values.entrySet()) { if (state.getValue()==Lifecycle.RUNNING) numRunning++; else if (!ignoreStates.contains(state.getValue())) onesNotHealthy.add(state.getKey()); } QuorumCheck qc = getConfig(RUNNING_QUORUM_CHECK); if (qc!=null) { if (qc.isQuorate(numRunning, onesNotHealthy.size()+numRunning)) return null; if (onesNotHealthy.isEmpty()) return "Not enough entities running to be quorate"; } else { if (onesNotHealthy.isEmpty()) return null; } return "Required entit"+Strings.ies(onesNotHealthy.size())+" not healthy: "+ (onesNotHealthy.size()>3 ? onesNotHealthy.get(0)+" and "+(onesNotHealthy.size()-1)+" others" : Strings.join(onesNotHealthy, ", ")); }
Source:
public static Map<String, Properties> getImportProcessorConfig(ImportType importType) { Map<String, Properties> processorConfig = new HashMap<String, Properties>(); if (importType == null) { return processorConfig; } List<String> streamList = new ArrayList<String>(); int i = 0; for (ImportConfigurationType importConfiguration : importType.getConfiguration()) { boolean connectorEnabled = importConfiguration.isEnabled(); if (!connectorEnabled) continue; if (!streamList.contains(importConfiguration.getModule())) { streamList.add(importConfiguration.getModule()); } Properties processorProperties = checkImportProcessorConfiguration(importConfiguration); String transformer = importConfiguration.getFormat(); if (transformer != null && !transformer.isEmpty()) { processorProperties.put(ImportDataProcessor.IMPORT_TRANSFORMER, transformer); } processorConfig.put(importConfiguration.getModule() + i++, processorProperties); } return processorConfig; }

Target:
public static Map<String, Properties> getImportProcessorConfig(ImportType importType) { Map<String, Properties> processorConfig = new HashMap<String, Properties>(); if (importType == null) { return processorConfig; } List<String> streamList = new ArrayList<String>(); int i = 0; for (ImportConfigurationType importConfiguration : importType.getConfiguration()) { boolean connectorEnabled = importConfiguration.isEnabled(); if (!connectorEnabled) continue; if (!streamList.contains(importConfiguration.getModule())) { streamList.add(importConfiguration.getModule()); } Properties processorProperties = checkImportProcessorConfiguration(importConfiguration); String formatter = importConfiguration.getFormat(); if (formatter != null && !formatter.isEmpty()) { processorProperties.put(ImportDataProcessor.IMPORT_FORMATTER, formatter); } processorConfig.put(importConfiguration.getModule() + i++, processorProperties); } return processorConfig; }
Source:
private boolean performNextOperationLiveMerge(int completedChildren) { if (completedChildren != 0) { checkImageIdConsistency(completedChildren - 1); } Guid nextImageId = getParameters().getImageIds().get(completedChildren); log.info("Starting child command of {}, image '{}'", completedChildren + 1, getParameters().getImageIds().size(), nextImageId); ImagesContainterParametersBase parameters = buildRemoveSnapshotSingleDiskLiveParameters(nextImageId, completedChildren); updateParameters(completedChildren, parameters.getDestinationImageId()); persistCommand(getParameters().getParentCommand(), true); CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.RemoveSnapshotSingleDiskLive, parameters, cloneContextAndDetachFromParent()); return true; }

Target:
private boolean performNextOperationLiveMerge(int completedChildren) { if (completedChildren != 0) { checkImageIdConsistency(completedChildren - 1); } Guid nextImageId = getParameters().getImageIds().get(completedChildren); log.info("Starting child command of {}, image '{}'", completedChildren + 1, getParameters().getImageIds().size(), nextImageId); ImagesContainterParametersBase parameters = buildRemoveSnapshotSingleDiskLiveParameters(nextImageId, completedChildren); updateParameters(completedChildren, parameters.getDestinationImageId()); persistCommandIfNeeded(); CommandCoordinatorUtil.executeAsyncCommand(VdcActionType.RemoveSnapshotSingleDiskLive, parameters, cloneContextAndDetachFromParent()); return true; }
Source:
public static String[] getRecurrenceDates(String recurrentEventIdentifier){ String[] recDates = null; if(recurrentEventIdentifier==null) { return null; } if(recurrentEventIdentifier.contains(RECURRENCE_PREFIX) && recurrentEventIdentifier.contains(RECURRENCE_SEPARATOR)){ String idAux = ""; try{ idAux = recurrentEventIdentifier.substring(recurrentEventIdentifier.indexOf(RECURRENCE_SEPARATOR)+1); }catch(IndexOutOfBoundsException e){} if(UtilMethods.isSet(idAux)){ recDates = idAux.split(RECURRENCE_SEPARATOR); } } return recDates; }

Target:
public static String[] getRecurrenceDates(String recurrentEventIdentifier){ String[] recDates = null; if(recurrentEventIdentifier==null) { return new String[]{}; } if(recurrentEventIdentifier.contains(RECURRENCE_PREFIX) && recurrentEventIdentifier.contains(RECURRENCE_SEPARATOR)){ String idAux = ""; try{ idAux = recurrentEventIdentifier.substring(recurrentEventIdentifier.indexOf(RECURRENCE_SEPARATOR)+1); }catch(IndexOutOfBoundsException e){} if(UtilMethods.isSet(idAux)){ recDates = idAux.split(RECURRENCE_SEPARATOR); } } return recDates; }
Source:
public Long scheduleRequest(String containerId, JobRequestInstance jobRequest) { Object result = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); String queryString = ""; if (containerId != null && !containerId.isEmpty()) { valuesMap.put(CONTAINER_ID, containerId); queryString = "?containerId=" + containerId; } result = makeHttpPostRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI, valuesMap) + queryString, jobRequest, Object.class); } else { if (containerId == null) { containerId = ""; } CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "scheduleRequest", serialize(jobRequest), marshaller.getFormat().getType(), new Object[]{containerId}) ) ); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } result = deserialize(response.getResult(), Object.class); } if (result instanceof Wrapped) { return (Long) ((Wrapped) result).unwrap(); } return ((Number) result).longValue(); }

Target:
public Long scheduleRequest(String containerId, JobRequestInstance jobRequest) { Object result = null; if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<String, Object>(); String queryString = ""; if (containerId != null && !containerId.isEmpty()) { queryString = "?containerId=" + containerId; } result = makeHttpPostRequestAndCreateCustomResponse( build(loadBalancer.getUrl(), JOB_URI, valuesMap) + queryString, jobRequest, Object.class); } else { if (containerId == null) { containerId = ""; } CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new DescriptorCommand( "JobService", "scheduleRequest", serialize(jobRequest), marshaller.getFormat().getType(), new Object[]{containerId}) ) ); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } result = deserialize(response.getResult(), Object.class); } if (result instanceof Wrapped) { return (Long) ((Wrapped) result).unwrap(); } return ((Number) result).longValue(); }
Source:
public String setInputCommand(Command command){ switch(((StringType) command).toString().toLowerCase()){ case "btaudio": return "extInput:btAudio"; case "tv": return "extInput:tv"; case "hdmi1": return "extInput:hdmi?port=1"; case "hdmi2": return "extInput:hdmi?port=2"; case "hdmi3": return "extInput:hdmi?port=3"; case "analog": return "extInput:line"; case "usb": return "storage:usb1"; case "network": return "dlna:music"; } return ((StringType) command).toString(); }

Target:
public String setInputCommand(Command command) { switch (command.toString().toLowerCase()) { case "btaudio": return "extInput:btAudio"; case "tv": return "extInput:tv"; case "hdmi1": return "extInput:hdmi?port=1"; case "hdmi2": return "extInput:hdmi?port=2"; case "hdmi3": return "extInput:hdmi?port=3"; case "analog": return "extInput:line"; case "usb": return "storage:usb1"; case "network": return "dlna:music"; case "cast": return "cast:audio"; } return command.toString(); }
Source:
private V pull(final EncodedKey<K> encodedKey) { try { workerClock.waitIfExceedingStalenessBound(); } catch (final InterruptedException e) { throw new RuntimeException(e); } final PullOp pullOp = new PullOp(encodedKey); final int partitionId = getPartitionIndex(encodedKey.getHash()); final int threadId = partitionId % numThreads; threads[threadId].enqueue(pullOp); return pullOp.get(); }

Target:
private V pull(final EncodedKey<K> encodedKey) { workerClock.waitIfExceedingStalenessBound(); final PullOp pullOp = new PullOp(encodedKey); final int partitionId = getPartitionIndex(encodedKey.getHash()); final int threadId = partitionId % numThreads; threads[threadId].enqueue(pullOp); return pullOp.get(); }
Source:
public void testReplicatedJoin() { JoinNode join = join("join", tableScan("ts1", "orderkey"), tableScan("ts2", "orderkey_0"), JoinNode.DistributionType.REPLICATED, "orderkey", "orderkey_0"); Map<String, PlanNodeCostEstimate> costs = ImmutableMap.of( "ts1", cpuCost(6000), "ts2", cpuCost(1000)); Map<String, PlanNodeStatsEstimate> stats = ImmutableMap.of( "join", statsEstimate(12000), "ts1", statsEstimate(6000), "ts2", statsEstimate(1000)); assertCost( join, costs, stats) .cpu(12000 + 6000 + 10000 + 6000 + 1000 + 1000 * (NUMBER_OF_NODES - 1)); assertCostEstimatedExchanges( join, costs, stats) .cpu(12000 + 6000 + 10000 + 6000 + 1000 + 1000 * NUMBER_OF_NODES); assertCostHasUnknownComponentsForUnknownStats(join); }

Target:
public void testReplicatedJoin() { TableScanNode ts1 = tableScan("ts1", "orderkey"); TableScanNode ts2 = tableScan("ts2", "orderkey_0"); JoinNode join = join("join", ts1, ts2, JoinNode.DistributionType.REPLICATED, "orderkey", "orderkey_0"); Map<String, PlanNodeCostEstimate> costs = ImmutableMap.of( "ts1", cpuCost(6000), "ts2", cpuCost(1000)); Map<String, PlanNodeStatsEstimate> stats = ImmutableMap.of( "join", statsEstimate(join, 12000), "ts1", statsEstimate(ts1, 6000), "ts2", statsEstimate(ts2, 1000)); assertCost(join, costs, stats) .cpu(12000 + 6000 + 10000 + 6000 + 1000 + 1000 * (NUMBER_OF_NODES - 1)) .memory(1000 * NUMBER_OF_NODES) .network(0); assertCostEstimatedExchanges(join, costs, stats) .cpu(12000 + 6000 + 10000 + 6000 + 1000 + 1000 * NUMBER_OF_NODES) .memory(1000 * NUMBER_OF_NODES) .network(1000 * NUMBER_OF_NODES); assertCostHasUnknownComponentsForUnknownStats(join); }
Source:
private void close() { stop(); process.close(); }

Target:
private void close() { exit.set(true); thread.interrupt(); }
Source:
public Result refresh() { refreshableCategoryTree.refresh(); return ok("Fetched " + refreshableCategoryTree.getAllAsFlatList().size() + " categories"); }

Target:
public Result refresh() { return refreshableCategoryTree.map(tree -> { tree.refresh(); return ok("Fetched " + tree.getAllAsFlatList().size() + " categories"); }).orElseThrow(() -> new RuntimeException("Not found refreshable category tree")); }
Source:
private static void addCustomAnnotationsToSpan(@Nullable Span span, @NotNull PhoenixConnection conn) { Preconditions.checkNotNull(conn); if (span != null) { Map<String, String> annotations = conn.getCustomTracingAnnotations(); for (Map.Entry<String, String> annotation : annotations.entrySet()) { span.addKVAnnotation(StringUtil.toBytes(annotation.getKey()), StringUtil.toBytes(annotation.getValue())); } } }

Target:
private static void addCustomAnnotationsToSpan(@Nullable Span span, @NotNull PhoenixConnection conn) { Preconditions.checkNotNull(conn); if (span == null) { return; } Map<String, String> annotations = conn.getCustomTracingAnnotations(); for (Map.Entry<String, String> annotation : annotations.entrySet()) { span.addKVAnnotation(toBytes(annotation.getKey()), toBytes(annotation.getValue())); } }
Source:
private List<String> getActiveBoundaryNodesSignals(ProcessInstance processInstance, Collection<NodeInstance> activeNodes) { WorkflowProcessInstance workflowProcessInstance = (WorkflowProcessInstance) processInstance; ArrayList<Node> processNodesList = new ArrayList(Arrays.asList(((RuleFlowProcessInstance) workflowProcessInstance).getNodeContainer().getNodes())); List<String> activeBoundaryNodesSignals = new ArrayList<>(); Map<String, NodeInstance> uniqueIdNodeInstanceMap = new HashMap<>(); for(NodeInstance activeNode : activeNodes) { uniqueIdNodeInstanceMap.put((String) activeNode.getNode().getMetaData().get("UniqueId"), activeNode); } try { for(Node processNode : processNodesList) { if(processNode instanceof BoundaryEventNode) { activeBoundaryNodesSignals.add(VariableUtil.resolveVariable((String) processNode.getMetaData().get("SignalName"), uniqueIdNodeInstanceMap.get(((BoundaryEventNode) processNode).getAttachedToNodeId()))); } } return activeBoundaryNodesSignals; } catch(Exception e) { logger.debug("Unable to retrieve boundary event nodes for active nodes in processInstance {}", processInstance.getId()); return new ArrayList<>(); } }

Target:
protected List<String> getActiveBoundaryNodesSignals(ProcessInstance processInstance, Collection<NodeInstance> activeNodes) { WorkflowProcessInstance workflowProcessInstance = (WorkflowProcessInstance) processInstance; ArrayList<Node> processNodesList = new ArrayList(Arrays.asList(((RuleFlowProcessInstance) workflowProcessInstance).getNodeContainer().getNodes())); List<String> activeBoundaryNodesSignals = new ArrayList<>(); Map<String, NodeInstance> uniqueIdNodeInstanceMap = new HashMap<>(); for(NodeInstance activeNode : activeNodes) { uniqueIdNodeInstanceMap.put((String) activeNode.getNode().getMetaData().get("UniqueId"), activeNode); } try { for(Node processNode : processNodesList) { if(processNode instanceof BoundaryEventNode && uniqueIdNodeInstanceMap.containsKey(((BoundaryEventNode) processNode).getAttachedToNodeId())) { activeBoundaryNodesSignals.add(VariableUtil.resolveVariable((String) processNode.getMetaData().get("SignalName"), uniqueIdNodeInstanceMap.get(((BoundaryEventNode) processNode).getAttachedToNodeId()))); } } return activeBoundaryNodesSignals; } catch(Exception e) { logger.debug("Unable to retrieve boundary event nodes for active nodes in processInstance {}", processInstance.getId()); return new ArrayList<>(); } }
Source:
public String getRawName() { return name().toLowerCase(Locale.US); }

Target:
public String getRawName() { return name().toLowerCase(); }
Source:
protected void setCommandCriteria(final String commandCriteria) { if (StringUtils.isEmpty(commandCriteria)) { this.commandCriteria = EMPTY_JSON_ARRAY; } else { this.commandCriteria = commandCriteria; } }

Target:
protected void setCommandCriteria(final String commandCriteria) { this.commandCriteria = StringUtils.isBlank(commandCriteria) ? EMPTY_JSON_ARRAY : commandCriteria; }
Source:
private AccessToken validateAccessToken(String token) { AccessToken accessToken; try { accessToken = connector.validateAccessToken(new AccessToken.Builder(token).build()); } catch (ConnectionInitializationException e) { String message = "Unable to retrieve access token from AuthServer " + authServerHome; LOGGER.warn(message); throw new InvalidTokenException(message); } catch (Exception e) { throw new InvalidTokenException("Your token is not valid", e); } return accessToken; }

Target:
private AccessToken validateAccessToken(String token) { AccessToken accessToken; try { accessToken = connector.validateAccessToken(new AccessToken.Builder(token).build()); } catch (ConnectionInitializationException e) { LOGGER.warn(String.format("Unable to retrieve access token from auth-server %s: %s", authServerHome, e.getMessage())); throw e; } catch (Exception e) { throw new InvalidTokenException("Your token is not valid", e); } return accessToken; }
Source:
private static void parseCommandLineOptions(Options options, String... args) throws ParseException { CommandLine commandLine = new DefaultParser().parse(options, args); if (commandLine.hasOption(HELP_OPTION)) { printHelp(options); System.exit(0); } if (commandLine.hasOption(SLEEP_OPTION)) { sleep = parseInt(commandLine.getOptionValue(SLEEP_OPTION)); } if (commandLine.hasOption(BATCH_SIZE_OPTION)) { batchSize = parseInt(commandLine.getOptionValue(BATCH_SIZE_OPTION)); } if (commandLine.hasOption(THREADS_OPTION)) { threads = parseInt(commandLine.getOptionValue(THREADS_OPTION)); } }

Target:
private static void parseCommandLineOptions(Options options, String... args) throws ParseException { CommandLine commandLine = new DefaultParser().parse(options, args); if (commandLine.hasOption(HELP_OPTION)) { printHelp(options); System.exit(-1); } if (commandLine.hasOption(SLEEP_OPTION)) { sleep = parseInt(commandLine.getOptionValue(SLEEP_OPTION)); } if (commandLine.hasOption(BATCH_SIZE_OPTION)) { batchSize = parseInt(commandLine.getOptionValue(BATCH_SIZE_OPTION)); } if (commandLine.hasOption(THREADS_OPTION)) { threads = parseInt(commandLine.getOptionValue(THREADS_OPTION)); } }
Source:
public void visitAssignmentExpression(AssignmentExpressionTree tree) { if (tree.getParent() instanceof ExpressionTree && !tree.operator().startsWith("=")) { visitReadAssignedVariable(tree.variable()); } else { visitAssignedVariable(tree.variable()); } super.visitAssignmentExpression(tree); }

Target:
public void visitAssignmentExpression(AssignmentExpressionTree tree) { if (!tree.getParent().is(Kind.EXPRESSION_STATEMENT) && !tree.operator().startsWith("=")) { visitReadAssignedVariable(tree.variable()); } else { visitAssignedVariable(tree.variable()); } super.visitAssignmentExpression(tree); }
Source:
public void testEmbeddedBeelineOutputs() throws Throwable{ String embeddedJdbcURL = Utils.URL_PREFIX+"/Default"; List<String> argList = getBaseArgs(embeddedJdbcURL); final String SCRIPT_TEXT = "set hive.lock.manager=org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager;\n" + "set hive.compute.query.using.stats=false;\n" + "create table if not exists embeddedBeelineOutputs(d int);\n" + "set a=1;\nselect count(*) from embeddedBeelineOutputs;\n"; final String EXPECTED_PATTERN = "Stage-1 map ="; testScriptFile(SCRIPT_TEXT, EXPECTED_PATTERN, true, argList, OUTSTREAM.ERR); }

Target:
public void testEmbeddedBeelineOutputs() throws Throwable{ String embeddedJdbcURL = Utils.URL_PREFIX+"/Default"; List<String> argList = getBaseArgs(embeddedJdbcURL); final String SCRIPT_TEXT = "set hive.lock.manager=org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager;\n" + "set hive.compute.query.using.stats=false;\n" + "create table if not exists embeddedBeelineOutputs(d int);\n" + "set a=1;\nselect count(*) from embeddedBeelineOutputs;\n" + "drop table embeddedBeelineOutputs;\n"; final String EXPECTED_PATTERN = "Stage-1 map ="; testScriptFile(SCRIPT_TEXT, EXPECTED_PATTERN, true, argList, OutStream.ERR); }
Source:
private TypedOutput buildBody() { switch (methodInfo.requestType) { case SIMPLE: { int bodyIndex = methodInfo.bodyIndex; if (bodyIndex == NO_BODY) { return null; } Object body = args[bodyIndex]; if (body instanceof TypedOutput) { return (TypedOutput) body; } else { return converter.toBody(body); } } case FORM_ENCODED: { FormEncodedTypedOutput body = new FormEncodedTypedOutput(); String[] requestFormPair = methodInfo.requestFormPair; for (int i = 0; i < requestFormPair.length; i++) { String name = requestFormPair[i]; if (name != null) { body.addPair(name, String.valueOf(args[i])); } } return body; } case MULTIPART: { MultipartTypedOutput body = new MultipartTypedOutput(); String[] requestMultipartPart = methodInfo.requestMultipartPart; for (int i = 0; i < requestMultipartPart.length; i++) { String name = requestMultipartPart[i]; if (name != null) { Object value = args[i]; if (value instanceof TypedOutput) { body.addPart(name, (TypedOutput) value); } else { body.addPart(name, converter.toBody(value)); } } } return body; } default: throw new IllegalArgumentException("Unknown request type " + methodInfo.requestType); } }

Target:
private TypedOutput buildBody() { switch (methodInfo.requestType) { case SIMPLE: { int bodyIndex = methodInfo.bodyIndex; if (bodyIndex == NO_BODY) { return null; } Object body = args[bodyIndex]; if (body instanceof TypedOutput) { return (TypedOutput) body; } else { return converter.toBody(body); } } case FORM_URL_ENCODED: { FormUrlEncodedTypedOutput body = new FormUrlEncodedTypedOutput(); String[] requestFormPair = methodInfo.requestFormPair; for (int i = 0; i < requestFormPair.length; i++) { String name = requestFormPair[i]; if (name != null) { body.addPair(name, String.valueOf(args[i])); } } return body; } case MULTIPART: { MultipartTypedOutput body = new MultipartTypedOutput(); String[] requestMultipartPart = methodInfo.requestMultipartPart; for (int i = 0; i < requestMultipartPart.length; i++) { String name = requestMultipartPart[i]; if (name != null) { Object value = args[i]; if (value instanceof TypedOutput) { body.addPart(name, (TypedOutput) value); } else { body.addPart(name, converter.toBody(value)); } } } return body; } default: throw new IllegalArgumentException("Unknown request type " + methodInfo.requestType); } }
Source:
protected static ILock getSecurePreferencesRootLock() { try { @SuppressWarnings("restriction") Field lockField = SecurePreferencesRoot.class.getDeclaredField("lock"); lockField.setAccessible(true); return (ILock) lockField.get(null); } catch (ClassCastException e) { handleErrorGettingLockField(e); } catch (SecurityException e) { handleErrorGettingLockField(e); } catch (IllegalArgumentException e) { handleErrorGettingLockField(e); } catch (NoSuchFieldException e) { handleErrorGettingLockField(e); } catch (IllegalAccessException e) { handleErrorGettingLockField(e); } return null; }

Target:
protected static ILock getSecurePreferencesRootLock() { try { @SuppressWarnings("restriction") Field lockField = SecurePreferencesRoot.class.getDeclaredField("lock"); lockField.setAccessible(true); return (ILock) lockField.get(null); } catch (Exception e) { if (!loggedDeadlockDetectionFailure.getAndSet(true)) { StatusHandler.log(new Status(IStatus.ERROR, RepositoriesUiPlugin.ID_PLUGIN, "Deadlock detection failed", e)); } } return null; }
Source:
protected void finished(StepContext context) throws Exception { Cloud c = Jenkins.get().getCloud(cloudName); String parentLabel = taskTemplate.getInheritFrom(); if (c == null) { LOGGER.log(Level.WARNING, "Cloud {0} no longer exists, cannot delete task template {1}", new Object[] { cloudName, taskTemplate.getTemplateName() }); return; } if (c instanceof ECSCloud) { ECSCloud ecsCloud = (ECSCloud) c; if (ecsCloud.isCustomTaskDefinition(parentLabel)){ LOGGER.log(Level.INFO, "Don't remove custom task template from cloud"); return; } else { LOGGER.log(Level.INFO, "Removing task template {1} from cloud {0}", new Object[] { c.name, taskTemplate.getTemplateName() }); ecsCloud.removeDynamicTemplate(taskTemplate); } } else { LOGGER.log(Level.WARNING, "Cloud is not an ECSCloud: {0} {1}", new String[] { c.name, c.getClass().getName() }); } }

Target:
protected void finished(StepContext context) throws Exception { Cloud c = Jenkins.get().getCloud(cloudName); String parentLabel = taskTemplate.getInheritFrom(); if (c == null) { LOGGER.log(Level.WARNING, "Cloud {0} no longer exists, cannot delete task template {1}", new Object[] { cloudName, taskTemplate.getTemplateName() }); return; } if (c instanceof ECSCloud) { ECSCloud ecsCloud = (ECSCloud) c; String customTaskDefinition = ecsCloud.isCustomTaskDefinition(parentLabel); if (customTaskDefinition != null){ LOGGER.log(Level.INFO, "Do not remove custom task template {1} from cloud {0}", new Object[] { c.name, customTaskDefinition }); return; } else { LOGGER.log(Level.INFO, "Removing task template {1} from cloud {0}", new Object[] { c.name, taskTemplate.getTemplateName() }); ecsCloud.removeDynamicTemplate(taskTemplate); } } else { LOGGER.log(Level.WARNING, "Cloud is not an ECSCloud: {0} {1}", new String[] { c.name, c.getClass().getName() }); } }
Source:
public Collection<Ingredient> getChildren() { return this.children; }

Target:
public Collection<Ingredient> getChildren() { return Collections.unmodifiableCollection(this.children); }
Source:
public ImmutableValue<Vector3d> headDirection() { return new ImmutableSpongeValue<>(Keys.HEAD_ROTATION, this.rotations.get(BodyParts.HEAD)); }

Target:
public ImmutableValue<Vector3d> headDirection() { return this.headRotationValue; }
Source:
public FileBasedConfig openJGitConfig(Config parent, FS fs) { return null; }

Target:
public FileBasedConfig openJGitConfig(Config parent, FS fs) { return jgitConfig; }
Source:
private void doScan(Exchange exchange, String tableName) throws KuduException { KuduClient connection = endpoint.getKuduClient(); KuduTable table = connection.openTable(tableName); List<String> projectColumns = new ArrayList<>(1); for (ColumnSchema columnSchema : table.getSchema().getColumns()) { projectColumns.add(columnSchema.getName()); } KuduScanner scanner = connection.newScannerBuilder(table) .setProjectedColumnNames(projectColumns) .build(); exchange.getIn().setBody(scanner); }

Target:
private void doScan(Exchange exchange, String tableName) throws KuduException { exchange.getIn().setBody(KuduUtils.doScan(tableName, endpoint.getKuduClient())); }
Source:
public void run() { while(true) { if (etc.getEditorState().isDirty()) { try { etc.getEditorState().setDirty(false); etc.spellCheckAllText(); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } } try { Thread.sleep(1000); } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); } } }

Target:
public void run() { while(true) { if (etc.getEditorState().isDirty()) { try { etc.getEditorState().setDirty(false); spellCheckAllText(); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } } try { Thread.sleep(1000); } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); } } }
Source:
public String getProfileName() { Properties config = (Properties) context.get(ExtensionProperties.CONFIGURATION); return config.getProperty("ovirt.engine.aaa.authz.profile.name"); }

Target:
public String getProfileName() { return ((Properties) context.get(ExtensionProperties.CONFIGURATION)).getProperty("ovirt.engine.aaa.authz.profile.name"); }
Source:
public List<String> complete(CommandSource src, CommandArgs args, CommandContext context) { Set<String> completions = Sets.newHashSet(); for (CommandElement element : elements) { Object start = args.getState(); try { element.parse(src, args, context); if (start.equals(args.getState())) { completions.addAll(element.complete(src, args, context)); } else if (!completions.isEmpty()) { completions.clear(); } if (!args.hasNext()) { args.setState(start); completions.addAll(element.complete(src, args, context)); break; } } catch (ArgumentParseException ignored) { args.setState(start); return element.complete(src, args, context); } } return Lists.newArrayList(completions); }

Target:
public List<String> complete(CommandSource src, CommandArgs args, CommandContext context) { Set<String> completions = Sets.newHashSet(); for (CommandElement element : elements) { Object state = args.getState(); try { element.parse(src, args, context); if (state.equals(args.getState())) { completions.addAll(element.complete(src, args, context)); args.setState(state); } else if (args.hasNext()) { completions.clear(); } else { args.setState(state); completions.addAll(element.complete(src, args, context)); if (!(element instanceof OptionalCommandElement)) { break; } args.setState(state); } } catch (ArgumentParseException ignored) { args.setState(state); completions.addAll(element.complete(src, args, context)); break; } } return Lists.newArrayList(completions); }
Source:
public Throwable rewriteException(Throwable throwable) { if (throwable instanceof FrameTooLargeException || throwable instanceof MessageTooLargeException) { return new PageTooLargeException(); } return throwable; }

Target:
public Throwable rewriteException(Throwable throwable) { if (throwable instanceof MessageTooLargeException) { return new PageTooLargeException(throwable); } return throwable; }
Source:
public Replicas pendingEndpointsFor(Token token, String keyspaceName) { PendingRangeMaps pendingRangeMaps = this.pendingRanges.get(keyspaceName); if (pendingRangeMaps == null) return new ReplicaList(0); return pendingRangeMaps.pendingEndpointsFor(token); }

Target:
public ReplicaCollection pendingEndpointsFor(Token token, String keyspaceName) { PendingRangeMaps pendingRangeMaps = this.pendingRanges.get(keyspaceName); if (pendingRangeMaps == null) return Replicas.empty(); return pendingRangeMaps.pendingEndpointsFor(token); }
Source:
void hash(byte[] raw, int ptr, final int end) throws TableFullException { final boolean text = !RawText.isBinary(raw); hashedCnt = 0; while (ptr < end) { int hash = 5381; int hashedCnt = 0; int start = ptr; do { int c = raw[ptr++] & 0xff; if (text && c == '\r' && ptr < end && raw[ptr] == '\n') continue; hashedCnt++; if (c == '\n') break; hash = (hash << 5) + hash + c; } while (ptr < end && ptr - start < 64); this.hashedCnt += hashedCnt; add(hash, hashedCnt); } }

Target:
void hash(byte[] raw, int ptr, final int end) throws TableFullException { final boolean text = !RawText.isBinary(raw); hashedCnt = 0; while (ptr < end) { int hash = 5381; int blockHashedCnt = 0; int start = ptr; do { int c = raw[ptr++] & 0xff; if (text && c == '\r' && ptr < end && raw[ptr] == '\n') continue; blockHashedCnt++; if (c == '\n') break; hash = (hash << 5) + hash + c; } while (ptr < end && ptr - start < 64); hashedCnt += blockHashedCnt; add(hash, blockHashedCnt); } }
Source:
public Boolean runAsync() { return true; }

Target:
public Boolean runAsync() { return false; }
Source:
private static int calculateCorePoolSize() { int definedSize = Integer.parseInt(System.getProperty("dsa.shared.threadPoolSize", "0")); if (definedSize == 0) { int processors = Runtime.getRuntime().availableProcessors(); if (processors <= 2) { definedSize = 16; } else { definedSize = Math.min(64, processors * 8); } } return definedSize; }

Target:
private static int calculateCorePoolSize() { int definedSize = Integer.parseInt(System.getProperty("dsa.shared.threadPoolSize", "0")); if (definedSize == 0) { int processors = Runtime.getRuntime().availableProcessors(); if (processors <= CORE_POOL_FEW_PROCESSORS_THRESHOLD) { definedSize = MIN_CORE_POOL_SIZE; } else { definedSize = Math.min(MAX_CORE_POOL_SIZE, processors * CORE_POOL_MANY_PROCESSORS_MULTIPLIER); } } return definedSize; }
Source:
private void onPreview() { Snapshot snapshot = getSelectedItem(); if (snapshot == null) { cancel(); return; } VM vm = getEntity(); SnapshotModel snapshotModel = (SnapshotModel) getWindow(); boolean memory = false; List<DiskImage> disks; Set<Guid> diskIds = null; if (snapshotModel.isShowPartialSnapshotWarning()) { switch (snapshotModel.getPartialPreviewSnapshotOptions().getSelectedItem()) { case preserveActiveDisks: disks = snapshotModel.getDisks(); disks.addAll(imagesSubtract(getVmDisks(), disks)); diskIds = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); break; case excludeActiveDisks: break; case openCustomPreviewDialog: setWindow(null); getCustomPreviewCommand().execute(); return; } } if (snapshotModel.isShowMemorySnapshotWarning()) { memory = snapshotModel.getMemory().getEntity(); } runTryBackToAllSnapshotsOfVm(snapshotModel, vm, snapshot, memory, diskIds); }

Target:
private void onPreview() { Snapshot snapshot = getSelectedItem(); if (snapshot == null) { cancel(); return; } VM vm = getEntity(); SnapshotModel snapshotModel = (SnapshotModel) getWindow(); boolean memory = false; List<DiskImage> disks; Set<Guid> diskImageIds = null; if (snapshotModel.isShowPartialSnapshotWarning()) { switch (snapshotModel.getPartialPreviewSnapshotOptions().getSelectedItem()) { case preserveActiveDisks: disks = snapshotModel.getDisks(); disks.addAll(imagesSubtract(getVmDisks(), disks)); diskImageIds = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); break; case excludeActiveDisks: break; case openCustomPreviewDialog: setWindow(null); getCustomPreviewCommand().execute(); return; } } if (snapshotModel.isShowMemorySnapshotWarning()) { memory = snapshotModel.getMemory().getEntity(); } runTryBackToAllSnapshotsOfVm(snapshotModel, vm, snapshot, memory, diskImageIds); }
Source:
public void sendsMessageToBout() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff1"); final Alias alias = user.aliases().iterate().iterator().next(); final long number = alias.inbox().start(); final Bout bout = alias.inbox().bout(number); bout.friends().invite(alias.name()); final RqWithAuth request = new RqWithAuth( urn, new RqMultipart.Fake( TkAttachTest.fake(number), new RqWithHeaders( new Request() { @Override public Iterable<String> head() throws IOException { return new LinkedList<>(); } @Override public InputStream body() throws IOException { return new ByteArrayInputStream( "non-zero".getBytes() ); } }, String.format(TkAttachTest.POST_URL, number), "Content-Disposition: form-data; name=\"file\"; filename=\"some.xml\"", "Content-Type: application/xml", "Content-Length: 8" ) ) ); try { new FkBout(".+", new TkAttach(base)).route(request); } catch (final RsForward response) { MatcherAssert.assertThat( response, new HmRsStatus(HttpURLConnection.HTTP_SEE_OTHER) ); } MatcherAssert.assertThat( bout.messages().iterate().iterator().next().text(), Matchers.containsString("attachment \"some.xml\"") ); }

Target:
public void sendsMessageToBout() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff1"); final Alias alias = user.aliases().iterate().iterator().next(); final long number = alias.inbox().start(); final Bout bout = alias.inbox().bout(number); bout.friends().invite(alias.name()); final RqWithAuth request = new RqWithAuth( urn, new RqMultipart.Fake( TkAttachTest.fake(number), new RqWithHeaders( TkAttachTest.body("non-zero"), String.format(TkAttachTest.POST_URL, number), "Content-Disposition: form-data; name=\"file\"; filename=\"some.xml\"", "Content-Type: application/xml", "Content-Length: 8" ) ) ); try { new FkBout(".+", new TkAttach(base)).route(request); } catch (final RsForward response) { MatcherAssert.assertThat( response, new HmRsStatus(HttpURLConnection.HTTP_SEE_OTHER) ); } MatcherAssert.assertThat( bout.messages().iterate().iterator().next().text(), Matchers.containsString("attachment \"some.xml\"") ); }
Source:
private Model createPomFromManifest(File manifestFile) throws IOException, ModelParseException { Attributes headers = readManifestHeaders(manifestFile); String bundleSymbolicName = getBundleSymbolicName(headers, manifestFile); Model model = createModel(); model.setParent(findParent(manifestFile.getParentFile().getParentFile())); model.setArtifactId(bundleSymbolicName); String bundleVersion = getRequiredHeaderValue("Bundle-Version", headers, manifestFile); model.setVersion(getPomVersion(bundleVersion)); model.setPackaging(getPackagingType(bundleSymbolicName)); setLocation(model, manifestFile); String bundleName = headers.getValue("Bundle-Name"); if (bundleName != null && !bundleName.isEmpty()) { model.setName(bundleName); } else { model.setName(bundleSymbolicName); } String vendorName = headers.getValue("Bundle-Vendor"); if (vendorName != null && !vendorName.isEmpty()) { Organization organization = new Organization(); organization.setName(vendorName); model.setOrganization(organization); } return model; }

Target:
private Model createPomFromManifest(File manifestFile) throws IOException, ModelParseException { Attributes headers = readManifestHeaders(manifestFile); String bundleSymbolicName = getBundleSymbolicName(headers, manifestFile); Model model = createModel(); model.setParent(findParent(manifestFile.getParentFile().getParentFile())); model.setArtifactId(bundleSymbolicName); String bundleVersion = getRequiredHeaderValue("Bundle-Version", headers, manifestFile); model.setVersion(getPomVersion(bundleVersion)); model.setPackaging(getPackagingType(bundleSymbolicName)); setLocation(model, manifestFile); String bundleName = getManifestAttributeValue(headers, "Bundle-Name", manifestFile); if (bundleName != null) { model.setName(bundleName); } else { model.setName(bundleSymbolicName); } String vendorName = getManifestAttributeValue(headers, "Bundle-Vendor", manifestFile); if (vendorName != null) { Organization organization = new Organization(); organization.setName(vendorName); model.setOrganization(organization); } return model; }
Source:
public static void handleIoTune(VmDevice vmDevice, Guid diskProfileId, QosCache cache) { if (cache == null) { cache = new QosCache(); } Map<String, Long> ioTune = buildIoTune(diskProfileId, cache); if (ioTune == null) { return; } if (vmDevice.getSpecParams() == null) { vmDevice.setSpecParams(new HashMap<>()); } vmDevice.getSpecParams().put(VdsProperties.Iotune, ioTune); }

Target:
public static void handleIoTune(VmDevice vmDevice, Guid diskProfileId, QosCache cache) { Map<String, Long> ioTune = buildIoTune(diskProfileId, cache); if (ioTune == null) { return; } if (vmDevice.getSpecParams() == null) { vmDevice.setSpecParams(new HashMap<>()); } vmDevice.getSpecParams().put(VdsProperties.Iotune, ioTune); }