auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void checkParameterTypes(String methodName, Class[] parameterTypes, String methodAnnotation, String[] parameterNames) { int totalLength = parameterTypes.length; Set<Class> injectedTypes = new HashSet<Class>() { private static final long serialVersionUID = -5324894581793435812L; { add(ITestContext.class); add(ITestResult.class); add(XmlTest.class); add(Method.class); add(Object[].class); }}; for (Class parameterType : parameterTypes) { if (injectedTypes.contains(parameterType)) { totalLength--; } } if ((parameterNames.length == 0)) { String annotation = methodAnnotation; if (!methodAnnotation.startsWith("@")) { annotation = "@" + methodAnnotation; } boolean invalid = (totalLength != 0) || (!validParameters(methodAnnotation, parameterTypes)); if (invalid) { String errPrefix = "Cannot inject " + annotation + " annotated Method [" + methodName + "] with " + Arrays.toString(parameterTypes); if (mapping.containsKey(methodAnnotation) ) { errPrefix = "Can inject only one of " + prettyFormat(mapping.get(methodAnnotation)) + " into a " + annotation + " annotated " + methodName; } throw new TestNGException(errPrefix + ".\nFor more information on native dependency injection please refer to " + "<LINK_0>" ); } } if (parameterNames.length != totalLength) { throw new TestNGException( "Method " + methodName + " requires " + parameterTypes.length + " parameters but " + parameterNames.length + " were supplied in the " + methodAnnotation + " annotation."); } }

Target:
private static void checkParameterTypes(String methodName, Class[] parameterTypes, String methodAnnotation, String[] parameterNames) { int totalLength = parameterTypes.length; Set<Class> injectedTypes = new HashSet<Class>() { private static final long serialVersionUID = -5324894581793435812L; { add(ITestContext.class); add(ITestResult.class); add(XmlTest.class); add(Method.class); add(Object[].class); }}; for (Class parameterType : parameterTypes) { if (injectedTypes.contains(parameterType)) { totalLength--; } } if (parameterNames.length == 0) { boolean invalid = (totalLength != 0) || (!validParameters(methodAnnotation, parameterTypes)); if (invalid) { String annotation = methodAnnotation; if (!methodAnnotation.startsWith("@")) { annotation = "@" + methodAnnotation; } String errPrefix; if (mapping.containsKey(methodAnnotation)) { errPrefix = "Can inject only one of " + prettyFormat(mapping.get(methodAnnotation)) + " into a " + annotation + " annotated " + methodName; } else { errPrefix = "Cannot inject " + annotation + " annotated Method [" + methodName + "] with " + Arrays.toString(parameterTypes); } throw new TestNGException(errPrefix + ".\nFor more information on native dependency injection please refer to " + "<LINK_0>" ); } } if (parameterNames.length != totalLength) { throw new TestNGException( "Method " + methodName + " requires " + parameterTypes.length + " parameters but " + parameterNames.length + " were supplied in the " + methodAnnotation + " annotation."); } }
Source:
public void testAddUserToOrgs() { ApiClient client = getWebClient(USER_2_USERNAME, testingPostgres); UsersApi userApi = new UsersApi(client); List<Workflow> workflows = userApi.refreshWorkflowsByOrganization((long)1, "DockstoreTestUser"); long numberOfWorkflows = workflows.size(); testingPostgres.runUpdateStatement("delete from user_entry where entryid = 951"); long newNumberOfWorkflows = userApi.userWorkflows((long)1).size(); assertEquals("Should have one less workflow", numberOfWorkflows - 1, newNumberOfWorkflows); newNumberOfWorkflows= userApi.addUserToDockstoreWorkflows().size(); assertEquals("Should have the original number of workflows", numberOfWorkflows, newNumberOfWorkflows); }

Target:
public void testAddUserToOrgs() { io.dockstore.openapi.client.ApiClient client = getOpenAPIWebClient(USER_2_USERNAME, testingPostgres); io.dockstore.openapi.client.api.UsersApi userApi = new io.dockstore.openapi.client.api.UsersApi(client); List<io.dockstore.openapi.client.model.Workflow> workflows = userApi.refreshWorkflowsByOrganization((long)1, "DockstoreTestUser"); long numberOfWorkflows = workflows.size(); testingPostgres.runUpdateStatement("delete from user_entry where entryid = 951"); long newNumberOfWorkflows = userApi.userWorkflows((long)1).size(); assertEquals("Should have one less workflow", numberOfWorkflows - 1, newNumberOfWorkflows); workflows = userApi.addUserToDockstoreWorkflows((long)1, ""); newNumberOfWorkflows = workflows.size(); assertEquals("Should have the original number of workflows", numberOfWorkflows, newNumberOfWorkflows); assertTrue("Should have the workflow DockstoreTestUser/dockstore-whalesay-2", workflows.stream().anyMatch(workflow -> Objects.equals("dockstore-whalesay-2", workflow.getRepository()) && Objects.equals("DockstoreTestUser", workflow.getOrganization()))); }
Source:
private static void removePermissionsFile(Project project) { File permissionsFile = new File(project.getDirectory(), "permissions.txt"); if (permissionsFile.exists()) { permissionsFile.delete(); } }

Target:
public static void removePermissionsFile(Project project) { File permissionsFile = new File(project.getDirectory(), PERMISSIONS_FILE_NAME); if (permissionsFile.exists()) { permissionsFile.delete(); } }
Source:
public String url() { return scheme + path; }

Target:
public String url() { return String.format("%s://%s", scheme, path); }
Source:
public byte[] getDataFromService(KM200Device device, String service) { byte[] responseBodyB64 = null; HttpClient client = new HttpClient(); GetMethod method = new GetMethod("http://" + device.getIP4Address() + service); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); method.setRequestHeader("Accept", "application/json"); method.addRequestHeader("User-Agent", "TeleHeater/2.2.3"); try { int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { String statusLine = method.getStatusLine().toString(); if (statusLine.contains(" 403 ")) { byte[] test = new byte[1]; return test; } else { logger.error("HTTP GET failed: " + method.getStatusLine()); return null; } } device.setCharSet(method.getResponseCharSet()); responseBodyB64 = ByteStreams.toByteArray(method.getResponseBodyAsStream()); } catch (HttpException e) { logger.error("Fatal protocol violation: " + e.getMessage()); e.printStackTrace(); } catch (IOException e) { logger.error("Fatal transport error: " + e.getMessage()); e.printStackTrace(); } finally { method.releaseConnection(); } return responseBodyB64; }

