auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void onChunkOperationComplete(GetChunk chunk) { if (chunk.getChunkException() != null) { setOperationException(chunk.getChunkException()); } if (chunk == firstChunk) { if (operationCallbackInvoked.compareAndSet(false, true)) { Exception e = getOperationException(); if (options.getChunkIdsOnly) { operationCompleted = true; List<StoreKey> chunkIds = e == null && compositeBlobInfo != null ? compositeBlobInfo.getKeys() : null; operationResult = new GetBlobResultInternal(new GetBlobResult(blobInfo, blobDataChannel, chunkIds), chunkIds); } else { long timeElapsed = time.milliseconds() - submissionTimeMs; routerMetrics.getBlobOperationLatencyMs.update(timeElapsed); if (e == null) { blobDataChannel = new BlobDataReadableStreamChannel(); operationResult = new GetBlobResultInternal(new GetBlobResult(blobInfo, blobDataChannel), null); } else { blobDataChannel = null; operationResult = null; routerMetrics.onGetBlobError(e, options); } } NonBlockingRouter.completeOperation(null, getOperationCallback, operationResult, e); } } chunk.postCompletionCleanup(); if (blobDataChannel != null) { blobDataChannel.maybeWriteToChannel(); } }

Target:
private void onChunkOperationComplete(GetChunk chunk) { if (chunk.getChunkException() != null) { setOperationException(chunk.getChunkException()); } if (chunk == firstChunk) { if (operationCallbackInvoked.compareAndSet(false, true)) { Exception e = getOperationException(); if (options.getChunkIdsOnly) { operationCompleted = true; List<StoreKey> chunkIds = e == null && compositeBlobInfo != null ? compositeBlobInfo.getKeys() : null; operationResult = new GetBlobResultInternal(new GetBlobResult(blobInfo, chunkIds), chunkIds); } else { long timeElapsed = time.milliseconds() - submissionTimeMs; routerMetrics.getBlobOperationLatencyMs.update(timeElapsed); if (e == null) { blobDataChannel = new BlobDataReadableStreamChannel(); operationResult = new GetBlobResultInternal(new GetBlobResult(blobInfo, blobDataChannel), null); } else { blobDataChannel = null; operationResult = null; routerMetrics.onGetBlobError(e, options); } } NonBlockingRouter.completeOperation(null, getOperationCallback, operationResult, e); } } chunk.postCompletionCleanup(); if (blobDataChannel != null) { blobDataChannel.maybeWriteToChannel(); } }
Source:
public void init() { paletteDefinitionBuilder .itemFilter(defId -> true) .categoryFilter(category -> !EXCLUDED_CATEGORIES.contains(category)); }

Target:
public void init() { paletteDefinitionBuilder .categoryFilter(category -> !EXCLUDED_CATEGORIES.contains(category)); }
Source:
public Map<String, String> thumbnails() { return thumbnail; }

Target:
public Map<String, Uri> thumbnails() { return thumbnail; }
Source:
public void testPurgeExpired() throws Exception { long lifespan = 6000; long idle = 4000; InternalCacheEntry ice1 = TestInternalCacheEntryFactory.create("k1", "v1", lifespan); cl.write(marshalledEntry(ice1, getMarshaller())); InternalCacheEntry ice2 = TestInternalCacheEntryFactory.create("k2", "v2", -1, idle); cl.write(marshalledEntry(ice2, getMarshaller())); InternalCacheEntry ice3 = TestInternalCacheEntryFactory.create("k3", "v3", lifespan, idle); cl.write(marshalledEntry(ice3, getMarshaller())); InternalCacheEntry ice4 = TestInternalCacheEntryFactory.create("k4", "v4", -1, -1); cl.write(marshalledEntry(ice4, getMarshaller())); InternalCacheEntry ice5 = TestInternalCacheEntryFactory.create("k5", "v5", lifespan * 1000, idle * 1000); cl.write(marshalledEntry(ice5, getMarshaller())); assert cl.contains("k1"); assert cl.contains("k2"); assert cl.contains("k3"); assert cl.contains("k4"); assert cl.contains("k5"); Thread.sleep(lifespan + 10); HashSet<String> expiredKeys = new HashSet<String>(); expiredKeys.add("k1"); expiredKeys.add("k2"); expiredKeys.add("k3"); purgeExpired(Collections.unmodifiableSet(expiredKeys), 1000); for (String key : expiredKeys) { assertFalse(cl.contains(key)); } assert cl.contains("k4"); assert cl.contains("k5"); }

Target:
public void testPurgeExpired() throws Exception { long lifespan = 6000; long idle = 4000; InternalCacheEntry ice1 = TestInternalCacheEntryFactory.create("k1", wrap("k1", "v1"), lifespan); cl.write(marshalledEntry(ice1, getMarshaller())); InternalCacheEntry ice2 = TestInternalCacheEntryFactory.create("k2", wrap("k2", "v2"), -1, idle); cl.write(marshalledEntry(ice2, getMarshaller())); InternalCacheEntry ice3 = TestInternalCacheEntryFactory.create("k3", wrap("k3", "v3"), lifespan, idle); cl.write(marshalledEntry(ice3, getMarshaller())); InternalCacheEntry ice4 = TestInternalCacheEntryFactory.create("k4", wrap("k4", "v4"), -1, -1); cl.write(marshalledEntry(ice4, getMarshaller())); InternalCacheEntry ice5 = TestInternalCacheEntryFactory.create("k5", wrap("k5", "v5"), lifespan * 1000, idle * 1000); cl.write(marshalledEntry(ice5, getMarshaller())); assert cl.contains("k1"); assert cl.contains("k2"); assert cl.contains("k3"); assert cl.contains("k4"); assert cl.contains("k5"); Thread.sleep(lifespan + 10); HashSet<String> expiredKeys = new HashSet<String>(Arrays.asList("k1", "k2", "k3")); purgeExpired(Collections.unmodifiableSet(expiredKeys), 1000); for (String key : expiredKeys) { assertFalse(cl.contains(key)); } assert cl.contains("k4"); assert cl.contains("k5"); }
Source:
private Constructor<E> getEntityConstructor() { final Class<E> entityClass = getEntityClass(); final Class<I> idClass = getIdClass(); try { final Constructor<E> result = entityClass.getDeclaredConstructor(idClass); checkConstructorAccessModifier(result.getModifiers(), entityClass.getSimpleName()); return result; } catch (NoSuchMethodException ignored) { throw noSuchConstructorException(entityClass.getSimpleName()); } }

