auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void sendPack() throws IOException { final boolean sideband = options.contains(OPTION_SIDE_BAND) || options.contains(OPTION_SIDE_BAND_64K); ProgressMonitor pm = NullProgressMonitor.INSTANCE; OutputStream packOut = rawOut; if (sideband) { int bufsz = SideBandOutputStream.SMALL_BUF; if (options.contains(OPTION_SIDE_BAND_64K)) bufsz = SideBandOutputStream.MAX_BUF; packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!options.contains(OPTION_NO_PROGRESS)) pm = new SideBandProgressMonitor(new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut)); } PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); final PackWriter pw = new PackWriter(cfg, walk.getObjectReader()); try { pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA)); pw.setThin(options.contains(OPTION_THIN_PACK)); <START> if(depth > 0) { <END> pw.preparePack(pm, wantAll, commonBase, unshallowCommits, depth); } else { pw.preparePack(pm, wantAll, commonBase); } if (options.contains(OPTION_INCLUDE_TAG)) { for (final Ref r : refs.values()) { final RevObject o; try { o = walk.parseAny(r.getObjectId()); } catch (IOException e) { continue; } if (o.has(WANT) || !(o instanceof RevTag)) continue; final RevTag t = (RevTag) o; if (!pw.willInclude(t) && pw.willInclude(t.getObject())) pw.addObject(t); } } pw.writePack(pm, NullProgressMonitor.INSTANCE, packOut); } finally { pw.release(); } packOut.flush(); if (sideband) pckOut.end(); }</code><technical_language>Style-nit: Space if</technical_language>

Target:
private void sendPack() throws IOException { final boolean sideband = options.contains(OPTION_SIDE_BAND) || options.contains(OPTION_SIDE_BAND_64K); ProgressMonitor pm = NullProgressMonitor.INSTANCE; OutputStream packOut = rawOut; if (sideband) { int bufsz = SideBandOutputStream.SMALL_BUF; if (options.contains(OPTION_SIDE_BAND_64K)) bufsz = SideBandOutputStream.MAX_BUF; packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!options.contains(OPTION_NO_PROGRESS)) pm = new SideBandProgressMonitor(new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut)); } PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); final PackWriter pw = new PackWriter(cfg, walk.getObjectReader()); try { pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA)); pw.setThin(options.contains(OPTION_THIN_PACK)); if (depth > 0) pw.setShallowPack(depth, unshallowCommits); pw.preparePack(pm, wantAll, commonBase); if (options.contains(OPTION_INCLUDE_TAG)) { for (final Ref r : refs.values()) { final RevObject o; try { o = walk.parseAny(r.getObjectId()); } catch (IOException e) { continue; } if (o.has(WANT) || !(o instanceof RevTag)) continue; final RevTag t = (RevTag) o; if (!pw.willInclude(t) && pw.willInclude(t.getObject())) pw.addObject(t); } } pw.writePack(pm, NullProgressMonitor.INSTANCE, packOut); } finally { pw.release(); } packOut.flush(); if (sideband) pckOut.end(); }
Source:
<code><START> default SourceMap sourceMap() { <END> return null; }</code><technical_language>rely Optional, introducing another method lead NPEs</technical_language>

Target:
default Optional<SourceMap> sourceMap() { return Optional.empty(); }
Source:
<code>private void setupVdsNetworkInterfaceDao() { when(getDbFacadeMockInstance().getInterfaceDao()).thenReturn(vdsNetworkInterfaceDaoMock); List<VdsNetworkInterface> expectedVdsNetworkInterface = Collections.singletonList(vdsNetworkInterface); when(vdsNetworkInterfaceDaoMock.getVdsInterfacesByNetworkId(networkId)).thenReturn( <START> expectedVdsNetworkInterface); <END> }</code><technical_language>change order of lines here?..</technical_language>

Target:
private void setupVdsNetworkInterfaceDao() { List<VdsNetworkInterface> expectedVdsNetworkInterface = Collections.singletonList(vdsNetworkInterface); when(vdsNetworkInterfaceDaoMock.getVdsInterfacesByNetworkId(networkId)).thenReturn( expectedVdsNetworkInterface); when(getDbFacadeMockInstance().getInterfaceDao()).thenReturn(vdsNetworkInterfaceDaoMock); }
Source:
<code>public void testGetProjectListWithWorkflow() throws Exception { Project<?, ?> masterProject = createFreeStyleProject("project"); <START> WorkflowJob p = (WorkflowJob) Jenkins.getInstance().createProject(WorkflowJob.class, "workflowproject"); <END> p.setDefinition(new CpsFlowDefinition("println('hello')")); BlockableBuildTriggerConfig masterConfig = createConfig("subproject1, workflowproject"); addParameterizedTrigger(masterProject, masterConfig); Project subProject1 = createFreeStyleProject("subproject1"); subProject1.setQuietPeriod(0); List<Job> jobs = masterConfig.getProjectListGeneral(masterProject.getParent(), null); assertEquals(2, jobs.size()); assertTrue("Job should include workflow job", jobs.contains(p)); assertTrue("Job should include non-workflow job", jobs.contains(subProject1)); List<AbstractProject> projects = masterConfig.getProjectList(masterProject.getParent(), null); assertEquals(1, projects.size()); assertFalse("Projects should NOT include workflow job", projects.contains(p)); assertTrue("Projects should include non-workflow job", projects.contains(subProject1)); }</code><technical_language>Redundant cast. remember a HudsonTestCase simply jenkins Jenkins.getInstance()</technical_language>

