auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void delete() { setCode(null); setAccessToken(null); setCreationDate(null); setDeviceId(null); setApplicationUserAuthorization(null); setRefreshToken(null); if (getUserPKCEInfoAuthorizationSession() != null) { getUserPKCEInfoAuthorizationSession().delete(); } setUserPKCEInfoAuthorizationSession(null); deleteDomainObject(); }

Target:
public void delete() { setCode(null); setAccessToken(null); setCreationDate(null); setDeviceId(null); setApplicationUserAuthorization(null); setRefreshToken(null); if (getUserPKCEInfoAuthorizationSession() != null) { getUserPKCEInfoAuthorizationSession().delete(); } deleteDomainObject(); }
Source:
private Vector<Entry> getStillValidEntriesFromMenu(Menu menu, OrderedHashtable<String, String> currentSessionData) { Hashtable<String, Entry> globalEntryMap = platform.getCommandToEntryMap(); Vector<Entry> stillValid = new Vector<>(); for (String cmd : menu.getCommandIds()) { Entry e = globalEntryMap.get(cmd); if (e == null) { throw new RuntimeException("No entry found for menu command [" + cmd + "]"); } if (entryRequiresAllDataInSession(e, currentSessionData)) { stillValid.addElement(e); } } return stillValid; }

Target:
private Vector<Entry> getStillValidEntriesFromMenu(Menu menu, OrderedHashtable<String, String> currentSessionData) { Hashtable<String, Entry> globalEntryMap = platform.getCommandToEntryMap(); Vector<Entry> stillValid = new Vector<>(); for (String cmd : menu.getCommandIds()) { Entry e = globalEntryMap.get(cmd); if (e == null) { throw new RuntimeException("No entry found for menu command [" + cmd + "]"); } stillValid.addElement(e); } return stillValid; }
Source:
public void testStart() { api().start(getName()); String status = ""; int stopCounter = 0; while (!status.equals("VM running")) { List<VirtualMachineInstance.VirtualMachineStatus> statuses = api().getInstanceDetails(getName()).statuses(); for (int c = 0; c < statuses.size(); c++) { if (statuses.get(c).code().substring(0, 10).equals("PowerState")) { status = statuses.get(c).displayStatus(); } try { Thread.sleep(5 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } stopCounter++; if (stopCounter == 40) break; } } assertEquals(status, "VM running"); }

Target:
public void testStart() { api().start(getName()); boolean jobDone = Predicates2.retry(new Predicate<String>() { @Override public boolean apply(String name) { String status = ""; List<VirtualMachineInstance.VirtualMachineStatus> statuses = api().getInstanceDetails(name).statuses(); for (int c = 0; c < statuses.size(); c++) { if (statuses.get(c).code().substring(0, 10).equals("PowerState")) { status = statuses.get(c).displayStatus(); break; } } return status.equals("VM running"); } }, 60 * 4 * 1000).apply(getName()); assertTrue(jobDone, "start operation did not complete in the configured timeout"); }
Source:
private String formatInstantAsDateInAdminTimeZone(Instant instant) { return FORMATTER_ADMIN_TIME.format( TimeHelper.convertInstantToLocalDateTime(instant, Const.SystemParams.ADMIN_TIME_ZONE)); }

Target:
private static String formatInstantAsDateInAdminTimeZone(Instant instant) { return DATE_FORMATTER.format( TimeHelper.convertInstantToLocalDateTime(instant, Const.SystemParams.ADMIN_TIME_ZONE)); }
Source:
public BulkImportOptions setAccumuloConnector(Connector conn) { this.conn = conn; return this; }

Target:
public BulkImportOptions setAccumuloConnector(Connector conn) { Objects.requireNonNull(conn); this.conn = conn; return this; }
Source:
VagrantExistingMachines(@Named(VagrantConstants.JCLOUDS_VAGRANT_HOME) String home, MachineConfig.Factory machineConfigFactory, Supplier<Collection<Image>> imageLister, Supplier<? extends Map<String, Hardware>> hardwareSupplier) { this.home = new File(checkNotNull(home, "home")); this.machineConfigFactory = checkNotNull(machineConfigFactory, "machineConfigFactory"); this.imageLister = checkNotNull(imageLister, "imageLister"); this.hardwareSupplier = checkNotNull(hardwareSupplier, "hardwareSupplier"); }

Target:
VagrantExistingMachines(@Named(VagrantConstants.JCLOUDS_VAGRANT_HOME) String home, MachineConfig.Factory machineConfigFactory, Supplier<Collection<Image>> imageLister, Supplier<? extends Map<String, Hardware>> hardwareSupplier) { this.home = new File(home); this.machineConfigFactory = machineConfigFactory; this.imageLister = imageLister; this.hardwareSupplier = hardwareSupplier; }
Source:
protected void initializeInternal() throws Exception { final YarnContainerEventHandler yarnContainerEventHandler = new YarnContainerEventHandler(); try { resourceManagerClient = yarnResourceManagerClientFactory.createResourceManagerClient( yarnHeartbeatIntervalMillis, yarnContainerEventHandler); resourceManagerClient.init(yarnConfig); resourceManagerClient.start(); final RegisterApplicationMasterResponse registerApplicationMasterResponse = registerApplicationMaster(); int maxPriority = getContainersFromPreviousAttempts(registerApplicationMasterResponse); taskExecutorProcessSpecContainerResourcePriorityAdapter = new TaskExecutorProcessSpecContainerResourcePriorityAdapter( maxPriority + 1, registerApplicationMasterResponse.getMaximumResourceCapability(), ExternalResourceUtils.getExternalResources(flinkConfig, YarnConfigOptions.EXTERNAL_RESOURCE_YARN_CONFIG_KEY_SUFFIX)); } catch (Exception e) { throw new ResourceManagerException("Could not start resource manager client.", e); } nodeManagerClient = yarnNodeManagerClientFactory.createNodeManagerClient(yarnContainerEventHandler); nodeManagerClient.init(yarnConfig); nodeManagerClient.start(); }

Target:
protected void initializeInternal() throws Exception { final YarnContainerEventHandler yarnContainerEventHandler = new YarnContainerEventHandler(); try { resourceManagerClient = yarnResourceManagerClientFactory.createResourceManagerClient( yarnHeartbeatIntervalMillis, yarnContainerEventHandler); resourceManagerClient.init(yarnConfig); resourceManagerClient.start(); final RegisterApplicationMasterResponse registerApplicationMasterResponse = registerApplicationMaster(); getContainersFromPreviousAttempts(registerApplicationMasterResponse); taskExecutorProcessSpecContainerResourcePriorityAdapter = new TaskExecutorProcessSpecContainerResourcePriorityAdapter( registerApplicationMasterResponse.getMaximumResourceCapability(), ExternalResourceUtils.getExternalResources(flinkConfig, YarnConfigOptions.EXTERNAL_RESOURCE_YARN_CONFIG_KEY_SUFFIX)); } catch (Exception e) { throw new ResourceManagerException("Could not start resource manager client.", e); } nodeManagerClient = yarnNodeManagerClientFactory.createNodeManagerClient(yarnContainerEventHandler); nodeManagerClient.init(yarnConfig); nodeManagerClient.start(); }
Source:
public LibraryTemplateDto updateLibraryTemplate(@PathVariable("id") Long id, @RequestBody LibraryTemplateDto libraryTemplateDto) throws IOException { if (libraryTemplateDto == null) { log.error( "Received null LibraryTemplateDto from front end; cannot convert to LibraryTemplate. Something likely went wrong in the JS DTO conversion."); throw new RestException("Cannot convert null to LibraryTemplate", Status.BAD_REQUEST); } LibraryTemplate libraryTemplate = libraryTemplateService.get(id); if (libraryTemplate == null) { throw new RestException("No such library.", Status.NOT_FOUND); } libraryTemplate = Dtos.to(libraryTemplateDto); libraryTemplateService.update(libraryTemplate); return Dtos.asDto(libraryTemplateService.get(id)); }

Target:
public LibraryTemplateDto updateLibraryTemplate(@PathVariable("id") Long id, @RequestBody LibraryTemplateDto libraryTemplateDto) throws IOException { if (libraryTemplateDto == null) { throw new RestException("Cannot convert null to LibraryTemplate", Status.BAD_REQUEST); } LibraryTemplate libraryTemplate = libraryTemplateService.get(id); if (libraryTemplate == null) { throw new RestException("No such LibraryTemplate.", Status.NOT_FOUND); } libraryTemplate = Dtos.to(libraryTemplateDto); libraryTemplateService.update(libraryTemplate); return Dtos.asDto(libraryTemplateService.get(id)); }
Source:
public void testString() { Value v1 = new Value("abc"); Value v2 = new Value("abc"); assertEquals(v2, v1); }

Target:
public void testString() { Value v1 = new Value("abc"); Value v2 = new Value("abc".getBytes(UTF_8)); assertEquals(v2, v1); }
Source:
public gov.hhs.fha.nhinc.common.connectionmanagerinfo.UDDIUpdateManagerForceRefreshResponseType forceRefreshFileFromUDDIServer( gov.hhs.fha.nhinc.common.connectionmanagerinfo.UDDIUpdateManagerForceRefreshRequestType uddiUpdateManagerForceRefreshRequest) { LOG.info("forceRefreshFileFromUDDIServer"); UDDIUpdateManagerHelper helper = new UDDIUpdateManagerHelper(); return helper.forceRefreshFileFromUDDIServer(uddiUpdateManagerForceRefreshRequest); }

Target:
public gov.hhs.fha.nhinc.common.connectionmanagerinfo.UDDIUpdateManagerForceRefreshResponseType forceRefreshFileFromUDDIServer( gov.hhs.fha.nhinc.common.connectionmanagerinfo.UDDIUpdateManagerForceRefreshRequestType uddiUpdateManagerForceRefreshRequest) { LOG.trace("forceRefreshFileFromUDDIServer"); UDDIUpdateManagerHelper helper = new UDDIUpdateManagerHelper(); return helper.forceRefreshFileFromUDDIServer(uddiUpdateManagerForceRefreshRequest); }
Source:
private void adjustKVMDataForBlockSD() { if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE && getStorageDomain() != null && getStorageDomain().getStorageType().isBlockDomain()) { getVm().getImages().forEach(image -> { image.setActualSizeInBytes(image.getSize()); image.setVolumeType(VolumeType.Preallocated); }); log.info("Block Storage Domains do not support Sparseness. The Import is defaulting to Preallocated."); } }

