auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CSVFileScanFragment( final DataSource source, final Schema schema, final long partitionStartByteRange, final long partitionEndByteRange, final boolean isLastWorker, @Nullable final Character delimiter, @Nullable final Character quote, @Nullable final Character escape, @Nullable final Integer numberOfSkippedLines) { this.source = (AmazonS3Source) Preconditions.checkNotNull(source, "source"); this.schema = Preconditions.checkNotNull(schema, "schema"); this.delimiter = MoreObjects.firstNonNull(delimiter, CSVFormat.DEFAULT.getDelimiter()); this.quote = MoreObjects.firstNonNull(quote, CSVFormat.DEFAULT.getQuoteCharacter()); <START> this.escape = escape != null ? escape : CSVFormat.DEFAULT.getEscapeCharacter(); <END> this.numberOfSkippedLines = MoreObjects.firstNonNull(numberOfSkippedLines, 0); this.partitionStartByteRange = partitionStartByteRange; this.partitionEndByteRange = partitionEndByteRange; this.isLastWorker = isLastWorker; }</code><technical_language>MoreObjects.firstNonNull well</technical_language>

Target:
public CSVFileScanFragment( final DataSource source, final Schema schema, final long partitionStartByteRange, final long partitionEndByteRange, final boolean isLastWorker, @Nullable final Character delimiter, @Nullable final Character quote, @Nullable final Character escape, @Nullable final Integer numberOfSkippedLines) { this.source = (AmazonS3Source) Preconditions.checkNotNull(source, "source"); this.schema = Preconditions.checkNotNull(schema, "schema"); this.delimiter = MoreObjects.firstNonNull(delimiter, CSVFormat.DEFAULT.getDelimiter()); this.quote = MoreObjects.firstNonNull(quote, CSVFormat.DEFAULT.getQuoteCharacter()); this.escape = escape; this.numberOfSkippedLines = MoreObjects.firstNonNull(numberOfSkippedLines, 0); this.partitionStartByteRange = partitionStartByteRange; this.partitionEndByteRange = partitionEndByteRange; this.isLastWorker = isLastWorker; maxByteRange = ((AmazonS3Source) source).getFileSize(); onLastRow = false; finishedReadingLastRow = false; flagAsIncomplete = false; }
Source:
<code>public void setInput(Object inputElement) { fInputElement = inputElement; ITimeGraphEntry[] input = fTimeGraphContentProvider.getElements(inputElement); synchronized (fListenerNotifierLock) { <START> fListenerNotifier = null; <END> } if (fTimeGraphCtrl != null) { setTimeRange(input); setTopIndex(0); fSelectionBegin = SWT.DEFAULT; fSelectionEnd = SWT.DEFAULT; fSelectedEntry = null; refreshAllData(input); } }</code><technical_language>state of reference is part of "this" object. monitor of "fListenerNotifierLock" cover states in object, in "this". remove synchronized block here, extract a local variable below</technical_language>

Target:
public void setInput(Object inputElement) { fInputElement = inputElement; ITimeGraphEntry[] input = fTimeGraphContentProvider.getElements(inputElement); fListenerNotifier = null; if (fTimeGraphCtrl != null) { setTimeRange(input); setTopIndex(0); fSelectionBegin = SWT.DEFAULT; fSelectionEnd = SWT.DEFAULT; fSelectedEntry = null; refreshAllData(input); } }
Source:
<code>public void panToPercent(double percent) { double minVisible = simplePlot.getAxes().getX().getMinimumValue(); double maxVisible = simplePlot.getAxes().getX().getMaximumValue(); double valueOnScaleShouldBe = percent * (maxRange - maxVisible + minVisible); double deltaInScale = valueOnScaleShouldBe - minVisible; <START> double pixelsToScale = (simplePlot.getOffsetWidth() - simplePlot.getOptions().getYAxisOptions().getLabelWidth()) / (maxVisible - minVisible); <END> Pan pan = Pan.create().setLeft(deltaInScale * pixelsToScale).setPreventEvent(true); simplePlot.pan(pan); int newHorizontalPosition = (int) ((scrollbar.getMaximumHorizontalScrollPosition() - scrollbar.getMinimumHorizontalScrollPosition()) * percent); if (newHorizontalPosition == scrollbar.getHorizontalScrollPosition()) { NativeEvent event = Document.get().createScrollEvent(); DomEvent.fireNativeEvent(event, scrollbar); } else { scrollbar.setHorizontalScrollPosition(newHorizontalPosition); } }</code><technical_language>propose put: simplePlot.getOffsetWidth() - simplePlot.getOptions().getYAxisOptions().getLabelWidth() separate private method. f.e. getPlotWidth()</technical_language>

Target:
public void panToPercent(double percent) { double minVisible = simplePlot.getAxes().getX().getMinimumValue(); double visibleRange = getVisibleRange(); double valueOnScaleShouldBe = percent * (maxRange - visibleRange); double deltaInScale = valueOnScaleShouldBe - minVisible; double pixelsToScale = getPlotWidth() / visibleRange; Pan pan = Pan.create().setLeft(deltaInScale * pixelsToScale).setPreventEvent(true); simplePlot.pan(pan); int newHorizontalPosition = (int) ((scrollbar.getMaximumHorizontalScrollPosition() - scrollbar.getMinimumHorizontalScrollPosition()) * percent); if (newHorizontalPosition == scrollbar.getHorizontalScrollPosition()) { NativeEvent event = Document.get().createScrollEvent(); DomEvent.fireNativeEvent(event, scrollbar); } else { scrollbar.setHorizontalScrollPosition(newHorizontalPosition); } }
Source:
<code>public void initialize() { <START> final Class<?> outTypeClass = out() == null ? Type.class : Util <END> .getTypeFromInterval(out()).getClass(); final Object inType = in() == null ? NativeType.class : Util .getTypeFromInterval(in()); final UnaryComputerOp<?, ?> typeComputer = Computers.unary(ops(), Ops.Copy.Type.class, outTypeClass, inType); mapComputer = RAIs.computer(ops(), Ops.Map.class, in(), typeComputer); createFunc = RAIs.function(ops(), Ops.Create.Img.class, in(), inType); }</code><technical_language>type Object</technical_language>