Target:
public void testGetProjectListWithWorkflow() throws Exception { Project<?, ?> masterProject = createFreeStyleProject("project"); WorkflowJob p = jenkins.createProject(WorkflowJob.class, "workflowproject"); p.setDefinition(new CpsFlowDefinition("println('hello')")); BlockableBuildTriggerConfig masterConfig = createConfig("subproject1, workflowproject"); addParameterizedTrigger(masterProject, masterConfig); Project subProject1 = createFreeStyleProject("subproject1"); subProject1.setQuietPeriod(0); List<Job> jobs = masterConfig.getJobs(masterProject.getParent(), null); assertEquals(2, jobs.size()); assertTrue("Job should include workflow job", jobs.contains(p)); assertTrue("Job should include non-workflow job", jobs.contains(subProject1)); List<AbstractProject> projects = masterConfig.getProjectList(masterProject.getParent(), null); assertEquals(1, projects.size()); assertFalse("Projects should NOT include workflow job", projects.contains(p)); assertTrue("Projects should include non-workflow job", projects.contains(subProject1)); }
Source:
<code>protected void addVmPermission() { super.addVmPermission(); if (!getParameters().isCopyTemplatePermissions()) { return; } PermissionDAO dao = getDbFacade().getPermissionDao(); <START> List<permissions> templatePermissions = dao.getAllForEntity(getVmTemplateId(), getCurrentUser().getUserId(), false); <END> List<permissions> vmPermissions = new ArrayList<permissions>(); for (permissions templatePermission : templatePermissions) { vmPermissions.add(new permissions(getCurrentUser().getUserId(), templatePermission.getrole_id(), getVmId(), VdcObjectType.VM)); } if (vmPermissions.size() > 0) { MultiLevelAdministrationHandler.addPermission(vmPermissions.toArray(new permissions[vmPermissions.size()])); } }</code><technical_language>need filter out PredefinedRoles.TEMPLATE_OWNER PredefinedRoles.TEMPLATE_USER permissions</technical_language>

Target:
protected void addVmPermission() { super.addVmPermission(); if (!getParameters().isCopyTemplatePermissions()) { return; } PermissionDAO dao = getDbFacade().getPermissionDao(); List<permissions> templatePermissions = dao.getAllForEntity(getVmTemplateId(), getCurrentUser().getUserId(), false); List<permissions> vmPermissions = new ArrayList<permissions>(); for (permissions templatePermission : templatePermissions) { boolean templateOwnerRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_OWNER.getId()); boolean templateUserRole = templatePermission.getrole_id().equals(PredefinedRoles.TEMPLATE_USER.getId()); if (templateOwnerRole || templateUserRole) { continue; } vmPermissions.add(new permissions(getCurrentUser().getUserId(), templatePermission.getrole_id(), getVmId(), VdcObjectType.VM)); } if (vmPermissions.size() > 0) { MultiLevelAdministrationHandler.addPermission(vmPermissions.toArray(new permissions[vmPermissions.size()])); } }
Source:
<code>public void addDataDirectory(String name, String path, boolean skipIO) { validateDataDirectory(name, path, skipIO); Path dataDirectory = compute(Paths.get(path)); LOGGER.debug("Defined directory with name: at location: {}", name, dataDirectory); dataRootMap.put(name, dataDirectory); for (EntityManagementRegistry registry : registries) { registry.register(new DataRootBinding(name, dataDirectory)); <START> registry.refresh(); <END> } }</code><technical_language>registerAndRefresh() registration done async in monitoring server depending voltron is calling monitoring service</technical_language>

Target:
public void addDataDirectory(String name, String path, boolean skipIO) { validateDataDirectory(name, path, skipIO); Path dataDirectory = compute(Paths.get(path)); LOGGER.debug("Defined directory with name: at location: {}", name, dataDirectory); dataRootMap.put(name, dataDirectory); for (EntityManagementRegistry registry : registries) { registry.registerAndRefresh(new DataRootBinding(name, dataDirectory)); } }
Source:
<code>public InputStream getStream(URL uri) throws IOException { Cache<URL, AudioStreamCache> cache = getCache(); <START> if (!cache.containsKey(uri)) { <END> lock.lock(); try { if (!cache.containsKey(uri)) { cache.put(uri, new AudioStreamCache(uri)); } } finally { lock.unlock(); } } return new ByteArrayInputStream(cache.get(uri).getBytes()); }</code><technical_language>cache support putIfAbsent? preferred locking. OK stream is lazily loaded</technical_language>

Target:
public InputStream getStream(URL uri) throws IOException { Cache<URL, AudioStreamCache> cache = getCache(); AudioStreamCache stream = cache.get(uri); if (stream == null) { stream = cache.putIfAbsent(uri, new AudioStreamCache(uri)); } return new ByteArrayInputStream(stream.getBytes()); }
Source:
<code><START> protected MergeStatus mergeTo(IProgressMonitor monitor, String branchName, <END> String targetBranchName) throws CoreException { try { if (!repository.hasBranch(targetBranchName)) { throw new RuntimeException(String.format( CoreText.GitFlowOperation_branchNotFound, targetBranchName)); } boolean dontCloseProjects = false; BranchOperation branchOperation = new BranchOperation( repository.getRepository(), targetBranchName, dontCloseProjects); branchOperation.execute(monitor); Status status = branchOperation.getResult().getStatus(); if (!CheckoutResult.Status.OK.equals(status)) { throw new CoreException(error(format( CoreText.GitFlowOperation_unableToCheckout, branchName, status.toString()))); } MergeOperation mergeOperation = new MergeOperation( repository.getRepository(), branchName); mergeOperation.execute(monitor); return mergeOperation.getResult().getMergeStatus(); } catch (GitAPIException e) { throw new RuntimeException(e); } }</code><technical_language>I this is wrong, return MergeResult contains information merge failed useful displayed dialogs more useful, e.g. if merge fails due a conflict show 2 branches merge this is important information. code receiving this MergeResult extract merge status decisions based that</technical_language>

Target:
protected MergeResult mergeTo(IProgressMonitor monitor, String branchName, String targetBranchName) throws CoreException { try { if (!repository.hasBranch(targetBranchName)) { throw new RuntimeException(String.format( CoreText.GitFlowOperation_branchNotFound, targetBranchName)); } boolean dontCloseProjects = false; BranchOperation branchOperation = new BranchOperation( repository.getRepository(), targetBranchName, dontCloseProjects); branchOperation.execute(monitor); Status status = branchOperation.getResult().getStatus(); if (!CheckoutResult.Status.OK.equals(status)) { throw new CoreException(error(format( CoreText.GitFlowOperation_unableToCheckout, branchName, status.toString()))); } MergeOperation mergeOperation = new MergeOperation( repository.getRepository(), branchName); mergeOperation.execute(monitor); return mergeOperation.getResult(); } catch (GitAPIException e) { throw new RuntimeException(e); } }
Source:
<code><START> public static ChannelManager getInstance() { <END> if (instance == null) { instance = new ChannelManager(); } return instance; }</code><technical_language>function synchronized. Res: done syncronized block</technical_language>