Target:
private Constructor<E> getEntityConstructor() { final Class<E> entityClass = getEntityClass(); final Class<I> idClass = getIdClass(); try { final Constructor<E> result = entityClass.getDeclaredConstructor(idClass); checkConstructorAccessModifier(result.getModifiers(), entityClass.getName()); return result; } catch (NoSuchMethodException ignored) { throw noSuchConstructorException(entityClass.getName(), idClass.getName()); } }
Source:
public ApprovalsUtil(ReviewDb db) { this.db = db; }

Target:
ApprovalsUtil(ReviewDb db) { this.db = db; }
Source:
public void privateSubscriber() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Event Subscriber class needs to be public"); bus.register(new PrivateSubscriber()); TestEvent e = new TestEvent(); bus.post(e); }

Target:
public void privateSubscriber() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Event Subscriber class com.cloudant.sync.event.EventBusTest$PrivateSubscriber needs to be public"); bus.register(new PrivateSubscriber()); }
Source:
public void getBytes(int index, OutputStream out, int length) throws IOException { checkIndexLength(index, length); if (hasBackingByteArray()) { out.write(backingByteArray(), (backingByteArrayOffset() + index), length); return; } byte[] buffer = new byte[4096]; while (length > 0) { int size = min(buffer.length, length); getBytes(index, buffer, 0, size); out.write(buffer, 0, size); length -= size; index += size; } }

Target:
public void getBytes(int index, OutputStream out, int length) throws IOException { checkIndexLength(index, length); if (hasByteArray()) { out.write(byteArray(), byteArrayOffset() + index, length); return; } byte[] buffer = new byte[4096]; while (length > 0) { int size = min(buffer.length, length); getBytes(index, buffer, 0, size); out.write(buffer, 0, size); length -= size; index += size; } }
Source:
public void createDirectory(ServiceInvocationContext context, List<PathFragment> pathWithRoot, String name){ Object object = GenericTreeStatefulService.getNodeByPathFor(pathWithRoot, null); String path = ((Pair<File, Object>)object).a.getPath() + "\\" + name; if(true){ } File theDir = new File(path); if (!theDir.exists()) { boolean result = theDir.mkdir(); if(!result) { } }else { context.getCommunicationChannel().appendCommandToCurrentHttpResponse( new DisplaySimpleMessageClientCommand(WebPlugin.getInstance().getMessage("explorer.createDirectory.error.title"), WebPlugin.getInstance().getMessage( "explorer.createDirectory.error.alreadyExists"), DisplaySimpleMessageClientCommand.ICON_ERROR)); } }

Target:
public void createDirectory(ServiceInvocationContext context, List<PathFragment> pathWithRoot, String name) { GenericTreeStatefulService service = GenericTreeStatefulService .getServiceFromPathWithRoot(pathWithRoot); String clientID = GenericTreeStatefulService.getClientIDFromPathWithRoot(pathWithRoot); Object object = GenericTreeStatefulService.getNodeByPathFor( pathWithRoot, null); @SuppressWarnings("unchecked") String path = ((Pair<File, Object>) object).a.getPath() + "\\" + name; File theDir = new File(path); if (!theDir.exists()) { boolean result = theDir.mkdirs(); if (result) { expandNodesAfterCreate(context, service, clientID, object, theDir, name); FileEvent event = new FileEvent(theDir, FileEvent.FILE_CREATED); CommonPlugin.getInstance().getFileEventDispatcher() .dispatch(event); } else { printMessageToUser(context, "explorer.createDirectory.error.title", "explorer.createDirectory.error.couldNotCreate"); } } else if(theDir.isFile()) { printMessageToUser(context, "explorer.createDirectory.error.title", "explorer.createDirectory.error.alreadyExistsAsFile"); } else { printMessageToUser(context, "explorer.createDirectory.error.title", "explorer.createDirectory.error.alreadyExists"); } }
Source:
private void writeRegionIndex() throws IOException { if (Arrays.stream(subpartitionBytes).sum() > 0) { for (int subpartition = 0; subpartition < numSubpartitions; ++subpartition) { if (!indexBuffer.hasRemaining()) { flushIndexBuffer(); indexBuffer.clear(); canCacheAllIndexData = false; } indexBuffer.putLong(totalBytesWritten); indexBuffer.putInt(subpartitionBuffers[subpartition]); totalBytesWritten += subpartitionBytes[subpartition]; } ++numRegions; currentSubpartition = 0; Arrays.fill(subpartitionBytes, 0); Arrays.fill(subpartitionBuffers, 0); } }

Target:
private void writeRegionIndex() throws IOException { if (Arrays.stream(subpartitionBuffers).sum() > 0) { for (int channel = 0; channel < numSubpartitions; ++channel) { writeIndexEntry(subpartitionOffsets[channel], subpartitionBuffers[channel]); } currentSubpartition = -1; ++numRegions; Arrays.fill(subpartitionBuffers, 0); } }
Source:
public void testTransaction() throws RemoteException, SystemException { log.info("Method stateful #testTransaction called"); Transaction txn; txn = tm.getTransaction(); TxTestUtil.enlistTestXAResource(txn); TxTestUtil.enlistTestXAResource(txn); }

