auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
TransferSegmentStatus synchronousStateTransfer( Stream<TransferBatchRequest> batchStream, long totalNeeded) { long accTransferred = 0L; Iterator<TransferBatchRequest> iterator = batchStream.iterator(); while (iterator.hasNext()) { TransferBatchRequest nextBatch = iterator.next(); TransferBatchResponse response = batchProcessor.transfer(nextBatch).join(); if (response.getStatus() == TransferStatus.FAILED) { Optional<TransferSegmentException> causeOfFailure = Optional.of(response.getCauseOfFailure() .map(TransferSegmentException::new) .orElse(new TransferSegmentException("Failed to transfer."))); return TransferSegmentStatus .builder() .totalTransferred(0L) .segmentState(FAILED) .causeOfFailure(causeOfFailure) .build(); } accTransferred += response.getTransferBatchRequest().getAddresses().size(); } if (accTransferred == totalNeeded) { return TransferSegmentStatus .builder() .totalTransferred(accTransferred) .segmentState(TRANSFERRED) .build(); } String errorMsg = String.format("Needed: %s, but transferred: %s", totalNeeded, accTransferred); return TransferSegmentStatus .builder() .totalTransferred(0L) .segmentState(FAILED) .causeOfFailure(Optional.of(new TransferSegmentException(errorMsg))) .build(); }

Target:
TransferSegmentStatus synchronousStateTransfer( Stream<TransferBatchRequest> batchStream, long totalNeeded) { long accTransferred = 0L; Iterator<TransferBatchRequest> iterator = batchStream.iterator(); while (iterator.hasNext()) { TransferBatchRequest nextBatch = iterator.next(); TransferBatchResponse response = batchProcessor.transfer(nextBatch).join(); if (response.getStatus() == TransferStatus.FAILED) { Optional<TransferSegmentException> causeOfFailure = Optional.of(response.getCauseOfFailure() .map(TransferSegmentException::new) .orElse(new TransferSegmentException("Failed to transfer."))); return TransferSegmentStatus .builder() .totalTransferred(accTransferred) .segmentState(FAILED) .causeOfFailure(causeOfFailure) .build(); } accTransferred += response.getTransferBatchRequest().getAddresses().size(); } if (accTransferred == totalNeeded) { return TransferSegmentStatus .builder() .totalTransferred(accTransferred) .segmentState(TRANSFERRED) .build(); } String errorMsg = String.format("Needed: %s, but transferred: %s", totalNeeded, accTransferred); return TransferSegmentStatus .builder() .totalTransferred(0L) .segmentState(FAILED) .causeOfFailure(Optional.of(new TransferSegmentException(errorMsg))) .build(); }
Source:
public Response doDisable() { final Worker worker = curatorCoordinator.getWorker(); final Worker newWorker = new Worker(worker.getHost(), worker.getIp(), worker.getCapacity(), ""); try { curatorCoordinator.updateWorkerAnnouncement(newWorker); return Response.ok(ImmutableMap.of(worker.getHost(), "disabled")).build(); } catch (Exception e) { return Response.serverError().build(); } }

Target:
public Response doDisable() { try { curatorCoordinator.updateWorkerAnnouncement(disabledWorker); return Response.ok(ImmutableMap.of(disabledWorker.getHost(), "disabled")).build(); } catch (Exception e) { return Response.serverError().build(); } }
Source:
public void getMandateTransfers() throws Exception { String mandateId = "15397886"; List<Transfer> transfers = this.api.getMandateApi().getTransfers("15397886", new Pagination(1, 1), null); assertNotNull(transfers); assertTrue(transfers.size() > 0); }

Target:
public void getMandateTransfers() throws Exception { String mandateId = "15397886"; List<Transfer> transfers = this.api.getMandateApi().getTransfers("15397886", new Pagination(1, 1), null); assertNotNull(transfers); assertTrue(transfers.size() == 1); }
Source:
public static RangePredicate range( int propertyKeyId, ValueGroup valueGroup ) { if ( valueGroup == ValueGroup.GEOMETRY ) { throw new IllegalArgumentException( "Cannot create GeometryRangePredicate without at specified CRS" ); } return new RangePredicate<>( propertyKeyId, valueGroup, null, true, null, true ); }

Target:
public static RangePredicate range( int propertyKeyId, ValueGroup valueGroup ) { if ( valueGroup == ValueGroup.GEOMETRY ) { throw new IllegalArgumentException( "Cannot create GeometryRangePredicate without a specified CRS" ); } return new RangePredicate<>( propertyKeyId, valueGroup, null, true, null, true ); }
Source:
public void registerPublisher(EventPublisher publisher, String... eventTypes) { if (publisher == null) { throw new InvalidParameterException("Publisher must not be null"); } if (eventTypes == null || eventTypes.length == 0) { throw new InvalidParameterException("At least one event type must be specified"); } regMgmtLock.lock(); try { final String publisherName = publisher.getPublisherName(); if (nameToPublisher.get(publisherName) != null) { throw new InvalidParameterException( "Publisher with name " + publisherName + " already registered by " + nameToPublisher .get(publisherName) .getPublisher() .getClass() .getCanonicalName()); } log.debug("registerPublisher " + publisherName); RegisteredPublisher regProd = new RegisteredPublisher(publisher, new HashSet<>(asList(eventTypes))); danglingConsumers.removeIf( regCon -> { if (regCon.getPublisherName().equals(publisherName)) { regProd.addConsumer(regCon); return true; } return false; }); nameToPublisher.put(publisherName, regProd); } finally { regMgmtLock.unlock(); } }

Target:
public void registerPublisher(EventPublisher publisher, String... eventTypes) { if (publisher == null) { throw new InvalidParameterException("Publisher must not be null"); } if (eventTypes == null || eventTypes.length == 0) { throw new InvalidParameterException("At least one event type must be specified"); } regMgmtLock.lock(); try { String publisherName = publisher.getPublisherName(); if (nameToPublisher.get(publisherName) != null) { throw new InvalidParameterException( "Publisher with name " + publisherName + " already registered by " + nameToPublisher .get(publisherName) .getPublisher() .getClass() .getCanonicalName()); } log.debug("registerPublisher " + publisherName); RegisteredPublisher regProd = new RegisteredPublisher(publisher, new HashSet<>(asList(eventTypes))); moveConsumers( danglingConsumers, consumer -> consumer.getPublisherName().equals(publisherName), regProd::addConsumer); nameToPublisher.put(publisherName, regProd); } finally { regMgmtLock.unlock(); } }
Source:
public void start() { if (!enabled) { logger.info(format("Diagnostics disabled. To enable add -D%s=true to the JVM arguments.", ENABLED.getName())); return; } if (stdout) { this.diagnosticsLog = new DiagnosticsStdout(this); } else { this.diagnosticsLog = new DiagnosticsLogFile(this); } this.scheduler = new ScheduledThreadPoolExecutor(1, new DiagnosticSchedulerThreadFactory()); logger.info("Diagnostics started"); }