Target:
public void initialize() { final Object outType = out() == null ? Type.class : Util .getTypeFromInterval(out()); final Object inType = in() == null ? NativeType.class : Util .getTypeFromInterval(in()); final UnaryComputerOp<?, ?> typeComputer = Computers.unary(ops(), Ops.Copy.Type.class, outType, inType); mapComputer = RAIs.computer(ops(), Ops.Map.class, in(), typeComputer); createFunc = RAIs.function(ops(), Ops.Create.Img.class, in(), inType); }
Source:
<code><START> public long getMonthlySpareParts() { <END> long partsCost = 0; for (Unit u : getUnits()) { if (u.isMothballed()) { continue; } partsCost += u.getSparePartsCost(); } return partsCost; }</code><technical_language>part of peacetime costs feature</technical_language>

Target:
private long getMonthlySpareParts() { long partsCost = 0; for (Unit u : getUnits()) { if (u.isMothballed()) { continue; } partsCost += u.getSparePartsCost(); } return partsCost; }
Source:
<code>private void checkCFG(ControlFlowGraph cfg, FunctionTree functionTree) { Scope scope = getContext().getSymbolModel().getScope(functionTree); LiveVariableAnalysis lva = LiveVariableAnalysis.create(cfg, scope); Usages usages = lva.getUsages(); for (CfgBlock cfgBlock : cfg.blocks()) { if (isTryBlock(cfgBlock)) { <START> return; <END> } } for (CfgBlock cfgBlock : cfg.blocks()) { Set<Symbol> live = lva.getLiveOutSymbols(cfgBlock); for (Tree element : Lists.reverse(cfgBlock.elements())) { Usage usage = usages.getUsage(element); if (usage != null) { checkUsage(usage, live, usages); } } } raiseIssuesForNeverReadSymbols(usages); }</code><technical_language>@ivandalbosco Minor cheap do: more this for-loop in beginning of this function (thus create useless LVA)</technical_language>

Target:
private void checkCFG(ControlFlowGraph cfg, FunctionTree functionTree) { for (CfgBlock cfgBlock : cfg.blocks()) { if (isTryBlock(cfgBlock)) { return; } } Scope scope = getContext().getSymbolModel().getScope(functionTree); LiveVariableAnalysis lva = LiveVariableAnalysis.create(cfg, scope); Usages usages = lva.getUsages(); for (CfgBlock cfgBlock : cfg.blocks()) { Set<Symbol> live = lva.getLiveOutSymbols(cfgBlock); for (Tree element : Lists.reverse(cfgBlock.elements())) { Usage usage = usages.getUsage(element); if (usage != null) { checkUsage(usage, live, usages); } } } raiseIssuesForNeverReadSymbols(usages); }
Source:
<code>public void basicPagination() throws IOException { try { HELPERS.ensureBucketExists(TEST_ENV_NAME); final int numObjects = 50; CLIENT.putBulkJobSpectraS3(new PutBulkJobSpectraS3Request(TEST_ENV_NAME, createTestList(numObjects))); <START> final GetObjectsFullDetailsLoaderFactory loaderFactory = new GetObjectsFullDetailsLoaderFactory(CLIENT, TEST_ENV_NAME, "", 10, RETRIES, false); <END> final Set<String> foundItems = new HashSet<>(); for (final DetailedS3Object detailedS3Object : new LazyIterable<>(loaderFactory)) { LOG.info("Testing: {}", detailedS3Object.getName()); assertFalse(foundItems.contains(detailedS3Object.getName())); foundItems.add(detailedS3Object.getName()); } for (int i = 0; i < numObjects; i++) { assertTrue(foundItems.contains("obj." + i)); } } finally { deleteAllContents(CLIENT, TEST_ENV_NAME); } }</code><technical_language>test if numObjects is integral multiple of page size. I work today</technical_language>

Target:
public void basicPagination() throws IOException { try { HELPERS.ensureBucketExists(TEST_ENV_NAME); final int numObjects = 55; CLIENT.putBulkJobSpectraS3(new PutBulkJobSpectraS3Request(TEST_ENV_NAME, createTestList(numObjects))); final GetObjectsFullDetailsLoaderFactory loaderFactory = new GetObjectsFullDetailsLoaderFactory(CLIENT, TEST_ENV_NAME, "", 10, RETRIES, false); final Set<String> foundItems = new HashSet<>(); for (final DetailedS3Object detailedS3Object : new LazyIterable<>(loaderFactory)) { LOG.info("Testing: {}", detailedS3Object.getName()); assertFalse(foundItems.contains(detailedS3Object.getName())); foundItems.add(detailedS3Object.getName()); } for (int i = 0; i < numObjects; i++) { assertTrue(foundItems.contains("obj." + i)); } } finally { deleteAllContents(CLIENT, TEST_ENV_NAME); } }
Source:
<code>public void test_unmodifiableSortedSetLjava_util_SortedSet() { boolean exception = false; SortedSet ss = new TreeSet(); ss.addAll(s); SortedSet c = Collections.unmodifiableSortedSet(ss); assertTrue("Returned set is of incorrect size", c.size() == ss.size()); Iterator i = ll.iterator(); while (i.hasNext()) assertTrue("Returned set missing elements", c.contains(i.next())); try { c.add(new Object()); } catch (UnsupportedOperationException e) { exception = true; } if (!exception) { fail("Allowed modification of set"); } exception = false; try { c.remove(new Object()); } catch (UnsupportedOperationException e) { <START> exception = <END> true; } if (!exception) { fail("Allowed modification of set"); } exception = false; try { c.removeIf(x -> true); } catch (UnsupportedOperationException e) { exception = true; } if (!exception) { fail("Allowed modification of set"); } }</code><technical_language>Normal pattern (which above). try { exceptionGeneratingOperation(); fail(); } catch (ExpectedException expected) { }</technical_language>

