auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void managerEmitterHandlingTest() throws Exception { emitter.purgeAllData(); metric.notifyManager(); Date from = new Date(); synchronized (this) { try { wait(2000); } catch (InterruptedException e) { e.printStackTrace(); } } Date to = new Date(); List<InMemoryHistoryNode> nodes = emitter.getDrawMetric("FakeMetric", from, to, false); assertEquals("Failed to report metric", 1, nodes.size()); assertEquals("Failed to report metric", nodes.get(0).getValue(), 4); }

Target:
public void managerEmitterHandlingTest() throws Exception { emitter.purgeAllData(); Date from = new Date(); metric.notifyManager(); synchronized (this) { try { wait(2000); } catch (InterruptedException e) { e.printStackTrace(); } } Date to = new Date(); List<InMemoryHistoryNode> nodes = emitter.getMetrics("FakeMetric", from, to, false); assertEquals("Failed to report metric", 1, nodes.size()); assertEquals("Failed to report metric", nodes.get(0).getValue(), 4); }
Source:
public static Scope getSurroundingScope(DetailAST node) { Scope returnValue = null; for (DetailAST token = node.getParent(); token != null; token = token.getParent()) { final int type = token.getType(); if (TokenUtil.isOfType(type, TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF, TokenTypes.ANNOTATION_DEF, TokenTypes.ENUM_DEF)) { final DetailAST mods = token.findFirstToken(TokenTypes.MODIFIERS); final Scope modScope = getScopeFromMods(mods); if (returnValue == null || returnValue.isIn(modScope)) { returnValue = modScope; } } else if (TokenUtil.isOfType(type, TokenTypes.LITERAL_NEW)) { returnValue = Scope.ANONINNER; break; } } return returnValue; }

Target:
public static Scope getSurroundingScope(DetailAST node) { Scope returnValue = null; for (DetailAST token = node.getParent(); token != null; token = token.getParent()) { final int type = token.getType(); if (TokenUtil.isTypeDeclaration(type)) { final DetailAST mods = token.findFirstToken(TokenTypes.MODIFIERS); final Scope modScope = getScopeFromMods(mods); if (returnValue == null || returnValue.isIn(modScope)) { returnValue = modScope; } } else if (type == TokenTypes.LITERAL_NEW) { returnValue = Scope.ANONINNER; break; } } return returnValue; }
Source:
public static ByteBuf encodeSimpleMetadata( ByteBufAllocator allocator, char[] username, char[] password) { int usernameLength = CharByteBufUtil.utf8Bytes(username); if (usernameLength > 256) { throw new IllegalArgumentException( "Username should be shorter than or equal to 256 bytes length in UTF-8 encoding"); } int passwordLength = CharByteBufUtil.utf8Bytes(password); int capacity = AUTH_TYPE_ID_LENGTH + USERNAME_BYTES_LENGTH + usernameLength + passwordLength; final ByteBuf buffer = allocator .buffer(capacity, capacity) .writeByte(WellKnownAuthType.SIMPLE.getIdentifier() | STREAM_METADATA_KNOWN_MASK) .writeByte(usernameLength); CharByteBufUtil.writeUtf8(buffer, username); CharByteBufUtil.writeUtf8(buffer, password); return buffer; }

Target:
public static ByteBuf encodeSimpleMetadata( ByteBufAllocator allocator, char[] username, char[] password) { int usernameLength = CharByteBufUtil.utf8Bytes(username); if (usernameLength > 255) { throw new IllegalArgumentException( "Username should be shorter than or equal to 255 bytes length in UTF-8 encoding"); } int passwordLength = CharByteBufUtil.utf8Bytes(password); int capacity = AUTH_TYPE_ID_LENGTH + USERNAME_BYTES_LENGTH + usernameLength + passwordLength; final ByteBuf buffer = allocator .buffer(capacity, capacity) .writeByte(WellKnownAuthType.SIMPLE.getIdentifier() | STREAM_METADATA_KNOWN_MASK) .writeByte(usernameLength); CharByteBufUtil.writeUtf8(buffer, username); CharByteBufUtil.writeUtf8(buffer, password); return buffer; }
Source:
@Override public long getNodeStartTime() { LongMetricImpl startTime = sysreg.metric("NodeStartTime", null); startTime.add(nodeStartTime); return startTime.value(); }

Target:
@Override public long getNodeStartTime() { return nodeStartTime; }
Source:
public boolean isInstanceOfScoped(EObject object, EClass clazz) { Object typeKey = toKey(object.eClass()); if (!doCalculateInstanceOf(typeKey, clazz)) { return false; } final Set<EObject> instances = instanceStore.getInstanceSet(typeKey); return instances != null && instances.contains(object); }

Target:
public boolean isInstanceOfScoped(EObject object, EClass clazz) { Object typeKey = toKey(object.eClass()); if (!doCalculateInstanceOf(typeKey, toKey(clazz))) { return false; } final Set<EObject> instances = instanceStore.getInstanceSet(typeKey); return instances != null && instances.contains(object); }
Source:
protected void configure(HttpSecurity http) throws Exception { http .anonymous() .principal("custom") .and() .anonymous(); }

Target:
protected void configure(HttpSecurity http) throws Exception { http .anonymous() .key("key") .principal("principal") .and() .anonymous(); }
Source:
private static ByteBuffer makeCatalogVersionAndBytes( int catalogVersion, long txnId, long uniqueId, byte[] catalogBytes, byte[] catalogHash, byte[] deploymentBytes) { ByteBuffer versionAndBytes = ByteBuffer.allocate( 4 + catalogBytes.length + 4 + deploymentBytes.length + 4 + 8 + 8 + 20 + 20 ); versionAndBytes.putInt(catalogVersion); versionAndBytes.putLong(txnId); versionAndBytes.putLong(uniqueId); if (catalogHash != null) { versionAndBytes.put(catalogHash); } else { try { versionAndBytes.put((new InMemoryJarfile(catalogBytes)).getSha1Hash()); } catch (IOException ioe) { VoltDB.crashLocalVoltDB("Unable to build InMemoryJarfile from bytes, should never happen.", true, ioe); } } versionAndBytes.put(makeDeploymentHash(deploymentBytes)); versionAndBytes.putInt(catalogBytes.length); versionAndBytes.put(catalogBytes); versionAndBytes.putInt(deploymentBytes.length); versionAndBytes.put(deploymentBytes); return versionAndBytes; }

