auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private int optimisedRead(final byte[] b, final int off, final int len, final long readFrom, final long actualLen) throws IOException { int totalBytesRead = 0; fCursor = readFrom; for (int i = 0; i < 2 && fCursor < contentLength; i++) { int bytesRead = readInternal(fCursor, buffer, limit, (int) actualLen - limit, true); if (bytesRead > 0) { totalBytesRead += bytesRead; limit += bytesRead; fCursor += bytesRead; } } if (fCursor < contentLength && bCursor > limit) { restorePointerState(); return readOneBlock(b, off, len); } firstRead = false; if (totalBytesRead == -1) { return -1; } return copyToUserBuffer(b, off, len); }

Target:
private int optimisedRead(final byte[] b, final int off, final int len, final long readFrom, final long actualLen) throws IOException { fCursor = readFrom; int totalBytesRead = 0; int lastBytesRead = 0; try { buffer = new byte[bufferSize]; for (int i = 0; i < MAX_OPTIMIZED_READ_ATTEMPTS && fCursor < contentLength; i++) { lastBytesRead = readInternal(fCursor, buffer, limit, (int) actualLen - limit, true); if (lastBytesRead > 0) { totalBytesRead += lastBytesRead; limit += lastBytesRead; fCursor += lastBytesRead; fCursorAfterLastRead = fCursor; } } } catch (IOException e) { LOG.debug("Optimized read failed. Defaulting to readOneBlock {}", e); restorePointerState(); return readOneBlock(b, off, len); } finally { firstRead = false; } if (totalBytesRead < 1) { restorePointerState(); return -1; } if (fCursor < contentLength && bCursor > limit) { restorePointerState(); return readOneBlock(b, off, len); } return copyToUserBuffer(b, off, len); }
Source:
private void testDeleteResponse() { ______TS("test delete response"); submitPage.fillResponseTextBox(2, 0, ""); submitPage.fillResponseTextBox(1, 0, ""); submitPage.clickSubmitButton(); submitPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertNull(fr); fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 2); fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertNull(fr); submitPage.waitForAndDismissAlertModal(); }

Target:
private void testDeleteResponse() { ______TS("test delete response"); submitPage.fillResponseTextBox(2, 0, ""); submitPage.fillResponseTextBox(1, 0, ""); submitPage.clickSubmitButton(); submitPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED); submitPage.verifyAndCloseSuccessfulSubmissionModal(); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertNull(fr); fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 2); fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertNull(fr); }
Source:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { Elevator.elevatorControl.set(true); waitUntil(Elevator.topLimitSwitch); boolean r = Rollers.running.get(); Rollers.direction.set(true); Rollers.running.set(true); waitUntil(crateInPosition); Rollers.running.set(r); Elevator.elevatorControl.set(false); }

Target:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { Elevator.elevatorControl.set(true); waitUntil(Elevator.topLimitSwitch); boolean r = Rollers.running.get(); boolean d = Rollers.direction.get(); Rollers.direction.set(true); Rollers.running.set(true); waitUntil(crateInPosition); Rollers.running.set(r); Rollers.direction.set(d); Elevator.elevatorControl.set(false); }
Source:
protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException { if (monitor == null) { monitor = new EclipseMonitor(new NullProgressMonitor()); } out.writeInt(infos); monitor.begin(infos); try { writeRevisionAvailabilityInfo(out, targetInfo, monitor.fork()); writeRevisionAvailabilityInfo(out, sourceInfo, monitor.fork()); if (infos > 2) { writeRevisionAvailabilityInfo(out, targetBaseInfo, monitor.fork()); } if (infos > 3) { writeRevisionAvailabilityInfo(out, sourceBaseInfo, monitor.fork()); } } finally { monitor.done(); } }

Target:
protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException { out.writeInt(infos); if (monitor != null) { monitor.begin(infos); } try { writeRevisionAvailabilityInfo(out, targetInfo, monitor != null ? monitor.fork() : null); writeRevisionAvailabilityInfo(out, sourceInfo, monitor != null ? monitor.fork() : null); if (infos > 2) { writeRevisionAvailabilityInfo(out, targetBaseInfo, monitor != null ? monitor.fork() : null); } if (infos > 3) { writeRevisionAvailabilityInfo(out, sourceBaseInfo, monitor != null ? monitor.fork() : null); } } finally { if (monitor != null) { monitor.done(); } } }
Source:
public FileCopyOutputFormatProvider(AbstractFileCopySink.AbstractFileCopySinkConfig config) { this.conf = new HashMap<>(); FileCopyOutputFormat.setBasePath(conf, config.basePath); FileCopyOutputFormat.setEnableOverwrite(conf, config.enableOverwrite.toString()); FileCopyOutputFormat.setPreserveFileOwner(conf, config.preserveFileOwner.toString()); if (config.bufferSize != null) { FileCopyOutputFormat.setBufferSize(conf, String.valueOf(config.bufferSize << 20)); } else { FileCopyOutputFormat.setBufferSize(conf, String.valueOf(FileCopyRecordWriter.DEFAULT_BUFFER_SIZE)); } conf.put(String.format("fs.%s.impl.disable.cache", config.getScheme()), String.valueOf(true)); if (config.getHostUri() != null) { FileCopyOutputFormat.setFilesystemHostUri(conf, config.getHostUri()); } }

Target:
public FileCopyOutputFormatProvider(AbstractFileCopySink.AbstractFileCopySinkConfig config) { this.conf = new HashMap<>(); FileCopyOutputFormat.setBasePath(conf, config.basePath); FileCopyOutputFormat.setEnableOverwrite(conf, config.enableOverwrite.toString()); FileCopyOutputFormat.setPreserveFileOwner(conf, config.preserveFileOwner.toString()); FileCopyOutputFormat.setFilesystemScheme(conf, config.getScheme()); if (config.bufferSize != null) { FileCopyOutputFormat.setBufferSize(conf, String.valueOf(config.bufferSize << 20)); } else { FileCopyOutputFormat.setBufferSize(conf, String.valueOf(FileCopyRecordWriter.DEFAULT_BUFFER_SIZE)); } if (config.getHostUri() != null) { FileCopyOutputFormat.setFilesystemHostUri(conf, config.getHostUri()); } }
Source:
private Set<String> getUsageArguments() { Set<String> args = new TreeSet<>(); for (String argName : this.properties.stringPropertyNames()) { String[] param = argName.split("\\."); if((param.length > 1 && !param[1].equals("arg")) || !param[0].equals(this.prefix)) { continue; } if (param.length < 4) { throw new IllegalArgumentException( String.format("Invalid option '%1$s'", argName) ); } args.add(param[2]); } return args; }

