You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2016/06/29 11:11:25 UTC

[19/39] tika git commit: Convert new lines from windows to unix

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java
index 20458bc..4c2bdfd 100644
--- a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java
+++ b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmBlockInfo.java
@@ -1,125 +1,125 @@
-/*
- * 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.tika.parser.chm;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
-import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
-import org.apache.tika.parser.chm.accessor.ChmItspHeader;
-import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
-import org.apache.tika.parser.chm.accessor.ChmLzxcResetTable;
-import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
-import org.apache.tika.parser.chm.core.ChmCommons;
-import org.apache.tika.parser.chm.core.ChmConstants;
-import org.apache.tika.parser.chm.lzx.ChmBlockInfo;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests major functionality of ChmBlockInfo
- * 
- */
-public class TestChmBlockInfo {
-    private byte[] data;
-    private ChmBlockInfo chmBlockInfo;
-    private ChmDirectoryListingSet chmDirListCont = null;
-    private ChmLzxcResetTable clrt = null;
-    private ChmLzxcControlData chmLzxcControlData = null;
-
-    @Before
-    public void setUp() throws Exception {
-        data = TestParameters.chmData;
-        /* Creates and parses itsf header */
-        ChmItsfHeader chmItsHeader = new ChmItsfHeader();
-        // chmItsHeader.parse(Arrays.copyOfRange(data, 0,
-        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
-        chmItsHeader.parse(ChmCommons.copyOfRange(data, 0,
-                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
-        /* Creates and parses itsp block */
-        ChmItspHeader chmItspHeader = new ChmItspHeader();
-        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
-        // chmItsHeader.getDirOffset(),
-        // (int) chmItsHeader.getDirOffset()
-        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        chmItspHeader.parse(ChmCommons.copyOfRange(data,
-                (int) chmItsHeader.getDirOffset(),
-                (int) chmItsHeader.getDirOffset()
-                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        /* Creating instance of ChmDirListingContainer */
-        chmDirListCont = new ChmDirectoryListingSet(data, chmItsHeader,
-                chmItspHeader);
-        int indexOfControlData = chmDirListCont.getControlDataIndex();
-
-        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
-                ChmConstants.LZXC.getBytes(UTF_8));
-        byte[] dir_chunk = null;
-        if (indexOfResetTable > 0) {
-            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
-            // indexOfResetTable
-            // +
-            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
-            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
-                    indexOfResetTable
-                            + chmDirListCont.getDirectoryListingEntryList()
-                                    .get(indexOfControlData).getLength());
-        }
-
-        /* Creates and parses control block */
-        chmLzxcControlData = new ChmLzxcControlData();
-        chmLzxcControlData.parse(dir_chunk, chmLzxcControlData);
-
-        int indexOfFeList = chmDirListCont.getResetTableIndex();
-        int startIndex = (int) chmDirListCont.getDataOffset()
-                + chmDirListCont.getDirectoryListingEntryList()
-                        .get(indexOfFeList).getOffset();
-        // dir_chunk = Arrays.copyOfRange(data, startIndex , startIndex +
-        // chmDirListCont.getDirectoryListingEntryList().get(indexOfFeList).getLength());
-        dir_chunk = ChmCommons.copyOfRange(data, startIndex, startIndex
-                        + chmDirListCont.getDirectoryListingEntryList().get(indexOfFeList).getLength());
-        clrt = new ChmLzxcResetTable();
-        clrt.parse(dir_chunk, clrt);
-    }
-
-    @Test
-    public void testToString() {
-        if (chmBlockInfo == null)
-            testGetChmBlockInfo();
-        assertTrue(chmBlockInfo.toString().length() > 0);
-    }
-
-    @Test
-    public void testGetChmBlockInfo() {
-        for (DirectoryListingEntry directoryListingEntry : chmDirListCont.getDirectoryListingEntryList()) {
-            chmBlockInfo = ChmBlockInfo.getChmBlockInfoInstance(
-                    directoryListingEntry, (int) clrt.getBlockLen(),
-                    chmLzxcControlData);
-            // Assert.assertTrue(!directoryListingEntry.getName().isEmpty() &&
-            // chmBlockInfo.toString() != null);
-            assertTrue(!ChmCommons.isEmpty(directoryListingEntry
-                    .getName()) && chmBlockInfo.toString() != null);
-        }
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        data = null;
-        chmBlockInfo = null;
-    }
-}
+/*
+ * 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.tika.parser.chm;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
+import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
+import org.apache.tika.parser.chm.accessor.ChmItspHeader;
+import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
+import org.apache.tika.parser.chm.accessor.ChmLzxcResetTable;
+import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
+import org.apache.tika.parser.chm.core.ChmCommons;
+import org.apache.tika.parser.chm.core.ChmConstants;
+import org.apache.tika.parser.chm.lzx.ChmBlockInfo;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests major functionality of ChmBlockInfo
+ * 
+ */
+public class TestChmBlockInfo {
+    private byte[] data;
+    private ChmBlockInfo chmBlockInfo;
+    private ChmDirectoryListingSet chmDirListCont = null;
+    private ChmLzxcResetTable clrt = null;
+    private ChmLzxcControlData chmLzxcControlData = null;
+
+    @Before
+    public void setUp() throws Exception {
+        data = TestParameters.chmData;
+        /* Creates and parses itsf header */
+        ChmItsfHeader chmItsHeader = new ChmItsfHeader();
+        // chmItsHeader.parse(Arrays.copyOfRange(data, 0,
+        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
+        chmItsHeader.parse(ChmCommons.copyOfRange(data, 0,
+                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
+        /* Creates and parses itsp block */
+        ChmItspHeader chmItspHeader = new ChmItspHeader();
+        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
+        // chmItsHeader.getDirOffset(),
+        // (int) chmItsHeader.getDirOffset()
+        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        chmItspHeader.parse(ChmCommons.copyOfRange(data,
+                (int) chmItsHeader.getDirOffset(),
+                (int) chmItsHeader.getDirOffset()
+                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        /* Creating instance of ChmDirListingContainer */
+        chmDirListCont = new ChmDirectoryListingSet(data, chmItsHeader,
+                chmItspHeader);
+        int indexOfControlData = chmDirListCont.getControlDataIndex();
+
+        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
+                ChmConstants.LZXC.getBytes(UTF_8));
+        byte[] dir_chunk = null;
+        if (indexOfResetTable > 0) {
+            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
+            // indexOfResetTable
+            // +
+            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
+            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
+                    indexOfResetTable
+                            + chmDirListCont.getDirectoryListingEntryList()
+                                    .get(indexOfControlData).getLength());
+        }
+
+        /* Creates and parses control block */
+        chmLzxcControlData = new ChmLzxcControlData();
+        chmLzxcControlData.parse(dir_chunk, chmLzxcControlData);
+
+        int indexOfFeList = chmDirListCont.getResetTableIndex();
+        int startIndex = (int) chmDirListCont.getDataOffset()
+                + chmDirListCont.getDirectoryListingEntryList()
+                        .get(indexOfFeList).getOffset();
+        // dir_chunk = Arrays.copyOfRange(data, startIndex , startIndex +
+        // chmDirListCont.getDirectoryListingEntryList().get(indexOfFeList).getLength());
+        dir_chunk = ChmCommons.copyOfRange(data, startIndex, startIndex
+                        + chmDirListCont.getDirectoryListingEntryList().get(indexOfFeList).getLength());
+        clrt = new ChmLzxcResetTable();
+        clrt.parse(dir_chunk, clrt);
+    }
+
+    @Test
+    public void testToString() {
+        if (chmBlockInfo == null)
+            testGetChmBlockInfo();
+        assertTrue(chmBlockInfo.toString().length() > 0);
+    }
+
+    @Test
+    public void testGetChmBlockInfo() {
+        for (DirectoryListingEntry directoryListingEntry : chmDirListCont.getDirectoryListingEntryList()) {
+            chmBlockInfo = ChmBlockInfo.getChmBlockInfoInstance(
+                    directoryListingEntry, (int) clrt.getBlockLen(),
+                    chmLzxcControlData);
+            // Assert.assertTrue(!directoryListingEntry.getName().isEmpty() &&
+            // chmBlockInfo.toString() != null);
+            assertTrue(!ChmCommons.isEmpty(directoryListingEntry
+                    .getName()) && chmBlockInfo.toString() != null);
+        }
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        data = null;
+        chmBlockInfo = null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java
index 5f53870..229277d 100644
--- a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java
+++ b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtraction.java
@@ -1,212 +1,212 @@
-/*
- * 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.tika.parser.chm;
-
-import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.regex.Pattern;
-
-import org.apache.tika.TikaTest;
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.metadata.Metadata;
-import org.apache.tika.parser.ParseContext;
-import org.apache.tika.parser.Parser;
-import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
-import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
-import org.apache.tika.parser.chm.core.ChmExtractor;
-import org.apache.tika.sax.BodyContentHandler;
-import org.junit.Test;
-import org.xml.sax.SAXException;
-
-public class TestChmExtraction extends TikaTest {
-
-    private final Parser parser = new ChmParser();
-
-    private final List<String> files = Arrays.asList(
-            "/test-documents/testChm.chm",
-            "/test-documents/testChm2.chm",
-            "/test-documents/testChm3.chm");
-
-    @Test
-    public void testGetText() throws Exception {
-        BodyContentHandler handler = new BodyContentHandler();
-        new ChmParser().parse(
-                new ByteArrayInputStream(TestParameters.chmData),
-                handler, new Metadata(), new ParseContext());
-        assertTrue(handler.toString().contains(
-                "The TCard method accepts only numeric arguments"));
-    }
-
-    @Test
-    public void testChmParser() throws Exception{
-        for (String fileName : files) {
-            InputStream stream = TestChmExtraction.class.getResourceAsStream(fileName);
-            testingChm(stream);
-        }
-    }
-
-    private void testingChm(InputStream stream) throws IOException, SAXException, TikaException {
-      try {
-          BodyContentHandler handler = new BodyContentHandler(-1);
-          parser.parse(stream, handler, new Metadata(), new ParseContext());
-          assertTrue(!handler.toString().isEmpty());
-      } finally {
-          stream.close();
-      }
-    }
-
-    @Test
-    public void testExtractChmEntries() throws TikaException, IOException{
-        for (String fileName : files) {
-            try (InputStream stream = TestChmExtraction.class.getResourceAsStream(fileName)) {
-                testExtractChmEntry(stream);
-            }
-        }
-    }
-    
-    protected boolean findZero(byte[] textData) {
-        for (byte b : textData) {
-            if (b==0) {
-                return true;
-            }
-        }
-        
-        return false;
-    }
-    
-    protected boolean niceAscFileName(String name) {
-        for (char c : name.toCharArray()) {
-            if (c>=127 || c<32) {
-                //non-ascii char or control char
-                return false;
-            }
-        }
-        
-        return true;
-    }
-    
-    protected void testExtractChmEntry(InputStream stream) throws TikaException, IOException{
-        ChmExtractor chmExtractor = new ChmExtractor(stream);
-        ChmDirectoryListingSet entries = chmExtractor.getChmDirList();
-        final Pattern htmlPairP = Pattern.compile("\\Q<html\\E.+\\Q</html>\\E"
-                , Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
-        
-        Set<String> names = new HashSet<String>();
-        
-        for (DirectoryListingEntry directoryListingEntry : entries.getDirectoryListingEntryList()) {
-            byte[] data = chmExtractor.extractChmEntry(directoryListingEntry);
-            
-            //Entry names should be nice. Disable this if the test chm do have bad looking but valid entry names.
-            if (! niceAscFileName(directoryListingEntry.getName())) {
-                throw new TikaException("Warning: File name contains a non ascii char : " + directoryListingEntry.getName());
-            }
-            
-            final String lowName = directoryListingEntry.getName().toLowerCase(Locale.ROOT);
-            
-            //check duplicate entry name which is seen before.
-            if (names.contains(lowName)) {
-                throw new TikaException("Duplicate File name detected : " + directoryListingEntry.getName());
-            }
-            names.add(lowName);
-            
-            if (lowName.endsWith(".html")
-                    || lowName.endsWith(".htm")
-                    || lowName.endsWith(".hhk")
-                    || lowName.endsWith(".hhc")
-                    //|| name.endsWith(".bmp")
-                    ) {
-                if (findZero(data)) {
-                    throw new TikaException("Xhtml/text file contains '\\0' : " + directoryListingEntry.getName());
-                }
-
-                //validate html
-                String html = new String(data, ISO_8859_1);
-                if (! htmlPairP.matcher(html).find()) {
-                    System.err.println(lowName + " is invalid.");
-                    System.err.println(html);
-                    throw new TikaException("Invalid xhtml file : " + directoryListingEntry.getName());
-                }
-//                else {
-//                    System.err.println(directoryListingEntry.getName() + " is valid.");
-//                }
-            }
-        }
-    }
-    
-
-    @Test
-    public void testMultiThreadedChmExtraction() throws InterruptedException {
-        ExecutorService executor = Executors.newFixedThreadPool(TestParameters.NTHREADS);
-        for (int i = 0; i < TestParameters.NTHREADS; i++) {
-            executor.execute(new Runnable() {
-                public void run() {
-                    for (String fileName : files) {
-                        InputStream stream = null;
-                        try {
-                            stream = TestChmExtraction.class.getResourceAsStream(fileName);
-                            BodyContentHandler handler = new BodyContentHandler(-1);
-                            parser.parse(stream, handler, new Metadata(), new ParseContext());
-                            assertTrue(!handler.toString().isEmpty());
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        } finally {
-                            try {
-                                stream.close();
-                            } catch (IOException e) {
-                                e.printStackTrace();
-                            }
-                        }
-                    }
-                }
-            });
-        }
-        executor.shutdown();
-        // Waits until all threads will have finished
-        while (!executor.isTerminated()) {
-            Thread.sleep(500);
-        }
-    }
-    
-    @Test
-    public void test_TIKA_1446() throws Exception {
-        String[] chemFiles = {
-                "admin.chm",
-                "cmak_ops.CHM",
-                "comexp.CHM",
-                "gpedit.CHM",
-                "IMJPCL.CHM",
-                "IMJPCLE.CHM",
-                "IMTCEN.CHM",
-                "tcpip.CHM",
-                "wmicontrol.CHM"
-        };
-        for (String fileName : chemFiles) {
-            testingChm(getTestDocumentAsStream("chm/"+fileName));
-        }
-    }
-}
+/*
+ * 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.tika.parser.chm;
+
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.regex.Pattern;
+
+import org.apache.tika.TikaTest;
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.ParseContext;
+import org.apache.tika.parser.Parser;
+import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
+import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
+import org.apache.tika.parser.chm.core.ChmExtractor;
+import org.apache.tika.sax.BodyContentHandler;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+public class TestChmExtraction extends TikaTest {
+
+    private final Parser parser = new ChmParser();
+
+    private final List<String> files = Arrays.asList(
+            "/test-documents/testChm.chm",
+            "/test-documents/testChm2.chm",
+            "/test-documents/testChm3.chm");
+
+    @Test
+    public void testGetText() throws Exception {
+        BodyContentHandler handler = new BodyContentHandler();
+        new ChmParser().parse(
+                new ByteArrayInputStream(TestParameters.chmData),
+                handler, new Metadata(), new ParseContext());
+        assertTrue(handler.toString().contains(
+                "The TCard method accepts only numeric arguments"));
+    }
+
+    @Test
+    public void testChmParser() throws Exception{
+        for (String fileName : files) {
+            InputStream stream = TestChmExtraction.class.getResourceAsStream(fileName);
+            testingChm(stream);
+        }
+    }
+
+    private void testingChm(InputStream stream) throws IOException, SAXException, TikaException {
+      try {
+          BodyContentHandler handler = new BodyContentHandler(-1);
+          parser.parse(stream, handler, new Metadata(), new ParseContext());
+          assertTrue(!handler.toString().isEmpty());
+      } finally {
+          stream.close();
+      }
+    }
+
+    @Test
+    public void testExtractChmEntries() throws TikaException, IOException{
+        for (String fileName : files) {
+            try (InputStream stream = TestChmExtraction.class.getResourceAsStream(fileName)) {
+                testExtractChmEntry(stream);
+            }
+        }
+    }
+    
+    protected boolean findZero(byte[] textData) {
+        for (byte b : textData) {
+            if (b==0) {
+                return true;
+            }
+        }
+        
+        return false;
+    }
+    
+    protected boolean niceAscFileName(String name) {
+        for (char c : name.toCharArray()) {
+            if (c>=127 || c<32) {
+                //non-ascii char or control char
+                return false;
+            }
+        }
+        
+        return true;
+    }
+    
+    protected void testExtractChmEntry(InputStream stream) throws TikaException, IOException{
+        ChmExtractor chmExtractor = new ChmExtractor(stream);
+        ChmDirectoryListingSet entries = chmExtractor.getChmDirList();
+        final Pattern htmlPairP = Pattern.compile("\\Q<html\\E.+\\Q</html>\\E"
+                , Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
+        
+        Set<String> names = new HashSet<String>();
+        
+        for (DirectoryListingEntry directoryListingEntry : entries.getDirectoryListingEntryList()) {
+            byte[] data = chmExtractor.extractChmEntry(directoryListingEntry);
+            
+            //Entry names should be nice. Disable this if the test chm do have bad looking but valid entry names.
+            if (! niceAscFileName(directoryListingEntry.getName())) {
+                throw new TikaException("Warning: File name contains a non ascii char : " + directoryListingEntry.getName());
+            }
+            
+            final String lowName = directoryListingEntry.getName().toLowerCase(Locale.ROOT);
+            
+            //check duplicate entry name which is seen before.
+            if (names.contains(lowName)) {
+                throw new TikaException("Duplicate File name detected : " + directoryListingEntry.getName());
+            }
+            names.add(lowName);
+            
+            if (lowName.endsWith(".html")
+                    || lowName.endsWith(".htm")
+                    || lowName.endsWith(".hhk")
+                    || lowName.endsWith(".hhc")
+                    //|| name.endsWith(".bmp")
+                    ) {
+                if (findZero(data)) {
+                    throw new TikaException("Xhtml/text file contains '\\0' : " + directoryListingEntry.getName());
+                }
+
+                //validate html
+                String html = new String(data, ISO_8859_1);
+                if (! htmlPairP.matcher(html).find()) {
+                    System.err.println(lowName + " is invalid.");
+                    System.err.println(html);
+                    throw new TikaException("Invalid xhtml file : " + directoryListingEntry.getName());
+                }
+//                else {
+//                    System.err.println(directoryListingEntry.getName() + " is valid.");
+//                }
+            }
+        }
+    }
+    
+
+    @Test
+    public void testMultiThreadedChmExtraction() throws InterruptedException {
+        ExecutorService executor = Executors.newFixedThreadPool(TestParameters.NTHREADS);
+        for (int i = 0; i < TestParameters.NTHREADS; i++) {
+            executor.execute(new Runnable() {
+                public void run() {
+                    for (String fileName : files) {
+                        InputStream stream = null;
+                        try {
+                            stream = TestChmExtraction.class.getResourceAsStream(fileName);
+                            BodyContentHandler handler = new BodyContentHandler(-1);
+                            parser.parse(stream, handler, new Metadata(), new ParseContext());
+                            assertTrue(!handler.toString().isEmpty());
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        } finally {
+                            try {
+                                stream.close();
+                            } catch (IOException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    }
+                }
+            });
+        }
+        executor.shutdown();
+        // Waits until all threads will have finished
+        while (!executor.isTerminated()) {
+            Thread.sleep(500);
+        }
+    }
+    
+    @Test
+    public void test_TIKA_1446() throws Exception {
+        String[] chemFiles = {
+                "admin.chm",
+                "cmak_ops.CHM",
+                "comexp.CHM",
+                "gpedit.CHM",
+                "IMJPCL.CHM",
+                "IMJPCLE.CHM",
+                "IMTCEN.CHM",
+                "tcpip.CHM",
+                "wmicontrol.CHM"
+        };
+        for (String fileName : chemFiles) {
+            testingChm(getTestDocumentAsStream("chm/"+fileName));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java
index 4301240..c072db0 100644
--- a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java
+++ b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmExtractor.java
@@ -1,63 +1,63 @@
-/*
- * 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.tika.parser.chm;
-
-import java.io.ByteArrayInputStream;
-import java.util.List;
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
-import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
-import org.apache.tika.parser.chm.core.ChmExtractor;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestChmExtractor {
-    private ChmExtractor chmExtractor = null;
-
-    @Before
-    public void setUp() throws Exception {
-        chmExtractor = new ChmExtractor(
-                new ByteArrayInputStream(TestParameters.chmData));
-    }
-
-    @Test
-    public void testEnumerateChm() {
-        List<String> chmEntries = chmExtractor.enumerateChm();
-        assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER,
-                chmEntries.size());
-    }
-
-    @Test
-    public void testGetChmDirList() {
-        assertNotNull(chmExtractor.getChmDirList());
-    }
-
-    @Test
-    public void testExtractChmEntry() throws TikaException{
-        ChmDirectoryListingSet entries = chmExtractor.getChmDirList();
-        
-        int count = 0;
-        for (DirectoryListingEntry directoryListingEntry : entries.getDirectoryListingEntryList()) {
-            chmExtractor.extractChmEntry(directoryListingEntry);
-            ++count;
-        }
-        assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER, count);
-    }
-
-}
+/*
+ * 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.tika.parser.chm;
+
+import java.io.ByteArrayInputStream;
+import java.util.List;
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
+import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
+import org.apache.tika.parser.chm.core.ChmExtractor;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestChmExtractor {
+    private ChmExtractor chmExtractor = null;
+
+    @Before
+    public void setUp() throws Exception {
+        chmExtractor = new ChmExtractor(
+                new ByteArrayInputStream(TestParameters.chmData));
+    }
+
+    @Test
+    public void testEnumerateChm() {
+        List<String> chmEntries = chmExtractor.enumerateChm();
+        assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER,
+                chmEntries.size());
+    }
+
+    @Test
+    public void testGetChmDirList() {
+        assertNotNull(chmExtractor.getChmDirList());
+    }
+
+    @Test
+    public void testExtractChmEntry() throws TikaException{
+        ChmDirectoryListingSet entries = chmExtractor.getChmDirList();
+        
+        int count = 0;
+        for (DirectoryListingEntry directoryListingEntry : entries.getDirectoryListingEntryList()) {
+            chmExtractor.extractChmEntry(directoryListingEntry);
+            ++count;
+        }
+        assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER, count);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java
index 6bda44a..05d3820 100644
--- a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java
+++ b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItsfHeader.java
@@ -1,122 +1,122 @@
-/*
- * 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.tika.parser.chm;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
-import org.apache.tika.parser.chm.core.ChmCommons;
-import org.apache.tika.parser.chm.core.ChmConstants;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests all public functions of ChmItsfHeader
- * 
- */
-public class TestChmItsfHeader {
-    private ChmItsfHeader chmItsfHeader = null;
-
-    @Before
-    public void setUp() throws Exception {
-        chmItsfHeader = new ChmItsfHeader();
-        byte[] data = TestParameters.chmData;
-        // chmItsfHeader.parse(Arrays.copyOfRange(data, 0,
-        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
-        chmItsfHeader.parse(ChmCommons.copyOfRange(data, 0,
-                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
-    }
-
-    @Test
-    public void getDataOffset() {
-        assertEquals(TestParameters.VP_DATA_OFFSET_LENGTH,
-                chmItsfHeader.getDataOffset());
-    }
-
-    @Test
-    public void getDir_uuid() {
-        assertNotNull(chmItsfHeader.getDir_uuid());
-    }
-
-    @Test
-    public void getDirLen() {
-        assertEquals(TestParameters.VP_DIRECTORY_LENGTH,
-                chmItsfHeader.getDirLen());
-    }
-
-    @Test
-    public void getDirOffset() {
-        assertEquals(TestParameters.VP_DIRECTORY_OFFSET,
-                chmItsfHeader.getDirOffset());
-    }
-
-    @Test
-    public void getHeaderLen() {
-        assertEquals(TestParameters.VP_ITSF_HEADER_LENGTH,
-                chmItsfHeader.getHeaderLen());
-    }
-
-    @Test
-    public void getLangId() {
-        assertEquals(TestParameters.VP_LANGUAGE_ID,
-                chmItsfHeader.getLangId());
-    }
-
-    @Test
-    public void getLastModified() {
-        assertEquals(TestParameters.VP_LAST_MODIFIED,
-                chmItsfHeader.getLastModified());
-    }
-
-    @Test
-    public void getUnknown_000c() {
-        assertEquals(TestParameters.VP_UNKNOWN_000C,
-                chmItsfHeader.getUnknown_000c());
-    }
-
-    @Test
-    public void getUnknownLen() {
-        assertEquals(TestParameters.VP_UNKNOWN_LEN,
-                chmItsfHeader.getUnknownLen());
-    }
-    
-    @Test
-    public void getUnknownOffset() {
-        assertEquals(TestParameters.VP_UNKNOWN_OFFSET,
-                chmItsfHeader.getUnknownOffset());
-    }
-
-    @Test
-    public void getVersion() {
-        assertEquals(TestParameters.VP_VERSION,
-                chmItsfHeader.getVersion());
-    }
-
-    @Test
-    public void testToString() {
-        assertTrue(chmItsfHeader.toString().contains(
-                TestParameters.VP_ISTF_SIGNATURE));
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        chmItsfHeader = null;
-    }
-}
+/*
+ * 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.tika.parser.chm;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
+import org.apache.tika.parser.chm.core.ChmCommons;
+import org.apache.tika.parser.chm.core.ChmConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests all public functions of ChmItsfHeader
+ * 
+ */
+public class TestChmItsfHeader {
+    private ChmItsfHeader chmItsfHeader = null;
+
+    @Before
+    public void setUp() throws Exception {
+        chmItsfHeader = new ChmItsfHeader();
+        byte[] data = TestParameters.chmData;
+        // chmItsfHeader.parse(Arrays.copyOfRange(data, 0,
+        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
+        chmItsfHeader.parse(ChmCommons.copyOfRange(data, 0,
+                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
+    }
+
+    @Test
+    public void getDataOffset() {
+        assertEquals(TestParameters.VP_DATA_OFFSET_LENGTH,
+                chmItsfHeader.getDataOffset());
+    }
+
+    @Test
+    public void getDir_uuid() {
+        assertNotNull(chmItsfHeader.getDir_uuid());
+    }
+
+    @Test
+    public void getDirLen() {
+        assertEquals(TestParameters.VP_DIRECTORY_LENGTH,
+                chmItsfHeader.getDirLen());
+    }
+
+    @Test
+    public void getDirOffset() {
+        assertEquals(TestParameters.VP_DIRECTORY_OFFSET,
+                chmItsfHeader.getDirOffset());
+    }
+
+    @Test
+    public void getHeaderLen() {
+        assertEquals(TestParameters.VP_ITSF_HEADER_LENGTH,
+                chmItsfHeader.getHeaderLen());
+    }
+
+    @Test
+    public void getLangId() {
+        assertEquals(TestParameters.VP_LANGUAGE_ID,
+                chmItsfHeader.getLangId());
+    }
+
+    @Test
+    public void getLastModified() {
+        assertEquals(TestParameters.VP_LAST_MODIFIED,
+                chmItsfHeader.getLastModified());
+    }
+
+    @Test
+    public void getUnknown_000c() {
+        assertEquals(TestParameters.VP_UNKNOWN_000C,
+                chmItsfHeader.getUnknown_000c());
+    }
+
+    @Test
+    public void getUnknownLen() {
+        assertEquals(TestParameters.VP_UNKNOWN_LEN,
+                chmItsfHeader.getUnknownLen());
+    }
+    
+    @Test
+    public void getUnknownOffset() {
+        assertEquals(TestParameters.VP_UNKNOWN_OFFSET,
+                chmItsfHeader.getUnknownOffset());
+    }
+
+    @Test
+    public void getVersion() {
+        assertEquals(TestParameters.VP_VERSION,
+                chmItsfHeader.getVersion());
+    }
+
+    @Test
+    public void testToString() {
+        assertTrue(chmItsfHeader.toString().contains(
+                TestParameters.VP_ISTF_SIGNATURE));
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        chmItsfHeader = null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItspHeader.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItspHeader.java b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItspHeader.java
index 91e4ba6..e78e7c8 100644
--- a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItspHeader.java
+++ b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmItspHeader.java
@@ -1,160 +1,160 @@
-/*
- * 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.tika.parser.chm;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
-import org.apache.tika.parser.chm.accessor.ChmItspHeader;
-import org.apache.tika.parser.chm.core.ChmCommons;
-import org.apache.tika.parser.chm.core.ChmConstants;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests all public methods of the ChmItspHeader
- * 
- */
-public class TestChmItspHeader {
-    private ChmItspHeader chmItspHeader = null;
-
-    @Before
-    public void setUp() throws Exception {
-        byte[] data = TestParameters.chmData;
-
-        ChmItsfHeader chmItsfHeader = new ChmItsfHeader();
-        // chmItsfHeader.parse(Arrays.copyOfRange(data, 0,
-        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
-        chmItsfHeader.parse(ChmCommons.copyOfRange(data, 0,
-                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
-
-        chmItspHeader = new ChmItspHeader();
-        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
-        // chmItsfHeader.getDirOffset(),
-        // (int) chmItsfHeader.getDirOffset()
-        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        chmItspHeader.parse(ChmCommons.copyOfRange(data,
-                (int) chmItsfHeader.getDirOffset(),
-                (int) chmItsfHeader.getDirOffset()
-                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-    }
-
-    @Test
-    public void testGetBlock_len() {
-        assertEquals(TestParameters.VP_BLOCK_LENGTH,
-                chmItspHeader.getBlock_len());
-    }
-
-    @Test
-    public void testGetBlockidx_intvl() {
-        assertEquals(TestParameters.VP_BLOCK_INDEX_INTERVAL,
-                chmItspHeader.getBlockidx_intvl());
-    }
-
-    @Test
-    public void testGetHeader_len() {
-        assertEquals(TestParameters.VP_ITSP_HEADER_LENGTH,
-                chmItspHeader.getHeader_len());
-    }
-
-    @Test
-    public void testGetIndex_depth() {
-        assertEquals(TestParameters.VP_INDEX_DEPTH,
-                chmItspHeader.getIndex_depth());
-    }
-
-    @Test
-    public void testGetIndex_head() {
-        assertEquals(TestParameters.VP_INDEX_HEAD,
-                chmItspHeader.getIndex_head());
-    }
-
-    @Test
-    public void testGetIndex_root() {
-        assertEquals(TestParameters.VP_INDEX_ROOT,
-                chmItspHeader.getIndex_root());
-    }
-
-    @Test
-    public void testGetLang_id() {
-        assertEquals(TestParameters.VP_LANGUAGE_ID,
-                chmItspHeader.getLang_id());
-    }
-
-    @Test
-    public void testGetNum_blocks() {
-        assertEquals(TestParameters.VP_UNKNOWN_NUM_BLOCKS,
-                chmItspHeader.getNum_blocks());
-    }
-
-    @Test
-    public void testGetUnknown_000c() {
-        assertEquals(TestParameters.VP_ITSP_UNKNOWN_000C,
-                chmItspHeader.getUnknown_000c());
-    }
-
-    @Test
-    public void testGetUnknown_0024() {
-        assertEquals(TestParameters.VP_ITSP_UNKNOWN_0024,
-                chmItspHeader.getUnknown_0024());
-    }
-
-    @Test
-    public void testGetUnknown_002() {
-        assertEquals(TestParameters.VP_ITSP_UNKNOWN_002C,
-                chmItspHeader.getUnknown_002c());
-    }
-
-    @Test
-    public void testGetUnknown_0044() {
-        assertEquals(TestParameters.VP_ITSP_BYTEARR_LEN,
-                chmItspHeader.getUnknown_0044().length);
-    }
-
-    @Test
-    public void testGetVersion() {
-        assertEquals(TestParameters.VP_ITSP_VERSION,
-                chmItspHeader.getVersion());
-    }
-
-    @Test
-    public void testGetSignature() {
-        assertEquals(TestParameters.VP_ISTP_SIGNATURE, new String(
-                chmItspHeader.getSignature(), UTF_8));
-    }
-
-    @Test
-    public void testGetSystem_uuid() {
-        assertEquals(TestParameters.VP_ITSP_BYTEARR_LEN,
-                chmItspHeader.getSystem_uuid().length);
-    }
-
-    @Test
-    public void testToString() {
-        assertTrue(chmItspHeader.toString().contains(
-                TestParameters.VP_ISTP_SIGNATURE));
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        chmItspHeader = null;
-    }
-
-}
+/*
+ * 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.tika.parser.chm;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
+import org.apache.tika.parser.chm.accessor.ChmItspHeader;
+import org.apache.tika.parser.chm.core.ChmCommons;
+import org.apache.tika.parser.chm.core.ChmConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests all public methods of the ChmItspHeader
+ * 
+ */
+public class TestChmItspHeader {
+    private ChmItspHeader chmItspHeader = null;
+
+    @Before
+    public void setUp() throws Exception {
+        byte[] data = TestParameters.chmData;
+
+        ChmItsfHeader chmItsfHeader = new ChmItsfHeader();
+        // chmItsfHeader.parse(Arrays.copyOfRange(data, 0,
+        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
+        chmItsfHeader.parse(ChmCommons.copyOfRange(data, 0,
+                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
+
+        chmItspHeader = new ChmItspHeader();
+        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
+        // chmItsfHeader.getDirOffset(),
+        // (int) chmItsfHeader.getDirOffset()
+        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        chmItspHeader.parse(ChmCommons.copyOfRange(data,
+                (int) chmItsfHeader.getDirOffset(),
+                (int) chmItsfHeader.getDirOffset()
+                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+    }
+
+    @Test
+    public void testGetBlock_len() {
+        assertEquals(TestParameters.VP_BLOCK_LENGTH,
+                chmItspHeader.getBlock_len());
+    }
+
+    @Test
+    public void testGetBlockidx_intvl() {
+        assertEquals(TestParameters.VP_BLOCK_INDEX_INTERVAL,
+                chmItspHeader.getBlockidx_intvl());
+    }
+
+    @Test
+    public void testGetHeader_len() {
+        assertEquals(TestParameters.VP_ITSP_HEADER_LENGTH,
+                chmItspHeader.getHeader_len());
+    }
+
+    @Test
+    public void testGetIndex_depth() {
+        assertEquals(TestParameters.VP_INDEX_DEPTH,
+                chmItspHeader.getIndex_depth());
+    }
+
+    @Test
+    public void testGetIndex_head() {
+        assertEquals(TestParameters.VP_INDEX_HEAD,
+                chmItspHeader.getIndex_head());
+    }
+
+    @Test
+    public void testGetIndex_root() {
+        assertEquals(TestParameters.VP_INDEX_ROOT,
+                chmItspHeader.getIndex_root());
+    }
+
+    @Test
+    public void testGetLang_id() {
+        assertEquals(TestParameters.VP_LANGUAGE_ID,
+                chmItspHeader.getLang_id());
+    }
+
+    @Test
+    public void testGetNum_blocks() {
+        assertEquals(TestParameters.VP_UNKNOWN_NUM_BLOCKS,
+                chmItspHeader.getNum_blocks());
+    }
+
+    @Test
+    public void testGetUnknown_000c() {
+        assertEquals(TestParameters.VP_ITSP_UNKNOWN_000C,
+                chmItspHeader.getUnknown_000c());
+    }
+
+    @Test
+    public void testGetUnknown_0024() {
+        assertEquals(TestParameters.VP_ITSP_UNKNOWN_0024,
+                chmItspHeader.getUnknown_0024());
+    }
+
+    @Test
+    public void testGetUnknown_002() {
+        assertEquals(TestParameters.VP_ITSP_UNKNOWN_002C,
+                chmItspHeader.getUnknown_002c());
+    }
+
+    @Test
+    public void testGetUnknown_0044() {
+        assertEquals(TestParameters.VP_ITSP_BYTEARR_LEN,
+                chmItspHeader.getUnknown_0044().length);
+    }
+
+    @Test
+    public void testGetVersion() {
+        assertEquals(TestParameters.VP_ITSP_VERSION,
+                chmItspHeader.getVersion());
+    }
+
+    @Test
+    public void testGetSignature() {
+        assertEquals(TestParameters.VP_ISTP_SIGNATURE, new String(
+                chmItspHeader.getSignature(), UTF_8));
+    }
+
+    @Test
+    public void testGetSystem_uuid() {
+        assertEquals(TestParameters.VP_ITSP_BYTEARR_LEN,
+                chmItspHeader.getSystem_uuid().length);
+    }
+
+    @Test
+    public void testToString() {
+        assertTrue(chmItspHeader.toString().contains(
+                TestParameters.VP_ISTP_SIGNATURE));
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        chmItspHeader = null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxState.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxState.java b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxState.java
index d40874f..c8a8eb7 100644
--- a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxState.java
+++ b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxState.java
@@ -1,101 +1,101 @@
-/*
- * 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.tika.parser.chm;
-
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
-import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
-import org.apache.tika.parser.chm.accessor.ChmItspHeader;
-import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
-import org.apache.tika.parser.chm.core.ChmCommons;
-import org.apache.tika.parser.chm.core.ChmConstants;
-import org.apache.tika.parser.chm.lzx.ChmLzxState;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestChmLzxState {
-    private ChmLzxState chmLzxState;
-    private int windowSize;
-
-    @Before
-    public void setUp() throws Exception {
-        byte[] data = TestParameters.chmData;
-
-        /* Creates and parses itsf header */
-        ChmItsfHeader chmItsHeader = new ChmItsfHeader();
-        // chmItsHeader.parse(Arrays.copyOfRange(data, 0,
-        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
-        chmItsHeader.parse(ChmCommons.copyOfRange(data, 0,
-                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
-        /* Creates and parses itsp block */
-        ChmItspHeader chmItspHeader = new ChmItspHeader();
-        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
-        // chmItsHeader.getDirOffset(),
-        // (int) chmItsHeader.getDirOffset()
-        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        chmItspHeader.parse(ChmCommons.copyOfRange(data,
-                (int) chmItsHeader.getDirOffset(),
-                (int) chmItsHeader.getDirOffset()
-                + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-
-        /* Creating instance of ChmDirListingContainer */
-        ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(
-                data, chmItsHeader, chmItspHeader);
-        int indexOfControlData = ChmCommons.indexOf(
-                chmDirListCont.getDirectoryListingEntryList(),
-                ChmConstants.CONTROL_DATA);
-
-        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
-                ChmConstants.LZXC.getBytes(UTF_8));
-        byte[] dir_chunk = null;
-        if (indexOfResetTable > 0) {
-            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
-            // indexOfResetTable
-            // +
-            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
-            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
-                    indexOfResetTable
-                    + chmDirListCont.getDirectoryListingEntryList()
-                    .get(indexOfControlData).getLength());
-        }
-
-        ChmLzxcControlData clcd = new ChmLzxcControlData();
-        clcd.parse(dir_chunk, clcd);
-        windowSize = (int) clcd.getWindowSize();
-    }
-
-    @Test
-    public void testChmLzxStateConstructor() throws TikaException {
-        chmLzxState = new ChmLzxState(windowSize);
-        assertNotNull(chmLzxState);
-    }
-
-    @Test
-    public void testToString() throws TikaException {
-        if (chmLzxState == null)
-            testChmLzxStateConstructor();
-        assertTrue(chmLzxState.toString().length() > 20);
-    }
-
-    // TODO add more tests
-
-}
+/*
+ * 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.tika.parser.chm;
+
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
+import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
+import org.apache.tika.parser.chm.accessor.ChmItspHeader;
+import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
+import org.apache.tika.parser.chm.core.ChmCommons;
+import org.apache.tika.parser.chm.core.ChmConstants;
+import org.apache.tika.parser.chm.lzx.ChmLzxState;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestChmLzxState {
+    private ChmLzxState chmLzxState;
+    private int windowSize;
+
+    @Before
+    public void setUp() throws Exception {
+        byte[] data = TestParameters.chmData;
+
+        /* Creates and parses itsf header */
+        ChmItsfHeader chmItsHeader = new ChmItsfHeader();
+        // chmItsHeader.parse(Arrays.copyOfRange(data, 0,
+        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
+        chmItsHeader.parse(ChmCommons.copyOfRange(data, 0,
+                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
+        /* Creates and parses itsp block */
+        ChmItspHeader chmItspHeader = new ChmItspHeader();
+        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
+        // chmItsHeader.getDirOffset(),
+        // (int) chmItsHeader.getDirOffset()
+        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        chmItspHeader.parse(ChmCommons.copyOfRange(data,
+                (int) chmItsHeader.getDirOffset(),
+                (int) chmItsHeader.getDirOffset()
+                + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+
+        /* Creating instance of ChmDirListingContainer */
+        ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(
+                data, chmItsHeader, chmItspHeader);
+        int indexOfControlData = ChmCommons.indexOf(
+                chmDirListCont.getDirectoryListingEntryList(),
+                ChmConstants.CONTROL_DATA);
+
+        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
+                ChmConstants.LZXC.getBytes(UTF_8));
+        byte[] dir_chunk = null;
+        if (indexOfResetTable > 0) {
+            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
+            // indexOfResetTable
+            // +
+            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
+            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
+                    indexOfResetTable
+                    + chmDirListCont.getDirectoryListingEntryList()
+                    .get(indexOfControlData).getLength());
+        }
+
+        ChmLzxcControlData clcd = new ChmLzxcControlData();
+        clcd.parse(dir_chunk, clcd);
+        windowSize = (int) clcd.getWindowSize();
+    }
+
+    @Test
+    public void testChmLzxStateConstructor() throws TikaException {
+        chmLzxState = new ChmLzxState(windowSize);
+        assertNotNull(chmLzxState);
+    }
+
+    @Test
+    public void testToString() throws TikaException {
+        if (chmLzxState == null)
+            testChmLzxStateConstructor();
+        assertTrue(chmLzxState.toString().length() > 20);
+    }
+
+    // TODO add more tests
+
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcControlData.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcControlData.java b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcControlData.java
index 4449b70..e7992bf 100644
--- a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcControlData.java
+++ b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcControlData.java
@@ -1,144 +1,144 @@
-/*
- * 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.tika.parser.chm;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
-import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
-import org.apache.tika.parser.chm.accessor.ChmItspHeader;
-import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
-import org.apache.tika.parser.chm.core.ChmCommons;
-import org.apache.tika.parser.chm.core.ChmConstants;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests all public methods of ChmLzxcControlData block
- */
-public class TestChmLzxcControlData {
-    private ChmLzxcControlData chmLzxcControlData = null;
-
-    @Before
-    public void setUp() throws Exception {
-        byte[] data = TestParameters.chmData;
-        /* Creates and parses itsf header */
-        ChmItsfHeader chmItsHeader = new ChmItsfHeader();
-        // chmItsHeader.parse(Arrays.copyOfRange(data, 0,
-        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
-        chmItsHeader.parse(ChmCommons.copyOfRange(data, 0,
-                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
-        /* Creates and parses itsp block */
-        ChmItspHeader chmItspHeader = new ChmItspHeader();
-        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
-        // chmItsHeader.getDirOffset(),
-        // (int) chmItsHeader.getDirOffset()
-        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        chmItspHeader.parse(ChmCommons.copyOfRange(data,
-                (int) chmItsHeader.getDirOffset(),
-                (int) chmItsHeader.getDirOffset()
-                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        /* Creating instance of ChmDirListingContainer */
-        ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(
-                data, chmItsHeader, chmItspHeader);
-        int indexOfControlData = chmDirListCont.getControlDataIndex();
-
-        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
-                ChmConstants.LZXC.getBytes(UTF_8));
-        byte[] dir_chunk = null;
-        if (indexOfResetTable > 0) {
-            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
-            // indexOfResetTable
-            // +
-            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
-            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
-                    indexOfResetTable
-                            + chmDirListCont.getDirectoryListingEntryList()
-                                    .get(indexOfControlData).getLength());
-        }
-
-        /* Creates and parses control block */
-        chmLzxcControlData = new ChmLzxcControlData();
-        chmLzxcControlData.parse(dir_chunk, chmLzxcControlData);
-
-    }
-
-    @Test
-    public void testConstructorNotNull() {
-        assertNotNull(chmLzxcControlData);
-    }
-
-    @Test
-    public void testGetResetInterval() {
-        assertEquals(TestParameters.VP_RESET_INTERVAL,
-                chmLzxcControlData.getResetInterval());
-    }
-
-    @Test
-    public void testGetSize() {
-        assertEquals(TestParameters.VP_CONTROL_DATA_SIZE,
-                chmLzxcControlData.getSize());
-    }
-
-    @Test
-    public void testGetUnknown_18() {
-        assertEquals(TestParameters.VP_UNKNOWN_18,
-                chmLzxcControlData.getUnknown_18());
-    }
-
-    @Test
-    public void testGetVersion() {
-        assertEquals(TestParameters.VP_CONTROL_DATA_VERSION,
-                chmLzxcControlData.getVersion());
-    }
-
-    @Test
-    public void testGetWindowSize() {
-        assertEquals(TestParameters.VP_WINDOW_SIZE,
-                chmLzxcControlData.getWindowSize());
-    }
-
-    @Test
-    public void testGetWindowsPerReset() {
-        assertEquals(TestParameters.VP_WINDOWS_PER_RESET,
-                chmLzxcControlData.getWindowsPerReset());
-    }
-
-    @Test
-    public void testGetToString() {
-        assertTrue(chmLzxcControlData.toString().contains(
-                TestParameters.VP_CONTROL_DATA_SIGNATURE));
-    }
-
-    @Test
-    public void testGetSignature() {
-        assertEquals(
-                TestParameters.VP_CONTROL_DATA_SIGNATURE.getBytes(UTF_8).length,
-                chmLzxcControlData.getSignature().length);
-    }
-
-    @Test
-    public void testGetSignaure() {
-        assertEquals(
-                TestParameters.VP_CONTROL_DATA_SIGNATURE.getBytes(UTF_8).length,
-                chmLzxcControlData.getSignature().length);
-    }
-
-}
+/*
+ * 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.tika.parser.chm;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
+import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
+import org.apache.tika.parser.chm.accessor.ChmItspHeader;
+import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
+import org.apache.tika.parser.chm.core.ChmCommons;
+import org.apache.tika.parser.chm.core.ChmConstants;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests all public methods of ChmLzxcControlData block
+ */
+public class TestChmLzxcControlData {
+    private ChmLzxcControlData chmLzxcControlData = null;
+
+    @Before
+    public void setUp() throws Exception {
+        byte[] data = TestParameters.chmData;
+        /* Creates and parses itsf header */
+        ChmItsfHeader chmItsHeader = new ChmItsfHeader();
+        // chmItsHeader.parse(Arrays.copyOfRange(data, 0,
+        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
+        chmItsHeader.parse(ChmCommons.copyOfRange(data, 0,
+                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
+        /* Creates and parses itsp block */
+        ChmItspHeader chmItspHeader = new ChmItspHeader();
+        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
+        // chmItsHeader.getDirOffset(),
+        // (int) chmItsHeader.getDirOffset()
+        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        chmItspHeader.parse(ChmCommons.copyOfRange(data,
+                (int) chmItsHeader.getDirOffset(),
+                (int) chmItsHeader.getDirOffset()
+                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        /* Creating instance of ChmDirListingContainer */
+        ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(
+                data, chmItsHeader, chmItspHeader);
+        int indexOfControlData = chmDirListCont.getControlDataIndex();
+
+        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
+                ChmConstants.LZXC.getBytes(UTF_8));
+        byte[] dir_chunk = null;
+        if (indexOfResetTable > 0) {
+            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
+            // indexOfResetTable
+            // +
+            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
+            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
+                    indexOfResetTable
+                            + chmDirListCont.getDirectoryListingEntryList()
+                                    .get(indexOfControlData).getLength());
+        }
+
+        /* Creates and parses control block */
+        chmLzxcControlData = new ChmLzxcControlData();
+        chmLzxcControlData.parse(dir_chunk, chmLzxcControlData);
+
+    }
+
+    @Test
+    public void testConstructorNotNull() {
+        assertNotNull(chmLzxcControlData);
+    }
+
+    @Test
+    public void testGetResetInterval() {
+        assertEquals(TestParameters.VP_RESET_INTERVAL,
+                chmLzxcControlData.getResetInterval());
+    }
+
+    @Test
+    public void testGetSize() {
+        assertEquals(TestParameters.VP_CONTROL_DATA_SIZE,
+                chmLzxcControlData.getSize());
+    }
+
+    @Test
+    public void testGetUnknown_18() {
+        assertEquals(TestParameters.VP_UNKNOWN_18,
+                chmLzxcControlData.getUnknown_18());
+    }
+
+    @Test
+    public void testGetVersion() {
+        assertEquals(TestParameters.VP_CONTROL_DATA_VERSION,
+                chmLzxcControlData.getVersion());
+    }
+
+    @Test
+    public void testGetWindowSize() {
+        assertEquals(TestParameters.VP_WINDOW_SIZE,
+                chmLzxcControlData.getWindowSize());
+    }
+
+    @Test
+    public void testGetWindowsPerReset() {
+        assertEquals(TestParameters.VP_WINDOWS_PER_RESET,
+                chmLzxcControlData.getWindowsPerReset());
+    }
+
+    @Test
+    public void testGetToString() {
+        assertTrue(chmLzxcControlData.toString().contains(
+                TestParameters.VP_CONTROL_DATA_SIGNATURE));
+    }
+
+    @Test
+    public void testGetSignature() {
+        assertEquals(
+                TestParameters.VP_CONTROL_DATA_SIGNATURE.getBytes(UTF_8).length,
+                chmLzxcControlData.getSignature().length);
+    }
+
+    @Test
+    public void testGetSignaure() {
+        assertEquals(
+                TestParameters.VP_CONTROL_DATA_SIGNATURE.getBytes(UTF_8).length,
+                chmLzxcControlData.getSignature().length);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tika/blob/c7a6bcac/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcResetTable.java
----------------------------------------------------------------------
diff --git a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcResetTable.java b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcResetTable.java
index d84f702..79c2804 100644
--- a/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcResetTable.java
+++ b/tika-parser-modules/tika-parser-office-module/src/test/java/org/apache/tika/parser/chm/TestChmLzxcResetTable.java
@@ -1,156 +1,156 @@
-/*
- * 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.tika.parser.chm;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
-import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
-import org.apache.tika.parser.chm.accessor.ChmItspHeader;
-import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
-import org.apache.tika.parser.chm.accessor.ChmLzxcResetTable;
-import org.apache.tika.parser.chm.assertion.ChmAssert;
-import org.apache.tika.parser.chm.core.ChmCommons;
-import org.apache.tika.parser.chm.core.ChmConstants;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestChmLzxcResetTable {
-    private ChmLzxcResetTable chmLzxcResetTable = null;
-
-    @Before
-    public void setUp() throws Exception {
-        byte[] data = TestParameters.chmData;
-        /* Creates and parses itsf header */
-        ChmItsfHeader chmItsfHeader = new ChmItsfHeader();
-        // chmItsfHeader.parse(Arrays.copyOfRange(data, 0,
-        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
-        chmItsfHeader.parse(ChmCommons.copyOfRange(data, 0,
-                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
-        /* Creates and parses itsp block */
-        ChmItspHeader chmItspHeader = new ChmItspHeader();
-        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
-        // chmItsfHeader.getDirOffset(),
-        // (int) chmItsfHeader.getDirOffset()
-        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        chmItspHeader.parse(ChmCommons.copyOfRange(data,
-                (int) chmItsfHeader.getDirOffset(),
-                (int) chmItsfHeader.getDirOffset()
-                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
-        /* Creating instance of ChmDirListingContainer */
-        ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(
-                data, chmItsfHeader, chmItspHeader);
-        int indexOfControlData = chmDirListCont.getControlDataIndex();
-
-        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
-                ChmConstants.LZXC.getBytes(UTF_8));
-        byte[] dir_chunk = null;
-        if (indexOfResetTable > 0) {
-            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
-            // indexOfResetTable
-            // +
-            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
-            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
-                    indexOfResetTable
-                            + chmDirListCont.getDirectoryListingEntryList()
-                                    .get(indexOfControlData).getLength());
-        }
-
-        /* Creates and parses control block */
-        ChmLzxcControlData chmLzxcControlData = new ChmLzxcControlData();
-        chmLzxcControlData.parse(dir_chunk, chmLzxcControlData);
-
-        indexOfResetTable = chmDirListCont.getResetTableIndex();
-        chmLzxcResetTable = new ChmLzxcResetTable();
-
-        int startIndex = (int) chmDirListCont.getDataOffset()
-                + chmDirListCont.getDirectoryListingEntryList()
-                        .get(indexOfResetTable).getOffset();
-
-        ChmAssert.assertCopyingDataIndex(startIndex, data.length);
-
-        // dir_chunk = Arrays.copyOfRange(data, startIndex, startIndex
-        // +
-        // chmDirListCont.getDirectoryListingEntryList().get(indexOfResetTable).getLength());
-        dir_chunk = ChmCommons.copyOfRange(
-                data,
-                startIndex,
-                startIndex
-                        + chmDirListCont.getDirectoryListingEntryList()
-                                .get(indexOfResetTable).getLength());
-
-        chmLzxcResetTable.parse(dir_chunk, chmLzxcResetTable);
-    }
-
-    @Test
-    public void testGetBlockAddress() {
-        assertEquals(TestParameters.VP_RESET_TABLE_BA,
-                chmLzxcResetTable.getBlockAddress().length);
-    }
-
-    @Test
-    public void testGetBlockCount() {
-        assertEquals(TestParameters.VP_RESET_TABLE_BA,
-                chmLzxcResetTable.getBlockCount());
-    }
-
-    @Test
-    public void testGetBlockLen() {
-        assertEquals(TestParameters.VP_RES_TBL_BLOCK_LENGTH,
-                chmLzxcResetTable.getBlockLen());
-    }
-
-    @Test
-    public void testGetCompressedLen() {
-        assertEquals(TestParameters.VP_RES_TBL_COMPR_LENGTH,
-                chmLzxcResetTable.getCompressedLen());
-    }
-
-    @Test
-    public void testGetTableOffset() {
-        assertEquals(TestParameters.VP_TBL_OFFSET,
-                chmLzxcResetTable.getTableOffset());
-    }
-
-    @Test
-    public void testGetUncompressedLen() {
-        assertEquals(TestParameters.VP_RES_TBL_UNCOMP_LENGTH,
-                chmLzxcResetTable.getUncompressedLen());
-    }
-
-    @Test
-    public void testGetUnknown() {
-        assertEquals(TestParameters.VP_RES_TBL_UNKNOWN,
-                chmLzxcResetTable.getUnknown());
-    }
-
-    @Test
-    public void testGetVersion() {
-        assertEquals(TestParameters.VP_RES_TBL_VERSION,
-                chmLzxcResetTable.getVersion());
-    }
-
-    @Test
-    public void testToString() {
-        assertTrue(chmLzxcResetTable.toString().length() > 0);
-    }
-
-    // TODO: add setters to be tested
-}
+/*
+ * 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.tika.parser.chm;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
+import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
+import org.apache.tika.parser.chm.accessor.ChmItspHeader;
+import org.apache.tika.parser.chm.accessor.ChmLzxcControlData;
+import org.apache.tika.parser.chm.accessor.ChmLzxcResetTable;
+import org.apache.tika.parser.chm.assertion.ChmAssert;
+import org.apache.tika.parser.chm.core.ChmCommons;
+import org.apache.tika.parser.chm.core.ChmConstants;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestChmLzxcResetTable {
+    private ChmLzxcResetTable chmLzxcResetTable = null;
+
+    @Before
+    public void setUp() throws Exception {
+        byte[] data = TestParameters.chmData;
+        /* Creates and parses itsf header */
+        ChmItsfHeader chmItsfHeader = new ChmItsfHeader();
+        // chmItsfHeader.parse(Arrays.copyOfRange(data, 0,
+        // ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
+        chmItsfHeader.parse(ChmCommons.copyOfRange(data, 0,
+                ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsfHeader);
+        /* Creates and parses itsp block */
+        ChmItspHeader chmItspHeader = new ChmItspHeader();
+        // chmItspHeader.parse(Arrays.copyOfRange( data, (int)
+        // chmItsfHeader.getDirOffset(),
+        // (int) chmItsfHeader.getDirOffset()
+        // + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        chmItspHeader.parse(ChmCommons.copyOfRange(data,
+                (int) chmItsfHeader.getDirOffset(),
+                (int) chmItsfHeader.getDirOffset()
+                        + ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
+        /* Creating instance of ChmDirListingContainer */
+        ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(
+                data, chmItsfHeader, chmItspHeader);
+        int indexOfControlData = chmDirListCont.getControlDataIndex();
+
+        int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
+                ChmConstants.LZXC.getBytes(UTF_8));
+        byte[] dir_chunk = null;
+        if (indexOfResetTable > 0) {
+            // dir_chunk = Arrays.copyOfRange( data, indexOfResetTable,
+            // indexOfResetTable
+            // +
+            // chmDirListCont.getDirectoryListingEntryList().get(indexOfControlData).getLength());
+            dir_chunk = ChmCommons.copyOfRange(data, indexOfResetTable,
+                    indexOfResetTable
+                            + chmDirListCont.getDirectoryListingEntryList()
+                                    .get(indexOfControlData).getLength());
+        }
+
+        /* Creates and parses control block */
+        ChmLzxcControlData chmLzxcControlData = new ChmLzxcControlData();
+        chmLzxcControlData.parse(dir_chunk, chmLzxcControlData);
+
+        indexOfResetTable = chmDirListCont.getResetTableIndex();
+        chmLzxcResetTable = new ChmLzxcResetTable();
+
+        int startIndex = (int) chmDirListCont.getDataOffset()
+                + chmDirListCont.getDirectoryListingEntryList()
+                        .get(indexOfResetTable).getOffset();
+
+        ChmAssert.assertCopyingDataIndex(startIndex, data.length);
+
+        // dir_chunk = Arrays.copyOfRange(data, startIndex, startIndex
+        // +
+        // chmDirListCont.getDirectoryListingEntryList().get(indexOfResetTable).getLength());
+        dir_chunk = ChmCommons.copyOfRange(
+                data,
+                startIndex,
+                startIndex
+                        + chmDirListCont.getDirectoryListingEntryList()
+                                .get(indexOfResetTable).getLength());
+
+        chmLzxcResetTable.parse(dir_chunk, chmLzxcResetTable);
+    }
+
+    @Test
+    public void testGetBlockAddress() {
+        assertEquals(TestParameters.VP_RESET_TABLE_BA,
+                chmLzxcResetTable.getBlockAddress().length);
+    }
+
+    @Test
+    public void testGetBlockCount() {
+        assertEquals(TestParameters.VP_RESET_TABLE_BA,
+                chmLzxcResetTable.getBlockCount());
+    }
+
+    @Test
+    public void testGetBlockLen() {
+        assertEquals(TestParameters.VP_RES_TBL_BLOCK_LENGTH,
+                chmLzxcResetTable.getBlockLen());
+    }
+
+    @Test
+    public void testGetCompressedLen() {
+        assertEquals(TestParameters.VP_RES_TBL_COMPR_LENGTH,
+                chmLzxcResetTable.getCompressedLen());
+    }
+
+    @Test
+    public void testGetTableOffset() {
+        assertEquals(TestParameters.VP_TBL_OFFSET,
+                chmLzxcResetTable.getTableOffset());
+    }
+
+    @Test
+    public void testGetUncompressedLen() {
+        assertEquals(TestParameters.VP_RES_TBL_UNCOMP_LENGTH,
+                chmLzxcResetTable.getUncompressedLen());
+    }
+
+    @Test
+    public void testGetUnknown() {
+        assertEquals(TestParameters.VP_RES_TBL_UNKNOWN,
+                chmLzxcResetTable.getUnknown());
+    }
+
+    @Test
+    public void testGetVersion() {
+        assertEquals(TestParameters.VP_RES_TBL_VERSION,
+                chmLzxcResetTable.getVersion());
+    }
+
+    @Test
+    public void testToString() {
+        assertTrue(chmLzxcResetTable.toString().length() > 0);
+    }
+
+    // TODO: add setters to be tested
+}