Target:
public void test_unmodifiableSortedSetLjava_util_SortedSet() { boolean exception = false; SortedSet ss = new TreeSet(); ss.addAll(s); SortedSet c = Collections.unmodifiableSortedSet(ss); assertTrue("Returned set is of incorrect size", c.size() == ss.size()); Iterator i = ll.iterator(); while (i.hasNext()) assertTrue("Returned set missing elements", c.contains(i.next())); try { c.add(new Object()); fail("Allowed modification of set"); } catch (UnsupportedOperationException e) try { c.remove(new Object()); fail("Allowed modification of set"); } catch (UnsupportedOperationException expected) try { c.removeIf(x -> true); fail("Allowed modification of set"); } catch (UnsupportedOperationException expected) }
Source:
<code><START> public void registerDispatcher(final IDispatcher dispatcher, final boolean aggregationRequired) { <END> if (aggregationRequired) { mDispatcher = new AggregatedDispatcher(dispatcher); } else { mDispatcher = new DefaultDispatcher(dispatcher); } }</code><technical_language>mDispatcher syncronized? #Resolved</technical_language>

Target:
public synchronized void registerDispatcher(final IDispatcher dispatcher, final boolean aggregationRequired) { if (aggregationRequired) { mDispatcher = new AggregatedDispatcher(dispatcher); } else { mDispatcher = new DefaultDispatcher(dispatcher); } }
Source:
<code>public static String getRegistrationKeyFromGmail(String username, String courseName, String courseId) throws IOException, MessagingException { Gmail service = new GmailServiceMaker(username).makeGmailService(); ListMessagesResponse listMessagesResponse; while (true) { try { listMessagesResponse = service.users().messages().list(username).setMaxResults(5L) .setQ("is:UNREAD").execute(); break; } catch (GoogleJsonResponseException e) { if (e.getDetails().getCode() == HttpStatusCodes.STATUS_CODE_FORBIDDEN) { System.out.println(e.getDetails().getMessage()); service = new GmailServiceMaker(username, true).makeGmailService(); } else { throw e; } } } final List<Message> messageStubs = listMessagesResponse.getMessages(); <START> if (messageStubs != null) { <END> for (Message messageStub : messageStubs) { final Message message = service.users().messages().get(username, messageStub.getId()).setFormat("raw") .execute(); final MimeMessage email = convertFromMessageToMimeMessage(message); if (isStudentCourseJoinRegistrationEmail(email, courseName, courseId)) { final String body = getEmailMessageBodyAsText(email); final ModifyMessageRequest modifyMessageRequest = new ModifyMessageRequest() .setRemoveLabelIds(Collections.singletonList("UNREAD")); service.users().messages().modify(username, messageStub.getId(), modifyMessageRequest).execute(); return getKey(body); } } } return null; }</code><technical_language>guard clause prevent deep nesting: if (messageStubs == null) { return null; }</technical_language>

Target:
public static String getRegistrationKeyFromGmail(String username, String courseName, String courseId) throws IOException, MessagingException { Gmail service = new GmailServiceMaker(username).makeGmailService(); ListMessagesResponse listMessagesResponse; while (true) { try { listMessagesResponse = service.users().messages().list(username).setMaxResults(5L) .setQ("is:UNREAD").execute(); break; } catch (GoogleJsonResponseException e) { if (e.getDetails().getCode() == HttpStatusCodes.STATUS_CODE_FORBIDDEN) { System.out.println(e.getDetails().getMessage()); service = new GmailServiceMaker(username, true).makeGmailService(); } else { throw e; } } } final List<Message> messageStubs = listMessagesResponse.getMessages(); if (isEmpty(messageStubs)) { return null; } for (Message messageStub : messageStubs) { final Message message = service.users().messages().get(username, messageStub.getId()).setFormat("raw") .execute(); final MimeMessage email = convertFromMessageToMimeMessage(message); if (isStudentCourseJoinRegistrationEmail(email, courseName, courseId)) { final String body = getTextFromEmail(email); markMessageAsRead(service, username, messageStub); return getKey(body); } } return null; }
Source:
<code>public Connection getOrConnect(@Nonnull Address address) { checkClientActive(); InetSocketAddress inetSocketAddress = inetSocketAddressCache.get(address); ClientConnection connection = activeConnections.get(inetSocketAddress); if (connection != null) { return connection; } synchronized (locks[abs(inetSocketAddress.hashCode() % CONCURRENT_AUTH_COUNT)]) { connection = activeConnections.get(inetSocketAddress); if (connection != null) { return connection; } address = translate(address); connection = createSocketConnection(address); <START> authenticate(connection); <END> return connection; } }</code><technical_language>I lock index calculation simpler. atomic counter %CONCURRENT_AUTH_COUNT do similarly utilization of slots (in case hashCode produces similar results.)</technical_language>

Target:
Connection getOrConnect(@Nonnull Address address) { checkClientActive(); InetSocketAddress inetSocketAddress = resolveAddress(address); ClientConnection connection = activeConnections.get(inetSocketAddress); if (connection != null) { return connection; } synchronized (inetSocketAddress) { connection = activeConnections.get(inetSocketAddress); if (connection != null) { return connection; } address = translate(address); connection = createSocketConnection(address); initializeToCluster(connection); return connection; } }
Source:
<code>public EntityList getDependency(String entityType, String entityName, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Entities.DEPENDENCY.path, entityType, entityName) .addQueryParam(DO_AS_OPT, doAsUser).call(Entities.DEPENDENCY); printClientResponse(clientResponse); checkIfSuccessful(clientResponse); EntityList result = clientResponse.getEntity(EntityList.class); <START> if (result == null || result.getElements() == null) { <END> return new EntityList(); } return result; }</code><technical_language>dont need " result.getElements() == null " condition</technical_language>

