auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void resolveTwoLevelHigherRelativeUrl() throws IOException, ConfigInvalidException { final String path = addSubmoduleToIndex(); String base = "git://server/repo.git"; FileBasedConfig config = db.getConfig(); config.setString(ConfigConstants.CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL, base); config.save(); SubmoduleWalk generator = SubmoduleWalk.forIndex(db); assertTrue(generator.next()); assertNull(generator.getConfigUrl()); assertNull(generator.getConfigUpdate()); FileBasedConfig modulesConfig = new FileBasedConfig(new File( db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_PATH, path); String url = "../../sub.git"; modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_URL, url); String update = "rebase"; modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_UPDATE, update); modulesConfig.save(); SubmoduleInitCommand command = new SubmoduleInitCommand(db); Collection<String> modules = command.call(); assertNotNull(modules); assertEquals(1, modules.size()); assertEquals(path, modules.iterator().next()); generator = SubmoduleWalk.forIndex(db); assertTrue(generator.next()); assertEquals("git://sub.git", generator.getConfigUrl()); assertEquals(update, generator.getConfigUpdate()); }

Target:
public void resolveTwoLevelHigherRelativeUrl() throws IOException, ConfigInvalidException { final String path = addSubmoduleToIndex(); String base = "git://server/repo.git"; FileBasedConfig config = db.getConfig(); config.setString(ConfigConstants.CONFIG_REMOTE_SECTION, Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL, base); config.save(); SubmoduleWalk generator = SubmoduleWalk.forIndex(db); assertTrue(generator.next()); assertNull(generator.getConfigUrl()); assertNull(generator.getConfigUpdate()); FileBasedConfig modulesConfig = new FileBasedConfig(new File( db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS()); modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_PATH, path); String url = "../../server2/sub.git"; modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_URL, url); String update = "rebase"; modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_UPDATE, update); modulesConfig.save(); SubmoduleInitCommand command = new SubmoduleInitCommand(db); Collection<String> modules = command.call(); assertNotNull(modules); assertEquals(1, modules.size()); assertEquals(path, modules.iterator().next()); generator = SubmoduleWalk.forIndex(db); assertTrue(generator.next()); assertEquals("git://server2/sub.git", generator.getConfigUrl()); assertEquals(update, generator.getConfigUpdate()); }
Source:
protected boolean hasType(JSONObject valueObject, ResourceTypes jsonType) { if (!valueObject.has(WebAnnotationFields.TYPE)) return false; try { String value = parseStringTypeValue(valueObject); return jsonType.getJsonValue().equals(value); } catch (JSONException e) { } catch (ClassCastException e) { } try { String value; JSONArray array = (JSONArray) valueObject.get(WebAnnotationFields.TYPE); for (int i = 0; i < array.length(); i++) { value = array.getString(i); if (jsonType.getJsonValue().equals(value)) return true; } } catch (JSONException e) { logger.warn("Unexpected problem occured when parsing type value: " + valueObject); } return false; }

Target:
protected boolean hasType(JSONObject valueObject, ResourceTypes jsonType) { if (!valueObject.has(WebAnnotationFields.TYPE)) return false; try { String value = parseStringTypeValue(valueObject); return jsonType.getJsonValue().equals(value); } catch (JSONException e) { } try { String value; JSONArray array = (JSONArray) valueObject.get(WebAnnotationFields.TYPE); for (int i = 0; i < array.length(); i++) { value = array.getString(i); if (jsonType.getJsonValue().equals(value)) return true; } } catch (JSONException e) { logger.warn("Unexpected problem occured when parsing type value: " + valueObject); } return false; }
Source:
public TransactionalSharedLuceneLock makeLock(Directory dir, String lockName) { if (!(dir instanceof DirectoryLuceneV5)) { throw new UnsupportedOperationException("TransactionalSharedLuceneLock can only be used with DirectoryLuceneV5, got: " + dir); } DirectoryLuceneV5 infinispanDirectory = (DirectoryLuceneV5) dir; Cache cache = infinispanDirectory.getDistLockCache(); String indexName = infinispanDirectory.getIndexName(); TransactionManager tm = cache.getAdvancedCache().getTransactionManager(); if (tm == null) { ComponentStatus status = cache.getAdvancedCache().getComponentRegistry().getStatus(); if (status.equals(ComponentStatus.RUNNING)) { throw new CacheException( "Failed looking up TransactionManager. Check if any transaction manager is associated with Infinispan cache: \'" + cache.getName() + "\'"); } else { throw new CacheException("Failed looking up TransactionManager: the cache is not running"); } } TransactionalSharedLuceneLock lock = new TransactionalSharedLuceneLock(cache, indexName, lockName, tm); if (log.isTraceEnabled()) { log.tracef("Lock prepared, not acquired: %s for index %s", lockName, indexName); } return lock; }

Target:
public TransactionalSharedLuceneLock makeLock(Directory dir, String lockName) { if (!(dir instanceof DirectoryLucene)) { throw new UnsupportedOperationException("TransactionalSharedLuceneLock can only be used with DirectoryLucene, got: " + dir); } DirectoryLucene infinispanDirectory = (DirectoryLucene) dir; Cache cache = infinispanDirectory.getDistLockCache(); String indexName = infinispanDirectory.getIndexName(); TransactionManager tm = cache.getAdvancedCache().getTransactionManager(); if (tm == null) { ComponentStatus status = cache.getAdvancedCache().getComponentRegistry().getStatus(); if (status.equals(ComponentStatus.RUNNING)) { throw new CacheException( "Failed looking up TransactionManager. Check if any transaction manager is associated with Infinispan cache: \'" + cache.getName() + "\'"); } else { throw new CacheException("Failed looking up TransactionManager: the cache is not running"); } } TransactionalSharedLuceneLock lock = new TransactionalSharedLuceneLock(cache, indexName, lockName, tm); if (log.isTraceEnabled()) { log.tracef("Lock prepared, not acquired: %s for index %s", lockName, indexName); } return lock; }
Source:
public PhysicalOperation(OperatorFactory operatorFactory, Map<Symbol, Integer> layout, LocalExecutionPlanContext context, PhysicalOperation source) { requireNonNull(operatorFactory, "operatorFactory is null"); requireNonNull(layout, "layout is null"); requireNonNull(source, "source is null"); int channelCount = layout.values().stream().mapToInt(Integer::intValue).max().orElse(-1) + 1; checkArgument(layout.size() == channelCount, "invalid layout"); checkArgument(ImmutableSet.copyOf(layout.values()).containsAll(ContiguousSet.create(closedOpen(0, channelCount), integers())), "invalid layout"); Map<Integer, Symbol> channelLayout = ImmutableBiMap.copyOf(layout).inverse(); this.operatorFactories = ImmutableList.<OperatorFactory>builder().addAll(source.getOperatorFactories()).add(operatorFactory).build(); this.layout = ImmutableMap.copyOf(layout); this.types = range(0, channelCount) .mapToObj(channelLayout::get) .map(context.getTypes()::get) .collect(toImmutableList()); verify(this.types.equals(operatorFactory.getTypes())); this.pipelineExecutionStrategy = source.pipelineExecutionStrategy; }