Target:
private void adjustKVMDataForBlockSD() { if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE && getStorageDomain() != null && getStorageDomain().getStorageType().isBlockDomain()) { getVm().getImages().forEach(image -> { image.setActualSizeInBytes(image.getSize()); image.setVolumeType(VolumeType.Preallocated); }); log.info("Block Storage Domains do not support Sparseness. The Importing of VM '{}' is defaulting to Preallocated.", getVm().getId()); } }
Source:
public void covers() { Map<String, TrackingToken> newTokens = new HashMap<>(); newTokens.put("token1", new GlobalSequenceTrackingToken(0)); newTokens.put("token2", new GlobalSequenceTrackingToken(0)); assertTrue(testSubject.covers(new MultiSourceTrackingToken(newTokens))); newTokens.put("token2", null); MultiSourceTrackingToken tokenWithNullConstituent = new MultiSourceTrackingToken(newTokens); assertTrue(testSubject.covers(tokenWithNullConstituent)); assertTrue(tokenWithNullConstituent.covers(tokenWithNullConstituent)); }

Target:
public void covers() { Map<String, TrackingToken> newTokens = new HashMap<>(); newTokens.put("token1", new GlobalSequenceTrackingToken(0)); newTokens.put("token2", new GlobalSequenceTrackingToken(0)); assertTrue(testSubject.covers(new MultiSourceTrackingToken(newTokens))); }
Source:
public Permissionable getParentPermissionable() { try{ if (FolderAPI.SYSTEM_FOLDER.equals(this.folder())) { PermissionableProxy host = new PermissionableProxy(); host.setIdentifier(this.host()); host.setInode(this.host()); return host; } else { Folder folder = new Folder(); DotConnect dc = new DotConnect(); dc.setSQL("select identifier from folder where inode = ?"); dc.addParam(this.folder()); folder.setIdentifier(dc.loadObjectResults().get(0).get("identifier").toString()); folder.setInode(this.folder()); return folder; } }catch (Exception e) { throw new DotRuntimeException(e.getMessage(), e); } }

