auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public OAuth2AuthorizedClient authorize(OAuth2AuthorizationContext context) { Assert.notNull(context, "context cannot be null"); if (!context.reauthorizationRequired() || context.getAuthorizedClient().getRefreshToken() == null) { return null; } HttpServletRequest request = context.getAttribute(HTTP_SERVLET_REQUEST_ATTRIBUTE_NAME); HttpServletResponse response = context.getAttribute(HTTP_SERVLET_RESPONSE_ATTRIBUTE_NAME); Assert.notNull(request, "The context attribute cannot be null '" + HTTP_SERVLET_REQUEST_ATTRIBUTE_NAME + "'"); Assert.notNull(response, "The context attribute cannot be null '" + HTTP_SERVLET_RESPONSE_ATTRIBUTE_NAME + "'"); String requestScope = context.getAttribute(REQUEST_SCOPE_ATTRIBUTE_NAME); Set<String> scopes = null; if (!StringUtils.isEmpty(requestScope)) { String delimiter = requestScope.indexOf(',') != -1 ? "," : " "; scopes = Arrays.stream(StringUtils.delimitedListToStringArray(requestScope, delimiter, " ")).collect(Collectors.toSet()); } OAuth2RefreshTokenGrantRequest refreshTokenGrantRequest = new OAuth2RefreshTokenGrantRequest(context.getAuthorizedClient(), scopes); OAuth2AccessTokenResponse tokenResponse = this.accessTokenResponseClient.getTokenResponse(refreshTokenGrantRequest); OAuth2AuthorizedClient authorizedClient = new OAuth2AuthorizedClient( context.getClientRegistration(), context.getPrincipal().getName(), tokenResponse.getAccessToken(), tokenResponse.getRefreshToken()); <START> this.authorizedClientRepository.saveAuthorizedClient( <END> authorizedClient, context.getPrincipal(), request, response); return authorizedClient; }</code><technical_language>is surprising provider save result try load first. I API save authorization. I more convinced API do save perform a lookup I find this asymmetry confusing</technical_language>

Target:
public OAuth2AuthorizedClient authorize(OAuth2AuthorizationContext context) { Assert.notNull(context, "context cannot be null"); OAuth2AuthorizedClient authorizedClient = context.getAuthorizedClient(); if (authorizedClient == null || authorizedClient.getRefreshToken() == null || !hasTokenExpired(authorizedClient.getAccessToken())) { return null; } Object requestScope = context.getAttribute(OAuth2AuthorizationContext.REQUEST_SCOPE_ATTRIBUTE_NAME); Set<String> scopes = Collections.emptySet(); if (requestScope != null) { Assert.isInstanceOf(String[].class, requestScope, "The context attribute must be of type String[] '" + OAuth2AuthorizationContext.REQUEST_SCOPE_ATTRIBUTE_NAME + "'"); scopes = new HashSet<>(Arrays.asList((String[]) requestScope)); } OAuth2RefreshTokenGrantRequest refreshTokenGrantRequest = new OAuth2RefreshTokenGrantRequest( authorizedClient.getClientRegistration(), authorizedClient.getAccessToken(), authorizedClient.getRefreshToken(), scopes); OAuth2AccessTokenResponse tokenResponse = this.accessTokenResponseClient.getTokenResponse(refreshTokenGrantRequest); return new OAuth2AuthorizedClient(context.getAuthorizedClient().getClientRegistration(), context.getPrincipal().getName(), tokenResponse.getAccessToken(), tokenResponse.getRefreshToken()); }
Source:
<code><START> public static List<String> xPathFuncList() { <END> return new ArrayList<>(funcList.values()); }</code><technical_language>wow this is awesome. thanks for setting this up. fyi @emord able expose this list api call formplayer if good in vellum</technical_language>

Target:
public static List<String> xPathFuncList() { return new ArrayList<>(funcList.keySet()); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { RepositoryGroups groups = new RepositoryGroups(); String groupName = getNewGroupName( getActiveShell(event), UIText.RepositoriesView_RepoGroup_Add_Title, groups, ""); if (groupName != null) { UUID groupId = groups.addGroup(groupName); <START> List<String> repoDirs <END> = getSelectedRepositories(event); if (!repoDirs.isEmpty()) { groups.addRepositoriesToGroup(groupId, repoDirs); } getView(event).refresh(); } return null; }</code><technical_language>File</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { RepositoryGroups groupsUtil = RepositoryGroups.getInstance(); String groupName = getNewGroupName(getActiveShell(event), UIText.RepositoriesView_RepoGroup_Add_Title, groupsUtil, ""); if (groupName != null) { UUID groupId = groupsUtil.addGroup(groupName); List<File> repoDirs = getSelectedRepositories(event); if (!repoDirs.isEmpty()) { groupsUtil.addRepositoriesToGroup(groupId, repoDirs); } getView(event).refresh(); } return null; }
Source:
<code>protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String username = Strings.nullToEmpty(req.getParameter("username")).trim(); String password = Strings.nullToEmpty(req.getParameter("password")); String remember = Strings.nullToEmpty(req.getParameter("rememberme")); if (username.isEmpty() || password.isEmpty()) { sendForm(req, res, "Invalid username or password."); return; } AuthRequest areq = AuthRequest.forUser(username); areq.setPassword(password); AuthResult ares; try { ares = accountManager.authenticate(areq); } catch (AccountUserNameException e) { sendForm(req, res, e.getMessage()); return; } catch (AuthenticationUnavailableException e) { sendForm(req, res, "Authentication unavailable at this time."); return; } catch (AccountException e) { log.info(String.format("'%s' failed to sign in: %s", username, e.getMessage())); sendForm(req, res, "Invalid username or password."); return; } catch (RuntimeException e) { log.error("LDAP authentication failed", e); sendForm(req, res, "Authentication unavailable at this time."); return; } String token = LoginUrlToken.getToken(req); StringBuilder dest = new StringBuilder(); dest.append(urlProvider.get(req)); <START> dest.append(token); <END> CacheHeaders.setNotCacheable(res); webSession.get().login(ares, "1".equals(remember)); res.sendRedirect(dest.toString()); }</code><technical_language>[optional] eliminate 'token' variable dest.append(LoginUrlToken.getToken(req));</technical_language>