Target:
public PhysicalOperation(OperatorFactory operatorFactory, Map<Symbol, Integer> layout, LocalExecutionPlanContext context, PhysicalOperation source) { this(operatorFactory, layout, context, Optional.of(requireNonNull(source, "source is null")), source.getPipelineExecutionStrategy()); }
Source:
protected <T> Observable buildUseCaseObservable(Map<String, T> parameters) { if (parameters == null || parameters.get(PARAM_USER_NAME) == null) { return Observable.error(new IllegalArgumentException("missing user name")); } String userName = (String) parameters.get(PARAM_USER_NAME); return surveyRepository.createUser(userName) .concatMap(new Function<Long, Observable<Boolean>>() { @Override public Observable<Boolean> apply(final Long userId) { if (userId == INVALID_ID) { return Observable.error(new Exception("Error inserting user")); } return userRepository.setSelectedUser(userId); } }); }

Target:
protected <T> Observable buildUseCaseObservable(Map<String, T> parameters) { if (parameters == null || parameters.get(PARAM_USER_NAME) == null) { return Observable.error(new IllegalArgumentException("missing user name")); } String userName = (String) parameters.get(PARAM_USER_NAME); return surveyRepository.createUser(userName) .concatMap(new Function<Long, Observable<Boolean>>() { @Override public Observable<Boolean> apply(final Long userId) { if (INVALID_USER_ID.equals(userId)) { return Observable.error(new Exception("Error inserting user")); } return userRepository.setSelectedUser(userId); } }); }
Source:
protected void updateActions() { if (! m_actionsInitialized) return; boolean enabled = hasSelection(); m_selectAllAction.setEnabled(enabled); m_refreshAction.setEnabled(enabled); m_enableLoadMetersAction.setEnabled(true); m_loadMetersRefreshSubSubmenu.setVisible(m_loadMetersEnabled); for (SetLoadMeterPeriodAction act : m_setLoadMeterPeriodActions) { act.setEnabled(true); act.refreshLabel(m_loadMeterTimerPeriod); } }

Target:
protected void updateActions() { if (! m_actionsInitialized) return; boolean enabled = hasSelection(); m_selectAllAction.setEnabled(enabled); m_refreshAction.setEnabled(enabled); m_enableLoadMetersAction.setEnabled(true); m_loadMetersRefreshSubSubmenu.setVisible(m_loadMetersEnabled); for (SetLoadMeterPeriodAction act : m_setLoadMeterPeriodActions) { act.setEnabled(true); } }
Source:
public void testWritePlaceholderProperties() throws Exception { SystemPropertiesAdmin spa = new SystemPropertiesAdmin(mockGuestClaimsHandlerExt); Map<String, String> map = new HashMap<>(); map.put(SystemBaseUrl.INTERNAL_HOST, "localhost"); map.put(SystemBaseUrl.INTERNAL_HTTP_PORT, "5678"); map.put(SystemBaseUrl.INTERNAL_HTTPS_PORT, "1234"); map.put(SystemBaseUrl.EXTERNAL_HOST, "localhost"); map.put(SystemBaseUrl.EXTERNAL_HTTP_PORT, "5678"); map.put(SystemBaseUrl.EXTERNAL_HTTPS_PORT, "1234"); spa.writeSystemProperties(map); List<SystemPropertyDetails> details = spa.readSystemProperties(); assertThat(getDetailsValue(details, SystemBaseUrl.EXTERNAL_HOST), equalTo("localhost")); assertThat(getDetailsValue(details, SystemBaseUrl.EXTERNAL_HTTP_PORT), equalTo("5678")); assertThat(getDetailsValue(details, SystemBaseUrl.EXTERNAL_HTTPS_PORT), equalTo("1234")); assertThat(getDetailsValue(details, SystemBaseUrl.INTERNAL_HOST), equalTo("localhost")); assertThat(getDetailsValue(details, SystemBaseUrl.INTERNAL_HTTP_PORT), equalTo("5678")); assertThat(getDetailsValue(details, SystemBaseUrl.INTERNAL_HTTPS_PORT), equalTo("1234")); assertThat(getDetailsValue(details, SystemInfo.ORGANIZATION), equalTo("org")); assertThat(getDetailsValue(details, SystemInfo.SITE_CONTACT), equalTo("contact")); assertThat(getDetailsValue(details, SystemInfo.SITE_NAME), equalTo("site")); assertThat(getDetailsValue(details, SystemInfo.VERSION), equalTo("version")); }