Target:
public Permissionable getParentPermissionable() { try{ if (FolderAPI.SYSTEM_FOLDER.equals(this.folder())) { PermissionableProxy host = new PermissionableProxy(); host.setIdentifier(this.host()); host.setInode(this.host()); return host; } else { return APILocator.getFolderAPI().find(this.folder(), APILocator.systemUser(), false); } }catch (Exception e) { throw new DotRuntimeException(e.getMessage(), e); } }
Source:
public PoolDefinition(long size, MemoryUnit unit) { if (unit == null) { throw new NullPointerException("Unit cannot be null"); } this.size = size; this.unit = unit; this.serverResource = null; }

Target:
public PoolDefinition(long size, MemoryUnit unit) { if (unit == null) { throw new NullPointerException("Unit cannot be null"); } if (size <= 0) { throw new IllegalArgumentException("Pool must have a positive size"); } this.size = size; this.unit = unit; this.serverResource = null; }
Source:
public DataSourceArray<BlockHeader> headerSource() { DbSource<byte[]> dataSource = keyValueDataSource("headers"); BatchSourceWriter<byte[], byte[]> batchSourceWriter = new BatchSourceWriter<>(dataSource); WriteCache.BytesKey<byte[]> writeCache = new WriteCache.BytesKey<>(batchSourceWriter, WriteCache.CacheType.SIMPLE); writeCache.withSizeEstimators(MemSizeEstimator.ByteArrayEstimator, MemSizeEstimator.ByteArrayEstimator); writeCache.setFlushSource(true); ObjectDataSource<BlockHeader> objectDataSource = new ObjectDataSource<>(dataSource, Serializers.BlockHeaderSerializer, 0); DataSourceArray<BlockHeader> dataSourceArray = new DataSourceArray<>(objectDataSource); return dataSourceArray; }

Target:
public DbSource<byte[]> headerSource() { return keyValueDataSource("headers"); }
Source:
public boolean feasible(Optimizable innerTable, OptimizablePredicateList predList, Optimizer optimizer, CostEstimate outerCost, boolean wasHinted, boolean skipKeyCheck) throws StandardException { if(outerCost.isUninitialized() ||(outerCost.localCost()==0d)) { return false; } if (JoinStrategyUtil.isNonCoveringIndex(innerTable)) return false; AccessPath currentAccessPath = innerTable.getCurrentAccessPath(); boolean isSpark = false; boolean isForcedControl = false; boolean isOneRow = false; boolean isHinted = currentAccessPath.isHintedJoinStrategy(); if (innerTable instanceof FromBaseTable) { DataSetProcessorType dspt = ((FromBaseTable) innerTable).getDataSetProcessorTypeForAccessPath(currentAccessPath); dspt.combine(((FromBaseTable) innerTable).getCompilerContext().getDataSetProcessorType()); isSpark = dspt.isSpark(); isForcedControl = (dspt.isHinted() || dspt.isForced()) && !dspt.isSpark(); isOneRow = ((FromBaseTable) innerTable).isOneRowResultSet(); } return !outerCost.isOuterJoin() && (isSpark || (isForcedControl && isHinted)) && !isOneRow; }

Target:
public boolean feasible(Optimizable innerTable, OptimizablePredicateList predList, Optimizer optimizer, CostEstimate outerCost, boolean wasHinted, boolean skipKeyCheck) throws StandardException { if(outerCost.isUninitialized() ||(outerCost.localCost()==0d)) { return false; } if (JoinStrategyUtil.isNonCoveringIndex(innerTable)) return false; AccessPath currentAccessPath = innerTable.getCurrentAccessPath(); boolean isSpark = false; boolean isForcedControl = false; boolean isOneRow = false; boolean isHinted = currentAccessPath.isHintedJoinStrategy(); if (innerTable instanceof FromBaseTable) { DataSetProcessorType dspt = (((FromBaseTable) innerTable).getCompilerContext().getDataSetProcessorType()); isSpark = optimizer.isForSpark(); isForcedControl = (dspt.isHinted() || dspt.isForced()) && !optimizer.isForSpark(); isOneRow = ((FromBaseTable) innerTable).isOneRowResultSet(); } return !outerCost.isOuterJoin() && (isSpark || (isForcedControl && isHinted)) && !isOneRow; }
Source:
public int compareTo(PersonAttribute other) { int retValue; if ((retValue = OpenmrsUtil.compareWithNullAsGreatest(getAttributeType(), other.getAttributeType())) != 0) { return retValue; } if ((retValue = isVoided().compareTo(other.isVoided())) != 0) { return retValue; } if ((retValue = OpenmrsUtil.compareWithNullAsLatest(getDateCreated(), other.getDateCreated())) != 0) { return retValue; } if ((retValue = OpenmrsUtil.compareWithNullAsGreatest(getValue(), other.getValue())) != 0) { return retValue; } return OpenmrsUtil.compareWithNullAsGreatest(getPersonAttributeId(), other.getPersonAttributeId()); }

Target:
public int compareTo(PersonAttribute other) { DefaultComparator paDComparator = new DefaultComparator(); return paDComparator.compare(this, other); }
Source:
public void record(PlanOptimizer optimizer, long nanos) { requireNonNull(optimizer, "optimizer is null"); stats.get(optimizer.getClass()).record(nanos); }

Target:
public void record(PlanOptimizer optimizer, long nanos) { requireNonNull(optimizer, "optimizer is null"); OptimizerStats optimizerStats = requireNonNull(stats.get(optimizer.getClass()), "optimizer is not registered"); optimizerStats.record(nanos); }
Source:
public void testRunStarted(String runName, int testCount) { if (mExpectedTestCount == 0) { mExpectedTestCount = testCount; } mTestRunName = runName; mIsRunComplete = false; }