Target:
private Set<String> getUsageArguments() { Set<String> args = new TreeSet<>(); for (String argName : this.properties.stringPropertyNames()) { String[] param = argName.split("\\."); if((param.length > 1 && !param[1].equals("arg")) || !param[0].equals(this.prefix)) { continue; } if (param.length < 4) { throw new IllegalArgumentException( String.format("Invalid configuration. Invalid structure for parameter'%1$s'", argName) ); } args.add(param[2]); } return args; }
Source:
protected String getQueueName(Task task) { return task.getTaskData().getDeploymentId()+"_"+task.getName(); }

Target:
protected String getQueueName(Task task) { return task.getTaskData().getProcessId()+"_"+task.getTaskData().getDeploymentId()+"_"+task.getName(); }
Source:
private void drag(double fromXScreen, double fromYScreen, double toXScreen, double toYScreen) { mapCanvas.setTranslateX(0); mapCanvas.setTranslateY(0); Point2D.Double from = new Point2D.Double(fromYScreen, fromXScreen); Point2D.Double to = new Point2D.Double(toYScreen, toXScreen); from = transformScreenToWorld(from); to = transformScreenToWorld(to); double fromX = from.getX(); double fromY = from.getY(); double toX = to.getX(); double toY = to.getY(); double xOffset = (toX - fromX); double yOffset = (toY - fromY); ReferencedEnvelope bBox = this.mapContent.getViewport().getBounds(); Point2D.Double minXY = transformScreenToWorld(new Point2D.Double(0 - toXScreen, 0 - toYScreen)); Point2D.Double maxXY = transformScreenToWorld(new Point2D.Double(dimensionX - toXScreen, dimensionY - toYScreen)); ReferencedEnvelope newBounds = new ReferencedEnvelope( minXY.getX(), maxXY.getX(), minXY.getY(), maxXY.getY(), this.crs); if(!maxBBox.contains(newBounds, true)){ newBounds = bBox; } setExtent(newBounds); }

Target:
private void drag(double fromXScreen, double fromYScreen, double toXScreen, double toYScreen) { mapCanvas.setTranslateX(0); mapCanvas.setTranslateY(0); ReferencedEnvelope bBox = this.mapContent.getViewport().getBounds(); Point2D.Double minXY = transformScreenToWorld(new Point2D.Double(0 - toXScreen, 0 - toYScreen)); Point2D.Double maxXY = transformScreenToWorld(new Point2D.Double(dimensionX - toXScreen, dimensionY - toYScreen)); ReferencedEnvelope newBounds = new ReferencedEnvelope( minXY.getX(), maxXY.getX(), minXY.getY(), maxXY.getY(), this.crs); if(!maxBBox.contains(newBounds, true)){ newBounds = bBox; } setExtent(newBounds); }
Source:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue( UserGroupUtil.retrieveUserAdGroups(DbFacade.getInstance().getDbUserDao() .get((getParameters()).getId(), getParameters().isFiltered()))); }

Target:
protected void executeQueryCommand() { DbUser user = DbFacade.getInstance().getDbUserDao() .get((getParameters()).getId(), getParameters().isFiltered()); if (getParameters() instanceof GetDbUserByUserIdParameters && ((GetDbUserByUserIdParameters) getParameters()).isResolveGroups()) { UserGroupUtil.retrieveUserGroups(user); } getQueryReturnValue().setReturnValue(user); }
Source:
public void cleanup() { if (internalLocator != null) { try { internalLocator.stop(); } catch (RuntimeException ignore) { } } }

Target:
public void cleanup() { if (internalLocator != null) { internalLocator.stop(); } }
Source:
public List<ModFile> scanMods() { LOGGER.debug(SCAN,"Scanning mods dir for mods", this.modFolder); return uncheck(()-> Files.list(this.modFolder)). sorted(Comparator.comparing(path-> StringUtils.toLowerCase(path.getFileName().toString()))). filter(p->StringUtils.toLowerCase(p.getFileName().toString()).endsWith(SUFFIX)). map(p->new ModFile(p, this)). filter(f->modJars.compute(f, (mf, fs)->createFileSystem(mf))!=null). collect(Collectors.toList()); }

Target:
public List<ModFile> scanMods() { LOGGER.debug(SCAN,"Scanning mods dir for mods", this.modFolder); return uncheck(()-> Files.list(this.modFolder)). sorted(Comparator.comparing(path-> StringUtils.toLowerCase(path.getFileName().toString()))). filter(p->StringUtils.toLowerCase(p.getFileName().toString()).endsWith(SUFFIX)). map(p->new ModFile(p, this)). peek(f->modJars.compute(f, (mf, fs)->createFileSystem(mf))). collect(Collectors.toList()); }
Source:
public boolean applicableInState(State state, String[] params) { if (!super.applicableInState(state, params)) { return false; } ObjectInstance tool = state.getObject(params[1]); ObjectInstance container = state.getObject(params[2]); if (!ToolFactory.getSpaceName(tool).equals(ContainerFactory.getSpaceName(container))) { return false; } for (String name : ContainerFactory.getContentNames(container)) { ObjectInstance ingredient = state.getObject(name); if (!ToolFactory.toolCanBeUsed(tool, ingredient)) { return false; } if (ToolFactory.toolHasBeenUsed(tool, ingredient)) { return false; } } return true; }

