sonatype-lift[bot] commented on a change in pull request #227: URL: https://github.com/apache/solr/pull/227#discussion_r673387063
########## File path: solr/solrj/src/java/org/apache/solr/common/util/ObjectReleaseTracker.java ########## @@ -57,49 +55,55 @@ public static void clear() { * @return null if ok else error message */ public static String checkEmpty() { - String error = null; - Set<Entry<Object,String>> entries = OBJECTS.entrySet(); + if (OBJECTS.isEmpty()) { + return null; + } - if (entries.size() > 0) { - List<String> objects = new ArrayList<>(); - for (Entry<Object,String> entry : entries) { - objects.add(entry.getKey().getClass().getSimpleName()); - } - - error = "ObjectTracker found " + entries.size() + " object(s) that were not released!!! " + objects + "\n"; - for (Entry<Object,String> entry : entries) { - error += entry.getValue() + "\n"; - } + StringBuilder error = new StringBuilder(); + error.append("ObjectTracker found ").append(OBJECTS.size()).append(" object(s) that were not released!!! "); + + Set<Entry<Object, Exception>> entries = OBJECTS.entrySet(); + + ArrayList<String> objects = new ArrayList<>(OBJECTS.size()); + for (Object object : OBJECTS.keySet()) { + Class<?> clazz = object.getClass(); + objects.add(clazz.isAnonymousClass() ? clazz.getSuperclass().getSimpleName() : clazz.getSimpleName()); + } + error.append(objects).append("\n"); + + for (Entry<Object, Exception> entry : entries) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + entry.getValue().printStackTrace(pw); Review comment: *INFORMATION_EXPOSURE_THROUGH_AN_ERROR_MESSAGE:* Possible information exposure through an error message [(details)](https://find-sec-bugs.github.io/bugs.htm#INFORMATION_EXPOSURE_THROUGH_AN_ERROR_MESSAGE) (at-me [in a reply](https://help.sonatype.com/lift) with `help` or `ignore`) -- 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. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org