auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testRenameRSGroup() throws Exception { RSGroupInfo oldgroup = addGroup("oldgroup", 2); TableName tb = TableName.valueOf("testRename"); TEST_UTIL.createTable(tb, "tr"); ADMIN.setRSGroup(Sets.newHashSet(tb), oldgroup.getName()); Thread.sleep(500); oldgroup = ADMIN.getRSGroup(oldgroup.getName()); assertEquals(2, oldgroup.getServers().size()); assertEquals(oldgroup.getName(), ADMIN.getRSGroup(tb).getName()); ADMIN.renameRSGroup(oldgroup.getName(), "newgroup"); Set<Address> servers = oldgroup.getServers(); RSGroupInfo newgroup = ADMIN.getRSGroup("newgroup"); assertEquals(servers.size(), newgroup.getServers().size()); int match = 0; for (Address addr : newgroup.getServers()) { if (servers.contains(addr)) { match++; } } assertEquals(servers.size(), match); assertEquals(newgroup.getName(), ADMIN.getRSGroup(tb).getName()); }

Target:
public void testRenameRSGroup() throws Exception { RSGroupInfo oldgroup = addGroup("oldgroup", 2); TableName tb1 = TableName.valueOf("testRename"); TEST_UTIL.createTable(tb1, "tr"); ADMIN.setRSGroup(Sets.newHashSet(tb1), oldgroup.getName()); TEST_UTIL.waitFor(1000, (Waiter.Predicate<Exception>) () -> ADMIN.getRSGroup(tb1).getServers().size() == 2); oldgroup = ADMIN.getRSGroup(oldgroup.getName()); assertEquals(2, oldgroup.getServers().size()); assertEquals(oldgroup.getName(), ADMIN.getRSGroup(tb1).getName()); RSGroupInfo normal = addGroup("normal", 1); TableName tb2 = TableName.valueOf("unmovedTable"); TEST_UTIL.createTable(tb2, "ut"); ADMIN.setRSGroup(Sets.newHashSet(tb2), normal.getName()); TEST_UTIL.waitFor(1000, (Waiter.Predicate<Exception>) () -> ADMIN.getRSGroup(tb2).getServers().size() == 1); normal = ADMIN.getRSGroup(normal.getName()); assertEquals(1, normal.getServers().size()); assertEquals(normal.getName(), ADMIN.getRSGroup(tb2).getName()); ADMIN.renameRSGroup(oldgroup.getName(), "newgroup"); Set<Address> servers = oldgroup.getServers(); RSGroupInfo newgroup = ADMIN.getRSGroup("newgroup"); assertEquals(servers.size(), newgroup.getServers().size()); int match = 0; for (Address addr : newgroup.getServers()) { if (servers.contains(addr)) { match++; } } assertEquals(servers.size(), match); assertEquals(newgroup.getName(), ADMIN.getRSGroup(tb1).getName()); assertEquals(normal.getName(), ADMIN.getRSGroup(tb2).getName()); }
Source:
public UpdateContainerOptions versionsLocation(String containerName) { this.headers.put(CONTAINER_VERSIONS_LOCATION, containerName); return this; }

Target:
public UpdateContainerOptions versionsLocation(String containerName) { this.headers.put(VERSIONS_LOCATION, containerName); return this; }
Source:
protected List<PRPAIN201306UV02MFMIMT700711UV01Subject1> getSubjects(PRPAIN201306UV02 response) { List<PRPAIN201306UV02MFMIMT700711UV01Subject1> subjects = null; if (response != null && response.getControlActProcess() != null) { subjects = response.getControlActProcess().getSubject(); } return subjects; }

Target:
protected List<PRPAIN201306UV02MFMIMT700711UV01Subject1> getSubjects(PRPAIN201306UV02 response) { List<PRPAIN201306UV02MFMIMT700711UV01Subject1> subjects = new ArrayList<PRPAIN201306UV02MFMIMT700711UV01Subject1>(); if (response != null && response.getControlActProcess() != null) { subjects = response.getControlActProcess().getSubject(); } return subjects; }
Source:
public static void writeMetadataFile(String jobName, String jobId, String containerId, Optional<String> execEnvContainerId, Config config) { Optional<File> metadataFile = JobConfig.getMetadataFile(execEnvContainerId.orElse(null)); if (metadataFile.isPresent()) { MetricsHeader metricsHeader = new MetricsHeader(jobName, jobId, "samza-container-" + containerId, execEnvContainerId.orElse(""), LocalContainerRunner.class.getName(), Util.getTaskClassVersion(config), Util.getSamzaVersion(), Util.getLocalHost().getHostName(), System.currentTimeMillis(), System.currentTimeMillis(), config); class MetadataFileContents { public final String version; public final String metricsSnapshot; public MetadataFileContents(String version, String metricsSnapshot) { this.version = version; this.metricsSnapshot = metricsSnapshot; } } MetricsSnapshot metricsSnapshot = new MetricsSnapshot(metricsHeader, new Metrics()); MetadataFileContents metadataFileContents = new MetadataFileContents("1", new String(new MetricsSnapshotSerdeV2().toBytes(metricsSnapshot))); new FileUtil().writeToTextFile(metadataFile.get(), new String(new JsonSerde<>().toBytes(metadataFileContents)), false); } else { log.info("Skipping writing metadata file."); } }

Target:
public static void writeMetadataFile(String jobName, String jobId, String containerId, Optional<String> execEnvContainerId, Config config) { Optional<File> metadataFile = JobConfig.getMetadataFile(execEnvContainerId.orElse(null)); if (metadataFile.isPresent()) { MetricsHeader metricsHeader = new MetricsHeader(jobName, jobId, "samza-container-" + containerId, execEnvContainerId.orElse(""), LocalContainerRunner.class.getName(), Util.getTaskClassVersion(config), Util.getSamzaVersion(), Util.getLocalHost().getHostName(), System.currentTimeMillis(), System.currentTimeMillis()); class MetadataFileContents { public final String version; public final String metricsSnapshot; public MetadataFileContents(String version, String metricsSnapshot) { this.version = version; this.metricsSnapshot = metricsSnapshot; } } MetricsSnapshot metricsSnapshot = new MetricsSnapshot(metricsHeader, new Metrics()); MetadataFileContents metadataFileContents = new MetadataFileContents("1", new String(new MetricsSnapshotSerdeV2().toBytes(metricsSnapshot))); new FileUtil().writeToTextFile(metadataFile.get(), new String(new JsonSerde<>().toBytes(metadataFileContents)), false); } else { log.info("Skipping writing metadata file."); } }
Source:
Set<File> collect(IMavenProjectFacade projectFacade, IProgressMonitor monitor) { logger.debug("{}: Collecting files for project {}", getName(), projectFacade.getProject()); Set<File> files = new HashSet<>(); if (!isValid(projectFacade.getProject())) { logger.debug("{}: Project determined invalid", getName(), projectFacade.getProject()); return files; } try { MavenBndrunContainer mavenBndrunContainer = MavenBndrunContainer.getBndrunContainer(projectFacade, null, true, true, allScopes, monitor); MapStream.of(mavenBndrunContainer.resolve() .entrySet()) .mapToObj((f, a) -> new MavenFile(f, a.getArtifact() .getGroupId(), a.getArtifact() .getArtifactId(), a.getArtifact() .getVersion(), "jar", a .getArtifact() .getClassifier(), getFrom( a))) .forEach(files::add); logger.debug("{}: Collected files for project {}", getName(), files, projectFacade.getProject()); } catch (Exception e) { logger.error("{}: Failed to collect files for project {}", getName(), projectFacade.getProject(), e); } return files; }

