auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CompletableFuture<Void> send(Address address, Message message) { transport.send(address, message, COMPLETED_PROMISE); return COMPLETED_PROMISE; }

Target:
public void send(Address address, Message message) { transport.send(address, message); }
Source:
void onQuickAddNext() { if (!(docDisplay_ instanceof AceEditor)) return; AceEditor editor = (AceEditor) docDisplay_; if (editor.getNativeSelection().isEmpty()) { editor.getNativeSelection().selectWord(); return; } String needle = editor.getSelectionValue(); Search search = Search.create( needle, false, true, true, true, editor.getCursorPosition(), null, false); Range range = search.find(editor.getSession()); if (range == null) return; editor.getNativeSelection().addRange(range, false); editor.centerSelection(); }

Target:
void onQuickAddNext() { docDisplay_.quickAddNext(); }
Source:
public Secret createSecret(String projectId, String secretId) throws IOException { try (SecretManagerServiceClient client = SecretManagerServiceClient.create()) { ProjectName parent = ProjectName.of(projectId); CreateSecretRequest request = CreateSecretRequest.newBuilder() .setParent(parent.toString()) .setSecretId(secretId) .setSecret( Secret.newBuilder() .setReplication( Replication.newBuilder() .setAutomatic(Replication.Automatic.newBuilder().build()) .build()) .build()) .build(); Secret secret = client.createSecret(request); System.out.printf("Created secret %s\n", secret.getName()); return secret; } }

Target:
public void createSecret(String projectId, String secretId) throws IOException { try (SecretManagerServiceClient client = SecretManagerServiceClient.create()) { ProjectName parent = ProjectName.of(projectId); Secret secret = Secret.newBuilder() .setReplication( Replication.newBuilder() .setAutomatic(Replication.Automatic.newBuilder().build()) .build()) .build(); CreateSecretRequest request = CreateSecretRequest.newBuilder() .setParent(parent.toString()) .setSecretId(secretId) .setSecret(secret) .build(); Secret createdSecret = client.createSecret(request); System.out.printf("Created secret %s\n", createdSecret.getName()); } }
Source:
public void handleResponse(Object response) { if (response.getBucket().isEmpty()) { throw new RuntimeException( "Got response from service with empty/missing bucketName: " + response.toString()); } Map<String, byte[]> metadata = Maps.transformValues( response.getMetadataMap(), value -> { try { return BaseEncoding.base64().decode(value); } catch (IllegalArgumentException iae) { logger.atSevere().withCause(iae).log( "In: " + this + "Failed to parse base64 encoded attribute value %s - %s", value, iae); return null; } }); byte[] md5Hash = response.getMd5Hash().length() > 0 ? BaseEncoding.base64().decode(response.getMd5Hash()) : null; byte[] crc32c = response.hasCrc32C() ? ByteBuffer.allocate(4).putInt(response.getCrc32C().getValue()).array() : null; completedItemInfo = new GoogleCloudStorageItemInfo( new StorageResourceId(response.getBucket(), response.getName()), Timestamps.toMillis(response.getUpdated()), Timestamps.toMillis(response.getUpdated()), response.getSize(), null, null, response.getContentType(), response.getContentEncoding(), metadata, response.getGeneration(), response.getMetageneration(), new VerificationAttributes(md5Hash, crc32c)); }

Target:
public void handleResponse(Object response) { checkArgument( !response.getBucket().isEmpty(), "Got response from service with empty/missing bucketName: %s", response); Map<String, byte[]> metadata = response.getMetadataMap().entrySet().stream() .collect( toMap(Map.Entry::getKey, entry -> BaseEncoding.base64().decode(entry.getValue()))); byte[] md5Hash = response.getMd5Hash().length() > 0 ? BaseEncoding.base64().decode(response.getMd5Hash()) : null; byte[] crc32c = response.hasCrc32C() ? ByteBuffer.allocate(4).putInt(response.getCrc32C().getValue()).array() : null; completedItemInfo = new GoogleCloudStorageItemInfo( new StorageResourceId(response.getBucket(), response.getName()), Timestamps.toMillis(response.getTimeCreated()), Timestamps.toMillis(response.getUpdated()), response.getSize(), null, null, response.getContentType(), response.getContentEncoding(), metadata, response.getGeneration(), response.getMetageneration(), new VerificationAttributes(md5Hash, crc32c)); }
Source:
public void should_report_secondary_issue_locations_from_eslint_based_rules() throws Exception { when(eslintBridgeServerMock.call(any())).thenReturn( "[{\"line\":1,\"column\":3,\"endLine\":3,\"endColumn\":5,\"ruleId\":\"no-all-duplicated-branches\",\"message\":\"Issue message\", " + "\"cost\": 14," + "\"secondaryLocations\": [{ message: \"Secondary\", \"line\":1,\"column\":3,\"endLine\":3,\"endColumn\":5}]}]"); EslintBasedRulesSensor sensor = createSensor(); DefaultInputFile inputFile = createInputFile(context); sensor.execute(context); assertThat(context.allIssues()).hasSize(1); Iterator<Issue> issues = context.allIssues().iterator(); Issue issue = issues.next(); IssueLocation location = issue.primaryLocation(); assertThat(location.inputComponent()).isEqualTo(inputFile); assertThat(location.message()).isEqualTo("Issue message"); assertThat(location.textRange()).isEqualTo(new DefaultTextRange(new DefaultTextPointer(1, 2), new DefaultTextPointer(3, 4))); assertThat(issue.gap()).isEqualTo(14); List<IssueLocation> secondaryLocations = issue.flows().get(0).locations(); assertThat(secondaryLocations).hasSize(1); IssueLocation secondary = secondaryLocations.get(0); assertThat(secondary.inputComponent()).isEqualTo(inputFile); assertThat(secondary.message()).isEqualTo("Secondary"); assertThat(secondary.textRange()).isEqualTo(new DefaultTextRange(new DefaultTextPointer(1, 2), new DefaultTextPointer(3, 4))); }