Target:
public static ChannelManager getInstance() { if (instance == null) { synchronized (ChannelManager.class) { if (instance == null) { instance = new ChannelManager(); } } } return instance; }
Source:
<code>public Response createClusterStateModelDefinition( @PathParam("clusterId") String clusterId, @PathParam("statemodel") String statemodel, String content ) { ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a valid ZNRecord!"); } <START> HelixZkClient zkClient = getHelixZkClient(); <END> String path = PropertyPathBuilder.stateModelDef(clusterId); try { ZKUtil.createChildren(zkClient, path, record); } catch (Exception e) { _logger.error("Failed to create zk node with path " + path + ", Exception:" + e); return badRequest("Failed to create a Znode for stateModel!"); } return OK(); }</code><technical_language>If exception needs caught, this exception need more specific? Do potential exception is thrown, InvalidACLException/InterruptedException/ZkNodeExistsException</technical_language>

Target:
public Response createClusterStateModelDefinition(@PathParam("clusterId") String clusterId, @PathParam("statemodel") String statemodel, String content) { ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a valid ZNRecord!"); } HelixZkClient zkClient = getHelixZkClient(); String path = PropertyPathBuilder.stateModelDef(clusterId); try { ZKUtil.createChildren(zkClient, path, record); } catch (Exception e) { _logger.error("Failed to create zk node with path " + path + ", Exception:" + e); return badRequest("Failed to create a Znode for stateModel! " + e); } return OK(); }
Source:
<code>private void initializeMocks(long[] blockSizes, short[] replication) throws IOException, BlockNotFoundException { <START> when(appFS.exists(Matchers.any(Path.class))).thenReturn(true); <END> when(status0.getReplication()).thenReturn(replication[0]); when(status1.getReplication()).thenReturn(replication[1]); when(status2.getReplication()).thenReturn(replication[2]); when(status0.getLen()).thenReturn(blockSizes[0]); when(status1.getLen()).thenReturn(blockSizes[1]); when(status2.getLen()).thenReturn(blockSizes[2]); when(appFS.getFileStatus(new Path("/0"))).thenReturn(status0); when(appFS.getFileStatus(new Path("/1"))).thenReturn(status1); when(appFS.getFileStatus(new Path("/2"))).thenReturn(status2); }</code><technical_language>do in beforeTest tests need this. If of needs different, override part for test</technical_language>

Target:
private void initializeMocks(long[] blockSizes, short[] replication) throws IOException, BlockNotFoundException { when(status0.getReplication()).thenReturn(replication[0]); when(status1.getReplication()).thenReturn(replication[1]); when(status2.getReplication()).thenReturn(replication[2]); when(status0.getLen()).thenReturn(blockSizes[0]); when(status1.getLen()).thenReturn(blockSizes[1]); when(status2.getLen()).thenReturn(blockSizes[2]); when(appFS.getFileStatus(new Path("/0"))).thenReturn(status0); when(appFS.getFileStatus(new Path("/1"))).thenReturn(status1); when(appFS.getFileStatus(new Path("/2"))).thenReturn(status2); }
Source:
<code>public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { try { if (!consumer.getEndpoint().isAutoAck()) { lock.acquire(); } <START> doHandleDelivery(consumerTag, envelope, properties, body); <END> if (!consumer.getEndpoint().isAutoAck()) { lock.release(); } } catch (InterruptedException e) { log.error("Thread Interrupted!"); } }</code><technical_language>a try - finally block is more robust here? in case some strange exception out doHandleDelivery()... I suggest snippet: Java try { doHandleDelivery(consumerTag, envelope, properties, body); } finally { if (!consumer.getEndpoint().isAutoAck()) { lock.release(); } }</technical_language>

Target:
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { try { if (!consumer.getEndpoint().isAutoAck()) { lock.acquire(); } if (!channel.isOpen()) return; try { doHandleDelivery(consumerTag, envelope, properties, body); } finally { if (!consumer.getEndpoint().isAutoAck()) { lock.release(); } } } catch (InterruptedException e) { log.error("Thread Interrupted!"); } }
Source:
<code><START> public Condition saveCondition(Condition condition) throws APIException { <END> return conditionDAO.saveCondition(condition); }</code><technical_language>need this putting class level</technical_language>

Target:
public Condition saveCondition(Condition condition) { return conditionDAO.saveCondition(condition); }
Source:
<code>public FixedRealVarImpl(String name, double value, Model model) { <START> super(name, model); this.lb = value; this.ub = value; <END> }</code><technical_language>Replace this(name, value, value, model);</technical_language>

Target:
public FixedRealVarImpl(String name, double value, Model model) { this(name, value, value, model); }
Source:
<code>public ImmutableBeaconData clearEffects() { <START> return this; <END> }</code><technical_language>This return a new ImmutableBeaconData, potion effects cleared</technical_language>

Target:
public ImmutableBeaconData clearEffects() { return new ImmutableSpongeBeaconData(null, null); }
Source:
<code>public void generate(final Ds3ApiSpec spec, final FileUtils fileUtils, final Path destDir) throws IOException { this.fileUtils = fileUtils; try { final ImmutableList<Request> allRequests = getAllRequests(spec); final ImmutableList<Enum> allEnums = getAllEnums(spec); final ImmutableSet<String> enumNames = EnumHelper.getEnumNamesSet(allEnums); <START> final Queue<Struct> allStructs = new LinkedList<>(getAllStructs(spec, enumNames, allRequests)); <END> final ImmutableList<Struct> allOrderedStructs = StructHelper.getStructsOrderedList(allStructs, enumNames); generateHeader(allEnums, allOrderedStructs, allRequests); generateSource(allEnums, allOrderedStructs, allRequests); } catch (final ParseException e) { LOG.error("Caught exception: ", e); } }</code><technical_language>a Queue here? extension a LinkedList</technical_language>

Target:
public void generate(final Ds3ApiSpec spec, final FileUtils fileUtils, final Path destDir) throws IOException { this.fileUtils = fileUtils; try { final ImmutableList<Request> allRequests = getAllRequests(spec); final ImmutableList<Enum> allEnums = getAllEnums(spec); final ImmutableSet<String> enumNames = EnumHelper.getEnumNamesSet(allEnums); final ImmutableList<Struct> allStructs = getAllStructs(spec, enumNames, allRequests); final ImmutableList<Struct> allOrderedStructs = StructHelper.getStructsOrderedList(allStructs, enumNames); generateHeader(allEnums, allOrderedStructs, allRequests); generateSource(allEnums, allOrderedStructs, allRequests); } catch (final ParseException e) { LOG.error("Caught exception: ", e); } }
Source:
<code>private Service getCheServiceBySelector(String selectorKey, String selectorValue) { ServiceList svcs = openShiftClient.services() .inNamespace(this.cheOpenShiftProjectName) .list(); Service svc = svcs.getItems().stream() .filter(s->s.getSpec().getSelector().containsKey(selectorKey)) .filter(s->s.getSpec().getSelector().get(selectorKey).equals(selectorValue)).findAny().orElse(null); if (svc == null) { <START> LOG.warn("No Service with selector " + selectorKey + "=" + selectorValue + " could be found."); <END> } return svc; }</code><technical_language>{} parameters instead of string concatenation</technical_language>

Target:
private Service getCheServiceBySelector(String selectorKey, String selectorValue) { ServiceList svcs = openShiftClient.services() .inNamespace(this.openShiftCheProjectName) .list(); Service svc = svcs.getItems().stream() .filter(s->s.getSpec().getSelector().containsKey(selectorKey)) .filter(s->s.getSpec().getSelector().get(selectorKey).equals(selectorValue)).findAny().orElse(null); if (svc == null) { LOG.warn("No Service with selector {}={} could be found", selectorKey, selectorValue); } return svc; }
Source:
<code>public void onLogin(User user) { mIconsHidden = false; supportInvalidateOptionsMenu(); <START> Log.e("LOGGED IN", "EFCEF"); <END> ((LoginListener)mMediaView).onLogin(user); if (((MainApplication)getApplication()).isFirstTimeGalleryUser()) { MediaFragment.createHelpDialog(this).show(); ((MainApplication)getApplication()).setFirstTimeGalleryUser(false); } }</code><technical_language>This log live</technical_language>

Target:
public void onLogin(User user) { mIconsHidden = false; supportInvalidateOptionsMenu(); ((LoginListener)mMediaView).onLogin(user); if (((MainApplication)getApplication()).isFirstTimeGalleryUser()) { MediaFragment.createHelpDialog(this).show(); ((MainApplication)getApplication()).setFirstTimeGalleryUser(false); } }
Source:
<code>public ScheduleException(PeriodicSchedule definition, String msgTemplate, Object... msgArguments) { super(ArgChecker.formatMessage(msgTemplate, msgArguments)); <START> this.definition = definition; END> }</code><technical_language>Is this a valid reason, check for null message line above</technical_language>

Target:
public ScheduleException(PeriodicSchedule definition, String msgTemplate, Object... msgArguments) { super(Messages.format(msgTemplate, msgArguments)); this.definition = definition; }
Source:
<code>public CompletionStage<Result> queryMetrics() { try { final MetricsQuery metricsQuery = _mapper.treeToValue(request().body().asJson(), MetricsQuery.class); if (_requireAggregators && metricsQuery.getMetrics().stream().anyMatch(metric -> metric.getAggregators().isEmpty())) { return CompletableFuture.completedFuture( Results.badRequest("All queried metrics must have at least one aggregator")); } if (_addMergeAggregator) { <START> return _kairosService.queryMetrics(addMergeAggregator(metricsQuery)) <END> .<JsonNode>thenApply(_mapper::valueToTree) .thenApply(Results::ok); } return _kairosService.queryMetrics(metricsQuery) .<JsonNode>thenApply(_mapper::valueToTree) .thenApply(Results::ok); } catch (final IOException e) { return CompletableFuture.completedFuture(Results.internalServerError(e.getMessage())); } }</code><technical_language>nit: metricsQuery non-final change (e.g. metrics=addMergeAggregator(metricsQuery)) normal flow resume</technical_language>

Target:
public CompletionStage<Result> queryMetrics() { try { MetricsQuery metricsQuery = _mapper.treeToValue(request().body().asJson(), MetricsQuery.class); if (_requireAggregators && metricsQuery.getMetrics().stream().anyMatch(metric -> metric.getAggregators().isEmpty())) { return CompletableFuture.completedFuture( Results.badRequest("All queried metrics must have at least one aggregator")); } if (_addMergeAggregator) { metricsQuery = checkAndAddMergeAggregator(metricsQuery); } return _kairosService.queryMetrics(metricsQuery) .<JsonNode>thenApply(_mapper::valueToTree) .thenApply(Results::ok); } catch (final IOException e) { return CompletableFuture.completedFuture(Results.internalServerError(e.getMessage())); } }
Source:
<code>public ValidationResult snapshotAlreadyExists(Map<Guid, Guid> diskToImageIds) { Set<Guid> diskIds = diskImages.stream() .flatMap(diskImage -> getDiskImageDao().getAllSnapshotsForImageGroup(diskImage.getId()).stream()) .map(diskImage -> diskImage.getImageId()) .collect(Collectors.toSet()); Set<Guid> passedImageIds = new HashSet(diskToImageIds.values()); Set<Guid> <START> invalidGuids <END> = passedImageIds.stream().filter(diskIds::contains).collect(Collectors.toSet()); if (!invalidGuids.isEmpty()) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_SNAPSHOT_IMAGE_ALREADY_EXISTS, ReplacementUtils.createSetVariableString("ImageId", invalidGuids)); } return ValidationResult.VALID; }</code><technical_language>I call 'duplicate' 'invalid'</technical_language>