Target:
public void start() { if (!enabled) { logger.info(format("Diagnostics disabled. To enable add -D%s=true to the JVM arguments.", ENABLED.getName())); return; } this.diagnosticsLog = stdout ? new DiagnosticsStdout(this) : new DiagnosticsLogFile(this); this.scheduler = new ScheduledThreadPoolExecutor(1, new DiagnosticSchedulerThreadFactory()); logger.info("Diagnostics started"); }
Source:
public AssertionError assertionError(String message, Object actual, Object expected) { return assertionFailedError(message, actual, expected).orElse(createAssertionError(message)); }

Target:
public AssertionError assertionError(String message, Object actual, Object expected) { return new LazyAssertionFailedErrorCreator(message, actual, expected).assertionErrorIfCantBeCreated(); }
Source:
public TObject minKey(String key, AccessToken creds, TransactionToken transaction, String environment) throws TException { checkAccess(creds, transaction); AtomicSupport store = getStore(transaction, environment); AtomicOperation atomic = null; TObject min = null; while (atomic == null || !atomic.commit()) { atomic = store.startAtomicOperation(); try { Map<TObject, Set<Long>> data = atomic.browse(key); for (Entry<TObject, Set<Long>> entry : data.entrySet()) { min = entry.getKey(); break; } } catch (AtomicStateException e) { atomic = null; min = null; } } return min; }

Target:
public TObject minKey(String key, AccessToken creds, TransactionToken transaction, String environment) throws TException { checkAccess(creds, transaction); AtomicSupport store = getStore(transaction, environment); AtomicOperation atomic = null; TObject min = null; while (atomic == null || !atomic.commit()) { atomic = store.startAtomicOperation(); try { Map<TObject, Set<Long>> data = atomic.browse(key); min = Iterables.getFirst(data.keySet(), min); } catch (AtomicStateException e) { atomic = null; min = null; } } return min; }
Source:
public static void assertNoErrors(Response response) throws MultipleFailureException{ List<Throwable> errors = new ArrayList<Throwable>(); for(Error error : response.getErrors()){ Exception e = new Exception(error.getMessage(), error); e.printStackTrace(); errors.add(e); } if(!errors.isEmpty()){ throw new MultipleFailureException(errors); } }

Target:
public static void assertNoErrors(Response response) throws MultipleFailureException{ List<Throwable> errors = new ArrayList<Throwable>(response.getErrors()); if(!errors.isEmpty()){ throw new MultipleFailureException(errors); } }
Source:
private void reportIssue(NewClassTree newClassTree, String typeName) { context.reportIssue(this, reportTree(newClassTree), String.format("Implement \"Comparable\" in \"%s\" or switch key type.%s", typeName, context.getJavaVersion().java8CompatibilityMessage())); }

Target:
private void reportIssue(NewClassTree newClassTree, String typeName) { context.reportIssue(this, reportTree(newClassTree), String.format("Implement \"Comparable\" in \"%s\" or change the key type of this map.%s", typeName, context.getJavaVersion().java8CompatibilityMessage())); }
Source:
public void releaseUserCodeClassLoader_willRegisterOnce() throws Exception { final BlobLibraryCacheManager libraryCacheManager = new TestingBlobLibraryCacheManagerBuilder().build(); final LibraryCacheManager.ClassLoaderLease classLoaderLease = libraryCacheManager.registerClassLoaderLease(new JobID()); final UserCodeClassLoader userCodeClassLoader = classLoaderLease.getOrResolveClassLoader(Collections.emptyList(), Collections.emptyList()); final OneShotLatch releaseHookLatch = new OneShotLatch(); userCodeClassLoader.registerReleaseHookIfAbsent("test", releaseHookLatch::trigger); userCodeClassLoader.registerReleaseHookIfAbsent("test", () -> { throw new RuntimeException("This hook is not expected to be executed"); }); classLoaderLease.release(); releaseHookLatch.await(); }

Target:
public void releaseUserCodeClassLoader_willRegisterOnce() throws IOException, InterruptedException { final BlobLibraryCacheManager libraryCacheManager = new TestingBlobLibraryCacheManagerBuilder().build(); final LibraryCacheManager.ClassLoaderLease classLoaderLease = libraryCacheManager.registerClassLoaderLease(new JobID()); final UserCodeClassLoader userCodeClassLoader = classLoaderLease.getOrResolveClassLoader(Collections.emptyList(), Collections.emptyList()); final OneShotLatch releaseHookLatch = new OneShotLatch(); userCodeClassLoader.registerReleaseHookIfAbsent("test", releaseHookLatch::trigger); userCodeClassLoader.registerReleaseHookIfAbsent("test", () -> { throw new RuntimeException("This hook is not expected to be executed"); }); classLoaderLease.release(); releaseHookLatch.await(); }
Source:
public static int insertToTable(Connection c, String storageKey, Persistable p){ Pair<String, List<Object>> mPair = DatabaseHelper.getTableInsertData(storageKey, p); try { PreparedStatement preparedStatement = c.prepareStatement(mPair.first); for(int i=0; i<mPair.second.size(); i++){ Object obj = mPair.second.get(i); if(obj instanceof String){ preparedStatement.setString(i + 1, (String) obj); } else if(obj instanceof Blob){ preparedStatement.setBlob(i+1, (Blob) obj); } else if(obj instanceof Integer){ preparedStatement.setInt(i + 1, ((Integer) obj).intValue()); } else if(obj instanceof byte[]){ preparedStatement.setBinaryStream(i+1,new ByteArrayInputStream((byte[]) obj), ((byte[]) obj).length); } } int affectedRows = preparedStatement.executeUpdate(); if (affectedRows == 0) { throw new SQLException("Creating user failed, no rows affected."); } try (ResultSet generatedKeys = preparedStatement.getGeneratedKeys()) { if (generatedKeys.next()) { int id = generatedKeys.getInt(1); p.setID(id); return id; } else { throw new SQLException("Creating user failed, no ID obtained."); } } } catch (SQLException e) { System.out.println("e: " + e); e.printStackTrace(); } return -1; }