Target:
public void should_report_secondary_issue_locations_from_eslint_based_rules() throws Exception { when(eslintBridgeServerMock.call(any())).thenReturn( "[{\"line\":1,\"column\":3,\"endLine\":3,\"endColumn\":5,\"ruleId\":\"no-all-duplicated-branches\",\"message\":\"Issue message\", " + "\"cost\": 14," + "\"secondaryLocations\": [" + "{ message: \"Secondary\", \"line\":2,\"column\":1,\"endLine\":2,\"endColumn\":4}," + "{ message: \"Secondary\", \"line\":3,\"column\":2,\"endLine\":3,\"endColumn\":5}" + "]}]"); EslintBasedRulesSensor sensor = createSensor(); DefaultInputFile inputFile = createInputFile(context); sensor.execute(context); assertThat(context.allIssues()).hasSize(1); Iterator<Issue> issues = context.allIssues().iterator(); Issue issue = issues.next(); assertThat(issue.gap()).isEqualTo(14); assertThat(issue.flows()).hasSize(2); IssueLocation secondary1 = issue.flows().get(0).locations().get(0); assertThat(secondary1.inputComponent()).isEqualTo(inputFile); assertThat(secondary1.message()).isEqualTo("Secondary"); assertThat(secondary1.textRange()).isEqualTo(new DefaultTextRange(new DefaultTextPointer(2, 0), new DefaultTextPointer(2, 3))); IssueLocation secondary2 = issue.flows().get(1).locations().get(0); assertThat(secondary2.inputComponent()).isEqualTo(inputFile); assertThat(secondary2.message()).isEqualTo("Secondary"); assertThat(secondary2.textRange()).isEqualTo(new DefaultTextRange(new DefaultTextPointer(3, 1), new DefaultTextPointer(3, 4))); }
Source:
public Schema(List<Column> columns) { if (columns instanceof ImmutableList) { @SuppressWarnings("unchecked") ImmutableList<Column> columnsCasted = (ImmutableList)columns; this.columns = columnsCasted; } else { this.columns = ImmutableList.copyOf(columns); } }

Target:
public Schema(List<Column> columns) { this.columns = ImmutableList.copyOf(columns); }
Source:
private void fetch() { if ((current == null || current.length <= pos) && base.hasNext()) { T[] result = Objects.requireNonNull(base.next()); wrapUp(result); current = result; pos = 0; } }

Target:
private void fetch() { if ((currentPage == null || currentPage.length <= nextItemIndex) && base.hasNext()) { T[] result = Objects.requireNonNull(base.next()); wrapUp(result); currentPage = result; nextItemIndex = 0; } }
Source:
public String redact(String redactableString) { for (String stopWord : STOP_WORDS) { if (redactableString.contains(stopWord)) { switch (stopWord) { case USER_DELEGATION_KEY: redactableString = redactUserDelegationKey(redactableString); break; case ACCESS_TOKEN: redactableString = redactAccessToken(redactableString); break; default: break; } } } return redactableString; }

Target:
public String redact(String redactableString) { String redactedString = redactableString; for (Function<String, String> redactor : RECORDING_REDACTORS) { redactedString = redactor.apply(redactedString); } return redactedString; }
Source:
public boolean isPackageExportedTo(PackageBinding pkg, ModuleBinding client) { PackageBinding resolved = getDeclaredPackage(pkg.compoundName); if (resolved != null) { if (this.isAuto || this == client) { return true; } Predicate<IPackageExport> isExportedTo = e -> Stream.of(e.targets()).map(ref -> this.environment.getModule(ref)).filter(m -> m != null).anyMatch(client::equals); return Stream.of(this.exports).filter(e -> CharOperation.equals(pkg.readableName(), e.name())) .anyMatch(e -> { if (!e.isQualified()) return true; return client != this.environment.UnNamedModule && isExportedTo.test(e); }); } return false; }

Target:
public boolean isPackageExportedTo(PackageBinding pkg, ModuleBinding client) { PackageBinding resolved = getDeclaredPackage(pkg.compoundName); if (resolved == pkg) { if (this.isAuto) { return true; } Predicate<IPackageExport> isExportedTo = e -> Stream.of(e.targets()).map(ref -> this.environment.getModule(ref)).filter(m -> m != null).anyMatch(client::equals); return Stream.of(this.exports).filter(e -> CharOperation.equals(pkg.readableName(), e.name())) .anyMatch(e -> { if (!e.isQualified()) return true; return client != this.environment.UnNamedModule && isExportedTo.test(e); }); } return false; }
Source:
public void initialize(BatchRuntimeContext context) throws Exception { batchConfig.verifySolrConfiguration(); }

Target:
public void initialize(BatchRuntimeContext context) throws Exception { metrics = context.getMetrics(); batchConfig.testSolrConnection(); }
Source:
public static boolean singleNewlineTerminated(File inputFile) throws IOException { RandomAccessFile randomAccessFile = new RandomAccessFile(inputFile, READ_ONLY_MODE); if (inputFile.length() < 1) { return true; } long indexOfLastByte = inputFile.length() - 1; long numTerminatingNewlines = 0; randomAccessFile.seek(indexOfLastByte); while (Byte.compare(randomAccessFile.readByte(), NEWLINE_DELIMITER) == 0) { numTerminatingNewlines++; indexOfLastByte--; if (indexOfLastByte < 0) { return false; } randomAccessFile.seek(indexOfLastByte); } return (numTerminatingNewlines == 1L); }

Target:
public static boolean singleNewlineTerminated(File inputFile) throws IOException { RandomAccessFile randomAccessFile = new RandomAccessFile(inputFile, READ_ONLY_MODE); if (inputFile.length() < 1) { return true; } randomAccessFile.seek(inputFile.length() - 1); if (Byte.compare(randomAccessFile.readByte(), NEWLINE_DELIMITER) != 0) { return false; } if (inputFile.length() < 2) { return true; } randomAccessFile.seek(inputFile.length() - 2); return (Byte.compare(randomAccessFile.readByte(), NEWLINE_DELIMITER) != 0); }
Source:
public boolean isInDiskCacheSync(final Uri uri) { return isInDiskCacheSync(uri, ImageRequest.CacheChoice.DEFAULT); }

