auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testAllModulesAreReferencedInConfigFile() throws Exception { final Set<String> modulesReferencedInConfig = CheckUtil.getConfigCheckStyleModules(); final Set<String> moduleNames = CheckUtil.getSimpleNames(CheckUtil.getCheckstyleModules()); moduleNames.remove("JavadocMetadataScraper"); moduleNames.stream().filter(check -> !modulesReferencedInConfig.contains(check)) .forEach(check -> { final String errorMessage = String.format(Locale.ROOT, "%s is not referenced in checkstyle_checks.xml", check); fail(errorMessage); }); }

Target:
public void testAllModulesAreReferencedInConfigFile() throws Exception { final Set<String> modulesReferencedInConfig = CheckUtil.getConfigCheckStyleModules(); final Set<String> moduleNames = CheckUtil.getSimpleNames(CheckUtil.getCheckstyleModules()); moduleNames.removeAll(INTERNAL_MODULES); moduleNames.stream().filter(check -> !modulesReferencedInConfig.contains(check)) .forEach(check -> { final String errorMessage = String.format(Locale.ROOT, "%s is not referenced in checkstyle_checks.xml", check); fail(errorMessage); }); }
Source:
public PersistentBinaryDeque(final String nonce, final File path, VoltLogger logger, final boolean deleteEmpty) throws IOException { EELibraryLoader.loadExecutionEngineLibrary(true); m_path = path; m_nonce = nonce; m_usageSpecificLog = logger; if (!path.exists() || !path.canRead() || !path.canWrite() || !path.canExecute() || !path.isDirectory()) { throw new IOException(path + " is not usable ( !exists || !readable " + "|| !writable || !executable || !directory)"); } parseFiles(deleteEmpty); Instant now = Instant.now(); Map.Entry<Long, PBDSegment> lastEntry = m_segments.lastEntry(); Instant tsLast = lastEntry == null ? now.minusMillis(1) : lastEntry.getValue().created(); Long writeSegmentIndex = lastEntry == null ? 0L : lastEntry.getKey(); String fname = getSegmentFileName(now, tsLast); PBDSegment writeSegment = newSegment( writeSegmentIndex, now, new VoltFile(m_path, fname)); m_segments.put(writeSegmentIndex, writeSegment); writeSegment.openForWrite(true); writeSegment.setFinal(false); if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Segment " + writeSegment.file() + " (final: " + writeSegment.isFinal() + "), has been opened for writing"); } m_numObjects = countNumObjects(); assertions(); }

Target:
public PersistentBinaryDeque(final String nonce, final File path, VoltLogger logger, final boolean deleteEmpty) throws IOException { EELibraryLoader.loadExecutionEngineLibrary(true); m_path = path; m_nonce = nonce; m_usageSpecificLog = logger; if (!path.exists() || !path.canRead() || !path.canWrite() || !path.canExecute() || !path.isDirectory()) { throw new IOException(path + " is not usable ( !exists || !readable " + "|| !writable || !executable || !directory)"); } parseFiles(deleteEmpty); long curId = getNextSegmentId(); Map.Entry<Long, PBDSegment> lastEntry = m_segments.lastEntry(); long prevId = lastEntry == null ? getNextSegmentId() : lastEntry.getValue().segmentId(); Long writeSegmentIndex = lastEntry == null ? 0L : lastEntry.getKey() + 1; String fname = getSegmentFileName(curId, prevId); PBDSegment writeSegment = newSegment( writeSegmentIndex, curId, new VoltFile(m_path, fname)); PBDSegment check = m_segments.put(writeSegmentIndex, writeSegment); if (check != null) { throw new IllegalStateException("Overwriting segment " + writeSegmentIndex); } writeSegment.openForWrite(true); writeSegment.setFinal(false); if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Segment " + writeSegment.file() + " (final: " + writeSegment.isFinal() + "), has been opened for writing"); } m_numObjects = countNumObjects(); assertions(); }
Source:
public void goto_successors() throws Exception { Label label0 = new Label(); Label label1 = new Label(); BytecodeCFGBuilder.BytecodeCFG cfg = new Instructions() .visitVarInsn(Opcodes.ALOAD, 0) .visitJumpInsn(Opcodes.IFNULL, label0) .visitVarInsn(Opcodes.ALOAD, 0) .visitJumpInsn(Opcodes.IFNULL, label1) .visitVarInsn(Opcodes.ALOAD, 0) .visitVarInsn(Opcodes.ALOAD, 0) .visitJumpInsn(Opcodes.IFEQ, label0) .visitInsn(Opcodes.ICONST_0) .visitJumpInsn(Opcodes.GOTO, label1) .visitLabel(label0) .visitInsn(Opcodes.ICONST_1) .visitLabel(label1) .visitInsn(Opcodes.IRETURN) .cfg(); cfg.blocks.forEach(b -> System.out.println(b.printBlock())); assertThat(cfg.blocks.get(6).successors).containsExactly(cfg.blocks.get(4)); }

Target:
public void goto_successors() throws Exception { Label label0 = new Label(); Label label1 = new Label(); BytecodeCFGBuilder.BytecodeCFG cfg = new Instructions() .visitVarInsn(Opcodes.ALOAD, 0) .visitJumpInsn(Opcodes.IFNULL, label0) .visitVarInsn(Opcodes.ALOAD, 0) .visitJumpInsn(Opcodes.IFNULL, label1) .visitVarInsn(Opcodes.ALOAD, 0) .visitVarInsn(Opcodes.ALOAD, 0) .visitJumpInsn(Opcodes.IFEQ, label0) .visitInsn(Opcodes.ICONST_0) .visitJumpInsn(Opcodes.GOTO, label1) .visitLabel(label0) .visitInsn(Opcodes.ICONST_1) .visitLabel(label1) .visitInsn(Opcodes.IRETURN) .cfg(); assertThat(cfg.blocks.get(6).successors).containsExactly(cfg.blocks.get(4)); }
Source:
protected void configure(HttpSecurity http) throws Exception { http .apply(stormpath()).and() .authorizeRequests(); }

Target:
protected void configure(HttpSecurity http) throws Exception { http .apply(stormpath()).and() .authorizeRequests() .antMatchers("/restricted").fullyAuthenticated() .antMatchers("/**").permitAll(); }
Source:
private KafkaAdminClient(AdminClientConfig config, String clientId, Time time, AdminMetadataManager metadataManager, Metrics metrics, KafkaClient client, TimeoutProcessorFactory timeoutProcessorFactory, LogContext logContext) { this.clientId = clientId; this.log = logContext.logger(KafkaAdminClient.class); configureDefaultApiTimeoutMsAndRequestTimeoutMs(config); this.time = time; this.metadataManager = metadataManager; this.metrics = metrics; this.client = client; this.runnable = new AdminClientRunnable(); String threadName = NETWORK_THREAD_PREFIX + " | " + clientId; this.thread = new KafkaThread(threadName, runnable, true); this.timeoutProcessorFactory = (timeoutProcessorFactory == null) ? new TimeoutProcessorFactory() : timeoutProcessorFactory; this.maxRetries = config.getInt(AdminClientConfig.RETRIES_CONFIG); this.retryBackoffMs = config.getLong(AdminClientConfig.RETRY_BACKOFF_MS_CONFIG); config.logUnused(); AppInfoParser.registerAppInfo(JMX_PREFIX, clientId, metrics, time.milliseconds()); log.debug("Kafka admin client initialized"); thread.start(); }

Target:
private KafkaAdminClient(AdminClientConfig config, String clientId, Time time, AdminMetadataManager metadataManager, Metrics metrics, KafkaClient client, TimeoutProcessorFactory timeoutProcessorFactory, LogContext logContext) { this.clientId = clientId; this.log = logContext.logger(KafkaAdminClient.class); this.requestTimeoutMs = config.getInt(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG); this.defaultApiTimeoutMs = configureDefaultApiTimeoutMs(config); this.time = time; this.metadataManager = metadataManager; this.metrics = metrics; this.client = client; this.runnable = new AdminClientRunnable(); String threadName = NETWORK_THREAD_PREFIX + " | " + clientId; this.thread = new KafkaThread(threadName, runnable, true); this.timeoutProcessorFactory = (timeoutProcessorFactory == null) ? new TimeoutProcessorFactory() : timeoutProcessorFactory; this.maxRetries = config.getInt(AdminClientConfig.RETRIES_CONFIG); this.retryBackoffMs = config.getLong(AdminClientConfig.RETRY_BACKOFF_MS_CONFIG); config.logUnused(); AppInfoParser.registerAppInfo(JMX_PREFIX, clientId, metrics, time.milliseconds()); log.debug("Kafka admin client initialized"); thread.start(); }
Source:
public void terminate() throws IllegalStateException{ terminate(Integer.MAX_VALUE); }

Target:
public void terminate() { terminate(Integer.MAX_VALUE); }
Source:
private Handler<NetSocket> getEchoHandler() { return new Handler<NetSocket>() { public void handle(NetSocket socket) { System.out.println("YAY"); tu.checkThread(); final int numChunks = 100; final int chunkSize = 100; final Buffer received = new Buffer(); final Buffer sent = new Buffer(); socket.dataHandler(new Handler<Buffer>() { public void handle(Buffer buffer) { tu.checkThread(); received.appendBuffer(buffer); if (received.length() == sent.length()) { tu.azzert(TestUtils.buffersEqual(sent, received)); tu.testComplete(); } } }); for (int i = 0; i < numChunks; i++) { Buffer buff = TestUtils.generateRandomBuffer(chunkSize); sent.appendBuffer(buff); socket.write(buff); } } }; }

Target:
private Handler<NetSocket> getEchoHandler() { return new Handler<NetSocket>() { public void handle(NetSocket socket) { tu.checkThread(); final int numChunks = 100; final int chunkSize = 100; final Buffer received = new Buffer(); final Buffer sent = new Buffer(); socket.dataHandler(new Handler<Buffer>() { public void handle(Buffer buffer) { tu.checkThread(); received.appendBuffer(buffer); if (received.length() == sent.length()) { tu.azzert(TestUtils.buffersEqual(sent, received)); tu.testComplete(); } } }); for (int i = 0; i < numChunks; i++) { Buffer buff = TestUtils.generateRandomBuffer(chunkSize); sent.appendBuffer(buff); socket.write(buff); } } }; }
Source:
public PatchSetInfo get(PatchSet.Id patchSetId) throws PatchSetInfoNotAvailableException { ReviewDb db = null; try { db = schemaFactory.open(); final PatchSet patchSet = db.patchSets().get(patchSetId); final Change change = db.changes().get(patchSet.getId().getParentKey()); final Project.NameKey projectKey = change.getDest().getParentKey(); final String projectName = projectKey.get(); final Repository repo = gs.openRepository(projectName); final RevWalk rw = new RevWalk(repo); final RevCommit src = rw.parseCommit(ObjectId.fromString(patchSet.getRevision().get())); return get(src, patchSetId); } catch (OrmException e) { throw new PatchSetInfoNotAvailableException(e); } catch (IOException e) { throw new PatchSetInfoNotAvailableException(e); } finally { if (db != null) db.close(); } }

Target:
public PatchSetInfo get(PatchSet.Id patchSetId) throws PatchSetInfoNotAvailableException { ReviewDb db = null; Repository repo = null; try { db = schemaFactory.open(); final PatchSet patchSet = db.patchSets().get(patchSetId); final Change change = db.changes().get(patchSet.getId().getParentKey()); final Project.NameKey projectKey = change.getDest().getParentKey(); final String projectName = projectKey.get(); repo = gs.openRepository(projectName); final RevWalk rw = new RevWalk(repo); final RevCommit src = rw.parseCommit(ObjectId.fromString(patchSet.getRevision().get())); return get(src, patchSetId); } catch (OrmException e) { throw new PatchSetInfoNotAvailableException(e); } catch (IOException e) { throw new PatchSetInfoNotAvailableException(e); } finally { if (db != null) db.close(); if (repo != null) repo.close(); } }
Source:
public void updateColHeaderFilter(Database db, MolgenisRequest t) throws Exception { if (matrix instanceof SliceablePhenoMatrixMV) { List<Integer> measurementIds = new ArrayList<Integer>(); List<String> list = (List<String>) t.getList(MEASUREMENTCHOOSER); for (String s : list) { measurementIds.add(Integer.parseInt(s)); } resetColumns(measurementIds); } else { List<?> chosenMeasurementIds; if (t.getList(MEASUREMENTCHOOSER) != null) { chosenMeasurementIds = t.getList(MEASUREMENTCHOOSER); } else { chosenMeasurementIds = new ArrayList<Object>(); } List<String> chosenMeasurementNames = new ArrayList<String>(); for (Object measurementId : chosenMeasurementIds) { System.out.println("__objmeasid: " + measurementId + "\n"); int measId = Integer.parseInt((String) measurementId); chosenMeasurementNames.add(db.findById(Measurement.class, measId).getName()); } setColHeaderFilter(chosenMeasurementNames); } }

Target:
public void updateColHeaderFilter(Database db, MolgenisRequest t) throws Exception { if (matrix instanceof SliceablePhenoMatrixMV) { List<Integer> measurementIds = new ArrayList<Integer>(); List<String> list = (List<String>) t.getList(MEASUREMENTCHOOSER); for (String s : list) { measurementIds.add(Integer.parseInt(s)); } resetColumns(measurementIds); } else { List<?> chosenMeasurementIds; if (t.getList(MEASUREMENTCHOOSER) != null) { chosenMeasurementIds = t.getList(MEASUREMENTCHOOSER); } else { chosenMeasurementIds = new ArrayList<Object>(); } List<String> chosenMeasurementNames = new ArrayList<String>(); for (Object measurementId : chosenMeasurementIds) { int measId = Integer.parseInt((String) measurementId); chosenMeasurementNames.add(db.findById(Measurement.class, measId).getName()); } setColHeaderFilter(chosenMeasurementNames); } }
Source:
private II providedPatientId(PRPAIN201305UV02 request) { II patId = null; String aaId; if (request != null && request.getControlActProcess() != null) { aaId = extractAAOID(request); if (NullChecker.isNotNullish(aaId) && request.getControlActProcess().getQueryByParameter() != null && request.getControlActProcess().getQueryByParameter().getValue() != null && request.getControlActProcess().getQueryByParameter().getValue().getParameterList() != null && NullChecker.isNotNullish(request.getControlActProcess().getQueryByParameter().getValue() .getParameterList().getLivingSubjectId())) { for (PRPAMT201306UV02LivingSubjectId livingSubId : request.getControlActProcess() .getQueryByParameter().getValue().getParameterList().getLivingSubjectId()) { for (II id : livingSubId.getValue()) { if (id != null && NullChecker.isNotNullish(id.getRoot()) && NullChecker.isNotNullish(id.getExtension()) && aaId.contentEquals(id.getRoot())) { patId = new II(); patId.setRoot(id.getRoot()); patId.setExtension(id.getExtension()); break; } } if (patId != null) { break; } } } } return patId; }

Target:
private II providedPatientId(PRPAIN201305UV02 request) { II patId = null; String aaId; if (request != null && request.getControlActProcess() != null) { aaId = extractAAOID(request); if (NullChecker.isNotNullish(aaId) && requestHasLivingId(request)) { for (PRPAMT201306UV02LivingSubjectId livingSubId : request.getControlActProcess() .getQueryByParameter().getValue().getParameterList().getLivingSubjectId()) { for (II id : livingSubId.getValue()) { if (id != null && NullChecker.isNotNullish(id.getRoot()) && NullChecker.isNotNullish(id.getExtension()) && aaId.contentEquals(id.getRoot())) { patId = new II(); patId.setRoot(id.getRoot()); patId.setExtension(id.getExtension()); break; } } if (patId != null) { break; } } } } return patId; }
Source:
@Test public void defaultEntrypoint() throws Exception { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { DockerTestUtil.assumeDocker(); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " withDockerContainer('ubuntu') {\n" + " sh 'cat /proc/1/cmdline'\n" + " }\n" + "}", true)); WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)); story.j.assertLogContains("cat", b); } }); }