Target:
public void testTransaction() throws RemoteException, SystemException { log.trace("Method stateful #testTransaction called"); Transaction txn; txn = tm.getTransaction(); TxTestUtil.enlistTestXAResource(txn); TxTestUtil.enlistTestXAResource(txn); }
Source:
public void testGenerateSingleTypedefEnum() throws IOException, ParserException, ResponseTypeNotFoundException, TypeRenamingConflictException { final String inputSpecFile = "/input/TypedefEnum.xml"; final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Ds3SpecParser parser = new Ds3SpecParserImpl(); final Ds3ApiSpec spec = parser.getSpec(CCodeGenerator_Test.class.getResourceAsStream(inputSpecFile)); final CCodeGenerator codeGenerator = new CCodeGenerator(); try { final Header header = new Header(CCodeGenerator.getAllEnums(spec), CCodeGenerator.getAllStructs(spec), CCodeGenerator.getAllRequests(spec)); codeGenerator.processTemplate(header, "TypedefEnum.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); LOG.info("Generated code:\n" + output); assertTrue(output.contains("typedef enum {")); assertTrue(output.contains(" IN_PROGRESS,")); assertTrue(output.contains(" COMPLETED,")); assertTrue(output.contains(" CANCELED")); assertFalse(output.contains(" CANCELED,")); assertTrue(output.contains("}ds3_job_status;")); } catch (final ParseException e) { LOG.error("Error parsing " + inputSpecFile, e); } }

Target:
public void testGenerateSingleTypedefEnum() throws IOException, ParserException, ResponseTypeNotFoundException, TypeRenamingConflictException, ParseException { final String inputSpecFile = "/input/TypedefEnum.xml"; final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Ds3SpecParser parser = new Ds3SpecParserImpl(); final Ds3ApiSpec spec = parser.getSpec(CCodeGenerator_Test.class.getResourceAsStream(inputSpecFile)); final CCodeGenerator codeGenerator = new CCodeGenerator(); final Header header = new Header(CCodeGenerator.getAllEnums(spec), CCodeGenerator.getAllStructs(spec), CCodeGenerator.getAllRequests(spec)); codeGenerator.processTemplate(header, "TypedefEnum.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); LOG.info("Generated code:\n" + output); assertTrue(output.contains("typedef enum {")); assertTrue(output.contains(" IN_PROGRESS,")); assertTrue(output.contains(" COMPLETED,")); assertTrue(output.contains(" CANCELED")); assertFalse(output.contains(" CANCELED,")); assertTrue(output.contains("}ds3_job_status;")); }
Source:
private void analyzeCreateDatabase(ASTNode ast) throws SemanticException { String dbName = unescapeIdentifier(ast.getChild(0).getText()); boolean ifNotExists = false; String dbComment = null; String dbLocation = null; Map<String, String> dbProps = null; for (int i = 1; i < ast.getChildCount(); i++) { ASTNode childNode = (ASTNode) ast.getChild(i); switch (childNode.getToken().getType()) { case HiveParser.TOK_IFNOTEXISTS: ifNotExists = true; break; case HiveParser.TOK_DATABASECOMMENT: dbComment = unescapeSQLString(childNode.getChild(0).getText()); break; case TOK_DATABASEPROPERTIES: dbProps = DDLSemanticAnalyzer.getProps((ASTNode) childNode.getChild(0)); break; case TOK_DATABASELOCATION: dbLocation = unescapeSQLString(childNode.getChild(0).getText()); addLocationToOutputs(dbLocation); break; default: throw new SemanticException("Unrecognized token in CREATE DATABASE statement"); } } CreateDatabaseDesc createDatabaseDesc = new CreateDatabaseDesc(dbName, dbComment, dbLocation, ifNotExists, new ReplicationSpec()); if (dbProps != null) { createDatabaseDesc.setDatabaseProperties(dbProps); } Database database = new Database(dbName, dbComment, dbLocation, dbProps); outputs.add(new WriteEntity(database, WriteEntity.WriteType.DDL_NO_LOCK)); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), createDatabaseDesc), conf)); }

Target:
private void analyzeCreateDatabase(ASTNode ast) throws SemanticException { String dbName = unescapeIdentifier(ast.getChild(0).getText()); boolean ifNotExists = false; String dbComment = null; String dbLocation = null; Map<String, String> dbProps = null; for (int i = 1; i < ast.getChildCount(); i++) { ASTNode childNode = (ASTNode) ast.getChild(i); switch (childNode.getToken().getType()) { case HiveParser.TOK_IFNOTEXISTS: ifNotExists = true; break; case HiveParser.TOK_DATABASECOMMENT: dbComment = unescapeSQLString(childNode.getChild(0).getText()); break; case TOK_DATABASEPROPERTIES: dbProps = DDLSemanticAnalyzer.getProps((ASTNode) childNode.getChild(0)); break; case TOK_DATABASELOCATION: dbLocation = unescapeSQLString(childNode.getChild(0).getText()); addLocationToOutputs(dbLocation); break; default: throw new SemanticException("Unrecognized token in CREATE DATABASE statement"); } } CreateDatabaseDesc createDatabaseDesc = new CreateDatabaseDesc(dbName, dbComment, dbLocation, ifNotExists); if (dbProps != null) { createDatabaseDesc.setDatabaseProperties(dbProps); } Database database = new Database(dbName, dbComment, dbLocation, dbProps); outputs.add(new WriteEntity(database, WriteEntity.WriteType.DDL_NO_LOCK)); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), createDatabaseDesc), conf)); }
Source:
private Message receiveForReply(final String queueName, Channel channel, Message receiveMessage) throws Exception { boolean channelTransacted = isChannelTransacted(); boolean channelLocallyTransacted = isChannelLocallyTransacted(channel); if (RabbitTemplate.this.receiveTimeout == 0) { GetResponse response = channel.basicGet(queueName, !channelTransacted); if (response != null) { long deliveryTag1 = response.getEnvelope().getDeliveryTag(); if (channelLocallyTransacted) { channel.basicAck(deliveryTag1, false); } else if (channelTransacted) { ConnectionFactoryUtils.registerDeliveryTag(getConnectionFactory(), channel, deliveryTag1); } receiveMessage = buildMessageFromResponse(response); } } else { CompletableFuture<Delivery> future = new CompletableFuture<>(); long timeoutMillis = this.receiveTimeout; Delivery delivery = getDeliveryAndCancelConsumer(channel, future, createConsumer(queueName, channel, future), timeoutMillis); if (delivery != null) { long deliveryTag2 = delivery.getEnvelope().getDeliveryTag(); if (channelTransacted && !channelLocallyTransacted) { ConnectionFactoryUtils.registerDeliveryTag(getConnectionFactory(), channel, deliveryTag2); } else { channel.basicAck(deliveryTag2, false); } receiveMessage = buildMessageFromDelivery(delivery); } } logReceived(receiveMessage); return receiveMessage; }