Target:
public void testWritePlaceholderProperties() throws Exception { SystemPropertiesAdmin spa = new SystemPropertiesAdmin(mockGuestClaimsHandlerExt); Map<String, String> map = new HashMap<>(); map.put(SystemBaseUrl.INTERNAL_HOST, "localhost"); map.put(SystemBaseUrl.INTERNAL_HTTP_PORT, "9999"); map.put(SystemBaseUrl.INTERNAL_HTTPS_PORT, "1111"); map.put(SystemBaseUrl.EXTERNAL_HOST, "localhost"); map.put(SystemBaseUrl.EXTERNAL_HTTP_PORT, "5678"); map.put(SystemBaseUrl.EXTERNAL_HTTPS_PORT, "1234"); spa.writeSystemProperties(map); org.apache.felix.utils.properties.Properties systemProps = new org.apache.felix.utils.properties.Properties(systemPropsFile); assertThat(systemProps.getProperty(SystemBaseUrl.EXTERNAL_HOST), equalTo("localhost")); assertThat(systemProps.getProperty(SystemBaseUrl.EXTERNAL_HOST), equalTo("localhost")); assertThat(systemProps.getProperty(SystemBaseUrl.EXTERNAL_HTTP_PORT), equalTo("5678")); assertThat(systemProps.getProperty(SystemBaseUrl.EXTERNAL_HTTPS_PORT), equalTo("1234")); assertThat(systemProps.getProperty(SystemBaseUrl.INTERNAL_HOST), equalTo("localhost")); assertThat(systemProps.getProperty(SystemBaseUrl.INTERNAL_HTTP_PORT), equalTo("9999")); assertThat(systemProps.getProperty(SystemBaseUrl.INTERNAL_HTTPS_PORT), equalTo("1111")); assertThat(systemProps.getProperty(SystemInfo.ORGANIZATION), equalTo("org")); assertThat(systemProps.getProperty(SystemInfo.SITE_CONTACT), equalTo("contact")); assertThat(systemProps.getProperty(SystemInfo.SITE_NAME), equalTo("site")); assertThat(systemProps.getProperty(SystemInfo.VERSION), equalTo("version")); }
Source:
public void inStoreAnonymousId() { StoreFixtures.withStore(client(), store -> { final String anonymousId = randomKey(); final CartDraft cartDraft = CartDraft.of(EUR).withAnonymousId(anonymousId).withStore(store.toResourceIdentifier()); final Cart cart = client().executeBlocking(CartCreateCommand.of(cartDraft)); final PagedQueryResult<Cart> result = client().executeBlocking(CartQuery.of().withPredicates(m -> m.anonymousId().is(anonymousId))); assertThat(result.getResults()).hasSize(1); assertThat(result.head().get().getId()).isEqualTo(cart.getId()); client().executeBlocking(CartDeleteCommand.of(cart)); }); }

Target:
public void inStoreAnonymousId() { withStore(client(), store -> { final String anonymousId = randomKey(); final CartDraft cartDraft = CartDraft.of(EUR).withAnonymousId(anonymousId).withStore(store.toResourceIdentifier()); final Cart cart = client().executeBlocking(CartCreateCommand.of(cartDraft)); final PagedQueryResult<Cart> result = client().executeBlocking(CartQuery.of().withPredicates(m -> m.anonymousId().is(anonymousId))); assertThat(result.getResults()).hasSize(1); assertThat(result.head().get().getId()).isEqualTo(cart.getId()); client().executeBlocking(CartDeleteCommand.of(cart)); }); }
Source:
public void testThrowsExceptionWhenFieldNameMissing() throws IOException { List<String> readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); List<String> writerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); List<String> writerData = new ArrayList<>(Arrays.asList("field_a_value", "field_b_value", "field_c_value")); Type readerType = getTypeNullName(readerFields.size()); Type writerType = getType(writerFields); write(tempFile, writerType, writerData); RowBlock readBlock = read(tempFile, readerType); }

Target:
public void testThrowsExceptionWhenFieldNameMissing() throws IOException { List<String> readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); List<String> writerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c")); List<String> writerData = new ArrayList<>(Arrays.asList("field_a_value", "field_b_value", "field_c_value")); Type readerType = getTypeNullName(readerFields.size()); Type writerType = getType(writerFields); write(tempFile, writerType, writerData); read(tempFile, readerType); }
Source:
public void writeFloat(float v) { int vAsInt = Float.floatToIntBits(v); byte[] bytes = new byte[FLOAT_SIZE_IN_BYTES]; for (int i = 0; i < FLOAT_SIZE_IN_BYTES; ++i) { byte b = (byte) ((vAsInt >> (i * 8)) & 0xFF); bytes[i] = b; } super.scatterBytes(bytes); }

Target:
public void writeFloat(float v) { super.scatterBytes(BytesUtils.intToBytes(Float.floatToIntBits(v))); }
Source:
void syncSSMInitialize() { try { addIfMissing(m_stateMachineMemberPath, CreateMode.PERSISTENT, null); addIfMissing(ZKUtil.joinZKPath(m_stateMachineMemberPath, m_memberId), CreateMode.EPHEMERAL, null); m_groupMembers = ImmutableSet.copyOf(m_zk.getChildren(m_stateMachineMemberPath, m_membershipWatcher)); for (StateMachineInstance instance : m_registeredStateMachines) { instance.syncStateMachineInitialize(m_groupMembers); } } catch (KeeperException.SessionExpiredException e) { m_done.set(true); } catch (KeeperException.ConnectionLossException e) { m_done.set(true); } catch (InterruptedException e) { m_done.set(true); } catch (Exception e) { org.voltdb.VoltDB.crashLocalVoltDB( "Unexpected failure in initializeInstances.", true, e); m_done.set(true); } }

Target:
void syncSSMInitialize() { try { addIfMissing(m_stateMachineMemberPath, CreateMode.PERSISTENT, null); addIfMissing(ZKUtil.joinZKPath(m_stateMachineMemberPath, m_memberId), CreateMode.EPHEMERAL, null); m_groupMembers = ImmutableSet.copyOf(m_zk.getChildren(m_stateMachineMemberPath, m_membershipWatcher)); for (StateMachineInstance instance : m_registeredStateMachines) { instance.syncStateMachineInitialize(m_groupMembers); } } catch (KeeperException.SessionExpiredException | KeeperException.ConnectionLossException e) { m_done.set(true); } catch (InterruptedException e) { m_done.set(true); } catch (Exception e) { org.voltdb.VoltDB.crashLocalVoltDB( "Unexpected failure in initializeInstances.", true, e); } }
Source:
public ASTNode transform(BuiltinSet builtinSet) { boolean changed = false; BuiltinSet.Builder builder = BuiltinSet.builder(); for(Term element : builtinSet.elements()) { Term transformedElement = (Term) element.accept(this); builder.add(transformedElement); changed = changed || (transformedElement != element); } for (KItem kItem : builtinSet.collectionPatterns()) { Term term = (Term) kItem.accept(this); changed = changed || (term != kItem); builder.concatenate(term); } for (Variable variable : builtinSet.collectionVariables()) { Term term = (Term) variable.accept(this); changed = changed || (term != variable); builder.concatenate(term); } for (Term term : builtinSet.collectionFunctions()) { Term transformedTerm = (Term) term.accept(this); changed = changed || (transformedTerm != term); builder.concatenate(transformedTerm); } return changed ? builder.build() : builtinSet; }