Target:
@Test public void defaultEntrypoint() throws Exception { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { DockerTestUtil.assumeDocker(); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " withDockerContainer('ubuntu') {\n" + " sh 'grep cat /proc/1/cmdline'\n" + " }\n" + "}", true)); WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)); } }); }
Source:
public void explain(OperationContext ctx, CRUDFindRequest req) { initialize(ctx,req); ExecutionContext executionContext = new ExecutionContext(ctx,null); JsonDoc doc=new JsonDoc(executionPlan.explain(executionContext)); ArrayList<DocCtx> l=new ArrayList<>(1); l.add(new DocCtx(doc)); ctx.setDocumentStream(new ListDocumentStream<DocCtx>(l)); }

Target:
public void explain(OperationContext ctx, CRUDFindRequest req) { initialize(ctx,req); ExecutionContext executionContext = new ExecutionContext(ctx,null); JsonDoc doc=new JsonDoc(executionPlan.explain(executionContext)); ctx.setDocumentStream(new ListDocumentStream<DocCtx>(Arrays.asList(new DocCtx(doc)))); }
Source:
@Override public boolean isApplicableToSCM(@Nonnull Class<? extends SCM> scmClass) { return super.isApplicableToSCM(scmClass) && MercurialSCM.class.isAssignableFrom(scmClass); }