Target:
private Message receiveForReply(final String queueName, Channel channel, Message receiveMessage) throws Exception { boolean channelTransacted = isChannelTransacted(); boolean channelLocallyTransacted = isChannelLocallyTransacted(channel); if (RabbitTemplate.this.receiveTimeout == 0) { GetResponse response = channel.basicGet(queueName, !channelTransacted); if (response != null) { long deliveryTag1 = response.getEnvelope().getDeliveryTag(); if (channelLocallyTransacted) { channel.basicAck(deliveryTag1, false); } else if (channelTransacted) { ConnectionFactoryUtils.registerDeliveryTag(getConnectionFactory(), channel, deliveryTag1); } receiveMessage = buildMessageFromResponse(response); } } else { Delivery delivery = consumeDelivery(channel, queueName, this.receiveTimeout); if (delivery != null) { long deliveryTag2 = delivery.getEnvelope().getDeliveryTag(); if (channelTransacted && !channelLocallyTransacted) { ConnectionFactoryUtils.registerDeliveryTag(getConnectionFactory(), channel, deliveryTag2); } else { channel.basicAck(deliveryTag2, false); } receiveMessage = buildMessageFromDelivery(delivery); } } logReceived(receiveMessage); return receiveMessage; }
Source:
public void testCollectRows() throws Exception { List<Row> rows = Arrays.asList(new Row1(10), new Row1(20)); Supplier<BatchIterator<Row>> batchIteratorSupplier = () -> InMemoryBatchIterator.of(rows, SentinelRow.SENTINEL, true); BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier); List<Object[]> expectedResult = Arrays.asList(new Object[]{10}, new Object[]{20}); tester.verifyResultAndEdgeCaseBehaviour(expectedResult); }

Target:
public void testCollectRows() throws Exception { List<Row> rows = Arrays.asList(new Row1(10), new Row1(20)); Supplier<BatchIterator<Row>> batchIteratorSupplier = () -> InMemoryBatchIterator.of(rows, SentinelRow.SENTINEL, false); BatchIteratorTester tester = new BatchIteratorTester(batchIteratorSupplier); List<Object[]> expectedResult = Arrays.asList(new Object[]{10}, new Object[]{20}); tester.verifyResultAndEdgeCaseBehaviour(expectedResult); }
Source:
public RowInsertionBuilder value(final int columnIndex, final Object value) { values.set(columnIndex, value); return this; }

Target:
public RowInsertionBuilder value(final int columnIndex, final Object value) { return value(columnIndex, value, null); }
Source:
public CONTENT extract(RoviProgramLine roviLine) { CONTENT content = createContent(); content.setTitle(roviLine.getLongTitle()); content.setCanonicalUri(canonicalUriForProgram(roviLine.getProgramId())); content.setPublisher(getPublisherForLanguage(roviLine.getLanguage())); content.setLanguages(Sets.newHashSet(roviLine.getLanguage())); if (roviLine.getReleaseYear().isPresent()) { content.setYear(roviLine.getReleaseYear().get()); } Optional<String> descriptionCulture = Optional.absent(); try { descriptionCulture = setDescriptionAndGetCulture(content, roviLine); } catch (IOException e) { log().error("Error while trying to populate the description for program " + roviLine.getKey(), e); } content.setPublisher(getPublisherForLanguageAndCulture(roviLine.getLanguage(), descriptionCulture)); setParentIfNeeded(roviLine, content); createVersionIfNeeded(content, roviLine); CONTENT extracted = addSpecificData(content, roviLine); log().trace("Extracted with canonical uri {}", extracted.getClass().getName(), extracted.getCanonicalUri()); return extracted; }

Target:
public CONTENT extract(RoviProgramLine roviLine) throws IndexAccessException { CONTENT content = createContent(); content.setTitle(roviLine.getLongTitle()); content.setCanonicalUri(canonicalUriForProgram(roviLine.getProgramId())); content.setPublisher(getPublisherForLanguage(roviLine.getLanguage())); content.setLanguages(Sets.newHashSet(roviLine.getLanguage())); if (roviLine.getReleaseYear().isPresent()) { content.setYear(roviLine.getReleaseYear().get()); } Optional<String> descriptionCulture = Optional.absent(); descriptionCulture = setDescriptionAndGetCulture(content, roviLine); content.setPublisher(getPublisherForLanguageAndCulture(roviLine.getLanguage(), descriptionCulture)); setParentIfNeeded(roviLine, content); createVersionIfNeeded(content, roviLine); CONTENT extracted = addSpecificData(content, roviLine); log().trace("Extracted with canonical uri {}", extracted.getClass().getName(), extracted.getCanonicalUri()); return extracted; }
Source:
public void retract(FirstLastValueWithRetractAccumulator<T> acc, Object value, Long order) throws Exception { if (value != null) { T v = (T) value; List<Long> orderList = acc.valueToOrderMap.get(v); if (orderList != null && orderList.size() > 0) { orderList.remove(0); if (orderList.isEmpty()) { acc.valueToOrderMap.remove(v); } else { acc.valueToOrderMap.put(v, orderList); } } else { List<Long> retractOrderList = acc.valueToOrderRetractMap.get(v); if (retractOrderList == null) { retractOrderList = new ArrayList<>(); } retractOrderList.add(order); acc.valueToOrderRetractMap.put(v, retractOrderList); } List<T> valueList = acc.orderToValueMap.get(order); int index = -1; if (valueList != null && (index = valueList.indexOf(v)) >= 0) { valueList.remove(index); if (valueList.isEmpty()) { acc.orderToValueMap.remove(order); } else { acc.orderToValueMap.put(order, valueList); } } else { List<T> retractValueList = acc.orderToValueRetractMap.get(order); if (retractValueList == null) { retractValueList = new ArrayList<>(); } retractValueList.add(v); acc.orderToValueRetractMap.put(order, retractValueList); } if (v.equals(acc.value)) { updateValue(acc); } } }