Target:
public boolean applicableInState(State state, String[] params) { return this.checkActionIsApplicableInState(state, params).getIsSuccess(); }
Source:
private String translateAuthenticationMessage(AuthenticationFailedMessage message) { String context = message.getContext(); if (context == null) { context = ""; } switch (context) { case "denied": return i18n.get("login.deniedError"); case "steam_link": return i18n.get("login.steamLinkError", clientProperties.getWebsite().getSteamLinkUrl()); case "policy": String result = message.getResult(); if (result != null) { switch (result) { case "vm": return i18n.get("login.policyVMError", clientProperties.getWebsite().getSteamLinkUrl()); case "already_associated": return i18n.get("login.policyAssociatedError", clientProperties.getWebsite().getSteamLinkUrl()); case "fraudulent": return i18n.get("login.policyFraudulentError"); default: return i18n.get("login.policyError", result); } } } String messageText = message.getText(); return messageText != null ? messageText: i18n.get("login.failedError"); }

Target:
private String translateAuthenticationMessage(AuthenticationFailedMessage message) { String context = message.getContext(); if (context == null) { String messageText = message.getText(); return messageText != null ? messageText: i18n.get("login.error"); } ArrayList<String> key = new ArrayList(Arrays.asList("login", "error", context)); ArrayList<Object> args = new ArrayList(Arrays.asList(clientProperties.getWebsite().getSteamLinkUrl())); String result = message.getResult(); if (context.equals("policy") && result != null) { key.add(result); args.add(result); } Object[] argsArray = args.toArray(); while(key.size() > 1) { try { return i18n.get(String.join(".", key), argsArray); } catch(NoSuchMessageException e) { key.remove(key.size() - 1); } } return "login.error"; }
Source:
protected boolean validate() { if (getParameters().getVmBackup().getFromCheckpointId() != null && !FeatureSupported.isIncrementalBackupSupported(getCluster().getCompatibilityVersion())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_INCREMENTAL_BACKUP_NOT_SUPPORTED); } DiskExistenceValidator diskExistenceValidator = createDiskExistenceValidator(getDiskIds()); if (!validate(diskExistenceValidator.disksNotExist())) { return false; } if (getParameters().getVmBackup().getFromCheckpointId() != null) { DiskImagesValidator diskImagesValidator = createDiskImagesValidator(getDisks()); if (!validate(diskImagesValidator.incrementalBackupEnabled())) { return false; } } if (!getVm().getStatus().isQualifiedForVmBackup()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_VM_SHOULD_BE_IN_UP_STATUS); } if (!vmBackupDao.getAllForVm(getVmId()).isEmpty()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_ALREADY_IN_PROGRESS); } if (!getVds().isBackupEnabled()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_NOT_SUPPORTED_BY_VDS, String.format("$vdsName %s", getVdsName())); } return true; }

Target:
protected boolean validate() { DiskExistenceValidator diskExistenceValidator = createDiskExistenceValidator(getDiskIds()); if (!validate(diskExistenceValidator.disksNotExist())) { return false; } if (getParameters().getVmBackup().getFromCheckpointId() != null) { if (!FeatureSupported.isIncrementalBackupSupported(getCluster().getCompatibilityVersion())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_INCREMENTAL_BACKUP_NOT_SUPPORTED); } DiskImagesValidator diskImagesValidator = createDiskImagesValidator(getDisks()); if (!validate(diskImagesValidator.incrementalBackupEnabled())) { return false; } } if (!getVm().getStatus().isQualifiedForVmBackup()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_VM_SHOULD_BE_IN_UP_STATUS); } if (!vmBackupDao.getAllForVm(getVmId()).isEmpty()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_ALREADY_IN_PROGRESS); } if (!getVds().isBackupEnabled()) { return failValidation(EngineMessage.CANNOT_START_BACKUP_NOT_SUPPORTED_BY_VDS, String.format("$vdsName %s", getVdsName())); } return true; }
Source:
protected ResourceSetListenerImpl getEventListener() { return eventListener; }

Target:
protected ResourceSetListener getEventListener() { return eventListener; }
Source:
public StrPosb() { super(new Column[] { new Column("org/apache/tajo/storage/text", TajoDataTypes.Type.TEXT), new Column("substring", TajoDataTypes.Type.TEXT) }); }

Target:
public StrPosb() { super(new Column[] { new Column("text", TajoDataTypes.Type.TEXT), new Column("substring", TajoDataTypes.Type.TEXT) }); }
Source:
public Filter toFilter() { ExtractionFn extractionFn = getExtractionFn(); String dimension = getDimension(); final String value = getValue(); if (extractionFn == null) { return new NoBitmapSelectorFilter(dimension, value); } else { final String valueOrNull = Strings.emptyToNull(value); final DruidPredicateFactory predicateFactory = new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { return new Predicate<String>() { @Override public boolean apply(String input) { return Objects.equals(valueOrNull, input); } }; } @Override public DruidLongPredicate makeLongPredicate() { return new DruidLongPredicate() { @Override public boolean applyLong(long input) { return false; } }; } @Override public DruidFloatPredicate makeFloatPredicate() { return new DruidFloatPredicate() { @Override public boolean applyFloat(float input) { return false; } }; } }; return new NoBitmapDimensionPredicateFilter(dimension, predicateFactory, extractionFn); } }

Target:
public Filter toFilter() { ExtractionFn extractionFn = getExtractionFn(); String dimension = getDimension(); final String value = getValue(); if (extractionFn == null) { return new NoBitmapSelectorFilter(dimension, value); } else { final String valueOrNull = Strings.emptyToNull(value); final DruidPredicateFactory predicateFactory = new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { return new Predicate<String>() { @Override public boolean apply(String input) { return Objects.equals(valueOrNull, input); } }; } @Override public DruidLongPredicate makeLongPredicate() { return DruidLongPredicate.ALWAYS_FALSE; } @Override public DruidFloatPredicate makeFloatPredicate() { return DruidFloatPredicate.ALWAYS_FALSE; } }; return new NoBitmapDimensionPredicateFilter(dimension, predicateFactory, extractionFn); } }
Source:
public void testCachePutPluginModifiesMetacard() { String name = "attribute"; String value = "value"; List<Metacard> metacards = new ArrayList<>(); Metacard metacard = mock(Metacard.class); when(metacard.getSourceId()).thenReturn(TEST_ID); when(metacard.getId()).thenReturn(TEST_ID); metacards.add(metacard); when(mockCachePutPlugin.process(any())) .thenAnswer( (Answer<Optional<Metacard>>) invocationOnMock -> { Metacard metacardToModify = (Metacard) invocationOnMock.getArguments()[0]; metacardToModify.setAttribute(new AttributeImpl(name, value)); return Optional.of(metacardToModify); }); solrCache.put(metacards); ArgumentCaptor<Attribute> argumentCaptor = ArgumentCaptor.forClass(Attribute.class); verify(metacard).setAttribute(argumentCaptor.capture()); assertThat(argumentCaptor.getValue().getName(), is(name)); assertThat(argumentCaptor.getValue().getValue(), is(value)); }

