harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Svetlana Samoilenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-86) java.util.zip.Inflater.needsDictionary() throws unspecified IllegalStateException
Date Fri, 10 Feb 2006 07:30:55 GMT
java.util.zip.Inflater.needsDictionary() throws unspecified IllegalStateException
---------------------------------------------------------------------------------

         Key: HARMONY-86
         URL: http://issues.apache.org/jira/browse/HARMONY-86
     Project: Harmony
        Type: Bug
  Components: Classlib  
    Reporter: Svetlana Samoilenko


According to the j2se 1.4 and 1.5 specification java.util.zip.needsDictionary() method must
not throw any exception.
Harmony throws unspecified IllegalStateException that contradicts specification.

Code to reproduce: 
import java.util.zip.*; 
public class test2 { 
    public static void main(String args[]) { 
        Inflater inf = new Inflater(); 
        System.out.println("Inflater.needsDictionary() = "+inf.needsDictionary()); 
    } 
}

Steps to Reproduce: 
1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. 
2. Compile test2.java using BEA 1.4 javac 
> javac -d . test2.java 
3. Run java using compatible VM (J9) 
> java -showversion test2

Output: 
C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 
java version "1.4.2_04" 
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) 
BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads,
GC strategy: parallel) 
Inflater.needsDictionary() = true

C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 
(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. 
java.lang.IllegalStateException
        at java.util.zip.Inflater.needsDictionary(Inflater.java:212)
        at test2.main(test2.java:8)

Siggested fix: to remove the lines in needsDictionary() method in archive/src/main/java/java/util/zip/Inflater.java
:   
         211              if (inputBuffer == null)
         212                    throw new IllegalStateException();

 Suggested junit test case:
------------------------ InflaterTest.java -------------------------------------------------

import java.util.zip.*;
import junit.framework.*; 

public class InflaterTest extends TestCase { 
    public static void main(String[] args) { 
        junit.textui.TestRunner.run(InflaterTest .class); 
    } 
    public void test_needsDictionary () { 
       Inflater inf = new Inflater(); 
       assertFalse(inf.needsDictionary());
   } 

}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message