knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [1/3] knox git commit: KNOX-1615 - Enable PMD for source analysis
Date Mon, 10 Dec 2018 18:20:20 GMT
Repository: knox
Updated Branches:
  refs/heads/master f54e9d2d4 -> 6a35473a9


http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationServiceFactory.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationServiceFactory.java
b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationServiceFactory.java
index 200636f..a7e5dbd 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationServiceFactory.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/api/CorrelationServiceFactory.java
@@ -23,7 +23,7 @@ import org.apache.knox.gateway.audit.log4j.correlation.Log4jCorrelationService;
 public abstract class CorrelationServiceFactory {
 
   // The global correlation service instance.
-  private static CorrelationService correlationService = null;
+  private static CorrelationService correlationService;
 
   // To prevent instantiation.
   private CorrelationServiceFactory() {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/appender/JdbmQueue.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/appender/JdbmQueue.java
b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/appender/JdbmQueue.java
index f9e4f56..eb0fbd1 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/appender/JdbmQueue.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/appender/JdbmQueue.java
@@ -160,8 +160,8 @@ public class JdbmQueue<E> {
   private static final class Stat implements Serializable {
 
     private static final long serialVersionUID = 1L;
-    private long lastEnqueue = 0;
-    private long nextDequeue = 0;
+    private long lastEnqueue;
+    private long nextDequeue;
     private long size() {
       return lastEnqueue - nextDequeue;
     }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditor.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditor.java
b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditor.java
index a70887b..3050871 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditor.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/audit/log4j/audit/Log4jAuditor.java
@@ -161,7 +161,7 @@ public class Log4jAuditor implements Auditor {
             }
           }
           if (i < (query.length -1) ) {
-            newQuery.append("&");
+            newQuery.append('&');
           }
         }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/JsonPath.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/JsonPath.java
b/gateway-util-common/src/main/java/org/apache/knox/gateway/util/JsonPath.java
index d231f34..48d2e65 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/JsonPath.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/util/JsonPath.java
@@ -312,18 +312,18 @@ public class JsonPath {
 
     @Override
     public String toString() {
-      StringBuilder s = new StringBuilder();
+      StringBuilder s = new StringBuilder(32);
       s.append( "JsonPath.Expression{" );
       for( int i=0, n=segments.size(); i<n; i++ ) {
         if( i > 0 ) {
-          s.append( "," );
+          s.append(',');
         }
         s.append( "segment[" );
         s.append( i );
         s.append( "]=" );
         s.append( segments.get( i ) );
       }
-      s.append( "]" );
+      s.append(']');
       return s.toString();
     }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/X500PrincipalParser.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/X500PrincipalParser.java
b/gateway-util-common/src/main/java/org/apache/knox/gateway/util/X500PrincipalParser.java
index 7f5c52e..78199ac 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/X500PrincipalParser.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/util/X500PrincipalParser.java
@@ -57,7 +57,7 @@ public class X500PrincipalParser
 
       if (namePart.startsWith(searchPart)) {
         // Return the string starting after the ID string and the = sign that follows it.
-        retList.add(namePart.toString().substring(searchPart.length()));
+        retList.add(namePart.substring(searchPart.length()));
       }
     }
 
@@ -128,7 +128,7 @@ public class X500PrincipalParser
 
       if (namePart.startsWith(searchPart)) {
         // Return the string starting after the ID string and the = sign that follows it.
-        retNamePart = namePart.toString().substring(searchPart.length());
+        retNamePart = namePart.substring(searchPart.length());
         // By definition the first one is most significant
         if (significance == MOSTSIGNIFICANT)
           break;

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java
b/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java
index 15a09cc..9a15dba 100644
--- a/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java
+++ b/gateway-util-common/src/main/java/org/apache/knox/gateway/util/XmlUtils.java
@@ -17,10 +17,10 @@
 package org.apache.knox.gateway.util;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Writer;
+import java.nio.file.Files;
 
 import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilder;
@@ -40,7 +40,7 @@ import org.xml.sax.SAXException;
 public class XmlUtils {
 
   public static Document readXml( File file ) throws ParserConfigurationException, IOException,
SAXException {
-    return readXml( new FileInputStream( file ));
+    return readXml(Files.newInputStream(file.toPath()));
   }
 
   public static Document readXml( InputStream input ) throws ParserConfigurationException,
IOException, SAXException {
@@ -84,7 +84,7 @@ public class XmlUtils {
     }
     if ( indent ) {
       t.setOutputProperty( OutputKeys.INDENT, "yes" );
-      t.setOutputProperty( "{xml.apache.org/xslt}indent-amount", "" + indentNumber );
+      t.setOutputProperty( "{xml.apache.org/xslt}indent-amount", String.valueOf(indentNumber)
);
     }
     if ( omitXmlDeclaration ) {
       t.setOutputProperty( OutputKeys.OMIT_XML_DECLARATION, "yes" );

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-common/src/test/java/org/apache/knox/gateway/util/IpAddressValidatorTest.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/test/java/org/apache/knox/gateway/util/IpAddressValidatorTest.java
b/gateway-util-common/src/test/java/org/apache/knox/gateway/util/IpAddressValidatorTest.java
index d1d4bf5..5ca2c81 100644
--- a/gateway-util-common/src/test/java/org/apache/knox/gateway/util/IpAddressValidatorTest.java
+++ b/gateway-util-common/src/test/java/org/apache/knox/gateway/util/IpAddressValidatorTest.java
@@ -22,7 +22,7 @@ import org.junit.Test;
 public class IpAddressValidatorTest extends org.junit.Assert {
   String test = "127.0.0.1,193.*,192.168.1.*,0:0:0:0:0:0:0:1,0:0:0:0:0:0:*";
   String testWeirdConfig = ",127.0.0.1,,193.*,192.168.1.*,29*";
-  String testNullConfig = null;
+  String testNullConfig;
 
   @Test
   public void testExplicitIpAddress() throws Exception {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/ConfigurationInjectorBuilder.java
----------------------------------------------------------------------
diff --git a/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/ConfigurationInjectorBuilder.java
b/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/ConfigurationInjectorBuilder.java
index a9a4db5..dcc2c10 100755
--- a/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/ConfigurationInjectorBuilder.java
+++ b/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/ConfigurationInjectorBuilder.java
@@ -29,7 +29,7 @@ import java.util.ServiceLoader;
 public class ConfigurationInjectorBuilder {
 
   private static ConfigurationBinding DEFAULT_BINDING = new DefaultConfigurationBinding();
-  private static ConfigurationInjector INSTANCE = null;
+  private static ConfigurationInjector INSTANCE;
 
   private static synchronized ConfigurationInjector getInjector() {
     if( INSTANCE == null ) {
@@ -57,9 +57,9 @@ public class ConfigurationInjectorBuilder {
     return injector;
   }
 
-  private Object target = null;
-  private ConfigurationAdapter source = null;
-  private ConfigurationBinding binding = null;
+  private Object target;
+  private ConfigurationAdapter source;
+  private ConfigurationBinding binding;
 
   public static ConfigurationInjectorBuilder configuration() {
     return new ConfigurationInjectorBuilder();

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/impl/ConfigurationAdapterFactory.java
----------------------------------------------------------------------
diff --git a/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/impl/ConfigurationAdapterFactory.java
b/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/impl/ConfigurationAdapterFactory.java
index da9b78c..14c2589 100755
--- a/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/impl/ConfigurationAdapterFactory.java
+++ b/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/impl/ConfigurationAdapterFactory.java
@@ -31,7 +31,7 @@ import java.util.ServiceLoader;
 
 public class ConfigurationAdapterFactory {
 
-  private static Map<Class<?>, Class<? extends ConfigurationAdapter>> ADAPTERS
= null;
+  private static Map<Class<?>, Class<? extends ConfigurationAdapter>> ADAPTERS;
 
   private static synchronized Map<Class<?>, Class<? extends ConfigurationAdapter>>
getAdapters() {
     if( ADAPTERS == null ) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/AdapterSampleTest.java
----------------------------------------------------------------------
diff --git a/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/AdapterSampleTest.java
b/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/AdapterSampleTest.java
index d6030dd..8d85462 100755
--- a/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/AdapterSampleTest.java
+++ b/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/AdapterSampleTest.java
@@ -30,7 +30,7 @@ public class AdapterSampleTest {
 
   private static class Target {
     @Configure
-    private String username = null;
+    private String username;
   }
 
   private static class Adapter implements ConfigurationAdapter {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/FuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/FuncTest.java
b/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/FuncTest.java
index 7e40212..3452c95 100755
--- a/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/FuncTest.java
+++ b/gateway-util-configinjector/src/test/java/org/apache/knox/gateway/config/FuncTest.java
@@ -72,7 +72,7 @@ public class FuncTest {
     }
     String multiArgStringField = "default";
     Integer multiArgIntegerField = 0;
-    int multiArgIntField = 0;
+    int multiArgIntField;
 
   }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Launcher.java
----------------------------------------------------------------------
diff --git a/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Launcher.java
b/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Launcher.java
index 92092dc..58700e2 100644
--- a/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Launcher.java
+++ b/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Launcher.java
@@ -18,7 +18,6 @@
 package org.apache.knox.gateway.launcher;
 
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -27,6 +26,7 @@ import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.util.Properties;
 
 public class Launcher {
@@ -116,7 +116,7 @@ public class Launcher {
   private static void createExternalConfig( File file, Properties config, URL src ) throws
IOException {
     try {
       if( file.createNewFile() ){
-        try (OutputStream output = new FileOutputStream(file)) {
+        try (OutputStream output = Files.newOutputStream(file.toPath())) {
           config.store(output, "Created from " + src);
         }
       }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Expander.java
----------------------------------------------------------------------
diff --git a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Expander.java
b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Expander.java
index abf9b6b..d239b0a 100644
--- a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Expander.java
+++ b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Expander.java
@@ -70,7 +70,7 @@ public class Expander {
     Segment segment = template.getScheme();
     if( segment != null ) {
       expandSingleValue( template.getScheme(), names, params, evaluator, builder );
-      builder.append( ":" );
+      builder.append(':');
     }
   }
 
@@ -85,17 +85,17 @@ public class Expander {
       Segment port = template.getPort();
       expandSingleValue( username, names, params, evaluator, builder );
       if( password != null ) {
-        builder.append( ":" );
+        builder.append(':');
         expandSingleValue( password, names, params, evaluator, builder );
       }
       if( username != null || password != null ) {
-        builder.append( "@" );
+        builder.append('@');
       }
       if( host != null ) {
         expandSingleValue( host, names, params, evaluator, builder );
       }
       if( port != null ) {
-        builder.append( ":" );
+        builder.append(':');
         expandSingleValue( port, names, params, evaluator, builder );
       }
     }
@@ -103,12 +103,12 @@ public class Expander {
 
   private static void expandPath( Template template, Set<String> names, Params params,
Evaluator evaluator, StringBuilder builder ) {
     if( template.isAbsolute() ) {
-      builder.append( "/" );
+      builder.append('/');
     }
     List<Path> path = template.getPath();
     for( int i=0, n=path.size(); i<n; i++ ) {
       if( i > 0 ) {
-        builder.append( "/" );
+        builder.append('/');
       }
       Path segment = path.get( i );
       String name = segment.getParamName();
@@ -130,7 +130,7 @@ public class Expander {
       }
     }
     if( template.isDirectory() && !path.isEmpty() ) {
-      builder.append( "/" );
+      builder.append('/');
     }
   }
 
@@ -141,7 +141,7 @@ public class Expander {
       if( type == Segment.GLOB || type == Segment.DEFAULT ) {
         for( int i=0, n=values.size(); i<n; i++ ) {
           if( i > 0 ) {
-            builder.append( "/" );
+            builder.append( '/' );
           }
           builder.append( values.get( i ) );
         }
@@ -169,9 +169,9 @@ public class Expander {
       for (Query query1 : query) {
         int i = index.incrementAndGet();
         if (i == 1) {
-          builder.append("?");
+          builder.append('?');
         } else {
-          builder.append("&");
+          builder.append('&');
         }
         String queryName = query1.getQueryName();
         String paramName = query1.getParamName();
@@ -183,7 +183,7 @@ public class Expander {
             builder.append(queryName);
             String pattern = value.getOriginalPattern();
             if (pattern != null) {
-              builder.append("=");
+              builder.append('=');
               builder.append(pattern);
             }
             break;
@@ -214,13 +214,13 @@ public class Expander {
           for( String value: values ) {
             int i = index.incrementAndGet();
             if( i == 1 ) {
-              builder.append( "?" );
+              builder.append('?');
             } else {
-              builder.append( "&" );
+              builder.append('&');
             }
             appendQueryPart(name, builder);
             if( value != null ) {
-              builder.append( "=" );
+              builder.append('=');
               appendQueryPart(value, builder);
             }
           }
@@ -238,12 +238,12 @@ public class Expander {
       if( type == Segment.GLOB || type == Segment.DEFAULT ) {
         for( int i=0, n=values.size(); i<n; i++ ) {
           if( i > 0 ) {
-            builder.append( "&" );
+            builder.append('&');
           }
           appendQueryPart(queryName, builder);
           value = values.get( i );
           if( value != null ) {
-            builder.append( "=" );
+            builder.append('=');
             appendQueryPart(value, builder);
           }
         }
@@ -251,7 +251,7 @@ public class Expander {
         appendQueryPart(queryName, builder);
         value = values.get( 0 );
         if( value != null ) {
-          builder.append( "=" );
+          builder.append('=');
           appendQueryPart(value, builder);
         }
       }
@@ -268,7 +268,7 @@ public class Expander {
 
   private static void expandFragment( Template template, Set<String> names, Params
params, Evaluator evaluator, StringBuilder builder ) {
     if( template.hasFragment() ) {
-      builder.append( "#" );
+      builder.append('#');
     }
     expandSingleValue( template.getFragment(), names, params, evaluator, builder );
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Function.java
----------------------------------------------------------------------
diff --git a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Function.java
b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Function.java
index bb13109..e11c5a3 100644
--- a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Function.java
+++ b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Function.java
@@ -25,9 +25,9 @@ class Function {
 
   private enum State { UNKNOWN, FUNCTION, VARIABLE, LITERAL }
 
-  private String funcName = null;
-  private String paramName = null;
-  private List<String> paramValue = null;
+  private String funcName;
+  private String paramName;
+  private List<String> paramValue;
 
   static List<String> evaluate( String statement, Resolver resolver, Evaluator evaluator
) {
     Function function = new Function( statement );

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Segment.java
----------------------------------------------------------------------
diff --git a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Segment.java
b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Segment.java
index 04dd89f..67c284e 100644
--- a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Segment.java
+++ b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Segment.java
@@ -143,15 +143,15 @@ abstract class Segment {
     } else if( values.isEmpty() ) {
       s.append( "empty" );
     } else {
-      s.append( "[" );
+      s.append('[');
       Iterator i = values.iterator();
       while( i.hasNext() ) {
         s.append( i.next() );
         if( i.hasNext() ) {
-          s.append( "," );
+          s.append(',');
         }
       }
-      s.append( "]" );
+      s.append(']');
     }
     return s.toString();
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Template.java
----------------------------------------------------------------------
diff --git a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Template.java
b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Template.java
index ca830f1..1293646 100644
--- a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Template.java
+++ b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Template.java
@@ -171,7 +171,7 @@ public class Template {
           b.append( ':' );
           buildSegmentValue( b, password, password.getFirstValue() );
         }
-        b.append( "@" );
+        b.append( '@' );
       }
       if( host != null ) {
         buildSegmentValue( b, host, host.getFirstValue() );
@@ -186,7 +186,7 @@ public class Template {
   private void buildSegmentValue( StringBuilder b, Segment s, Segment.Value v ) {
     String paramName = s.getParamName();
     if( paramName != null && !paramName.isEmpty()) {
-      b.append( "{" );
+      b.append( '{' );
       b.append( s.getParamName() );
       String actualPattern = v.getToken().originalPattern;
       if( ( actualPattern != null ) && ( v.getType() != Segment.DEFAULT ) )  {
@@ -213,7 +213,7 @@ public class Template {
       String paramName = segment.getParamName();
       Segment.Value firstValue = segment.getFirstValue();
       if( paramName != null && !paramName.isEmpty()) {
-        b.append( "{" );
+        b.append( '{' );
         b.append( segment.getParamName() );
         String pattern = firstValue.getOriginalPattern();
         if( pattern != null && !pattern.isEmpty() ) {
@@ -284,9 +284,9 @@ public class Template {
     if( paramName != null && !paramName.isEmpty()) {
       if( !Segment.GLOB_PATTERN.equals( queryName ) && !Segment.STAR_PATTERN.equals(
queryName ) ) {
         b.append( segment.getQueryName() );
-        b.append( "=" );
+        b.append( '=' );
       }
-      b.append( "{" );
+      b.append( '{' );
       b.append( segment.getParamName() );
       if( valuePattern != null ) {
         b.append( '=' );
@@ -296,7 +296,7 @@ public class Template {
     } else {
       b.append( queryName );
       if( valuePattern != null ) {
-        b.append( "=" );
+        b.append( '=' );
         b.append( valuePattern );
       }
     }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1b8db03..3bcc455 100644
--- a/pom.xml
+++ b/pom.xml
@@ -197,6 +197,7 @@
         <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
         <maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
         <maven-enforcer-plugin.version>3.0.0-M2</maven-enforcer-plugin.version>
+        <maven-pmd-plugin.version>3.11.0</maven-pmd-plugin.version>
         <metrics.version>4.0.3</metrics.version>
         <nimbus-jose-jwt.version>6.0.2</nimbus-jose-jwt.version>
         <okhttp.version>2.7.5</okhttp.version>
@@ -618,6 +619,32 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <version>${maven-pmd-plugin.version}</version>
+                <configuration>
+                    <rulesets>
+                        <ruleset>build-tools/pmd/pmd-ruleset.xml</ruleset>
+                    </rulesets>
+                    <printFailingErrors>true</printFailingErrors>
+                    <targetJdk>1.8</targetJdk>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.knox</groupId>
+                        <artifactId>build-tools</artifactId>
+                        <version>1.0.0</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
         </plugins>
     </build>
 
@@ -661,6 +688,15 @@
                     </reportSet>
                 </reportSets>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <configuration>
+                    <rulesets>
+                        <ruleset>build-tools/pmd/pmd-ruleset.xml</ruleset>
+                    </rulesets>
+                </configuration>
+            </plugin>
         </plugins>
     </reporting>
 


Mime
View raw message