auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void OnInstall() { InstallModel model = (InstallModel) getWindow(); boolean isOVirt = getEntity().getVdsType() == VDSType.oVirtNode; if (!model.Validate(isOVirt)) { return; } UpdateVdsActionParameters param = new UpdateVdsActionParameters(); param.setvds(getEntity()); param.setVdsId(getEntity().getId()); param.setRootPassword((String) model.getRootPassword().getEntity()); param.setIsReinstallOrUpgrade(true); param.setInstallVds(true); param.setoVirtIsoFile(isOVirt ? ((RpmVersion) model.getOVirtISO().getSelectedItem()).getRpmName() : null); param.setOverrideFirewall((Boolean) model.getOverrideIpTables().getEntity()); param.setRebootAfterInstallation(isOVirt); Frontend.RunAction( VdcActionType.UpdateVds, param, new IFrontendActionAsyncCallback() { @Override public void Executed(FrontendActionAsyncResult result) { VdcReturnValueBase returnValue = result.getReturnValue(); if (returnValue != null && returnValue.getSucceeded()) { Cancel(); } } } ); }

Target:
public void OnInstall() { InstallModel model = (InstallModel) getWindow(); final boolean isOVirt = getEntity().getVdsType() == VDSType.oVirtNode; if (!model.Validate(isOVirt)) { return; } UpdateVdsActionParameters param = new UpdateVdsActionParameters(); param.setvds(getEntity()); param.setVdsId(getEntity().getId()); param.setRootPassword((String) model.getRootPassword().getEntity()); param.setIsReinstallOrUpgrade(true); param.setInstallVds(true); param.setoVirtIsoFile(isOVirt ? ((RpmVersion) model.getOVirtISO().getSelectedItem()).getRpmName() : null); param.setOverrideFirewall((Boolean) model.getOverrideIpTables().getEntity()); param.setRebootAfterInstallation(isOVirt); Frontend.RunAction( VdcActionType.UpdateVds, param, new IFrontendActionAsyncCallback() { @Override public void Executed(FrontendActionAsyncResult result) { VdcReturnValueBase returnValue = result.getReturnValue(); if (returnValue != null && returnValue.getSucceeded()) { Cancel(); } } } ); }
Source:
private String getPassword() { String password = null; String passwordType = (String)actionArgs.get("password"); if(passwordType.startsWith("interactive")) { System.out.print("Please enter password: "); password = System.console().readLine(); } else if(passwordType.startsWith("pass:")) { password = passwordType.substring(5); } else if(passwordType.startsWith("env:")) { password = System.getenv(passwordType.substring(4)); } else if(passwordType.startsWith("file:")) { try { try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(passwordType.substring(5)), Charset.forName("UTF-8")))) { password = reader.readLine(); } } catch (IOException ex) { throw new RuntimeException(ex); } } else { throw new RuntimeException(String.format("Unknown file type: '%1$s'", passwordType)); } return password; }

Target:
private String getPassword() { String password = null; String passwordType = (String)actionArgs.get("password"); if(passwordType.startsWith("interactive")) { System.out.print("Please enter password: "); password = System.console().readLine(); } else if(passwordType.startsWith("pass:")) { password = passwordType.substring(5); } else if(passwordType.startsWith("env:")) { password = System.getenv(passwordType.substring(4)); } else if(passwordType.startsWith("file:")) { try( InputStream is = new FileInputStream(passwordType.substring(5)); Reader reader = new InputStreamReader(is, Charset.forName("UTF-8")); BufferedReader br = new BufferedReader(reader) ) { password = br.readLine(); } catch (IOException ex) { throw new RuntimeException(ex); } } else { throw new RuntimeException(String.format("Unknown file type: '%1$s'", passwordType)); } return password; }
Source:
public ReplTxnWork(String replPolicy, String dbName, String tableName, Long txnId, OperationType type, ReplicationSpec replicationSpec) { this(replPolicy, dbName, tableName, Lists.newArrayList(txnId), type, null, replicationSpec); }

Target:
public ReplTxnWork(String replPolicy, String dbName, String tableName, Long txnId, OperationType type, ReplicationSpec replicationSpec) { this(replPolicy, dbName, tableName, Collections.singletonList(txnId), type, null, replicationSpec); }
Source:
public void testMultipartChunkedFilenames() throws InterruptedException, IOException { String containerName = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); String objectName = "file.txt"; long countBefore = blobStore.countBlobs(containerName); File fileToUpload = createFileExactly(PART_SIZE * 11, objectName); addMultipartBlobToContainer(containerName, objectName, fileToUpload); long countAfter = blobStore.countBlobs(containerName); assertNotEquals(countBefore, countAfter, "No blob was created"); assertTrue(countAfter - countBefore > 1, "A multipart blob wasn't actually created - " + "there was only 1 extra blob but there should be one manifest blob and multiple chunk blobs"); assertEquals(countBefore + 12, countAfter, "12 parts (11 objects + 1 manifest) were expected."); Blob read = blobStore.getBlob(containerName, objectName); File outFile = new File("target", "file-read.txt"); ByteStreams.copy(read.getPayload(), Files.asByteSink(outFile)); HashCode expectedHashCode = Files.hash(fileToUpload, Hashing.md5()); HashCode actualHashCode = Files.hash(outFile, Hashing.md5()); assertEquals(actualHashCode, expectedHashCode); } finally { returnContainer(containerName); } }

Target:
public void testMultipartChunkedFilenames() throws InterruptedException, IOException { String containerName = getContainerName(); try { BlobStore blobStore = view.getBlobStore(); String objectName = "object.txt"; long countBefore = blobStore.countBlobs(containerName); ByteSource inputSource = createByteSource(PART_SIZE * 11); addMultipartBlobToContainer(containerName, objectName, inputSource); long countAfter = blobStore.countBlobs(containerName); assertNotEquals(countAfter, countBefore, "No blob was created"); assertEquals(countAfter, countBefore + 12, "12 parts (11 objects + 1 manifest) were expected."); Blob read = blobStore.getBlob(containerName, objectName); Payload readPayload = read.getPayload(); assertTrue(inputSource.contentEquals(ByteSources.asByteSource(readPayload.openStream()))); } finally { returnContainer(containerName); } }
Source:
public <T> T lockProjectSecret(int projectId, String scope, String key, SecretLockAction<T> action) { EncryptedSecret secret = dao.lockProjectSecret(siteId, projectId, scope, key); Optional<String> value; if (secret == null) { value = Optional.absent(); } else { if (!crypto.getName().equals(secret.engine)) { throw new AssertionError("Crypto engine mismatch"); } String decrypted = crypto.decryptSecret(secret.value); value = Optional.of(decrypted); } return action.call(this, value); }

