auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testOsgiServiceProxy() throws Exception { ConnectorProvider proxy = getServiceUtils().getOsgiServiceProxy( getServiceUtils().makeFilter(ConnectorProvider.class, "(connector=example)"), ConnectorProvider.class); assertThat(proxy.getId(), is("example")); }

Target:
public void testOsgiServiceProxy() throws Exception { ConnectorProvider proxy = getServiceUtils().getOsgiServiceProxy( getServiceUtils().makeFilter(ConnectorProvider.class, String.format("(%s=example)", org.openengsb.core.api.Constants.CONNECTOR_KEY)), ConnectorProvider.class); assertThat(proxy.getId(), is("example")); }
Source:
private void processVmJobs(Guid vmId, List<VmJob> jobs, List<VmJob> jobsToUpdate, List<Guid> jobIdsToRemove) { if (jobs == null) { log.debug("No vmJob data returned from VDSM, preserving existing jobs"); return; } Map<Guid, VmJob> jobIdToReportedJob = jobs.stream().collect(toMap(VmJob::getId, identity())); getExistingJobsForVm(vmId).forEach(job -> { VmJob reportedJob = jobIdToReportedJob.get(job.getId()); if (reportedJob != null) { if (reportedJob.equals(job)) { log.info("VM job '{}': In progress (no change)", job.getId()); } else { jobsToUpdate.add(reportedJob); log.info("VM job '{}': In progress, updating", job.getId()); } } else if (!job.isMonitored()) { log.info("VM job is not monitored", job.getId()); processNotMonitoredVmJobs(jobs, job, jobIdsToRemove); } else { jobIdsToRemove.add(job.getId()); log.info("VM job '{}': Deleting", job.getId()); } }); }

Target:
private void processVmJobs(Guid vmId, List<VmJob> jobs, List<VmJob> jobsToUpdate, List<Guid> jobIdsToRemove) { if (jobs == null) { log.debug("No vmJob data returned from VDSM, preserving existing jobs"); return; } Map<Guid, VmJob> jobIdToReportedJob = jobs.stream().collect(toMap(VmJob::getId, identity())); Map<VmJobKey, VmJob> jobKeyToReportedJob = jobs.stream().collect(toMap(VmJob::getKey, identity())); getExistingJobsForVm(vmId).forEach(job -> { VmJob reportedJob = jobIdToReportedJob.get(job.getId()); if (reportedJob != null) { if (reportedJob.equals(job)) { log.info("VM job '{}': In progress (no change)", job.getId()); } else { jobsToUpdate.add(reportedJob); log.info("VM job '{}': In progress, updating", job.getId()); } } else if (!job.isMonitored() && jobKeyToReportedJob.get(job.getKey()) != null) { log.info("VM job is not monitored", job.getId()); processNotMonitoredVmJob(jobKeyToReportedJob.get(job.getKey()), job, jobIdsToRemove); } else { jobIdsToRemove.add(job.getId()); log.info("VM job '{}': Deleting", job.getId()); } }); }
Source:
private void testGeneralQuestionOperations() throws Exception { testCancelAddingNewQuestion(); testCancelEditQuestion(); testNewQuestionLink(); testInputValidationForQuestion(); testAddQuestionAction(); testEditQuestionLink(); testEditQuestionAction(); testDuplicateQuestionAction(); testCopyQuestion(); testChangeFeedbackGiver(); testChangeFeedbackRecipient(); testVisibilityOptionsCorrespondToFeedbackPath(); testVisibilityOptionsUncheckedWhenHidden(); testEditQuestionNumberAction(); testAjaxOnVisibilityMessageButton(); testDeleteQuestionAction(2); testEditWithEmptyQuestionTextThenDeleteQuestionAction(1); testEditWithInvalidNumericalTextThenDeleteQuestionAction(); testEditNonExistentQuestion(); testResponseRate(); testAddTemplateQuestionLink(); testAddTemplateQuestionAction(); }

Target:
private void testGeneralQuestionOperations() throws Exception { testCancelAddingNewQuestion(); testCancelEditQuestion(); testNewQuestionLink(); testInputValidationForQuestion(); testAddQuestionAction(); testEditQuestionLink(); testEditQuestionAction(); testDuplicateQuestionAction(); testCopyQuestion(); testChangeFeedbackGiver(); testChangeFeedbackRecipient(); testVisibilityOptionsCorrespondToFeedbackPath(); testVisibilityOptionsUncheckedWhenHidden(); testEditQuestionNumberAction(); testAjaxOnVisibilityMessageButton(); testDeleteQuestionAction(2); testEditWithEmptyQuestionTextThenDeleteQuestionAction(1); testEditWithInvalidNumericalTextThenDeleteQuestionAction(); testEditNonExistentQuestion(); testResponseRate(); }
Source:
public void defaultParser() { assertEquals(spp.getKeyValuePairSeparators(), "&"); assertEquals(spp.getKeyValueSeparators(), "="); assertEquals(spp.getStructuralParameters().size(), 0); List<NameValuePair> res = spp.parseParameters("a=b&b=c&d=f&d=g"); assertEquals(res.size(), 4); assertEquals(res.get(0).getName(), "a"); assertEquals(res.get(0).getValue(), "b"); assertEquals(res.get(1).getName(), "b"); assertEquals(res.get(1).getValue(), "c"); assertEquals(res.get(2).getName(), "d"); assertEquals(res.get(2).getValue(), "f"); assertEquals(res.get(3).getName(), "d"); assertEquals(res.get(3).getValue(), "g"); }