Target:
public EntityList getDependency(String entityType, String entityName, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Entities.DEPENDENCY.path, entityType, entityName) .addQueryParam(DO_AS_OPT, doAsUser).call(Entities.DEPENDENCY); printClientResponse(clientResponse); checkIfSuccessful(clientResponse); EntityList result = clientResponse.getEntity(EntityList.class); if (result == null) { return new EntityList(); } return result; }
Source:
<code>private void fetchAndDisplayThumbnail(DisplayableContribution contribution) { String keyForLRUCache = getKeyForLRUCache(contribution.getContentUri()); String cacheUrl = thumbnailCache.get(keyForLRUCache); if (!StringUtils.isBlank(cacheUrl)) { imageView.setImageURI(cacheUrl); return; } imageView.setBackground(null); if ((contribution.getState() != Contribution.STATE_COMPLETED) && fileExists( contribution.getLocalUri())) { <START> imageView.setImageURI(contribution.getLocalUri()); <END> }else { Timber.d("Fetching thumbnail for %s", contribution.getFilename()); Disposable disposable = mediaDataExtractor .getMediaFromFileName(contribution.getFilename()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(media -> { thumbnailCache.put(keyForLRUCache, media.getThumbUrl()); imageView.setImageURI(media.getThumbUrl()); }); compositeDisposable.add(disposable); } }</code><technical_language>If getState() != Contribution.STATE_COMPLETED, contribution.getLocalUri() some temporary image</technical_language>

Target:
private void fetchAndDisplayThumbnail(DisplayableContribution contribution) { String keyForLRUCache = getKeyForLRUCache(contribution.getContentUri()); String cacheUrl = thumbnailCache.get(keyForLRUCache); if (!StringUtils.isBlank(cacheUrl)) { imageView.setImageURI(cacheUrl); return; } imageView.setBackground(null); if ((contribution.getState() != Contribution.STATE_COMPLETED) && FileUtils.fileExists( contribution.getLocalUri())) { imageView.setImageURI(contribution.getLocalUri()); } else { Timber.d("Fetching thumbnail for %s", contribution.getFilename()); Disposable disposable = mediaDataExtractor .getMediaFromFileName(contribution.getFilename()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(media -> { thumbnailCache.put(keyForLRUCache, media.getThumbUrl()); imageView.setImageURI(media.getThumbUrl()); }); compositeDisposable.add(disposable); } }
Source:
<code>public CassandraService(MetricsManager metricsManager, CassandraKeyValueServiceConfig config, Blacklist blacklist) { <START> this(metricsManager, config, blacklist, Optional.empty(), new Random()); <END> }</code><technical_language>usages of this constructor in develop, Optional. avoid proliferation of constructors factories untenable time. fine for breaks people instantiating if fix for arise</technical_language>

Target:
public CassandraService(MetricsManager metricsManager, CassandraKeyValueServiceConfig config, Blacklist blacklist) { this.metricsManager = metricsManager; this.randomHostsSelected = metricsManager.getTaggedRegistry().counter(MetricName.builder() .safeName(MetricRegistry.name(CassandraService.class, "randomHostsSelected")).build()); this.localHostsSelected = metricsManager.getTaggedRegistry().counter(MetricName.builder() .safeName(MetricRegistry.name(CassandraService.class, "localHostsSelected")).build()); this.config = config; this.myLocationSupplier = new HostLocationSupplier(this::getSnitch, config.overrideHostLocation()); this.blacklist = blacklist; }
Source:
<code>public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { List<VDS> list = new ArrayList<>(); if (vm.getStatus() == VMStatus.Paused) { return hosts; } List<VmNumaNode> vmNumaNodes = DbFacade.getInstance().getVmNumaNodeDAO().getAllVmNumaNodeByVmId(vm.getId()); for (VDS vds : hosts) { if (!isVMSwapValueLegal(vds)) { log.debugFormat("host '{0}' swap value is illegal", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__SWAP_VALUE_ILLEGAL.toString()); continue; } if (!memoryChecker.evaluate(vds, vm)) { log.debugFormat("host '{0}' has insufficient memory to run the VM", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__NOT_ENOUGH_MEMORY.toString()); continue; } <START> if (isVmNumaPinned(vmNumaNodes) && vm.getNumaTuneMode() == NumaTuneMode.STRICT <END> && (!vds.isNumaSupport() || !canVmNumaPinnedToVds(vm, vmNumaNodes, vds))) { log.debugFormat("host '{0}' cannot accommodate memory of VM's pinned virtual NUMA nodes within host's physical NUMA nodes", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__NOT_ENOUGH_MEMORY.toString()); continue; } list.add(vds); } return list; }</code><technical_language>chcek if STRICT (the cheapest check)</technical_language>

Target:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { List<VDS> list = new ArrayList<>(); if (vm.getStatus() == VMStatus.Paused) { return hosts; } List<VmNumaNode> vmNumaNodes = DbFacade.getInstance().getVmNumaNodeDAO().getAllVmNumaNodeByVmId(vm.getId()); for (VDS vds : hosts) { if (!isVMSwapValueLegal(vds)) { log.debugFormat("host '{0}' swap value is illegal", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__SWAP_VALUE_ILLEGAL.toString()); continue; } if (!memoryChecker.evaluate(vds, vm)) { log.debugFormat("host '{0}' has insufficient memory to run the VM", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__NOT_ENOUGH_MEMORY.toString()); continue; } if (vm.getNumaTuneMode() == NumaTuneMode.STRICT && isVmNumaPinned(vmNumaNodes) && (!vds.isNumaSupport() || !canVmNumaPinnedToVds(vm, vmNumaNodes, vds))) { log.debugFormat("host '{0}' cannot accommodate memory of VM's pinned virtual NUMA nodes within host's physical NUMA nodes", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__NOT_MEMORY_PINNED_NUMA.toString()); continue; } list.add(vds); } return list; }
Source:
<code>public VoltTable run(byte[] licenseBytes) { VoltTable vt = constructResultTable(); File tmpLicense = new File(VoltDB.instance().getVoltDBRootPath(), tmpFileName); try { Files.write(licenseBytes, tmpLicense); } catch (IOException e) { return constructFailureResponse(vt, "Failed to write the new license to disk: " + e.getMessage(), null); } LicenseApi newLicense = MiscUtils.licenseApiFactory(tmpLicense.getAbsolutePath()); if (newLicense == null) { return constructFailureResponse(vt, "Invalid license format", tmpLicense); } Date today = Calendar.getInstance().getTime(); if (newLicense.expires().before(today)) { return constructFailureResponse(vt, "Failed to update the license because new license is expired", tmpLicense); <START> } <END> LicenseApi currentLicense = VoltDB.instance().getLicenseApi(); String error = MiscUtils.isLicenseChangeAllowed(newLicense, currentLicense); if (error != null) { return constructFailureResponse(vt, error, tmpLicense); } vt.addRow(VoltSystemProcedure.STATUS_OK, ""); return vt; }</code><technical_language>easily include actual expiration date</technical_language>

Target:
public VoltTable run(byte[] licenseBytes) { VoltTable vt = constructResultTable(); File tmpLicense = new File(VoltDB.instance().getVoltDBRootPath(), tmpFileName); try { Files.write(licenseBytes, tmpLicense); } catch (IOException e) { return constructFailureResponse(vt, "Failed to write the new license to disk: " + e.getMessage(), null); } LicenseApi newLicense = MiscUtils.createLicenseApi(tmpLicense.getAbsolutePath()); if (newLicense == null) { return constructFailureResponse(vt, "Invalid license format", tmpLicense); } Date today = Calendar.getInstance().getTime(); if (newLicense.expires().before(today)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return constructFailureResponse(vt, "Failed to update the license because new license expires at " + sdf.format(newLicense.expires().getTime()), tmpLicense); } LicenseApi currentLicense = VoltDB.instance().getLicenseApi(); String error = MiscUtils.isLicenseChangeAllowed(newLicense, currentLicense); if (error != null) { return constructFailureResponse(vt, error, tmpLicense); } vt.addRow(VoltSystemProcedure.STATUS_OK, ""); return vt; }
Source:
<code><START> private ActionReturnValue attachToClusters(List<NetworkCluster> networkAttachments) { networkAttachments.forEach(networkCluster -> networkCluster.setNetworkId(getNetwork().getId())); return runInternalAction(ActionType.ManageNetworkClusters, new ManageNetworkClustersParameters(networkAttachments)); } <END></code><technical_language>private ActionReturnValue attachToClusters(List<NetworkCluster> networkAttachments) { networkAttachments.forEach(networkCluster -> networkCluster.setNetworkId(getNetwork().getId())); return runInternalAction(ActionType.ManageNetworkClusters, new ManageNetworkClustersParameters(networkAttachments), getContext().clone().withoutLock()); }</technical_language>

Target:
private ActionReturnValue attachToClusters(List<NetworkCluster> networkAttachments) { networkAttachments.forEach(networkCluster -> networkCluster.setNetworkId(getNetwork().getId())); return runInternalAction(ActionType.ManageNetworkClusters, new ManageNetworkClustersParameters(networkAttachments), getContext().clone().withoutLock()); }
Source:
<code>public SnapshotImpl saveSnapshot(String namespace, String workspaceId, String machineId) throws ServerException, ConflictException, NotFoundException { EnvironmentHolder environmentHolder; try (StripedLocks.ReadLock lock = stripedLocks.acquireReadLock(workspaceId)) { environmentHolder = environments.get(workspaceId); if (environmentHolder == null || environmentHolder.status != EnvStatus.RUNNING) { throw new ConflictException(format("Environment '%s' is not running", workspaceId)); } } for (Instance machine : environmentHolder.machines) { if (machine.getId().equals(machineId)) { <START> final SnapshotImpl snapshot = SnapshotImpl.builder() <END> .generateId() .setType(machine.getConfig().getType()) .setNamespace(namespace) .setWorkspaceId(machine.getWorkspaceId()) .setDescription(machine.getEnvName()) .setDev(machine.getConfig().isDev()) .setEnvName(machine.getEnvName()) .setMachineName(machine.getConfig().getName()) .useCurrentCreationDate() .build(); try { MachineSource machineSource = machine.saveToSnapshot(); snapshot.setMachineSource(machineSource); return snapshot; } catch (ServerException e) { try { machine.getLogger().writeLine("Snapshot storing failed. " + e.getLocalizedMessage()); } catch (IOException ignore) { } throw e; } } } throw new NotFoundException(format("Machine with id '%s' is not found in environment of workspace '%s'", machineId, workspaceId)); }</code><technical_language>snapshot object created in lock, while saved out of it</technical_language>

Target:
public SnapshotImpl saveSnapshot(String namespace, String workspaceId, String machineId) throws ServerException, NotFoundException { EnvironmentHolder environmentHolder; SnapshotImpl snapshot = null; Instance instance = null; try (StripedLocks.ReadLock lock = stripedLocks.acquireReadLock(workspaceId)) { environmentHolder = environments.get(workspaceId); if (environmentHolder == null || environmentHolder.status != EnvStatus.RUNNING) { throw new EnvironmentNotRunningException(format("Environment '%s' is not running", workspaceId)); } for (Instance machine : environmentHolder.machines) { if (machine.getId().equals(machineId)) { instance = machine; snapshot = SnapshotImpl.builder() .generateId() .setType(machine.getConfig().getType()) .setNamespace(namespace) .setWorkspaceId(machine.getWorkspaceId()) .setDescription(machine.getEnvName()) .setDev(machine.getConfig().isDev()) .setEnvName(machine.getEnvName()) .setMachineName(machine.getConfig().getName()) .useCurrentCreationDate() .build(); } } } if (instance == null) { throw new NotFoundException(format("Machine with id '%s' is not found in environment of workspace '%s'", machineId, workspaceId)); } try { MachineSource machineSource = instance.saveToSnapshot(); snapshot.setMachineSource(machineSource); return snapshot; } catch (ServerException e) { try { instance.getLogger().writeLine("Snapshot storing failed. " + e.getLocalizedMessage()); } catch (IOException ignore) { } throw e; } }
Source:
<code>public void setEnvironment() throws Exception { super.init(); apimTestCaseUtils.loadResource <START> ("/artifacts/AM/synapseconfigs/property/duplicate_transfer_encoding.xml"); <END> int port = 9785; String expectedResponse = "HTTP/1.0 200 OK\r\nServer: testServer\r\n" + "Content-Type: text/html\r\n" + "Transfer-Encoding: chunked\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + "<HTML>\n" + "<!DOCTYPE HTML PUBLIC " + "\"- "<HEAD>\n" + " <TITLE>Test Server Results</TITLE>\n" + "</HEAD>\n" + "\n" + "<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1 ALIGN=\"CENTER\"> Results</H1>\n" + "Here is the request line and request headers\n" + "sent by your browser:\n" + "<PRE>"; simpleSocketServer = new SimpleSocketServer(port, expectedResponse); simpleSocketServer.start(); Thread.sleep(10000); }</code><technical_language>a File exception due this file. added file. Please update pull request it</technical_language>

Target:
public void setEnvironment() throws Exception { super.init(); AuthenticatorClient login = new AuthenticatorClient(gatewayContext.getContextUrls().getBackEndUrl()); String session = login.login("admin", "admin", "localhost"); String file = "artifacts" + File.separator + "AM" + File.separator + "synapseconfigs" + File.separator + "property" + File.separator + "duplicate_transfer_encoding.xml"; OMElement synapseConfig = apimTestCaseUtils.loadResource(file); apimTestCaseUtils.updateSynapseConfiguration(synapseConfig, gatewayContext.getContextUrls().getBackEndUrl(), session); int port = 9785; String expectedResponse = "HTTP/1.0 200 OK\r\nServer: testServer\r\n" + "Content-Type: text/html\r\n" + "Transfer-Encoding: chunked\r\n" + "Transfer-Encoding: chunked\r\n" + "\r\n" + "<HTML>\n" + "<!DOCTYPE HTML PUBLIC " + "\"- "<HEAD>\n" + " <TITLE>Test Server Results</TITLE>\n" + "</HEAD>\n" + "\n" + "<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1 ALIGN=\"CENTER\"> Results</H1>\n" + "Here is the request line and request headers\n" + "sent by your browser:\n" + "<PRE>"; simpleSocketServer = new SimpleSocketServer(port, expectedResponse); simpleSocketServer.start(); Thread.sleep(10000); }
Source:
<code>public DataNode<ProjectData> resolveProjectInfo( @NotNull ExternalSystemTaskId id, @NotNull String projectPath, boolean isPreviewMode, @Nullable PantsExecutionSettings settings, @NotNull ExternalSystemTaskNotificationListener listener ) throws ExternalSystemException, IllegalArgumentException, IllegalStateException { if (projectPath.startsWith(".pants.d")) { return null; } checkForDifferentPantsExecutables(id, projectPath); final PantsCompileOptionsExecutor executor = PantsCompileOptionsExecutor.create(projectPath, settings); task2executor.put(id, executor); final DataNode<ProjectData> projectDataNode = resolveProjectInfoImpl(id, executor, listener, isPreviewMode, settings.isEnableIncrementalImport()); <START> if (!settings.isImportSourceDepsAsJars()) { <END> doViewSwitch(id, projectPath); } task2executor.remove(id); return projectDataNode; }</code><technical_language>(From anecdotal evidence, a grain of salt) users talked improved "Project" view "Import Source Deps Jars" brings, prefer "Project File Tree" view default, allows search for files excluded more easily</technical_language>

Target:
public DataNode<ProjectData> resolveProjectInfo( @NotNull ExternalSystemTaskId id, @NotNull String projectPath, boolean isPreviewMode, @Nullable PantsExecutionSettings settings, @NotNull ExternalSystemTaskNotificationListener listener ) throws ExternalSystemException, IllegalArgumentException, IllegalStateException { if (projectPath.startsWith(".pants.d")) { return null; } checkForDifferentPantsExecutables(id, projectPath); final PantsCompileOptionsExecutor executor = PantsCompileOptionsExecutor.create(projectPath, settings); task2executor.put(id, executor); final DataNode<ProjectData> projectDataNode = resolveProjectInfoImpl(id, executor, listener, isPreviewMode, settings.isEnableIncrementalImport()); doViewSwitch(id, projectPath); task2executor.remove(id); return projectDataNode; }
Source:
<code>private void handleQosDataCenterLinks(Map<Guid, List<Qos>> qosMap) { if (!qosMap.isEmpty()) { List<StorageQos> list = getBackendCollection( StorageQos.class, QueryType.GetAllQosByType, new QosQueryParameterBase(null, QosType.STORAGE)); for (StorageQos storageQos : list) { List<Qos> qosList = qosMap.get(storageQos.getId()); if (qosList != null) { DataCenter dc = new DataCenter(); <START> for (Qos qos : qosList) { <END> qos.setDataCenter(dc); qos.getDataCenter().setId(storageQos.getStoragePoolId().toString()); } } } } }</code><technical_language>Please set DataCenter ID loop. dc.setId(storageQos.getStoragePoolId().toString())</technical_language>

Target:
private void handleQosDataCenterLinks(Map<Guid, List<Qos>> qosMap) { if (!qosMap.isEmpty()) { List<StorageQos> list = getBackendCollection( StorageQos.class, QueryType.GetAllQosByType, new QosQueryParameterBase(null, QosType.STORAGE)); for (StorageQos storageQos : list) { List<Qos> qosList = qosMap.get(storageQos.getId()); if (qosList != null) { DataCenter dc = new DataCenter(); dc.setId(storageQos.getStoragePoolId().toString()); for (Qos qos : qosList) { qos.setDataCenter(dc); } } } } }
Source:
<code>protected boolean classpathContainerContains(IJavaProject project, String id, String path) throws JavaModelException { try { return getClasspathEntry(project, id, path) != null; } catch (Exception e) { <START> debug("entry was not found", e); <END> return false; } }</code><technical_language>hide this log messages for tests. refactor getClasspathEntry throw exception entry found</technical_language>

Target:
protected boolean classpathContainerContains(IJavaProject project, String id, String path) throws JavaModelException { IClasspathContainer container = JavaCore.getClasspathContainer(new Path(id), project); for (IClasspathEntry entry : container.getClasspathEntries()) { if (entry.getPath().toOSString().contains(path)) { return true; } } return false; }
Source:
<code>void assertThatExperimentInformationIsTransformedIntoSolrInputDocuments(String accession) throws Exception { Experiment experiment = experimentTrader.getPublicExperiment(accession); Iterable<SolrInputDocument> result = getResults(experiment); int count = 0; for (SolrInputDocument solrInputDocument : result) { count++; assertThat(solrInputDocument.size(), greaterThan(6)); assertThat( experiment.getType().name().toUpperCase(), is(solrInputDocument.getField("experiment_type").getValue())); assertThat( experiment.getSpecies().getReferenceName(), is(solrInputDocument.getField("species").getValue())); } <START> assertThat(count, is(greaterThan(100))); <END> }</code><technical_language>I realise this is older bit of code out of scope for this PR this assertion is a bit odd... 100? Also, I get point of count variable. do result.size() instead</technical_language>

Target:
void assertThatExperimentInformationIsTransformedIntoSolrInputDocuments(String accession) throws Exception { Experiment experiment = experimentTrader.getPublicExperiment(accession); Iterable<SolrInputDocument> result = getResults(experiment); int count = 0; for (SolrInputDocument solrInputDocument : result) { count++; assertThat(solrInputDocument.size(), greaterThan(6)); assertThat( experiment.getType().name().toUpperCase(), is(solrInputDocument.getField("experiment_type").getValue())); assertThat( experiment.getSpecies().getReferenceName(), is(solrInputDocument.getField("species").getValue())); } assertThat(count, is(greaterThan(0))); }
Source:
<code>protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (getVm().isDeleteProtected()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DELETE_PROTECTION_ENABLED); } if (!(super.canDoAction() && canRemoveVm())) { return false; } <START> return true; <END> }</code><technical_language>remove code: if (!(.... return false; } return true; simply : return super.canDoAction() && canRemoveVm()</technical_language>

Target:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (getVm().isDeleteProtected()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DELETE_PROTECTION_ENABLED); } return (super.canDoAction() && canRemoveVm()); }
Source:
<code>public CliCommand init(final Arguments args) throws Exception { this.filterParams = args.getFilterParams(); this.bucketName = args.getBucket(); if (Guard.isStringNullOrEmpty(this.bucketName)) { throw new MissingOptionException("The get detailed objects command requires '-b' to be set."); } <START> <END> if (!Guard.isStringNullOrEmpty(args.getPrefix())) { LOG.warn("'-p' prefix is not supported."); } this.prefix = null; return this; }</code><technical_language>Technically -- do want force it</technical_language>