Target:
@Override public boolean isApplicableToSCM(@Nonnull Class<? extends SCM> scmClass) { if (super.isApplicableToSCM(scmClass)) { for (MercurialInstallation i : MercurialInstallation.allInstallations()) { if (i.isUseCaches()) { return true; } } } return false; }
Source:
public void aggregate(Object item) { if (item instanceof ObjectNode) { ObjectNode objectNode = (ObjectNode) item; if (objectNode.hasNonNull("count")) { long count = objectNode.get("count").asLong(); if (count == 0) { return; } if (objectNode.has("min")) { item = MaxAggregator.getValue(objectNode.get("min")); } else { item = Undefined.value(); } } } if (item == Undefined.value()) { return; } if (Undefined.value().equals(this.value)) { this.value = item; } else if (ItemComparator.getInstance().compare(item, this.value) < 0) { this.value = item; } }

Target:
public void aggregate(Object item) { if (item instanceof ObjectNode) { ObjectNode objectNode = (ObjectNode) item; if (objectNode.hasNonNull(COUNT_PROPERTY_NAME)) { long count = objectNode.get(COUNT_PROPERTY_NAME).asLong(); if (count == 0) { return; } if (objectNode.has(MIN_PROPERTY_NAME)) { item = MaxAggregator.getValue(objectNode.get(MIN_PROPERTY_NAME)); } else { item = Undefined.value(); } } } if (item == Undefined.value()) { return; } if (Undefined.value().equals(this.value)) { this.value = item; } else if (ItemComparator.getInstance().compare(item, this.value) < 0) { this.value = item; } }
Source:
public Job getJobContent(JobId jobId) throws NotConnectedException, PermissionException, UnknownJobException, JobCreationException, SubmissionClosedException { File tempFile = null; try { final InputStream jobContent = restApi().getJobContent(sid, jobId.value()); tempFile = File.createTempFile("jobContent", jobId.value()); FileUtils.copyInputStreamToFile(jobContent, tempFile); final Job job = JobFactory.getFactory().createJob(tempFile.getPath()); return job; } catch (NotConnectedRestException e) { throw new NotConnectedException(e); } catch (UnknownJobRestException e) { throw new UnknownJobException(e); } catch (PermissionRestException e) { throw new PermissionException(e); } catch (SubmissionClosedRestException e) { throw new SubmissionClosedException(e); } catch (JobCreationRestException e) { throw new JobCreationException(e); } catch (IOException e) { throw new RuntimeException(e); } finally { if (tempFile != null) { tempFile.delete(); } } }