Target:
public void defaultParser() { assertEquals(spp.getKeyValuePairSeparators(), "&"); assertEquals(spp.getKeyValueSeparators(), "="); assertEquals(spp.getStructuralParameters().size(), 0); @SuppressWarnings("deprecation") Map<String, String> res = spp.parse("a=b&b=c&d=f"); assertEquals(res.size(), 3); assertEquals(res.get("a"), "b"); assertEquals(res.get("b"), "c"); assertEquals(res.get("d"), "f"); List<NameValuePair> res2 = spp.parseParameters("a=b&b=c&d=f&d=g"); assertEquals(res2.size(), 4); assertEquals(res2.get(0).getName(), "a"); assertEquals(res2.get(0).getValue(), "b"); assertEquals(res2.get(1).getName(), "b"); assertEquals(res2.get(1).getValue(), "c"); assertEquals(res2.get(2).getName(), "d"); assertEquals(res2.get(2).getValue(), "f"); assertEquals(res2.get(3).getName(), "d"); assertEquals(res2.get(3).getValue(), "g"); }
Source:
private PojoUtils.Setter generateSettersForField(Class<?> klass, String outputFieldName) throws NoSuchFieldException, SecurityException { Field f = outputClass.getDeclaredField(outputFieldName); Class c = ClassUtils.primitiveToWrapper(f.getType()); PojoUtils.Setter classSetter = PojoUtils.createSetter(klass, outputFieldName, c); return classSetter; }

Target:
private PojoUtils.Setter generateSettersForField(Class<?> klass, String outputFieldName) throws NoSuchFieldException, SecurityException { Field f = klass.getDeclaredField(outputFieldName); Class c = ClassUtils.primitiveToWrapper(f.getType()); return PojoUtils.createSetter(klass, outputFieldName, c); }
Source:
public void start(Map<String, String> props) { try { HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); boolean hiveIntegration = connectorConfig.getBoolean(HdfsSinkConnectorConfig.HIVE_INTEGRATION_CONFIG); if (hiveIntegration) { Compatibility compatibility = SchemaUtils.getCompatibility( connectorConfig.getString(HdfsSinkConnectorConfig.SCHEMA_COMPATIBILITY_CONFIG)); if (compatibility == Compatibility.NONE) { throw new ConfigException("Hive Integration requires schema compatibility to be BACKWARD, FORWARD or FULL"); } } boolean secureHadoop = connectorConfig.getBoolean(HdfsSinkConnectorConfig.SECURE_HADOOP_CONFIG); if (secureHadoop) { String principal = connectorConfig.getString(HdfsSinkConnectorConfig.HDFS_CONNECTOR_PRINCIPAL_CONFIG); String keytab = connectorConfig.getString(HdfsSinkConnectorConfig.HDFS_CONNECTOR_KEYTAB_CONFIG); UserGroupInformation ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(principal, keytab); log.info("Login as: " + ugi.getUserName()); } int schemaCacheSize = connectorConfig.getInt(HdfsSinkConnectorConfig.SCHEMA_CACHE_SIZE_CONFIG); avroData = new AvroData(schemaCacheSize); hdfsWriter = new DataWriter(connectorConfig, context, avroData); Set<TopicPartition> assignment = context.assignment(); recover(assignment); if (hiveIntegration) { syncWithHive(); } } catch (ConfigException e) { throw new ConnectException("Couldn't start HdfsSinkConnector due to configuration error.", e); } catch (ConnectException | IOException e) { log.info("Couldn't start HdfsSinkConnector:", e); log.info("Shutting down HdfsSinkConnector."); if (hdfsWriter != null) { hdfsWriter.close(); } } }

Target:
public void start(Map<String, String> props) { try { HdfsSinkConnectorConfig connectorConfig = new HdfsSinkConnectorConfig(props); boolean hiveIntegration = connectorConfig.getBoolean(HdfsSinkConnectorConfig.HIVE_INTEGRATION_CONFIG); if (hiveIntegration) { Compatibility compatibility = SchemaUtils.getCompatibility( connectorConfig.getString(HdfsSinkConnectorConfig.SCHEMA_COMPATIBILITY_CONFIG)); if (compatibility == Compatibility.NONE) { throw new ConfigException("Hive Integration requires schema compatibility to be BACKWARD, FORWARD or FULL"); } } int schemaCacheSize = connectorConfig.getInt(HdfsSinkConnectorConfig.SCHEMA_CACHE_SIZE_CONFIG); avroData = new AvroData(schemaCacheSize); hdfsWriter = new DataWriter(connectorConfig, context, avroData); Set<TopicPartition> assignment = context.assignment(); recover(assignment); if (hiveIntegration) { syncWithHive(); } } catch (ConfigException e) { throw new ConnectException("Couldn't start HdfsSinkConnector due to configuration error.", e); } catch (ConnectException e) { log.info("Couldn't start HdfsSinkConnector:", e); log.info("Shutting down HdfsSinkConnector."); if (hdfsWriter != null) { hdfsWriter.close(); } } }
Source:
public void initialize(ConstraintDescriptor<ParameterScriptAssert> constraintDescriptor, HibernateConstraintValidatorInitializationContext initializationContext) { ParameterScriptAssert constraintAnnotation = constraintDescriptor.getAnnotation(); validateParameters( constraintAnnotation ); this.languageName = constraintAnnotation.lang(); this.script = constraintAnnotation.script(); this.escapedScript = InterpolationHelper.escapeMessageParameter( constraintAnnotation.script() ); initializeScriptContext( initializationContext ); }

Target:
public void initialize(ConstraintDescriptor<ParameterScriptAssert> constraintDescriptor, HibernateConstraintValidatorInitializationContext initializationContext) { ParameterScriptAssert constraintAnnotation = constraintDescriptor.getAnnotation(); validateParameters( constraintAnnotation ); initialize( constraintAnnotation.lang(), constraintAnnotation.script(), initializationContext ); }
Source:
public Ample.TabletMutator putTime(String time) { Preconditions.checkState(updatesEnabled, "Cannot make updates after calling mutate."); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mutation, new Value(time.getBytes())); return this; }

Target:
public Ample.TabletMutator putTime(String time) { Preconditions.checkState(updatesEnabled, "Cannot make updates after calling mutate."); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mutation, new Value(time)); return this; }
Source:
public void testRemoveSecurityGroup() { HttpRequest delete = HttpRequest.builder().method("DELETE").endpoint( URI.create("<LINK_0>")) .headers( ImmutableMultimap.<String, String>builder().put("Accept", "application/json") .put("X-Auth-Token", authToken).build()).build(); HttpResponse deleteResponse = HttpResponse.builder().statusCode(202).build(); HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_details_extension.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse); requestResponseMap.put(delete, deleteResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); assertTrue(extension.removeSecurityGroup(zone + "/160")); }

