GanttOptions.java

Index Score
net.sourceforge.ganttproject
GanttProject

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
JAVA0034JAVA0034 Missing braces in if statement
CYCLOMATICCyclomatic complexity
DECL_COMMENTSComments in declarations
COMPARISONSNumber of comparison operators
SIZESize of the file in bytes
PROGRAM_LENGTHHalstead program length
OPERATORSNumber of operators
OPERANDSNumber of operands
ELOCEffective lines of code
LOGICAL_LINESNumber of statements
UNIQUE_OPERANDSNumber of unique operands
FUNCTIONSNumber of function declarations
BLOCKSNumber of blocks
JAVA0049JAVA0049 Nested block at depth N (maximum: M)
LOCLines of code
PROGRAM_VOCABHalstead program vocabulary
LINE_COMMENTNumber of line comments
EXEC_COMMENTSComments in executable code
LINESNumber of lines in the source file
JAVA0278JAVA0278 Unnecessary use of Boolean constructor
RETURNSNumber of return points from functions
EXITSProcedure exits
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
INTERFACE_COMPLEXITYInterface complexity
JAVA0116JAVA0116 Missing javadoc: field 'field'
WHITESPACENumber of whitespace lines
PARAMSNumber of formal parameter declarations
JAVA0117JAVA0117 Missing javadoc: method 'method'
COMMENTSComment lines
JAVA0270JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0285JAVA0285 Dereference of potentially null variable
DOC_COMMENTNumber of javadoc comment lines
JAVA0130JAVA0130 Non-static method does not use instance fields
JAVA0267JAVA0267 Use of System.err
LOOPSNumber of loops
JAVA0177JAVA0177 Variable declaration missing initializer
JAVA0160JAVA0160 Method does not throw specified exception
JAVA0254JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0265JAVA0265 Use of Throwable.printStackTrace()
UNIQUE_OPERATORSNumber of unique operators
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0064JAVA0064 N variations of identifier name (maximum: M)
JAVA0071JAVA0071 Strings compared with ==
JAVA0166JAVA0166 Generic exception caught
NEST_DEPTHMaximum nesting depth
PROGRAM_VOLUMEHalstead program volume
JAVA0259JAVA0259 Return of collection/array field
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0029JAVA0029 Private method not used
JAVA0100JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0145JAVA0145 Tab character used in source file
/*************************************************************************** GanttOptions.java - description ------------------- begin : mar 2003 copyright : (C) 2003 by Thomas Alexandre email : alexthomas(at)ganttproject.org ***************************************************************************/ /*************************************************************************** * * * 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, or * * (at your option) any later version. * * * ***************************************************************************/ package net.sourceforge.ganttproject; import java.awt.Color; import java.awt.Font; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.security.AccessControlException; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import javax.swing.JToolBar; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import net.sourceforge.ganttproject.document.Document; import net.sourceforge.ganttproject.document.DocumentManager; import net.sourceforge.ganttproject.document.DocumentsMRU; import net.sourceforge.ganttproject.gui.GanttLookAndFeelInfo; import net.sourceforge.ganttproject.gui.GanttLookAndFeels; import net.sourceforge.ganttproject.gui.UIConfiguration; import net.sourceforge.ganttproject.gui.options.model.CLOBOption; import net.sourceforge.ganttproject.gui.options.model.GP1XOptionConverter; import net.sourceforge.ganttproject.gui.options.model.GPConfigurable; import net.sourceforge.ganttproject.gui.options.model.GPOption; import net.sourceforge.ganttproject.gui.options.model.GPOptionGroup; import net.sourceforge.ganttproject.io.CSVOptions; import net.sourceforge.ganttproject.io.GanttXMLOpen; import net.sourceforge.ganttproject.io.SaverBase; import net.sourceforge.ganttproject.language.GanttLanguage; import net.sourceforge.ganttproject.parser.IconPositionTagHandler; import net.sourceforge.ganttproject.parser.RoleTagHandler; import net.sourceforge.ganttproject.roles.Role; import net.sourceforge.ganttproject.roles.RoleManager; import net.sourceforge.ganttproject.roles.RoleSet; import net.sourceforge.ganttproject.util.ColorConvertion; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.DefaultHandler; /** * The class aible to load and save options on the file */ public class GanttOptions extends SaverBase { private GanttLanguage language = GanttLanguage.getInstance(); // private Color color; private int x = 0, y = 0, width = 800, height = 600; private String styleClass = "", styleName = ""; private GanttLookAndFeelInfo lookAndFeel; private boolean isloaded; private boolean automatic; // private boolean dragTime; private boolean openTips; private boolean redline; private int lockDAVMinutes; private int undoNumber; private String xslDir; private String xslFo; private String workingDir = ""; private final RoleManager myRoleManager; private DocumentsMRU documentsMRU; private UIConfiguration myUIConfig; private Font myChartMainFont; private String sTaskNamePrefix; private int toolBarPosition; private boolean bShowStatusBar; private String iconSize; public static final int ICONS = 0; public static final int ICONS_TEXT = 1; public static final int TEXT = 2; private int buttonsshow; /** FTP options */ private String FTPUrl = ""; private String FTPDirectory = ""; private String FTPUser = ""; private String FTPPwd = ""; /** Export options. */ private boolean bExportName; private boolean bExportComplete; private boolean bExportRelations; private boolean bExport3DBorders; /** CVS export options. */ private CSVOptions csvOptions; private int[] iconListAsIntArray; private int[] deletedIconListAsIntArray; private String iconListAsString; private String deletedIconListAsString; private boolean isOnlyViewer; public static final int SEPARATOR = 0; public static final int EXIT = 1; public static final int NEW = 2; public static final int OPEN = 3; public static final int SAVE = 4; public static final int SAVEAS = 5; public static final int IMPORT = 6; public static final int EXPORT = 7; public static final int PRINT = 8; public static final int CUT = 9; public static final int COPY = 10; public static final int PASTE = 11; public static final int NEWTASK = 12; public static final int DELETE = 13; public static final int PROPERTIES = 14; public static final int UNLINK = 15; public static final int LINK = 16; public static final int IND = 17; public static final int UNIND = 18; public static final int UP = 19; public static final int DOWN = 20; public static final int PREV = 21; public static final int CENTER = 22; public static final int NEXT = 23; public static final int ZOOMOUT = 24; public static final int ZOOMIN = 25; public static final int UNDO = 26; public static final int REDO = 27; public static final int CRITICAL = 28; public static final int ABOUT = 29; public static final int SAVECURRENT = 30; public static final int COMPAREPREV = 31; public static final int REFRESH = 32; public static final int PREVIEWPRINT = 33; private Map/*<String,GPOption>*/ myGPOptions = new LinkedHashMap(); private Map/*<String,GP1XOptionConverter>*/ myTagDotAttribute_Converter = new HashMap(); private final DocumentManager myDocumentManager; /** Default constructor. */ public GanttOptions(RoleManager roleManager, DocumentManager documentManager, boolean isOnlyViewer) { myDocumentManager = documentManager; myRoleManager = roleManager; this.isOnlyViewer = isOnlyViewer; initByDefault(); try { this.workingDir = System.getProperty("user.home"); } catch (AccessControlException e) { // This can happen when running in a sandbox (Java WebStart) System.err.println(e + ": " + e.getMessage()); } } /** Init the options by default. */ public void initByDefault() { automatic = false; // dragTime = true; openTips = true; redline = false; lockDAVMinutes = 240; undoNumber = 50; xslDir = GanttOptions.class.getResource("/xslt").toString(); xslFo = GanttOptions.class.getResource("/xslfo/ganttproject.xsl") .toString(); sTaskNamePrefix = ""; toolBarPosition = JToolBar.HORIZONTAL; bShowStatusBar = true; iconSize = "16"; // must be 16 small, 24 for big (32 for extra big // not directly include on UI) buttonsshow = GanttOptions.ICONS; /** Export options. */ bExportName = true; bExportComplete = true; bExportRelations = true; bExport3DBorders = false; /** CVS export options. */ csvOptions = new CSVOptions(); // Icon status bar iconListAsString = getDefaultIconListAsString(); iconListAsIntArray = getDefaultIconListIntArray(); deletedIconListAsString = getDefaultDeletedIconListAsString(); deletedIconListAsIntArray = getDefaultDeletedIconListIntArray(); } // iconListAsIntArray = initIconList (); /** * Constructor. public GanttOptions(Color c, int x, int y, int width, int * height, GanttLookAndFeelInfo lookAndFeel, boolean automatic, boolean * dragTime, String xslDir, String xslFo,String workingDir, boolean tips, * boolean redline, int lockDAVMinutes, DocumentsMRU documentsMRU, * UIConfiguration uiConfiguration, RoleManager roleManager) { myRoleManager = * roleManager; color = c; this.x = x; this.y = y; this.width = width; * this.height = height; this.lookAndFeel = lookAndFeel; * this.automatic=automatic; this.dragTime=dragTime; this.openTips=tips; * this.redline=redline; this.lockDAVMinutes=lockDAVMinutes; this.myUIConfig = * uiConfiguration; if(xslFo!=null) this.xslFo=xslFo; if (xslDir != null) * this.xslDir = xslDir; try { this.workingDir = * System.getProperty("user.home"); } catch (AccessControlException e) { // * This can happen when running in a sandbox (Java WebStart) * System.err.println (e + ": " + e.getMessage()); } if (workingDir != null && * new File(workingDir).exists()) this.workingDir = workingDir; * this.documentsMRU = documentsMRU; } */ /** * Save the options file */ public void save() { try { String sFileName = ".ganttproject"; /* * if(System.getProperty("os.name").startsWith("Windows") || * System.getProperty("os.name").startsWith("Mac")) sFileName = * "ganttproject.ini"; */ File file = new File(System.getProperty("user.home") + System.getProperty("file.separator") + sFileName); // DataOutputStream fout = new DataOutputStream(new // FileOutputStream(file)); TransformerHandler handler = ((SAXTransformerFactory) SAXTransformerFactory .newInstance()).newTransformerHandler(); Transformer serializer = handler.getTransformer(); serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); serializer.setOutputProperty( "{http://xml.apache.org/xslt}indent-amount", "4"); handler.setResult(new StreamResult(file)); handler.startDocument(); // handler.startDTD("ganttproject.sourceforge.net", // "-//GanttProject.org//DTD GanttProject-1.x//EN", // "http://ganttproject.sourceforge.net/dtd/ganttproject.dtd"); // handler.endDTD(); // AttributesImpl attrs = new AttributesImpl(); handler.startElement("", "ganttproject-options", "ganttproject-options", attrs); // attrs.addAttribute("", "selection", "selection", "CDATA", language .getText("shortLanguage")); handler.startElement("", "language", "language", attrs); handler.endElement("", "language", "language"); attrs.clear(); // write the task Color /* * Color color = getUIConfiguration().getTaskColor(); * attrs.addAttribute("", "red", "red", "CDATA", ""+color.getRed()); * attrs.addAttribute("", "green", "green", "CDATA", * ""+color.getGreen()); attrs.addAttribute("", "blue", "blue", * "CDATA", ""+color.getBlue()); handler.startElement("", * "task-color", "task-color", attrs); handler.endElement("", * "task-color", "task-color"); attrs.clear(); */ Color resourceColor = myUIConfig.getResourceColor(); if (resourceColor != null) attrs.addAttribute("", "resources", "resources", "CDATA", "" + ColorConvertion.getColor(resourceColor)); Color resourceOverloadColor = myUIConfig.getResourceOverloadColor(); if (resourceOverloadColor != null) attrs.addAttribute("", "resourcesOverload", "resourcesOverload", "CDATA", "" + ColorConvertion .getColor(resourceOverloadColor)); Color resourceUnderloadColor = myUIConfig .getResourceUnderloadColor(); if (resourceUnderloadColor != null) attrs.addAttribute("", "resourcesUnderload", "resourcesUnderload", "CDATA", "" + ColorConvertion .getColor(resourceUnderloadColor)); Color weekEndColor = myUIConfig.getWeekEndColor(); if (weekEndColor != null) attrs.addAttribute("", "weekEnd", "weekEnd", "CDATA", "" + ColorConvertion.getColor(weekEndColor)); Color daysOffColor = myUIConfig.getDayOffColor(); if (daysOffColor != null) attrs.addAttribute("", "daysOff", "daysOff", "CDATA", "" + ColorConvertion.getColor(daysOffColor)); handler.startElement("", "colors", "colors", attrs); handler.endElement("", "colors", "colors"); attrs.clear(); // Geometry of the window addAttribute("x", "" + x, attrs); addAttribute("y", "" + y, attrs); addAttribute("width", "" + width, attrs); addAttribute("height", "" + height, attrs); emptyElement("geometry", attrs, handler); // look'n'feel addAttribute("name", lookAndFeel.getName(), attrs); addAttribute("class", lookAndFeel.getClassName(), attrs); emptyElement("looknfeel", attrs, handler); // ToolBar position addAttribute("position", "" + toolBarPosition, attrs); addAttribute("icon-size", "" + iconSize, attrs); addAttribute("show", "" + buttonsshow, attrs); emptyElement("toolBar", attrs, handler); addAttribute("show", "" + bShowStatusBar, attrs); emptyElement("statusBar", attrs, handler); // Export options addAttribute("name", "" + bExportName, attrs); addAttribute("complete", "" + bExportComplete, attrs); addAttribute("border3d", "" + bExport3DBorders, attrs); addAttribute("relations", "" + bExportRelations, attrs); emptyElement("export", attrs, handler); // csv export options startElement("csv-export", attrs, handler); addAttribute("fixed", "" + csvOptions.bFixedSize, attrs); addAttribute("separatedChar", "" + csvOptions.sSeparatedChar, attrs); addAttribute("separatedTextChar", "" + csvOptions.sSeparatedTextChar, attrs); emptyElement("csv-general", attrs, handler); addAttribute("id", "" + csvOptions.bExportTaskID, attrs); addAttribute("name", "" + csvOptions.bExportTaskName, attrs); addAttribute("start-date", "" + csvOptions.bExportTaskStartDate, attrs); addAttribute("end-date", "" + csvOptions.bExportTaskEndDate, attrs); addAttribute("percent", "" + csvOptions.bExportTaskPercent, attrs); addAttribute("duration", "" + csvOptions.bExportTaskDuration, attrs); addAttribute("webLink", "" + csvOptions.bExportTaskWebLink, attrs); addAttribute("resources", "" + csvOptions.bExportTaskResources, attrs); addAttribute("notes", "" + csvOptions.bExportTaskNotes, attrs); emptyElement("csv-tasks", attrs, handler); addAttribute("id", "" + csvOptions.bExportResourceID, attrs); addAttribute("name", "" + csvOptions.bExportResourceName, attrs); addAttribute("mail", "" + csvOptions.bExportResourceMail, attrs); addAttribute("phone", "" + csvOptions.bExportResourcePhone, attrs); addAttribute("role", "" + csvOptions.bExportResourceRole, attrs); emptyElement("csv-resources", attrs, handler); endElement("csv-export", handler); // automatic popup launch addAttribute("value", "" + automatic, attrs); emptyElement("automatic-launch", attrs, handler); // automaticdrag time on the chart // addAttribute("value", ""+dragTime, attrs); emptyElement("dragTime", attrs, handler); // automatic tips of the day launch addAttribute("value", "" + openTips, attrs); emptyElement("tips-on-startup", attrs, handler); // Should WebDAV resources be locked, when opening them? addAttribute("value", "" + lockDAVMinutes, attrs); emptyElement("lockdavminutes", attrs, handler); // write the xsl directory addAttribute("dir", xslDir, attrs); emptyElement("xsl-dir", attrs, handler); // write the xslfo directory addAttribute("file", xslFo, attrs); emptyElement("xsl-fo", attrs, handler); // write the working directory directory addAttribute("dir", workingDir, attrs); emptyElement("working-dir", attrs, handler); // write the task name prefix addAttribute("prefix", sTaskNamePrefix, attrs); emptyElement("task-name", attrs, handler); // The last opened files { startElement("files", attrs, handler); for (Iterator iterator = documentsMRU.iterator(); iterator .hasNext();) { Document document = (Document) iterator.next(); addAttribute("path", document.getPath(), attrs); emptyElement("file", attrs, handler); } endElement("files", handler); } addAttribute("category", "menu", attrs); addAttribute("spec", getFontSpec(getUIConfiguration().getMenuFont()), attrs); emptyElement("font", attrs, handler); // addAttribute("category", "chart-main", attrs); addAttribute("spec", getFontSpec(getUIConfiguration() .getChartMainFont()), attrs); emptyElement("font", attrs, handler); // saveIconPositions(handler); saveRoleSets(handler); for (Iterator options = myGPOptions.entrySet().iterator(); options.hasNext();) { Map.Entry nextEntry = (Entry) options.next(); GPOption nextOption = (GPOption)nextEntry.getValue(); if (nextOption.getPersistentValue()!=null) { addAttribute("id", nextEntry.getKey().toString(), attrs); if (nextOption instanceof CLOBOption) { cdataElement("option", EncodeCLOB(nextOption.getPersistentValue()), attrs, handler); } else { addAttribute("id", nextEntry.getKey().toString(), attrs); addAttribute("value", nextOption.getPersistentValue(), attrs); emptyElement("option", attrs, handler); } } } endElement("ganttproject-options", handler); // GPLogger.log("[GanttOptions] save(): finished!!"); handler.endDocument(); } catch (Exception e) { if (!GPLogger.log(e)) { e.printStackTrace(System.err); } } } public static String escapeXML(String str) { if (str == null) { return (""); } str = str.replaceAll("&", "&amp;"); str = str.replaceAll(">", "&gt;"); str = str.replaceAll("<", "&lt;"); str = str.replaceAll("\"", "&quot;"); str = str.replaceAll("--", "&#45;&#45;"); return str; } public static String unescapeXML(String str) { if (str == null) { return (""); } str = str.replaceAll("&gt;", ">"); str = str.replaceAll("&lt;", "<"); str = str.replaceAll("&quot;", "\""); str = str.replaceAll("&#45;&#45;", "--"); str = str.replaceAll("&amp;", "&"); return str; } private String EncodeCLOB(String clob) { return escapeXML(clob); } private String getFontSpec(Font font) { return font.getFamily() + "-" + getFontStyle(font) + "-" + font.getSize(); } private String getFontStyle(Font font) { String result; final int BOLDITALIC = Font.BOLD + Font.ITALIC; switch (font.getStyle()) { case Font.PLAIN: { result = "plain"; break; } case Font.BOLD: { result = "bold"; break; } case Font.ITALIC: { result = "italic"; break; } case BOLDITALIC: { result = "bolditalic"; break; } default: { throw new RuntimeException("Illegal value of font style. style=" + font.getStyle() + " font=" + font); } } return result; } public String correct(String s) { String res; res = s.replaceAll("&", "&#38;"); res = res.replaceAll("<", "&#60;"); res = res.replaceAll(">", "&#62;"); res = res.replaceAll("/", "&#47;"); res = res.replaceAll("\"", "&#34;"); return res; } /** Load the options file */ public boolean load() { // Use an instance of ourselves as the SAX event handler DefaultHandler handler = new GanttXMLOptionsParser(); // Use the default (non-validating) parser SAXParserFactory factory = SAXParserFactory.newInstance(); try { String sFileName = ".ganttproject"; /* * if(System.getProperty("os.name").startsWith("Windows") || * System.getProperty("os.name").startsWith("Mac")) sFileName = * "ganttproject.ini"; */ File file = new File(System.getProperty("user.home") + System.getProperty("file.separator") + sFileName); if (!file.exists()) { return false; } documentsMRU.clear(); // Parse the input SAXParser saxParser = factory.newSAXParser(); saxParser.parse(file, handler); GanttLookAndFeelInfo info = GanttLookAndFeels .getGanttLookAndFeels().getInfoByClass(styleClass); if (null == info) info = GanttLookAndFeels.getGanttLookAndFeels().getInfoByName( styleName); if (null != info) lookAndFeel = info; if (null == lookAndFeel) lookAndFeel = GanttLookAndFeels.getGanttLookAndFeels() .getDefaultInfo(); loadRoleSets(file); } catch (Exception e) { if (!GPLogger.log(e)) { e.printStackTrace(System.err); } return false; } isloaded = true; return true; } private void loadRoleSets(File optionsFile) { GanttXMLOpen loader = new GanttXMLOpen(null); IconPositionTagHandler iconHandler = new IconPositionTagHandler(); loader.addTagHandler(iconHandler); loader.addTagHandler(new RoleTagHandler(getRoleManager())); loader.load(optionsFile); if (iconHandler.getList() != null) { iconListAsIntArray = iconHandler.getList(); iconListAsString = iconHandler.getPositions(); } if (iconHandler.getDeletedList() != null) { deletedIconListAsIntArray = iconHandler.getDeletedList(); deletedIconListAsString = iconHandler.getDeletedPositions(); } } private void saveRoleSets(TransformerHandler handler) throws TransformerConfigurationException, TransformerFactoryConfigurationError, SAXException { RoleSet[] roleSets = getRoleManager().getRoleSets(); for (int i = 0; i < roleSets.length; i++) { AttributesImpl attrs = new AttributesImpl(); attrs.addAttribute("", "roleset-name", "roleset-name", "CDATA", roleSets[i].getName()); handler.startElement("", "roles", "roles", attrs); saveRoles(roleSets[i], handler); handler.endElement("", "roles", "roles"); } } private void saveRoles(RoleSet roleSet, TransformerHandler handler) throws SAXException { Role[] roles = roleSet.getRoles(); AttributesImpl attrs = new AttributesImpl(); for (int i = 0; i < roles.length; i++) { Role next = roles[i]; addAttribute("id", "" + next.getID(), attrs); addAttribute("name", next.getName(), attrs); emptyElement("role", attrs, handler); } } private void saveIconPositions(TransformerHandler handler) throws TransformerConfigurationException, TransformerFactoryConfigurationError, SAXException { AttributesImpl attrs = new AttributesImpl(); addAttribute("icons-list", iconListAsString, attrs); addAttribute("deletedIcons-list", deletedIconListAsString, attrs); emptyElement("positions", attrs, handler); } public UIConfiguration getUIConfiguration() { if (myUIConfig == null) { myUIConfig = new UIConfiguration(null, null, new Color(140, 182, 206), redline) { public Font getMenuFont() { return myMenuFont == null ? super.getMenuFont() : myMenuFont; } public Font getChartMainFont() { return myChartMainFont == null ? super.getChartMainFont() : myChartMainFont; } }; // Color.black } return myUIConfig; } private RoleManager getRoleManager() { return myRoleManager; } private Font myMenuFont; /** Class to parse the xml option file */ class GanttXMLOptionsParser extends DefaultHandler { private GPOption myContextCLOBOption; @Override public void characters(char[] ch, int start, int length) throws SAXException { if (myContextCLOBOption!=null) { myContextCLOBOption.lock(); myContextCLOBOption.loadPersistentValue(unescapeXML(new String(ch, start, length))); myContextCLOBOption.commit(); myContextCLOBOption = null; } } public void startElement(String namespaceURI, String sName, // simple // name String qName, // qualified name Attributes attrs) throws SAXException { int r = 0, g = 0, b = 0; if ("option".equals(qName)) { GPOption option = (GPOption) myGPOptions.get(attrs.getValue("id")); if (option!=null) { if (option instanceof CLOBOption) { myContextCLOBOption = option; } else { option.lock(); option.loadPersistentValue(attrs.getValue("value")); option.commit(); } } return; } if (attrs != null) { for (int i = 0; i < attrs.getLength(); i++) { String aName = attrs.getQName(i); // Attr name String value = attrs.getValue(i); String tagDotAttribute = qName+"."+aName; GP1XOptionConverter converter = (GP1XOptionConverter) myTagDotAttribute_Converter.get(tagDotAttribute); if (converter!=null) { converter.loadValue(value); continue; } if (qName.equals("language")) { if (aName == "selection") { if (value.equals("English") || value.equals("en")) { language.setLocale(Locale.US); } else if (value.equals("English (UK)") || value.equals("en_GB")) { language.setLocale(Locale.UK); } else if (value.equals("Fran\u00e7ais") || value.equals("fr")) { language.setLocale(Locale.FRANCE); } else if (value.equals("Espa\u00f1ol") || value.equals("es")) { language.setLocale(new Locale("es", "ES")); } else if (value.equals("Portugues") || value.equals("pt")) { language.setLocale(new Locale("pt", "PT")); } else if (value.equals("Portugu\u00eas do Brasil") || value.equals("pt_BR")) { language.setLocale(new Locale("pt", "BR")); } else if (value.equals("Deutsch") || value.equals("de")) { language.setLocale(Locale.GERMANY); } else if (value.equals("Norsk") || value.equals("no")) { language.setLocale(new Locale("no", "NO")); } else if (value.equals("Italiano") || value.equals("it")) { language.setLocale(Locale.ITALY); } else if (value.equals("Japanese") || value.equals("jpn")) { language.setLocale(new Locale("ja", "JP")); } else if (value.equals("T\u00FCrk\u00E7e") || value.equals("tr")) { language.setLocale(new Locale("tr", "TR")); } else if (value.equals("Simplified Chinese") || value.equals("SIMPLIFIED_CHINESE") || value.equals("CHINA") || value.equals("zh_CN")) { language.setLocale(Locale.CHINA); } else if (value.equals("Traditional Chinese") || value.equals("TRADITIONAL_CHINESE") || value.equals("TAIWAN") || value.equals("zh_TW")) { language.setLocale(Locale.TAIWAN); } else if (value.equals("Polski") || value.equals("pl")) { language.setLocale(new Locale("pl", "PL")); } else if (value .equals("\u0420\u0443\u0441\u0441\u043a\u0438\u0439") || value.equals("ru")) { language.setLocale(new Locale("ru", "RU")); } else if (value.equals("Estonian") || value.equals("et")) { language.setLocale(new Locale("et", "ET")); } else if (value.equals("fi")) { language.setLocale(new Locale("fi", "FI")); } else if (value.equals("Hungarian") || value.equals("hu")) { language.setLocale(new Locale("hu", "HU")); } else if (value .equals("\u05d0\u05e0\u05d2\u05dc\u05d9\u05ea") || value.equals("iw")) { language.setLocale(new Locale("iw", "IW")); } else if (value.equals("Sloven\u0161\u010dina") || value.equals("si")) { language.setLocale(new Locale("sl", "SL")); } else if (value.equals("Slovensky") || value.equals("sk")) { language.setLocale(new Locale("sk", "SK")); } else if (value.equals("Svenska") || value.equals("sv")) { language.setLocale(new Locale("sv", "SV")); } else if (value.equals("Romanian") || value.equals("ro")) { language.setLocale(new Locale("ro", "RO")); } else if (value.equals("Nederlands") || value.equals("nl")) { language.setLocale(new Locale("nl", "NL")); } else if (value.equals("\u010cesky") || value.equals("cz")) { language.setLocale(new Locale("cs", "CZ")); } else if (value.equals("Dansk") || value.equals("da")) { language.setLocale(new Locale("da", "DK")); } else if (value.equals("Ti\u1ebfng anh") || value.equals("vi")) { language.setLocale(new Locale("vi", "VN")); } } } else if (qName.equals("task-color")) { if (aName.equals("red")) { r = new Integer(value).hashCode(); } else if (aName.equals("green")) { g = new Integer(value).hashCode(); } else if (aName.equals("blue")) { b = new Integer(value).hashCode(); } } else if (qName.equals("geometry")) { if (aName.equals("x")) { x = new Integer(value).hashCode(); } if (aName.equals("y")) { y = new Integer(value).hashCode(); } if (aName.equals("width")) { width = new Integer(value).hashCode(); } if (aName.equals("height")) { height = new Integer(value).hashCode(); } } else if (qName.equals("looknfeel")) { if (aName.equals("name")) { styleName = value; } if (aName.equals("class")) { styleClass = value; } } else if (qName.equals("file")) { if (aName.equals("path")) { documentsMRU.append(myDocumentManager .getDocument(value)); } } else if (qName.equals("automatic-launch")) { if (aName.equals("value")) { automatic = (new Boolean(value)).booleanValue(); } } else if (qName.equals("tips-on-startup")) { if (aName.equals("value")) { openTips = (new Boolean(value)).booleanValue(); } } else if (qName.equals("lockdavminutes")) { if (aName.equals("value")) { lockDAVMinutes = (new Integer(value)).intValue(); } } else if (qName.equals("xsl-dir")) { if (aName.equals("dir")) { if (new File(value).exists()) xslDir = value; } } else if (qName.equals("xsl-fo")) { if (aName.equals("file")) { if (new File(value).exists()) xslFo = value; } } else if (qName.equals("working-dir")) { if (aName.equals("dir")) { if (new File(value).exists()) workingDir = value; } } else if (qName.equals("task-name")) { if (aName.equals("prefix")) sTaskNamePrefix = value; } else if (qName.equals("toolBar")) { if (aName.equals("position")) toolBarPosition = (new Integer(value)).intValue(); else if (aName.equals("icon-size")) iconSize = value; else if (aName.equals("show")) buttonsshow = (new Integer(value)).intValue(); } else if (qName.equals("statusBar")) { if (aName.equals("show")) bShowStatusBar = (new Boolean(value)) .booleanValue(); } else if (qName.equals("export")) { if (aName.equals("name")) bExportName = (new Boolean(value)).booleanValue(); else if (aName.equals("complete")) bExportComplete = (new Boolean(value)) .booleanValue(); else if (aName.equals("relations")) bExportRelations = (new Boolean(value)) .booleanValue(); else if (aName.equals("border3d")) bExport3DBorders = (new Boolean(value)) .booleanValue(); } else if (qName.equals("colors")) { if (aName.equals("resources")) { Color colorR = ColorConvertion .determineColor(value); if (colorR != null) setResourceColor(colorR); } else if (aName.equals("resourcesOverload")) { Color colorR = ColorConvertion .determineColor(value); if (colorR != null) setResourceOverloadColor(colorR); } else if (aName.equals("resourcesUnderload")) { Color colorR = ColorConvertion .determineColor(value); if (colorR != null) setResourceUnderloadColor(colorR); } else if (aName.equals("weekEnd")) { Color colorR = ColorConvertion .determineColor(value); if (colorR != null) setWeekEndColor(colorR); } else if (aName.equals("daysOff")) { Color colorD = ColorConvertion .determineColor(value); if (colorD != null) setDaysOffColor(colorD); } } else if (qName.equals("csv-general")) { if (aName.equals("fixed")) csvOptions.bFixedSize = (new Boolean(value)) .booleanValue(); if (aName.equals("separatedChar")) csvOptions.sSeparatedChar = value; if (aName.equals("separatedTextChar")) csvOptions.sSeparatedTextChar = value; } else if (qName.equals("csv-tasks")) { if (aName.equals("id")) csvOptions.bExportTaskID = (new Boolean(value)) .booleanValue(); if (aName.equals("name")) csvOptions.bExportTaskName = (new Boolean(value)) .booleanValue(); if (aName.equals("start-date")) csvOptions.bExportTaskStartDate = (new Boolean( value)).booleanValue(); if (aName.equals("end-date")) csvOptions.bExportTaskEndDate = (new Boolean(value)) .booleanValue(); if (aName.equals("percent")) csvOptions.bExportTaskPercent = (new Boolean(value)) .booleanValue(); if (aName.equals("duration")) csvOptions.bExportTaskDuration = (new Boolean(value)) .booleanValue(); if (aName.equals("webLink")) csvOptions.bExportTaskWebLink = (new Boolean(value)) .booleanValue(); if (aName.equals("resources")) csvOptions.bExportTaskResources = (new Boolean( value)).booleanValue(); if (aName.equals("notes")) csvOptions.bExportTaskNotes = (new Boolean(value)) .booleanValue(); } else if (qName.equals("csv-resources")) { if (aName.equals("id")) csvOptions.bExportResourceID = (new Boolean(value)) .booleanValue(); if (aName.equals("name")) csvOptions.bExportResourceName = (new Boolean(value)) .booleanValue(); if (aName.equals("mail")) csvOptions.bExportResourceMail = (new Boolean(value)) .booleanValue(); if (aName.equals("phone")) csvOptions.bExportResourcePhone = (new Boolean( value)).booleanValue(); if (aName.equals("role")) csvOptions.bExportResourceRole = (new Boolean(value)) .booleanValue(); } } } // old version of the color version if (qName.equals("task-color")) { // Color color = new Color(r, g, b); // getUIConfiguration().setTaskColor(color); setDefaultTaskColor(new Color(r, g, b)); } if (qName.equals("font")) { String category = attrs.getValue("category"); if ("menu".equals(category)) { myMenuFont = Font.decode(attrs.getValue("spec")); } else if ("chart-main".equals(category)) { myChartMainFont = Font.decode(attrs.getValue("spec")); } } } } private String getFilePath(String value) { String result = null; String filePath; try { URL fileUrl = new URL(value); filePath = fileUrl.getPath(); } catch (MalformedURLException e) { filePath = value; } if (new File(filePath).exists()) { result = filePath; } return result; } /** @return the language. */ public GanttLanguage getLanguage() { return language; } /** @return the default color for tasks. */ public Color getDefaultColor() { return getUIConfiguration().getTaskColor(); } /** @return the color for resources. */ public Color getResourceColor() { return getUIConfiguration().getResourceColor(); } // TODO This method was not used... // /** @return the color for resources overload. */ // public Color getResourceOverloadColor() { // return getUIConfiguration().getResourceOverloadColor(); // } /** @return the lock DAV Minutes. */ public int getLockDAVMinutes() { return lockDAVMinutes; } /** @return the undo number */ public int getUndoNumber() { return undoNumber; } /** @return the working directory. */ public String getWorkingDir() { return workingDir; } /** @return the xsl directory. */ public String getXslDir() { return xslDir; } /** @return the xsl-fo file. */ public String getXslFo() { return (new File(xslFo).exists()) ? xslFo : getClass().getResource( "/xslfo/ganttproject.xsl").toString(); } /** @return if you want to open the tips at the start of GP. */ public boolean getOpenTips() { return openTips; } /** @return if the mouse is used to drag on the chart. */ // public boolean getDragTime() { // return dragTime; // } /** @return automatic launch properties box when create a new task. */ public boolean getAutomatic() { return automatic; } /** @return the lookAndFeel infos. */ public GanttLookAndFeelInfo getLnfInfos() { return lookAndFeel; } /** @return true is options are loaded from the options file. */ public boolean isLoaded() { return isloaded; } /** @return true if show the status bar. */ public boolean getShowStatusBar() { return bShowStatusBar; } /** set show the status bar. */ public void setShowStatusBar(boolean showStatusBar) { bShowStatusBar = showStatusBar; } /** @return the top left x position of the window. */ public int getX() { return x; } /** @return the top left y position of the window. */ public int getY() { return y; } /** @return the width of the window. */ public int getWidth() { return width; } /** @return the height of the window. */ public int getHeight() { return height; } /** @return the cvsOptions. */ public CSVOptions getCSVOptions() { return csvOptions; } /** @return the task name prefix. */ public String getTaskNamePrefix() { if (sTaskNamePrefix == null || sTaskNamePrefix.equals("")) return language.getText("newTask"); return sTaskNamePrefix; } public String getTrueTaskNamePrefix() { if (sTaskNamePrefix == null || sTaskNamePrefix.equals("") || sTaskNamePrefix.equals(language.getText("newTask"))) return null; return sTaskNamePrefix; } /** @return the toolbar position. */ public int getToolBarPosition() { return toolBarPosition; } /** @return the size of the icons on the toolbar. */ public String getIconSize() { return iconSize; } /** * @return true if you want to export the name of the task on the exported * chart. */ public boolean getExportName() { return bExportName; } /** * @return true if you want to export the complete percent of the task on * the exported chart. */ public boolean getExportComplete() { return bExportComplete; } /** * @return true if you want to export the relations of the task on the * exported chart. */ public boolean getExportRelations() { return bExportRelations; } /** @return the 3d borders export. */ public boolean getExport3dBorders() { return bExport3DBorders; } public GanttExportSettings getExportSettings() { return new GanttExportSettings(bExportName, bExportComplete, bExportRelations, bExport3DBorders); } public void setExportName(boolean exportName) { bExportName = exportName; } public void setExportComplete(boolean exportComplete) { bExportComplete = exportComplete; } public void setExportRelations(boolean eportRelations) { bExportRelations = eportRelations; } public void setExport3dBorders(boolean borders3d) { bExport3DBorders = borders3d; } public int[] getIconList() { return iconListAsIntArray; } public int[] getDeletedIconList() { return deletedIconListAsIntArray; } public void setIconList(String list) { iconListAsString = list; } public void setDeletedIconList(String list) { deletedIconListAsString = list; } /** * @return the button show attribute must be GanttOptions.ICONS or * GanttOptions.TEXT ir GanttOptions.ICONS_TEXT */ public int getButtonShow() { return buttonsshow; } /** * set a new button show value must be GanttOptions.ICONS or * GanttOptions.TEXT ir GanttOptions.ICONS_TEXT */ public void setButtonShow(int buttonShow) { if (buttonShow != GanttOptions.ICONS && buttonShow != GanttOptions.TEXT && buttonShow != GanttOptions.ICONS_TEXT) buttonShow = GanttOptions.ICONS; buttonsshow = buttonShow; } /** Set a new icon size. Must be 16, 24 (or 32 exceptionnally) */ public void setIconSize(String sIconSize) { iconSize = sIconSize; } /** set the toolbar position. */ public void setToolBarPosition(int iToolBarPosition) { toolBarPosition = iToolBarPosition; } /** Set new window position (top left corner) */ public void setWindowPosition(int x, int y) { this.x = x; this.y = y; } /** Set new window position (top left corner) */ public void setWindowSize(int width, int height) { this.width = width; this.height = height; } /** Set new working directory value. */ public void setWorkingDirectory(String workingDirectory) { workingDir = workingDirectory; } /** set a new value for web dav locking. */ public void setLockDAVMinutes(int minuteslock) { lockDAVMinutes = minuteslock; } /** set a new value for undo number. */ public void setUndoNumber(int number) { undoNumber = number; } /** set a new default tasks color. */ public void setDefaultTaskColor(Color color) { getUIConfiguration().setTaskColor(color); } /** set a new default resources color. */ public void setResourceColor(Color color) { getUIConfiguration().setResourceColor(color); } /** set a new resources overload tasks color. */ public void setResourceOverloadColor(Color color) { getUIConfiguration().setResourceOverloadColor(color); } /** set a new resources underload tasks color. */ public void setResourceUnderloadColor(Color color) { getUIConfiguration().setResourceUnderloadColor(color); } /** set a new previous tasks color. */ public void setPreviousTaskColor(Color color) { getUIConfiguration().setPreviousTaskColor(color); } /** set a new earlier previous tasks color. */ public void setEarlierPreviousTaskColor(Color color) { getUIConfiguration().setEarlierPreviousTaskColor(color); } /** set a new later previous tasks color. */ public void setLaterPreviousTaskColor(Color color) { getUIConfiguration().setLaterPreviousTaskColor(color); } /** Set a new week end color. */ public void setWeekEndColor(Color color) { getUIConfiguration().setWeekEndColor(color); } /** Set a new week end color. */ public void setDaysOffColor(Color color) { getUIConfiguration().setDayOffColor(color); } /** Set a new xsl directory for html export. */ public void setXslDir(String xslDir) { this.xslDir = xslDir; } /** Set a new xsl-fo file for pdf export. */ public void setXslFo(String xslFo) { this.xslFo = xslFo; } public void setDocumentsMRU(DocumentsMRU documentsMRU) { this.documentsMRU = documentsMRU; } public void setUIConfiguration(UIConfiguration uiConfiguration) { this.myUIConfig = uiConfiguration; } /** set new open tips value. */ public void setOpenTips(boolean openTips) { this.openTips = openTips; } /** set new automatic launch value. */ public void setAutomatic(boolean automatic) { this.automatic = automatic; } /** set new drag time with mouse value. */ // public void setDragTime(boolean dragTime){ // this.dragTime = dragTime; // } public void setLookAndFeel(GanttLookAndFeelInfo lookAndFeel) { this.lookAndFeel = lookAndFeel; } public void setTaskNamePrefix(String taskNamePrefix) { sTaskNamePrefix = taskNamePrefix; } public void setRedline(boolean isOn) { this.redline = isOn; getUIConfiguration().setRedlineOn(isOn); } /** * @return */ public String getFTPDirectory() { return FTPDirectory; } /** * @return */ public String getFTPPwd() { return FTPPwd; } /** * @return */ public String getFTPUrl() { return FTPUrl; } /** * @return */ public String getFTPUser() { return FTPUser; } /** * @param pvString */ public void setFTPDirectory(String pvString) { FTPDirectory = pvString; } /** * @param pvString */ public void setFTPPwd(String pvString) { FTPPwd = pvString; } /** * @param pvString */ public void setFTPUrl(String pvString) { FTPUrl = pvString; } /** * @param pvString */ public void setFTPUser(String pvString) { FTPUser = pvString; } /** * @return the default string to configure the iconList */ public String getDefaultIconListAsString() { // String iconAsString = "1,3,4,5,6,7,8,0,21,22,23,24,25,0,28,0,29"; // // if (!isOnlyViewer) // iconAsString = // "2,3,4,5,6,7,8,0,9,10,11,0,12,13,14,15,16,17,18,19,20,0,21,22,23,24,25,0,26,27,0,30,31,0,28"; // // return iconAsString; return getStringList(getDefaultIconListIntArray()); } private static String getStringList(int[] tabInt) { String res = ""; int i = 0; for (i = 0; i < tabInt.length - 1; i++) { res += tabInt[i] + ","; } res += tabInt[i]; return res; } /** * @return the default integer array to configure the iconList */ public int[] getDefaultIconListIntArray() { if (!isOnlyViewer) return new int[] { SAVE, SEPARATOR, CUT, COPY, PASTE, SEPARATOR, UNDO, REDO, SEPARATOR, NEWTASK, DELETE, PROPERTIES, UNLINK, LINK, IND, UNIND, UP, DOWN, SEPARATOR, /*PREV,*/ CENTER, /*NEXT, */ZOOMOUT, ZOOMIN, SEPARATOR, SAVECURRENT, COMPAREPREV, SEPARATOR, CRITICAL }; /* else */ return new int[] { EXIT, OPEN, SAVE, SAVEAS, IMPORT, EXPORT, PRINT, PREVIEWPRINT, SEPARATOR, /*PREV, */CENTER, /*NEXT,*/ ZOOMOUT, ZOOMIN, SEPARATOR, CRITICAL, SEPARATOR, ABOUT }; } /** * @return the default string to configure the iconList */ public String getDefaultDeletedIconListAsString() { return ""; } /** * @return the default integer array to configure the iconList */ public int[] getDefaultDeletedIconListIntArray() { return null; } public void addOptionGroups(GPOptionGroup[] optionGroups) { for (int i=0; i<optionGroups.length; i++) { GPOptionGroup nextGroup = optionGroups[i]; addOptions(nextGroup); } } public void addOptions(GPConfigurable configurable) { if (configurable!=null) { addOptions(configurable.getOptions()); } } private void addOptions(GPOptionGroup optionGroup) { GPOption[] options = optionGroup.getOptions(); for (int i=0;i<options.length; i++) { GPOption nextOption = options[i]; myGPOptions.put(optionGroup.getID()+"."+nextOption.getID(), nextOption); if (nextOption instanceof GP1XOptionConverter) { GP1XOptionConverter nextConverter = (GP1XOptionConverter) nextOption; myTagDotAttribute_Converter.put(nextConverter.getTagName()+"."+nextConverter.getAttributeName(), nextConverter); } } } }

The table below shows all metrics for GanttOptions.java.

MetricValueDescription
BLOCKS215.00Number of blocks
BLOCK_COMMENT20.00Number of block comment lines
COMMENTS229.00Comment lines
COMMENT_DENSITY 0.25Comment density
COMPARISONS199.00Number of comparison operators
CYCLOMATIC288.00Cyclomatic complexity
DECL_COMMENTS81.00Comments in declarations
DOC_COMMENT149.00Number of javadoc comment lines
ELOC915.00Effective lines of code
EXEC_COMMENTS38.00Comments in executable code
EXITS133.00Procedure exits
FUNCTIONS100.00Number of function declarations
HALSTEAD_DIFFICULTY95.75Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY182.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 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 1.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
JAVA003446.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'
JAVA004927.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 3.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 1.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
JAVA010828.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 1.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 0.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA011637.00JAVA0116 Missing javadoc: field 'field'
JAVA011720.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 2.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 3.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 1.00JAVA0137 Non-abstract class missing constructor
JAVA0138 0.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 0.00JAVA0144 Line exceeds maximum M characters
JAVA0145 0.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 2.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 2.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 0.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 0.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 3.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 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 2.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 2.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 2.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 3.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 4.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 i