Download.java

Index Score
org.gudy.azureus2.plugins.download
Azureus

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
DOC_COMMENTNumber of javadoc comment lines
COMMENTSComment lines
FUNCTIONSNumber of function declarations
JAVA0141JAVA0141 Unnecessary modifier for method in interface
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
LINESNumber of lines in the source file
SIZESize of the file in bytes
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
PARAMSNumber of formal parameter declarations
CYCLOMATICCyclomatic complexity
JAVA0034JAVA0034 Missing braces in if statement
WHITESPACENumber of whitespace lines
UNIQUE_OPERANDSNumber of unique operands
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
EXEC_COMMENTSComments in executable code
JAVA0126JAVA0126 Method declares unchecked exception in throws
LINE_COMMENTNumber of line comments
JAVA0117JAVA0117 Missing javadoc: method 'method'
COMPARISONSNumber of comparison operators
BLOCKSNumber of blocks
RETURNSNumber of return points from functions
PROGRAM_VOCABHalstead program vocabulary
LOOPSNumber of loops
EXITSProcedure exits
/* * File : Download.java * Created : 06-Jan-2004 * By : parg * * Azureus - a Java Bittorrent client * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details ( see the LICENSE file ). * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package org.gudy.azureus2.plugins.download; import java.io.File; import java.util.Map; import org.gudy.azureus2.plugins.download.savelocation.DefaultSaveLocationManager; import org.gudy.azureus2.plugins.download.savelocation.SaveLocationChange; import org.gudy.azureus2.plugins.download.savelocation.SaveLocationManager; import org.gudy.azureus2.plugins.torrent.Torrent; import org.gudy.azureus2.plugins.torrent.TorrentAttribute; import org.gudy.azureus2.plugins.disk.DiskManager; import org.gudy.azureus2.plugins.disk.DiskManagerFileInfo; import org.gudy.azureus2.plugins.peers.PeerManager; /** * Management of a Torrent's activity. * * <b>Note:</b> All listener based methods are now located in {@link DownloadEventNotifier}. * * <PRE> * A download's lifecycle: * torrent gets added * state -> QUEUED * slot becomes available, queued torrent is picked, "restart" executed * state -> WAITING * state moves through PREPARING to READY * state -> PREPARING * state -> READY * execute "start" method * state -> SEEDING -or- DOWNLOADING * if torrent is DOWNLOADING, and completes, state changes to SEEDING * * Path 1 | Path 2 * -------------------------+------------------------------------------------ * execute "stop" method | startstop rules are met, execute "stopandQueue" * state -> STOPPING | state -> STOPPING * state -> STOPPED | state -> STOPPED * | state -> QUEUED * execute "remove" method -> deletes the download * a "stop" method call can be made when the download is in all states except STOPPED * </PRE> * * @author parg */ public interface Download extends DownloadEventNotifier { /** waiting to be told to start preparing */ public static final int ST_WAITING = 1; /** getting files ready (allocating/checking) */ public static final int ST_PREPARING = 2; /** ready to be started if required */ public static final int ST_READY = 3; /** downloading */ public static final int ST_DOWNLOADING = 4; /** seeding */ public static final int ST_SEEDING = 5; /** stopping */ public static final int ST_STOPPING = 6; /** stopped, do not auto-start! */ public static final int ST_STOPPED = 7; /** failed */ public static final int ST_ERROR = 8; /** stopped, but ready for auto-starting */ public static final int ST_QUEUED = 9; public static final String[] ST_NAMES = { "", "Waiting", "Preparing", "Ready", "Downloading", "Seeding", "Stopping", "Stopped", "Error", "Queued", }; /** Use more of the upload bandwidth than low priority downloads * don't change these as they are used by remote clients */ public static final int PR_HIGH_PRIORITY = 1; /** Use less of the upload bandwidth than high priority downloads */ public static final int PR_LOW_PRIORITY = 2; /** * Flags values * @since 2.3.0.5 */ public static final long FLAG_ONLY_EVER_SEEDED = 0x00000001; public static final long FLAG_SCAN_INCOMPLETE_PIECES = 0x00000002; /** * Flag value - if set, it prevents any of the "move on completion" or * "move on removal" rules taking place. * * @since 2.5.0.1 */ public static final long FLAG_DISABLE_AUTO_FILE_MOVE = 0x00000004; /** * Flag value - if set, then it means this download has been considered * for "move on completion", and it should not be considered again for * it. This value is more for internal use rather than plugin use. * * @since 2.5.0.1 */ public static final long FLAG_MOVE_ON_COMPLETION_DONE = 0x00000008; /** * Flag value - if set the user won't be bothered with popups/completion events during * the download's life. This is used, for example, for downloads used to run speed-tests * @since 3.0.1.3 */ public static final long FLAG_LOW_NOISE = 0x00000010; /** * Flag value - normally the permitted peer sources for a download are fixed and can't be changed * this flag allows the permitted peer source set to be increased/decreased (but not beyond the enforced * values required to honour a torrent's 'private' flag */ public static final long FLAG_ALLOW_PERMITTED_PEER_SOURCE_CHANGES = 0x00000020; /** * Flag value - if set the data will not be delete when the download is "deleted" from * the v3 interface. * @since 3.1.0.0 */ public static final long FLAG_DO_NOT_DELETE_DATA_ON_REMOVE = 0x00000040; /** get state from above ST_ set * @return ST_ constant * * @since 2.0.7.0 */ public int getState(); /** * For the STOPPING state this method gives the state that is being transited too (STOPPED, QUEUED or ERROR) * @return * @since 2.3.0.5 */ public int getSubState(); /** When the download state is ERROR this method returns the error details * @return * * @since 2.0.7.0 */ public String getErrorStateDetails(); /** * Get the flag value * @since 2.3.0.5 * @param flag FLAG value from above * @return */ public boolean getFlag(long flag); /** * Set the flag value. * * @since 2.5.0.1 * @param flag FLAG value from above * @param set <code>true</code> to enable the flag, <code>false</code> to disable it. */ public void setFlag(long flag, boolean set); /** * Index of download. {@link #getPosition()} * @return index - 0 based * * @since 2.0.7.0 */ public int getIndex(); /** * Each download has a corresponding torrent * @return the download's torrent * * @since 2.0.7.0 */ public Torrent getTorrent(); /** * See lifecycle description above * @throws DownloadException * * @since 2.0.7.0 */ public void initialize() throws DownloadException; /** * See lifecycle description above * @throws DownloadException * * @since 2.0.7.0 */ public void start() throws DownloadException; /** * See lifecycle description above * @throws DownloadException * * @since 2.0.7.0 */ public void stop() throws DownloadException; /** * See lifecycle description above * @throws DownloadException * * @since 2.0.8.0 */ public void stopAndQueue() throws DownloadException; /** * See lifecycle description above * @throws DownloadException * * @since 2.0.7.0 */ public void restart() throws DownloadException; /** * Performs a complete recheck of the downloaded data * Download must be in stopped, queued or error state * Action is performed asynchronously and will progress the download through * states PREPARING back to the relevant state * @throws DownloadException * @since 2.1.0.3 */ public void recheckData() throws DownloadException; /** * When a download is "start-stop locked" it means that seeding rules shouldn't start or * stop the download as it is under manual control * @return True if download is locked and should not be started or stopped * * @since 2.0.7.0 */ public boolean isStartStopLocked(); /** Retrieves whether the download is force started * @return True if download is force started. False if not. * * @since 2.0.8.0 */ public boolean isForceStart(); /** Set the forcestart state of the download * @param forceStart True - Download will start, despite any Start/Stop rules/limits<BR> * False - Turn forcestart state off. Download may or may not stop, depending on * Start/Stop rules/limits * * @since 2.0.8.0 */ public void setForceStart(boolean forceStart); /** * Downloads can either be low or high priority (see PR_ constants above) * @return the download's priority * * @deprecated >= 2.1.0.6 does nothing * @since 2.0.7.0 */ public int getPriority(); /** * This method sets a download's priority * @param priority the required priority, see PR_ constants above * @deprecated >= 2.1.0.6 does nothing * * @since 2.0.7.0 */ public void setPriority( int priority ); /** When a download's priority is locked this means that seeding rules should not change * a downloads priority, it is under manual control * @return whether it is locked or not * @deprecated >= 2.0.8.0 does nothing * * @since 2.0.7.0 */ public boolean isPriorityLocked(); /** * @since 2403 * @return */ public boolean isPaused(); /** * Pause the download * @since 2501 */ public void pause(); /** * Resume the download if paused * @since 2501 */ public void resume(); /** Returns the name of the torrent. Similar to Torrent.getName() and is usefull * if getTorrent() returns null and you still need the name. * @return name of the torrent * * @since 2.0.8.0 */ public String getName(); /** Returns the full file path and name of the .torrent file * * @return File name of the torrent. * * @since 2.1.0.0 */ public String getTorrentFileName(); /** * Gets an attribute of this download. For category use the Category torrent attribute * @param attribute * @return */ public String getAttribute( TorrentAttribute attribute ); /** * Sets an attribute of this download. For category use the Category torrent attribute * * @param attribute Previously created attribute * @param value Value to store. null to remove attribute */ public void setAttribute( TorrentAttribute attribute, String value ); public String[] getListAttribute( TorrentAttribute attribute ); /** * * @param attribute * @param value * @since 2.5.0.1 */ public void setListAttribute(TorrentAttribute attribute, String[] value); /** * * @param attribute * @param value must be bencodable - key is string, value is Map, List, Long or byte[] */ public void setMapAttribute( TorrentAttribute attribute, Map value ); public Map getMapAttribute( TorrentAttribute attribute ); /** * Gets the value of the given attribute from the download. If no value is * set, then <code>0</code> will be returned. */ public int getIntAttribute(TorrentAttribute attribute); /** * Sets an integer attribute on this download. */ public void setIntAttribute(TorrentAttribute attribute, int value); /** * Gets the value of the given attribute from the download. If no value is * set, then <code>0</code> will be returned. */ public long getLongAttribute(TorrentAttribute attribute); /** * Sets a long attribute on this download. */ public void setLongAttribute(TorrentAttribute attribute, long value); /** * Gets the value of the given attribute from the download. If no value is * set, then <code>false</code> will be returned. */ public boolean getBooleanAttribute(TorrentAttribute attribute); /** * Sets a boolean attribute on this download. */ public void setBooleanAttribute(TorrentAttribute attribute, boolean value); /** * Returns <code>true</code> if the download has an explicit value stored for * the given attribute. */ public boolean hasAttribute(TorrentAttribute attribute); /** Returns the name of the Category * * @return name of the category * * @since 2.1.0.0 * @deprecated Use TorrentAttribute.TA_CATEGORY (2.2.0.3) */ public String getCategoryName(); /** Sets the category for the download * * @param sName Category name * * @since 2.1.0.0 * @deprecated Use TorrentAttribute.TA_CATEGORY (2.2.0.3) */ public void setCategory(String sName); /** * Removes a download. The download must be stopped or in error. Removal may fail if another * component does not want the removal to occur - in this case a "veto" exception is thrown * @throws DownloadException * @throws DownloadRemovalVetoException * * @since 2.0.7.0 */ public void remove() throws DownloadException, DownloadRemovalVetoException; /** * Same as "remove" but, if successful, deletes the torrent and/or data * @param delete_torrent * @param delete_data * @throws DownloadException * @throws DownloadRemovalVetoException * @since 2.2.0.3 */ public void remove( boolean delete_torrent, boolean delete_data ) throws DownloadException, DownloadRemovalVetoException; /** * Returns the current position in the queue * Completed and Incompleted downloads have seperate position sets. This means * we can have a position x for Completed, and position x for Incompleted. * * @since 2.0.8.0 */ public int getPosition(); /** * returns the time this download was created in milliseconds * @return */ public long getCreationTime(); /** * Sets the position in the queue * Completed and Incompleted downloads have seperate position sets * * @since 2.0.8.0 */ public void setPosition( int newPosition); /** * Moves the download position up one * * @since 2.1.0.0 */ public void moveUp(); /** * Moves the download down one position * * @since 2.1.0.0 */ public void moveDown(); /** * Moves a download and re-orders the others appropriately. Note that setPosition does not do this, it * merely sets the position thus making it possible, for example, for two downloads to have the same * position * @param position * @since 2.3.0.7 */ public void moveTo( int position ); /** * Tests whether or not a download can be removed. Due to synchronization issues it is possible * for a download to report OK here but still fail removal. * @return * @throws DownloadRemovalVetoException * * @since 2.0.7.0 */ public boolean canBeRemoved() throws DownloadRemovalVetoException; public void setAnnounceResult( DownloadAnnounceResult result ); public void setScrapeResult( DownloadScrapeResult result ); /** * Gives access to the last announce result received from the tracker for the download * @return * * @since 2.0.7.0 */ public DownloadAnnounceResult getLastAnnounceResult(); /** * Gives access to the last scrape result received from the tracker for the download * @return a non-null DownloadScrapeResult * * @since 2.0.7.0 */ public DownloadScrapeResult getLastScrapeResult(); /** * Gives access to the current activation state. Note that we currently only fire the activation listener * on an increase in activation requirements. This method however gives the current view of the state * and takes into account decreases too * @return * @since 2.4.0.3 */ public DownloadActivationEvent getActivationState(); /** * Gives access to the download's statistics * @return * * @since 2.0.7.0 */ public DownloadStats getStats(); /** Downloads can be persistent (be remembered accross Azureus sessions), or * non-persistent. * * @return true - persistent<br> * false - non-persistent * * @since 2.1.0.0 */ public boolean isPersistent(); /** * Sets the maximum download speed in bytes per second. 0 -> unlimited * @since 2.1.0.2 * @param kb */ public void setMaximumDownloadKBPerSecond( int kb ); public int getMaximumDownloadKBPerSecond(); /** * Get the max upload rate allowed for this download. * @return upload rate in bytes per second, 0 for unlimited, -1 for upload disabled */ public int getUploadRateLimitBytesPerSecond(); /** * Set the max upload rate allowed for this download. * @param max_rate_bps limit in bytes per second, 0 for unlimited, -1 for upload disabled */ public void setUploadRateLimitBytesPerSecond( int max_rate_bps ); /** * Get the max download rate allowed for this download. * @return upload rate in bytes per second, 0 for unlimited, -1 for download disabled * @since 3013 */ public int getDownloadRateLimitBytesPerSecond(); /** * Set the max download rate allowed for this download. * @param max_rate_bps limit in bytes per second, 0 for unlimited, -1 for dowmload disabled * @since 3013 */ public void setDownloadRateLimitBytesPerSecond( int max_rate_bps ); /** * Indicates if the download has completed or not, exluding any files marked * as Do No Download * * @return Download Complete status * @since 2.1.0.4 */ public boolean isComplete(); /** * Indicates if the download has completed or not * * @param bIncludeDND Whether to include DND files when determining * completion state * @return Download Complete status * * @since 2.4.0.3 */ public boolean isComplete(boolean bIncludeDND); /** * When a download is completed it is rechecked (if the option is enabled). This method * returns true during this phase (at which time the status will be seeding) * @return * @since 2.3.0.6 */ public boolean isChecking(); /** * This returns the full save path for the download. If the download is a simple torrent, * this will be the full path of the file being downloaded. If the download is a multiple * file torrent, this will be the path to the directory containing all the files in the * torrent. * * @return Full save path for this download. */ public String getSavePath(); /** * Move a download's data files to a new location. Download must be stopped and persistent * * <p> * * If a download is running, it will be automatically paused and resumed afterwards - be * aware that this behaviour may generate <tt>stateChanged</tt> events being fired. * * @since 2.3.0.5 * @param new_parent_dir * @throws DownloadException */ public void moveDataFiles( File new_parent_dir ) throws DownloadException; /** * Move a download's data files to a new location, and rename the download at the same time. * Download must be stopped and persistent. This is equivalent to calling <tt>moveDataFiles[File]</tt> * and then <tt>renameDownload[String]</tt>. * * For convenience, either argument can be <tt>null</tt>, but not both. * * <p> * * If a download is running, it will be automatically paused and resumed afterwards - be * aware that this behaviour may generate <tt>stateChanged</tt> events being fired. * * @since 3.0.2 * @throws DownloadException * @see {@link #moveDataFiles(File)} * @see {@link #renameDownload(String)} */ public void moveDataFiles(File new_parent_dir, String new_name) throws DownloadException; /** * Move a download's torrent file to a new location. Download must be stopped and persistent * @since 2.3.0.5 * @param new_parent_dir * @throws DownloadException */ public void moveTorrentFile( File new_parent_dir ) throws DownloadException; /** * Renames the file (for a single file torrent) or directory (for a multi file torrent) where the * download is being saved to. The download must be in a state to move the data files to a new location * (see {@link #moveDataFiles(File)}). * * <p> * * This will not rename the displayed name for the torrent - if you wish to do that, you must do it via * the {@link org.gudy.azureus2.plugins.torrent.TorrentAttribute TorrentAttribute} class. * * <p> * * If a download is running, it will be automatically paused and resumed afterwards - be * aware that this behaviour may generate <tt>stateChanged</tt> events being fired. * * @param name New name for the download. * @see #moveDataFiles(File) */ public void renameDownload(String name) throws DownloadException; /** * return the current peer manager for the download. * @return null returned if torrent currently doesn't have one (e.g. it is stopped) */ public PeerManager getPeerManager(); /** * Return the disk manager, null if its not running * @return * @since 2.3.0.1 */ public DiskManager getDiskManager(); /** * Returns info about the torrent's files. Note that this will return "stub" values if the * download isn't running (not including info such as completion status) * @return * @since 2.3.0.1 */ public DiskManagerFileInfo[] getDiskManagerFileInfo(); /** * request a tracker announce * @since 2.1.0.5 */ public void requestTrackerAnnounce(); /** * request a tracker announce * @since 2.3.0.7 */ public void requestTrackerAnnounce( boolean immediate ); /** * request a tracker announce * @since 2.3.0.7 */ public void requestTrackerScrape( boolean immediate ); /** * The torrents with the highest rankings will be seeded first. * * @return Seeding Rank */ public int getSeedingRank(); /** * The torrents with the highest rankings will be seeded first. * * @param rank New Ranking */ public void setSeedingRank(int rank); /** * Get the local peerID advertised to the download swarm. * @return self peer id * * @since 2.1.0.5 */ public byte[] getDownloadPeerId(); /** * Is advanced AZ messaging enabled for this download. * @return true if enabled, false if disabled */ public boolean isMessagingEnabled(); /** * Enable or disable advanced AZ messaging for this download. * @param enabled true to enabled, false to disabled */ public void setMessagingEnabled( boolean enabled ); /** * Returns an array of size 2 indicating the appropriate locations for this * download's data files and torrent file, based on Azureus's rules regarding * default save paths, and move on completion rules. * * <p> * * This method takes one argument - <i>for_moving</i>. This essentially * indicates whether you are getting this information for purposes of just * finding where Azureus would store these files by default, or whether you * are considering moving the files from its current location. * * <p> * * If <i>for_moving</i> is <tt>false</tt>, this method will determine locations * for the download and the torrent file where Azureus would store them by * default (it may return the current paths used by this download). * * <p> * * If <i>for_moving</i> is <tt>true</tt>, then this method will consider the * download's current location, and whether it is allowed to move it - you * may not be allowed to move this download (based on Azureus's current rules) * if the download doesn't exist within a default save directory already. If * a download is complete, we consider whether we are allowed to move downloads * on completion, and whether that includes downloads outside the default save * directory. * * <p> * * In this case, the array may contain <tt>null</tt> indicating that the Azureus * doesn't believe that the download should be moved (based on the current rules * the user has set out). However, you are not prevented from changing the * location of the torrent file or download. * * @since 2.5.0.2 * @param for_moving Indicates whether you want this information for the purposes * of moving the download or not. * @author amc1 * @deprecated Use {@link #calculateDefaultDownloadLocation()} instead. * @return An array of type <tt>File</tt> of size 2, first element containing the * calculated location for the download's data files, and the second element * containing the location for the download's torrent file. */ public File[] calculateDefaultPaths(boolean for_moving); /** * Returns <tt>true</tt> if the download is being saved to one of the default * save directories. * * @since 2.5.0.2 * @deprecated Use {@link DefaultSaveLocationManager#isInDefaultSaveDir(Download)} instead. * @author amc1 */ public boolean isInDefaultSaveDir(); /** * @since 3.0.4.3 * @return */ public boolean isRemoved(); /** * Returns <tt>true</tt> if Azureus will allow the data files for the torrent * to be moved. * * @since 3.0.5.1 */ public boolean canMoveDataFiles(); /** * Returns a {@link SaveLocationChange} object describing the appropriate location * for the download (and torrent file) to exist in, based on the download's completion * state, the <tt>for-completion</tt> rules in place, and the {@link SaveLocationManager} * object in use. * * @since 3.0.5.3 */ public SaveLocationChange calculateDefaultDownloadLocation(); /** * Apply the changes in the given {@link SaveLocationChange} object - this includes * moving torrent and data file data. * * @param slc The change to apply. * @since 3.1.0.1 * @throws DownloadException If there is a problem moving the data. */ public void changeLocation(SaveLocationChange slc) throws DownloadException; /** * get user-defined key/value * @param key * @return * @since 3.0.5.3 */ public Object getUserData( Object key ); /** * set user defined value. this is TRANSIENT and not persisted over Azureus stop/start * @param key * @param data */ public void setUserData( Object key, Object data ); /** * Simple method to start the download. Will not raise an error if it * didn't work, or if the download is already running. * * @since 3.0.5.3 * @param force <tt>true</tt> to force the download to be started. */ public void startDownload(boolean force); /** * Simple method to stop the download. Will not raise an error if it * didn't work, or if the download is already stopped. * * @since 3.0.5.3 */ public void stopDownload(); }

The table below shows all metrics for Download.java.

MetricValueDescription
BLOCKS 0.00Number of blocks
BLOCK_COMMENT20.00Number of block comment lines
COMMENTS647.00Comment lines
COMMENT_DENSITY 2.98Comment density
COMPARISONS 0.00Number of comparison operators
CYCLOMATIC90.00Cyclomatic complexity
DECL_COMMENTS104.00Comments in declarations
DOC_COMMENT627.00Number of javadoc comment lines
ELOC217.00Effective lines of code
EXEC_COMMENTS 0.00Comments in executable code
EXITS 0.00Procedure exits
FUNCTIONS90.00Number of function declarations
HALSTEAD_DIFFICULTY16.62Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY50.00Interface complexity
JAVA0001 1.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 1.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 0.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 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 0.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)
JAVA010119.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
JAVA010815.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 8.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'
JAVA0116 2.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 5.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[])
JAVA014190.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 0.00JAVA0144 Line exceeds maximum M characters
JAVA0145776.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 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 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 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 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
LINES1027.00Number of lines in the source file
LINE_COMMENT 0.00Number of line comments
LOC220.00Lines of code
LOGICAL_LINES120.00Number of statements
LOOPS 0.00Number of loops
NEST_DEPTH 0.00Maximum nesting depth
OPERANDS315.00Number of operands
OPERATORS694.00Number of operators
PARAMS50.00Number of formal parameter declarations
PROGRAM_LENGTH1009.00Halstead program length
PROGRAM_VOCAB241.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS 0.00Number of return points from functions
SIZE26929.00Size of the file in bytes
UNIQUE_OPERANDS218.00Number of unique operands
UNIQUE_OPERATORS23.00Number of unique operators
WHITESPACE160.00Number of whitespace lines