auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testItTimesOutProperly() throws Exception { String validationQuery = "select 1"; DBI dbi = mock(DBI.class); Handle handle = mock(Handle.class); when(dbi.open()).thenReturn(handle); Mockito.doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { try { TimeUnit.SECONDS.sleep(10); } catch (Exception ignored) return null; } }).when(handle).execute(validationQuery); DBIHealthCheck dbiHealthCheck = new DBIHealthCheck(Executors.newSingleThreadExecutor(), Duration.milliseconds(5), dbi, validationQuery); HealthCheck.Result result = dbiHealthCheck.check(); assertThat("is unhealthy", false, is(result.isHealthy())); }

Target:
public void testItTimesOutProperly() throws Exception { String validationQuery = "select 1"; DBI dbi = mock(DBI.class); Handle handle = mock(Handle.class); when(dbi.open()).thenReturn(handle); Mockito.doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { try { TimeUnit.SECONDS.sleep(10); } catch (Exception ignored) { } return null; } }).when(handle).execute(validationQuery); ExecutorService executorService = Executors.newSingleThreadExecutor(); DBIHealthCheck dbiHealthCheck = new DBIHealthCheck(executorService, Duration.milliseconds(5), dbi, validationQuery); HealthCheck.Result result = dbiHealthCheck.check(); executorService.shutdown(); assertThat("is unhealthy", false, is(result.isHealthy())); }
Source:
public List<Object> load(List<EntityInfo> entityInfos) { int entitiesSize = entityInfos.size(); Set<Object> keys = new LinkedHashSet<>(entitiesSize); for (EntityInfo e : entityInfos) { keys.add(decodeKey(e)); } Map<?, ?> entries = cache.getAll(keys); List<Object> results = new LinkedList<>(); for (Object key : keys) { Object value = entries.get(key); if (value != null) { results.add(value); } } return results; }

Target:
public List<Object> load(List<EntityInfo> entityInfos) { int entitiesSize = entityInfos.size(); Set<Object> keys = new LinkedHashSet<>(entitiesSize); for (EntityInfo e : entityInfos) { keys.add(decodeKey(e)); } Map<?, ?> entries = cache.getAll(keys); List<Object> results = new ArrayList<>(entitiesSize); for (Object key : keys) { Object value = entries.get(key); if (value != null) { results.add(value); } } return results; }
Source:
public ITypedElement getRight() { return getFileRevisionTypedElement(gitPath, baseCommit, repo); }

Target:
public ITypedElement getRight() { return getFileRevisionTypedElement(gitPath, remoteCommit, repo); }
Source:
private Object createComplexRecord(int index) { GenericRecord record = new GenericData.Record(ComplexRecord.SCHEMA$); record.put("id", index); record.put("string_value", "Name" + index); record.put("bytes_value", java.nio.ByteBuffer.wrap(("sample bytes").getBytes())); GenericData.Array<String> arrayValues = new GenericData.Array<>(index, ComplexRecord.SCHEMA$.getField("array_values").schema().getTypes().get(1)); arrayValues.addAll(IntStream.range(0, index).mapToObj(String::valueOf).collect(Collectors.toList())); record.put("array_values", arrayValues); return record; }

Target:
private Object createComplexRecord(int index) { GenericRecord record = new GenericData.Record(ComplexRecord.SCHEMA$); record.put("id", index); record.put("string_value", "Name" + index); record.put("bytes_value", ByteBuffer.wrap(("sample bytes").getBytes())); GenericData.Array<String> arrayValues = new GenericData.Array<>(index, ComplexRecord.SCHEMA$.getField("array_values").schema().getTypes().get(1)); arrayValues.addAll(IntStream.range(0, index).mapToObj(String::valueOf).collect(Collectors.toList())); record.put("array_values", arrayValues); return record; }
Source:
public void write(byte[] data, final int offset, final int length) { currentBlock = getOrCreateCurrentBlock(); try { currentBlock.write(data, offset, length); } catch (FixedBlock.OutOfBlockBufferMemoryException e) { FixedBlock previousBlock = null; previousBlock = moveToNextBlock(); if(!currentBlock.isFresh()) { throw new RuntimeException("New block is not flash."); } if(!previousBlock.isClear()) { previousBlock.moveLastObjectDataTo(currentBlock); } currentBlock.write(data, offset, length); } size += length; }

Target:
public void write(byte[] data, final int offset, final int length) { currentBlock = getOrCreateCurrentBlock(); try { currentBlock.write(data, offset, length); } catch (FixedBlock.OutOfBlockBufferMemoryException e) { FixedBlock previousBlock = null; previousBlock = moveToNextBlock(); if(!currentBlock.isFresh()) { throw new RuntimeException("New block is not fresh."); } if(!previousBlock.isClear()) { previousBlock.moveLastObjectDataTo(currentBlock); } currentBlock.write(data, offset, length); } size += length; }
Source:
private static List<TestPropertySourceAttributes> resolveTestPropertySourceAttributes(Class<?> testClass) { Assert.notNull(testClass, "Class must not be null"); return MergedAnnotations .from(testClass, MergedAnnotations.SearchStrategy.EXHAUSTIVE) .stream(TestPropertySource.class) .map(a -> new TestPropertySourceAttributes((Class<?>) a.getSource(), a.synthesize())) .collect(Collectors.toList()); }

Target:
private static List<TestPropertySourceAttributes> resolveTestPropertySourceAttributes(Class<?> testClass) { Assert.notNull(testClass, "Class must not be null"); return MergedAnnotations .from(testClass, MergedAnnotations.SearchStrategy.EXHAUSTIVE) .stream(TestPropertySource.class) .map(TestPropertySourceUtils::makeTestPropertySourceAttribute) .collect(Collectors.toList()); }
Source:
public static void migrateOsgiLaunchConfiguration(ILaunchConfigurationWorkingCopy configuration) throws CoreException { ILaunchConfigurationWorkingCopy wc = getWorkingCopy(configuration); convertToSet(wc, IPDELauncherConstants.WORKSPACE_BUNDLES, IPDELauncherConstants.SELECTED_WORKSPACE_BUNDLES); convertToSet(wc, IPDELauncherConstants.TARGET_BUNDLES, IPDELauncherConstants.SELECTED_TARGET_BUNDLES); convertToSet(wc, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS, IPDELauncherConstants.DESELECTED_WORKSPACE_BUNDLES); }

