auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public synchronized Object getEntity() { abortIfClosed(); Object entity = super.getEntity(); if (entity != null) { return entity; } try { InputStream inputStream = getEntityStream(); if(inputStream.available() == 0){ throw new IllegalStateException(); } return inputStream; } catch (IOException e) { throw new IllegalStateException(e); } }

Target:
public synchronized Object getEntity() { abortIfClosed(); Object entity = super.getEntity(); if (entity != null) { return entity; } if (streamFullyRead && bufferedEntity == null) { throw new IllegalStateException(); } return getEntityStream(); }
Source:
private static String toString(List<Channel> channels) { List<String> strings = new ArrayList<>(channels.size()); for (Channel channel : channels) { strings.add(channel.getUID().toString() + '#' + channel.getAcceptedItemType() + '#' + channel.getTriggerType()); } Collections.sort(strings); return Joiner.on(',').join(strings); }

Target:
private static String toString(List<Channel> channels) { List<String> strings = new ArrayList<>(channels.size()); for (Channel channel : channels) { strings.add(channel.getUID().toString() + '#' + channel.getAcceptedItemType() + '#' + channel.getKind()); } Collections.sort(strings); return Joiner.on(',').join(strings); }
Source:
public @ResponseBody ResponseEntity<String> retrieveMODS(@PathVariable("id") String id) throws IOException { PID pid = PIDs.get(id); AgentPrincipals agent = AgentPrincipals.createFromThread(); String modsString; try { modsString = modsService.retrieveMODS(agent, pid); if (modsString == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } } catch (Exception e) { if (e instanceof AuthorizationException || e instanceof AccessRestrictionException) { log.warn("User does not have permission to view metadata for {}", agent.getUsername(), pid); return new ResponseEntity<>(HttpStatus.FORBIDDEN); } else { log.error("Failed to retrieve MODS for object with pid " + pid, e); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } return new ResponseEntity<String>(modsString, HttpStatus.OK); }

Target:
public @ResponseBody ResponseEntity<String> retrieveMODS(@PathVariable("id") String id) throws IOException { PID pid = PIDs.get(id); AgentPrincipals agent = AgentPrincipals.createFromThread(); String modsString; try { modsString = modsService.retrieveMODS(agent, pid); if (modsString == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } } catch (Exception e) { if (e instanceof AuthorizationException || e instanceof AccessRestrictionException) { log.warn("User does not have permission to view metadata for {}", agent.getUsername(), pid); return new ResponseEntity<>(HttpStatus.FORBIDDEN); } else if (e instanceof NotFoundException) { log.warn("There is no object with pid {}", pid); return new ResponseEntity<>(HttpStatus.NOT_FOUND); } else { log.error("Failed to retrieve MODS for object with pid {}", pid, e); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } } return new ResponseEntity<String>(modsString, HttpStatus.OK); }
Source:
protected Image getImage(Template template) { return Activator.getDefault().getImageRegistry().get("swagger_16"); }

Target:
protected Image getImage(Template template) { return Activator.getDefault().getImage(Icons.template_item); }
Source:
protected void onBind() { super.onBind(); registerHandler(getView().getBookmarkButton().addClickHandler(event -> { BookmarkListModel bookmarkListModel = bookmarkModelProvider.getModel(); bookmarkListModel.setSearchString(getView().getSearchString()); bookmarkListModel.getNewCommand().execute(); })); registerHandler(getView().getClearButton().addClickHandler(event -> { model.setSearchString(""); updateViewSearchString(); updateModelSearchString(); })); registerHandler(getView().getSearchButton().addClickHandler(event -> updateModelSearchString())); registerHandler(getView().getSearchInputHandlers().addKeyDownHandler(event -> { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { updateModelSearchString(); } else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { getView().hideSuggestionBox(); } })); BookmarkListModel bookmarkListModel = bookmarkModelProvider.getModel(); bookmarkListModel.getItemsChangedEvent().addListener((ev, sender, args) -> { bookmarkItemsChanged(); }); if (bookmarkListModel.getItems() == null) { bookmarkListModel.search(); } bookmarkItemsChanged(); }

Target:
protected void onBind() { super.onBind(); registerHandler(getView().getBookmarkButton().addClickHandler(event -> { BookmarkListModel bookmarkListModel = bookmarkModelProvider.getModel(); bookmarkListModel.setSearchString(getView().getSearchString()); bookmarkListModel.getNewCommand().execute(); })); registerHandler(getView().getClearButton().addClickHandler(event -> { model.setSearchString(""); updateViewSearchString(); updateModelSearchString(); })); registerHandler(getView().getSearchButton().addClickHandler(event -> updateModelSearchString())); registerHandler(getView().getSearchInputHandlers().addKeyDownHandler(event -> { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { updateModelSearchString(); } else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { getView().hideSuggestionBox(); } })); BookmarkListModel bookmarkListModel = bookmarkModelProvider.getModel(); bookmarkListModel.getItemsChangedEvent().addListener((ev, sender, args) -> bookmarkItemsChanged()); if (bookmarkListModel.getItems() == null) { bookmarkListModel.search(); } bookmarkItemsChanged(); }
Source:
protected void executeCommand() { switch (getDisk().getDiskStorageType()) { case IMAGE: if (getDisk().getDiskStorageType() == DiskStorageType.IMAGE) { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveImage, buildRemoveImageParameters(getDiskImage()), cloneContextAndDetachFromParent()); try { VdcReturnValueBase vdcReturnValue = future.get(); if (vdcReturnValue.getSucceeded()) { incrementVmsGeneration(); setSucceeded(true); } } catch (Exception ex) { log.error("Exception raised during executeAsyncCommand", ex); } } break; case LUN: removeLunDisk(); break; case CINDER: Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveCinderDisk, new RemoveDiskParameters(getParameters().getDiskId()), cloneContextAndDetachFromParent()); try { setReturnValue(future.get()); setSucceeded(getReturnValue().getSucceeded()); } catch (InterruptedException | ExecutionException e) { log.error("Error removing Cinder disk '{}': {}", getDiskImage().getDiskAlias(), e.getMessage()); log.debug("Exception", e); } break; } }