Target:
public Job getJobContent(JobId jobId) throws NotConnectedException, PermissionException, UnknownJobException, JobCreationException, SubmissionClosedException { File tempFile = null; try { final InputStream jobContent = restApi().getJobContent(sid, jobId.value()); tempFile = File.createTempFile("jobContent", jobId.value()); FileUtils.copyInputStreamToFile(jobContent, tempFile); return JobFactory.getFactory().createJob(tempFile.getPath()); } catch (NotConnectedRestException e) { throw new NotConnectedException(e); } catch (UnknownJobRestException e) { throw new UnknownJobException(e); } catch (PermissionRestException e) { throw new PermissionException(e); } catch (SubmissionClosedRestException e) { throw new SubmissionClosedException(e); } catch (JobCreationRestException e) { throw new JobCreationException(e); } catch (IOException e) { throw new RuntimeException(e); } finally { if (tempFile != null) { try { Files.delete(tempFile.toPath()); } catch (IOException e) { logger.error("Cannot delete file: " + e); } } } }
Source:
public void setDurability(int durability) { if (durability >= 0) { this.durability = durability; } else { throw new IllegalArgumentException("Invalid value for durability"); } }

Target:
public void setDurability(int durability) { checkArgument(durability >= 0, "Durability cannot be less than zero!"); this.durability = durability; }
Source:
public static Async<Void> parallel(Collection<? extends Async<?>> asyncs, final boolean alwaysSucceed, final ParallelData parallelData) { final ResolvableAsync<Void> result = parallelData.getResultAsync(); final Runnable checkTermination = new Runnable() { @Override public void run() { if (parallelData.decrementInProgressAndGet() == 0) { List<Throwable> exceptions = parallelData.getExceptions(); if (!exceptions.isEmpty() && !alwaysSucceed) { result.failure(new ThrowableCollectionException(exceptions)); } else { result.success(null); } } } }; for (Async<?> a : asyncs) { a.onResult(new Consumer<Object>() { @Override public void accept(Object item) { checkTermination.run(); } }, new Consumer<Throwable>() { @Override public void accept(Throwable failure) { parallelData.addException(failure); checkTermination.run(); } }); } if (asyncs.isEmpty()) { return Asyncs.constant(null); } return result; }

Target:
private static Async<Void> parallel(Collection<? extends Async<?>> asyncs, final boolean alwaysSucceed, final ParallelData parallelData) { if (asyncs.isEmpty()) { return Asyncs.constant(null); } final ResolvableAsync<Void> result = parallelData.getResultAsync(); final Runnable checkTermination = new Runnable() { @Override public void run() { if (parallelData.decrementInProgressAndGet() == 0) { List<Throwable> exceptions = parallelData.getExceptions(); if (!exceptions.isEmpty() && !alwaysSucceed) { result.failure(new ThrowableCollectionException(exceptions)); } else { result.success(null); } } } }; for (Async<?> a : asyncs) { a.onResult(new Consumer<Object>() { @Override public void accept(Object item) { checkTermination.run(); } }, new Consumer<Throwable>() { @Override public void accept(Throwable failure) { parallelData.addException(failure); checkTermination.run(); } }); } return result; }
Source:
public boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage) { String currentCmBuildNumber = currentImage.getImage().getCmBuildNumber(); boolean clusterManagerUpdateNeeded = !currentCmBuildNumber.equals(targetImage.getImage().getCmBuildNumber()); flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), DATALAKE_UPGRADE, targetImage.getImage().getUuid()); clusterService.updateClusterStatusByStackId(stackId, Status.UPDATE_IN_PROGRESS); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, currentCmBuildNumber); } return clusterManagerUpdateNeeded; }

Target:
public boolean upgradeClusterManager(long stackId, StatedImage currentImage, StatedImage targetImage) { String currentCmBuildNumber = currentImage.getImage().getCmBuildNumber(); boolean clusterManagerUpdateNeeded = isUpdateNeeded(currentCmBuildNumber, targetImage.getImage().getCmBuildNumber()); flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), DATALAKE_UPGRADE, targetImage.getImage().getUuid()); clusterService.updateClusterStatusByStackId(stackId, Status.UPDATE_IN_PROGRESS); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_NOT_NEEDED, currentCmBuildNumber); } return clusterManagerUpdateNeeded; }
Source:
public SpongeGameModeData(GameMode mode) { super(GameModeData.class, mode, Keys.GAME_MODE, ImmutableGameModeData.class); }

Target:
public SpongeGameModeData(GameMode mode) { super(GameModeData.class, mode, Keys.GAME_MODE, ImmutableSpongeGameModeData.class); }
Source:
private SoftwareInfoManager(XMPPConnection connection) throws IOException, XmlPullParserException, SmackParsingException { super(connection); serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); addFeature(); discoverInfoBuilder = DiscoverInfo.builder(connection); }