Target:
public static int insertToTable(Connection c, String storageKey, Persistable p) { Pair<String, List<Object>> mPair = DatabaseHelper.getTableInsertData(storageKey, p); PreparedStatement preparedStatement = null; try { preparedStatement = c.prepareStatement(mPair.first); for (int i = 0; i < mPair.second.size(); i++) { Object obj = mPair.second.get(i); if (obj instanceof String) { preparedStatement.setString(i + 1, (String)obj); } else if (obj instanceof Blob) { preparedStatement.setBlob(i + 1, (Blob)obj); } else if (obj instanceof Integer) { preparedStatement.setInt(i + 1, (Integer) obj); } else if (obj instanceof byte[]) { preparedStatement.setBinaryStream(i + 1, new ByteArrayInputStream((byte[])obj), ((byte[])obj).length); } } int affectedRows = preparedStatement.executeUpdate(); if (affectedRows == 0) { throw new SQLException("Creating user failed, no rows affected."); } try (ResultSet generatedKeys = preparedStatement.getGeneratedKeys()) { if (generatedKeys.next()) { int id = generatedKeys.getInt(1); p.setID(id); return id; } else { throw new SQLException("Creating user failed, no ID obtained."); } } } catch (SQLException e) { throw new RuntimeException(e); } finally { if (preparedStatement != null) { try { preparedStatement.close(); } catch (SQLException e) { e.printStackTrace(); } } } }
Source:
public CouponInArrearsCalculation(CapletStripper stripper, List<CapFloor> caps, double[] mrkPrices, MarketDataType type, double[] errors, DoubleMatrix1D guess, MulticurveProviderInterface curves) { long t0 = System.nanoTime(); _capletStrippingResult = stripper.solve(mrkPrices, type, errors, guess); long t1 = System.nanoTime(); _time = (t1 - t0) * 1e-9; _curves = curves; DoublesPair[] expStrikes = _capletStrippingResult.getPricer().getExpiryStrikeArray(); DoubleMatrix1D vols = _capletStrippingResult.getCapletVols(); CombinedInterpolatorExtrapolator interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator( Interpolator1DFactory.LINEAR, Interpolator1DFactory.LINEAR_EXTRAPOLATOR); GridInterpolator2D interpolator2D = new GridInterpolator2D(interpolator, interpolator); _surface = new InterpolatedDoublesSurface(expStrikes, vols.getData(), interpolator2D); }

Target:
public CouponInArrearsCalculation(CapletStripper stripper, List<CapFloor> caps, double[] mrkPrices, MarketDataType type, double[] errors, DoubleMatrix1D guess, MulticurveProviderInterface curves) { ArgumentChecker.notNull(stripper, "stripper"); ArgumentChecker.notNull(caps, "caps"); ArgumentChecker.notNull(type, "type"); ArgumentChecker.notNull(guess, "guess"); ArgumentChecker.notNull(curves, "curves"); ArgumentChecker.notNull(mrkPrices, "mrkPrices"); ArgumentChecker.notNull(errors, "errors"); _mrkPrices = Arrays.copyOf(mrkPrices, mrkPrices.length); _errors = Arrays.copyOf(errors, errors.length); long t0 = System.nanoTime(); _capletStrippingResult = stripper.solve(_mrkPrices, type, _errors, guess); long t1 = System.nanoTime(); _time = (t1 - t0) * 1e-9; _curves = curves; DoublesPair[] expStrikes = _capletStrippingResult.getPricer().getExpiryStrikeArray(); DoubleMatrix1D vols = _capletStrippingResult.getCapletVols(); CombinedInterpolatorExtrapolator interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator( Interpolator1DFactory.LINEAR, Interpolator1DFactory.LINEAR_EXTRAPOLATOR); GridInterpolator2D interpolator2D = new GridInterpolator2D(interpolator, interpolator); _surface = new InterpolatedDoublesSurface(expStrikes, vols.getData(), interpolator2D); }
Source:
public Shell open(Display display) { shell = new Shell(display); shell.setLayout(new FillLayout()); shell.addShellListener(new ShellAdapter() { @Override public void shellClosed(ShellEvent e) { e.doit = closeAddressBook(); } }); createMenuBar(); searchDialog = new SearchDialog(shell); searchDialog.setSearchAreaNames(columnNames); searchDialog.setSearchAreaLabel(resAddressBook.getString("Column")); searchDialog.addFindListener(() -> findEntry()); table = new Table(shell, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); table.setHeaderVisible(true); table.setMenu(createPopUpMenu()); table.addSelectionListener(widgetDefaultSelectedAdapter(e -> { TableItem[] items = table.getSelection(); if (items.length > 0) editEntry(items[0]); })); for(int i = 0; i < columnNames.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(columnNames[i]); column.setWidth(150); final int columnIndex = i; column.addSelectionListener(widgetSelectedAdapter(e -> { sort(columnIndex); })); } newAddressBook(); shell.setSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300); shell.open(); return shell; }

Target:
public Shell open(Display display) { shell = new Shell(display); shell.setLayout(new FillLayout()); shell.addShellListener(new ShellAdapter() { @Override public void shellClosed(ShellEvent e) { e.doit = closeAddressBook(); } }); createMenuBar(); searchDialog = new SearchDialog(shell); searchDialog.setSearchAreaNames(columnNames); searchDialog.setSearchAreaLabel(resAddressBook.getString("Column")); searchDialog.addFindListener(() -> findEntry()); table = new Table(shell, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); table.setHeaderVisible(true); table.setMenu(createPopUpMenu()); table.addSelectionListener(widgetDefaultSelectedAdapter(e -> { TableItem[] items = table.getSelection(); if (items.length > 0) editEntry(items[0]); })); for(int i = 0; i < columnNames.length; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText(columnNames[i]); column.setWidth(150); final int columnIndex = i; column.addSelectionListener(widgetSelectedAdapter(e -> sort(columnIndex))); } newAddressBook(); shell.setSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, 300); shell.open(); return shell; }
Source:
public LedgerChildElement getChild(String name, int multiplicity) { if (multiplicity == TreeReference.INDEX_TEMPLATE) { return LedgerChildElement.TemplateElement(this); } if (name.equals(LedgerChildElement.NAME)) { getLedgers(); if (ledgers.size() == 0) { return LedgerChildElement.TemplateElement(this); } return ledgers.elementAt(multiplicity); } return null; }

