auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public IResult execute(IProgressListener listener) throws Exception { ExtractedCollectionBase extractor = CollectionExtractionUtils.extractCollection(list); if (extractor != null && extractor.hasExtractableContents()) { return new ObjectListResult.Outbound(snapshot, extractor.extractEntryIds()); } else { throw new IllegalArgumentException(MessageUtil.format(Messages.ExtractListValuesQuery_NotAWellKnownList, list .getDisplayName())); } }

Target:
public IResult execute(IProgressListener listener) throws Exception { AbstractExtractedCollection extractor = CollectionExtractionUtils.extractCollection(list); if (extractor != null && extractor.hasExtractableContents()) { return new ObjectListResult.Outbound(snapshot, extractor.extractEntryIds()); } else { throw new IllegalArgumentException(MessageUtil.format(Messages.ExtractListValuesQuery_NotAWellKnownList, list.getDisplayName())); } }
Source:
public void acquireTask(DatastreamTaskImpl task, long timeoutMs) throws DatastreamException { String lockPath = KeyBuilder.datastreamTaskLock(_cluster, task.getConnectorType(), task.getDatastreamTaskName()); String owner = null; if (_zkclient.exists(lockPath)) { owner = _zkclient.ensureReadData(lockPath); if (owner.equals(_instanceName)) { _log.info(String.format("%s already owns the lock on %s", _instanceName, task)); return; } CountDownLatch busyLatch = new CountDownLatch(1); String lockNode = lockPath.substring(lockPath.lastIndexOf('/') + 1); String taskPath = KeyBuilder.connectorTask(_cluster, task.getConnectorType(), task.getDatastreamTaskName()); if (_zkclient.exists(lockPath)) { IZkChildListener listener = (parentPath, currentChilds) -> { if (!currentChilds.contains(lockNode)) { busyLatch.countDown(); } }; try { _zkclient.subscribeChildChanges(taskPath, listener); busyLatch.await(timeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { _log.warn("Unexpectedly interrupted during task acquire.", e); } finally { _zkclient.unsubscribeChildChanges(taskPath, listener); } } } if (!_zkclient.exists(lockPath)) { _zkclient.createEphemeral(lockPath, _instanceName); _log.info(String.format("%s successfully acquired the lock on %s", _instanceName, task)); } else { String msg = String.format("%s failed to acquire task %s in %dms, current owner: %s", _instanceName, task, timeoutMs, owner); ErrorLogger.logAndThrowDatastreamRuntimeException(_log, msg, null); } }

Target:
public void acquireTask(DatastreamTaskImpl task, long timeoutMs) throws DatastreamException { String lockPath = KeyBuilder.datastreamTaskLock(_cluster, task.getConnectorType(), task.getDatastreamTaskName()); String owner = null; if (_zkclient.exists(lockPath)) { owner = _zkclient.ensureReadData(lockPath); if (owner.equals(_instanceName)) { _log.info(String.format("%s already owns the lock on %s", _instanceName, task)); return; } waitForTaskRelease(task, timeoutMs, lockPath); } if (!_zkclient.exists(lockPath)) { _zkclient.createEphemeral(lockPath, _instanceName); _log.info(String.format("%s successfully acquired the lock on %s", _instanceName, task)); } else { String msg = String.format("%s failed to acquire task %s in %dms, current owner: %s", _instanceName, task, timeoutMs, owner); ErrorLogger.logAndThrowDatastreamRuntimeException(_log, msg, null); } }
Source:
static boolean isImmutable(List<Object> extra) { if (extra == Collections.emptyList()) return true; String simpleName = extra.getClass().getSimpleName(); return simpleName.startsWith("Unmodifiable") || simpleName.contains("Immutable"); }

Target:
static boolean isImmutable(List<Object> extra) { assert extra.size() > 1; String simpleName = extra.getClass().getSimpleName(); return simpleName.startsWith("Unmodifiable") || simpleName.contains("Immutable"); }
Source:
protected void beforeLogin(LoginModel loginModel) { CommonModelManager.init(eventBus); }

Target:
protected void beforeLogin(LoginModel loginModel) { CommonModelManager.init(eventBus); ModelInitializedEvent.fire(eventBus); }
Source:
public LayoutInflater onGetLayoutInflater(@Nullable Bundle savedInstanceState) { LayoutInflater layoutInflater = super.onGetLayoutInflater(savedInstanceState); if (!mShowsDialog || mCreatingDialog) { if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) { String message = "getting layout inflater for DialogFragment " + this; if (!mShowsDialog) { Log.d(TAG, "mShowsDialog = false: " + message); } else { Log.d(TAG, "mCreatingDialog = true: " + message); } } return layoutInflater; } prepareDialog(savedInstanceState); if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) { Log.d(TAG, "get layout inflater for DialogFragment " + this + " from dialog context"); } if (mDialog != null) { layoutInflater = layoutInflater.cloneInContext(requireDialog().getContext()); } return layoutInflater; }

Target:
public LayoutInflater onGetLayoutInflater(@Nullable Bundle savedInstanceState) { LayoutInflater layoutInflater = super.onGetLayoutInflater(savedInstanceState); if (!mShowsDialog || mCreatingDialog) { if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) { String message = "getting layout inflater for DialogFragment " + this; if (!mShowsDialog) { Log.d(TAG, "mShowsDialog = false: " + message); } else { Log.d(TAG, "mCreatingDialog = true: " + message); } } return layoutInflater; } prepareDialog(savedInstanceState); if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) { Log.d(TAG, "get layout inflater for DialogFragment " + this + " from dialog context"); } if (mDialog != null) { layoutInflater = layoutInflater.cloneInContext(mDialog.getContext()); } return layoutInflater; }
Source:
public void idle() { if (lastSendInterval++ >= sendIntervals) { lastSendInterval = 0; Iterator<DispatchAttempt> iterator = sendQueue.iterator(); while (iterator.hasNext()) { DispatchAttempt attempt = iterator.next(); try { EventMessageContent message = new EventMessageContent(); message.prepareMessage(hostName, attempt.event, isBodyHtml); log.info("Send email to [{}]\n subject:\n [{}]", attempt.address, message.getMessageSubject()); if (log.isDebugEnabled()) { log.debug("body:\n [{}]", message.getMessageBody()); } sendMail(attempt.address, message.getMessageSubject(), message.getMessageBody()); notifyObservers(DispatchResult.success(attempt.event, attempt.address, EventNotificationMethod.SMTP)); iterator.remove(); } catch (Exception ex) { attempt.retries++; if (attempt.retries >= retries) { notifyObservers(DispatchResult.failure(attempt.event, attempt.address, EventNotificationMethod.SMTP, ex.getMessage())); iterator.remove(); } } } } }