Target:
protected void executeCommand() { switch (getDisk().getDiskStorageType()) { case IMAGE: Future<VdcReturnValueBase> removeImageFuture = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveImage, buildRemoveImageParameters(getDiskImage()), cloneContextAndDetachFromParent()); try { VdcReturnValueBase vdcReturnValue = removeImageFuture.get(); if (vdcReturnValue.getSucceeded()) { incrementVmsGeneration(); setSucceeded(true); } } catch (Exception ex) { log.error("Exception raised during executeAsyncCommand", ex); } break; case LUN: removeLunDisk(); break; case CINDER: Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveCinderDisk, new RemoveDiskParameters(getParameters().getDiskId()), cloneContextAndDetachFromParent()); try { setReturnValue(future.get()); setSucceeded(getReturnValue().getSucceeded()); } catch (InterruptedException | ExecutionException e) { log.error("Error removing Cinder disk '{}': {}", getDiskImage().getDiskAlias(), e.getMessage()); log.debug("Exception", e); } break; } }
Source:
public void testApplication() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.run(10 * 1000); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }

Target:
public void testApplication() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); conf.set("dt.application.RecordReaderExample.operator.fileOutput.prop.filePath", outputDir); File outputfile = FileUtils.getFile(outputDir, "output.txt_5.0"); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); while (!outputfile.exists()) { System.out.println("Sleeping ...."); Thread.sleep(1000); } lc.shutdown(); Assert.assertTrue( FileUtils.contentEquals( FileUtils.getFile( conf.get("dt.application.RecordReaderExample.operator.recordReader.prop.files") ),outputfile)); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }
Source:
public RealmStreamTask<DocumentT> watch(){ return new RealmStreamTaskImpl<>(new RealmStreamTaskImpl.Executor() { @Nullable @Override public OsJavaNetworkTransport.Response sendRequest() throws IOException { BsonArray args = new BsonArray(); BsonDocument arguments = new BsonDocument("database", new BsonString(nameSpace.getDatabaseName())); arguments.put("collection", new BsonString(nameSpace.getCollectionName())); args.add(arguments); OsJavaNetworkTransport.Request request = streamNetworkTransport.makeStreamingRequest("watch", args, osMongoCollection.getServiceName()); return streamNetworkTransport.sendRequest(request); } }, getCodecRegistry(), getDocumentClass()); }

Target:
public RealmEventStreamTask<DocumentT> watch() { return new RealmEventStreamTaskImpl<>(getNamespace().getFullName(), new RealmEventStreamTaskImpl.Executor<DocumentT>() { @Override public EventStream<DocumentT> run() throws IOException { return osMongoCollection.watch(); } }); }
Source:
public boolean archiveRepository(final Project.NameKey name) throws RepositoryNotFoundException { if (isUnreasonableName(name)) { throw new RepositoryNotFoundException("Invalid name: " + name); } File dir = FileKey.resolve(gitDirOf(name), FS.DETECTED); if (dir != null) { String timeStamp = new SimpleDateFormat("yyyyMMddHHmm").format(new Date()); File dest = new File(archivePath.getAbsolutePath() + File.separator + timeStamp + "-" + dir.getName()); return dir.renameTo(dest); } else { throw new RepositoryNotFoundException("Cannot find the repository " + name); } }