Target:
public ValidationResult snapshotAlreadyExists(Map<Guid, Guid> diskToImageIds) { Set<Guid> diskIds = diskImages.stream() .flatMap(diskImage -> getDiskImageDao().getAllSnapshotsForImageGroup(diskImage.getId()).stream()) .map(diskImage -> diskImage.getImageId()) .collect(Collectors.toSet()); Set<Guid> passedImageIds = new HashSet(diskToImageIds.values()); Set<Guid> existingGuids = passedImageIds.stream().filter(diskIds::contains).collect(Collectors.toSet()); if (!existingGuids.isEmpty()) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_SNAPSHOT_IMAGE_ALREADY_EXISTS, ReplacementUtils.createSetVariableString("ImageId", existingGuids)); } return ValidationResult.VALID; }
Source:
<code>public MethodConstraintMappingContext method(String name, Class<?>... parameterTypes) { Contracts.assertNotNull( name, MESSAGES.methodNameMustNotBeNull() ); Method method = run( GetDeclaredMethod.action( beanClass, name, parameterTypes ) ); if ( method == null || method.getDeclaringClass() != beanClass ) { throw LOG.getBeanDoesNotContainMethodException( beanClass, name, parameterTypes ); } <START> JavaBeanMethod javaBeanExecutable = (JavaBeanMethod) JavaBeanExecutable.of( method ); <END> if ( configuredMembers.contains( javaBeanExecutable ) ) { throw LOG.getMethodHasAlreadyBeenConfiguredViaProgrammaticApiException( beanClass, ExecutableHelper.getExecutableAsString( name, parameterTypes ) ); } MethodConstraintMappingContextImpl context = new MethodConstraintMappingContextImpl( this, javaBeanExecutable ); configuredMembers.add( javaBeanExecutable ); executableContexts.add( context ); return context; }</code><technical_language>Mmmh, instantiate a JavaBeanMethod constructor instead of casting :) call variable javaBeanMethod</technical_language>