Target:
public byte[] getDataFromService(KM200Device device, String service) { byte[] responseBodyB64 = null; if (client == null) { client = new HttpClient(); } GetMethod method = new GetMethod("http://" + device.getIP4Address() + service); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); method.setRequestHeader("Accept", "application/json"); method.addRequestHeader("User-Agent", "TeleHeater/2.2.3"); try { int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { String statusLine = method.getStatusLine().toString(); if (statusLine.contains(" 403 ")) { byte[] test = new byte[1]; return test; } else { logger.error("HTTP GET failed: {}", method.getStatusLine()); return null; } } device.setCharSet(method.getResponseCharSet()); responseBodyB64 = ByteStreams.toByteArray(method.getResponseBodyAsStream()); } catch (HttpException e) { logger.error("Fatal protocol violation: {}", e); e.printStackTrace(); } catch (IOException e) { logger.error("Fatal transport error: {}", e); e.printStackTrace(); } finally { method.releaseConnection(); } return responseBodyB64; }
Source:
private void placeYinYang(CoreChunk chunk, Vector3i yinYangPosition) { for (int i = -RADIUS; i <= RADIUS; i++) { for (int j = -2 * RADIUS; j <= 2 * RADIUS; j++) { String blockString = pixel(j, i, RADIUS); Vector3i chunkBlockPosition = new Vector3i(i, 0, j).add(yinYangPosition); if (chunk.getRegion().contains(chunkBlockPosition)) { chunk.setBlock(ChunkMath.calcRelativeBlockPos(chunkBlockPosition, new Vector3i()), getBlock(blockString)); } } } }

Target:
private void placeYinYang(CoreChunk chunk, Vector3i yinYangPosition) { Vector3i tempPos = new Vector3i(); for (int i = -RADIUS; i <= RADIUS; i++) { for (int j = -2 * RADIUS; j <= 2 * RADIUS; j++) { String blockString = pixel(j, i, RADIUS); Vector3i chunkBlockPosition = new Vector3i(i, 0, j).add(yinYangPosition); if (chunk.getRegion().contains(chunkBlockPosition)) { chunk.setBlock(ChunkMath.calcRelativeBlockPos(chunkBlockPosition, tempPos), getBlock(blockString)); } } } }
Source:
public boolean supportsAtomicCreateNewFile() { if (supportsAtomicCreateNewFile == AtomicFileCreation.UNDEFINED) { determineAtomicFileCreationSupport(); if (supportsAtomicCreateNewFile == AtomicFileCreation.UNDEFINED) { supportsAtomicCreateNewFile = AtomicFileCreation.SUPPORTED; } } return supportsAtomicCreateNewFile == AtomicFileCreation.SUPPORTED; }

Target:
public boolean supportsAtomicCreateNewFile() { if (supportsAtomicCreateNewFile == AtomicFileCreation.UNDEFINED) { determineAtomicFileCreationSupport(); } return supportsAtomicCreateNewFile == AtomicFileCreation.SUPPORTED; }
Source:
public boolean isStopped() { return stopRequested && activeSyncs.size() == 0; }

Target:
public boolean isStopped() { return this.state == State.STOPPED; }
Source:
public LzfEncoder(boolean safeInstance, int totalLength, int compressThreshold) { super(false); if (totalLength < MIN_BLOCK_TO_COMPRESS || totalLength > MAX_CHUNK_LEN) { throw new IllegalArgumentException("totalLength: " + totalLength + " (expected: " + MIN_BLOCK_TO_COMPRESS + '-' + MAX_CHUNK_LEN + ')'); } setCompressThreshold(compressThreshold); this.encoder = safeInstance ? ChunkEncoderFactory.safeNonAllocatingInstance(totalLength) : ChunkEncoderFactory.optimalNonAllocatingInstance(totalLength); this.recycler = BufferRecycler.instance(); }

Target:
public LzfEncoder(boolean safeInstance, int totalLength, int compressThreshold) { super(false); if (totalLength < MIN_BLOCK_TO_COMPRESS || totalLength > MAX_CHUNK_LEN) { throw new IllegalArgumentException("totalLength: " + totalLength + " (expected: " + MIN_BLOCK_TO_COMPRESS + '-' + MAX_CHUNK_LEN + ')'); } if (compressThreshold < MIN_BLOCK_TO_COMPRESS) { throw new IllegalArgumentException("compressThreshold:" + compressThreshold + " expected >=" + MIN_BLOCK_TO_COMPRESS); } this.compressThreshold = compressThreshold; this.encoder = safeInstance ? ChunkEncoderFactory.safeNonAllocatingInstance(totalLength) : ChunkEncoderFactory.optimalNonAllocatingInstance(totalLength); this.recycler = BufferRecycler.instance(); }
Source:
public String[] profilesToActivate() { if (topicExpression != null) { return new String[] { TOPIC_EXPRESSION_PROFILE }; } else if (topic != null) { this.topicExpression = "'" + this.topic + "'"; return new String[] { TOPIC_EXPRESSION_PROFILE }; } else if (queueExpression != null) { return new String[] { QUEUE_EXPRESSION_PROFILE }; } else if (queue != null) { this.queueExpression = "'" + this.queue + "'"; return new String[] { QUEUE_EXPRESSION_PROFILE }; } else if (keyExpression != null) { return new String[] { STORE_EXPRESSION_PROFILE }; } else if (key != null) { this.keyExpression = "'" + this.key + "'"; return new String[] { STORE_EXPRESSION_PROFILE }; } return new String[] {}; }

