axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Gonia <phil.go...@adelphia.net>
Subject Programming Meticulous coDe
Date Sat, 22 Apr 2006 19:21:34 GMT
Hi all,

I am developing an application that uses Axis (1.3). All my
development is supported through the use of NetBeans 5.0.

I recently installed a NB plugin called PMD (Programming Meticulous
coDe ... informal meaning), which allows a programmer to perform
automated code inspections based on various
coding rules. (see http://pmd.sourceforge.net/rules/index.html)

Yesterday I managed to start to work through a set of reported issues
by the PMD plugin. The following is related to ten issues identified
to a class within my application that was auto-generated by the
Axis msdl2java tool.

First the PMD "Unused Code Rule" rule at issue here is the following:

"UnusedFormalParameter -- Avoid passing parameters to methods or
constructors and then not using those parameters."

(Aside from the fact that the following appears to not correctly
represent the reported code rule it has raised a question in
my mind that would be nice to understand.)

Here is the code at issue, as related to this e-mail. I have entered
my questions within the code.

      // Class SoapBindingStub constructor.
      public SoapBindingStub(javax.xml.rpc.Service service)
      throws org.apache.axis.AxisFault
      {
          if (service == null)
          {
              super.service = new org.apache.axis.client.Service();
          }
          else
          {
              super.service = service;
          }

          ((org.apache.axis.client.Service)super.service).
                  setTypeMappingVersion("1.2");

          java.lang.Class cls;

          javax.xml.namespace.QName qName;

          javax.xml.namespace.QName qName2;

          // Each of the following ten local variables were tagged as
          // breaking the stated rule above. This does not appear to
          // completely represent the rule as outlined on the
          // PMD web site. But I have to admit, what is the reason for
          // these variables? They are local to this constructor and
          // yet are not used.
          java.lang.Class beansf = org.apache.axis.encoding.ser.
                  BeanSerializerFactory.class;

          java.lang.Class beandf = org.apache.axis.encoding.ser.
                  BeanDeserializerFactory.class;

          java.lang.Class enumsf = org.apache.axis.encoding.ser.
                  EnumSerializerFactory.class;

          java.lang.Class enumdf = org.apache.axis.encoding.ser.
                  EnumDeserializerFactory.class;

          java.lang.Class arraysf = org.apache.axis.encoding.ser.
                  ArraySerializerFactory.class;

          java.lang.Class arraydf = org.apache.axis.encoding.ser.
                  ArrayDeserializerFactory.class;

          java.lang.Class simplesf = org.apache.axis.encoding.ser.
                  SimpleSerializerFactory.class;

          java.lang.Class simpledf = org.apache.axis.encoding.ser.
                  SimpleDeserializerFactory.class;

          java.lang.Class simplelistsf = org.apache.axis.encoding.ser.
                  SimpleListSerializerFactory.class;

          java.lang.Class simplelistdf = org.apache.axis.encoding.ser.
                  SimpleListDeserializerFactory.class;

          qName = new javax.xml.namespace.QName(_URN,
                  "ArrayOf_soapenc_string");

          cachedSerQNames.add(qName);

          cls = java.lang.String[].class;

          cachedSerClasses.add(cls);

          qName = new javax.xml.namespace.QName(
                  _NAMESPACE_URI, _LOCALPART);

          qName2 = null;
          cachedSerFactories.add(new org.apache.axis.encoding.ser.
                  ArraySerializerFactory(qName, qName2));

          cachedDeserFactories.add(new org.apache.axis.encoding.ser.
                  ArrayDeserializerFactory());

      }

Philip


Mime
View raw message