hello all, the attached patch --already committed-- delays the class initialization of DateFormat and NumberFormat classes; which otherwise may cause bootstrapping problems with some VMs.
2006-05-07 Raif S. Naffah <[EMAIL PROTECTED]>
* gnu/classpath/debug/Simple1LineFormatter.java (DAT_FORMAT): Removed.
(THREAD_FORMAT): Likewise.
(dateFormat): Added field.
(threadFormat): Added field.
(format): Initialize instance fields if null.
Use StringBuilder instead of StringBuffer.
cheers;
rsn
Index: Simple1LineFormatter.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/classpath/debug/Simple1LineFormatter.java,v
retrieving revision 1.1
diff -u -r1.1 Simple1LineFormatter.java
--- Simple1LineFormatter.java 28 Feb 2006 14:00:05 -0000 1.1
+++ Simple1LineFormatter.java 7 May 2006 07:47:43 -0000
@@ -91,20 +91,27 @@
extends Formatter
{
private static final String DAT_PATTERN = "yyyy-MM-dd HH:mm:ss.SSSS Z ";
- private static final DateFormat DAT_FORMAT = new SimpleDateFormat(DAT_PATTERN);
private static final String THREAD_PATTERN = " #########0;-#########0";
- private static final NumberFormat THREAD_FORMAT = new DecimalFormat(THREAD_PATTERN);
private static final String SPACES_32 = " ";
private static final String SPACES_6 = " ";
private static final String LS = SystemProperties.getProperty("line.separator");
+ private DateFormat dateFormat;
+ private NumberFormat threadFormat;
+
// default 0-arguments constructor
public String format(LogRecord record)
{
- StringBuffer sb = new StringBuffer(180)
- .append(DAT_FORMAT.format(new Date(record.getMillis())))
- .append(THREAD_FORMAT.format(record.getThreadID()))
+ if (dateFormat == null)
+ dateFormat = new SimpleDateFormat(DAT_PATTERN);
+
+ if (threadFormat == null)
+ threadFormat = new DecimalFormat(THREAD_PATTERN);
+
+ StringBuilder sb = new StringBuilder(180)
+ .append(dateFormat.format(new Date(record.getMillis())))
+ .append(threadFormat.format(record.getThreadID()))
.append(" ");
String s = record.getSourceClassName();
if (s == null)
pgpMyRNwrRKI7.pgp
Description: PGP signature
