diff options
author | Jiri Vanek <[email protected]> | 2012-12-03 18:08:38 +0100 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2012-12-03 18:08:38 +0100 |
commit | 7aff0a246448bef22d89859b07fef92c128e14e5 (patch) | |
tree | e37515083680cbdde1dc32a6d41b972cefdc4e6d /tests/test-extensions | |
parent | 5c844362f517ee6704ff66d96c24c4f82b45374c (diff) |
Fixed logging bottleneck
Xml logging is now filtering not-unicode characters.
Logging have more propper test-method recognition
Diffstat (limited to 'tests/test-extensions')
-rw-r--r-- | tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java | 22 | ||||
-rw-r--r-- | tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java | 25 |
2 files changed, 43 insertions, 4 deletions
diff --git a/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java b/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java index 54fa248..75db3b5 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java +++ b/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java @@ -117,7 +117,7 @@ public class LoggingBottleneck { String testName = testLog.getKey(); String testLogs = testLog.getValue().toString(); w.write("<" + TESTLOG_ELEMENT + " " + TESTMETHOD_ATTRIBUTE + "=\"" + testName + "\" " + FULLID_ATTRIBUTE + "=\"" + className + "." + testName + "\" >"); - w.write(testLogs); + w.write(clearChars(testLogs)); w.write("</" + TESTLOG_ELEMENT + ">"); } w.write("</" + CLASSLOG_ELEMENT + ">"); @@ -215,4 +215,24 @@ public class LoggingBottleneck { DEFAULT_STDLOGS_WRITER.newLine(); DEFAULT_STDLOGS_WRITER.flush(); } + + public static String clearChars(String ss) { + StringBuilder s = new StringBuilder(ss); + for (int i = 0; i < s.length(); i++) { + char q = s.charAt(i); + if (q == '\n') { + continue; + } + if (q == '\t') { + continue; + } + int iq = (int) q; + if ((iq <= 31 || iq > 65533)||(iq >= 64976 && iq <= 65007)) { + s.setCharAt(i, 'I'); + s.insert(i + 1, "NVALID_CHAR_" + iq); + i--; + } + } + return s.toString(); + } } diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java index c0dd525..12fde78 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java @@ -783,8 +783,27 @@ public class ServerAccess { //probablky it is necessary to get out of net.sourceforge.jnlp. //package where are right now all test-extensions //for now keeping exactly the three clases helping yo acces the log - if (!stack[i].getClassName().startsWith("net.sourceforge.jnlp.")) { - break; + try { + Class clazz = Class.forName(stack[i].getClassName()); + String path = null; + try { + path = clazz.getProtectionDomain().getCodeSource().getLocation().getPath(); + } catch (NullPointerException ex) { + //silently ignoring and continuing with null path + } + if (path != null && path.contains("/tests.build/")) { + if (!path.contains("/test-extensions/")) { + break; + } + } else { + //running from ide + if (!stack[i].getClassName().startsWith("net.sourceforge.jnlp.")) { + break; + } + } + } catch (ClassNotFoundException ex) { + ///should not happen, searching only for already loaded class + ex.printStackTrace(); } } //if nothing left in stack then we have been in ServerAccess already @@ -793,7 +812,7 @@ public class ServerAccess { if (i >= stack.length) { return result; } - //now we are out of net.sourceforge.jnlp.* + //now we are out of test-extensions //method we need (the test) is highest from following class baseClass = stack[i].getClassName(); for (; i < stack.length; i++) { |