Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2006-07-12 15:18:33 -0400
committerPascal Rapicault2006-07-12 15:18:33 -0400
commit11f8aff18ec949545666a57abc2dffcde488cd32 (patch)
treed51a533a89adc636646e0713ad306da5fb88bf16
parent017073ae0915951d03aa171afe0a81bf45c07979 (diff)
downloadrt.equinox.framework-11f8aff18ec949545666a57abc2dffcde488cd32.tar.gz
rt.equinox.framework-11f8aff18ec949545666a57abc2dffcde488cd32.tar.xz
rt.equinox.framework-11f8aff18ec949545666a57abc2dffcde488cd32.zip
Bug 149892 - Equinox 3.2 Does Not Run on OSGi Min/RMv20060712
-rw-r--r--bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseLog.java36
1 files changed, 26 insertions, 10 deletions
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseLog.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseLog.java
index 860f06ec1..b4d054fbc 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseLog.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseLog.java
@@ -12,8 +12,7 @@ package org.eclipse.core.runtime.adaptor;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
+import java.util.Calendar;
import java.util.Date;
import org.eclipse.core.runtime.internal.adaptor.EclipseEnvironmentInfo;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
@@ -384,15 +383,32 @@ public class EclipseLog implements FrameworkLog {
* @return a date string.
*/
protected String getDate(Date date) {
- try {
- DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); //$NON-NLS-1$
- return formatter.format(date);
- } catch (Exception e) {
- // If there were problems writing out the date, ignore and
- // continue since that shouldn't stop us from logging the rest
- // of the information
+ Calendar c = Calendar.getInstance();
+ c.setTime(date);
+ StringBuffer sb = new StringBuffer();
+ appendPaddedInt(c.get(Calendar.YEAR), 4, sb).append('-');
+ appendPaddedInt(c.get(Calendar.MONTH) + 1, 2, sb).append('-');
+ appendPaddedInt(c.get(Calendar.DAY_OF_MONTH), 2, sb).append(' ');
+ appendPaddedInt(c.get(Calendar.HOUR_OF_DAY), 2, sb).append(':');
+ appendPaddedInt(c.get(Calendar.MINUTE), 2, sb).append(':');
+ appendPaddedInt(c.get(Calendar.SECOND), 2, sb).append('.');
+ appendPaddedInt(c.get(Calendar.MILLISECOND), 3, sb);
+ return sb.toString();
+ }
+
+ private StringBuffer appendPaddedInt(int value, int pad, StringBuffer buffer) {
+ pad = pad - 1;
+ if (pad == 0)
+ return buffer.append(Integer.toString(value));
+ int padding = (int) Math.pow(10, pad);
+ if (value >= padding)
+ return buffer.append(Integer.toString(value));
+ while (padding > value && padding > 1) {
+ buffer.append('0');
+ padding = padding / 10;
}
- return Long.toString(System.currentTimeMillis());
+ buffer.append(value);
+ return buffer;
}
/**

Back to the top