Target:
public void testCachePutPluginModifiesMetacard() throws SolrServerException, MetacardCreationException, IOException { String name = "attribute"; String value = "value"; List<Metacard> metacards = new ArrayList<>(); MetacardImpl metacard = new MetacardImpl(); metacard.setSourceId(TEST_ID); metacard.setId(TEST_ID); metacards.add(metacard); when(mockCachePutPlugin.process(any())) .thenAnswer( invocationOnMock -> { Metacard metacardToModify = (Metacard) invocationOnMock.getArguments()[0]; metacardToModify.setAttribute(new AttributeImpl(name, value)); return Optional.of(metacardToModify); }); solrCache.put(metacards); ArgumentCaptor<List> updatedMetacardsCaptor = ArgumentCaptor.forClass(List.class); verify(mockCacheSolrMetacardClient).add(updatedMetacardsCaptor.capture(), eq(false)); assertThat(updatedMetacardsCaptor.getValue().size(), is(1)); assertThat(updatedMetacardsCaptor.getValue().get(0), is(metacard)); Metacard capturedMetacard = (Metacard) updatedMetacardsCaptor.getValue().get(0); assertThat(capturedMetacard.getAttribute(name), notNullValue()); assertThat(capturedMetacard.getAttribute(name).getValue(), is(value)); }
Source:
void canConstructReportsUrlFromTeamcityProperty() { System.setProperty("teamcity.serverUrl", "<LINK_0>"); System.setProperty("teamcity.buildType.id", "my-build"); System.setProperty("build.number", "1"); assertThat(new SelenideConfig().reportsUrl()).isEqualTo("<LINK_0>/repository/download/my-build/1:id/"); }

Target:
void canConstructReportsUrlFromTeamcityProperty() { System.setProperty("teamcity.serverUrl", "<LINK_0>"); System.setProperty("teamcity.buildType.id", "my-build"); System.setProperty("build.number", "1"); assertThat(new SelenideConfig().reportsUrl()).isEqualTo("<LINK_0>repository/download/my-build/1:id/"); }
Source:
public boolean hasNext() { return currentIdx < numberOfEntries(mmap); }

Target:
public boolean hasNext() { return currentIdx < numberOfEntries; }
Source:
public static List<ContainerStatus> getContainerStatus(Pod pod) { PodStatus podStatus = pod.getStatus(); if (podStatus == null) { return Collections.emptyList(); } return pod.getStatus().getContainerStatuses(); }

Target:
public static List<ContainerStatus> getContainerStatus(Pod pod) { PodStatus podStatus = pod.getStatus(); if (podStatus == null) { return Collections.emptyList(); } return podStatus.getContainerStatuses(); }
Source:
public PageRequest() { this.offset = null; this.limit = DEFAULT_LIMIT; }

Target:
public PageRequest() { this(null, DEFAULT_LIMIT); }
Source:
public RebaseCommand setUpstream(String upstream) throws RefNotFoundException { try { ObjectId upstreamId = repo.resolve(upstream); if (upstreamId == null) throw new RefNotFoundException(MessageFormat.format(JGitText .get().refNotResolved, upstream)); upstreamCommit = new RevWalk(repo).parseCommit(repo .resolve(upstream)); return this; } catch (IOException ioe) { throw new JGitInternalException(ioe.getMessage(), ioe); } }

Target:
public RebaseCommand setUpstream(String upstream) throws RefNotFoundException { try { ObjectId upstreamId = repo.resolve(upstream); if (upstreamId == null) throw new RefNotFoundException(MessageFormat.format(JGitText .get().refNotResolved, upstream)); upstreamCommit = walk.parseCommit(repo.resolve(upstream)); return this; } catch (IOException ioe) { throw new JGitInternalException(ioe.getMessage(), ioe); } }
Source:
public RealmAsyncTask changePasswordAsync(final String newPassword, final Callback callback) { checkLooperThread("Asynchronous changing password is only possible from looper threads."); return new Request(SyncManager.NETWORK_POOL_EXECUTOR, callback) { @Override public SyncUser run() { changePassword(newPassword); return SyncUser.this; } }.start(); }

Target:
public RealmAsyncTask changePasswordAsync(final String newPassword, final Callback callback) { checkLooperThread("Asynchronous changing password is only possible from looper threads."); if (callback == null) { throw new IllegalArgumentException("Non-null 'callback' required."); } return new Request(SyncManager.NETWORK_POOL_EXECUTOR, callback) { @Override public SyncUser run() { changePassword(newPassword); return SyncUser.this; } }.start(); }
Source:
private CompositeByteBuf(ByteBufAllocator alloc, boolean direct, int maxNumComponents, int initSize) { super(AbstractByteBufAllocator.DEFAULT_MAX_CAPACITY); if (maxNumComponents < 1) { throw new IllegalArgumentException( "maxNumComponents: " + maxNumComponents + " (expected: >= 1)"); } this.alloc = ObjectUtil.checkNotNull(alloc, "alloc"); this.direct = direct; this.maxNumComponents = maxNumComponents; components = newCompArray(initSize, maxNumComponents); }

Target:
private CompositeByteBuf(ByteBufAllocator alloc, boolean direct, int maxNumComponents, int initSize) { super(AbstractByteBufAllocator.DEFAULT_MAX_CAPACITY); this.alloc = ObjectUtil.checkNotNull(alloc, "alloc"); if (maxNumComponents < 1) { throw new IllegalArgumentException( "maxNumComponents: " + maxNumComponents + " (expected: >= 1)"); } this.direct = direct; this.maxNumComponents = maxNumComponents; components = newCompArray(initSize, maxNumComponents); }
Source:
public Observable<Group> getGroup(final int groupId) { return Observable.defer(new Func0<Observable<Group>>() { @Override public Observable<Group> call() { Group group = SQLite.select() .from(Group.class) .where(Group_Table.id.eq(groupId)) .querySingle(); if (group != null) { group.setActivationDate(Arrays.asList(group.getGroupDate().getDay(), group.getGroupDate().getMonth(), group.getGroupDate().getYear())); } return null; } }); }