Target:
public <T> T lockProjectSecret(int projectId, String scope, String key, SecretLockAction<T> action) { EncryptedSecret secret = dao.lockProjectSecret(siteId, projectId, scope, key); Optional<String> value; if (secret == null) { value = Optional.absent(); } else { if (!crypto.getName().equals(secret.engine)) { throw new AssertionError(String.format(ENGLISH, "Crypto engine mismatch. Expected '%s' but got '%s'", secret.engine, crypto.getName())); } String decrypted = crypto.decryptSecret(secret.value); value = Optional.of(decrypted); } return action.call(this, value); }
Source:
private OperationType getOperationType(byte opCode) { switch (opCode) { case BookieProtocol.ADDENTRY: return OperationType.ADD_ENTRY; case BookieProtocol.READENTRY: return OperationType.READ_ENTRY; case BookieProtocol.AUTH: return OperationType.AUTH; case BookieProtocol.READ_LAC: return OperationType.READ_LAC; case BookieProtocol.WRITE_LAC: return OperationType.WRITE_LAC; case BookieProtocol.GET_BOOKIE_INFO: return OperationType.GET_BOOKIE_INFO; default: throw new IllegalArgumentException("Invalid operation type"); } }

Target:
private static OperationType getOperationType(byte opCode) { switch (opCode) { case BookieProtocol.ADDENTRY: return OperationType.ADD_ENTRY; case BookieProtocol.READENTRY: return OperationType.READ_ENTRY; case BookieProtocol.AUTH: return OperationType.AUTH; case BookieProtocol.READ_LAC: return OperationType.READ_LAC; case BookieProtocol.WRITE_LAC: return OperationType.WRITE_LAC; case BookieProtocol.GET_BOOKIE_INFO: return OperationType.GET_BOOKIE_INFO; default: throw new IllegalArgumentException("Invalid operation type " + opCode); } }
Source:
private boolean isDateValid(final DateTime issueInstant, final int interval) { final DateTime before = DateTime.now().plusSeconds(acceptedSkew); final DateTime after = DateTime.now().minusSeconds(acceptedSkew + interval); boolean isDateValid = issueInstant.isBefore(before) && issueInstant.isAfter(after); if (logger.isTraceEnabled() && !isDateValid) { logger.trace("interval=" + interval + ",before=" + before.toDateTime(issueInstant.getZone()) + ",after=" + after.toDateTime(issueInstant.getZone()) + ",issueInstant=" + issueInstant); } return isDateValid; }

Target:
private boolean isDateValid(final DateTime issueInstant, final int interval) { final DateTime before = DateTime.now().plusSeconds(acceptedSkew); final DateTime after = DateTime.now().minusSeconds(acceptedSkew + interval); boolean isDateValid = issueInstant.isBefore(before) && issueInstant.isAfter(after); if (!isDateValid) { logger.trace("interval={},before={},after={},issueInstant={}", interval, before.toDateTime(issueInstant.getZone()), after.toDateTime(issueInstant.getZone()), issueInstant); } return isDateValid; }
Source:
public void ensureAtLeastNPeriods(int n) { synchronized (this) { while (periods.size() < n) { PeriodStatsModel psm = new DefaultPeriodStatsModel(periods.size() + 1); psm.addScoreBoardListener(this); periods.add(psm); } } }

Target:
public synchronized void ensureAtLeastNPeriods(int n) { while (periods.size() < n) { PeriodStatsModel psm = new DefaultPeriodStatsModel(periods.size() + 1); psm.addScoreBoardListener(this); periods.add(psm); } }
Source:
public boolean canLogAtLevel(LogLevel logLevel) { loadSystemLogLevel(); return canLogAtLevel(logLevel, rootLogLevel); }

Target:
public boolean canLogAtLevel(LogLevel logLevel) { LogLevel rootLogLevel = loadSystemLogLevel(); return canLogAtLevel(logLevel, rootLogLevel); }
Source:
private void validateQosNotPartiallyConfigured() { Set<String> someSubInterfacesHaveQos = new HashSet<>(); Set<String> notAllSubInterfacesHaveQos = new HashSet<>(); for (VdsNetworkInterface iface : params.getInterfaces()) { String networkName = iface.getNetworkName(); Network network = getExistingClusterNetworks().get(networkName); NetworkAttachment networkAttachment = getNetworkAttachment(iface, network); String baseIfaceName = NetworkUtils.stripVlan(iface); if (network != null) { if (NetworkUtils.qosConfiguredOnInterface(networkAttachment, network)) { someSubInterfacesHaveQos.add(baseIfaceName); } else { notAllSubInterfacesHaveQos.add(baseIfaceName); } } } for (String ifaceName : someSubInterfacesHaveQos) { if (notAllSubInterfacesHaveQos.contains(ifaceName)) { addViolation(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_QOS_INTERFACES_WITHOUT_QOS, ifaceName); } } }

Target:
private void validateQosNotPartiallyConfigured() { Set<String> someSubInterfacesHaveQos = new HashSet<>(); Set<String> notAllSubInterfacesHaveQos = new HashSet<>(); for (VdsNetworkInterface iface : params.getInterfaces()) { String networkName = iface.getNetworkName(); Network network = getExistingClusterNetworks().get(networkName); if (network != null) { NetworkAttachment networkAttachment = getNetworkAttachment(iface, network); String baseIfaceName = NetworkUtils.stripVlan(iface); if (NetworkUtils.qosConfiguredOnInterface(networkAttachment, network)) { someSubInterfacesHaveQos.add(baseIfaceName); } else { notAllSubInterfacesHaveQos.add(baseIfaceName); } } } for (String ifaceName : someSubInterfacesHaveQos) { if (notAllSubInterfacesHaveQos.contains(ifaceName)) { addViolation(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_QOS_INTERFACES_WITHOUT_QOS, ifaceName); } } }
Source:
static <T> Stream<T> of(T... elements) { Objects.requireNonNull(elements, "elements is null"); return Stream.ofAll(new Iterator<T>() { int i = 0; @Override public boolean hasNext() { return i < elements.length; } @Override public T next() { if (i >= elements.length) { throw new NoSuchElementException(); } return elements[i++]; } }); }