Target:
public LedgerChildElement getChild(String name, int multiplicity) { if ((multiplicity == TreeReference.INDEX_TEMPLATE) && "ledger".equals(name)) { return LedgerChildElement.TemplateElement(this); } if (name.equals(LedgerChildElement.NAME)) { getLedgers(); if (ledgers.size() == 0) { return LedgerChildElement.TemplateElement(this); } return ledgers.elementAt(multiplicity); } return null; }
Source:
public void testSnapshotAfterEndOfPartition() throws Exception { VerifyRecordsDataOutput<Long> output = new VerifyRecordsDataOutput<>(); LongSerializer inSerializer = LongSerializer.INSTANCE; int numInputChannels = 1; StreamTestSingleInputGate<Long> inputGate = new StreamTestSingleInputGate<>(numInputChannels, 0, inSerializer, 1024); TestRecordDeserializer[] deserializers = IntStream.range(0, numInputChannels) .mapToObj(index -> new TestRecordDeserializer(ioManager.getSpillingDirectoriesPaths())) .toArray(TestRecordDeserializer[]::new); StreamTaskNetworkInput<Long> input = new StreamTaskNetworkInput<>( new CheckpointedInputGate( inputGate.getInputGate(), new CheckpointBarrierUnaligner( new int[] { 1 }, ChannelStateWriter.NO_OP, "test", new DummyCheckpointInvokable())), inSerializer, new StatusWatermarkValve(1, output), 0, deserializers); inputGate.sendEvent(new CheckpointBarrier(0, 0, CheckpointOptions.forCheckpointWithDefaultLocation()), 0); inputGate.sendElement(new StreamRecord<>(42L), 0); assertHasNextElement(input, output); assertHasNextElement(input, output); assertEquals(1, output.getNumberOfEmittedRecords()); inputGate.sendEvent(EndOfPartitionEvent.INSTANCE, 0); input.emitNext(output); assertNull(deserializers[0]); CompletableFuture<Void> completableFuture = input.prepareSnapshot(ChannelStateWriter.NO_OP, 0); completableFuture.join(); }

Target:
public void testSnapshotAfterEndOfPartition() throws Exception { int numInputChannels = 1; int channelId = 0; int checkpointId = 0; VerifyRecordsDataOutput<Long> output = new VerifyRecordsDataOutput<>(); LongSerializer inSerializer = LongSerializer.INSTANCE; StreamTestSingleInputGate<Long> inputGate = new StreamTestSingleInputGate<>(numInputChannels, 0, inSerializer, 1024); TestRecordDeserializer[] deserializers = IntStream.range(0, numInputChannels) .mapToObj(index -> new TestRecordDeserializer(ioManager.getSpillingDirectoriesPaths())) .toArray(TestRecordDeserializer[]::new); StreamTaskNetworkInput<Long> input = new StreamTaskNetworkInput<>( new CheckpointedInputGate( inputGate.getInputGate(), new CheckpointBarrierUnaligner( new int[] { numInputChannels }, ChannelStateWriter.NO_OP, "test", new DummyCheckpointInvokable())), inSerializer, new StatusWatermarkValve(numInputChannels, output), 0, deserializers); inputGate.sendEvent( new CheckpointBarrier(checkpointId, 0L, CheckpointOptions.forCheckpointWithDefaultLocation()), channelId); inputGate.sendElement(new StreamRecord<>(42L), channelId); assertHasNextElement(input, output); assertHasNextElement(input, output); assertEquals(1, output.getNumberOfEmittedRecords()); inputGate.sendEvent(EndOfPartitionEvent.INSTANCE, channelId); input.emitNext(output); assertNull(deserializers[channelId]); CompletableFuture<Void> completableFuture = input.prepareSnapshot(ChannelStateWriter.NO_OP, checkpointId); completableFuture.join(); }
Source:
public Optional<LocalServer> getLocalServer() { return Optional.ofNullable((LocalServer) theIntegratedServer); }

Target:
public Optional<LocalServer> getLocalServer() { return Optional.ofNullable((LocalServer) this.theIntegratedServer); }
Source:
public List<Object> getJsonPatchOperations() { return Collections.unmodifiableList(operations); }

Target:
public List<JsonPatchOperation> getJsonPatchOperations() { return Collections.unmodifiableList(operations); }
Source:
public Builder<ChannelFactory> configure(OperationContext context, ModelNode model) throws OperationFailedException { this.statisticsEnabled = StackResourceDefinition.Attribute.STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean(); Resource resource = context.readResourceFromRoot(this.address, false); Optional<PathElement> transport = Optional.empty(); for (Resource.ResourceEntry resourceEntry : resource.getChildren(TransportResourceDefinition.WILDCARD_PATH.getKey())) { PathElement pathElement = resourceEntry.getPathElement(); transport = Optional.of(pathElement); break; } if (!transport.isPresent()) { throw JGroupsLogger.ROOT_LOGGER.transportNotDefined(this.getName()); } this.transport = new InjectedValueDependency<>(new SingletonProtocolServiceNameProvider(this.address, transport.get()), TransportConfiguration.class); List<ValueDependency<ProtocolConfiguration>> list = new ArrayList<>(); for (Resource.ResourceEntry entry : resource.getChildren(ProtocolResourceDefinition.WILDCARD_PATH.getKey())) { InjectedValueDependency<ProtocolConfiguration> protocolConfigurationInjectedValueDependency = new InjectedValueDependency<>(new ProtocolServiceNameProvider(this.address, entry.getPathElement()), ProtocolConfiguration.class); list.add(protocolConfigurationInjectedValueDependency); } this.protocols = list; this.relay = resource.hasChild(RelayResourceDefinition.PATH) ? new InjectedValueDependency<>(new SingletonProtocolServiceNameProvider(this.address, RelayResourceDefinition.PATH), RelayConfiguration.class) : null; return this; }