Target:
public boolean isInDiskCacheSync(final Uri uri) { return isInDiskCacheSync(uri, ImageRequest.CacheChoice.SMALL) || isInDiskCacheSync(uri, ImageRequest.CacheChoice.DEFAULT); }
Source:
public boolean initialize() { if (events == null) { try { events = CacheBuilder.newBuilder() .expireAfterWrite(unit.toMillis(expiration), TimeUnit.MILLISECONDS) .build(); logger.info("initialized replication cache with expiration in {}: {}", unit, expiration); } catch (Exception ex) { logger.warn("initialize failure in {}: {}", unit, expiration); return false; } } return true; }

Target:
public boolean initialize() { if (events == null) { try { events = CacheBuilder.newBuilder() .expireAfterWrite(expiration, unit) .build(); logger.info("initialized replication cache with expiration in {}: {}", unit, expiration); } catch (Exception ex) { logger.warn("initialize failure in {}: {}", unit, expiration); return false; } } return true; }
Source:
private ArrayList<String> loadWMSServers() { CoreWorkspace ws = (CoreWorkspace) Services.getService(CoreWorkspace.class); File file = new File(ws.getWorkspaceFolder() + File.separator + WMSServerFile); try { if (file.exists()) { return readWMSServerFile(new FileInputStream(file)); } else { return readWMSServerFile(WMSConnectionPanel.class.getResourceAsStream(WMSServerFile)); } } catch (IOException e) { } return null; }

Target:
private ArrayList<String> loadWMSServers() { CoreWorkspace ws = Services.getService(CoreWorkspace.class); File file = new File(ws.getWorkspaceFolder() + File.separator + WMSServerFile); try { if (file.exists()) { return readWMSServerFile(new FileInputStream(file)); } else { return readWMSServerFile(WMSConnectionPanel.class.getResourceAsStream(WMSServerFile)); } } catch (IOException e) { LOGGER.error(I18N.tr("Cannot load the list of WMS url"), e); } return null; }
Source:
public List<CloudResource> handleTransientDeployment(AzureClient client, String resourceGroupName, String deploymentName) { List<CloudResource> deployedResources = new ArrayList<>(); ResourceStatus deploymentStatus = client.getTemplateDeploymentStatus(resourceGroupName, deploymentName); if (deploymentStatus.isTransient()) { LOGGER.info("Template deployment has transient status , cancelling it now.", deploymentName, deploymentStatus); Deployment deployment = client.getTemplateDeployment(resourceGroupName, deploymentName); deployment.cancel(); deployedResources = azureCloudResourceService.getDeploymentCloudResources(deployment); LOGGER.info("Found resources to be removed: {}", deployedResources); List<CloudResource> transientVms = deployedResources.stream() .filter(cloudResource -> ResourceType.AZURE_INSTANCE == cloudResource.getType()) .collect(Collectors.toList()); List<CloudResource> osDiskResources = azureCloudResourceService.getAttachedOsDiskResources(transientVms, resourceGroupName, client); deployedResources.addAll(osDiskResources); } return deployedResources; }

Target:
public List<CloudResource> handleTransientDeployment(AzureClient client, String resourceGroupName, String deploymentName) { List<CloudResource> deployedResources = azureTransientDeploymentService.handleTransientDeployment(client, resourceGroupName, deploymentName); if (CollectionUtils.isNotEmpty(deployedResources)) { List<CloudResource> osDiskResources = getOsDiskResources(client, resourceGroupName, deployedResources); deployedResources.addAll(osDiskResources); } return deployedResources; }
Source:
public Void visit(Definition def, Void _) { super.visit(def, _); if (def.getMainSyntaxModule().equals(def.getMainModule())) { def.getModulesMap().get(def.getMainModule()).getModuleContext().addImportedModule(this.getCurrentDefinition().getModulesMap().get(Constants.AUTO_INCLUDED_MODULE)); moduleInclusion.addRelation(def.getModulesMap().get(def.getMainModule()).getName(), Constants.AUTO_INCLUDED_MODULE); } List<String> circuit = moduleInclusion.checkForCycles(); if (circuit != null) { String msg = "Found circularity in module imports: "; for (String moduleName : circuit) msg += moduleName + " < "; msg += circuit.get(0); throw KExceptionManager.compilerError(msg, this, def); } Set<Module> visited = new HashSet<>(); DFS(def.getModulesMap().get(def.getMainModule()), visited); return null; }

Target:
public Void visit(Definition def, Void _) { super.visit(def, _); Set<Module> visited = new HashSet<>(); DFS(def.getDefinitionContext().getModuleByName(def.getMainModule()), visited); return null; }
Source:
public Map<String, String> getAliasMap() { return aliases; }

Target:
public ImmutableMap<String, String> getAliasMap() { return aliases; }
Source:
public LoggingInterceptor(@NonNull Logger logger) { this.logger = logger; }

Target:
private LoggingInterceptor(@NonNull Logger logger) { this.logger = logger; }
Source:
public void run() throws OperationException { try { Class clazz = Class.forName(auditStorageClass); if (!AuditStorage.class.isAssignableFrom(clazz)) { throw new OperationException( "The class " + auditStorageClass + " does not implement the AuditStorage interface"); } AuditStorage auditStorage = (AuditStorage) clazz.getDeclaredConstructor().newInstance(); Logs auditBackend = (Logs) Framework.getService(AuditLogger.class); auditBackend.restore(auditStorage, batchSize, keepAlive); } catch (ReflectiveOperationException e) { throw new OperationException("Cannot create audit storage of type " + auditStorageClass, e); } }

Target:
public void run() { NXAuditEventsService audit = (NXAuditEventsService) Framework.getRuntime() .getComponent(NXAuditEventsService.NAME); auditBackend.restore(audit.getAuditStorage(auditStorageId), batchSize, keepAlive); }
Source:
public final void testSuccessfulConsumerStateTransition() throws Exception { ExecutorService directExecutorService = spy(executorService); doAnswer(invocation -> directlyExecuteRunnable(invocation)) .when(directExecutorService).execute(any()); ShardConsumer consumer = new ShardConsumer(recordsPublisher, directExecutorService, shardInfo, logWarningForTaskAfterMillis, shardConsumerArgument, blockedOnParentsState, t -> t, 1, taskExecutionListener, 0); mockSuccessfulUnblockOnParents(); mockSuccessfulInitializeWithFailureTransition(); mockSuccessfulProcessing(null); int arbitraryExecutionCount = 3; do { try { consumer.executeLifecycle(); } catch (Exception e) { } } while (--arbitraryExecutionCount > 0); assertEquals(ShardConsumerState.PROCESSING.consumerState().state(), consumer.currentState().state()); verify(directExecutorService, times(2)).execute(any()); }

