DN.java

Index Score
com.ca.commons.naming
JXplorer

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
DECL_COMMENTSComments in declarations
JAVA0034JAVA0034 Missing braces in if statement
LOOPSNumber of loops
COMMENTSComment lines
RETURNSNumber of return points from functions
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
JAVA0081JAVA0081 Boolean literal in comparison
LINESNumber of lines in the source file
CYCLOMATICCyclomatic complexity
LINE_COMMENTNumber of line comments
INTERFACE_COMPLEXITYInterface complexity
DOC_COMMENTNumber of javadoc comment lines
JAVA0035JAVA0035 Missing braces in for statement
FUNCTIONSNumber of function declarations
JAVA0036JAVA0036 Missing braces in while statement
COMPARISONSNumber of comparison operators
SIZESize of the file in bytes
WHITESPACENumber of whitespace lines
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
BLOCK_COMMENTNumber of block comment lines
LOCLines of code
BLOCKSNumber of blocks
PARAMSNumber of formal parameter declarations
JAVA0266JAVA0266 Use of System.out
EXITSProcedure exits
LOGICAL_LINESNumber of statements
OPERATORSNumber of operators
PROGRAM_LENGTHHalstead program length
JAVA0115JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
UNIQUE_OPERATORSNumber of unique operators
PROGRAM_VOCABHalstead program vocabulary
JAVA0283JAVA0283 Control variable not updated in loop body
ELOCEffective lines of code
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0160JAVA0160 Method does not throw specified exception
UNIQUE_OPERANDSNumber of unique operands
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0132JAVA0132 Method overload with compatible signature
OPERANDSNumber of operands
JAVA0117JAVA0117 Missing javadoc: method 'method'
JAVA0267JAVA0267 Use of System.err
EXEC_COMMENTSComments in executable code
JAVA0145JAVA0145 Tab character used in source file
package com.ca.commons.naming; import java.lang.String; import java.util.Vector; import java.util.Enumeration; import javax.naming.*; //import com.ca.commons.cbutil.CBIntText; /** * A Data class that encapsulated the idea of an * ldap Distinguished Name of the form: * ou=frog farmers,o=frogcorp,c=au * - and provides a bunch of utility methods for modifying * and reading these values, especially the various bits * of each rdn in various ways. <p> * * implements javax.naming.Name.<p> * * Why don't we just use CompoundName or CompositeName?<br> * * &nbsp;&nbsp;&nbsp;- basically because we're not supporting multiple * naming systems - we're *only* supporting ldap. So Name is implemented * for support with existing jndi ftns, but also a lot of other stuff * is needed for rdns, and multi-value rdns. This could be architected * as, say, compound name with another helper class, but that seems * clumsy.<p> * */ // // Can be used stand alone with com.ca.commons.naming.RDN, com.ca.commons.naming.NameUtility, com.ca.commons.cbutil.CBParse // // // public class DN implements Name { // these variables are all there is! Basically the magic is in the vector of // rdns - all the code below is simply utility stuff for parsing and manipulating // those rdns. private Vector RDNs; // a list of segment RDNs, as strings, e.g. 'ou=frog farmers' // element 0 is the 'root' RDN (i.e. 'c=au') // element (RDNs.size()-1) is the lowest RDN (i.e. 'cn=fred'). boolean binary = false; // whether the dn contains isNonString data, and should // be base64 encoded before being written out... // XXX Candidate for refactoring! // Rather than throwing errors (which they probably should) some methods // cache error information and expect the caller to check the error status // what can I say. I was young. - CB String errorString = ""; // the cached root exception. NamingException rootException = null; // boolean empty = false; // whether this is the blank DN "". /** * Default constructor creates a DN with no value set. */ public static String BLANKBASEDN = "World"; public DN() { RDNs = new Vector(); } /** * Copy constructor creates a new DN with an item by item * <i>copy</i> of the parameter DN. * * @param copyMe the DN to be copied */ public DN(DN copyMe) { try { RDNs = new Vector(); if (copyMe != null) { for (int i=0; i<copyMe.size(); i++) { add(new String(copyMe.get(i))); } } } catch (InvalidNameException e) // 'impossible' error - if copyMe is DN, how can this fail? { setError("error cloningDN " + copyMe.toString(), e); clear(); } } /** * Main Constructor takes an ldap Distinguished Name string * (e.g. 'ou=wombat botherers,o=nutters inc,c=au') and * breaks it up into a vector of RDNs * * @param ldapDN the ldap distinguished name to be parsed. */ public DN(String ldapDN) { try { RDNs = new Vector(); if ("".equals(ldapDN) || BLANKBASEDN.equals(ldapDN)) { return; } int start = 0; int end = NameUtility.next(ldapDN, 0, ','); // get the RDNs in the form xxx=xxx,xxx=xxx,xxx=xxx while (end!=-1) { String rdn = ldapDN.substring(start,end); add(0,rdn); start = end+1; end = NameUtility.next(ldapDN, start, ','); } // ... and the last bit... add(0,ldapDN.substring(start).trim()); } catch (InvalidNameException e) { setError("unable to make DN from " + ldapDN ,e); clear(); } } /** * This Constructor takes an existing jndi Name, * And initialises itself by taking that Name's rdn elements * an element at a time, and converting them to RDN objects. * * @param name the ldap distinguished name to be parsed. */ public DN(Name name) { try { RDNs = new Vector(); if (name.isEmpty()) return; for (int i=0; i<name.size(); i++) { add(i,name.get(i)); } } catch (InvalidNameException e) { setError("unable to create DN from name: " + name.toString(), e); clear(); } } /* public DN(byte[] name) { setError("Binary Distinguished Names not yet implemented "); } */ /** * Spits back the DN as an escaped ldap DN string * * @return ldap DN in normal form (e.g. 'ou=linux fanatics,o=penguin fanciers pty. ltd.,c=us') */ public String toString() { String ldapDN = ""; for (int i=0; i<RDNs.size(); i++) ldapDN = get(i) + (i!=0?",":"") + ldapDN; if (ldapDN.endsWith(",")) { if (ldapDN.charAt(ldapDN.length()-2) != '\\') { ldapDN = ldapDN.substring(0,ldapDN.length()-1); } } return ldapDN; } /** * Spits back the DN as a tree-level formatted string (mainly for debugging) * * @return ldap DN in level form (e.g. <pre>\nou=linux fanatics \no=penguin fanciers pty. ltd.\n c=us\n</pre>) */ public String toFormattedString() { String ldapDN = ""; for (int i=0; i<RDNs.size(); i++) ldapDN += get(i) + "\n"; return ldapDN; } /** * a synonym for 'toString()' this returns the full ldap DN. * @deprecated - use toString(). * @return the full ldap Distinguished Name */ public String getDN() { return toString(); } /** * gets the ldap 'class' (e.g. 'c' or 'cn') for a particular * RDN. If there are multiple attributes (for a multi-valued * rdn) only the first is returned (XXX). * * @param i the index of the RDN class to return. * @return the ldap class name for the specified RDN */ public String getRDNAttribute(int i) { if (isEmpty()) return ""; if (i >= size()) return ""; if (i < 0) return ""; return getRDN(i).getAtt(); } /** * gets the ldap value (e.g. 'au' or 'Silverstone, Alicia') for a particular * RDN. If there are multiple values, only the first is * returned (XXX). * * @param i the index of the RDN value to return. * @return the actual value for the specified RDN. */ public String getRDNValue(int i) { if (isEmpty()) return ""; if (i >= size()) return ""; if (i < 0) return ""; return getRDN(i).getRawVal(); } /** * dumps the dn in a structured form, demonstrating parsing. */ public void debugPrint() { System.out.print("\n"); for (int i=0; i<size(); i++) { System.out.print("element [" + i + "] = " + get(i).toString() + "\n"); getRDN(i).dump(); } } /** * gets the full RDN (e.g. 'c=au' or 'cn=Englebert Humperdink') for a particular * indexed RDN. * * @param rdn the ldap RDN string name for the specified index * @param i the index of the RDN to set. */ public void setRDN(RDN rdn, int i) { if (i<size() && i>= 0) RDNs.setElementAt(rdn, i); } /** * gets the full RDN (e.g. 'c=au' or 'cn=Englebert Humperdink') for a particular * indexed RDN. * * @param i the index of the RDN to return. * @return the ldap RDN string name for the specified index */ public RDN getRDN(int i) { if (i==0 && isEmpty()) return new RDN(); // return empty RDN for empty DN if (i<0) return new RDN(); if (i >= size()) new RDN(); return (RDN) RDNs.elementAt(i); } /** * Returns the root RDN as a string (e.g. 'c=au') * * @return the root RDN string. */ public RDN getRootRDN() { if (isEmpty()) return new RDN(""); else return getRDN(0); } /** * Gets the value of the lowest LDAP RDN. * That is, the furthest-from-the-root class value of the DN. * For example, 'ou=frog fanciers' in 'ou=frog fanciers,o=nutters,c=uk' * * @return the lowest level ldap value for the DN */ public RDN getLowestRDN() { return getRDN(size()-1); } /** * Adds an RDN to an existing DN at the highest level * - mainly used internally * while parsing a DN. * * @param rdn the RDN string to apend to the DN */ public void addParentRDN(String rdn) { try { add(0,rdn); } catch (InvalidNameException e) { setError("Error adding RDN in DN.addParentRDN()", e); } } /** * Adds a new 'deepest level' RDN to a DN * * @param rdn the RDN to append to the end of the DN */ public void addChildRDN(String rdn) throws InvalidNameException { add(rdn); } /** * Adds a new 'deepest level' RDN to a DN * * @param rdn the RDN to append to the end of the DN */ public void addChildRDN(RDN rdn) throws InvalidNameException { add(rdn); } /** * sets (or more often <i>re</i>sets) the lowest (furthest-from-root) * value of the DN * * @param value the (raw, unescaped) new lowest RDN value to overwrite the existing lowest RDN value with */ // XXX code should be turned into wrapper for add(0,...) when that handles multi-val rdns properly public void setLowestRDNRawValue(String value) { try { RDN rdn = getRDN(size()-1); rdn.setRawVal(value); } catch (InvalidNameException e) { setError("Error setting DN.setLowestRDNRawValue: to " + value, e); } } /** * Exchanges the value of an rdn att=val element, and returns */ protected String exchangeRDNelementValue(String rdn, String value) { return rdn.substring(0,NameUtility.next(rdn,0,'=')) + "=" + value; } /** * Check whether this DN is equal to another DN... * * @param testDN the DN to compare against this DN */ public boolean equals(DN testDN) { //XXX return (toString().equals(testDN.toString())); if (testDN == null) return false; if (testDN.size()!= size()) return false; for (int i=0; i<size(); i++) { if (getRDN(i).equals(testDN.getRDN(i)) == false) return false; } return true; } /** * implement the object.equals(object) method for genericity and unit testing. * Note that this is slower than DN.equals(DN), since it requires instanceof checks. * @param o a DN or Name object to test against */ public boolean equals(Object o) { if (o == null) return false; if (o instanceof DN) return equals((DN)o); else if (o instanceof Name) return (compareTo((Name)o) == 0); else return false; // cannot be equal in any sense if not a name } /** * Checks whether the testDN is a subset of the current DN, * starting from the root. Currently case insensitive. * * @param testDN the subset DN to test against */ public boolean startsWith(DN testDN) { return startsWith((Name)testDN); } /** * Test if the DNs are identical except for the * lowest RDN. * In other words, test if they are leaves on the same branch. * * @param testDN the putatitive sibling DN */ public boolean sharesParent(DN testDN) { if (testDN.size()!= size()) return false; for (int i=0; i<size()-1; i++) { if ((testDN.getRDN(i).equals(getRDN(i)))==false) return false; } return true; } /** * Return the full DN of this DN's immediate parent. * In other words, return this DN after removing the lowest RDN. * * @return the parent of this DN, or an empty DN if this is the top level DN. */ public DN parentDN() { // XXX what to do if this is already an empty DN? The same? if (size()<=1) return new DN(); // return empty DN for top level DNs DN newDN = new DN(this); newDN.RDNs.removeElementAt(size()-1); return newDN; } /** * reverse the order of elements in a DN... */ public void reverse() { Vector rev = new Vector(); for (int i=RDNs.size()-1; i>=0; i--) rev.add(RDNs.elementAt(i)); RDNs = rev; } /** * Empties the DN of all RDNs. */ public void clear() { RDNs.clear(); errorString = null; } /** * Overload this method for app specific error handling. */ public void setError(String msg, NamingException e) { errorString = msg; rootException = e; System.out.println(e); } /** * Whether there was an error using this DN (i.e. when creating it). */ public boolean error() { return (errorString == null); } /** * Gets the error message (if any) associated with this DN. */ public String getError() { return errorString; } /** * Gets the root exception (if any) associated with this DN */ public NamingException getNamingException() { return rootException; } /** * Prepare a dn for jndi transmission */ /* public void escape() { for (int i=0; i<size(); i++) { getRDN(i).escape(); } } */ /** * Unescape a dn that has been *normally* escaped using ldap v3 (i.e. by the * preceeding ftn.). */ /* public void unescape() throws InvalidNameException { for (int i=0; i<size(); i++) { getRDN(i).unescape(); } } */ /** (Obsolete) * Unescape a dn that has been returned by jndi, that may contain either * ldap v2 escaping, or the multiple-slash wierdness bug. */ /* public void unescapeJndiReturn() throws InvalidNameException // shouldn't happen... { for (int i=0; i<size(); i++) { getRDN(i).unescapeJndiReturn(); } } */ /** * Add an RDN to the end of the DN. */ public Name add(RDN rdn) { //RDNs.insertElementAt(rdn,size()); add(size(), rdn); return this; } /** * The core method for adding RDN objects to the name. * Called by all add methods. * @param posn the position in the DN to add the RDN at (0 = root) * @param rdn the RDN to add (may be multi-valued). */ public Name add(int posn, RDN rdn) { RDNs.insertElementAt(rdn,posn); return this; } // NN N A MM MM EEEEEE // NNN N A A M MMM M EE // N NN N A A M M M EEEE (Interface Def.) // N NNN AAAAAAA M M M EE // N NN AA AA M M M EEEEEE /* * Adds a single component at a specified position within this name. */ // These two ftns should be used by all code to add rdns... the RDN array // should not be accessed directly. public Name add(int posn, String rdn) throws InvalidNameException { RDN r = new RDN(rdn); // may throw invalidName Exception add(posn, r); return this; } /* * Adds a single component to the end of this name. */ public Name add(String rdn) throws InvalidNameException { RDN r = new RDN(rdn); // may throw invalidName Exception add(size(), r); return this; } /* * Adds the components of a name -- in order -- at a specified position within this name. */ public Name addAll(int posn, Name n) throws InvalidNameException { Enumeration e = n.getAll(); while (e.hasMoreElements()) add(posn++, e.nextElement().toString()); return this; } /* * Adds the components of a name -- in order -- to the end of this name. */ public Name addAll(Name suffix) throws InvalidNameException { Enumeration e = suffix.getAll(); while (e.hasMoreElements()) add(e.nextElement().toString()); return this; } /* * Generates a new copy of this name. */ public Object clone() { return new DN(this); } /* * Compares this name with another name for order. * ... for the time being, ordering is alphabetical by rdns ordered * right to left. Damn but the ldap rdn ordering system is screwed. */ public int compareTo(Object obj) { int val = 0; int pos = 1; if (obj instanceof Name) { Name compareMe = (Name)obj; int size = size(); int compSize = compareMe.size(); while (val == 0) { String RDN = get(size-pos); String compRDN = compareMe.get(compSize-pos); int rdnOrder = RDN.compareTo(compRDN); if (rdnOrder != 0) return rdnOrder; // return alphabetic order of rdn. pos++; if (pos>size || pos>compSize) { if (size==compSize) return 0; // names are equal if (pos>size) return -1; // shorter dns first else return 1; } } } else throw new ClassCastException("non Name object in DN.compareTo - object was " + obj.getClass()); return 0; // never reached. } /* * Determines whether this name ends with a specified suffix. */ public boolean endsWith(Name n) { return false; } /* * Retrieves a component of this name. Returns zero length string for * an empty DN's first element - otherwise throws a ArrayIndexException. * (is this correct behaviour?). */ public String get(int posn) { if (posn==0 && isEmpty()) return ""; // return empty string for empty DN return RDNs.elementAt(posn).toString(); } /* * Retrieves the components of this name as an enumeration of strings. */ public java.util.Enumeration getAll() { DXNamingEnumeration ret = new DXNamingEnumeration(); for (int i=0; i<size(); i++) ret.add(get(i)); return ret; } /* * Creates a name whose components consist of a prefix of the components of this name. */ public Name getPrefix(int posn) { DN returnMe = new DN(); try { for (int i=0; i<posn; i++) returnMe.add(get(i)); return returnMe; } catch (InvalidNameException e) { System.err.println("unexpected error in DN:\n " + e); return new DN(); } } /* * Creates a name whose components consist of a suffix of the components in this name. */ public Name getSuffix(int posn) { DN returnMe = new DN(); for (int i=posn; i<size(); i++) { returnMe.add(new RDN(getRDN(i))); } return returnMe; } /** * returns true if this is an 'empty', or root DN (i.e. \"\") * @return empty status */ public boolean isEmpty() { return (size()==0); } /* * Removes a component from this name. */ public Object remove(int posn) { return RDNs.remove(posn); } /* * Returns the number of components in this name, * and hence the level (the number * of nodes from root) of the DN. */ public int size() { return RDNs.size(); } /* * Returns the number of components in this name, * and hence the level (the number * of nodes from root) of the DN. * (synonym of 'size()'. Why java didn't standardise on just one...) */ /* public int length() { return RDNs.size(); } */ /* * Determines whether this name starts with a specified prefix. */ public boolean startsWith(Name n) { int pos = 0; Enumeration e = n.getAll(); while (e.hasMoreElements()) if (e.nextElement().toString().equalsIgnoreCase(get(pos++).toString())==false) return false; return true; // falls through - all tested components must be equal! } }

