auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testFreetemplateFileNameValidity() { final TextTemplate textTemplate = new TextTemplate(); textTemplate.setFreemarkerParsingExtensions("nxftl"); final File testResouceDirectory = new File(getClass().getClassLoader().getResource("test-nxftl").getPath()); final File tmpdir = new File(System.getProperty("java.io.tmpdir")); try { textTemplate.processDirectory(new File(testResouceDirectory, "tutu.xml.nxftl"), tmpdir); textTemplate.processDirectory(new File(testResouceDirectory, "tutu.nxftl"), tmpdir); } catch (Exception e) { Assert.fail("Unexpected exception: " + e.getMessage()); } final File failingFile = new File(testResouceDirectory, ".nxftl"); IOException exceptedException = null; try { textTemplate.processDirectory(failingFile, tmpdir); } catch (IOException expected) { exceptedException = expected; } catch (TemplateException e) { } Assert.assertNotNull(exceptedException); Assert.assertEquals("Template file : '" + failingFile.getAbsolutePath() + "' cannot be parsed. Launcher had to stop, please fix this problem." + System.getProperty("line.separator") + "It may be caused by its output name '" + tmpdir.getAbsolutePath() + "'", exceptedException.getMessage()); }

Target:
public void testFreetemplateFileNameValidity() throws Exception { File tmpdir = temporary.newFolder(); TextTemplate textTemplate = new TextTemplate(); textTemplate.setFreemarkerParsingExtensions("nxftl"); File testResouceDirectory = FileUtils.getResourceFileFromContext("test-nxftl"); textTemplate.processDirectory(new File(testResouceDirectory, "tutu.xml.nxftl"), tmpdir); textTemplate.processDirectory(new File(testResouceDirectory, "tutu.nxftl"), tmpdir); File failingFile = new File(testResouceDirectory, ".nxftl"); try { textTemplate.processDirectory(failingFile, tmpdir); fail("File name is invalid the call should not success"); } catch (IOException expected) { String expectedMessage = "Extension only as a filename is not allowed: " + failingFile.getAbsolutePath(); assertEquals(expectedMessage, expected.getMessage()); } }
Source:
public CreateGlusterVolumeGeoRepSessionCommand(GlusterVolumeGeoRepSessionParameters params) { super(params); setGlusterVolumeId(getParameters().getVolumeId()); session = getDbFacade().getGlusterGeoRepDao().getById(getParameters().getGeoRepSessionId()); }

Target:
public CreateGlusterVolumeGeoRepSessionCommand(GlusterVolumeGeoRepSessionParameters params) { super(params); setGlusterVolumeId(getParameters().getVolumeId()); setVdsGroupId(getGlusterVolume().getClusterId()); }
Source:
private void notifyThingAboutRemoval(final Thing thing) { logger.debug("Asking handler of thing '{}' to handle its removal.", thing.getUID()); ThreadPoolManager.getPool(THING_MANAGER_THREADPOOL_NAME).execute(new Runnable() { @Override public void run() { try { thing.getHandler().handleRemoval(); logger.trace("Handler of thing '{}' returned from handling its removal.", thing.getUID()); } catch (Exception ex) { logger.error("The ThingHandler caused an exception while handling the removal of its thing", ex); } } }); }

Target:
private void notifyThingAboutRemoval(final Thing thing) { logger.trace("Asking handler of thing '{}' to handle its removal.", thing.getUID()); ThreadPoolManager.getPool(THING_MANAGER_THREADPOOL_NAME).execute(new Runnable() { @Override public void run() { try { thing.getHandler().handleRemoval(); logger.trace("Handler of thing '{}' returned from handling its removal.", thing.getUID()); } catch (Exception ex) { logger.error("The ThingHandler caused an exception while handling the removal of its thing", ex); } } }); }
Source:
public Response execute(Command command) throws WebDriverException, IOException { if (DriverCommand.NEW_SESSION.equals(command.getName())) { serviceOptional.ifPresent(driverService -> { try { driverService.start(); } catch (IOException e) { throw new WebDriverException(e.getMessage(), e); } }); } Response response; try { if (!NEW_SESSION.equals(command.getName())) { response = super.execute(command); } else { response = createSession(command); } } catch (Throwable t) { Throwable rootCause = Throwables.getRootCause(t); if (rootCause instanceof ConnectException && rootCause.getMessage().contains("Connection refused")) { throw serviceOptional.map(service -> { if (service.isRunning()) { return new WebDriverException("The session is closed!", rootCause); } return new WebDriverException("The appium server has accidentally died!", rootCause); }).orElseGet((Supplier<WebDriverException>) () -> new WebDriverException(rootCause.getMessage(), rootCause)); } throwIfUnchecked(t); throw new WebDriverException(t); } finally { if (DriverCommand.QUIT.equals(command.getName())) { serviceOptional.ifPresent(DriverService::stop); } } if (DriverCommand.NEW_SESSION.equals(command.getName()) && getCommandCodec() instanceof W3CHttpCommandCodec) { setCommandCodec(new AppiumW3CHttpCommandCodec()); getAdditionalCommands().forEach(this::defineCommand); } return response; }

