[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] ResourceBundle
From: |
Mark Wielaard |
Subject: |
Re: [cp-patches] ResourceBundle |
Date: |
Sat, 27 Nov 2004 23:03:20 +0100 |
Hi,
On Sat, 2004-11-27 at 17:35, Mark Wielaard wrote:
> 2004-11-27 Mark Wielaard <address@hidden>
>
> * java/util/zip/ZipFile.java (KNOWN_EXTRA): New static field.
> (setExtra): Don't parse bytes.
> (parseExtra): New private method.
> (getTime): Call parseExtra.
>
> This solves the startup problem for me (with the GNU Classpath
> examples.zip since that one is created by a zip implementation that sets
> the extra bytes to contain additional time information).
>
> What do you think?
You are probably thinking "where is the patch!?!".
Here it is...
Index: java/util/zip/ZipEntry.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/zip/ZipEntry.java,v
retrieving revision 1.14
diff -u -r1.14 ZipEntry.java
--- java/util/zip/ZipEntry.java 22 Oct 2004 18:02:06 -0000 1.14
+++ java/util/zip/ZipEntry.java 27 Nov 2004 17:04:00 -0000
@@ -55,6 +55,7 @@
private static final int KNOWN_CSIZE = 2;
private static final int KNOWN_CRC = 4;
private static final int KNOWN_TIME = 8;
+ private static final int KNOWN_EXTRA = 16;
private static Calendar cal;
@@ -186,7 +187,10 @@
{
if ((known & KNOWN_TIME) == 0)
return -1;
-
+
+ // The extra bytes might contain the time (posix/unix extension)
+ parseExtra ();
+
int sec = 2 * (dostime & 0x1f);
int min = (dostime >> 5) & 0x3f;
int hrs = (dostime >> 11) & 0x1f;
@@ -317,10 +321,23 @@
this.extra = null;
return;
}
-
if (extra.length > 0xffff)
throw new IllegalArgumentException();
this.extra = extra;
+ }
+
+ private void parseExtra()
+ {
+ // Already parsed?
+ if ((known & KNOWN_EXTRA) != 0)
+ return;
+
+ if (extra == null)
+ {
+ known |= KNOWN_EXTRA;
+ return;
+ }
+
try
{
int pos = 0;
@@ -351,6 +368,8 @@
/* be lenient */
return;
}
+
+ known |= KNOWN_EXTRA;
}
/**
signature.asc
Description: This is a digitally signed message part