Target:
public MethodConstraintMappingContext method(String name, Class<?>... parameterTypes) { Contracts.assertNotNull( name, MESSAGES.methodNameMustNotBeNull() ); Method method = run( GetDeclaredMethod.action( beanClass, name, parameterTypes ) ); if ( method == null || method.getDeclaringClass() != beanClass ) { throw LOG.getBeanDoesNotContainMethodException( beanClass, name, parameterTypes ); } JavaBeanMethod javaBeanMethod = JavaBeanExecutable.of( method ); if ( configuredMembers.contains( javaBeanMethod ) ) { throw LOG.getMethodHasAlreadyBeenConfiguredViaProgrammaticApiException( beanClass, ExecutableHelper.getExecutableAsString( name, parameterTypes ) ); } MethodConstraintMappingContextImpl context = new MethodConstraintMappingContextImpl( this, javaBeanMethod ); configuredMembers.add( javaBeanMethod ); executableContexts.add( context ); return context; }
Source:
<code>private String getAzureSubnetToUseWithPrivateEndpoint(DetailedEnvironmentResponse detailedEnvironmentResponse, DBStack dbStack) { String subscriptionId = subnetListerService.getAzureSubscriptionId(detailedEnvironmentResponse.getCrn()); return subnetChooserService.chooseSubnetForPrivateEndpoint(detailedEnvironmentResponse.getNetwork().getSubnetMetas().values(), dbStack).stream() .findFirst() .map(csn -> SubnetListerService.expandAzureResourceId(csn, detailedEnvironmentResponse, subscriptionId)) <START> .map(sn -> sn.getId()).orElse(null); <END> }</code><technical_language>SubnetListerService#expandAzureResourceId static, public spring injection</technical_language>

Target:
private String getAzureSubnetToUseWithPrivateEndpoint(DetailedEnvironmentResponse detailedEnvironmentResponse, DBStack dbStack) { String subscriptionId = subnetListerService.getAzureSubscriptionId(detailedEnvironmentResponse.getCrn()); return subnetChooserService.chooseSubnetForPrivateEndpoint( detailedEnvironmentResponse.getNetwork().getSubnetMetas().values(), dbStack, detailedEnvironmentResponse.getNetwork().isExistingNetwork()).stream() .findFirst() .map(csn -> subnetListerService.expandAzureResourceId(csn, detailedEnvironmentResponse, subscriptionId)) .map(sn -> sn.getId()).orElse(null); }
Source:
<code>public Double getLastPos() { <START> return lastPos; <END> }</code><technical_language>this is a confusing method. do position ? mean? care is current position (as provided encoder)</technical_language>

Target:
public Double getLastPos() { return currentPos; }
Source:
<code>ConfigFileConfigProvider(@JsonProperty("configFile") String configFile){ this.configFile = configFile; <START> loadProperties(); <END> }</code><technical_language>loadProperties() configFile location argument remove global variable configFile . is needed reducing global state is good in general</technical_language>

Target:
ConfigFileConfigProvider(@JsonProperty("configFile") String configFile){ loadProperties(configFile); }
Source:
<code>IndexValue(String logSegmentName, ByteBuffer value, short version) { this.version = version; switch (version) { case PersistentIndex.VERSION_0: if (value.capacity() != INDEX_VALUE_SIZE_IN_BYTES_V0) { throw new IllegalArgumentException("Invalid buffer size for version 0"); } size = value.getLong(); offset = new Offset(logSegmentName, value.getLong()); flags = value.get(); expiresAtMs = value.getLong(); originalMessageOffset = value.getLong(); operationTimeInMs = (int) Utils.Infinite_Time; serviceId = SERVICE_CONTAINER_ID_DEFAULT_VALUE; containerId = SERVICE_CONTAINER_ID_DEFAULT_VALUE; break; case PersistentIndex.VERSION_1: if (value.capacity() != INDEX_VALUE_SIZE_IN_BYTES_V1) { throw new IllegalArgumentException("Invalid buffer size for version 1"); } size = value.getLong(); offset = new Offset(logSegmentName, value.getLong()); flags = value.get(); long expiresAt = value.getInt(); <START> expiresAtMs = expiresAt > Utils.Infinite_Time ? (expiresAt * Time.MsPerSec) : Utils.Infinite_Time; <END> originalMessageOffset = value.getLong(); long operationTimeInSecs = value.getInt(); operationTimeInMs = operationTimeInSecs != Utils.Infinite_Time ? (operationTimeInSecs * Time.MsPerSec) : Utils.Infinite_Time; serviceId = value.getShort(); containerId = value.getShort(); break; default: throw new IllegalArgumentException("Unsupported version " + version + " passed in for IndexValue "); } }</code><technical_language>minor: I check expiresAt >= 0 because, this check, Utils.Infinite_Time is negative (or valid times)</technical_language>