Target:
static <T> Stream<T> of(T... elements) { Objects.requireNonNull(elements, "elements is null"); return Stream.ofAll(new Iterator<T>() { int i = 0; @Override public boolean hasNext() { return i < elements.length; } @Override public T next() { return elements[i++]; } }); }
Source:
public void jobCompleted(JobInstance job) { AgentInstance agentInstance = agentService.findAgent(job.getAgentUuid()); if (!agentInstance.isElastic()) { LOGGER.debug("Agent is not elastic. Skipping further execution.", agentInstance.getUuid()); return; } if (job.isAssignedToAgent()) { jobCreationTimeMap.remove(job.getId()); } String pluginId = agentInstance.elasticAgentMetadata().elasticPluginId(); String elasticAgentId = agentInstance.elasticAgentMetadata().elasticAgentId(); ElasticProfile elasticProfile = job.getPlan().getElasticProfile(); ClusterProfile clusterProfile = job.getPlan().getClusterProfile(); secretParamResolver.resolve(elasticProfile); Map<String, String> elasticProfileConfiguration = elasticProfile.getConfigurationAsMap(true, true); Map<String, String> clusterProfileConfiguration = emptyMap(); if (clusterProfile != null) { secretParamResolver.resolve(clusterProfile); clusterProfileConfiguration = clusterProfile.getConfigurationAsMap(true, true); } elasticAgentPluginRegistry.reportJobCompletion(pluginId, elasticAgentId, job.getIdentifier(), elasticProfileConfiguration, clusterProfileConfiguration); }

Target:
public void jobCompleted(JobInstance job) { AgentInstance agentInstance = agentService.findAgent(job.getAgentUuid()); if (!agentInstance.isElastic()) { LOGGER.debug("Agent is not elastic. Skipping further execution.", agentInstance.getUuid()); return; } if (job.isAssignedToAgent()) { jobCreationTimeMap.remove(job.getId()); } String pluginId = agentInstance.elasticAgentMetadata().elasticPluginId(); String elasticAgentId = agentInstance.elasticAgentMetadata().elasticAgentId(); JobIdentifier jobIdentifier = job.getIdentifier(); ElasticProfile elasticProfile = job.getPlan().getElasticProfile(); ClusterProfile clusterProfile = job.getPlan().getClusterProfile(); try { secretParamResolver.resolve(elasticProfile); Map<String, String> elasticProfileConfiguration = elasticProfile.getConfigurationAsMap(true, true); Map<String, String> clusterProfileConfiguration = emptyMap(); if (clusterProfile != null) { secretParamResolver.resolve(clusterProfile); clusterProfileConfiguration = clusterProfile.getConfigurationAsMap(true, true); } elasticAgentPluginRegistry.reportJobCompletion(pluginId, elasticAgentId, jobIdentifier, elasticProfileConfiguration, clusterProfileConfiguration); } catch (RulesViolationException | SecretResolutionFailureException e) { String description = format("The job completion call to the plugin for the job identifier [%s] failed for secrets resolution: %s ", jobIdentifier.toString(), e.getMessage()); ServerHealthState healthState = error("Failed to notify plugin", description, general(scopeForJob(jobIdentifier))); healthState.setTimeout(Timeout.FIVE_MINUTES); serverHealthService.update(healthState); LOGGER.error(description); } }
Source:
public static JdbcTableDefinitionBuilder like(JdbcTableDefinition tableDefinition) { JdbcTableDefinitionBuilder builder = new JdbcTableDefinitionBuilder(tableDefinition.getName()) .setCreateTableDDLTemplate(tableDefinition.createTableDDLTemplate) .setDataSource(tableDefinition.getDataSource()); if (tableDefinition.getSchema().isPresent()) { builder.withSchema(tableDefinition.getSchema().get()); } if (tableDefinition.getTableHandle().getShouldCreateSchema()) { builder.shouldNotCreateSchema(); } return builder; }

Target:
public static JdbcTableDefinitionBuilder like(JdbcTableDefinition tableDefinition) { JdbcTableDefinitionBuilder builder = new JdbcTableDefinitionBuilder(tableDefinition.getName()) .setCreateTableDDLTemplate(tableDefinition.createTableDDLTemplate) .setDataSource(tableDefinition.getDataSource()); if (tableDefinition.getSchema().isPresent()) { builder.withSchema(tableDefinition.getSchema().get()); } return builder; }
Source:
public boolean applyFWRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException { if (rules.size() == 1 && rules.iterator().next().getType().equals(FirewallRuleType.System)) { s_logger.debug("Default ACL added by CS as system is ignored for network " + network.getName() + " with rule " + rules); return true; } if (rules.isEmpty()) { return true; } s_logger.debug("Handling applyFWRules for network " + network.getName() + " with " + rules.size() + " FWRules"); return applyACLRules(network, rules, false, rules.iterator().next().getTrafficType().equals(FirewallRule.TrafficType.Ingress), false); }

Target:
public boolean applyFWRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { return true; } if (rules.size() == 1 && rules.iterator().next().getType().equals(FirewallRuleType.System)) { if (s_logger.isDebugEnabled()) { s_logger.debug("Default ACL added by CS as system is ignored for network " + network.getName() + " with rule " + rules); } return true; } s_logger.info("Applying " + rules.size() + " Firewall Rules for network " + network.getName()); return applyACLRules(network, rules, false, rules.iterator().next().getTrafficType().equals(FirewallRule.TrafficType.Ingress), false); }
Source:
public <K, V> List<Map.Entry<Integer, Map.Entry<K, V>>> asAnchorList(SerializationService serializationService) { List<Map.Entry<Integer, Map.Entry<K, V>>> anchorObjectList = new ArrayList<>(anchorDataList.size()); Iterator<Map.Entry<Data, Data>> dataEntryIterator = anchorDataList.iterator(); for (Iterator<Integer> pageNumberIt = anchorPageList.iterator(); pageNumberIt.hasNext(); ) { Integer pageNumber = pageNumberIt.next(); Map.Entry<Data, Data> dataEntry = dataEntryIterator.next(); K key = serializationService.toObject(dataEntry.getKey()); V value = serializationService.toObject(dataEntry.getValue()); AbstractMap.SimpleImmutableEntry<K, V> entry = new AbstractMap.SimpleImmutableEntry<>(key, value); anchorObjectList.add(new AbstractMap.SimpleImmutableEntry<>(pageNumber, entry)); } return anchorObjectList; }

