auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void checkTaskManagerTimeout(int redundantTaskManagerNum) throws Exception { Executor executor = TestingUtils.defaultExecutor(); canBeReleasedFuture.set(CompletableFuture.completedFuture(true)); try (SlotManager slotManager = SlotManagerBuilder .newBuilder() .setTaskManagerTimeout(Time.milliseconds(10L)) .setRedundantTaskManagerNum(redundantTaskManagerNum) .build()) { slotManager.start(resourceManagerId, executor, resourceManagerActions); executor.execute(() -> slotManager.registerTaskManager(taskManagerConnection, slotReport)); assertThat(releaseFuture.get(), is(equalTo(taskManagerConnection.getInstanceID()))); } }

Target:
private void checkTaskManagerTimeout(int redundantTaskManagerNum) throws Exception { canBeReleasedFuture.set(CompletableFuture.completedFuture(true)); try (SlotManager slotManager = SlotManagerBuilder .newBuilder() .setTaskManagerTimeout(Time.milliseconds(10L)) .setRedundantTaskManagerNum(redundantTaskManagerNum) .buildAndStartWithDirectExec(resourceManagerId, resourceManagerActions)) { slotManager.registerTaskManager(taskManagerConnection, slotReport); assertThat(releaseFuture.get(), is(equalTo(taskManagerConnection.getInstanceID()))); } }
Source:
Slice(byte[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = ARRAY_BYTE_BASE_OFFSET + offset; this.size = length; this.retainedSize = INSTANCE_SIZE + sizeOf(base); this.reference = (offset == 0 && length == base.length ? COMPACT : NOT_COMPACT); }

Target:
Slice(byte[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = ARRAY_BYTE_BASE_OFFSET + offset; this.size = length; this.retainedSize = INSTANCE_SIZE + sizeOf(base); this.reference = (offset == 0 && length == base.length) ? COMPACT : NOT_COMPACT; }
Source:
public CompletableFuture<Object> invokeAsync(InvocationContext ctx, VisitableCommand command) { Stages.pushInvocationIdNDC(command, trace); try { Object result = firstInterceptor.visitCommand(ctx, command); if (result instanceof InvocationStage) { return ((InvocationStage) result).toCompletableFuture(); } else { return CompletableFuture.completedFuture(result); } } catch (Throwable t) { return CompletableFutures.completedExceptionFuture(t); } finally { Stages.popInvocationIdNDC(command, trace); } }

Target:
public CompletableFuture<Object> invokeAsync(InvocationContext ctx, VisitableCommand command) { try { Object result = firstInterceptor.visitCommand(ctx, command); if (result instanceof InvocationStage) { return ((InvocationStage) result).toCompletableFuture(); } else { return CompletableFuture.completedFuture(result); } } catch (Throwable t) { return CompletableFutures.completedExceptionFuture(t); } }
Source:
private Network getGlusterNetworkId(VdsStatic server, String networkAddress) { List<Network> allNetworksInCluster = DbFacade.getInstance().getNetworkDao().getAllForCluster(server.getVdsGroupId()); for (Network network : allNetworksInCluster) { if (network.getCluster().isGluster()) { return network; } } return null; }

Target:
private Network getGlusterNetworkId(VdsStatic server, String networkAddress) { List<Network> allNetworksInCluster = DbFacade.getInstance().getNetworkDao().getAllForCluster(server.getVdsGroupId()); for (Network network : allNetworksInCluster) { if (network.getCluster().isGluster() && isSameNetworkAddress(server.getId(), network.getName(), networkAddress)) { return network; } } return null; }
Source:
public GridH2Table( CreateTableData createTblData, GridH2RowDescriptor desc, H2TableDescriptor tblDesc, GridCacheContextInfo cacheInfo ) { super(createTblData); assert tblDesc != null; this.desc = desc; this.cacheInfo = cacheInfo; affKeyCol = calculateAffinityKeyColumn(); affKeyColIsKey = affKeyCol != null && desc.isKeyColumn(affKeyCol.column.getColumnId()); identifier = new QueryTable(getSchema().getName(), getName()); identifierStr = identifier.schema() + "." + identifier.table(); idxs = tblDesc.createSystemIndexes(this); assert idxs != null; List<Index> clones = new ArrayList<>(idxs.size()); for (Index index : idxs) { Index clone = createDuplicateIndexIfNeeded(index); if (clone != null) clones.add(clone); } idxs.addAll(clones); boolean hasHashIndex = idxs.size() >= 2 && index(0).getIndexType().isHash(); if (hasHashIndex) idxs.add(0, new H2TableScanIndex(this, index(1), index(0))); else idxs.add(0, new H2TableScanIndex(this, index(0), null)); pkIndexPos = hasHashIndex ? 2 : 1; sysIdxsCnt = idxs.size(); lock = new ReentrantReadWriteLock(); if (desc != null && desc.context() != null) { GridKernalContext ctx = desc.context().kernalContext(); log = ctx.log(getClass()); } assert log != null; }

Target:
public GridH2Table( CreateTableData createTblData, GridH2RowDescriptor desc, H2TableDescriptor tblDesc, GridCacheContextInfo cacheInfo ) { super(createTblData); assert tblDesc != null; this.desc = desc; this.cacheInfo = cacheInfo; affKeyCol = calculateAffinityKeyColumn(); affKeyColIsKey = affKeyCol != null && desc.isKeyColumn(affKeyCol.column.getColumnId()); identifier = new QueryTable(getSchema().getName(), getName()); identifierStr = identifier.schema() + "." + identifier.table(); idxs = tblDesc.createSystemIndexes(this); assert idxs != null; List<Index> clones = new ArrayList<>(idxs.size()); for (Index index : idxs) { Index clone = createDuplicateIndexIfNeeded(index); if (clone != null) clones.add(clone); } idxs.addAll(clones); boolean hasHashIndex = idxs.size() >= 2 && index(0).getIndexType().isHash(); if (hasHashIndex) idxs.add(0, new H2TableScanIndex(this, index(1), index(0))); else idxs.add(0, new H2TableScanIndex(this, index(0), null)); pkIndexPos = hasHashIndex ? 2 : 1; sysIdxsCnt = idxs.size(); lock = new ReentrantReadWriteLock(); if (cacheInfo.affinityNode()) { long totalTblSize = rowCount(false); size.add(totalTblSize); } tblStats = new TableStatistics(0, 0); if (desc != null && desc.context() != null) { GridKernalContext ctx = desc.context().kernalContext(); log = ctx.log(getClass()); } }
Source:
protected GlusterVolumeProfileInfo setBrickNames(GlusterVolumeProfileInfo profileInfo) { List<BrickProfileDetails> brickProfiles= profileInfo.getBrickProfileDetails(); for(int i = 0; i < brickProfiles.size(); i++) { brickProfiles.get(i).setBrickName(DbFacade.getInstance().getGlusterBrickDao().getById(brickProfiles.get(i).getBrickId()).getQualifiedName()); } return profileInfo; }

Target:
protected GlusterVolumeProfileInfo setBrickNames(GlusterVolumeProfileInfo profileInfo) { List<BrickProfileDetails> brickProfiles= profileInfo.getBrickProfileDetails(); for(BrickProfileDetails brickProfileDetails : brickProfiles) { brickProfileDetails.setBrickName(DbFacade.getInstance().getGlusterBrickDao().getById(brickProfileDetails.getBrickId()).getQualifiedName()); } return profileInfo; }
Source:
public void setDataSourceCountCallback_switchesToDefinedSize_throwsOnSizeQuery() { TestComponent testComponent = new TestComponent(); Assert.assertTrue(testComponent.getLazyDataView().isDefinedSize()); testComponent.setDataSource(query -> Stream.of("foo","bar","baz")); Assert.assertFalse(testComponent.getLazyDataView().isDefinedSize()); testComponent.getLazyDataView().withDefinedSize(); expectedException.expect(IllegalStateException.class); testComponent.getLazyDataView().getSize(); }

Target:
public void setDataSourceCountCallback_switchesToDefinedSize_throwsOnSizeQuery() { TestComponent testComponent = new TestComponent(); testComponent.setDataSource(query -> Stream.of("foo","bar","baz")); Assert.assertFalse(testComponent.getLazyDataView().isDefinedSize()); testComponent.getLazyDataView().withDefinedSize(); Assert.assertTrue(testComponent.getLazyDataView().isDefinedSize()); expectedException.expect(IllegalStateException.class); testComponent.getLazyDataView().getSize(); }
Source:
public void open() throws Exception { joinCondition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader()); joinCondition.setRuntimeContext(getRuntimeContext()); joinCondition.open(new Configuration()); nextLeftIndex = getRuntimeContext().getState( new ValueStateDescriptor<>(NEXT_LEFT_INDEX_STATE_NAME, Types.LONG)); leftState = getRuntimeContext().getMapState( new MapStateDescriptor<>(LEFT_STATE_NAME, Types.LONG, leftType)); rightState = getRuntimeContext().getMapState( new MapStateDescriptor<>(RIGHT_STATE_NAME, Types.LONG, rightType)); registeredTimer = getRuntimeContext().getState( new ValueStateDescriptor<>(REGISTERED_TIMER_STATE_NAME, Types.LONG)); timerService = getInternalTimerService( TIMERS_STATE_NAME, VoidNamespaceSerializer.INSTANCE, this); collector = new TimestampedCollector<>(output); outRow = new JoinedRow(); }

Target:
public void open() throws Exception { joinCondition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader()); joinCondition.setRuntimeContext(getRuntimeContext()); joinCondition.open(new Configuration()); nextLeftIndex = getRuntimeContext().getState( new ValueStateDescriptor<>(NEXT_LEFT_INDEX_STATE_NAME, Types.LONG)); leftState = getRuntimeContext().getMapState( new MapStateDescriptor<>(LEFT_STATE_NAME, Types.LONG, leftType)); rightState = getRuntimeContext().getMapState( new MapStateDescriptor<>(RIGHT_STATE_NAME, Types.LONG, rightType)); registeredTimer = getRuntimeContext().getState( new ValueStateDescriptor<>(REGISTERED_TIMER_STATE_NAME, Types.LONG)); timerService = getInternalTimerService( TIMERS_STATE_NAME, VoidNamespaceSerializer.INSTANCE, this); collector = new TimestampedCollector<>(output); outRow = new JoinedRow(); outRow.setRowKind(RowKind.INSERT); }
Source:
public void endWindow() { logger.info("in endWindow()"); while (doneTuples.peek() != null) { S3Reconciler.OutputMetaData metaData = doneTuples.poll(); logger.info("found metaData = {}", metaData); committedTuples.remove(metaData); try { Path dest = new Path(metaData.getPath()); FileStatus[] statuses = fs.listStatus(dest.getParent()); logger.info("found statuses = {}", statuses); for (FileStatus status : statuses) { String statusName = status.getPath().getName(); logger.info("statusName = {}", statusName); if (statusName.endsWith(TMP_EXTENSION) && statusName.startsWith(metaData.getFileName())) { String actualFileName = statusName.substring(0, statusName.lastIndexOf('.', statusName.lastIndexOf('.') - 1)); logger.info("actualFileName = {}", actualFileName); if (metaData.getFileName().equals(actualFileName)) { logger.info("deleting stray file {}", statusName); fs.delete(status.getPath(), true); } } else if (statusName.equals(metaData.getFileName())) { logger.info("deleting s3-compaction file {}", statusName); fs.delete(status.getPath(), true); } } } catch (IOException e) { logger.error("Unable to Delete a file: {}", metaData.getFileName()); } } }