Target:
public final void testSuccessfulConsumerStateTransition() throws Exception { ExecutorService directExecutorService = spy(executorService); doAnswer(invocation -> directlyExecuteRunnable(invocation)) .when(directExecutorService).execute(any()); ShardConsumer consumer = new ShardConsumer(recordsPublisher, directExecutorService, shardInfo, logWarningForTaskAfterMillis, shardConsumerArgument, blockedOnParentsState, t -> t, 1, taskExecutionListener, 0); mockSuccessfulUnblockOnParents(); mockSuccessfulInitializeWithFailureTransition(); mockSuccessfulProcessing(null); int arbitraryExecutionCount = 3; do { try { consumer.executeLifecycle(); } catch (Exception e) { fail("Unexpected exception while executing consumer lifecycle"); } } while (--arbitraryExecutionCount > 0); assertEquals(ShardConsumerState.PROCESSING.consumerState().state(), consumer.currentState().state()); verify(directExecutorService, times(2)).execute(any()); }
Source:
public void testRemoveObserver() throws CacheException { InfinispanPropertyCache cache = createCache(); CountingObserver observer = new CountingObserver(); Property<Integer> property = new Property<>("id1", 2); cache.store(null, property); cache.addObserver(null, "id1", observer); cache.store(null, new Property<>("id1", 34)); Assert.assertEquals(1, observer.updatedCounter.intValue()); cache.removeObserver(null, "id1", observer); cache.store(null, new Property<>("id1", 34)); Assert.assertEquals(1, observer.updatedCounter.intValue()); }

Target:
public void testRemoveObserver() throws CacheException { CountingObserver observer = new CountingObserver(); propertyCache.store(null, new Property<>("id1", 2)); propertyCache.addObserver(null, "id1", observer); propertyCache.store(null, new Property<>("id1", 34)); Assert.assertEquals(1, observer.updatedCounter.intValue()); propertyCache.removeObserver(null, "id1", observer); propertyCache.store(null, new Property<>("id1", 32)); Assert.assertEquals(1, observer.updatedCounter.intValue()); }
Source:
public void testUnsupportedKeyValueCollectionOperations() { final String key1 = "1", value1 = "one", key2 = "2", value2 = "two", key3 = "3", value3 = "three"; Map<String, String> m = new HashMap<>(); m.put(key1, value1); m.put(key2, value2); m.put(key3, value3); cache(0, "replSync").putAll(m); Set<Object> keys = cache(0, "replSync").keySet(); Collection<Object> values = cache(0, "replSync").values(); Collection[] collections = new Collection[]{keys, values}; Object newObj = new Object(); List newObjCol = new ArrayList(); newObjCol.add(newObj); for (Collection col : collections) { try { col.add(newObj); assert false : "Should have thrown a UnsupportedOperationException"; } catch (UnsupportedOperationException uoe) { } catch (ClassCastException e) { } try { col.addAll(newObjCol); assert false : "Should have thrown a UnsupportedOperationException"; } catch (UnsupportedOperationException uoe) { } } }

Target:
public void testUnsupportedKeyValueCollectionOperations() { final String key1 = "1", value1 = "one", key2 = "2", value2 = "two", key3 = "3", value3 = "three"; Map<String, String> m = new HashMap<>(); m.put(key1, value1); m.put(key2, value2); m.put(key3, value3); cache(0, "replSync").putAll(m); Set<Object> keys = cache(0, "replSync").keySet(); Collection<Object> values = cache(0, "replSync").values(); Collection[] collections = new Collection[]{keys, values}; Object newObj = new Object(); List newObjCol = new ArrayList(); newObjCol.add(newObj); for (Collection col : collections) { try { col.add(newObj); fail("Should have thrown a UnsupportedOperationException"); } catch (UnsupportedOperationException uoe) { } catch (ClassCastException e) { } try { col.addAll(newObjCol); fail("Should have thrown a UnsupportedOperationException"); } catch (UnsupportedOperationException uoe) { } } }
Source:
protected IRefreshMonitor createPollingMonitor(IResource resource) { PollingMonitor monitor = ((Workspace)resource.getWorkspace()).getRefreshManager().monitors.pollMonitor; monitor.monitor(resource); return monitor; }

Target:
protected IRefreshMonitor createPollingMonitor(IResource resource) { Workspace workspace = (Workspace) resource.getWorkspace(); RefreshManager refreshManager = workspace.getRefreshManager(); MonitorManager monitors = refreshManager.monitors; PollingMonitor pollingMonitor = monitors.pollMonitor; pollingMonitor.monitor(resource); return pollingMonitor; }
Source:
public PipelineStatus getPipelineStatus() { return new PipelineStatus(ImmutableList.copyOf(this.drivers)); }

Target:
public PipelineStatus getPipelineStatus() { return getPipelineStatus(ImmutableList.copyOf(drivers)); }
Source:
public String toString() { return "" + key; }

Target:
public String toString() { return Integer.toString(key); }
Source:
public void mountPathNotFoundTest() throws Exception { MockDataNodeId dataNode = clusterMap.getDataNodes().get(0); List<ReplicaId> replicas = clusterMap.getReplicaIds(dataNode); List<String> mountPaths = dataNode.getMountPaths(); String mountPathToDelete = mountPaths.get(RANDOM.nextInt(mountPaths.size())); deleteDirectory(new File(mountPathToDelete)); StorageManager storageManager = createAndStartStoreManager(replicas); for (ReplicaId replica : replicas) { if (replica.getMountPath().equals(mountPathToDelete)) { assertNull(storageManager.getStore(replica.getPartitionId())); } else { Store store = storageManager.getStore(replica.getPartitionId()); assertTrue("Store should be started", ((BlobStore) store).isStarted()); } } shutdownAndAssertStoresInaccessible(storageManager, replicas); }