Target:
private static ByteBuffer makeCatalogVersionAndBytes( int catalogVersion, long txnId, long uniqueId, byte[] catalogBytes, byte[] catalogHash, byte[] deploymentBytes) { ByteBuffer versionAndBytes = ByteBuffer.allocate( 4 + catalogBytes.length + 4 + deploymentBytes.length + 4 + 8 + 8 + 20 + 20 ); if (catalogHash == null) { try { catalogHash = (new InMemoryJarfile(catalogBytes)).getSha1Hash(); } catch (IOException ioe) { VoltDB.crashLocalVoltDB("Unable to build InMemoryJarfile from bytes, should never happen.", true, ioe); } } versionAndBytes.putInt(catalogVersion); versionAndBytes.putLong(txnId); versionAndBytes.putLong(uniqueId); versionAndBytes.put(catalogHash); versionAndBytes.put(makeDeploymentHash(deploymentBytes)); versionAndBytes.putInt(catalogBytes.length); versionAndBytes.put(catalogBytes); versionAndBytes.putInt(deploymentBytes.length); versionAndBytes.put(deploymentBytes); return versionAndBytes; }
Source:
private static BytecodeNode cast( BytecodeGeneratorContext generatorContext, BytecodeNode argument, Type actualType, TypeSignature requiredType) { if (actualType.getTypeSignature().equals(requiredType)) { return argument; } FunctionHandle functionHandle = generatorContext .getFunctionManager() .lookupCast(fromOperatorType(CAST), actualType.getTypeSignature(), requiredType); return generatorContext.generateCall(CAST.name(), generatorContext.getFunctionManager().getScalarFunctionImplementation(functionHandle), ImmutableList.of(argument)); }

Target:
private static BytecodeNode cast( BytecodeGeneratorContext generatorContext, BytecodeNode argument, Type actualType, TypeSignature requiredType) { if (actualType.getTypeSignature().equals(requiredType)) { return argument; } FunctionHandle functionHandle = generatorContext .getFunctionManager() .lookupCast(CastType.CAST, actualType.getTypeSignature(), requiredType); return generatorContext.generateCall(CAST.name(), generatorContext.getFunctionManager().getScalarFunctionImplementation(functionHandle), ImmutableList.of(argument)); }
Source:
public PagedIterable<ModelData> createModels(List<String> models) { return new PagedIterable<>(digitalTwinsAsyncClient.createModels(models)); }

Target:
public List<ModelData> createModels(List<String> models) { return createModelsWithResponse(models, Context.NONE).getValue(); }
Source:
public void testNonBundleFails() throws Exception { Repository newRepo = createBareRepository(); thrown.expect(TransportException.class); fetchFromBundle(newRepo, "Not a bundle file".getBytes(StandardCharsets.UTF_8)); }

Target:
public void testNonBundleFails() throws Exception { Repository newRepo = createBareRepository(); thrown.expect(TransportException.class); fetchFromBundle(newRepo, "Not a bundle file".getBytes(UTF_8)); }
Source:
public void put(K key, V value) { if (inFlightRequests.putIfAbsent(key, value) != null) { return; } Futures.getUnchecked(valuePutter.apply(Maps.immutableEntry(key, value))); }

Target:
public void put(K key, V value) { Futures.getUnchecked(valuePutter.apply(Maps.immutableEntry(key, value))); }
Source:
@Test public void arrayIterable() throws Exception { FormUrlEncodedTypedOutput fe = new FormUrlEncodedTypedOutput(); fe.addField("ping", Arrays.asList(new String[]{"pong", "pong-too"})); ByteArrayOutputStream out = new ByteArrayOutputStream(); fe.writeTo(out); String actual = new String(out.toByteArray(), "UTF-8"); assertThat(actual).isEqualTo("ping=pong&ping=pong-too"); }

Target:
@Test public void arrayIterable() throws Exception { FormUrlEncodedTypedOutput fe = new FormUrlEncodedTypedOutput(); fe.addField("ping", Arrays.asList("pong", "pong-too")); ByteArrayOutputStream out = new ByteArrayOutputStream(); fe.writeTo(out); String actual = new String(out.toByteArray(), "UTF-8"); assertThat(actual).isEqualTo("ping=pong&ping=pong-too"); }
Source:
public abstract Ref getRef(String name) throws IOException; public Ref getExactRef(String name) throws IOException { int slash = name.lastIndexOf('/'); return getRefs(name.substring(0, slash+1)).get(name); }