Target:
public Builder<ChannelFactory> configure(OperationContext context, ModelNode model) throws OperationFailedException { this.statisticsEnabled = StackResourceDefinition.Attribute.STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean(); Resource resource = context.readResourceFromRoot(this.address, false); Iterator<Resource.ResourceEntry> iterator = resource.getChildren(TransportResourceDefinition.WILDCARD_PATH.getKey()).iterator(); if (! iterator.hasNext()) { throw JGroupsLogger.ROOT_LOGGER.transportNotDefined(this.getName()); } PathElement transport = iterator.next().getPathElement(); this.transport = new InjectedValueDependency<>(new SingletonProtocolServiceNameProvider(this.address, transport), TransportConfiguration.class); final Set<Resource.ResourceEntry> entries = resource.getChildren(ProtocolResourceDefinition.WILDCARD_PATH.getKey()); final List<ValueDependency<ProtocolConfiguration>> list = new ArrayList<>(entries.size()); for (Resource.ResourceEntry entry : entries) { InjectedValueDependency<ProtocolConfiguration> protocolConfigurationInjectedValueDependency = new InjectedValueDependency<>(new ProtocolServiceNameProvider(this.address, entry.getPathElement()), ProtocolConfiguration.class); list.add(protocolConfigurationInjectedValueDependency); } this.protocols = list; this.relay = resource.hasChild(RelayResourceDefinition.PATH) ? new InjectedValueDependency<>(new SingletonProtocolServiceNameProvider(this.address, RelayResourceDefinition.PATH), RelayConfiguration.class) : null; return this; }
Source:
public ExchangeClient( DataSize bufferCapacity, DataSize maxResponseSize, int concurrentRequestMultiplier, Duration maxErrorDuration, boolean acknowledgePages, double responseSizeExponentialMovingAverageDecayingAlpha, HttpClient httpClient, ScheduledExecutorService scheduler, LocalMemoryContext systemMemoryContext, Executor pageBufferClientCallbackExecutor) { checkArgument(responseSizeExponentialMovingAverageDecayingAlpha >= 0.0 && responseSizeExponentialMovingAverageDecayingAlpha <= 1.0, "averageBytesEMAALpha must be between 0 and 1: %s", responseSizeExponentialMovingAverageDecayingAlpha); this.bufferCapacity = bufferCapacity.toBytes(); this.maxResponseSize = maxResponseSize; this.concurrentRequestMultiplier = concurrentRequestMultiplier; this.maxErrorDuration = maxErrorDuration; this.acknowledgePages = acknowledgePages; this.httpClient = httpClient; this.scheduler = scheduler; this.systemMemoryContext = systemMemoryContext; this.maxBufferRetainedSizeInBytes = Long.MIN_VALUE; this.pageBufferClientCallbackExecutor = requireNonNull(pageBufferClientCallbackExecutor, "pageBufferClientCallbackExecutor is null"); this.responseSizeExponentialMovingAverage = new ExponentialMovingAverage(responseSizeExponentialMovingAverageDecayingAlpha, DEFAULT_MAX_PAGE_SIZE_IN_BYTES); }