Target:
public void mountPathNotFoundTest() throws Exception { MockDataNodeId dataNode = clusterMap.getDataNodes().get(0); List<ReplicaId> replicas = clusterMap.getReplicaIds(dataNode); List<String> mountPaths = dataNode.getMountPaths(); String mountPathToDelete = mountPaths.get(RANDOM.nextInt(mountPaths.size())); deleteDirectory(new File(mountPathToDelete)); StorageManager storageManager = createAndStartStoreManager(replicas); for (ReplicaId replica : replicas) { if (replica.getMountPath().equals(mountPathToDelete)) { assertNull("This store should not be accessible.", storageManager.getStore(replica.getPartitionId())); } else { Store store = storageManager.getStore(replica.getPartitionId()); assertTrue("Store should be started", ((BlobStore) store).isStarted()); } } shutdownAndAssertStoresInaccessible(storageManager, replicas); }
Source:
public void setValue(Object o) { n = (Integer)o; }

Target:
public void setValue(Object o) { if (o == null) { throw new NullPointerException("Attempt to set an IAnswerData class to null."); } n = (Integer)o; }
Source:
private Object putFromLoadInternal(Data key, Object value, long ttl, long maxIdle, boolean backup, Address callerAddress) { if (!isKeyAndValueLoadable(key, value)) { return null; } long now = getNow(); if (shouldEvict()) { return null; } markRecordStoreExpirable(ttl, maxIdle); Record record = getRecordOrNull(key, now, backup); Object oldValue = null; EntryEventType entryEventType; if (record == null) { value = mapServiceContext.interceptPut(interceptorRegistry, null, value); record = createRecord(key, value, ttl, maxIdle, now); storage.put(key, record); mutationObserver.onLoadRecord(key, record, backup); entryEventType = LOADED; } else { oldValue = record.getValue(); value = mapServiceContext.interceptPut(interceptorRegistry, oldValue, value); updateRecord(key, record, value, oldValue, now, true, ttl, maxIdle, false, null, backup); entryEventType = UPDATED; } if (!backup) { mapEventPublisher.publishEvent(callerAddress, name, entryEventType, key, oldValue, value); } return oldValue; }

Target:
private Object putFromLoadInternal(Data key, Object value, long ttl, long maxIdle, boolean backup, Address callerAddress) { if (!isKeyAndValueLoadable(key, value)) { return null; } long now = getNow(); if (shouldEvict()) { return null; } markRecordStoreExpirable(ttl, maxIdle); Record record = getRecordOrNull(key, now, backup); Object oldValue = null; EntryEventType entryEventType; if (record == null) { value = mapServiceContext.interceptPut(interceptorRegistry, null, value); record = createRecord(key, value, ttl, maxIdle, now); storage.put(key, record); mutationObserver.onLoadRecord(key, record, backup); entryEventType = LOADED; } else { oldValue = record.getValue(); value = mapServiceContext.interceptPut(interceptorRegistry, oldValue, value); updateRecord(key, record, oldValue, value, now, true, ttl, maxIdle, false, null, backup); entryEventType = UPDATED; } if (!backup) { mapEventPublisher.publishEvent(callerAddress, name, entryEventType, key, oldValue, value); } return oldValue; }
Source:
public void testValidationChecksumBuilderChecksumArtifactsNullFails() { final Builder builder = new ValidationChecksum.Builder().destination(checksumdirectory); final Artifact a1 = TestArtifactBuilder.testArtifact().groupId("org.apache.maven.plugins") .artifactId("maven-compiler-plugin").packaging("jar").version("1.0").build(); final Artifact a2 = TestArtifactBuilder.testArtifact().groupId("org.apache.commons").artifactId("commons-io") .packaging("jar").version("1.0").build(); assertThatThrownBy(() -> builder.artifacts(asList(a1, a2, null)).build()) .isExactlyInstanceOf(NullPointerException.class); }

Target:
public void testValidationChecksumBuilderChecksumArtifactsNullFails() { final Builder builder = new ValidationChecksum.Builder().destination(checksumdirectory); final Artifact a1 = TestArtifactBuilder.testArtifact().groupId("org.apache.maven.plugins") .artifactId("maven-compiler-plugin").packaging("jar").version("1.0").build(); final Artifact a2 = TestArtifactBuilder.testArtifact().groupId("org.apache.commons").artifactId("commons-io") .packaging("jar").version("1.0").build(); final List<Artifact> artifacts = asList(a1, a2, null); assertThatCode(() -> builder.artifacts(artifacts).build()) .isExactlyInstanceOf(NullPointerException.class); }
Source:
public void buildDelta(IResourceChangeDescriptionFactory builder) { if (fDeltaDescriptions == null) return; for (DeltaDescription deltaDescription : fDeltaDescriptions) { deltaDescription.buildDelta(builder); } }

Target:
public void buildDelta(IResourceChangeDescriptionFactory builder) { if (fDeltaDescriptions == null) return; for (DeltaDescription delta : fDeltaDescriptions) { delta.buildDelta(builder); } }
Source:
public Task updateTask(Task task) { task = taskDao.update(task); task.setHref(MessageFormat.format(systemPropertiesProvider.getProperty(SDC_MANAGER_URL)+ Configuration.TASK_BASE_PATH, Long.valueOf(task.getId()).toString(), task.getVdc())); return task; }

Target:
public Task updateTask(Task task) { task = taskDao.update(task); task.setHref(getHrefUrl(task)); return task; }
Source:
MakeBucketArgs(Builder builder) { super(builder); this.objectLock = builder.objectLock; }

Target:
private MakeBucketArgs(Builder builder) { super(builder); this.objectLock = builder.objectLock; }
Source:
private JRadioButtonMenuItem addZAPModeMenuItem(final Mode modeType){ final JRadioButtonMenuItem modeItem = new JRadioButtonMenuItem(""+Constant.messages.getString("view.toolbar.mode."+modeType.name()+".select")); modeItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { Control.getSingleton().setMode(modeType); if (View.isInitialised()){ View.getSingleton().getMainFrame().getMainToolbarPanel().setMode(modeType); } } }); return modeItem; }