Target:
public void retract(FirstLastValueWithRetractAccumulator<T> acc, Object value, Long order) throws Exception { if (value != null) { T v = (T) value; List<Long> orderList = acc.valueToOrderMap.get(v); if (orderList != null && orderList.size() > 0) { orderList.remove(0); if (orderList.isEmpty()) { acc.valueToOrderMap.remove(v); } else { acc.valueToOrderMap.put(v, orderList); } } else { List<Long> retractOrderList = acc.valueToOrderRetractMap.get(v); if (retractOrderList == null) { retractOrderList = new ArrayList<>(); } retractOrderList.add(order); acc.valueToOrderRetractMap.put(v, retractOrderList); } List<T> valueList = acc.orderToValueMap.get(order); int index; if (valueList != null && (index = valueList.indexOf(v)) >= 0) { valueList.remove(index); if (valueList.isEmpty()) { acc.orderToValueMap.remove(order); } else { acc.orderToValueMap.put(order, valueList); } } else { List<T> retractValueList = acc.orderToValueRetractMap.get(order); if (retractValueList == null) { retractValueList = new ArrayList<>(); } retractValueList.add(v); acc.orderToValueRetractMap.put(order, retractValueList); } if (v.equals(acc.value)) { updateValue(acc); } } }
Source:
public void updateCertificatePolicyCodeSnippets() { CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); certificateAsyncClient.getCertificatePolicy("certificateName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(certificatePolicyResponseValue -> { CertificatePolicy certificatePolicy = certificatePolicyResponseValue; certificatePolicy.setCertificateTransparent(true); certificateAsyncClient.updateCertificatePolicy("certificateName", certificatePolicy) .subscribe(updatedPolicy -> System.out.printf("Certificate policy's updated transparency status %s %n", updatedPolicy.isCertificateTransparent().toString())); }); END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicy#string certificateAsyncClient.getCertificatePolicy("certificateName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(certificatePolicyResponseValue -> { CertificatePolicy certificatePolicy = certificatePolicyResponseValue; certificatePolicy.setCertificateTransparent(true); certificateAsyncClient.updateCertificatePolicyWithResponse("certificateName", certificatePolicy) .subscribe(updatedPolicyResponse -> System.out.printf("Certificate policy's updated transparency status %s %n", updatedPolicyResponse.getValue().isCertificateTransparent().toString())); }); END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicyWithResponse#string }

Target:
public void updateCertificatePolicyCodeSnippets() { CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); certificateAsyncClient.getCertificatePolicy("certificateName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(certificatePolicyResponseValue -> { CertificatePolicy certificatePolicy = certificatePolicyResponseValue; certificatePolicy.setCertificateTransparent(true); certificateAsyncClient.updateCertificatePolicy("certificateName", certificatePolicy) .subscribe(updatedPolicy -> System.out.printf("Certificate policy's updated transparency status %s %n", updatedPolicy.isCertificateTransparent())); }); END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicy#string certificateAsyncClient.getCertificatePolicy("certificateName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(certificatePolicyResponseValue -> { CertificatePolicy certificatePolicy = certificatePolicyResponseValue; certificatePolicy.setCertificateTransparent(true); certificateAsyncClient.updateCertificatePolicyWithResponse("certificateName", certificatePolicy) .subscribe(updatedPolicyResponse -> System.out.printf("Certificate policy's updated transparency status %s %n", updatedPolicyResponse.getValue().isCertificateTransparent())); }); END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicyWithResponse#string }
Source:
public StoreKey getStoreKey(DataInputStream value) throws IOException { return BlobId.fromDataInputStream(value, clusterMap); }

Target:
public StoreKey getStoreKey(DataInputStream value) throws IOException { return new BlobId(value, clusterMap); }
Source:
private void handleStateChange(StateManager.CommunicationsState newState ){ if(newState == null) { return; } if(newState.isZoomChange()) { graph.getView().setScale(newState.getZoomValue()); return; } CVTEvents.getCVTEventBus().post(new CVTEvents.StateEvent(newState)); setStateButtonsEnabled(); graph.getModel().beginUpdate(); graph.resetGraph(); if(newState.getPinnedList() != null) { pinnedAccountModel.pinAccount(newState.getPinnedList()); } else { pinnedAccountModel.clear(); } currentFilter = new CommunicationsFilter(); currentFilter.addAndFilter(new CommunicationsFilter.RelationshipTypeFilter( ImmutableSet.of(CALL_LOG, MESSAGE))); newState.getCommunicationsFilters().forEach(filter -> { currentFilter.addAndFilter(filter); }); rebuildGraph(); graph.getModel().endUpdate(); fitGraph(); }

Target:
private void handleStateChange(StateManager.CommunicationsState newState ){ if(newState == null) { return; } if(newState.isZoomChange()) { graph.getView().setScale(newState.getZoomValue()); return; } CVTEvents.getCVTEventBus().post(new CVTEvents.StateEvent(newState)); setStateButtonsEnabled(); graph.getModel().beginUpdate(); graph.resetGraph(); if(newState.getPinnedList() != null) { pinnedAccountModel.pinAccount(newState.getPinnedList()); } else { pinnedAccountModel.clear(); } currentFilter = newState.getCommunicationsFilter(); rebuildGraph(); graph.getModel().endUpdate(); fitGraph(); }
Source:
private static void log(final RqFallback req) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final Throwable error = req.throwable(); final PrintStream stream = new PrintStream( baos, false, StandardCharsets.UTF_8.toString() ); error.printStackTrace(stream); stream.close(); Logger.getLogger(FbLog4j.class).error( String.format( "%s %s failed with %s: %s", new RqMethod.Base(req).method(), new RqHref.Base(req).href(), req.code(), baos.toString("UTF-8") ) ); }

Target:
private static void log(final RqFallback req) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final Throwable error = req.throwable(); final PrintStream stream = new PrintStream( baos, false, StandardCharsets.UTF_8.toString() ); try { error.printStackTrace(stream); } finally { stream.close(); } Logger.getLogger(FbLog4j.class).error( String.format( "%s %s failed with %s: %s", new RqMethod.Base(req).method(), new RqHref.Base(req).href(), req.code(), baos.toString("UTF-8") ) ); }
Source:
public void setUp() throws Exception { r.jenkins.getDescriptorByType(GlobalDefaultFlowDurabilityLevel.DescriptorImpl.class).setDurabilityHint(FlowDurabilityHint.PERFORMANCE_OPTIMIZED); deletePods(cloud.connect(), getLabels(cloud, this, name), false); warnings.record("", Level.WARNING).capture(1000); assertNotNull(createJobThenScheduleRun()); logs = logs.recordPackage(ContainerExecDecorator.class, Level.FINEST); }