Target:
public ExchangeClient( DataSize bufferCapacity, DataSize maxResponseSize, int concurrentRequestMultiplier, Duration maxErrorDuration, boolean acknowledgePages, double responseSizeExponentialMovingAverageDecayingAlpha, HttpClient httpClient, ScheduledExecutorService scheduler, LocalMemoryContext systemMemoryContext, Executor pageBufferClientCallbackExecutor) { checkArgument(responseSizeExponentialMovingAverageDecayingAlpha >= 0.0 && responseSizeExponentialMovingAverageDecayingAlpha <= 1.0, "responseSizeExponentialMovingAverageDecayingAlpha must be between 0 and 1: %s", responseSizeExponentialMovingAverageDecayingAlpha); this.bufferCapacity = bufferCapacity.toBytes(); this.maxResponseSize = maxResponseSize; this.concurrentRequestMultiplier = concurrentRequestMultiplier; this.maxErrorDuration = maxErrorDuration; this.acknowledgePages = acknowledgePages; this.httpClient = httpClient; this.scheduler = scheduler; this.systemMemoryContext = systemMemoryContext; this.maxBufferRetainedSizeInBytes = Long.MIN_VALUE; this.pageBufferClientCallbackExecutor = requireNonNull(pageBufferClientCallbackExecutor, "pageBufferClientCallbackExecutor is null"); this.responseSizeExponentialMovingAverage = new ExponentialMovingAverage(responseSizeExponentialMovingAverageDecayingAlpha, DEFAULT_MAX_PAGE_SIZE_IN_BYTES); }
Source:
public void run() { try { EntryDialog dialog = new EntryDialog("Override Commit", getText() + "\n\nEnter Reason"); if (dialog.open() == 0) { Result result = atsApi.getBranchService().getCommitOverrideOps().setCommitOverride(teamWf, branch, dialog.getEntry()); if (result.isFalse()) { AWorkbench.popup(getText(), result.getText()); } else if (commitManager != null) { commitManager.loadTable(); } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }

Target:
public void run() { try { EntryDialog dialog = new EntryDialog("Override Commit", getText() + "\n\nEnter Reason"); if (dialog.open() == 0) { Result result = atsApi.getBranchService().getCommitOverrideOps().setCommitOverride(teamWf, branch, dialog.getEntry()); if (result.isFalse()) { AWorkbench.popup(getText(), result.getText()); } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } }
Source:
public Mono<AccessToken> getToken(TokenRequestContext request) { if (pubClient == null) { try { PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); pubClient = PublicClientApplication.builder(this.clientId) .setTokenCacheAccessAspect(accessAspect) .build(); } catch (Exception e) { return Mono.error(e); } } return Mono.fromFuture(pubClient.getAccounts()) .flatMap(set -> { IAccount requestedAccount; Map<String, IAccount> accounts = new HashMap<>(); for (IAccount cached : set) { if (username == null || username.equals(cached.username())) { if (!accounts.containsKey(cached.homeAccountId())) { accounts.put(cached.homeAccountId(), cached); } } } if (accounts.size() == 0) { if (username == null) { return Mono.error(new RuntimeException("SharedTokenCacheCredential authentication unavailable. No accounts were discovered in the cache.")); } else { return Mono.error(new RuntimeException(String.format("SharedTokenCacheCredential authentication unavailable. No account " + "matching the specified %s was found in the cache.", username))); } } else if (accounts.size() > 1) { if (username == null) { return Mono.error(new RuntimeException("SharedTokenCacheCredential authentication unavailable. " + "Multiple accounts were found in the cache. Use username and tenant id to disambiguate.")); } else { return Mono.error(new RuntimeException(String.format("SharedTokenCacheCredential authentication unavailable. Multiple accounts matching the specified " + " %s were found in the cache.", username))); } } else { requestedAccount = accounts.values().iterator().next(); } SilentParameters params = SilentParameters.builder( new HashSet<>(request.getScopes()), requestedAccount).build(); CompletableFuture<IAuthenticationResult> future; try { future = pubClient.acquireTokenSilently(params); return Mono.fromFuture(() -> future).map(result -> new AccessToken(result.accessToken(), result.expiresOnDate().toInstant().atOffset(ZoneOffset.UTC))); } catch (MalformedURLException e) { e.printStackTrace(); return Mono.error(new RuntimeException("Token was not found")); } }); }

Target:
public Mono<AccessToken> getToken(TokenRequestContext request) { return Mono.defer(() -> { if (cachedToken.get() != null) { return identityClient.authenticateWithPublicClientCache(request, cachedToken.get().getAccount()) .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } }).switchIfEmpty( Mono.defer(() -> identityClient.authenticateWithSharedTokenCache(request, username))) .map(msalToken -> { cachedToken.set(msalToken); return msalToken; }); }
Source:
protected abstract KeyStore keyStoreInstance() throws KeyStoreException; private char[] passwordStringToCharArray(String password) { return password == null ? EMPTY_CHAR_ARRAY : password.toCharArray(); }

Target:
protected abstract KeyStore keyStoreInstance() throws KeyStoreException; private static char[] passwordStringToCharArray(String password) { return password == null ? EMPTY_CHAR_ARRAY : password.toCharArray(); }
Source:
public HybridFile(OpenMode mode, String path, String name, boolean isDirectory) { this.mode = mode; if (path.startsWith("smb://") || isSmb()) { if (!isDirectory) this.path = path + name; else if (!name.endsWith("/")) this.path = path + name + "/"; else this.path = path + name; } else if(path.startsWith("ssh://") || isSftp()) { this.path = path + "/" + name; } else this.path = path + "/" + name; }

Target:
public HybridFile(OpenMode mode, String path, String name, boolean isDirectory) { this.mode = mode; if (path.startsWith("smb://") || isSmb()) { if (!isDirectory) this.path += name; else if (!name.endsWith("/")) this.path += name + "/"; else this.path += name; } else if(path.startsWith("ssh://") || isSftp()) { this.path += "/" + name; } else if (isRoot() && path.equals("/")) { this.path += name; } else { this.path += "/" + name; } }
Source:
private boolean canConnect(VDS vds) { boolean returnValue = true; if (vds.getvds_type() == VDSType.VDS && Config.<Boolean> GetValue(ConfigValues.InstallVds)) { SSHClient sshclient = null; try { Long timeout = TimeUnit.SECONDS.toMillis(Config.<Integer> GetValue(ConfigValues.ConnectToServerTimeoutInSeconds)); sshclient = getSSHClient(); sshclient.setHardTimeout(timeout); sshclient.setSoftTimeout(timeout); sshclient.setHost(vds.gethost_name()); sshclient.setUser("root"); sshclient.setPassword(getParameters().getRootPassword()); sshclient.connect(); sshclient.authenticate(); } catch (Exception e) { log.errorFormat( "Failed to establish session with host {0}", vds.getvds_name(), e ); addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_CONNECT_TO_SERVER); returnValue = false; } finally { if (sshclient != null) { sshclient.disconnect(); } } } return returnValue; }

Target:
private boolean canConnect(VDS vds) { boolean returnValue = true; if (vds.getvds_type() == VDSType.VDS && Config.<Boolean> GetValue(ConfigValues.InstallVds)) { SSHClient sshclient = null; try { Long timeout = TimeUnit.SECONDS.toMillis(Config.<Integer> GetValue(ConfigValues.ConnectToServerTimeoutInSeconds)); sshclient = getSSHClient(); sshclient.setHardTimeout(timeout); sshclient.setSoftTimeout(timeout); sshclient.setHost(vds.gethost_name()); sshclient.setUser(USER_NAME); sshclient.setPassword(getParameters().getRootPassword()); sshclient.connect(); sshclient.authenticate(); } catch (Exception e) { log.errorFormat( "Failed to establish session with host {0}", vds.getvds_name(), e ); addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_CONNECT_TO_SERVER); returnValue = false; } finally { if (sshclient != null) { sshclient.disconnect(); } } } return returnValue; }
Source:
private void setFragmentBuilder() throws JClassAlreadyExistsException { fragmentBuilderClass = generatedClass._class(PUBLIC | STATIC, "FragmentBuilder" + ModelConstants.generationSuffix()); narrowBuilderClass = narrow(fragmentBuilderClass); generify(fragmentBuilderClass); JClass superClass = refClass(org.androidannotations.api.builder.FragmentBuilder.class); superClass = superClass.narrow(narrowBuilderClass, getAnnotatedClass()); fragmentBuilderClass._extends(superClass); fragmentArgumentsBuilderField = ref("args"); setFragmentBuilderBuild(); setFragmentBuilderCreate(); }

Target:
private void setFragmentBuilder() throws JClassAlreadyExistsException { fragmentBuilderClass = generatedClass._class(PUBLIC | STATIC, "FragmentBuilder" + generationSuffix()); narrowBuilderClass = narrow(fragmentBuilderClass); generify(fragmentBuilderClass); JClass superClass = refClass(org.androidannotations.api.builder.FragmentBuilder.class); superClass = superClass.narrow(narrowBuilderClass, getAnnotatedClass()); fragmentBuilderClass._extends(superClass); fragmentArgumentsBuilderField = ref("args"); setFragmentBuilderBuild(); setFragmentBuilderCreate(); }
Source:
public void analyzeSentimentBatchNullInput() { StepVerifier.create(client.analyzeSentimentBatch(null, null, (TextAnalyticsRequestOptions) null)) .verifyErrorSatisfies(exception -> { assertEquals(NullPointerException.class, exception.getClass()); assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage())); }); }

Target:
public void analyzeSentimentBatchNullInput() { StepVerifier.create(client.analyzeSentimentBatch(null, null, new TextAnalyticsRequestOptions())) .verifyErrorSatisfies(exception -> { assertEquals(NullPointerException.class, exception.getClass()); assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage())); }); }
Source:
public byte[] getTextBytes(int fieldId) { return new byte[0]; }

