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:
[email protected]
With regards,
Apache Git Services