Target:
public Observable<Group> getGroup(final int groupId) { return Observable.defer(new Func0<Observable<Group>>() { @Override public Observable<Group> call() { Group group = SQLite.select() .from(Group.class) .where(Group_Table.id.eq(groupId)) .querySingle(); if (group != null) { group.setActivationDate(Arrays.asList(group.getGroupDate().getDay(), group.getGroupDate().getMonth(), group.getGroupDate().getYear())); } return Observable.just(group); } }); }
Source:
public int compareTo(ConceptSet cs) { int value = OpenmrsUtil.compareWithNullAsLowest(concept.isRetired(), cs.concept.isRetired()); if (value == 0) { if ((getSortWeight() == null) && (cs.getSortWeight() != null)) { return -1; } if ((getSortWeight() != null) && (cs.getSortWeight() == null)) { return 1; } if ((getSortWeight() == null) && (cs.getSortWeight() == null)) { return 0; } return (getSortWeight() < cs.getSortWeight()) ? -1 : (getSortWeight() > cs.getSortWeight()) ? 1 : 0; } return value; }

Target:
public int compareTo(ConceptSet cs) { int value = OpenmrsUtil.compareWithNullAsLowest(concept.isRetired(), cs.concept.isRetired()); if (value == 0) { value = OpenmrsUtil.compareWithNullAsLowest(this.getSortWeight(), cs.getSortWeight()); } return value; }
Source:
protected MavenModuleSet getProject() { MavenModuleSet project = createJob(); copyFilesToWorkspace(project, "checkstyle-qualitygate.xml"); copyToWorkspace(project, "pom.xml"); return project; }

Target:
protected MavenModuleSet getProject() { MavenModuleSet project = createJob(); copyToWorkspace(project, "pom.xml"); return project; }
Source:
public LoggerHandler() { update(null, null); ExtensionsManager.getInstance().addObserver(this); }

Target:
public LoggerHandler() { ExtensionsManager.getInstance().addObserver(this); update(null, null); }
Source:
public void execute_assertions_in_comments() throws IOException { assertTrue(String.format( "Last line in coverage data (%d) should be less or equal to number of lines in source file (%d)", source.getCoverage().getLastLine(), source.getLines().size()), source.getCoverage().getLastLine() <= source.getLines().size()); for (Line line : source.getLines()) { String exec = line.getComment(); if (exec != null) { StatementParser.parse(exec, new StatementExecutor(this, line), line.toString()); } } }

Target:
public void execute_assertions_in_comments() throws IOException { for (Line line : source.getLines()) { String exec = line.getComment(); if (exec != null) { StatementParser.parse(exec, new StatementExecutor(this, line), line.toString()); } } }
Source:
public Expression visitApp(AppExpression expr, NormalizationMode mode) { List<Expression> args = new ArrayList<>(); Expression function = expr; for (; expr != null; expr = function.cast(AppExpression.class)) { args.add(expr.getArgument()); function = expr.getFunction().accept(this, NormalizationMode.WHNF); } Collections.reverse(args); LamExpression lam = function instanceof LamExpression ? (LamExpression) function : null; if (lam != null) { return normalizeLam(lam, args).accept(this, mode); } if (mode == NormalizationMode.NF) { function = function.accept(this, mode); } for (Expression arg : args) { function = AppExpression.make(function, mode == NormalizationMode.WHNF ? arg : arg.accept(this, mode)); } return function; }

Target:
public Expression visitApp(AppExpression expr, NormalizationMode mode) { List<Expression> args = new ArrayList<>(); Expression function = expr; for (; expr != null; expr = function.cast(AppExpression.class)) { args.add(expr.getArgument()); function = expr.getFunction().accept(this, NormalizationMode.WHNF); } Collections.reverse(args); LamExpression lam = function.cast(LamExpression.class); if (lam != null) { return normalizeLam(lam, args).accept(this, mode); } if (mode == NormalizationMode.NF) { function = function.accept(this, mode); } for (Expression arg : args) { function = AppExpression.make(function, mode == NormalizationMode.WHNF ? arg : arg.accept(this, mode)); } return function; }
Source:
ResponseEntity<?> editTournament(@RequestBody Tournament tournament) { final Tournament finalTournament = tournament; tournamentService.getTournaments() .stream() .filter(dbTournament -> dbTournament.getId().equals(finalTournament.getId())) .findFirst() .orElseThrow(TournamentNotFoundException::new); tournament = tournamentService.addTournament(tournament); return createResponseEntity(HttpStatus.CREATED, "Tournament updated.", tournament); }

Target:
ResponseEntity<?> editTournament(@RequestBody Tournament tournament) { tournament = tournamentService.replaceTournament(tournament); return createResponseEntity(HttpStatus.CREATED, "Tournament updated.", tournament); }
Source:
private UsmUser getUsmUser(Profile profile) { OID authenticationProtocol = null; OctetString authenticationPassphrase = null; OID privacyProtocol = null; OctetString privacyPassphrase = null; switch(profile.securityLevel) { case SecurityLevel.AUTH_NOPRIV: authenticationProtocol = AuthMD5.ID; authenticationPassphrase = profile.authPassphrase; break; case SecurityLevel.AUTH_PRIV: authenticationProtocol = AuthMD5.ID; authenticationPassphrase = profile.authPassphrase; privacyProtocol = PrivAES128.ID; privacyPassphrase = profile.privacyPassphrase; break; } return new UsmUser(profile.username, authenticationProtocol, authenticationPassphrase, privacyProtocol, privacyPassphrase); }