Target:
public CliCommand init(final Arguments args) throws Exception { this.filterParams = args.getFilterParams(); this.bucketName = args.getBucket(); if (!Guard.isStringNullOrEmpty(args.getPrefix())) { LOG.warn("'-p' prefix is not supported."); } this.prefix = null; return this; }
Source:
<code>public List<GatewayTable> getAll(GATEWAY_TYPE gatewayType, NETWORK_TYPE networkType, Boolean enabled) { try { if (gatewayType == null && networkType == null && enabled == null) { return this.getDao().queryForAll(); } QueryBuilder<GatewayTable, Integer> queryBuilder = this.getDao().queryBuilder(); Where<GatewayTable, Integer> where = queryBuilder.where(); where.gt("id", 0); if (enabled != null) { where.and().eq(GatewayTable.KEY_ENABLED, enabled); } if (gatewayType != null) { where.and().eq(GatewayTable.KEY_TYPE, gatewayType); } if (networkType != null) { where.and().eq(GatewayTable.KEY_NETWORK_TYPE, networkType); } queryBuilder.setWhere(where); List<GatewayTable> gateways = this.getDao().query(queryBuilder.prepare()); return gateways; } catch (SQLException ex) { _logger.error("unable to get all gateways:[type:{}, NetworkType:{}, Enabled:{}]", <START> gatewayType != null ? gatewayType.getText() : "no gateway", networkType, enabled, ex); <END> return null; } }</code><technical_language>@Fraid pass null type do gatewayType object. "no gateway" confuse user</technical_language>