Target:
public void idle() { if (lastSendInterval++ >= sendIntervals) { lastSendInterval = 0; Iterator<DispatchAttempt> iterator = sendQueue.iterator(); while (iterator.hasNext()) { DispatchAttempt attempt = iterator.next(); try { EventMessageContent message = new EventMessageContent(); message.prepareMessage(hostName, attempt.event, isBodyHtml); log.info("Send mail subject='{}' to='{}'", message.getMessageSubject(), attempt.address); log.debug("Send mail body='{}'", message.getMessageBody()); sendMail(attempt.address, message.getMessageSubject(), message.getMessageBody()); notifyObservers(DispatchResult.success(attempt.event, attempt.address, EventNotificationMethod.SMTP)); iterator.remove(); } catch (Exception ex) { attempt.retries++; if (attempt.retries >= retries) { notifyObservers(DispatchResult.failure(attempt.event, attempt.address, EventNotificationMethod.SMTP, ex.getMessage())); iterator.remove(); } } } } }
Source:
protected ResourceMetadata(Resource resource, ResourceResource self, boolean isDir) { if (!"".equals(resource.path())) { parent = new ResourceReference("/" + resource.parent().path(), new AtomLink(self.href(resource.parent().path(), true), "alternate", self.getFormatGet(false).getMediaType().getName())); } lastModified = new Date(resource.lastmodified()); type = isDir ? null : resource.getType().toString().toLowerCase(); name = resource.name(); }

Target:
protected ResourceMetadata(Resource resource, ResourceResource self, boolean isDir) { if (!resource.path().isEmpty()) { parent = new ResourceReference("/" + resource.parent().path(), new AtomLink(self.href(resource.parent().path(), true), "alternate", self.getFormatGet(false).getMediaType().getName())); } lastModified = new Date(resource.lastmodified()); type = isDir ? null : resource.getType().toString().toLowerCase(); name = resource.name(); }
Source:
public long getEntityOwnerId() { VMSnapshot vmsnapshot = _entityMgr.findById(VMSnapshot.class, getVMSnapshotId()); if (vmsnapshot == null) { throw new InvalidParameterValueException("Unable to find vmsnapshot by id=" + getVMSnapshotId()); } Account account = _accountService.getAccount(vmsnapshot.getAccountId()); if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) { Project project = _projectService.findByProjectAccountId(vmsnapshot.getAccountId()); if (project.getState() != Project.State.Active) { throw new PermissionDeniedException("Can't add resources to the project id=" + project.getId() + " in state=" + project.getState() + " as it's no longer active"); } } else if (account.getState() == Account.State.disabled) { throw new PermissionDeniedException("The owner of template is disabled: " + account); } return vmsnapshot.getAccountId(); }

Target:
public long getEntityOwnerId() { VMSnapshot vmsnapshot = _entityMgr.findById(VMSnapshot.class, getVMSnapshotId()); if (vmsnapshot == null) { throw new InvalidParameterValueException("Unable to find vmsnapshot by id=" + getVMSnapshotId()); } Account account = _accountService.getAccount(vmsnapshot.getAccountId()); if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) { Project project = _projectService.findByProjectAccountId(vmsnapshot.getAccountId()); if (project == null) { throw new InvalidParameterValueException("Unable to find project by account id=" + account.getUuid()); } if (project.getState() != Project.State.Active) { throw new PermissionDeniedException("Can't add resources to the project id=" + project.getUuid() + " in state=" + project.getState() + " as it's no longer active"); } } else if (account.getState() == Account.State.disabled) { throw new PermissionDeniedException("The owner of template is disabled: " + account); } return vmsnapshot.getAccountId(); }
Source:
protected void populateBlocks() { long blockID = 1000; for (int i = 0; i < FILE_CONTENTS.length; i++) { int blockIndex = 1; AbstractFileSplitter.FileMetadata fileMetadata = new AbstractFileSplitter.FileMetadata(outputPath); fileMetadata.setRelativePath("file" + i); int noOfBlocks = (int)((FILE_CONTENTS[i].length() / BLOCK_SIZE) + (((FILE_CONTENTS[i].length() % BLOCK_SIZE) == 0) ? 0 : 1)); long[] blockIds = new long[noOfBlocks]; for (int offset = 0; offset < FILE_CONTENTS[i].length(); offset += BLOCK_SIZE, blockID++) { String blockContents; if (offset + BLOCK_SIZE < FILE_CONTENTS[i].length()) { blockContents = FILE_CONTENTS[i].substring(offset, offset + BLOCK_SIZE); } else { blockContents = FILE_CONTENTS[i].substring(offset); } AbstractBlockReader.ReaderRecord<Slice> readerRecord = new AbstractBlockReader.ReaderRecord<Slice>(blockID, new Slice(blockContents.getBytes())); blockIds[blockIndex - 1] = blockID; blockIndex++; blockIdToExpectedContent.put(blockID, blockContents); blockDataList.add(readerRecord); } fileMetadata.setBlockIds(blockIds); fileMetadata.setNumberOfBlocks(noOfBlocks); fileMetadatas.add(fileMetadata); } }

Target:
protected void populateBlocks() { long blockId = 1000; for (int i = 0; i < FILE_CONTENTS.length; i++) { int blockIndex = 0; List<AbstractBlockReader.ReaderRecord<Slice>> blockList = new ArrayList<>(); AbstractFileSplitter.FileMetadata fileMetadata = new AbstractFileSplitter.FileMetadata(outputPath); fileMetadata.setRelativePath(FILE_NAME + i); String fileContents = FILE_CONTENTS[i]; int fileLength = fileContents.length(); int noOfBlocks = ((fileLength / BLOCK_SIZE) + (((fileLength % BLOCK_SIZE) == 0) ? 0 : 1)); long[] blockIds = new long[noOfBlocks]; for (int offset = 0; offset < fileLength; offset += BLOCK_SIZE, blockId++) { String blockContents; if (offset + BLOCK_SIZE < fileLength) { blockContents = fileContents.substring(offset, offset + BLOCK_SIZE); } else { blockContents = fileContents.substring(offset); } AbstractBlockReader.ReaderRecord<Slice> readerRecord = new AbstractBlockReader.ReaderRecord<Slice>(blockId, new Slice(blockContents.getBytes())); blockIds[blockIndex] = blockId; blockIndex++; blockIdToExpectedContent.put(blockId, blockContents); blockList.add(readerRecord); } blockDataList.add(blockList); fileMetadata.setBlockIds(blockIds); fileMetadata.setNumberOfBlocks(noOfBlocks); fileMetadatas.add(fileMetadata); } }
Source:
public List<VendorDetail> getVendors(List<String> vendorNumbers) throws BadRequestException { Criteria criteria = new Criteria(); for (String vendorNumber : vendorNumbers) { Criteria criteriaVendorPk = new Criteria(); criteriaVendorPk.addEqualTo(CUPurapConstants.Einvoice.VENDOR_GENERATED_HEADER_ID, getVendorHeaderId(vendorNumber)); criteriaVendorPk.addEqualTo(CUPurapConstants.Einvoice.VENDOR_DETAIL_ASSIGNED_ID, getVendorDetailId(vendorNumber)); criteria.addOrCriteria(criteriaVendorPk); } Query query = QueryFactory.newQuery(VendorDetail.class, criteria); return (List<VendorDetail>) getPersistenceBrokerTemplate().getCollectionByQuery(query); }