Target:
public <K, V> List<Map.Entry<Integer, Map.Entry<K, V>>> asAnchorList(SerializationService serializationService) { List<Map.Entry<Integer, Map.Entry<K, V>>> anchorObjectList = new ArrayList<>(anchorDataList.size()); Iterator<Map.Entry<Data, Data>> dataEntryIterator = anchorDataList.iterator(); for (Integer pageNumber : anchorPageList) { Map.Entry<Data, Data> dataEntry = dataEntryIterator.next(); K key = serializationService.toObject(dataEntry.getKey()); V value = serializationService.toObject(dataEntry.getValue()); AbstractMap.SimpleImmutableEntry<K, V> entry = new AbstractMap.SimpleImmutableEntry<>(key, value); anchorObjectList.add(new AbstractMap.SimpleImmutableEntry<>(pageNumber, entry)); } return anchorObjectList; }
Source:
public static DatadogClient getInstance(String url, String logIntakeUrl, Secret apiKey){ if (lastInstance != null && (StringUtils.equals(lastInstance.getLogIntakeUrl(), logIntakeUrl)) && (StringUtils.equals(lastInstance.getUrl(), url) && ((lastInstance.getApiKey() == null && apiKey == null) || lastInstance.getApiKey().equals(apiKey)))){ return instance; } else { DatadogHttpClient.lastInstance = new DatadogHttpClient(url, logIntakeUrl, apiKey); if (enableValidations) { try { validateCongiguration(url, logIntakeUrl, apiKey); } catch(Exception e){ logger.severe(e.getMessage()); return null; } } instance = lastInstance; return instance; } }

Target:
public static DatadogClient getInstance(String url, String logIntakeUrl, Secret apiKey){ DatadogHttpClient newInstance = new DatadogHttpClient(url, logIntakeUrl, apiKey); if (instance != null && instance.equals(newInstance)) { if (DatadogHttpClient.failedLastValidation) { return null; } return instance; } if (enableValidations) { synchronized (DatadogHttpClient.class) { DatadogHttpClient.instance = newInstance; try { newInstance.validateConfiguration(); } catch(IllegalArgumentException e){ logger.severe(e.getMessage()); DatadogHttpClient.failedLastValidation = true; return null; } } } return newInstance; }
Source:
public static RemoveAddress of(final Address address) { if (address.getId() == null) { throw new IllegalArgumentException(format("The address %s should have an id.", address)); } return of(address.getId(), address.getKey()); }

Target:
public static RemoveAddress of(final Address address) { if (address.getId() == null && address.getKey() == null) { throw new IllegalArgumentException(format("The address %s should have an id or a key.", address)); } if (address.getId() != null) { return of(address.getId()); } else { return ofKey(address.getKey()); } }
Source:
public void createALC() { int numRetriesRemaining = 4; int retryDelayMsec = 100; while (true) { try { AL.create(); break; } catch (LWJGLException exception1) { if (numRetriesRemaining < 1) { throw new RuntimeException(exception1); } --numRetriesRemaining; System.out.printf("Caught an LWJGLException from AL.create(). " + "Will retry after %d msec, " + "with %d more retr%s remaining.%n", retryDelayMsec, numRetriesRemaining, (numRetriesRemaining == 1) ? "y" : "ies"); try { Thread.sleep(retryDelayMsec); } catch (InterruptedException exception2) { } retryDelayMsec *= 3; } } }

Target:
public void createALC() { int numRetriesRemaining = 4; int retryDelayMsec = 100; while (true) { try { AL.create(); break; } catch (LWJGLException exception1) { if (numRetriesRemaining < 1) { throw new RuntimeException(exception1); } --numRetriesRemaining; String message = String.format( "Caught an LWJGLException from AL.create(). " + "Will retry after %d msec, " + "with %d more retr%s remaining.%n", retryDelayMsec, numRetriesRemaining, (numRetriesRemaining == 1) ? "y" : "ies"); logger.log(Level.WARNING, message); try { Thread.sleep(retryDelayMsec); } catch (InterruptedException exception2) { } } } }
Source:
public void onNext(final AvroElasticMemoryMessage msg) { LOG.log(Level.INFO, "Received new Evaluators Deleted {0}.", msg); if (executingPlan == null) { throw new RuntimeException("Evaluators deleted " + msg + " received, but no executingPlan available."); } executingPlan.onDeleted(); }

Target:
public void onNext(final AvroElasticMemoryMessage msg) { LOG.log(Level.INFO, "Received new Evaluators Deleted {0}", msg); if (msg.getResultMsg().getResult() == Result.FAILURE) { LOG.log(Level.WARNING, "Evaluator delete failed for evaluator {0}", msg.getSrcId()); } if (executingPlan == null) { throw new RuntimeException("Evaluators deleted " + msg + " received, but no executingPlan available."); } executingPlan.onDeleted(); }
Source:
public void clearTaskChangeTimes(LocalDateTime untilLocalDateTime) { if (untilLocalDateTime != null) { final List<Long> removableChanges = taskChangeTimes.entrySet().stream() .filter(entry -> untilLocalDateTime.compareTo(entry.getValue()) > 0) .map(Map.Entry::getKey) .collect(Collectors.toList()); removableChanges.forEach(removableChange -> taskChangeTimes.remove(removableChange)); } }