Target:
Set<Artifact> collect(IMavenProjectFacade projectFacade, IProgressMonitor monitor) { logger.debug("{}: Collecting files for project {}", getName(), projectFacade.getProject()); Set<Artifact> files = new HashSet<>(); if (!isValid(projectFacade.getProject())) { logger.debug("{}: Project determined invalid", getName(), projectFacade.getProject()); return files; } try { MavenBndrunContainer mavenBndrunContainer = MavenBndrunContainer.getBndrunContainer(projectFacade, null, true, true, allScopes, monitor); mavenBndrunContainer.resolve() .values() .stream() .map( this::fromArtifactResult) .forEach(files::add); logger.debug("{}: Collected artifacts for project {}", getName(), files, projectFacade.getProject()); } catch (Exception e) { logger.error("{}: Failed to collect artifacts for project {}", getName(), projectFacade.getProject(), e); } return files; }
Source:
public Set<KProperty<?>> build() { final Set<KProperty<?>> indexElements = new HashSet<>(); for (IndexElementsGenerator generator : generators) { addIndexElements(indexElements, generator); } indexElements.add(new KProperty<String>() { @Override public String getName() { return FullFileNameIndexTerm.TERM; } @Override public String getValue() { return fileName; } @Override public boolean isSearchable() { return true; } }); indexElements.add(new KProperty<String>() { @Override public String getName() { return FieldFactory.FILE_NAME_FIELD_SORTED; } @Override public String getValue() { return fileName.toLowerCase(); } @Override public boolean isSearchable() { return false; } @Override public boolean isSortable() { return true; } }); if (project != null && project.getRootPath() != null) { final String projectRootUri = project.getRootPath().toURI(); indexElements.add(new KProperty<String>() { @Override public String getName() { return ProjectRootPathIndexTerm.TERM; } @Override public String getValue() { return projectRootUri; } @Override public boolean isSearchable() { return true; } }); final String projectName = project.getProjectName(); if (projectName != null) { indexElements.add(new KProperty<String>() { @Override public String getName() { return ProjectNameIndexTerm.TERM; } @Override public String getValue() { return projectName; } @Override public boolean isSearchable() { return true; } }); } } if (pkgName == null) { pkgName = pkg.getPackageName(); } if (pkg != null) { indexElements.add(new KProperty<String>() { @Override public String getName() { return PackageNameIndexTerm.TERM; } @Override public String getValue() { return pkgName; } @Override public boolean isSearchable() { return true; } }); } return indexElements; }

Target:
public Set<KProperty<?>> build() { final Set<KProperty<?>> indexElements = new HashSet<>(); generators.forEach((generator) -> addIndexElements(indexElements, generator)); indexElements.add(new KPropertyImpl<>(FullFileNameIndexTerm.TERM, fileName)); indexElements.add(new KPropertyImpl<>(FieldFactory.FILE_NAME_FIELD_SORTED, fileName.toLowerCase(), false, true)); if (project != null && project.getRootPath() != null) { final String projectRootUri = project.getRootPath().toURI(); indexElements.add(new KPropertyImpl<>(ProjectRootPathIndexTerm.TERM, projectRootUri)); final String projectName = project.getProjectName(); if (projectName != null) { indexElements.add(new KPropertyImpl<>(ProjectNameIndexTerm.TERM, projectName)); } } if (pkgName == null) { pkgName = pkg.getPackageName(); } if (pkgName != null) { indexElements.add(new KPropertyImpl<>(PackageNameIndexTerm.TERM, pkgName)); } return indexElements; }
Source:
public void completeRadiologyReport_shouldSetTheRadiologyReportStatusToComplete() throws Exception { RadiologyReport existingRadiologyReport = radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID); Provider existingProvider = existingRadiologyReport.getProvider(); RadiologyReport radiologyReport = radiologyService .completeRadiologyReport(existingRadiologyReport, existingProvider); assertNotNull(radiologyReport); assertThat(radiologyReport.getRadiologyReportStatus(), is(RadiologyReportStatus.COMPLETED)); }

Target:
public void completeRadiologyReport_shouldSetTheRadiologyReportStatusToComplete() throws Exception { RadiologyReport radiologyReport = radiologyService.completeRadiologyReport(radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID), radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID).getPrincipalResultsInterpreter()); assertNotNull(radiologyReport); assertThat(radiologyReport.getReportStatus(), is(RadiologyReportStatus.COMPLETED)); }
Source:
public void update(ViewerCell cell) { Object element = cell.getElement(); if (cell.getColumnIndex() == 0) { cell.setImage(getColumnImage(element, cell.getColumnIndex())); cell.setText(getColumnText(element, cell.getColumnIndex())); } else { if (cell.getColumnIndex() == 3) { cell.setText(getColumnText(element, cell.getColumnIndex())); } else { cell.setImage(getColumnImage(element, cell.getColumnIndex())); } } }

Target:
public void update(ViewerCell cell) { Object element = cell.getElement(); int columnNumber = cell.getColumnIndex(); if (columnNumber == 0) { cell.setImage(getColumnImage(element, cell.getColumnIndex())); cell.setText(getColumnText(element, cell.getColumnIndex())); } else { if (columnNumber == 3) { cell.setText(getColumnText(element, cell.getColumnIndex())); } else { cell.setImage(getColumnImage(element, cell.getColumnIndex())); } } }
Source:
public static void fixHardcore() { Minecraft mc = Minecraft.getInstance(); IntegratedServer server = ((IntegratedServer) ServerLifecycleHooks.getCurrentServer()); if(server != null) { server.addScheduledTask(() -> { String ownerName = server.getServerOwner(); EntityPlayerMP owner = server.getPlayerList().getPlayerByUsername(ownerName); owner.setGameType(GameType.NOT_SET); mc.world.sendQuittingDisconnectingPacket(); }); } else { mc.world.sendQuittingDisconnectingPacket(); } while(mc.getConnection().getNetworkManager().isChannelOpen()) mc.loadWorld(null); }