Target:
public List<VendorDetail> getVendors(List<String> vendorNumbers) throws BadRequestException { HashMap<Integer, List<Integer>> vendorDetailToHeaderMap = buildVendorDetailMap(vendorNumbers); Criteria criteria = buildQueryCriteria(vendorDetailToHeaderMap); Query query = QueryFactory.newQuery(VendorDetail.class, criteria); return (List<VendorDetail>) getPersistenceBrokerTemplate().getCollectionByQuery(query); }
Source:
DebugMenu(final TripleAFrame frame) { super("Debug"); setMnemonic(KeyEvent.VK_D); final Set<Player> players = frame.getLocalPlayers().getLocalPlayers(); final boolean areThereProAIs = players.stream().anyMatch(AbstractProAi.class::isInstance); if (areThereProAIs) { AbstractProAi.initialize(frame); add(SwingAction.of("Show Hard AI Logs", AbstractProAi::showSettingsWindow)) .setMnemonic(KeyEvent.VK_X); } players.stream() .filter(PlayerDebug.class::isInstance) .forEach( player -> { final JMenu playerDebugMenu = new JMenu(player.getName()); add(playerDebugMenu); ((PlayerDebug) player).addDebugMenuItems(frame, playerDebugMenu::add); }); add(SwingAction.of("Show Console", () -> ClientSetting.showConsole.setValueAndFlush(true))) .setMnemonic(KeyEvent.VK_C); }

Target:
DebugMenu(final TripleAFrame frame) { super("Debug"); setMnemonic(KeyEvent.VK_D); menuItemsAndFactories.forEach( (name, factory) -> { final JMenu playerDebugMenu = new JMenu(name); add(playerDebugMenu); factory.apply(frame).forEach(playerDebugMenu::add); }); }
Source:
public void testTargetsCanAddExecutionPlatformConstraints_notEnabled() throws Exception { StarlarkSemantics semantics = StarlarkSemantics.DEFAULT_SEMANTICS.toBuilder() .incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(false) .build(); ev = createEvaluationTestCase(semantics); ev.initialize(); scratch.file("test/BUILD", "toolchain_type(name = 'my_toolchain_type')"); evalAndExport( "def impl():", " return 0", "r1 = rule(impl, ", " toolchains=[' " execution_platform_constraints_allowed=False,", ")"); RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); assertThat(c.executionPlatformConstraintsAllowed()) .isEqualTo(ExecutionPlatformConstraintsAllowed.PER_RULE); }

Target:
public void testTargetsCanAddExecutionPlatformConstraints_notEnabled() throws Exception { StarlarkSemantics semantics = StarlarkSemantics.DEFAULT_SEMANTICS.toBuilder() .incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(false) .build(); ev = createEvaluationTestCase(semantics); ev.initialize(); registerDummyUserDefinedFunction(); scratch.file("test/BUILD", "toolchain_type(name = 'my_toolchain_type')"); evalAndExport( "r1 = rule(impl, ", " toolchains=[' " execution_platform_constraints_allowed=False,", ")"); RuleClass c = ((SkylarkRuleFunction) lookup("r1")).getRuleClass(); assertThat(c.executionPlatformConstraintsAllowed()) .isEqualTo(ExecutionPlatformConstraintsAllowed.PER_RULE); }
Source:
public Point2D inverseTransform(VisualizationServer<N, E> vv, Point2D p) { MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer(); MutableTransformer viewTransformer = multiLayerTransformer.getTransformer(Layer.VIEW); MutableTransformer layoutTransformer = multiLayerTransformer.getTransformer(Layer.LAYOUT); if (viewTransformer instanceof LensTransformer) { LensTransformer lensTransformer = (LensTransformer) viewTransformer; MutableTransformer delegateTransformer = lensTransformer.getDelegate(); if (viewTransformer instanceof MagnifyShapeTransformer) { MagnifyTransformer ht = new MagnifyTransformer(lensTransformer.getLens(), layoutTransformer); p = delegateTransformer.inverseTransform(p); p = ht.inverseTransform(p); } else if (viewTransformer instanceof HyperbolicShapeTransformer) { HyperbolicTransformer ht = new HyperbolicTransformer(lensTransformer.getLens(), layoutTransformer); p = delegateTransformer.inverseTransform(p); p = ht.inverseTransform(p); } } else if (layoutTransformer instanceof LensTransformer) { p = multiLayerTransformer.inverseTransform(p); } else { p = multiLayerTransformer.inverseTransform(p); } return p; }

Target:
public Point2D inverseTransform(VisualizationServer<N, E> vv, Point2D p) { MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer(); MutableTransformer viewTransformer = multiLayerTransformer.getTransformer(Layer.VIEW); MutableTransformer layoutTransformer = multiLayerTransformer.getTransformer(Layer.LAYOUT); if (viewTransformer instanceof LensTransformer) { LensTransformer lensTransformer = (LensTransformer) viewTransformer; MutableTransformer delegateTransformer = lensTransformer.getDelegate(); if (viewTransformer instanceof MagnifyShapeTransformer) { MagnifyTransformer ht = new MagnifyTransformer(lensTransformer.getLens(), layoutTransformer); p = delegateTransformer.inverseTransform(p); p = ht.inverseTransform(p); } else if (viewTransformer instanceof HyperbolicShapeTransformer) { HyperbolicTransformer ht = new HyperbolicTransformer(lensTransformer.getLens(), layoutTransformer); p = delegateTransformer.inverseTransform(p); p = ht.inverseTransform(p); } } else { p = multiLayerTransformer.inverseTransform(p); } return p; }
Source:
private void logRenamedEntity() { try { if (this instanceof RenamedEntityInfoProvider) { String oldEntityName; String newEntityName; RenamedEntityInfoProvider renameable = (RenamedEntityInfoProvider) this; String entityType = renameable.getEntityType(); oldEntityName = renameable.getEntityOldName(); newEntityName = renameable.getEntityNewName(); if (!oldEntityName.equals(newEntityName)) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("EntityType", entityType); logable.AddCustomValue("OldEntityName", oldEntityName); logable.AddCustomValue("NewEntityName", newEntityName); renameable.setEntityId(logable); AuditLogDirector.log(logable, AuditLogType.ENTITY_RENAMED); } } } catch (Exception e) { log.error(e.getMessage()); log.debug("Failed to log entity rename operation.", e); } }

Target:
private void logRenamedEntity() { try { if (this instanceof RenamedEntityInfoProvider) { RenamedEntityInfoProvider renameable = (RenamedEntityInfoProvider) this; String entityType = renameable.getEntityType(); String oldEntityName = renameable.getEntityOldName(); String newEntityName = renameable.getEntityNewName(); if (!oldEntityName.equals(newEntityName)) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("EntityType", entityType); logable.AddCustomValue("OldEntityName", oldEntityName); logable.AddCustomValue("NewEntityName", newEntityName); renameable.setEntityId(logable); AuditLogDirector.log(logable, AuditLogType.ENTITY_RENAMED); } } } catch (Exception e) { log.error(e.getMessage()); log.debug("Failed to log entity rename operation.", e); } }
Source:
private PlanNode rewriteToDefaultAggregation(ApplyNode parent, Context context) { Symbol count = context.getSymbolAllocator().newSymbol(COUNT, BIGINT); Symbol exists = getOnlyElement(parent.getSubqueryAssignments().getSymbols()); return new LateralJoinNode( parent.getId(), parent.getInput(), new ProjectNode( context.getIdAllocator().getNextId(), new AggregationNode( context.getIdAllocator().getNextId(), parent.getSubquery(), ImmutableMap.of(count, new Aggregation( functionManager.lookupFunction(COUNT, ImmutableList.of()), ImmutableList.of(), Optional.empty(), Optional.empty(), false, Optional.empty())), globalAggregation(), ImmutableList.of(), AggregationNode.Step.SINGLE, Optional.empty(), Optional.empty()), Assignments.of(exists, new ComparisonExpression(GREATER_THAN, count.toSymbolReference(), new Cast(new LongLiteral("0"), BIGINT.toString())))), parent.getCorrelation(), INNER, parent.getOriginSubqueryError()); }