Target:
public void testRemoveSecurityGroup() { HttpRequest delete = HttpRequest.builder().method("DELETE").endpoint( URI.create("<LINK_0>")) .headers( ImmutableMultimap.<String, String>builder().put("Accept", "application/json") .put("X-Auth-Token", authToken).build()).build(); HttpResponse deleteResponse = HttpResponse.builder().statusCode(202).build(); HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_details_extension.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse); requestResponseMap.put(delete, deleteResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); assertTrue(extension.removeSecurityGroup(zone + "/160"), "Expected removal of securitygroup to be successful"); }
Source:
protected void onInit() { Assert.notNull(getFile(), "File cannot be null"); super.onInit(); String command = "tail"; this.command = command + " " + this.options + " " + this.getFile().getAbsolutePath(); }

Target:
protected void onInit() { Assert.notNull(getFile(), "File cannot be null"); super.onInit(); this.command = "tail " + this.options + " " + this.getFile().getAbsolutePath(); }
Source:
public void init(IViewSite site) throws PartInitException { super.init(site); for (ModelExplorerTabDescriptor tabDescriptor : ModelExplorerTabRegistry.getRegisteredExtensions()) { IModelExplorerTabExtension tab = tabDescriptor.getTabExtension(); if (tab != null) { tab.init(site); } } for (Session session : SessionManager.INSTANCE.getSessions()) { PermissionAuthorityRegistry.getDefault().getPermissionAuthority(session.getTransactionalEditingDomain().getResourceSet()).addAuthorityListener(this); } permissionAuthoritySessionManagerListener = new PermissionAuthoritySessionManagerListener(this); SessionManager.INSTANCE.addSessionsListener(permissionAuthoritySessionManagerListener); }

Target:
public void init(IViewSite site) throws PartInitException { super.init(site); for (ModelExplorerTabDescriptor tabDescriptor : ModelExplorerTabRegistry.getRegisteredExtensions()) { IModelExplorerTabExtension tab = tabDescriptor.getTabExtension(); if (tab != null) { tab.init(site); } } lockDecorationUpdater.register(this); }
Source:
public void setParallel(Supplier<Integer> width){ output._json().addProperty(PortProperties.PARTITIONED, true); output._json().addProperty(PortProperties.WIDTH, width.get()); }

Target:
public TStream<T> setParallel(Supplier<Integer> width){ BOutputPort output = (BOutputPort)this.output; output.operator().addConfig(OpProperties.PARALLEL, true); output.operator().addConfig(OpProperties.WIDTH, width.get()); throw new UnsupportedOperationException("setParallel is not implemented."); }
Source:
public static AddToReadingListDialog newInstance(@NonNull List<PageTitle> titles, InvokeSource source, @Nullable DialogInterface.OnDismissListener listener) { AddToReadingListDialog dialog = new AddToReadingListDialog(); Bundle args = new Bundle(); args.putParcelableArrayList("titles", new ArrayList<Parcelable>(titles)); args.putSerializable("source", source); dialog.setArguments(args); dialog.setOnDismissListener(listener); return dialog; }