Target:
public static void migrateOsgiLaunchConfiguration(ILaunchConfigurationWorkingCopy configuration) throws CoreException { convertToSet(configuration, IPDELauncherConstants.WORKSPACE_BUNDLES, IPDELauncherConstants.SELECTED_WORKSPACE_BUNDLES); convertToSet(configuration, IPDELauncherConstants.TARGET_BUNDLES, IPDELauncherConstants.SELECTED_TARGET_BUNDLES); convertToSet(configuration, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS, IPDELauncherConstants.DESELECTED_WORKSPACE_BUNDLES); }
Source:
public Object apply(ReviewerResource rsrc) throws OrmException, NoSuchChangeException { return json.format(rsrc); }

Target:
public Object apply(ReviewerResource rsrc) throws OrmException { return json.format(rsrc); }
Source:
protected boolean processResponseError(ReplicaId replicaId, ServerErrorCode serverErrorCode) throws CoordinatorException { switch (serverErrorCode) { case No_Error: case Blob_Deleted: return true; case Blob_Not_Found: blobNotFoundCount++; if (blobNotFoundCount == replicaIdCount) { String message = "DeleteOperation : Blob not found : blobNotFoundCount == replicaIdCount == " + blobNotFoundCount + "."; logger.trace(message); throw new CoordinatorException(message, CoordinatorError.BlobDoesNotExist); } setCurrentError(CoordinatorError.BlobDoesNotExist); return false; case Blob_Expired: logger.trace("Server returned Blob Expired error for DeleteOperation"); setCurrentError(CoordinatorError.BlobExpired); return false; case Disk_Unavailable: logger.trace("Server returned Disk Unavailable error for DeleteOperation"); setCurrentError(CoordinatorError.AmbryUnavailable); return false; case IO_Error: logger.trace("Server returned IO error for DeleteOperation"); setCurrentError(CoordinatorError.UnexpectedInternalError); return false; case Partition_Unknown: logger.trace("Server returned Partition Unknown error for DeleteOperation"); setCurrentError(CoordinatorError.BlobDoesNotExist); return false; default: CoordinatorException e = new CoordinatorException("Server returned unexpected error for DeleteOperation.", CoordinatorError.UnexpectedInternalError); logger.error("{} DeleteResponse for BlobId received from ReplicaId had unexpected error code {}: {}", context, blobId, replicaId, serverErrorCode, e); throw e; } }

Target:
protected boolean processResponseError(ReplicaId replicaId, ServerErrorCode serverErrorCode) throws CoordinatorException { switch (serverErrorCode) { case No_Error: case Blob_Deleted: return true; case Blob_Not_Found: blobNotFoundCount++; if (blobNotFoundCount == replicaIdCount) { String message = context + " DeleteOperation : Blob not found : blobNotFoundCount == replicaIdCount == " + blobNotFoundCount + "."; logger.trace(message); throw new CoordinatorException(message, CoordinatorError.BlobDoesNotExist); } setCurrentError(CoordinatorError.BlobDoesNotExist); return false; case Blob_Expired: logger.trace(context + " Server returned Blob Expired error for DeleteOperation"); setCurrentError(CoordinatorError.BlobExpired); return false; case Disk_Unavailable: logger.trace(context + " Server returned Disk Unavailable error for DeleteOperation"); setCurrentError(CoordinatorError.AmbryUnavailable); return false; case IO_Error: logger.trace(context + " Server returned IO error for DeleteOperation"); setCurrentError(CoordinatorError.UnexpectedInternalError); return false; case Partition_Unknown: logger.trace(context + " Server returned Partition Unknown error for DeleteOperation"); setCurrentError(CoordinatorError.BlobDoesNotExist); return false; default: CoordinatorException e = new CoordinatorException("Server returned unexpected error for DeleteOperation.", CoordinatorError.UnexpectedInternalError); logger.error("{} DeleteResponse for BlobId received from ReplicaId had unexpected error code {}: {}", context, blobId, replicaId, serverErrorCode, e); throw e; } }
Source:
private OrcRecordReader createRecordReader() throws IOException { OrcDataSource dataSource = new FileOrcDataSource(booleanNoNullFile, new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), true); OrcReader orcReader = new OrcReader(dataSource, ORC, new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE)); return orcReader.createRecordReader( ImmutableMap.of(0, BOOLEAN), OrcPredicate.TRUE, DateTimeZone.UTC, newSimpleAggregatedMemoryContext(), INITIAL_BATCH_SIZE); }

Target:
private OrcRecordReader createRecordReader() throws IOException { OrcDataSource dataSource = new FileOrcDataSource(booleanNoNullFile, new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), true); OrcReader orcReader = new OrcReader(dataSource, ORC, new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE)); return orcReader.createRecordReader( ImmutableMap.of(0, BOOLEAN), OrcPredicate.TRUE, UTC, newSimpleAggregatedMemoryContext(), INITIAL_BATCH_SIZE); }
Source:
public static String[] getCompletionResults(String match) { ArrayList<String> data = new ArrayList<String>(); if (barLookups) return new String[] {"No completion data found."}; boolean tapsetAndProbeIncluded = isTapsetAndProbe(match); if (tapsetAndProbeIncluded) { ArrayList<String> temp = builtMetadata.get(getTapset(match)); String probe = getTapsetProbe(match); for (int i=0; i<temp.size(); i++) { if (temp.get(i).startsWith(probe)) { data.add(temp.get(i)); } } } else{ Set<String> tapset = builtMetadata.keySet(); for (String probePoint : tapset) { if (probePoint.startsWith(match)){ data.add(probePoint); } } } if (data == null) return new String[] {}; else return data.toArray(new String[0]); }