Target:
public void testRunStarted(String runName, int testCount) { if (mExpectedTestCount == 0) { mExpectedTestCount = testCount; } else { CLog.w("%s calls testRunStarted more than once", runName); } mTestRunName = runName; mIsRunComplete = false; }
Source:
public void pullFromProjectRepo() throws Exception { SWTBotTree repositoriesTree = repoView.bot().tree(); repositoriesTree.select(0); repositoriesTree.contextMenu("Pull...").click(); bot.shell("Pull").setFocus(); assertTrue("Remote combo misses items", bot.comboBox().items().length > 1); bot.button(IDialogConstants.FINISH_LABEL).click(); ShellWithTextPrefixMatcher shellWithTextPrefixMatcher = new ShellWithTextPrefixMatcher( "Pull Result"); bot.waitUntil(waitForShell(shellWithTextPrefixMatcher)); shellWithTextPrefixMatcher.getFoundShell().setFocus(); bot.button(IDialogConstants.OK_LABEL).click(); }

Target:
public void pullFromProjectRepo() throws Exception { SWTBotTree repositoriesTree = getOrOpenView().bot().tree(); repositoriesTree.select(0); repositoriesTree.contextMenu("Pull...").click(); bot.shell("Pull").setFocus(); assertTrue("Remote combo misses items", bot.comboBox().items().length > 1); bot.button(IDialogConstants.FINISH_LABEL).click(); ShellWithTextPrefixMatcher shellWithTextPrefixMatcher = new ShellWithTextPrefixMatcher( "Pull Result"); bot.waitUntil(waitForShell(shellWithTextPrefixMatcher)); shellWithTextPrefixMatcher.getFoundShell().setFocus(); bot.button(IDialogConstants.OK_LABEL).click(); }
Source:
private Group setUpGroup(User u0, User u1) throws PrivilegeException, InternalErrorException, UserNotExistsException, VoExistsException, GroupExistsException, VoNotExistsException, GroupNotExistsException, AlreadyMemberException, MemberNotExistsException, WrongReferenceAttributeValueException, WrongAttributeValueException, ExtendMembershipException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException, PolicyNotExistsException { Vo vo = new Vo(); vo.setShortName("testVo"); vo.setName("Test VO"); perun.getVosManager().createVo(sess, vo); Group authGroup = new Group(); authGroup.setShortName("testGroup"); authGroup.setName("Test Group"); Member m0 = perun.getMembersManager().createMember(sess, vo, u0); Member m1 = perun.getMembersManager().createMember(sess, vo, u1); perun.getGroupsManager().createGroup(sess, vo, authGroup); perun.getGroupsManager().addMember(sess, authGroup, m0); perun.getGroupsManager().addMember(sess, authGroup, m1); return authGroup; }

Target:
private Group setUpGroup(User u0, User u1) throws PrivilegeException, InternalErrorException, UserNotExistsException, VoExistsException, GroupExistsException, VoNotExistsException, GroupNotExistsException, AlreadyMemberException, MemberNotExistsException, WrongReferenceAttributeValueException, WrongAttributeValueException, ExtendMembershipException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException { Vo vo = new Vo(); vo.setShortName("testVo"); vo.setName("Test VO"); perun.getVosManager().createVo(sess, vo); Group authGroup = new Group(); authGroup.setShortName("testGroup"); authGroup.setName("Test Group"); Member m0 = perun.getMembersManager().createMember(sess, vo, u0); Member m1 = perun.getMembersManager().createMember(sess, vo, u1); perun.getGroupsManager().createGroup(sess, vo, authGroup); perun.getGroupsManager().addMember(sess, authGroup, m0); perun.getGroupsManager().addMember(sess, authGroup, m1); return authGroup; }
Source:
protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(getCacheMode(), true); builder.clustering().stateTransfer().chunkSize(128); createClusteredCaches(4, cacheName(), builder); }

Target:
protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(getCacheMode(), true); builder.clustering().stateTransfer().chunkSize(2); createClusteredCaches(4, cacheName(), builder); }
Source:
public boolean include(TreeWalk tw) throws MissingObjectException, IncorrectObjectTypeException, IOException { final int wm = tw.getRawMode(workingTree); if (wm == 0) return true; final int cnt = tw.getTreeCount(); final int dm = tw.getRawMode(dirCache); WorkingTreeIterator workingTreeIterator = workingTree(tw); if (dm == 0) { if (honorIgnores && workingTreeIterator.isEntryIgnored()) { ignoredPaths.add(workingTreeIterator.getEntryPathString()); int i = 0; for (; i < cnt; i++) { if (i == dirCache || i == workingTree) continue; if (tw.getRawMode(i) != 0) break; } return i == cnt ? false : true; } else { return true; } } if (tw.isSubtree()) return true; for (int i = 0; i < cnt; i++) { if (i == dirCache || i == workingTree) continue; if (tw.getRawMode(i) != dm || !tw.idEqual(i, dirCache)) return true; } WorkingTreeIterator wi = workingTreeIterator; DirCacheIterator di = tw.getTree(dirCache, DirCacheIterator.class); return wi.isModified(di.getDirCacheEntry(), true); }

Target:
public boolean include(TreeWalk tw) throws MissingObjectException, IncorrectObjectTypeException, IOException { final int wm = tw.getRawMode(workingTree); if (wm == 0) return true; final int cnt = tw.getTreeCount(); final int dm = tw.getRawMode(dirCache); WorkingTreeIterator wi = workingTree(tw); if (dm == 0) { if (honorIgnores && wi.isEntryIgnored()) { ignoredPaths.add(wi.getEntryPathString()); int i = 0; for (; i < cnt; i++) { if (i == dirCache || i == workingTree) continue; if (tw.getRawMode(i) != 0) break; } return i == cnt ? false : true; } else { return true; } } if (tw.isSubtree()) return true; for (int i = 0; i < cnt; i++) { if (i == dirCache || i == workingTree) continue; if (tw.getRawMode(i) != dm || !tw.idEqual(i, dirCache)) return true; } DirCacheIterator di = tw.getTree(dirCache, DirCacheIterator.class); return wi.isModified(di.getDirCacheEntry(), true); }
Source:
public void startOfExecution(Scope functionScope) { operandsWithIssues.clear(); super.startOfExecution(functionScope); }

Target:
public void startOfExecution(Scope functionScope) { operandsWithIssues.clear(); }
Source:
private void restoreStudentFeedbackResponseToDatastore(FeedbackResponseAttributes response) throws InvalidParametersException, EntityDoesNotExistException { frLogic.createFeedbackResponses(Arrays.asList(response)); fsLogic.addStudentRespondent(response.giver, response.feedbackSessionName, response.courseId); }