Target:
public List<GatewayTable> getAll(GATEWAY_TYPE gatewayType, NETWORK_TYPE networkType, Boolean enabled) { try { if (gatewayType == null && networkType == null && enabled == null) { return this.getDao().queryForAll(); } QueryBuilder<GatewayTable, Integer> queryBuilder = this.getDao().queryBuilder(); Where<GatewayTable, Integer> where = queryBuilder.where(); where.gt("id", 0); if (enabled != null) { where.and().eq(GatewayTable.KEY_ENABLED, enabled); } if (gatewayType != null) { where.and().eq(GatewayTable.KEY_TYPE, gatewayType); } if (networkType != null) { where.and().eq(GatewayTable.KEY_NETWORK_TYPE, networkType); } queryBuilder.setWhere(where); List<GatewayTable> gateways = this.getDao().query(queryBuilder.prepare()); return gateways; } catch (SQLException ex) { _logger.error("unable to get all gateways:[type:{}, NetworkType:{}, Enabled:{}]", gatewayType != null ? gatewayType.getText() : null, networkType, enabled, ex); return null; } }
Source:
<code><START> public BasisFunctionAggregation(final List<Function1D<T, Double>> functions, final double[] weights) { <END> Validate.notEmpty(functions, "no functions"); Validate.notNull(weights, "no weights"); Validate.isTrue(functions.size() == weights.length); _f = functions; _w = weights; }</code><technical_language>weights needs copied construction</technical_language>