Target:
public void clearTaskChangeTimes(LocalDateTime untilLocalDateTime) { if (untilLocalDateTime != null) { taskChangeTimes.entrySet().stream() .filter(entry -> untilLocalDateTime.compareTo(entry.getValue()) > 0) .map(Map.Entry::getKey) .collect(Collectors.toList()) .forEach(removableChange -> taskChangeTimes.remove(removableChange)); } }
Source:
public Collection<Referenceable> getEntities(String type, Map<String, Object> attributes) throws AtlasException { log.debug("Getting entity with type and attributes [{}]", type, attributes); checkAttributes(attributes); if (attributes.isEmpty()) { return getEntities(type); } List<Referenceable> referenceables = new ArrayList<>(); List<String> entityGuids = metadataService.getEntityList(type); Set<Map.Entry<String, Object>> attributesSet = attributes.entrySet(); for (String entityGuid : entityGuids) { Referenceable entity = getEntity(entityGuid); Set<Map.Entry<String, Object>> entityValuesSet = entity.getValuesMap().entrySet(); if (containsAll(attributesSet, entityValuesSet)) { referenceables.add(entity); } } return referenceables; }

Target:
public Collection<Referenceable> getEntities(String type, Map<String, Object> attributes) throws AtlasException { LOG.debug("Getting entity with type and attributes [{}]", type, attributes); checkAttributes(attributes); Collection<Referenceable> referenceables = null; if (attributes.isEmpty()) { referenceables = getEntities(type); } else { referenceables = new ArrayList<>(); List<String> entityGuids = metadataService.getEntityList(type); Set<Map.Entry<String, Object>> attributesSet = attributes.entrySet(); for (String entityGuid : entityGuids) { Referenceable entity = getEntity(entityGuid); Set<Map.Entry<String, Object>> entityValuesSet = entity.getValuesMap().entrySet(); if (containsAll(attributesSet, entityValuesSet)) { referenceables.add(entity); } } } return referenceables; }
Source:
public static InformationItem wbFromDMN(final org.kie.dmn.model.v1_1.InformationItem dmn) { if (dmn == null) { return null; } Id id = new Id(dmn.getId()); Description description = new Description(dmn.getDescription()); Name name = new Name(dmn.getName()); QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef()); InformationItem result = new InformationItem(id, description, name, typeRef); return result; }

Target:
public static InformationItem wbFromDMN(final org.kie.dmn.model.v1_1.InformationItem dmn) { if (dmn == null) { return null; } Id id = new Id(dmn.getId()); Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription()); Name name = new Name(dmn.getName()); QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef()); InformationItem result = new InformationItem(id, description, name, typeRef); return result; }
Source:
public int area() { return Math.abs((maxY - minY) * (maxY - minY)); }

Target:
public int area() { return (maxY - minY) * (maxY - minY); }
Source:
private List<TypeElement> fetchSuperinterfaces(TypeElement baseInterface) { List<TypeMirror> interfacesQueue = new ArrayList<>(baseInterface.getInterfaces()); Set<TypeMirror> interfacesSet = Sets.newHashSet(interfacesQueue); List<TypeElement> superInterfaceElements = new ArrayList<>(); for (int i = 0; i < interfacesQueue.size(); i++) { TypeMirror superInterfaceMirror = interfacesQueue.get(i); TypeElement superInterfaceType = ProcessorUtils.extractType(typeUtils, superInterfaceMirror); superInterfaceElements.add(superInterfaceType); List<TypeMirror> newInterfaces = superInterfaceType.getInterfaces() .stream() .filter((newInteface) -> !interfacesSet.contains(newInteface)) .collect(Collectors.toList()); interfacesSet.addAll(newInterfaces); interfacesQueue.addAll(newInterfaces); } return superInterfaceElements; }

Target:
private List<TypeElement> fetchSuperinterfaces(TypeElement baseInterface) { List<TypeMirror> interfacesQueue = new ArrayList<>(baseInterface.getInterfaces()); Set<TypeMirror> interfacesSet = Sets.newHashSet(interfacesQueue); List<TypeElement> superinterfaceElements = new ArrayList<>(); for (int i = 0; i < interfacesQueue.size(); i++) { TypeMirror superinterfaceMirror = interfacesQueue.get(i); TypeElement superinterfaceType = ProcessorUtils.extractType(typeUtils, superinterfaceMirror); superinterfaceElements.add(superinterfaceType); List<TypeMirror> newInterfaces = superinterfaceType.getInterfaces() .stream() .filter((newInteface) -> !interfacesSet.contains(newInteface)) .collect(Collectors.toList()); interfacesSet.addAll(newInterfaces); interfacesQueue.addAll(newInterfaces); } return superinterfaceElements; }
Source:
public boolean isFinished() { return finishing && inputPage == null && unfinishedWork == null; }

Target:
public boolean isFinished() { return finishing && !hasUnfinishedInput(); }
Source:
public void testSimpleOutput() throws IOException { final MarkupToXslfoTask task; task = new MarkupToXslfoTask(); task.setMarkupLanguage(languageName); File markup = createSimpleTextileMarkup(); task.setFile(markup); task.execute(); File targetFile = new File(markup.getParentFile(), "simple.fo"); assertTrue(targetFile.exists() && targetFile.isFile()); String content = getContent(targetFile); assertTrue(content.contains("<root xmlns=\"<LINK_0>\"")); assertTrue(content.contains("</root>")); assertTrue(content.contains(">simple</block>")); assertTrue(content.contains(" id=\"FirstHeading\">First Heading</block>")); assertTrue(content.contains(" id=\"SecondHeading\">Second Heading</block>")); }

Target:
public void testSimpleOutput() throws IOException { File markup = createSimpleTextileMarkup(); task.setFile(markup); task.execute(); File targetFile = new File(markup.getParentFile(), "simple.fo"); assertTrue(targetFile.exists() && targetFile.isFile()); String content = getContent(targetFile); assertTrue(content.contains("<root xmlns=\"<LINK_0>\"")); assertTrue(content.contains("</root>")); assertTrue(content.contains(">simple</block>")); assertTrue(content.contains(" id=\"FirstHeading\">First Heading</block>")); assertTrue(content.contains(" id=\"SecondHeading\">Second Heading</block>")); }
Source:
public void notifyTimeout(DCCppMessage msg) { log.debug("Notified of timeout on message '{}'", msg.toString()); }

