auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void validateDeleteRespPayloadAndExchangeType( List<IkePayload> respPayloads, @ExchangeType int exchangeType) throws IkeProtocolException { if (exchangeType != EXCHANGE_TYPE_INFORMATIONAL) { throw new InvalidSyntaxException( "Unexpected exchange type in Delete Child response: " + exchangeType); } for (IkePayload payload : respPayloads) { handlePayload: switch (payload.payloadType) { case PAYLOAD_TYPE_DELETE: break handlePayload; case PAYLOAD_TYPE_NOTIFY: IkeNotifyPayload notify = (IkeNotifyPayload) payload; if (!notify.isErrorNotify()) { logw( "Unexpected or unknown status notification in Delete Child" + " response: " + notify.notifyType); break handlePayload; } IkeProtocolException exception = notify.validateAndBuildIkeException(); throw exception; default: logw( "Unexpected payload type in Delete Child response: " + payload.payloadType); } } }

Target:
protected void validateDeleteRespPayloadAndExchangeType( List<IkePayload> respPayloads, @ExchangeType int exchangeType) throws IkeProtocolException { if (exchangeType != EXCHANGE_TYPE_INFORMATIONAL) { throw new InvalidSyntaxException( "Unexpected exchange type in Delete Child response: " + exchangeType); } for (IkePayload payload : respPayloads) { handlePayload: switch (payload.payloadType) { case PAYLOAD_TYPE_DELETE: break handlePayload; case PAYLOAD_TYPE_NOTIFY: IkeNotifyPayload notify = (IkeNotifyPayload) payload; if (!notify.isErrorNotify()) { logw( "Unexpected or unknown status notification in Delete Child" + " response: " + notify.notifyType); break handlePayload; } throw notify.validateAndBuildIkeException(); default: logw( "Unexpected payload type in Delete Child response: " + payload.payloadType); } } }
Source:
public NodeMetadata apply(VApp from) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(from.getHref().toASCIIString()); builder.uri(from.getHref()); builder.name(from.getName()); String groupName = ""; if (!isNullOrEmpty(from.getDescription()) && from.getDescription().indexOf('=') != -1 && from.getDescription().indexOf('\n') != -1) { try { Map<String, String> metadataMap = Splitter.on('\n').withKeyValueSeparator("=").split(from.getDescription()); addMetadataAndParseTagsFromCommaDelimitedValue(builder, metadataMap); if (metadataMap.get("jclouds-group") != null) { groupName = metadataMap.get("jclouds-group"); } } catch (IllegalArgumentException iae) { } } builder.hostname(from.getName()); builder.location(findLocationForResourceInVDC.apply(from.getVDC())); if (groupName.equals("")) { groupName = nodeNamingConvention.groupInUniqueNameOrNull(from.getName()); } builder.group(groupName); builder.operatingSystem(toComputeOs(from, null)); builder.hardware(hardwareForVApp.apply(from)); builder.status(vAppStatusToNodeStatus.get(from.getStatus())); Set<String> addresses = getIpsFromVApp(from); builder.publicAddresses(filter(addresses, not(IsPrivateIPAddress.INSTANCE))); builder.privateAddresses(filter(addresses, IsPrivateIPAddress.INSTANCE)); Credentials fromApi = getCredentialsFrom(from); if (fromApi != null && !credentialStore.containsKey("node#" + from.getHref().toASCIIString())) credentialStore.put("node#" + from.getHref().toASCIIString(), fromApi); return builder.build(); }

Target:
public NodeMetadata apply(VApp from) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(from.getHref().toASCIIString()); builder.uri(from.getHref()); builder.name(from.getName()); String groupName = ""; Map<String, String> metadataMap; if (!isNullOrEmpty(from.getDescription()) && from.getDescription().indexOf('=') != -1 && from.getDescription().indexOf('\n') != -1) { try { metadataMap = Splitter.on('\n').withKeyValueSeparator("=").split(from.getDescription()); addMetadataAndParseTagsFromCommaDelimitedValue(builder, metadataMap); } catch (IllegalArgumentException iae) { metadataMap = ImmutableMap.of(); } } else { metadataMap = ImmutableMap.of(); } builder.hostname(from.getName()); builder.location(findLocationForResourceInVDC.apply(from.getVDC())); builder.group(groupFromMapOrName(metadataMap, from.getName(), nodeNamingConvention)); builder.operatingSystem(toComputeOs(from, null)); builder.hardware(hardwareForVApp.apply(from)); builder.status(vAppStatusToNodeStatus.get(from.getStatus())); Set<String> addresses = getIpsFromVApp(from); builder.publicAddresses(filter(addresses, not(IsPrivateIPAddress.INSTANCE))); builder.privateAddresses(filter(addresses, IsPrivateIPAddress.INSTANCE)); Credentials fromApi = getCredentialsFrom(from); if (fromApi != null && !credentialStore.containsKey("node#" + from.getHref().toASCIIString())) credentialStore.put("node#" + from.getHref().toASCIIString(), fromApi); return builder.build(); }
Source:
public ChannelPipelineFactory newChannelPipelineFactory(final int maxFrameSize) { return new ChannelPipelineFactory() { @Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline cp = Channels.pipeline(); cp.addLast("frameEncoder", new LengthFieldPrepender(4)); cp.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(maxFrameSize, 0, 4, 0, 4)); return cp; } }; }

Target:
public ChannelPipelineFactory newChannelPipelineFactory(final int maxFrameSize) { return new ChannelPipelineFactory() { @Override public ChannelPipeline getPipeline() throws Exception { ChannelPipeline cp = Channels.pipeline(); cp.addLast("frameEncoder", new LengthFieldPrepender(LENGTH_FIELD_LENGTH)); cp.addLast( "frameDecoder", new LengthFieldBasedFrameDecoder( maxFrameSize, LENGTH_FIELD_OFFSET, LENGTH_FIELD_LENGTH, LENGTH_ADJUSTMENT, INITIAL_BYTES_TO_STRIP)); return cp; } }; }
Source:
public List<UnregisteredDisk> getByDiskIdAndStorageDomainId(Guid diskId, Guid storageDomainId) { List<UnregisteredDisk> unregisteredDisks = getCallsHandler().executeReadList("GetDiskByDiskIdAndStorageDomainId", unregisteredDiskRowMapper, getCustomMapSqlParameterSource() .addValue("disk_id", diskId) .addValue("storage_domain_id", storageDomainId)); for (UnregisteredDisk unregDisk : unregisteredDisks) { List<VmBase> vms = getCallsHandler().executeReadList("GetEntitiesByDiskId", vmsForUnregisteredDiskRowMapper, getCustomMapSqlParameterSource().addValue("disk_id", unregDisk.getId().getDiskId())); unregDisk.getVms().addAll(vms); } return unregisteredDisks; }