Target:
public ASTNode transform(BuiltinSet builtinSet) { boolean changed = false; BuiltinSet.Builder builder = BuiltinSet.builder(); for(Term element : builtinSet.elements()) { Term transformedElement = (Term) element.accept(this); builder.add(transformedElement); changed = changed || (transformedElement != element); } for (Term term : builtinSet.baseTerms()) { Term transformedTerm = (Term) term.accept(this); changed = changed || (transformedTerm != term); builder.concatenate(transformedTerm); } return changed ? builder.build() : builtinSet; }
Source:
public List<Product> resolveProductsByIds(Owner recipientOwner, Collection<String> productIds, boolean includeShares) { Map<String, Product> result = new HashMap<String, Product>(); List<Product> existingProducts; Set<String> missingProducts = new HashSet<String>(); if (productIds != null && !productIds.isEmpty()) { missingProducts.addAll(productIds); existingProducts = ownerProductCurator.getProductsByIds(recipientOwner, productIds).list(); } else { existingProducts = ownerProductCurator.getProductsByOwner(recipientOwner).list(); } for (Product product : existingProducts) { result.put(product.getId(), product); missingProducts.remove(product.getId()); } if (includeShares && CollectionUtils.isNotEmpty(missingProducts)) { List<OwnerProductShare> shares = shareCurator.findProductSharesByRecipient(recipientOwner, true, missingProducts); for (OwnerProductShare share : shares) { if (!result.containsKey(share.getId())) { result.put(share.getId(), share.getProduct()); } } } return new ArrayList<Product>(result.values()); }

Target:
public List<Product> resolveProductsByIds(Owner recipientOwner, Collection<String> productIds, boolean includeShares) { return resolveProducts(recipientOwner, productIds, includeShares); }
Source:
private void leaveBreadcrumb(String activityName, String lifecycleCallback) { Map<String, Object> metadata = new HashMap<>(); metadata.put(KEY_LIFECYCLE_CALLBACK, lifecycleCallback); try { client.leaveBreadcrumb(activityName, BreadcrumbType.NAVIGATION, metadata); } catch (Exception ex) { Logger.warn("Failed to leave breadcrumb in SessionTracker: " + ex.getMessage()); } }

Target:
private void leaveBreadcrumb(String activityName, String lifecycleCallback) { Map<String, Object> metadata = new HashMap<>(); metadata.put(KEY_LIFECYCLE_CALLBACK, lifecycleCallback); try { client.leaveBreadcrumb(activityName, BreadcrumbType.NAVIGATION, metadata); } catch (Exception ex) { logger.w("Failed to leave breadcrumb in SessionTracker: " + ex.getMessage()); } }
Source:
public void onStop(){ try { Dhis2Application.bus.unregister(this); }catch(Exception e){} super.onStop(); }

Target:
public void onStop(){ Dhis2Application.bus.unregister(this); super.onStop(); }
Source:
public int getDeletedByUserId() { return deletedByUserId; }

Target:
public Integer getDeletedByUserId() { return deletedByUserId; }
Source:
public static void changeValueNoncompoundAttribute(WebDriver driver, By context, String simpleName, String value) { WebElement attribuetContainer = findAttributeContainerWebElement(driver, context, simpleName, false); changeValueAttribute(attribuetContainer, simpleName, value); }

Target:
public static void changeValueNoncompoundAttribute(WebDriver driver, By context, String simpleName, String value) { WebElement attributeContainer = findAttributeContainerWebElement(driver, context, simpleName, false); changeValueAttributeTextNumberEmailUrl(attributeContainer, simpleName, value); assertEquals(getValueNoncompoundAttribute(driver, context, simpleName), value); }
Source:
protected Collection<MultiMapRecord> getNewRecordsCollection() { final MultiMapConfig.ValueCollectionType valueCollectionType = config.getValueCollectionType(); return createCollection(valueCollectionType); }

Target:
protected Collection<MultiMapRecord> getNewRecordsCollection() { return createCollection(config.getValueCollectionType()); }
Source:
private void recursiveTar(String entryFilename, String rootPath, String itemPath, TarArchiveOutputStream tarArchive) { try { final File sourceFile = new File(itemPath).getCanonicalFile(); final File sourceRootFile = new File(rootPath).getCanonicalFile(); final String relativePathToSourceFile = sourceRootFile.toPath().relativize(sourceFile.toPath()).toFile().toString(); final String tarEntryFilename; if (relativePathToSourceFile.isEmpty()) { tarEntryFilename = entryFilename; } else { tarEntryFilename = entryFilename + "/" + relativePathToSourceFile; } final TarArchiveEntry tarEntry = new TarArchiveEntry(sourceFile, tarEntryFilename); tarEntry.setMode(getUnixFileMode(itemPath)); tarArchive.putArchiveEntry(tarEntry); if (sourceFile.isFile()) { Files.copy(sourceFile.toPath(), tarArchive); } tarArchive.closeArchiveEntry(); final File[] children = sourceFile.listFiles(); if (children != null) { for (final File child : children) { recursiveTar(entryFilename, sourceRootFile.getCanonicalPath(), child.getCanonicalPath(), tarArchive); } } } catch (IOException e) { log.error("Error when copying TAR file entry: {}", itemPath, e); throw new UncheckedIOException(e); } }