Target:
public static AddToReadingListDialog newInstance(@NonNull List<PageTitle> titles, InvokeSource source, @Nullable DialogInterface.OnDismissListener listener) { AddToReadingListDialog dialog = new AddToReadingListDialog(); Bundle args = new Bundle(); args.putParcelableArrayList("titles", new ArrayList<Parcelable>(titles)); args.putInt("source", source.ordinal()); dialog.setArguments(args); dialog.setOnDismissListener(listener); return dialog; }
Source:
public void setup() { if ( canSetUp ) { eventBusHandlerRegistrations.add( eventBus.addHandler( ValidateEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( DeleteRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AfterColumnDeleted.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( UpdateColumnDataEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AppendRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( InsertRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AfterColumnInserted.TYPE, analyzerController ) ); } canSetUp = false; }

Target:
public void setup() { if ( eventBusHandlerRegistrations.isEmpty() ) { eventBusHandlerRegistrations.add( eventBus.addHandler( ValidateEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( DeleteRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AfterColumnDeleted.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( UpdateColumnDataEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AppendRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( InsertRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AfterColumnInserted.TYPE, analyzerController ) ); } }
Source:
private static TransformerFactory getTransformerFactory(String transformerFactoryImplClass) { if (transformerFactoryImplClass == null || transformerFactoryImplClass.length() <= 0) { return TransformerFactory.newInstance(); } else { return TransformerFactory.newInstance(transformerFactoryImplClass, ClassLoader.getSystemClassLoader()); } }

Target:
private static TransformerFactory getTransformerFactory(String transformerFactoryImplClass) { TransformerFactory transformerFactory = null; if (transformerFactoryImplClass == null || transformerFactoryImplClass.length() <= 0) { transformerFactory = TransformerFactory.newInstance(); } else if(ClassUtils.isPresent(transformerFactoryImplClass, ClassLoader.getSystemClassLoader())) { transformerFactory = TransformerFactory.newInstance(transformerFactoryImplClass, ClassLoader.getSystemClassLoader()); } else { if (logger.isWarnEnabled()) { logger.warn(String.format("Class [%s] was not found will default to [%s], please ensure [%s] is located on your class path", transformerFactoryImplClass, TransformerFactory.class, transformerFactoryImplClass)); } transformerFactory = TransformerFactory.newInstance(); } return transformerFactory; }
Source:
public static File getArchiveForCoordinate(MavenCoordinate mavenCoordinate) { String sdkLocation = AndroidSdkUtils.tryToChooseAndroidSdk().getLocation(); String path = String.format(SUPPORT_REPOSITORY_BASE_PATH, sdkLocation, mavenCoordinate.getArtifactId()); String revisionPath = String.format(MAVEN_REVISION_PATH, mavenCoordinate.getFullRevision(), mavenCoordinate.getArtifactId(), mavenCoordinate.getFullRevision()); return new File(path, revisionPath); }

Target:
public static File getArchiveForCoordinate(MavenCoordinate mavenCoordinate) { String sdkLocation = AndroidSdkUtils.tryToChooseAndroidSdk().getLocation(); String path = String.format(SUPPORT_REPOSITORY_BASE_PATH, sdkLocation, mavenCoordinate.getArtifactId()); path = FileUtil.toSystemDependentName(path); String revisionPath = String.format(MAVEN_REVISION_PATH, mavenCoordinate.getFullRevision(), mavenCoordinate.getArtifactId(), mavenCoordinate.getFullRevision()); revisionPath = FileUtil.toSystemDependentName(revisionPath); return new File(path, revisionPath); }
Source:
public static OSDeviceState getDeviceState() { if (shouldLogUserPrivacyConsentErrorMessageForMethodName("getDeviceState()")) return null; if (appContext == null) { logger.error("OneSignal.initWithContext has not been called. Could not get OSDeviceState"); return null; } OSSubscriptionState subscriptionStatus = getCurrentSubscriptionState(appContext); OSPermissionState permissionStatus = getCurrentPermissionState(appContext); OSEmailSubscriptionState emailSubscriptionStatus = getCurrentEmailSubscriptionState(appContext); return new OSDeviceState(subscriptionStatus, permissionStatus, emailSubscriptionStatus); }

Target:
public static OSDeviceState getDeviceState() { if (appContext == null) { logger.error("OneSignal.initWithContext has not been called. Could not get OSDeviceState"); return null; } OSSubscriptionState subscriptionStatus = getCurrentSubscriptionState(appContext); OSPermissionState permissionStatus = getCurrentPermissionState(appContext); OSEmailSubscriptionState emailSubscriptionStatus = getCurrentEmailSubscriptionState(appContext); return new OSDeviceState(subscriptionStatus, permissionStatus, emailSubscriptionStatus); }
Source:
public void testPutAll_without_cache_writer() throws Exception { CacheConfigurationBuilder cacheConfigurationBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder(); CacheConfiguration<String, String> cacheConfiguration = cacheConfigurationBuilder.buildCacheConfig(String.class, String.class); CacheManagerBuilder<CacheManager> managerBuilder = CacheManagerBuilder.newCacheManagerBuilder(); CacheManager cacheManager = managerBuilder.withCache("myCache", cacheConfiguration).build(); Cache<String, String> myCache = cacheManager.getCache("myCache", String.class, String.class); HashMap<String, String> stringStringHashMap = new HashMap<String, String>(); for (int i = 0; i < 100; i++) { stringStringHashMap.put("key" + i, "value" + i); } myCache.putAll(stringStringHashMap.entrySet()); for (int i = 0; i < 100; i++) { assertThat(myCache.get("key" + i), is("value" + i)); } }

Target:
public void testPutAll_without_cache_writer() throws Exception { CacheConfigurationBuilder cacheConfigurationBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder(); CacheConfiguration<String, String> cacheConfiguration = cacheConfigurationBuilder.buildCacheConfig(String.class, String.class); CacheManagerBuilder<CacheManager> managerBuilder = CacheManagerBuilder.newCacheManagerBuilder(); CacheManager cacheManager = managerBuilder.withCache("myCache", cacheConfiguration).build(); Cache<String, String> myCache = cacheManager.getCache("myCache", String.class, String.class); HashMap<String, String> stringStringHashMap = new HashMap<String, String>(); for (int i = 0; i < 3; i++) { stringStringHashMap.put("key" + i, "value" + i); } myCache.putAll(stringStringHashMap.entrySet()); for (int i = 0; i < 3; i++) { assertThat(myCache.get("key" + i), is("value" + i)); } }
Source:
public void attachmentsDataEncrypted() throws IOException, DocumentException { MutableDocumentRevision rev = new MutableDocumentRevision(); rev.body = DocumentBodyFactory.create(new HashMap<String, String>()); File expectedPlainText = TestUtils.loadFixture("fixture/EncryptedAttachmentTest_plainText"); assertNotNull(expectedPlainText); UnsavedFileAttachment attachment = new UnsavedFileAttachment( expectedPlainText, "text/plain"); rev.attachments.put("EncryptedAttachmentTest_plainText", attachment); datastore.createDocumentFromRevision(rev); File attachmentsFolder = new File(datastore_manager_dir + File.separator + "EndToEndEncryptionTest" + File.separator + "extensions" + File.separator + "com.cloudant.attachments"); File[] contents = attachmentsFolder.listFiles(); assertNotNull("Didn't find expected attachments folder", contents); assertThat("Didn't find expected file in attachments", contents.length, IsEqual.equalTo(1)); InputStream in = new FileInputStream(contents[0]); if(dataShouldBeEncrypted) { byte[] actualContent = new byte[expectedFirstAttachmentByte.length]; int readLength = in.read(actualContent); assertEquals("Didn't read full buffer", actualContent.length, readLength); assertArrayEquals("First byte not version byte", actualContent, expectedFirstAttachmentByte); } else { assertTrue(IOUtils.contentEquals(new FileInputStream(expectedPlainText), in)); } }

Target:
public void attachmentsDataEncrypted() throws IOException, DocumentException, InvalidKeyException { MutableDocumentRevision rev = new MutableDocumentRevision(); rev.body = DocumentBodyFactory.create(new HashMap<String, String>()); File expectedPlainText = TestUtils.loadFixture("fixture/EncryptedAttachmentTest_plainText"); assertNotNull(expectedPlainText); UnsavedFileAttachment attachment = new UnsavedFileAttachment( expectedPlainText, "text/plain"); rev.attachments.put("EncryptedAttachmentTest_plainText", attachment); datastore.createDocumentFromRevision(rev); File attachmentsFolder = new File(datastoreManagerDir + File.separator + "EndToEndEncryptionTest" + File.separator + "extensions" + File.separator + "com.cloudant.attachments"); File[] contents = attachmentsFolder.listFiles(); assertNotNull("Didn't find expected attachments folder", contents); assertThat("Didn't find expected file in attachments", contents.length, IsEqual.equalTo(1)); InputStream in = new FileInputStream(contents[0]); if(dataShouldBeEncrypted) { byte[] actualContent = new byte[expectedFirstAttachmentByte.length]; int readLength = in.read(actualContent); assertEquals("Didn't read full buffer", actualContent.length, readLength); assertArrayEquals("First byte not version byte", expectedFirstAttachmentByte, actualContent); assertTrue("Encrypted attachment did not decrypt correctly", IOUtils.contentEquals( new EncryptedAttachmentInputStream(new FileInputStream(contents[0]), KEY), new FileInputStream(expectedPlainText))); } else { assertTrue("Unencrypted attachment did not read correctly", IOUtils.contentEquals(new FileInputStream(expectedPlainText), in)); } }
Source:
public Mono<Response<BlockBlobItem>> uploadWithResponse(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions accessConditions) { return determineUploadFullOrChunked(data, (stream) -> uploadInChunks(stream, parallelTransferOptions, headers, metadata, tier, accessConditions), (stream, length) -> getBlockBlobAsyncClient().uploadWithResponse(stream, length, headers, metadata, tier,accessConditions)); }

Target:
public Mono<Response<BlockBlobItem>> uploadWithResponse(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions accessConditions) { try { Objects.requireNonNull(data, "'data' must not be null"); BlobRequestConditions validatedAccessConditions = accessConditions == null ? new BlobRequestConditions() : accessConditions; final ParallelTransferOptions validatedParallelTransferOptions = parallelTransferOptions == null ? new ParallelTransferOptions(null, null, null) : new ParallelTransferOptions(parallelTransferOptions.getBlockSize(), parallelTransferOptions.getNumBuffers(), parallelTransferOptions.getProgressReceiver()); BlockBlobAsyncClient blockBlobAsyncClient = getBlockBlobAsyncClient(); Function<Flux<ByteBuffer>, Mono<Response<BlockBlobItem>>> uploadInChunksFunction = (stream) -> uploadInChunks(blockBlobAsyncClient, stream, validatedParallelTransferOptions, headers, metadata, tier, validatedAccessConditions); BiFunction<Flux<ByteBuffer>, Long, Mono<Response<BlockBlobItem>>> uploadFullBlobMethod = (stream, length) -> blockBlobAsyncClient.uploadWithResponse(ProgressReporter .addProgressReporting(stream, validatedParallelTransferOptions.getProgressReceiver()), length, headers, metadata, tier, null, validatedAccessConditions); return determineUploadFullOrChunked(data, uploadInChunksFunction, uploadFullBlobMethod); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
private X509ExtendedTrustManager getLinkedTrustMananger(X509Certificate[] chain, SSLEngine sslEngine) { if (sslEngine != null) { String peer = sslEngine.getPeerHost() + ":" + sslEngine.getPeerPort(); X509ExtendedTrustManager trustManager = linkedTrustManager.getOrDefault(peer, EMPTY_QUEUE).peek(); if (trustManager != null) { logger.trace("Found trustManager by sslEngine peer/host: {}", peer); return trustManager; } else { logger.trace("Did NOT find trustManager by sslEngine peer/host: {}", peer); } } return getLinkedTrustMananger(chain); }

Target:
private X509ExtendedTrustManager getLinkedTrustMananger(X509Certificate[] chain, SSLEngine sslEngine) { if (sslEngine != null) { X509ExtendedTrustManager trustManager = null; String peer = null; if (sslEngine.getPeerHost() != null) { peer = sslEngine.getPeerHost() + ":" + sslEngine.getPeerPort(); trustManager = linkedTrustManager.getOrDefault(peer, EMPTY_QUEUE).peek(); } if (trustManager != null) { logger.trace("Found trustManager by sslEngine peer/host: {}", peer); return trustManager; } else { logger.trace("Did NOT find trustManager by sslEngine peer/host: {}", peer); } } return getLinkedTrustMananger(chain); }
Source:
private void assertStoredEntry(InternalCacheEntry entry, Object expectedValue, long expectedLifespan, String src, Object key) { assert entry != null : src + " entry for key " + key + " should NOT be null"; assert entry.getValue().equals(expectedValue) : src + " should contain value " + expectedValue + " under key " + entry.getKey() + " but was " + entry.getValue() + ". Entry is " + entry; assert entry.getLifespan() == expectedLifespan : src + " expected lifespan for key " + key + " to be " + expectedLifespan + " but was " + entry.getLifespan() + ". Entry is " + entry; }

Target:
private void assertStoredEntry(InternalCacheEntry entry, Object expectedValue, long expectedLifespan, String src, Object key) { assertNotNull(src + " entry for key " + key + " should NOT be null", entry); assertEquals(src + " should contain value " + expectedValue + " under key " + entry.getKey() + " but was " + entry.getValue() + ". Entry is " + entry, expectedValue, entry.getValue()); assertEquals(src + " expected lifespan for key " + key + " to be " + expectedLifespan + " but was " + entry.getLifespan() + ". Entry is " + entry, expectedLifespan, entry.getLifespan()); }
Source:
private Set<SpecificHaxeClassReference> getCompatibleEnumTypes(HaxeClassModel model, HaxeGenericResolver resolver) { final Set<SpecificHaxeClassReference> list = new HashSet<>(); if (null == model) return list; boolean isEnumType = isContextAnEnumType(); boolean instanceIsExpected = canBeEnumInstance(); if (model instanceof HaxeEnumModel || (model.isEnum() && model.isAbstract())) { if (instanceIsExpected) { list.add(SpecificHaxeClassReference.getEnumValue(context)); } if(isEnumType) { SpecificHaxeClassReference ref = new SpecificHaxeClassReference( model.getReference(), resolver.getSpecifics(), null, null, context); list.add(SpecificHaxeClassReference.getEnum(context, ref)); } } else if (model.isAbstract() && "Enum".equals(model.getQualifiedInfo().getPresentableText())) { ResultHolder[] specifics = resolver.getSpecifics(); if (specifics.length == 1) { if (instanceIsExpected) { list.add(SpecificHaxeClassReference.getEnumValue(context)); } if(isEnumType) { list.add(specifics[0].getClassType()); } } } return list; }

Target:
private Set<SpecificHaxeClassReference> getCompatibleEnumTypes(HaxeClassModel model, HaxeGenericResolver resolver) { final Set<SpecificHaxeClassReference> list = new HashSet<>(); if (null == model) return list; boolean isEnumType = isContextAnEnumType(); if (model instanceof HaxeEnumModel || (model.isEnum() && model.isAbstract())) { if(isEnumType) { SpecificHaxeClassReference ref = new SpecificHaxeClassReference( model.getReference(), resolver.getSpecifics(), null, null, context); list.add(SpecificHaxeClassReference.getEnum(context, ref)); } } else if (model.isAbstract() && "Enum".equals(model.getQualifiedInfo().getPresentableText())) { ResultHolder[] specifics = resolver.getSpecifics(); if (specifics.length == 1) { if(isEnumType) { list.add(specifics[0].getClassType()); } } } return list; }
Source:
private void checkSuperHasCorrectNumberOfArguments(SuperTreeImpl superTree) { if (isInConstructor(superTree) && !isInBaseClass(getEnclosingConstructor(superTree))) { ClassTree classTree = getEnclosingClass(superTree); ExpressionTree superClassTree = classTree.superClass(); if (superClassTree.is(Kind.IDENTIFIER_REFERENCE)) { IdentifierTree superClassId = (IdentifierTree) superClassTree; String superClassName = superClassId.identifierToken().text(); Scope constructorScope = getContext().getSymbolModel().getScope(getEnclosingConstructor(superTree)); Symbol superClassSymbol = constructorScope.lookupSymbol(superClassName); if (superClassSymbol != null) { compareNumberOfArguments(superTree, superClassSymbol); } } } }

Target:
private void checkSuperHasCorrectNumberOfArguments(SuperTreeImpl superTree) { ClassTree classTree = getEnclosingClass(superTree); ExpressionTree superClassTree = classTree.superClass(); if (superClassTree.is(Kind.IDENTIFIER_REFERENCE)) { Symbol superClassSymbol = ((IdentifierTree) superClassTree).symbol(); if (superClassSymbol != null) { compareNumberOfArguments(superTree, superClassSymbol); } } }
Source:
public static boolean openRenameWizard(String newName, IStructuredSelection structuredSelection) { Map<String, Object> commandParameters = new HashMap<>(); commandParameters.put(LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY, newName); return runCommand(LTK_RENAME_ID, structuredSelection, commandParameters); }

Target:
public static boolean openRenameWizard(String newName, IStructuredSelection structuredSelection) { Map<String, Object> commandParameters = Collections.singletonMap(LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY, newName); return runCommand(LTK_RENAME_ID, structuredSelection, commandParameters); }
Source:
protected void init(TaggedValuePointable[] args) throws SystemException { returnSelf = true; indexSeqArgs = 0; indexSequence.add(0); returnSequence.add(0); if (args.length == 1) { } else { isfilter = true; if (args[1].getTag() != ValueTag.XS_INT_TAG) { throw new IllegalArgumentException("Expected int value tag, got: " + args[1].getTag()); } args[1].getValue(ip); if (ip.getInteger() != filterLookupID) { filterLookupID = ip.getInteger(); SequenceType sType = dCtx.getStaticContext().lookupSequenceType(ip.getInteger()); filter = NodeTestFilter.getNodeTestFilter(sType); } } if (args[0].getTag() == ValueTag.SEQUENCE_TAG) { args[0].getValue(seqNtp); seqArgsLength = seqNtp.getEntryCount(); } else if (args[0].getTag() == ValueTag.NODE_TREE_TAG) { args[0].getValue(ntp); seqArgsLength = -1; } else { throw new SystemException(ErrorCode.SYSE0001); } }

Target:
protected void init(TaggedValuePointable[] args) throws SystemException { returnSelf = true; indexSeqArgs = 0; indexSequence.add(0); returnSequence.add(0); if (args.length > 1) { isfilter = true; if (args[1].getTag() != ValueTag.XS_INT_TAG) { throw new IllegalArgumentException("Expected int value tag, got: " + args[1].getTag()); } args[1].getValue(ip); if (ip.getInteger() != filterLookupID) { filterLookupID = ip.getInteger(); SequenceType sType = dCtx.getStaticContext().lookupSequenceType(ip.getInteger()); filter = NodeTestFilter.getNodeTestFilter(sType); } } if (args[0].getTag() == ValueTag.SEQUENCE_TAG) { args[0].getValue(seqNtp); seqArgsLength = seqNtp.getEntryCount(); } else if (args[0].getTag() == ValueTag.NODE_TREE_TAG) { args[0].getValue(ntp); seqArgsLength = -1; } else { throw new SystemException(ErrorCode.SYSE0001); } }
Source:
private FeedbackSessionResponseStatus getFeedbackSessionResponseStatus( FeedbackSessionAttributes fsa, CourseRoster roster, List<FeedbackQuestionAttributes> questions) throws EntityDoesNotExistException { FeedbackSessionResponseStatus responseStatus = new FeedbackSessionResponseStatus(); List<StudentAttributes> students = roster.getStudents(); List<InstructorAttributes> instructors = roster.getInstructors(); List<FeedbackQuestionAttributes> studentQns = fqLogic .getFeedbackQuestionsForStudents(questions); List<String> studentNoResponses = new ArrayList<String>(); List<String> instructorNoResponses = new ArrayList<String>(); if(!studentQns.isEmpty()){ for(StudentAttributes student : students){ studentNoResponses.add(student.email); responseStatus.emailNameTable.put(student.email, student.name); responseStatus.emailTeamNameTable.put(student.email, student.team); } } studentNoResponses.removeAll(fsa.respondingStudentList); for (InstructorAttributes instructor : instructors) { List<FeedbackQuestionAttributes> instructorQns = fqLogic .getFeedbackQuestionsForInstructor(questions, fsa.isCreator(instructor.email)); if (!instructorQns.isEmpty()) { if(responseStatus.emailNameTable.get(instructor.email) == null){ instructorNoResponses.add(instructor.email); responseStatus.emailNameTable.put(instructor.email, instructor.name); responseStatus.emailTeamNameTable.put(instructor.email, "Teaching Team"); } } } instructorNoResponses.removeAll(fsa.respondingInstructorList); responseStatus.noResponse.addAll(studentNoResponses); responseStatus.noResponse.addAll(instructorNoResponses); return responseStatus; }

Target:
private FeedbackSessionResponseStatus getFeedbackSessionResponseStatus( FeedbackSessionAttributes fsa, CourseRoster roster, List<FeedbackQuestionAttributes> questions) throws EntityDoesNotExistException { FeedbackSessionResponseStatus responseStatus = new FeedbackSessionResponseStatus(); List<StudentAttributes> students = roster.getStudents(); List<InstructorAttributes> instructors = roster.getInstructors(); List<FeedbackQuestionAttributes> studentQns = fqLogic .getFeedbackQuestionsForStudents(questions); List<String> studentNoResponses = new ArrayList<String>(); List<String> instructorNoResponses = new ArrayList<String>(); if(!studentQns.isEmpty()){ for(StudentAttributes student : students){ studentNoResponses.add(student.email); responseStatus.emailNameTable.put(student.email, student.name); responseStatus.emailTeamNameTable.put(student.email, student.team); } } studentNoResponses.removeAll(fsa.respondingStudentList); for (InstructorAttributes instructor : instructors) { List<FeedbackQuestionAttributes> instructorQns = fqLogic .getFeedbackQuestionsForInstructor(questions, fsa.isCreator(instructor.email)); if (!instructorQns.isEmpty()) { if(responseStatus.emailNameTable.get(instructor.email) == null){ instructorNoResponses.add(instructor.email); responseStatus.emailNameTable.put(instructor.email, instructor.name); } } } instructorNoResponses.removeAll(fsa.respondingInstructorList); responseStatus.noResponse.addAll(studentNoResponses); responseStatus.noResponse.addAll(instructorNoResponses); return responseStatus; }
Source:
public int compareTo(final ActivityCalendar other) { return other.calendarName.compareTo(this.calendarName); }

Target:
public int compareTo(final ActivityCalendar other) { return this.calendarName.compareTo(other.calendarName); }
Source:
private @CheckForNull String getThreaddump() { Process proc = process.getProcess(); try { int val = proc.exitValue(); return null; } catch (IllegalThreadStateException _) { } Class<?> clazz; Field pidField; try { clazz = Class.forName("java.lang.UNIXProcess"); pidField = clazz.getDeclaredField("pid"); pidField.setAccessible(true); } catch (Exception e) { return null; } if (clazz.isAssignableFrom(proc.getClass())) { int pid; try { pid = (int) pidField.get(proc); } catch (IllegalArgumentException | IllegalAccessException e) { throw new AssertionError(e); } try { File tmpFile = File.createTempFile("jstack-output", ".tmp"); tmpFile.deleteOnExit(); Process jstack = new ProcessBuilder("jstack", String.valueOf(pid)) .redirectErrorStream(true) .redirectOutput(ProcessBuilder.Redirect.to(tmpFile)) .start(); if (jstack.waitFor() == 0) { StringWriter writer = new StringWriter(); IOUtils.copy(new FileInputStream(tmpFile), writer); return writer.toString(); } } catch (IOException | InterruptedException e) { throw new AssertionError(e); } } return null; }

Target:
private @CheckForNull String getThreaddump() { Process proc = process.getProcess(); try { int val = proc.exitValue(); return null; } catch (IllegalThreadStateException _) { } Class<?> clazz; Field pidField; try { clazz = Class.forName("java.lang.UNIXProcess"); pidField = clazz.getDeclaredField("pid"); pidField.setAccessible(true); } catch (Exception e) { return null; } if (clazz.isAssignableFrom(proc.getClass())) { int pid; try { pid = (int) pidField.get(proc); } catch (IllegalArgumentException | IllegalAccessException e) { throw new AssertionError(e); } try { File tmpFile = File.createTempFile("jstack-output", ".tmp"); tmpFile.deleteOnExit(); Process jstack = new ProcessBuilder("jstack", String.valueOf(pid)) .redirectErrorStream(true) .redirectOutput(ProcessBuilder.Redirect.to(tmpFile)) .start(); if (jstack.waitFor() == 0) { return FileUtils.readFileToString(tmpFile, Charset.defaultCharset()); } } catch (IOException | InterruptedException e) { throw new AssertionError(e); } } return null; }
Source:
public BoundFilter(final BoundDimFilter boundDimFilter) { super( boundDimFilter.getDimension(), new Predicate<String>() { private volatile Predicate<String> predicate; @Override public boolean apply(String input) { return function().apply(input); } private Predicate<String> function() { if (predicate == null) { final Comparator<String> comparator; if (boundDimFilter.isAlphaNumeric()) { comparator = new AlphaNumericTopNMetricSpec(null).getComparator(null, null); } else { comparator = new LexicographicTopNMetricSpec(null).getComparator(null, null); } final ExtractionFn extractionFn = boundDimFilter.getExtractionFn(); predicate = new Predicate<String>() { @Override public boolean apply(String input) { if (input == null) { return false; } if (extractionFn != null) { input = extractionFn.apply(input); } int lowerComparing = 1; int upperComparing = 1; if (boundDimFilter.getLower() != null) { lowerComparing = comparator.compare(input, boundDimFilter.getLower()); } if (boundDimFilter.getUpper() != null) { upperComparing = comparator.compare(boundDimFilter.getUpper(), input); } if (boundDimFilter.isLowerStrict() && boundDimFilter.isUpperStrict()) { return ((lowerComparing > 0)) && (upperComparing > 0); } else if (boundDimFilter.isLowerStrict()) { return (lowerComparing > 0) && (upperComparing >= 0); } else if (boundDimFilter.isUpperStrict()) { return (lowerComparing >= 0) && (upperComparing > 0); } return (lowerComparing >= 0) && (upperComparing >= 0); } }; } return predicate; } } ); }

Target:
public BoundFilter(final BoundDimFilter boundDimFilter) { this.boundDimFilter = boundDimFilter; this.comparator = boundDimFilter.isAlphaNumeric() ? StringComparators.ALPHANUMERIC : StringComparators.LEXICOGRAPHIC; this.extractionFn = boundDimFilter.getExtractionFn(); }
Source:
private void deleteOldBlobs() { if (retentionDays <= 0) { return; } try { SmartQuery<SQLBlob> deleteQuery = oma.select(SQLBlob.class) .eq(SQLBlob.SPACE_NAME, spaceName) .where(OMA.FILTERS.lt(SQLBlob.LAST_MODIFIED, LocalDateTime.now().minusDays(retentionDays))) .where(OMA.FILTERS.ltOrEmpty(MongoBlob.LAST_TOUCHED, LocalDateTime.now() .minusDays(retentionDays))); if (isTouchTracking()) { deleteQuery.where(OMA.FILTERS.ltOrEmpty(SQLBlob.LAST_TOUCHED, LocalDateTime.now().minusDays(retentionDays))); } deleteQuery.limit(256).delete(); } catch (Exception e) { Exceptions.handle() .to(StorageUtils.LOG) .error(e) .withSystemErrorMessage("Layer 2/SQL: Failed to delete old blobs in %s: %s (%s)", spaceName) .handle(); } }

Target:
private void deleteOldBlobs() { if (retentionDays <= 0) { return; } try { SmartQuery<SQLBlob> deleteQuery = oma.select(SQLBlob.class) .eq(SQLBlob.SPACE_NAME, spaceName) .where(OMA.FILTERS.lt(SQLBlob.LAST_MODIFIED, LocalDateTime.now().minusDays(retentionDays))) .where(OMA.FILTERS.ltOrEmpty(SQLBlob.LAST_TOUCHED, LocalDateTime.now() .minusDays(retentionDays))); if (isTouchTracking()) { deleteQuery.where(OMA.FILTERS.ltOrEmpty(SQLBlob.LAST_TOUCHED, LocalDateTime.now().minusDays(retentionDays))); } deleteQuery.limit(256).delete(); } catch (Exception e) { Exceptions.handle() .to(StorageUtils.LOG) .error(e) .withSystemErrorMessage("Layer 2/SQL: Failed to delete old blobs in %s: %s (%s)", spaceName) .handle(); } }
Source:
protected void writeBuckets(String fieldName, List<Bucket> buckets, Field field, JsonGenerator jg) throws IOException { Schema schema = field.getDeclaringType().getSchema(); DocumentPartImpl part = new DocumentPartImpl(schema); jg.writeArrayFieldStart(fieldName); for (Bucket bucket : buckets) { jg.writeStartObject(); jg.writeObjectField("key", bucket.getKey()); Property prop = PropertyFactory.createProperty(part, field, Property.NONE); if (prop.isList()) { ListType t = (ListType) prop.getType(); t.getField(); prop = PropertyFactory.createProperty(part, t.getField(), Property.NONE); } log.debug("Writing for field resolved to {}", fieldName, field.getName(), prop.getName()); prop.setValue(bucket.getKey()); writeEntityField("fetchedKey", prop, jg); jg.writeNumberField("docCount", bucket.getDocCount()); jg.writeEndObject(); if (bucket instanceof BucketRange) { BucketRange bucketRange = (BucketRange) bucket; jg.writeNumberField("from", bucketRange.getFrom()); jg.writeNumberField("to", bucketRange.getTo()); } if (bucket instanceof BucketRangeDate) { BucketRangeDate bucketRange = (BucketRangeDate) bucket; jg.writeStringField("fromAsDate", formatISODateTime(nowIfNull(bucketRange.getFromAsDate()))); jg.writeStringField("toAsDate", formatISODateTime(nowIfNull(bucketRange.getToAsDate()))); } } jg.writeEndArray(); }

Target:
protected void writeBuckets(String fieldName, List<Bucket> buckets, Field field, JsonGenerator jg) throws IOException { Schema schema = field.getDeclaringType().getSchema(); DocumentPartImpl part = new DocumentPartImpl(schema); jg.writeArrayFieldStart(fieldName); for (Bucket bucket : buckets) { jg.writeStartObject(); jg.writeObjectField("key", bucket.getKey()); Property prop = PropertyFactory.createProperty(part, field, Property.NONE); if (prop.isList()) { ListType t = (ListType) prop.getType(); t.getField(); prop = PropertyFactory.createProperty(part, t.getField(), Property.NONE); } log.debug("Writing value: for field: resolved to: {}", fieldName, field.getName(), prop.getName()); prop.setValue(bucket.getKey()); writeEntityField("fetchedKey", prop, jg); jg.writeNumberField("docCount", bucket.getDocCount()); jg.writeEndObject(); if (bucket instanceof BucketRange) { BucketRange bucketRange = (BucketRange) bucket; jg.writeNumberField("from", bucketRange.getFrom()); jg.writeNumberField("to", bucketRange.getTo()); } if (bucket instanceof BucketRangeDate) { BucketRangeDate bucketRange = (BucketRangeDate) bucket; jg.writeStringField("fromAsDate", formatISODateTime(nowIfNull(bucketRange.getFromAsDate()))); jg.writeStringField("toAsDate", formatISODateTime(nowIfNull(bucketRange.getToAsDate()))); } } jg.writeEndArray(); }
Source:
private void storeFileContent( File file, ByteBuffer sourceBuffer ) throws IOException { try ( StoreChannel storeChannel = fileSystem.create( file ) ) { storeChannel.write( sourceBuffer ); } }

Target:
private void storeFileContent( File file, ByteBuffer sourceBuffer ) throws IOException { try ( StoreChannel storeChannel = fileSystem.create( file ) ) { storeChannel.writeAll( sourceBuffer ); } }
Source:
private byte[] updateOrDoFinal(byte[] input, int offset, int len, boolean isFinal) throws IllegalBlockSizeException, BadPaddingException { allocateBuffer(); int tempLen = isFinal ? len - len % transformation.getAlgorithmBlockSize() + transformation.getAlgorithmBlockSize() : len - len % transformation.getAlgorithmBlockSize(); byte[] temp = new byte[tempLen]; int cursor = consumeInput(input, offset, len, isFinal, temp); return generateOutput(temp, cursor, tempLen); }

Target:
private byte[] updateOrDoFinal(byte[] input, int offset, int len, boolean isFinal) throws IllegalBlockSizeException, BadPaddingException, ShortBufferException { if (input == null || offset < 0 || len < 0 || len > (input.length - offset)) { throw new IllegalArgumentException("Bad arguments"); } allocateBuffer(); final int blockSize = transformation.getAlgorithmBlockSize(); int bufferLen = isFinal ? len - len % blockSize + blockSize : len - len % blockSize; byte[] buffer = new byte[bufferLen]; int pos = updateInput(input, offset, len, isFinal, buffer); return getOutput(buffer, pos, bufferLen); }