Target:
public boolean archiveRepository(final Project.NameKey name) throws RepositoryNotFoundException { if (isUnreasonableName(name)) { throw new RepositoryNotFoundException("Invalid name: " + name); } File dir = FileKey.resolve(gitDirOf(name), FS.DETECTED); if (dir != null) { String today = new SimpleDateFormat("yyyyMMdd").format(new Date()); File moveTo = new File(archivePath.getAbsolutePath() + File.separator + today); moveTo.mkdir(); int lastSlash = name.get().lastIndexOf('/'); if (lastSlash > 0) { String parentDirs = name.get().substring(0, lastSlash); moveTo = new File(moveTo, parentDirs); moveTo.mkdirs(); } String timeStamp = new SimpleDateFormat("HHmmss").format(new Date()); File dest = new File(moveTo, timeStamp + "-" + dir.getName()); return dir.renameTo(dest); } else { throw new RepositoryNotFoundException("Cannot find the repository " + name); } }
Source:
public void updateEntity() { if (Game.isNotHost(getWorld())) return; boolean wasLocked = locked == 0; boolean springState = sprung == 0; List<UUID> lockcarts = getCartsAtLockEntrance(); for (UUID cartUUID : lockcarts) { if (springingCarts.contains(cartUUID)) springingCarts.remove(cartUUID); lockingCarts.add(cartUUID); } List<UUID> springcarts = getCartsAtSpringEntrance(); for (UUID cartUUID : springcarts) { if (lockingCarts.contains(cartUUID)) lockingCarts.remove(cartUUID); springingCarts.add(cartUUID); } List<UUID> cartsOnTrack = CartUtils.getMinecartUUIDsAt( getWorld(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, 0.3f); for (UUID cartOnTrack : cartsOnTrack) { if (springingCarts.contains(cartOnTrack)) { sprung = SPRING_DURATION; locked = 0; break; } else if (lockingCarts.contains(cartOnTrack)) { locked = SPRING_DURATION; sprung = 0; break; } } if (locked > 0) locked--; if (sprung > 0) sprung--; if (locked == 0 && sprung == 0) { lockingCarts.clear(); springingCarts.clear(); } if (springState != (sprung == 0) || wasLocked != (locked == 0)) sendUpdateToClient(); }

Target:
public void updateEntity() { if (Game.isNotHost(getWorld())) return; boolean wasLocked = locked == 0; boolean springState = sprung == 0; if (locked > 0) locked--; if (sprung > 0) sprung--; if (locked == 0 && sprung == 0) { lockingCarts.clear(); springingCarts.clear(); decidingCarts.clear(); currentCart = null; } updateSet(lockingCarts, getCartsAtLockEntrance(), springingCarts, decidingCarts); updateSet(springingCarts, getCartsAtSpringEntrance(), lockingCarts, decidingCarts); updateSet(decidingCarts, getCartsAtDecisionEntrance(), lockingCarts, springingCarts); List<UUID> cartsOnTrack = CartUtils.getMinecartUUIDsAt( getWorld(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, 0.3f); for (UUID cartOnTrack : cartsOnTrack) { if(isSwitched(LinkageManager.instance().getCartFromUUID(cartOnTrack))) { springTrack(cartOnTrack); break; } else { lockTrack(cartOnTrack); break; } } if (springState != (sprung == 0) || wasLocked != (locked == 0)) sendUpdateToClient(); }
Source:
public void onProjectDeleted(Event event) { Project.NameKey p = new NameKey(event.getProjectName()); repoSizeCache.evict(p); }

Target:
public void onProjectDeleted(Event event) { repoSizeCache.evict(new Project.NameKey(event.getProjectName())); }
Source:
protected InputStream execCommand(final String command, InputStream forStdIn, ChannelInputStreams channelInputStream, Session session) throws OpenShiftSSHOperationException { assertLiveSSHSession(); ChannelExec channel = null; try { channel = (ChannelExec) session.openChannel(JSCH_EXEC_CHANNEL); ((ChannelExec) channel).setCommand(command); final OutputStream remoteStdIn = channel.getOutputStream(); InputStream in = channel.getInputStream(); ChannelResponse channelResponse = new ChannelResponse(in, channel); channel.connect(CONNECT_TIMEOUT); if (forStdIn != null) { writeToRemoteStdInput(forStdIn, remoteStdIn); } return channelResponse; } catch (JSchException e) { if (channel != null && channel.isConnected()) { channel.disconnect(); } throw new OpenShiftSSHOperationException(e, "Could no execute remote ssh command \"{0}\" on application {1}", command, application.getName()); } catch (IOException e) { if (channel.isConnected()) { channel.disconnect(); } throw new OpenShiftSSHOperationException(e, "Could not get response channel for remote ssh command \"{0}\" on application {1}", command, application.getName()); } }

Target:
protected InputStream execCommand(final String command, InputStream forStdIn, ChannelInputStreams channelInputStream, Session session) throws OpenShiftSSHOperationException { assertLiveSSHSession(); ChannelExec channel = null; try { channel = (ChannelExec) session.openChannel(JSCH_EXEC_CHANNEL); ((ChannelExec) channel).setCommand(command); final OutputStream remoteStdIn = channel.getOutputStream(); InputStream in = channel.getInputStream(); ChannelResponse channelResponse = new ChannelResponse(in, channel); channel.connect(CONNECT_TIMEOUT); if (forStdIn != null) { writeToRemoteStdInput(forStdIn, remoteStdIn); } return channelResponse; } catch (JSchException e) { if (channel != null && channel.isConnected()) { channel.disconnect(); } throw new OpenShiftSSHOperationException(e, "Could no execute remote ssh command \"{0}\" on application {1}", command, application.getName()); } catch (IOException e) { if (channel != null && channel.isConnected()) { channel.disconnect(); } throw new OpenShiftSSHOperationException(e, "Could not get response channel for remote ssh command \"{0}\" on application {1}", command, application.getName()); } }
Source:
public Set<Subproject> getByProjectId(Long projectId) throws IOException { Project project = projectStore.get(projectId); if (!authorizationManager.readCheck(project)) { return Sets.newHashSet(); } return Sets.newHashSet(subprojectDao.getByProjectId(projectId)); }

Target:
public Set<Subproject> getByProjectId(Long projectId) throws IOException { Project project = projectStore.get(projectId); authorizationManager.throwIfNotReadable(project); return Sets.newHashSet(subprojectDao.getByProjectId(projectId)); }
Source:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); getWindow().setStatusBarColor(Color.TRANSPARENT); getWindow().setNavigationBarColor(0); }

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); getWindow().setStatusBarColor(Color.TRANSPARENT); }
Source:
public String getUuid() { return UUID.randomUUID().toString(); }

Target:
public static String getUuid() { return UUID.randomUUID().toString(); }
Source:
private <E extends Element, S extends DocumentSchema<E>> Iterator<E> search(SearchQuery<E> query, Map<S, Search> schemas) { Optional<MutableMetrics> metrics = query.getStepDescriptor().getMetrics(); MutableMetrics controllerMetric = new MutableMetrics(query.getStepDescriptor().getId() + this.toString(), this.toString()); metrics.ifPresent(metric -> metric.addNested(controllerMetric)); controllerMetric.start(); List<MutableMetrics> childMetrics = schemas.keySet().stream().map((schema) -> new MutableMetrics(query.getStepDescriptor().getId(), schema.toString())).collect(Collectors.toList()); childMetrics.forEach(controllerMetric::addNested); if(schemas.size() == 0) return EmptyIterator.instance(); logger.debug("Preparing search. Schemas: {}", schemas); client.refresh(); MultiSearch multiSearch = new MultiSearch.Builder(schemas.values()).build(); MultiSearchResult results = client.execute(multiSearch); List<MultiSearchResult.MultiSearchResponse> responses = results.getResponses(); for (int i = 0; i < responses.size(); i++) { MutableMetrics child = childMetrics.get(i); MultiSearchResult.MultiSearchResponse response = responses.get(i); child.setCount(TraversalMetrics.ELEMENT_COUNT_ID, response.searchResult.getTotal()); child.setDuration(Long.parseLong(response.searchResult.getJsonObject().get("took").toString()), TimeUnit.MILLISECONDS ); } if(results == null || !results.isSucceeded()) return EmptyIterator.instance(); Iterator<S> schemaIterator = schemas.keySet().iterator(); controllerMetric.stop(); controllerMetric.setCount(TraversalMetrics.ELEMENT_COUNT_ID, controllerMetric.getNested().stream() .mapToLong(n -> n.getCount(TraversalMetrics.ELEMENT_COUNT_ID)).sum()); return responses.stream().filter(this::valid).flatMap(result -> schemaIterator.next().parseResults(result.searchResult.getJsonString(), query).stream()).iterator(); }

