From 729661318d12de20e0a9f31be7d7cd9e5f6e67ee Mon Sep 17 00:00:00 2001 From: mrglavas Date: Fri, 17 Jun 2005 19:26:53 +0000 Subject: [PATCH] Merge in Performance Fix from the tck-jaxp-1_2_0 branch: When reading the service provider name from a jar a BufferedReader is used to read the first line from the file. BufferedReader's default buffer size is 8K chars. Since we're only reading one line (the name of a class) this is pretty excessive. Reducing this size significantly to 80 chars. git-svn-id: https://svn.apache.org/repos/asf/xml/commons/trunk@226237 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/javax/xml/datatype/FactoryFinder.java | 11 ++++++++--- .../external/src/javax/xml/parsers/FactoryFinder.java | 11 ++++++++--- .../src/javax/xml/transform/FactoryFinder.java | 11 ++++++++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/java/external/src/javax/xml/datatype/FactoryFinder.java b/java/external/src/javax/xml/datatype/FactoryFinder.java index 29fb775..42ecbdb 100644 --- a/java/external/src/javax/xml/datatype/FactoryFinder.java +++ b/java/external/src/javax/xml/datatype/FactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,6 +64,11 @@ class FactoryFinder { *

Take care of restrictions imposed by java security model

*/ private static SecuritySupport ss = new SecuritySupport(); + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; /** *

Check to see if debugging enabled by property.

@@ -277,9 +282,9 @@ class FactoryFinder { BufferedReader rd; try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); } String factoryClassName = null; diff --git a/java/external/src/javax/xml/parsers/FactoryFinder.java b/java/external/src/javax/xml/parsers/FactoryFinder.java index ad11f08..9f95ff3 100644 --- a/java/external/src/javax/xml/parsers/FactoryFinder.java +++ b/java/external/src/javax/xml/parsers/FactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,11 @@ class FactoryFinder { static Properties cacheProps= new Properties(); static SecuritySupport ss = new SecuritySupport() ; static boolean firstTime = true; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; // Define system property "jaxp.debug" to get output static { @@ -260,9 +265,9 @@ class FactoryFinder { // jkesselm] BufferedReader rd; try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); } String factoryClassName = null; diff --git a/java/external/src/javax/xml/transform/FactoryFinder.java b/java/external/src/javax/xml/transform/FactoryFinder.java index e01f212..8869543 100644 --- a/java/external/src/javax/xml/transform/FactoryFinder.java +++ b/java/external/src/javax/xml/transform/FactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,11 @@ class FactoryFinder { static Properties cacheProps= new Properties(); static SecuritySupport ss = new SecuritySupport() ; static boolean firstTime = true; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; // Define system property "jaxp.debug" to get output static { @@ -260,9 +265,9 @@ class FactoryFinder { // jkesselm] BufferedReader rd; try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); } String factoryClassName = null;