Target:
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String username = Strings.nullToEmpty(req.getParameter("username")).trim(); String password = Strings.nullToEmpty(req.getParameter("password")); String remember = Strings.nullToEmpty(req.getParameter("rememberme")); if (username.isEmpty() || password.isEmpty()) { sendForm(req, res, "Invalid username or password."); return; } AuthRequest areq = AuthRequest.forUser(username); areq.setPassword(password); AuthResult ares; try { ares = accountManager.authenticate(areq); } catch (AccountUserNameException e) { sendForm(req, res, e.getMessage()); return; } catch (AuthenticationUnavailableException e) { sendForm(req, res, "Authentication unavailable at this time."); return; } catch (AccountException e) { log.info(String.format("'%s' failed to sign in: %s", username, e.getMessage())); sendForm(req, res, "Invalid username or password."); return; } catch (RuntimeException e) { log.error("LDAP authentication failed", e); sendForm(req, res, "Authentication unavailable at this time."); return; } StringBuilder dest = new StringBuilder(); dest.append(urlProvider.get(req)); dest.append(LoginUrlToken.getToken(req)); CacheHeaders.setNotCacheable(res); webSession.get().login(ares, "1".equals(remember)); res.sendRedirect(dest.toString()); }
Source:
<code>public void dispose() { super.dispose(); if (this.tabFolder != null) { this.tabFolder.dispose(); this.tabFolder = null; } tabItems.clear(); for (ModelExplorerTabDescriptor tabDescriptor : ModelExplorerTabRegistry.getRegisteredExtensions()) { IModelExplorerTabExtension tab = tabDescriptor.getTabExtension(); if (tab != null) { tab.dispose(); } } <START> lockDecorationUpdater.unregister(); <END> }</code><technical_language>set null, especially LockDecorationUpdater fields set null unregister() call</technical_language>

Target:
public void dispose() { super.dispose(); if (this.tabFolder != null) { this.tabFolder.dispose(); this.tabFolder = null; } tabItems.clear(); for (ModelExplorerTabDescriptor tabDescriptor : ModelExplorerTabRegistry.getRegisteredExtensions()) { IModelExplorerTabExtension tab = tabDescriptor.getTabExtension(); if (tab != null) { tab.dispose(); } } lockDecorationUpdater.unregister(); lockDecorationUpdater = null; }
Source:
<code>public void execute(JobExecutionContext context) throws JobExecutionException { String methodName = null; try { JobDataMap data = context.getJobDetail().getJobDataMap(); Map paramsMap = data.getWrappedMap(); methodName = (String) paramsMap.get(SchedulerUtilBaseImpl.RUN_METHOD_NAME); final Object instance = getInstanceToRun(paramsMap); final Object[] methodParams = (Object[]) paramsMap.get(SchedulerUtilBaseImpl.RUN_METHOD_PARAM); String methodKey = getMethodKey(instance.getClass().getName(), methodName); final Method methodToRun; if (!cachedMethods.containsKey(methodKey)) { cachedMethods.putIfAbsent(methodKey, getMethodToRun(instance, methodName)); } methodToRun = cachedMethods.get(methodKey); String correlationId = LoggedUtils.getObjectId(this); CorrelationIdTracker.setCorrelationId(correlationId); invokeMethod(instance, methodToRun, methodParams); <START> CorrelationIdTracker.setCorrelationId(null); <END> } catch (Exception e) { log.error("Failed to invoke scheduled method {}: {}", methodName, e.getMessage()); log.debug("Exception", e); JobExecutionException jee = new JobExecutionException("failed to execute job"); jee.setStackTrace(e.getStackTrace()); throw jee; } }</code><technical_language>set in a finally block</technical_language>

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { String methodName = null; try { JobDataMap data = context.getJobDetail().getJobDataMap(); Map paramsMap = data.getWrappedMap(); methodName = (String) paramsMap.get(SchedulerUtilBaseImpl.RUN_METHOD_NAME); final Object instance = getInstanceToRun(paramsMap); final Object[] methodParams = (Object[]) paramsMap.get(SchedulerUtilBaseImpl.RUN_METHOD_PARAM); String methodKey = getMethodKey(instance.getClass().getName(), methodName); final Method methodToRun; if (!cachedMethods.containsKey(methodKey)) { cachedMethods.putIfAbsent(methodKey, getMethodToRun(instance, methodName)); } methodToRun = cachedMethods.get(methodKey); String correlationId = LoggedUtils.getObjectId(this); CorrelationIdTracker.setCorrelationId(correlationId); invokeMethod(instance, methodToRun, methodParams); } catch (Exception e) { log.error("Failed to invoke scheduled method {}: {}", methodName, e.getMessage()); log.debug("Exception", e); JobExecutionException jee = new JobExecutionException("failed to execute job"); jee.setStackTrace(e.getStackTrace()); throw jee; } finally { CorrelationIdTracker.setCorrelationId(null); } }
Source:
<code>public void hoverClickAndViewStudentPhotoOnHeading(String panelHeadingIndex, String urlRegex) { String idOfPanelHeading = "panelHeading-" + panelHeadingIndex; <START> waitForElementPresence(By.id(idOfPanelHeading)); <END> WebElement photoDiv = browser.driver.findElement(By.id(idOfPanelHeading)) .findElement(By.className("profile-pic-icon-hover")); executeScript("arguments[0].scrollIntoView(true);", photoDiv); Actions actions = new Actions(browser.driver); actions.moveToElement(photoDiv).perform(); waitForElementPresence(By.cssSelector(".popover-content")); executeScript("document.getElementsByClassName('popover-content')[0]" + ".getElementsByTagName('a')[0].click();"); waitForElementPresence(By.cssSelector(".popover-content > img")); AssertHelper.assertContainsRegex(urlRegex, browser.driver.findElements(By.cssSelector(".popover-content > img")) .get(0) .getAttribute("src")); executeScript("document.getElementsByClassName('popover')[0].parentNode.removeChild(" + "document.getElementsByClassName('popover')[0])"); }</code><technical_language>Is this part of issue</technical_language>