Target:
private PlanNode rewriteToDefaultAggregation(ApplyNode parent, Context context) { VariableReferenceExpression count = context.getSymbolAllocator().newVariable("count", BIGINT); VariableReferenceExpression exists = getOnlyElement(parent.getSubqueryAssignments().getVariables()); return new LateralJoinNode( parent.getId(), parent.getInput(), new ProjectNode( context.getIdAllocator().getNextId(), new AggregationNode( context.getIdAllocator().getNextId(), parent.getSubquery(), ImmutableMap.of(count, new Aggregation( new CallExpression( "count", functionResolution.countFunction(), BIGINT, ImmutableList.of()), Optional.empty(), Optional.empty(), false, Optional.empty())), globalAggregation(), ImmutableList.of(), AggregationNode.Step.SINGLE, Optional.empty(), Optional.empty()), Assignments.of(exists, new ComparisonExpression(GREATER_THAN, asSymbolReference(count), new Cast(new LongLiteral("0"), BIGINT.toString())))), parent.getCorrelation(), INNER, parent.getOriginSubqueryError()); }
Source:
protected boolean validateCanResizeDisk() { DiskImage newDiskImage = (DiskImage) getNewDisk(); DiskImage oldDiskImage = (DiskImage) getOldDisk(); if (newDiskImage.getSize() != oldDiskImage.getSize()) { if (Boolean.TRUE.equals(getVmDeviceForVm().getIsReadOnly())) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_READ_ONLY_DISK); } if (vmDeviceForVm.getSnapshotId() != null) { DiskImage snapshotDisk = getDiskImageDao().getDiskSnapshotForVmSnapshot(getParameters().getDiskId(), vmDeviceForVm.getSnapshotId()); if (snapshotDisk.getSize() != newDiskImage.getSize()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_DISK_SNAPSHOT); } } if (oldDiskImage.getSize() > newDiskImage.getSize()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_REQUESTED_DISK_SIZE_IS_TOO_SMALL); } for (VM vm : getVmsDiskPluggedTo()) { if (!VdcActionUtils.canExecute(Collections.singletonList(vm), VM.class, VdcActionType.ExtendImageSize)) { return failVmStatusIllegal(); } } StorageDomainValidator storageDomainValidator = getStorageDomainValidator((DiskImage) getNewDisk()); if (!validate(storageDomainValidator.isDomainExistAndActive())) { return false; } long additionalDiskSpaceInGB = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); DiskImage dummyForValidation = DiskImage.copyOf(newDiskImage); dummyForValidation.setSizeInGigabytes(additionalDiskSpaceInGB); return validate(storageDomainValidator.hasSpaceForNewDisk(dummyForValidation)); } return true; }

Target:
protected boolean validateCanResizeDisk() { DiskImage newDiskImage = (DiskImage) getNewDisk(); DiskImage oldDiskImage = (DiskImage) getOldDisk(); if (newDiskImage.getSize() != oldDiskImage.getSize()) { if (Boolean.TRUE.equals(getVmDeviceForVm().getIsReadOnly())) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_READ_ONLY_DISK); } if (vmDeviceForVm.getSnapshotId() != null) { DiskImage snapshotDisk = getDiskImageDao().getDiskSnapshotForVmSnapshot(getParameters().getDiskId(), vmDeviceForVm.getSnapshotId()); if (snapshotDisk.getSize() != newDiskImage.getSize()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_CANNOT_RESIZE_DISK_SNAPSHOT); } } if (oldDiskImage.getSize() > newDiskImage.getSize()) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_REQUESTED_DISK_SIZE_IS_TOO_SMALL); } for (VM vm : getVmsDiskPluggedTo()) { if (!VdcActionUtils.canExecute(Collections.singletonList(vm), VM.class, VdcActionType.ExtendImageSize)) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(vm.getStatus())); } } StorageDomainValidator storageDomainValidator = getStorageDomainValidator((DiskImage) getNewDisk()); if (!validate(storageDomainValidator.isDomainExistAndActive())) { return false; } long additionalDiskSpaceInGB = newDiskImage.getSizeInGigabytes() - oldDiskImage.getSizeInGigabytes(); DiskImage dummyForValidation = DiskImage.copyOf(newDiskImage); dummyForValidation.setSizeInGigabytes(additionalDiskSpaceInGB); return validate(storageDomainValidator.hasSpaceForNewDisk(dummyForValidation)); } return true; }
Source:
public Button getDuplicateButton() { return duplicateButton; }