Target:
private void recursiveTar(String entryFilename, String rootPath, String itemPath, TarArchiveOutputStream tarArchive) { try { final File sourceFile = new File(itemPath).getCanonicalFile(); final File sourceRootFile = new File(rootPath).getCanonicalFile(); final String relativePathToSourceFile = sourceRootFile.toPath().relativize(sourceFile.toPath()).toFile().toString(); final String tarEntryFilename; if (relativePathToSourceFile.isEmpty()) { tarEntryFilename = entryFilename; } else { tarEntryFilename = entryFilename + "/" + relativePathToSourceFile; } final TarArchiveEntry tarEntry = new TarArchiveEntry(sourceFile, tarEntryFilename.replaceAll("^/", "")); tarEntry.setMode(getUnixFileMode(itemPath)); tarArchive.putArchiveEntry(tarEntry); if (sourceFile.isFile()) { Files.copy(sourceFile.toPath(), tarArchive); } tarArchive.closeArchiveEntry(); final File[] children = sourceFile.listFiles(); if (children != null) { for (final File child : children) { recursiveTar(entryFilename, sourceRootFile.getCanonicalPath(), child.getCanonicalPath(), tarArchive); } } } catch (IOException e) { log.error("Error when copying TAR file entry: {}", itemPath, e); throw new UncheckedIOException(e); } }
Source:
private void handleMultiFetchReply(TransferWrap response, DelegationIOConnection from) { MultiFetchReply multiFetchReply = (MultiFetchReply)response.unwrap(); List<String> partitions = multiFetchReply.getPartitionList(); List<MessageSet> messageSets = multiFetchReply.getMessagesList(); List<Long> offsets = multiFetchReply.getOffsetList(); for (int i = 0; i < partitions.size(); i++) { PartitionTopicInfo info = partitionMap.get(partitions.get(i)); long offset = offsets.get(i); if (offset == MessageAndOffset.OFFSET_OUT_OF_RANGE) { partitionBlockMap.put(info, true); senOffsetRequest(from, info); } else { try { info.enqueue((ByteBufferMessageSet)messageSets.get(i), info.getFetchedOffset()); } catch (InterruptedException e) { LOG.error("Oops, catch an Interrupted Exception of queue.put()," + " but ignore it.", e); } catch (RuntimeException e) { throw e; } } } if (!needBlocking()) { sendMultiFetchRequest(from); } }

Target:
private void handleMultiFetchReply(TransferWrap response, DelegationIOConnection from) { MultiFetchReply multiFetchReply = (MultiFetchReply)response.unwrap(); List<String> partitions = multiFetchReply.getPartitionList(); List<MessageSet> messageSets = multiFetchReply.getMessagesList(); List<Long> offsets = multiFetchReply.getOffsetList(); for (int i = 0; i < partitions.size(); i++) { PartitionTopicInfo info = partitionMap.get(partitions.get(i)); long offset = offsets.get(i); if (offset == MessageAndOffset.OFFSET_OUT_OF_RANGE) { partitionBlockMap.put(info, true); sendOffsetRequest(from, info); } else { try { info.enqueue((ByteBufferMessageSet)messageSets.get(i), info.getFetchedOffset()); } catch (InterruptedException e) { LOG.error("Oops, catch an Interrupted Exception of queue.put()," + " but ignore it.", e); } catch (RuntimeException e) { throw e; } } } if (!needBlocking()) { sendMultiFetchRequest(from); } }
Source:
private void refreshMinTrackDurationInSeconds() { final int minTrackDurationInSeconds = WAILSettings.getMinTrackDurationInSeconds(getActivity()); minDurationInSecondsDescription.setText( getString( R.string.settings_min_track_elapsed_time_in_seconds_desc, minTrackDurationInSeconds ) ); }

Target:
private void refreshMinTrackDurationInSeconds() { final int minTrackDurationInSeconds = WAILSettings.getMinTrackDurationInSeconds(getActivity()); minDurationInSecondsDescription.setText( getString( R.string.settings_min_track_elapsed_time_in_seconds_desc, minTrackDurationInSeconds + " " + WordFormUtil.getWordForm(minTrackDurationInSeconds, getResources().getStringArray(R.array.word_forms_second)) ) ); }
Source:
public static double readDouble(DataInput in) throws IOException { return Double.longBitsToDouble(in.readLong()); }

Target:
public static double readDouble(DataInput in) throws IOException { return in.readDouble(); }
Source:
public void onWriteFailure( BoltServerAddress address ) { routingTable.removeWriter( address ); }

Target:
public void onWriteFailure( BoltServerAddress address ) { routingTable.forgetWriter( address ); }
Source:
public void onEventMainThread(@NonNull MoveToDiscoveryTabEvent event) { if (!ConfigUtil.Companion.isCourseDiscoveryEnabled(environment)) { return; } if (binding != null) { binding.viewPager2.setCurrentItem(binding.viewPager2.getAdapter().getItemCount() - 1, true); if (event.getScreenName() != null) { EventBus.getDefault().post(ScreenArgumentsEvent.Companion.getNewInstance(event.getScreenName())); } } }

Target:
public void onEventMainThread(@NonNull MoveToDiscoveryTabEvent event) { if (!ConfigUtil.Companion.isCourseDiscoveryEnabled(environment)) { return; } if (binding != null) { binding.viewPager2.setCurrentItem(binding.viewPager2.getAdapter().getItemCount() - 1); if (event.getScreenName() != null) { EventBus.getDefault().post(ScreenArgumentsEvent.Companion.getNewInstance(event.getScreenName())); } } }
Source:
public String resolve(String variable, String defaultValue) { IVariableResolver delegate = new ExpressionResolver.SystemPropertiesVariableResolver(); String result = delegate.resolve(variable, null); if (result == null) { try { result = propertiesProvider.getValue(variable, defaultValue, new NullProgressMonitor()); } catch (CoreException e) { throw new ExpressionResolutionException(e); } } return result; }

Target:
public String resolve(String variable, String defaultValue) { IVariableResolver delegate = new ExpressionResolver.SystemPropertiesVariableResolver(); String result = delegate.resolve(variable, null); if (result == null) { result = propertiesProvider.getValue(variable, defaultValue); } return result; }
Source:
private boolean canPullItem(EntityItem item) { if(item.isDead || item.pickupDelay <= 40 || SubTileSolegnolia.hasSolegnoliaAround(item)) return false; ItemStack stack = item.getItem(); if(stack.isEmpty() || stack.getItem() instanceof IManaItem || stack.getItem() instanceof IRelic || BLACKLIST.contains(Item.REGISTRY.getNameForObject(stack.getItem())) || BotaniaAPI.isItemBlacklistedFromMagnet(stack)) return false; BlockPos pos = new BlockPos(item); if(BotaniaAPI.isBlockBlacklistedFromMagnet(item.world.getBlockState(pos))) return false; if(BotaniaAPI.isBlockBlacklistedFromMagnet(item.world.getBlockState(pos.down()))) return false; return true; }