Target:
public void endWindow() { logger.info("in endWindow()"); while (doneTuples.peek() != null) { FSRecordCompactionOperator.OutputMetaData metaData = doneTuples.poll(); logger.debug("found metaData = {}", metaData); committedTuples.remove(metaData); try { Path dest = new Path(metaData.getPath()); FileStatus[] statuses = fs.listStatus(dest.getParent()); for (FileStatus status : statuses) { String statusName = status.getPath().getName(); if (statusName.endsWith(TMP_EXTENSION) && statusName.startsWith(metaData.getFileName())) { String actualFileName = statusName.substring(0, statusName.lastIndexOf('.', statusName.lastIndexOf('.') - 1)); logger.debug("actualFileName = {}", actualFileName); if (metaData.getFileName().equals(actualFileName)) { logger.debug("deleting stray file {}", statusName); fs.delete(status.getPath(), true); } } else if (statusName.equals(metaData.getFileName())) { logger.info("deleting s3-compaction file {}", statusName); fs.delete(status.getPath(), true); } } } catch (IOException e) { logger.error("Unable to Delete a file: {}", metaData.getFileName()); } } }
Source:
protected List<ILogData> getNextEntries(long maxGlobal) { boolean readQueueIsEmpty = !fillReadQueue(maxGlobal); if (maxGlobal < queueAddressManager.getCheckpointSuccessStartAddr()) { throw new TrimmedException(); } if (readQueueIsEmpty) { return Collections.emptyList(); } List<Long> readList = queueAddressManager.getAllReads(maxGlobal); List<ILogData> readResults = readAll(readList).stream() .filter(x -> x.getType() == DataType.DATA) .filter(x -> x.containsStream(id)) .collect(Collectors.toList()); queueAddressManager.clearQueue(maxGlobal); readResults.stream() .forEach(x -> queueAddressManager.addToResolvedQueue(x.getGlobalAddress())); if (!readResults.isEmpty()) { queueAddressManager.setGlobalPointerCheckGCTrimMark(readResults.get(readResults.size() - 1) .getGlobalAddress()); } return readResults; }