Target:
public String[] profilesToActivate() { if (topicExpression != null) { return new String[] { TOPIC_EXPRESSION_PROFILE }; } else if (queueExpression != null) { return new String[] { QUEUE_EXPRESSION_PROFILE }; } else if (keyExpression != null) { return new String[] { STORE_EXPRESSION_PROFILE }; } return new String[] {}; }
Source:
public void registerOperationsGroup(String name, Set<Operation> operations) { if (groupOperationsMap.containsKey(name)) { return; } for (Map.Entry<String, Set<Operation>> entry : groupOperationsMap.entrySet()) { for (Operation operation : operations) { if (entry.getValue().contains(operation)) { return; } } } groupOperationsMap.put(name, operations); for (Operation operation : operations) { ensure(operation.id); operationGroupMap.put(operation, name); } }

Target:
public void registerOperationsGroup(String name, Set<Operation> operations) { if (groupOperationsMap.containsKey(name)) { throw new IllegalArgumentException("Group with name " + name + " already exists"); } for (Map.Entry<String, Set<Operation>> entry : groupOperationsMap.entrySet()) { for (Operation operation : operations) { if (entry.getValue().contains(operation)) { throw new IllegalArgumentException("Operation " + operation + " is already included in group " + entry.getKey()); } } } groupOperationsMap.put(name, operations); for (Operation operation : operations) { ensure(operation.id); operationGroupMap.put(operation, name); } }
Source:
public Map<Errors, Integer> errorCounts() { return errorCounts(data.topics().stream().flatMap(topicResult -> topicResult.partitions().stream()) .map(partitionResult -> Errors.forCode(partitionResult.errorCode()))); }

Target:
public Map<Errors, Integer> errorCounts() { return errorCounts(data.topics().stream().flatMap(topicResult -> topicResult.partitions().stream().map(partitionResult -> Errors.forCode(partitionResult.errorCode())))); }
Source:
private void setMerged(Change c, ChangeMessage msg) throws OrmException, IOException { logDebug("Setting change merged", c.getId()); ChangeUpdate update = null; PatchSetApproval submitter; PatchSet merged; try { db.changes().beginTransaction(c.getId()); CodeReviewCommit commit = commits.get(c.getId()); PatchSet.Id mergedId = commit.change().currentPatchSetId(); merged = db.patchSets().get(mergedId); c = setMergedPatchSet(c.getId(), mergedId); submitter = approvalsUtil.getSubmitter(db, commit.notes(), mergedId); ChangeControl control = commit.getControl(); update = updateFactory.create(control, c.getLastUpdatedOn()); if (msg != null) { cmUtil.addChangeMessage(db, update, msg); } db.commit(); } finally { db.rollback(); } sendMergedEmail(c, submitter); indexer.index(db, c); if (submitter != null) { try { hooks.doChangeMergedHook(c, accountCache.get(submitter.getAccountId()).getAccount(), merged, db); } catch (OrmException ex) { logError("Cannot run hook for submitted patch set " + c.getId(), ex); } } update.commit(); }

Target:
private void setMerged(Change c, ChangeMessage msg) throws OrmException, IOException { logDebug("Setting change merged", c.getId()); ChangeUpdate update = null; PatchSetApproval submitter; PatchSet merged; try { db.changes().beginTransaction(c.getId()); CodeReviewCommit commit = commits.get(c.getId()); PatchSet.Id mergedId = commit.change().currentPatchSetId(); merged = db.patchSets().get(mergedId); c = setMergedPatchSet(c.getId(), mergedId); submitter = approvalsUtil.getSubmitter(db, commit.notes(), mergedId); ChangeControl control = commit.getControl(); update = updateFactory.create(control, c.getLastUpdatedOn()); if (msg != null) { cmUtil.addChangeMessage(db, update, msg); } db.commit(); } finally { db.rollback(); } update.commit(); sendMergedEmail(c, submitter); indexer.index(db, c); if (submitter != null) { try { hooks.doChangeMergedHook(c, accountCache.get(submitter.getAccountId()).getAccount(), merged, db); } catch (OrmException ex) { logError("Cannot run hook for submitted patch set " + c.getId(), ex); } } }
Source:
public void setUp() throws Exception { directory = FileUtilities.createTemporaryDirectory("directory"); entries = new FileEntry[3]; entries[0] = new FileEntry("foo.c", "foo.c", 0, 112, null); entries[1] = new FileEntry("bar.h", "bar.h", Long.MAX_VALUE, 0, null); entries[2] = new FileEntry("subdir", "subdir/", 0, DIRECTORY_INTERNAL_SIZE, Arrays.asList( new FileEntry[]{ new FileEntry("SCCS", "SCCS", 0, DIRECTORY_INTERNAL_SIZE, Arrays.asList( new FileEntry[]{ new FileEntry("version", "version", 0, 312, null) }) )} )); for (FileEntry entry : entries) { entry.create(); } FileEntry hgtags = new FileEntry(".hgtags", ".hgtags", 0, 1, null); hgtags.create(); RuntimeEnvironment env = RuntimeEnvironment.getInstance(); RepositoryFactory.setIgnored(env); }

Target:
public void setUp() throws Exception { directory = FileUtilities.createTemporaryDirectory("directory"); entries = new FileEntry[3]; entries[0] = new FileEntry("foo.c", "foo.c", 0, 112); entries[1] = new FileEntry("bar.h", "bar.h", Long.MAX_VALUE, 0); entries[2] = new FileEntry("subdir", "subdir/", 0, Arrays.asList( new FileEntry[]{ new FileEntry("SCCS", "SCCS/", 0, Arrays.asList( new FileEntry[]{ new FileEntry("version", "version", 0, 312) }) )} )); for (FileEntry entry : entries) { entry.create(); } FileEntry hgtags = new FileEntry(".hgtags", ".hgtags", 0, 1); hgtags.create(); RuntimeEnvironment env = RuntimeEnvironment.getInstance(); RepositoryFactory.setIgnored(env); }
Source:
DivXmlElementAccess(DivType div, Mets mets, Map<String, List<FileXmlElementAccess>> mediaUnitsMap, int parentOrder) { super(); super.setLabel(div.getLABEL()); for (Object mdSecType : div.getDMDID()) { super.getMetadata().addAll(readMetadata((MdSecType) mdSecType, MdSec.DMD_SEC)); } for (Object mdSecType : div.getADMID()) { super.getMetadata().addAll(readMetadata((MdSecType) mdSecType, amdSecTypeOf(mets, (MdSecType) mdSecType))); } metsReferrerId = div.getID(); BigInteger order = div.getORDER(); if (Objects.nonNull(order) && order.intValue() > 0) { super.setOrder(order.intValue()); } else if (parentOrder > 0) { super.setOrder(parentOrder); } else { super.setOrder(1); } super.setOrderlabel(div.getORDERLABEL()); for (DivType child : div.getDiv()) { super.getChildren().add(new DivXmlElementAccess(child, mets, mediaUnitsMap, super.getOrder())); } super.setType(div.getTYPE()); List<FileXmlElementAccess> fileXmlElementAccesses = mediaUnitsMap.get(div.getID()); if (Objects.nonNull(fileXmlElementAccesses)) { for (FileXmlElementAccess fileXmlElementAccess : fileXmlElementAccesses) { if (Objects.nonNull(fileXmlElementAccess) && !fileXmlElementAccessIsLinkedToChildren(fileXmlElementAccess, div.getDiv(), mediaUnitsMap)) { super.getViews().add(new AreaXmlElementAccess(fileXmlElementAccess).getView()); fileXmlElementAccess.getMediaUnit().getIncludedStructuralElements().add(this); } } } super.setLink(MptrXmlElementAccess.getLinkFromDiv(div)); }