Target:
public static String[] getCompletionResults(String match) { ArrayList<String> data = new ArrayList<String>(); if (barLookups) return new String[] {"No completion data found."}; boolean tapsetAndProbeIncluded = isTapsetAndProbe(match); if (tapsetAndProbeIncluded) { ArrayList<String> temp = builtMetadata.get(getTapset(match)); if (temp == null) return new String[] {"No completion data found."}; String probe = getTapsetProbe(match); for (int i=0; i<temp.size(); i++) { if (temp.get(i).startsWith(probe)) { data.add(temp.get(i)); } } } else{ Set<String> tapset = builtMetadata.keySet(); for (String probePoint : tapset) { if (probePoint.startsWith(match)){ data.add(probePoint); } } } if (data == null) return new String[] {}; else return data.toArray(new String[0]); }
Source:
private static Either<byte[]> runCompilerFile( final Context context, final File compiler, final List<String> arguments) throws ExitException { Either<Utils.CommandResult> result; if (Utils.isWindows()) { result = Utils.runCommand(context, compiler.getAbsolutePath(), compiler.getParentFile(), arguments); } else { final Either<String> mono = Mono.findMono(context); if (mono.isSuccess()) { arguments.add(0, compiler.getAbsolutePath()); int retryCount = 0; result = Utils.runCommand(context, mono.get(), compiler.getParentFile(), arguments); while(monoNativeFailure(result) && retryCount < 4) { retryCount++; if(retryCount > 0) { context.warning("Running Mono failed. Mono is buggy, so retry("+retryCount+") is in order... in 1 second"); context.error(result.explainError()); Utils.sleep(1000); } result = Utils.runCommand(context, mono.get(), compiler.getParentFile(), arguments); } } else { context.error("Mono is required to run DSL compiler. Mono not detected or specified."); throw new ExitException(); } } if (!result.isSuccess()) { return Either.fail(result.whyNot()); } if (result.get().exitCode != 0) { return Either.fail(result.get().output + result.get().error); } return Either.success(result.get().output.getBytes(UTF_8)); }

Target:
private static Either<byte[]> runCompilerFile( final Context context, final File compiler, final List<String> arguments) throws ExitException { Either<Utils.CommandResult> result; if (Utils.isWindows()) { result = Utils.runCommand(context, compiler.getAbsolutePath(), compiler.getParentFile(), arguments); } else { final Either<String> mono = Mono.findMono(context); if (mono.isSuccess()) { arguments.add(0, compiler.getAbsolutePath()); result = Utils.runCommand(context, mono.get(), compiler.getParentFile(), arguments); if(monoNativeFailure(result) && promptUserMonoRetry(context)) { context.warning("Retrying in 1 second ..."); context.error(result.explainError()); sleep(1000); result = Utils.runCommand(context, mono.get(), compiler.getParentFile(), arguments); } } else { context.error("Mono is required to run DSL compiler. Mono not detected or specified."); throw new ExitException(); } } if (!result.isSuccess()) { return Either.fail(result.whyNot()); } if (result.get().exitCode != 0) { return Either.fail(result.get().output + result.get().error); } return Either.success(result.get().output.getBytes(UTF_8)); }
Source:
public void marshal( DatabaseName databaseName, WritableChannel channel ) throws IOException { if ( databaseName == null ) { channel.put( (byte) 0 ); } else if ( databaseName.name().length() > 127 ) { throw new IOException( "The database name is too large to be stored. It must be fewer than 128 UTF-8 characters." ); } else { channel.put( (byte) 1 ); channel.put( (byte) databaseName.name().length() ); channel.put( UTF8.encode( databaseName.name() ), databaseName.name().length() ); } }

Target:
public void marshal( DatabaseName databaseName, WritableChannel channel ) throws IOException { StringMarshal.marshal( channel, databaseName.name() ); }
Source:
public ConnectHostToStoragePoolServerCommandBase() { super(); }

Target:
public ConnectHostToStoragePoolServerCommandBase() { }
Source:
public List<INetwork> getApprovedNetworkList() throws QuadrigaStorageException { List<INetwork> networkList = new ArrayList<INetwork>(); try { networkList = networkmapper.getListOfApprovedNetworks(); } catch (QuadrigaStorageException e) { logger.error("Something went wrong in DB", e); } return networkList; }

Target:
public List<INetwork> getApprovedNetworkList() throws QuadrigaStorageException { List<INetwork> networkList = new ArrayList<INetwork>(); try { networkList = networkmapper.getListOfApprovedNetworks(); } catch (QuadrigaStorageException e) { logger.error("Something went wrong in DB", e); throw e; } return networkList; }
Source:
private boolean isJava8() { String version = System.getProperty("java.version"); int pos = version.indexOf('.'); pos = version.indexOf('.', pos+1); return Double.valueOf(version.substring (0, pos)).compareTo(Double.valueOf(1.8)) >= 0; }

Target:
private boolean isJava8() { return Util.DEFAULT != null; }
Source:
public void removeValue() { thrown.expect(UnsupportedOperationException.class); VerboseIterable<String> verboseIterable = new VerboseIterable<String>( VALID_LIST, NO_NEXT_VALUE_ERROR); verboseIterable.iterator().remove(); MatcherAssert.assertThat(verboseIterable, IsIterableWithSize .<String> iterableWithSize(VALID_LIST.size() - 1)); }

Target:
public final void removeValue() { new VerboseIterable<String>( Arrays.asList( "If-None-Match: \"737060cd8c284d8af7ad3082f209582d\"", "If-Range: \"737060cd8c284d8af7ad3082f209582d\"", "Max-Forwards: 10", "Origin: <LINK_0>", "User-Agent: Mozilla/5.0 (X11; Linux x86_64) Gecko/2010010" ), "Thrown Error Message" ).iterator().remove(); }
Source:
private Repository openRepository() { try { return args.server.openRepository(change.getProject()); } catch (RepositoryNotFoundException e) { return null; } }

Target:
private Repository openRepository() { try { return args.server.openRepository(change.getProject()); } catch (RepositoryNotFoundException e) { log.error("Cannot open repository", e); return null; } }
Source:
public void registerImport(DetailAST imp) { final FullIdent ident = FullIdent.createFullIdent( imp.getLastChild().getPreviousSibling()); final String fullName = ident.getText(); if (fullName.charAt(fullName.length() - 1) != '*') { final int lastDot = fullName.lastIndexOf('.'); importedClassPackage.put(fullName.substring(lastDot + 1), fullName); } }