Target:
public void hoverClickAndViewStudentPhotoOnHeading(String panelHeadingIndex, String urlRegex) { String headingSelector = "#panelHeading-" + panelHeadingIndex; String popoverSelector = headingSelector + " .popover-content"; moveToElement(By.cssSelector(headingSelector + " .profile-pic-icon-hover")); waitForElementPresence(By.cssSelector(popoverSelector + " > a")).click(); String imgSrc = getElementSrcWithRetryAfterWaitForPresence(By.cssSelector(popoverSelector + " > img")); AssertHelper.assertContainsRegex(urlRegex, imgSrc); }
Source:
<code>public EventReceiverFirehoseMonitor( EventReceiverFirehoseRegister eventReceiverFirehoseRegister, Properties props ) { this.register = eventReceiverFirehoseRegister; <START> this.dimensions = MonitorsConfig.getDimensions(props); <END> }</code><technical_language>this recognize props starting "druid.metrics.emitter.dimension.", I understand currently (dataSource taskId) in future add more of end emitted unintentionally. for specific dimensions present instead of blindly all</technical_language>

Target:
public EventReceiverFirehoseMonitor( EventReceiverFirehoseRegister eventReceiverFirehoseRegister, Properties props ) { this.register = eventReceiverFirehoseRegister; this.dimensions = MonitorsConfig.extractDimensions( props, Lists.newArrayList(DruidMetrics.DATASOURCE, DruidMetrics.TASK_ID) ); }
Source:
<code>public static String[] getMatches(String regExpression, String source) throws TransformationException { if (regExpression == null || source == null) { <START> throw new TransformationException("the given parameters 'regex' and 'source' must not be null"); <END> } logger.debug("about to transform '{}' by the function '{}'", source, regExpression); if (isSubtitution(regExpression)) { Matcher substMatcher = SUBST_PATTERN.matcher(regExpression); if (substMatcher.matches()) { logger.debug("Using substitution form of regex transformation"); String regex = substMatcher.group(1); String substitution = substMatcher.group(2); String options = substMatcher.group(3); String result; if (options.equals("g")) { result = source.trim().replaceAll(regex, substitution); } else { result = source.trim().replaceFirst(regex, substitution); } return new String[] { result }; } } Matcher matcher = getPattern(regExpression).matcher(source.trim()); List<String> results = new ArrayList<String>(); while (matcher.find()) { results.add(matcher.group(1)); } return results.toArray(new String[results.size()]); }</code><technical_language>"The given" ..</technical_language>

Target:
public static String[] getMatches(String regExpression, String source) throws TransformationException { if (regExpression == null || source == null) { throw new TransformationException("The given parameters 'regExpression' and 'source' must not be null"); } logger.debug("about to transform '{}' by the function '{}'", source, regExpression); if (isSubtitution(regExpression)) { Matcher substMatcher = SUBST_PATTERN.matcher(regExpression); String result = source; if (substMatcher.matches()) { logger.debug("Using substitution form of regex transformation"); String regex = substMatcher.group(1); String substitution = substMatcher.group(2); String options = substMatcher.group(3); if (options.equals("g")) { result = source.trim().replaceAll(regex, substitution); } else { result = source.trim().replaceFirst(regex, substitution); } } return new String[] { result }; } else { Matcher matcher = getPattern(regExpression).matcher(source.trim()); List<String> results = new ArrayList<>(); while (matcher.find()) { results.add(matcher.group(1)); } return results.toArray(new String[results.size()]); } }
Source:
<code>private ConversionUtils() { <START> throw new AssertionError("Must not instantiate an element of this class"); <END> }</code><technical_language>"Must instantiate ~~an element of~~ this class"</technical_language>

Target:
private ConversionUtils() { throw new AssertionError("Must not instantiate this class"); }
Source:
<code>public Response uploadIcon(@ApiParam("The image for stack") Iterator<FileItem> formData, @ApiParam("The stack id") @PathParam("id") String stackId) <START> throws NotFoundException, ServerException, BadRequestException, ForbiddenException { <END> requireNonNullAndNonEmpty(stackId, "Stack id required"); if (formData.hasNext()) { FileItem fileItem = formData.next(); String iconName = fileItem.getName(); try { StackIcon stackIcon = new StackIcon(fileItem.getContentType(), fileItem.get()); StackImpl stack = stackDao.getById(stackId); User user = EnvironmentContext.getCurrent().getUser(); if (!user.isMemberOf("system/admin") && !permissionChecker.hasAccess(stack, user.getId(), "write")) { throw new ForbiddenException(format("User %s doesn't have access to stack %s", stack.getId(), stack.getId())); } stack.setIcon(stackIcon); stackDao.update(stack); } catch (IOException | ConflictException e) { throw new ServerException(format("Failed upload icon %s for stack %s", iconName, stackId), e); } } return Response.ok().build(); }</code><technical_language>MULTIPART_FORM_DATA rework accept octet/stream</technical_language>

Target:
public Response uploadIcon(@ApiParam("The image for stack") Iterator<FileItem> formData, @ApiParam("The stack id") @PathParam("id") String stackId) throws NotFoundException, ServerException, BadRequestException, ForbiddenException { requireNonNullAndNonEmpty(stackId, "Stack id required"); if (formData.hasNext()) { FileItem fileItem = formData.next(); String iconName = fileItem.getName(); try { StackIcon stackIcon = new StackIcon(fileItem.getContentType(), fileItem.get()); DecoratedStackImpl stack = stackDao.getById(stackId); User user = EnvironmentContext.getCurrent().getUser(); if (!user.isMemberOf("system/admin") && !permissionChecker.hasAccess(stack, user.getId(), stack.getCreator(), "write")) { throw new ForbiddenException(format("User %s doesn't have access to stack %s", stack.getId(), stack.getId())); } stack.setIcon(stackIcon); stackDao.update(stack); } catch (IOException | ConflictException e) { throw new ServerException(format("Failed upload icon %s for stack %s", iconName, stackId), e); } } return Response.ok().build(); }
Source:
<code>public void setup() throws Exception { Configuration conf = new Configuration(); conf.setClass(S3_CLIENT_FACTORY_IMPL, MockS3ClientFactory.class, S3ClientFactory.class); <START> conf.setClass(S3_METADATA_STORE_IMPL, LocalMetadataStore.class, <END> MetadataStore.class); conf.setBoolean(CommitConstants.MAGIC_COMMITTER_ENABLED, true); conf.setLong(Constants.MULTIPART_SIZE, MULTIPART_MIN_SIZE); fs = new S3AFileSystem(); URI uri = URI.create(FS_S3A + "://" + BUCKET); fs.initialize(uri, conf); s3 = fs.getAmazonS3ClientForTesting("mocking"); }</code><technical_language>IMO this set -Ds3guard is passed command line, similar other tests before. Tests meaningful S3Guard Assume.assumeTrue() this, other tests meaningful exercised</technical_language>