Target:
private UsmUser getUsmUser(Profile profile) { OID authenticationProtocol = null; OctetString authenticationPassphrase = null; OID privacyProtocol = null; OctetString privacyPassphrase = null; switch(profile.securityLevel) { case SecurityLevel.AUTH_NOPRIV: authenticationProtocol = profile.authProtocol; authenticationPassphrase = profile.authPassphrase; break; case SecurityLevel.AUTH_PRIV: authenticationProtocol = profile.authProtocol; authenticationPassphrase = profile.authPassphrase; privacyProtocol = profile.privProtocol; privacyPassphrase = profile.privacyPassphrase; break; } return new UsmUser(profile.username, authenticationProtocol, authenticationPassphrase, privacyProtocol, privacyPassphrase); }
Source:
public List<HostAddress> getPreferredNodes(List<HostAddress> sortedCandidates) { if (address.isPresent()) { return ImmutableList.of(address.get()); } return ImmutableList.of(); }

Target:
public List<HostAddress> getPreferredNodes(List<HostAddress> sortedCandidates) { return address.map(ImmutableList::of).orElse(ImmutableList.of()); }
Source:
private void handleFunctionExit(ITmfStateSystemBuilder ss, ITmfEvent event) { Object functionExitState = functionExit(event); if (functionExitState != null) { long timestamp = event.getTimestamp().toNanos(); String processName = getProcessName(event); if (processName == null) { int processId = getProcessId(event); processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId); } String threadName = getThreadName(event); if (threadName == null) { threadName = Long.toString(getThreadId(event)); } int quark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName, threadName, InstrumentedCallStackAnalysis.CALL_STACK); Object poppedValue = ss.popAttributeObject(timestamp, quark); if (!functionExitState.equals(poppedValue)) { if (!fHasErrors ) { Activator.getInstance().logWarning(NLS.bind(Messages.CallStackStateProvider_EventDescription, event.getName(), event.getTimestamp().getValue()) + ": " + NLS.bind( Messages.CallStackStateProvider_UnmatchedPoppedValue, functionExitState, poppedValue)); fHasErrors = true; } } } }

Target:
private void handleFunctionExit(ITmfStateSystemBuilder ss, ITmfEvent event) { Object functionExitState = functionExit(event); if (functionExitState != null) { long timestamp = event.getTimestamp().toNanos(); String processName = getProcessName(event); if (processName == null) { int processId = getProcessId(event); processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId); } String threadName = getThreadName(event); if (threadName == null) { threadName = Long.toString(getThreadId(event)); } int quark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName, threadName, InstrumentedCallStackAnalysis.CALL_STACK); Object poppedValue = ss.popAttributeObject(timestamp, quark); if (!fHasErrors && !functionExitState.equals(poppedValue)) { Activator.getInstance().logWarning(NLS.bind(Messages.CallStackStateProvider_EventDescription, event.getName(), event.getTimestamp().getValue()) + ": " + NLS.bind( Messages.CallStackStateProvider_UnmatchedPoppedValue, functionExitState, poppedValue)); fHasErrors = true; } } }
Source:
private void handleErrorStatus(ProjectNegotiation.Status status, String errorMessage, JID peer) { switch (status) { case ERROR: log.error("ERROR running project negotiation: " + errorMessage); break; case REMOTE_ERROR: log.error( "REMOTE_ERROR running project negotiation: " + errorMessage + " at remote: " + peer.toString()); break; case CANCEL: log.info("Project negotiation was cancelled locally"); break; case REMOTE_CANCEL: log.info("Project negotiation was cancelled by remote: " + peer.toString()); break; } }

Target:
private void handleErrorStatus(ProjectNegotiation.Status status, String errorMessage, JID peer) { switch (status) { case ERROR: log.error("ERROR running project negotiation: " + errorMessage); break; case REMOTE_ERROR: log.error( "REMOTE_ERROR running project negotiation: " + errorMessage + " at remote: " + peer.toString()); break; case CANCEL: log.info("Project negotiation was cancelled locally"); break; case REMOTE_CANCEL: log.info("Project negotiation was cancelled by remote: " + peer.toString()); break; default: throw new UnsupportedOperationException( "Unknown ProjectNegotation.Status (" + status + "): " + errorMessage); } }
Source:
public Result<BpmnNode> convert(org.eclipse.bpmn2.Gateway gateway) { return Match.of(org.eclipse.bpmn2.Gateway.class, Result.class) .when(org.eclipse.bpmn2.ParallelGateway.class, this::parallelGateway) .when(org.eclipse.bpmn2.ExclusiveGateway.class, this::exclusiveGateway) .when(org.eclipse.bpmn2.InclusiveGateway.class, this::inclusiveGateway) .ignore(EventBasedGateway.class) .defaultValue(Result.ignored("Gateway not found")) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.resultBpmnDecorator()) .mode(getMode()) .apply(gateway) .value() .get(); }

Target:
public Result<BpmnNode> convert(org.eclipse.bpmn2.Gateway gateway) { return Match.of(org.eclipse.bpmn2.Gateway.class, Result.class) .when(org.eclipse.bpmn2.ParallelGateway.class, this::parallelGateway) .when(org.eclipse.bpmn2.ExclusiveGateway.class, this::exclusiveGateway) .when(org.eclipse.bpmn2.InclusiveGateway.class, this::inclusiveGateway) .when(org.eclipse.bpmn2.EventBasedGateway.class, this::eventGateway) .defaultValue(Result.ignored("Gateway not found")) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.resultBpmnDecorator()) .mode(getMode()) .apply(gateway) .value(); }
Source:
private void onFragmentLoaded(List<FeedItem> episodes) { listAdapter.notifyDataSetChanged(); if (episodes.size() == 0) { createRecycleAdapter(recyclerView, emptyView); } if(feedItemFilter.getValues().length > 0) { txtvInformation.setText("{fa-info-circle} " + this.getString(R.string.filtered_label)); Iconify.addIcons(txtvInformation); txtvInformation.setVisibility(View.VISIBLE); } else { txtvInformation.setVisibility(View.GONE); } restoreScrollPosition(); requireActivity().invalidateOptionsMenu(); }