Target:
private SoftwareInfoManager(XMPPConnection connection) throws IOException, XmlPullParserException, SmackParsingException { super(connection); serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); }
Source:
public void complete(T value) { Preconditions.checkState( future.complete(value)); }

Target:
public void complete(T value) { Preconditions.checkState( future.complete(value), "This result is already completed"); }
Source:
public static void setRandomProfession(EntityVillager entity, Random rand) { ArrayList<String> entries = new ArrayList(INSTANCE.professionsByName.keySet()); int prof = rand.nextInt(entries.size()); VillagerProfession profession = INSTANCE.professionsByName.get(entries.get(prof)); entity.setProfession(profession.id); }

Target:
public static void setRandomProfession(EntityVillager entity, Random rand) { ArrayList entries = new ArrayList(INSTANCE.professions.getKeys()); int prof = rand.nextInt(entries.size()); VillagerProfession profession = INSTANCE.professions.getObject(entries.get(prof)); entity.setProfession(profession.getId()); }
Source:
private void openDialog(Shell shell, EditableConfiguration config, ConfigurationViewModels configurationViewModels) { config.setIsComponent(true); EditConfigDialog editDialog = new EditConfigDialog(shell, TITLE, SUB_TITLE, config, true, configurationViewModels, false); if (editDialog.open() == Window.OK) { if (editDialog.doAsComponent()) { SERVER.saveAsComponent().uncheckedWrite(editDialog.getComponent()); } else { SERVER.saveAs().uncheckedWrite(editDialog.getConfig()); } } editDialog.close(); }

Target:
private void openDialog(Shell shell, EditableConfiguration config, ConfigurationViewModels configurationViewModels) { config.setIsComponent(true); EditConfigDialog editDialog = new EditConfigDialog(shell, TITLE, SUB_TITLE, config, true, configurationViewModels, false); if (editDialog.open() == Window.OK) { if (editDialog.doAsComponent()) { SERVER.saveAsComponent().uncheckedWrite(editDialog.getComponent()); } else { SERVER.saveAs().uncheckedWrite(editDialog.getConfig()); } } }
Source:
public Iterator<Proposal> getProposalsFromTxnLog(long startZxid, long sizeLimit) { if (sizeLimit < 0) { LOG.debug("Negative size limit - retrieving proposal via txnlog is disabled"); return TxnLogProposalIterator.EMPTY_ITERATOR; } TxnIterator itr = null; try { itr = snapLog.readTxnLog(startZxid, false); if ((itr.getHeader() != null) && (itr.getHeader().getZxid() > startZxid)) { LOG.warn("Unable to find proposals from txnlog for zxid: {}", startZxid); itr.close(); return TxnLogProposalIterator.EMPTY_ITERATOR; } if (sizeLimit > 0) { long txnSize = itr.getStorageSize(); if (txnSize > sizeLimit) { LOG.info("Txnlog size: exceeds sizeLimit: {}", txnSize, sizeLimit); itr.close(); return TxnLogProposalIterator.EMPTY_ITERATOR; } } } catch (IOException e) { LOG.error("Unable to read txnlog from disk", e); try { if (itr != null) { itr.close(); } } catch (IOException ioe) { LOG.warn("Error closing file iterator", ioe); } return TxnLogProposalIterator.EMPTY_ITERATOR; } return new TxnLogProposalIterator(itr); }

Target:
public Iterator<Proposal> getProposalsFromTxnLog(long startZxid, long sizeLimit) { if (sizeLimit < 0) { LOG.debug("Negative size limit - retrieving proposal via txnlog is disabled"); return TxnLogProposalIterator.EMPTY_ITERATOR; } TxnIterator itr = null; try { itr = snapLog.readTxnLog(startZxid, false); if ((itr.getHeader() != null) && (itr.getHeader().getZxid() > startZxid)) { LOG.warn( "Unable to find proposals from txnlog for zxid: 0x{}", Long.toHexString(startZxid)); itr.close(); return TxnLogProposalIterator.EMPTY_ITERATOR; } if (sizeLimit > 0) { long txnSize = itr.getStorageSize(); if (txnSize > sizeLimit) { LOG.info("Txnlog size: exceeds sizeLimit: {}", txnSize, sizeLimit); itr.close(); return TxnLogProposalIterator.EMPTY_ITERATOR; } } } catch (IOException e) { LOG.error("Unable to read txnlog from disk", e); try { if (itr != null) { itr.close(); } } catch (IOException ioe) { LOG.warn("Error closing file iterator", ioe); } return TxnLogProposalIterator.EMPTY_ITERATOR; } return new TxnLogProposalIterator(itr); }
Source:
public static String getSuggestedDiskAlias(Disk disk, String diskPrefix) { String diskAlias; if (disk == null) { diskAlias = getDefaultDiskAlias(diskPrefix, "1"); log.errorFormat("Disk object is null, the suggested default disk alias to be used is %1$s", diskAlias); } else { diskAlias = disk.getDiskAlias(); if (diskAlias == null) { diskAlias = getDefaultDiskAlias(diskPrefix, new Integer(disk.getInternalDriveMapping()).toString()); log.infoFormat("Disk alias retrieved from the client is null, the suggested default disk alias to be used is %1$s", diskAlias); } } return diskAlias; }

Target:
public static String getSuggestedDiskAlias(Disk disk, String diskPrefix) { String diskAlias; if (disk == null) { diskAlias = getDefaultDiskAlias(diskPrefix, "1"); log.warnFormat("Disk object is null, the suggested default disk alias to be used is %1$s", diskAlias); } else { diskAlias = disk.getDiskAlias(); if (diskAlias == null) { diskAlias = getDefaultDiskAlias(diskPrefix, String.valueOf(disk.getInternalDriveMapping())); log.infoFormat("Disk alias retrieved from the client is null, the suggested default disk alias to be used is %1$s", diskAlias); } } return diskAlias; }
Source:
public GenericShuffleProducer construct(ConstructArgs args) { return new GenericShuffleProducer( null, getRealOperatorIds().toArray(new ExchangePairID[] {}), MyriaUtils.integerSetToIntArray(getRealWorkerIds()), new BroadcastDistributeFunction(getRealWorkerIds().size())); }

