This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug libgcj/23183] New: SimpleDateFormat fails to render '' as single quotes
- From: "hannes at helma dot at" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 1 Aug 2005 17:38:50 -0000
- Subject: [Bug libgcj/23183] New: SimpleDateFormat fails to render '' as single quotes
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When using java.text.SimpleDateFormat to render a date, single quotes encoded as
'' (see <http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html>)
in the format string are swallowed in the output. The following code
sdf = new SimpleDateFormat("''yyyy-MM-dd HH:mm:ss''");
sdf.render(new Date());
produces something like this:
2005-08-01 18:54:05
bug should actually produce:
'2005-08-01 18:54:05'
Interestingly, using single quotes to escape other text works as supposed, and
using '' next to escaped text also causes the single quotes to appear. Thus,
sdf = new SimpleDateFormat(""'' '' '''FOO''' '' ''"");
sdf.render(new Date());
produces:
'FOO'
while it shold produce:
' ' 'FOO' ' '
PS: Maybe I should have reported this bug against Classpath, but I wasn't sure
which version of classpath is used in gcj 4.0.
--
Summary: SimpleDateFormat fails to render '' as single quotes
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hannes at helma dot at
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23183