Target:
public BasisFunctionAggregation(final List<Function1D<T, Double>> functions, final double[] weights) { Validate.notEmpty(functions, "no functions"); Validate.notNull(weights, "no weights"); Validate.isTrue(functions.size() == weights.length); _f = functions; _w = weights.clone(); }
Source:
<code>public Map<String, Object> toBundleFragment() { Map<String, Object> bundleFragment = new HashMap<>(); bundleFragment.put(Bundleable.KIND, this.getClass().getSimpleName()); bundleFragment.put("name", name); bundleFragment.put("signature", signature.toString()); bundleFragment.put("category", category); bundleFragment.put("documentation", documentation); bundleFragment.put("isConstructor", isConstructor); <START> bundleFragment.put("isCommon", isCommon); <END> return bundleFragment; }</code><technical_language>save name lookup function info catalog</technical_language>

Target:
public Map<String, Object> toBundleFragment() { Map<String, Object> bundleFragment = new HashMap<>(); bundleFragment.put(Bundleable.KIND, this.getClass().getSimpleName()); bundleFragment.put("name", name); return bundleFragment; }
Source:
<code>public void shouldRenderStatisticsPageWithTwoMonitors() { JamonTestUtil.startThisManyMonitors(2); wicketTester.startPage(new JamonAdminPage()); <START> wicketTester.assertRenderedPage(JamonAdminPage.class); <END> }</code><technical_language>is assertion of number of monitors I is need of test methods</technical_language>

