src/JavaZipSupport.st
branchjk_new_structure
changeset 1539 6d8621e0f106
parent 1538 baa8e06aac40
child 1543 6ade2e8a1403
--- a/src/JavaZipSupport.st	Fri Jul 20 21:06:16 2012 +0000
+++ b/src/JavaZipSupport.st	Fri Jul 20 21:23:11 2012 +0000
@@ -102,6 +102,14 @@
 
 ! !
 
+!JavaZipSupport::Deflater methodsFor:'* As yet uncategorized *'!
+
+> aSmallInteger
+    ^(z_stream address ? 0) > aSmallInteger
+
+    "Created: / 20-07-2012 / 22:21:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !JavaZipSupport::Deflater methodsFor:'accessing'!
 
 vm: javaVM
@@ -425,7 +433,8 @@
 %}.
 
     errorType isNil ifTrue:[
-        self registerForFinalization
+        self registerForFinalization.
+        ^self
     ].
 
     z_stream free.
@@ -434,7 +443,7 @@
         ^self.
     ].
     errorType == #StreamError ifTrue:[
-        vm throwIllegalArgumentErrorWithMessage:
+        vm throwIllegalArgumentException:
             'Z_STREAM_ERROR returned from inflateInit2'.
         ^self.
     ].
@@ -515,7 +524,7 @@
 
 finalize
 
-    z_stream notNil ifTrue:[self end].
+    (z_stream notNil and:[z_stream isValid]) ifTrue:[self end].
 
     "Created: / 20-07-2012 / 21:50:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -814,7 +823,8 @@
     }    
 %}.
     errorType isNil ifTrue:[
-        self registerForFinalization
+        self registerForFinalization.
+        ^self
     ].
 
     z_stream free.
@@ -892,7 +902,7 @@
 
 finalize
 
-    z_stream notNil ifTrue:[self end].
+    (z_stream notNil and:[z_stream isValid]) ifTrue:[self end].
 
     "Created: / 20-07-2012 / 21:50:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !