RedoableOp.java

Index Score
com.zimbra.cs.redolog.op
Zimbra Collaboration Suite

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
JAVA0116JAVA0116 Missing javadoc: field 'field'
JAVA0034JAVA0034 Missing braces in if statement
JAVA0117JAVA0117 Missing javadoc: method 'method'
LINE_COMMENTNumber of line comments
UNIQUE_OPERANDSNumber of unique operands
PROGRAM_VOCABHalstead program vocabulary
JAVA0143JAVA0143 Synchronized method
ELOCEffective lines of code
RETURNSNumber of return points from functions
LOGICAL_LINESNumber of statements
SIZESize of the file in bytes
EXITSProcedure exits
LOCLines of code
OPERATORSNumber of operators
FUNCTIONSNumber of function declarations
PROGRAM_LENGTHHalstead program length
INTERFACE_COMPLEXITYInterface complexity
OPERANDSNumber of operands
LINESNumber of lines in the source file
BLOCKSNumber of blocks
CYCLOMATICCyclomatic complexity
JAVA0068JAVA0068 Modifiers not declared in recommended order
DECL_COMMENTSComments in declarations
UNIQUE_OPERATORSNumber of unique operators
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0160JAVA0160 Method does not throw specified exception
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
JAVA0100JAVA0100 Class contains N non-final fields (maximum: M)
LOOPSNumber of loops
DOC_COMMENTNumber of javadoc comment lines
NEST_DEPTHMaximum nesting depth
/* * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1 * * The contents of this file are subject to the Mozilla Public License * Version 1.1 ("License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.zimbra.com/license * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is: Zimbra Collaboration Suite Server. * * The Initial Developer of the Original Code is Zimbra, Inc. * Portions created by Zimbra are Copyright (C) 2004, 2005, 2006 Zimbra, Inc. * All Rights Reserved. * * Contributor(s): * * ***** END LICENSE BLOCK ***** */ /* * Created on 2004. 7. 21. */ package com.zimbra.cs.redolog.op; import java.io.ByteArrayOutputStream; import java.io.EOFException; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import com.zimbra.common.util.Log; import com.zimbra.common.util.LogFactory; import com.zimbra.cs.mailbox.Mailbox.OperationContext; import com.zimbra.cs.redolog.RedoLogInput; import com.zimbra.cs.redolog.RedoLogManager; import com.zimbra.cs.redolog.RedoLogOutput; import com.zimbra.cs.redolog.RedoLogProvider; import com.zimbra.cs.redolog.TransactionId; import com.zimbra.cs.redolog.Version; import com.zimbra.cs.util.Zimbra; /** * @author jhahm */ public abstract class RedoableOp { protected static Log mLog = LogFactory.getLog(RedoableOp.class); private static String sPackageName = RedoableOp.class.getPackage().getName(); // magic marker for each redo item in redo log private static final String REDO_MAGIC = "ZMREDO"; // for initializing various ID member values public static final int UNKNOWN_ID = 0; // special ID value meaning operation is not for any specific mailbox // but is needed by all mailboxes public static final int MAILBOX_ID_ALL = -1; // List of supported operations // The integer values keep changing during development in order to // keep related operations next to each other. Once we ship, there // should not be any more rearranging. New operations should only // get added at the end, and deprecated operations should result in // holes. public static final int OP_UNKNOWN = 0; public static final int OP_CHECKPOINT = 1; public static final int OP_START_TXN = 2; public static final int OP_COMMIT_TXN = 3; public static final int OP_ABORT_TXN = 4; public static final int OP_LAST_CONTROL_OP = 5; public static final int OP_ROLLOVER = 6; public static final int OP_CREATE_MAILBOX = 7; public static final int OP_DELETE_MAILBOX = 8; public static final int OP_BACKUP_MAILBOX = 9; public static final int OP_REINDEX_MAILBOX = 10; public static final int OP_PURGE_OLD_MESSAGES = 11; public static final int OP_CREATE_SAVED_SEARCH = 12; public static final int OP_MODIFY_SAVED_SEARCH = 13; public static final int OP_CREATE_TAG = 14; public static final int OP_RENAME_TAG = 15; public static final int OP_COLOR_ITEM = 16; public static final int OP_INDEX_ITEM = 17; public static final int OP_ALTER_ITEM_TAG = 18; public static final int OP_SET_ITEM_TAGS = 19; public static final int OP_MOVE_ITEM = 20; public static final int OP_DELETE_ITEM = 21; public static final int OP_COPY_ITEM = 22; public static final int OP_CREATE_FOLDER_PATH = 23; public static final int OP_RENAME_FOLDER_PATH = 24; public static final int OP_EMPTY_FOLDER = 25; public static final int OP_STORE_INCOMING_BLOB = 26; public static final int OP_CREATE_MESSAGE = 27; public static final int OP_SAVE_DRAFT = 28; public static final int OP_SET_IMAP_UID = 29; public static final int OP_CREATE_CONTACT = 30; public static final int OP_MODIFY_CONTACT = 31; public static final int OP_CREATE_NOTE = 32; public static final int OP_EDIT_NOTE = 33; public static final int OP_REPOSITION_NOTE = 34; public static final int OP_CREATE_LINK = 35; public static final int OP_MODIFY_INVITE_FLAG = 36; public static final int OP_MODIFY_INVITE_PARTSTAT = 37; public static final int OP_CREATE_VOLUME = 38; public static final int OP_MODIFY_VOLUME = 39; public static final int OP_DELETE_VOLUME = 40; public static final int OP_SET_CURRENT_VOLUME = 41; public static final int OP_MOVE_BLOBS = 42; public static final int OP_CREATE_INVITE = 43; public static final int OP_SET_CALENDAR_ITEM = 44; public static final int OP_TRACK_SYNC = 45; public static final int OP_SET_CONFIG = 46; public static final int OP_GRANT_ACCESS = 47; public static final int OP_REVOKE_ACCESS = 48; public static final int OP_SET_URL = 49; public static final int OP_SET_SUBSCRIPTION_DATA = 50; public static final int OP_SET_PERMISSIONS = 51; public static final int OP_SAVE_WIKI = 52; public static final int OP_SAVE_DOCUMENT = 53; public static final int OP_ADD_DOCUMENT_REVISION = 54; public static final int OP_TRACK_IMAP = 55; public static final int OP_IMAP_COPY_ITEM = 56; public static final int OP_ICAL_REPLY = 57; public static final int OP_CREATE_FOLDER = 58; public static final int OP_RENAME_FOLDER = 59; public static final int OP_FIX_CALENDAR_ITEM_TZ = 60; public static final int OP_RENAME_ITEM = 61; public static final int OP_RENAME_ITEM_PATH = 62; public static final int OP_CREATE_CHAT = 63; public static final int OP_SAVE_CHAT = 64; public static final int OP_LAST = 65; // Element index is same as Redoable.OP_* constants. // The strings must match the class names. public static final String[] sOpClassNameArray = { "UNKNOWN", // 0 "Checkpoint", "UNKNOWN", "CommitTxn", "AbortTxn", "UNKNOWN", // separator between control ops and data ops "Rollover", "CreateMailbox", "DeleteMailbox", "BackupMailbox", "ReindexMailbox", // 10 "PurgeOldMessages", "CreateSavedSearch", "ModifySavedSearch", "CreateTag", "RenameTag", "ColorItem", "IndexItem", "AlterItemTag", "SetItemTags", "MoveItem", // 20 "DeleteItem", "CopyItem", "CreateFolderPath", "RenameFolderPath", "EmptyFolder", "StoreIncomingBlob", "CreateMessage", "SaveDraft", "SetImapUid", "CreateContact", // 30 "ModifyContact", "CreateNote", "EditNote", "RepositionNote", "CreateMountpoint", "ModifyInviteFlag", "ModifyInvitePartStat", "CreateVolume", "ModifyVolume", "DeleteVolume", // 40 "SetCurrentVolume", "MoveBlobs", "CreateInvite", "SetCalendarItem", "TrackSync", "SetConfig", "GrantAccess", "RevokeAccess", "SetFolderUrl", "SetSubscriptionData", // 50 "SetPermissions", "SaveWiki", "SaveDocument", "AddDocumentRevision", "TrackImap", "ImapCopyItem", "ICalReply", "CreateFolder", "RenameFolder", "FixCalendarItemTimeZone", // 60 "RenameItem", "RenameItemPath", "CreateChat", "SaveChat", }; public static String getOpClassName(int opcode) { if (opcode > OP_UNKNOWN && opcode < OP_LAST) return sOpClassNameArray[opcode]; else return null; } private Version mVersion; private TransactionId mTxnId; private boolean mActive; private long mTimestamp; // timestamp of the operation private int mChangeId = -1; private int mChangeConstraint; private int mMailboxId; private RedoLogManager mRedoLogMgr; private boolean mUnloggedReplay; // true if redo of this op is not redo-logged public RedoableOp() { mRedoLogMgr = RedoLogProvider.getInstance().getRedoLogManager(); mVersion = new Version(); mTxnId = null; mActive = false; mMailboxId = UNKNOWN_ID; mUnloggedReplay = false; } protected Version getVersion() { return mVersion; } private void setVersion(Version v) { mVersion = v; } public boolean getUnloggedReplay() { return mUnloggedReplay; } public void setUnloggedReplay(boolean b) { mUnloggedReplay = b; } public void start(long timestamp) { // Assign timestamp and txn ID to the operation. // Doing the assignment in this method means we timestamp and sequence // the operation start time, not when the operation get committed or // logged. // // Ideally, operations should start, commit, and log in precisely the // same order, but we can guarantee that only by eliminating concurrency. mTimestamp = timestamp; if (isStartMarker()) setTransactionId(mRedoLogMgr.getNewTxnId()); } public void log() { log(true); } public void log(boolean synchronous) { mRedoLogMgr.log(this, synchronous); if (isStartMarker()) mActive = true; } public void setChangeConstraint(boolean checkCreated, int changeId) { mChangeConstraint = changeId; if (checkCreated == OperationContext.CHECK_CREATED) mChangeConstraint *= -1; } public OperationContext getOperationContext() { OperationContext octxt = new OperationContext(this); if (mChangeConstraint != 0) { boolean checkCreated = (mChangeConstraint < 0 ? OperationContext.CHECK_CREATED : OperationContext.CHECK_MODIFIED); octxt.setChangeConstraint(checkCreated, Math.abs(mChangeConstraint)); } return octxt; } public synchronized void commit() { if (mActive) { mActive = false; mRedoLogMgr.commit(this); if (mChainedOps != null) { for (RedoableOp rop : mChainedOps) rop.commit(); mChainedOps = null; } } // We don't need to hang onto the byte arrays after commit/abort. synchronized (mSBAVGuard) { mSerializedByteArrayVector = null; } } public synchronized void abort() { if (mActive) { mActive = false; mRedoLogMgr.abort(this); if (mChainedOps != null) { for (RedoableOp rop : mChainedOps) rop.abort(); mChainedOps = null; } } // We don't need to hang onto the byte arrays after commit/abort. synchronized (mSBAVGuard) { mSerializedByteArrayVector = null; } } // whether this is a record that marks the beginning of a transaction public boolean isStartMarker() { return getOpCode() > OP_LAST_CONTROL_OP; } // whether this is a recod that marks the end of a transaction // (true for CommitTxn and AbortTxn, false for all others) public boolean isEndMarker() { int opCode = getOpCode(); return opCode == OP_COMMIT_TXN || opCode == OP_ABORT_TXN; } /** * Crash recovery redoes all uncommitted operations from previous crash * before allowing client connections. This doesn't work out well for a * long-running operation such as fully reindexing a large mailbox. Those * operations should be excluded from initial crash recovery and run after * startup procedure finishes. Note this treatment is possible only for * independent operations, i.e. no other operation during crash recovery * should depend on having this operation done first. * @return */ public boolean deferCrashRecovery() { return false; } public long getTimestamp() { return mTimestamp; } protected void setTimestamp(long timestamp) { mTimestamp = timestamp; } public int getChangeId() { return mChangeId; } public void setChangeId(int changeId) { mChangeId = changeId; } public TransactionId getTransactionId() { return mTxnId; } protected void setTransactionId(TransactionId txnId) { mTxnId = txnId; } public int getMailboxId() { return mMailboxId; } public void setMailboxId(int mboxId) { mMailboxId = mboxId; } protected void serializeHeader(RedoLogOutput out) throws IOException { out.write(REDO_MAGIC.getBytes()); mVersion.serialize(out); out.writeInt(getOpCode()); out.writeLong(mTimestamp); out.writeInt(mChangeId); out.writeInt(mChangeConstraint); mTxnId.serialize(out); out.writeInt(mMailboxId); } private void deserialize(RedoLogInput in) throws IOException { // We don't deserialize magic marker, version, and operation code // because they were already deserialized by deserializeOp. mTimestamp = in.readLong(); mChangeId = in.readInt(); mChangeConstraint = in.readInt(); mTxnId = new TransactionId(); mTxnId.deserialize(in); mMailboxId = in.readInt(); // Deserialize the subclass. deserializeData(in); } public String toString() { StringBuffer sb = new StringBuffer("txn "); sb.append(mTxnId).append(" [").append(getOpClassName(getOpCode())); sb.append("] ver=").append(mVersion); sb.append(", tstamp=").append(mTimestamp); if (mChangeId != -1) sb.append(", change=").append(mChangeId); if (mChangeConstraint != 0) sb.append(", constraint=").append(mChangeConstraint); String data = getPrintableData(); if (mMailboxId != UNKNOWN_ID) { sb.append(", mailbox=").append(mMailboxId); if (data != null) sb.append(", ").append(data); } else if (data != null) sb.append(", ").append(data); return sb.toString(); } /** * Returns the operation code of the transaction. Returns the * same value as getEntryOpCode(), except CommitTxn and AbortTxn * return the getEntryOpCode() value from their corresponding * change entry. * @return */ public int getTxnOpCode() { return getOpCode(); } /** * Returns the operation code of the log entry. * @return */ // Should return one of the OP_xyz constants defined above. public abstract int getOpCode(); /** * Repeat the operation. */ public abstract void redo() throws Exception; // Used to toString(). protected abstract String getPrintableData(); // Used by serialize() and deserialize(). protected abstract void serializeData(RedoLogOutput out) throws IOException; protected abstract void deserializeData(RedoLogInput in) throws IOException; /** * Returns the next operation in the redo log stream. * @return a RedoableOp object * @throws EOFException - if end of stream is reached while reading; * EOF may happen in the middle of a log entry, * indicating the server may have died unexpectedly * @throws IOException - if any other error occurs */ public static RedoableOp deserializeOp(RedoLogInput in) throws EOFException, IOException { return deserializeOp(in, false); } public static RedoableOp deserializeOp(RedoLogInput in, boolean skipDetail) throws EOFException, IOException { RedoableOp op = null; byte[] magicBuf = new byte[REDO_MAGIC.length()]; in.readFully(magicBuf, 0, magicBuf.length); String magic = new String(magicBuf); if (magic.compareTo(REDO_MAGIC) != 0) throw new IOException("Missing redo item magic marker"); Version ver = new Version(); ver.deserialize(in); if (ver.tooHigh()) throw new IOException("Redo op version " + ver + " is higher than the highest known version " + Version.latest()); int opcode = in.readInt(); if (!skipDetail) { String className = RedoableOp.getOpClassName(opcode); if (className != null) { Class clz = null; try { clz = loadOpClass(sPackageName + "." + className); } catch (ClassNotFoundException e) { throw new IOException("ClassNotFoundException for redo operation " + className); } try { op = (RedoableOp) clz.newInstance(); } catch (InstantiationException e) { String msg = "Unable to instantiate " + className; mLog.error(msg, e); throw new IOException("Unable to instantiate " + className); } catch (IllegalAccessException e) { String msg = "IllegalAccessException while instantiating " + className; mLog.error(msg, e); throw new IOException(msg); } } else { throw new IOException("Invalid redo operation code " + opcode); } } else { op = new HeaderOnlyOp(opcode); } op.setVersion(ver); op.deserialize(in); return op; } protected byte[][] mSerializedByteArrayVector; // Synchronize access to mSerializedByteArrayVector with mSBAVGuard. // Don't synchronize on "this" object because that can cause deadlock // between a thread committing this op and another thread doing // rollover, which needs to call getSerializedByteArrayVector on this // object to log it to new redo log file. protected final Object mSBAVGuard = new Object(); public void setSerializedByteArray(byte[] data) { synchronized (mSBAVGuard) { if (data != null) { mSerializedByteArrayVector = new byte[1][]; mSerializedByteArrayVector[0] = data; } else { // clear current vector mSerializedByteArrayVector = null; } } } protected byte[] serializeToByteArray() throws IOException { byte[] buf; ByteArrayOutputStream baos = new ByteArrayOutputStream(512); RedoLogOutput out = new RedoLogOutput(baos); serializeHeader(out); serializeData(out); buf = baos.toByteArray(); baos.close(); return buf; } public byte[][] getSerializedByteArrayVector() throws IOException { synchronized (mSBAVGuard) { if (mSerializedByteArrayVector == null) setSerializedByteArray(serializeToByteArray()); return mSerializedByteArrayVector; } } // indexing sub-operation that is chained to this operation private List<RedoableOp> mChainedOps; public synchronized void addChainedOp(RedoableOp subOp) { if (mChainedOps == null) mChainedOps = new LinkedList<RedoableOp>(); mChainedOps.add(subOp); } private static boolean checkSubclasses() { boolean allGood = true; for (int opcode = OP_UNKNOWN + 1; opcode < OP_LAST; opcode++) { String className = RedoableOp.getOpClassName(opcode); if (className == null) { mLog.error("Invalid redo operation code: " + opcode); allGood = false; } else if (className.compareTo("UNKNOWN") != 0) { Class clz = null; try { clz = loadOpClass(sPackageName + "." + className); clz.newInstance(); } catch (ClassNotFoundException e) { // Some classes may not be found depending on which // optional packages are installed. mLog.debug("Ignoring ClassNotFoundException for redo operation " + className); } catch (InstantiationException e) { String msg = "Unable to instantiate " + className + "; Check default constructor is defined."; mLog.error(msg, e); allGood = false; } catch (IllegalAccessException e) { String msg = "IllegalAccessException while instantiating " + className; mLog.error(msg, e); allGood = false; } } } return allGood; } private static Map<String, Class> sOpClassMap; private static List<ClassLoader> sOpClassLoaders; static { sOpClassMap = new HashMap<String, Class>(); sOpClassLoaders = new ArrayList<ClassLoader>(); boolean allSubclassesGood = checkSubclasses(); if (!allSubclassesGood) { Zimbra.halt( "Some RedoableOp subclasses are incomplete. " + "Hint: Make sure the subclass defines a default constructor."); } } /** * Register a class loader for instantiating redo op objects. * @param ldr */ public synchronized static void registerClassLoader(ClassLoader ldr) { mLog.debug("Registering class loader " + ldr); for (ClassLoader loader : sOpClassLoaders) { if (loader.equals(ldr)) return; } sOpClassLoaders.add(ldr); } public synchronized static void deregisterClassLoader(ClassLoader ldr) { mLog.debug("Deregistering class loader " + ldr); List<String> toRemove = new ArrayList<String>(); for (Map.Entry<String, Class> entry : sOpClassMap.entrySet()) { Class clz = entry.getValue(); if (clz.getClassLoader().equals(ldr)) toRemove.add(entry.getKey()); } for (String key : toRemove) { sOpClassMap.remove(key); mLog.debug("Removed " + key + " from redo op class map"); } for (Iterator iter = sOpClassLoaders.iterator(); iter.hasNext(); ) { ClassLoader loader = (ClassLoader) iter.next(); if (loader.equals(ldr)) iter.remove(); } } private synchronized static Class loadOpClass(String className) throws ClassNotFoundException { Class clz = sOpClassMap.get(className); if (clz == null) { // Try default class loader first. try { clz = Class.forName(className); sOpClassMap.put(className, clz); } catch (ClassNotFoundException e) { // Try the registered class loaders. for (ClassLoader loader : sOpClassLoaders) { try { clz = loader.loadClass(className); mLog.debug( "Loaded class " + className + " using class loader " + loader); sOpClassMap.put(className, clz); break; } catch (ClassNotFoundException e2) {} } if (clz == null) throw e; } } return clz; } }

The table below shows all metrics for RedoableOp.java.

MetricValueDescription
BLOCKS78.00Number of blocks
BLOCK_COMMENT27.00Number of block comment lines
COMMENTS107.00Comment lines
COMMENT_DENSITY 0.25Comment density
COMPARISONS33.00Number of comparison operators
CYCLOMATIC80.00Cyclomatic complexity
DECL_COMMENTS21.00Comments in declarations
DOC_COMMENT39.00Number of javadoc comment lines
ELOC432.00Effective lines of code
EXEC_COMMENTS 9.00Comments in executable code
EXITS73.00Procedure exits
FUNCTIONS43.00Number of function declarations
HALSTEAD_DIFFICULTY53.51Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY93.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 0.00JAVA0007 Should not declare public field
JAVA0008 1.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 1.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
JAVA003417.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 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 3.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 1.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 1.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 0.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 1.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA011669.00JAVA0116 Missing javadoc: field 'field'
JAVA011732.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 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 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 6.00JAVA0143 Synchronized method
JAVA0144 0.00JAVA0144 Line exceeds maximum M characters
JAVA0145482.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 1.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 0.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 1.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 0.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
LINES686.00Number of lines in the source file
LINE_COMMENT41.00Number of line comments
LOC493.00Lines of code
LOGICAL_LINES267.00Number of statements
LOOPS 2.00Number of loops
NEST_DEPTH 5.00Maximum nesting depth
OPERANDS959.00Number of operands
OPERATORS1990.00Number of operators
PARAMS23.00Number of formal parameter declarations
PROGRAM_LENGTH2949.00Halstead program length
PROGRAM_VOCAB518.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS70.00Number of return points from functions
SIZE23219.00Size of the file in bytes
UNIQUE_OPERANDS466.00Number of unique operands
UNIQUE_OPERATORS52.00Number of unique operators
WHITESPACE86.00Number of whitespace lines