Target:
public byte[] getTextBytes(int fieldId) { return NULL_TEXT_BYTES; }
Source:
public void invalidateEmailLink() { FlowParameters flowParameters = getFlowParams(); flowParameters.emailLink = null; setIntent(new Intent().putExtra(ExtraConstants.FLOW_PARAMS, flowParameters)); }

Target:
public void invalidateEmailLink() { FlowParameters flowParameters = getFlowParams(); flowParameters.emailLink = null; setIntent(getIntent().putExtra(ExtraConstants.FLOW_PARAMS, flowParameters)); }
Source:
private LogMetadata initializeLogMetadata(long startSegment, long endSegment) { LogMetadata metadata = new LogMetadata(); long start = System.currentTimeMillis(); for (long currentSegment = startSegment; currentSegment <= endSegment; currentSegment++) { SegmentHandle sh = getSegmentHandleForAddress(currentSegment * RECORDS_PER_LOG_FILE + 1); try { for (Long address : sh.getKnownAddresses().keySet()) { if (address < startingAddress) { continue; } LogData logEntry = read(address); metadata.update(logEntry); } } finally { sh.close(); } } writeChannels.clear(); long end = System.currentTimeMillis(); log.info("initializeStreamTails: took ms to load {}", end - start, metadata); return metadata; }

Target:
private LogMetadata initializeLogMetadata(long startSegment, long endSegment) { LogMetadata metadata = new LogMetadata(); long start = System.currentTimeMillis(); for (long currentSegment = startSegment; currentSegment <= endSegment; currentSegment++) { SegmentHandle segment = getSegmentHandleForAddress(currentSegment * RECORDS_PER_LOG_FILE + 1); try { for (Long address : segment.getKnownAddresses().keySet()) { if (address < startingAddress) { continue; } LogData logEntry = read(address); metadata.update(logEntry); } } finally { segment.close(); } } writeChannels.clear(); long end = System.currentTimeMillis(); log.info("initializeStreamTails: took ms to load {}", end - start, metadata); return metadata; }
Source:
public WallThermostatControlMsg(String rawMsg) { super(rawMsg); logger.debug(this.msgType+" Payload Len -> "+this.payload.length); if (this.payload.length == WALL_THERMOSTAT_CONTROL_SET_POINT_AND_MEASURED_PAYLOAD_LEN) { desiredTemperature = (this.payload[0] & 0x7F)/2.0; int mTemp = (this.payload[0]&0x80); mTemp <<= 1; mTemp |= (((int)this.payload[1])&0xff); measuredTemperature = mTemp/10.0; } else if (this.payload.length == WALL_THERMOSTAT_CONTROL_SET_POINT_ONLY_PAYLOAD_LEN) { desiredTemperature = (this.payload[0] & 0x7F)/2.0; measuredTemperature = null; } else logger.error("Got "+this.msgType+" message with incorrect length!"); }

Target:
public WallThermostatControlMsg(String rawMsg) { super(rawMsg); logger.debug(this.msgType + " Payload Len -> " + this.payload.length); if (this.payload.length == WALL_THERMOSTAT_CONTROL_SET_POINT_AND_MEASURED_PAYLOAD_LEN) { desiredTemperature = (this.payload[0] & 0x7F) / 2.0; int mTemp = (this.payload[0] & 0x80); mTemp <<= 1; mTemp |= (((int) this.payload[1]) & 0xff); measuredTemperature = mTemp / 10.0; } else if (this.payload.length == WALL_THERMOSTAT_CONTROL_SET_POINT_ONLY_PAYLOAD_LEN) { desiredTemperature = (this.payload[0] & 0x7F) / 2.0; measuredTemperature = null; } else { logger.error("Got " + this.msgType + " message with incorrect length!"); } }
Source:
public SortedFileArchiveIdentifier(File dataFile) throws FileNotFoundException { if (!dataFile.exists()) throw new IllegalArgumentException("Hash to GAV data file does not exist: " + dataFile.toString()); this.dataFile = dataFile; this.dataSize = this.dataFile.length(); this.dataFileIS = new FileInputStream(dataFile); }

Target:
public SortedFileArchiveIdentifier(File dataFile) { if (!dataFile.exists()) throw new IllegalArgumentException("Hash to GAV data file does not exist: " + dataFile.toString()); this.dataFile = dataFile; this.dataSize = this.dataFile.length(); try { this.dataFileIS = new FileInputStream(dataFile); } catch (FileNotFoundException ex) { throw new IllegalStateException("Could not read file despite it exists: " + dataFile, ex); } }
Source:
public void setCaptureSessionSucceed() { Assume.assumeTrue(mCameraDevice != null); CaptureSession captureSession = new CaptureSession(mTestParameters0.mHandler); captureSession.setSessionConfig(mTestParameters0.mSessionConfig); assertThat(captureSession.getSessionConfig()).isEqualTo(mTestParameters0.mSessionConfig); }

Target:
public void setCaptureSessionSucceed() { Log.i("CaptureSessionTest", "setCaptureSessionSucceed"); CaptureSession captureSession = new CaptureSession(mTestParameters0.mHandler); captureSession.setSessionConfig(mTestParameters0.mSessionConfig); assertThat(captureSession.getSessionConfig()).isEqualTo(mTestParameters0.mSessionConfig); }
Source:
void shutdown() throws InterruptedException { Timer.Context context = metrics.diskShutdownTime.time(); try { compactionManager.disable(); final AtomicInteger numFailures = new AtomicInteger(0); List<Thread> shutdownThreads = new ArrayList<>(); for (final Map.Entry<PartitionId, BlobStore> partitionAndStore : stores.entrySet()) { Thread thread = Utils.newThread("store-Shutdown-" + partitionAndStore.getKey(), new Runnable() { @Override public void run() { try { partitionAndStore.getValue().shutdown(); } catch (Exception e) { numFailures.incrementAndGet(); metrics.totalStoreShutdownFailures.inc(); logger.error("Exception while shutting down store on disk {}", partitionAndStore.getKey(), disk, e); } } }, false); thread.start(); shutdownThreads.add(thread); } for (Thread shutdownThread : shutdownThreads) { shutdownThread.join(); } if (numFailures.get() > 0) { logger.error( "Could not shutdown " + numFailures.get() + " out of " + stores.size() + " stores on the disk " + disk); } compactionManager.awaitTermination(); diskIOScheduler.close(); } finally { context.stop(); } }

