/** * Sets the pathname for this warning. * * @param workspacePath * the workspace path */ @Override public void setPathName(final String workspacePath) { String normalized = workspacePath.replace('\\', '/'); String s = StringUtils.removeStart(getFileName(), normalized); s = StringUtils.remove(s, FilenameUtils.getName(getFileName())); s = StringUtils.removeStart(s, SLASH); s = StringUtils.removeEnd(s, SLASH); pathName = TreeString.of(s); }
/** * Checks if the file exists and the user is authorized to see the contents of the file. * * @return <code>true</code>, if successful */ public final boolean canDisplayFile(final AbstractBuild<?, ?> owner) { if (owner.hasPermission(Item.WORKSPACE)) { return new File(getFileName()).exists() || new File(getTempName(owner)).exists(); } return false; }
/** * Checks if the file exists and the user is authorized to see the contents of the file. * * @return <code>true</code>, if successful */ @Override public final boolean canDisplayFile(final Run<?, ?> owner) { if (owner.hasPermission(Item.WORKSPACE)) { return isInConsoleLog() || new File(getFileName()).exists() || new File(getTempName(owner)).exists(); } return false; }
/** * Sets the pathname for this warning. * * @param workspacePath * the workspace path */ public void setPathName(final String workspacePath) { String normalized = workspacePath.replace('\\', '/'); String s = StringUtils.removeStart(getFileName(), normalized); s = StringUtils.remove(s, FilenameUtils.getName(getFileName())); s = StringUtils.removeStart(s, SLASH); s = StringUtils.removeEnd(s, SLASH); pathName = TreeString.of(s); }
/** {@inheritDoc} */ public String getLinkName() { if (hasPackageName()) { return getPackageName() + "." + FilenameUtils.getBaseName(getFileName()); } else { if (pathName == null || pathName.isBlank()) { return getFileName(); } else { return pathName + SLASH + getShortFileName(); } } }
@Override public String getLinkName() { if (hasPackageName()) { return getPackageName() + "." + FilenameUtils.getBaseName(getFileName()); } else { if (pathName == null || pathName.isBlank()) { return getFileName(); } else { return pathName + SLASH + getShortFileName(); } } }
@Override public String toString() { return String.format("%s(%s):%s,%s,%s:%s", getFileName(), primaryLineNumber, priority, getCategory(), getType(), getMessage()); } }
@Override public String toString() { return String.format("%s(%s):%s,%s,%s:%s", getFileName(), primaryLineNumber, priority, getCategory(), getType(), getMessage()); }
/** {@inheritDoc} */ public int compareTo(final FileAnnotation other) { int result; result = getFileName().compareTo(other.getFileName()); if (result != 0) { return result; } result = getPrimaryLineNumber() - other.getPrimaryLineNumber(); if (result != 0) { return result; } return hashCode() - other.hashCode(); // fallback }
@Override public int compareTo(final FileAnnotation other) { int result; result = getFileName().compareTo(other.getFileName()); if (result != 0) { return result; } result = getPrimaryLineNumber() - other.getPrimaryLineNumber(); if (result != 0) { return result; } result = getColumnStart() - other.getColumnStart(); if (result != 0) { return result; } return hashCode() - other.hashCode(); // fallback }
/** * Copy constructor: Creates a new instance of {@link AbstractAnnotation}. * * @param copy * the annotation to copy the values from */ @edu.umd.cs.findbugs.annotations.SuppressWarnings("ST") public AbstractAnnotation(final AbstractAnnotation copy) { key = currentKey++; message = TreeString.of(copy.getMessage()); priority = copy.getPriority(); primaryLineNumber = copy.getPrimaryLineNumber(); lineRanges = new LineRangeList(copy.getLineRanges()); contextHashCode = copy.getContextHashCode(); fileName = TreeString.of(copy.getFileName()); category = copy.getCategory(); type = copy.getType(); moduleName = TreeString.of(copy.getModuleName()); packageName = TreeString.of(copy.getPackageName()); }