Target:
public void setup() throws Exception { Configuration conf = createConfiguration(); fs = new S3AFileSystem(); URI uri = URI.create(FS_S3A + "://" + BUCKET); fs.initialize(uri, conf); s3 = fs.getAmazonS3ClientForTesting("mocking"); }
Source:
<code>private DelegatingResourceDescription getBuildCreatableProperties(SimpleObject propertiesToCreate) { DelegatingResourceDescription description = getCreatableProperties(); <START> if (propertiesToCreate.containsKey("uuid")) { <END> description.addProperty("uuid"); } return description; }</code><technical_language>RestConstants.PROPERTY_UUID</technical_language>

Target:
private DelegatingResourceDescription getBuildCreatableProperties(SimpleObject propertiesToCreate) { DelegatingResourceDescription description = getCreatableProperties(); if (propertiesToCreate.containsKey(RestConstants.PROPERTY_UUID)) { description.addProperty(RestConstants.PROPERTY_UUID); } return description; }
Source:
<code>public FileSystem getTestFileSystem() throws IOException { <START> return FileSystem.get(URI.create("sftp://user:password@localhost"), conf); <END> }</code><technical_language>nit: a variable reuse</technical_language>

Target:
public FileSystem getTestFileSystem() throws IOException { return FileSystem.get(TEST_URI, conf); }
Source:
<code><START> public Builder errorMapperIfAbsent(ServiceProviderErrorMapper errorMapper) { <END> if (this.errorMapper == null) { this.errorMapper = errorMapper; } return this; }</code><technical_language>get idea of .***IfAbsent methods. u need them? Irregardless of servicesProvider type u .registerInMethodRegistry() which, turn, sets dependencies</technical_language>

Target:
Builder errorMapperIfAbsent(ServiceProviderErrorMapper errorMapper) { if (this.errorMapper == null) { this.errorMapper = errorMapper; } return this; }
Source:
<code>protected @Nullable String getProcessName(@NonNull ITmfEvent event) { String pName = super.getProcessName(event); if (pName == null) { pName = event.getContent().getFieldValue(String.class, "pid"); } if (pName == null) { int processId = getProcessId(event); <START> ITmfTrace trace = event.getTrace(); Iterable<@NonNull ProcessNameAspect> aspects = TmfTraceUtils.getAnalysisModulesOfClass(trace, ProcessNameAspect.class); for (ProcessNameAspect aspect : aspects) { pName = aspect.resolve(event); if (pName != null) { return pName; } } <END> pName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId); } return pName; }</code><technical_language>super.getProcessName(event) pretty this. If pName is null there, chances either</technical_language>

Target:
protected @Nullable String getProcessName(@NonNull ITmfEvent event) { String pName = super.getProcessName(event); if (pName == null) { pName = event.getContent().getFieldValue(String.class, "pid"); } if (pName == null) { int processId = getProcessId(event); pName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId); } return pName; }
Source:
<code>public static UserGroupInformation createSecurityEnabledProxyUser(String userToProxy, Logger log) throws IOException { String filelocation = System.getenv(HADOOP_TOKEN_FILE_LOCATION); if (filelocation == null) { throw new RuntimeException("hadoop token information not set."); } if (!new File(filelocation).exists()) { throw new RuntimeException("hadoop token file doesn't exist."); } <START> log.info("Found token file " + filelocation); <END> log.info("Setting " + HadoopSecurityManager.MAPREDUCE_JOB_CREDENTIALS_BINARY + " to " + filelocation); System.setProperty(HadoopSecurityManager.MAPREDUCE_JOB_CREDENTIALS_BINARY, filelocation); UserGroupInformation loginUser = null; loginUser = UserGroupInformation.getLoginUser(); log.info("Current logged in user is " + loginUser.getUserName()); log.info("Creating proxy user."); UserGroupInformation proxyUser = UserGroupInformation.createProxyUser(userToProxy, loginUser); for (Token<?> token : loginUser.getTokens()) { proxyUser.addToken(token); } return proxyUser; }</code><technical_language>fileLocation is printed out</technical_language>

Target:
public static UserGroupInformation createSecurityEnabledProxyUser(String userToProxy, Logger log) throws IOException { String filelocation = System.getenv(HADOOP_TOKEN_FILE_LOCATION); if (filelocation == null) { throw new RuntimeException("hadoop token information not set."); } if (!new File(filelocation).exists()) { throw new RuntimeException("hadoop token file doesn't exist."); } log.info("Found token file. Setting " + HadoopSecurityManager.MAPREDUCE_JOB_CREDENTIALS_BINARY + " to " + filelocation); System.setProperty(HadoopSecurityManager.MAPREDUCE_JOB_CREDENTIALS_BINARY, filelocation); UserGroupInformation loginUser = null; loginUser = UserGroupInformation.getLoginUser(); log.info("Current logged in user is " + loginUser.getUserName()); UserGroupInformation proxyUser = UserGroupInformation.createProxyUser(userToProxy, loginUser); for (Token<?> token : loginUser.getTokens()) { proxyUser.addToken(token); } return proxyUser; }
Source:
<code>private void update() { final Metric metric = serverTiming.start("processUpdate", "Update of OS process list"); try { <START> List<OSProcess> procs = Arrays.asList(os.getProcesses(10, OperatingSystem.ProcessSort.CPU)); <END> for (OSProcess process : procs) { ProcessBean bean = null; if (processList.getItems().size() <= procs.indexOf(process)) { bean = beanManager.create(ProcessBean.class); processList.getItems().add(bean); } else { bean = processList.getItems().get(procs.indexOf(process)); } bean.setProcessID(new Integer(process.getProcessID()).toString()); bean.setCpuPercentage(format.format(100d * (process.getKernelTime() + process.getUserTime()) / process.getUpTime())); bean.setMemoryPercentage(format.format(100d * process.getResidentSetSize() / memory.getTotal())); bean.setName(process.getName()); } asyncServerRunner.execute(new Runnable() { @Override public void run() { sessionExecutor.runLaterInClientSession(() -> update()); } }); } finally { metric.stop(); } }</code><technical_language>Add final keyword</technical_language>

