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

 ##########
 File path: 
gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlFilterReaderBase.java
 ##########
 @@ -288,19 +279,13 @@ private QName getQName( String name ) {
     }
 
     private void parseNamespaces() {
-      Attributes attributes = tag.getAttributes();
-      if( attributes != null ) {
-        for( Attribute attribute : tag.getAttributes() ) {
-          String name = attribute.getName();
-          if( name.toLowerCase(Locale.ROOT).startsWith( "xmlns" ) ) {
-            int colon = name.indexOf( ':', 5 );
-            String prefix;
-            if( colon <= 0 ) {
-              prefix = "";
-            } else {
-              prefix = name.substring( colon );
-            }
-            namespaces.put( prefix, attribute.getValue() );
+      if (tag.getAttributes() != null) {
+        String prefix;
+        for (Attribute attribute : tag.getAttributes()) {
+          if 
(attribute.getName().toLowerCase(Locale.ROOT).startsWith("xmlns")) {
 
 Review comment:
   Might help to pull `attribute.getName()` out to a local variable since it is 
used a bunch of times.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to