Target:
DivXmlElementAccess(DivType div, Mets mets, Map<String, List<FileXmlElementAccess>> mediaUnitsMap, int parentOrder) { super(); super.setLabel(div.getLABEL()); for (Object mdSecType : div.getDMDID()) { super.getMetadata().addAll(readMetadata((MdSecType) mdSecType, MdSec.DMD_SEC)); } for (Object mdSecType : div.getADMID()) { super.getMetadata().addAll(readMetadata((MdSecType) mdSecType, amdSecTypeOf(mets, (MdSecType) mdSecType))); } metsReferrerId = div.getID(); BigInteger order = div.getORDER(); if (Objects.nonNull(order) && order.intValue() > 0) { setOrder(order.intValue()); } else if (parentOrder > 0) { setOrder(parentOrder); } else { setOrder(1); } super.setOrderlabel(div.getORDERLABEL()); for (DivType child : div.getDiv()) { getChildren().add(new DivXmlElementAccess(child, mets, mediaUnitsMap, getOrder())); } super.setType(div.getTYPE()); List<FileXmlElementAccess> fileXmlElementAccesses = mediaUnitsMap.get(div.getID()); if (Objects.nonNull(fileXmlElementAccesses)) { for (FileXmlElementAccess fileXmlElementAccess : fileXmlElementAccesses) { if (Objects.nonNull(fileXmlElementAccess) && !fileXmlElementAccessIsLinkedToChildren(fileXmlElementAccess, div.getDiv(), mediaUnitsMap)) { super.getViews().add(new AreaXmlElementAccess(fileXmlElementAccess).getView()); fileXmlElementAccess.getMediaUnit().getIncludedStructuralElements().add(this); } } } super.setLink(MptrXmlElementAccess.getLinkFromDiv(div)); }
Source:
public void testSuperIsSuper() throws Exception { ZooKeeper zk = createClient(); try { zk.create("/digest_read", null, Arrays.asList(new ACL(Perms.READ, otherDigestUser)), CreateMode.PERSISTENT); zk.create("/digest_read/sub", null, Arrays.asList(new ACL(Perms.READ, otherDigestUser)), CreateMode.PERSISTENT); zk.create("/sasl_read", null, Arrays.asList(new ACL(Perms.READ, otherSaslUser)), CreateMode.PERSISTENT); zk.create("/sasl_read/sub", null, Arrays.asList(new ACL(Perms.READ, otherSaslUser)), CreateMode.PERSISTENT); zk.delete("/digest_read/sub", -1); zk.delete("/digest_read", -1); zk.delete("/sasl_read/sub", -1); zk.delete("/sasl_read", -1); Thread.sleep(1000); } finally { zk.close(); } }

Target:
public void testSuperIsSuper() throws Exception { ZooKeeper zk = createClient(); try { zk.create("/digest_read", null, Arrays.asList(new ACL(Perms.READ, otherDigestUser)), CreateMode.PERSISTENT); zk.create("/digest_read/sub", null, Arrays.asList(new ACL(Perms.READ, otherDigestUser)), CreateMode.PERSISTENT); zk.create("/sasl_read", null, Arrays.asList(new ACL(Perms.READ, otherSaslUser)), CreateMode.PERSISTENT); zk.create("/sasl_read/sub", null, Arrays.asList(new ACL(Perms.READ, otherSaslUser)), CreateMode.PERSISTENT); zk.delete("/digest_read/sub", -1); zk.delete("/digest_read", -1); zk.delete("/sasl_read/sub", -1); zk.delete("/sasl_read", -1); Assert.assertEquals(authFailed.get(), 0); } finally { zk.close(); } }
Source:
<R> List<R> cleanResults(List<?> functionResults) { List<R> results = new ArrayList<>(); for (Object functionResult : functionResults) { if (functionResult == null) { continue; } if (functionResult instanceof Throwable) { logger.info("Error executing CacheRealizationFunction.", (Throwable) functionResult); continue; } results.add((R) functionResult); } return results; }

Target:
<R> List<R> cleanResults(List<?> functionResults) { List<R> results = new ArrayList<>(); for (Object functionResult : functionResults) { if (functionResult == null) { continue; } if (functionResult instanceof Throwable) { logger.warn("Error executing CacheRealizationFunction.", (Throwable) functionResult); continue; } results.add((R) functionResult); } return results; }
Source:
public void blobStoreHardDeleteTestBlobV2Mixed() throws MessageFormatException, IOException { short[] blobVersions = new short[5]; BlobType[] blobTypes = new BlobType[5]; blobVersions[0] = MessageFormatRecord.Blob_Version_V1; blobTypes[0] = BlobType.DataBlob; blobVersions[0] = MessageFormatRecord.Blob_Version_V2; blobTypes[0] = BlobType.MetadataBlob; blobVersions[0] = MessageFormatRecord.Blob_Version_V2; blobTypes[0] = BlobType.MetadataBlob; blobVersions[0] = MessageFormatRecord.Blob_Version_V2; blobTypes[0] = BlobType.MetadataBlob; blobVersions[0] = MessageFormatRecord.Blob_Version_V2; blobTypes[0] = BlobType.DataBlob; blobStoreHardDeleteTestUtil(blobVersions, blobTypes); blobVersions = new short[5]; blobTypes = new BlobType[5]; blobVersions[0] = MessageFormatRecord.Blob_Version_V1; blobTypes[0] = BlobType.DataBlob; blobVersions[0] = MessageFormatRecord.Blob_Version_V2; blobTypes[0] = BlobType.DataBlob; blobVersions[0] = MessageFormatRecord.Blob_Version_V2; blobTypes[0] = BlobType.MetadataBlob; blobVersions[0] = MessageFormatRecord.Blob_Version_V2; blobTypes[0] = BlobType.DataBlob; blobVersions[0] = MessageFormatRecord.Blob_Version_V2; blobTypes[0] = BlobType.MetadataBlob; blobStoreHardDeleteTestUtil(blobVersions, blobTypes); }