Target:
public void setUp() throws Exception { r.jenkins.getDescriptorByType(GlobalDefaultFlowDurabilityLevel.DescriptorImpl.class).setDurabilityHint(FlowDurabilityHint.PERFORMANCE_OPTIMIZED); deletePods(cloud.connect(), getLabels(cloud, this, name), false); warnings.record("", Level.WARNING).capture(1000); assertNotNull(createJobThenScheduleRun()); }
Source:
private boolean validateServers(Set<String> serverNames) { for (String serverName : serverNames) { if (getVdsStaticDao().getAllForHost(serverName).size() > 0 || getVdsStaticDao().getAllWithIpAddress(serverName).size() > 0) { return true; } } return false; }

Target:
private boolean validateServers(Set<String> serverNames) { for (String serverName : serverNames) { if (getVdsStaticDao().getAllForHost(serverName).size() > 0 || getVdsStaticDao().getAllWithIpAddress(serverName).size() > 0) { return false; } } return true; }
Source:
public int[] order(int[] sortVector, SortModel.Dir direction, int[] range) { switch(direction) { case ASC: if (range == null || range.length == numRows) { HeapsortColumn.heapsortBitSet(bitSet, sortVector, numRows, true); } else { HeapsortColumn.heapsortBitSet(bitSet, sortVector, range.length, range, true); } break; case DESC: if (range == null || range.length == numRows) { HeapsortColumn.heapsortBitSet(bitSet, sortVector, numRows, false); } else { HeapsortColumn.heapsortBitSet(bitSet, sortVector, range.length, range, false); } break; } return sortVector; }

Target:
public int[] order(int[] sortVector, SortModel.Dir direction, int[] range) { if (range == null || range.length == numRows) { HeapsortColumn.heapsortBitSet(bitSet, sortVector, numRows, direction == SortModel.Dir.ASC); } else { HeapsortColumn.heapsortBitSet(bitSet, sortVector, range.length, range, direction == SortModel.Dir.ASC); } return sortVector; }
Source:
public RtReleases(final Request req, final Repo repo) { this.entry = req; this.owner = repo; this.request = this.releaseURI(repo) .back(); this.latest = this.releaseURI(repo) .path("/latest") .back(); this.tagged = this.releaseURI(repo) .path("/tags/"); }

Target:
public RtReleases(final Request req, final Repo repo) { this.entry = req; this.owner = repo; this.request = this.entry.uri() .path("/repos") .path(repo.coordinates().user()) .path(repo.coordinates().repo()) .path("/releases").back(); }
Source:
public Object[] getUserAndServerUrl(RealmConfiguration config) { if (config instanceof SyncConfiguration) { SyncConfiguration syncConfig = (SyncConfiguration) config; SyncUser user = syncConfig.getUser(); String rosServerUrl = syncConfig.getServerUrl().toString(); String rosUserIdentity = user.getIdentity(); String syncRealmAuthUrl = user.getAuthenticationUrl().toString(); String rosSerializedUser = user.toJson(); return new Object[]{rosUserIdentity, rosServerUrl, syncRealmAuthUrl, rosSerializedUser, syncConfig.syncClientValidateSsl(), syncConfig.getServerCertificateFilePath(), syncConfig.isPartialSync()}; } else { return new Object[7]; } }

Target:
public Object[] getUserAndServerUrl(RealmConfiguration config) { if (config instanceof SyncConfiguration) { SyncConfiguration syncConfig = (SyncConfiguration) config; SyncUser user = syncConfig.getUser(); String rosServerUrl = syncConfig.getServerUrl().toString(); String rosUserIdentity = user.getIdentity(); String syncRealmAuthUrl = user.getAuthenticationUrl().toString(); String rosSerializedUser = user.toJson(); byte sessionStopPolicy = syncConfig.getSessionStopPolicy().getNativeValue(); return new Object[]{rosUserIdentity, rosServerUrl, syncRealmAuthUrl, rosSerializedUser, syncConfig.syncClientValidateSsl(), syncConfig.getServerCertificateFilePath(), sessionStopPolicy, syncConfig.isPartialRealm()}; } else { return new Object[8]; } }
Source:
public boolean handle(ResponseMsg response, ChannelHandlerContext ctx) { IClientRouter router = client.getRouter(); long requestId = response.getHeader().getRequestId(); PayloadCase payloadCase = response.getPayload().getPayloadCase(); if (payloadCase.equals(PayloadCase.SERVER_ERROR)) { ErrorCase errorCase = response.getPayload().getServerError().getErrorCase(); if (errorHandlerMap.containsKey(errorCase)) { try{ errorHandlerMap.get(errorCase).handle(response, ctx, router); } catch (Throwable e) { router.completeExceptionally(requestId, e); } } } else if (handlerMap.containsKey(payloadCase)) { try { Object ret = handlerMap.get(payloadCase).handle(response, ctx, router); if (ret != null) { router.completeRequest(requestId, ret); } } catch (Throwable e) { router.completeExceptionally(requestId, e); } return true; } return false; }