Target:
private void update() { final Metric metric = serverTiming.start("processUpdate", "Update of OS process list"); try { final List<OSProcess> procs = Arrays.asList(os.getProcesses(10, OperatingSystem.ProcessSort.CPU)); for (final OSProcess process : procs) { ProcessBean bean = null; if (processList.getItems().size() <= procs.indexOf(process)) { bean = beanManager.create(ProcessBean.class); processList.getItems().add(bean); } else { bean = processList.getItems().get(procs.indexOf(process)); } bean.setProcessID(Integer.toString(process.getProcessID())); bean.setCpuPercentage(format.format(100d * (process.getKernelTime() + process.getUserTime()) / process.getUpTime())); bean.setMemoryPercentage(format.format(100d * process.getResidentSetSize() / memory.getTotal())); bean.setName(process.getName()); } asyncServerRunner.execute(() -> sessionExecutor.runLaterInClientSession(this::update)); } finally { metric.stop(); } }
Source:
<code>public String getDescriptiveText(String xmllang) { <START> try { <END> return descriptiveTexts.get(xmllang); } catch (NullPointerException | IllegalArgumentException | ClassCastException e) { return null; } }</code><technical_language>If null key, simply a Objects.requireNotNull(xmllang) guard get(). This avoid try/catch block</technical_language>

Target:
public String getDescriptiveText(String xmllang) { Objects.requireNonNull(xmllang, "xmllang must not be null"); return descriptiveTexts.get(xmllang); }
Source:
<code><START> private void printSystemViewContent(VisorSystemViewTaskResult taskRes, Logger log) { <END> List<String> colTitles = taskRes.systemViewAttributes(); List<? extends List<?>> sysViewRows = taskRes.systemViewContent(); List<Integer> colLenghts = colTitles.stream().map(String::length).collect(Collectors.toList()); List<List<String>> rows = new ArrayList<>(sysViewRows.size()); sysViewRows.forEach(sysViewRow -> { ListIterator<Integer> colLenIter = colLenghts.listIterator(); rows.add(sysViewRow.stream().map(attr -> { String colVal = String.valueOf(attr); colLenIter.set(Math.max(colLenIter.next(), colVal.length())); return colVal; }).collect(Collectors.toList())); }); printRow(colTitles, nCopies(colTitles.size(), STRING), colLenghts, log); rows.forEach(row -> printRow(row, taskRes.systemViewAttributeTypes(), colLenghts, log)); }</code><technical_language>I suggest removing this newline</technical_language>

Target:
private void printSystemViewContent(VisorSystemViewTaskResult taskRes, Logger log) { List<String> titles = taskRes.attributes(); List<List<?>> viewRows = taskRes.rows(); List<Integer> colSzs = titles.stream().map(String::length).collect(Collectors.toList()); List<List<String>> rows = new ArrayList<>(viewRows.size()); viewRows.forEach(sysViewRow -> { ListIterator<Integer> colSzIter = colSzs.listIterator(); rows.add(sysViewRow.stream().map(attr -> { String val = String.valueOf(attr); colSzIter.set(Math.max(colSzIter.next(), val.length())); return val; }).collect(Collectors.toList())); }); printRow(titles, nCopies(titles.size(), STRING), colSzs, log); rows.forEach(row -> printRow(row, taskRes.types(), colSzs, log)); }
Source:
<code>private boolean copyData(VmBase source, VmBase dest) { for (Field srcFld : VmBase.class.getDeclaredFields()) { try { if (srcFld.getAnnotation(CopyOnNewVersion.class) != null) { srcFld.setAccessible(true); Field dstFld = VmBase.class.getDeclaredField(srcFld.getName()); dstFld.setAccessible(true); dstFld.set(dest, srcFld.get(source)); } } catch (Exception exp) { <START> log.error("Failed to copy field '{}' of new version to VM '{}' ({}), error: {}", <END> srcFld.getName(), source.getName(), source.getId(), exp.getMessage()); return false; } } return true; }</code><technical_language>s/, error//</technical_language>

Target:
private boolean copyData(VmBase source, VmBase dest) { for (Field srcFld : VmBase.class.getDeclaredFields()) { try { if (srcFld.getAnnotation(CopyOnNewVersion.class) != null) { srcFld.setAccessible(true); Field dstFld = VmBase.class.getDeclaredField(srcFld.getName()); dstFld.setAccessible(true); dstFld.set(dest, srcFld.get(source)); } } catch (Exception exp) { log.error("Failed to copy field '{}' of new version to VM '{}' ({}): {}", srcFld.getName(), source.getName(), source.getId(), exp.getMessage()); log.debug("Exception", exp); return false; } } return true; }
Source:
<code>public List<WorkflowStateDto> list() throws IOException { <START> return workflowManager.listUserWorkflows().stream().map(WorkflowStateDto::new).collect(Collectors.toList()); <END> }</code><technical_language>WorkflowStateDto::new a call asDto</technical_language>

Target:
public List<WorkflowStateDto> list() throws IOException { return workflowManager.listUserWorkflows().stream().map(Dtos::asDto).collect(Collectors.toList()); }
Source:
<code>AccountSummary unmarshallAccountSummary(HibernateAccount hibernateAccount) { StudyIdentifier studyId = null; if (StringUtils.isNotBlank(hibernateAccount.getStudyId())) { studyId = new StudyIdentifierImpl(hibernateAccount.getStudyId()); } Set<String> callerSubstudyIds = BridgeUtils.getRequestContext().getCallerSubstudies(); Set<String> substudyIds = new HashSet<>(); Set<String> externalIds = new HashSet<>(); if (hibernateAccount.getId() != null) { List<HibernateAccountSubstudy> accountSubstudies = hibernateHelper.queryGet( "FROM HibernateAccountSubstudy WHERE accountId=:accountId", ImmutableMap.of("accountId", hibernateAccount.getId()), null, null, HibernateAccountSubstudy.class); for (AccountSubstudy acctSubstudy : accountSubstudies) { if (callerSubstudyIds.isEmpty() || callerSubstudyIds.contains(acctSubstudy.getSubstudyId())) { substudyIds.add(acctSubstudy.getSubstudyId()); if (acctSubstudy.getExternalId() != null) { externalIds.add(acctSubstudy.getExternalId()); } <START> } <END> } } if (hibernateAccount.getExternalId() != null) { externalIds.add(hibernateAccount.getExternalId()); } return new AccountSummary(hibernateAccount.getFirstName(), hibernateAccount.getLastName(), hibernateAccount.getEmail(), hibernateAccount.getPhone(), externalIds, hibernateAccount.getId(), hibernateAccount.getCreatedOn(), hibernateAccount.getStatus(), studyId, substudyIds); }</code><technical_language>substudy filtering tests updated external IDs</technical_language>