Target:
void shutdown() throws InterruptedException { long startTimeMs = time.milliseconds(); try { compactionManager.disable(); final AtomicInteger numFailures = new AtomicInteger(0); List<Thread> shutdownThreads = new ArrayList<>(); for (final Map.Entry<PartitionId, BlobStore> partitionAndStore : stores.entrySet()) { Thread thread = Utils.newThread("store-shutdown-" + partitionAndStore.getKey(), new Runnable() { @Override public void run() { try { partitionAndStore.getValue().shutdown(); } catch (Exception e) { numFailures.incrementAndGet(); metrics.totalStoreShutdownFailures.inc(); logger.error("Exception while shutting down store on disk {}", partitionAndStore.getKey(), disk, e); } } }, false); thread.start(); shutdownThreads.add(thread); } for (Thread shutdownThread : shutdownThreads) { shutdownThread.join(); } if (numFailures.get() > 0) { logger.error( "Could not shutdown " + numFailures.get() + " out of " + stores.size() + " stores on the disk " + disk); } compactionManager.awaitTermination(); diskIOScheduler.close(); } finally { metrics.diskShutdownTimeMs.update(time.milliseconds() - startTimeMs); } }
Source:
public static NonNullList<ItemStack> defaultRecipeGetRemainingItems(InventoryCrafting inv) { NonNullList<ItemStack> ret = NonNullList.func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a); for (int i = 0; i < ret.size(); i++) { ItemStack container = getContainerItem(inv.getStackInSlot(i)); if (container != null) { ret.set(i, container); } } return ret; }

Target:
public static NonNullList<ItemStack> defaultRecipeGetRemainingItems(InventoryCrafting inv) { NonNullList<ItemStack> ret = NonNullList.func_191197_a(inv.getSizeInventory(), ItemStack.field_190927_a); for (int i = 0; i < ret.size(); i++) { ret.set(i, getContainerItem(inv.getStackInSlot(i))); } return ret; }
Source:
DefaultConnectivityMonitor(@NonNull Context context, @NonNull ConnectivityListener listener) { this.context = context.getApplicationContext(); this.listener = listener; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { connectivityReceiver = null; callback = new ConnectivityManager.NetworkCallback() { @Override public void onAvailable(@NonNull Network network) @Override public void onLost(@NonNull Network network) { onConnectivityChanged(false); } @Override public void onCapabilitiesChanged( @NonNull Network network, @NonNull NetworkCapabilities networkCapabilities) { boolean connected = networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET) && networkCapabilities.hasCapability( NetworkCapabilities.NET_CAPABILITY_VALIDATED); onConnectivityChanged(connected); } }; } else { connectivityReceiver = new BroadcastReceiver() { @Override public void onReceive(@NonNull Context context, Intent intent) { onConnectivityChanged(isConnected(context)); } }; callback = null; } }

Target:
DefaultConnectivityMonitor(@NonNull Context context, @NonNull ConnectivityListener listener) { this.context = context.getApplicationContext(); this.listener = listener; }
Source:
public ToPagedIterable(DimensionDataCloudControlApi api) { this.api = api; }

Target:
ToPagedIterable(DimensionDataCloudControlApi api) { this.api = api; }
Source:
public String get(String key) { Assert.notNull(key, "'key' must not be null."); BoundValueOperations<String, String> ops = redisTemplate.boundValueOps(key); return ops.get(); }

Target:
public String get(String key) { Assert.notNull(key, "'key' must not be null."); BoundValueOperations<String, String> ops = this.redisTemplate.boundValueOps(key); return ops.get(); }
Source:
public EnumSchema(Name name, String doc, LockableArrayList<String> symbols, String enumDefault) { super(Type.ENUM, name, doc); this.symbols = symbols.lock(); this.ordinals = new HashMap<>(symbols.size()); this.enumDefault = enumDefault; int i = 0; for (String symbol : symbols) if (ordinals.put(validateName(symbol), i++) != null) throw new SchemaParseException("Duplicate enum symbol: " + symbol); if (enumDefault != null && !symbols.contains(enumDefault)) throw new SchemaParseException( "The Enum Default: " + enumDefault + " is not in the enum symbol set: " + symbols); }

Target:
public EnumSchema(Name name, String doc, LockableArrayList<String> symbols, String enumDefault) { super(Type.ENUM, name, doc); this.symbols = symbols.lock(); this.ordinals = new HashMap<>((int) Math.ceil(symbols.size() / 0.75)); this.enumDefault = enumDefault; int i = 0; for (String symbol : symbols) if (ordinals.put(validateName(symbol), i++) != null) throw new SchemaParseException("Duplicate enum symbol: " + symbol); if (enumDefault != null && !symbols.contains(enumDefault)) throw new SchemaParseException( "The Enum Default: " + enumDefault + " is not in the enum symbol set: " + symbols); }
Source:
public FilterRegistrationBean getBackendInfoFilterRegistrationBean(final BackendInfoFilter filter) { final FilterRegistrationBean reg = new FilterRegistrationBean(filter); reg.addUrlPatterns("/*"); return reg; }

Target:
public FilterRegistrationBean getBackendInfoFilterRegistrationBean(final BackendInfoFilter filter) { return new FilterRegistrationBean(filter); }
Source:
public void testCopyFile(final Path file) throws IOException { final Path outFile = Files.createTempFile("tmp", ".tmp"); outFile.toFile().deleteOnExit(); IOUtil.copyFile(file.toFile(), outFile.toFile()); final Stream<String> stream = Files.lines(file); final Stream<String> outStream = Files.lines(outFile); final Iterator<String> itStream = stream.iterator(); final Iterator<String> itOutStream = outStream.iterator(); while (itStream.hasNext() && itOutStream.hasNext()) { Assert.assertEquals(itStream.next(), itOutStream.next()); } Assert.assertFalse(itStream.hasNext()); Assert.assertFalse(itOutStream.hasNext()); }

Target:
public void testCopyFile(final Path file) throws IOException { final Path outFile = Files.createTempFile("tmp", ".tmp"); outFile.toFile().deleteOnExit(); IOUtil.copyFile(file.toFile(), outFile.toFile()); Assert.assertEquals(Files.lines(file).collect(Collectors.toList()), Files.lines(outFile).collect(Collectors.toList())); }