Target:
public Response execute(Command command) throws WebDriverException { if (DriverCommand.NEW_SESSION.equals(command.getName())) { serviceOptional.ifPresent(driverService -> { try { driverService.start(); } catch (IOException e) { throw new WebDriverException(e.getMessage(), e); } }); } Response response; try { response = NEW_SESSION.equals(command.getName()) ? createSession(command) : super.execute(command); } catch (Throwable t) { Throwable rootCause = Throwables.getRootCause(t); if (rootCause instanceof ConnectException && rootCause.getMessage().contains("Connection refused")) { throw serviceOptional.map(service -> { if (service.isRunning()) { return new WebDriverException("The session is closed!", rootCause); } return new WebDriverException("The appium server has accidentally died!", rootCause); }).orElseGet((Supplier<WebDriverException>) () -> new WebDriverException(rootCause.getMessage(), rootCause)); } throwIfUnchecked(t); throw new WebDriverException(t); } finally { if (DriverCommand.QUIT.equals(command.getName())) { serviceOptional.ifPresent(DriverService::stop); } } if (DriverCommand.NEW_SESSION.equals(command.getName()) && getCommandCodec() instanceof W3CHttpCommandCodec) { setCommandCodec(new AppiumW3CHttpCommandCodec()); getAdditionalCommands().forEach(this::defineCommand); } return response; }
Source:
public void setValue(Object target, String fieldName, Object value) { Type<?> targetClass = getType(target); String targetType = getJsonAliasFor(targetClass); String fieldAlias = fieldName; try { Type<?> fieldClass = getType(targetClass, fieldName); String realName = getNameFromAlias(target, fieldName); fieldAlias = (realName != null) ? realName : fieldName; String setMethod = "set" + StringUtils.capitalize(fieldAlias); Method method = EntityDictionary.findMethod(targetClass, setMethod, fieldClass); method.invoke(target, coerce(target, value, fieldAlias, fieldClass)); } catch (IllegalAccessException e) { throw new InvalidAttributeException(fieldAlias, targetType, e); } catch (InvocationTargetException e) { throw handleInvocationTargetException(e); } catch (IllegalArgumentException | NoSuchMethodException noMethod) { AccessibleObject accessor = getAccessibleObject(target, fieldAlias); if (accessor != null && accessor instanceof Field) { Field field = (Field) accessor; try { field.getField().set(target, coerce(target, value, fieldAlias, field.getType())); } catch (IllegalAccessException noField) { throw new InvalidAttributeException(fieldAlias, targetType, noField); } } else { throw new InvalidAttributeException(fieldAlias, targetType); } } }

Target:
public void setValue(Object target, String fieldName, Object value) { Type<?> targetClass = getType(target); String targetType = getJsonAliasFor(targetClass); String fieldAlias = fieldName; try { Type<?> fieldClass = getType(targetClass, fieldName); String realName = getNameFromAlias(target, fieldName); fieldAlias = (realName != null) ? realName : fieldName; String setMethod = "set" + StringUtils.capitalize(fieldAlias); Method method = EntityDictionary.findMethod(targetClass, setMethod, fieldClass); method.invoke(target, coerce(target, value, fieldAlias, fieldClass)); } catch (IllegalAccessException e) { throw new InvalidAttributeException(fieldAlias, targetType, e); } catch (InvocationTargetException e) { throw handleInvocationTargetException(e); } catch (IllegalArgumentException | NoSuchMethodException noMethod) { AccessibleObject accessor = getAccessibleObject(target, fieldAlias); if (accessor != null && accessor instanceof Field) { Field field = (Field) accessor; try { field.set(target, coerce(target, value, fieldAlias, field.getType())); } catch (IllegalAccessException noField) { throw new InvalidAttributeException(fieldAlias, targetType, noField); } } else { throw new InvalidAttributeException(fieldAlias, targetType); } } }
Source:
public <T> ParamConverter<T> getConverter( final Class<T> rawType, final Type genericType, final Annotation[] annotations) { if (Optional.class.equals(rawType)) { final List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(genericType); final ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null; if (ctp == null || ctp.rawClass() == String.class) { return new ParamConverter<T>() { @Override public T fromString(final String value) { return rawType.cast(Optional.ofNullable(value)); } @Override public String toString(final T value) { return value.toString(); } }; } for (ParamConverterProvider provider : Providers.getProviders(injectionManager, ParamConverterProvider.class)) { final ParamConverter<?> converter = provider.getConverter(ctp.rawClass(), ctp.type(), annotations); if (converter != null) { return new ParamConverter<T>() { @Override public T fromString(final String value) { return rawType.cast(Optional.ofNullable(value).map(_s -> converter.fromString(value))); } @Override public String toString(final T value) { return value.toString(); } }; } } } return null; }

Target:
public <T> ParamConverter<T> getConverter( final Class<T> rawType, final Type genericType, final Annotation[] annotations) { if (Optional.class.equals(rawType)) { final List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(genericType); final ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null; if (ctp == null || ctp.rawClass() == String.class) { return new ParamConverter<T>() { @Override public T fromString(final String value) { return rawType.cast(Optional.ofNullable(value)); } @Override public String toString(final T value) { return value.toString(); } }; } for (ParamConverterProvider provider : Providers.getProviders(injectionManager, ParamConverterProvider.class)) { final ParamConverter<?> converter = provider.getConverter(ctp.rawClass(), ctp.type(), annotations); if (converter != null) { return new ParamConverter<T>() { @Override public T fromString(final String value) { return rawType.cast(Optional.ofNullable(value).map(converter::fromString)); } @Override public String toString(final T value) { return value.toString(); } }; } } } return null; }
Source:
public void doUpdateCacheMembers(int viewId, Throwable throwable) throws Throwable { if (throwable instanceof SuspectException) { log.tracef("Node %s left while updating cache members", ((SuspectException) throwable).getSuspect()); } else if (throwable != null) { throw throwable; } int newViewId = transport.getViewId(); if (newViewId != viewId) { log.debugf("Skipping cache members update for view %d after receiving view %d", viewId, newViewId); return; } for (ClusterCacheStatus cacheStatus : cacheStatusMap.values()) { cacheStatus.doHandleClusterView(viewId); } }