Target:
protected List<ILogData> getNextEntries(long maxGlobal) { boolean readQueueIsEmpty = !fillReadQueue(maxGlobal); if (maxGlobal < queueAddressManager.getCheckpointSuccessStartAddr()) { throw new TrimmedException(); } if (readQueueIsEmpty) { return Collections.emptyList(); } List<Long> readList = queueAddressManager.getAllReads(maxGlobal); List<ILogData> readResults = readAll(readList).stream() .filter(x -> x.getType() == DataType.DATA) .filter(x -> x.containsStream(id)) .collect(Collectors.toList()); queueAddressManager.clearReadQueue(maxGlobal); readResults.stream() .forEach(x -> queueAddressManager.addToResolvedQueue(x.getGlobalAddress())); if (!readResults.isEmpty()) { queueAddressManager.setGlobalPointerCheckGCTrimMark(readResults.get(readResults.size() - 1) .getGlobalAddress()); } return readResults; }
Source:
public Value[] getCurrentValueList(Session session) { HashSet<Value> valueSet = new HashSet<>(); for (Expression e : expressionList) { Value v = e.getValue(session); v = column.convert(v); valueSet.add(v); } Value[] array = valueSet.toArray(new Value[0]); final CompareMode mode = session.getDatabase().getCompareMode(); Arrays.sort(array, new Comparator<Value>() { @Override public int compare(Value o1, Value o2) { return o1.compareTo(o2, mode); } }); return array; }

Target:
public Value[] getCurrentValueList(Session session) { HashSet<Value> valueSet = new HashSet<>(); for (Expression e : expressionList) { Value v = e.getValue(session); v = column.convert(v); valueSet.add(v); } Value[] array = valueSet.toArray(new Value[valueSet.size()]); final CompareMode mode = session.getDatabase().getCompareMode(); Arrays.sort(array, new Comparator<Value>() { @Override public int compare(Value o1, Value o2) { return o1.compareTo(o2, mode); } }); return array; }
Source:
public void executeTransactionAsync_exceptionHandling() throws Throwable { final TestHelper.TestLogger testLogger = new TestHelper.TestLogger(); RealmLog.add(testLogger); final Realm realm = looperThread.realm; assertEquals(0, realm.allObjects(Owner.class).size()); realm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { Owner owner = realm.createObject(Owner.class); owner.setName("Owner"); realm.cancelTransaction(); throw new RuntimeException("Boom"); } }, new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { fail("Should not reach success if runtime exception is thrown in callback."); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { assertEquals("Could not cancel transaction, not currently in a transaction.", testLogger.previousMessage); RealmLog.remove(testLogger); looperThread.testComplete(); } }); }

Target:
public void executeTransactionAsync_exceptionHandling() throws Throwable { final TestHelper.TestLogger testLogger = new TestHelper.TestLogger(); RealmLog.add(testLogger); final Realm realm = looperThread.realm; assertEquals(0, realm.where(Owner.class).count()); realm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { Owner owner = realm.createObject(Owner.class); owner.setName("Owner"); realm.cancelTransaction(); throw new RuntimeException("Boom"); } }, new Realm.Transaction.OnSuccess() { @Override public void onSuccess() { fail("Should not reach success if runtime exception is thrown in callback."); } }, new Realm.Transaction.OnError() { @Override public void onError(Throwable error) { assertEquals("Could not cancel transaction, not currently in a transaction.", testLogger.message); RealmLog.remove(testLogger); looperThread.testComplete(); } }); }
Source:
private VdcBllMessages isReadyToRun(final VDS vds) { if ((!vds.getvds_group_id().equals(getVm().getvds_group_id())) || (vds.getstatus() != VDSStatus.Up) || isVdsFailedToRunVm(vds.getId())) { return VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_CLUSTER; } else if (getVm().getstatus() != VMStatus.Paused && !RunVmCommandBase.hasMemoryToRunVM(vds, getVm())) { return VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_MEMORY; } else if (vds.getcpu_cores() != null && getVm().getnum_of_cpus() > vds.getcpu_cores()) { return VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_CPUS; } else if (!IsVMSwapValueLegal(vds)) { return VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_SWAP; } return null; }

Target:
private ValidationResult isReadyToRun(final VDS vds) { if ((!vds.getvds_group_id().equals(getVm().getvds_group_id())) || (vds.getstatus() != VDSStatus.Up) || isVdsFailedToRunVm(vds.getId())) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_CLUSTER); } else if (getVm().getstatus() != VMStatus.Paused && !RunVmCommandBase.hasMemoryToRunVM(vds, getVm())) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_MEMORY); } else if (vds.getcpu_cores() != null && getVm().getnum_of_cpus() > vds.getcpu_cores()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_CPUS); } else if (!IsVMSwapValueLegal(vds)) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_SWAP); } return new ValidationResult(); }
Source:
public void print(String msg) { for (String part : msg.split("\n")) { sender.sendMessage("\u00A7d" + part); } }