Target:
private boolean canPullItem(EntityItem item) { if(item.isDead || item.pickupDelay >= 40 || SubTileSolegnolia.hasSolegnoliaAround(item)) return false; ItemStack stack = item.getItem(); if(stack.isEmpty() || stack.getItem() instanceof IManaItem || stack.getItem() instanceof IRelic || BLACKLIST.contains(Item.REGISTRY.getNameForObject(stack.getItem())) || BotaniaAPI.isItemBlacklistedFromMagnet(stack)) return false; BlockPos pos = new BlockPos(item); if(BotaniaAPI.isBlockBlacklistedFromMagnet(item.world.getBlockState(pos))) return false; if(BotaniaAPI.isBlockBlacklistedFromMagnet(item.world.getBlockState(pos.down()))) return false; return true; }
Source:
private void storagePoolType_SelectedItemChanged() { AsyncDataProvider.getInstance().getDataCenterVersions(new AsyncQuery<>(versions -> { Version selectedVersion = null; if (getVersion().getSelectedItem() != null) { selectedVersion = getVersion().getSelectedItem(); boolean hasSelectedVersion = false; for (Version version : versions) { if (selectedVersion.equals(version)) { selectedVersion = version; hasSelectedVersion = true; break; } } if (!hasSelectedVersion) { selectedVersion = null; } } if (getIsEdit()) { final Version maxVersion = versions.stream().max(Comparator.naturalOrder()).get(); if ( getEntity() != null ) { final Version compatibilityVersion = getEntity().getCompatibilityVersion(); List<Version> filteredVersions = versions.stream().filter(version -> version.compareTo(compatibilityVersion) >= 0).collect(Collectors.toList()); getVersion().setItems(filteredVersions); } } else { getVersion().setItems(versions); } if (selectedVersion == null) { getVersion().setSelectedItem(versions.stream().max(Comparator.naturalOrder()).orElse(null)); if (getEntity() != null) { initVersion(); } } else { getVersion().setSelectedItem(selectedVersion); } }), getDataCenterId()); }

Target:
private void storagePoolType_SelectedItemChanged() { AsyncDataProvider.getInstance().getDataCenterVersions(new AsyncQuery<>(versions -> { Version selectedVersion = null; if (getVersion().getSelectedItem() != null) { selectedVersion = getVersion().getSelectedItem(); boolean hasSelectedVersion = false; for (Version version : versions) { if (selectedVersion.equals(version)) { selectedVersion = version; hasSelectedVersion = true; break; } } if (!hasSelectedVersion) { selectedVersion = null; } } if (getIsEdit() && getEntity() != null) { final Version compatibilityVersion = getEntity().getCompatibilityVersion(); List<Version> filteredVersions = versions.stream().filter(version -> version.compareTo(compatibilityVersion) >= 0).collect(Collectors.toList()); getVersion().setItems(filteredVersions); } else { getVersion().setItems(versions); } if (selectedVersion == null) { getVersion().setSelectedItem(versions.stream().max(Comparator.naturalOrder()).orElse(null)); if (getEntity() != null) { initVersion(); } } else { getVersion().setSelectedItem(selectedVersion); } }), getDataCenterId()); }
Source:
public AtomClientServiceImpl(FeedRecordDataService feedRecordDataService, EventRelay eventRelay, AtomClientConfigService configService, MotechSchedulerService motechSchedulerService) { feedFetcher = new HttpURLFeedFetcher(new FeedCache(feedRecordDataService, eventRelay, configService)); feedFetcher.setAllowDoctypes(true); this.configService = configService; this.motechSchedulerService = motechSchedulerService; this.feedRecordDataService = feedRecordDataService; }

Target:
public AtomClientServiceImpl(FeedRecordDataService feedRecordDataService, EventRelay eventRelay, AtomClientConfigService configService, MotechSchedulerService motechSchedulerService) { feedFetcher = new HttpURLFeedFetcher(new FeedCache(feedRecordDataService, eventRelay, configService)); this.configService = configService; this.motechSchedulerService = motechSchedulerService; this.feedRecordDataService = feedRecordDataService; }
Source:
public TestResult getResultByRunAndNodes(@Nonnull String runId, @Nonnull List<String> nodeIds) { TestResult result = new TestResult(); if (suitesByRunAndNode.containsKey(runId)) { for (String n : nodeIds) { List<SuiteResult> suites = suitesByRunAndNode.get(runId).get(n); if (suites != null) { for (SuiteResult s : suites) { s.setParent(null); result.add(s); } } } } result.tally(); return result; }

Target:
public TestResult getResultByRunAndNodes(@Nonnull String runId, @Nonnull List<String> nodeIds) { TestResult result = new TestResult(); if (suitesByRunAndNode.containsKey(runId)) { for (String n : nodeIds) { List<SuiteResult> suites = suitesByRunAndNode.get(runId).get(n); if (suites != null) { for (SuiteResult s : suites) { result.add(s); } } } } result.setParentAction(parentAction); return result; }
Source:
public void lockDiskStore(String diskStoreName) { CountDownLatch countDownLatch = diskStoreLatches.get(diskStoreName); if (countDownLatch == null) { countDownLatch = diskStoreLatches.putIfAbsent(diskStoreName, new CountDownLatch(1)); if (countDownLatch != null) { try { countDownLatch.await(); } catch (InterruptedException e) { throw new InternalGemFireError(e); } } } else { try { countDownLatch.await(); } catch (InterruptedException e) { throw new InternalGemFireError(e); } } }

Target:
public void lockDiskStore(String diskStoreName) { doLockDiskStore(diskStoreName); }
Source:
private boolean isSchemaChangeQuery(String sql) { String q = sql.toLowerCase().trim(); q = q.replaceAll(" {2,}", " "); return (q.startsWith("alter table") || q.startsWith("alter ignore table") || q.startsWith("drop table")); }

Target:
private static boolean isSchemaChangeQuery(String sql) { String q = sql.toLowerCase().trim(); q = q.replaceAll(" {2,}", " "); return (q.startsWith("alter table") || q.startsWith("alter ignore table") || q.startsWith("drop table")); }
Source:
public ByteBuffer getBinaryValue() throws IllegalStateException { if (mode == Mode.DETACHED) { return binaryValue.duplicate(); } else { throw new IllegalStateException("This OffHeapValueHolder has not been prepared to hand off its binary form"); } }

Target:
public ByteBuffer getBinaryValue() throws IllegalStateException { if (isBinaryValueAvailable()) { return binaryValue.duplicate(); } else { throw new IllegalStateException("This OffHeapValueHolder has not been prepared to hand off its binary form"); } }
Source:
public boolean equals(Object o) { if(o instanceof java.lang.Iterable) { java.lang.Iterable<?> iterable = (java.lang.Iterable<?>) o; Objects.requireNonNull(iterable, "iterable is null"); java.util.Iterator<?> that = iterable.iterator(); while (this.hasNext() && that.hasNext()) { if (!Objects.equals(this.next(), that.next())) { return false; } } return this.hasNext() == that.hasNext(); } else { return false; } }