Target:
protected void onFragmentLoaded(List<FeedItem> episodes) { listAdapter.notifyDataSetChanged(); if (episodes.size() == 0) { createRecycleAdapter(recyclerView, emptyView); } if (feedItemFilter.getValues().length > 0) { txtvInformation.setText("{fa-info-circle} " + this.getString(R.string.filtered_label)); Iconify.addIcons(txtvInformation); txtvInformation.setVisibility(View.VISIBLE); } else { txtvInformation.setVisibility(View.GONE); } restoreScrollPosition(); requireActivity().invalidateOptionsMenu(); }
Source:
protected void handleMessage(Message<?> message) { if (this.shouldTrack) { message = MessageHistory.write(message, this, this.getMessageBuilderFactory()); } try { this.messagingTemplate.send(getOutputChannel(), message); if (this.source instanceof DeferredAcknowlegmentMessageSource) { AcknowledgmentCallback callback = message.getHeaders() .get(IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK, AcknowledgmentCallback.class); if (callback != null && !callback.isAcknowledged()) { callback.acknlowledge(Status.ACCEPT); } } } catch (Exception e) { if (this.source instanceof DeferredAcknowlegmentMessageSource) { AcknowledgmentCallback callback = message.getHeaders() .get(IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK, AcknowledgmentCallback.class); if (callback != null && !callback.isAcknowledged()) { callback.acknlowledge(Status.REJECT); } } if (e instanceof MessagingException) { throw (MessagingException) e; } else { throw new MessagingException(message, "Failed to send Message", e); } } }

Target:
protected void handleMessage(Message<?> message) { if (this.shouldTrack) { message = MessageHistory.write(message, this, getMessageBuilderFactory()); } AcknowledgmentCallback ackCallback = StaticMessageHeaderAccessor.getAcknowledgmentCallback(message); try { this.messagingTemplate.send(getOutputChannel(), message); AckUtils.autoAck(ackCallback); } catch (Exception e) { AckUtils.autoNack(ackCallback); if (e instanceof MessagingException) { throw (MessagingException) e; } else { throw new MessagingException(message, "Failed to send Message", e); } } }
Source:
protected long getPositionsSizeInBytes() { int positionsSizenBytes = Integer.BYTES * positionCount; if (mappedPositions != null) { positionsSizenBytes *= 2; } return positionsSizenBytes; }

Target:
protected long getPositionsSizeInBytes() { if (mappedPositions != null) { return 2 * SIZE_OF_INT * positionCount; } return SIZE_OF_INT * positionCount; }
Source:
static Optional<OrcDecompressor> createOrcDecompressor(OrcDataSourceId orcDataSourceId, CompressionKind compression, int bufferSize, boolean zstdJniDecompressionEnabled) throws OrcCorruptionException { if ((compression != NONE) && ((bufferSize <= 0) || (bufferSize > MAX_BUFFER_SIZE))) { throw new OrcCorruptionException(orcDataSourceId, "Invalid compression block size: " + bufferSize); } switch (compression) { case NONE: return Optional.empty(); case ZLIB: return Optional.of(new OrcZlibDecompressor(orcDataSourceId, bufferSize)); case SNAPPY: return Optional.of(new OrcSnappyDecompressor(orcDataSourceId, bufferSize)); case LZ4: return Optional.of(new OrcLz4Decompressor(orcDataSourceId, bufferSize)); case ZSTD: if (zstdJniDecompressionEnabled) { return Optional.of(new ZstdJniDecompressor(orcDataSourceId, bufferSize)); } else { return Optional.of(new OrcZstdDecompressor(orcDataSourceId, bufferSize)); } default: throw new OrcCorruptionException(orcDataSourceId, "Unknown compression type: " + compression); } }

Target:
static Optional<OrcDecompressor> createOrcDecompressor(OrcDataSourceId orcDataSourceId, CompressionKind compression, int bufferSize, boolean zstdJniDecompressionEnabled) throws OrcCorruptionException { if ((compression != NONE) && ((bufferSize <= 0) || (bufferSize > MAX_BUFFER_SIZE))) { throw new OrcCorruptionException(orcDataSourceId, "Invalid compression block size: " + bufferSize); } switch (compression) { case NONE: return Optional.empty(); case ZLIB: return Optional.of(new OrcZlibDecompressor(orcDataSourceId, bufferSize)); case SNAPPY: return Optional.of(new OrcSnappyDecompressor(orcDataSourceId, bufferSize)); case LZ4: return Optional.of(new OrcLz4Decompressor(orcDataSourceId, bufferSize)); case ZSTD: return Optional.of(new OrcZstdDecompressor(orcDataSourceId, bufferSize, zstdJniDecompressionEnabled)); default: throw new OrcCorruptionException(orcDataSourceId, "Unknown compression type: " + compression); } }
Source:
public static List<Assignment> parseAssignments(JSONArray jsonArray) { List<Assignment> assignments = new ArrayList<Assignment>(); try { for(int i = 0; i < jsonArray.length(); i++) { JSONObject assignmentJson = jsonArray.getJSONObject(i); Assignment assignment = new Assignment(); assignment.setId(assignmentJson.getString("id")); assignment.setTeamRole(assignmentJson.getString("team_role")); JSONObject location = assignmentJson.getJSONObject("location"); assignment.setLatitude(location.getDouble("latitude")); assignment.setLongitude(location.getDouble("longitude")); assignment.setLocationZoom(assignmentJson.getInt("location_zoom")); Ministry ministry = MinistryJsonParser.parseMinistry(assignmentJson); if(assignmentJson.has("sub_ministries")) { JSONArray subMinistriesJson = assignmentJson.getJSONArray("sub_ministries"); List<Ministry> subMinistries = MinistryJsonParser.parseMinistriesJson(subMinistriesJson); ministry.setSubMinistries(subMinistries); } assignment.setMinistry(ministry); assignments.add(assignment); } } catch(Exception e) { Log.e(TAG, e.getMessage()); } return assignments; }