Target:
public void blobStoreHardDeleteTestBlobV2Mixed() throws MessageFormatException, IOException { short[] blobVersions = new short[5]; BlobType[] blobTypes = new BlobType[5]; blobVersions[0] = MessageFormatRecord.Blob_Version_V1; blobTypes[0] = BlobType.DataBlob; blobVersions[1] = MessageFormatRecord.Blob_Version_V2; blobTypes[1] = BlobType.MetadataBlob; blobVersions[2] = MessageFormatRecord.Blob_Version_V2; blobTypes[2] = BlobType.DataBlob; blobVersions[3] = MessageFormatRecord.Blob_Version_V2; blobTypes[3] = BlobType.MetadataBlob; blobVersions[4] = MessageFormatRecord.Blob_Version_V2; blobTypes[4] = BlobType.DataBlob; blobStoreHardDeleteTestUtil(blobVersions, blobTypes); blobVersions = new short[5]; blobTypes = new BlobType[5]; blobVersions[0] = MessageFormatRecord.Blob_Version_V1; blobTypes[0] = BlobType.DataBlob; blobVersions[1] = MessageFormatRecord.Blob_Version_V2; blobTypes[1] = BlobType.DataBlob; blobVersions[2] = MessageFormatRecord.Blob_Version_V2; blobTypes[2] = BlobType.MetadataBlob; blobVersions[3] = MessageFormatRecord.Blob_Version_V2; blobTypes[3] = BlobType.DataBlob; blobVersions[4] = MessageFormatRecord.Blob_Version_V2; blobTypes[4] = BlobType.MetadataBlob; blobStoreHardDeleteTestUtil(blobVersions, blobTypes); }
Source:
private void validateModel(BpmnModel model) throws Exception { FlowElement flowElement = model.getMainProcess().getFlowElement("UserTask_0ej3luy"); assertNotNull(flowElement); assertTrue(flowElement instanceof UserTask); checkXml(model); }

Target:
private void validateModel(BpmnModel model) throws Exception { FlowElement flowElement = model.getMainProcess().getFlowElement("UserTask_0ej3luy"); assertThat(flowElement).isNotNull(); assertThat(flowElement instanceof UserTask).isTrue(); checkXml(model); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } DomainInfo other = (DomainInfo) obj; if (!fChannels.equals(other.fChannels)) { return false; } if (fDomain != other.getDomain()) { return false; } if (fBufferType != other.fBufferType) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } DomainInfo other = (DomainInfo) obj; if (!fChannels.equals(other.fChannels)) { return false; } if (fDomain == null) { if (other.fDomain != null) { return false; } }else if (!fDomain.equals(other.fDomain)) { return false; } if (fBufferType != other.fBufferType) { return false; } return true; }
Source:
private CompletableFuture<?> handleBatchGet(Collection<Operation<K, V>> operations) { Preconditions.checkNotNull(operations); final List<K> gets = getOperationKeys(operations); if (gets.isEmpty()) { return CompletableFuture.completedFuture(null); } final Object[] args = getOperationArgs(operations); final CompletableFuture<Map<K, V>> getsFuture = args == null ? table.getAllAsync(gets) : table.getAllAsync(gets, args); getsFuture.whenComplete((map, throwable) -> { operations.forEach(operation -> { GetOperation<K, V> getOperation = (GetOperation<K, V>) operation; if (throwable != null) { getOperation.completeExceptionally(throwable); } else { getOperation.complete(map.get(operation.getKey())); } }); }); return getsFuture; }

Target:
private CompletableFuture<?> handleBatchGet(Collection<Operation<K, V>> operations) { Preconditions.checkNotNull(operations); final List<K> gets = getOperationKeys(operations); if (gets.isEmpty()) { return CompletableFuture.completedFuture(Collections.EMPTY_MAP); } final Object[] args = getOperationArgs(operations); final CompletableFuture<Map<K, V>> getsFuture = args == null ? table.getAllAsync(gets) : table.getAllAsync(gets, args); getsFuture.whenComplete((map, throwable) -> { operations.forEach(operation -> { GetOperation<K, V> getOperation = (GetOperation<K, V>) operation; if (throwable != null) { getOperation.completeExceptionally(throwable); } else { getOperation.complete(map.get(operation.getKey())); } }); }); return getsFuture; }
Source:
public GHMilestone createMilestone(String title, String description) throws IOException { return root.retrieve() .method("POST") .with("title", title) .with("description", description) .method("POST") .withUrlPath(getApiTailUrl("milestones")) .to(GHMilestone.class) .wrap(this); }

Target:
public GHMilestone createMilestone(String title, String description) throws IOException { return root.createRequest() .method("POST") .with("title", title) .with("description", description) .withUrlPath(getApiTailUrl("milestones")) .fetch(GHMilestone.class) .wrap(this); }
Source:
private Optional<TargetedSweeperLock> tryToAcquireLockForNextShardAndStrategy() throws InterruptedException { for (int i = 0; i < queue.getNumShards(); i++) { int nextShardCandidate = getShardAndIncrement(); TargetedSweeperLock lock = TargetedSweeperLock.acquire(nextShardCandidate, sweepStrategy, lockService); if (lock.isHeld()) { return Optional.of(lock); } } log.info("There are no candidates for this iteration of targeted sweep as all shards for sweep strategy " + "are currently being swept by other threads. You may consider increasing the number of shards, " + "or reducing the number of threads.", SafeArg.of("sweepStrategy", sweepStrategy)); return Optional.empty(); }