Target:
private void doUpdateCacheMembers(int viewId, Throwable throwable) { try { if (throwable == null) { int newViewId = transport.getViewId(); if (newViewId != viewId) { log.debugf("Skipping cache members update for view %d, newer view received: %d", viewId, newViewId); return; } for (ClusterCacheStatus cacheStatus : cacheStatusMap.values()) { cacheStatus.doHandleClusterView(viewId); } } else if (throwable instanceof SuspectException) { Address leaver = ((SuspectException) throwable).getSuspect(); log.debugf("Skipping cache members update for view %d, node %s left", viewId, leaver); return; } } catch (Throwable t) { throwable = t; } if (clusterManagerStatus.isRunning()) { log.errorUpdatingMembersList(viewId, throwable); } }
Source:
private Element createRootElement(Document doc, LookupTransactionManagerProviderConfiguration lookupTransactionManagerProviderConfiguration) { Element rootElement = doc.createElement(TRANSACTION_NAMESPACE_PREFIX + COLON + TRANSACTION_ELEMENT_NAME); rootElement.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:" + TRANSACTION_NAMESPACE_PREFIX, NAMESPACE.toString()); rootElement.setAttribute(TRANSACTION_LOOKUP_CLASS, lookupTransactionManagerProviderConfiguration.getTransactionManagerLookup() .getName()); return rootElement; }

Target:
protected Element createRootElement(Document doc, LookupTransactionManagerProviderConfiguration lookupTransactionManagerProviderConfiguration) { Element rootElement = doc.createElementNS(NAMESPACE.toString(), TRANSACTION_NAMESPACE_PREFIX + COLON + TRANSACTION_ELEMENT_NAME); rootElement.setAttribute(TRANSACTION_LOOKUP_CLASS, lookupTransactionManagerProviderConfiguration.getTransactionManagerLookup() .getName()); return rootElement; }
Source:
private static Stream<ExpressionTree> findStringArg(MethodInvocationTree mit) { return mit.arguments().stream() .filter(arg -> arg.symbolType().is(String.class.getCanonicalName())); }

Target:
private static Stream<ExpressionTree> findStringArg(MethodInvocationTree mit) { return mit.arguments().stream() .filter(arg -> arg.symbolType().is("java.lang.String")); }
Source:
public void run() { running = true; LOG.debug("RootCache Started"); final long rootPartitionId = INode.calculatePartitionId(HdfsConstantsClient.GRANDFATHER_INODE_ID, INodeDirectory.ROOT_NAME, INodeDirectory.ROOT_DIR_DEPTH); LightWeightRequestHandler getRootINode = new LightWeightRequestHandler(HDFSOperationType.GET_ROOT) { @Override public Object performTask() throws IOException { INodeDataAccess da = (INodeDataAccess) HdfsStorageFactory .getDataAccess(INodeDataAccess.class); INode rootINode = (INode) da.findInodeByNameParentIdAndPartitionIdPK(INodeDirectory.ROOT_NAME, HdfsConstantsClient.GRANDFATHER_INODE_ID, rootPartitionId); return rootINode; } }; while (running) { try { Thread.sleep(UPDATE_TIMER); INode rootInodeRet = (INode) getRootINode.handle(); if (rootInodeRet != null) { synchronized (rootCacheUpdater) { rootINode = rootInodeRet; } } else { LOG.debug("RootCache: root does not exist."); } } catch (InterruptedException e) { LOG.warn(e); } catch (IOException e) { LOG.warn(e); } } }

Target:
public void run() { running = true; LOG.debug("RootCache Started"); final long rootPartitionId = INode.calculatePartitionId(HdfsConstantsClient.GRANDFATHER_INODE_ID, INodeDirectory.ROOT_NAME, INodeDirectory.ROOT_DIR_DEPTH); LightWeightRequestHandler getRootINode = new LightWeightRequestHandler(HDFSOperationType.GET_ROOT) { @Override public Object performTask() throws IOException { INodeDataAccess da = (INodeDataAccess) HdfsStorageFactory .getDataAccess(INodeDataAccess.class); INode rootINode = (INode) da.findInodeByNameParentIdAndPartitionIdPK(INodeDirectory.ROOT_NAME, HdfsConstantsClient.GRANDFATHER_INODE_ID, rootPartitionId); return rootINode; } }; while (running) { try { Thread.sleep(UPDATE_TIMER); INode rootInodeRet = (INode) getRootINode.handle(); if (rootInodeRet != null) { synchronized (rootCacheUpdater) { rootINode = rootInodeRet; } } else { LOG.debug("RootCache: root does not exist."); } } catch (InterruptedException e) { LOG.warn(e); Thread.currentThread().interrupt(); } catch (IOException e) { LOG.warn(e); } } }
Source:
public DistStageAck executeOnSlave() { if (groupName == null || (slaveState.getGroupName() != null && slaveState.getGroupName().equals(groupName))) { ProbeSlaveMonitor slaveMonitors = slaveState.get(ProbeSlaveMonitor.MONITORS) == null ? new ProbeSlaveMonitor(slaveState, period) : (ProbeSlaveMonitor) slaveState.get(ProbeSlaveMonitor.MONITORS); slaveMonitors.addMonitor(new Monitor() { @Override public void run() { JgroupsProbeMonitorStartStage.this.run(); } @Override public void start() { JgroupsProbeMonitorStartStage.this.run(); } @Override public void stop() { JgroupsProbeMonitorStartStage.this.run(); } }); slaveMonitors.start(); } return successfulResponse(); }

Target:
public DistStageAck executeOnSlave() { ProbeSlaveMonitor slaveMonitors = slaveState.get(ProbeSlaveMonitor.MONITORS) == null ? new ProbeSlaveMonitor(slaveState, period) : (ProbeSlaveMonitor) slaveState.get(ProbeSlaveMonitor.MONITORS); slaveMonitors.addMonitor(new Monitor() { @Override public void run() { try { monitor(JgroupsProbeMonitorStartStage.this.run()); } catch (IOException e) { log.error(e.getMessage(), e); } } @Override public void start() { try { monitor(JgroupsProbeMonitorStartStage.this.run()); } catch (IOException e) { log.error(e.getMessage(), e); } } @Override public void stop() { try { monitor(JgroupsProbeMonitorStartStage.this.run()); } catch (IOException e) { log.error(e.getMessage(), e); } } public void monitor(String[] packetsResponse) { for (String response : packetsResponse) { if (printResultsAsInfo) { log.info(response); } else { log.trace(response); } } } }); slaveMonitors.start(); return successfulResponse(); }
Source:
public void testTraceSetWithExperiment() { Set<ITmfTrace> expected = ImmutableSet.of(trace1); Set<ITmfTrace> actual = TmfTraceManager.getTraceSetWithExperiment(trace1); assertEquals(1, actual.size()); assertArrayEquals(expected.toArray(), actual.toArray()); TmfExperiment exp = createExperiment(trace1, trace2); expected = ImmutableSet.of(trace1, trace2, exp); actual = TmfTraceManager.getTraceSetWithExperiment(exp); assertEquals(3, actual.size()); assertArrayEquals(expected.toArray(), actual.toArray()); }

Target:
public void testTraceSetWithExperiment() { Set<ITmfTrace> expected = ImmutableSet.of(trace1); Set<ITmfTrace> actual = TmfTraceManager.getTraceSetWithExperiment(trace1); assertEquals(1, actual.size()); assertEquals(expected, actual); TmfExperiment exp = createExperiment(trace1, trace2); expected = ImmutableSet.of(trace1, trace2, exp); actual = TmfTraceManager.getTraceSetWithExperiment(exp); assertEquals(3, actual.size()); assertEquals(expected, actual); }
Source:
public void testImportVMFromConfigurationXMLCouldNotGetParsed() { OvfEntityData ovfEntity = getOvfEntityData(); ovfEntity.setOvfData("This is not a valid XML"); initCommand(ovfEntity); when(unregisteredOVFDataDao.getByEntityIdAndStorageDomain(vmId, storageDomainId)).thenReturn(ovfEntity); when(validator.validateUnregisteredEntity(any(IVdcQueryable.class), any(OvfEntityData.class), any(List.class))).thenReturn(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED)); CanDoActionTestUtils.runAndAssertCanDoActionFailure(cmd, VdcBllMessages.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED); }