Target:
public void notifyTimeout(DCCppMessage msg) { log.debug("Notified of timeout on message '{}'", msg); }
Source:
private static boolean stopPreviousDevInstance() { if (!isDevelopmentModeSafe() || ERXProperties.booleanForKeyWithDefault("er.extensions.ERXApplication.allowMultipleDevInstances", false)) { return false; } String appUrl; if (!(application().wasMainInvoked())) { return false; } else if (application().isDirectConnectEnabled()) { appUrl = application().cgiAdaptorURL().replace("/cgi", ":" + application().port() + "/cgi"); appUrl += "/" + application().name() + ".woa"; } else { appUrl = application().cgiAdaptorURL() + "/" + application().name() + ".woa/-" + application().port(); } URL url; try { appUrl = appUrl + "/" + application().directActionRequestHandlerKey() + "/stop"; url = new URL(appUrl); log.debug("Stopping previously running instance of " + application().name()); URLConnection connection = url.openConnection(); connection.getContent(); Thread.sleep(2000); return true; } catch (Throwable e) { e.printStackTrace(); } return false; }

Target:
private static boolean stopPreviousDevInstance() { if (!isDevelopmentModeSafe() || ERXProperties.booleanForKeyWithDefault("er.extensions.ERXApplication.allowMultipleDevInstances", false)) { return false; } if (!(application().wasMainInvoked())) { return false; } String adapterUrl; if (application().host() != null) { adapterUrl = application().cgiAdaptorURL(); } else { adapterUrl = application().cgiAdaptorURL().replace("://null/", "://localhost/"); } String appUrl; if (application().isDirectConnectEnabled()) { appUrl = adapterUrl.replace("/cgi", ":" + application().port() + "/cgi"); appUrl += "/" + application().name() + ".woa"; } else { appUrl = adapterUrl + "/" + application().name() + ".woa/-" + application().port(); } URL url; try { appUrl = appUrl + "/" + application().directActionRequestHandlerKey() + "/stop"; url = new URL(appUrl); log.debug("Stopping previously running instance of " + application().name()); URLConnection connection = url.openConnection(); connection.getContent(); Thread.sleep(2000); return true; } catch (Throwable e) { e.printStackTrace(); } return false; }
Source:
private void copyViaHttp(Folder f, JenkinsRule.WebClient wc, String fromName, String toName) throws Exception { r.jenkins.setCrumbIssuer(null); URL apiURL = new URL(MessageFormat.format( "{0}createItem?mode=copy&from={1}&name={2}", r.jenkins.getRootUrl() + "/" + f.getUrl().toString(), fromName, toName)); WebRequest request = new WebRequest(apiURL, HttpMethod.POST); request.setEncodingType(null); assertTrue("Copy Job request has failed", 200 == r.createWebClient() .getPage(request).getWebResponse().getStatusCode()); }

Target:
private void copyViaHttp(Folder f, JenkinsRule.WebClient wc, String fromName, String toName) throws Exception { r.jenkins.setCrumbIssuer(null); URL apiURL = new URL( r.jenkins.getRootUrl().toString() + "/" + f.getUrl().toString() + "createItem?mode=copy&from=" + URLEncoder.encode(fromName, "UTF-8") + "&name=" + URLEncoder.encode(toName, "UTF-8")); WebRequest request = new WebRequest(apiURL, HttpMethod.POST); request.setEncodingType(null); assertTrue("Copy Job request has failed", 200 == r.createWebClient() .getPage(request).getWebResponse().getStatusCode()); }
Source:
public void test() throws Exception { doInJPA( this::entityManagerFactory, entityManager -> { final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); final CriteriaQuery<Object[]> query = cb.createQuery( Object[].class ); final Root<Book> entity = query.from( Book.class ); query.multiselect( entity.get( "id" ).alias( "id" ), entity.get( "name" ).alias( "name" ) ); List<BookDto> dtos = entityManager.createQuery( query ) .unwrap( Query.class ) .setResultTransformer( Transformers.aliasToBean( BookDto.class ) ) .getResultList(); assertEquals( 1, dtos.size() ); BookDto dto = dtos.get( 0 ); assertEquals( 1, (int) dto.getId() ); assertEquals( bookName(), dto.getName() ); } ); }

Target:
public void test() { doInJPA( this::entityManagerFactory, entityManager -> { final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); final CriteriaQuery<Object[]> query = cb.createQuery( Object[].class ); final Root<Book> entity = query.from( Book.class ); query.multiselect( entity.get( "id" ).alias( "id" ), entity.get( "name" ).alias( "title" ) ); List<BookDto> dtos = entityManager.createQuery( query ) .unwrap( Query.class ) .setResultTransformer( Transformers.aliasToBean( BookDto.class ) ) .getResultList(); assertEquals( 1, dtos.size() ); BookDto dto = dtos.get( 0 ); assertEquals( 1, (int) dto.getId() ); assertEquals( bookName(), dto.getTitle() ); } ); }
Source:
private boolean checkRowNotExpired(List<Cell> cellList) throws IOException { long cellListSize = cellList.size(); Cell cell = null; if (cellListSize == 0) { return true; } Iterator<Cell> cellIterator = cellList.iterator(); while (cellIterator.hasNext()) { cell = cellIterator.next(); if (isEmptyColumn(cell)) { LOG.debug(String.format("** PHOENIX-TTL: Row expired for [%s], expired = %s **", cell.toString(), isTTLExpired(cell))); if (cellListSize > 1) { cellIterator.remove(); } return !isTTLExpired(cell); } } byte[] rowKey = new byte[cell.getRowLength()]; System.arraycopy(cell.getRowArray(), cell.getRowOffset(), rowKey, 0, cell.getRowLength()); return checkEmptyColumnNotExpired(rowKey); }

Target:
private boolean checkRowNotExpired(List<Cell> cellList) throws IOException { long cellListSize = cellList.size(); Cell cell = null; if (cellListSize == 0) { return true; } Iterator<Cell> cellIterator = cellList.iterator(); while (cellIterator.hasNext()) { cell = cellIterator.next(); if (ScanUtil.isEmptyColumn(cell, this.emptyCF, this.emptyCQ)) { LOG.trace(String.format("** PHOENIX-TTL: Row expired for [%s], expired = %s **", cell.toString(), ScanUtil.isTTLExpired(cell, this.scan, this.now))); if (cellListSize > 1) { cellIterator.remove(); } return !ScanUtil.isTTLExpired(cell, this.scan, this.now); } } LOG.warn("The empty column does not exist in a row in " + region.getRegionInfo() .getTable().getNameAsString()); return true; }
Source:
private void checkMissingQueues(String[] queueNames) { if (isMissingQueuesFatal()) { RabbitAdmin checkAdmin = new RabbitAdmin(getConnectionFactory()); for (String queue : queueNames) { Properties queueProperties = checkAdmin.getQueueProperties(queue); if (queueProperties == null && isMissingQueuesFatal()) { throw new IllegalStateException("At least one of the configured queues is missing"); } } } }

