2 Replies Latest reply: Sep 27, 2008 4:03 PM by 843810 RSS

    JavaDocError: Utility classes should not have a public or default construct

    843810
      Hello all,

      I am trying to comply with some check style errors that i am getting and i cannot seem to figure out what is going on. I have set all non-data members to private, except for call point public static void main(string[] args) and i am still getting this error. "Utility classes should not have a public or default constructor." I cannot figure out what is going on, any help would be greatly welcomed. My code is posted below.
      public final class Main
      {
          /**
           * Constant Data Member: RECTANGLE
           * Purpose: contains the constant string representing a rectangle.
           * @deprecated RECTANGLE Representitive string value for a rectangle.
           */ 
          public static final String RECTANGLE = "rectangle";
          /**
           * Constant Data Member: TRIANGLE
           * Purpose: contains the constant string representing a triangle.
           * @deprecated TRIANGLE Representitive string value for a triangle. 
           */
          public static final String TRIANGLE = "triangle";
          /**
           * Constant Data Member: REGEX_NUMBER_TEST
           * Purpose: contains the constant for numerical test within regex method.
           * @deprecated REGEX_NUMBER_TEST regex string for digit comparison. 
           */
          public static final String REGEX_NUMBER_TEST = "^[0-9]+$";
          /**
           * Constant Data Member: MAX_ARGUMENTS_RECTANGLE
           * Purpose: contains the constant for the maximum number of allowed 
           *          arguments coming in from the command line.
           * @deprecated MAX_ARGUMENTS_RECTANGLE constant for rectangle argument.
           *                                      limit.
           */
          public static final int MAX_ARGUMENTS_RECTANGLE = 3;
          /**
           * Constant Data Member: MAX_ARGUMENTS_TRIANGLE
           * Purpose: contains the constant for the maximum number of allowed 
           *          arguments coming in from the command line, in the case of a
           *          triangle object. 
           * @deprecated MAX_ARGUMENTS_TRIANGLE constant for triangle argument limit.
           */
          public static final int MAX_ARGUMENTS_TRIANGLE = 2;
          /**
           * Method: main
           * Purpose: Is the execution point for the program. It is in charge of
           *          initiating validation and the creation and application of
           *          objects and their related draw methods.
           * @param args input from the user.
           */
          public static void main(final String[] args)
          {
              String objectType = null;
              int width = 0;
              int height = 0;
              
              if(args.length > MAX_ARGUMENTS_RECTANGLE || args.length < 
                  MAX_ARGUMENTS_TRIANGLE || (args.length == MAX_ARGUMENTS_TRIANGLE &&
                  !isTriangle(args[0])))
              {
                   // fails
                  outputErrorMessage();
              } 
              else
              {
                  if ((isTriangle(args[0]) && args.length > MAX_ARGUMENTS_TRIANGLE) ||
                      (!isTriangle(args[0]) && args.length > MAX_ARGUMENTS_RECTANGLE))
                  {
                      // fails becuase triangle should only have one argument
                      outputErrorMessage();
                  } 
                  else
                  {
                      // passes and proceed
                      objectType = args[0];
                      if (validNumber(args[1]))
                      {
                          width = Integer.parseInt(args[1]);
                          if(width == 0)
                          {
                              outputErrorMessage();
                          } 
                          else
                          {
      ....