Target:
private void restoreStudentFeedbackResponseToDatastore(FeedbackResponseAttributes response) throws InvalidParametersException, EntityDoesNotExistException, EntityAlreadyExistsException { restoreFeedbackResponse(response); fsLogic.addStudentRespondent(response.giver, response.feedbackSessionName, response.courseId); }
Source:
public RqWithBody(final Request req, final CharSequence bdy) { super( new RqOf( req::head, () -> new ByteArrayInputStream( new Utf8String(bdy.toString()).asBytes() ) ) ); }

Target:
public RqWithBody(final Request req, final CharSequence bdy) { super( new RequestOf( req::head, () -> new ByteArrayInputStream( new Utf8String(bdy.toString()).asBytes() ) ) ); }
Source:
public void visit(DataChartStringDescriptor<?> desc) { setType(EnumSet.of(DescriptorType.STRING)); }

Target:
public void visit(DataChartStringDescriptor<?> desc) { fType.add(DescriptorType.STRING); }
Source:
public String getOption() { final Function<Path, FileTime> createTimeComp = path -> { try { return Files.readAttributes(path, BasicFileAttributes.class).creationTime(); } catch (IOException e) { throw new RuntimeException(UNABLE_TO_DETERMINE_EXAM_DIR_ERROR, e); } }; System.err.println("HomeAwareVmOption"); System.err.println(UNPACK_DIRECTORY.toString()); System.err.println(super.getOption()); System.err.println("------------------------------------*************---------------------"); File f = new File("target/"); System.err.println(f.getAbsolutePath()); try (final Stream<Path> dirContents = Files.list(UNPACK_DIRECTORY.toPath())) { return dirContents .max(Comparator.comparing(createTimeComp)) .map(Path::toAbsolutePath) .map(Path::toString) .map( s -> { System.err.println(s); return s; }) .map(s -> StringUtils.replace(super.getOption(), KARAF_HOME, s)) .map(s -> s.replace('\\', '/')) .map(s -> s.replace("/bin/..", "/")) .orElseGet(super::getOption); } catch (IOException e) { throw new RuntimeException(UNABLE_TO_DETERMINE_EXAM_DIR_ERROR, e); } }

Target:
public String getOption() { final Function<Path, FileTime> createTimeComp = path -> { try { return Files.readAttributes(path, BasicFileAttributes.class).creationTime(); } catch (IOException e) { throw new RuntimeException(UNABLE_TO_DETERMINE_EXAM_DIR_ERROR, e); } }; try (final Stream<Path> dirContents = Files.list(UNPACK_DIRECTORY.toPath())) { return dirContents .max(Comparator.comparing(createTimeComp)) .map(Path::toAbsolutePath) .map(Path::toString) .map( s -> { LOGGER.error(s); return s; }) .map(s -> StringUtils.replace(super.getOption(), KARAF_HOME, s)) .map(s -> s.replace('\\', '/')) .map(s -> s.replace("/bin/..", "/")) .orElseGet(super::getOption); } catch (IOException e) { throw new RuntimeException(UNABLE_TO_DETERMINE_EXAM_DIR_ERROR, e); } }
Source:
public APIResult submit( @PathParam("extension-name") String extensionName, @Context HttpServletRequest request, @DefaultValue("") @QueryParam("doAs") String doAsUser, @QueryParam("jobName") String jobName, @FormDataParam("processes") List<FormDataBodyPart> processForms, @FormDataParam("feeds") List<FormDataBodyPart> feedForms, @FormDataParam("config") InputStream config) { checkIfExtensionServiceIsEnabled(); Map<EntityType, List<Entity>> entityMap; try { entityMap = getEntityList(extensionName, jobName, feedForms, processForms, config); submitEntities(extensionName, jobName, entityMap, config, request); } catch (FalconException | IOException | JAXBException e) { LOG.error("Error while submitting extension job: ", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } return new APIResult(APIResult.Status.SUCCEEDED, "Extension job submitted successfully:" + jobName); }

Target:
public APIResult submit( @PathParam("extension-name") String extensionName, @Context HttpServletRequest request, @DefaultValue("") @QueryParam("doAs") String doAsUser, @QueryParam("jobName") String jobName, @FormDataParam("processes") List<FormDataBodyPart> processForms, @FormDataParam("feeds") List<FormDataBodyPart> feedForms, @FormDataParam("config") InputStream config) { checkIfExtensionServiceIsEnabled(); SortedMap<EntityType, List<Entity>> entityMap; try { entityMap = getEntityList(extensionName, jobName, feedForms, processForms, config); submitEntities(extensionName, jobName, entityMap, config, request); } catch (FalconException | IOException | JAXBException e) { LOG.error("Error while submitting extension job: ", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } return new APIResult(APIResult.Status.SUCCEEDED, "Extension job submitted successfully:" + jobName); }
Source:
synchronized void register(File watchFile, Store keyStore) throws IOException { File canonical = watchFile.getCanonicalFile(); File parentDir = canonical.getParentFile(); String fileName = canonical.getName(); Path dirPath = parentDir.toPath(); boolean watchRequired = false; Map<String, List<Store>> pathRegistration = watchedPaths.get(dirPath); List<Store> pathStores = null; if (pathRegistration == null) { watchRequired = true; pathRegistration = new HashMap<String, List<Store>>(); pathStores = new LinkedList<Store>(); } else { pathRegistration = new HashMap<String, List<Store>>(pathRegistration); List<Store> tmpStore = pathRegistration.get(fileName); if (tmpStore != null) { pathStores = new LinkedList<Store>(tmpStore); } else { pathStores = new LinkedList<Store>(); } } pathStores.add(keyStore); pathRegistration.put(fileName, pathStores); Map<Path, Map<String, List<Store>>> newWatchedPaths = new HashMap<Path, Map<String, List<Store>>>(watchedPaths); newWatchedPaths.put(dirPath, pathRegistration); watchedPaths = newWatchedPaths; if (watchRequired) { if (watchService == null) { watchService = fileSystem.newWatchService(); executor.execute(new EventTaker()); } WatchKey key = dirPath.register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY); registrations.put(dirPath, key); } }

Target:
synchronized void register(File watchFile, Store keyStore) throws IOException { File canonical = watchFile.getCanonicalFile(); File parentDir = canonical.getParentFile(); String fileName = canonical.getName(); Path dirPath = parentDir.toPath(); boolean watchRequired = false; Map<String, List<Store>> pathRegistration = watchedPaths.get(dirPath); List<Store> pathStores = null; if (pathRegistration == null) { watchRequired = true; pathRegistration = new HashMap<String, List<Store>>(); pathStores = new ArrayList<Store>(); } else { pathRegistration = new HashMap<String, List<Store>>(pathRegistration); List<Store> tmpStore = pathRegistration.get(fileName); if (tmpStore != null) { pathStores = new ArrayList<Store>(tmpStore); } else { pathStores = new ArrayList<Store>(); } } pathStores.add(keyStore); pathRegistration.put(fileName, pathStores); Map<Path, Map<String, List<Store>>> newWatchedPaths = new HashMap<Path, Map<String, List<Store>>>(watchedPaths); newWatchedPaths.put(dirPath, pathRegistration); watchedPaths = newWatchedPaths; if (watchRequired) { if (watchService == null) { watchService = fileSystem.newWatchService(); Thread pollThread = new Thread(new EventTaker(), "KeyStoreWatcher Daemon"); pollThread.setDaemon(true); pollThread.start(); } WatchKey key = dirPath.register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY); registrations.put(dirPath, key); } }
Source:
public String toString(JCCompilationUnit compilationUnit) { StringBuilder result = new StringBuilder("replace "); for (Replacement replacement : getReplacements(compilationUnit.endPositions)) { result .append("position ") .append(replacement.startPosition()) .append(":") .append(replacement.endPosition()) .append(" with \"") .append(replacement.replaceWith()) .append("\" "); } return result.toString(); }

