Description
Hello!
We've checked your project with static code analyzer AppChecker and it found several possible defects:
1) https://github.com/apache/karaf/blob/d2894bfabaa73baa63f73675df1b4ae980528517/web/src/main/java/org/apache/karaf/web/internal/WebContainerServiceImpl.java#L85
contextPath.trim();
contextPath is not changed. Probably it should be:
contextPath = contextPath.trim();
if (repository.equals(repository)) {
repository is compared with itself. Probably it should be:
if (this.repository.equals(repository)) {
enableGeneration = !"feature".equals(packaging) && !"feature".equals(packaging);
!"feature".equals(packaging) is checked twice
return metadata != null && (checkTableExists(tableName.toLowerCase(), metadata) // || checkTableExists(tableName.toLowerCase(), metadata));
checkTableExists(tableName.toLowerCase(), metadata) is checked twice
5) Not a bug, pedantic remark
https://github.com/apache/karaf/blob/d2894bfabaa73baa63f73675df1b4ae980528517/shell/core/src/main/java/org/apache/karaf/shell/support/table/ShellTable.java#L166
if (ps.getClass().getName().equals("org.apache.felix.gogo.runtime.threadio.ThreadPrintStream")) {
Not recommended to comparising of classes by name. See:
https://cwe.mitre.org/data/definitions/486.html
https://www.securecoding.cert.org/confluence/display/java/OBJ09-J.+Compare+classes+and+not+class+names
We hope this was helpful