PATCH: DeflaterOutputStream.java
Carlos Valiente
kaffe@rufus.w3.org
Sun, 6 May 2001 23:21:57 +0200
--------------Boundary-00=_LCNXSHABT0SSOFL3Q23N
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Here's another fix for a problem regarding the creation of zip files. Kaffe
fails to create compressed zip files. apart from the diff, I have included a
small test program to reproduce the bug and test the fix.
--------------Boundary-00=_LCNXSHABT0SSOFL3Q23N
Content-Type: text/x-c++;
charset="iso-8859-1";
name="DeflaterOutputStream.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="DeflaterOutputStream.diff"
SW5kZXg6IERlZmxhdGVyT3V0cHV0U3RyZWFtLmphdmEKPT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL2N2
cy9rYWZmZS9rYWZmZS9saWJyYXJpZXMvamF2YWxpYi9qYXZhL3V0aWwvemlwL0RlZmxhdGVyT3V0
cHV0U3RyZWFtLmphdmEsdgpyZXRyaWV2aW5nIHJldmlzaW9uIDEuNApkaWZmIC11IC1yMS40IERl
ZmxhdGVyT3V0cHV0U3RyZWFtLmphdmEKLS0tIERlZmxhdGVyT3V0cHV0U3RyZWFtLmphdmEJMjAw
MS8wMy8wNyAwMzoyNzo0MwkxLjQKKysrIERlZmxhdGVyT3V0cHV0U3RyZWFtLmphdmEJMjAwMS8w
NS8wNiAyMToyMjozNQpAQCAtNjIsOCArNjIsMTEgQEAKIHB1YmxpYyB2b2lkIHdyaXRlKGJ5dGUg
YltdLCBpbnQgb2ZmLCBpbnQgbGVuKSB0aHJvd3MgSU9FeGNlcHRpb24gewogCWlmIChvZmYgPCAw
IHx8IGxlbiA8IDAgfHwgb2ZmICsgbGVuID4gYi5sZW5ndGgpCiAJCXRocm93IG5ldyBJbmRleE91
dE9mQm91bmRzRXhjZXB0aW9uKCk7Ci0JZGVmLnNldElucHV0KGIsIG9mZiwgbGVuKTsKLQlkZWZs
YXRlKCk7CisJCisJaWYobGVuICE9IDApIHsKKwkJZGVmLnNldElucHV0KGIsIG9mZiwgbGVuKTsK
KwkJZGVmbGF0ZSgpOworCX0KIH0KIAogcHVibGljIHZvaWQgd3JpdGUoaW50IGIpIHRocm93cyBJ
T0V4Y2VwdGlvbiB7Cg==
--------------Boundary-00=_LCNXSHABT0SSOFL3Q23N
Content-Type: text/x-java;
charset="iso-8859-1";
name="ZipTest.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="ZipTest.java"
aW1wb3J0IGphdmEuaW8uKjsKaW1wb3J0IGphdmEudXRpbC56aXAuKjsKCgpwdWJsaWMgY2xhc3Mg
WmlwVGVzdCB7CgogICAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3Mp
CgkgICAgICAgIHRocm93cyBFeGNlcHRpb24KCXsKCgkgICAgICAgIGJ1aWxkWmlwKCJ6aXB0ZXN0
MS56aXAiLCBmYWxzZSk7CgkJYnVpbGRaaXAoInppcHRlc3QyLnppcCIsIHRydWUpOwoJfQoKCXN0
YXRpYyB2b2lkIGJ1aWxkWmlwKFN0cmluZyB6aXBGaWxlLCBib29sZWFuIGNvbXByZXNzKQoJICAg
ICAgICB0aHJvd3MgRXhjZXB0aW9uCgl7CgoJCVN5c3RlbS5vdXQucHJpbnRsbigiKioqKiIpOwoJ
ICAgICAgICBTeXN0ZW0ub3V0LnByaW50KCJDcmVhdGluZyAiICsgemlwRmlsZSArICIgKCIpOwoJ
CWlmKCFjb21wcmVzcykKCQkgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoInVuIik7CiAgICAgICAg
ICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oImNvbXByZXNzZWQpIik7CgoJICAgICAgICBaaXBP
dXRwdXRTdHJlYW0gek91dCA9IG5ldyBaaXBPdXRwdXRTdHJlYW0obmV3IEZpbGVPdXRwdXRTdHJl
YW0oemlwRmlsZSkpO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