Target:
protected Button getDuplicateButton() { return duplicateButton; }
Source:
public ZKClientConfig getClientConfig() { if (clientConfig == null) { clientConfig = new ZKClientConfig(); } return clientConfig; }

Target:
public ZKClientConfig getClientConfig() { return clientConfig; }
Source:
public static void testGetViewport() { final boolean excludeMine = Settings.isExcludeMyCaches(); final CacheType cacheType = Settings.getCacheType(); try { TestSettings.setExcludeMine(false); Settings.setCacheType(CacheType.ALL); GCLogin.getInstance().login(); final MapTokens tokens = GCLogin.getInstance().getMapTokens(); { final Viewport viewport = new Viewport(new Geopoint("N 52° 25.369 E 9° 35.499"), new Geopoint("N 52° 25.600 E 9° 36.200")); final SearchResult searchResult = ConnectorFactory.searchByViewport(viewport, tokens); assertThat(searchResult).isNotNull(); assertThat(searchResult.getGeocodes()).doesNotContain("GC4ER5H"); } { final Viewport viewport = new Viewport(new Geopoint("N 52° 24.000 E 9° 34.500"), new Geopoint("N 52° 26.000 E 9° 38.500")); final SearchResult searchResult = ConnectorFactory.searchByViewport(viewport, tokens); assertThat(searchResult).isNotNull(); assertThat(searchResult.isEmpty()).isFalse(); assertThat(searchResult.getGeocodes()).contains("GC4ER5H"); } } finally { TestSettings.setExcludeMine(excludeMine); Settings.setCacheType(cacheType); } }

Target:
public static void testGetViewport() { final boolean excludeMine = Settings.isExcludeMyCaches(); final CacheType cacheType = Settings.getCacheType(); try { TestSettings.setExcludeMine(false); Settings.setCacheType(CacheType.ALL); GCLogin.getInstance().login(); final MapTokens tokens = GCLogin.getInstance().getMapTokens(); { final Viewport viewport = new Viewport(new Geopoint("N 52° 25.369 E 9° 35.499"), new Geopoint("N 52° 25.600 E 9° 36.200")); final SearchResult searchResult = ConnectorFactory.searchByViewport(viewport, tokens); assertThat(searchResult).isNotNull(); assertThat(searchResult.isEmpty()).isFalse(); assertThat(searchResult.getGeocodes()).doesNotContain("GC4ER5H"); } { final Viewport viewport = new Viewport(new Geopoint("N 52° 24.000 E 9° 34.500"), new Geopoint("N 52° 26.000 E 9° 38.500")); final SearchResult searchResult = ConnectorFactory.searchByViewport(viewport, tokens); assertThat(searchResult).isNotNull(); assertThat(searchResult.getGeocodes()).contains("GC4ER5H"); } } finally { TestSettings.setExcludeMine(excludeMine); Settings.setCacheType(cacheType); } }
Source:
public void testCall() { SetReviewCommand setReviewcommand = fGerrit.setReview(change_id, commit_id); ReviewInput reviewInput = new ReviewInput(); reviewInput.setMessage("This review is NOW ready to go ..."); Map obj = new HashMap(); obj.put("Code-Review", "2"); reviewInput.setLabels(obj); setReviewcommand.setCommandInput(reviewInput); try { setReviewcommand.call(); } catch (EGerritException e) { fail(e.getMessage()); } SubmitCommand submitCmd = fGerrit.submit(change_id); SubmitInput submitInput = new SubmitInput(); submitInput.setWait_for_merge(true); submitCmd.setCommandInput(submitInput); ChangeInfo submitCmdResult = null; try { submitCmdResult = submitCmd.call(); assertEquals(submitCmdResult.getId(), change_id); } catch (EGerritException e) { fail(e.getMessage()); } RevertCommand revertCmd = fGerrit.revert(change_id); RevertInput revertInput = new RevertInput(); revertInput.setMessage("Change must be reverted !"); revertCmd.setCommandInput(revertInput); ChangeInfo revertCmdResult = null; try { revertCmdResult = revertCmd.call(); assertNotEquals(revertCmdResult.getId(), change_id); } catch (EGerritException e) { fail(e.getMessage()); } }

Target:
public void testCall() { SetReviewCommand setReviewcommand = fGerrit.setReview(change_id, commit_id); ReviewInput reviewInput = new ReviewInput(); reviewInput.setMessage("This review is NOW ready to go ..."); Map obj = new HashMap(); obj.put("Code-Review", "2"); reviewInput.setLabels(obj); setReviewcommand.setCommandInput(reviewInput); try { setReviewcommand.call(); } catch (EGerritException e) { fail(e.getMessage()); } SubmitCommand submitCmd = fGerrit.submit(change_id); SubmitInput submitInput = new SubmitInput(); submitInput.setWait_for_merge(true); submitCmd.setCommandInput(submitInput); ChangeInfo submitCmdResult = null; try { submitCmdResult = submitCmd.call(); assertEquals(submitCmdResult.getId(), change_id); } catch (EGerritException e) { fail(e.getMessage()); } RevertCommand revertCmd = fGerrit.revert(change_id); RevertInput revertInput = new RevertInput(); revertInput.setMessage("Change must be reverted !"); revertCmd.setCommandInput(revertInput); ChangeInfo revertCmdResult = null; try { revertCmdResult = revertCmd.call(); assertNotEquals(revertCmdResult.getId(), change_id); assertEquals(revertCmdResult.getStatus(), "NEW"); } catch (EGerritException e) { fail(e.getMessage()); } }
Source:
private void deleteRemovedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) { Object[] refChildren = refContainer.getChildren(); for (Object element2 : container.getChildren()) { Object element = getElement(refChildren, element2); if (element == null) { if (element2 instanceof BreakpointContainer) { BreakpointContainer.removeAll((BreakpointContainer) element2, containerDelta); } else { BreakpointContainer.removeBreakpoint(container, (IBreakpoint) element2, containerDelta); } } else if (element instanceof BreakpointContainer){ ModelDelta childDelta = containerDelta.addNode(element2, IModelDelta.STATE); deleteRemovedElements((BreakpointContainer) element2, (BreakpointContainer) element, childDelta); } } }