Target:
public void print(String msg) { for (String part : msg.split("\n")) { print(TextComponent.of(part, TextColor.LIGHT_PURPLE)); } }
Source:
public StramLocalCluster(LogicalPlan dag) throws IOException, ClassNotFoundException { dag.validate(); cloneLogicalPlan(dag); String pathUri = CLUSTER_WORK_DIR.toURI().toString(); try { FileContext.getLocalFSFileContext().delete(new Path(pathUri ), true); } catch (IllegalArgumentException e) { throw e; } catch (IOException e) { throw new RuntimeException("could not cleanup test dir", e); } dag.getAttributes().put(LogicalPlan.APPLICATION_ID, "app_local_" + System.currentTimeMillis()); if (dag.getAttributes().get(LogicalPlan.APPLICATION_PATH) == null) { dag.getAttributes().put(LogicalPlan.APPLICATION_PATH, pathUri); } if (dag.getAttributes().get(OperatorContext.STORAGE_AGENT) == null) { dag.setAttribute(OperatorContext.STORAGE_AGENT, new AsyncFSStorageAgent(new Path(pathUri, LogicalPlan.SUBDIR_CHECKPOINTS).toString(), null)); } this.dnmgr = new StreamingContainerManager(dag); this.umbilical = new UmbilicalProtocolLocalImpl(); for (String jar : dag.getJarResources().keySet()) { try { addToClasspath(jar); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { throw new RuntimeException("Failed to add jar to classpath.", e); } } if (!perContainerBufferServer) { StreamingContainer.eventloop.start(); bufferServer = new Server(0, 1024 * 1024,8); bufferServer.setSpoolStorage(new DiskStorage()); SocketAddress bindAddr = bufferServer.run(StreamingContainer.eventloop); this.bufferServerAddress = ((InetSocketAddress)bindAddr); LOG.info("Buffer server started: {}", bufferServerAddress); } }

Target:
public StramLocalCluster(LogicalPlan dag) throws IOException, ClassNotFoundException { dag.validate(); cloneLogicalPlan(dag); String pathUri = CLUSTER_WORK_DIR.toURI().toString(); try { FileContext.getLocalFSFileContext().delete(new Path(pathUri ), true); } catch (IllegalArgumentException e) { throw e; } catch (IOException e) { throw new RuntimeException("could not cleanup test dir", e); } dag.getAttributes().put(LogicalPlan.APPLICATION_ID, "app_local_" + System.currentTimeMillis()); if (dag.getAttributes().get(LogicalPlan.APPLICATION_PATH) == null) { dag.getAttributes().put(LogicalPlan.APPLICATION_PATH, pathUri); } if (dag.getAttributes().get(OperatorContext.STORAGE_AGENT) == null) { dag.setAttribute(OperatorContext.STORAGE_AGENT, new AsyncFSStorageAgent(new Path(pathUri, LogicalPlan.SUBDIR_CHECKPOINTS).toString(), null)); } this.dnmgr = new StreamingContainerManager(dag); this.umbilical = new UmbilicalProtocolLocalImpl(); if (!perContainerBufferServer) { StreamingContainer.eventloop.start(); bufferServer = new Server(0, 1024 * 1024,8); bufferServer.setSpoolStorage(new DiskStorage()); SocketAddress bindAddr = bufferServer.run(StreamingContainer.eventloop); this.bufferServerAddress = ((InetSocketAddress)bindAddr); LOG.info("Buffer server started: {}", bufferServerAddress); } }
Source:
protected boolean isConnectionAlreadyFormed(final Node<? extends View<?>, ? extends Edge> source, final Node<? extends View<?>, ? extends Edge> target, final Edge<? extends View<?>, ? extends Node> connector) { final Set<Edge<? extends View<?>, ? extends Node>> existingEdges = new HashSet<>(); final Class<?> newConnectorClass = connector .getContent() .getDefinition() .getClass(); source.getOutEdges() .stream() .filter(e -> !e.equals(connector)) .forEach(e -> { final Object content = e.getContent(); if (content instanceof Definition) { final Class<?> existingConnectorClass = ((Definition) content).getDefinition().getClass(); if (newConnectorClass.equals(existingConnectorClass)) { existingEdges.add(e); } } }); if (existingEdges.isEmpty()) { return false; } return existingEdges.stream() .map(Edge::getTargetNode) .filter(n -> n != null) .filter(n -> n.equals(target)) .findFirst() .isPresent(); }

Target:
protected boolean isConnectionAlreadyFormed(final Node<? extends View<?>, ? extends Edge> source, final Node<? extends View<?>, ? extends Edge> target, final Edge<? extends View<?>, ? extends Node> connector) { final Class<?> newConnectorClass = connector .getContent() .getDefinition() .getClass(); return source.getOutEdges() .stream() .filter(e -> !Objects.equals(e, connector)) .flatMap(e -> { final Object content = e.getContent(); if (content instanceof Definition) { final Class<?> existingConnectorClass = ((Definition) content).getDefinition().getClass(); if (newConnectorClass.equals(existingConnectorClass)) { return Stream.of(e); } } return Stream.empty(); }) .distinct() .map(Edge::getTargetNode) .anyMatch(n -> Objects.equals(n, target)); }
Source:
public int getAdjacentNodeCount() { if (sourceNodes == null) { return sinkNodes.size(); } else if (sinkNodes == null) { return sourceNodes.size(); } int size = sourceNodes.size(); size += sinkNodes.stream().filter(notContainedBy(sourceNodes)).count(); return size; }

Target:
public int getAdjacentNodeCount() { if (sourceNodes == null) { return sinkNodes.size(); } else if (sinkNodes == null) { return sourceNodes.size(); } return (int) Stream.concat(sourceNodes.stream(), sinkNodes.stream()).distinct() .count(); }
Source:
public static List<Phonenumber> extractTelecoms(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7DbParser201305.ExtractTelecoms method..."); List<Phonenumber> phonenumbers = new ArrayList<>(); Phonenumber phonenumber; if (CollectionUtils.isNotEmpty(params.getPatientTelecom()) && params.getPatientTelecom().get(0) != null) { for (PRPAMT201306UV02PatientTelecom patientTelecom : params.getPatientTelecom()) { String telecom = hl7ParserUtils.extractTelecom(patientTelecom); if (telecom != null) { phonenumber = new Phonenumber(); phonenumber.setValue(telecom); phonenumbers.add(phonenumber); } } } else { LOG.info("message does not contain a patientTelecom"); } LOG.trace("Exiting HL7DbParser201305.ExtractTelecoms method..."); return phonenumbers; }

Target:
public static List<Phonenumber> extractTelecoms(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7DbParser201305.ExtractTelecoms method..."); List<Phonenumber> phonenumbers = new ArrayList<>(); Phonenumber phonenumber; if (CollectionUtils.isNotEmpty(params.getPatientTelecom()) && params.getPatientTelecom().get(0) != null) { for (PRPAMT201306UV02PatientTelecom patientTelecom : params.getPatientTelecom()) { String telecom = hl7ParserUtils.extractTelecom(patientTelecom); if (StringUtils.isNotEmpty(telecom)) { phonenumber = new Phonenumber(); phonenumber.setValue(telecom); phonenumbers.add(phonenumber); } } } else { LOG.info("message does not contain a patientTelecom"); } LOG.trace("Exiting HL7DbParser201305.ExtractTelecoms method..."); return phonenumbers; }
Source:
protected List<String> getKotlinCompilerOptions(boolean isTest) { if (!isKotlin) { return ImmutableList.of(); } ImmutableList.Builder<String> optionBuilder = ImmutableList.builder(); if (getProject().getPlugins().hasPlugin(KotlinManager.KOTLIN_ALLOPEN_MODULE)) { AllOpenKotlinGradleSubplugin subplugin = getAllOpenKotlinGradleSubplugin(); if (subplugin != null && fakeCompile != null) { List<SubpluginOption> options = subplugin.apply(getProject(), fakeCompile, fakeCompile, null, null, null); optionBuilder.add( "-Xplugin=" + KotlinManager.KOTLIN_LIBRARIES_LOCATION + File.separator + KotlinManager.KOTLIN_ALLOPEN_JAR); for (SubpluginOption option : options) { optionBuilder.add("-P"); optionBuilder.add( "plugin:org.jetbrains.kotlin.allopen:" + option.getKey() + "=" + option.getValue()); } } } if (isTest) { optionBuilder.add("-Xfriend-paths=$(location :" + JvmBuckRuleComposer.src(this) + "[output])"); } return optionBuilder.build(); }

Target:
protected List<String> getKotlinCompilerOptions(boolean isTest) { if (!isKotlin) { return ImmutableList.of(); } ImmutableList.Builder<String> optionBuilder = ImmutableList.builder(); if (getProject().getPlugins().hasPlugin(KotlinManager.KOTLIN_ALLOPEN_MODULE)) { AllOpenKotlinGradleSubplugin subplugin = getAllOpenKotlinGradleSubplugin(); if (subplugin != null && fakeCompile != null) { List<SubpluginOption> options = subplugin.apply(getProject(), fakeCompile, fakeCompile, null, null, null); optionBuilder.add( "-Xplugin=" + KotlinManager.KOTLIN_LIBRARIES_LOCATION + File.separator + KotlinManager.KOTLIN_ALLOPEN_JAR); for (SubpluginOption option : options) { optionBuilder.add("-P"); optionBuilder.add("plugin:org.jetbrains.kotlin.allopen:" + option.getKey() + "=" + option.getValue()); } } } if (isTest) { String composedTargetName = JvmBuckRuleComposer.src(this); optionBuilder.add( "-Xfriend-paths=" + Paths.get("buck-out/gen") .resolve(getProject().getRootProject().relativePath(getProject().getProjectDir())) .resolve(String.format("lib__%s__output", composedTargetName)) .resolve(composedTargetName + ".jar") .toString()); } return optionBuilder.build(); }
Source:
private Vector3i findRequiredBuilding(BuildingType buildingType, TaskComponent oreonTaskComponent, HoldingComponent oreonHolding) { List<EntityRef> buildings = oreonHolding.constructedBuildings; for (EntityRef building : buildings) { ConstructedBuildingComponent constructedBuildingComponent = building.getComponent(ConstructedBuildingComponent.class); if (constructedBuildingComponent.buildingType.equals(buildingType)) { oreonTaskComponent.taskRegion = constructedBuildingComponent.boundingRegions.get(86); oreonTaskComponent.buildingToVisit = building; return constructedBuildingComponent.boundingRegions.get(86).min(); } } logger.info("Could not find required building"); return null; }

Target:
private Vector3i findRequiredBuilding(BuildingType buildingType, TaskComponent oreonTaskComponent, HoldingComponent oreonHolding) { List<EntityRef> buildings = oreonHolding.constructedBuildings; for (EntityRef building : buildings) { ConstructedBuildingComponent constructedBuildingComponent = building.getComponent(ConstructedBuildingComponent.class); if (constructedBuildingComponent.buildingType.equals(buildingType)) { oreonTaskComponent.taskRegion = constructedBuildingComponent.boundingRegions.get(Constants.DINER_CHAIR_REGION_INDEX); oreonTaskComponent.buildingToVisit = building; return constructedBuildingComponent.boundingRegions.get(Constants.DINER_CHAIR_REGION_INDEX).min(); } } logger.info("Could not find required building"); return null; }
Source:
public Optional getTrackableSession(final J2EContext context) { return Optional.of(getHttpSession(context)); }

Target:
public Optional getTrackableSession(final J2EContext context) { return Optional.ofNullable(getHttpSession(context)); }
Source:
public void processCancellationBarrier(CancelCheckpointMarker cancelBarrier) throws IOException { final long cancelledId = cancelBarrier.getCheckpointId(); if (cancelledId >= currentCheckpointId && (cancelledId > currentCheckpointId || numBarriersReceived > 0)) { abortInternal(cancelledId, new CheckpointException(CheckpointFailureReason.CHECKPOINT_DECLINED_ON_CANCELLATION_BARRIER)); } }

Target:
public void processCancellationBarrier(CancelCheckpointMarker cancelBarrier) throws IOException { final long cancelledId = cancelBarrier.getCheckpointId(); if (cancelledId > currentCheckpointId || (cancelledId == currentCheckpointId && numBarriersReceived > 0)) { abortInternal(cancelledId, new CheckpointException(CheckpointFailureReason.CHECKPOINT_DECLINED_ON_CANCELLATION_BARRIER)); } }
Source:
private void terminateContainerGracefully(DockerCloud dc, Container container) throws TerminationException, ContainerIsTaintedException { String containerId = container.getId(); Map<String, String> containerLabels = container.getLabels(); String removeVolumesString = containerLabels.get(DockerContainerLabelKeys.REMOVE_VOLUMES); if (removeVolumesString == null) { throw new ContainerIsTaintedException("The removeVolumes label is missing; thus the container must have been " + "mangled unexpectedly; not cleaning up at all anymore, as another tool must have touched it"); } boolean removeVolumes = Boolean.parseBoolean(removeVolumesString); boolean containerRunning = true; if (container.getStatus().startsWith("Dead") || container.getStatus().startsWith("Exited") || container.getStatus().startsWith("Created")) { containerRunning = false; } DockerAPI dockerApi = dc.getDockerApi(); boolean success = stopAndRemoveContainer(dockerApi, LOGGER, String.format("%s is terminating detached Container %s", DockerContainerWatchdog.class.getSimpleName(), containerId), removeVolumes, container.getId(), !containerRunning); if (success) { LOGGER.info("Successfully terminated container consistently", containerId); } else { throw new TerminationException("Graceful termination failed; see logs for detials"); } }

Target:
private void terminateContainerGracefully(DockerCloud dc, Container container) throws TerminationException, ContainerIsTaintedException { String containerId = container.getId(); Map<String, String> containerLabels = container.getLabels(); final String nodeName = containerLabels.get(DockerContainerLabelKeys.NODE_NAME); if (nodeExistsBypassingCache(nodeName)) { LOGGER.warn("Attempt to terminate container ID gracefully, but a node for it suddenly has appeared", container.getId()); throw new ContainerIsTaintedException(String.format("Node for container ID %s has appeared", container.getId())); } containerLabels.get(DockerContainerLabelKeys.REMOVE_VOLUMES); String removeVolumesString = containerLabels.get(DockerContainerLabelKeys.REMOVE_VOLUMES); if (removeVolumesString == null) { throw new ContainerIsTaintedException(String.format("Container ID %s has no '%s' label; skipping.", container.getId(), DockerContainerLabelKeys.REMOVE_VOLUMES)); } boolean removeVolumes = Boolean.parseBoolean(removeVolumesString); boolean containerRunning = true; if (container.getStatus().startsWith("Dead") || container.getStatus().startsWith("Exited") || container.getStatus().startsWith("Created")) { containerRunning = false; } DockerAPI dockerApi = dc.getDockerApi(); Instant start = clock.instant(); boolean success = stopAndRemoveContainer(dockerApi, LOGGER, String.format("(orphaned container found by %s)", DockerContainerWatchdog.class.getSimpleName()), removeVolumes, container.getId(), !containerRunning); Instant stop = clock.instant(); if (success) { executionStatistics.addContainerRemovalGracefully(Duration.between(start, stop).toMillis()); LOGGER.info("Successfully terminated orphaned container {}", containerId); } else { throw new TerminationException("Graceful termination failed."); } }
Source:
public void leaseExpired() { if (listener != null) { listener.notifyDisconnected(); } }

Target:
public void leaseExpired() { disconnectLock.lock(); try { this.listeners.forEach(DisconnectedEventListener::notifyDisconnected); } finally { disconnectLock.unlock(); } }
Source:
public void bindInputs(ChannelBindingService channelBindingService) { if (log.isDebugEnabled()) { log.debug(String.format("Binding inputs for %s:%s", this.channelNamespace, this.type)); } for (Map.Entry<String, ChannelHolder> channelHolderEntry : this.channelFactory.getInputs().entrySet()) { String inputChannelName = channelHolderEntry.getKey(); ChannelHolder channelHolder = channelHolderEntry.getValue(); if (channelHolder.isBindable()) { if (log.isDebugEnabled()) { log.debug(String.format("Binding %s:%s:%s", this.channelNamespace, this.type, inputChannelName)); } channelBindingService.bindConsumer(channelHolder.getMessageChannel(), inputChannelName); } } }

Target:
public void bindInputs(ChannelBindingService channelBindingService) { if (log.isDebugEnabled()) { log.debug(String.format("Binding inputs for %s:%s", this.channelNamespace, this.type)); } for (Map.Entry<String, ChannelHolder> channelHolderEntry : this.inputs.entrySet()) { String inputChannelName = channelHolderEntry.getKey(); ChannelHolder channelHolder = channelHolderEntry.getValue(); if (channelHolder.isBindable()) { if (log.isDebugEnabled()) { log.debug(String.format("Binding %s:%s:%s", this.channelNamespace, this.type, inputChannelName)); } channelBindingService.bindConsumer(channelHolder.getMessageChannel(), inputChannelName); } } }
Source:
void resetButtons() { for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) arrayOfButtons[i][j].setGraphic(new ImageView(imageEmpty)); field.resetLogic(); }

Target:
void resetButtons() { for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) arrayOfButtons[i][j].setGraphic(new ImageView(imageEmpty)); field.resetLogic(); }
Source:
public String sendEventsToEs(){ OnmsRestEventsClient onmsRestEventsClient = new OnmsRestEventsClient(); onmsRestEventsClient.setOnmsUrl(onmsUrl); onmsRestEventsClient.setOnmsPassWord(onmsPassWord); onmsRestEventsClient.setOnmsUserName(onmsUserName); Event firstEvent=null; Event lastEvent=null; boolean endofEvents=false; int eventsSent=0; int eventOffset=offset; while (!endofEvents && eventsSent<=limit){ List<Event> events = onmsRestEventsClient.getEvents(EVENT_RETREIVAL_LIMIT, eventOffset); endofEvents = events.isEmpty(); for(Event event:events){ if(firstEvent==null) firstEvent=event; lastEvent=event; eventsSent++; if (! useNodeLabel){ List<Parm> parmCollection = event.getParmCollection(); ListIterator<Parm> iter = parmCollection.listIterator(); while(iter.hasNext()){ if(XmlOnmsEvent.NODE_LABEL.equals(iter.next().getParmName())){ iter.remove(); } } } LOG.debug("sending event to es: eventid="+event.getDbid()); getEventForwarder().sendNow(event); } eventOffset=eventOffset+EVENT_RETREIVAL_LIMIT; } return "Sent "+eventsSent + " events to Elastic Search. First event id="+firstEvent.getDbid()+ " last event id="+lastEvent.getDbid(); }

Target:
public String sendEventsToEs(){ OnmsRestEventsClient onmsRestEventsClient = new OnmsRestEventsClient(); onmsRestEventsClient.setOnmsUrl(onmsUrl); onmsRestEventsClient.setOnmsPassWord(onmsPassWord); onmsRestEventsClient.setOnmsUserName(onmsUserName); Event firstEvent=null; Event lastEvent=null; boolean endofEvents=false; int eventsSent=0; int eventOffset=offset; while (!endofEvents && eventsSent<=limit){ List<Event> events = onmsRestEventsClient.getEvents(EVENT_RETREIVAL_LIMIT, eventOffset); endofEvents = events.isEmpty(); for(Event event:events){ if(firstEvent==null) firstEvent=event; lastEvent=event; eventsSent++; if (! useNodeLabel){ List<Parm> parmCollection = event.getParmCollection(); ListIterator<Parm> iter = parmCollection.listIterator(); while(iter.hasNext()){ if(OnmsRestEventsClient.NODE_LABEL.equals(iter.next().getParmName())){ iter.remove(); } } } LOG.debug("sending event to es: eventid="+event.getDbid()); getEventForwarder().sendNow(event); } eventOffset=eventOffset+EVENT_RETREIVAL_LIMIT; } return "Sent "+eventsSent + " events to Elastic Search. First event " + "id="+((firstEvent!=null) ? firstEvent.getDbid() : "firstEvent null") + " last event id="+((lastEvent!=null) ? lastEvent.getDbid() : "lastEvent null"); }
Source:
public void upload(InputStream input, OutputStream output, @Nullable OutputStream messages) throws IOException { try { uploadWithExceptionPropagation(input, output, messages); } catch (ServiceMayNotContinueException err) { if (!err.isOutput() && err.getMessage() != null) { try { errOut.writeError(err.getMessage()); } catch (IOException e) { err.addSuppressed(e); throw err; } err.setOutput(); } throw err; } catch (IOException | RuntimeException | Error err) { if (rawOut != null) { String msg = err instanceof PackProtocolException ? err.getMessage() : JGitText.get().internalServerError; try { errOut.writeError(msg); } catch (IOException e) { err.addSuppressed(e); throw err; } throw new UploadPackInternalServerErrorException(err); } throw err; } finally { msgOut = NullOutputStream.INSTANCE; walk.close(); if (timer != null) { try { timer.terminate(); } finally { timer = null; } } } }

Target:
public void upload(InputStream input, OutputStream output, @Nullable OutputStream messages) throws IOException { try { uploadWithExceptionPropagation(input, output, messages); } catch (ServiceMayNotContinueException err) { if (!err.isOutput() && err.getMessage() != null) { try { errOut.writeError(err.getMessage()); } catch (IOException e) { err.addSuppressed(e); throw err; } err.setOutput(); } throw err; } catch (IOException | RuntimeException | Error err) { if (rawOut != null) { String msg = err instanceof PackProtocolException ? err.getMessage() : JGitText.get().internalServerError; try { errOut.writeError(msg); } catch (IOException e) { err.addSuppressed(e); throw err; } throw new UploadPackInternalServerErrorException(err); } throw err; } }
Source:
private boolean isApp(File file) { if (file.getAbsolutePath().contains(".apk")) { String ext = file.getName(); return ext.endsWith(".apk"); } return false; }

Target:
private boolean isApp(File file) { if (file != null) { return file.getAbsolutePath().endsWith(".apk"); } return false; }
Source:
public void onClick(View v) { switch (v.getId()) { case R.id.google_sign_in_button: connectionProgressDialog.show(); saveServerURL(); Toast.makeText(this, getString(R.string.logging_into_server, ZulipApp.get().getServerURI()), Toast.LENGTH_SHORT).show(); setupGoogleSignIn(); break; case R.id.zulip_login: if (!isInputValid(true)) return; saveServerURL(); Toast.makeText(this, getString(R.string.logging_into_server, ZulipApp.get().getServerURI()), Toast.LENGTH_SHORT).show(); connectionProgressDialog.show(); AsyncLogin alog = new AsyncLogin(LoginActivity.this, mUserName.getText().toString(), mPassword.getText().toString(), false); alog.setCallback(new AsyncTaskCompleteListener() { @Override public void onTaskComplete(String result, JSONObject object) { connectionProgressDialog.dismiss(); } @Override public void onTaskFailure(String result) { connectionProgressDialog.dismiss(); } }); alog.execute(); break; case R.id.legal_button: openLegal(); break; case R.id.local_server_button: if (!isInputValid(false)) return; saveServerURL(); AsyncDevGetEmails asyncDevGetEmails = new AsyncDevGetEmails(LoginActivity.this); asyncDevGetEmails.execute(); default: break; } }

Target:
public void onClick(View v) { switch (v.getId()) { case R.id.google_sign_in_button: connectionProgressDialog.show(); saveServerURL(); Toast.makeText(this, getString(R.string.logging_into_server, ZulipApp.get().getServerURI()), Toast.LENGTH_SHORT).show(); setupGoogleSignIn(); break; case R.id.zulip_login: if (!isInputValid()) return; saveServerURL(); Toast.makeText(this, getString(R.string.logging_into_server, ZulipApp.get().getServerURI()), Toast.LENGTH_SHORT).show(); connectionProgressDialog.show(); AsyncLogin alog = new AsyncLogin(LoginActivity.this, mUserName.getText().toString(), mPassword.getText().toString(), false); alog.setCallback(new AsyncTaskCompleteListener() { @Override public void onTaskComplete(String result, JSONObject object) { connectionProgressDialog.dismiss(); } @Override public void onTaskFailure(String result) { connectionProgressDialog.dismiss(); } }); alog.execute(); break; case R.id.legal_button: openLegal(); break; case R.id.local_server_button: if (!isInputValidForDevAuth()) return; saveServerURL(); AsyncDevGetEmails asyncDevGetEmails = new AsyncDevGetEmails(LoginActivity.this); asyncDevGetEmails.execute(); default: break; } }
Source:
public void onReceive(Context context, Intent intent) { if (intent != null) { if (IDP_LOGIN_REQUEST_ACTION.equals(intent.getAction())) { final Bundle extras = intent.getExtras(); if (extras != null) { userHint = extras.getString(USER_HINT_KEY); spActivityName = extras.getString(SP_ACTVITY_NAME_KEY); } if (!doesUserExist()) { launchLoginActivity(); } else { UserAccountManager.getInstance().switchToUser(getUserForHint()); if (!TextUtils.isEmpty(spActivityName)) { try { final Intent launchIntent = new Intent(SalesforceSDKManager.getInstance().getAppContext(), Class.forName(spActivityName)); launchIntent.addCategory(Intent.CATEGORY_DEFAULT); SalesforceSDKManager.getInstance().getAppContext().startActivity(launchIntent); } catch (Exception e) { SalesforceSDKLogger.e(TAG, "Could not start activity", e); } } } } } }

Target:
public void onReceive(Context context, Intent intent) { if (intent != null) { if (IDP_LOGIN_REQUEST_ACTION.equals(intent.getAction())) { final Bundle extras = intent.getExtras(); if (extras != null) { userHint = extras.getString(USER_HINT_KEY); spActivityName = extras.getString(SP_ACTVITY_NAME_KEY); spActivityExtras = extras.getBundle(SP_ACTVITY_EXTRAS_KEY); } if (!doesUserExist()) { launchLoginActivity(); } else { UserAccountManager.getInstance().switchToUser(getUserForHint()); if (!TextUtils.isEmpty(spActivityName)) { try { final Intent launchIntent = new Intent(SalesforceSDKManager.getInstance().getAppContext(), Class.forName(spActivityName)); launchIntent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra(SP_ACTVITY_EXTRAS_KEY, spActivityExtras); SalesforceSDKManager.getInstance().getAppContext().startActivity(launchIntent); } catch (Exception e) { SalesforceSDKLogger.e(TAG, "Could not start activity", e); } } } } } }
Source:
private static Map<String, Object> createEvent(final String identifier, final String eventTypes) { final Map<String, Object> headers = new HashMap<>(); headers.put(FCREPO_URI, identifier); headers.put(FCREPO_DATE_TIME, timestamp); headers.put(FCREPO_AGENT, Arrays.asList(userID, userAgent)); headers.put(FCREPO_EVENT_TYPE, eventTypes); headers.put(FCREPO_BASE_URL, baseUri); headers.put(EVENT_TYPE, "ResourceCreation"); headers.put(IDENTIFIER, "original_file"); headers.put(RESOURCE_TYPE, Binary.getURI()); headers.put("MimeType", "application/octet-stream"); return headers; }

Target:
private static Map<String, Object> createEvent(final String identifier, final String eventTypes) { final Map<String, Object> headers = new HashMap<>(); headers.put(FCREPO_URI, identifier); headers.put(FCREPO_DATE_TIME, timestamp); headers.put(FCREPO_AGENT, Arrays.asList(userID, userAgent)); headers.put(FCREPO_EVENT_TYPE, eventTypes); headers.put(FCREPO_BASE_URL, baseUri); headers.put(EVENT_TYPE, "ResourceCreation"); headers.put(IDENTIFIER, "original_file"); headers.put(RESOURCE_TYPE, Binary.getURI()); headers.put(CdrBinaryMimeType, "application/octet-stream"); return headers; }
Source:
void updateValue() { if (is24HourView) { LocalTimeStringConverter localTimeStringConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMAN); timePicker.setValue(localTimeStringConverter.fromString(selectedHourLabel.getText() + ":" + selectedMinLabel.getText())); } else { String input = selectedHourLabel.getText() + ":" + selectedMinLabel.getText() + " " + period.get(); timePicker.setValue(LocalTime.parse(input, DateTimeFormatter.ofPattern("h:mm a").withLocale(Locale.ENGLISH))); } }