Target:
IndexValue(String logSegmentName, ByteBuffer value, short version) { this.version = version; switch (version) { case PersistentIndex.VERSION_0: if (value.capacity() != INDEX_VALUE_SIZE_IN_BYTES_V0) { throw new IllegalArgumentException("Invalid buffer size for version 0"); } size = value.getLong(); offset = new Offset(logSegmentName, value.getLong()); flags = value.get(); expiresAtMs = value.getLong(); originalMessageOffset = value.getLong(); operationTimeInMs = (int) Utils.Infinite_Time; serviceId = SERVICE_CONTAINER_ID_DEFAULT_VALUE; containerId = SERVICE_CONTAINER_ID_DEFAULT_VALUE; break; case PersistentIndex.VERSION_1: if (value.capacity() != INDEX_VALUE_SIZE_IN_BYTES_V1) { throw new IllegalArgumentException("Invalid buffer size for version 1"); } size = value.getLong(); offset = new Offset(logSegmentName, value.getLong()); flags = value.get(); long expiresAt = value.getInt(); expiresAtMs = expiresAt >= 0 ? TimeUnit.SECONDS.toMillis(expiresAt) : Utils.Infinite_Time; originalMessageOffset = value.getLong(); long operationTimeInSecs = value.getInt(); operationTimeInMs = operationTimeInSecs != Utils.Infinite_Time ? TimeUnit.SECONDS.toMillis(operationTimeInSecs) : Utils.Infinite_Time; serviceId = value.getShort(); containerId = value.getShort(); break; default: throw new IllegalArgumentException("Unsupported version " + version + " passed in for IndexValue "); } }
Source:
<code>public FeedbackResponse getFeedbackResponseEntityWithCheck ( String feedbackQuestionId, String giverEmail, String receiverEmail) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, feedbackQuestionId); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, giverEmail); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, receiverEmail); FeedbackResponse fr = getFeedbackResponseEntity(feedbackQuestionId, giverEmail, receiverEmail); <START> if (fr == null || JDOHelper.isDeleted(fr)) { <END> log.warning("Trying to get non-existent response: " + feedbackQuestionId + "/" + "from: " + giverEmail + " to: " + receiverEmail ); return null; } return fr; }</code><technical_language>this redundant <code>getFeedbackResponseEntity</code> performs this check</technical_language>

Target:
public FeedbackResponse getFeedbackResponseEntityWithCheck ( String feedbackQuestionId, String giverEmail, String receiverEmail) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, feedbackQuestionId); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, giverEmail); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, receiverEmail); FeedbackResponse fr = getFeedbackResponseEntity(feedbackQuestionId, giverEmail, receiverEmail); if (fr == null) { log.warning("Trying to get non-existent response: " + feedbackQuestionId + "/" + "from: " + giverEmail + " to: " + receiverEmail ); return null; } return fr; }
Source:
<code>private void bccWatchesNotifySubmittedChanges() { if (db != null) { try { final ProjectState ps = getProjectState(); if (ps != null) { for (AccountProjectWatch w : db.accountProjectWatches() .notifySubmittedChanges(ps.getProject().getNameKey())) { final List<Patch> patches = getPatches(patchSet.getId()); <START> final List<String> patchFileNames = getPatchesFileNames(patches); <END> if (canAddRecipient(w, patchFileNames)) { add(RecipientType.BCC, w.getAccountId()); } } } } catch (OrmException err) { } } }</code><technical_language>change loop. Please hoist of loop recomputing them</technical_language>

Target:
private void bccWatchesNotifySubmittedChanges() { try { for (final AccountProjectWatch w : getWatches()) { if (w.isNotifySubmittedChanges()) { add(RecipientType.BCC, w.getAccountId()); } } } catch (OrmException err) { } }
Source:
<code>private void logPoolStats() { if (log.isTraceEnabled()) { State stateLocal = state; HikariPoolMXBean poolProxy = stateLocal.poolProxy; if (poolProxy != null) { try { <START> log.trace( <END> "[{}] HikariCP: " + "numBusyConnections = {}, " + "numIdleConnections = {}, " + "numConnections = {}, " + "numThreadsAwaitingCheckout = {}", connConfig.getConnectionPoolName(), poolProxy.getActiveConnections(), poolProxy.getIdleConnections(), poolProxy.getTotalConnections(), poolProxy.getThreadsAwaitingConnection()); } catch (Exception e) { log.error("[{}] Unable to log pool statistics.", connConfig.getConnectionPoolName(), e); } } } }</code><technical_language>this sense trace log</technical_language>