Target:
public static void fixHardcore() { Minecraft mc = Minecraft.getInstance(); IntegratedServer server = ((IntegratedServer) ServerLifecycleHooks.getCurrentServer()); if(server != null) { server.addScheduledTask(() -> { String ownerName = server.getServerOwner(); EntityPlayerMP owner = server.getPlayerList().getPlayerByUsername(ownerName); owner.setGameType(GameType.NOT_SET); owner.connection.disconnect(new TextComponentTranslation("deathScreen.title.hardcore")); }); } else { mc.world.sendQuittingDisconnectingPacket(); } while(mc.getConnection().getNetworkManager().isChannelOpen()) mc.loadWorld(null); }
Source:
public <S extends T> S findOne(Example<S> example) { Assert.notNull(example); WherePath selectFrom = N1qlUtils.createSelectFromForEntity(getCouchbaseOperations().getCouchbaseBucket().name()); Expression whereCriteria = N1qlUtils.createWhereFilterByExampleForEntity(null, getCouchbaseOperations().getConverter(), getEntityInformation(), example); Statement st = selectFrom.where(whereCriteria).limit(1); ScanConsistency consistency = getCouchbaseOperations().getDefaultConsistency().n1qlConsistency(); N1qlQuery query = N1qlQuery.simple(st, N1qlParams.build().consistency(consistency)); return getCouchbaseOperations().findByN1QL(query, example.getProbeType()).get(0); }

Target:
public <S extends T> S findOne(Example<S> example) { Assert.notNull(example); WherePath selectFrom = N1qlUtils.createSelectFromForEntity(getCouchbaseOperations().getCouchbaseBucket().name()); Expression whereCriteria = N1qlUtils.createWhereFilterByExampleForEntity(null, getCouchbaseOperations().getConverter(), getEntityInformation(), example); Statement st = selectFrom.where(whereCriteria).limit(1); ScanConsistency consistency = getCouchbaseOperations().getDefaultConsistency().n1qlConsistency(); N1qlQuery query = N1qlQuery.simple(st, N1qlParams.build().consistency(consistency)); List<S> result = getCouchbaseOperations().findByN1QL(query, example.getProbeType()); return result.size() > 0 ? result.get(0) : null; }
Source:
public void setPriority(boolean priority) { if (priority) { Assert.isInstanceOf(ChannelPriorityMessageStore.class, this.messageGroupStore); } }

Target:
public void setPriority(boolean priority) { if (priority) { Assert.isInstanceOf(PriorityCapableChannelMessageStore.class, this.messageGroupStore); Assert.isTrue(((PriorityCapableChannelMessageStore) this.messageGroupStore).isPriorityEnabled(), "When using priority, the 'PriorityCapableChannelMessageStore' must have priority enabled."); } else { if (logger.isWarnEnabled() && this.messageGroupStore instanceof PriorityCapableChannelMessageStore && ((PriorityCapableChannelMessageStore) this.messageGroupStore).isPriorityEnabled()) { logger.warn("It's not recommended to use a priority-based message store " + "when declaring a non-priority 'MessageGroupQueue'; message retrieval may not be FIFO; " + "set 'priority' to 'true' if that is your intent. If you are using the namespace to " + "define a channel, use '<priority-queue message-store.../> instead."); } } }
Source:
public void processRelation(ReaderRelation relation) { if (relation.hasTag("type", "restriction")) { List<OSMTurnRelation> turnRelations = createTurnRelation(relation); for (OSMTurnRelation turnRelation : turnRelations) { if (turnRelation != null) { GraphExtension extendedStorage = graph.getExtension(); if (extendedStorage instanceof TurnCostExtension) { TurnCostExtension tcs = (TurnCostExtension) extendedStorage; Collection<TurnCostTableEntry> entries = analyzeTurnRelation(turnRelation); for (TurnCostTableEntry entry : entries) { tcs.addTurnInfo(entry.edgeFrom, entry.nodeVia, entry.edgeTo, entry.flags); } } } } } }