Target:
public boolean handle(ResponseMsg response, ChannelHandlerContext ctx) { IClientRouter router = client.getRouter(); final long requestId = response.getHeader().getRequestId(); PayloadCase payloadCase = response.getPayload().getPayloadCase(); if (payloadCase == PayloadCase.SERVER_ERROR) { ErrorCase errorCase = response.getPayload().getServerError().getErrorCase(); if (errorHandlerMap.containsKey(errorCase)) { try{ errorHandlerMap.get(errorCase).handle(response, ctx, router); } catch (Throwable e) { router.completeExceptionally(requestId, e); } } } else if (handlerMap.containsKey(payloadCase)) { try { Object ret = handlerMap.get(payloadCase).handle(response, ctx, router); if (ret != null) { router.completeRequest(requestId, ret); } } catch (Throwable e) { router.completeExceptionally(requestId, e); } return true; } return false; }
Source:
public TmfModelResponse<ITmfCommonXAxisModel> fetchXY(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { boolean isComplete = true; ImmutableMap.Builder<String, IYModel> series = ImmutableMap.builder(); for (ITmfXYDataProvider dataProvider : fProviders) { TmfModelResponse<ITmfCommonXAxisModel> response = dataProvider.fetchXY(filter, monitor); isComplete &= response.getStatus() == ITmfResponse.Status.COMPLETED; ITmfCommonXAxisModel model = response.getModel(); if (model != null) { series.putAll(model.getYData()); } if (monitor != null && monitor.isCanceled()) { TmfCommonXAxisResponseFactory.createCancelledResponse(CommonStatusMessage.TASK_CANCELLED); } } return TmfCommonXAxisResponseFactory.create(fTitle, filter.getTimesRequested(), series.build(), isComplete); }

Target:
public TmfModelResponse<ITmfCommonXAxisModel> fetchXY(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { boolean isComplete = true; ImmutableMap.Builder<String, IYModel> series = ImmutableMap.builder(); for (ITmfXYDataProvider dataProvider : fProviders) { TmfModelResponse<ITmfCommonXAxisModel> response = dataProvider.fetchXY(filter, monitor); isComplete &= response.getStatus() == ITmfResponse.Status.COMPLETED; ITmfCommonXAxisModel model = response.getModel(); if (model != null) { series.putAll(model.getYData()); } if (monitor != null && monitor.isCanceled()) { return TmfCommonXAxisResponseFactory.createCancelledResponse(CommonStatusMessage.TASK_CANCELLED); } } return TmfCommonXAxisResponseFactory.create(fTitle, filter.getTimesRequested(), series.build(), isComplete); }
Source:
private static PagesHashStrategy pagesHashStrategy() { return new SimplePagesHashStrategy( ImmutableList.of(BIGINT), ImmutableList.of(), ImmutableList.of(ImmutableList.of(TEST_PAGE.getBlock(0))), ImmutableList.of(), Optional.empty(), Optional.of(new SortExpressionExtractor.RowSortExpressionContext(0))); }

Target:
private static PagesHashStrategy pagesHashStrategy() { return new SimplePagesHashStrategy( ImmutableList.of(BIGINT), ImmutableList.of(), ImmutableList.of(ImmutableList.of(TEST_PAGE.getBlock(0))), ImmutableList.of(), Optional.empty(), Optional.of(0)); }
Source:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } if (getStoragePool() == null && getActionType().getQuotaDependency() != VdcActionType.QuotaDependency.NONE) { log.error("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); return false; } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper(this, getReturnValue().getCanDoActionMessages()); quotaConsumptionParametersWrapper.setParameters(getQuotaConsumptionParameters()); return quotaConsumptionParametersWrapper.getParameters().isEmpty() || getQuotaManager().consume(quotaConsumptionParametersWrapper); }

Target:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } if (getStoragePool() == null && isQuotaDependant()) { log.error("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); return false; } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper(this, getReturnValue().getCanDoActionMessages()); quotaConsumptionParametersWrapper.setParameters(getQuotaConsumptionParameters()); if (quotaConsumptionParametersWrapper.getParameters() == null || quotaConsumptionParametersWrapper.getParameters().isEmpty()) { log.error("Command: " + this.getClass().getName() + ". No Quota parameters available."); return false; } return getQuotaManager().consume(quotaConsumptionParametersWrapper); }
Source:
public void onUpdate() { if (this.worldObj.blockExists(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ))) { super.onUpdate(); this.sendMotionUpdates(); } if (!this.isSprinting() && runToggle) { if (canSprint()) { setSprinting(true); this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 4)); }else{ setSprinting(false); } } }

Target:
public void onUpdate() { if (this.worldObj.blockExists(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ))) { super.onUpdate(); this.sendMotionUpdates(); } if (!this.isSprinting() && runToggle) { if (canSprint()) { setSprinting(true); this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 4)); } }else if(this.isSprinting() && !canSprint){ setSprinting(false); runToggle = false; } }
Source:
public void SentMessage_shouldFillInAllParameters() { Message message = new Message(); message.setId(1); message.setSubject("hello world"); message.setContent("hello world content"); message.setContentType("plain text"); message.setSentDate(new Date()); SentMessage sm = new SentMessage(message, 2, 3); Assert.assertEquals(message.getId(), sm.getMessageId()); Assert.assertEquals(Integer.valueOf(2), sm.getSenderId()); Assert.assertEquals(Integer.valueOf(3), sm.getReceiverId()); Assert.assertEquals(message.getSubject(), sm.getSubject()); Assert.assertEquals(message.getContent(), sm.getContent()); Assert.assertEquals(message.getContentType(), sm.getContentType()); Assert.assertEquals(message.getSentDate(), sm.getSentDate()); }

Target:
public void SentMessage_shouldFillInAllParameters() { Message message = new Message(); message.setId(1); message.setSubject("hello world"); message.setContent("hello world content"); message.setContentType("plain text"); message.setSentDate(new Date()); User sender = new User(); User receiver = new User(); sender.setUserId(2); receiver.setUserId(3); SentMessage sm = new SentMessage(message, sender, receiver); Assert.assertEquals(message.getId(), sm.getMessageId()); Assert.assertEquals(Integer.valueOf(2), sm.getSender().getUserId()); Assert.assertEquals(Integer.valueOf(3), sm.getReceiver().getUserId()); Assert.assertEquals(message.getSubject(), sm.getSubject()); Assert.assertEquals(message.getContent(), sm.getContent()); Assert.assertEquals(message.getContentType(), sm.getContentType()); Assert.assertEquals(message.getSentDate(), sm.getSentDate()); }
Source:
public void handleCreatedEvent(ClientCacheEntryCreatedEvent e) { createdEvents.add(e); System.out.println("Created " + e); }

Target:
public void handleCreatedEvent(ClientCacheEntryCreatedEvent e) { createdEvents.add(e); }
Source:
public <V> Future<V> execute(BackgroundTask<V> task) { Task<V> javafxTask = getJavaFXTask(task); if (task.showToUser()) { Globals.stateManager.addBackgroundTask(javafxTask); } return execute(javafxTask); }