Target:
public abstract Ref getRef(String name) throws IOException; public Ref exactRef(String name) throws IOException { int slash = name.lastIndexOf('/'); Ref result = getRefs(name.substring(0, slash + 1)).get(name); if (result != null || slash != -1) { return result; } for (Ref ref : getAdditionalRefs()) { if (name.equals(ref.getName())) { return ref; } } return null; }
Source:
public void testGetVirtualGuestOperatingSystemsWithMissingReferenceCode() { ContainerVirtualGuestConfigurationOption os = ContainerVirtualGuestConfigurationOption.builder() .productItemPrice(ProductItemPrice.builder() .hourlyRecurringFee(0.131f) .recurringFee("90.63") .item(ProductItem.builder().description("Windows Server 2012 Datacenter Edition (64bit)").build()) .build()) .template(VirtualGuest.builder().build()) .build(); ContainerVirtualGuestConfiguration conf = ContainerVirtualGuestConfiguration.builder() .blockDevices(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .datacenters(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .memory(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .networkComponents(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .operatingSystems(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of(os)) .processors(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .build(); Set<OperatingSystem> virtualGuestOperatingSystems = conf.getVirtualGuestOperatingSystems(); assertTrue(virtualGuestOperatingSystems.isEmpty()); }

Target:
public void testGetVirtualGuestOperatingSystemsWithMissingReferenceCode() { ContainerVirtualGuestConfigurationOption osValid = ContainerVirtualGuestConfigurationOption.builder() .productItemPrice(ProductItemPrice.builder() .hourlyRecurringFee(0) .recurringFee("0") .item(ProductItem.builder().description("CentOS - Latest").build()) .build()) .template(VirtualGuest.builder().operatingSystemReferenceCode("CENTOS_LATEST").build()) .build(); ContainerVirtualGuestConfigurationOption osInvalid = ContainerVirtualGuestConfigurationOption.builder() .productItemPrice(ProductItemPrice.builder() .hourlyRecurringFee(0.131f) .recurringFee("90.63") .item(ProductItem.builder().description("Windows Server 2012 Datacenter Edition (64bit)").build()) .build()) .template(VirtualGuest.builder().build()) .build(); ContainerVirtualGuestConfiguration conf = ContainerVirtualGuestConfiguration.builder() .blockDevices(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .datacenters(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .memory(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .networkComponents(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .operatingSystems(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of(osValid, osInvalid)) .processors(ImmutableSet.<ContainerVirtualGuestConfigurationOption>of()) .build(); Set<OperatingSystem> virtualGuestOperatingSystems = conf.getVirtualGuestOperatingSystems(); OperatingSystem os = Iterables.getOnlyElement(virtualGuestOperatingSystems); assertEquals(os.getOperatingSystemReferenceCode(), osValid.getTemplate().getOperatingSystemReferenceCode()); }
Source:
private boolean internalCanDoAction() { boolean returnValue = false; try { Transaction transaction = null; if (!isCanDoActionSupportsTransaction()) { transaction = TransactionSupport.suspend(); } try { returnValue = isUserAuthorizedToRunAction() && isBackwardsCompatible() && validateInputs() && acquireLock() && canDoAction() && internalValidateAndSetQuota(); if (!returnValue && getReturnValue().getCanDoActionMessages().size() > 0) { List<String> canDos = getBackend().getErrorsTranslator(). TranslateErrorText(getReturnValue().getCanDoActionMessages()); log.warn("CanDoAction of action '{}' failed for user {}. Reasons: {}", getActionType(), getUserName(), StringUtils.join(canDos, ',')); } } finally { if (transaction != null) { TransactionSupport.resume(transaction); } } } catch (DataAccessException dataAccessEx) { log.error("Data access error during CanDoActionFailure.", dataAccessEx); addCanDoActionMessage(EngineMessage.CAN_DO_ACTION_DATABASE_CONNECTION_FAILURE); } catch (RuntimeException ex) { log.error("Error during CanDoActionFailure.", ex); addCanDoActionMessage(EngineMessage.CAN_DO_ACTION_GENERAL_FAILURE); } finally { if (!returnValue) { freeLock(); } } return returnValue; }

Target:
private boolean internalCanDoAction() { boolean returnValue = false; try { Transaction transaction = null; if (!isCanDoActionSupportsTransaction()) { transaction = TransactionSupport.suspend(); } try { returnValue = isUserAuthorizedToRunAction() && isBackwardsCompatible() && validateInputs() && acquireLock() && canDoAction() && internalValidateAndSetQuota(); if (!returnValue && getReturnValue().getCanDoActionMessages().size() > 0) { log.warn("CanDoAction of action '{}' failed for user {}. Reasons: {}", getActionType(), getUserName(), StringUtils.join(getReturnValue().getCanDoActionMessages(), ',')); } } finally { if (transaction != null) { TransactionSupport.resume(transaction); } } } catch (DataAccessException dataAccessEx) { log.error("Data access error during CanDoActionFailure.", dataAccessEx); addCanDoActionMessage(EngineMessage.CAN_DO_ACTION_DATABASE_CONNECTION_FAILURE); } catch (RuntimeException ex) { log.error("Error during CanDoActionFailure.", ex); addCanDoActionMessage(EngineMessage.CAN_DO_ACTION_GENERAL_FAILURE); } finally { if (!returnValue) { freeLock(); } } return returnValue; }
Source:
public Block readBlock(Type type) throws IOException { if (!rowGroupOpen) { openRowGroup(); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } for (StreamReader structField : structFields.values()) { structField.prepareNextRead(readOffset); } } List<Type> typeParameters = type.getTypeParameters(); boolean[] nullVector = new boolean[nextBatchSize]; Block[] blocks; if (presentStream == null) { blocks = getBlocksForType(type, nextBatchSize); } else { int nullValues = presentStream.getUnsetBits(nextBatchSize, nullVector); if (nullValues != nextBatchSize) { blocks = getBlocksForType(type, nextBatchSize - nullValues); } else { blocks = new Block[typeParameters.size()]; for (int i = 0; i < typeParameters.size(); i++) { blocks[i] = typeParameters.get(i).createBlockBuilder(null, 0).build(); } } } verify(Arrays.stream(blocks) .mapToInt(Block::getPositionCount) .distinct() .count() == 1); Block rowBlock = RowBlock.fromFieldBlocks(nullVector, blocks); readOffset = 0; nextBatchSize = 0; return rowBlock; }

Target:
public Block readBlock(Type type) throws IOException { if (!rowGroupOpen) { openRowGroup(); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } for (StreamReader structField : structFields.values()) { structField.prepareNextRead(readOffset); } } boolean[] nullVector = new boolean[nextBatchSize]; Block[] blocks; if (presentStream == null) { blocks = getBlocksForType(type, nextBatchSize); } else { int nullValues = presentStream.getUnsetBits(nextBatchSize, nullVector); if (nullValues != nextBatchSize) { blocks = getBlocksForType(type, nextBatchSize - nullValues); } else { List<Type> typeParameters = type.getTypeParameters(); blocks = new Block[typeParameters.size()]; for (int i = 0; i < typeParameters.size(); i++) { blocks[i] = typeParameters.get(i).createBlockBuilder(null, 0).build(); } } } verify(Arrays.stream(blocks) .mapToInt(Block::getPositionCount) .distinct() .count() == 1); Block rowBlock = RowBlock.fromFieldBlocks(nullVector, blocks); readOffset = 0; nextBatchSize = 0; return rowBlock; }
Source:
public CallStatus run() { RequestMetrics.Context context = metrics.startHealthRequest(); LOGGER.debug("run: health"); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); try { Map<String, HealthCheck.Result> healthCheckResults = new LinkedHashMap<>(); CallStatus callStatus = new CallStatus(); for (Map.Entry<String, Result> entry : CrudCheckRegistry.getHealthCheckRegistry().runHealthChecks().entrySet()) { if (entry.getValue().isHealthy()) { LOGGER.debug("healthCheck is OK", entry.getKey()); healthCheckResults.put(entry.getKey(), entry.getValue()); } else { String errorDetails = entry.getKey().toString() + " " + entry.getValue().getDetails(); Error.push("healthCheck failed! " + errorDetails); LOGGER.debug("healthCheck failed!", errorDetails); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_CHECK_HEALTH, errorDetails)); } } return new CallStatus(new CrudCheckResponse(healthCheckResults)); } catch (Error e) { context.markRequestException(e); LOGGER.error("checkHealth failure: {}", e); return new CallStatus(e); } catch (Exception e) { context.markRequestException(e); LOGGER.error("checkHealth failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_CHECK_HEALTH, e.toString())); } finally { context.endRequestMonitoring(); } }

Target:
public CallStatus run() { RequestMetrics.Context context = metrics.startHealthRequest(); LOGGER.debug("run: health"); Error.reset(); Error.push("rest"); Error.push(getClass().getSimpleName()); try { Response.Status healthCheckResponse = Response.Status.OK; Map<String, HealthCheck.Result> healthCheckResults = new LinkedHashMap<>(); for (Map.Entry<String, Result> entry : healthCheckRegistry.runHealthChecks().entrySet()) { if (entry.getValue().isHealthy()) { LOGGER.debug("healthCheck is OK", entry.getKey()); healthCheckResults.put(entry.getKey(), entry.getValue()); } else { String errorDetails = entry.getKey().toString() + " " + entry.getValue().getDetails(); Error.push("healthCheck failed! " + errorDetails); LOGGER.debug("healthCheck failed!", errorDetails); healthCheckResults.put(entry.getKey(), entry.getValue()); healthCheckResponse = Response.Status.SERVICE_UNAVAILABLE; } } return new CallStatus(new CrudCheckResponse(healthCheckResults), healthCheckResponse); } catch (Error e) { context.markRequestException(e); LOGGER.error("checkHealth failure: {}", e); return new CallStatus(e); } catch (Exception e) { context.markRequestException(e); LOGGER.error("checkHealth failure: {}", e); return new CallStatus(Error.get(RestCrudConstants.ERR_REST_CHECK_HEALTH, e.toString())); } finally { context.endRequestMonitoring(); } }
Source:
private List<StudentAttributes> getOldStudentsForMigration(ScriptTarget target) { List<StudentAttributes> students; if (target == ScriptTarget.BY_TIME) { Calendar startCal = Calendar.getInstance(); startCal.add(Calendar.DAY_OF_YEAR, -1 * numDays); students = getOldStudentsSince(startCal.getTime()); } else if (target == ScriptTarget.BY_COURSE) { students = getOldStudentsForCourse(courseId); } else if (target == ScriptTarget.ALL) { students = getAllOldStudents(); } else { students = null; Assumption.fail("no target selected"); } return students; }

Target:
private List<StudentAttributes> getOldStudentsForMigration(ScriptTarget target) { switch (target) { case BY_TIME: Calendar startCal = Calendar.getInstance(); startCal.add(Calendar.DAY_OF_YEAR, -1 * numDays); return getOldStudentsSince(startCal.getTime()); case BY_COURSE: return getOldStudentsForCourse(courseId); case ALL: return getAllOldStudents(); default: Assumption.fail("no target selected"); return null; } }
Source:
public Transaction beginTransaction(TxIsolation isolation) { SpiTransaction t = transactionManager.createTransaction(true, isolation.getLevel()); return transactionManager.wrapAsScopedTransaction(t); }

Target:
public Transaction beginTransaction(TxIsolation isolation) { SpiTransaction t = transactionManager.createTransaction(true, isolation.getLevel()); try { transactionManager.set(t); } catch (PersistenceException existingTransactionError) { t.end(); throw existingTransactionError; } return t; }
Source:
private MagicCommandFunctionality classpathAddJar() { return (code, command, message, executionCount) -> { String[] split = command.split(" "); try { if (split.length != 4) { throw new IllegalStateException("Wrong command format: " + CLASSPATH_ADD_JAR); } String path = split[3]; if (doesPathContainsWildCards(path)) { getPaths(path) .forEach(currentPath -> kernel.addJarToClasspath(new PathToJar(currentPath))); } else { validatePath(path); this.kernel.addJarToClasspath(new PathToJar(path)); } return getMagicCommandItem(code, message, executionCount); } catch (IllegalStateException e) { return new MagicCommandItemWithResult( messageCreator .buildOutputMessage(message, e.getMessage(), true), messageCreator.buildReplyWithoutStatus(message, executionCount) ); } }; }

Target:
private MagicCommandFunctionality classpathAddJar() { return (code, command, message, executionCount) -> { String[] split = command.split(" "); try { if (split.length != 4) { throw new IllegalStateException("Wrong command format: " + CLASSPATH_ADD_JAR); } String path = split[3]; if (doesPathContainsWildCards(path)) { validateWildcardPath(path); getPaths(path) .forEach(currentPath -> kernel.addJarToClasspath(new PathToJar(currentPath))); } else { validatePath(path); this.kernel.addJarToClasspath(new PathToJar(path)); } return getMagicCommandItem(code, message, executionCount); } catch (IllegalStateException e) { return new MagicCommandItemWithResult( messageCreator .buildOutputMessage(message, e.getMessage(), true), messageCreator.buildReplyWithoutStatus(message, executionCount) ); } }; }
Source:
private static void checkFunctionLike(SubscriptionContext ctx) { FunctionLike functionLike = (FunctionLike) ctx.syntaxNode(); Tree enclosingLoop = enclosingLoop(functionLike); if(enclosingLoop == null || !enclosingLoop.is(Tree.Kind.WHILE_STMT, Tree.Kind.FOR_STMT, Tree.Kind.GENERATOR_EXPR, Tree.Kind.LIST_COMPREHENSION)) { return; } if (isCalledWithinLoop(functionLike, enclosingLoop)) { return; } if (isReturnedInLoop(enclosingLoop, functionLike)) { return; } Set<Symbol> enclosingScopeSymbols = getEnclosingScopeSymbols(functionLike); for (Symbol symbol : enclosingScopeSymbols) { List<Tree> problematicUsages = new ArrayList<>(); List<Tree> bindingUsages = new ArrayList<>(); for (Usage usage : symbol.usages()) { Tree usageTree = usage.tree(); if (isUsedInFunctionLike(usageTree, functionLike) && !usage.isBindingUsage()) { problematicUsages.add(usageTree); } if (usage.isBindingUsage() && isWithinEnclosingLoop(usageTree, enclosingLoop)) { bindingUsages.add(usageTree); } } reportIssue(ctx, functionLike, problematicUsages, bindingUsages); } }

Target:
private static void checkFunctionLike(SubscriptionContext ctx) { FunctionLike functionLike = (FunctionLike) ctx.syntaxNode(); Tree enclosingLoop = enclosingLoop(functionLike); if(enclosingLoop == null || !enclosingLoop.is(Tree.Kind.WHILE_STMT, Tree.Kind.FOR_STMT, Tree.Kind.GENERATOR_EXPR, Tree.Kind.LIST_COMPREHENSION)) { return; } if (isReturnedOrCalledWithinLoop(functionLike, enclosingLoop)) { return; } Set<Symbol> enclosingScopeSymbols = getEnclosingScopeSymbols(enclosingLoop); for (Symbol symbol : enclosingScopeSymbols) { List<Tree> problematicUsages = new ArrayList<>(); List<Tree> bindingUsages = new ArrayList<>(); for (Usage usage : symbol.usages()) { Tree usageTree = usage.tree(); if (isUsedInFunctionLike(usageTree, functionLike) && !usage.isBindingUsage()) { problematicUsages.add(usageTree); } if (usage.isBindingUsage() && isWithinEnclosingLoop(usageTree, enclosingLoop)) { bindingUsages.add(usageTree); } } reportIssue(ctx, functionLike, problematicUsages, bindingUsages); } }
Source:
public static MediaType detectMediaType(InputStream inputStream) throws IOException { if (!inputStream.markSupported()) throw new UnsupportedOperationException("InputStream marking support is required!"); Detector detector = new AutoDetectParser().getDetector(); return detector.detect(inputStream, new Metadata()); }

Target:
public static MediaType detectMediaType(InputStream inputStream) throws IOException { if (!inputStream.markSupported()) throw new UnsupportedOperationException("InputStream marking support is required!"); return new AutoDetectParser().getDetector().detect(inputStream, new Metadata()); }
Source:
public static PackIndex read(InputStream fd) throws IOException, CorruptObjectException { final byte[] hdr = new byte[8]; IO.readFully(fd, hdr, 0, hdr.length); if (isTOC(hdr)) { final int v = NB.decodeInt32(hdr, 4); switch (v) { case 2: return new PackIndexV2(fd); default: throw new UnsupportedPackIndexVersionException(MessageFormat .format(JGitText.get().unsupportedPackIndexVersion, Integer.valueOf(v))); } } return new PackIndexV1(fd, hdr); }

Target:
public static PackIndex read(InputStream fd) throws IOException, CorruptObjectException { final byte[] hdr = new byte[8]; IO.readFully(fd, hdr, 0, hdr.length); if (isTOC(hdr)) { final int v = NB.decodeInt32(hdr, 4); switch (v) { case 2: return new PackIndexV2(fd); default: throw new UnsupportedPackIndexVersionException(v); } } return new PackIndexV1(fd, hdr); }
Source:
public Fragment getFirstFragment() { return CourseTabsDashboardFragment.newInstance( (EnrolledCoursesResponse) getIntent().getExtras().getSerializable(EXTRA_COURSE_DATA), getIntent().getStringExtra(EXTRA_COURSE_ID), getIntent().getStringExtra(EXTRA_SCREEN_NAME)); }

Target:
public Fragment getFirstFragment() { return CourseTabsDashboardFragment.newInstance( (EnrolledCoursesResponse) getIntent().getSerializableExtra(EXTRA_COURSE_DATA), getIntent().getStringExtra(EXTRA_COURSE_ID), getIntent().getStringExtra(EXTRA_SCREEN_NAME)); }
Source:
public double getTonnage() { if (getType().getKgPerShot() > 0) { return getType().getKgPerShot() * shots/1000.0; } return ((double)shots / getType().getShots()); }

Target:
public double getTonnage() { if (getType().getKgPerShot() > 0) { return getType().getKgPerShot() * (shots / 1000.0); } return ((double) shots / getType().getShots()); }
Source:
public LStat lstat(FS fs, File file) throws NoSuchFileException, NotDirectoryException { String path = file.getAbsolutePath(); int[] rawlstat = lstatImpl(path); if (rawlstat.length != 11) throw new IllegalArgumentException("lstat() didn't return int[11]"); return new LStat(rawlstat); }

Target:
public LStat lstat(FS fs, File file) throws NoSuchFileException, NotDirectoryException { String path = file.getAbsolutePath(); int[] rawlstat = lstatImpl(path); if (rawlstat.length != 11) throw new IllegalArgumentException( JGitText.get().lstatImplIllegalResult); return new LStat(rawlstat); }
Source:
public LocalStackContainer() { this(TestcontainersConfiguration.getInstance().getLocalStackImage().split(":")[1]); }

Target:
public LocalStackContainer() { super(TestcontainersConfiguration.getInstance().getLocalStackImage()); sharedSetup(); }
Source:
public static AbstractItem resolveForCLI( @Argument(required=true,metaVar="NAME",usage="Job name") String name) throws CmdLineException { AbstractItem item = Jenkins.getInstance().getItemByFullName(name, AbstractItem.class); if (item==null) { AbstractProject project = AbstractProject.findNearest(name); throw new CmdLineException(null, Messages.AbstractItem_NoSuchJobExists(name, project == null ? "" : project.getFullName())); } return item; }

Target:
public static AbstractItem resolveForCLI( @Argument(required=true,metaVar="NAME",usage="Job name") String name) throws CmdLineException { AbstractItem item = Jenkins.getInstance().getItemByFullName(name, AbstractItem.class); if (item==null) { AbstractProject project = AbstractProject.findNearest(name); throw new CmdLineException(null, project == null ? Messages.AbstractItem_NoSuchJobExistsWithoutSuggestion(name) : Messages.AbstractItem_NoSuchJobExists(name, project.getFullName())); } return item; }
Source:
public static Matrix4 createRotationMatrix(final Axis axis, double angle) { Matrix4 ret = new Matrix4(); return ret.setToRotation(axis, angle); }

Target:
public static Matrix4 createRotationMatrix(final Axis axis, double angle) { return new Matrix4().setToRotation(axis, angle); }
Source:
public static NuageVspPluginClientLoader getClientLoader(String relativePath, String[] cmsUserInfo, int numRetries, int retryInterval, String nuageVspCmsId) throws Exception { NuageVspPluginClientLoader nuageVspPluginClientClassloader = new NuageVspPluginClientLoader(NUAGE_PLUGIN_CLIENT_JAR_FILE); nuageVspPluginClientClassloader.loadClasses(relativePath, cmsUserInfo, numRetries, retryInterval, nuageVspCmsId); return nuageVspPluginClientClassloader; }

Target:
public static NuageVspPluginClientLoader getClientLoader(String relativePath, String[] cmsUserInfo, int numRetries, int retryInterval, String nuageVspCmsId) throws ConfigurationException { NuageVspPluginClientLoader nuageVspPluginClientClassloader = new NuageVspPluginClientLoader(NUAGE_PLUGIN_CLIENT_JAR_FILE); nuageVspPluginClientClassloader.loadClasses(relativePath, cmsUserInfo, numRetries, retryInterval, nuageVspCmsId); return nuageVspPluginClientClassloader; }
Source:
List<IndexEntry> getValidIndexEntriesForIndexSegment(Offset indexSegmentStartOffset, long deleteReferenceTimeMs, long expiryReferenceTimeMs) { List<IndexEntry> validEntries = new ArrayList<>(); if (referenceIndex.containsKey(indexSegmentStartOffset)) { for (Map.Entry<MockId, IndexValue> indexSegmentEntry : referenceIndex.get(indexSegmentStartOffset).entrySet()) { MockId key = indexSegmentEntry.getKey(); IndexValue value = indexSegmentEntry.getValue(); if (value.isFlagSet(IndexValue.Flags.Delete_Index)) { validEntries.add(new IndexEntry(key, value)); if (!isDeletedAt(key, deleteReferenceTimeMs) && !isExpiredAt(key, expiryReferenceTimeMs) && value.getOriginalMessageOffset() != IndexValue.UNKNOWN_ORIGINAL_MESSAGE_OFFSET && value.getOriginalMessageOffset() >= indexSegmentStartOffset.getOffset()) { validEntries.add(new IndexEntry(key, allKeys.get(key).getFirst())); } } else if (!isExpiredAt(key, expiryReferenceTimeMs)) { if (!deletedKeys.contains(key)) { validEntries.add(new IndexEntry(key, value)); } else if (!isDeletedAt(key, deleteReferenceTimeMs)) { validEntries.add(new IndexEntry(key, value)); } } } } return validEntries; }

Target:
List<IndexEntry> getValidIndexEntriesForIndexSegment(Offset indexSegmentStartOffset, long deleteReferenceTimeMs, long expiryReferenceTimeMs) { List<IndexEntry> validEntries = new ArrayList<>(); if (referenceIndex.containsKey(indexSegmentStartOffset)) { for (Map.Entry<MockId, IndexValue> indexSegmentEntry : referenceIndex.get(indexSegmentStartOffset).entrySet()) { MockId key = indexSegmentEntry.getKey(); IndexValue value = indexSegmentEntry.getValue(); if (value.isFlagSet(IndexValue.Flags.Delete_Index)) { validEntries.add(new IndexEntry(key, value)); if (value.getOriginalMessageOffset() != IndexValue.UNKNOWN_ORIGINAL_MESSAGE_OFFSET && value.getOriginalMessageOffset() != value.getOffset().getOffset() && value.getOriginalMessageOffset() >= indexSegmentStartOffset.getOffset() && !isDeletedAt(key, deleteReferenceTimeMs) && !isExpiredAt(key, expiryReferenceTimeMs)) { validEntries.add(new IndexEntry(key, allKeys.get(key).getFirst())); } } else if (!isExpiredAt(key, expiryReferenceTimeMs)) { if (!deletedKeys.contains(key)) { validEntries.add(new IndexEntry(key, value)); } else if (!isDeletedAt(key, deleteReferenceTimeMs)) { validEntries.add(new IndexEntry(key, value)); } } } } return validEntries; }
Source:
public void run(String realfile, int port) { String file = "reactivesocket-tck-drivers/src/main/test/resources/servertest$.txt"; if (realfile != null) { file = realfile; } TcpReactiveSocketServer server = TcpReactiveSocketServer.create(port); JavaServerDriver jsd = new JavaServerDriver(file, server, mutex); jsd.run(); }

Target:
public void run(String realfile, int port) { String file = "reactivesocket-tck-drivers/src/main/resources/server$.txt"; if (realfile != null) { file = realfile; } TcpReactiveSocketServer server = TcpReactiveSocketServer.create(port); JavaServerDriver jsd = new JavaServerDriver(file, server, mutex); jsd.run(); }
Source:
public void onSiteEditorsChanged(OnSiteEditorsChanged event) { if (event.isError()) { return; } if (TextUtils.isEmpty(event.site.getMobileEditor())) { if (AppPrefs.isDefaultAppWideEditorPreferenceSet()) { String defaultEditor = AppPrefs.isGutenbergDefaultForNewPosts() ? SiteUtils.GB_EDITOR_NAME : SiteUtils.AZTEC_EDITOR_NAME; mDispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorAction( new DesignateMobileEditorPayload(event.site, defaultEditor))); AnalyticsUtils.trackWithSiteDetails( AppPrefs.isGutenbergDefaultForNewPosts() ? Stat.EDITOR_GUTENBERG_ENABLED : Stat.EDITOR_GUTENBERG_DISABLED, mSite); } } notifyUpdatedOnUiThread(); }

Target:
public void onSiteEditorsChanged(OnSiteEditorsChanged event) { if (event.isError()) { return; } notifyUpdatedOnUiThread(); }
Source:
public List<RefactoringPageRow> buildResponse(final List<KObject> kObjects) { final List<RefactoringPageRow> result = new ArrayList<RefactoringPageRow>(kObjects.size()); for (final KObject kObject : kObjects) { for (KProperty property : kObject.getProperties()) { if (property.getName().equals(ResourceType.FORM.toString())) { String formId = (String) property.getValue(); final Path path = Paths.convert(ioService.get(URI.create(kObject.getKey()))); Map<String, Path> map = new HashMap<String, Path>(); map.put(formId, path); RefactoringMapPageRow row = new RefactoringMapPageRow(); row.setValue(map); result.add(row); } } } return result; }

Target:
public List<RefactoringPageRow> buildResponse(final List<KObject> kObjects) { final List<RefactoringPageRow> result = new ArrayList<RefactoringPageRow>(kObjects.size()); for (final KObject kObject : kObjects) { String formId = findFormId(kObject.getProperties()); if (formId != null) { final Path path = Paths.convert(ioService.get(URI.create(kObject.getKey()))); Map<String, Path> map = new HashMap<String, Path>(); map.put(formId, path); RefactoringMapPageRow row = new RefactoringMapPageRow(); row.setValue(map); result.add(row); } } return result; }
Source:
public ParametersBuilder add(int year, int month, int day, int hour, int minute, int second, int nanosecond, String zone, ZoneId defaultTimeZone) { if ( isNanosecondPrecisionSupported() ) { nanosecond = 0; } return add( defaultTimeZone, year, month, day, hour, minute, second, nanosecond, zone ); }

Target:
public ParametersBuilder add(int year, int month, int day, int hour, int minute, int second, int nanosecond, String zone, ZoneId defaultTimeZone) { if ( !isNanosecondPrecisionSupported() ) { nanosecond = 0; } return add( defaultTimeZone, year, month, day, hour, minute, second, nanosecond, zone ); }
Source:
public LoadQueuePeonTester() { super( null, null, null, null, null, new TestDruidCoordinatorConfig( null, null, null, new Duration(1), null, null, 10, null, false, false, new Duration("PT1s") ) ); }

Target:
public LoadQueuePeonTester() { super( null, null, null, Execs.scheduledSingleThreaded("LoadQueuePeonTester--%d"), null, new TestDruidCoordinatorConfig( null, null, null, new Duration(1), null, null, 10, null, false, false, new Duration("PT1s"), Duration.millis(10) ) ); }
Source:
public void enterText(String columnHeading, int rowNum, String text) { if (!text.equals(cleanAscii(text))) { throw new IllegalArgumentException("text contains non-ASCII characters"); } WebElement cell = getCell(columnHeading, rowNum); Action action = new Actions(getDriver()) .click(cell) .sendKeys(Keys.DELETE) .sendKeys(text) .sendKeys(Keys.ENTER) .build(); for (int retries = 0; retries < 3 && !text.equals(getText(columnHeading, rowNum)); retries++) { action.perform(); } }

Target:
public void enterText(String columnHeading, int rowNum, String text) { if (LimsUtils.isStringEmptyOrNull(text)) { clearField(columnHeading, rowNum, text); return; } if (!text.equals(cleanAscii(text))) { throw new IllegalArgumentException("text contains non-ASCII characters"); } WebElement cell = getCell(columnHeading, rowNum); cancelEditing(); if (!cell.getAttribute("class").contains("current")) { cell.click(); cell = getCell(columnHeading, rowNum); if (!cell.getAttribute("class").contains("current")) { throw new IllegalStateException("Cell still not selected after clicking"); } } new Actions(getDriver()).sendKeys(Keys.ENTER).build().perform(); waitUntil(presenceOfElementLocated(activeCellEditorSelector)); WebElement cellEditor = getDriver().findElement(activeCellEditorSelector); cellEditor.clear(); waitUntil(textToBe(activeCellEditorSelector, "")); safeInput(activeCellEditorSelector, text); cellEditor.sendKeys(Keys.ENTER); waitUntil(invisibilityOf(cellEditor)); }
Source:
private List<TransactionalStrategyState> getStrategyForMacAllocation() { List<TransactionalStrategyState> states = new ArrayList<>(); if (usingCompensationState.shouldUseCompensation()) { states.add(usingCompensationState); } boolean shouldUseTxDecorator = TransactionSupport.current() != null; if (shouldUseTxDecorator) { states.add(usingTxDecoratorState); } if (states.isEmpty()) { states.add(nontransactionalState); } log.debug("Using as allocation strategies", Arrays.toString(states.toArray())); return states; }

Target:
private List<TransactionalStrategyState> getStrategyForMacAllocation() { List<TransactionalStrategyState> states = new ArrayList<>(); if (usingCompensationState.shouldUseCompensation()) { states.add(usingCompensationState); } boolean shouldUseTxDecorator = TransactionSupport.current() != null; if (shouldUseTxDecorator) { states.add(usingTxDecoratorState); } if (states.isEmpty()) { states.add(nontransactionalState); } log.debug("Using as allocation strategies", states); return states; }
Source:
public void testDescribe() { vpc = vpcClient.createVpc(TEST_REGION, VPC_CIDR); assertNotNull(vpc, "Failed to create VPC to test attachments"); tagger.applyToResources(ImmutableMap.of("Name", simpleName), ImmutableList.of(vpc.id())); final FluentIterable<RouteTable> routeTables = routeTableApi.describeRouteTables(TEST_REGION); assertNotNull(routeTables, "Failed to return list of RouteTables"); boolean foundVpc = false; for (RouteTable rt : routeTables) { if (vpc.id().equals(rt.vpcId())) { foundVpc = true; assertEquals(rt.associationSet().size(), 1, "Route for test VPC has wrong number of associations, should be 1: " + rt.associationSet()); assertTrue(rt.associationSet().get(0).main(), "Association for route " + rt.id() + "should be 'main'"); assertEquals(rt.routeSet().size(), 1, "Wrong number of routes in default route table for VPC " + vpc.id()); final String defaultCidr = rt.routeSet().get(0).destinationCidrBlock(); assertEquals(defaultCidr, vpc.cidrBlock(), "Route in default route table does not match CIDR of VPC, " + defaultCidr + " should be " + vpc.cidrBlock()); break; } } assertTrue(foundVpc, "Could not find VPC " + vpc.id() + " in described route tables"); }

Target:
public void testDescribe() { vpc = vpcClient.createVpc(TEST_REGION, VPC_CIDR); assertNotNull(vpc, "Failed to create VPC to test attachments"); tagger.applyToResources(ImmutableMap.of("Name", simpleName), ImmutableList.of(vpc.id())); final FluentIterable<RouteTable> routeTables = routeTableApi.describeRouteTables(TEST_REGION); assertNotNull(routeTables, "Failed to return list of RouteTables"); Optional<RouteTable> vpcRT = Iterables.tryFind(routeTables, new Predicate<RouteTable>() { @Override public boolean apply(RouteTable input) { return vpc.id().equals(input.vpcId()); } }); assertTrue(vpcRT.isPresent(), "Could not find VPC " + vpc.id() + " in described route tables"); RouteTable rt = vpcRT.get(); assertEquals(rt.associationSet().size(), 1, "Route for test VPC has wrong number of associations, should be 1: " + rt.associationSet()); assertTrue(rt.associationSet().get(0).main(), "Association for route " + rt.id() + "should be 'main'"); assertEquals(rt.routeSet().size(), 1, "Wrong number of routes in default route table for VPC " + vpc.id()); final String defaultCidr = rt.routeSet().get(0).destinationCidrBlock(); assertEquals(defaultCidr, vpc.cidrBlock(), "Route in default route table does not match CIDR of VPC, " + defaultCidr + " should be " + vpc.cidrBlock()); }
Source:
public LongDictionary(DictionaryPage dictionaryPage) throws IOException { super(dictionaryPage.getEncoding()); content = new long[dictionaryPage.getDictionarySize()]; LongPlainValuesReader longReader = new LongPlainValuesReader(); final ByteBufferInputStream in = ByteBufferInputStream.wrap(ByteBuffer.wrap(dictionaryPage.getSlice().getBytes())); longReader.initFromPage(dictionaryPage.getDictionarySize(), in); for (int i = 0; i < content.length; i++) { content[i] = longReader.readLong(); } }

Target:
public LongDictionary(DictionaryPage dictionaryPage) throws IOException { super(dictionaryPage.getEncoding()); content = new long[dictionaryPage.getDictionarySize()]; LongPlainValuesReader longReader = new LongPlainValuesReader(); ByteBuffer byteBuffer = ByteBuffer.wrap(dictionaryPage.getSlice().getBytes()); ByteBufferInputStream inputStream = ByteBufferInputStream.wrap(ImmutableList.of(byteBuffer)); longReader.initFromPage(dictionaryPage.getDictionarySize(), inputStream); for (int i = 0; i < content.length; i++) { content[i] = longReader.readLong(); } }
Source:
private Response handleAuthResponse(String chargeId, AuthoriseStatus authoriseStatus) { if (authoriseStatus.equals(AuthoriseStatus.SUBMITTED)) { logger.info("Charge {}: authorisation was deferred.", chargeId); return badRequestResponse("This transaction was deferred."); } if (isAuthorisationDeclined(authoriseStatus)) { logger.info("Charge {}: authorisation was declined.", chargeId); return badRequestResponse("This transaction was declined."); } return ResponseUtil.successResponseWithEntity(ImmutableMap.of("status", authoriseStatus.getMappedChargeStatus().toString())); }

Target:
private Response handleAuthResponse(String chargeId, AuthoriseStatus authoriseStatus) { if (authoriseStatus.equals(AuthoriseStatus.SUBMITTED)) { logger.info("Charge {}: authorisation was deferred.", chargeId); return badRequestResponse("This transaction was deferred."); } if (isAuthorisationDeclined(authoriseStatus)) { return badRequestResponse("This transaction was declined."); } return ResponseUtil.successResponseWithEntity(ImmutableMap.of("status", authoriseStatus.getMappedChargeStatus().toString())); }
Source:
private void internalWriteRow(List<Object> values, Sheet sheet, int rowNr) { final org.apache.poi.ss.usermodel.Row row = sheet.createRow(rowNr); AtomicInteger counter = new AtomicInteger(0); values .stream() .forEach( record -> { int index = counter.getAndIncrement(); if (record != null) { String stringValue = record.toString().trim(); if (!stringValue.isEmpty()) { final Cell cell = row.createCell(index); cell.setCellValue(stringValue); } } }); }

Target:
private void internalWriteRow(List<Object> values, Sheet sheet, int rowNr) { final org.apache.poi.ss.usermodel.Row row = sheet.createRow(rowNr); AtomicInteger counter = new AtomicInteger(0); values .stream() .forEach( record -> { int index = counter.getAndIncrement(); if (record != null) { String stringValue = record.toString(); if (!stringValue.isEmpty()) { final Cell cell = row.createCell(index); cell.setCellValue(stringValue); } } }); }
Source:
public void loadModels() { if (loadingModels || mModels.getLoaded()) { return; } loadingModels = true; new Exception().printStackTrace(); new Thread(new Runnable() { @Override public void run() { Timber.v("Loading models"); mModels.load(loadColumn("models")); Timber.v("Models loaded"); } }).start(); }

Target:
public void loadModels() { if (futureLoadingModel != null) { return; } futureLoadingModel = new FutureTask( () -> mModels.load(loadColumn("models")) ); new Thread(futureLoadingModel).start(); }
Source:
public NoSuchStepExecutionException(long id) { super("Could not find step execution with id '" + id + "'"); }

Target:
public NoSuchStepExecutionException(long id) { super("Could not find step execution with id " + id); }
Source:
public PagedFlux<BlockItem> listBlocks(BlockListType listType, LeaseAccessConditions leaseAccessConditions) { return new PagedFlux<>( () -> postProcessResponse(this.azureBlobStorage.blockBlobs().getBlockListWithRestResponseAsync( null, null, listType, snapshot, null, null, null, leaseAccessConditions, Context.NONE)) .map(response -> new PagedResponseBase<>( response.request(), response.statusCode(), response.headers(), Stream.concat( response.value().committedBlocks().stream() .map(committedBlock -> new BlockItem(committedBlock, true)), response.value().uncommittedBlocks().stream() .map(uncommittedBlock -> new BlockItem(uncommittedBlock, false))) .collect(Collectors.toList()), null , response.deserializedHeaders())), (marker) -> null); }

Target:
public Mono<Response<BlockList>> listBlocks(BlockListType listType, LeaseAccessConditions leaseAccessConditions) { return postProcessResponse(this.azureBlobStorage.blockBlobs().getBlockListWithRestResponseAsync( null, null, listType, snapshot, null, null, null, leaseAccessConditions, Context.NONE)) .map(response -> new SimpleResponse<>(response, response.value())); }
Source:
public Profile getProfileByTicket(String ticketId, String... attributesToReturn) throws ProfileException { MultiValueMap<String, String> params = createBaseParams(); HttpUtils.addValue(PARAM_TICKET_ID, ticketId, params); HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params); String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_BY_TICKET); url = addQueryParams(url, params, false); return doGetForObject(url, Profile.class); }

Target:
public Profile getProfileByTicket(String ticketId, String... attributesToReturn) throws ProfileException { MultiValueMap<String, String> params = createBaseParams(); HttpUtils.addValue(PARAM_TICKET_ID, ticketId, params); HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params); String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_BY_TICKET); url = addQueryParams(url, params, false); try { return doGetForObject(url, Profile.class); } catch (ProfileRestServiceException e) { if(e.getStatus() == HttpStatus.NOT_FOUND) { return null; } else { throw e; } } }