@Override public String toString() { return String.format("%s(%s):%s,%s,%s:%s", getFileName(), primaryLineNumber, priority, getCategory(), getType(), getMessage()); } }
/** * Rebuilds the priorities mapping. * * @return the created object */ private Object readResolve() { if (instanceHash == null) { instanceHash = String.valueOf(super.hashCode()); } return this; }
/** {@inheritDoc} */ public String getLinkName() { if (hasPackageName()) { return getPackageName() + "." + FilenameUtils.getBaseName(getFileName()); } else { if (pathName == null || pathName.isBlank()) { return getFileName(); } else { return pathName + SLASH + getShortFileName(); } } }
/** * 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; }
/** * 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()); }
@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 }
/** {@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 }
/** * Returns the detail message of the task (the text after the task keyword). * * @return the detail message of the task */ public String getDetailMessage() { return super.getMessage(); }
/** * 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; }
return false; if (!getModuleName().equals(other.getModuleName())) { return false; if (!getPackageName().equals(other.getPackageName())) { return false;
/** * 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); }
/** * Verifies the first annotation of the project. * * @param project the created project */ @SuppressWarnings("PMD") protected void verifyFirstAnnotation(final JavaProject project) { FileAnnotation annotation = project.getAnnotation(firstAnnotation.getKey()); assertEquals(WRONG_ANNOTATION_KEY, firstAnnotation, annotation); annotation = project.getAnnotation(String.valueOf(firstAnnotation.getKey())); assertEquals(WRONG_ANNOTATION_KEY, firstAnnotation, annotation); verifyFirstAnnotation(firstAnnotation); JavaProject dummyProject = new JavaProject(); addAnnotation(dummyProject, LINE_NUMBER, TEST_TASK1, Priority.HIGH, PATH_TO_FILE1, PACKAGE1, MODULE1); FileAnnotation other = dummyProject.getAnnotations().iterator().next(); assertEquals("Wrong equals evaluation.", annotation, other); }
/** * @deprecated use {@link #getTempName(Run)} instead */ @Deprecated public String getTempName(final AbstractBuild<?, ?> owner) { return getTempName((Run<?, ?>) owner); } }
@Override public String getMessage() { return super.getMessage() + getCloudInformation(); }
/** * 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); }
/** * Verifies the first annotation of the project. * * @param project the created project */ @SuppressWarnings("PMD") protected void verifyFirstAnnotation(final JavaProject project) { FileAnnotation annotation = project.getAnnotation(firstAnnotation.getKey()); assertEquals(WRONG_ANNOTATION_KEY, firstAnnotation, annotation); annotation = project.getAnnotation(String.valueOf(firstAnnotation.getKey())); assertEquals(WRONG_ANNOTATION_KEY, firstAnnotation, annotation); verifyFirstAnnotation(firstAnnotation); JavaProject dummyProject = new JavaProject(); addAnnotation(dummyProject, LINE_NUMBER, TEST_TASK1, Priority.HIGH, PATH_TO_FILE1, PACKAGE1, MODULE1); FileAnnotation other = dummyProject.getAnnotations().iterator().next(); assertEquals("Wrong equals evaluation.", annotation, other); }
@Override public String toString() { return String.format("%s(%s):%s,%s,%s:%s", getFileName(), primaryLineNumber, priority, getCategory(), getType(), getMessage()); }
@Override public String getLinkName() { if (hasPackageName()) { return getPackageName() + "." + FilenameUtils.getBaseName(getFileName()); } else { if (pathName == null || pathName.isBlank()) { return getFileName(); } else { return pathName + SLASH + getShortFileName(); } } }
/** {@inheritDoc} */ @Override public int hashCode() { int prime = 31; // NOCHECKSTYLE int result = super.hashCode(); result = prime * result + ((sourceCode == null) ? 0 : sourceCode.hashCode()); return result; }
@Override public String getMessage() { return super.getMessage() + getCloudInformation(); }