Target:
public List<UnregisteredDisk> getByDiskIdAndStorageDomainId(Guid diskId, Guid storageDomainId) { List<UnregisteredDisk> unregisteredDisks = getCallsHandler().executeReadList("GetDiskByDiskIdAndStorageDomainId", unregisteredDiskRowMapper, createIdParameterMapper(new UnregisteredDiskId(diskId, storageDomainId))); for (UnregisteredDisk unregDisk : unregisteredDisks) { List<VmBase> vms = getCallsHandler().executeReadList("GetEntitiesByDiskId", vmsForUnregisteredDiskRowMapper, getCustomMapSqlParameterSource().addValue("disk_id", unregDisk.getId().getDiskId())); unregDisk.getVms().addAll(vms); } return unregisteredDisks; }
Source:
private List<Artifact> readArtifactList(ObjectMapper mapper, String hydratedTemplate) { try { return mapper.readValue(hydratedTemplate, artifactListReference); } catch (IOException ioe) { log.error("Unable to parse artifact from {}", hydratedTemplate); } return null; }

Target:
private List<Artifact> readArtifactList(ObjectMapper mapper, String hydratedTemplate) { try { return mapper.readValue(hydratedTemplate, artifactListReference); } catch (IOException ioe) { log.warn("Unable to parse artifact from {}", hydratedTemplate); } return null; }
Source:
public long getOneKB() { return oneKb; }

Target:
long getOneKB() { return oneKb; }
Source:
public static Slice stGeometryN(@SqlType(GEOMETRY_TYPE_NAME) Slice input, @SqlType(INTEGER) long index) { OGCGeometry geometry = deserialize(input); GeometryType type = GeometryType.getForEsriGeometryType(geometry.geometryType()); if (!type.isMultitype()) { if (index == 1) { return input; } return null; } if (index < 1 || index > ((OGCGeometryCollection) geometry).numGeometries()) { return null; } return serialize(((OGCGeometryCollection) geometry).geometryN((int) index - 1)); }

Target:
public static Slice stGeometryN(@SqlType(GEOMETRY_TYPE_NAME) Slice input, @SqlType(INTEGER) long index) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { return null; } GeometryType type = GeometryType.getForEsriGeometryType(geometry.geometryType()); if (!type.isMultitype()) { if (index == 1) { return input; } return null; } OGCGeometryCollection geometryCollection = ((OGCGeometryCollection) geometry); if (index < 1 || index > geometryCollection.numGeometries()) { return null; } OGCGeometry ogcGeometry = geometryCollection.geometryN((int) index - 1); return serialize(ogcGeometry); }
Source:
public void beforeClass() { embeddedCacheManager = TestCacheManagerFactory.createCacheManager(); hotrodServer = HotRodTestingUtil.startHotRodServer(embeddedCacheManager, 19723); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer().host("localhost").port(hotrodServer.getPort()) .marshaller(new JavaSerializationMarshaller()) .addJavaSerialWhiteList("java.time.*", "org.springframework.session.MapSession", "org.infinispan.spring.remote.*"); remoteCacheManager = new RemoteCacheManager(builder.build()); }

Target:
public void beforeClass() { embeddedCacheManager = TestCacheManagerFactory.createCacheManager(); hotrodServer = HotRodTestingUtil.startHotRodServer(embeddedCacheManager, 19723); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer().host("localhost").port(hotrodServer.getPort()) .marshaller(new JavaSerializationMarshaller()) .addJavaSerialWhiteList(SPRING_JAVA_SERIAL_WHITELIST.split(",")); remoteCacheManager = new RemoteCacheManager(builder.build()); }
Source:
public <E> CacheQuery<E> buildCacheQuery(QueryDefinition queryDefinition, IndexedQueryMode indexedQueryMode, KeyTransformationHandler keyTransformationHandler, TimeoutExceptionFactory timeoutExceptionFactory, ExecutorService asyncExecutor, IndexedTypeMap<CustomTypeMetadata> indexedTypeMap) { if (!isIndexed) { throw log.cannotRunLuceneQueriesIfNotIndexed(cache.getName()); } if (indexedQueryMode == IndexedQueryMode.BROADCAST) { return new ClusteredCacheQueryImpl<>(queryDefinition, asyncExecutor, cache, keyTransformationHandler, indexedTypeMap); } else { queryDefinition.initialize(cache); HSQuery hsQuery = queryDefinition.getHsQuery(); CacheQuery cacheQuery = new CacheQueryImpl<>(hsQuery, cache, keyTransformationHandler); return (CacheQuery<E>) cacheQuery; } }

Target:
public <E> CacheQuery<E> buildCacheQuery(QueryDefinition queryDefinition, IndexedQueryMode indexedQueryMode, KeyTransformationHandler keyTransformationHandler, TimeoutExceptionFactory timeoutExceptionFactory, ExecutorService asyncExecutor, IndexedTypeMap<CustomTypeMetadata> indexedTypeMap) { if (!isIndexed) { throw log.cannotRunLuceneQueriesIfNotIndexed(cache.getName()); } if (indexedQueryMode == IndexedQueryMode.BROADCAST) { return new ClusteredCacheQueryImpl<>(queryDefinition, asyncExecutor, cache, keyTransformationHandler, indexedTypeMap); } else { queryDefinition.initialize(cache); HSQuery hsQuery = queryDefinition.getHsQuery(); return new CacheQueryImpl<>(hsQuery, cache, keyTransformationHandler); } }
Source:
private String marshallAuditMessage(AuditMessageType mess) { if (mess != null) { try { JAXBContextHandler oHandler = new JAXBContextHandler(); JAXBContext jc = oHandler.getJAXBContext(AUDIT_MESSAGE_NAMESPACE); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); ByteArrayOutputStream baOutStrm = new ByteArrayOutputStream(); baOutStrm.reset(); ObjectFactory factory = new ObjectFactory(); JAXBElement<AuditMessageType> oJaxbElement = factory.createAuditMessage(mess); baOutStrm.close(); marshaller.marshal(oJaxbElement, baOutStrm); return baOutStrm.toString(); } catch (JAXBException | IOException e) { LOG.error("Exception during Blob conversion {}", e.getLocalizedMessage(), e); } } return null; }