Target:
public void registerImport(DetailAST imp) { final FullIdent ident = FullIdent.createFullIdent( imp.getLastChild().getPreviousSibling()); final String fullName = ident.getText(); if (fullName.charAt(fullName.length() - 1) != '*') { final int lastDot = fullName.lastIndexOf(DOT); importedClassPackage.put(fullName.substring(lastDot + 1), fullName); } }
Source:
public final synchronized void addFunctions(String catalog, List<? extends SqlFunction> functions) { if (functionNamespaces.get(catalog) == null) { FunctionNamespace namespace = new StaticFunctionNamespace(typeManager, blockEncodingSerde, featuresConfig); namespace.addFunctions(functions); ImmutableMap.Builder<String, FunctionNamespace> builder = ImmutableMap.<String, FunctionNamespace>builder() .putAll(functionNamespaces) .put(catalog, namespace); functionNamespaces = builder.build(); } else { functionNamespaces.get(catalog).addFunctions(functions); } }

Target:
public synchronized void addFunctions(String catalog, List<? extends SqlFunction> functions) { Map<Boolean, List<SqlFunction>> operatorAndFunctionMap = functions.stream() .collect(Collectors.partitioningBy(function -> isOperator(function.getSignature()))); operatorNamespace.addFunctions(operatorAndFunctionMap.get(true)); if (!functionNamespaces.containsKey(catalog)) { FunctionNamespace namespace = new StaticFunctionNamespace(typeManager, blockEncodingSerde, featuresConfig); namespace.addFunctions(operatorAndFunctionMap.get(false)); functionNamespaces = ImmutableMap.<String, FunctionNamespace>builder() .putAll(functionNamespaces) .put(catalog, namespace) .build(); } else { functionNamespaces.get(catalog).addFunctions(operatorAndFunctionMap.get(false)); } }
Source:
public Priority getPriority(DBObject dbObject) { Double score = null; List<String> positiveScoreReasons = Lists.newArrayList(); List<String> negativeScoreReasons = Lists.newArrayList(); try { score = TranslatorUtils.toDouble(dbObject, ITEM_PRIORITY_KEY); } catch (ClassCastException e) { DBObject priority = TranslatorUtils.toDBObject(dbObject, ITEM_PRIORITY_KEY); score = TranslatorUtils.toDouble(priority, SCORE_KEY); DBObject priorityReasons = TranslatorUtils.toDBObject(priority, REASONS_KEY); List<DBObject> positiveReasons = TranslatorUtils.toDBObjectList(priorityReasons, POSITIVE_REASONS_KEY); for (Object reason : positiveReasons) { if (reason != null && reason instanceof String) { String string = (String) reason; positiveScoreReasons.add(string); } } List<DBObject> negativeReasons = TranslatorUtils.toDBObjectList(priorityReasons, NEGATIVE_REASONS_KEY); for (Object reason : positiveReasons) { if (reason != null && reason instanceof String) { String string = (String) reason; negativeScoreReasons.add(string); } } } PriorityScoreReasons priorityScoreReasons = new PriorityScoreReasons(positiveScoreReasons, negativeScoreReasons); return new Priority(score, priorityScoreReasons); }

Target:
public Priority getPriority(DBObject dbObject) { Double score = null; List<String> positiveScoreReasons = Lists.newArrayList(); List<String> negativeScoreReasons = Lists.newArrayList(); try { score = TranslatorUtils.toDouble(dbObject, ITEM_PRIORITY_KEY); } catch (ClassCastException e) { DBObject priority = TranslatorUtils.toDBObject(dbObject, ITEM_PRIORITY_KEY); score = TranslatorUtils.toDouble(priority, SCORE_KEY); DBObject priorityReasons = TranslatorUtils.toDBObject(priority, REASONS_KEY); List<DBObject> positiveReasons = TranslatorUtils.toDBObjectList(priorityReasons, POSITIVE_REASONS_KEY); for (Object reason : positiveReasons) { if (reason != null && reason instanceof String) { String string = (String) reason; positiveScoreReasons.add(string); } } List<DBObject> negativeReasons = TranslatorUtils.toDBObjectList(priorityReasons, NEGATIVE_REASONS_KEY); for (Object reason : negativeReasons) { if (reason != null && reason instanceof String) { String string = (String) reason; negativeScoreReasons.add(string); } } } PriorityScoreReasons priorityScoreReasons = new PriorityScoreReasons(positiveScoreReasons, negativeScoreReasons); return new Priority(score, priorityScoreReasons); }
Source:
public synchronized void remove(Object key) { tMultiTheadLockMap.remove(key); }

Target:
public void remove(Object key) { tMultiTheadLockMap.remove(key); }
Source:
private PagedResources.PageMetadata buildPageMetadata(Integer pageSize, Integer pageNumber, Integer totalNumberOfResults) throws IllegalArgumentException { Long totalPages = pageSize == 0L ? 0L : (long) Math.ceil((double) totalNumberOfResults / (double) pageSize); if (pageNumber < 0 || pageNumber >= totalPages) { throw new IllegalArgumentException("For the given page size, there are " + totalPages + " page(s), so " + "the correct page range is from 0 to " + String.valueOf(totalPages - 1) + " (both included)."); } return new PagedResources.PageMetadata(pageSize, pageNumber, totalNumberOfResults, totalPages); }

Target:
private PagedResources.PageMetadata buildPageMetadata(Integer pageSize, Integer pageNumber, Integer totalNumberOfResults) throws IllegalArgumentException { Long totalPages = pageSize == 0L ? 0L : (long) Math.ceil((double) totalNumberOfResults / (double) pageSize); if (pageNumber < 0 || pageNumber >= totalPages) { throw new IllegalArgumentException("For the given page size, there are " + totalPages + " page(s), so " + "the correct page range is from 0 to " + (totalPages - 1) + " (both included)."); } return new PagedResources.PageMetadata(pageSize, pageNumber, totalNumberOfResults, totalPages); }
Source:
protected List<CompositeEvent> retrieveCompositeEventList(DocumentReference user) throws NotificationException { CompositeEvent resultCompositeEvent = new CompositeEvent(this.compositeEvent); if (this.hasCorrespondingNotificationPreference(user, resultCompositeEvent)) { for (NotificationFilter filter : this.notificationFilterManager.getAllNotificationFilters(user)) { CopyOnWriteArrayList<Event> events = new CopyOnWriteArrayList<>(resultCompositeEvent.getEvents()); for (Event event : events) { if (filter.filterEvent(event, user, NotificationFormat.EMAIL)) { resultCompositeEvent.remove(event); if (resultCompositeEvent.getEvents().size() == 0) { return Collections.emptyList(); } } } } return Collections.singletonList(resultCompositeEvent); } return Collections.emptyList(); }