Target:
public static List<Assignment> parseAssignments(JSONArray jsonArray) { List<Assignment> assignments = new ArrayList<Assignment>(); try { for(int i = 0; i < jsonArray.length(); i++) { JSONObject assignmentJson = jsonArray.getJSONObject(i); Assignment assignment = new Assignment(); assignment.setId(assignmentJson.getString("id")); assignment.setTeamRole(assignmentJson.getString("team_role")); JSONObject location = assignmentJson.optJSONObject("location"); if(location != null) { assignment.setLatitude(location.getDouble("latitude")); assignment.setLongitude(location.getDouble("longitude")); assignment.setLocationZoom(assignmentJson.optInt("location_zoom")); } Ministry ministry = MinistryJsonParser.parseMinistry(assignmentJson); if(assignmentJson.has("sub_ministries")) { JSONArray subMinistriesJson = assignmentJson.getJSONArray("sub_ministries"); List<Ministry> subMinistries = MinistryJsonParser.parseMinistriesJson(subMinistriesJson); ministry.setSubMinistries(subMinistries); } assignment.setMinistry(ministry); assignments.add(assignment); } } catch(Exception e) { Log.e(TAG, e.getMessage()); } return assignments; }
Source:
public void initialise() { addDesiredStateChange(new SetViewportToSizeOf(new ResourceUrn("engine:sceneOpaquePingPong"), displayResolutionDependentFBOs)); addDesiredStateChange(new EnableMaterial(DEFERRED_LIGHTING_MATERIAL.toString())); FBO sceneOpaqueFbo = displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaque")); int textureSlot = 0; addDesiredStateChange(new SetInputTexture( textureSlot++, sceneOpaqueFbo.colorBufferTextureId, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaque")); addDesiredStateChange(new SetInputTexture( textureSlot++, sceneOpaqueFbo.depthStencilTextureId, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaqueDepth")); addDesiredStateChange(new SetInputTexture( textureSlot++, sceneOpaqueFbo.normalsBufferTextureId, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaqueNormals")); addDesiredStateChange(new SetInputTexture( textureSlot, sceneOpaqueFbo.lightBufferTextureId, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaqueLightBuffer")); }

Target:
public void initialise() { sceneOpaqueFbo = displayResolutionDependentFBOs.get(READONLY_GBUFFER); sceneOpaquePingPongFbo = displayResolutionDependentFBOs.get(WRITEONLY_GBUFFER); refractiveReflectiveFbo = displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE); addDesiredStateChange(new SetViewportToSizeOf(WRITEONLY_GBUFFER, displayResolutionDependentFBOs)); addDesiredStateChange(new EnableMaterial(DEFERRED_LIGHTING_MATERIAL.toString())); int textureSlot = 0; addDesiredStateChange(new SetInputTexture( textureSlot++, sceneOpaqueFbo.colorBufferTextureId, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaque")); addDesiredStateChange(new SetInputTexture( textureSlot++, sceneOpaqueFbo.depthStencilTextureId, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaqueDepth")); addDesiredStateChange(new SetInputTexture( textureSlot++, sceneOpaqueFbo.normalsBufferTextureId, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaqueNormals")); addDesiredStateChange(new SetInputTexture( textureSlot, sceneOpaqueFbo.lightBufferTextureId, DEFERRED_LIGHTING_MATERIAL, "texSceneOpaqueLightBuffer")); }
Source:
public Void execute(K k, Rewriter rewriter, CompiledDefinition compiledDefinition) { KDebug debugger = new KoreKDebug(k, rewriter, checkpointInterval); ConsoleReader reader = getConsoleReader(); while (true) { try { String input = reader.readLine("KDebug> "); Command command = parseCommand(input); if (command instanceof Commands.QuitCommand) { break; } command.runCommand(debugger, compiledDefinition); } catch (ParseException parseException) { System.out.println(parseException.getMessage()); } catch (NumberFormatException numberException) { System.out.println("Error Formatting Number"); } catch (IOException inputException) { System.out.println("Error Interacting with Console"); } } return null; }

Target:
public Void execute(K k, Rewriter rewriter, CompiledDefinition compiledDefinition) { KDebug debugger = new KoreKDebug(k, rewriter, checkpointInterval); ConsoleReader reader = getConsoleReader(); while (true) { try { String input = reader.readLine("KDebug> "); Command command = parseCommand(input); if (command instanceof Commands.QuitCommand) { break; } command.runCommand(debugger, compiledDefinition); } catch (KEMException e) { System.out.println(e.getMessage()); } catch (ParseException parseException) { System.out.println(parseException.getMessage()); } catch (NumberFormatException numberException) { System.out.println("Could not parse \"foo\" as number"); } catch (IOException inputException) { KEMException.criticalError("Failed to read input from console"); } } return null; }
Source:
private void fillValues(IMarkerEvent marker) { Map<String, String> toolTips = fTimeGraphProvider.getEventHoverToolTipInfo(marker); String category = marker.getCategory(); String label = marker.getLabel(); addItem(category == null ? Messages.TimeGraphTooltipHandler_DefaultMarkerName : category, label == null ? "" : label); Long timestamp = marker.getTime(); long duration = marker.getDuration(); if (duration == 0) { addItem(MARKER_OFFSET + Messages.TimeGraphTooltipHandler_Timestamp, TmfTimestamp.fromNanos(timestamp).toString()); } else { addItem(MARKER_OFFSET + Messages.TimeGraphTooltipHandler_StartTime, TmfTimestamp.fromNanos(timestamp).toString()); addItem(MARKER_OFFSET + Messages.TimeGraphTooltipHandler_EndTime, TmfTimestamp.fromNanos(timestamp + duration).toString()); } if (toolTips != null) { for (Entry<String, String> tooltip : toolTips.entrySet()) { addItem(MARKER_OFFSET + tooltip.getKey(), tooltip.getValue()); } } }

Target:
private void fillValues(IMarkerEvent marker) { Map<String, String> toolTips = fTimeGraphProvider.getEventHoverToolTipInfo(marker); String category = marker.getCategory(); String label = marker.getLabel(); addItem(category == null ? Messages.TimeGraphTooltipHandler_DefaultMarkerName : category, label == null ? "" : label); long timestamp = marker.getTime(); long duration = marker.getDuration(); if (duration == 0) { addItem(MARKER_OFFSET + Messages.TimeGraphTooltipHandler_Timestamp, TmfTimestamp.fromNanos(timestamp).toString()); } else { addItem(MARKER_OFFSET + Messages.TimeGraphTooltipHandler_StartTime, TmfTimestamp.fromNanos(timestamp).toString()); addItem(MARKER_OFFSET + Messages.TimeGraphTooltipHandler_EndTime, TmfTimestamp.fromNanos(timestamp + duration).toString()); } if (toolTips != null) { for (Entry<String, String> tooltip : toolTips.entrySet()) { addItem(MARKER_OFFSET + tooltip.getKey(), tooltip.getValue()); } } }