Target:
public boolean equals(Object o) { if(o instanceof Iterator) { final Iterator<?> that = (Iterator<?>) o; while (this.hasNext() && that.hasNext()) { if (!Objects.equals(this.next(), that.next())) { return false; } } return this.hasNext() == that.hasNext(); } else { return false; } }
Source:
protected Insults doInsultRequest(Map<String, String> messageMap, SsmlDocumentBuilder builder, QuipMetadata metadata) { Deque<String> insultsUsed = metadata.getInsultsUsed(); LOG.debug("Recently used insults in user session:\n"+insultsUsed.toString()); int maxQuipHistorySize = determineMaxQuipHistorySize(Insults.values().length); Insults insult = Insults.getRandomInsult(); while(insultsUsed.contains(insult.name())){ insult = Insults.getRandomInsult(); } insultsUsed.add(insult.name()); while(insultsUsed.size() > maxQuipHistorySize){ insultsUsed.pop(); } LOG.debug("Insult being used ("+insult.name()+"): "+insult.getInsult()); builder.text(insult.getInsult()); return insult; }

Target:
protected Insults doInsultRequest(Map<String, String> messageMap, SsmlDocumentBuilder builder, QuipMetadata metadata) { Queue<String> insultsUsed = metadata.getInsultsUsed(); LOG.debug("Recently used insults in user session:\n"+insultsUsed.toString()); int maxQuipHistorySize = determineMaxQuipHistorySize(Insults.values().length); Insults insult = Insults.getRandomInsult(); while(insultsUsed.contains(insult.name())){ insult = Insults.getRandomInsult(); } insultsUsed.add(insult.name()); while(insultsUsed.size() > maxQuipHistorySize){ insultsUsed.remove(); } LOG.debug("Insult being used ("+insult.name()+"): "+insult.getInsult()); builder.text(insult.getInsult()); return insult; }
Source:
private void wipeStorageForFourTwelveSync(SQLiteDatabase userDb) { userDb.beginTransaction(); SqlStorage.wipeTableWithoutCommit(userDb, ACase.STORAGE_KEY); SqlStorage.wipeTableWithoutCommit(userDb, Ledger.STORAGE_KEY); SqlStorage.wipeTableWithoutCommit(userDb, AndroidCaseIndexTable.TABLE_NAME); SqlStorage.wipeTableWithoutCommit(userDb, EntityStorageCache.TABLE_NAME); EntityStorageCache.setCachedWipedPref(); }

Target:
private void wipeStorageForFourTwelveSync(SQLiteDatabase userDb) { SqlStorage.wipeTableWithoutCommit(userDb, ACase.STORAGE_KEY); SqlStorage.wipeTableWithoutCommit(userDb, Ledger.STORAGE_KEY); SqlStorage.wipeTableWithoutCommit(userDb, AndroidCaseIndexTable.TABLE_NAME); EntityStorageCache.wipeCacheForCurrentAppWithoutCommit(userDb); }
Source:
public static int[] cellsAsColumnIndices(Set<Cell> cells, int cellsPerColumn) { return cells.stream().mapToInt(c -> c.getColumn().getIndex()) .sorted().distinct().toArray(); }

Target:
public static int[] cellsAsColumnIndices(Set<Cell> cells, int cellsPerColumn) { return SDR.asColumnList(cells); }
Source:
public boolean isSecure() { return secureMode != SecurityMode.NO_SEC || useOscore == true; }

Target:
public boolean isSecure() { return secureMode != SecurityMode.NO_SEC; }
Source:
protected DiagramEventBroker getDiagramEventBroker() { TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); if (theEditingDomain != null) { return DiagramEventBroker.getInstance(theEditingDomain); } return null; }

Target:
protected DiagramEventBroker getDiagramEventBroker() { DiagramEventBroker eventBroker = null; TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); if (null != editingDomain) { eventBroker = DiagramEventBroker.getInstance(editingDomain); } return eventBroker; }
Source:
Set<SpecificHaxeClassReference> getCompatibleTypes(Compatibility direction) { HaxeClassModel model = getHaxeClassModel(); boolean skipCachingForDebug = HaxeDebugUtil.isCachingDisabled(); if(false) { Set<SpecificHaxeClassReference> result = context.getUserData(COMPATIBLE_TYPES_KEY); if (result == null) { processedElements.get().clear(); result = getCompatibleTypesInternal(direction); result.add(this); context.putUserData(COMPATIBLE_TYPES_KEY, result); } return result; } else { processedElements.get().clear(); Set<SpecificHaxeClassReference>result = getCompatibleTypesInternal(direction); result.add(this); return result; } }

Target:
Set<SpecificHaxeClassReference> getCompatibleTypes(Compatibility direction) { HaxeClassModel model = getHaxeClassModel(); boolean skipCachingForDebug = HaxeDebugUtil.isCachingDisabled(); if (!skipCachingForDebug && (null == model || !model.hasGenericParams())) { Set<SpecificHaxeClassReference> result = context.getUserData(COMPATIBLE_TYPES_KEY); if (result == null) { processedElements.get().clear(); result = getCompatibleTypesInternal(direction); result.add(this); context.putUserData(COMPATIBLE_TYPES_KEY, result); } return result; } else { processedElements.get().clear(); Set<SpecificHaxeClassReference>result = getCompatibleTypesInternal(direction); result.add(this); return result; } }
Source:
public void doSomething() throws WqpException { try { int div = 1/ 0; if (div == 0) return; } catch (Exception e) { throw new WqpException(WqpExceptionId.URL_PARSING_EXCEPTION, Klass.class, "doSomething", "div by zero"); } }

Target:
public void doSomething() throws WqpException { try { int div = 1/ 0; } catch (Exception e) { throw new WqpException(WqpExceptionId.URL_PARSING_EXCEPTION, Klass.class, "doSomething", "div by zero"); } }
Source:
public void start() { bootstrap = new ClientBootstrap( new NioClientSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool()) ); bootstrap.setPipelineFactory(new TimberClientPipelineFactory(this, bootstrap)); bootstrap.setOption("tcpNoDelay", true); bootstrap.setOption("remoteAddress", new InetSocketAddress(host, port)); log.info("Client connecting to " + host + ":" + port + "..."); ChannelFuture connectFuture = bootstrap.connect().awaitUninterruptibly(); log.info("Client connected to " + host + ":" + port); }