Target:
private JRadioButtonMenuItem addZAPModeMenuItem(final Mode modeType){ final JRadioButtonMenuItem modeItem = new JRadioButtonMenuItem(Constant.messages.getString("view.toolbar.mode."+modeType.name()+".select")); modeItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { Control.getSingleton().setMode(modeType); if (View.isInitialised()){ View.getSingleton().getMainFrame().getMainToolbarPanel().setMode(modeType); } } }); return modeItem; }
Source:
private void performActionForServicesOfServer() { List<GlusterService> serviceList = getGlusterServiceDao().getByServiceType(serviceType); List<String> serviceListStr = new ArrayList<String>(); for (GlusterService srvc : serviceList) { serviceListStr.add(srvc.getServiceName()); } VDSReturnValue returnValue = null; returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(serverId, serviceListStr, actionType)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(manageActionDetailsMap.get(getParameters().getActionType()).getActionFailedActionLog(), returnValue.getVdsError().getMessage()); } else { VDS vds = new VDS(); vds.setStatus(VDSStatus.Up); Pair<VDS, VDSReturnValue> pairRetVal = new Pair<VDS, VDSReturnValue>(vds, returnValue); updateService(serverId, serviceList, pairRetVal); } }

Target:
private void performActionForServicesOfServer() { List<String> serviceList = getServiceList(); VDSReturnValue returnValue = null; returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(serverId, serviceList, actionType)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(manageActionDetailsMap.get(getParameters().getActionType()).getActionFailedActionLog(), returnValue.getVdsError().getMessage()); } else { updateService(serverId); } }
Source:
public FakeRequest(final int status, @NotNull(message = "HTTP reason can't be NULL") final String reason, @NotNull(message = "list of headers can't be NULL") final Collection<Map.Entry<String, String>> headers, final Map<Pattern, byte[]> bodies) { this.code = status; this.phrase = reason; this.hdrs = new Array<Map.Entry<String, String>>(headers); this.content = bodies; }

Target:
public FakeRequest(final int status, @NotNull(message = "HTTP reason can't be NULL") final String reason, @NotNull(message = "list of headers can't be NULL") final Collection<Map.Entry<String, String>> headers, final Map<Pattern, byte[]> bodies) { this.code = status; this.phrase = reason; this.hdrs = new Array<Map.Entry<String, String>>(headers); this.content = new ArrayMap<Pattern, byte[]>(bodies); }
Source:
public Duration getFullGcTime() { long endFullGcTimeNanos = this.endFullGcTimeNanos.get(); if (endFullGcTimeNanos == 0) { endFullGcTimeNanos = gcMonitor.getMajorGcTime().roundTo(NANOSECONDS); } return new Duration(max(0, endFullGcTimeNanos - startFullGcTimeNanos.get()), NANOSECONDS); }

Target:
public Duration getFullGcTime() { long startFullGcTimeNanos = this.startFullGcTimeNanos.get(); if (startFullGcTimeNanos < 0) { return new Duration(0, MILLISECONDS); } long endFullGcTimeNanos = this.endFullGcTimeNanos.get(); if (endFullGcTimeNanos < 0) { endFullGcTimeNanos = gcMonitor.getMajorGcTime().roundTo(NANOSECONDS); } return new Duration(max(0, endFullGcTimeNanos - startFullGcTimeNanos), NANOSECONDS); }
Source:
private void testSelectBeforeUpdate() { rebuildSessionFactory( ); TransactionUtil.doInHibernate( this::sessionFactory, session -> { final Person john = new Person( 1, "John", new Address() ); session.save( john ); final Person mary = new Person( 2, "Mary", null ); session.save( mary ); } ); TransactionUtil.doInHibernate( this::sessionFactory, session -> { final Person john = session.find( Person.class, 1 ); i.reset(); john.setAddress( null ); session.flush(); assertEquals( 0, i.getCalls() ); i.reset(); final Person mary = session.find( Person.class, 2 ); mary.setAddress( new Address() ); session.flush(); assertEquals( 0, i.getCalls() ); } ); final Person john = TransactionUtil.doInHibernate( this::sessionFactory, session -> { return session.get( Person.class, 1 ); } ); final Person mary = TransactionUtil.doInHibernate( this::sessionFactory, session -> { return session.get( Person.class, 2 ); } ); TransactionUtil.doInHibernate( this::sessionFactory, session -> { i.reset(); john.setAddress( null ); session.update( john ); session.flush(); assertEquals( 0, i.getCalls() ); i.reset(); mary.setAddress( new Address() ); session.update( mary ); session.flush(); assertEquals( 0, i.getCalls() ); } ); }

Target:
private void testSelectBeforeUpdate() { TransactionUtil.doInHibernate( this::sessionFactory, session -> { final Person john = new Person( 1, "John", new Address() ); session.save( john ); final Person mary = new Person( 2, "Mary", null ); session.save( mary ); } ); TransactionUtil.doInHibernate( this::sessionFactory, session -> { final Person john = session.find( Person.class, 1 ); i.reset(); john.setAddress( null ); session.flush(); assertEquals( 0, i.getCalls() ); i.reset(); final Person mary = session.find( Person.class, 2 ); mary.setAddress( new Address() ); session.flush(); assertEquals( 0, i.getCalls() ); } ); final Person john = TransactionUtil.doInHibernate( this::sessionFactory, session -> { return session.get( Person.class, 1 ); } ); final Person mary = TransactionUtil.doInHibernate( this::sessionFactory, session -> { return session.get( Person.class, 2 ); } ); TransactionUtil.doInHibernate( this::sessionFactory, session -> { i.reset(); john.setAddress( null ); session.update( john ); session.flush(); assertEquals( 0, i.getCalls() ); i.reset(); mary.setAddress( new Address() ); session.update( mary ); session.flush(); assertEquals( 0, i.getCalls() ); } ); }
Source:
protected Map<VmTemplate, List<DiskImage>> setUpTemplates(boolean notFound) { return IntStream.range(0, NAMES.length) .filter(x -> !notFound).boxed().collect(Collectors.toMap(this::getEntity, ArrayList::new)); }

Target:
protected Map<VmTemplate, List<DiskImage>> setUpTemplates(boolean notFound) { if (notFound) { return Collections.emptyMap(); } return IntStream.range(0, NAMES.length).boxed().collect(Collectors.toMap(this::getEntity, ArrayList::new)); }
Source:
private void deleteProjectPreferences(ProjectDeletedEvent event) { this.modelCache.invalidate(event.getProject().getName()); deleteModel(event.getProject()); }