The table below shows all metrics for DN.java.

MetricValueDescription
BLOCKS73.00Number of blocks
BLOCK_COMMENT95.00Number of block comment lines
COMMENTS326.00Comment lines
COMMENT_DENSITY 1.31Comment density
COMPARISONS68.00Number of comparison operators
CYCLOMATIC107.00Cyclomatic complexity
DECL_COMMENTS72.00Comments in declarations
DOC_COMMENT200.00Number of javadoc comment lines
ELOC248.00Effective lines of code
EXEC_COMMENTS 5.00Comments in executable code
EXITS50.00Procedure exits
FUNCTIONS47.00Number of function declarations
HALSTEAD_DIFFICULTY81.82Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY114.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 1.00JAVA0004 Unnecessary import from java.lang
JAVA0005 1.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
JAVA003430.00JAVA0034 Missing braces in if statement
JAVA0035 5.00JAVA0035 Missing braces in for statement
JAVA0036 3.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 0.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 0.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 1.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 3.00JAVA0081 Boolean literal in comparison
JAVA0082 1.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 5.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA011010.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 1.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 1.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 2.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 0.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 1.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 0.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 2.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 1.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.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 1.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 0.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 0.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 1.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 1.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 3.00JAVA0266 Use of System.out
JAVA0267 1.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 1.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 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 1.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
LINES885.00Number of lines in the source file
LINE_COMMENT31.00Number of line comments
LOC394.00Lines of code
LOGICAL_LINES168.00Number of statements
LOOPS16.00Number of loops
NEST_DEPTH 4.00Maximum nesting depth
OPERANDS684.00Number of operands
OPERATORS1408.00Number of operators
PARAMS36.00Number of formal parameter declarations
PROGRAM_LENGTH2092.00Halstead program length
PROGRAM_VOCAB259.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS78.00Number of return points from functions
SIZE21850.00Size of the file in bytes
UNIQUE_OPERANDS209.00Number of unique operands
UNIQUE_OPERATORS50.00Number of unique operators
WHITESPACE165.00Number of whitespace lines