Target:
public GenericShuffleProducer construct(ConstructArgs args) { GenericShuffleProducer ret = new GenericShuffleProducer( null, getRealOperatorIds().toArray(new ExchangePairID[] {}), Ints.toArray(getRealWorkerIds()), new BroadcastDistributeFunction()); ret.getDistributeFunction().setDestinations(getRealWorkerIds().size(), 1); return ret; }
Source:
protected String resolveJava() throws InterruptedException, IOException { for (JavaProvider provider : JavaProvider.all()) { for (String javaCommand : provider.getJavas(computer, listener, connection)) { LOGGER.fine("Trying Java at " + javaCommand); try { return checkJavaVersion(listener, javaCommand); } catch (IOException e) { LOGGER.log(FINE, "Failed to check the Java version",e); } } } throw new IOException("Java not found " + computer + ", install a Java 8+ version on the Agent, if you need " + "others JDK use the Global Tool Configuration to install them."); }

Target:
protected String resolveJava() throws InterruptedException, IOException { for (JavaProvider provider : JavaProvider.all()) { for (String javaCommand : provider.getJavas(computer, listener, connection)) { LOGGER.fine("Trying Java at " + javaCommand); try { return checkJavaVersion(listener, javaCommand); } catch (IOException e) { LOGGER.log(FINE, "Failed to check the Java version",e); } } } throw new IOException("Java not found on " + computer + ". Install a Java 8 version on the Agent."); }
Source:
public void testInvokeRebalanceAndInvokeRebalanceForResource() { String resourceName = "ResourceToInvoke"; _gSetupTool.getClusterManagementTool() .addResource(CLUSTER_NAME, resourceName, 5, MasterSlaveSMD.name); IdealState idealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, resourceName); ResourceConfig resourceConfig = new ResourceConfig(resourceName); resourceConfig.setPreferenceLists(Collections.singletonMap("0", Arrays.asList("1", "2", "3"))); _configAccessor.setResourceConfig(CLUSTER_NAME, resourceName, resourceConfig); int i = 0; while (i++ < NUM_ATTEMPTS) { RebalanceScheduler.invokeRebalance(_manager.getHelixDataAccessor(), resourceName); RebalanceScheduler .invokeRebalanceForResourceConfig(_manager.getHelixDataAccessor(), resourceName); } Assert.assertTrue(idealState.getRecord().equals( _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, resourceName).getRecord())); Assert.assertTrue(resourceConfig.getRecord().equals( _configAccessor.getResourceConfig(CLUSTER_NAME, resourceName).getRecord())); }

Target:
public void testInvokeRebalanceAndInvokeRebalanceForResource() { String resourceName = "ResourceToInvoke"; _gSetupTool.getClusterManagementTool() .addResource(CLUSTER_NAME, resourceName, 5, MasterSlaveSMD.name); IdealState idealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, resourceName); ResourceConfig resourceConfig = new ResourceConfig(resourceName); resourceConfig.setPreferenceLists(Collections.singletonMap("0", Arrays.asList("1", "2", "3"))); _configAccessor.setResourceConfig(CLUSTER_NAME, resourceName, resourceConfig); int i = 0; while (i++ < NUM_ATTEMPTS) { RebalanceScheduler.invokeRebalance(_manager.getHelixDataAccessor(), resourceName); RebalanceScheduler .invokeRebalanceForResourceConfig(_manager.getHelixDataAccessor(), resourceName); } IdealState newIdealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, resourceName); ResourceConfig newResourceConfig = _configAccessor.getResourceConfig(CLUSTER_NAME, resourceName); Assert.assertTrue(idealState.getRecord().equals(newIdealState.getRecord())); Assert.assertEquals(idealState.getStat().getVersion(), 0); Assert.assertEquals(newIdealState.getStat().getVersion(), NUM_ATTEMPTS); Assert.assertTrue(resourceConfig.getRecord().equals(newResourceConfig.getRecord())); Assert.assertEquals( resourceConfig.getStat().getVersion(), 0); Assert.assertEquals(newResourceConfig.getStat().getVersion(), NUM_ATTEMPTS); }
Source:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); context.record( TransformLineageRecorderUtils.allInToAllOut(normalizeFieldList, TransformLineageRecorderUtils.getFields(outputSchema), "normalize", "Normalize wide rows and reduce data to canonical form.")); }

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); initializeFieldData(); if (context.getOutputSchema() == null || context.getOutputSchema().getFields() == null) { return; } context.record( TransformLineageRecorderUtils.generateManyToMany(normalizeFieldList, TransformLineageRecorderUtils.getFields(context.getOutputSchema()), "normalize", "Normalize wide rows and reduce data to canonical form.")); }
Source:
protected void applyHeaders() { getHeaders().entrySet().forEach(e -> e.getValue().forEach(v -> this.jettyRequest.header(e.getKey(), v))); if (!getHeaders().containsKey(HttpHeaders.ACCEPT)) { this.jettyRequest.header(HttpHeaders.ACCEPT, "*/*"); } }

Target:
protected void applyHeaders() { HttpHeaders headers = getHeaders(); headers.forEach((key, value) -> value.forEach(v -> this.jettyRequest.header(key, v))); if (!headers.containsKey(HttpHeaders.ACCEPT)) { this.jettyRequest.header(HttpHeaders.ACCEPT, "*/*"); } }
Source:
protected List<Identifier> findByParentPath(final String siteId, String parentPath) throws DotDataException { final Identifier identifier = findByURI(siteId, parentPath); if(!UtilMethods.isSet(identifier) || !UtilMethods.isSet(identifier.getId()) ){ return Collections.emptyList(); } parentPath = identifier.getURI(); if(!parentPath.endsWith("/")) { parentPath=parentPath+"/"; } Logger.info(getClass(),parentPath); DotConnect dc = new DotConnect(); dc.setSQL("select * from identifier where parent_path = ? and host_inode = ?"); dc.addParam(parentPath); dc.addParam(siteId); return TransformerLocator.createIdentifierTransformer(dc.loadObjectResults()).asList(); }