Target:
private void checkMissingQueues(String[] queueNames) { if (isMissingQueuesFatal()) { RabbitAdmin checkAdmin = getRabbitAdmin(); if (checkAdmin == null) { checkAdmin = new RabbitAdmin(getConnectionFactory()); } for (String queue : queueNames) { Properties queueProperties = checkAdmin.getQueueProperties(queue); if (queueProperties == null && isMissingQueuesFatal()) { throw new IllegalStateException("At least one of the configured queues is missing"); } } } }
Source:
public long getAllCount() { return 1; }

Target:
public long getAllCount() { return 0; }
Source:
public void basics() throws JSONException { JSONObject jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); DataNode dataNode = new TestDataNode("datacenter", jsonObject, clusterMapConfig); assertEquals(dataNode.getHostname(), TestUtils.getLocalHost()); assertEquals(dataNode.getPort(), 6666); assertEquals(dataNode.getState(), HardwareState.AVAILABLE); assertEquals(dataNode.getDisks().size(), diskCount); assertEquals(dataNode.getRawCapacityInBytes(), diskCount * diskCapacityInBytes); assertNull(dataNode.getRackId()); assertEquals(Long.toString(TestUtils.DEFAULT_XID), dataNode.getXid()); assertEquals(dataNode.toJSONObject().toString(), jsonObject.toString()); assertEquals(dataNode, new TestDataNode("datacenter", dataNode.toJSONObject(), clusterMapConfig)); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, 42, 64, HardwareState.AVAILABLE, getDisks()); dataNode = new TestDataNode("datacenter", jsonObject, clusterMapConfig); assertEquals("42", dataNode.getRackId()); assertEquals("64", dataNode.getXid()); assertEquals(dataNode.toJSONObject().toString(), jsonObject.toString()); assertEquals(dataNode, new TestDataNode("datacenter", dataNode.toJSONObject(), clusterMapConfig)); }

Target:
public void basics() throws JSONException { JSONObject jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); DataNode dataNode = new TestDataNode("datacenter", jsonObject, clusterMapConfig); assertEquals(dataNode.getHostname(), TestUtils.getLocalHost()); assertEquals(dataNode.getPort(), 6666); assertEquals(dataNode.getState(), HardwareState.AVAILABLE); assertEquals(dataNode.getDisks().size(), diskCount); assertEquals(dataNode.getRawCapacityInBytes(), diskCount * diskCapacityInBytes); assertNull(dataNode.getRackId()); assertEquals(TestUtils.DEFAULT_XID, dataNode.getXid()); assertEquals(dataNode.toJSONObject().toString(), jsonObject.toString()); assertEquals(dataNode, new TestDataNode("datacenter", dataNode.toJSONObject(), clusterMapConfig)); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, 42, TestUtils.DEFAULT_XID, HardwareState.AVAILABLE, getDisks()); dataNode = new TestDataNode("datacenter", jsonObject, clusterMapConfig); assertEquals("42", dataNode.getRackId()); assertEquals(TestUtils.DEFAULT_XID, dataNode.getXid()); assertEquals(dataNode.toJSONObject().toString(), jsonObject.toString()); assertEquals(dataNode, new TestDataNode("datacenter", dataNode.toJSONObject(), clusterMapConfig)); }
Source:
public void selectLoginMethod(String loginMethod) { Assume.assumeTrue("This test is WiP, so it must be remade after adding a certain feature.",false); new Select(authenticatorsSelect).selectByVisibleText(loginMethod); }

Target:
public void selectLoginMethod(String loginMethod) { new Select(authenticatorsSelect).selectByVisibleText(loginMethod); }
Source:
private static Druids.ScanQueryBuilder basicC(final BenchmarkSchemaInfo basicSchema) { final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(Collections.singletonList(basicSchema.getDataInterval())); final List<String> dimUniformFilterVals = new ArrayList<>(); final int resultNum = (int) (100000 * 0.1); final int step = 100000 / resultNum; for (int i = 1; i < 100001 && dimUniformFilterVals.size() < resultNum; i += step) { dimUniformFilterVals.add(String.valueOf(i)); } final String dimName = "dimUniform"; return Druids.newScanQueryBuilder() .filters(new SelectorDimFilter(dimName, "3", StrlenExtractionFn.instance())) .intervals(intervalSpec); }

Target:
private static Druids.ScanQueryBuilder basicC(final BenchmarkSchemaInfo basicSchema) { final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(Collections.singletonList(basicSchema.getDataInterval())); final String dimName = "dimUniform"; return Druids.newScanQueryBuilder() .filters(new SelectorDimFilter(dimName, "3", StrlenExtractionFn.instance())) .intervals(intervalSpec); }
Source:
public void listSettingRevisions() { ConfigurationClient configurationClient = createSyncConfigurationClient(); SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); PagedIterable<ConfigurationSetting> csStream = configurationClient.listSettingRevisions(settingSelector); csStream.streamByPage().forEach(setting -> { System.out.printf("Key: %s, Value: %s", setting.value().get(0).key(), setting.value().get(0).value()); }); END: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector }

Target:
public void listSettingRevisions() { ConfigurationClient client = createSyncConfigurationClient(); SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); client.listSettingRevisions(settingSelector).streamByPage().forEach(resp -> { System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), resp.request().url(), resp.statusCode()); resp.items().forEach(value -> { System.out.printf("Response value is %d %n", value); }); }); END: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector }
Source:
public void createConnectors(List<String> listeners, List<String> adminListeners) { List<Connector> connectors = new ArrayList<>(); for (String listener : listeners) { if (!listener.isEmpty()) { Connector connector = createConnector(listener); connectors.add(connector); log.info("Added connector for {}", listener); } } jettyServer.setConnectors(connectors.toArray(new Connector[connectors.size()])); if (adminListeners != null && !adminListeners.isEmpty()) { for (String adminListener : adminListeners) { Connector conn = createConnector(adminListener, ADMIN_SERVER_CONNECTOR_NAME); jettyServer.addConnector(conn); log.info("Added admin connector for {}", adminListener); } } }