Target:
public String toString(JCCompilationUnit compilationUnit) { StringBuilder result = new StringBuilder("replace "); for (Replacement replacement : getReplacements(compilationUnit.endPositions)) { result.append( String.format( "position %d:%d with \"%s\" ", replacement.startPosition(), replacement.endPosition(), replacement.replaceWith())); } return result.toString(); }
Source:
public Page getOutput() { if (unfinishedWork != null) { boolean finished = unfinishedWork.process(); updateMemoryReservation(); if (finished) { unfinishedWork = null; } else { return null; } } if (!finishing) { return null; } if (outputIterator == null) { outputIterator = groupedTopNBuilder.buildResult(); } Page output = null; if (outputIterator.hasNext()) { Page page = outputIterator.next(); Block[] blocks = new Block[page.getChannelCount()]; for (int i = 0; i < outputChannels.size(); i++) { blocks[i] = page.getBlock(outputChannels.get(i)); } output = new Page(blocks); } updateMemoryReservation(); return output; }

Target:
public Page getOutput() { if (unfinishedWork != null) { boolean finished = unfinishedWork.process(); updateMemoryReservation(); if (!finished) { return null; } unfinishedWork = null; } if (!finishing) { return null; } if (outputIterator == null) { outputIterator = groupedTopNBuilder.buildResult(); } Page output = null; if (outputIterator.hasNext()) { Page page = outputIterator.next(); Block[] blocks = new Block[page.getChannelCount()]; for (int i = 0; i < outputChannels.size(); i++) { blocks[i] = page.getBlock(outputChannels.get(i)); } output = new Page(blocks); } updateMemoryReservation(); return output; }
Source:
public void getAssignedGroupsResourceMember() throws Exception { System.out.println(CLASS_NAME + "getAssignedGroupsResourceMember"); vo = setUpVo(); member = setUpMember(vo); group = setUpGroup(vo, member); facility = setUpFacility(); resource = setUpResource(); resourcesManager.assignGroupToResource(sess, group, resource); List<Group> groups = resourcesManager.getAssignedGroups(sess, resource, member); groups.forEach(System.out::println); assertTrue("only one group should be assigned",groups.size() == 1); assertTrue("our group should be assigned",groups.contains(group)); }

Target:
public void getAssignedGroupsResourceMember() throws Exception { System.out.println(CLASS_NAME + "getAssignedGroupsResourceMember"); vo = setUpVo(); member = setUpMember(vo); group = setUpGroup(vo, member); facility = setUpFacility(); resource = setUpResource(); resourcesManager.assignGroupToResource(sess, group, resource); List<Group> groups = resourcesManager.getAssignedGroups(sess, resource, member); assertTrue("only one group should be assigned",groups.size() == 1); assertTrue("our group should be assigned",groups.contains(group)); }
Source:
@Override public <K, V> ModelsComposition fit(DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) { MLLogger log = environment.logger(getClass()); log.log(MLLogger.VerboseLevel.MIN, "Start learning"); Long startTs = System.currentTimeMillis(); List<Promise<ModelOnFeaturesSubspace>> learnedModelsF = new ArrayList<>(); for (int i = 0; i < ensembleSize; i++) { learnedModelsF.add(environment.parallelismStrategy().submit(() -> learnModel(datasetBuilder, featureExtractor, lbExtractor) )); } List<Model<Vector, Double>> models = learnedModelsF.stream() .map(Promise::unsafeGet) .peek(model -> log.log(MLLogger.VerboseLevel.MAX, model)) .collect(Collectors.toList()); double learningTime = (double)(System.currentTimeMillis() - startTs) / 1000.0; log.log(MLLogger.VerboseLevel.MID, "The training time was %.2fs", learningTime); log.log(MLLogger.VerboseLevel.MIN, "Learning finished"); return new ModelsComposition(models, predictionsAggregator); }