Target:
protected List<Identifier> findByParentPath(final String siteId, String parentPath) throws DotDataException { final Identifier identifier = findByURI(siteId, parentPath); if(!UtilMethods.isSet(identifier) || !UtilMethods.isSet(identifier.getId()) ){ return Collections.emptyList(); } parentPath = identifier.getURI(); if(!parentPath.endsWith("/")) { parentPath=parentPath+"/"; } DotConnect dc = new DotConnect(); dc.setSQL("select * from identifier where parent_path = ? and host_inode = ?"); dc.addParam(parentPath); dc.addParam(siteId); return TransformerLocator.createIdentifierTransformer(dc.loadObjectResults()).asList(); }
Source:
@Override public boolean add(Integer integer) { if (integer == null) throw new UnsupportedOperationException("Negative or null values are not supported!"); return add((int) integer); }

Target:
@Override public boolean add(Integer integer) { if (integer == null) throw new IllegalArgumentException("Negative or null values are not supported!"); return add((int)integer); }
Source:
public boolean isDeleted(ArtifactId artifact) { return ((Artifact) artifact).isDeleted(); }

Target:
public boolean isDeleted(ArtifactId artifact) { return ((Artifact) services.getArtifact(artifact)).isDeleted(); }
Source:
public List<GroupedTimelineLogSummary> getTimelineLogSummaryHistopry(@Auth final AccessToken accessToken, @QueryParam("start_date") final String startDate, @QueryParam("end_date") final String endDate) { List<GroupedTimelineLogSummary> summaries = timelineAnalyticsDAO.getGroupedSummariesForDateRange(startDate, endDate); return summaries; }

Target:
public List<GroupedTimelineLogSummary> getTimelineLogSummaryHistopry(@Auth final AccessToken accessToken, @QueryParam("start_date") final String startDate, @QueryParam("end_date") final String endDate) { if (startDate == null || endDate == null) { throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(new JsonError( Response.Status.BAD_REQUEST.getStatusCode(), "start_date and end_date must be specified")).build()); } final List<GroupedTimelineLogSummary> summaries = timelineAnalyticsDAO.getGroupedSummariesForDateRange(startDate, endDate); return summaries; }
Source:
public JsonArray execJson() { checkNotClosed(); HttpQuery httpQuery = makeHttpQuery(); httpQuery.setAccept(WebContent.contentTypeJSON); InputStream in = httpQuery.exec(); JsonValue v = JSON.parseAny(in); if ( ! v.isArray() ) return v.getAsArray(); }

Target:
public JsonArray execJson() { checkNotClosed(); HttpQuery httpQuery = makeHttpQuery(); httpQuery.setAccept(WebContent.contentTypeJSON); InputStream in = httpQuery.exec(); JsonValue v = JSON.parseAny(in); if ( ! v.isArray() ) throw new QueryExecException("Return from a JSON query isn't an array"); return v.getAsArray(); }
Source:
private MetricsQuery(final Builder builder) { _startTime = builder._startTime; _endTime = builder._endTime; _metrics = ImmutableList.copyOf(builder._metrics); }

Target:
private MetricsQuery(final Builder builder) { _startTime = builder._startTime; _endTime = Optional.ofNullable(builder._endTime); _metrics = builder._metrics; }
Source:
WorkerTransfer(WorkerState workerState, Map<String, Object> topologyConf, int maxTaskIdInTopo) { this.workerState = workerState; this.backPressureWaitStrategy = IWaitStrategy.createBackPressureWaitStrategy(topologyConf); this.drainer = new TransferDrainer(); this.remoteBackPressureStatus = new AtomicBoolean[maxTaskIdInTopo + 1]; for (int i = 0; i < remoteBackPressureStatus.length; i++) { remoteBackPressureStatus[i] = new AtomicBoolean(false); } Integer xferQueueSz = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_TRANSFER_BUFFER_SIZE)); Integer xferBatchSz = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_TRANSFER_BATCH_SIZE)); if (xferBatchSz > xferQueueSz / 2) { throw new IllegalArgumentException(Config.TOPOLOGY_TRANSFER_BATCH_SIZE + ":" + xferBatchSz + " must be no more than half of " + Config.TOPOLOGY_TRANSFER_BUFFER_SIZE + ":" + xferQueueSz); } List<Integer> taskIds = new ArrayList<>(); taskIds.add(-1); this.transferQueue = new JCQueue("worker-transfer-queue", xferQueueSz, 0, xferBatchSz, backPressureWaitStrategy, workerState.getTopologyId(), Constants.SYSTEM_COMPONENT_ID, taskIds, workerState.getPort(), workerState.getMetricRegistry()); }

Target:
WorkerTransfer(WorkerState workerState, Map<String, Object> topologyConf, int maxTaskIdInTopo) { this.workerState = workerState; this.backPressureWaitStrategy = IWaitStrategy.createBackPressureWaitStrategy(topologyConf); this.drainer = new TransferDrainer(); this.remoteBackPressureStatus = new AtomicBoolean[maxTaskIdInTopo + 1]; for (int i = 0; i < remoteBackPressureStatus.length; i++) { remoteBackPressureStatus[i] = new AtomicBoolean(false); } Integer xferQueueSz = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_TRANSFER_BUFFER_SIZE)); Integer xferBatchSz = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_TRANSFER_BATCH_SIZE)); if (xferBatchSz > xferQueueSz / 2) { throw new IllegalArgumentException(Config.TOPOLOGY_TRANSFER_BATCH_SIZE + ":" + xferBatchSz + " must be no more than half of " + Config.TOPOLOGY_TRANSFER_BUFFER_SIZE + ":" + xferQueueSz); } this.transferQueue = new JCQueue("worker-transfer-queue", xferQueueSz, 0, xferBatchSz, backPressureWaitStrategy, workerState.getTopologyId(), Constants.SYSTEM_COMPONENT_ID, Collections.singletonList(-1), workerState.getPort(), workerState.getMetricRegistry()); }
Source:
public void testValidateGracePeriodAndExternalPorts() throws Exception { final Job noPorts = Json.read(stringFromResource("job-with-no-ports.json"), Job.class); assertThat(validator.validate(noPorts), Matchers.<String>empty()); final Job noExternalPorts = Json.read( stringFromResource("job-with-no-external-ports.json"), Job.class); assertThat(validator.validate(noExternalPorts), Matchers.<String>empty()); final Job externalPorts = Json.read( stringFromResource("job-with-external-ports.json"), Job.class); assertThat(validator.validate(externalPorts), Matchers.<String>empty()); final Job externalPortsAndGracePeriod = Json.read( stringFromResource("job-with-external-ports-and-grace-period.json"), Job.class); assertThat(validator.validate(externalPortsAndGracePeriod), hasItem("Job has a grace period and static/external ports. " + "Please choose one or the other.")); }