Target:
AccountSummary unmarshallAccountSummary(HibernateAccount hibernateAccount) { StudyIdentifier studyId = null; if (StringUtils.isNotBlank(hibernateAccount.getStudyId())) { studyId = new StudyIdentifierImpl(hibernateAccount.getStudyId()); } SubstudyAssociations assoc = null; if (hibernateAccount.getId() != null) { List<HibernateAccountSubstudy> accountSubstudies = hibernateHelper.queryGet( "FROM HibernateAccountSubstudy WHERE accountId=:accountId", ImmutableMap.of("accountId", hibernateAccount.getId()), null, null, HibernateAccountSubstudy.class); assoc = BridgeUtils.substudyAssociationsVisibleToCaller(accountSubstudies); } else { assoc = BridgeUtils.substudyAssociationsVisibleToCaller(null); } return new AccountSummary(hibernateAccount.getFirstName(), hibernateAccount.getLastName(), hibernateAccount.getEmail(), hibernateAccount.getPhone(), hibernateAccount.getExternalId(), assoc.getExternalIdsVisibleToCaller(), hibernateAccount.getId(), hibernateAccount.getCreatedOn(), hibernateAccount.getStatus(), studyId, assoc.getSubstudyIdsVisibleToCaller()); }
Source:
<code>private long getPullIndex( File storeDir ) throws IOException { ReadOnlyTransactionIdStore txIdStore = new ReadOnlyTransactionIdStore( pageCache, storeDir ); long lastCleanTxId = txIdStore.getLastCommittedTransactionId(); ReadOnlyTransactionStore txStore = new ReadOnlyTransactionStore( pageCache, fs, storeDir, new Monitors() ); long lastTxId = BASE_TX_ID; try ( Lifespan ignored = new Lifespan( txStore ) ) { try ( TransactionCursor cursor = txStore.getTransactions( lastCleanTxId ) ) <START> { <END> while ( cursor.next() ) { CommittedTransactionRepresentation tx = cursor.get(); lastTxId = tx.getCommitEntry().getTxId(); } if ( lastTxId < lastCleanTxId ) { throw new IllegalStateException( "Metadata index was higher than transaction log index." ); } return lastTxId + 1; } catch ( NoSuchTransactionException e ) { log.info( "No transaction logs found. Will use metadata store as base for pull request." ); return lastCleanTxId; } } }</code><technical_language>I combined well</technical_language>

Target:
private long getPullIndex( File storeDir ) throws IOException { ReadOnlyTransactionIdStore txIdStore = new ReadOnlyTransactionIdStore( pageCache, storeDir ); long lastCleanTxId = txIdStore.getLastCommittedTransactionId(); ReadOnlyTransactionStore txStore = new ReadOnlyTransactionStore( pageCache, fs, storeDir, new Monitors() ); long lastTxId = BASE_TX_ID; try ( Lifespan ignored = new Lifespan( txStore ); TransactionCursor cursor = txStore.getTransactions( lastCleanTxId ) ) { while ( cursor.next() ) { CommittedTransactionRepresentation tx = cursor.get(); lastTxId = tx.getCommitEntry().getTxId(); } if ( lastTxId < lastCleanTxId ) { throw new IllegalStateException( "Metadata index was higher than transaction log index." ); } return lastTxId + 1; } catch ( NoSuchTransactionException e ) { log.info( "No transaction logs found. Will use metadata store as base for pull request." ); return lastCleanTxId; } }
Source:
<code>public String get(Properties properties) { <START> return new org.postgresql.util.ExpressionProperties(properties).getProperty(_name, _defaultValue); <END> }</code><technical_language>This unexpected consequence if dfwe${...}asdfa pattern right a password property</technical_language>

Target:
public String get(Properties properties) { return properties.getProperty(_name, _defaultValue); }
Source:
<code>protected void map( Writable key, Writable value, Context context ) throws IOException, InterruptedException { try { final InputRow inputRow; try { inputRow = parseInputRow(value, parser); } catch (Exception e) { if (config.isIgnoreInvalidRows()) { <START> log.warn(e, "Ignoring invalid row [%s] due to parsing error", value.toString()); <END> context.getCounter(HadoopDruidIndexerConfig.IndexJobCounters.INVALID_ROW_COUNTER).increment(1); return; } else { throw e; } } if (!granularitySpec.bucketIntervals().isPresent() || granularitySpec.bucketInterval(new DateTime(inputRow.getTimestampFromEpoch())) .isPresent()) { innerMap(inputRow, value, context); } } catch (RuntimeException e) { throw new RE(e, "Failure on row[%s]", value); } }</code><technical_language>this potentially log a tremendous amount of errors. cap logging reasonable? Default = 10</technical_language>

Target:
protected void map( Writable key, Writable value, Context context ) throws IOException, InterruptedException { try { final InputRow inputRow; try { inputRow = parseInputRow(value, parser); } catch (Exception e) { if (config.isIgnoreInvalidRows()) { log.debug(e, "Ignoring invalid row [%s] due to parsing error", value.toString()); context.getCounter(HadoopDruidIndexerConfig.IndexJobCounters.INVALID_ROW_COUNTER).increment(1); return; } else { throw e; } } if (!granularitySpec.bucketIntervals().isPresent() || granularitySpec.bucketInterval(new DateTime(inputRow.getTimestampFromEpoch())) .isPresent()) { innerMap(inputRow, value, context); } } catch (RuntimeException e) { throw new RE(e, "Failure on row[%s]", value); } }
Source:
<code>public void initialize(Configuration config) { this.config = config; eventProcessorRegistry().registerHandlerInvoker(processorInfo.getName(), c -> sagaManager.get()); eventProcessorRegistry().registerTokenStore(processorInfo.getName(), c -> tokenStore.get()); eventProcessorRegistry().configureMessageMonitor(processorInfo.getName(), <START> c -> (MessageMonitor<Message<?>>) messageMonitor.get()); <END> eventProcessorRegistry().configureErrorHandler(processorInfo.getName(), c -> errorHandler.get()); eventProcessorRegistry().configureRollbackConfiguration(processorInfo.getName(), c -> rollbackConfiguration.get()); eventProcessorRegistry().configureTransactionManager(processorInfo.getName(), c -> transactionManager.get()); handlerInterceptors.forEach(i -> eventProcessorRegistry() .registerHandlerInterceptor(processorInfo.getName(), i)); if (processorInfo.isCreateNewProcessor()) { switch (processorInfo.getType()) { case TRACKING: eventProcessorRegistry().registerEventProcessor(processorInfo.getName(), this::buildTrackingEventProcessor); break; case SUBSCRIBING: eventProcessorRegistry().registerEventProcessor(processorInfo.getName(), this::buildSubscribingEventProcessor); break; default: throw new IllegalStateException("Unsupported event processor type."); } } }</code><technical_language>Is cast needed get generics right</technical_language>