Target:
void updateValue() { if (is24HourView) { LocalTimeStringConverter localTimeStringConverter = new LocalTimeStringConverter(FormatStyle.SHORT, Locale.GERMAN); timePicker.setValue(localTimeStringConverter.fromString(selectedHourLabel.getText() + ":" + selectedMinLabel.getText())); } else { timePicker.setValue(LocalTime.parse(selectedHourLabel.getText() + ":" + selectedMinLabel.getText() + " " + period.get(), DateTimeFormatter.ofPattern("h:mm a").withLocale(Locale.ENGLISH))); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(getIntent().getExtras().getString("selection_name")); setContentView(R.layout.player_skin_simple_layout); EMBED = getIntent().getExtras().getString("embed_code"); OoyalaSkinLayout skinLayout = (OoyalaSkinLayout)findViewById(R.id.ooyalaSkin); PlayerDomain domain = new PlayerDomain(DOMAIN); Options options = new Options.Builder().setShowPromoImage(false).setShowNativeLearnMoreButton(false).setUseExoPlayer(true).build(); player = new OoyalaPlayer(PCODE, domain, options); JSONObject overrides = createSkinOverrides(); SkinOptions skinOptions = new SkinOptions.Builder().setSkinOverrides(overrides).build(); playerLayoutController = new OoyalaSkinLayoutController(getApplication(), skinLayout, player, skinOptions); player.addObserver(this); File folder = new File(android.os.Environment.getExternalStoragePublicDirectory(android.os.Environment.DIRECTORY_MOVIES), EMBED); OfflineVideo ov = OfflineVideo.getVideo(getApplicationContext(), folder); if (player.setUnbundledVideo(ov)) { } else { Log.e(TAG, "Asset Failure"); } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(getIntent().getExtras().getString("selection_name")); setContentView(R.layout.player_skin_simple_layout); EMBED = getIntent().getExtras().getString("embed_code"); OoyalaSkinLayout skinLayout = (OoyalaSkinLayout)findViewById(R.id.ooyalaSkin); PlayerDomain domain = new PlayerDomain(DOMAIN); Options options = new Options.Builder().setShowPromoImage(false).setShowNativeLearnMoreButton(false).setUseExoPlayer(true).build(); player = new OoyalaPlayer(PCODE, domain, options); JSONObject overrides = createSkinOverrides(); SkinOptions skinOptions = new SkinOptions.Builder().setSkinOverrides(overrides).build(); playerLayoutController = new OoyalaSkinLayoutController(getApplication(), skinLayout, player, skinOptions); player.addObserver(this); File folder = new File(android.os.Environment.getExternalStoragePublicDirectory(android.os.Environment.DIRECTORY_MOVIES), EMBED); OfflineVideo ov = OfflineVideo.getVideo(this, folder); if (player.setUnbundledVideo(ov)) { } else { Log.e(TAG, "Asset Failure"); } }
Source:
public Node getNode( Location location ) { if (location != null) { String pathString = factories.getStringFactory().create(location.getPath()); try { return session.getNode(pathString, false); } catch (PathNotFoundException pnfe) { LOGGER.debug("'{0}' not found - it must have been deleted from storage but not yet from the indexes", pathString); } catch (AccessDeniedException ade) { LOGGER.debug("READ access denied on '{0}'", pathString); } catch (RepositoryException re) { LOGGER.error(re, JcrI18n.cannotLoadNodeFromQueryResult, pathString); } } return null; }

Target:
public Node getNode( Location location ) { if (location != null) { Path path = location.getPath(); try { session.checkPermission(path, ModeShapePermissions.READ); return session.node(location.getKey(), null); } catch (ItemNotFoundException infe) { LOGGER.debug("'{0}' not found - it must have been deleted from storage but not yet from the indexes", path); } catch (AccessDeniedException ade) { LOGGER.debug("READ access denied on '{0}'", path); } } return null; }