Target:
private Optional<TargetedSweeperLock> tryToAcquireLockForNextShardAndStrategy() { return IntStream.range(0, queue.getNumShards()) .map(ignore -> getShardAndIncrement()) .mapToObj(shard -> TargetedSweeperLock.tryAcquire(shard, sweepStrategy, timeLock)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); }
Source:
protected void registerAllTypeVariables(Type classType) { if (!(classType instanceof Class || classType instanceof ParameterizedType)) { return; } Queue<Type> typesToRegister = new LinkedList<Type>(); Set<Type> registeredTypes = new HashSet<Type>(); typesToRegister.add(classType); while (!typesToRegister.isEmpty()) { Type typeToRegister = typesToRegister.poll(); if (typeToRegister == null || registeredTypes.contains(typeToRegister)) { continue; } registerTypeVariablesOn(typeToRegister); registeredTypes.add(typeToRegister); Class<?> rawType = getRawType(typeToRegister); typesToRegister.add(rawType.getGenericSuperclass()); typesToRegister.addAll(Arrays.asList(rawType.getGenericInterfaces())); } }

Target:
protected void registerAllTypeVariables(Type classType) { Queue<Type> typesToRegister = new LinkedList<Type>(); Set<Type> registeredTypes = new HashSet<Type>(); typesToRegister.add(classType); while (!typesToRegister.isEmpty()) { Type typeToRegister = typesToRegister.poll(); if (typeToRegister == null || registeredTypes.contains(typeToRegister)) { continue; } registerTypeVariablesOn(typeToRegister); registeredTypes.add(typeToRegister); Class<?> rawType = extractRawTypeOf(typeToRegister); typesToRegister.add(rawType.getGenericSuperclass()); typesToRegister.addAll(Arrays.asList(rawType.getGenericInterfaces())); } }
Source:
public TimelineLog(final Long accountId, final long dateOfNight) { this(accountId, dateOfNight, DateTime.now().getMillis()); }

Target:
public TimelineLog(final Long accountId, final long dateOfNight) { this(accountId, dateOfNight, DateTime.now(DateTimeZone.UTC).getMillis()); }
Source:
public int[] convertFromState(State value, ComfoAirCommandType commandType) { int[] template = commandType.getChangeDataTemplate(); template[commandType.getChangeDataPos()] = ((DecimalType) value).intValue() == 1 ? commandType.getPossibleValues()[0] : 0x00; return template; }

Target:
public int[] convertFromState(State value, ComfoAirCommandType commandType) { if (value == null || commandType == null) { logger.trace("\"DataTypeBoolean\" class \"convertFromState\" method parameter: null"); return null; } else { int[] template = commandType.getChangeDataTemplate(); template[commandType.getChangeDataPos()] = ((DecimalType) value).intValue() == 1 ? commandType.getPossibleValues()[0] : 0x00; return template; } }
Source:
public void notifyReceived(final ChannelHandlerContext ctx, MessageEvent evt) throws Exception { NotifyMessage notifyMessage = (NotifyMessage) evt.getMessage(); final String barrier = notifyMessage.getBarrier(); if (logger.isDebugEnabled()) { logger.debug("NOTIFY: " + barrier); } robot.notifyBarrier(barrier); final NotifiedMessage notifiedMessaged = new NotifiedMessage(); notifiedMessaged.setBarrier(barrier); logger.debug("sending NOTIFIED: " + barrier); ChannelFuture pendingNotify = ctx.getChannel().write(notifiedMessaged); pendingWrites.add(pendingNotify); }

Target:
public void notifyReceived(final ChannelHandlerContext ctx, MessageEvent evt) throws Exception { NotifyMessage notifyMessage = (NotifyMessage) evt.getMessage(); final String barrier = notifyMessage.getBarrier(); if (logger.isDebugEnabled()) { logger.debug("NOTIFY: " + barrier); } writeNotifiedOnBarrier(barrier, ctx); robot.notifyBarrier(barrier); }
Source:
public void setActiveEditor(IEditorPart editor) { for (Object element : cache) { ((EditorContribution) element).editorChanged(editor); } }

Target:
public void setActiveEditor(IEditorPart editor) { for (Object contribution : cache) { ((EditorContribution) contribution).editorChanged(editor); } }
Source:
public InputStream getObject(GetObjectArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException { checkArgs(args); args.validateSsec(this.baseUrl); Long offset = args.offset(); Long length = args.length(); if (length != null && offset == null) { offset = 0L; } String range = (offset != null) ? ("bytes=" + offset + "-" + (length != null ? offset + length - 1 : "")) : null; Multimap<String, String> headers = HashMultimap.create(); if (range != null) headers.put("Range", range); if (args.ssec() != null) headers.putAll(newMultimap(args.ssec().headers())); Multimap<String, String> queryParams = HashMultimap.create(); if (args.versionId() != null) queryParams.put("versionId", args.versionId()); Response response = executeGet(args, headers, queryParams); return response.body().byteStream(); }

Target:
public InputStream getObject(GetObjectArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, ServerException, XmlParserException { checkArgs(args); args.validateSsec(this.baseUrl); Long offset = args.offset(); Long length = args.length(); if (length != null && offset == null) { offset = 0L; } String range = null; if (offset != null) { range = "bytes=" + offset + "-"; if (length != null) { range = range + (offset + length - 1); } } Multimap<String, String> headers = HashMultimap.create(); if (range != null) headers.put("Range", range); if (args.ssec() != null) headers.putAll(newMultimap(args.ssec().headers())); Multimap<String, String> queryParams = HashMultimap.create(); if (args.versionId() != null) queryParams.put("versionId", args.versionId()); Response response = executeGet(args, headers, queryParams); return response.body().byteStream(); }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getBricks() == null || getParameters().getBricks().size() == 0) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (getGlusterVolume().getBricks().size() == 1 || getGlusterVolume().getBricks().size() <= getParameters().getBricks().size()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REMOVE_ALL_BRICKS_FROM_VOLUME); return false; } if (getGlusterVolume().getVolumeType() == GlusterVolumeType.REPLICATE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) { if (getParameters().getReplicaCount() < getGlusterVolume().getReplicaCount() - 1) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT_MORE_THAN_ONE); return false; } else if (getParameters().getReplicaCount() > getGlusterVolume().getReplicaCount()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT); return false; } } return validateBricks(getParameters().getBricks()); }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getBricks() == null || getParameters().getBricks().size() == 0) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); } if (getGlusterVolume().getBricks().size() == 1 || getGlusterVolume().getBricks().size() <= getParameters().getBricks().size()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REMOVE_ALL_BRICKS_FROM_VOLUME); } if (getGlusterVolume().getVolumeType().isReplicatedType()) { if (getParameters().getReplicaCount() < getGlusterVolume().getReplicaCount() - 1) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT_MORE_THAN_ONE); } else if (getParameters().getReplicaCount() > getGlusterVolume().getReplicaCount()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT); } } GlusterBrickValidator brickValidator = new GlusterBrickValidator(); return validate(brickValidator.validateBricks(getParameters().getBricks(), getGlusterVolume())); }
Source:
public Iterable<Header> getHeaders() { return _headers; }

