<java>
request.getResponse().setContentType("text/xml");
</java><?xml version="1.0" ?>
<ruleset name="custom">
  <description>ATG Dynamo Rules</description>  
  
  <rule name="AlwaysLogDebug" message="Avoid logDebug() without isLoggingDebug()" class="net.sourceforge.pmd.rules.XPathRule">
    <description>Use of a logDebug method without wrapping it in a isLoggingDebug() conditional.</description>
    <priority> 3 </priority>
    <properties>
      <property name="xpath">
        <value>  <![CDATA[
          //Name[@Image='logDebug' and count(ancestor::IfStatement/descendant::Name[@Image='isLoggingDebug']) = 0] 
        ]]>  </value>
      </property>
    </properties>
  </rule>  

  <rule name="AlwaysLogWarning" message="Avoid logWarning() without isLoggingWarning()" class="net.sourceforge.pmd.rules.XPathRule">
    <description>Use of a logWarning method without wrapping it in a isLoggingWarning() conditional.</description>
    <priority> 3 </priority>
    <properties>
      <property name="xpath">
        <value>  <![CDATA[
          //Name[@Image='logWarning' and count(ancestor::IfStatement/descendant::Name[@Image='isLoggingWarning']) = 0] 
        ]]>  </value>
      </property>
    </properties>
  </rule>  

  <rule name="AlwaysLogError" message="Avoid logError() without isLoggingError()" class="net.sourceforge.pmd.rules.XPathRule">
    <description>Use of a logError method without wrapping it in a isLoggingError() conditional.</description>
    <priority> 3 </priority>
    <properties>
      <property name="xpath">
        <value>  <![CDATA[
          //Name[@Image='logError' and count(ancestor::IfStatement/descendant::Name[@Image='isLoggingError']) = 0] 
        ]]>  </value>
      </property>
    </properties>
  </rule>  
  
  <rule name="AlwaysLogInfo" message="Avoid logInfo() without isLoggingInfo()" class="net.sourceforge.pmd.rules.XPathRule">
    <description>Use of a logInfo method without wrapping it in a isLoggingInfo() conditional.</description>
    <priority> 3 </priority>
    <properties>
      <property name="xpath">
        <value>  <![CDATA[
          //Name[@Image='logInfo' and count(ancestor::IfStatement/descendant::Name[@Image='isLoggingInfo']) = 0] 
        ]]>  </value>
      </property>
    </properties>
  </rule>  
  
  <rule name="LogErrorNeedsTwoArguments" message="Please use logError(msg, exception) inside a catch block" class="net.sourceforge.pmd.rules.XPathRule">
    <description>
      To aid debugging, please include as much information as possible in logError() statements
      inside a catch block.  At a minimum, this means using 
      
      logError(e.getMessage(), e);
    
      so that the stacktrace is logged with the error.
    </description>
    <priority> 3 </priority>
    <properties>
      <property name="xpath">
        <value>  <![CDATA[
          //TryStatement/descendant::Name[@Image='logError']/../following-sibling::node()[count(descendant::PrimaryExpression) = 1]
        ]]>  </value>
      </property>
    </properties>
  </rule>    
  
  <rule name="TwoArgumentDropletFormException" message="Consider using three argument form of DropletFormException" class="net.sourceforge.pmd.rules.XPathRule">
    <description>
      Be wary of using the two argument form of DropletFormException.  
      
      DropletFormException should be used in situations where an
      exception is linked to a specific property of the form handler.  Consider 
      using the three argument form:
      
      new DropletFormException(msg, getAbsoluteName() + ".propertyName", MSG_CONSTANT);
      
      or using DropletException instead.
      
      See http://tersesystems.com/post/1600003.jhtml for more details.
    </description>
    <priority> 3 </priority>
    <properties>
      <property name="xpath">
        <value>  <![CDATA[
          //Name[@Image="DropletFormException" and count(following-sibling::Arguments/ArgumentList/Expression) = 2]
        ]]>  </value>
      </property>
    </properties>
  </rule>   
     
  <!-- 
  	Not as high priority, but worth noting...
  -->
  <rule name="StringTokenizerWarning" message="StringTokenizer is vulnerable to NullPointerException" class="net.sourceforge.pmd.rules.XPathRule">
    <description>
	    StringTokenizer has a bug which will cause it to crash if given a null string, i.e.
	    
		public StringTokenizer getTokenizer(String pString) { 
		   return new StringTokenizer(pString); 
		}
		
		will crash if pString is null.  Make sure you check that the string is not null
	    before using this class.
    </description>
    <priority> 5 </priority>
    <properties>
      <property name="xpath">
        <value>  <![CDATA[
          //AllocationExpression/Name[@Image="StringTokenizer"]
        ]]>  </value>
      </property>
    </properties>
  </rule>      
    
</ruleset>