Target:
private void deleteRemovedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) { Object[] refChildren = refContainer.getChildren(); for (Object childElement : container.getChildren()) { Object element = getElement(refChildren, childElement); if (element == null) { if (childElement instanceof BreakpointContainer) { BreakpointContainer.removeAll((BreakpointContainer) childElement, containerDelta); } else { BreakpointContainer.removeBreakpoint(container, (IBreakpoint) childElement, containerDelta); } } else if (element instanceof BreakpointContainer){ ModelDelta childDelta = containerDelta.addNode(childElement, IModelDelta.STATE); deleteRemovedElements((BreakpointContainer) childElement, (BreakpointContainer) element, childDelta); } } }
Source:
public Set<TypeClass> getSupers() { return supers; }

Target:
protected Set<TypeClass> getSupers() { return this.supers; }
Source:
public void createRoles(DynamicSchema dynamicSchema) { List<String> roles = (List<String>) CollectionUtils.toList(CollectionUtils.getNestedValue(dynamicSchema.getData(), "fields", "roles")); for (String role: roles) { create().insertInto(DYNAMIC_SCHEMA_ROLE, DYNAMIC_SCHEMA_ROLE.DYNAMIC_SCHEMA_ID, DYNAMIC_SCHEMA_ROLE.ROLE) .values(dynamicSchema.getId(), role).execute(); } }

Target:
public void createRoles(DynamicSchema dynamicSchema) { List<String> roles = (List<String>) CollectionUtils.toList(CollectionUtils.getNestedValue(dynamicSchema.getData(), "fields", "roles")); InsertValuesStep2<DynamicSchemaRoleRecord, Long, String> insertStart = create() .insertInto(DYNAMIC_SCHEMA_ROLE, DYNAMIC_SCHEMA_ROLE.DYNAMIC_SCHEMA_ID, DYNAMIC_SCHEMA_ROLE.ROLE); for (String role: roles) { insertStart = insertStart.values(dynamicSchema.getId(), role); } insertStart.execute(); }
Source:
public InstrumentedExecutorService(ExecutorService delegate) { this(delegate, "instrumented_delegate_" + NAME_COUNTER.incrementAndGet()); }

Target:
public InstrumentedExecutorService(ExecutorService delegate) { this(delegate, "unknown_" + NAME_COUNTER.incrementAndGet()); }
Source:
protected void deactivate() { active.set(false); extendedDiscoveryServices.clear(); discoveryServiceCallback = null; }

Target:
protected void deactivate() { extendedDiscoveryServices.clear(); discoveryServiceCallback.inbox = null; discoveryServiceCallback.thingRegistry = null; discoveryServiceCallback = null; }
Source:
public void browse() { running = true; QueueBrowser consumer = null; String threadName = Thread.currentThread().getName(); System.out.println(threadName + " trying to browse " + messageCount + " messages"); try { if (filter != null) { consumer = session.createBrowser((Queue) destination, filter); } else { consumer = session.createBrowser((Queue) destination); } Enumeration<Message> enumBrowse = consumer.getEnumeration(); while (enumBrowse.hasMoreElements()) { Message msg = enumBrowse.nextElement(); if (msg != null) { System.out.println(threadName + " Browsing " + (msg instanceof TextMessage ? ((TextMessage) msg).getText() : msg.getJMSMessageID())); if (verbose) { System.out.println("..." + msg); } if (bytesAsText && (msg instanceof BytesMessage)) { long length = ((BytesMessage) msg).getBodyLength(); byte[] bytes = new byte[(int) length]; ((BytesMessage) msg).readBytes(bytes); System.out.println("Message:" + msg); } received++; if (received >= messageCount) { break; } } else { break; } if (sleep > 0) { Thread.sleep(sleep); } } consumer.close(); } catch (Exception e) { e.printStackTrace(); } finally { if (finished != null) { finished.countDown(); } if (consumer != null) { System.out.println(threadName + " browsed: " + this.getReceived() + " messages"); try { consumer.close(); } catch (JMSException e) { e.printStackTrace(); } } } System.out.println(threadName + " thread finished"); }

Target:
public void browse() { running = true; QueueBrowser consumer = null; String threadName = Thread.currentThread().getName(); System.out.println(threadName + " trying to browse " + messageCount + " messages"); try { if (filter != null) { consumer = session.createBrowser((Queue) destination, filter); } else { consumer = session.createBrowser((Queue) destination); } Enumeration<Message> enumBrowse = consumer.getEnumeration(); while (enumBrowse.hasMoreElements()) { Message msg = enumBrowse.nextElement(); if (msg != null) { System.out.println(threadName + " browsing " + (msg instanceof TextMessage ? ((TextMessage) msg).getText() : msg.getJMSMessageID())); if (verbose) { System.out.println("..." + msg); } if (bytesAsText && (msg instanceof BytesMessage)) { long length = ((BytesMessage) msg).getBodyLength(); byte[] bytes = new byte[(int) length]; ((BytesMessage) msg).readBytes(bytes); System.out.println("Message:" + msg); } received++; if (received >= messageCount) { break; } } else { break; } if (sleep > 0) { Thread.sleep(sleep); } } consumer.close(); } catch (Exception e) { e.printStackTrace(); } finally { if (finished != null) { finished.countDown(); } if (consumer != null) { System.out.println(threadName + " browsed: " + this.getReceived() + " messages"); try { consumer.close(); } catch (JMSException e) { e.printStackTrace(); } } } System.out.println(threadName + " Browser thread finished"); }
Source:
public Channel handleUnknownChannelCommand( ConnectionService service, byte cmd, int channelId, Buffer buffer) throws IOException { Session session = service.getSession(); if (log.isDebugEnabled()) { log.debug("handleUnknownChannelCommand({}) received command for unknown channel: {}", session, SshConstants.getCommandMessageName(cmd), channelId); } boolean wantReply = false; switch (cmd) { case SshConstants.SSH_MSG_CHANNEL_REQUEST: { String req = buffer.getString(); wantReply = buffer.getBoolean(); if (log.isDebugEnabled()) { log.debug("handleUnknownChannelCommand({}) Received SSH_MSG_CHANNEL_REQUEST={} (wantReply={}) for unknown channel: {}", session, req, wantReply, channelId); } break; } case SshConstants.SSH_MSG_CHANNEL_DATA: case SshConstants.SSH_MSG_CHANNEL_EXTENDED_DATA: wantReply = false; break; default: } if (wantReply) { sendFailureResponse(service, cmd, channelId); } return null; }