Target:
private <E extends Element, S extends DocumentSchema<E>> Iterator<E> search(SearchQuery<E> query, Map<S, Search> schemas) { MetricsRunner metrics = new MetricsRunner(this, query, schemas.keySet().stream().map(s-> ((ElementSchema) s)).collect(Collectors.toList())); if(schemas.size() == 0) return EmptyIterator.instance(); logger.debug("Preparing search. Schemas: {}", schemas); client.refresh(); MultiSearch multiSearch = new MultiSearch.Builder(schemas.values()).build(); MultiSearchResult results = client.execute(multiSearch); List<MultiSearchResult.MultiSearchResponse> responses = results.getResponses(); metrics.stop((children) -> fillChildren(children, responses)); if(results == null || !results.isSucceeded()) return EmptyIterator.instance(); Iterator<S> schemaIterator = schemas.keySet().iterator(); return responses.stream().filter(this::valid).flatMap(result -> schemaIterator.next().parseResults(result.searchResult.getJsonString(), query).stream()).iterator(); }
Source:
public void expireKeys(String depositUUID, int seconds) { try (Jedis jedis = getJedisPool().getResource()) { jedis.expire(DEPOSIT_STATUS_PREFIX + depositUUID, seconds); } }

Target:
public void expireKeys(String depositUUID, int seconds) { try (Jedis jedis = getJedisPool().getResource()) { jedis.expire(DEPOSIT_STATUS_PREFIX + depositUUID, seconds); jedis.expire(DEPOSIT_MANIFEST_PREFIX + depositUUID, seconds); } }
Source:
public RelNode accept(RexShuttle shuttle) { List<RexNode> exps = shuttle.apply(this.exps); if (this.exps == exps) { return this; } final RelDataType rowType = RexUtil.createStructType( getInput().getCluster().getTypeFactory(), exps, this.rowType.getFieldNames(), SqlValidatorUtil.F_SUGGESTER); return copy(traitSet, getInput(), exps, rowType); }

Target:
public RelNode accept(RexShuttle shuttle) { List<RexNode> exps = shuttle.apply(this.exps); if (this.exps == exps) { return this; } final RelDataType rowType = RexUtil.createStructType( getInput().getCluster().getTypeFactory(), exps, this.rowType.getFieldNames(), null); return copy(traitSet, getInput(), exps, rowType); }
Source:
private static List<TimeGraphState> getCurrentThreads(@NonNull ITmfStateSystem ss, ITmfStateInterval userModeInterval, @NonNull NavigableSet<ITmfStateInterval> currentThreadIntervals) throws StateSystemDisposedException { List<TimeGraphState> list = new ArrayList<>(); for (ITmfStateInterval currentThread : currentThreadIntervals) { if (currentThread.getStartTime() <= userModeInterval.getEndTime() && currentThread.getEndTime() >= userModeInterval.getStartTime()) { long start = Long.max(userModeInterval.getStartTime(), currentThread.getStartTime()); long end = Long.min(userModeInterval.getEndTime(), currentThread.getEndTime()); long duration = end - start + 1; Object tid = currentThread.getValue(); if (tid instanceof Integer) { int execNameQuark = ss.optQuarkAbsolute(Attributes.THREADS, String.valueOf(tid), Attributes.EXEC_NAME); if (execNameQuark != ITmfStateSystem.INVALID_ATTRIBUTE) { Object currentThreadName = ss.querySingleState(currentThread.getEndTime(), execNameQuark).getValue(); if (currentThreadName instanceof String) { list.add(new TimeGraphState(start, duration, StateValues.CPU_STATUS_RUN_USERMODE, Messages.Usermode)); continue; } } } list.add(new TimeGraphState(start, duration, StateValues.CPU_STATUS_RUN_USERMODE)); } } return list; }

Target:
private static List<TimeGraphState> getCurrentThreads(@NonNull ITmfStateSystem ss, ITmfStateInterval userModeInterval, @NonNull NavigableSet<ITmfStateInterval> currentThreadIntervals) throws StateSystemDisposedException { List<TimeGraphState> list = new ArrayList<>(); for (ITmfStateInterval currentThread : currentThreadIntervals) { if (currentThread.getStartTime() <= userModeInterval.getEndTime() && currentThread.getEndTime() >= userModeInterval.getStartTime()) { long start = Long.max(userModeInterval.getStartTime(), currentThread.getStartTime()); long end = Long.min(userModeInterval.getEndTime(), currentThread.getEndTime()); long duration = end - start + 1; Object tid = currentThread.getValue(); if (tid instanceof Integer) { int execNameQuark = ss.optQuarkAbsolute(Attributes.THREADS, String.valueOf(tid), Attributes.EXEC_NAME); if (execNameQuark != ITmfStateSystem.INVALID_ATTRIBUTE) { Object currentThreadName = ss.querySingleState(currentThread.getEndTime(), execNameQuark).getValue(); if (currentThreadName instanceof String) { list.add(new TimeGraphState(start, duration, StateValues.CPU_STATUS_RUN_USERMODE, Messages.ThreadStatusUsermode)); continue; } } } list.add(new TimeGraphState(start, duration, StateValues.CPU_STATUS_RUN_USERMODE)); } } return list; }
Source:
public void onReceive(Context context, Intent intent) { TwitterSession session = Twitter.getSessionManager().getActiveSession(); EchoAuth echoAuth = new EchoAuth(session); HandlerAPIConnect.requestToken(echoAuth.getAuthHeaders(),context); }

