| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
@xeno6696 I'm not 100% sure, but I think if this was a failed test, the exception stack trace that you showed wasn't from the failed test.
First, if you look closely, you'll see this:
...
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.025 sec
Results :
Failed tests: testLoadEncryptedAndAdd(org.owasp.esapi.reference.crypto.EncryptedPropertiesUtilsTest): null expected:<jim bob> but was:<null>
Tests run: 595, Failures: 1, Errors: 0, Skipped: 0
That would seem to indicate that the failed test was in EncryptedPropertiesUtilstest.testLoadEncryptedAndAdd() rather than somewhere in EnterpriseSecurityExceptionTest. I think probably that exception stack trace that you are seeing is a legitimate (i.e., expected) stack trace that comes out as part of the logging that happens as a side effect when it is EnterpriseSecurityExceptions (and subsclasses) is thrown.
In fact, I think what you are looking at is the log message, which likely is going to stdout or stderr (both, which by default go to your "console" / terminal) since it is using JavaLogFactory for the logger. According to that stack trace, the cause is this line (line 152) in EnterpriseSecurityExceptionTest.java:
ex = new IntrusionException("m1","m2", new Throwable());
In fact, that agrees 100% of what we would expect and corresponds exactly to:
SEVERE: [SECURITY FAILURE Anonymous:null@unknown -> 10.1.43.6:80/ExampleApplication/IntrusionException] INTRUSION - m2
followed by the exception (with empty message) and stack trace.
So I think that is what is expected here.
As for why the EncryptedPropertiesUtilstest.testLoadEncryptedAndAdd() test case failed, I have no explanation without some additional details like log messages or whatever. And since we are unable reproduce it, I think that we should close this issue (especially sit it is pointing fingers at the wrong test). If someone is able to reproduce it reliably, or provide a stack trace for the actual failed test, then we can either reopen it or (my preference) create a new issue that correctly describes the
failed test case as well as how to reproduce it, etc.
So, anyone against closing this issue?
-kevin
Jeremiah discovered while investigating this that it was caused by some kind of internal dependency on the order of test method execution. (Or something like that.) Basically the tests write to a file and if the methods execute in a different order then how they were written--something possible in JUnit--you would get this oddball error. His concurrent test runner was able to identify this issue and it'll be resolved in his batch of patches.
If he ever gets a github account... ;-)
@jeremiahjstacey If you don't want to fix this, NBD, but I thought since you were already working on it, it made sense. Let me know if you want me to re-assign it.
The stack trace Matt posted originally has a bit of a red herring. I believe that the maven build was running multi-threaded (2 cores?). The actual test failure was in EncryptedPropertyUtilsTest.testLoadEncryptedAndAdd, but that failure terminated the other thread's execution which was in the EnterpriseSecurityExceptionTest which resulted in the stacktrace.
The EnterpriseSecurityExceptionTest implementation is fine.
This issue is a multi-threading issue in the EncryptedPropertyUtilsTest which relies on test ordering. The specific issue are lines 171 and 172 of testLoadEncryptedAndAdd(), which cannot be true unless the tests in this class are guaranteed to run sequentially every time. That state expectation is a carry-over from the testLoadPlaintextAndEncrypt method which places K/V-3 and K/V-4 into the ENCRYPTED_FILENAME_1 instance.
Delete lines 171 and 172 of EncryptedPropertyUtilsTest and this specific issue is resolved.
171| assertEquals(VALUE3, props.getProperty(KEY3));
172| assertEquals(VALUE4, props.getProperty(KEY4));I would recommend removing the shared file references in favor of the TemporaryFolder junit rule which can provide clean file status between tests and manage the creation/cleanup for us. This requires Junit to be upgraded to at least 4.7.
I will work on getting a correctly-configured environment to begin active project participation, but the fix for this is small enough that I don't believe it's necessary to wait for my spin-up time.
Don't know why this issue didn't close... but its fixed.
| Back | FazBrowse Home | New Git URL |
Stack trace and build error as follows:
Jan 01, 2016 5:44:22 PM org.owasp.esapi.reference.JavaLogFactory$JavaLogger log SEVERE: [SECURITY FAILURE Anonymous:null@unknown -> 10.1.43.6:80/ExampleApplication/IntrusionException] INTRUSION - m2 java.lang.Throwable at org.owasp.esapi.errors.EnterpriseSecurityExceptionTest.testExceptions(EnterpriseSecurityExceptionTest.java:152) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.025 sec Results : Failed tests: testLoadEncryptedAndAdd(org.owasp.esapi.reference.crypto.EncryptedPropertiesUtilsTest): null expected:<jim bob> but was:<null> Tests run: 595, Failures: 1, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 28.262 s [INFO] Finished at: 2016-01-01T17:44:22-06:00 [INFO] Final Memory: 28M/439M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project esapi: There are test failures. [ERROR] [ERROR] Please refer to /home/mahapralaya/gitRepos/esapi-java-legacy/target/surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException mahapralaya@kali:~/gitRepos/esapi-java-legacy$Subsequent test runs both on command line and on eclipse failed to reproduce. This means that either the test is poorly threadable, or the class under question is threaded poorly. More research is needed.