You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2014/08/31 21:14:29 UTC

svn commit: r1621616 - in /commons/proper/compress/trunk/src: changes/changes.xml site/xdoc/examples.xml test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java

Author: bodewig
Date: Sun Aug 31 19:14:28 2014
New Revision: 1621616

URL: http://svn.apache.org/r1621616
Log:
COMPRESS-285 docs

Added:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java   (with props)
Modified:
    commons/proper/compress/trunk/src/changes/changes.xml
    commons/proper/compress/trunk/src/site/xdoc/examples.xml

Modified: commons/proper/compress/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1621616&r1=1621615&r2=1621616&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Sun Aug 31 19:14:28 2014
@@ -56,6 +56,12 @@ The <action> type attribute can be add,u
         Expanding 7z archives using LZMA compression could cause an
         EOFException.
       </action>
+      <action type="update" date="2014-08-31" issue="COMPRESS-285">
+        Checking for XZ for Java may be expensive.  The result will
+        now be cached outside of an OSGi environment.  You can use the
+        new XZUtils#setCacheXZAvailability to overrride this default
+        behavior.
+      </action>
     </release>
 
     <release version="1.8.1" date="2014-05-14"

Modified: commons/proper/compress/trunk/src/site/xdoc/examples.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/site/xdoc/examples.xml?rev=1621616&r1=1621615&r2=1621616&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/site/xdoc/examples.xml (original)
+++ commons/proper/compress/trunk/src/site/xdoc/examples.xml Sun Aug 31 19:14:28 2014
@@ -418,6 +418,14 @@ pIn.close();
           public domain <a href="http://tukaani.org/xz/java.html">XZ
           for Java</a> library.</p>
 
+        <p>When you try to open an XZ stream for reading using
+        <code>CompressorStreamFactory</code>, Commons Compress will
+        check whether the XZ for Java library is available.  Starting
+        with Compress 1.9 the result of this check will be cached
+        unless Compress finds OSGi classes in its classpath.  You can
+        use <code>XZUtils#setCacheXZAvailability</code> to overrride
+        this default behavior.</p>
+
         <p>Uncompressing a given XZ compressed file (you would
           certainly add exception handling and make sure all streams
           get closed properly):</p>

Added: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java?rev=1621616&view=auto
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java (added)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java Sun Aug 31 19:14:28 2014
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.compress.compressors.xz;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class XZCompressorInputStreamTest {
+    @Test
+    public void redundantTestOfAlmostDeprecatedMatchesMethod() {
+        byte[] data = {
+            (byte) 0xFD, '7', 'z', 'X', 'Z', '\0'
+        };
+        Assert.assertFalse(XZCompressorInputStream.matches(data, 5));
+        Assert.assertTrue(XZCompressorInputStream.matches(data, 6));
+        Assert.assertTrue(XZCompressorInputStream.matches(data, 7));
+        data[5] = '0';
+        Assert.assertFalse(XZCompressorInputStream.matches(data, 6));
+    }
+}

Propchange: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStreamTest.java
------------------------------------------------------------------------------
    svn:eol-style = native