Target:
public void onReceive(Context context, Intent intent) { TwitterSession session = Twitter.getSessionManager().getActiveSession(); if (session!=null) { EchoAuth echoAuth = new EchoAuth(session); HandlerAPIConnect.requestToken(echoAuth.getAuthHeaders(), context); } }
Source:
public void testStash() { try { git.stashCreate().call(); readFile("Stash Created", git.getRepository().getWorkTree() + "/File1.txt"); git.stashList().call(); git.stashApply().call(); readFile("Stash Created", git.getRepository().getWorkTree() + "/File1.txt"); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void testStash() throws Exception { git.stashCreate().call(); readFile("Stash Created", git.getRepository().getWorkTree() + "/File1.txt"); git.stashList().call(); git.stashApply().call(); readFile("Stash Created", git.getRepository().getWorkTree() + "/File1.txt"); }
Source:
public void testImport() { System.out.println(null instanceof Definitions); DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Importing_Model.dmn", this.getClass(), "Imported_Model.dmn"); DMNModel importedModel = runtime.getModel("<LINK_0>", "Imported Model"); assertThat(importedModel, notNullValue()); for (DMNMessage message : importedModel.getMessages()) { System.out.println(message); } DMNModel dmnModel = runtime.getModel("<LINK_1>", "Importing Model"); assertThat(dmnModel, notNullValue()); for (DMNMessage message : dmnModel.getMessages()) { System.out.println(message); } DMNContext context = runtime.newContext(); context.set("A Person", mapOf(entry("name", "John"), entry("age", 47))); DMNResult evaluateAll = runtime.evaluateAll(dmnModel, context); for (DMNMessage message : evaluateAll.getMessages()) { System.out.println(message); } System.out.println(evaluateAll); assertThat(evaluateAll.getDecisionResultByName("Greeting").getResult(), is("Hello John!")); }

Target:
public void testImport() { System.out.println(null instanceof Definitions); DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Importing_Model.dmn", this.getClass(), "Imported_Model.dmn"); DMNModel importedModel = runtime.getModel("<LINK_0>", "Imported Model"); assertThat(importedModel, notNullValue()); for (DMNMessage message : importedModel.getMessages()) { LOG.debug("{}", message); } DMNModel dmnModel = runtime.getModel("<LINK_1>", "Importing Model"); assertThat(dmnModel, notNullValue()); for (DMNMessage message : dmnModel.getMessages()) { LOG.debug("{}", message); } DMNContext context = runtime.newContext(); context.set("A Person", mapOf(entry("name", "John"), entry("age", 47))); DMNResult evaluateAll = runtime.evaluateAll(dmnModel, context); for (DMNMessage message : evaluateAll.getMessages()) { LOG.debug("{}", message); } LOG.debug("{}", evaluateAll); assertThat(evaluateAll.getDecisionResultByName("Greeting").getResult(), is("Hello John!")); }
Source:
private ResourceNode findMatch(String path, Map<String, String> variables) { Optional<Map.Entry<PathItem, ResourceNode>> first = children.entrySet().stream().filter(f -> f.getKey() instanceof VariablePathItem) .filter(pi -> { VariablePathItem vpi = (VariablePathItem) pi.getKey(); Map<String, String> vars = PathInterpreter.resolveVariables(vpi.getExpression(), path); if (!vars.isEmpty()) { variables.putAll(vars); return true; } return false; }).findFirst(); return first.map(Map.Entry::getValue).orElse(null); }

Target:
private ResourceNode findMatch(String path, Map<String, String> variables) { for (Map.Entry<PathItem, ResourceNode> e : children.entrySet()) { if (e.getKey() instanceof VariablePathItem) { VariablePathItem vpi = (VariablePathItem) e.getKey(); Map<String, String> vars = PathInterpreter.resolveVariables(vpi.getExpression(), path); if (!vars.isEmpty()) { variables.putAll(vars); return e.getValue(); } } } return null; }
Source:
public void start(J project, boolean newInstance) { this.job = project; try { this.tabs = CronTabList.create(spec, Hash.from(project.getFullName())); } catch (ANTLRException e) { LOGGER.log(Level.WARNING, "Failed to parse crontab spec: "+spec,e); } }

Target:
public void start(J project, boolean newInstance) { this.job = project; try { this.tabs = CronTabList.create(spec, Hash.from(project.getFullName())); } catch (ANTLRException e) { LOGGER.log(Level.WARNING, String.format("Failed to parse crontab spec %s in job %s", spec, project.getFullName()), e); } }
Source:
public byte[] getFirstData() { if (bodyType != AmqpMessageBodyType.DATA) { throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("Can not return data for a " + "message which is of type %s.", getBodyType().toString()))); } return Arrays.copyOf(data, data.length); }

Target:
public byte[] getFirstData() { if (bodyType != AmqpMessageBodyType.DATA) { throw logger.logExceptionAsError(new IllegalArgumentException( "This method can only be called for AMQP Data body type at present. Track this issue, " + "<LINK_0> for other body type support in " + "future.")); } return data; }
Source:
final static String getUserNameFromSubject(Subject subject) { if (subject == null || subject.getPrincipals() == null || subject.getPrincipals().isEmpty()) { throw new IllegalArgumentException("Subject is null or does not contain principals"); } Iterator<Principal> piter = subject.getPrincipals().iterator(); Principal principal = piter.next(); String username = principal.getName(); while (piter.hasNext()) { principal = piter.next(); if (principal instanceof DelegatePrincipal) { username = principal.getName(); } } return username; }

Target:
final static String getUserNameFromSubject(Subject subject) { if (subject == null || subject.getPrincipals() == null || subject.getPrincipals().isEmpty()) { throw new IllegalArgumentException("Subject is null or does not contain principals"); } Iterator<Principal> piter = subject.getPrincipals().iterator(); Principal principal = piter.next(); String username = principal.getName(); while (piter.hasNext()) { principal = piter.next(); if (principal instanceof DelegatePrincipal) { username = principal.getName(); break; } } return username; }
Source:
protected void processValue(int quark, long timestamp, ITmfStateValue value) throws AttributeNotFoundException, TimeRangeException, StateValueTypeException { ITmfStateSystemBuilder ss = getStateSystem(); if (ss == null) { throw new IllegalStateException(ILLEGAL_STATE_EXCEPTION_MESSAGE); } switch (getStackType()) { case POP: ss.popAttribute(timestamp, quark); break; case PUSH: ss.pushAttribute(timestamp, value, quark); break; case NULL: case PEEK: default: if (!isUpdate()) { ss.modifyAttribute(timestamp, value, quark); } else { ss.updateOngoingState(value, quark); } break; } }

Target:
protected void processValue(int quark, long timestamp, ITmfStateValue value) throws AttributeNotFoundException, TimeRangeException, StateValueTypeException { ITmfStateSystemBuilder ss = getStateSystem(); if (ss == null) { throw new IllegalStateException(ILLEGAL_STATE_EXCEPTION_MESSAGE); } switch (getStackType()) { case POP: ss.popAttribute(timestamp, quark); break; case PUSH: ss.pushAttribute(timestamp, value, quark); break; case NULL: case PEEK: default: if (isUpdate()) { ss.updateOngoingState(value, quark); } else { ss.modifyAttribute(timestamp, value, quark); } break; } }
Source:
public void setCodecPrivateIfNeeded() { if (codec == Codec.H264) { List<ByteBuffer> sps = selectUnique(spsList); List<ByteBuffer> pps = selectUnique(ppsList); if (!sps.isEmpty() && !pps.isEmpty()) { getEntries().get(0).add(H264Utils.createAvcCFromPS(sps, pps, 4)); } } else if (codec == Codec.AAC) { if (adtsHeader != null) { getEntries().get(0).add(EsdsBox.fromADTS(adtsHeader)); } } }

Target:
public void setCodecPrivateIfNeeded() { if (codec == Codec.H264) { List<ByteBuffer> sps = selectUnique(spsList); List<ByteBuffer> pps = selectUnique(ppsList); if (!sps.isEmpty() && !pps.isEmpty()) { getEntries().get(0).add(H264Utils.createAvcCFromPS(sps, pps, 4)); } else { Logger.warn("CodecMP4MuxerTrack: Not adding a sample entry for h.264 track, missing any SPS/PPS NAL units"); } } else if (codec == Codec.AAC) { if (adtsHeader != null) { getEntries().get(0).add(EsdsBox.fromADTS(adtsHeader)); } else { Logger.warn("CodecMP4MuxerTrack: Not adding a sample entry for AAC track, missing any ADTS headers."); } } }
Source:
public boolean doBuild(TopologyBuilder bldr, Set<String> stageNames) { if (!left.isBuilt() || !right.isBuilt()) { return false; } if (getName() == null) { calculateName(stageNames); } if (stageNames.contains(getName())) { throw new RuntimeException("Duplicate Names"); } stageNames.add(getName()); bldr.setBolt(getName(), new UnionOperator<I>(), getNumPartitions()).shuffleGrouping(left.getName()).shuffleGrouping(right.getName()); return true; }

Target:
public boolean doBuild(TopologyBuilder bldr, Set<String> stageNames) { if (!left.isBuilt() || !right.isBuilt()) { return false; } if (getName() == null) { setName(defaultNameCalculator("union", stageNames)); } if (stageNames.contains(getName())) { throw new RuntimeException("Duplicate Names"); } stageNames.add(getName()); bldr.setBolt(getName(), new UnionOperator<I>(), getNumPartitions()).shuffleGrouping(left.getName()).shuffleGrouping(right.getName()); return true; }
Source:
protected void patchResourcewithSparql(final FedoraResource resource, final String requestBody) { updatePropertiesService.updateProperties(transaction().getId(), getUserPrincipal(), FedoraId.create(resource.getId()), requestBody); }

Target:
protected void patchResourcewithSparql(final FedoraResource resource, final String requestBody) { updatePropertiesService.updateProperties(transaction().getId(), getUserPrincipal(), resource.getFedoraId(), requestBody); }
Source:
void toMessageCollections() { FieldMask fieldMask = Given.fieldMask(Project.STATUS_FIELD_NUMBER, Project.TASK_FIELD_NUMBER); int count = 5; Collection<Project> original = newLinkedList(); for (int i = 0; i < count; i++) { Project project = Given.newProject(format("project-%s", i)); original.add(project); } Collection<Project> masked = FieldMasks.applyMask(fieldMask, original, Given.TYPE); assertSize(original.size(), masked); assertFalse(original == masked); for (Project project : masked) { assertMatchesMask(project, fieldMask); assertFalse(project.getTaskList() .isEmpty()); } }

Target:
void toMessageCollections() { FieldMask fieldMask = Given.fieldMask(Project.STATUS_FIELD_NUMBER, Project.TASK_FIELD_NUMBER); int count = 5; Collection<Project> original = newArrayListWithCapacity(count); for (int i = 0; i < count; i++) { Project project = Given.newProject(format("project-%s", i)); original.add(project); } Collection<Project> masked = FieldMasks.applyMask(fieldMask, original, Given.TYPE); assertSize(original.size(), masked); assertNotSame(original, masked); for (Project project : masked) { assertMatchesMask(project, fieldMask); assertFalse(project.getTaskList() .isEmpty()); } }
Source:
public JSONObject getPoolByBarcode(HttpSession session, JSONObject json) { String barcode = json.getString("barcode"); int container = json.getInt("container"); int partition = json.getInt("partition"); RunImpl r = (RunImpl) session.getAttribute("run_" + json.getString("run_cId")); try { Pool<? extends Poolable> p = null; if (barcode != null && !isStringEmptyOrNull(barcode)) { if (LimsUtils.isBase64String(barcode)) { barcode = new String(Base64.decodeBase64(barcode)); } } if (json.has("platform") && !isStringEmptyOrNull(json.getString("platform"))) { PlatformType pt = PlatformType.get(json.getString("platform")); if (pt != null) { p = requestManager.getPoolByBarcode(barcode, pt); } else { p = requestManager.getPoolByBarcode(barcode); } } else { if (r.getPlatformType() != null) { p = requestManager.getPoolByBarcode(barcode, r.getPlatformType()); } else { p = requestManager.getPoolByBarcode(barcode); } } List<SequencerPartitionContainer> fs = new ArrayList<SequencerPartitionContainer>(r.getSequencerPartitionContainers()); if (!fs.isEmpty()) { SequencerPartitionContainer f = fs.get(container); if (f.getPlatform().getPlatformType().equals(p.getPlatformType())) { return JSONUtils.JSONObjectResponse("html", poolHtml(p, container, partition)); } else { return JSONUtils.JSONObjectResponse("err", "Error: pool platform does not match container platform"); } } return JSONUtils.JSONObjectResponse("err", "Error: cannot get containers from this run"); } catch (IOException e) { log.error("no such pool", e); return JSONUtils.JSONObjectResponse("err", "Error: no such pool"); } }

Target:
public JSONObject getPoolByBarcode(HttpSession session, JSONObject json) { String barcode = json.getString("barcode"); int container = json.getInt("container"); int partition = json.getInt("partition"); RunImpl r = (RunImpl) session.getAttribute("run_" + json.getString("run_cId")); try { Pool<? extends Poolable> p = null; if (!isStringEmptyOrNull(barcode)) { if (LimsUtils.isBase64String(barcode)) { barcode = new String(Base64.decodeBase64(barcode)); } } if (json.has("platform") && !isStringEmptyOrNull(json.getString("platform"))) { PlatformType pt = PlatformType.get(json.getString("platform")); if (pt != null) { p = requestManager.getPoolByBarcode(barcode, pt); } else { p = requestManager.getPoolByBarcode(barcode); } } else { if (r.getPlatformType() != null) { p = requestManager.getPoolByBarcode(barcode, r.getPlatformType()); } else { p = requestManager.getPoolByBarcode(barcode); } } List<SequencerPartitionContainer> fs = new ArrayList<SequencerPartitionContainer>(r.getSequencerPartitionContainers()); if (!fs.isEmpty()) { SequencerPartitionContainer f = fs.get(container); if (f.getPlatform().getPlatformType().equals(p.getPlatformType())) { return JSONUtils.JSONObjectResponse("html", poolHtml(p, container, partition)); } else { return JSONUtils.JSONObjectResponse("err", "Error: pool platform does not match container platform"); } } return JSONUtils.JSONObjectResponse("err", "Error: cannot get containers from this run"); } catch (IOException e) { log.error("no such pool", e); return JSONUtils.JSONObjectResponse("err", "Error: no such pool"); } }
Source:
static CharSequence toLowerCase(CharSequence s) { if (s instanceof AsciiString) { AsciiString asciiString = (AsciiString) s; return asciiString.toLowerCase(); } StringBuilder buffer = null; int len = s.length(); for (int index = 0; index < len; index++) { char c = s.charAt(index); if (c >= 'A' && c <= 'Z') { if (buffer == null) { buffer = new StringBuilder(s); } buffer.setCharAt(index, (char)(c + ('a' - 'A'))); } } if (buffer != null) { return buffer.toString(); } else { return s; } }

Target:
static CharSequence toLowerCase(CharSequence s) { StringBuilder buffer = null; int len = s.length(); for (int index = 0; index < len; index++) { char c = s.charAt(index); if (c >= 'A' && c <= 'Z') { if (buffer == null) { buffer = new StringBuilder(s); } buffer.setCharAt(index, (char)(c + ('a' - 'A'))); } } if (buffer != null) { return buffer.toString(); } else { return s; } }
Source:
static <T> Collection<T> convertAllBeanDataToObjects(Collection<? extends BeanData> data) { return Collections2.transform(data, new BeanDataToObjectFunction<T>()); }

Target:
public static <T> Collection<T> convertAllBeanDataToObjects(Collection<? extends BeanData> data) { return Collections2.transform(data, new BeanDataToObjectFunction<T>()); }
Source:
public void performDurableTopicDeadLetterChannelTestCase() throws Exception { String deletingMessageID; String restoringMessageID; DLCBrowsePage dlcBrowsePage = homePage.getDLCBrowsePage(); Assert.assertNotNull(dlcBrowsePage.isDLCCreated(), "DeadLetter Channel not created. " + DLC_TEST_DURABLE_TOPIC); DLCContentPage dlcContentPage = dlcBrowsePage.getDLCContent(); deletingMessageID = dlcContentPage.deleteFunction(); Assert.assertTrue(checkMessages(deletingMessageID, DLC_TEST_DURABLE_TOPIC), "Deleting messages of dead letter channel is unsuccessful."); Long beforeRestoreMessageReceivedCount = consumerClient.getReceivedMessageCount(); restoringMessageID = dlcContentPage.restoreFunction(); waitUntilMessagesReceived(9L); AndesClientUtils.sleepForInterval(80000L); Long afterRestoreMessageReceivedCount = consumerClient.getReceivedMessageCount(); Assert.assertTrue(beforeRestoreMessageReceivedCount < afterRestoreMessageReceivedCount, restoringMessageID + "Durable topic message not successfully restored."); }

Target:
public void performDurableTopicDeadLetterChannelTestCase() throws IOException { String deletingMessageID; String restoringMessageID; DLCBrowsePage dlcBrowsePage = homePage.getDLCBrowsePage(); Assert.assertNotNull(dlcBrowsePage.isDLCCreated(), "DeadLetter Channel not created. " + DLC_TEST_DURABLE_TOPIC); DLCContentPage dlcContentPage = dlcBrowsePage.getDLCContent(); deletingMessageID = dlcContentPage.deleteFunction(); Assert.assertTrue(checkMessages(deletingMessageID, DLC_TEST_DURABLE_TOPIC), "Deleting messages of dead letter channel is unsuccessful."); Long beforeRestoreMessageReceivedCount = consumerClient.getReceivedMessageCount(); restoringMessageID = dlcContentPage.restoreFunction(); waitUntilMessagesReceived(9L); AndesClientUtils.sleepForInterval(80000L); Long afterRestoreMessageReceivedCount = consumerClient.getReceivedMessageCount(); Assert.assertTrue(beforeRestoreMessageReceivedCount < afterRestoreMessageReceivedCount, restoringMessageID + " Durable topic message not successfully restored."); }
Source:
public boolean contains(Object value) { final Iterator it = new StepIterator(this, stepSize); if (value == null) { return false; } while (it.hasNext()) { try { if (compareEqual(value, it.next())) { return true; } } catch (ClassCastException e) { return false; } } return false; }

Target:
public boolean contains(Object value) { if (value == null) { return false; } final Iterator it = new StepIterator(this, stepSize); while (it.hasNext()) { if (compareEqual(value, it.next())) { return true; } } return false; }
Source:
public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { if (id.isComplete()) return Collections.singleton(id.toObjectId()); boolean noGarbage = avoidUnreachable; HashSet<ObjectId> matches = new HashSet<ObjectId>(4); PackList packList = db.getPackList(); resolveImpl(packList, id, noGarbage, matches); if (MAX_RESOLVE_MATCHES > matches.size() && packList.dirty()) { resolveImpl(db.scanPacks(packList), id, noGarbage, matches); } return matches; }

Target:
public Collection<ObjectId> resolve(AbbreviatedObjectId id) throws IOException { if (id.isComplete()) return Collections.singleton(id.toObjectId()); boolean noGarbage = avoidUnreachable; HashSet<ObjectId> matches = new HashSet<ObjectId>(4); PackList packList = db.getPackList(); resolveImpl(packList, id, noGarbage, matches); if (matches.size() <= MAX_RESOLVE_MATCHES && packList.dirty()) { resolveImpl(db.scanPacks(packList), id, noGarbage, matches); } return matches; }
Source:
protected void updateButtons() { BatchImportTraceWizard wiz = getBatchWizard(); ImportUtils.buildFilesToScan(wiz); updateTable(); wiz.getContainer().updateButtons(); }

Target:
private void updateButtons() { BatchImportTraceWizard wiz = getBatchWizard(); updateTable(); wiz.getContainer().updateButtons(); }
Source:
private String processTopicPartitionStatsRequest() { List<KafkaTopicPartitionStatsResponse> serializedResponses = new ArrayList<>(); synchronized (_runningTasks) { _runningTasks.forEach((dataStreamTask, connectorTaskEntry) -> { KafkaTopicPartitionTracker tracker = connectorTaskEntry.getConnectorTask().getKafkaTopicPartitionTracker(); KafkaTopicPartitionStatsResponse response = new KafkaTopicPartitionStatsResponse(tracker.getConsumerGroupId(), tracker.getTopicPartitions()); serializedResponses.add(response); }); } return KafkaTopicPartitionStatsResponse.toJson(serializedResponses); }

Target:
private String processTopicPartitionStatsRequest() { _logger.info("process topic partitions stats request"); List<KafkaTopicPartitionStatsResponse> serializedResponses = new ArrayList<>(); synchronized (_runningTasks) { _runningTasks.forEach((dataStreamTask, connectorTaskEntry) -> { List<Datastream> datastreams = dataStreamTask.getDatastreams(); Set<String> datastreamNames = new HashSet<>(); datastreams.forEach(datastream -> datastreamNames.add(datastream.getName())); KafkaTopicPartitionTracker tracker = connectorTaskEntry.getConnectorTask().getKafkaTopicPartitionTracker(); KafkaTopicPartitionStatsResponse response = new KafkaTopicPartitionStatsResponse(tracker.getConsumerGroupId(), tracker.getTopicPartitions(), datastreamNames); serializedResponses.add(response); }); } return JsonUtils.toJson(serializedResponses); }
Source:
@NonNull ByteBuffer getByteBufferAt(long position, long size) throws CTFReaderException, IOException { MappedByteBuffer map = fFileChannel.map(MapMode.READ_ONLY, position, size); if( map == null){ throw new CTFReaderException("Failed to allocate mapped byte buffer"); } return map; }

Target:
ByteBuffer getByteBufferAt(long position, long size) throws CTFReaderException, IOException { MappedByteBuffer map = fFileChannel.map(MapMode.READ_ONLY, position, size); if (map == null) { throw new CTFReaderException("Failed to allocate mapped byte buffer"); } return map; }
Source:
synchronized private Set<Guid> removeClearedAndOldTasks() { Set<Guid> poolsOfActiveTasks = new HashSet<Guid>(); Set<Guid> poolsOfClearedAndOldTasks = new HashSet<Guid>(); Map<Guid, SPMAsyncTask> activeTaskMap = new HashMap<Guid, SPMAsyncTask>(); boolean isShouldBeUpdated = false; for (SPMAsyncTask task : _tasks.values()) { if (!CachingOver(task)) { activeTaskMap.put(task.getTaskID(), task); poolsOfActiveTasks.add(task.getStoragePoolID()); } else { isShouldBeUpdated = true; poolsOfClearedAndOldTasks.add(task.getStoragePoolID()); } } if (isShouldBeUpdated) { setNewMap(activeTaskMap); poolsOfClearedAndOldTasks.removeAll(poolsOfActiveTasks); } return poolsOfClearedAndOldTasks; }

Target:
synchronized private Set<Guid> removeClearedAndOldTasks() { Set<Guid> poolsOfActiveTasks = new HashSet<Guid>(); Set<Guid> poolsOfClearedAndOldTasks = new HashSet<Guid>(); Map<Guid, SPMAsyncTask> activeTaskMap = new HashMap<Guid, SPMAsyncTask>(); for (SPMAsyncTask task : _tasks.values()) { if (!CachingOver(task)) { activeTaskMap.put(task.getTaskID(), task); poolsOfActiveTasks.add(task.getStoragePoolID()); } else { poolsOfClearedAndOldTasks.add(task.getStoragePoolID()); } } if (poolsOfClearedAndOldTasks.size() > 0) { setNewMap(activeTaskMap); poolsOfClearedAndOldTasks.removeAll(poolsOfActiveTasks); } return poolsOfClearedAndOldTasks; }
Source:
Series(String string) { this.digits = Arrays.stream(string.split((""))) .map(Integer::parseInt) .collect(Collectors.toList()); this.digitsSize = this.digits.size(); }

Target:
Series(String string) { this.digits = Arrays.stream(string.split("")) .map(Integer::parseInt) .collect(Collectors.toList()); this.digitsSize = this.digits.size(); }
Source:
private static int getWindowHeightAPI23Plus(@NonNull Activity activity) { View decorView = activity.getWindow().getDecorView(); if (decorView.getRootWindowInsets() == null) return decorView.getHeight(); return decorView.getHeight() - decorView.getRootWindowInsets().getStableInsetBottom() - decorView.getRootWindowInsets().getStableInsetTop(); }

Target:
private static int getWindowHeightAPI23Plus(@NonNull Activity activity) { View decorView = activity.getWindow().getDecorView(); WindowInsets windowInsets = decorView.getRootWindowInsets(); if (windowInsets == null) return decorView.getHeight(); return decorView.getHeight() - windowInsets.getStableInsetBottom() - windowInsets.getStableInsetTop(); }