Target:
public void createConnectors(List<String> listeners, List<String> adminListeners) { List<Connector> connectors = new ArrayList<>(); for (String listener : listeners) { if (!listener.isEmpty()) { Connector connector = createConnector(listener); connectors.add(connector); log.info("Added connector for {}", listener); } } jettyServer.setConnectors(connectors.toArray(new Connector[connectors.size()])); if (adminListeners != null && !adminListeners.isEmpty()) { for (String adminListener : adminListeners) { Connector conn = createConnector(adminListener, true); jettyServer.addConnector(conn); log.info("Added admin connector for {}", adminListener); } } }
Source:
public GmmTrainer withInitialMeans(List<Vector> means) { A.notEmpty(means, "GMM should starts with non empty initial components list"); this.initialMeans = means.stream().toArray(Vector[]::new); this.countOfComponents = means.size(); return this; }

Target:
public GmmTrainer withInitialMeans(List<Vector> means) { A.notEmpty(means, "GMM should start with non empty initial components list"); this.initialMeans = means.toArray(new Vector[means.size()]); this.countOfComponents = means.size(); return this; }
Source:
public BatchSecretDeliveryResource(@Readonly SecretController secretController, AclDAOFactory aclDAOFactory, ClientDAOFactory clientDAOFactory) { this.secretController = secretController; this.aclDAO = aclDAOFactory.readonly(); this.clientDAO = clientDAOFactory.readwrite(); }

Target:
public BatchSecretDeliveryResource(@Readonly SecretController secretController, AclDAOFactory aclDAOFactory, ClientDAOFactory clientDAOFactory) { this.secretController = secretController; this.aclDAO = aclDAOFactory.readonly(); this.clientDAO = clientDAOFactory.readonly(); }
Source:
public Preferences() { chat = new ChatPrefs(); login = new LoginPrefs(); lang= new LanguagePrefs(); mainWindow = new WindowPrefs(); forgedAlliance = new ForgedAlliancePrefs(); themeName = new SimpleStringProperty(DEFAULT_THEME_NAME); lastGameType = new SimpleStringProperty(KnownFeaturedMod.DEFAULT.getString()); ignoredNotifications = new SimpleListProperty<>(observableArrayList()); notification = new NotificationsPrefs(); rememberLastTab = new SimpleBooleanProperty(true); lastGameTitle = new SimpleStringProperty(); lastMap = new SimpleStringProperty(); lastGameMinRating = new SimpleIntegerProperty(800); lastGameMaxRating = new SimpleIntegerProperty(1300); ranked1v1 = new Ranked1v1Prefs(); gamesViewMode = new SimpleStringProperty(); newsPrefs = new NewsPrefs(); developerPrefs = new DeveloperPrefs(); }

Target:
public Preferences() { chat = new ChatPrefs(); login = new LoginPrefs(); localization = new LocalizationPrefs(); mainWindow = new WindowPrefs(); forgedAlliance = new ForgedAlliancePrefs(); themeName = new SimpleStringProperty(DEFAULT_THEME_NAME); lastGameType = new SimpleStringProperty(KnownFeaturedMod.DEFAULT.getString()); ignoredNotifications = new SimpleListProperty<>(observableArrayList()); notification = new NotificationsPrefs(); rememberLastTab = new SimpleBooleanProperty(true); lastGameTitle = new SimpleStringProperty(); lastMap = new SimpleStringProperty(); lastGameMinRating = new SimpleIntegerProperty(800); lastGameMaxRating = new SimpleIntegerProperty(1300); ranked1v1 = new Ranked1v1Prefs(); gamesViewMode = new SimpleStringProperty(); news = new NewsPrefs(); developer = new DeveloperPrefs(); }
Source:
public void close() throws IOException { super.close(); transport.close(); }

Target:
public void close() throws IOException { super.close(); }
Source:
private void setInterpretationAndStatus(EncounterTransaction.Observation observation, Obs obs) { try { Method getInterpretation = obs.getClass().getDeclaredMethod("getInterpretation"); Method getStatus = obs.getClass().getDeclaredMethod("getStatus"); Enum obsInterpretation = (Enum) getInterpretation.invoke(obs); Enum obsStatus = (Enum) getStatus.invoke(obs); String interpretation = (obsInterpretation != null) ? obsInterpretation.name() : null; String status = (obsStatus != null) ? obsStatus.name() : null; observation.setInterpretation(interpretation); observation.setStatus(status); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }

Target:
private void setInterpretationAndStatus(EncounterTransaction.Observation observation, Obs obs) { try { Method getInterpretation = obs.getClass().getDeclaredMethod("getInterpretation"); Method getStatus = obs.getClass().getDeclaredMethod("getStatus"); Enum obsInterpretation = (Enum) getInterpretation.invoke(obs); Enum obsStatus = (Enum) getStatus.invoke(obs); String interpretation = (obsInterpretation != null) ? obsInterpretation.name() : null; String status = (obsStatus != null) ? obsStatus.name() : null; observation.setInterpretation(interpretation); observation.setStatus(status); } catch (IllegalAccessException e) { log.warn("Illegal access of methods via reflection", e); } catch (NoSuchMethodException e) { log.warn("No such method exists", e); } catch (InvocationTargetException e) { log.warn("Exception during Method invocation", e); } }
Source:
public void testSymbolizerUoMOther() throws Exception { PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer(); FeatureTypeStyle fts = fts(p); p.setUnitOfMeasure(NonSI.ASTRONOMICAL_UNIT); StringWriter out = new StringWriter(); exception.expect(IllegalArgumentException.class); Ysld.encode(sld(fts), out); }

Target:
public void testSymbolizerUoMOther() throws Exception { PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer(); FeatureTypeStyle fts = fts(p); p.setUnitOfMeasure(USCustomary.LIGHT_YEAR); StringWriter out = new StringWriter(); exception.expect(IllegalArgumentException.class); Ysld.encode(sld(fts), out); }