Target:
public void testValidateGracePeriodAndExternalPorts() throws Exception { final Job noPorts = Json.read(stringFromResource("job-with-no-ports.json"), Job.class); assertThat(validator.validate(noPorts), Matchers.<String>empty()); final Job noExternalPorts = Json.read( stringFromResource("job-with-no-external-ports.json"), Job.class); assertThat(validator.validate(noExternalPorts), Matchers.<String>empty()); final Job externalPorts = Json.read( stringFromResource("job-with-external-ports.json"), Job.class); assertThat(validator.validate(externalPorts), Matchers.<String>empty()); final Job gracePeriod = Json.read( stringFromResource("job-with-grace-period.json"), Job.class); assertThat(validator.validate(gracePeriod), Matchers.<String>empty()); final Job externalPortsAndGracePeriod = Json.read( stringFromResource("job-with-external-ports-and-grace-period.json"), Job.class); assertThat(validator.validate(externalPortsAndGracePeriod), hasItem("This configuration will prevent new containers from deploying during the " + "gracePeriod because of port conflicts.")); }
Source:
public void offer(PrioritizedSplitRunner split) { checkArgument(split != null, "split is null"); split.setReady(); lock.lock(); try { levelWaitingSplits.get(split.getLevel()).offer(split); notEmpty.signal(); } finally { lock.unlock(); } }

Target:
public void offer(PrioritizedSplitRunner split) { checkArgument(split != null, "split is null"); split.setReady(); lock.lock(); try { levelWaitingSplits.get(split.getPriority().getLevel()).offer(split); notEmpty.signal(); } finally { lock.unlock(); } }
Source:
private List<JobID> tryExecuteJobs(final DispatcherGateway dispatcherGateway, final PackagedProgram program, final Configuration configuration) { configuration.set(DeploymentOptions.ATTACHED, false); final List<JobID> applicationJobIds = new ArrayList<>(); final PipelineExecutorServiceLoader executorServiceLoader = new WebSubmissionExecutorServiceLoader(applicationJobIds, dispatcherGateway); try { ClientUtils.executeProgram(executorServiceLoader, configuration, program, enforceSingleJobExecution, true); } catch (ProgramInvocationException e) { LOG.warn("Could not execute application: ", e); throw new CompletionException(new RestHandlerException("Could not execute application.", HttpResponseStatus.BAD_REQUEST, e)); } return applicationJobIds; }

Target:
private List<JobID> tryExecuteJobs(final DispatcherGateway dispatcherGateway, final PackagedProgram program, final Configuration configuration) { configuration.set(DeploymentOptions.ATTACHED, false); final List<JobID> applicationJobIds = new ArrayList<>(); final PipelineExecutorServiceLoader executorServiceLoader = new WebSubmissionExecutorServiceLoader(applicationJobIds, dispatcherGateway); try { ClientUtils.executeProgram(executorServiceLoader, configuration, program, enforceSingleJobExecution, true); } catch (ProgramInvocationException e) { LOG.warn("Could not execute application: ", e); throw new FlinkRuntimeException("Could not execute application.", e); } return applicationJobIds; }
Source:
public int getBlockPower(BlockFace face) { BlockType type = ItemTable.instance().getBlock(getType()); if(type == null) { return 0; } return (type.canBlockEmitPower(this, face, false) ? getWorld().getRSManager().getBlockPower(this) : 0); }

Target:
public int getBlockPower(BlockFace face) { BlockType type = ItemTable.instance().getBlock(getType()); if(type == null) { return 0; } return type.canBlockEmitPower(this, face, false) ? getWorld().getRSManager().getBlockPower(this) : 0; }
Source:
private static boolean learnedValueIsGreatestAcceptedValue( List<ConsolidatedLearnerAndAcceptorRecord> records, Long seq) { byte[] learnedValueData = getPaxosValueData(getLearnedValue(records, seq)); if (learnedValueData == null) { return true; } byte[] greatestAcceptedValueData = getPaxosValueData(getGreatestAcceptedValueAtSequence(records, seq)); if (greatestAcceptedValueData == null) { return false; } return PtBytes.toLong(greatestAcceptedValueData) <= PtBytes.toLong(learnedValueData); }

Target:
private static boolean learnedValueIsGreatestAcceptedValue( List<ConsolidatedLearnerAndAcceptorRecord> records, Long seq) { byte[] learnedValueData = getPaxosValueData(getLearnedValue(records, seq)); if (learnedValueData == null) { return true; } byte[] greatestAcceptedValueData = getPaxosValueData(getGreatestAcceptedValueAtSequence(records, seq)); Preconditions.checkNotNull( greatestAcceptedValueData, "Value learned did have data while there " + "was no data in any of the accepted states. This should never happen, contact support"); return PtBytes.toLong(greatestAcceptedValueData) <= PtBytes.toLong(learnedValueData); }
Source:
DatasetPermissions assignPermissions(Session session, CollectionDescription description, String datasetID) throws DatasetPermissionsException { DatasetPermissions permissions = new DatasetPermissions(); if (isAdminOrPublisher(session)) { permissions.permit(CREATE, READ, UPDATE, DELETE); } else if (isCollectionViewer(session, description)) { permissions.permit(READ); } else { info().data("collection_id", description.getId()) .data("dataset_id", datasetID) .data("user", session.getEmail()) .log("user not permitted to access dataset"); return permissions; } info().data("collection_id", description.getId()) .data("dataset_id", datasetID) .data("user", session.getEmail()) .log("permitted collection dataset permissions for user"); return permissions; }

Target:
DatasetPermissions assignPermissions(Session session, CollectionDescription description, String datasetID) throws DatasetPermissionsException { DatasetPermissions permissions = new DatasetPermissions(); if (isAdminOrPublisher(session)) { permissions.permit(CREATE, READ, UPDATE, DELETE); } else if (isCollectionViewer(session, description)) { permissions.permit(READ); } else { info().collectionID(description.getId()).datasetID(datasetID).user(session).log("user not permitted to access dataset"); return permissions; } info().collectionID(description).datasetID(datasetID).user(session).log("permitted collection dataset permissions for user"); return permissions; }