Duplicate :
|
Name: jl125535 Date: 03/23/2004 A DESCRIPTION OF THE REQUEST : Class: java.net.URLEncoder uses Class: java.io.BufferedWriter which has the following line in the constructor. lineSeparator = (String) java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction("line.separator")); I am thinking that the lineSeparator should be defined as STATIC variable in the class and it should be initialized once to avoid subsequenct security check and duplicate read on a hashtable (which has synchronized get() method). JUSTIFICATION : We are having significant performance issue when trying to use URLEncoder and we found that multiple threads are trying to System.getProperty("line.separator") from BufferedWriter (System.getProperty() is reading from a Hashtable and it has a synchronized get(), thus causing huge performance issue for us). Is it possible for you to get the line.separator as a private static variable and gets it value only once instead of getting it during every object creation. (Incident Review ID: 192587) ======================================================================