Source Code Cross Referenced for BugPattern.java in  » Code-Analyzer » findbugs » edu » umd » cs » findbugs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Code Analyzer » findbugs » edu.umd.cs.findbugs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * FindBugs - Find bugs in Java programs
003:         * Copyright (C) 2003,2004 University of Maryland
004:         * 
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         * 
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:         * Lesser General Public License for more details.
014:         * 
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018:         */
019:
020:        package edu.umd.cs.findbugs;
021:
022:        /**
023:         * A BugPattern object collects all of the metadata for a particular
024:         * species of BugInstance.  Specifically, it stores the human-readable
025:         * text for displaying a bug instance.  BugPatterns derive from the
026:         * BugPattern elements in the "findbugs.xml" and "messages.xml"
027:         * found in a FindBugs plugin.
028:         *
029:         * @author David Hovemeyer
030:         * @see BugInstance
031:         */
032:        public class BugPattern implements  Comparable<BugPattern> {
033:            final private String type;
034:            final private String abbrev;
035:            final private String category;
036:            final private boolean experimental;
037:            final private String shortDescription;
038:            final private String longDescription;
039:            final private String detailText;
040:            private String detailHTML;
041:            final int cweid;
042:
043:            /**
044:             * Constructor.
045:             *
046:             * @param type             the type (species) of BugInstance
047:             * @param abbrev           the abbreviation or "bug code"; see {@link BugCode}
048:             * @param category         the category
049:             * @param experimental     true if the bug pattern is experimental
050:             * @param shortDescription short one-line description of the bug species
051:             * @param longDescription  longer one-line description; may contain placeholders
052:             *                         for use by {@link FindBugsMessageFormat} to format BugAnnotations
053:             * @param detailText       HTML text containing a full description of the bug species
054:             */
055:            public BugPattern(String type, String abbrev, String category,
056:                    boolean experimental, String shortDescription,
057:                    String longDescription, String detailText) {
058:                this (type, abbrev, category, experimental, shortDescription,
059:                        longDescription, detailText, 0);
060:            }
061:
062:            /**
063:             * Constructor.
064:             *
065:             * @param type             the type (species) of BugInstance
066:             * @param abbrev           the abbreviation or "bug code"; see {@link BugCode}
067:             * @param category         the category
068:             * @param experimental     true if the bug pattern is experimental
069:             * @param shortDescription short one-line description of the bug species
070:             * @param longDescription  longer one-line description; may contain placeholders
071:             *                         for use by {@link FindBugsMessageFormat} to format BugAnnotations
072:             * @param detailText       HTML text containing a full description of the bug species
073:             */
074:            public BugPattern(String type, String abbrev, String category,
075:                    boolean experimental, String shortDescription,
076:                    String longDescription, String detailText, int cweid) {
077:
078:                this .type = type;
079:                this .abbrev = abbrev;
080:                this .category = category;
081:                this .experimental = experimental;
082:                this .shortDescription = shortDescription;
083:                this .longDescription = longDescription;
084:                this .detailText = detailText;
085:                this .cweid = cweid;
086:            }
087:
088:            static final BugPattern REALLY_UNKNOWN = new BugPattern(
089:                    "REALLY_UNKNOWN",
090:                    "TEST",
091:                    "CORRECTNESS",
092:                    false,
093:                    "Unknown warning; core bug patterns not found",
094:                    "Unknown warning BUG_PATTERN in {1}; core bug patterns not found",
095:                    "<p>A warning was recorded, but findbugs can't find the description of this bug pattern "
096:                            + "and so can't describe it. This should occur only in cases of a bug in FindBugs or its configuration, "
097:                            + "or perhaps if an analysis was generated using a plugin, but that plugin is not currently loaded. "
098:                            + "</p>");
099:
100:            /**
101:             * Get the type (species).
102:             */
103:            public String getType() {
104:                return type;
105:            }
106:
107:            /**
108:             * Get the abbreviation or "bug code".
109:             */
110:            public String getAbbrev() {
111:                return abbrev;
112:            }
113:
114:            /**
115:             * Get the category.
116:             */
117:            public String getCategory() {
118:                return category;
119:            }
120:
121:            public String getCategoryAbbrev() {
122:                String categoryAbbrev = null;
123:                BugCategory bcat = I18N.instance()
124:                        .getBugCategory(getCategory());
125:                if (bcat != null)
126:                    categoryAbbrev = bcat.getAbbrev();
127:                if (categoryAbbrev == null)
128:                    categoryAbbrev = TextUIBugReporter.OTHER_CATEGORY_ABBREV;
129:                return categoryAbbrev;
130:            }
131:
132:            /**
133:             * Is the bug pattern experimental?
134:             */
135:            public boolean isExperimental() {
136:                return experimental;
137:            }
138:
139:            /**
140:             * Get the short description.
141:             */
142:            public String getShortDescription() {
143:                return shortDescription;
144:            }
145:
146:            /**
147:             * Get the long description.
148:             */
149:            public String getLongDescription() {
150:                return longDescription;
151:            }
152:
153:            /**
154:             * Get the HTML detail text describing the bug.
155:             */
156:            public String getDetailText() {
157:                return detailText;
158:            }
159:
160:            /**
161:             * Get the detail text as a complete HTML document.
162:             */
163:            public String getDetailHTML() {
164:                if (detailHTML == null) {
165:                    StringBuffer buf = new StringBuffer();
166:                    buf
167:                            .append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
168:                    buf.append("<HTML><HEAD><TITLE>");
169:                    buf.append(getShortDescription());
170:                    buf.append("</TITLE></HEAD><BODY><H1>");
171:                    buf.append(getShortDescription());
172:                    buf.append("</H1>\n");
173:                    buf.append(getDetailText());
174:                    buf.append("</BODY></HTML>\n");
175:                    detailHTML = buf.toString();
176:                }
177:                return detailHTML;
178:            }
179:
180:            public int compareTo(BugPattern other) {
181:                return type.compareTo(other.type);
182:            }
183:
184:            @Override
185:            public int hashCode() {
186:                return type.hashCode();
187:            }
188:
189:            @Override
190:            public boolean equals(Object o) {
191:                if (!(o instanceof  BugPattern))
192:                    return false;
193:                BugPattern other = (BugPattern) o;
194:                return type.equals(other.type);
195:            }
196:
197:            /**
198:             * @return Returns the cweid.
199:             */
200:            public int getCWEid() {
201:                return cweid;
202:            }
203:        }
204:
205:        // vim:ts=4
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.