r4fterman/pdf.forms

View on GitHub
src/main/java/org/pdf/forms/gui/library/LibraryPanel.java

Summary

Maintainability
A
35 mins
Test Coverage
C
73%

Method getListCellRendererComponent has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

                final JList<? extends String> list,
                final String value,
                final int index,
                final boolean isSelected,
                final boolean cellHasFocus) {
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/library/LibraryPanel.java - About 35 mins to fix

    Make "listener" transient or serializable.
    Open

        private final ListSelectionListener listener;

    Fields in a Serializable class must themselves be either Serializable or transient even if the class is never explicitly serialized or deserialized. For instance, under load, most J2EE application frameworks flush objects to disk, and an allegedly Serializable object with non-transient, non-serializable data members could cause program crashes, and open the door to attackers. In general a Serializable class is expected to fulfil its contract and not have an unexpected behaviour when an instance is serialized.

    This rule raises an issue on non-Serializable fields, and on collection fields when they are not private (because they could be assigned non-Serializable values externally), and when they are assigned non-Serializable types within the class.

    Noncompliant Code Example

    public class Address {
      //...
    }
    
    public class Person implements Serializable {
      private static final long serialVersionUID = 1905122041950251207L;
    
      private String name;
      private Address address;  // Noncompliant; Address isn't serializable
    }
    

    Compliant Solution

    public class Address implements Serializable {
      private static final long serialVersionUID = 2405172041950251807L;
    }
    
    public class Person implements Serializable {
      private static final long serialVersionUID = 1905122041950251207L;
    
      private String name;
      private Address address;
    }
    

    Exceptions

    The alternative to making all members serializable or transient is to implement special methods which take on the responsibility of properly serializing and de-serializing the object. This rule ignores classes which implement the following methods:

     private void writeObject(java.io.ObjectOutputStream out)
         throws IOException
     private void readObject(java.io.ObjectInputStream in)
         throws IOException, ClassNotFoundException;
    

    See

    Wrong lexicographical order for 'com.vlsolutions.swing.docking.DockKey' import. Should be before 'org.pdf.forms.widgets.utils.WidgetFactory'.
    Open

    import com.vlsolutions.swing.docking.DockKey;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

    This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

    Extra separation in import group before 'org.pdf.forms.gui.designer.IDesigner'
    Open

    import org.pdf.forms.gui.designer.IDesigner;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

    This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

    Wrong lexicographical order for 'com.vlsolutions.swing.docking.Dockable' import. Should be before 'org.pdf.forms.widgets.utils.WidgetFactory'.
    Open

    import com.vlsolutions.swing.docking.Dockable;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

    This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

    Line is longer than 100 characters (found 102).
    Open

        private static class LibraryPanelCellRenderer extends JLabel implements ListCellRenderer<String> {

    Checks for long lines.

    Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

    This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

    Using the '.*' form of import should be avoided - javax.swing.*.
    Open

    import javax.swing.*;

    Checks that there are no import statements that use the * notation.

    Rationale: Importing all classes from a package or staticmembers from a class leads to tight coupling between packagesor classes and might lead to problems when a new version of alibrary introduces name clashes.

    This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

    Extra separation in import group before 'com.vlsolutions.swing.docking.DockKey'
    Open

    import com.vlsolutions.swing.docking.DockKey;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

    This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

    Extra separation in import group before 'javax.swing.*'
    Open

    import javax.swing.*;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

    This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

    Using the '.*' form of import should be avoided - java.awt.*.
    Open

    import java.awt.*;

    Checks that there are no import statements that use the * notation.

    Rationale: Importing all classes from a package or staticmembers from a class leads to tight coupling between packagesor classes and might lead to problems when a new version of alibrary introduces name clashes.

    This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

    There are no issues that match your filters.

    Category
    Status