Target:
private String marshallAuditMessage(AuditMessageType mess) { if (mess != null) { ByteArrayOutputStream baOutStrm = null; try { JAXBContext jc = new JAXBContextHandler().getJAXBContext(AUDIT_MESSAGE_NAMESPACE); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); baOutStrm = new ByteArrayOutputStream(); baOutStrm.reset(); ObjectFactory factory = new ObjectFactory(); JAXBElement<AuditMessageType> oJaxbElement = factory.createAuditMessage(mess); marshaller.marshal(oJaxbElement, baOutStrm); return baOutStrm.toString(); } catch (JAXBException e) { LOG.error("Exception during Blob conversion {}", e.getLocalizedMessage(), e); } finally { if (baOutStrm != null) { try { baOutStrm.close(); } catch (IOException ex) { LOG.error("Unable to close OutputStream {}", ex.getLocalizedMessage(), ex); } } } } return null; }
Source:
private static String expectedTypeInsteadOfOptional(Type type) { if (type.is(JAVA_UTIL_OPTIONAL) && ((JavaType) type).isParameterized()) { ParametrizedTypeJavaType parametrizedTypeJavaType = (ParametrizedTypeJavaType) type; return parametrizedTypeJavaType.substitution(parametrizedTypeJavaType.typeParameters().get(0)).erasure().name(); } Optional<String> primitiveOptional = PRIMITIVE_OPTIONALS.stream().filter(type::is).findFirst(); if (primitiveOptional.isPresent()) { return primitiveOptional.get().substring(JAVA_UTIL_OPTIONAL.length()).toLowerCase(); } return null; }

Target:
private static Optional<String> expectedTypeInsteadOfOptional(Type type) { if (type.is(JAVA_UTIL_OPTIONAL)) { String msg; if (((JavaType) type).isParameterized()) { ParametrizedTypeJavaType ptjt = (ParametrizedTypeJavaType) type; String parameterTypeName = ptjt.substitution(ptjt.typeParameters().get(0)).erasure().name(); msg = formatMsg(parameterTypeName); } else { msg = "Specify a type instead."; } return Optional.of(msg); } return PRIMITIVE_OPTIONALS.stream() .filter(type::is) .findFirst() .map(optional -> formatMsg(optional.substring(JAVA_UTIL_OPTIONAL.length()).toLowerCase())); }
Source:
public synchronized void load() throws IOException { COL result = create(); if (exists()) { try (LinesStream stream = lines()) { for (String line : stream) { if (line.startsWith("#")) continue; T r = parse(line); if (r != null) result.add(r); } } } parsed = readOnly(result); }