Target:
public void testImportVMFromConfigurationXMLCouldNotGetParsed() { OvfEntityData ovfEntity = getOvfEntityData(); ovfEntity.setOvfData("This is not a valid XML"); initCommand(ovfEntity); when(unregisteredOVFDataDao.getByEntityIdAndStorageDomain(vmId, storageDomainId)).thenReturn(ovfEntity); when(validator.validateUnregisteredEntity(any(IVdcQueryable.class), any(OvfEntityData.class), anyList())).thenReturn(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED)); CanDoActionTestUtils.runAndAssertCanDoActionFailure(cmd, VdcBllMessages.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED); }
Source:
public static <A> UniConstraintCollector<A, ?, Integer> countDistinct(Function<A, ?> groupValueMapping) { return ConstraintCollectors.countDistinctLong(groupValueMapping, Long::intValue); }

Target:
public static <A> UniConstraintCollector<A, ?, Integer> countDistinct(Function<A, ?> groupValueMapping) { class CountDistinctResultContainer { int count = 0; Map<Object, int[]> objectCountMap = new HashMap<>(); } return new DefaultUniConstraintCollector<>( CountDistinctResultContainer::new, (resultContainer, a) -> { Object value = groupValueMapping.apply(a); int[] objectCount = resultContainer.objectCountMap.computeIfAbsent(value, k -> new int[1]); if (objectCount[0] == 0) { resultContainer.count++; } objectCount[0]++; return (() -> { int[] objectCount2 = resultContainer.objectCountMap.get(value); if (objectCount2 == null) { throw new IllegalStateException("Impossible state: the value (" + value + ") of A (" + a + ") is removed more times than it was added."); } objectCount2[0]--; if (objectCount2[0] == 0) { resultContainer.objectCountMap.remove(value); resultContainer.count--; } }); }, resultContainer -> resultContainer.count); }
Source:
public void onActivityResult(int requestCode, int resultCode, Intent data) { if (mFacebookAuthHelper != null) { mFacebookAuthHelper.mCallbackManager.onActivityResult(requestCode, resultCode, data); } if (mTwitterAuthHelper != null) { mTwitterAuthHelper.onActivityResult(requestCode, resultCode, data); } if (mGoogleAuthHelper != null) { mGoogleAuthHelper.onActivityResult(requestCode, resultCode, data); } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { if (mFacebookAuthProvider != null) { mFacebookAuthProvider.mCallbackManager.onActivityResult(requestCode, resultCode, data); } if (mTwitterAuthProvider != null) { mTwitterAuthProvider.onActivityResult(requestCode, resultCode, data); } if (mGoogleAuthProvider != null) { mGoogleAuthProvider.onActivityResult(requestCode, resultCode, data); } }
Source:
private static Collection<ExternalVnicProfileMapping> mapVnicProfilesMapping(RegistrationVnicProfileMappings model) { Collection<ExternalVnicProfileMapping> result = new ArrayList<>(model.getRegistrationVnicProfileMappings().size()); model.getRegistrationVnicProfileMappings().forEach(regMapping -> { result.add(new ExternalVnicProfileMapping( regMapping.getFrom().getNetwork().getName(), regMapping.getFrom().getName(), regMapping.getTo() != null ? new Guid(regMapping.getTo().getId()) : null)); }); return result; }

Target:
private static Collection<ExternalVnicProfileMapping> mapVnicProfilesMapping( RegistrationVnicProfileMappings model) { return model.getRegistrationVnicProfileMappings() .stream() .map(regMapping -> new ExternalVnicProfileMapping( regMapping.getFrom().getNetwork().getName(), regMapping.getFrom().getName(), regMapping.getTo() != null ? new Guid(regMapping.getTo().getId()) : null)) .collect(Collectors.toList()); }
Source:
private void endFilteredBlock(FilteredBlock m) { if (log.isDebugEnabled()) log.debug("{}: Received broadcast filtered block {}", getAddress(), m.getHash().toString()); if (!vDownloadData) { log.debug("{}: Received block we did not ask for: {}", getAddress(), m.getHash().toString()); return; } if (blockChain == null) { log.warn("Received filtered block but was not configured with an AbstractBlockChain"); return; } pendingBlockDownloads.remove(m.getBlockHeader().getHash()); try { lock.lock(); try { if (awaitingFreshFilter != null || checkForFilterExhaustion(m)) { if (awaitingFreshFilter == null) { log.info("Bloom filter exhausted whilst processing block {}, discarding", m.getHash()); awaitingFreshFilter = new LinkedList<Sha256Hash>(); awaitingFreshFilter.add(m.getHash()); awaitingFreshFilter.addAll(blockChain.drainOrphanBlocks()); } else { log.info("Discarding block because we're still waiting for a fresh filter", m.getHash()); awaitingFreshFilter.add(m.getHash()); } return; } } finally { lock.unlock(); } if (blockChain.add(m)) { invokeOnBlocksDownloaded(m.getBlockHeader()); } else { lock.lock(); try { final Block orphanRoot = checkNotNull(blockChain.getOrphanRoot(m.getHash())); blockChainDownloadLocked(orphanRoot.getHash()); } finally { lock.unlock(); } } } catch (VerificationException e) { log.warn("{}: FilteredBlock verification failed", getAddress(), e); } catch (PrunedException e) { throw new RuntimeException(e); } }

Target:
private void endFilteredBlock(FilteredBlock m) { if (log.isDebugEnabled()) log.debug("{}: Received broadcast filtered block {}", getAddress(), m.getHash().toString()); if (!vDownloadData) { log.debug("{}: Received block we did not ask for: {}", getAddress(), m.getHash().toString()); return; } if (blockChain == null) { log.warn("Received filtered block but was not configured with an AbstractBlockChain"); return; } pendingBlockDownloads.remove(m.getBlockHeader().getHash()); try { lock.lock(); try { if (awaitingFreshFilter != null) { log.info("Discarding block because we're still waiting for a fresh filter", m.getHash()); awaitingFreshFilter.add(m.getHash()); return; } else if (checkForFilterExhaustion(m)) { log.info("Bloom filter exhausted whilst processing block {}, discarding", m.getHash()); awaitingFreshFilter = new LinkedList<Sha256Hash>(); awaitingFreshFilter.add(m.getHash()); awaitingFreshFilter.addAll(blockChain.drainOrphanBlocks()); return; } } finally { lock.unlock(); } if (blockChain.add(m)) { invokeOnBlocksDownloaded(m.getBlockHeader()); } else { lock.lock(); try { final Block orphanRoot = checkNotNull(blockChain.getOrphanRoot(m.getHash())); blockChainDownloadLocked(orphanRoot.getHash()); } finally { lock.unlock(); } } } catch (VerificationException e) { log.warn("{}: FilteredBlock verification failed", getAddress(), e); } catch (PrunedException e) { throw new RuntimeException(e); } }
Source:
public static <V> CompletableFuture<V> toCompletableFuture(ListenableFuture<V> listenableFuture) { requireNonNull(listenableFuture, "listenableFuture is null"); CompletableFuture<V> future = new CompletableFuture<>(); listenableFuture.addListener(() -> { try { future.complete(listenableFuture.get()); } catch (InterruptedException e) { future.completeExceptionally(e); } catch (ExecutionException e) { Throwable cause = e.getCause() == null ? e : e.getCause(); future.completeExceptionally(cause); } }, MoreExecutors.directExecutor()); return future; }

Target:
public static <V> CompletableFuture<V> toCompletableFuture(ListenableFuture<V> listenableFuture) { requireNonNull(listenableFuture, "listenableFuture is null"); CompletableFuture<V> future = new CompletableFuture<>(); future.exceptionally(throwable -> { if (throwable instanceof CancellationException) { listenableFuture.cancel(true); } return null; }); Futures.addCallback(listenableFuture, new FutureCallback<V>() { @Override public void onSuccess(V result) { future.complete(result); } @Override public void onFailure(Throwable t) { future.completeExceptionally(t); } }); return future; }
Source:
protected void setMatcherString(String pattern) { if (pattern.length() == 0) { searchPattern = null; } else { SearchPattern patternMatcher = new SearchPattern(); if (pattern.indexOf('*') != 0 && pattern.indexOf('?') != 0 && pattern.indexOf('.') != 0) { pattern = "*" + pattern; } patternMatcher.setPattern(pattern); searchPattern = patternMatcher; } }

Target:
protected void setMatcherString(String pattern) { if (pattern.length() == 0) { searchPattern = null; } else { SearchPattern patternMatcher = new SearchPattern(); if (pattern.indexOf('*') != 0 && pattern.indexOf('?') != 0 && pattern.indexOf('.') != 0) { pattern = '*' + pattern; } patternMatcher.setPattern(pattern); searchPattern = patternMatcher; } }
Source:
public static final boolean hasReadPairedFlag(Read read) { return read.getFlags() != null && ((read.getFlags() & READ_PAIRED_FLAG) != 0); }

Target:
public static boolean hasReadPairedFlag(Read read) { return hasFlag(read, READ_PAIRED_FLAG); }
Source:
public void enqueueUpdatesNumberOfShards() { assertThat(DEFAULT_SWEEP_QUEUE_SHARDS).isLessThan(DEFAULT_SHARDS); assertThat(progress.getNumberOfShards()).isEqualTo(DEFAULT_SWEEP_QUEUE_SHARDS); enqueueWriteCommitted(TABLE_CONS, LOW_TS); assertThat(progress.getNumberOfShards()).isEqualTo(DEFAULT_SHARDS); }

Target:
public void enqueueUpdatesNumberOfShards() { assertThat(AtlasDbConstants.DEFAULT_SWEEP_QUEUE_SHARDS).isLessThan(DEFAULT_SHARDS); assertThat(progress.getNumberOfShards()).isEqualTo(AtlasDbConstants.DEFAULT_SWEEP_QUEUE_SHARDS); enqueueWriteCommitted(TABLE_CONS, LOW_TS); assertThat(progress.getNumberOfShards()).isEqualTo(DEFAULT_SHARDS); }
Source:
boolean isSupportedKeyType(X509Certificate cert) { for (ClientCertificateType type : certificateTypes) { boolean isCompatibleType = type.isCompatibleWithKeyAlgorithm(cert.getPublicKey().getAlgorithm()); boolean meetsSigningRequirements = !type.requiresSigningCapability() || (type.requiresSigningCapability() && (cert.getKeyUsage() == null || cert.getKeyUsage()[0])); LOGGER.debug("type: {}, isCompatibleWithKeyAlgorithm[{}]: {}, meetsSigningRequirements: {}", new Object[]{ type, cert.getPublicKey().getAlgorithm(), isCompatibleType, meetsSigningRequirements}); if (isCompatibleType && meetsSigningRequirements) { return true; } } LOGGER.debug("certificate is not of any supported type", cert); return false; }

Target:
boolean isSupportedKeyType(X509Certificate cert) { for (ClientCertificateType type : certificateTypes) { boolean isCompatibleType = type.isCompatibleWithKeyAlgorithm(cert.getPublicKey().getAlgorithm()); boolean meetsSigningRequirements = !type.requiresSigningCapability() || (cert.getKeyUsage() == null || cert.getKeyUsage()[0]); LOGGER.debug("type: {}, isCompatibleWithKeyAlgorithm[{}]: {}, meetsSigningRequirements: {}", new Object[] { type, cert.getPublicKey().getAlgorithm(), isCompatibleType, meetsSigningRequirements }); if (isCompatibleType && meetsSigningRequirements) { return true; } } LOGGER.debug("certificate is not of any supported type", cert); return false; }
Source:
public Action<?, ?> startingDownscaleAction() { return new AbstractDownscaleAction<>(DownscaleEvent.class) { @Override protected void doExecute(FreeIpaDownscaleContext context, DownscaleEvent payload, Map<Object, Object> variables) { Stack stack = context.getStack(); List<String> instanceIds = context.getInstanceIds(); LOGGER.info("Starting downscale of stack instances [{}]", stack.getId(), instanceIds); stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.DOWNSCALE_IN_PROGRESS, "Starting downscale"); sendEvent(context, STARTING_DOWNSCALE_FINISHED_EVENT.selector(), new StackEvent(stack.getId())); } }; }