Target:
public void shouldRenderStatisticsPageWithTwoMonitors() { JamonTestUtil.startThisManyMonitors(2); wicketTester.startPage(new JamonAdminPage()); wicketTester.assertRenderedPage(JamonAdminPage.class); Assert.assertEquals(2, wicketTester.getTagsByWicketId("linkText").size()); Assert.assertTrue( wicketTester.getTagsByWicketId("linkText").get(0).getValue().equals("mon0")); Assert.assertTrue( wicketTester.getTagsByWicketId("linkText").get(1).getValue().equals("mon1")); }
Source:
<code>public boolean equals(Object o) { if (o instanceof PermissionSubject) { PermissionSubject other = (PermissionSubject) o; <START> return other.objectId.equals(objectId) && <END> other.ObjectType.equals(ObjectType) && other.actionGroup.equals(actionGroup); } return false; }</code><technical_language>pls Objects.equals for comparison</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof PermissionSubject) { PermissionSubject other = (PermissionSubject) o; return Objects.equals(other.objectId, objectId) && Objects.equals(other.ObjectType, ObjectType) && Objects.equals(other.actionGroup, actionGroup); } return false; }
Source:
<code>public SAMRecord next() { if (bufferIndex < buffer.size()) { return buffer.get(bufferIndex++); } else { <START> return this.iterator.next(); <END> } }</code><technical_language>empty buffer this point reduce memory overhead</technical_language>

Target:
public SAMRecord next() { if (bufferIndex < buffer.size()) { return buffer.get(bufferIndex++); } else { buffer.clear(); return this.iterator.next(); } }
Source:
<code>public void test_create_table_with_check_fail_on_insert() { execute("create table t (id integer primary key, qty integer, constraint check_1 check (qty > 0))"); execute("insert into t(id, qty) values(0, null), (1, 1)"); refresh(); execute("select id, qty from t order by id"); <START> assertEquals(2, response.rowCount()); Object [][] rows = response.rows(); assertEquals(0, rows[0][0]); assertNull(rows[0][1]); assertEquals(1, rows[1][0]); assertEquals(1, rows[1][1]); <END> expectedException.expectMessage(containsString("Failed CONSTRAINT check_1 CHECK (\"qty\" > 0) and values")); execute("insert into t(id, qty) values(2, -1)"); }</code><technical_language>printedTable assertions a bit more readable</technical_language>

Target:
public void test_create_table_with_check_fail_on_insert() { execute("create table t (id integer primary key, qty integer, constraint check_1 check (qty > 0))"); execute("insert into t(id, qty) values(0, null), (1, 1)"); refresh(); execute("select id, qty from t order by id"); assertEquals(printedTable(response.rows()), "0| NULL\n" + "1| 1\n"); expectedException.expectMessage(containsString("Failed CONSTRAINT check_1 CHECK (\"qty\" > 0) and values")); execute("insert into t(id, qty) values(2, -1)"); }
Source:
<code>public char[] getPassphrase(byte[] keyFingerprint) throws PGPException { if (passphrase == null) { passphrase = new CharArrayType(JGitText.get().credentialPassphrase, true); } if (credentialsProvider == null) { throw new PGPException(JGitText.get().gpgNoCredentialsProvider); } if (passphrase.getValue() == null && !credentialsProvider <START> .get(createURI(keyFingerprint), passphrase)) { <END> return null; } return passphrase.getValue(); }</code><technical_language>If CredentialsProvider.get() returns false user canceled dialog, this currently ends a NPE, instead this cancel commit command if key requires a passphrase</technical_language>

Target:
public char[] getPassphrase(byte[] keyFingerprint) throws PGPException, CanceledException { if (passphrase == null) { passphrase = new CharArrayType(JGitText.get().credentialPassphrase, true); } if (credentialsProvider == null) { throw new PGPException(JGitText.get().gpgNoCredentialsProvider); } if (passphrase.getValue() == null && !credentialsProvider.get(createURI(keyFingerprint), new InformationalMessage( MessageFormat.format(JGitText.get().gpgKeyInfo, Hex.toHexString(keyFingerprint))), passphrase)) { throw new CanceledException(JGitText.get().gpgSigningCancelled); } return passphrase.getValue(); }
Source:
<code>public Promise<HttpResponse> execute(HttpUriRequest request, HttpContext context) { final SettableFuture<HttpResponse> future = SettableFuture.create(); client.execute(request, context, new ThreadLocalContextAwareFutureCallback<C, HttpResponse>(threadLocalContextManager) { @Override void doCompleted(final HttpResponse httpResponse) { executor.execute( () -> future.set(httpResponse)); <START> log.info( "Closing in doCompleted()" ); <END> closeClient(); } @Override void doFailed(final Exception ex) { executor.execute(() -> future.setException(ex)); log.info( "Closing in doFailed()" ); closeClient(); } @Override void doCancelled() { final TimeoutException timeoutException = new TimeoutException(); executor.execute(() -> future.setException(timeoutException)); log.info( "Closing in doCancelled()" ); closeClient(); } }); return Promises.forListenableFuture(future); }</code><technical_language>log.debug probably? for (or remove altogether)</technical_language>

Target:
public Promise<HttpResponse> execute(HttpUriRequest request, HttpContext context) { final SettableFuture<HttpResponse> future = SettableFuture.create(); Future<org.apache.http.HttpResponse> clientFuture = client.execute(request, context, new ThreadLocalContextAwareFutureCallback<C, HttpResponse>(threadLocalContextManager) { @Override void doCompleted(final HttpResponse httpResponse) { executor.execute( () -> future.set(httpResponse)); log.info( "Closing in doCompleted()" ); closeClient(); } @Override void doFailed(final Exception ex) { executor.execute(() -> future.setException(ex)); log.info( "Closing in doFailed()" ); closeClient(); } @Override void doCancelled() { final TimeoutException timeoutException = new TimeoutException(); executor.execute(() -> future.setException(timeoutException)); log.info( "Closing in doCancelled()" ); closeClient(); } }); return Promises.forFuture(clientFuture,executor); }
Source:
<code>public String toString() { <START> final List<UUID> recipientIds = <END> _recipients.values() .stream() .map(Recipient::getId) .collect(Collectors.toList()); return MoreObjects.toStringHelper(this) .add("id", _id) .add("name", _name) .add("schedule", _schedule) .add("recipients", recipientIds) .add("source.id", _source.getId()) .toString(); }</code><technical_language>Is a reason custom serialize this relying List's toString do it</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("id", _id) .add("name", _name) .add("schedule", _schedule) .add("recipients", _recipients) .add("source", _source) .toString(); }