Target:
public <V> Future<V> execute(BackgroundTask<V> task) { Task<V> javafxTask = getJavaFXTask(task); if (task.showToUser()) { stateManager.addBackgroundTask(javafxTask); } return execute(javafxTask); }
Source:
private static List<Contig> getContigsInReadGroupSet(String readGroupSetId, SexChromosomeFilter sexChromosomeFilter, GenomicsFactory.OfflineAuth auth) throws IOException, GeneralSecurityException { String referenceSetId = GenomicsUtils.getReferenceSetId(readGroupSetId, auth); if(null == referenceSetId) { throw new IllegalArgumentException("No referenceSetId associated with readGroupSetId " + readGroupSetId + "."); } List<Contig> contigs = Lists.newArrayList(); for (Reference reference : GenomicsUtils.getReferences(referenceSetId, auth)) { String referenceName = reference.getName().toLowerCase(); if (sexChromosomeFilter == SexChromosomeFilter.EXCLUDE_XY && (referenceName.contains("x") || referenceName.contains("y"))) { continue; } contigs.add(new Contig(reference.getName(), 0, reference.getLength())); } return contigs; }

Target:
private static List<Contig> getContigsInReadGroupSet(String readGroupSetId, SexChromosomeFilter sexChromosomeFilter, GenomicsFactory.OfflineAuth auth) throws IOException, GeneralSecurityException { List<Contig> contigs = Lists.newArrayList(); for (CoverageBucket bucket : GenomicsUtils.getCoverageBuckets(readGroupSetId, auth)) { if (sexChromosomeFilter == SexChromosomeFilter.EXCLUDE_XY && SEX_CHROMOSOME_REGEXP.matcher(bucket.getRange().getReferenceName()).matches()) { continue; } contigs.add(new Contig(bucket.getRange().getReferenceName(), (null == bucket.getRange().getStart()) ? 0 : bucket.getRange().getStart(), bucket.getRange().getEnd())); } return contigs; }
Source:
public void testValidateMultipleInvalidAttributes() throws UnsupportedQueryException { List<SourceAttributeRestriction> restrictions = ImmutableList.of(mockRestriction("src-1", ImmutableSet.of("attr-1"))); Mockito.when(attributeExtractor.extractAttributes(any())) .thenReturn(ImmutableSet.of("attr-2", "attr-3")); QueryRequest request = mockQueryRequest("src-1"); validator = new UnsupportedAttributeQueryValidator(attributeExtractor); validator.setSourceAttributeRestrictions(restrictions); Set<QueryValidationViolation> violations = validator.validate(request); assertThat(violations, hasSize(2)); for (QueryValidationViolation violation : violations) { assertThat(violation.getSeverity(), is(Severity.ERROR)); Map<String, Object> extraData = violation.getExtraData(); assertThat((Set<String>) extraData.get("sources"), Matchers.hasItems("src-1")); String attribute = (String) extraData.get("attribute"); if (attribute.equals("attr-2")) { assertThat( violation.getMessage(), is("The field \"attr-2\" is not supported by the src-1 Content Store(s)")); } else if (attribute.equals("attr-3")) { assertThat( violation.getMessage(), is("The field \"attr-3\" is not supported by the src-1 Content Store(s)")); } else { fail("Unknown attribute found in violations"); } } }

Target:
public void testValidateMultipleInvalidAttributes() throws UnsupportedQueryException { Mockito.when(attributeExtractor.extractAttributes(any())) .thenReturn(ImmutableSet.of("attr-2", "attr-3")); QueryRequest request = mockQueryRequest("src-1"); validator = new UnsupportedAttributeQueryValidator(attributeExtractor, messageFormatSupplier); validator.bind(mockRestriction("src-1", ImmutableSet.of("attr-1"))); Set<QueryValidationViolation> violations = validator.validate(request); QueryValidationViolation violation1 = makeViolation( "The field \"attr-2\" is not supported by the src-1 Source(s)", "attr-2", "src-1"); QueryValidationViolation violation2 = makeViolation( "The field \"attr-3\" is not supported by the src-1 Source(s)", "attr-3", "src-1"); assertThat(violations, hasSize(2)); assertThat(violations, hasItems(violation1, violation2)); }
Source:
private static EntitySpec<?> createEntitySpecFromServicesBlock(String plan, BrooklynClassLoadingContext loader, Set<String> encounteredTypes, boolean isApplication) { CampPlatform camp = CampInternalUtils.getCampPlatform(loader.getManagementContext()); AssemblyTemplate at = CampInternalUtils.registerDeploymentPlan(plan, loader, camp); AssemblyTemplateInstantiator instantiator = CampInternalUtils.getInstantiator(at); if (instantiator instanceof AssemblyTemplateSpecInstantiator) { EntitySpec<? extends Application> appSpec = ((AssemblyTemplateSpecInstantiator)instantiator).createApplicationSpec(at, camp, loader, encounteredTypes); if (!isApplication && EntityManagementUtils.canPromoteChildrenInWrappedApplication(appSpec) && appSpec.getChildren().size()==1) { CampInternalUtils.resetSpecIfTemplateHasNoExplicitParameters(at, appSpec); EntitySpec<?> childSpec = appSpec.getChildren().get(0); EntityManagementUtils.mergeWrapperParentSpecToChildEntity(appSpec, childSpec); return childSpec; } return appSpec; } else { throw new IllegalStateException("Unable to instantiate YAML; incompatible instantiator "+instantiator+" for "+at); } }

Target:
private static EntitySpec<?> createEntitySpecFromServicesBlock(String plan, BrooklynClassLoadingContext loader, Set<String> encounteredTypes, boolean isApplication) { CampPlatform camp = CampInternalUtils.getCampPlatform(loader.getManagementContext()); AssemblyTemplate at = CampInternalUtils.registerDeploymentPlan(plan, loader, camp); AssemblyTemplateInstantiator instantiator = CampInternalUtils.getInstantiator(at); if (instantiator instanceof AssemblyTemplateSpecInstantiator) { EntitySpec<? extends Application> appSpec = ((AssemblyTemplateSpecInstantiator)instantiator).createApplicationSpec(at, camp, loader, encounteredTypes); if (!isApplication && EntityManagementUtils.canPromoteChildrenInWrappedApplication(appSpec)) { EntitySpec<?> childSpec = Iterables.getOnlyElement(appSpec.getChildren()); EntityManagementUtils.mergeWrapperParentSpecToChildEntity(appSpec, childSpec); return childSpec; } return appSpec; } else { throw new IllegalStateException("Unable to instantiate YAML; incompatible instantiator "+instantiator+" for "+at); } }
Source:
public void setFreshnessThreshold(final int value) { _freshnessThreshold = value; }

Target:
public void setFreshnessThreshold(final int value) { _freshnessThresholdInSeconds = value; }