Target:
public Action<?, ?> startingDownscaleAction() { return new AbstractDownscaleAction<>(DownscaleEvent.class) { @Override protected void doExecute(StackContext context, DownscaleEvent payload, Map<Object, Object> variables) { Stack stack = context.getStack(); List<String> instanceIds = payload.getInstanceIds(); setInstanceIds(variables, instanceIds); String operationId = payload.getOperationId(); setOperationId(variables, operationId); List<String> fqdns = getInstanceMetadataFromStack(stack, instanceIds).stream() .map(InstanceMetaData::getDiscoveryFQDN) .filter(Objects::nonNull) .collect(Collectors.toList()); setHosts(variables, fqdns); LOGGER.info("Starting downscale of stack instances [{}]", stack.getId(), instanceIds); stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.DOWNSCALE_IN_PROGRESS, "Starting downscale"); sendEvent(context, STARTING_DOWNSCALE_FINISHED_EVENT.selector(), new StackEvent(stack.getId())); } }; }
Source:
public byte[] getNoLeadZeroesData() { return ByteUtil.stripLeadingZeroes(getData()); }

Target:
public byte[] getNoLeadZeroesData() { return ByteUtil.stripLeadingZeroes(copyData()); }
Source:
public void placeNewMarketOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if (orderType == OrderType.BUY) { BuyOrder order = new BuyOrder(symbol, volume, true, this); for (Order o : ordersPlaced) { if (o.getStockSymbol() == order.getStockSymbol()) { throw new StockMarketExpection("An order for this stock has already been placed. Stock: " + symbol + " Trader: " + name); } } ordersPlaced.add(order); m.addOrder(order); } else { SellOrder order = new SellOrder(symbol, volume, true, this); boolean found = false; for (Order o : position) { if (o.getStockSymbol() == order.getStockSymbol()) { found = true; if (order.getSize() > o.getSize()) { throw new StockMarketExpection("The trader does not have enough stock to sell. Stock: " + symbol + " Trader: " + name); } } } for (Order o : ordersPlaced) { if (o.getStockSymbol() == order.getStockSymbol()) { throw new StockMarketExpection("An order for this stock has already been placed. Stock: " + symbol + " Trader: " + name); } } if (found == false) { throw new StockMarketExpection("The trader does not have the stock for this order. Stock: " + symbol + " Trader: " + name); } ordersPlaced.add(order); m.addOrder(order); } }