Target:
public Headers getHeaders() { return _headers; }
Source:
public static void execute(String imagePath, QuestionWidget questionWidget, Context context) { ExifInterface exif = null; try { exif = new ExifInterface(imagePath); } catch (IOException e) { Timber.w(e); } rotateImageIfNeeded(imagePath); scaleDownImageIfNeeded(imagePath, questionWidget, context); try { exif.saveAttributes(); } catch (IOException e) { Timber.w(e); } }

Target:
public static void execute(String imagePath, QuestionWidget questionWidget, Context context) { ExifInterface exif = null; try { exif = new ExifInterface(imagePath); } catch (IOException e) { Timber.w(e); } rotateImageIfNeeded(imagePath); scaleDownImageIfNeeded(imagePath, questionWidget, context); if (exif != null) { try { exif.saveAttributes(); } catch (IOException e) { Timber.w(e); } } }
Source:
protected static void validateConfigParameters(Schema inputSchema, @Nullable String featuresToInclude, @Nullable String featuresToExclude, String predictionField, @Nullable String cardinalityMapping) { if (!Strings.isNullOrEmpty(featuresToExclude) && !Strings.isNullOrEmpty(featuresToInclude)) { throw new IllegalArgumentException("Cannot specify values for both featuresToInclude and featuresToExclude. " + "Please specify fields for one."); } Map<String, Integer> fields = getFeatureList(inputSchema, featuresToInclude, featuresToExclude, predictionField); for (String field : fields.keySet()) { Schema.Field inputField = inputSchema.getField(field); Schema schema = inputField.getSchema(); Schema.Type features = schema.isNullableSimple() ? schema.getNonNullable().getType() : schema.getType(); if (!(features.equals(Schema.Type.INT) || features.equals(Schema.Type.LONG) || features.equals(Schema.Type.FLOAT) || features.equals(Schema.Type.DOUBLE))) { throw new IllegalArgumentException(String.format("Field to classify must be continuous : int, double, " + "float, long but was %s.", features)); } } getCategoricalFeatureInfo(inputSchema, featuresToInclude, featuresToExclude, predictionField, cardinalityMapping); }