Target:
@Override public <K, V> ModelsComposition fit(DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, Double> lbExtractor) { MLLogger log = environment.logger(getClass()); log.log(MLLogger.VerboseLevel.LOW, "Start learning"); Long startTs = System.currentTimeMillis(); List<IgniteSupplier<ModelOnFeaturesSubspace>> tasks = new ArrayList<>(); for(int i = 0; i < ensembleSize; i++) tasks.add(() -> learnModel(datasetBuilder, featureExtractor, lbExtractor)); List<Model<Vector, Double>> models = environment.parallelismStrategy().submit(tasks) .stream().map(Promise::unsafeGet) .collect(Collectors.toList()); double learningTime = (double)(System.currentTimeMillis() - startTs) / 1000.0; log.log(MLLogger.VerboseLevel.LOW, "The training time was %.2fs", learningTime); log.log(MLLogger.VerboseLevel.LOW, "Learning finished"); return new ModelsComposition(models, predictionsAggregator); }
Source:
private static ProxyOptions attemptToLoadJavaProxy(Configuration configuration, String type) { if (!Boolean.parseBoolean(configuration.get(JAVA_PROXY_PREREQUISITE))) { return null; } String host = configuration.get(type + "." + JAVA_PROXY_HOST); if (CoreUtils.isNullOrEmpty(host)) { return null; } int port; try { port = Integer.parseInt(configuration.get(type + "." + JAVA_PROXY_PORT)); } catch (NumberFormatException ex) { port = HTTPS.equals(type) ? 443 : 80; } ProxyOptions proxyOptions = new ProxyOptions(Type.HTTP, new InetSocketAddress(host, port)) .setNonProxyHosts(configuration.get(JAVA_NON_PROXY_HOSTS)); String username = configuration.get(type + "." + JAVA_PROXY_USER); String password = configuration.get(type + "." + JAVA_PROXY_PASSWORD); if (username != null && password != null) { proxyOptions.setCredentials(username, password); } return proxyOptions; }

Target:
private static ProxyOptions attemptToLoadJavaProxy(Configuration configuration, String type) { if (!Boolean.parseBoolean(configuration.get(JAVA_PROXY_PREREQUISITE))) { return null; } String host = configuration.get(type + "." + JAVA_PROXY_HOST); if (CoreUtils.isNullOrEmpty(host)) { return null; } int port; try { port = Integer.parseInt(configuration.get(type + "." + JAVA_PROXY_PORT)); } catch (NumberFormatException ex) { port = HTTPS.equals(type) ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT; } ProxyOptions proxyOptions = new ProxyOptions(Type.HTTP, new InetSocketAddress(host, port)) .setNonProxyHosts(configuration.get(JAVA_NON_PROXY_HOSTS)); String username = configuration.get(type + "." + JAVA_PROXY_USER); String password = configuration.get(type + "." + JAVA_PROXY_PASSWORD); if (username != null && password != null) { proxyOptions.setCredentials(username, password); } return proxyOptions; }
Source:
public static byte[] concat(Bytes... listOfBytes) { int offset = 0; int counter = 0; for (Bytes b : listOfBytes) { counter += b.length() + 1; } byte[] data = new byte[counter]; for (Bytes b : listOfBytes) { writeVint(data, offset, b.length()); offset++; b.copyTo(0, b.length(), data, offset); offset += b.length(); } return data; }

Target:
public static byte[] concat(Bytes... listOfBytes) { int offset = 0; int size = 0; for (Bytes b : listOfBytes) { size += b.length() + checkVlen(b.length()); } byte[] data = new byte[size]; for (Bytes b : listOfBytes) { offset = writeVint(data, offset, b.length()); b.copyTo(0, b.length(), data, offset); offset += b.length(); } return data; }
Source:
public String getLoginFromSessionId(String sessionId) { try { return sessionStore.get(sessionId).getUserName(); } catch (Exception e) { return ""; } }

Target:
public String getLoginFromSessionId(String sessionId) { try { return sessionStore.get(sessionId).getUserName(); } catch (Exception e) { LOGGER.debug("Invalid session : " + sessionId); return ""; } }
Source:
public String posts(Model model, @PathVariable String slug, @RequestParam(required = false, defaultValue = "1") int page, @RequestParam(required = false) String query, @RequestParam(required = false) String category, @RequestParam(required = false, defaultValue = "false") boolean showAll, @RequestParam(required = false, defaultValue = "false") boolean archived) { Site site = Site.fromSlug(slug); ensureCanDoThis(site,Permission.SEE_POSTS); Collection<Post> posts = (archived) ? site.getArchivedPostsSet() : site.getPostSet(); if (!Strings.isNullOrEmpty(category)) { Category cat = site.categoryForSlug(category); posts = cat.getPostsSet().stream() .filter(p -> (archived) ? p.getArchivedSite() != null : p.getSite() != null) .collect(Collectors.toSet()); model.addAttribute("category", cat); } if(!showAll) { posts = posts.stream().filter(post -> !post.isStaticPost()).collect(Collectors.toList()); } if (!Strings.isNullOrEmpty(query)) { posts = searchPosts(posts, query); } SearchUtils.Partition<Post> partition = new SearchUtils.Partition<>(posts, Post.CREATION_DATE_COMPARATOR, PER_PAGE, page); model.addAttribute("site", site); model.addAttribute("query", query); model.addAttribute("partition", partition); model.addAttribute("posts", partition.getItems()); return (archived) ? "fenixedu-cms/archivedPosts" : "fenixedu-cms/posts"; }

Target:
public String posts(Model model, @PathVariable String slug, @RequestParam(required = false, defaultValue = "1") int page, @RequestParam(required = false) String query, @RequestParam(required = false) String category, @RequestParam(required = false, defaultValue = "false") boolean showAll, @RequestParam(required = false, defaultValue = "false") boolean archived) { Site site = Site.fromSlug(slug); ensureCanDoThis(site,Permission.SEE_POSTS); if (archived) { ensureCanDoThis(site, Permission.DELETE_POSTS); } Collection<Post> posts = (archived) ? site.getArchivedPostsSet() : site.getPostSet(); if (!Strings.isNullOrEmpty(category)) { Category cat = site.categoryForSlug(category); posts = cat.getPostsSet().stream() .filter(p -> (archived) ? p.getArchivedSite() != null : p.getSite() != null) .collect(Collectors.toSet()); model.addAttribute("category", cat); } if(!showAll) { posts = posts.stream().filter(post -> !post.isStaticPost()).collect(Collectors.toList()); } if (!Strings.isNullOrEmpty(query)) { posts = searchPosts(posts, query); } SearchUtils.Partition<Post> partition = new SearchUtils.Partition<>(posts, Post.CREATION_DATE_COMPARATOR, PER_PAGE, page); model.addAttribute("site", site); model.addAttribute("query", query); model.addAttribute("partition", partition); model.addAttribute("posts", partition.getItems()); return (archived) ? "fenixedu-cms/archivedPosts" : "fenixedu-cms/posts"; }
Source:
public OperatingSystem getImage(final String id) { return find(listImages(), new Predicate<OperatingSystem>() { @Override public boolean apply(OperatingSystem input) { return input.equals(id); } }, null); }