Target:
private void logPoolStats() { if (log.isWarnEnabled()) { State stateLocal = state; HikariPoolMXBean poolProxy = stateLocal.poolProxy; if (poolProxy != null) { try { log.warn( "[{}] HikariCP: " + "numBusyConnections = {}, " + "numIdleConnections = {}, " + "numConnections = {}, " + "numThreadsAwaitingCheckout = {}", connConfig.getConnectionPoolName(), poolProxy.getActiveConnections(), poolProxy.getIdleConnections(), poolProxy.getTotalConnections(), poolProxy.getThreadsAwaitingConnection()); } catch (Exception e) { log.error("[{}] Unable to log pool statistics.", connConfig.getConnectionPoolName(), e); } } } }
Source:
<code>public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "applicationContext.xml"); PersonRepository repository = context.getBean(PersonRepository.class); Person peter = new Person("Peter", "Sagan", 17); Person nasta = new Person("Nasta", "Kuzminova", 25); Person john = new Person("John", "lawrence", 35); Person terry = new Person("Terry", "Law", 36); repository.save(peter); repository.save(nasta); repository.save(john); repository.save(terry); LOGGER.info("Count Person records: {}", repository.count()); List<Person> persons = (List<Person>) repository.findAll(); for (Person person : persons) { LOGGER.info(person.toString()); } nasta.setName("Barbora"); nasta.setSurname("Spotakova"); repository.save(nasta); <START> LOGGER.info("Find by id 2: {}", repository.findById(2L)); <END> repository.deleteById(2L); LOGGER.info("Count Person records: {}", repository.count()); Optional<Person> p = repository.findOne(new PersonSpecifications.NameEqualSpec("John")); LOGGER.info("Find by John is {}", p.get()); persons = repository.findAll(new PersonSpecifications.AgeBetweenSpec(20, 40)); LOGGER.info("Find Person with age between 20,40: "); for (Person person : persons) { LOGGER.info(person.toString()); } repository.deleteAll(); context.close(); }</code><technical_language>findById returns Optional, want log contents</technical_language>

Target:
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "applicationContext.xml"); PersonRepository repository = context.getBean(PersonRepository.class); Person peter = new Person("Peter", "Sagan", 17); Person nasta = new Person("Nasta", "Kuzminova", 25); Person john = new Person("John", "lawrence", 35); Person terry = new Person("Terry", "Law", 36); repository.save(peter); repository.save(nasta); repository.save(john); repository.save(terry); LOGGER.info("Count Person records: {}", repository.count()); List<Person> persons = (List<Person>) repository.findAll(); for (Person person : persons) { LOGGER.info(person.toString()); } nasta.setName("Barbora"); nasta.setSurname("Spotakova"); repository.save(nasta); LOGGER.info("Find by id 2: {}", repository.findById(2L).get()); repository.deleteById(2L); LOGGER.info("Count Person records: {}", repository.count()); Optional<Person> p = repository.findOne(new PersonSpecifications.NameEqualSpec("John")); LOGGER.info("Find by John is {}", p.get()); persons = repository.findAll(new PersonSpecifications.AgeBetweenSpec(20, 40)); LOGGER.info("Find Person with age between 20,40: "); for (Person person : persons) { LOGGER.info(person.toString()); } repository.deleteAll(); context.close(); }
Source:
<code>public Sheet getDataSheet(File file) { stream = new PushbackInputStream(new FileInputStream(file)); Workbook wb = null; try { wb = WorkbookFactory.create(stream); } catch (Exception e) { <START> Log.error("Workbook creation exception:" + e); <END> } return wb.getSheetAt(0); }</code><technical_language>this added a new import: org.jfree.util.Log, log object line 204? log.error("Workbook creation exception", e); ? Is a reason 2 ways of logging errors</technical_language>

Target:
public Sheet getDataSheet(File file) { Workbook wb = null; try { stream = new PushbackInputStream(new FileInputStream(file)); wb = WorkbookFactory.create(stream); } catch (Exception e) { log.error("Workbook creation exception:" + e); } return wb.getSheetAt(0); }
Source:
<code>public void setPrice1(int price3) { if (price3 < 0 || price3 > 10000) { <START> throw new IllegalArgumentException("Invalid price: " + price3); END> } if (true) { assert price3 > 1000; } }</code><technical_language>is this part for? checking throw statements</technical_language>

Target:
public void setPrice1(int price3) { if (true) { assert price3 > 1000; } }
Source:
<code><START> @Test public void slave() throws Exception { <END> DumbSlave s = j.createOnlineSlave(); project.setAssignedLabel(s.getSelfLabel()); FilePath src = new FilePath(j.jenkins.getRootPath(), "jobs/junit/workspace/"); assertNotNull(src); FilePath dest = s.getWorkspaceFor(project); assertNotNull(dest); src.copyRecursiveTo("*.xml", dest); basic(); }</code><technical_language>Inherited sin. put @Test annotation a new line public modifier</technical_language>

Target:
public void slave() throws Exception { DumbSlave s = j.createOnlineSlave(); project.setAssignedLabel(s.getSelfLabel()); FilePath src = new FilePath(j.jenkins.getRootPath(), "jobs/junit/workspace/"); assertNotNull(src); FilePath dest = s.getWorkspaceFor(project); assertNotNull(dest); src.copyRecursiveTo("*.xml", dest); basic(); }
Source:
<code>private void setVmLeasesAvailability() { TModel model = getModel(); Version compVer = model.getSelectedCluster().getCompatibilityVersion(); if (model.getCustomCompatibilityVersion().getSelectedItem() != null) { compVer = model.getCustomCompatibilityVersion().getSelectedItem(); } <START> model.getLease().setIsAvailable(AsyncDataProvider.getInstance().isVmLeasesFeatureSupported(compVer)); <END> }</code><technical_language>hide options supported instead disable a message (same e.g. model.getIsRngEnabled())</technical_language>

Target:
private void setVmLeasesAvailability() { TModel model = getModel(); Version compVer = model.getSelectedCluster().getCompatibilityVersion(); if (model.getCustomCompatibilityVersion().getSelectedItem() != null) { compVer = model.getCustomCompatibilityVersion().getSelectedItem(); } model.getLease().setIsChangeable( AsyncDataProvider.getInstance().isVmLeasesFeatureSupported(compVer), constants.vmLeasesSupported()); }
Source:
<code>private void detectIndexChanges() { if (isBare()) { return; } File indexFile = getIndexFile(); synchronized (this) { if (snapshot == null) { snapshot = FileSnapshot.save(indexFile); } else if (snapshot.isModified(indexFile)) { <START> notifyIndexChanged(false); <END> } } }</code><technical_language>This call fireEvent() while monitor is held, synchronously invoke registered event listeners. Invoking callbacks a synchronized block is... risky</technical_language>

