You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2019/11/18 17:26:54 UTC

[GitHub] [knox] risdenk commented on a change in pull request #201: KNOX-2131 - Fixed sonarcloud bugs

risdenk commented on a change in pull request #201: KNOX-2131 - Fixed sonarcloud bugs
URL: https://github.com/apache/knox/pull/201#discussion_r347508488
 
 

 ##########
 File path: gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlFilterReaderBase.java
 ##########
 @@ -264,19 +262,12 @@ private String getNamespace( String prefix ) {
       return getNamespaces().get( prefix );
     }
 
-    private QName getQName( String name ) {
-      String prefix;
-      String local;
-      int colon = ( name == null ? -1 : name.indexOf( ':' ) );
-      if( colon < 0 ) {
-        prefix = "";
-        local = name;
-      } else {
-        prefix = name.substring( 0, colon );
-        local = ( colon + 1 < name.length() ? name.substring( colon + 1 ) : "" );
-      }
-      String namespace = getNamespace( prefix );
-      return new QName( namespace, local, prefix );
+    private QName getQName(String name) {
+      final int colon = name == null ? -1 : name.indexOf(':');
+      final String prefix = name != null && colon > 0 ? name.substring(0, colon) : "";
 
 Review comment:
   Might make sense for helper methods like `getPrefix` and `getLocal`. The `local` processing is a bit involved for one line.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services