Target:
static void validateConfigParameters(Schema inputSchema, @Nullable String featuresToInclude, @Nullable String featuresToExclude, String predictionField, @Nullable String cardinalityMapping) { if (!Strings.isNullOrEmpty(featuresToExclude) && !Strings.isNullOrEmpty(featuresToInclude)) { throw new IllegalArgumentException("Cannot specify values for both featuresToInclude and featuresToExclude. " + "Please specify fields for one."); } Map<String, Integer> fields = getFeatureList(inputSchema, featuresToInclude, featuresToExclude, predictionField); for (String field : fields.keySet()) { Schema.Field inputField = inputSchema.getField(field); Schema schema = inputField.getSchema(); Schema.Type features = schema.isNullableSimple() ? schema.getNonNullable().getType() : schema.getType(); if (!(features.equals(Schema.Type.INT) || features.equals(Schema.Type.LONG) || features.equals(Schema.Type.FLOAT) || features.equals(Schema.Type.DOUBLE))) { throw new IllegalArgumentException(String.format("Features must be of type : int, double, float, long but " + "was of type %s for field %s.", features, field)); } } getCategoricalFeatureInfo(inputSchema, featuresToInclude, featuresToExclude, predictionField, cardinalityMapping); }
Source:
void executeRefresh(ZWaveNode node, ZWaveThermostatFanStateCommandClass commandClass, int endpointId, Map<String, String> arguments) { logger.debug("NODE {}: Generating poll message for for node endpoint {}", commandClass.getCommandClass().getLabel(), node.getNodeId(), endpointId); SerialMessage serialMessage = node.encapsulate(commandClass.getValueMessage(), commandClass, endpointId); if (serialMessage == null) { logger.warn("NODE {}: Generating message failed for command class = {}, endpoint = {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId); return; } this.getController().sendData(serialMessage); }

Target:
void executeRefresh(ZWaveNode node, ZWaveThermostatFanStateCommandClass commandClass, int endpointId, Map<String, String> arguments) { logger.debug("NODE {}: Generating poll message for endpoint {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId); SerialMessage serialMessage = node.encapsulate(commandClass.getValueMessage(), commandClass, endpointId); if (serialMessage == null) { logger.warn("NODE {}: Generating message failed for command class = {}, endpoint = {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId); return; } this.getController().sendData(serialMessage); }
Source:
public void completeUpdate() { mAppUpdateManager.completeUpdate() .addOnSuccessListener(result -> { Logger.log(TAG, "completeUpdate|was successful"); publishStatus(); }) .addOnFailureListener(exception -> { Logger.log(TAG, "completeUpdate|failed with : " + exception.getMessage()); publishStatus(); }); }

Target:
public void completeUpdate() { mAppUpdateManager.completeUpdate() .addOnSuccessListener(result -> { Logger.log(TAG, "completeUpdate|was successful"); }) .addOnFailureListener(exception -> { Logger.log(TAG, "completeUpdate|failed with : " + exception.getMessage()); publishStatus(); }); }
Source:
public synchronized CauseOfBlockage canRun(Queue.Item item) { if (!(item.task instanceof AbstractProject)) { logger.debug("Not an abstract project: {}", item.task); return null; } GerritCause cause = getGerritCause(item); if (cause == null) { logger.debug("Not a gerrit cause: {}", cause); return null; } GerritTriggeredEvent event = cause.getEvent(); if (event == null) { logger.debug("Does not contain an event"); return null; } if (item.isBuildable()) { logger.debug("Item is already buildable"); return null; } AbstractProject p = (AbstractProject)item.task; GerritTrigger trigger = GerritTrigger.getTrigger(p); if (trigger == null) { logger.debug("Project does not contain a trigger"); return null; } List<AbstractProject> dependencies = getProjectsFromString(trigger.getDependencyJobsNames(), (Item)p); if ((dependencies == null) || (dependencies.size() == 0)) { logger.debug("No dependencies on project: {}", p); return null; } if (currentlyTriggeringEvents.contains(event)) { logger.debug("We need to wait while is being triggered", event); return new BecauseWaitingForOtherProjectsToTrigger(); } List<AbstractProject> blockingProjects = getBlockingDependencyProjects(dependencies, event); if (blockingProjects.size() > 0) { return new BecauseDependentBuildIsBuilding(blockingProjects); } else { logger.info("No active dependencies on project: , it will now build", p); return null; } }

Target:
public CauseOfBlockage canRun(Queue.Item item) { if (!(item.task instanceof AbstractProject)) { logger.debug("Not an abstract project: {}", item.task); return null; } GerritCause cause = getGerritCause(item); if (cause == null) { logger.debug("Not a gerrit cause: {}", cause); return null; } GerritTriggeredEvent event = cause.getEvent(); if (event == null) { logger.debug("Does not contain an event"); return null; } if (item.isBuildable()) { logger.debug("Item is already buildable"); return null; } AbstractProject p = (AbstractProject)item.task; GerritTrigger trigger = GerritTrigger.getTrigger(p); if (trigger == null) { logger.debug("Project does not contain a trigger"); return null; } List<AbstractProject> dependencies = getProjectsFromString(trigger.getDependencyJobsNames(), (Item)p); if ((dependencies == null) || (dependencies.size() == 0)) { logger.debug("No dependencies on project: {}", p); return null; } if (currentlyTriggeringEvents.contains(event)) { logger.debug("We need to wait while is being triggered", event); return new BecauseWaitingForOtherProjectsToTrigger(); } List<AbstractProject> blockingProjects = getBlockingDependencyProjects(dependencies, event); if (blockingProjects.size() > 0) { return new BecauseDependentBuildIsBuilding(blockingProjects); } else { logger.info("No active dependencies on project: , it will now build", p); return null; } }
Source:
private void addTokensToUGI(Subject subject) { if (subject != null) { Set<Credentials> privateCredentials = subject.getPrivateCredentials(Credentials.class); if (privateCredentials != null) { for (Credentials cred : privateCredentials) { Collection<Token<? extends TokenIdentifier>> allTokens = cred.getAllTokens(); if (allTokens != null) { for (Token<? extends TokenIdentifier> token : allTokens) { try { LOG.debug("Current user: {}", UserGroupInformation.getCurrentUser()); LOG.debug("Extracted Token from Credentials : {}", token); UserGroupInformation.getCurrentUser().addToken(token); LOG.info("Added delegation tokens to UGI."); } catch (IOException e) { LOG.error("Exception while trying to add tokens to ugi", e); } } } } } } }

Target:
private void addTokensToUGI(Subject subject) { if (subject != null) { Set<Credentials> privateCredentials = subject.getPrivateCredentials(Credentials.class); if (privateCredentials != null) { for (Credentials cred : privateCredentials) { Collection<Token<? extends TokenIdentifier>> allTokens = cred.getAllTokens(); if (allTokens != null) { for (Token<? extends TokenIdentifier> token : allTokens) { try { if (token == null) { LOG.debug("Ignoring null token"); continue; } LOG.debug("Current user: {}", UserGroupInformation.getCurrentUser()); LOG.debug("Token from Credentials : {}", token); UserGroupInformation.getCurrentUser().addToken(token); LOG.info("Added delegation tokens to UGI."); } catch (IOException e) { LOG.error("Exception while trying to add tokens to ugi", e); } } } } } } }
Source:
public void testHttpIngestionAllInvalidStringBooleanMetrics() throws Exception { HttpResponse response = httpPost(TENANT_ID, postPath, generateJSONMetricsDataWithAllWrongTypes(System.currentTimeMillis())); ErrorResponse errorResponse = getErrorResponse(response); try { assertEquals("number of errors", 3, errorResponse.getErrors().size()); assertEquals("Should get status 400 from " + String.format(postPath, TENANT_ID), 400, response.getStatusLine().getStatusCode() ); for (int i = 0; i < errorResponse.getErrors().size(); i++) { assertEquals("Invalid error source", "metricValue", errorResponse.getErrors().get(i).getSource()); } } finally { EntityUtils.consume( response.getEntity() ); } }

Target:
public void testHttpIngestionAllInvalidStringBooleanMetrics() throws Exception { HttpResponse response = httpPost(TENANT_ID, postPath, generateJSONMetricsDataWithAllWrongTypes(false, System.currentTimeMillis())); ErrorResponse errorResponse = getErrorResponse(response); try { assertEquals("number of errors", 3, errorResponse.getErrors().size()); assertEquals("Should get status 400 from " + String.format(postPath, TENANT_ID), 400, response.getStatusLine().getStatusCode() ); for (int i = 0; i < errorResponse.getErrors().size(); i++) { assertEquals("Invalid error source", "metricValue", errorResponse.getErrors().get(i).getSource()); } } finally { EntityUtils.consume( response.getEntity() ); } }
Source:
protected void stop() throws Exception { logger.info("Service Component is deactivated"); }

Target:
protected void stop() throws Exception { logger.info("Service Component is deactivated"); serviceRegistration.unregister(); }