Target:
private void detectIndexChanges() { if (isBare()) { return; } File indexFile = getIndexFile(); boolean notify = false; synchronized (this) { if (snapshot == null) { snapshot = FileSnapshot.save(indexFile); } else if (snapshot.isModified(indexFile)) { notify = true; } } if (notify) { notifyIndexChanged(false); } }
Source:
<code>public void run() { <START> LogUtils.registerLoggingContext(ss.getConf()); <END> runner = Thread.currentThread(); try { SessionState.start(ss); runSequential(); } finally { try { Hive.closeCurrent(); } catch (Exception e) { LOG.warn("Exception closing Metastore connection:" + e.getMessage()); } runner = null; result.setRunning(false); } }</code><technical_language>tsk.getConf() configs provided clause there</technical_language>

Target:
public void run() { LogUtils.registerLoggingContext(tsk.getConf()); runner = Thread.currentThread(); try { SessionState.start(ss); runSequential(); } finally { try { Hive.closeCurrent(); } catch (Exception e) { LOG.warn("Exception closing Metastore connection:" + e.getMessage()); } runner = null; result.setRunning(false); } }
Source:
<code>public static String host() { <START> String host = System.getenv("HOST"); <END> return host == null ? currentHost() : host; }</code><technical_language>compatible</technical_language>

Target:
public static String host() { String host = ObjectUtils.firstNonNull(System.getenv("HOST"), System.getenv("MESOS_HOSTNAME")); return host == null ? currentHost() : host; }
Source:
<code>public String getTrace() { StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); Throwable exc = getException(); exc.printStackTrace(writer); if (exc instanceof ExceptionWithThread) { ExceptionWithThread ewt = (ExceptionWithThread) exc; <START> if (ewt.getDescription() == null) { <END> writer.println("Stack for thread " + ewt.getThread().getName() + ":"); } else { writer.println(ewt.getDescription() + ":"); } StackTraceElement[] threadTrace = ewt.getThreadStackTrace(); for (StackTraceElement traceElement : threadTrace) { writer.println("\tat " + traceElement); } } StringBuffer buffer = stringWriter.getBuffer(); return buffer.toString(); }</code><technical_language>special-casing ExceptionWithThread in failure, FailOnTimeout create a MultipleFailureException, "host" exception a synthetic exception failing thread? handled</technical_language>

Target:
public String getTrace() { StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); getException().printStackTrace(writer); StringBuffer buffer = stringWriter.getBuffer(); return buffer.toString(); }
Source:
<code>private static RealmAwareZkClient getHelixZkClient(String zkAddr) { if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED)) { try { RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig = new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(); RealmAwareZkClient.RealmAwareZkClientConfig clientConfig = new RealmAwareZkClient.RealmAwareZkClientConfig(); return new FederatedZkClient(connectionConfig, clientConfig); } catch (IllegalArgumentException | IOException | InvalidRoutingDataException e) { throw new HelixException("Not able to connect on realm-aware mode", e); } <START> } else { <END> if (zkAddr == null || zkAddr.isEmpty()) { throw new HelixException("ZK Address given is either null or empty!"); } HelixZkClient.ZkClientConfig clientConfig = new HelixZkClient.ZkClientConfig(); clientConfig.setZkSerializer(new ZNRecordSerializer()); return DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddr), clientConfig); } }</code><technical_language>Nit, need for else</technical_language>

Target:
private static RealmAwareZkClient getHelixZkClient(String zkAddr) { if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED)) { try { RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig = new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(); RealmAwareZkClient.RealmAwareZkClientConfig clientConfig = new RealmAwareZkClient.RealmAwareZkClientConfig(); return new FederatedZkClient(connectionConfig, clientConfig); } catch (IllegalArgumentException | IOException | InvalidRoutingDataException e) { throw new HelixException("Not able to connect on realm-aware mode", e); } } if (zkAddr == null || zkAddr.isEmpty()) { throw new HelixException("ZK Address given is either null or empty!"); } HelixZkClient.ZkClientConfig clientConfig = new HelixZkClient.ZkClientConfig(); clientConfig.setZkSerializer(new ZNRecordSerializer()); return DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddr), clientConfig); }
Source:
<code>private static void run( ZestScript zs, Map<String, String> parameters, boolean debug, Integer timeoutInSeconds, boolean skipSSLCertificateCheck) { ZestBasicRunner zbr = <START> (timeoutInSeconds == null) <END> ? new ZestBasicRunner() : new ZestBasicRunner(timeoutInSeconds, skipSSLCertificateCheck); zbr.setOutputWriter(new OutputStreamWriter(System.out)); zbr.setStopOnAssertFail(false); zbr.setDebug(debug); try { zbr.run(zs, parameters); } catch (Exception e) { System.out.println("Error running script: " + e); e.printStackTrace(); } }</code><technical_language>This means need set a timeout able disable cert checking, is purpose</technical_language>

Target:
private static void run( ZestScript zs, Map<String, String> parameters, boolean debug, Integer timeoutInSeconds, boolean skipSSLCertificateCheck) { ZestBasicRunner zbr = new ZestBasicRunner(timeoutInSeconds, skipSSLCertificateCheck); zbr.setOutputWriter(new OutputStreamWriter(System.out)); zbr.setStopOnAssertFail(false); zbr.setDebug(debug); try { zbr.run(zs, parameters); } catch (Exception e) { System.out.println("Error running script: " + e); e.printStackTrace(); } }
Source:
<code>public PagedFlux<BlobItem> listBlobsFlat(ListBlobsOptions options) { return new PagedFlux<>( () -> listBlobsFlatSegment(null, options) <START> .map(response -> new PagedResponseBase<>( <END> response.request(), response.statusCode(), response.headers(), response.value().segment().blobItems(), response.value().nextMarker(), response.deserializedHeaders() )), (marker) -> listBlobsFlatSegment(marker, options) .map(response -> new PagedResponseBase<>( response.request(), response.statusCode(), response.headers(), response.value().segment().blobItems(), response.value().nextMarker(), response.deserializedHeaders() )) ); }</code><technical_language>question making this mapping a class level method, this reduce of blocks a single place</technical_language>

Target:
public PagedFlux<BlobItem> listBlobsFlat(ListBlobsOptions options) { return listBlobsFlatWithOptionalTimeout(options, null); }