Target:
public Channel handleUnknownChannelCommand( ConnectionService service, byte cmd, int channelId, Buffer buffer) throws IOException { Session session = service.getSession(); if (log.isDebugEnabled()) { log.debug("handleUnknownChannelCommand({}) received command for unknown channel: {}", session, SshConstants.getCommandMessageName(cmd), channelId); } boolean wantReply = false; switch (cmd) { case SshConstants.SSH_MSG_CHANNEL_REQUEST: { String req = buffer.getString(); wantReply = buffer.getBoolean(); if (log.isDebugEnabled()) { log.debug("handleUnknownChannelCommand({}) Received SSH_MSG_CHANNEL_REQUEST={} (wantReply={}) for unknown channel: {}", session, req, wantReply, channelId); } break; } case SshConstants.SSH_MSG_CHANNEL_DATA: case SshConstants.SSH_MSG_CHANNEL_EXTENDED_DATA: wantReply = true; break; default: } if (wantReply) { sendFailureResponse(service, cmd, channelId); } return null; }
Source:
private GroupDefinition initGroupDef(IPersonAttributesGroupDefinition group) { GroupDefinition groupDef = new GroupDefinition(); groupDef.setKey(group.getName()); groupDef.setName(group.getName()); groupDef.setDescription(group.getDescription()); addMemberKeys(groupDef, group.getMembers()); Set<IPersonAttributesGroupTestGroupDefinition> testGroups = group.getTestGroups(); for(IPersonAttributesGroupTestGroupDefinition testGroup : testGroups) { TestGroup tg = new TestGroup(); Set<IPersonAttributesGroupTestDefinition> tests = testGroup.getTests(); for(IPersonAttributesGroupTestDefinition test : tests) { IPersonTester testerInst = initializeTester(test); tg.addTest(testerInst); } groupDef.addTestGroup(tg); } return groupDef; }

Target:
private GroupDefinition initGroupDef(IPersonAttributesGroupDefinition group) { GroupDefinition groupDef = new GroupDefinition(); groupDef.setKey(group.getName()); groupDef.setName(group.getName()); groupDef.setDescription(group.getDescription()); addMemberKeys(groupDef, group.getMembers()); Set<IPersonAttributesGroupTestGroupDefinition> testGroups = group.getTestGroups(); for(IPersonAttributesGroupTestGroupDefinition testGroup : testGroups) { TestGroup tg = new TestGroup(); Set<IPersonAttributesGroupTestDefinition> tests = testGroup.getTests(); for(IPersonAttributesGroupTestDefinition test : tests) { IPersonTester testerInst = initializeTester(test); if (testerInst == null) { return null; } tg.addTest(testerInst); } groupDef.addTestGroup(tg); } return groupDef; }
Source:
public FieldSetFilteringRecordSet(FunctionManager functionManager, RecordSet delegate, List<Set<Integer>> fieldSets) { requireNonNull(functionManager, "functionManager is null"); this.delegate = requireNonNull(delegate, "delegate is null"); ImmutableList.Builder<Set<Field>> fieldSetsBuilder = ImmutableList.builder(); List<Type> columnTypes = delegate.getColumnTypes(); for (Set<Integer> fieldSet : requireNonNull(fieldSets, "fieldSets is null")) { ImmutableSet.Builder<Field> fieldSetBuilder = ImmutableSet.builder(); for (int field : fieldSet) { fieldSetBuilder.add(new Field( field, functionManager.getScalarFunctionImplementation( functionManager.resolveOperator(OperatorType.EQUAL, TypeSignatureProvider.fromTypes(ImmutableList.of(columnTypes.get(field), columnTypes.get(field))))).getMethodHandle())); } fieldSetsBuilder.add(fieldSetBuilder.build()); } this.fieldSets = fieldSetsBuilder.build(); }

Target:
public FieldSetFilteringRecordSet(FunctionManager functionManager, RecordSet delegate, List<Set<Integer>> fieldSets) { requireNonNull(functionManager, "functionManager is null"); this.delegate = requireNonNull(delegate, "delegate is null"); ImmutableList.Builder<Set<Field>> fieldSetsBuilder = ImmutableList.builder(); List<Type> columnTypes = delegate.getColumnTypes(); for (Set<Integer> fieldSet : requireNonNull(fieldSets, "fieldSets is null")) { ImmutableSet.Builder<Field> fieldSetBuilder = ImmutableSet.builder(); for (int field : fieldSet) { fieldSetBuilder.add(new Field( field, functionManager.getScalarFunctionImplementation( functionManager.resolveOperator(OperatorType.EQUAL, fromTypes(ImmutableList.of(columnTypes.get(field), columnTypes.get(field))))).getMethodHandle())); } fieldSetsBuilder.add(fieldSetBuilder.build()); } this.fieldSets = fieldSetsBuilder.build(); }
Source:
public static <T> CompletableFuture<T> getIfDoneOrCancel(Future<T> future, Duration after) throws NullArgumentException { if (future == null) { throw new NullArgumentException("future"); } CompletableFuture<T> result = new CompletableFuture<>(); SCHEDULED_EXECUTOR_SERVICE.schedule(() -> { if (future.isDone()) { try { T t = future.get(); result.complete(t); } catch (InterruptedException e) { result.completeExceptionally(e); } catch (ExecutionException e) { result.completeExceptionally(e.getCause()); } catch (CancellationException e) { result.cancel(false); } } else { future.cancel(true); result.cancel(false); } }, after.toMillis(), TimeUnit.MILLISECONDS); return result; }

Target:
public static <T> CompletableFuture<T> getIfDoneOrCancel(Future<T> future, Duration after) { Validate.notNull(future); Validate.notNull(after); CompletableFuture<T> result = new CompletableFuture<>(); SCHEDULED_EXECUTOR_SERVICE.schedule(() -> { if (future.isDone()) { try { T t = future.get(); result.complete(t); } catch (InterruptedException e) { result.completeExceptionally(e); } catch (ExecutionException e) { result.completeExceptionally(e.getCause()); } catch (CancellationException e) { result.cancel(false); } } else { future.cancel(true); result.cancel(false); } }, after.toMillis(), TimeUnit.MILLISECONDS); return result; }
Source:
static <T extends BusinessEntity<Guid>> void check(final AutoRecoverDAO<T> dao, final VdcActionType actionType, final DoWithClosure<T, VdcActionParametersBase> paramsCallback, final String logMsg) { log.info("Checking autorecoverable " + logMsg); final List<T> fails = dao.listFailedAutorecoverables(); final BackendInternal backend = Backend.getInstance(); for (final T fail : fails) { final VdcActionParametersBase actionParams = paramsCallback.doWith(fail); actionParams.setParentCommand(VdcActionType.Unknown); actionParams.setShouldBeLogged(true); backend.runInternalAction(actionType, actionParams); } log.info("Checking autorecoverable " + logMsg + " done"); }