Target:
public OperatingSystem getImage(final String id) { return find(listImages(), new Predicate<OperatingSystem>() { @Override public boolean apply(OperatingSystem input) { return input.getId().equals(id); } }, null); }
Source:
private RecognizeOptions getRecognizeOptionsProperties(RecognizeOptions userProvidedOptions) { if (userProvidedOptions != null) { return new RecognizeOptions() .setPollInterval(userProvidedOptions.getPollInterval()) .setFormContentType(userProvidedOptions.getFormContentType()) .setIncludeTextContent(userProvidedOptions.isIncludeTextContent()); } else { return new RecognizeOptions(); } }

Target:
private RecognizeOptions getRecognizeOptionsProperties(RecognizeOptions userProvidedOptions) { if (userProvidedOptions != null) { return userProvidedOptions; } else { return new RecognizeOptions(); } }
Source:
private List<Integer> createProxyPorts(int portCount) { PortChooser portChooser = new PortChooser(); int firstProxyPort = portChooser.chooseRandomPorts(portCount); List<Integer> proxyPorts = new ArrayList<>(portCount); for (int i = 0; i < portCount; i++) { proxyPorts.add(firstProxyPort + i); } return proxyPorts; }

Target:
private List<Integer> createProxyPorts(int portCount) { PortChooser portChooser = new PortChooser(); int firstProxyPort = portChooser.chooseRandomPorts(portCount); return IntStream .range(0, portCount) .map(i -> firstProxyPort + i) .boxed() .collect(Collectors.toList()); }
Source:
private BigDecimal getBigDecimalLowerBoundFromFloatString(String floatStr) { BigDecimal convertedBD; try { convertedBD = new BigDecimal(floatStr); } catch (NumberFormatException nfe) { return null; } if (lowerStrict) { convertedBD = convertedBD.setScale(0, RoundingMode.FLOOR); } else { convertedBD = convertedBD.setScale(0, RoundingMode.CEILING); } return convertedBD; }

Target:
private BigDecimal getBigDecimalLowerBoundFromFloatString(String floatStr) { BigDecimal convertedBD; try { convertedBD = new BigDecimal(floatStr); } catch (NumberFormatException nfe) { return null; } if (lowerStrict) { return convertedBD.setScale(0, RoundingMode.FLOOR); } else { return convertedBD.setScale(0, RoundingMode.CEILING); } }
Source:
public synchronized void addBinding(final Binding binding) throws Exception { server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.beforeAddBinding(binding) : null); addressManager.addBinding(binding); TypedProperties props = new TypedProperties(); props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, binding.getType().toInt()); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress()); props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName()); props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName()); props.putLongProperty(ManagementHelper.HDR_BINDING_ID, binding.getID()); props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance()); Filter filter = binding.getFilter(); if (filter != null) { props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filter.getFilterString()); } String uid = UUIDGenerator.getInstance().generateStringUUID(); if (logger.isDebugEnabled()) { logger.debug("ClusterCommunication::Sending notification for addBinding " + binding + " from server " + server); } managementService.sendNotification(new Notification(uid, CoreNotificationType.BINDING_ADDED, props)); server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterAddBinding(binding) : null); }

Target:
public synchronized void addBinding(final Binding binding) throws Exception { if (server.hasBrokerPlugins()) { server.callBrokerPlugins(plugin -> plugin.beforeAddBinding(binding)); } addressManager.addBinding(binding); TypedProperties props = new TypedProperties(); props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, binding.getType().toInt()); props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress()); props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName()); props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName()); props.putLongProperty(ManagementHelper.HDR_BINDING_ID, binding.getID()); props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance()); Filter filter = binding.getFilter(); if (filter != null) { props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filter.getFilterString()); } String uid = UUIDGenerator.getInstance().generateStringUUID(); if (logger.isDebugEnabled()) { logger.debug("ClusterCommunication::Sending notification for addBinding " + binding + " from server " + server); } managementService.sendNotification(new Notification(uid, CoreNotificationType.BINDING_ADDED, props)); if (server.hasBrokerPlugins()) { server.callBrokerPlugins(plugin -> plugin.afterAddBinding(binding)); } }
Source:
protected BackendQuotaLimitsResource(Guid quotaId, Class<N> baseResourcesClass) { super(baseResourcesClass, Quota.class, SUB_COLLECTIONS); this.quotaId = quotaId; }

Target:
protected BackendQuotaLimitsResource(Guid quotaId, Class<N> baseResourcesClass) { super(baseResourcesClass, Quota.class); this.quotaId = quotaId; }
Source:
public Optional<JobExecution.Success<Report.Result>> getLastSuccess(final UUID jobId, final Organization organization) throws NoSuchElementException { assertIsOpen(); final Optional<ReportExecution> row = _ebeanServer.find(ReportExecution.class) .orderBy() .desc("completed_at") .where() .eq("report.uuid", jobId) .eq("report.organization.uuid", organization.getId()) .eq("state", ReportExecution.State.SUCCESS) .setMaxRows(1) .findOneOrEmpty(); if (row.isPresent()) { final JobExecution<Report.Result> execution = toInternalModel(row.get()); if (execution instanceof JobExecution.Success) { return Optional.of((JobExecution.Success<Report.Result>) execution); } throw new IllegalStateException("execution returned was not a success"); } return Optional.empty(); }

Target:
public Optional<JobExecution.Success<Report.Result>> getLastSuccess(final UUID jobId, final Organization organization) throws NoSuchElementException { assertIsOpen(); final Optional<ReportExecution> row = _ebeanServer.find(ReportExecution.class) .orderBy() .desc("completed_at") .where() .eq("report.uuid", jobId) .eq("report.organization.uuid", organization.getId()) .eq("state", ReportExecution.State.SUCCESS) .setMaxRows(1) .findOneOrEmpty(); if (row.isPresent()) { final JobExecution<Report.Result> execution = toInternalModel(row.get()); if (execution instanceof JobExecution.Success) { return Optional.of((JobExecution.Success<Report.Result>) execution); } throw new IllegalStateException( String.format("execution returned was not a success when specified by the query: %s", row.get()) ); } return Optional.empty(); }