Target:
public void placeNewMarketOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if (orderType == OrderType.BUY) { BuyOrder order = new BuyOrder(symbol, volume, true, this); for (Order orderIterator : ordersPlaced) { if (orderIterator.getStockSymbol() == order.getStockSymbol()) { throw new StockMarketExpection("An order for this stock has already been placed. Stock: " + symbol + " Trader: " + name); } } ordersPlaced.add(order); m.addOrderToMarket(order); } else { SellOrder order = new SellOrder(symbol, volume, true, this); boolean found = false; for (Order orderIterator : position) { if (orderIterator.getStockSymbol() == order.getStockSymbol()) { found = true; if (order.getSize() > orderIterator.getSize()) { throw new StockMarketExpection("The trader does not have enough stock to sell. Stock: " + symbol + " Trader: " + name); } } } for (Order orderIterator : ordersPlaced) { if (orderIterator.getStockSymbol() == order.getStockSymbol()) { throw new StockMarketExpection("An order for this stock has already been placed. Stock: " + symbol + " Trader: " + name); } } if (found == false) { throw new StockMarketExpection("The trader does not have the stock for this order. Stock: " + symbol + " Trader: " + name); } ordersPlaced.add(order); m.addOrderToMarket(order); } }
Source:
private int readInt( long pageId, int pageOffset ) throws IOException { int bytesInCurentPage = pageSize - pageOffset; if ( bytesInCurentPage < 4 ) { return readPageCrossingInt( pageId, pageOffset, bytesInCurentPage ); } moveCursorTo( pageId, pageOffset ); int val; do { val = cursor.getInt( pageOffset ); } while ( cursor.shouldRetry() ); if ( cursor.checkAndClearBoundsFlag() ) { throw newEOFException( "Cursor bounds check failed" ); } return val; }