Target:
static <T extends BusinessEntity<Guid>> void check(final AutoRecoverDAO<T> dao, final VdcActionType actionType, final DoWithClosure<T, VdcActionParametersBase> paramsCallback, final String logMsg) { log.info("Checking autorecoverable " + logMsg); final List<T> fails = dao.listFailedAutorecoverables(); final BackendInternal backend = Backend.getInstance(); for (final T fail : fails) { final VdcActionParametersBase actionParams = paramsCallback.doWith(fail); actionParams.setShouldBeLogged(true); backend.runInternalAction(actionType, actionParams); } log.info("Checking autorecoverable " + logMsg + " done"); }
Source:
public void sendingButNotReceivingClientShouldBeKilledWhenWriteThrottleMaxDurationIsReached() throws Exception { int numberOfRunDiscardPairs = 10_000; String largeString = StringUtils.repeat( " ", 8 * 1024 ); connection.connect( address ) .send( TransportTestUtil.acceptedVersions( 1, 0, 0, 0 ) ) .send( TransportTestUtil.chunk( init( "TestClient/1.1", emptyMap() ) ) ); assertThat( connection, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); assertThat( connection, eventuallyReceives( msgSuccess() ) ); Future sender = otherThread.execute( state -> { for ( int i = 0; i < numberOfRunDiscardPairs; i++ ) { connection.send( TransportTestUtil.chunk( run( "RETURN $data as data", ValueUtils.asMapValue( singletonMap( "data", largeString ) ) ), pullAll() ) ); } return null; } ); try { otherThread.get().awaitFuture( sender ); } catch ( ExecutionException e ) { assertThat( e.getCause(), Matchers.instanceOf( SocketException.class ) ); } logProvider.assertAtLeastOnce( AssertableLogProvider.inLog( Matchers.containsString( WorkerFactory.class.getPackage().getName() ) ).error( containsString( "crashed" ), matchesExceptionMessage( containsString( "will be closed because the client did not consume outgoing buffers for " ) ) ) ); }

Target:
public void sendingButNotReceivingClientShouldBeKilledWhenWriteThrottleMaxDurationIsReached() throws Exception { int numberOfRunDiscardPairs = 10_000; String largeString = StringUtils.repeat( " ", 8 * 1024 ); client.connect( address ) .send( TransportTestUtil.acceptedVersions( 1, 0, 0, 0 ) ) .send( TransportTestUtil.chunk( init( "TestClient/1.1", emptyMap() ) ) ); assertThat( client, eventuallyReceives( new byte[]{0, 0, 0, 1} ) ); assertThat( client, eventuallyReceives( msgSuccess() ) ); Future sender = otherThread.execute( state -> { for ( int i = 0; i < numberOfRunDiscardPairs; i++ ) { client.send( TransportTestUtil.chunk( run( "RETURN $data as data", ValueUtils.asMapValue( singletonMap( "data", largeString ) ) ), pullAll() ) ); } return null; } ); try { otherThread.get().awaitFuture( sender ); fail( "should throw ExecutionException instead" ); } catch ( ExecutionException e ) { assertThat( e.getCause(), Matchers.instanceOf( SocketException.class ) ); } logProvider.assertAtLeastOnce( AssertableLogProvider.inLog( Matchers.containsString( WorkerFactory.class.getPackage().getName() ) ).error( containsString( "crashed" ), matchesExceptionMessage( containsString( "will be closed because the client did not consume outgoing buffers for " ) ) ) ); }
Source:
public <T> T evaluate(Object obj, Class<T> target) { PropertyAccessor accessor = getLastPropertyAccessor(); Object value = false; boolean success = false; Exception lastException = null; if (accessor != null && accessor.canHandle(obj, attPath, target)) { try { value = accessor.get(obj, attPath, target); success = true; } catch (Exception e) { } } if (!success) { if (namespaceSupport != null && hints == null) { hints = new Hints(PropertyAccessorFactory.NAMESPACE_CONTEXT, namespaceSupport); } List<PropertyAccessor> accessors = PropertyAccessors.findPropertyAccessors(obj, attPath, target, hints); if (accessors != null) { Iterator<PropertyAccessor> it = accessors.iterator(); while (!success && it.hasNext()) { accessor = it.next(); try { value = accessor.get(obj, attPath, target); success = true; } catch (Exception e) { lastException = e; } } } if (!success) { if (lenient) return null; else throw new IllegalArgumentException( "Could not find working property accessor for attribute (" + attPath + ") in object (" + obj + ")", lastException); } else { setLastPropertyAccessor(accessor); } } if (target == null) { return (T) value; } return Converters.convert(value, target); }

Target:
public <T> T evaluate(Object obj, Class<T> target) { PropertyAccessor accessor = getLastPropertyAccessor(); Object value = false; boolean success = false; if (accessor != null && accessor.canHandle(obj, attPath, target)) { try { value = accessor.get(obj, attPath, target); success = true; } catch (Exception e) { } } if (!success) { if (namespaceSupport != null && hints == null) { hints = new Hints(PropertyAccessorFactory.NAMESPACE_CONTEXT, namespaceSupport); } List<PropertyAccessor> accessors = PropertyAccessors.findPropertyAccessors(obj, attPath, target, hints); List<Exception> exceptions = null; if (accessors != null) { Iterator<PropertyAccessor> it = accessors.iterator(); while (!success && it.hasNext()) { accessor = it.next(); try { value = accessor.get(obj, attPath, target); success = true; } catch (Exception e) { if (exceptions == null) { exceptions = new ArrayList<>(); } exceptions.add(e); } } } if (!success) { if (lenient) return null; else { IllegalArgumentException exception = new IllegalArgumentException( "Could not find working property accessor for attribute (" + attPath + ") in object (" + obj + ")"); if (exceptions != null) { exceptions.forEach(e -> exception.addSuppressed(exception)); } throw exception; } } else { setLastPropertyAccessor(accessor); } } if (target == null) { return (T) value; } return Converters.convert(value, target); }