Changeset 8109
- Timestamp:
- Feb 8, 2023, 1:58:34 PM (8 months ago)
- Location:
- branches/3.19-stable
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.19-stable/.classpath
r8102 r8109 36 36 <classpathentry kind="lib" path="lib/dist/postgresql-42.5.1.jar"/> 37 37 <classpathentry kind="lib" path="lib/dist/zip4j-2.11.2.jar"/> 38 <classpathentry kind="lib" path="lib/dist/commons-lang3-3.10.jar" sourcepath="C:/Users/thep-nni/AppData/Local/Temp/.org.sf.feeling.decompiler1675842571201/source/commons-lang3-3.10-sources.jar"/> 38 39 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> 39 40 <attributes> -
branches/3.19-stable/src/clients/web/net/sf/basedb/clients/web/servlet/RssNewsFeed.java
r7962 r8109 24 24 import java.nio.charset.Charset; 25 25 import java.nio.charset.StandardCharsets; 26 import java.text.SimpleDateFormat;27 26 import java.util.ArrayList; 28 27 import java.util.Date; … … 36 35 import javax.servlet.http.HttpServletResponse; 37 36 37 import org.apache.commons.lang3.time.FastDateFormat; 38 38 import org.jdom2.Document; 39 39 import org.jdom2.Element; … … 189 189 // Generate the XML document 190 190 String channelTitle = "BASE news from " + host + contextPath; 191 SimpleDateFormat rfc822 = new SimpleDateFormat("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss' 'Z", Locale.US);191 FastDateFormat rfc822 = FastDateFormat.getInstance("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss' 'Z", Locale.US); 192 192 193 193 // <rss version="2.0"> -
branches/3.19-stable/src/core/net/sf/basedb/core/DateUtil.java
r7514 r8109 23 23 package net.sf.basedb.core; 24 24 25 import java.text.SimpleDateFormat;26 25 import java.util.Calendar; 27 26 import java.util.Date; 28 27 import java.util.List; 28 29 import org.apache.commons.lang3.time.FastDateFormat; 29 30 30 31 /** … … 105 106 } 106 107 107 private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");108 private static final FastDateFormat DATE_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd"); 108 109 109 110 /** … … 133 134 catch (Exception ex2) 134 135 { 135 throw new DateFormatException("The value "+value+" is not a valid date for format: " + DATE_FORMAT. toPattern());136 throw new DateFormatException("The value "+value+" is not a valid date for format: " + DATE_FORMAT.getPattern()); 136 137 } 137 138 } … … 152 153 153 154 154 private static final SimpleDateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");155 private static final FastDateFormat TIMESTAMP_FORMAT = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss"); 155 156 156 157 /** … … 181 182 catch (Exception ex2) 182 183 { 183 throw new DateFormatException("The value "+value+" is not a valid timestamp for format: " + TIMESTAMP_FORMAT. toPattern());184 throw new DateFormatException("The value "+value+" is not a valid timestamp for format: " + TIMESTAMP_FORMAT.getPattern()); 184 185 } 185 186 } -
branches/3.19-stable/src/core/net/sf/basedb/core/File.java
r8017 r8109 60 60 import java.nio.charset.Charset; 61 61 import java.nio.charset.StandardCharsets; 62 import java.text.SimpleDateFormat;63 62 import java.util.Date; 64 63 import java.util.LinkedList; … … 69 68 70 69 import org.anarres.parallelgzip.ParallelGZIPOutputStream; 70 import org.apache.commons.lang3.time.FastDateFormat; 71 71 72 72 import java.security.MessageDigest; … … 1575 1575 1576 1576 private static final String separator = java.io.File.separator; 1577 private static final SimpleDateFormat SUBDIR_FORMAT = 1578 new SimpleDateFormat("yyyy-ww"+separator+"dd-ss"); 1577 private static final FastDateFormat SUBDIR_FORMAT = FastDateFormat.getInstance("yyyy-ww"+separator+"dd-ss"); 1579 1578 1580 1579 /** -
branches/3.19-stable/src/core/net/sf/basedb/core/migrate/DateWriter.java
r5896 r8109 27 27 import java.sql.ResultSet; 28 28 import java.sql.SQLException; 29 import java.text.DateFormat; 29 30 import org.apache.commons.lang3.time.FastDateFormat; 30 31 31 32 … … 33 34 Generic writer implementation that writes date values from a result 34 35 set. This writer use {@link ResultSet#getDate(int)} to read data from 35 the result set and the {@link DateFormat#format(java.util.Date)}36 the result set and the {@link FastDateFormat#format(java.util.Date)} 36 37 to format the value. 37 38 … … 43 44 extends AbstractResultWriter 44 45 { 45 private final DateFormat dateFormat;46 private final FastDateFormat dateFormat; 46 47 47 public DateWriter(ResultSet rs, int index, Writer writer, char[] nullEscape, DateFormat dateFormat)48 public DateWriter(ResultSet rs, int index, Writer writer, char[] nullEscape, FastDateFormat dateFormat) 48 49 { 49 50 super(rs, index, writer, nullEscape); -
branches/3.19-stable/src/core/net/sf/basedb/core/migrate/TimestampWriter.java
r5896 r8109 27 27 import java.sql.SQLException; 28 28 import java.sql.Timestamp; 29 import java.text.DateFormat; 29 30 import org.apache.commons.lang3.time.FastDateFormat; 30 31 31 32 … … 33 34 Generic writer implementation that writes timestamp values from a result 34 35 set. This writer use {@link ResultSet#getTimestamp(int)} to read data from 35 the result set and the {@link DateFormat#format(java.util.Date)}36 the result set and the {@link FastDateFormat#format(java.util.Date)} 36 37 to format the value. 37 38 … … 43 44 extends AbstractResultWriter 44 45 { 45 private final DateFormat dateFormat;46 private final FastDateFormat dateFormat; 46 47 47 public TimestampWriter(ResultSet rs, int index, Writer writer, char[] nullEscape, DateFormat dateFormat)48 public TimestampWriter(ResultSet rs, int index, Writer writer, char[] nullEscape, FastDateFormat dateFormat) 48 49 { 49 50 super(rs, index, writer, nullEscape); -
branches/3.19-stable/src/core/net/sf/basedb/core/migrate/postgres/PostgresResultWriterFactory.java
r5896 r8109 25 25 import java.sql.ResultSet; 26 26 import java.sql.Types; 27 import java.text.DateFormat; 28 import java.text.SimpleDateFormat;27 28 import org.apache.commons.lang3.time.FastDateFormat; 29 29 30 30 import net.sf.basedb.core.BaseException; … … 62 62 PostgreSQL uses 'yyyy-MM-dd' for dates. 63 63 */ 64 private final DateFormat dateFormat;64 private final FastDateFormat dateFormat; 65 65 /** 66 66 PostgreSQL uses 'yyyy-MM-dd HH:mm:ss' for timestamps. 67 67 */ 68 private final DateFormat timestampFormat;68 private final FastDateFormat timestampFormat; 69 69 70 70 private char[][] BINARY_ESCAPE; … … 75 75 { 76 76 this.NULL_ESCAPE = new char[] { '\\', 'N' }; 77 this.dateFormat = new SimpleDateFormat("yyyy-MM-dd");78 this.timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");77 this.dateFormat = FastDateFormat.getInstance("yyyy-MM-dd"); 78 this.timestampFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss"); 79 79 } 80 80 -
branches/3.19-stable/src/core/net/sf/basedb/util/HttpUtil.java
r7461 r8109 23 23 24 24 import java.io.IOException; 25 import java.text.SimpleDateFormat;26 25 import java.util.Date; 27 26 import java.util.Locale; 28 27 29 30 28 import org.apache.commons.lang3.time.FastDateFormat; 31 29 import org.apache.http.Header; 32 30 import org.apache.http.HttpResponse; … … 47 45 { 48 46 49 private static final SimpleDateFormat HTTP_DATE_FORMAT = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z", Locale.ENGLISH);47 private static final FastDateFormat HTTP_DATE_FORMAT = FastDateFormat.getInstance("EEE, d MMM yyyy HH:mm:ss z", Locale.ENGLISH); 50 48 51 49 private static UserAgentAnalyzer userAgentAnalyzer; -
branches/3.19-stable/src/core/net/sf/basedb/util/formatter/DateFormatter.java
r7646 r8109 35 35 Format a date for output in a client application. This implementation 36 36 uses the {@link SimpleDateFormat} standard formatting routines. 37 <p> 38 NOTE! The SimpleDateFormat implementation is not thread-safe which may 39 have affected instances of this class before BASE 3.19.7. Since BASE 3.19.7 40 this class has implemented synchronization and should be thread-safe. 41 But beware of the {@link #getDateFormat()} which return the underlying 42 formatter instance that is not thread-safe! 37 43 38 44 @author nicklas … … 84 90 public String format(Date value) 85 91 { 86 return value == null ? "" : dateFormat.format(value); 92 if (value == null) return ""; 93 synchronized (dateFormat) 94 { 95 return dateFormat.format(value); 96 } 87 97 } 88 98 @Override … … 92 102 try 93 103 { 94 return dateFormat.parse(value); 104 synchronized (dateFormat) 105 { 106 return dateFormat.parse(value); 107 } 95 108 } 96 109 catch (ParseException ex)
Note: See TracChangeset
for help on using the changeset viewer.