Target:
private int readInt( long pageId, int pageOffset ) throws IOException { moveCursorTo( pageId, pageOffset ); int val; do { val = cursor.getInt( pageOffset ); } while ( cursor.shouldRetry() ); if ( !cursor.checkAndClearBoundsFlag() ) { return val; } return readPageCrossingInt( pageId, pageOffset ); }
Source:
public Server(String clusterName, String mainDirectory, String languages, String transportAddresses) throws Exception { try { if (SystemUtils.IS_OS_WINDOWS) { setupDirectories(new URL("file:/ } else { setupDirectories(new URL("file://" + mainDirectory)); } } catch (Exception e) { throw new RuntimeException("Can't create directories: ", e); } this.clusterName = clusterName; this.languages = languages.split(","); this.transportAddresses = transportAddresses; }

Target:
public Server(String clusterName, String mainDirectory, String languages, String transportAddresses) { try { if (SystemUtils.IS_OS_WINDOWS) { setupDirectories(new URL("file:/ } else { setupDirectories(new URL("file://" + mainDirectory)); } } catch (Exception e) { throw new RuntimeException("Can't create directories: ", e); } this.clusterName = clusterName; this.languages = languages.split(","); this.transportAddresses = transportAddresses; }
Source:
public void viewWithNoResult_emptyList() throws IOException { init(); assertEquals(0, db.getViewRequestBuilder("example", "by_tag").newRequest(Key.Type.STRING, Object.class).keys("javax").build().getResponse().getKeys().size(), "The results list should be of length 0"); }

Target:
public void viewWithNoResult_emptyList() throws IOException { init(); assertEquals(0, db.getViewRequestBuilder("example", "by_tag").newRequest(Key.Type.STRING, Object.class).keys("javax").build().getResponse().getKeys().size(), "The results " + "list should be of length 0"); }
Source:
private void setJspVersion(CompileJSPs compile, Set<String> installedFeatures) { if (jspVersion != null) { compile.setJspVersion(jspVersion); } else if (installedFeatures.contains("jsp-2.2")) { compile.setJspVersion("2.2"); } else if (installedFeatures.contains("jsp-2.3")) { compile.setJspVersion("2.3"); } }

Target:
private void setJspVersion(CompileJSPs compile, Set<String> installedFeatures) { if (jspVersion != null) { compile.setJspVersion(jspVersion); } else { Iterator it = installedFeatures.iterator(); String currentFeature; while (it.hasNext()) { currentFeature = (String) it.next(); if(currentFeature.startsWith("jsp-")) { String version = currentFeature.replace("jsp-", ""); compile.setJspVersion(version); break; } } } }
Source:
public SXSSFWorkbook searchResultToExcel(List<Vertex> vertices, String rootType, int depth, List<String> relationNames) { SXSSFWorkbook workbook = new SXSSFWorkbook(); final String[] relationTypes = relationNames == null ? null : relationNames.toArray(new String[relationNames.size()]); Collection rootCollection = mappings.getCollectionForType(rootType).get(); Vre vre = rootCollection.getVre(); String detectedVre = vre.getVreName(); Map<String, Set<Vertex>> verticesPerType = Maps.newHashMap(); verticesPerType.put(rootCollection.getEntityTypeName(), Sets.newHashSet(vertices)); GraphTraversal<Vertex, Vertex> current = graphWrapper.getGraph().traversal().V(vertices); String relationPropTypeName = getRelationAcceptedPropName(vre); for (int i = 0; i < depth - 1; i++) { current = relationTypes == null ? current.bothE().and(__.has(relationPropTypeName, true), __.has("isLatest", true)).otherV() : current.bothE(relationTypes).and(__.has(relationPropTypeName, true), __.has("isLatest", true)).otherV(); mapVertices(detectedVre, current, verticesPerType); } renderEntitySheets(workbook, verticesPerType, relationPropTypeName, relationTypes); return workbook; }

Target:
public SXSSFWorkbook searchResultToExcel(List<Vertex> vertices, String rootType, int depth, List<String> relationNames) { SXSSFWorkbook workbook = new SXSSFWorkbook(); final String[] relationTypes = relationNames == null ? null : relationNames.toArray(new String[relationNames.size()]); Collection rootCollection = mappings.getCollectionForType(rootType).get(); Vre vre = rootCollection.getVre(); String detectedVre = vre.getVreName(); Map<String, Set<Vertex>> verticesPerType = Maps.newHashMap(); verticesPerType.put(rootCollection.getEntityTypeName(), Sets.newHashSet(vertices)); GraphTraversal<Vertex, Vertex> current = graphWrapper.getGraph().traversal().V(vertices); String relationPropTypeName = getRelationAcceptedPropName(vre); for (int i = 1; i < depth; i++) { current = relationTypes == null ? current.bothE().and(__.has(relationPropTypeName, true), __.has("isLatest", true)).otherV() : current.bothE(relationTypes).and(__.has(relationPropTypeName, true), __.has("isLatest", true)).otherV(); mapVertices(detectedVre, current, verticesPerType); } renderEntitySheets(workbook, verticesPerType, relationPropTypeName, relationTypes); return workbook; }
Source:
private ANTLRv4GrammarProperties findSettingsForFile(String fileName) { for (ANTLRv4GrammarProperties settings : perGrammarGenerationSettings) { WildcardFileNameMatcher wildcardFileNameMatcher = new WildcardFileNameMatcher(settings.fileName); if (wildcardFileNameMatcher.acceptsCharSequence(fileName)) { return settings; } } return null; }

Target:
private ANTLRv4GrammarProperties findSettingsForFile(String fileName) { for (ANTLRv4GrammarProperties settings : perGrammarGenerationSettings) { if (settings.fileName.equals(fileName)) { return settings; } } for (ANTLRv4GrammarProperties settings : perGrammarGenerationSettings) { if (matchesWildcardPattern(fileName, settings)) { return settings; } } return null; }
Source:
public Extension deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { if (urn == null || urn.isEmpty()) { throw new IllegalStateException("The URN cannot be null or empty"); } JsonNode rootNode = jp.readValueAsTree(); if (rootNode.getNodeType() != JsonNodeType.OBJECT) { throw new JsonMappingException("Extension is of wrong JSON type"); } Extension.Builder extension = new Extension.Builder(urn); Iterator<Map.Entry<String, JsonNode>> fieldIterator = rootNode.fields(); while (fieldIterator.hasNext()) { Map.Entry<String, JsonNode> entry = fieldIterator.next(); switch (entry.getValue().getNodeType()) { case BOOLEAN: handleBoolean(extension, entry); break; case STRING: handleString(extension, entry); break; case NUMBER: handleNumber(extension, entry); break; default: throw new IllegalArgumentException("JSON type not supported: " + entry.getValue().getNodeType()); } } return extension.build(); }

Target:
public Extension deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { if (urn == null || urn.isEmpty()) { throw new IllegalStateException("The URN cannot be null or empty"); } JsonNode rootNode = jp.readValueAsTree(); if (rootNode.getNodeType() != JsonNodeType.OBJECT) { throw new JsonMappingException("Extension is of wrong JSON type"); } Extension.Builder extensionBuilder = new Extension.Builder(urn); Iterator<Map.Entry<String, JsonNode>> fieldIterator = rootNode.fields(); while (fieldIterator.hasNext()) { Map.Entry<String, JsonNode> entry = fieldIterator.next(); switch (entry.getValue().getNodeType()) { case BOOLEAN: handleBoolean(extensionBuilder, entry); break; case STRING: handleString(extensionBuilder, entry); break; case NUMBER: handleNumber(extensionBuilder, entry); break; default: throw new IllegalArgumentException("JSON type not supported: " + entry.getValue().getNodeType()); } } return extensionBuilder.build(); }
Source:
public void sendRoutingTableUpdateMsg(final String destId, final List<Integer> blocks, final String oldEvalId, final String newEvalId, @Nullable final TraceInfo parentTraceInfo) { Span detached = null; try (final TraceScope sendRoutingTableUpdateMsgScope = Trace.startSpan(SEND_ROUTING_TABLE_UPDATE_MSG + ". destId: " + destId, parentTraceInfo)) { LOG.entering(ElasticMemoryMsgSenderImpl.class.getSimpleName(), "sendRoutingTableUpdateMsg"); final RoutingTableUpdateMsg routingTableUpdateMsg = RoutingTableUpdateMsg.newBuilder() .setOldEvalId(oldEvalId) .setNewEvalId(newEvalId) .setBlockIds(blocks) .build(); detached = sendRoutingTableUpdateMsgScope.detach(); send(destId, AvroElasticMemoryMessage.newBuilder() .setType(Type.RoutingTableUpdateMsg) .setSrcId(emNetworkSetup.getMyId().toString()) .setDestId(destId) .setTraceInfo(HTraceUtils.toAvro(TraceInfo.fromSpan(detached))) .setRoutingTableUpdateMsg(routingTableUpdateMsg) .build()); LOG.exiting(ElasticMemoryMsgSenderImpl.class.getSimpleName(), "sendRoutingTableUpdateMsg"); } finally { Trace.continueSpan(detached).close(); } }

Target:
public void sendRoutingTableUpdateMsg(final String destId, final List<Integer> blocks, final String oldEvalId, final String newEvalId, @Nullable final TraceInfo parentTraceInfo) { Span detached = null; try (final TraceScope sendRoutingTableUpdateMsgScope = Trace.startSpan(String.format("send_routing_table_update_msg. destId: %s", destId), parentTraceInfo)) { LOG.entering(ElasticMemoryMsgSenderImpl.class.getSimpleName(), "sendRoutingTableUpdateMsg"); final RoutingTableUpdateMsg routingTableUpdateMsg = RoutingTableUpdateMsg.newBuilder() .setOldEvalId(oldEvalId) .setNewEvalId(newEvalId) .setBlockIds(blocks) .build(); detached = sendRoutingTableUpdateMsgScope.detach(); send(destId, AvroElasticMemoryMessage.newBuilder() .setType(Type.RoutingTableUpdateMsg) .setSrcId(emNetworkSetup.getMyId().toString()) .setDestId(destId) .setTraceInfo(HTraceUtils.toAvro(TraceInfo.fromSpan(detached))) .setRoutingTableUpdateMsg(routingTableUpdateMsg) .build()); LOG.exiting(ElasticMemoryMsgSenderImpl.class.getSimpleName(), "sendRoutingTableUpdateMsg"); } finally { Trace.continueSpan(detached).close(); } }
Source:
public void setMaxSession(final Integer value) { if (logger.isTraceEnabled()) { logger.trace("setMaxSession(" + value + ")"); } if ( value < 1 ) { logger.warn("Invalid number of session (negative):" + value + ", defaulting to 1."); maxSession = 1; } else maxSession = value; }

Target:
public void setMaxSession(final Integer value) { if (logger.isTraceEnabled()) { logger.trace("setMaxSession(" + value + ")"); } if ( value < 1 ) { maxSession = 1; ActiveMQRALogger.LOGGER.invalidNumberOfMaxSession(value, maxSession); } else maxSession = value; }
Source:
private HandshakeStatus wrap( ByteBuffer buffer ) throws IOException { HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); Status status = sslEngine.wrap( buffer, cipherOut ).getStatus(); switch ( status ) { case OK: handshakeStatus = runDelegatedTasks(); cipherOut.flip(); while ( cipherOut.hasRemaining() ) { channelWrite( cipherOut ); } cipherOut.clear(); break; case BUFFER_OVERFLOW: int curNetSize = cipherOut.capacity(); int netSize = sslEngine.getSession().getPacketBufferSize(); if ( netSize > curNetSize ) { cipherOut = ByteBuffer.allocate( netSize ); logger.debug( "Enlarged network output buffer from %s to %s. " + "This operation should be a rare operation.", curNetSize, netSize ); } else { cipherOut.flip(); channelWrite( cipherOut ); cipherOut.compact(); logger.debug( "Network output buffer couldn't be enlarged, flushing data to the channel instead." ); } break; default: throw new ClientException( "Got unexpected status " + status ); } return handshakeStatus; }

Target:
private HandshakeStatus wrap( ByteBuffer buffer ) throws IOException, ClientException { HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); Status status = sslEngine.wrap( buffer, cipherOut ).getStatus(); switch ( status ) { case OK: handshakeStatus = runDelegatedTasks(); cipherOut.flip(); while ( cipherOut.hasRemaining() ) { channelWrite( cipherOut ); } cipherOut.clear(); break; case BUFFER_OVERFLOW: int curNetSize = cipherOut.capacity(); int netSize = sslEngine.getSession().getPacketBufferSize(); if ( netSize > curNetSize ) { cipherOut = ByteBuffer.allocate( netSize ); logger.debug( "Enlarged network output buffer from %s to %s. " + "This operation should be a rare operation.", curNetSize, netSize ); } else { cipherOut.flip(); if ( channelWrite( cipherOut ) == 0 ) { throw new ClientException( format( "Failed to enlarge network buffer from %s to %s. This is either because the " + "new size is however less than the old size, or because the application " + "buffer size %s is so big that the application data still cannot fit into the " + "new network buffer.", curNetSize, netSize, buffer.capacity() ) ); } cipherOut.compact(); logger.debug( "Network output buffer couldn't be enlarged, flushing data to the channel instead." ); } break; default: throw new ClientException( "Got unexpected status " + status ); } return handshakeStatus; }
Source:
public void testSetMaxSize() throws Exception { SizeLimitedVector slv = new SizeLimitedVector(10); slv.setMaxSize(14); assertEquals(slv.getMaxSize(), 14); }

Target:
public void testSetMaxSize() throws Exception { SizeLimitedVector slv = new SizeLimitedVector(5); slv.setMaxSize(6); slv.add(1); slv.add(2); slv.add(3); slv.add(4); slv.add(5); slv.add(6); slv.add(7); assertEquals(slv.getMaxSize(), 6); assertEquals(slv.capacity(), 10); assertEquals(slv.size(), 6); assertEquals(slv.get(0), 2); }