Target:
private void deleteProjectPreferences(ProjectDeletedEvent event) { deleteModel(event.getProject()); }
Source:
private void registerErrorsAndWarningsFromValidationReport(final HttpServletResponse resp, final Map<String, String> ret, final Map<String, ValidationReport> reports) { final StringBuffer errorMsgs = new StringBuffer(); final StringBuffer warnMsgs = new StringBuffer(); for (final Entry<String, ValidationReport> reportEntry : reports.entrySet()) { final ValidationReport report = reportEntry.getValue(); for (final String msg : report.getInfoMsgs()) { switch (ValidationReport.getInfoMsgLevel(msg)) { case ERROR: errorMsgs.append(ValidationReport.getInfoMsg(msg) + "<br/>"); break; case WARN: warnMsgs.append(ValidationReport.getInfoMsg(msg) + "<br/>"); break; default: break; } } if (!report.getErrorMsgs().isEmpty()) { errorMsgs.append("Validator " + reportEntry.getKey() + " reports errors:<ul>"); for (final String msg : report.getErrorMsgs()) { errorMsgs.append("<li>" + msg + "</li>"); } errorMsgs.append("</ul>"); } if (!report.getWarningMsgs().isEmpty()) { warnMsgs.append("Validator " + reportEntry.getKey() + " reports warnings:<ul>"); for (final String msg : report.getWarningMsgs()) { warnMsgs.append("<li>" + msg + "</li>"); } warnMsgs.append("</ul>"); } } if (errorMsgs.length() > 0) { registerError(ret, errorMsgs.length() > 4000 ? errorMsgs.substring(0, 4000) : errorMsgs.toString(), resp, 500); } if (warnMsgs.length() > 0) { ret.put("warn", warnMsgs.length() > 4000 ? warnMsgs.substring(0, 4000) : warnMsgs.toString()); } }

Target:
private void registerErrorsAndWarningsFromValidationReport(final HttpServletResponse resp, final Map<String, String> ret, final Map<String, ValidationReport> reports) { final StringBuffer errorMsgs = new StringBuffer(); final StringBuffer warnMsgs = new StringBuffer(); for (final Entry<String, ValidationReport> reportEntry : reports.entrySet()) { final ValidationReport report = reportEntry.getValue(); for (final String msg : report.getInfoMsgs()) { switch (ValidationReport.getInfoMsgLevel(msg)) { case ERROR: errorMsgs.append(ValidationReport.getInfoMsg(msg) + "<br/>"); break; case WARN: warnMsgs.append(ValidationReport.getInfoMsg(msg) + "<br/>"); break; default: break; } } if (!report.getErrorMsgs().isEmpty()) { errorMsgs.append("Validator " + reportEntry.getKey() + " reports errors:<ul>"); for (final String msg : report.getErrorMsgs()) { errorMsgs.append("<li>" + msg + "</li>"); } errorMsgs.append("</ul>"); } if (!report.getWarningMsgs().isEmpty()) { warnMsgs.append("Validator " + reportEntry.getKey() + " reports warnings:<ul>"); for (final String msg : report.getWarningMsgs()) { warnMsgs.append("<li>" + msg + "</li>"); } warnMsgs.append("</ul>"); } } if (errorMsgs.length() > 0) { registerError(ret, errorMsgs.length() > 4000 ? errorMsgs.substring(0, 4000) : errorMsgs.toString(), resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (warnMsgs.length() > 0) { ret.put("warn", warnMsgs.length() > 4000 ? warnMsgs.substring(0, 4000) : warnMsgs.toString()); } }
Source:
public String getPrivateKeyAsHex(){ return getPrivKey().toString(16); }

Target:
public String getPrivateKeyAsHex() { return Utils.HEX.encode(getPrivKeyBytes()); }
Source:
public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); SimpleTiledWriter tiledWriter = new SimpleTiledWriter(args[0], args[1], tileSizeX, tileSizeY); tiledWriter.readWriteTiles(); tiledWriter.cleanup(); }

Target:
public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); SimpleTiledWriter tiledWriter = new SimpleTiledWriter(args[0], args[1], tileSizeX, tileSizeY); tiledWriter.initialize(); try { tiledWriter.readWriteTiles(); } catch(Exception e) { System.err.println("Failed to read and write tiles."); e.printStackTrace(); throw e; } finally { tiledWriter.cleanup(); } }
Source:
private synchronized int getUseSessionTimeoutMs() { int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; useSessionTimeoutMs = sessionExpirationPercent > 0 && startOfSuspendedEpoch != 0 ? (useSessionTimeoutMs * sessionExpirationPercent) / 100 : useSessionTimeoutMs; return useSessionTimeoutMs; }

Target:
private int getUseSessionTimeoutMs() { int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; useSessionTimeoutMs = sessionExpirationPercent > 0 && startOfSuspendedEpoch != 0 ? (useSessionTimeoutMs * sessionExpirationPercent) / 100 : useSessionTimeoutMs; return useSessionTimeoutMs; }
Source:
public int compareOrder(NodeInfo other) { int result = 0; if (other != null) { result = getRootDepth(this) - getRootDepth(other); } if (result == 0 && other instanceof ElementNode) { result = indexAmongSiblings - ((ElementNode) other).indexAmongSiblings; } return result; }

Target:
public int compareOrder(NodeInfo other) { int result = 0; if (other instanceof AbstractNode) { result = getDepth() - ((AbstractNode) other).getDepth(); if (result == 0) { final ElementNode[] children = getCommonAncestorChildren(other); result = children[0].indexAmongSiblings - children[1].indexAmongSiblings; } } return result; }
Source:
void calculatePercentageFrequencyAndAverage() { percentageFrequencyAndAverage = new float[numOfRubricSubQuestions][numOfRubricChoices + 1]; for (int i = 0; i < percentageFrequencyAndAverage.length; i++) { int totalForSubQuestion = responseFrequency[i][responseTotalIndex]; if (totalForSubQuestion == 0) { continue; } for (int j = 0; j < numOfRubricChoices; j++) { percentageFrequencyAndAverage[i][j] = (float) responseFrequency[i][j] / totalForSubQuestion; } if (questionDetails.hasAssignedWeights) { for (int j = 0; j < numOfRubricChoices; j++) { float choiceWeight = (float) (questionDetails.rubricWeights.get(j) * percentageFrequencyAndAverage[i][j]); percentageFrequencyAndAverage[i][numOfRubricChoices] += choiceWeight; } } } }