Target:
public void load() { try { load2(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public void addLocalizedTitle(LocalizedTitle localizedTitle) { this.localizedTitles = ImmutableSet.<LocalizedTitle> builder() .add(localizedTitle) .addAll(localizedTitles) .build(); }

Target:
public void addLocalizedTitle(LocalizedTitle localizedTitle) { this.localizedTitles = MoreSets.add(localizedTitles, localizedTitle); }
Source:
private Chain dropLastElement(Chain chain) { List<Element> elements = StreamSupport.stream(chain.spliterator(), false) .collect(Collectors.toList()); if (!elements.isEmpty()) { elements.remove(elements.size() - 1); } return Util.getChain(elements); }

Target:
private Chain dropLastElement(Chain chain) { if (!chain.isEmpty()) { List<Element> elements = StreamSupport.stream(chain.spliterator(), false) .collect(Collectors.toList()); elements.remove(elements.size() - 1); return Util.getChain(elements); } else { return chain; } }
Source:
@Test public void testMissingFileInitializes() throws Exception { testFile = File.createTempFile(FRESH_SERIALIZED_QUEUE, "test"); assertTrue(testFile.delete()); assertFalse(testFile.exists()); QueueFile queue = new QueueFile.Builder(testFile).build(); try { assertEquals(0, queue.size()); assertTrue(testFile.exists()); } finally { queue.close(); } }

Target:
@Test public void testMissingFileInitializes() throws Exception { testFile = File.createTempFile(FRESH_SERIALIZED_QUEUE, "test"); assertTrue(testFile.delete()); assertFalse(testFile.exists()); QueueFile queue = new QueueFile.Builder(testFile).build(); assertEquals(0, queue.size()); assertTrue(testFile.exists()); queue.close(); }
Source:
public void processEvent(CloudTrailEvent event) { List<String> instances = getInstances(event); for (String instance : instances) { DateTime eventDate = getLifecycleDate(event, instance); LifecycleEntity lifecycleEntity = new LifecycleEntity(); lifecycleEntity.setEventType(event.getEventData().getEventName()); lifecycleEntity.setEventDate(eventDate); ApplicationEntity applicationEntity; VersionEntity versionEntity; try { String versionName = getVersionName(event, instance); versionEntity = new VersionEntity(versionName); String applicationName = getApplicationName(event, instance); applicationEntity = new ApplicationEntity(applicationName); } catch (AmazonServiceException e) { LOG.warn("Lifecycle: {}", e.getMessage()); return; } applicationLifecycleService.saveLifecycle(applicationEntity, versionEntity, lifecycleEntity); } }

Target:
public void processEvent(CloudTrailEvent event) { List<String> instances = getInstances(event); String region = getRegionAsString(event); for (String instance : instances) { DateTime eventDate = getLifecycleDate(event, instance); LifecycleEntity lifecycleEntity = new LifecycleEntity(); lifecycleEntity.setEventType(event.getEventData().getEventName()); lifecycleEntity.setEventDate(eventDate); lifecycleEntity.setRegion(region); lifecycleEntity.setInstanceId(getSingleInstance(instance)); ApplicationEntity applicationEntity; VersionEntity versionEntity; try { String versionName = getVersionName(event, instance); versionEntity = new VersionEntity(versionName); String applicationName = getApplicationName(event, instance); applicationEntity = new ApplicationEntity(applicationName); } catch (AmazonServiceException e) { LOG.warn("Could not get version/application for lifecycle event.", e); return; } applicationLifecycleService.saveLifecycle(applicationEntity, versionEntity, lifecycleEntity); } }
Source:
public TimelineResult(ImmutableList<Timeline> timelines, TimelineLog log) { this.timelines = timelines; this.log = log; }

Target:
private TimelineResult(ImmutableList<Timeline> timelines, TimelineLog log) { this.timelines = timelines; this.log = log; }
Source:
public void run() throws Exception { List<String> argsList = (List <String>)args.get("__other__"); Runnable action = actions.get(argsList.remove(0)); if(action == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } action.run(); }

Target:
public void run() throws Exception { List<String> argsList = (List <String>)args.get("__other__"); Runnable action = actions.get(argsList.get(0)); if(action == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } action.run(); }
Source:
public SSLSocketFactory( String algorithm, final KeyStore keystore, final String keystorePassword, final KeyStore truststore, final SecureRandom random, final HostNameResolver nameResolver) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { super(); if (algorithm == null) { algorithm = TLS; } KeyManager[] keymanagers = null; if (keystore != null) { keymanagers = createKeyManagers(keystore, keystorePassword); } TrustManager[] trustmanagers = null; if (truststore != null) { trustmanagers = createTrustManagers(truststore); } sslcontext = SSLContext.getInstance(algorithm); sslcontext.init(keymanagers, trustmanagers, random); socketfactory = (SSLCertificateSocketFactory) sslcontext.getSocketFactory(); this.nameResolver = nameResolver; }

Target:
public SSLSocketFactory( String algorithm, final KeyStore keystore, final String keystorePassword, final KeyStore truststore, final SecureRandom random, final HostNameResolver nameResolver) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { super(); if (algorithm == null) { algorithm = TLS; } KeyManager[] keymanagers = null; if (keystore != null) { keymanagers = createKeyManagers(keystore, keystorePassword); } TrustManager[] trustmanagers = null; if (truststore != null) { trustmanagers = createTrustManagers(truststore); } sslcontext = SSLContext.getInstance(algorithm); sslcontext.init(keymanagers, trustmanagers, random); socketfactory = sslcontext.getSocketFactory(); this.nameResolver = nameResolver; }
Source:
public void destroyNode(String id) { api.getRemoteApi().stopContainer(id); api.getRemoteApi().removeContainer(id); }

Target:
public void destroyNode(String id) { api.getRemoteApi().removeContainer(id, RemoveContainerOptions.Builder.force(true)); }
Source:
public void setFluoTableSplits(SortedSet<Text> splits) { final String table = fluoConfig.getAccumuloTable(); if (conn.tableOperations().exists(table)) { try { conn.tableOperations().addSplits(table, splits); } catch (AccumuloException | AccumuloSecurityException | TableNotFoundException e) { throw new IllegalStateException("Failed to add splits to Fluo's Accumulo table " + table, e); } } else { log.error("Fluo's Accumulo table does not exist. No splits will be added", table); } }

Target:
public void setFluoTableSplits(SortedSet<Text> splits) { final String table = fluoConfig.getAccumuloTable(); try { conn.tableOperations().addSplits(table, splits); } catch (AccumuloException | AccumuloSecurityException | TableNotFoundException e) { throw new IllegalStateException("Failed to add splits to Fluo's Accumulo table " + table, e); } }
Source:
protected void updateSearchField() { if (!isNew() && !forceUpdateSearchPrefixes && getDescriptor().isFetched(this, getDescriptor().getProperty(SEARCH_PREFIXES)) && !isAnyMappingChanged()) { return; } getSearchPrefixes().clear(); this.getDescriptor() .getProperties() .stream() .filter(p -> p.getAnnotation(PrefixSearchContent.class).isPresent()) .map(p -> p.getValue(this)) .filter(Strings::isFilled) .forEach(this::addContent); }

Target:
protected void updateSearchField() { if (!isNew() && !forceUpdateSearchPrefixes && !isAnyMappingChanged()) { return; } getSearchPrefixes().clear(); this.getDescriptor() .getProperties() .stream() .filter(p -> p.getAnnotation(PrefixSearchContent.class).isPresent()) .map(p -> p.getValue(this)) .filter(Strings::isFilled) .forEach(this::addContent); }
Source:
public boolean equals(Object o) { throw new UnsupportedOperationException("equals:ImmutableDruidDataSource shouldn't be used as the key in containers"); }

Target:
public boolean equals(Object o) { throw new UnsupportedOperationException("ImmutableDruidDataSource shouldn't be used as the key in containers"); }
Source:
public void cannotDropTables() { assertThrowsAtlasDbDependencyExceptionAndDoesNotChangeCassandraSchema(() -> getTestKvs().truncateTable(TABLE_TO_DROP_2)); }

Target:
public void cannotDropTables() { assertThrowsAtlasDbDependencyExceptionAndDoesNotChangeCassandraSchema(() -> getTestKvs().dropTables(ImmutableSet.of(TABLE_TO_DROP_2))); }
Source:
public void testBytes() { assertQueryUsingH2Cte("SELECT byte_col1 FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT byte_col1 FROM lineitem_ex WHERE byte_col1 < 0"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE byte_col1 > 0"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE byte_col1 is null"); assertQueryUsingH2Cte("SELECT byte_col1, byte_col2 FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT byte_col1, byte_col2 FROM lineitem_ex WHERE byte_col1 = 0"); assertQueryUsingH2Cte("SELECT byte_col1, byte_col2 FROM lineitem_ex WHERE byte_col1 = 0 AND byte_col2 = 0"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE byte_col1 is null"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE byte_col1 is not null AND byte_col2 = 1"); assertQueryUsingH2Cte("SELECT byte_col1, byte_col2 FROM lineitem_ex WHERE byte_col1 > 0 and byte_col2 < 0 and (byte_col1 + byte_col2) = 0"); }

Target:
public void testBytes() { assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day FROM lineitem_ex WHERE ship_day < 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day > 15"); assertQueryUsingH2Cte("SELECT count(*) FROM lineitem_ex WHERE ship_day is null"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day = 1 AND ship_month = 1"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_month is null"); assertQueryUsingH2Cte("SELECT COUNT(*) FROM lineitem_ex WHERE ship_day is not null AND ship_month = 1"); assertQueryUsingH2Cte("SELECT ship_day, ship_month FROM lineitem_ex WHERE ship_day > 15 AND ship_month < 5 AND (ship_day + ship_month) < 20"); }
Source:
public PatchList get(PatchListKey key) { try { return fileCache.get(key); } catch (ExecutionException e) { PatchListLoader.log.warn("Error computing " + key, e); return null; } }

Target:
public PatchList get(PatchListKey key) throws PatchListNotAvailableException { try { return fileCache.get(key); } catch (ExecutionException e) { PatchListLoader.log.warn("Error computing " + key, e); throw new PatchListNotAvailableException(e.getCause()); } }
Source:
public static Function<Resource, Long> toLongResourceValue() { return new Function<Resource, Long>() { @Override public Long apply(@Nullable Resource resource) { return resourceValueLong(Optional.fromNullable(resource)).or(0l); } }; }

Target:
public static Function<Resource, Long> toLongResourceValue() { return ToLongResourceValue.INSTANCE; }
Source:
public PolymorphicScalarFunctionChoice build() { if (argumentProperties.isEmpty()) { argumentProperties = Collections.nCopies(signature.getArgumentTypes().size(), valueTypeArgumentProperty(RETURN_NULL_ON_NULL)); } return new PolymorphicScalarFunctionChoice(nullableResult, argumentProperties, methodsGroups); }

Target:
public PolymorphicScalarFunctionChoice build() { return new PolymorphicScalarFunctionChoice(nullableResult, argumentProperties, methodsGroups.build()); }
Source:
public AuditLogType getAuditLogTypeValue() { addCustomValue("UserName", String.format("%s", getUserName())); return getSucceeded() ? AuditLogType.USER_REBOOT_VM : AuditLogType.USER_FAILED_REBOOT_VM; }

Target:
public AuditLogType getAuditLogTypeValue() { return getSucceeded() ? AuditLogType.USER_REBOOT_VM : AuditLogType.USER_FAILED_REBOOT_VM; }
Source:
private float getChargingPercent(ItemStack stack) { if (stack != null && stack.getItem() instanceof ItemExosuitArmor) { if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } if (!stack.stackTagCompound.hasKey("steamFill")) { stack.stackTagCompound.setInteger("steamFill", 0); } if (!stack.stackTagCompound.hasKey("maxFill")) { stack.stackTagCompound.setInteger("maxFill", 0); } int maxFill = stack.stackTagCompound.getInteger("maxFill"); int steamFill = stack.stackTagCompound.getInteger("steamFill"); return ((float) steamFill / (float) maxFill); } else if (stack != null) { return 1.0f - ((float) stack.getItemDamage() / (float) stack.getMaxDamage()); } return 0.0f; }

Target:
private float getChargingPercent(ItemStack stack) { if (stack == null) { return 0F; } if (stack.getItem() instanceof ItemExosuitArmor) { if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } if (!stack.stackTagCompound.hasKey("steamFill")) { stack.stackTagCompound.setInteger("steamFill", 0); } if (!stack.stackTagCompound.hasKey("maxFill")) { stack.stackTagCompound.setInteger("maxFill", 0); } int maxFill = stack.stackTagCompound.getInteger("maxFill"); int steamFill = stack.stackTagCompound.getInteger("steamFill"); return ((float) steamFill / (float) maxFill); } return 1.0f - ((float) stack.getItemDamage() / (float) stack.getMaxDamage()); }
Source:
public void createsCorrectRefundPayload() { String payload = stripeRefundRequest.getGatewayOrder().getPayload(); assertThat(payload, containsString("charge=" + stripeChargeId)); assertThat(payload, containsString("amount=" + refundAmount)); assertThat(payload, containsString("refund_application_fee=true")); }

Target:
public void createsCorrectRefundPayload() { String payload = stripeRefundRequest.getGatewayOrder().getPayload(); assertThat(payload, containsString("charge=" + stripeChargeId)); assertThat(payload, containsString("amount=" + refundAmount)); assertThat(payload, containsString("refund_application_fee=true")); assertThat(payload, containsString("reverse_transfer=true")); }
Source:
public List<Guid> getHostIdsForClusterAndStatus(Guid clusterId, VDSStatus hostStatus) { final String sql = "select vds_static.vds_id \n" + "from vds_static \n" + "join vds_dynamic on vds_static.vds_id = vds_dynamic.vds_id \n" + "where vds_static.cluster_id = :v_clusterId \n" + "and vds_dynamic.status = :v_status"; final MapSqlParameterSource customMapSqlParameterSource = getCustomMapSqlParameterSource() .addValue("clusterId", clusterId) .addValue("status", hostStatus); final NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(getJdbcTemplate()); return namedParameterJdbcTemplate.query(sql, customMapSqlParameterSource, GUID_MAPPER); }

Target:
public List<Guid> getHostIdsForClusterAndStatus(Guid clusterId, VDSStatus hostStatus) { final String sql = "select vds_static.vds_id \n" + "from vds_static \n" + "join vds_dynamic on vds_static.vds_id = vds_dynamic.vds_id \n" + "where vds_static.cluster_id = :v_clusterId \n" + "and vds_dynamic.status = :v_status"; final MapSqlParameterSource customMapSqlParameterSource = getCustomMapSqlParameterSource() .addValue("clusterId", clusterId) .addValue("status", hostStatus); final NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(getJdbcTemplate()); return namedParameterJdbcTemplate.query(sql, customMapSqlParameterSource, createGuidMapper()); }
Source:
private void doFullTextSearch(final String searchTerm, final Map<String, String> continueOffset, final boolean clearOnSuccess) { final long startTime = System.nanoTime(); updateProgressBar(true); disposables.add(ServiceFactory.get(WikiSite.forLanguageCode(getSearchLanguageCode())).fullTextSearch(searchTerm, BATCH_SIZE, continueOffset != null ? continueOffset.get("continue") : null, continueOffset != null ? continueOffset.get("gsroffset") : null) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .map(response -> { if (response.query() != null) { return new SearchResults(response.query().pages(), WikiSite.forLanguageCode(getSearchLanguageCode()), response.continuation(), null); } return new SearchResults(); }) .flatMap(results -> { List<SearchResult> resultList = results.getResults(); cache(resultList, searchTerm); log(resultList, startTime); if (clearOnSuccess) { clearResults(false); } searchErrorView.setVisibility(View.GONE); SearchResultsFragment.this.lastFullTextResults = results; if (!resultList.isEmpty()) { displayResults(resultList); } return resultList.isEmpty() ? doFullTextSearchResultsCountObservable(searchTerm) : Observable.empty(); }) .toList() .doAfterTerminate(() -> updateProgressBar(false)) .subscribe(list -> { if (!list.isEmpty()) { searchResultsCountCache.put(getSearchLanguageCode() + "-" + searchTerm, list); displayResultsCount(list); } }, throwable -> { logError(true, startTime); })); }

Target:
private void doFullTextSearch(final String searchTerm, final Map<String, String> continueOffset, final boolean clearOnSuccess) { final long startTime = System.nanoTime(); updateProgressBar(true); disposables.add(ServiceFactory.get(WikiSite.forLanguageCode(getSearchLanguageCode())).fullTextSearch(searchTerm, BATCH_SIZE, continueOffset != null ? continueOffset.get("continue") : null, continueOffset != null ? continueOffset.get("gsroffset") : null) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .map(response -> { if (response.query() != null) { return new SearchResults(response.query().pages(), WikiSite.forLanguageCode(getSearchLanguageCode()), response.continuation(), null); } return new SearchResults(); }) .flatMap(results -> { List<SearchResult> resultList = results.getResults(); cache(resultList, searchTerm); log(resultList, startTime); if (clearOnSuccess) { clearResults(false); } searchErrorView.setVisibility(View.GONE); SearchResultsFragment.this.lastFullTextResults = results; if (!resultList.isEmpty()) { displayResults(resultList); } else { updateProgressBar(true); } return resultList.isEmpty() ? doFullTextSearchResultsCountObservable(searchTerm) : Observable.empty(); }) .toList() .doAfterTerminate(() -> updateProgressBar(false)) .subscribe(list -> { if (!list.isEmpty()) { searchResultsCountCache.put(getSearchLanguageCode() + "-" + searchTerm, list); displayResultsCount(list); } }, throwable -> { logError(true, startTime); })); }
Source:
public <T> NavigableMap<String, T> getMostRecentValues(String family) throws IOException { Preconditions.checkState(mTableLayout.getFamilyMap().get(family).isMapType(), new IllegalStateException(String.format("getMostRecentValues(String family) is only enabled" + " on map type column families. The column family [%s], is a group type column family." + " Please use the getMostRecentValues(String family, String qualifier) method.", family))); final NavigableMap<String, T> result = Maps.newTreeMap(); for (String qualifier : getQualifiers(family)) { final T value = getMostRecentValue(family, qualifier); result.put(qualifier, value); } return result; }

Target:
public <T> NavigableMap<String, T> getMostRecentValues(String family) throws IOException { Preconditions.checkState(mTableLayout.getFamilyMap().get(family).isMapType(), String.format("getMostRecentValues(String family) is only enabled" + " on map type column families. The column family [%s], is a group type column family." + " Please use the getMostRecentValues(String family, String qualifier) method.", family)); final NavigableMap<String, T> result = Maps.newTreeMap(); for (String qualifier : getQualifiers(family)) { final T value = getMostRecentValue(family, qualifier); result.put(qualifier, value); } return result; }
Source:
private void openSocket() { try { socket = new DatagramSocket(); } catch (SocketException e) { log.error("Cannot reopen socket", e); throw Throwables.propagate(e); } }

Target:
private void openSocket() { try { socket = new DatagramSocket(); } catch (SocketException e) { log.error("Cannot open socket", e); throw Throwables.propagate(e); } }
Source:
public JobInstance() { String jobInstIdSuffix = System.getProperty(PARAM_JOB_INST_ID); if (jobInstIdSuffix == null) { jobInstIdSuffix = ManagementFactory.getRuntimeMXBean().getName().split("@")[0]; } jobInstanceId = IpUtils.getIp() + DELIMITER + jobInstIdSuffix; }

Target:
public JobInstance() { String jobInstanceIdSuffix = System.getProperty(PROPERTY_JOB_INSTANCE_ID); if (null == jobInstanceIdSuffix) { jobInstanceIdSuffix = ManagementFactory.getRuntimeMXBean().getName().split("@")[0]; } jobInstanceId = IpUtils.getIp() + DELIMITER + jobInstanceIdSuffix; }
Source:
public static void parse(String path) { try { FileInputStream inputStream = new FileInputStream(path); OsInfoParser parser = new OsInfoParser(inputStream); parser.parse(); } catch (FileNotFoundException e) { throw new RuntimeException("osinfo properties file cannot be found"); } catch (ParseException e) { int line = e.currentToken.beginLine; int charPositionInLine = e.currentToken.beginColumn; String msg = e.getMessage(); throw new RuntimeException("osinfo properties syntax error: " + ("line " + line + ":" + charPositionInLine + " " + msg)); } }

Target:
public static void parse(String path) { try (FileInputStream inputStream = new FileInputStream(path)) { OsInfoParser parser = new OsInfoParser(inputStream); parser.parse(); } catch (FileNotFoundException e) { throw new RuntimeException("osinfo properties file cannot be found"); } catch (IOException e) { throw new RuntimeException("error while reading osinfo properties file"); } catch (ParseException e) { throw new RuntimeException( String.format( "osinfo properties syntax error: %s: %d, %d: error: %s", path, e.currentToken.beginLine, e.currentToken.beginColumn, e.getMessage() ), e ); } }
Source:
public DataType getDataTypeByName(String name) { if (name.toLowerCase().equals(COMPLEX_DATA_TYPE_NAME)) { return complexDataType; } return null; }

Target:
public DataType getDataTypeByName(String name) { if (name.toLowerCase(Locale.ENGLISH).equals(COMPLEX_DATA_TYPE_NAME)) { return complexDataType; } return null; }
Source:
public static OutputStream checkAndWrap(HttpServletRequest httpRequest, HttpServletResponse httpResponse, boolean requireWantsHeader) throws IOException { OutputStream outputStream = httpResponse.getOutputStream(); boolean acceptsGzip = Collections.list(httpRequest.getHeaders(ACCEPT_ENCODING)).stream().anyMatch(STRING_MATCH); boolean wantGzip = httpResponse.getHeaders(CONTENT_ENCODING).contains(GZIP); if (acceptsGzip) { if (wantGzip || !requireWantsHeader) { outputStream = new GZIPOutputStream(outputStream, true); } } return outputStream; }

Target:
public static OutputStream checkAndWrap(HttpServletRequest httpRequest, HttpServletResponse httpResponse, boolean requireWantsHeader) throws IOException { OutputStream responseStream = httpResponse.getOutputStream(); boolean acceptsGzip = Collections.list(httpRequest.getHeaders(ACCEPT_ENCODING)).stream().anyMatch(STRING_MATCH); boolean wantGzip = httpResponse.getHeaders(CONTENT_ENCODING).contains(GZIP); if (acceptsGzip) { if (!requireWantsHeader || wantGzip) { responseStream = new GZIPOutputStream(responseStream, true); } } return responseStream; }
Source:
public VariableMappingExpressionEvaluatorWrapper(IExpressionEvaluator wrapped, Map<PVariable, PVariable> variableMapping) { this.wrapped = wrapped; this.variableMapping = Maps.newLinkedHashMap(); Map<String, PVariable> names = Maps.newHashMap(); for (PVariable originalVar : variableMapping.keySet()) { names.put(originalVar.getName(), originalVar); } for (String inputParameterName : wrapped.getInputParameterNames()) { PVariable original = names.get(inputParameterName); if (original != null){ PVariable mapped = variableMapping.get(original); if (mapped != null){ this.variableMapping.put(inputParameterName, mapped.getName()); } } } }

Target:
public VariableMappingExpressionEvaluatorWrapper(IExpressionEvaluator wrapped, Map<PVariable, PVariable> variableMapping) { boolean rewrap = wrapped instanceof VariableMappingExpressionEvaluatorWrapper; this.wrapped = rewrap ? ((VariableMappingExpressionEvaluatorWrapper)wrapped).wrapped : wrapped; this.variableMapping = Maps.newLinkedHashMap(); Map<String, PVariable> names = Maps.newHashMap(); for (PVariable originalVar : variableMapping.keySet()) { names.put(originalVar.getName(), originalVar); } Map<String, String> previousMapping = null; if (rewrap){ previousMapping = ((VariableMappingExpressionEvaluatorWrapper)wrapped).variableMapping; } for (String inputParameterName : this.wrapped.getInputParameterNames()) { String parameterName = rewrap ? previousMapping.get(inputParameterName) : inputParameterName; Preconditions.checkArgument(parameterName != null); PVariable original = names.get(parameterName); Preconditions.checkArgument(original != null); PVariable mapped = variableMapping.get(original); if (mapped != null){ this.variableMapping.put(inputParameterName, mapped.getName()); } } }
Source:
public ItemsFilter(SearchPattern searchPattern) { patternMatcher = searchPattern; String stringPattern = ""; if (pattern != null && !pattern.getText().equals("*")) { stringPattern = pattern.getText(); } if (stringPattern.indexOf("*") != 0 && stringPattern.indexOf("?") != 0 && stringPattern.indexOf(".") != 0) { stringPattern = "*" + stringPattern; } patternMatcher.setPattern(stringPattern); }

Target:
public ItemsFilter(SearchPattern searchPattern) { patternMatcher = searchPattern; String stringPattern = ""; if (pattern != null) { stringPattern = pattern.getText(); } if (!stringPattern.startsWith("*") && !stringPattern.startsWith("?") && !stringPattern.startsWith(".")) { stringPattern = "*" + stringPattern; } patternMatcher.setPattern(stringPattern); }
Source:
public DiagnosticsReportSource heapDump() { return new DiagnosticsReportSource() { @Override public String destinationPath() { return "heapdump.hprof"; } @Override public void addToArchive( Path archiveDestination, DiagnosticsReporterProgressInteractions progress ) throws IOException { progress.info( "dumping..." ); Path tempFile = Files.createTempFile("neo4j-heapdump", ".hprof"); Files.deleteIfExists( tempFile ); heapDump( tempFile.toAbsolutePath().toString() ); progress.info( "archiving..." ); long size = Files.size( tempFile ); InputStream in = Files.newInputStream( tempFile ); try ( ProgressAwareInputStream inStream = new ProgressAwareInputStream( in, size, progress::percentChanged ) ) { Files.copy( inStream, archiveDestination ); } Files.delete( tempFile ); } @Override public long estimatedSize( DiagnosticsReporterProgressInteractions progress ) { try { MemoryMXBean bean = ManagementFactory.getPlatformMXBean( mBeanServer, MemoryMXBean.class ); long totalMemory = bean.getHeapMemoryUsage().getCommitted() + bean.getNonHeapMemoryUsage().getCommitted(); return (long) (totalMemory * 1.2); } catch ( IOException e ) { progress.error( "Unable to determine size of neo4j instance memory", e ); } return 0; } }; }

Target:
public DiagnosticsReportSource heapDump() { return new DiagnosticsReportSource() { @Override public String destinationPath() { return "heapdump.hprof"; } @Override public void addToArchive( Path archiveDestination, DiagnosticsReporterProgress progress ) throws IOException { progress.info( "dumping..." ); Path tempFile = Files.createTempFile("neo4j-heapdump", ".hprof"); Files.deleteIfExists( tempFile ); heapDump( tempFile.toAbsolutePath().toString() ); progress.info( "archiving..." ); long size = Files.size( tempFile ); InputStream in = Files.newInputStream( tempFile ); try ( ProgressAwareInputStream inStream = new ProgressAwareInputStream( in, size, progress::percentChanged ) ) { Files.copy( inStream, archiveDestination ); } Files.delete( tempFile ); } @Override public long estimatedSize( DiagnosticsReporterProgress progress ) throws IOException { MemoryMXBean bean = ManagementFactory.getPlatformMXBean( mBeanServer, MemoryMXBean.class ); long totalMemory = bean.getHeapMemoryUsage().getCommitted() + bean.getNonHeapMemoryUsage().getCommitted(); return (long) (totalMemory * 1.2); } }; }
Source:
public @NonNull Map<@NonNull String, @NonNull String> getWorkerInformation(long t) { int tid = fHostTid.getTid(); if (tid == -1) { return Collections.emptyMap(); } Map<String, String> workerInfo = new HashMap<>(); workerInfo.put(OsStrings.tid(), String.valueOf(tid)); Optional<@Nullable KernelAnalysisModule> kam = TmfTraceManager.getInstance().getActiveTraceSet() .stream() .filter(trace -> trace.getHostId().equals(getHostId())) .map(trace -> TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID)) .filter(Objects::nonNull) .findFirst(); if (!kam.isPresent()) { return Collections.emptyMap(); } KernelAnalysisModule module = kam.get(); int priority = KernelThreadInformationProvider.getThreadPriority(module, tid, t); if (priority != -1) { String execName = KernelThreadInformationProvider.getExecutableName(module, tid, t); if (execName != null) { return ImmutableMap.of(NonNullUtils.nullToEmptyString(Messages.OsWorker_threadPriority), Integer.toString(priority), OsStrings.execName(), execName, OsStrings.tid(), Integer.toString(tid)); } return Collections.singletonMap(NonNullUtils.nullToEmptyString(Messages.OsWorker_threadPriority), Integer.toString(priority)); } return Collections.emptyMap(); }

Target:
public @NonNull Map<@NonNull String, @NonNull String> getWorkerInformation(long t) { int tid = fHostTid.getTid(); if (tid == -1) { return Collections.emptyMap(); } ImmutableMap.Builder<String, String> workerInfo = new Builder<>(); workerInfo.put(OsStrings.tid(), String.valueOf(tid)); Optional<@Nullable KernelAnalysisModule> kam = TmfTraceManager.getInstance().getActiveTraceSet() .stream() .filter(trace -> trace.getHostId().equals(getHostId())) .map(trace -> TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID)) .filter(Objects::nonNull) .findFirst(); if (!kam.isPresent()) { return workerInfo.build(); } KernelAnalysisModule module = kam.get(); int priority = KernelThreadInformationProvider.getThreadPriority(module, tid, t); if (priority != -1) { workerInfo.put(NonNullUtils.nullToEmptyString(Messages.OsWorker_threadPriority), Integer.toString(priority)); } String execName = KernelThreadInformationProvider.getExecutableName(module, tid, t); if (execName != null) { workerInfo.put(OsStrings.execName(), execName); } return workerInfo.build(); }
Source:
public void validate() throws JobConfigValidationException { super.validate(); try { final JobArguments arguments = this.getJobArguments(); final String ownerKey = arguments.getAsString(OWNER_KEY); final String consumerUuid = arguments.getAsString(CONSUMER_UUID_KEY); final String[] prodIds = arguments.getAs(PROD_IDS_KEY, String[].class); final String[] pools = arguments.getAs(FROM_POOLS_KEY, String[].class); if (ownerKey == null || ownerKey.isEmpty()) { final String errmsg = "Owner has not been set!"; throw new JobConfigValidationException(errmsg); } if (consumerUuid == null || consumerUuid.isEmpty()) { final String errmsg = "Consumer UUID has not been set!"; throw new JobConfigValidationException(errmsg); } if (prodIds == null || prodIds.length == 0) { final String errmsg = "Product ids has not been set!"; throw new JobConfigValidationException(errmsg); } if (pools == null) { final String errmsg = "Pools has not been set!"; throw new JobConfigValidationException(errmsg); } } catch (ArgumentConversionException e) { final String errmsg = "One or more required arguments are of the wrong type"; throw new JobConfigValidationException(errmsg, e); } }