Target:
public void processRelation(ReaderRelation relation) { if (relation.hasTag("type", "restriction")) { GraphExtension extendedStorage = graph.getExtension(); if (extendedStorage instanceof TurnCostExtension) { TurnCostExtension tcs = (TurnCostExtension) extendedStorage; List<OSMTurnRelation> turnRelations = createTurnRelations(relation); for (OSMTurnRelation turnRelation : turnRelations) { Collection<TurnCostTableEntry> entries = analyzeTurnRelation(turnRelation); for (TurnCostTableEntry entry : entries) { tcs.addTurnInfo(entry.edgeFrom, entry.nodeVia, entry.edgeTo, entry.flags); } } } } }
Source:
public boolean stop(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException { JobExecution jobExecution = findExecutionById(executionId); BatchStatus status = jobExecution.getStatus(); if (!(status == BatchStatus.STARTED || status == BatchStatus.STARTING)) { throw new JobExecutionNotRunningException("JobExecution must be running so that it can be stopped: "+jobExecution); } jobExecution.setStatus(BatchStatus.STOPPING); jobRepository.update(jobExecution); try { Job job = jobRegistry.getJob(jobExecution.getJobInstance().getJobName()); if (job instanceof StepLocator) { for (StepExecution stepExecution : jobExecution.getStepExecutions()) { if (stepExecution.getStatus().isRunning()) { try { Step step = ((StepLocator)job).getStep(stepExecution.getStepName()); if (step instanceof TaskletStep) { Tasklet tasklet = ((TaskletStep)step).getTasklet(); if (tasklet instanceof StoppableTasklet) { StepSynchronizationManager.register(stepExecution); ((StoppableTasklet)tasklet).stop(); StepSynchronizationManager.release(); } } } catch (NoSuchStepException e) { logger.warn("Step not found",e); } } } } } catch (NoSuchJobException e) { logger.warn("Cannot find Job object in the job registry",e); } return true; }

Target:
public boolean stop(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException { JobExecution jobExecution = findExecutionById(executionId); BatchStatus status = jobExecution.getStatus(); if (!(status == BatchStatus.STARTED || status == BatchStatus.STARTING)) { throw new JobExecutionNotRunningException("JobExecution must be running so that it can be stopped: "+jobExecution); } jobExecution.setStatus(BatchStatus.STOPPING); jobRepository.update(jobExecution); try { Job job = jobRegistry.getJob(jobExecution.getJobInstance().getJobName()); if (job instanceof StepLocator) { for (StepExecution stepExecution : jobExecution.getStepExecutions()) { if (stepExecution.getStatus().isRunning()) { try { Step step = ((StepLocator)job).getStep(stepExecution.getStepName()); if (step instanceof TaskletStep) { Tasklet tasklet = ((TaskletStep)step).getTasklet(); if (tasklet instanceof StoppableTasklet) { StepSynchronizationManager.register(stepExecution); ((StoppableTasklet)tasklet).stop(); StepSynchronizationManager.release(); } } } catch (NoSuchStepException e) { logger.warn("Step not found",e); } } } } } catch (NoSuchJobException e) { logger.warn("Cannot find Job object in the job registry. StoppableTasklet#stop() will not be called",e); } return true; }
Source:
public int doOnePhaseCommit () { int status = super.status(); if (status == ActionStatus.ABORT_ONLY || doBeforeCompletion()) { status = super.End(true); switch (super.getHeuristicDecision()) { case TwoPhaseOutcome.PREPARE_OK: case TwoPhaseOutcome.FINISH_OK: if (super.failedList != null && super.failedList.size() > 0) { return ActionStatus.H_COMMIT; } default: break; } } else { status = ActionStatus.ABORTED; } afterCompletion(status); TransactionReaper.transactionReaper().remove(this); return status; }

Target:
public int doOnePhaseCommit () { int status = super.status(); if (status == ActionStatus.ABORT_ONLY || doBeforeCompletion()) { status = super.End(true); switch (super.getHeuristicDecision()) { case TwoPhaseOutcome.PREPARE_OK: case TwoPhaseOutcome.FINISH_OK: if (super.failedList != null && super.failedList.size() > 0) { status = ActionStatus.H_COMMIT; } default: break; } } else { status = ActionStatus.ABORTED; } afterCompletion(status); TransactionReaper.transactionReaper().remove(this); return status; }
Source:
protected void insertOrUpdateEntity() throws IOException { if (isNewEntity) { try { CrudResponse response = bullhornRestApi.insertEntity((CreateEntity) entity); checkForRestSdkErrorMessages(response); entityID = response.getChangedEntityId(); entity.setId(entityID); if (entity.getClass() == ClientCorporation.class) { handleDefaultContactExternalId(entityID); } } catch (RestApiException e) { checkForRequiredFieldsError(e); } } else { CrudResponse response = bullhornRestApi.updateEntity((UpdateEntity) entity); checkForRestSdkErrorMessages(response); } }

Target:
protected void insertOrUpdateEntity() throws IOException { if (isNewEntity) { try { CrudResponse response = bullhornRestApi.insertEntity((CreateEntity) entity); checkForRestSdkErrorMessages(response); entityID = response.getChangedEntityId(); entity.setId(entityID); if (entity.getClass() == ClientCorporation.class) { setDefaultContactExternalId(entityID); } } catch (RestApiException e) { checkForRequiredFieldsError(e); } } else { CrudResponse response = bullhornRestApi.updateEntity((UpdateEntity) entity); checkForRestSdkErrorMessages(response); } }
Source:
public boolean incrementToken() throws IOException { if (!input.incrementToken()) { return false; } String thisToken = termAtt.toString(); if (highSurrogatePattern.matcher(thisToken).matches()) { highSurrogate = termAtt.buffer()[0]; highSurrogateStart = offsetAtt.startOffset(); termAtt.setEmpty(); offsetAtt.setOffset(highSurrogateStart, highSurrogateStart); posIncr.setPositionIncrement(1); } else if (lowSurrogatePattern.matcher(thisToken).matches()) { termAtt.setEmpty(); if (highSurrogate == null) { offsetAtt.setOffset(offsetAtt.startOffset(), offsetAtt.startOffset()); posIncr.setPositionIncrement(1); } else { termAtt.append(highSurrogate).append(thisToken); offsetAtt.setOffset(highSurrogateStart, offsetAtt.endOffset()); posIncr.setPositionIncrement(1); } highSurrogate = null; } else { highSurrogate = null; } return true; }

Target:
public boolean incrementToken() throws IOException { if (!input.incrementToken()) { return false; } String thisToken = termAtt.toString(); if (thisToken.length() == 1 && Character.isHighSurrogate(termAtt.buffer()[0])) { char highSurrogate = termAtt.buffer()[0]; int highSurrogateStart = offsetAtt.startOffset(); if (!input.incrementToken()) { return true; } thisToken = termAtt.toString(); if (thisToken.length() == 1 && Character.isLowSurrogate(termAtt.buffer()[0])) { termAtt.setEmpty(); termAtt.append(highSurrogate).append(thisToken); offsetAtt.setOffset(highSurrogateStart, offsetAtt.endOffset()); posIncr.setPositionIncrement(1); } } return true; }
Source:
public MyCustomCacheStore() { try { TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) { throw new AssertionError("Got interrupted exception", e); } }

Target:
public MyCustomCacheStore() { try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { fail("This thread shouldn't get interrupted; " + e.getMessage()); } }
Source:
public void clear() { while (getRowCount() != 0) { removeRow(0); } }

Target:
public void clear() { rowData.clear(); fireTableDataChanged(); }
Source:
ParallaxEngine() { super(); renderer = new LondonParallaxWallpaperRenderer(LondonParallaxWallpaper.this.getAssets()); setRenderer(renderer); ENDERMODE_WHEN_DIRTY if not showing snow setRenderMode(RENDERMODE_WHEN_DIRTY); initLayers(); requestRender(); }

Target:
ParallaxEngine() { super(); renderer = new LondonParallaxWallpaperRenderer(LondonParallaxWallpaper.this.getAssets()); setRenderer(renderer); setRenderMode(RENDERMODE_WHEN_DIRTY); initLayers(); requestRender(); }
Source:
public Iterator<Note> iterator() { try { return new Iterator<Note>() { private Iterator<Note> itr = root == null ? null : root .iterator(new MutableObjectId(), reader); public boolean hasNext() { if (itr == null) return true; return itr.hasNext(); } public Note next() { return itr.next(); } public void remove() { throw new UnsupportedOperationException(); } }; } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public Iterator<Note> iterator() { try { return root.iterator(new MutableObjectId(), reader); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
private int getInfixPrecedence(Token token) { switch (token.getType()) { case SEMICOLON: return Precedence.SHORTER_DISJUNCTION; case AND: case QUALIFIER: case SYMBOL: case LBRACKET: return Precedence.CONJUNCTION; case OR: return Precedence.DISJUNCTION; case NOT: return Precedence.PREFIX; default: return 0; } }

Target:
private int getInfixPrecedence(Token token) { switch (token.getType()) { case AND: case QUALIFIER: case SYMBOL: case LBRACKET: return Precedence.CONJUNCTION; case OR: return Precedence.DISJUNCTION; case NOT: return Precedence.PREFIX; default: return 0; } }
Source:
public int cleanupOldCheckIns() { String hql = "SELECT cc1.id FROM CheckIn cc1 WHERE cc1.checkInTime != (" + "SELECT MAX(cc2.checkInTime) " + "FROM CheckIn cc2 " + "WHERE cc2.consumer = cc1.consumer)"; Query q = currentSession().createQuery(hql); q.setMaxResults(DELETE_BATCH_SIZE); List<String> checkInIds = q.list(); int totalDeleted = 0; int totalQueries = 1; while (checkInIds.size() > 0) { log.debug("Found check-in IDs to be deleted.", checkInIds.size()); String deleteHql = "DELETE from CheckIn where id in (:deleteIds)"; Query deleteQuery = currentSession().createQuery(deleteHql); deleteQuery.setParameterList("deleteIds", checkInIds); totalDeleted += deleteQuery.executeUpdate(); checkInIds = q.list(); totalQueries += 2; } log.info("Deleted a total of consumer check-in times with queries.", totalDeleted, totalQueries); return totalDeleted; }

Target:
public int cleanupOldCheckIns() { String hql = "SELECT cc1.id FROM CheckIn cc1 WHERE cc1.checkInTime != (" + "SELECT MAX(cc2.checkInTime) " + "FROM CheckIn cc2 " + "WHERE cc2.consumer = cc1.consumer)"; Query q = currentSession().createQuery(hql); q.setMaxResults(DELETE_BATCH_SIZE); List<String> checkInIds = q.list(); int totalDeleted = 0; int totalQueries = 1; String deleteHql = "DELETE from CheckIn where id in (:deleteIds)"; Query deleteQuery = currentSession().createQuery(deleteHql); while (checkInIds.size() > 0) { log.debug("Found check-in IDs to be deleted.", checkInIds.size()); deleteQuery.setParameterList("deleteIds", checkInIds); totalDeleted += deleteQuery.executeUpdate(); checkInIds = q.list(); totalQueries += 2; } log.info("Deleted a total of consumer check-in times with queries.", totalDeleted, totalQueries); return totalDeleted; }
Source:
public int available() { throw new UnsupportedOperationException("this operation is not supported"); }

Target:
public int available() { return stream.isReceiveReady() ? 1 : 0; }
Source:
public IComparisonScope createMinimizedScope() { minimize(); final ResourceSet leftResourceSet = new NotLoadingResourceSet(leftTraversal); final ResourceSet rightResourceSet = new NotLoadingResourceSet(rightTraversal); final ResourceSet originResourceSet; if (originTraversal == null || originTraversal.getStorages().isEmpty()) { originResourceSet = null; } else { originResourceSet = new NotLoadingResourceSet(originTraversal); } final Set<URI> urisInScope = Sets.newLinkedHashSet(); for (IStorage left : leftTraversal.getStorages()) { urisInScope.add(createURIFor(left)); } for (IStorage right : rightTraversal.getStorages()) { urisInScope.add(createURIFor(right)); } for (IStorage origin : originTraversal.getStorages()) { urisInScope.add(createURIFor(origin)); } final FilterComparisonScope scope = new DefaultComparisonScope(leftResourceSet, rightResourceSet, originResourceSet); scope.setResourceSetContentFilter(isInScope(urisInScope)); return scope; }

Target:
public IComparisonScope createMinimizedScope() { minimize(); final ResourceSet leftResourceSet = new NotLoadingResourceSet(leftTraversal); final ResourceSet rightResourceSet = new NotLoadingResourceSet(rightTraversal); final ResourceSet originResourceSet; if (originTraversal == null || originTraversal.getStorages().isEmpty()) { originResourceSet = null; } else { originResourceSet = new NotLoadingResourceSet(originTraversal); } final Set<URI> urisInScope = Sets.newLinkedHashSet(); for (IStorage left : leftTraversal.getStorages()) { urisInScope.add(createURIFor(left)); } for (IStorage right : rightTraversal.getStorages()) { urisInScope.add(createURIFor(right)); } if (originTraversal != null) { for (IStorage origin : originTraversal.getStorages()) { urisInScope.add(createURIFor(origin)); } } final FilterComparisonScope scope = new DefaultComparisonScope(leftResourceSet, rightResourceSet, originResourceSet); scope.setResourceSetContentFilter(isInScope(urisInScope)); return scope; }
Source:
public void verifyBasicResponse() { String expected = "{\"data\":" + "{\"book\":" + "{\"edges\":" + "[{\"node\":" + "{\"id\":\"1\"," + "\"title\":\"My first book\"," + "\"authors\":{\"edges\":[{\"node\":{" + "\"name\":\"Ricky Carmichael\"}}]}}}]}}}"; String actual = document( selection( field( RESPONSE, "book", selections( field("id", "1"), field("title", "My first book"), field( RESPONSE, "authors", selection( field("name", "Ricky Carmichael") ) ) ) ) ) ).toResponse(); Assert.assertEquals(actual, expected); }

Target:
public void verifyBasicResponse() { String expected = "{\"data\":" + "{\"book\":" + "{\"edges\":" + "[{\"node\":" + "{\"id\":\"1\"," + "\"title\":\"My first book\"," + "\"authors\":{\"edges\":[{\"node\":{" + "\"name\":\"Ricky Carmichael\"}}]}}}]}}}"; String actual = document( selection( field( "book", selections( field("id", "1"), field("title", "My first book"), field( "authors", selection( field("name", "Ricky Carmichael") ) ) ) ) ) ).toResponse(); assertEquals(expected, actual); }
Source:
public static Disk map(org.ovirt.engine.core.common.businessentities.Disk entity, Disk template) { Disk model = template != null ? template : new Disk(); model.setName(entity.getDiskAlias()); model.setAlias(entity.getDiskAlias()); if (entity.getId() != null) { model.setId(entity.getId().toString()); } if (entity.getDiskInterface() != null) { model.setInterface(map(entity.getDiskInterface(), null)); } model.setBootable(entity.isBoot()); model.setPropagateErrors(PropagateErrors.On == entity.getPropagateErrors()); model.setWipeAfterDelete(entity.isWipeAfterDelete()); model.setActive(entity.getPlugged()); model.setReadOnly(entity.getReadOnly()); model.setShareable(entity.isShareable()); model.setDescription(entity.getDiskDescription()); model.setLogicalName(entity.getLogicalName()); if (entity.getDiskStorageType() == DiskStorageType.IMAGE) { mapDiskImageToDiskFields((DiskImage) entity, model); } else { model.setLunStorage(StorageLogicalUnitMapper.map(((LunDisk) entity).getLun(), new Storage())); if (entity.getSgio() != null && entity.getDiskInterface() == map(DiskInterface.VIRTIO_SCSI, null)) { model.setSgio(map(entity.getSgio(), null)); model.setUsesScsiReservation(((LunDisk)entity).isUsingScsiReservation()); } } return model; }

Target:
public static Disk map(org.ovirt.engine.core.common.businessentities.Disk entity, Disk template) { Disk model = template != null ? template : new Disk(); model.setName(entity.getDiskAlias()); model.setAlias(entity.getDiskAlias()); if (entity.getId() != null) { model.setId(entity.getId().toString()); } if (entity.getDiskInterface() != null) { model.setInterface(map(entity.getDiskInterface(), null)); } model.setBootable(entity.isBoot()); model.setPropagateErrors(PropagateErrors.On == entity.getPropagateErrors()); model.setWipeAfterDelete(entity.isWipeAfterDelete()); model.setActive(entity.getPlugged()); model.setReadOnly(entity.getReadOnly()); model.setShareable(entity.isShareable()); model.setDescription(entity.getDiskDescription()); model.setLogicalName(entity.getLogicalName()); if (entity.getDiskStorageType() == DiskStorageType.IMAGE) { mapDiskImageToDiskFields((DiskImage) entity, model); } else { model.setLunStorage(StorageLogicalUnitMapper.map(((LunDisk) entity).getLun(), new Storage())); model.setUsesScsiReservation(((LunDisk) entity).isUsingScsiReservation()); if (entity.getSgio() != null && entity.getDiskInterface() == map(DiskInterface.VIRTIO_SCSI, null)) { model.setSgio(map(entity.getSgio(), null)); } } return model; }
Source:
List<InputRow> parse(List<byte[]> streamChunk) throws IOException { if (parser != null) { return parseWithParser(parser, streamChunk); } else { return parseWithInputFormat(lazyByteEntityReaderSupplier.get(), streamChunk); } }

Target:
List<InputRow> parse(List<byte[]> streamChunk) throws IOException { if (byteEntityReader != null) { return parseWithInputFormat(byteEntityReader, streamChunk); } else { return parseWithParser(parser, streamChunk); } }
Source:
public String raw() { if (raw == null) { throw new RuntimeException("JSON document has no \"raw\" field"); } return raw; }

Target:
public String raw() { return raw; }
Source:
public void executeAction(final WorkflowProcessor processor, final Map<String, WorkflowActionClassParameter> params) throws WorkflowActionFailureException { final Map<Relationship, List<Contentlet>> contentRelationships = new HashMap<Relationship, List<Contentlet>>(); try { final Contentlet contentlet = processor.getContentlet(); final User user = processor.getUser(); final List<Category > categories = this.categoryAPI.getParents(contentlet, user, false); final List< Permission > permissions = this.permissionAPI.getPermissions(contentlet, false, true); Logger.debug(this, "Saving the content as draft of the contentlet: " + contentlet.getIdentifier()); contentlet.setProperty(Contentlet.WORKFLOW_IN_PROGRESS, Boolean.TRUE); this.buildRelationships(processor.getUser(), contentRelationships, contentlet); this.contentletAPI.saveDraft( processor.getContentlet(), contentRelationships, categories, permissions, user, true); Logger.debug(this, "content draft already saved for the contentlet: " + contentlet.getIdentifier()); } catch (Exception e) { Logger.error(this.getClass(),e.getMessage(),e); throw new WorkflowActionFailureException(e.getMessage()); } }

Target:
public void executeAction(final WorkflowProcessor processor, final Map<String, WorkflowActionClassParameter> params) throws WorkflowActionFailureException { final Map<Relationship, List<Contentlet>> contentRelationships = new HashMap<Relationship, List<Contentlet>>(); try { final Contentlet contentlet = processor.getContentlet(); final User user = processor.getUser(); final List<Category > categories = this.categoryAPI.getParents(contentlet, user, false); final List< Permission > permissions = this.permissionAPI.getPermissions(contentlet, false, true); Logger.debug(this, "Saving the content as draft of the contentlet: " + contentlet.getIdentifier()); contentlet.setProperty(Contentlet.WORKFLOW_IN_PROGRESS, Boolean.TRUE); this.buildRelationships(processor.getUser(), contentRelationships, contentlet); final Contentlet contentletNew = this.contentletAPI.saveDraft( contentlet, contentRelationships, categories, permissions, user, true); processor.setContentlet(contentletNew); Logger.debug(this, "content draft already saved for the contentlet: " + contentlet.getIdentifier()); } catch (Exception e) { Logger.error(this.getClass(),e.getMessage(),e); throw new WorkflowActionFailureException(e.getMessage()); } }
Source:
public void contextInitialized(ServletContextEvent sce) { ServletContext ctx = sce.getServletContext(); RelationshipCheckerRegistry.registerRelationshipChecker(new InfoContentEntityChecker()); RelationshipCheckerRegistry.registerRelationshipChecker(new GrantChecker()); RelationshipCheckerRegistry.registerRelationshipChecker(new ProjectOrServiceChecker()); RelationshipCheckerRegistry.registerRelationshipChecker(new PresentationChecker()); RelationshipCheckerRegistry.registerRelationshipChecker(new CourseChecker()); RelationshipCheckerRegistry.registerRelationshipChecker(new AdvisingRelationshipChecker()); }

Target:
public void contextInitialized(ServletContextEvent sce) { RelationshipChecker.getQueryBuilder() .addRelationshipThroughContext(URI_BEARER_OF, URI_ADVISOR_ROLE, URI_RELATED_BY, URI_ADVISING_RELATIONSHIP_TYPE) .addRelationshipThroughContext(URI_BEARER_OF, URI_TEACHER_ROLE_TYPE, URI_REALIZED_IN, URI_COURSE_TYPE) .addRelationshipThroughContext(URI_BEARER_OF, URI_PI_ROLE_TYPE, URI_RELATED_BY, URI_GRANT_TYPE) .addRelationshipThroughContext(URI_BEARER_OF, URI_CO_PI_ROLE_TYPE, URI_RELATED_BY, URI_GRANT_TYPE) .addRelationshipThroughContext(URI_RELATED_BY, URI_AUTHORSHIP_TYPE, URI_RELATES, URI_INFO_CONTENT_TYPE) .addRelationshipThroughContext(URI_RELATED_BY, URI_EDITORSHIP_TYPE, URI_RELATES, URI_INFO_CONTENT_TYPE) .addRelationshipThroughContext(URI_BEARER_OF, URI_PRESENTER_ROLE_TYPE, URI_REALIZED_IN, URI_PRESENTATION_TYPE) .addRelationshipThroughContext(URI_BEARER_OF, URI_CLINICAL_ROLE_TYPE, URI_CONTRIBUTES_TO, URI_PROJECT_TYPE) .addRelationshipThroughContext(URI_BEARER_OF, URI_CLINICAL_ROLE_TYPE, URI_CONTRIBUTES_TO, URI_SERVICE_TYPE) .finish(); }
Source:
private static Long invoke(Method method) { try { return method == null ? null : (Long) method.invoke(ManagementFactory.getOperatingSystemMXBean()); } catch (Throwable throwable) { if (throwable instanceof Error) { throw (Error) throwable; } if (throwable instanceof RuntimeException) { throw (RuntimeException) throwable; } throw new RuntimeException(throwable); } }

Target:
private static Long invoke(Method method) { try { return method == null ? null : (Long) method.invoke(ManagementFactory.getOperatingSystemMXBean()); } catch (IllegalAccessException e) { LOGGER.trace("Error invoking method '{}': {}", method, e.getMessage(), e); return null; } catch (InvocationTargetException e) { LOGGER.trace("Error invoking method '{}': {}", method, e.getTargetException().getMessage(), e.getTargetException()); return null; } }
Source:
public void setElements(Object[] elements) { if (elements == null) { fElements = new Object[0]; } else { fElements = new Object[elements.length]; System.arraycopy(elements, 0, fElements, 0, elements.length); } fList.deselectAll(); int length = fElements.length; fLabels = new Label[length]; Set imageSet = new HashSet(); for (int i = 0; i != length; i++) { String text = fLabelProvider.getText(fElements[i]); Image image = fLabelProvider.getImage(fElements[i]); fLabels[i] = new Label(text, image); imageSet.add(image); } fImages.clear(); fImages.addAll(imageSet); fSorter.sort(fLabels, fElements); fFilteredIndices = new int[length]; fFoldedIndices = new int[length]; updateList(); }

Target:
public void setElements(Object[] elements) { if (elements == null) { fElements = new Object[0]; } else { fElements = new Object[elements.length]; System.arraycopy(elements, 0, fElements, 0, elements.length); } int length = fElements.length; fLabels = new Label[length]; Set imageSet = new HashSet(); for (int i = 0; i != length; i++) { String text = fLabelProvider.getText(fElements[i]); Image image = fLabelProvider.getImage(fElements[i]); fLabels[i] = new Label(text, image); imageSet.add(image); } fList.deselectAll(); fImages.clear(); fImages.addAll(imageSet); fSorter.sort(fLabels, fElements); fFilteredIndices = new int[length]; fFoldedIndices = new int[length]; updateList(); }
Source:
public QueryParameters queryParameters(SqlFieldsQuery qry) { NestedTxMode nestedTxMode = NestedTxMode.DEFAULT; boolean autoCommit = true; List<Object[]> batchedArgs = null; if (qry instanceof SqlFieldsQueryEx) { SqlFieldsQueryEx qry0 = (SqlFieldsQueryEx)qry; if (qry0.getNestedTxMode() != null) nestedTxMode = qry0.getNestedTxMode(); autoCommit = qry0.isAutoCommit(); batchedArgs = qry0.batchedArguments(); } int timeout; if (qry.getTimeout() >= 0) { timeout = qry.getTimeout(); } else { timeout = (int)idx.kernalContext().config().getDefaultQueryTimeout(); A.ensure(timeout >= 0 && timeout <= Integer.MAX_VALUE, "timeout value should be valid Integer."); } return new QueryParameters( qry.getArgs(), qry.getPartitions(), timeout, qry.isLazy(), qry.getPageSize(), null, nestedTxMode, autoCommit, batchedArgs, qry.getUpdateBatchSize() ); }

Target:
public QueryParameters queryParameters(SqlFieldsQuery qry) { NestedTxMode nestedTxMode = NestedTxMode.DEFAULT; boolean autoCommit = true; List<Object[]> batchedArgs = null; if (qry instanceof SqlFieldsQueryEx) { SqlFieldsQueryEx qry0 = (SqlFieldsQueryEx)qry; if (qry0.getNestedTxMode() != null) nestedTxMode = qry0.getNestedTxMode(); autoCommit = qry0.isAutoCommit(); batchedArgs = qry0.batchedArguments(); } int timeout; if (qry.getTimeout() >= 0) timeout = qry.getTimeout(); else timeout = (int)idx.kernalContext().config().getDefaultQueryTimeout(); return new QueryParameters( qry.getArgs(), qry.getPartitions(), timeout, qry.isLazy(), qry.getPageSize(), null, nestedTxMode, autoCommit, batchedArgs, qry.getUpdateBatchSize() ); }
Source:
private void searchAgentJar() { File agentJar = null; try { URL entry = org.jboss.tools.jmx.jvmmonitor.core.Activator.getDefault().getBundle() .getEntry(IConstants.JVMMONITOR_AGENT_JAR); URL entryFileUrl = FileLocator.toFileURL(entry); URI entryFileURI = new URI(entryFileUrl.getProtocol(), null, entryFileUrl.getPath(), null); agentJar = new File(entryFileURI); } catch (IOException e) { Activator.log(IStatus.ERROR, Messages.corePluginNoFoundMsg, new Exception(e)); return; } catch (URISyntaxException e) { Activator.log(IStatus.ERROR, Messages.corePluginNoFoundMsg, new Exception(e)); return; } if( agentJar != null ) { agentJarPath = agentJar.getAbsolutePath(); if (!agentJar.exists()) { Activator.log( IStatus.ERROR, NLS.bind(Messages.agentJarNotFoundMsg, agentJar.getAbsolutePath()), new Exception()); } else { Activator.log(IStatus.INFO, NLS.bind(Messages.agentJarFoundMsg, agentJarPath), new Exception()); } } }

Target:
private void searchAgentJar() { File agentJar = null; try { URL entry = org.jboss.tools.jmx.jvmmonitor.core.Activator.getDefault().getBundle() .getEntry(IConstants.JVMMONITOR_AGENT_JAR); URL entryFileUrl = FileLocator.toFileURL(entry); agentJar = new File(entryFileUrl.getPath()); } catch (IOException e) { Activator.log(IStatus.ERROR, Messages.corePluginNoFoundMsg, new Exception(e)); return; } if( agentJar != null ) { agentJarPath = agentJar.getAbsolutePath(); if (!agentJar.exists()) { Activator.log( IStatus.ERROR, NLS.bind(Messages.agentJarNotFoundMsg, agentJar.getAbsolutePath()), new Exception()); } else { Activator.log(IStatus.INFO, NLS.bind(Messages.agentJarFoundMsg, agentJarPath), new Exception()); } } }
Source:
public void lowerBoundMismatchTokens() { Map<String, TrackingToken> newTokens = new HashMap<>(); newTokens.put("token1", new GlobalSequenceTrackingToken(1)); newTokens.put("token3", new GlobalSequenceTrackingToken(2)); Map<String, TrackingToken> expectedTokens = new HashMap<>(); expectedTokens.put("token1", new GlobalSequenceTrackingToken(0)); expectedTokens.put("token2", new GlobalSequenceTrackingToken(0)); ; MultiSourceTrackingToken newMultiToken = (MultiSourceTrackingToken) testSubject .lowerBound(new MultiSourceTrackingToken(newTokens)); }

Target:
public void lowerBoundMismatchTokens() { Map<String, TrackingToken> newTokens = new HashMap<>(); newTokens.put("token1", new GlobalSequenceTrackingToken(1)); newTokens.put("token3", new GlobalSequenceTrackingToken(2)); testSubject.lowerBound(new MultiSourceTrackingToken(newTokens)); }
Source:
public void apply(final EntityLocal entity) { new MachineLifecycleEffectorTasks() { @Override protected String startProcessesAtMachine(Supplier<MachineLocation> machineS) { DynamicTasks.queue( SshEffectorTasks.ssh( "mkdir "+dir(entity), "cd "+dir(entity), BashCommands.downloadToStdout(downloadUrl(entity, isLocalhost(machineS)))+" | tar xvz" ).summary("download mysql").returning(SshTasks.returningStdoutLoggingInfo(log, true))); if (isLinux(machineS)) { DynamicTasks.queue(SshEffectorTasks.ssh(BashCommands.installPackage("libaio1"))); } DynamicTasks.queue( SshEffectorTasks.put(".my.cnf") .contents(String.format("[mysqld]\nbasedir=%s/%s\n", dir(entity), installDir(entity, isLocalhost(machineS)))), SshEffectorTasks.ssh( "cd "+dir(entity)+" data data/*.pid")).block().getStdout().trim())); entity().setAttribute(Attributes.SERVICE_UP, true); } @Override protected String stopProcessesAtMachine() { entity().setAttribute(Attributes.SERVICE_UP, true); Integer pid = entity().getAttribute(Attributes.PID); if (pid==null) { log.info("mysql not running"); return "No pid -- is it running?"; } DynamicTasks.queue(SshEffectorTasks.ssh( "cd "+dir(entity)+"/*", "./support-files/mysql.server stop" ).summary("stop mysql")); return "submitted stop"; } }.attachLifecycleEffectors(entity); }

Target:
public void apply(final EntityLocal entity) { new MachineLifecycleEffectorTasks() { @Override protected String startProcessesAtMachine(Supplier<MachineLocation> machineS) { DynamicTasks.queue( SshEffectorTasks.ssh( "mkdir "+dir(entity), "cd "+dir(entity), BashCommands.downloadToStdout(downloadUrl(entity, isLocalhost(machineS)))+" | tar xvz" ).summary("download mysql").returning(SshTasks.returningStdoutLoggingInfo(log, true))); if (isLinux(machineS)) { DynamicTasks.queue(SshEffectorTasks.ssh(BashCommands.installPackage("libaio1"))); } DynamicTasks.queue( SshEffectorTasks.put(".my.cnf") .contents(String.format("[mysqld]\nbasedir=%s/%s\n", dir(entity), installDir(entity, isLocalhost(machineS)))), SshEffectorTasks.ssh( "cd "+dir(entity)+" data data/*.pid")).block().getStdout().trim())); entity().setAttribute(Attributes.SERVICE_UP, true); } @Override protected String stopProcessesAtMachine() { entity().setAttribute(Attributes.SERVICE_UP, false); Integer pid = entity().getAttribute(Attributes.PID); if (pid==null) { log.info("mysql not running"); return "No pid -- is it running?"; } DynamicTasks.queue(SshEffectorTasks.ssh( "cd "+dir(entity)+"/*", "./support-files/mysql.server stop" ).summary("stop mysql")); return "submitted stop"; } }.attachLifecycleEffectors(entity); }
Source:
protected void addPermission(DocumentModel doc) { if (user == null && (Objects.isNull(users) || users.isEmpty()) && email == null) { throw new IllegalParameterException("'users' or 'email' parameters must be set"); } else if (Objects.nonNull(email) && end == null) { throw new IllegalParameterException("'end' parameter must be set when adding a permission for an 'email'"); } ConfigurationService configService = Framework.getService(ConfigurationService.class); if (configService.isBooleanPropertyFalse(ALLOW_VIRTUAL_USER)) { if (Objects.nonNull(user)) { checkUserExistence(user); } if (Objects.nonNull(users) && !users.isEmpty()) { for (String username : users) { checkUserExistence(username); } } } ensureUserListIsUsed(); ACP acp = doc.getACP() != null ? doc.getACP() : new ACPImpl(); Map<String, Serializable> contextData = new HashMap<>(); contextData.put(NOTIFY_KEY, notify); contextData.put(COMMENT_KEY, comment); String creator = session.getPrincipal().getName(); boolean permissionChanged = false; if (blockInheritance) { permissionChanged = acp.blockInheritance(aclName, creator); } for (String username : users) { ACE ace = ACE.builder(username, permission) .creator(creator) .begin(begin) .end(end) .contextData(contextData) .build(); permissionChanged = acp.addACE(aclName, ace) || permissionChanged; } if (permissionChanged) { doc.setACP(acp, true); } }

Target:
protected void addPermission(DocumentModel doc) { ACP acp = doc.getACP() != null ? doc.getACP() : new ACPImpl(); Map<String, Serializable> contextData = new HashMap<>(); contextData.put(NOTIFY_KEY, notify); contextData.put(COMMENT_KEY, comment); String creator = session.getPrincipal().getName(); boolean permissionChanged = false; if (blockInheritance) { permissionChanged = acp.blockInheritance(aclName, creator); } for (String username : users) { ACE ace = ACE.builder(username, permission) .creator(creator) .begin(begin) .end(end) .contextData(contextData) .build(); permissionChanged = acp.addACE(aclName, ace) || permissionChanged; } if (permissionChanged) { doc.setACP(acp, true); } }