Target:
public void start() { bootstrap = new ClientBootstrap( new NioClientSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool()) ); bootstrap.setPipelineFactory(new TimberClientPipelineFactory(this, bootstrap)); bootstrap.setOption("tcpNoDelay", true); bootstrap.setOption("remoteAddress", new InetSocketAddress(host, port)); log.info("Client connecting to " + host + ":" + port + "..."); bootstrap.connect().awaitUninterruptibly(); }
Source:
public void update(boolean force) { final List<MToolBar> children = modelService.findElements(window, null, MToolBar.class, null); for (MToolBar el : children) { ToolBarManagerRenderer renderer = (ToolBarManagerRenderer) rendererFactory.getRenderer( el, null); final ToolBarManager manager = renderer.getManager((MToolBar) el); if (manager != null) { fill(el, manager); manager.update(true); ToolBar tb = manager.getControl(); if (tb != null && !tb.isDisposed()) { tb.getShell().layout(new Control[] { tb }, SWT.DEFER); } } } if (!trimBarsAdded) { topTrim.setToBeRendered(true); trimBarsAdded = true; } }

Target:
public void update(boolean force) { final List<MToolBar> children = modelService.findElements(window, null, MToolBar.class, null); for (MToolBar el : children) { ToolBarManagerRenderer renderer = (ToolBarManagerRenderer) rendererFactory.getRenderer( el, null); final ToolBarManager manager = renderer.getManager((MToolBar) el); if (manager != null) { fill(el, manager); ToolBar tb = manager.getControl(); if (tb != null && !tb.isDisposed()) { tb.getShell().layout(new Control[] { tb }, SWT.DEFER); } } } if (!trimBarsAdded) { topTrim.setToBeRendered(true); trimBarsAdded = true; } }
Source:
private boolean isDistinct(AggregationNode node) { return !node.getAssignments().isEmpty() || node.getOutputSymbols().size() != node.getGroupingKeys().size() || !node.getOutputSymbols().containsAll(node.getGroupingKeys()); }

Target:
private boolean isDistinct(AggregationNode node) { return !node.getAggregations().isEmpty() || node.getOutputSymbols().size() != node.getGroupingKeys().size() || !node.getOutputSymbols().containsAll(node.getGroupingKeys()); }
Source:
FacadeObjectImpl.BasicFacadeAdapter<? extends FacadeObjectImpl> createAdapter(T element) { FacadeObjectImpl.BasicFacadeAdapter<? extends FacadeObjectImpl> result = null; FacadeObject facade = null; if (stereotype == NO_STEREOTYPE) { facade = facadeFactory.apply(element); if (facade != null && facade instanceof FacadeObjectImpl) { result = ((FacadeObjectImpl) facade).createFacadeAdapter(); result.addAdapter(element); ((FacadeObjectImpl) facade).init(element, null); } } else { S application = getStereotypeApplication(element); if (application != null) { facade = facadeFactory.apply(element); if (facade != null && facade instanceof FacadeObjectImpl) { result = ((FacadeObjectImpl) facade).createFacadeAdapter(); result.addAdapter(element); ((FacadeObjectImpl) facade).init(element, application); } } } return result; }

Target:
FacadeObjectImpl.BasicFacadeAdapter<? extends FacadeObjectImpl> createAdapter(T element) { FacadeObjectImpl.BasicFacadeAdapter<? extends FacadeObjectImpl> result = null; FacadeObjectImpl facade = null; if (stereotype == NO_STEREOTYPE) { facade = (FacadeObjectImpl) (facadeFactory.apply(element)); if (facade != null) { result = facade.createFacadeAdapter(); result.addAdapter(element); facade.init(element, null); } } else { S application = getStereotypeApplication(element); if (application != null) { facade = (FacadeObjectImpl) facadeFactory.apply(element); if (facade != null) { result = facade.createFacadeAdapter(); result.addAdapter(element); facade.init(element, application); } } } return result; }
Source:
public void addContent(HttpContent httpContent) throws RestServiceException { if (!isOpen()) { nettyMetrics.multipartRequestAlreadyClosedError.inc(); throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } else { rawRequestContents.add(httpContent); ReferenceCountUtil.retain(httpContent); } }

Target:
public void addContent(HttpContent httpContent) throws RestServiceException { if (!isOpen()) { nettyMetrics.multipartRequestAlreadyClosedError.inc(); throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } else { rawRequestContents.add(ReferenceCountUtil.retain(httpContent)); } }
Source:
@Test public void connectViaHttpsToUntrustedServer() throws Exception { jdkMatchRule.expectFailure(platform.platformMatcher(PlatformRule.CONSCRYPT_PROPERTY), anything()); server.useHttps(handshakeCertificates.sslSocketFactory(), false); server.enqueue(new MockResponse()); try { getResponse(newRequest("/foo")); fail(); } catch (SSLHandshakeException expected) { assertThat(expected.getCause()).isInstanceOf(CertificateException.class); } assertThat(server.getRequestCount()).isEqualTo(0); }

Target:
@Test public void connectViaHttpsToUntrustedServer() throws Exception { platform.expectFailureOnConscryptPlatform(); server.useHttps(handshakeCertificates.sslSocketFactory(), false); server.enqueue(new MockResponse()); try { getResponse(newRequest("/foo")); fail(); } catch (SSLHandshakeException expected) { assertThat(expected.getCause()).isInstanceOf(CertificateException.class); } assertThat(server.getRequestCount()).isEqualTo(0); }
Source:
public static List<Filter> toFilters(List<DimFilter> dimFilters) { return ImmutableList.copyOf( FunctionalIterable .create(dimFilters) .filter( new Predicate<DimFilter>() { @Override public boolean apply(DimFilter input) { return input != null; } } ).transform( new Function<DimFilter, Filter>() { @Override public Filter apply(DimFilter input) { return input.toFilter(); } } ) ); }

Target:
public static List<Filter> toFilters(List<DimFilter> dimFilters) { return ImmutableList.copyOf( FunctionalIterable .create(dimFilters) .transform( new Function<DimFilter, Filter>() { @Override public Filter apply(DimFilter input) { return input.toFilter(); } } ) ); }