Target:
public void validate() throws JobConfigValidationException { super.validate(); try { final JobArguments arguments = this.getJobArguments(); final String consumerUuid = arguments.getAsString(CONSUMER_UUID_KEY); final String[] prodIds = arguments.getAs(PROD_IDS_KEY, String[].class); final String[] pools = arguments.getAs(FROM_POOLS_KEY, String[].class); if (consumerUuid == null || consumerUuid.isEmpty()) { final String errmsg = "Consumer UUID has not been set!"; throw new JobConfigValidationException(errmsg); } if (prodIds == null || prodIds.length == 0) { final String errmsg = "Product ids has not been set!"; throw new JobConfigValidationException(errmsg); } if (pools == null) { final String errmsg = "Pools has not been set!"; throw new JobConfigValidationException(errmsg); } } catch (ArgumentConversionException e) { final String errmsg = "One or more required arguments are of the wrong type"; throw new JobConfigValidationException(errmsg, e); } }
Source:
public void testWithSideEffect() throws InterruptedException { Task<?> task = value("value1Task", "value1").withSideEffect("delayed sideEffect", v -> delayedValue("value2", 5, TimeUnit.SECONDS)); runAndWait(task); Assert.assertFalse(_traceCaptureListener.isDone()); Assert.assertTrue(_traceCaptureListener.await(30, TimeUnit.SECONDS)); Trace trace = _traceCaptureListener.getTrace(); Assert.assertNotNull(trace); Optional<ShallowTrace> sideEffectTrace = findTraceByName(trace, "delayed sideEffect"); Assert.assertTrue(sideEffectTrace.isPresent()); Assert.assertEquals(sideEffectTrace.get().getResultType(), ResultType.SUCCESS); Optional<ShallowTrace> valueTrace = findTraceByName(trace, "value2 delayed"); Assert.assertTrue(valueTrace.isPresent()); Assert.assertEquals(valueTrace.get().getResultType(), ResultType.SUCCESS); }

Target:
public void testWithSideEffect() throws InterruptedException { Task<?> task = value("value1Task", "value1").withSideEffect("delayed sideEffect", v -> delayedValue("value2", 100, TimeUnit.MILLISECONDS)); runAndWait(task); Assert.assertTrue(_traceCaptureListener.await(30, TimeUnit.SECONDS)); Trace trace = _traceCaptureListener.getTrace(); Assert.assertNotNull(trace); Optional<ShallowTrace> sideEffectTrace = findTraceByName(trace, "delayed sideEffect"); Assert.assertTrue(sideEffectTrace.isPresent()); Assert.assertEquals(sideEffectTrace.get().getResultType(), ResultType.SUCCESS); Optional<ShallowTrace> valueTrace = findTraceByName(trace, "value2 delayed"); Assert.assertTrue(valueTrace.isPresent()); Assert.assertEquals(valueTrace.get().getResultType(), ResultType.SUCCESS); }