Target:
protected List<CompositeEvent> retrieveCompositeEventList(DocumentReference user) throws NotificationException { CompositeEvent resultCompositeEvent = new CompositeEvent(this.compositeEvent); if (this.hasCorrespondingNotificationPreference(user, resultCompositeEvent)) { for (NotificationFilter filter : this.notificationFilterManager.getAllNotificationFilters(user)) { Iterator<Event> it = resultCompositeEvent.getEvents().iterator(); while (it.hasNext()) { Event event = it.next(); if (filter.filterEvent(event, user, NotificationFormat.EMAIL)) { it.remove(); if (resultCompositeEvent.getEvents().size() == 0) { return Collections.emptyList(); } } } } return Collections.singletonList(resultCompositeEvent); } return Collections.emptyList(); }
Source:
public void configure() throws Exception { onException(Throwable.class).logStackTrace(true); createCamelContext(); from("timer:simple") .process( new Processor() { private int count; @Override public void process(Exchange exchange) { count++; exchange.getIn().setBody("Message " + count); System.out.println(count + " PING"); } }) .to("amqp:sdk.example"); from("amqp:topic:sdk.example") .process(exchange -> System.out.println("ACK " + exchange.getIn().getBody())) .stop(); }

Target:
public void configure() throws Exception { onException(Throwable.class).logStackTrace(true); createCamelContext(); CamelContext camelContext = getContext(); from("timer:simple") .process( new Processor() { private int count; @Override public void process(Exchange exchange) { count++; exchange.getIn().setBody("Message " + count); System.out.println(count + " PING"); } }) .to("amqp:sdk.example"); from("amqp:topic:sdk.example") .process(exchange -> System.out.println("ACK " + exchange.getIn().getBody())) .stop(); }
Source:
public void updated(Dictionary config) throws ConfigurationException { logger.info("Update DD-WRT Binding configuration ..."); if (config == null || config.isEmpty()) { throw new RuntimeException("No properties in openhab.cfg set!"); } if (config != null) { String ip = (String) config.get("ip"); if (StringUtils.isNotBlank(ip)) { if (!ip.equals(DDWRTBinding.ip)) { DDWRTBinding.ip = ip; String port = (String) config.get("port"); if (!StringUtils.isNotBlank(port)) { port = "23"; } DDWRTBinding.port = port; conditionalDeActivate(); } } String username = (String) config.get("username"); if (StringUtils.isNotBlank(username)) { DDWRTBinding.username = username; } String password = (String) config.get("password"); if (StringUtils.isNotBlank(password)) { DDWRTBinding.password = password; } String interface_24 = (String) config.get("interface_24"); if (StringUtils.isNotBlank(interface_24)) { DDWRTBinding.interface_24 = interface_24; } String interface_50 = (String) config.get("interface_50"); if (StringUtils.isNotBlank(interface_50)) { DDWRTBinding.interface_50 = interface_50; } String interface_guest = (String) config.get("interface_guest"); if (StringUtils.isNotBlank(interface_guest)) { DDWRTBinding.interface_guest = interface_guest; } } }

Target:
public void updated(Dictionary config) throws ConfigurationException { logger.info("Update DD-WRT Binding configuration ..."); if (config == null) { return; } else { if (config.isEmpty()) { throw new RuntimeException("No properties in openhab.cfg set!"); } String ip = (String) config.get("ip"); if (StringUtils.isNotBlank(ip)) { if (!ip.equals(DDWRTBinding.ip)) { DDWRTBinding.ip = ip; String port = (String) config.get("port"); if (!StringUtils.isNotBlank(port)) { port = "23"; } DDWRTBinding.port = port; conditionalDeActivate(); } } String username = (String) config.get("username"); if (StringUtils.isNotBlank(username)) { DDWRTBinding.username = username; } String password = (String) config.get("password"); if (StringUtils.isNotBlank(password)) { DDWRTBinding.password = password; } String interface_24 = (String) config.get("interface_24"); if (StringUtils.isNotBlank(interface_24)) { DDWRTBinding.interface_24 = interface_24; } String interface_50 = (String) config.get("interface_50"); if (StringUtils.isNotBlank(interface_50)) { DDWRTBinding.interface_50 = interface_50; } String interface_guest = (String) config.get("interface_guest"); if (StringUtils.isNotBlank(interface_guest)) { DDWRTBinding.interface_guest = interface_guest; } } }
Source:
public void MonetizationModuleTest_022(String countryCode, Boolean isFromsearch, String testWiki, String testArticle, int isMulti) { wikiURL = urlBuilder.getUrlForWiki(testWiki); String articleURL = urlBuilder.getUrlForPath(testWiki, testArticle); WikiBasePageObject base = new WikiBasePageObject(driver); base.openWikiPage(articleURL); MonetizationModuleComponentObject monetizationModule = new MonetizationModuleComponentObject(driver); if (isFromsearch) { monetizationModule.setCookieFromSearch(); } else { monetizationModule.deleteCookieFromSearch(); } monetizationModule.setCookieGeo(countryCode); base.refreshPage(); monetizationModule.verifyMonetizationModuleNotShown(); base.logInCookie(credentials.userName7, credentials.password7, wikiURL); base.openWikiPage(articleURL); monetizationModule.verifyMonetizationModuleNotShown(); }

Target:
public void MonetizationModuleTest_022(String countryCode, Boolean isFromsearch, String testWiki, String testArticle, int isMulti) { wikiURL = urlBuilder.getUrlForWiki(testWiki); String articleURL = urlBuilder.getUrlForPath(testWiki, testArticle); WikiBasePageObject base = new WikiBasePageObject(driver); base.openWikiPage(articleURL); MonetizationModuleComponentObject monetizationModule = new MonetizationModuleComponentObject(driver); if (isFromsearch) { monetizationModule.setCookieFromSearch(); } else { monetizationModule.deleteCookieFromSearch(); } monetizationModule.setCookieGeo(countryCode); base.refreshPage(); monetizationModule.verifyEcommerceUnitNotShown(); base.logInCookie(credentials.userName7, credentials.password7, wikiURL); base.openWikiPage(articleURL); monetizationModule.verifyEcommerceUnitNotShown(); }
Source:
public CallReader setStartTimeBefore(final ZonedDateTime startTimeBefore) { this.startTimeBefore = startTimeBefore; return this; }