Target:
public void initialize(Configuration config) { this.config = config; eventProcessingConfiguration().registerHandlerInvoker(processorInfo.getProcessingGroup(), c -> sagaManager.get()); eventProcessingConfiguration().registerTokenStore(processorInfo.getProcessingGroup(), c -> tokenStore.get()); eventProcessingConfiguration().configureMessageMonitor(processorInfo.getProcessingGroup(), c -> (MessageMonitor<Message<?>>) messageMonitor.get()); eventProcessingConfiguration().configureErrorHandler(processorInfo.getProcessingGroup(), c -> errorHandler.get()); eventProcessingConfiguration().configureRollbackConfiguration(processorInfo.getProcessingGroup(), c -> rollbackConfiguration.get()); eventProcessingConfiguration().configureTransactionManager(processorInfo.getProcessingGroup(), c -> transactionManager.get()); handlerInterceptors.forEach(i -> eventProcessingConfiguration() .registerHandlerInterceptor(processorInfo.getProcessingGroup(), i)); if (processorInfo.isCreateNewProcessor()) { switch (processorInfo.getType()) { case TRACKING: eventProcessingConfiguration().registerEventProcessor(processorInfo.getProcessingGroup(), this::buildTrackingEventProcessor); break; case SUBSCRIBING: eventProcessingConfiguration().registerEventProcessor(processorInfo.getProcessingGroup(), this::buildSubscribingEventProcessor); break; default: throw new IllegalStateException("Unsupported event processor type."); } } }
Source:
<code>protected EmbeddedCacheManager createBackingEmbeddedCacheManager() throws IOException { if (configurationFileLocation != null) { ConfigurationBuilderHolder configurationBuilderHolder = new ParserRegistry(Thread.currentThread().getContextClassLoader()) .parse(configurationFileLocation.getInputStream()); if(gcb != null) { configurationBuilderHolder.getGlobalConfigurationBuilder().read(gcb.build()); } if (builder != null) { configurationBuilderHolder.getDefaultConfigurationBuilder().read(builder.build()); } <START> return createCacheManager(configurationBuilderHolder); <END> } else { if (gcb == null) { if (logger.isDebugEnabled()) logger.debug("GlobalConfigurationBuilder is null. Using default new " + "instance."); gcb = new GlobalConfigurationBuilder(); gcb.globalJmxStatistics().allowDuplicateDomains(true); } if (builder == null) { if (logger.isDebugEnabled()) logger.debug("ConfigurationBuilder is null. Using default new instance."); builder = new ConfigurationBuilder(); } return createCacheManager(gcb, builder); } }</code><technical_language>thing</technical_language>

Target:
protected EmbeddedCacheManager createBackingEmbeddedCacheManager() throws IOException { if (configurationFileLocation != null) { ConfigurationBuilderHolder configurationBuilderHolder = new ParserRegistry(Thread.currentThread().getContextClassLoader()) .parse(configurationFileLocation.getInputStream()); if(gcb != null) { configurationBuilderHolder.getGlobalConfigurationBuilder().read(gcb.build()); } if (builder != null) { configurationBuilderHolder.getDefaultConfigurationBuilder().read(builder.build()); } return new DefaultCacheManager(configurationBuilderHolder, true); } else { if (gcb == null) { if (logger.isDebugEnabled()) logger.debug("GlobalConfigurationBuilder is null. Using default new " + "instance."); gcb = new GlobalConfigurationBuilder(); gcb.globalJmxStatistics().allowDuplicateDomains(true); } if (builder == null) { if (logger.isDebugEnabled()) logger.debug("ConfigurationBuilder is null. Using default new instance."); builder = new ConfigurationBuilder(); } return new DefaultCacheManager(gcb.build(), builder.build()); } }
Source:
<code>public Object getValueAt(int rowIndex, int columnIndex) { FormStatus form = forms.get(rowIndex); switch (columnIndex) { case TransferFormsTableView.SELECTED_CHECKBOX_COL: return form.isSelected(); case TransferFormsTableView.FORM_NAME_COL: return form.getFormName(); case TransferFormsTableView.PULL_COL: <START> return form.isPullSelected(); <END> case TransferFormsTableView.PUSH_COL: return form.isPushSelected(); case TransferFormsTableView.EXPORT_COL: return form.isExportSelected(); case TransferFormsTableView.DETAIL_BUTTON_COL: return detailButtons.computeIfAbsent(form, UI::buildDetailButton); default: throw new IllegalStateException("unexpected column choice"); } }</code><technical_language>forms.isPullSelected(form)</technical_language>

Target:
public Object getValueAt(int rowIndex, int columnIndex) { FormStatus form = forms.get(rowIndex); switch (columnIndex) { case TransferFormsTableView.SELECTED_CHECKBOX_COL: return form.isSelected(); case TransferFormsTableView.FORM_NAME_COL: return form.getFormName(); case TransferFormsTableView.PULL_COL: return forms.isPullSelected(form); case TransferFormsTableView.PUSH_COL: return forms.isPushSelected(form); case TransferFormsTableView.EXPORT_COL: return forms.isExportSelected(form); case TransferFormsTableView.DETAIL_BUTTON_COL: return detailButtons.computeIfAbsent(form, UI::buildDetailButton); default: throw new IllegalStateException("unexpected column choice"); } }
Source:
<code>public static Timestamp getCurrentTimeOnDB(Connection conn, Calendar cal) throws SQLException, ConnectException { Statement stmt = conn.createStatement(); ResultSet rs; String query; String dbProduct = conn.getMetaData().getDatabaseProductName(); if ("Oracle".equals(dbProduct)) query = "select CURRENT_TIMESTAMP from dual"; else if ("Apache Derby".equals(dbProduct)) query = "values(CURRENT_TIMESTAMP)"; else query = "select CURRENT_TIMESTAMP "; try { rs = stmt.executeQuery(query); if (rs.next()) return rs.getTimestamp(1, cal); else throw new ConnectException("Unable to get current time from DB using query " + query + " on database " + dbProduct); } catch (SQLException e) { log.error("Failed to get current time from DB using query " + query + " on database " + dbProduct, e); <START> throw e; <END> } }</code><technical_language>want wrap this in a ConnectException. In general, I attempting restrict exceptions get thrown framework ConnectExceptions ensuring enough expressiveness in allow framework correclty respond is handle arbitrary exceptions. (Of need handle guarantee thrown, minimize intent encourage correct handling of exceptions.)</technical_language>

