peval / owasp-esapi-java

Automatically exported from code.google.com/p/owasp-esapi-java
Other
0 stars 0 forks source link

JavaLogFactory not thread safe #280

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

        for (int i = 0; i < 5000; ++i) {
            new Thread(new Runnable() {
                    public void run() {
                        ESAPI.getLogger(String.valueOf(Math.random()));
                    }
                }).start();
        }

What is the expected output? What do you see instead?
Expect the program to finish, doesn't always finish.  Non-synchronized 
puts/gets to HashMap can result in an infinite loop.

What version of the product are you using? On what operating system?
esapi-2.0.1.jar
$ java -version
java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) Server VM (build 20.7-b02, mixed mode)

Please provide any additional information below.
Should use Collections.synchronizedMap or ConcurrentHashMap

Original issue reported on code.google.com by mike.til...@gmail.com on 26 Jul 2012 at 2:07