Target:
public CallReader setStartTimeBefore(final ZonedDateTime startTimeBefore) { this.startTime = null; this.startTimeBefore = startTimeBefore; return this; }
Source:
public void testAggregationExpressionRewrite() throws Exception { tester().assertThat(new FunctionCallExpressionRewriter()).on(p -> p.aggregation((a) -> a.globalGrouping() .addAggregation( p.symbol("count_1", BigintType.BIGINT), new FunctionCall(QualifiedName.of("count"), ImmutableList.of()), ImmutableList.of(BigintType.BIGINT)) .source( p.values()))) .matches( PlanMatchPattern.aggregation( ImmutableMap.of("count_1", functionCall("none", ImmutableList.of())), PlanMatchPattern.values())); }

Target:
public void testAggregationExpressionRewrite() throws Exception { tester().assertThat(functionCallRewriter).on(p -> p.aggregation(a -> a .globalGrouping() .addAggregation( p.symbol("count_1", BigintType.BIGINT), new FunctionCall(QualifiedName.of("count"), ImmutableList.of()), ImmutableList.of(BigintType.BIGINT)) .source( p.values()))) .matches( PlanMatchPattern.aggregation( ImmutableMap.of("count_1", functionCall("now", ImmutableList.of())), values())); }
Source:
public void testToDateFunctionBind() throws Exception { long ts = nextTimestamp(); Date date = new Date(1); String tenantId = getOrganizationId(); initATableValues("aTable", tenantId, getDefaultSplits(tenantId),date, ts, getUrl()); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts+1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { String query = "SELECT a_date FROM atable WHERE organization_id='" + tenantId + "' and a_date < TO_DATE(?)"; PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, "1970-1-1 12:00:00"); ResultSet rs = statement.executeQuery(); verifyDateResultSet(rs, date, 3); } finally { conn.close(); } }

Target:
public void testToDateFunctionBind() throws Exception { long ts = nextTimestamp(); Date date = new Date(1); String tenantId = getOrganizationId(); initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId),date, ts, getUrl()); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts+1)); Connection conn = DriverManager.getConnection(getUrl(), props); try { String query = "SELECT a_date FROM atable WHERE organization_id='" + tenantId + "' and a_date < TO_DATE(?)"; PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, "1970-1-1 12:00:00"); ResultSet rs = statement.executeQuery(); verifyDateResultSet(rs, date, 3); } finally { conn.close(); } }
Source:
public static ExecutionEnvironmentResolutionHandler adapt(ExecutionEnvironmentConfiguration eeConfiguration) { if (eeConfiguration.isCustomProfile()) { return new CustomEEResolutionHandler(eeConfiguration); } else { return new StandardEEResolutionHandler(eeConfiguration.getProfileNameForResolver()); } }

Target:
public static ExecutionEnvironmentResolutionHandler adapt(ExecutionEnvironmentConfiguration eeConfiguration) { if (eeConfiguration.isIgnoredByResolver()) { return new AllKnownEEsResolutionHandler(); } else if (eeConfiguration.isCustomProfile()) { return new CustomEEResolutionHandler(eeConfiguration); } else { return new StandardEEResolutionHandler(eeConfiguration.getProfileName()); } }
Source:
public EurekaArchaius2InstanceConfig(Config config, String namespace, DataCenterInfo dcInfo) { this.defaultAppGroup = config.getString(FALLBACK_APP_GROUP_KEY, Values.UNKNOWN_APPLICATION); this.namespace = namespace; this.config = config.getPrefixedView(namespace); this.dcInfo = dcInfo; DiscoveryManager.getInstance().setEurekaInstanceConfig(this); }

Target:
public EurekaArchaius2InstanceConfig(Config config, String namespace, DataCenterInfo dcInfo) { this.defaultAppGroup = config.getString(FALLBACK_APP_GROUP_KEY, Values.UNKNOWN_APPLICATION); this.namespace = namespace; this.config = config.getPrefixedView(namespace); this.dcInfo = dcInfo; }
Source:
private boolean isFarmable(World world, Block block, int x, int y, int z) { return (block != null && !block.isAir(world, x, y, z) && (block == Blocks.dirt || block == Blocks.grass)); }

Target:
private boolean isFarmable(World world, Block block, int x, int y, int z) { return (block != null && (block == Blocks.dirt || block == Blocks.grass)); }
Source:
private KeyStore createRepacementKeyStore(KeyStore keyStore, char[] password) { final KeyStore replacementKeyStore = createEmptyStore(this.keyStoreType); final KeyStore.ProtectionParameter protection = new KeyStore.PasswordProtection(password); final KeyStore.Entry keyEntry; try { keyEntry = keyStore.getEntry(this.keyAlias, protection); } catch (NoSuchAlgorithmException ex) { throw new IllegalStateException("Failed to read certificate for alias " + this.keyAlias, ex); } catch (UnrecoverableEntryException ex) { throw new IllegalStateException("Failed to read certificate for alias '" + this.keyAlias + "'. Maybe the password is not correct.", ex); } catch (KeyStoreException ex) { throw new IllegalStateException("Failed to read certificate for alias " + this.keyAlias, ex); } if (keyEntry == null) { throw new IllegalStateException("Failed to read certificate for alias '" + this.keyAlias + "'. Maybe wrong alias was provided."); } try { replacementKeyStore.setEntry(this.keyAlias, keyEntry, protection); } catch (KeyStoreException ex) { throw new IllegalStateException("Failed to write certificate for alias " + this.keyAlias, ex); } return replacementKeyStore; }

