UCM.java

Index Score
net.sourceforge.cruisecontrol.sourcecontrols
CruiseControl

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
SIZESize of the file in bytes
BLOCKSNumber of blocks
LOGICAL_LINESNumber of statements
EXITSProcedure exits
OPERANDSNumber of operands
PROGRAM_LENGTHHalstead program length
UNIQUE_OPERANDSNumber of unique operands
OPERATORSNumber of operators
ELOCEffective lines of code
PROGRAM_VOCABHalstead program vocabulary
LINESNumber of lines in the source file
LOCLines of code
CYCLOMATICCyclomatic complexity
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
DECL_COMMENTSComments in declarations
RETURNSNumber of return points from functions
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
EXEC_COMMENTSComments in executable code
DOC_COMMENTNumber of javadoc comment lines
FUNCTIONSNumber of function declarations
INTERFACE_COMPLEXITYInterface complexity
JAVA0034JAVA0034 Missing braces in if statement
LOOPSNumber of loops
JAVA0130JAVA0130 Non-static method does not use instance fields
COMMENTSComment lines
JAVA0177JAVA0177 Variable declaration missing initializer
JAVA0166JAVA0166 Generic exception caught
COMPARISONSNumber of comparison operators
LINE_COMMENTNumber of line comments
JAVA0117JAVA0117 Missing javadoc: method 'method'
PARAMSNumber of formal parameter declarations
UNIQUE_OPERATORSNumber of unique operators
WHITESPACENumber of whitespace lines
NEST_DEPTHMaximum nesting depth
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0043JAVA0043 Inner class does not use outer class
JAVA0064JAVA0064 N variations of identifier name (maximum: M)
JAVA0145JAVA0145 Tab character used in source file
/******************************************************************************** * CruiseControl, a Continuous Integration Toolkit * Copyright (c) 2001-2003, ThoughtWorks, Inc. * 200 E. Randolph, 25th Floor * Chicago, IL 60601 USA * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * + Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * + Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the * names of its contributors may be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ********************************************************************************/ package net.sourceforge.cruisecontrol.sourcecontrols; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import net.sourceforge.cruisecontrol.CruiseControlException; import net.sourceforge.cruisecontrol.Modification; import net.sourceforge.cruisecontrol.SourceControl; import net.sourceforge.cruisecontrol.util.Commandline; import net.sourceforge.cruisecontrol.util.CommandlineUtil; import net.sourceforge.cruisecontrol.util.ValidationHelper; import org.apache.log4j.Logger; import org.jdom.Element; /** * This class implements the SourceControlElement methods for ClearCase UCM. * * @author <a href="mailto:kevin.lee@buildmeister.com">Kevin Lee</a> * @author Alex Batlin */ public class UCM implements SourceControl { private static final Logger LOG = Logger.getLogger(UCM.class); private String stream; private String viewPath; private boolean multiVob; private boolean contributors = true; private boolean rebases = false; private final SourceControlProperties properties = new SourceControlProperties(); private final SimpleDateFormat inputDateFormat = new SimpleDateFormat("dd-MMMM-yyyy.HH:mm:ss"); private final SimpleDateFormat outputDateFormat = new SimpleDateFormat("yyyyMMdd.HHmmss"); private String pvob; /** * Unlikely combination of characters to separate fields in a ClearCase query */ static final String DELIMITER = "#~#"; /** * Even more unlikely combination of characters to indicate end of one line in query. Carriage return (\n) can be * used in comments and so is not available to us. */ static final String END_OF_STRING_DELIMITER = "@#@#@#@#@#@#@#@#@#@#@#@"; public Map getProperties() { return properties.getPropertiesAndReset(); } public void validate() throws CruiseControlException { ValidationHelper.assertIsSet(stream, "stream", this.getClass()); ValidationHelper.assertIsSet(viewPath, "viewpath", this.getClass()); if (isRebases()) { ValidationHelper.assertIsSet(pvob, "pvob", this.getClass()); } } /** * get which stream is being checked * * @return the name of the stream being checked */ public String getStream() { return stream; } /** * set the stream to check for changes * * @param stream * the stream to be checked (via its underlying branch) */ public void setStream(String stream) { this.stream = stream; } /** * get the starting point path in a view to check for changes * * @return path inside a view */ public String getViewPath() { return viewPath; } /** * set the starting point path in a view to check for changes * * @param viewPath * path inside a view */ public void setViewPath(String viewPath) { this.viewPath = viewPath; } /** * get whether the view contains multiple vobs * * @return true, if the view contains multiple vobs, else false */ public boolean isMultiVob() { return this.multiVob; } /** * set whether the view contains multiple vobs * * @param multiVob boolean indicating whether the view contains multiple vobs */ public void setMultiVob(boolean multiVob) { this.multiVob = multiVob; } /** * Set the name of the pvob to use for queries. * * @param pvob * the pvob */ public void setPvob(String pvob) { this.pvob = pvob; } /** * Get the name of the pvob to use for queries. * * @return The name of the pvob */ public String getPvob() { return this.pvob; } /** * Gets whether rebases are to be reported as changes. * * @return true, if rebases are to be reported, else false */ public boolean isRebases() { return this.rebases; } /** * Sets whether rebases of the integration stream are reported as changes. * * @param rebases * boolean indicating whether rebases are to be reported as changes */ public void setRebases(boolean rebases) { this.rebases = rebases; } /** * get whether contributors are to be found * * @return true, if contributors are to be found, else false */ public boolean isContributors() { return contributors; } /** * set whether contributors are to be found * * @param contributors * boolean indicating whether contributors are to be found */ public void setContributors(boolean contributors) { this.contributors = contributors; } /** * set the name of the property that will be set if modifications are found * * @param property * The name of the property to set */ public void setProperty(String property) { properties.assignPropertyName(property); } /** * Get a List of modifications detailing all the changes between now and the last build. Return this as an element. * It is not necessary for sourcecontrols to actually do anything other than returning a chunk of XML data back. * * @param lastBuild * time of last build * @param now * time this build started * @return a list of XML elements that contains data about the modifications that took place. If no changes, this * method returns an empty list. */ public List getModifications(final Date lastBuild, final Date now) { final String lastBuildDate = inputDateFormat.format(lastBuild); final String nowDate = inputDateFormat.format(now); properties.put("ucmlastbuild", lastBuildDate); properties.put("ucmnow", nowDate); List<Modification> mods = new ArrayList<Modification>(); try { final HashMap<String, String> activityNames = collectActivitiesSinceLastBuild(lastBuildDate); if (activityNames.size() == 0) { return mods; } mods = describeAllActivities(activityNames); } catch (Exception e) { LOG.error("Command failed to execute succesfully", e); } if (this.isRebases()) { try { final Commandline commandline = buildDetectRebasesCommand(lastBuildDate); commandline.setWorkingDirectory(viewPath); final InputStream cmdStream = CommandlineUtil.streamOutput(commandline); try { mods.addAll(parseRebases(cmdStream)); } finally { cmdStream.close(); } } catch (Exception e) { LOG.error("Error in executing the Clear Case command : ", e); } } // If modifications were found, set the property if (!mods.isEmpty()) { properties.modificationFound(); } return mods; } /** * get all the activities on the stream since the last build date */ private HashMap<String, String> collectActivitiesSinceLastBuild(final String lastBuildDate) { LOG.debug("Last build time was: " + lastBuildDate); final HashMap<String, String> activityMap = new HashMap<String, String>(); final Commandline commandLine = buildListStreamCommand(lastBuildDate); LOG.debug("Executing: " + commandLine); try { commandLine.setWorkingDirectory(viewPath); final InputStream cmdStream = CommandlineUtil.streamOutput(commandLine); final InputStreamReader isr = new InputStreamReader(cmdStream); final BufferedReader br = new BufferedReader(isr); try { String line = br.readLine(); while ((line != null) && (!line.equals(""))) { final String[] details = getDetails(line); if (details[0].equals("mkbranch") || details[0].equals("rmbranch") || details[0].equals("rmver")) { // if type is create/remove branch then skip } else { final String activityName = details[1]; final String activityDate = details[2]; // assume the latest change for an activity is listed first if (!activityMap.containsKey(activityName)) { LOG.debug("Found activity name: " + activityName + "; date: " + activityDate); activityMap.put(activityName, activityDate); } } line = br.readLine(); } } finally { br.close(); cmdStream.close(); } } catch (IOException e) { LOG.error("IO Error executing ClearCase lshistory command", e); } catch (CruiseControlException e) { LOG.error("Interrupt Error executing ClearCase lshistory command", e); } return activityMap; } private String[] getDetails(String line) { // replacing line.split("~#~") for jdk 1.3 ArrayList<String> details = new ArrayList<String>(); String delimiter = "~#~"; int startIndex = 0; int index = 0; while (index != -1) { String detail; index = line.indexOf(delimiter, startIndex); if (index == -1) { detail = line.substring(startIndex, line.length()); } else { detail = line.substring(startIndex, index); } details.add(detail); startIndex = index + delimiter.length(); } return details.toArray(new String[details.size()]); } /** * construct a command to get all the activities on the specified stream */ public Commandline buildListStreamCommand(final String lastBuildDate) { final Commandline commandLine = new Commandline(); if (isMultiVob()) { try { commandLine.setWorkingDirectory(getViewPath()); } catch (CruiseControlException e) { LOG.error("Error in setting workdirectory", e); } } commandLine.setExecutable("cleartool"); commandLine.createArgument("lshistory"); commandLine.createArguments("-branch", getStream()); if (isMultiVob()) { commandLine.createArgument("-avobs"); } else { commandLine.createArgument("-r"); } commandLine.createArgument("-nco"); commandLine.createArguments("-since", lastBuildDate); commandLine.createArguments("-fmt", "%o~#~%[activity]Xp~#~%Nd\n"); if (!isMultiVob()) { commandLine.createArgument(getViewPath()); } return commandLine; } /** * get all the activities on the stream since the last build date */ private List<Modification> describeAllActivities(final HashMap<String, String> activityNames) { final ArrayList<Modification> activityList = new ArrayList<Modification>(); for (Map.Entry<String, String> activity : activityNames.entrySet()) { final String activityID = activity.getKey(); final String activityDate = activity.getValue(); final UCMModification activityMod = describeActivity(activityID, activityDate); activityList.add(activityMod); // check for contributor activities if (activityMod.comment.startsWith("deliver ") && isContributors()) { final List<String> contribList = describeContributors(activityID); final Iterator contribIter = contribList.iterator(); while (contribIter.hasNext()) { final String contribName = activity.toString(); final UCMModification contribMod = describeActivity(contribName, activityDate); // prefix type to make it stand out in Build Results report contribMod.type = "contributor"; LOG.debug("Found contributor name: " + contribName + "; date: " + activityDate); activityList.add(contribMod); } } } return activityList; } /** * get all the activities on the stream since the last build date */ private UCMModification describeActivity(final String activityID, final String activityDate) { final UCMModification mod = new UCMModification(); final Commandline commandLine = buildDescribeActivityCommand(activityID); LOG.debug("Executing: " + commandLine); try { commandLine.setWorkingDirectory(viewPath); final InputStream cmdStream = CommandlineUtil.streamOutput(commandLine); final InputStreamReader isr = new InputStreamReader(cmdStream); final BufferedReader br = new BufferedReader(isr); try { String line = br.readLine(); while ((line != null) && (!line.equals(""))) { final String[] details = getDetails(line); try { mod.modifiedTime = outputDateFormat.parse(activityDate); } catch (ParseException e) { LOG.error("Error parsing modification date"); mod.modifiedTime = new Date(); } mod.type = "activity"; // counter for UCM without ClearQuest if (details[0].equals("")) { mod.revision = details[3]; } else { mod.revision = details[0]; } mod.crmtype = details[1]; mod.userName = details[2]; mod.comment = details[3]; line = br.readLine(); } } finally { br.close(); cmdStream.close(); } } catch (IOException e) { LOG.error("IO Error executing ClearCase describe command", e); } catch (CruiseControlException e) { LOG.error("Interrupt error executing ClearCase describe command", e); } return mod; } /** * construct a command to get all the activities on the specified stream */ public Commandline buildDescribeActivityCommand(final String activityID) { final Commandline commandLine = new Commandline(); commandLine.setExecutable("cleartool"); commandLine.createArgument("describe"); commandLine.createArguments("-fmt", "%[crm_record_id]p~#~%[crm_record_type]p~#~%u~#~%[headline]p~#~"); commandLine.createArgument(activityID); return commandLine; } /** * get all the activities on the stream since the last build date */ private List<String> describeContributors(final String activityName) { final ArrayList<String> contribList = new ArrayList<String>(); final Commandline commandLine = buildListContributorsCommand(activityName); LOG.debug("Executing: " + commandLine); try { commandLine.setWorkingDirectory(viewPath); final InputStream cmdStream = CommandlineUtil.streamOutput(commandLine); final InputStreamReader isr = new InputStreamReader(cmdStream); final BufferedReader br = new BufferedReader(isr); try { String line; while ((line = br.readLine()) != null) { final String[] contribs = splitOnSpace(line); contribList.addAll(Arrays.asList(contribs)); } } finally { br.close(); cmdStream.close(); } } catch (IOException e) { LOG.error("IO Error executing ClearCase describe contributors command", e); } catch (CruiseControlException e) { LOG.error("Interrupt Error executing ClearCase describe contributors command", e); } return contribList; } private String[] splitOnSpace(final String string) { return string.split(" "); } /** * construct a command to get all the activities on the specified stream */ public Commandline buildListContributorsCommand(final String activityID) { final Commandline commandLine = new Commandline(); commandLine.setExecutable("cleartool"); commandLine.createArgument("describe"); commandLine.createArguments("-fmt", "%[contrib_acts]Xp"); commandLine.createArgument(activityID); return commandLine; } protected Commandline buildDetectRebasesCommand(final String lastBuildDate) { final Commandline commandLine = new Commandline(); commandLine.setExecutable("cleartool"); commandLine.createArgument().setValue("lshistory"); commandLine.createArgument().setValue("-since"); commandLine.createArgument().setValue(lastBuildDate); commandLine.createArgument().setValue("-minor"); commandLine.createArgument().setValue("-fmt"); final String format = "%u" + DELIMITER + "%Nd" + DELIMITER + "%o" + DELIMITER + "%Nc" + END_OF_STRING_DELIMITER + "\\n"; commandLine.createArgument().setValue(format); commandLine.createArgument().setValue("stream:" + stream + "@" + pvob); return commandLine; } /** * Parses the given input stream to construct the modifications list. The stream is expected to be the result of * listing the history of a UCM stream. Rebases are then detected by delegating to * {@link #parseRebaseEntry(String)}. * Package-private to make it available to the unit test. * * @param input * the stream to parse * @return a list of modification elements * @exception IOException */ List<Modification> parseRebases(final InputStream input) throws IOException { final ArrayList<Modification> modifications = new ArrayList<Modification>(); final BufferedReader reader = new BufferedReader(new InputStreamReader(input)); try { final String ls = System.getProperty("line.separator"); String line; StringBuffer lines = new StringBuffer(); while ((line = reader.readLine()) != null) { if (lines.length() != 0) { lines.append(ls); } lines.append(line); Modification mod = null; if (lines.indexOf(END_OF_STRING_DELIMITER) > -1) { mod = parseRebaseEntry(lines.substring(0, lines.indexOf(END_OF_STRING_DELIMITER))); lines = new StringBuffer(); } if (mod != null) { modifications.add(mod); } } } finally { reader.close(); } return modifications; } /** * Parses a single line from the reader. Each line contains a signe revision with the format : <br> * username#~#date_of_revision#~#operation_type#~#comments <br> * <p> * This method looks for operations of type rmhlink and mkhlink where the hyperlink name begins with "UseBaseline". * These represent changes in the baseline dependencies of the stream. * </p> * * @param line * the line to parse * @return a modification element corresponding to the given line */ Modification parseRebaseEntry(final String line) { LOG.debug("parsing entry: " + line); String[] tokens = tokenizeEntry(line); if (tokens == null) { return null; } String username = tokens[0].trim(); String timeStamp = tokens[1].trim(); String operationType = tokens[2].trim(); String comment = tokens[3].trim(); Modification mod = null; // Rebases show up as mkhlink and rmhlink operations if (operationType.equals("mkhlink") || operationType.equals("rmhlink")) { // Parse the hyperlink name out of the comment field, then // get more information on that hyperlink mod = new Modification(); String linkName = parseLinkName(comment); // If this isn't a "UseBaseline" hyperlink, we're not interested if (!linkName.startsWith("UseBaseline")) { return null; } Hyperlink link = getHyperlink(linkName); StringBuffer modComment = new StringBuffer(); mod.type = "ucmdependency"; if (operationType.equals("mkhlink")) { modComment.append("Added dependency"); } else { modComment.append("Removed dependency"); } if (link.getFrom().length() > 0) { modComment.append(" of "); modComment.append(link.getFrom()); } if (link.getTo().length() > 0) { modComment.append(" on "); modComment.append(link.getTo()); mod.revision = link.getTo(); } else { // Don't know what the revision was to mod.revision = ""; } mod.comment = modComment.toString(); mod.userName = username; try { mod.modifiedTime = outputDateFormat.parse(timeStamp); } catch (ParseException e) { LOG.error("Error parsing modification date", e); mod.modifiedTime = new Date(); } properties.modificationFound(); } return mod; } private Hyperlink getHyperlink(String linkName) { Commandline commandline = buildGetHyperlinkCommandline(linkName); try { commandline.setWorkingDirectory(viewPath); InputStream cmdStream = CommandlineUtil.streamOutput(commandline); Hyperlink link = null; try { link = parseHyperlinkDescription(cmdStream); } finally { cmdStream.close(); } return link; } catch (Exception e) { LOG.error("Error in executing the Clear Case command : ", e); return new Hyperlink(); } } protected Commandline buildGetHyperlinkCommandline(String linkName) { Commandline commandline = new Commandline(); commandline.setExecutable("cleartool"); commandline.createArgument().setValue("describe"); commandline.createArgument().setValue("hlink:" + linkName + "@" + pvob); return commandline; } Hyperlink parseHyperlinkDescription(final InputStream input) throws IOException { final BufferedReader reader = new BufferedReader(new InputStreamReader(input)); try { String lastLine = ""; String line = reader.readLine(); // If the hyperlink wasn't found, cleartool will return no output, giving // us an empty stream. This will end up returning an empty string. while (line != null) { lastLine = line; line = reader.readLine(); } final Hyperlink link = new Hyperlink(); final StringTokenizer tokens = new StringTokenizer(lastLine, " "); if (!tokens.hasMoreTokens()) { return link; } // Discard the first one, that's the link name tokens.nextToken(); if (!tokens.hasMoreTokens()) { return link; } link.setFrom(tokens.nextToken()); // Discard "->" if (!tokens.hasMoreTokens()) { return link; } tokens.nextToken(); if (!tokens.hasMoreTokens()) { return link; } link.setTo(tokens.nextToken()); return link; } finally { reader.close(); } } String parseLinkName(String comment) { // Parse on spaces and quotes (to eliminate them) StringTokenizer tokens = new StringTokenizer(comment, " \""); String link = ""; String token = ""; // The next-to-last token should contain the hyperlink name while (tokens.hasMoreTokens()) { link = token; token = tokens.nextToken(); } int index = link.lastIndexOf('@'); if (index != -1) { // Remove the VOB-qualifier from the end. We'll add it back ourselves return link.substring(0, link.lastIndexOf('@')); } else { // Return it unmodified return link; } } private String[] tokenizeEntry(String line) { int maxTokens = 4; int minTokens = maxTokens - 1; // comment may be absent. String[] tokens = new String[maxTokens]; Arrays.fill(tokens, ""); int tokenIndex = 0; for (int oldIndex = 0, i = line.indexOf(DELIMITER, 0); true; oldIndex = i + DELIMITER.length(), i = line .indexOf(DELIMITER, oldIndex), tokenIndex++) { if (tokenIndex > maxTokens) { LOG.debug("Too many tokens; skipping entry"); return null; } if (i == -1) { tokens[tokenIndex] = line.substring(oldIndex); break; } else { tokens[tokenIndex] = line.substring(oldIndex, i); } } if (tokenIndex < minTokens) { LOG.debug("Not enough tokens; skipping entry"); return null; } return tokens; } /** * Class to represent ClearCase hyperlinks. */ class Hyperlink { private String from = ""; private String to = ""; public String getFrom() { return this.from; } public void setFrom(String from) { this.from = from; } public String getTo() { return this.to; } public void setTo(String to) { this.to = to; } } /** * class to hold UCMModifications */ private static class UCMModification extends Modification { private static final String TAGNAME_CRMTYPE = "crmtype"; public String crmtype; public int compareTo(Object o) { UCMModification modification = (UCMModification) o; return getActivitityNumber() - modification.getActivitityNumber(); } public boolean equals(Object o) { if (o == null || !(o instanceof UCMModification)) { return false; } UCMModification modification = (UCMModification) o; return getActivitityNumber() == modification.getActivitityNumber(); } public int hashCode() { return getActivitityNumber(); } private int getActivitityNumber() { return Integer.parseInt(revision); } UCMModification() { super("ucm"); } public Element toElement(DateFormat formatter) { Element modificationElement = super.toElement(formatter); Element crmtypeElement = new Element(TAGNAME_CRMTYPE); crmtypeElement.addContent(crmtype); modificationElement.addContent(crmtypeElement); return modificationElement; } } }

The table below shows all metrics for UCM.java.

MetricValueDescription
BLOCKS126.00Number of blocks
BLOCK_COMMENT 0.00Number of block comment lines
COMMENTS201.00Comment lines
COMMENT_DENSITY 0.46Comment density
COMPARISONS49.00Number of comparison operators
CYCLOMATIC100.00Cyclomatic complexity
DECL_COMMENTS29.00Comments in declarations
DOC_COMMENT181.00Number of javadoc comment lines
ELOC436.00Effective lines of code
EXEC_COMMENTS18.00Comments in executable code
EXITS89.00Procedure exits
FUNCTIONS43.00Number of function declarations
HALSTEAD_DIFFICULTY84.82Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY96.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 0.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 0.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 0.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 1.00JAVA0007 Should not declare public field
JAVA0008 0.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 0.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA0034 0.00JAVA0034 Missing braces in if statement
JAVA0035 0.00JAVA0035 Missing braces in for statement
JAVA0036 0.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 1.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 1.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 0.00JAVA0059 Method override only calls super()
JAVA0061 0.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '$'
JAVA0064 2.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 0.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 0.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA0076 0.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 0.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 0.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 0.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0087 0.00JAVA0087 Use of Thread.sleep()
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 0.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 0.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 0.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA0108 8.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 7.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 0.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 1.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 0.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 1.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 6.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA0126 0.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 4.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 1.00JAVA0137 Non-abstract class missing constructor
JAVA0138 0.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 0.00JAVA0144 Line exceeds maximum M characters
JAVA0145 0.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 0.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA0166 3.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 0.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 0.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 3.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 2.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 0.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 0.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 0.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 0.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 0.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 0.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0272 0.00JAVA0272 Thread.run() called
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 1.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 0.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES860.00Number of lines in the source file
LINE_COMMENT20.00Number of line comments
LOC538.00Lines of code
LOGICAL_LINES307.00Number of statements
LOOPS 9.00Number of loops
NEST_DEPTH 6.00Maximum nesting depth
OPERANDS1284.00Number of operands
OPERATORS2325.00Number of operators
PARAMS32.00Number of formal parameter declarations
PROGRAM_LENGTH3609.00Halstead program length
PROGRAM_VOCAB437.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS64.00Number of return points from functions
SIZE30172.00Size of the file in bytes
UNIQUE_OPERANDS386.00Number of unique operands
UNIQUE_OPERATORS51.00Number of unique operators
WHITESPACE121.00Number of whitespace lines