Target:
void calculatePercentageFrequencyAndAverage() { Assumption.assertNotNull("Response Frequency should be initialised and calculated first.", responseFrequency); percentageFrequencyAndAverage = new float[numOfRubricSubQuestions][numOfRubricChoices + 1]; for (int i = 0; i < percentageFrequencyAndAverage.length; i++) { int totalForSubQuestion = responseFrequency[i][responseTotalIndex]; if (totalForSubQuestion == 0) { continue; } for (int j = 0; j < numOfRubricChoices; j++) { percentageFrequencyAndAverage[i][j] = (float) responseFrequency[i][j] / totalForSubQuestion; } if (questionDetails.hasAssignedWeights) { for (int j = 0; j < numOfRubricChoices; j++) { float choiceWeight = (float) (questionDetails.rubricWeights.get(j) * percentageFrequencyAndAverage[i][j]); percentageFrequencyAndAverage[i][numOfRubricChoices] += choiceWeight; } } } }
Source:
private int getApproximateReadByteCount(Map<ByteBuffer, List<ColumnOrSuperColumn>> result) { return result.entrySet().stream() .mapToInt((entry) -> entry.getKey().array().length + entry.getValue().stream() .mapToInt(columnOrSuperColumn -> SerializationUtils.serialize(columnOrSuperColumn).length) .sum()) .sum(); }

Target:
private long getApproximateReadByteCount(Map<ByteBuffer, List<ColumnOrSuperColumn>> result) { return getCollectionSize(result.entrySet(), rowResult -> ThriftObjectSizeUtils.getByteBufferSize(rowResult.getKey()) + getCollectionSize(rowResult.getValue(), ThriftObjectSizeUtils::getColumnOrSuperColumnSize)); }
Source:
private static String verifyXmlrpcUrl(final String siteUrl, final String httpUsername, final String httpPassword) throws XMLRPCUtilsException { final Set<String> urlsToTry = new LinkedHashSet<>(); final String sanitizedSiteUrlHttps = XMLRPCUtils.sanitizeSiteUrl(siteUrl, true); urlsToTry.add(XMLRPCUtils.appendXMLRPCPath(sanitizedSiteUrlHttps)); urlsToTry.add(sanitizedSiteUrlHttps); final String sanitizedSiteUrlHttp = XMLRPCUtils.sanitizeSiteUrl(siteUrl, false); urlsToTry.add(XMLRPCUtils.appendXMLRPCPath(sanitizedSiteUrlHttp)); urlsToTry.add(sanitizedSiteUrlHttp); urlsToTry.add(siteUrl); AppLog.i(AppLog.T.NUX, "The app will call system.listMethods on the following URLs: " + urlsToTry); for (String url : urlsToTry) { try { if (XMLRPCUtils.checkXMLRPCEndpointValidity(url, httpUsername, httpPassword)) { return url; } } catch (XMLRPCUtilsException e) { continue; } catch (RuntimeException re) { continue; } } return null; }

Target:
private static String verifyXmlrpcUrl(final String siteUrl, final String httpUsername, final String httpPassword) throws XMLRPCUtilsException { final Set<String> urlsToTry = new LinkedHashSet<>(); final String sanitizedSiteUrlHttps = XMLRPCUtils.sanitizeSiteUrl(siteUrl, true); final String sanitizedSiteUrlHttp = XMLRPCUtils.sanitizeSiteUrl(siteUrl, false); urlsToTry.add(XMLRPCUtils.appendXMLRPCPath(sanitizedSiteUrlHttp)); urlsToTry.add(XMLRPCUtils.appendXMLRPCPath(sanitizedSiteUrlHttps)); urlsToTry.add(sanitizedSiteUrlHttp); urlsToTry.add(sanitizedSiteUrlHttps); urlsToTry.add(siteUrl); AppLog.i(AppLog.T.NUX, "The app will call system.listMethods on the following URLs: " + urlsToTry); for (String url : urlsToTry) { try { if (XMLRPCUtils.checkXMLRPCEndpointValidity(url, httpUsername, httpPassword)) { return url; } } catch (XMLRPCUtilsException e) { if (e.kind == XMLRPCUtilsException.Kind.ERRONEOUS_SSL_CERTIFICATE || e.kind == XMLRPCUtilsException.Kind.HTTP_AUTH_REQUIRED || e.kind == XMLRPCUtilsException.Kind.MISSING_XMLRPC_METHOD) { throw e; } continue; } catch (RuntimeException re) { continue; } } return null; }
Source:
public static Message parse(byte[] array) { String[] message = new String(array, UTF8).split("\n"); Message result = new Message(); Command parsedCommand = Command.valueOf(message[0]); result.setCommand(parsedCommand.toString()); Map<String, String> headers = new HashMap<>(); int i = 1; String currentLine = message[i]; while (currentLine.length() > 0) { int ind = currentLine.indexOf(':'); String key = currentLine.substring(0, ind); String value = currentLine.substring(ind + 1, currentLine.length()); headers.put(key, value); currentLine = message[++i]; } result.withHeaders(headers); result.withContent(getContent(array, message, ++i)); return result; }

Target:
public static Message parse(byte[] array) { String[] message = new String(array, UTF8).split("\n"); Message result = new Message(); Command parsedCommand = Command.valueOf(message[0]); result.setCommand(parsedCommand.toString()); Map<String, String> headers = new HashMap<>(); int i = 1; String currentLine = message[i]; while (currentLine.length() > 0) { int ind = currentLine.indexOf(':'); String key = currentLine.substring(0, ind); String value = currentLine.substring(ind + 1, currentLine.length()); headers.put(key, value); currentLine = message[++i]; } result.withHeaders(headers); i = i + 1; result.withContent(getContent(array, message, i)); return result; }