Target:
private KeyStore createRepacementKeyStore(KeyStore keyStore, char[] password) { final KeyStore replacementKeyStore = createEmptyStore(KeyStoreType.DEFAULT_TYPE); final KeyStore.ProtectionParameter protection = new KeyStore.PasswordProtection(password); final KeyStore.Entry keyEntry; try { keyEntry = keyStore.getEntry(this.keyAlias, protection); } catch (NoSuchAlgorithmException ex) { throw new IllegalStateException("Failed to read certificate for alias " + this.keyAlias, ex); } catch (UnrecoverableEntryException ex) { throw new IllegalStateException("Failed to read certificate for alias '" + this.keyAlias + "'. Maybe the password is not correct.", ex); } catch (KeyStoreException ex) { throw new IllegalStateException("Failed to read certificate for alias " + this.keyAlias, ex); } if (keyEntry == null) { throw new IllegalStateException("Failed to read certificate for alias '" + this.keyAlias + "'. Maybe wrong alias was provided."); } try { replacementKeyStore.setEntry(this.keyAlias, keyEntry, protection); } catch (KeyStoreException ex) { throw new IllegalStateException("Failed to write certificate for alias " + this.keyAlias, ex); } return replacementKeyStore; }
Source:
public final void setVolumeByIncrement(float level) throws IOException { Volume volume = this.getStatus().volume; float total = volume.level; if (level > total) { while (total < level) { total = Math.min(total + volume.increment, level); setVolume(total); } } else if (level < total) { while (total > level) { total = Math.max(total - volume.increment, level); setVolume(total); } } }

Target:
public final void setVolumeByIncrement(float level) throws IOException { Volume volume = this.getStatus().volume; float total = volume.level; if (volume.increment <= 0f) { throw new ChromeCastException("Volume.increment is <= 0"); } if (level > total) { while (total < level) { total = Math.min(total + volume.increment, level); setVolume(total); } } else if (level < total) { while (total > level) { total = Math.max(total - volume.increment, level); setVolume(total); } } }
Source:
private static DateRange getNewTaskScheduleDateRange(String preference) { switch (preference) { case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_NOT_SCHEDULED: return null; case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TODAY: return TaskActivityUtil.getCurrentWeek().getToday(); case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TOMORROW: return TaskActivityUtil.getCurrentWeek().getToday().next(); } return TaskActivityUtil.getCurrentWeek(); }

Target:
private static DateRange getNewTaskScheduleDateRange(String preference) { switch (preference) { case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_NOT_SCHEDULED: return null; case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TODAY: return TaskActivityUtil.getCurrentWeek().getToday(); case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_TOMORROW: return TaskActivityUtil.getCurrentWeek().getToday().next(); case ITasksUiPreferenceConstants.SCHEDULE_NEW_TASKS_FOR_THIS_WEEK: return TaskActivityUtil.getCurrentWeek(); } return TaskActivityUtil.getCurrentWeek(); }
Source:
public String getUpstreamCert( @PathParam("dbid") String entitlementId) { Entitlement ent = entitlementCurator.find(entitlementId); if (ent == null) { throw new NotFoundException(i18n.tr( "Entitlement with ID ''{0}'' could not be found.", entitlementId)); } String subscriptionId = null; Pool entPool = ent.getPool(); if (StringUtils.isBlank(entPool.getSourceStackId())) { subscriptionId = entPool.getSubscriptionId(); } else { log.debug("Entitlement is from a stack derived pool, searching for oldest " + "active entitlements in source stack."); Entitlement e = entitlementCurator.findUpstreamEntitlementForStack( entPool.getSourceConsumer(), entPool.getSourceStackId()); if (e != null) { subscriptionId = e.getPool().getSubscriptionId(); } } if (subscriptionId == null) { throw new NotFoundException( i18n.tr("Unable to find upstream certificate for entitlement: {0}", entitlementId)); } return subResource.getSubCertAsPem(subscriptionId); }

Target:
public String getUpstreamCert( @PathParam("dbid") String entitlementId) { Entitlement ent = entitlementCurator.find(entitlementId); if (ent == null) { throw new NotFoundException(i18n.tr( "Entitlement with ID ''{0}'' could not be found.", entitlementId)); } String subscriptionId = null; Pool entPool = ent.getPool(); if (StringUtils.isBlank(entPool.getSourceStackId())) { subscriptionId = entPool.getSubscriptionId(); } else { log.debug("Entitlement is from a stack derived pool, searching for oldest " + "active entitlements in source stack."); Entitlement e = entitlementCurator.findUpstreamEntitlementForStack( entPool.getSourceConsumer(), entPool.getSourceStackId()); if (e != null) { subscriptionId = e.getPool().getSubscriptionId(); } } if (StringUtils.isEmpty(subscriptionId)) { throw new NotFoundException( i18n.tr("Unable to find upstream certificate for entitlement: {0}", entitlementId)); } return subResource.getSubCertAsPem(subscriptionId); }
Source:
private String getInstituteForStudent( CourseStudent student, List<Instructor> allInstructors, List<Account> allAccounts) { courseIdToInstituteMap.computeIfAbsent(student.getCourseId(), key -> { List<Instructor> instructorList = getInstructorsOfCourse(allInstructors, student.getCourseId()); return getInstituteForInstructors(instructorList, allAccounts); }); return courseIdToInstituteMap.get(student.getCourseId()); }

Target:
private String getInstituteForStudent( CourseStudent student, List<Instructor> allInstructors, List<Account> allAccounts) { return courseIdToInstituteMap.computeIfAbsent(student.getCourseId(), key -> { List<Instructor> instructorList = getInstructorsOfCourse(allInstructors, student.getCourseId()); return getInstituteForInstructors(instructorList, allAccounts); }); }
Source:
public void close() { try { arrayOut.close(); } catch (IOException e) { throw new ParquetRuntimeException("Error closing output stream.", e){ }; } }

Target:
public void close() { arrayOut.close(); out.close(); }
Source:
private void checkSnapDir() throws SnapdirContentCheckException { File[] files = this.snapDir.listFiles(); if(files != null) { boolean hasLogFiles = false; for (File file : files) { if(Util.isLogFile(file)){ hasLogFiles = true; break; } } if (hasLogFiles) { throw new SnapdirContentCheckException("Snapshot directory has log files. Check if dataLogDir and dataDir configuration is correct."); } } }

Target:
private void checkSnapDir() throws SnapDirContentCheckException { File[] files = this.snapDir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return Util.isLogFileName(name); } }); if (files != null && files.length > 0) { throw new SnapDirContentCheckException("Snapshot directory has log files. Check if dataLogDir and dataDir configuration is correct."); } }
Source:
public final CompletableFuture<Void> enterSynchronizationAsync(CompletableFuture<Void> releaseFuture) { while (true) { CompletableFuture<Void> currentFuture = synchronization.get(); if (synchronization.compareAndSet(currentFuture, releaseFuture)) return currentFuture; } }

