equal
deleted
inserted
replaced
41 * |
41 * |
42 * @author Santiago.PericasGeertsen@sun.com |
42 * @author Santiago.PericasGeertsen@sun.com |
43 * @author Huizhe.Wang@oracle.com |
43 * @author Huizhe.Wang@oracle.com |
44 */ |
44 */ |
45 class FactoryFinder { |
45 class FactoryFinder { |
|
46 private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xalan.internal."; |
46 |
47 |
47 /** |
48 /** |
48 * Internal debug flag. |
49 * Internal debug flag. |
49 */ |
50 */ |
50 private static boolean debug = false; |
51 private static boolean debug = false; |
167 * @param useServicesMechanism True use services mechanism |
168 * @param useServicesMechanism True use services mechanism |
168 */ |
169 */ |
169 static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader, boolean useServicesMechanism) |
170 static Object newInstance(String className, ClassLoader cl, boolean doFallback, boolean useBSClsLoader, boolean useServicesMechanism) |
170 throws ConfigurationError |
171 throws ConfigurationError |
171 { |
172 { |
|
173 // make sure we have access to restricted packages |
|
174 if (System.getSecurityManager() != null) { |
|
175 if (className != null && className.startsWith(DEFAULT_PACKAGE)) { |
|
176 cl = null; |
|
177 useBSClsLoader = true; |
|
178 } |
|
179 } |
|
180 |
172 try { |
181 try { |
173 Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader); |
182 Class providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader); |
174 Object instance = null; |
183 Object instance = null; |
175 if (!useServicesMechanism) { |
184 if (!useServicesMechanism) { |
176 instance = newInstanceNoServiceLoader(providerClass); |
185 instance = newInstanceNoServiceLoader(providerClass); |