Target:
public static Timestamp getCurrentTimeOnDB(Connection conn, Calendar cal) throws SQLException, ConnectException { Statement stmt = conn.createStatement(); ResultSet rs = null; String query; String dbProduct = conn.getMetaData().getDatabaseProductName(); if ("Oracle".equals(dbProduct)) query = "select CURRENT_TIMESTAMP from dual"; else if ("Apache Derby".equals(dbProduct)) query = "values(CURRENT_TIMESTAMP)"; else query = "select CURRENT_TIMESTAMP;"; try { log.debug("executing query " + query + " to get current time from database"); rs = stmt.executeQuery(query); if (rs.next()) return rs.getTimestamp(1, cal); else throw new ConnectException("Unable to get current time from DB using query " + query + " on database " + dbProduct); } catch (SQLException e) { log.error("Failed to get current time from DB using query " + query + " on database " + dbProduct, e); throw e; } finally { if (rs != null) rs.close(); if (stmt != null) stmt.close(); } }
Source:
<code>private void processExternallyManagedVms() { _externalVmsToAdd.clear(); for (VmInternalData vmInternalData : _runningVms.values()) { VM currentVmData = _vmDict.get(vmInternalData.getVmDynamic().getId()); if (currentVmData == null) { <START> if (getDbFacade().getVmDao().get(vmInternalData.getVmDynamic().getId()) == null) { <END> Guid vmId = vmInternalData.getVmDynamic().getId(); Map vmConfiguration = getVmInfo(vmId.toString())[0]; VmStatic vmStatic = new VmStatic(); vmStatic.setOrigin(OriginType.valueOf(Config.<String>GetValue(ConfigValues.OriginType))); vmStatic.setId(vmId); vmStatic.setQuotaId(null); vmStatic.setCreationDate(new Date()); vmStatic.setVdsGroupId(_vds.getVdsGroupId()); String vmNameOnHost = (String) vmConfiguration.get(VdsProperties.vm_name); String vmName = "external-" + vmNameOnHost; vmStatic.setName(vmName); vmStatic.setNumOfSockets(Integer.parseInt((String) vmConfiguration.get(VdsProperties.num_of_cpus))); vmStatic.setMemSizeMb(Integer.parseInt((String) vmConfiguration.get(VdsProperties.mem_size_mb))); vmStatic.setExternallyManaged(true); _externalVmsToAdd.add(vmStatic); log.infoFormat("VDS::UpdateVmRunTimeInfo: Importing VM {0} as {1}, as it is running on the on Host, but does not exist in the engine.", vmNameOnHost, vmName); } } } }</code><technical_language>get vm static instead of vm object</technical_language>

Target:
private void processExternallyManagedVms() { _externalVmsToAdd.clear(); List<String> vmsToQuery = new ArrayList<String>(); for (VmInternalData vmInternalData : _runningVms.values()) { VM currentVmData = _vmDict.get(vmInternalData.getVmDynamic().getId()); if (currentVmData == null) { if (getDbFacade().getVmStaticDao().get(vmInternalData.getVmDynamic().getId()) == null) { Guid vmId = vmInternalData.getVmDynamic().getId(); vmsToQuery.add(vmId.toString()); } } } if (!vmsToQuery.isEmpty()) { Map[] vmsInfo = getVmInfo(vmsToQuery); for (Map vmInfo : vmsInfo) { Guid vmId = Guid.createGuidFromString((String) vmInfo.get(VdsProperties.vm_guid)); VmStatic vmStatic = new VmStatic(); vmStatic.setId(vmId); vmStatic.setCreationDate(new Date()); vmStatic.setVdsGroupId(_vds.getVdsGroupId()); String vmNameOnHost = (String) vmInfo.get(VdsProperties.vm_name); String vmName = "external-" + vmNameOnHost; vmStatic.setName(vmName); vmStatic.setNumOfSockets(Integer.parseInt((String) vmInfo.get(VdsProperties.num_of_cpus))); vmStatic.setMemSizeMb(Integer.parseInt((String) vmInfo.get(VdsProperties.mem_size_mb))); vmStatic.setExternallyManaged(true); _externalVmsToAdd.add(vmStatic); log.infoFormat("Importing VM {0} as {1}, as it is running on the on Host, but does not exist in the engine.", vmNameOnHost, vmName); } } }
Source:
<code>SafeHtml asTr() { return new SafeHtmlBuilder() .appendHtmlConstant("<tr>") <START> .appendHtmlConstant("<td>").appendEscaped(event).appendHtmlConstant("</td>") <END> .appendHtmlConstant("<td>").appendEscaped(this.node).appendHtmlConstant("</td>") .appendHtmlConstant("<td>").appendEscaped(this.start.toString()).appendHtmlConstant("</td>") .appendHtmlConstant("<td>").appendEscaped(this.getEnd()).appendHtmlConstant("</td>") .appendHtmlConstant("</tr>") .toSafeHtml(); }</code><technical_language>this is needed for of these. remove all? I mind consistent</technical_language>

Target:
SafeHtml asTr() { return new SafeHtmlBuilder() .appendHtmlConstant("<tr>") .appendHtmlConstant("<td>").appendEscaped(this.event).appendHtmlConstant("</td>") .appendHtmlConstant("<td>").appendEscaped(this.node).appendHtmlConstant("</td>") .appendHtmlConstant("<td>").appendEscaped(this.start.toString()).appendHtmlConstant("</td>") .appendHtmlConstant("<td>").appendEscaped(this.getEnd()).appendHtmlConstant("</td>") .appendHtmlConstant("</tr>") .toSafeHtml(); }