Target:
public final CompletableFuture<Void> enterSynchronizationAsync(CompletableFuture<Void> releaseFuture) { CompletableFuture<Void> currentFuture; do { currentFuture = synchronization.get(); } while (!synchronization.compareAndSet(currentFuture, releaseFuture)); return currentFuture; }
Source:
private static String aggregatePerHostResults(VoltTable vtable) { vtable.advanceRow(); String kitCheckResult = vtable.getString("KIT_CHECK_RESULT"); String rootCheckResult = vtable.getString("ROOT_CHECK_RESULT"); StringBuilder result = new StringBuilder(); if (!kitCheckResult.equals("Success")){ result.append(kitCheckResult); } if (!rootCheckResult.equals("Success")) { result.append(rootCheckResult); } if (result.length() == 0) { result.append("Success"); } return result.toString(); }

Target:
private static String aggregatePerHostResults(VoltTable vtable) { vtable.advanceRow(); String kitCheckResult = vtable.getString("KIT_CHECK_RESULT"); String rootCheckResult = vtable.getString("ROOT_CHECK_RESULT"); StringBuilder result = new StringBuilder(); if (!kitCheckResult.equals(SUCCESS)){ result.append(kitCheckResult); } if (!rootCheckResult.equals(SUCCESS)) { result.append(rootCheckResult); } if (result.length() == 0) { result.append(SUCCESS); } return result.toString(); }
Source:
protected <T extends DAO> T getDao(Class<T> daoType) { @SuppressWarnings("unchecked") Set<T> daos = (Set<T>) beanManager.getBeans(daoType, (Annotation[]) null); if (daos.size() == 0) { log.error("Can't find dao for " + daoType); return null; } T dao = daos.iterator().next(); if (dao instanceof BaseDAODbFacade && !(dao instanceof HibernateFacade)) { BaseDAODbFacade dbFacadeDAO = (BaseDAODbFacade) dao; dbFacadeDAO.setTemplate(jdbcTemplate); dbFacadeDAO.setDialect(dbEngineDialect); dbFacadeDAO.setDbFacade(this); } return dao; }

Target:
protected <T extends DAO> T getDao(Class<T> daoType) { for (DAO dao : daos) { if (daoType.isAssignableFrom(dao.getClass())) { if (dao instanceof BaseDAODbFacade && !(dao instanceof HibernateFacade)) { BaseDAODbFacade dbFacadeDAO = (BaseDAODbFacade) dao; dbFacadeDAO.setTemplate(jdbcTemplate); dbFacadeDAO.setDialect(dbEngineDialect); dbFacadeDAO.setDbFacade(this); } return (T) dao; } } log.error("Can't find dao for " + daoType); return null; }
Source:
public static HadoopDruidIndexerConfig fromDistributedFileSystem(String path) { try { Path pt = new Path(path); FileSystem fs = FileSystem.get(new Configuration()); Reader reader = new InputStreamReader(fs.open(pt)); return fromMap( (Map<String, Object>) HadoopDruidIndexerConfig.jsonMapper.readValue( reader, new TypeReference<Map<String, Object>>() { } ) ); } catch (IOException e) { throw Throwables.propagate(e); } }

Target:
public static HadoopDruidIndexerConfig fromDistributedFileSystem(String path) { try { Path pt = new Path(path); FileSystem fs = FileSystem.get(pt.toUri(), new Configuration()); Reader reader = new InputStreamReader(fs.open(pt)); return fromMap( (Map<String, Object>) HadoopDruidIndexerConfig.jsonMapper.readValue( reader, new TypeReference<Map<String, Object>>() { } ) ); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
public void save() { if(BulkChange.contains(this)) return; lock.lock(); try { State state = new State(); state.counter = WaitingItem.COUNTER.longValue(); for (Item item: getItems()) { if(item.task instanceof TransientTask) continue; state.items.add(item); } try { XmlFile queueFile = new XmlFile(XSTREAM, getXMLQueueFile()); queueFile.write(state); SaveableListener.fireOnChange(this, queueFile); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to write out the queue file " + getXMLQueueFile(), e); } } finally { lock.unlock(); } }

Target:
public void save() { if(BulkChange.contains(this)) return; XmlFile queueFile = new XmlFile(XSTREAM, getXMLQueueFile()); lock.lock(); try { State state = new State(); state.counter = WaitingItem.COUNTER.longValue(); for (Item item: getItems()) { if(item.task instanceof TransientTask) continue; state.items.add(item); } try { queueFile.write(state); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to write out the queue file " + getXMLQueueFile(), e); } } finally { lock.unlock(); } SaveableListener.fireOnChange(this, queueFile); }
Source:
public void testAttributeResettingWorks(final VCBuilderScheme builderScheme) { final VariantContextBuilder root1 = new VariantContextBuilder(snpSource, snpChr, snpLocStart, snpLocStop, Arrays.asList(Aref, C)); final VariantContext result1 = root1.attribute("AC", 1).make(); final VariantContextBuilder root2 = builderScheme.getOtherBuilder(root1, result1) .source(snpSource).chr(snpChr).start(snpLocStart).stop(snpLocStop).alleles(Arrays.asList(Aref, C)); final VariantContext ignored = root1.attribute("AC", 2).make(); final VariantContext result2 = root2.attribute("AC", 1).make(); Assert.assertEquals(result1.getAttribute("AC"), result2.getAttribute("AC")); }

Target:
public void testAttributeResettingWorks(final VCBuilderScheme builderScheme) { final VariantContextBuilder root1 = new VariantContextBuilder(snpSource, snpChr, snpLocStart, snpLocStop, Arrays.asList(Aref, C)); final VariantContext result1 = root1.attribute("AC", 1).make(); final VariantContextBuilder root2 = builderScheme.getOtherBuilder(root1, result1) .source(snpSource) .chr(snpChr) .start(snpLocStart) .stop(snpLocStop) .alleles(Arrays.asList(Aref, C)); final VariantContext ignored = root1.attribute("AC", 2).make(); final VariantContext result2 = root2.attribute("AC", 1).make(); Assert.assertEquals(result1.getAttribute("AC"), 1); Assert.assertEquals(result2.getAttribute("AC"), 1); }