Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmItspHeader.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmItspHeader.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmItspHeader.java	(working copy)
@@ -16,120 +16,116 @@
  */
 package org.apache.tika.parser.chm;
 
-import java.util.Arrays;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.io.TikaInputStream;
 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;
 
+
 /**
  * Tests all public methods of the ChmItspHeader
- * 
+ *
  */
-public class TestChmItspHeader extends TestCase {
+public class TestChmItspHeader extends TestCase{
 	private ChmItspHeader chmItspHeader = null;
-
 	public void setUp() throws Exception {
-		TikaInputStream stream = TikaInputStream
-				.get(TestContainerAwareDetector.class
-						.getResource(TestParameters.chmFile));
-		byte[] data = TestUtils.toByteArray(stream);
-
+		byte[] data = TestUtils.toByteArray(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
+		
 		ChmItsfHeader chmItsfHeader = new ChmItsfHeader();
-		chmItsfHeader.parse(
-				Arrays.copyOfRange(data, 0, ChmConstants.CHM_ITSF_V3_LEN - 1),
-				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(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);
 	}
-
-	public void testGetBlock_len() {
-		Assert.assertEquals(TestParameters.VP_BLOCK_LENGTH,
-				chmItspHeader.getBlock_len());
+	
+	public void testGetBlock_len(){
+		Assert.assertEquals(TestParameters.VP_BLOCK_LENGTH, chmItspHeader.getBlock_len());
 	}
-
-	public void testGetBlockidx_intvl() {
-		Assert.assertEquals(TestParameters.VP_BLOCK_INDEX_INTERVAL,
-				chmItspHeader.getBlockidx_intvl());
+	
+	
+	public void testGetBlockidx_intvl(){
+		Assert.assertEquals(TestParameters.VP_BLOCK_INDEX_INTERVAL, chmItspHeader.getBlockidx_intvl());
 	}
-
-	public void testGetHeader_len() {
-		Assert.assertEquals(TestParameters.VP_ITSP_HEADER_LENGTH,
-				chmItspHeader.getHeader_len());
+	
+	
+	public void testGetHeader_len(){
+		Assert.assertEquals(TestParameters.VP_ITSP_HEADER_LENGTH, chmItspHeader.getHeader_len());
 	}
-
-	public void testGetIndex_depth() {
-		Assert.assertEquals(TestParameters.VP_INDEX_DEPTH,
-				chmItspHeader.getIndex_depth());
+	
+	
+	public void testGetIndex_depth(){
+		Assert.assertEquals(TestParameters.VP_INDEX_DEPTH, chmItspHeader.getIndex_depth());
 	}
-
-	public void testGetIndex_head() {
-		Assert.assertEquals(TestParameters.VP_INDEX_HEAD,
-				chmItspHeader.getIndex_head());
+	
+	
+	public void testGetIndex_head(){
+		Assert.assertEquals(TestParameters.VP_INDEX_HEAD, chmItspHeader.getIndex_head());
 	}
-
-	public void testGetIndex_root() {
-		Assert.assertEquals(TestParameters.VP_INDEX_ROOT,
-				chmItspHeader.getIndex_root());
+	
+	
+	public void testGetIndex_root(){
+		Assert.assertEquals(TestParameters.VP_INDEX_ROOT, chmItspHeader.getIndex_root());
 	}
-
-	public void testGetLang_id() {
-		Assert.assertEquals(TestParameters.VP_LANGUAGE_ID,
-				chmItspHeader.getLang_id());
+	
+	
+	public void testGetLang_id(){
+		Assert.assertEquals(TestParameters.VP_LANGUAGE_ID,chmItspHeader.getLang_id());
 	}
-
-	public void testGetNum_blocks() {
-		Assert.assertEquals(TestParameters.VP_UNKNOWN_NUM_BLOCKS,
-				chmItspHeader.getNum_blocks());
+	
+	
+	public void testGetNum_blocks(){
+		Assert.assertEquals(TestParameters.VP_UNKNOWN_NUM_BLOCKS,chmItspHeader.getNum_blocks());
 	}
-
-	public void testGetUnknown_000c() {
-		Assert.assertEquals(TestParameters.VP_ITSP_UNKNOWN_000C,
-				chmItspHeader.getUnknown_000c());
+	
+	
+	public void testGetUnknown_000c(){
+		Assert.assertEquals(TestParameters.VP_ITSP_UNKNOWN_000C,chmItspHeader.getUnknown_000c());
 	}
-
-	public void testGetUnknown_0024() {
-		Assert.assertEquals(TestParameters.VP_ITSP_UNKNOWN_0024,
-				chmItspHeader.getUnknown_0024());
+	
+	
+	public void testGetUnknown_0024(){
+		Assert.assertEquals(TestParameters.VP_ITSP_UNKNOWN_0024, chmItspHeader.getUnknown_0024());
 	}
-
-	public void testGetUnknown_002() {
-		Assert.assertEquals(TestParameters.VP_ITSP_UNKNOWN_002C,
-				chmItspHeader.getUnknown_002c());
+	
+	
+	public void testGetUnknown_002(){
+		Assert.assertEquals(TestParameters.VP_ITSP_UNKNOWN_002C, chmItspHeader.getUnknown_002c());
 	}
-
-	public void testGetUnknown_0044() {
-		Assert.assertEquals(TestParameters.VP_ITSP_BYTEARR_LEN,
-				chmItspHeader.getUnknown_0044().length);
+	
+	
+	public void testGetUnknown_0044(){
+		Assert.assertEquals(TestParameters.VP_ITSP_BYTEARR_LEN, chmItspHeader.getUnknown_0044().length);
 	}
-
-	public void testGetVersion() {
-		Assert.assertEquals(TestParameters.VP_ITSP_VERSION,
-				chmItspHeader.getVersion());
+	
+	
+	public void testGetVersion(){
+		Assert.assertEquals(TestParameters.VP_ITSP_VERSION, chmItspHeader.getVersion());
 	}
-
-	public void testGetSignature() {
-		Assert.assertEquals(TestParameters.VP_ISTP_SIGNATURE, new String(
-				chmItspHeader.getSignature()));
+	
+	
+	public void testGetSignature(){
+		Assert.assertEquals(TestParameters.VP_ISTP_SIGNATURE, new String(chmItspHeader.getSignature()));
 	}
-
-	public void testGetSystem_uuid() {
-		Assert.assertEquals(TestParameters.VP_ITSP_BYTEARR_LEN,
-				chmItspHeader.getSystem_uuid().length);
+	
+	
+	public void testGetSystem_uuid(){
+		Assert.assertEquals(TestParameters.VP_ITSP_BYTEARR_LEN, chmItspHeader.getSystem_uuid().length);
 	}
-
-	public void testToString() {
-		Assert.assertTrue(chmItspHeader.toString().contains(
-				TestParameters.VP_ISTP_SIGNATURE));
+	
+	
+	public void testToString(){
+		Assert.assertTrue(chmItspHeader.toString().contains(TestParameters.VP_ISTP_SIGNATURE));
 	}
 
 	public void tearDown() throws Exception {
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestDirectoryListingEntry.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestDirectoryListingEntry.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestDirectoryListingEntry.java	(working copy)
@@ -16,56 +16,67 @@
  */
 package org.apache.tika.parser.chm;
 
+
 import junit.framework.Assert;
 import junit.framework.TestCase;
+
 import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
 
 /**
  * Tests public methods of the DirectoryListingEntry class
  * 
+ * @author olegt
+ *
  */
-public class TestDirectoryListingEntry extends TestCase {
+public class TestDirectoryListingEntry extends TestCase{
 	private DirectoryListingEntry dle = null;
 
+	
 	public void setUp() throws Exception {
-		dle = new DirectoryListingEntry(TestParameters.nameLength,
-				TestParameters.entryName, TestParameters.entryType,
-				TestParameters.offset, TestParameters.length);
+		dle = new DirectoryListingEntry(TestParameters.nameLength, TestParameters.entryName, TestParameters.entryType, TestParameters.offset, TestParameters.length);
 	}
 
-	public void testDefaultConstructor() {
+	
+	public void testDefaultConstructor(){
 		Assert.assertNotNull(dle);
 	}
-
-	public void testParamConstructor() {
+	
+	
+	public void testParamConstructor(){
 		Assert.assertEquals(TestParameters.nameLength, dle.getNameLength());
 		Assert.assertEquals(TestParameters.entryName, dle.getName());
 		Assert.assertEquals(TestParameters.entryType, dle.getEntryType());
 		Assert.assertEquals(TestParameters.offset, dle.getOffset());
 		Assert.assertEquals(TestParameters.length, dle.getLength());
 	}
-
-	public void testToString() {
+	
+	 
+	public void testToString(){
 		Assert.assertNotNull(dle.toString());
 	}
-
-	public void testGetNameLength() {
+	
+	
+	public void testGetNameLength(){
 		Assert.assertEquals(TestParameters.nameLength, dle.getNameLength());
 	}
-
-	public void testGetName() {
+	
+	
+	public void testGetName(){
 		Assert.assertEquals(TestParameters.entryName, dle.getName());
 	}
-
-	public void testGetEntryType() {
+	
+	
+	public void testGetEntryType(){
 		Assert.assertEquals(TestParameters.entryType, dle.getEntryType());
 	}
-
-	public void testGetOffset() {
+	
+	
+	public void testGetOffset(){
 		Assert.assertEquals(TestParameters.offset, dle.getOffset());
 	}
-
-	public void testGetLength() {
+	
+	
+	public void testGetLength(){
 		Assert.assertEquals(TestParameters.length, dle.getLength());
 	}
 }
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestUtils.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestUtils.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestUtils.java	(working copy)
@@ -26,8 +26,7 @@
 	/**
 	 * Converts InputStream to byte array
 	 * 
-	 * @param is
-	 *            InputStream
+	 * @param is InputStream
 	 * @return byte[]
 	 * 
 	 * @throws IOException
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmExtractor.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmExtractor.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmExtractor.java	(working copy)
@@ -16,52 +16,75 @@
  */
 package org.apache.tika.parser.chm;
 
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.tika.detect.TestContainerAwareDetector;
+import org.apache.tika.exception.TikaException;
 import org.apache.tika.io.TikaInputStream;
+import org.apache.tika.metadata.Metadata;
 import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
 import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
 import org.apache.tika.parser.chm.core.ChmExtractor;
 
-public class TestChmExtractor extends TestCase {
+
+public class TestChmExtractor extends TestCase{
 	private ChmExtractor chmExtractor = null;
-
+	
 	public void setUp() throws Exception {
-		TikaInputStream stream = TikaInputStream
-				.get(TestContainerAwareDetector.class
-						.getResource(TestParameters.chmFile));
-		chmExtractor = new ChmExtractor(stream);
+		chmExtractor = new ChmExtractor(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
 	}
 
-	public void testEnumerateChm() {
+	public void testEnumerateChm(){
 		List<String> chmEntries = chmExtractor.enumerateChm();
-		Assert.assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER,
-				chmEntries.size());
+		Assert.assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER, chmEntries.size());
 	}
-
-	public void testGetChmDirList() {
+	
+	public void testGetChmDirList(){
 		Assert.assertNotNull(chmExtractor.getChmDirList());
 	}
-
-	public void testExtractChmEntry() {
+	
+	public void testExtractChmEntry(){
 		ChmDirectoryListingSet entries = chmExtractor.getChmDirList();
 		byte[][] localFile;
 		int count = 0;
-		for (Iterator<DirectoryListingEntry> it = entries
-				.getDirectoryListingEntryList().iterator(); it.hasNext();) {
+		for (Iterator<DirectoryListingEntry> it = entries.getDirectoryListingEntryList().iterator(); it.hasNext();) {
 			localFile = chmExtractor.extractChmEntry(it.next());
-			if (localFile != null) {
+			if(localFile != null){
 				++count;
 			}
 		}
 		Assert.assertEquals(TestParameters.VP_CHM_ENTITIES_NUMBER, count);
 	}
-
+	
+	public void testChmParser(){
+		List<String> files = new ArrayList<String>();
+		files.add("/test-documents/testChm.chm");
+		files.add("/test-documents/testChm3.chm");
+		
+		for (String fileName : files) {
+			try {
+				InputStream stream = TikaInputStream.get(TestChmBlockInfo.class.getResource(fileName));
+				CHMDocumentInformation chmDocInfo = CHMDocumentInformation.load(stream);
+				Metadata md = new Metadata();
+				String text = chmDocInfo.getText();
+				chmDocInfo.getCHMDocInformation(md);
+				assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString().trim());
+				assertTrue(text.length() > 0);
+			} catch (IOException e) {
+				e.printStackTrace();
+			} catch (TikaException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+	
 	public void tearDown() throws Exception {
 	}
 
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmLzxcControlData.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmLzxcControlData.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmLzxcControlData.java	(working copy)
@@ -16,12 +16,9 @@
  */
 package org.apache.tika.parser.chm;
 
-import java.util.Arrays;
-
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
 import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
@@ -33,98 +30,84 @@
 /**
  * Tests all public methods of ChmLzxcControlData block
  */
-public class TestChmLzxcControlData extends TestCase {
+public class TestChmLzxcControlData extends TestCase{
 	private ChmLzxcControlData chmLzxcControlData = null;
 
 	public void setUp() throws Exception {
-		TikaInputStream stream = TikaInputStream
-				.get(TestContainerAwareDetector.class
-						.getResource(TestParameters.chmFile));
-
-		byte[] data = TestUtils.toByteArray(stream);
+		byte[] data = TestUtils.toByteArray(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
 		/* Creates and parses itsf header */
 		ChmItsfHeader chmItsHeader = new ChmItsfHeader();
-		chmItsHeader.parse(
-				Arrays.copyOfRange(data, 0, ChmConstants.CHM_ITSF_V3_LEN - 1),
-				chmItsHeader);
+//		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(),
+//		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);
+				+ ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
 		/* Creating instance of ChmDirListingContainer */
-		ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(
-				data, chmItsHeader, chmItspHeader);
+		ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(data, chmItsHeader, chmItspHeader);
 		int indexOfControlData = chmDirListCont.getControlDataIndex();
-
-		int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
-				ChmConstants.LZXC.getBytes());
+		
+		int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data, ChmConstants.LZXC.getBytes());
 		byte[] dir_chunk = null;
-		if (indexOfResetTable > 0) {
-			dir_chunk = Arrays.copyOfRange(data, indexOfResetTable,
-					indexOfResetTable
-							+ chmDirListCont.getDirectoryListingEntryList()
-									.get(indexOfControlData).getLength());
+		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);
-
+		
 	}
 
-	public void testConstructorNotNull() {
+	public void testConstructorNotNull(){
 		Assert.assertNotNull(chmLzxcControlData);
 	}
-
-	public void testGetResetInterval() {
-		Assert.assertEquals(TestParameters.VP_RESET_INTERVAL,
-				chmLzxcControlData.getResetInterval());
+	
+	public void testGetResetInterval(){
+		Assert.assertEquals(TestParameters.VP_RESET_INTERVAL, chmLzxcControlData.getResetInterval());
 	}
-
-	public void testGetSize() {
-		Assert.assertEquals(TestParameters.VP_CONTROL_DATA_SIZE,
-				chmLzxcControlData.getSize());
+	
+	public void testGetSize(){
+		Assert.assertEquals(TestParameters.VP_CONTROL_DATA_SIZE, chmLzxcControlData.getSize());
 	}
-
-	public void testGetUnknown_18() {
-		Assert.assertEquals(TestParameters.VP_UNKNOWN_18,
-				chmLzxcControlData.getUnknown_18());
+	
+	public void testGetUnknown_18(){
+		Assert.assertEquals(TestParameters.VP_UNKNOWN_18, chmLzxcControlData.getUnknown_18());
 	}
-
-	public void testGetVersion() {
-		Assert.assertEquals(TestParameters.VP_CONTROL_DATA_VERSION,
-				chmLzxcControlData.getVersion());
+	
+	public void testGetVersion(){
+		Assert.assertEquals(TestParameters.VP_CONTROL_DATA_VERSION, chmLzxcControlData.getVersion());
 	}
-
-	public void testGetWindowSize() {
-		Assert.assertEquals(TestParameters.VP_WINDOW_SIZE,
-				chmLzxcControlData.getWindowSize());
+	
+	public void testGetWindowSize(){
+		Assert.assertEquals(TestParameters.VP_WINDOW_SIZE, chmLzxcControlData.getWindowSize());
 	}
-
-	public void testGetWindowsPerReset() {
-		Assert.assertEquals(TestParameters.VP_WINDOWS_PER_RESET,
-				chmLzxcControlData.getWindowsPerReset());
+	
+	public void testGetWindowsPerReset(){
+		Assert.assertEquals(TestParameters.VP_WINDOWS_PER_RESET, chmLzxcControlData.getWindowsPerReset());
 	}
-
-	public void testGetToString() {
-		Assert.assertTrue(chmLzxcControlData.toString().contains(
-				TestParameters.VP_CONTROL_DATA_SIGNATURE));
+	
+	public void testGetToString(){
+		Assert.assertTrue(chmLzxcControlData.toString().contains(TestParameters.VP_CONTROL_DATA_SIGNATURE));
 	}
-
-	public void testGetSignature() {
-		Assert.assertEquals(
-				TestParameters.VP_CONTROL_DATA_SIGNATURE.getBytes().length,
-				chmLzxcControlData.getSignature().length);
+	
+	public void testGetSignature(){
+		Assert.assertEquals(TestParameters.VP_CONTROL_DATA_SIGNATURE.getBytes().length, chmLzxcControlData.getSignature().length);
 	}
-
-	public void testGetSignaure() {
-		Assert.assertEquals(
-				TestParameters.VP_CONTROL_DATA_SIGNATURE.getBytes().length,
-				chmLzxcControlData.getSignature().length);
+	
+	public void testGetSignaure(){
+		Assert.assertEquals(TestParameters.VP_CONTROL_DATA_SIGNATURE.getBytes().length, chmLzxcControlData.getSignature().length);
 	}
-
+	
 	public void tearDown() throws Exception {
 	}
+
 }
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmLzxcResetTable.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmLzxcResetTable.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmLzxcResetTable.java	(working copy)
@@ -17,12 +17,9 @@
 
 package org.apache.tika.parser.chm;
 
-import java.util.Arrays;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
-
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
 import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
@@ -33,107 +30,103 @@
 import org.apache.tika.parser.chm.core.ChmCommons;
 import org.apache.tika.parser.chm.core.ChmConstants;
 
-public class TestChmLzxcResetTable extends TestCase {
+public class TestChmLzxcResetTable extends TestCase{
 	private ChmLzxcResetTable chmLzxcResetTable = null;
 
 	public void setUp() throws Exception {
-		TikaInputStream stream = TikaInputStream
-				.get(TestContainerAwareDetector.class
-						.getResource(TestParameters.chmFile));
-
-		byte[] data = TestUtils.toByteArray(stream);
+		byte[] data = TestUtils.toByteArray(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
 		/* Creates and parses itsf header */
 		ChmItsfHeader chmItsfHeader = new ChmItsfHeader();
-		chmItsfHeader.parse(
-				Arrays.copyOfRange(data, 0, ChmConstants.CHM_ITSF_V3_LEN - 1),
-				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(),
+//		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);
+				+ ChmConstants.CHM_ITSP_V1_LEN), chmItspHeader);
 		/* Creating instance of ChmDirListingContainer */
-		ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(
-				data, chmItsfHeader, chmItspHeader);
+		ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(data, chmItsfHeader, chmItspHeader);
 		int indexOfControlData = chmDirListCont.getControlDataIndex();
-
-		int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
-				ChmConstants.LZXC.getBytes());
+		
+		int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data, ChmConstants.LZXC.getBytes());
 		byte[] dir_chunk = null;
-		if (indexOfResetTable > 0) {
-			dir_chunk = Arrays.copyOfRange(data, indexOfResetTable,
-					indexOfResetTable
-							+ chmDirListCont.getDirectoryListingEntryList()
-									.get(indexOfControlData).getLength());
+		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();
+		
+		indexOfResetTable =  chmDirListCont.getResetTableIndex();
 		chmLzxcResetTable = new ChmLzxcResetTable();
-
+		
 		int startIndex = (int) chmDirListCont.getDataOffset()
-				+ chmDirListCont.getDirectoryListingEntryList()
-						.get(indexOfResetTable).getOffset();
-
+				         + chmDirListCont.getDirectoryListingEntryList().get(indexOfResetTable).getOffset();
+		
 		ChmAssert.assertCopyingDataIndex(startIndex, data.length);
-
-		dir_chunk = Arrays.copyOfRange(
-				data,
-				startIndex,
-				startIndex
-						+ chmDirListCont.getDirectoryListingEntryList()
-								.get(indexOfResetTable).getLength());
-
+		
+//		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);
 	}
-
-	public void testGetBlockAddress() {
-		Assert.assertEquals(TestParameters.VP_RESET_TABLE_BA,
-				chmLzxcResetTable.getBlockAddress().length);
+	
+	
+	public void testGetBlockAddress(){
+		Assert.assertEquals(TestParameters.VP_RESET_TABLE_BA, chmLzxcResetTable.getBlockAddress().length);
 	}
-
-	public void testGetBlockCount() {
-		Assert.assertEquals(TestParameters.VP_RESET_TABLE_BA,
-				chmLzxcResetTable.getBlockCount());
+	
+	
+	public void testGetBlockCount(){
+		Assert.assertEquals(TestParameters.VP_RESET_TABLE_BA, chmLzxcResetTable.getBlockCount());
 	}
-
-	public void testGetBlockLen() {
-		Assert.assertEquals(TestParameters.VP_RES_TBL_BLOCK_LENGTH,
-				chmLzxcResetTable.getBlockLen());
+	
+	
+	public void testGetBlockLen(){
+		Assert.assertEquals(TestParameters.VP_RES_TBL_BLOCK_LENGTH, chmLzxcResetTable.getBlockLen());
 	}
-
-	public void testGetCompressedLen() {
-		Assert.assertEquals(TestParameters.VP_RES_TBL_COMPR_LENGTH,
-				chmLzxcResetTable.getCompressedLen());
+	
+	
+	public void testGetCompressedLen(){
+		Assert.assertEquals(TestParameters.VP_RES_TBL_COMPR_LENGTH, chmLzxcResetTable.getCompressedLen());
 	}
-
-	public void testGetTableOffset() {
-		Assert.assertEquals(TestParameters.VP_TBL_OFFSET,
-				chmLzxcResetTable.getTableOffset());
+	
+	
+	public void testGetTableOffset(){
+		Assert.assertEquals(TestParameters.VP_TBL_OFFSET, chmLzxcResetTable.getTableOffset());
 	}
-
-	public void testGetUncompressedLen() {
-		Assert.assertEquals(TestParameters.VP_RES_TBL_UNCOMP_LENGTH,
-				chmLzxcResetTable.getUncompressedLen());
+	
+	
+	public void testGetUncompressedLen(){
+		Assert.assertEquals(TestParameters.VP_RES_TBL_UNCOMP_LENGTH, chmLzxcResetTable.getUncompressedLen());
 	}
-
-	public void testGetUnknown() {
-		Assert.assertEquals(TestParameters.VP_RES_TBL_UNKNOWN,
-				chmLzxcResetTable.getUnknown());
+	
+	
+	public void testGetUnknown(){
+		Assert.assertEquals(TestParameters.VP_RES_TBL_UNKNOWN, chmLzxcResetTable.getUnknown());
 	}
-
-	public void testGetVersion() {
-		Assert.assertEquals(TestParameters.VP_RES_TBL_VERSION,
-				chmLzxcResetTable.getVersion());
+	
+	
+	public void testGetVersion(){
+		Assert.assertEquals(TestParameters.VP_RES_TBL_VERSION, chmLzxcResetTable.getVersion());
 	}
-
-	public void testToString() {
+	
+	
+	public void testToString(){
 		Assert.assertTrue(chmLzxcResetTable.toString().length() > 0);
 	}
+	
+	//TODO: add setters to be tested
 
 	public void tearDown() throws Exception {
 	}
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestParameters.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestParameters.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestParameters.java	(working copy)
@@ -23,9 +23,8 @@
  */
 public class TestParameters {
 	/* Prevents initialization */
-	private TestParameters() {
-	}
-
+	private TestParameters(){}
+	
 	/* Tests values */
 	static final int nameLength = 5;
 	static final String entryName = TestParameters.class.getName();
@@ -33,58 +32,58 @@
 	static final int offset = 3;
 	static final int length = 20;
 	static final int NTHREADS = 2;
-
+	
 	static final int BUFFER_SIZE = 16384;
-
+	
 	static final String chmFile = "/test-documents/testChm.chm";
-
+	
 	/* Verification points */
-	static final String VP_CHM_MIME_TYPE = "Content-Type=application/x-chm";
-	static final String VP_EXTRACTED_TEXT = "The TCard method accepts only numeric arguments";
-	static final String VP_ISTF_SIGNATURE = "ITSF";
-	static final String VP_ISTP_SIGNATURE = "ITSP";
-	static final String VP_PMGL_SIGNATURE = "PMGL";
+	static final String VP_CHM_MIME_TYPE = 			"Content-Type=application/x-chm";
+	static final String VP_EXTRACTED_TEXT = 		"The TCard method accepts only numeric arguments";
+	static final String VP_ISTF_SIGNATURE = 		"ITSF";
+	static final String VP_ISTP_SIGNATURE = 		"ITSP";
+	static final String VP_PMGL_SIGNATURE = 		"PMGL";
 	static final String VP_CONTROL_DATA_SIGNATURE = "LZXC";
-
-	static final int VP_DIRECTORY_LENGTH = 4180;
-	static final int VP_DATA_OFFSET_LENGTH = 4300;
-	static final int VP_DIRECTORY_OFFSET = 120;
-	static final int VP_ITSF_HEADER_LENGTH = 96;
-	static final int VP_LANGUAGE_ID = 1033;
-	static final int VP_LAST_MODIFIED = 1042357880;
-	static final int VP_UNKNOWN_000C = 1;
-	static final int VP_UNKNOWN_LEN = 24;
-	static final int VP_UNKNOWN_OFFSET = 96;
-	static final int VP_VERSION = 3;
-	static final int VP_BLOCK_LENGTH = 4096;
-	static final int VP_BLOCK_INDEX_INTERVAL = 2;
-	static final int VP_ITSP_HEADER_LENGTH = 84;
-	static final int VP_INDEX_DEPTH = 1;
-	static final int VP_INDEX_HEAD = 0;
-	static final int VP_INDEX_ROOT = -1;
-	static final int VP_UNKNOWN_NUM_BLOCKS = -1;
-	static final int VP_ITSP_UNKNOWN_000C = 10;
-	static final int VP_ITSP_UNKNOWN_0024 = 0;
-	static final int VP_ITSP_UNKNOWN_002C = 1;
-	static final int VP_ITSP_BYTEARR_LEN = 16;
-	static final int VP_ITSP_VERSION = 1;
-	static final int VP_RESET_INTERVAL = 2;
-	static final int VP_CONTROL_DATA_SIZE = 6;
-	static final int VP_UNKNOWN_18 = 0;
-	static final int VP_CONTROL_DATA_VERSION = 2;
-	static final int VP_WINDOW_SIZE = 65536;
-	static final int VP_WINDOWS_PER_RESET = 1;
-	static final int VP_CHM_ENTITIES_NUMBER = 101;
-	static final int VP_PMGI_FREE_SPACE = 3;
-	static final int VP_PMGL_BLOCK_NEXT = -1;
-	static final int VP_PMGL_BLOCK_PREV = -1;
-	static final int VP_PMGL_FREE_SPACE = 1644;
-	static final int VP_PMGL_UNKNOWN_008 = 0;
-	static final int VP_RESET_TABLE_BA = 12;
-	static final int VP_RES_TBL_BLOCK_LENGTH = 32768;
-	static final int VP_RES_TBL_COMPR_LENGTH = 177408;
-	static final int VP_RES_TBL_UNCOMP_LENGTH = 383786;
-	static final int VP_TBL_OFFSET = 40;
-	static final int VP_RES_TBL_UNKNOWN = 8;
-	static final int VP_RES_TBL_VERSION = 2;
+	
+	static final int VP_DIRECTORY_LENGTH = 			4180;
+	static final int VP_DATA_OFFSET_LENGTH = 		4300;
+	static final int VP_DIRECTORY_OFFSET = 			120;
+	static final int VP_ITSF_HEADER_LENGTH = 		96;
+	static final int VP_LANGUAGE_ID = 				1033;
+	static final int VP_LAST_MODIFIED = 			1042357880;
+	static final int VP_UNKNOWN_000C = 				1;
+	static final int VP_UNKNOWN_LEN = 				24;
+	static final int VP_UNKNOWN_OFFSET = 			96;
+	static final int VP_VERSION = 					3;
+	static final int VP_BLOCK_LENGTH = 				4096;
+	static final int VP_BLOCK_INDEX_INTERVAL =  	2;
+	static final int VP_ITSP_HEADER_LENGTH = 		84;
+	static final int VP_INDEX_DEPTH = 				1;
+	static final int VP_INDEX_HEAD = 				0;
+	static final int VP_INDEX_ROOT = 				-1;
+	static final int VP_UNKNOWN_NUM_BLOCKS = 		-1;
+	static final int VP_ITSP_UNKNOWN_000C = 		10;
+	static final int VP_ITSP_UNKNOWN_0024 =     	0;
+	static final int VP_ITSP_UNKNOWN_002C =     	1;
+	static final int VP_ITSP_BYTEARR_LEN = 			16;
+	static final int VP_ITSP_VERSION = 				1;
+	static final int VP_RESET_INTERVAL = 			2;
+	static final int VP_CONTROL_DATA_SIZE = 		6;
+	static final int VP_UNKNOWN_18 = 				0;
+	static final int VP_CONTROL_DATA_VERSION = 		2;
+	static final int VP_WINDOW_SIZE = 				65536;
+	static final int VP_WINDOWS_PER_RESET = 		1;
+	static final int VP_CHM_ENTITIES_NUMBER = 		101;
+	static final int VP_PMGI_FREE_SPACE = 			3;
+	static final int VP_PMGL_BLOCK_NEXT = 			-1;
+	static final int VP_PMGL_BLOCK_PREV = 			-1;
+	static final int VP_PMGL_FREE_SPACE = 			1644;
+	static final int VP_PMGL_UNKNOWN_008 = 			0;
+	static final int VP_RESET_TABLE_BA = 			12;
+	static final int VP_RES_TBL_BLOCK_LENGTH = 		32768;
+	static final int VP_RES_TBL_COMPR_LENGTH = 		177408;
+	static final int VP_RES_TBL_UNCOMP_LENGTH = 	383786;
+	static final int VP_TBL_OFFSET = 				40;
+	static final int VP_RES_TBL_UNKNOWN = 			8;
+	static final int VP_RES_TBL_VERSION = 			2;
 }
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestPmgiHeader.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestPmgiHeader.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestPmgiHeader.java	(working copy)
@@ -1,34 +1,32 @@
 package org.apache.tika.parser.chm;
 
+
 import junit.framework.Assert;
 import junit.framework.TestCase;
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.parser.chm.accessor.ChmPmgiHeader;
 import org.apache.tika.parser.chm.core.ChmCommons;
 
-public class TestPmgiHeader extends TestCase {
+public class TestPmgiHeader extends TestCase{
 	ChmPmgiHeader chmPmgiHeader = null;
-
+	
+	
 	public void setUp() throws Exception {
-		TikaInputStream stream = TikaInputStream
-				.get(TestContainerAwareDetector.class
-						.getResource(TestParameters.chmFile));
-		byte[] data = ChmCommons.toByteArray(stream);
+		byte[] data = ChmCommons.toByteArray(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
 		chmPmgiHeader = new ChmPmgiHeader();
 		chmPmgiHeader.parse(data, chmPmgiHeader);
 	}
 
-	public void testToString() {
-		Assert.assertTrue((chmPmgiHeader != null)
-				&& (chmPmgiHeader.toString().length() > 0));
+	public void testToString(){
+		Assert.assertTrue((chmPmgiHeader != null) && (chmPmgiHeader.toString().length() > 0));
 	}
-
-	public void testGetFreeSpace() {
-		Assert.assertEquals(TestParameters.VP_PMGI_FREE_SPACE,
-				chmPmgiHeader.getFreeSpace());
+	
+	public void testGetFreeSpace(){
+		Assert.assertEquals(TestParameters.VP_PMGI_FREE_SPACE, chmPmgiHeader.getFreeSpace());
 	}
-
+	
+	
 	public void tearDown() throws Exception {
 	}
+
 }
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmItsfHeader.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmItsfHeader.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmItsfHeader.java	(working copy)
@@ -16,93 +16,78 @@
  */
 package org.apache.tika.parser.chm;
 
-import java.util.Arrays;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
+import org.apache.tika.parser.chm.core.ChmCommons;
 import org.apache.tika.parser.chm.core.ChmConstants;
 
 /**
  * Tests all public functions of ChmItsfHeader
- * 
+ *
  */
-public class TestChmItsfHeader extends TestCase {
+public class TestChmItsfHeader extends TestCase{
 	private ChmItsfHeader chmItsfHeader = null;
-
+	
 	public void setUp() throws Exception {
 		chmItsfHeader = new ChmItsfHeader();
-		TikaInputStream stream = TikaInputStream
-				.get(TestContainerAwareDetector.class
-						.getResource(TestParameters.chmFile));
-		byte[] data = TestUtils.toByteArray(stream);
-		chmItsfHeader.parse(
-				Arrays.copyOfRange(data, 0, ChmConstants.CHM_ITSF_V3_LEN - 1),
-				chmItsfHeader);
+		byte[] data = TestUtils.toByteArray(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
+//		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);
 	}
 
-	public void testGetDataOffset() {
-		Assert.assertEquals(TestParameters.VP_DATA_OFFSET_LENGTH,
-				chmItsfHeader.getDataOffset());
+	public void getDataOffset(){
+		Assert.assertEquals(TestParameters.VP_DATA_OFFSET_LENGTH, chmItsfHeader.getDataOffset());
 	}
-
-	public void testGetDir_uuid() {
+	
+	public void getDir_uuid(){
 		Assert.assertNotNull(chmItsfHeader.getDir_uuid());
 	}
-
-	public void testGetDirLen() {
-		Assert.assertEquals(TestParameters.VP_DIRECTORY_LENGTH,
-				chmItsfHeader.getDirLen());
+	
+	public void getDirLen(){
+		Assert.assertEquals(TestParameters.VP_DIRECTORY_LENGTH, chmItsfHeader.getDirLen());
 	}
-
-	public void testGetDirOffset() {
-		Assert.assertEquals(TestParameters.VP_DIRECTORY_OFFSET,
-				chmItsfHeader.getDirOffset());
+	
+	public void getDirOffset(){
+		Assert.assertEquals(TestParameters.VP_DIRECTORY_OFFSET, chmItsfHeader.getDirOffset());
 	}
-
-	public void testGetHeaderLen() {
-		Assert.assertEquals(TestParameters.VP_ITSF_HEADER_LENGTH,
-				chmItsfHeader.getHeaderLen());
+	
+	public void getHeaderLen(){
+		Assert.assertEquals(TestParameters.VP_ITSF_HEADER_LENGTH, chmItsfHeader.getHeaderLen());
 	}
-
-	public void testGetLangId() {
-		Assert.assertEquals(TestParameters.VP_LANGUAGE_ID,
-				chmItsfHeader.getLangId());
+	
+	public void getLangId(){
+		Assert.assertEquals(TestParameters.VP_LANGUAGE_ID, chmItsfHeader.getLangId());
 	}
-
-	public void testGetLastModified() {
-		Assert.assertEquals(TestParameters.VP_LAST_MODIFIED,
-				chmItsfHeader.getLastModified());
+	
+	public void getLastModified(){
+		Assert.assertEquals(TestParameters.VP_LAST_MODIFIED, chmItsfHeader.getLastModified());
 	}
-
-	public void testGetUnknown_000c() {
-		Assert.assertEquals(TestParameters.VP_UNKNOWN_000C,
-				chmItsfHeader.getUnknown_000c());
+	
+	public void getUnknown_000c(){
+		Assert.assertEquals(TestParameters.VP_UNKNOWN_000C, chmItsfHeader.getUnknown_000c());
 	}
-
-	public void testGetUnknownLen() {
-		Assert.assertEquals(TestParameters.VP_UNKNOWN_LEN,
-				chmItsfHeader.getUnknownLen());
+	
+	public void getUnknownLen(){
+		Assert.assertEquals(TestParameters.VP_UNKNOWN_LEN, chmItsfHeader.getUnknownLen());
 	}
-
-	public void testGetUnknownOffset() {
-		Assert.assertEquals(TestParameters.VP_UNKNOWN_OFFSET,
-				chmItsfHeader.getUnknownOffset());
+	
+	public void getUnknownOffset(){
+		Assert.assertEquals(TestParameters.VP_UNKNOWN_OFFSET, chmItsfHeader.getUnknownOffset());
 	}
-
-	public void testGetVersion() {
-		Assert.assertEquals(TestParameters.VP_VERSION,
-				chmItsfHeader.getVersion());
+	
+	public void getVersion(){
+		Assert.assertEquals(TestParameters.VP_VERSION, chmItsfHeader.getVersion());
 	}
-
-	public void testToString() {
-		Assert.assertTrue(chmItsfHeader.toString().contains(
-				TestParameters.VP_ISTF_SIGNATURE));
+	
+	public void testToString(){
+		Assert.assertTrue(chmItsfHeader.toString().contains(TestParameters.VP_ISTF_SIGNATURE));
 	}
-
+	
+	
 	public void tearDown() throws Exception {
 		chmItsfHeader = null;
 	}
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmLzxState.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmLzxState.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmLzxState.java	(working copy)
@@ -16,13 +16,11 @@
  */
 package org.apache.tika.parser.chm;
 
-import java.io.IOException;
-import java.util.Arrays;
 
+import java.io.IOException;
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
 import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
@@ -32,44 +30,39 @@
 import org.apache.tika.parser.chm.core.ChmConstants;
 import org.apache.tika.parser.chm.lzx.ChmLzxState;
 
-public class TestChmLzxState extends TestCase {
+public class TestChmLzxState extends TestCase{
 	private ChmLzxState chmLzxState;
 	private int windowSize;
-
+	
 	public void setUp() throws Exception {
 		try {
-			TikaInputStream stream = TikaInputStream
-					.get(TestContainerAwareDetector.class
-							.getResource(TestParameters.chmFile));
-
-			byte[] data = TestUtils.toByteArray(stream);
-
+			byte[] data = TestUtils.toByteArray(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
+			
 			/* Creates and parses itsf header */
 			ChmItsfHeader chmItsHeader = new ChmItsfHeader();
-			chmItsHeader.parse(Arrays.copyOfRange(data, 0,
-					ChmConstants.CHM_ITSF_V3_LEN - 1), chmItsHeader);
+//			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(),
+//			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);
-
+					+ 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);
+			ChmDirectoryListingSet chmDirListCont = new ChmDirectoryListingSet(data, chmItsHeader, chmItspHeader);
+			int indexOfControlData = ChmCommons.indexOf(chmDirListCont.getDirectoryListingEntryList(), ChmConstants.CONTROL_DATA);
 
-			int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
-					ChmConstants.LZXC.getBytes());
+			int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data, ChmConstants.LZXC.getBytes());
 			byte[] dir_chunk = null;
-			if (indexOfResetTable > 0) {
-				dir_chunk = Arrays.copyOfRange(data, indexOfResetTable,
-						indexOfResetTable
-								+ chmDirListCont.getDirectoryListingEntryList()
-										.get(indexOfControlData).getLength());
+			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();
@@ -79,18 +72,20 @@
 			e.printStackTrace();
 		}
 	}
-
-	public void testChmLzxStateConstructor() {
+	
+	public void testChmLzxStateConstructor(){
 		chmLzxState = new ChmLzxState(windowSize);
 		Assert.assertNotNull(chmLzxState);
 	}
-
-	public void testToString() {
-		if (chmLzxState == null)
+	
+	public void testToString(){
+		if(chmLzxState == null)
 			testChmLzxStateConstructor();
 		Assert.assertTrue(chmLzxState.toString().length() > 20);
 	}
 
+	//TODO add more tests
+	
 	public void tearDown() throws Exception {
 	}
 
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmExtraction.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmExtraction.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmExtraction.java	(working copy)
@@ -15,9 +15,13 @@
  * limitations under the License.
  */
 
+
 package org.apache.tika.parser.chm;
 
+
+import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
@@ -27,54 +31,55 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.exception.TikaException;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.metadata.Metadata;
 
+
+
 public class TestChmExtraction extends TestCase {
 
 	private List<String> files = new ArrayList<String>();
-
-	public void setUp() {
+	
+	public void setUp(){
 		files.add("/test-documents/testChm.chm");
-		files.add("/test-documents/testChm2.chm");
 		files.add("/test-documents/testChm3.chm");
 	}
-
+	
+	
 	public void testMultiThreadedChmExtraction() throws InterruptedException {
-		ExecutorService executor = Executors
-				.newFixedThreadPool(TestParameters.NTHREADS);
+		ExecutorService executor = Executors.newFixedThreadPool(TestParameters.NTHREADS);
 		for (int i = 0; i < TestParameters.NTHREADS; i++) {
 			executor.execute(new Runnable() {
 				public void run() {
 					Lock mutex = new ReentrantLock();
 					for (String fileName : files) {
-						TikaInputStream stream;
+						InputStream stream = null;
 						try {
-							stream = TikaInputStream
-									.get(TestContainerAwareDetector.class
-											.getResource(fileName));
-							mutex.lock();
+							stream = TikaInputStream.get(TestChmExtraction.class.getResource(fileName));
+							
+							CHMDocumentInformation chmDocInfo = CHMDocumentInformation.load(stream);
+							Metadata md = new Metadata();
+							mutex.lock(); 
+							String text = chmDocInfo.getText();
+							chmDocInfo.getCHMDocInformation(md);
+							assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString().trim());
+							assertTrue(text.length() > 0);
+						} catch (TikaException e) {
+							e.printStackTrace();
+						} catch (FileNotFoundException e) {
+							e.printStackTrace();
+						} catch (IOException e) {
+							e.printStackTrace();
+						} finally {
 							try {
-								CHMDocumentInformation chmDocInfo = CHMDocumentInformation
-										.load(stream);
-								Metadata md = new Metadata();
-								String text = chmDocInfo.getText();
-								chmDocInfo.getCHMDocInformation(md);
-								assertEquals(TestParameters.VP_CHM_MIME_TYPE,
-										md.toString().trim());
-								assertTrue(text.length() > 0);
-							} catch (TikaException e) {
+								stream.close();
+							} catch (IOException e) {
 								e.printStackTrace();
-							} finally {
-								mutex.unlock();
 							}
-						} catch (IOException e) {
-							e.printStackTrace();
+							mutex.unlock();
 						}
 					}
-
 				}
 			});
 		}
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestPmglHeader.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestPmglHeader.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestPmglHeader.java	(working copy)
@@ -1,58 +1,52 @@
 package org.apache.tika.parser.chm;
 
-import java.util.Arrays;
+
 import junit.framework.Assert;
 import junit.framework.TestCase;
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.parser.chm.accessor.ChmPmglHeader;
 import org.apache.tika.parser.chm.core.ChmCommons;
 import org.apache.tika.parser.chm.core.ChmConstants;
 
-public class TestPmglHeader extends TestCase {
+public class TestPmglHeader extends TestCase{
 	ChmPmglHeader chmPmglHeader = null;
 
 	public void setUp() throws Exception {
-		TikaInputStream stream = TikaInputStream
-				.get(TestContainerAwareDetector.class
-						.getResource(TestParameters.chmFile));
-		byte[] data = ChmCommons.toByteArray(stream);
+		byte[] data = ChmCommons.toByteArray(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
 		chmPmglHeader = new ChmPmglHeader();
-		chmPmglHeader.parse(Arrays.copyOfRange(data, ChmConstants.START_PMGL,
-				ChmConstants.START_PMGL + ChmConstants.CHM_PMGL_LEN + 10),
-				chmPmglHeader);
+		chmPmglHeader.parse(ChmCommons.copyOfRange(data, ChmConstants.START_PMGL, ChmConstants.START_PMGL + ChmConstants.CHM_PMGL_LEN + 10), chmPmglHeader);
 	}
 
-	public void testToString() {
-		Assert.assertTrue((chmPmglHeader != null)
-				&& chmPmglHeader.toString().length() > 0);
+	
+	public void testToString(){
+		Assert.assertTrue((chmPmglHeader != null) && chmPmglHeader.toString().length() > 0);
 	}
-
-	public void testChmPmglHeaderGet() {
-		Assert.assertEquals(TestParameters.VP_PMGL_SIGNATURE, new String(
-				chmPmglHeader.getSignature()));
+	
+	
+	public void testChmPmglHeaderGet(){
+		Assert.assertEquals(TestParameters.VP_PMGL_SIGNATURE, new String(chmPmglHeader.getSignature()));
 	}
-
-	public void testGetBlockNext() {
-		Assert.assertEquals(TestParameters.VP_PMGL_BLOCK_NEXT,
-				chmPmglHeader.getBlockNext());
+	
+	
+	public void testGetBlockNext(){
+		Assert.assertEquals(TestParameters.VP_PMGL_BLOCK_NEXT, chmPmglHeader.getBlockNext());
 	}
-
-	public void testGetBlockPrev() {
-		Assert.assertEquals(TestParameters.VP_PMGL_BLOCK_PREV,
-				chmPmglHeader.getBlockPrev());
+	
+	
+	public void testGetBlockPrev(){
+		Assert.assertEquals(TestParameters.VP_PMGL_BLOCK_PREV, chmPmglHeader.getBlockPrev());
 	}
-
-	public void testGetFreeSpace() {
-		Assert.assertEquals(TestParameters.VP_PMGL_FREE_SPACE,
-				chmPmglHeader.getFreeSpace());
+	
+	
+	public void testGetFreeSpace(){
+		Assert.assertEquals(TestParameters.VP_PMGL_FREE_SPACE, chmPmglHeader.getFreeSpace());
 	}
-
-	public void testGetUnknown0008() {
-		Assert.assertEquals(TestParameters.VP_PMGL_UNKNOWN_008,
-				chmPmglHeader.getUnknown0008());
+	
+	
+	public void testGetUnknown0008(){
+		Assert.assertEquals(TestParameters.VP_PMGL_UNKNOWN_008, chmPmglHeader.getUnknown0008());
 	}
-
+	
 	public void tearDown() throws Exception {
 	}
 }
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmDocumentInformation.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmDocumentInformation.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmDocumentInformation.java	(working copy)
@@ -1,37 +1,33 @@
 package org.apache.tika.parser.chm;
 
+
 import java.io.IOException;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.exception.TikaException;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.metadata.Metadata;
 
-public class TestChmDocumentInformation extends TestCase {
+public class TestChmDocumentInformation extends TestCase{
 	private CHMDocumentInformation chmDoc = null;
-
+	
 	public void setUp() throws Exception {
-		TikaInputStream stream = TikaInputStream
-				.get(TestContainerAwareDetector.class
-						.getResource(TestParameters.chmFile));
-		chmDoc = CHMDocumentInformation.load(stream);
+		chmDoc = CHMDocumentInformation.load(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
 	}
 
-	public void testGetCHMDocInformation() throws TikaException, IOException {
+	public void testGetCHMDocInformation() throws TikaException, IOException{
 		Metadata md = new Metadata();
 		chmDoc.getCHMDocInformation(md);
-		Assert.assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString()
-				.trim());
+		Assert.assertEquals(TestParameters.VP_CHM_MIME_TYPE, md.toString().trim());
 	}
-
-	public void testGetText() throws TikaException {
-		Assert.assertTrue(chmDoc.getText().contains(
-				"The TCard method accepts only numeric arguments"));
+	
+	public void testGetText() throws TikaException{
+		Assert.assertTrue(chmDoc.getText().contains("The TCard method accepts only numeric arguments"));
 	}
-
+	
 	public void tearDown() throws Exception {
 	}
+
 }
Index: tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmBlockInfo.java
===================================================================
--- tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmBlockInfo.java	(revision 1133479)
+++ tika-parsers/src/test/java/org/apache/tika/parsers/chm/TestChmBlockInfo.java	(working copy)
@@ -16,13 +16,12 @@
  */
 package org.apache.tika.parser.chm;
 
-import java.util.Arrays;
+
 import java.util.Iterator;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
-import org.apache.tika.detect.TestContainerAwareDetector;
 import org.apache.tika.io.TikaInputStream;
 import org.apache.tika.parser.chm.accessor.ChmDirectoryListingSet;
 import org.apache.tika.parser.chm.accessor.ChmItsfHeader;
@@ -34,9 +33,10 @@
 import org.apache.tika.parser.chm.core.ChmConstants;
 import org.apache.tika.parser.chm.lzx.ChmBlockInfo;
 
+
 /**
  * Tests major functionality of ChmBlockInfo
- * 
+ *
  */
 public class TestChmBlockInfo extends TestCase {
 	private byte[] data;
@@ -44,76 +44,62 @@
 	private ChmDirectoryListingSet chmDirListCont = null;
 	private ChmLzxcResetTable clrt = null;
 	private ChmLzxcControlData chmLzxcControlData = null;
-
+	
 	public void setUp() throws Exception {
-		TikaInputStream stream = TikaInputStream
-				.get(TestContainerAwareDetector.class
-						.getResource(TestParameters.chmFile));
-
-		data = TestUtils.toByteArray(stream);
-
+		data = TestUtils.toByteArray(TikaInputStream.get(TestChmBlockInfo.class.getResource(TestParameters.chmFile)));
 		/* Creates and parses itsf header */
 		ChmItsfHeader chmItsHeader = new ChmItsfHeader();
-		chmItsHeader.parse(
-				Arrays.copyOfRange(data, 0, ChmConstants.CHM_ITSF_V3_LEN - 1),
-				chmItsHeader);
+//		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(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);
+		chmDirListCont = new ChmDirectoryListingSet(data, chmItsHeader, chmItspHeader);
 		int indexOfControlData = chmDirListCont.getControlDataIndex();
-
-		int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data,
-				ChmConstants.LZXC.getBytes());
+		
+		int indexOfResetTable = ChmCommons.indexOfResetTableBlock(data, ChmConstants.LZXC.getBytes());
 		byte[] dir_chunk = null;
-		if (indexOfResetTable > 0) {
-			dir_chunk = Arrays.copyOfRange(data, indexOfResetTable,
-					indexOfResetTable
-							+ chmDirListCont.getDirectoryListingEntryList()
-									.get(indexOfControlData).getLength());
+		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());
+		
+		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);
 	}
 
-	public void testToString() {
-		if (chmBlockInfo == null)
+	public void testToString(){
+		if(chmBlockInfo == null)
 			testGetChmBlockInfo();
 		Assert.assertTrue(chmBlockInfo.toString().length() > 0);
 	}
-
-	public void testGetChmBlockInfo() {
-		for (Iterator<DirectoryListingEntry> it = chmDirListCont
-				.getDirectoryListingEntryList().iterator(); it.hasNext();) {
+	
+	public void testGetChmBlockInfo(){
+		for (Iterator<DirectoryListingEntry> it = chmDirListCont.getDirectoryListingEntryList().iterator(); it.hasNext();) {
 			DirectoryListingEntry directoryListingEntry = it.next();
-			chmBlockInfo = ChmBlockInfo.getChmBlockInfoInstance(
-					directoryListingEntry, (int) clrt.getBlockLen(),
-					chmLzxcControlData);
-			Assert.assertTrue(!directoryListingEntry.getName().isEmpty()
-					&& chmBlockInfo.toString() != null);
+			chmBlockInfo = ChmBlockInfo.getChmBlockInfoInstance(directoryListingEntry, (int)clrt.getBlockLen(), chmLzxcControlData);
+//			Assert.assertTrue(!directoryListingEntry.getName().isEmpty() && chmBlockInfo.toString() != null);
+			Assert.assertTrue(!ChmCommons.isEmpty(directoryListingEntry.getName()) && chmBlockInfo.toString() != null);
 		}
 	}
-
+	
 	public void tearDown() throws Exception {
 		data = null;
 		chmBlockInfo = null;
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmItspHeader.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmItspHeader.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmItspHeader.java	(working copy)
@@ -21,117 +21,100 @@
 import org.apache.tika.parser.chm.core.ChmConstants;
 import org.apache.tika.parser.chm.exception.ChmParsingException;
 
+
 /**
- * Directory header The directory starts with a header; its format is as
- * follows: 0000: char[4] 'ITSP' 0004: DWORD Version number 1 0008: DWORD Length
- * of the directory header 000C: DWORD $0a (unknown) 0010: DWORD $1000 Directory
- * chunk size 0014: DWORD "Density" of quickref section, usually 2 0018: DWORD
- * Depth of the index tree - 1 there is no index, 2 if there is one level of
- * PMGI chunks 001C: DWORD Chunk number of root index chunk, -1 if there is none
- * (though at least one file has 0 despite there being no index chunk, probably
- * a bug) 0020: DWORD Chunk number of first PMGL (listing) chunk 0024: DWORD
- * Chunk number of last PMGL (listing) chunk 0028: DWORD -1 (unknown) 002C:
- * DWORD Number of directory chunks (total) 0030: DWORD Windows language ID
- * 0034: GUID {5D02926A-212E-11D0-9DF9-00A0C922E6EC} 0044: DWORD $54 (This is
- * the length again) 0048: DWORD -1 (unknown) 004C: DWORD -1 (unknown) 0050:
- * DWORD -1 (unknown)
+ * Directory header
+ * The directory starts with a header; its format is as follows:
+ * 0000: char[4] 'ITSP'
+ * 0004: DWORD Version number 1
+ * 0008: DWORD Length of the directory header
+ * 000C: DWORD $0a (unknown)
+ * 0010: DWORD $1000 Directory chunk size
+ * 0014: DWORD "Density" of quickref section, usually 2
+ * 0018: DWORD Depth of the index tree - 1 there is no index, 2 if there is one level of PMGI chunks
+ * 001C: DWORD Chunk number of root index chunk, -1 if there is none
+ * (though at least one file has 0 despite there being no index chunk, probably a bug)
+ * 0020: DWORD Chunk number of first PMGL (listing) chunk
+ * 0024: DWORD Chunk number of last PMGL (listing) chunk 
+ * 0028: DWORD -1 (unknown)
+ * 002C: DWORD Number of directory chunks (total)
+ * 0030: DWORD Windows language ID
+ * 0034: GUID {5D02926A-212E-11D0-9DF9-00A0C922E6EC}
+ * 0044: DWORD $54 (This is the length again)
+ * 0048: DWORD -1 (unknown)
+ * 004C: DWORD -1 (unknown)
+ * 0050: DWORD -1 (unknown)
  * 
- * {@link http
- * ://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original
- * /?show-translation-form=1}
- * 
+ * {@link http://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original/?show-translation-form=1}
+ *
  */
-public class ChmItspHeader implements ChmAccessor<ChmItspHeader> {
-	// TODO: refactor all unmarshals
+public class ChmItspHeader implements ChmAccessor<ChmItspHeader>{
+	//TODO: refactor all unmarshals
 	private static final long serialVersionUID = 1962394421998181341L;
-	private byte[] signature = new String(ChmConstants.ITSP).getBytes(); /*
-																		 * 0
-																		 * (ITSP
-																		 * )
-																		 */
-	private int version; /* 4 */
-	private int header_len; /* 8 */
-	private int unknown_000c; /* c */
-	private long block_len; /* 10 */
-	private int blockidx_intvl; /* 14 */
-	private int index_depth; /* 18 */
-	private int index_root; /* 1c */
-	private int index_head; /* 20 */
-	private int unknown_0024; /* 24 */
-	private long num_blocks; /* 28 */
-	private int unknown_002c; /* 2c */
-	private long lang_id; /* 30 */
-	private byte[] system_uuid = new byte[ChmConstants.BYTE_ARRAY_LENGHT]; /* 34 */
-	private byte[] unknown_0044 = new byte[ChmConstants.BYTE_ARRAY_LENGHT]; /* 44 */
+	private byte[] signature = new String(ChmConstants.ITSP).getBytes();  							/* 0 (ITSP) */
+	private int version;  																			/* 4 */
+	private int header_len; 																		/* 8 */
+	private int unknown_000c; 																		/* c */
+	private long block_len; 																		/* 10 */
+	private int blockidx_intvl; 																	/* 14 */
+	private int index_depth; 																		/* 18 */
+	private int index_root; 																		/* 1c */
+	private int index_head; 																		/* 20 */
+	private int unknown_0024; 																		/* 24 */
+	private long num_blocks; 																		/* 28 */
+	private int unknown_002c; 																		/* 2c */
+	private long lang_id; 																			/* 30 */
+	private byte[] system_uuid = new byte[ChmConstants.BYTE_ARRAY_LENGHT]; 							/* 34 */
+	private byte[] unknown_0044 = new byte[ChmConstants.BYTE_ARRAY_LENGHT]; 						/* 44 */
 
-	/* local usage */
-	private int dataRemained;
-	private int currentPlace = 0;
-
-	public String toString() {
-		StringBuilder sb = new StringBuilder();
-		sb.append("[ signature:=" + new String(getSignature())
-				+ System.getProperty("line.separator"));
-		sb.append("version:=\t" + getVersion()
-				+ System.getProperty("line.separator"));
-		sb.append("header_len:=\t" + getHeader_len()
-				+ System.getProperty("line.separator"));
-		sb.append("unknown_00c:=\t" + getUnknown_000c()
-				+ System.getProperty("line.separator"));
-		sb.append("block_len:=\t" + getBlock_len() + " [directory chunk size]"
-				+ System.getProperty("line.separator"));
-		sb.append("blockidx_intvl:=" + getBlockidx_intvl()
-				+ ", density of quickref section, usually 2"
-				+ System.getProperty("line.separator"));
-		sb.append("index_depth:=\t"
-				+ getIndex_depth()
-				+ ", depth of the index tree - 1 there is no index, 2 if there is one level of PMGI chunk"
-				+ System.getProperty("line.separator"));
-		sb.append("index_root:=\t" + getIndex_root()
-				+ ", chunk number of root index chunk, -1 if there is none"
-				+ System.getProperty("line.separator"));
-		sb.append("index_head:=\t" + getIndex_head()
-				+ ", chunk number of first PMGL (listing) chunk"
-				+ System.getProperty("line.separator"));
-		sb.append("unknown_0024:=\t" + getUnknown_0024()
-				+ ", chunk number of last PMGL (listing) chunk"
-				+ System.getProperty("line.separator"));
-		sb.append("num_blocks:=\t" + getNum_blocks() + ", -1 (unknown)"
-				+ System.getProperty("line.separator"));
-		sb.append("unknown_002c:=\t" + getUnknown_002c()
-				+ ", number of directory chunks (total)"
-				+ System.getProperty("line.separator"));
-		sb.append("lang_id:=\t" + getLang_id() + " - "
-				+ ChmCommons.getLanguage(getLang_id())
-				+ System.getProperty("line.separator"));
-		sb.append("system_uuid:=" + getSystem_uuid()
-				+ System.getProperty("line.separator"));
-		sb.append("unknown_0044:=" + getUnknown_0044() + " ]");
-		return sb.toString();
-	}
-
-	/**
-	 * Copies 4 bits from data[]
-	 * 
-	 * @param data
-	 * @param chmItspHeader
-	 * @param count
-	 */
-	private void unmarshalCharArray(byte[] data, ChmItspHeader chmItspHeader,
-			int count) {
-		ChmAssert.assertByteArrayNotNull(data);
-		ChmAssert.assertChmAccessorNotNull(chmItspHeader);
+	 /* local usage */
+    private int dataRemained;
+    private int currentPlace = 0;
+    
+    
+    public String toString(){
+    	StringBuilder sb = new StringBuilder();
+    	sb.append("[ signature:=" + new String(getSignature()) + System.getProperty("line.separator"));
+    	sb.append("version:=\t" + getVersion() + System.getProperty("line.separator"));
+    	sb.append("header_len:=\t" + getHeader_len() + System.getProperty("line.separator"));
+    	sb.append("unknown_00c:=\t" + getUnknown_000c() + System.getProperty("line.separator"));
+    	sb.append("block_len:=\t" + getBlock_len() + " [directory chunk size]" + System.getProperty("line.separator"));
+    	sb.append("blockidx_intvl:=" + getBlockidx_intvl() + ", density of quickref section, usually 2" + System.getProperty("line.separator"));
+    	sb.append("index_depth:=\t" + getIndex_depth() + ", depth of the index tree - 1 there is no index, 2 if there is one level of PMGI chunk" + System.getProperty("line.separator"));
+    	sb.append("index_root:=\t" + getIndex_root() + ", chunk number of root index chunk, -1 if there is none" + System.getProperty("line.separator"));
+    	sb.append("index_head:=\t" + getIndex_head() + ", chunk number of first PMGL (listing) chunk" + System.getProperty("line.separator"));
+    	sb.append("unknown_0024:=\t" + getUnknown_0024() + ", chunk number of last PMGL (listing) chunk" + System.getProperty("line.separator"));
+    	sb.append("num_blocks:=\t" + getNum_blocks() + ", -1 (unknown)" + System.getProperty("line.separator"));
+    	sb.append("unknown_002c:=\t" + getUnknown_002c() + ", number of directory chunks (total)" + System.getProperty("line.separator"));
+    	sb.append("lang_id:=\t" + getLang_id() + " - " + ChmCommons.getLanguage(getLang_id()) + System.getProperty("line.separator"));
+    	sb.append("system_uuid:=" + getSystem_uuid() + System.getProperty("line.separator"));
+    	sb.append("unknown_0044:=" + getUnknown_0044() + " ]");
+    	return sb.toString();
+    }
+    
+    
+  
+    /**
+     * Copies 4 bits from data[]
+     * 
+     * @param data
+     * @param chmItspHeader
+     * @param count
+     */
+    private void unmarshalCharArray(byte[] data, ChmItspHeader chmItspHeader, int count) {
+    	ChmAssert.assertByteArrayNotNull(data);
+    	ChmAssert.assertChmAccessorNotNull(chmItspHeader);
 		this.setDataRemained(data.length);
 		System.arraycopy(data, 0, chmItspHeader.signature, 0, count);
 		this.setCurrentPlace(this.getCurrentPlace() + count);
 		this.setDataRemained(this.getDataRemained() - count);
 	}
-
-	private int unmarshalInt32(byte[] data, int dataLenght, int dest) {
+    
+    private int unmarshalInt32(byte[] data, int dataLenght, int dest) {
 		ChmAssert.assertByteArrayNotNull(data);
 		if (4 > this.getDataRemained())
 			throw new ChmParsingException("4 > dataLenght");
-		dest = data[this.getCurrentPlace()]
+		dest =  data[this.getCurrentPlace()]
 				| data[this.getCurrentPlace() + 1] << 8
 				| data[this.getCurrentPlace() + 2] << 16
 				| data[this.getCurrentPlace() + 3] << 24;
@@ -140,12 +123,12 @@
 		this.setDataRemained(this.getDataRemained() - 4);
 		return dest;
 	}
-
-	private long unmarshalUInt32(byte[] data, int dataLenght, long dest) {
-		ChmAssert.assertByteArrayNotNull(data);
+    
+    private long unmarshalUInt32(byte[] data, int dataLenght, long dest) {
+    	ChmAssert.assertByteArrayNotNull(data);
 		if (4 > dataLenght)
 			throw new ChmParsingException("4 > dataLenght");
-		dest = data[this.getCurrentPlace()]
+		dest =  data[this.getCurrentPlace()]
 				| data[this.getCurrentPlace() + 1] << 8
 				| data[this.getCurrentPlace() + 2] << 16
 				| data[this.getCurrentPlace() + 3] << 24;
@@ -154,56 +137,55 @@
 		this.setCurrentPlace(this.getCurrentPlace() + 4);
 		return dest;
 	}
-
-	private byte[] unmarshalUuid(byte[] data, int dataLenght, byte[] dest,
-			int count) {
+	
+    private byte[] unmarshalUuid(byte[] data, int dataLenght, byte[] dest, int count) {
 		System.arraycopy(data, this.getCurrentPlace(), dest, 0, count);
 		this.setCurrentPlace(this.getCurrentPlace() + count);
 		this.setDataRemained(this.getDataRemained() - count);
 		return dest;
 	}
-
-	/**
-	 * Returns how many bytes remained
-	 * 
-	 * @return int
-	 */
-	private int getDataRemained() {
+	
+    /**
+     * Returns how many bytes remained
+     * 
+     * @return int
+     */
+    private int getDataRemained() {
 		return dataRemained;
 	}
 
-	/**
-	 * Sets how many bytes remained
-	 * 
-	 * @param dataRemained
-	 */
-	private void setDataRemained(int dataRemained) {
+    /**
+     * Sets how many bytes remained
+     * 
+     * @param dataRemained
+     */
+    private void setDataRemained(int dataRemained) {
 		this.dataRemained = dataRemained;
 	}
 
-	/**
-	 * Returns a place holder
-	 * 
-	 * @return current place
-	 */
-	private int getCurrentPlace() {
+    /**
+     * Returns a place holder
+     * 
+     * @return current place
+     */
+    private int getCurrentPlace() {
 		return currentPlace;
 	}
 
-	/**
-	 * Sets current place
-	 * 
-	 * @param currentPlace
-	 */
-	private void setCurrentPlace(int currentPlace) {
+    /**
+     * Sets current place
+     * 
+     * @param currentPlace
+     */
+    private void setCurrentPlace(int currentPlace) {
 		this.currentPlace = currentPlace;
 	}
 
-	/**
-	 * Returns a signature of the header
-	 * 
-	 * @return itsp signature
-	 */
+    /**
+     * Returns a signature of the header
+     * 
+     * @return itsp signature
+     */
 	public byte[] getSignature() {
 		return signature;
 	}
@@ -217,6 +199,7 @@
 		this.signature = signature;
 	}
 
+
 	/**
 	 * Returns version of itsp header
 	 * 
@@ -226,6 +209,7 @@
 		return version;
 	}
 
+
 	/**
 	 * Sets a version of itsp header
 	 * 
@@ -235,6 +219,7 @@
 		this.version = version;
 	}
 
+
 	/**
 	 * Returns header length
 	 * 
@@ -244,6 +229,7 @@
 		return header_len;
 	}
 
+
 	/**
 	 * Sets itsp header length
 	 * 
@@ -253,6 +239,7 @@
 		this.header_len = header_len;
 	}
 
+
 	/**
 	 * Returns 000c unknown bytes
 	 */
@@ -260,9 +247,10 @@
 		return unknown_000c;
 	}
 
+
 	/**
-	 * Sets 000c unknown bytes Unknown means here that those guys who cracked
-	 * the chm format do not know what's it purposes for
+	 * Sets 000c unknown bytes
+	 * Unknown means here that those guys who cracked the chm format do not know what's it purposes for
 	 * 
 	 * @param unknown_000c
 	 */
@@ -270,6 +258,7 @@
 		this.unknown_000c = unknown_000c;
 	}
 
+
 	/**
 	 * Returns block's length
 	 * 
@@ -279,6 +268,7 @@
 		return block_len;
 	}
 
+
 	/**
 	 * Sets block length
 	 * 
@@ -288,6 +278,7 @@
 		this.block_len = block_len;
 	}
 
+
 	/**
 	 * Returns block index interval
 	 * 
@@ -297,6 +288,7 @@
 		return blockidx_intvl;
 	}
 
+
 	/**
 	 * Sets block index interval
 	 * 
@@ -306,6 +298,7 @@
 		this.blockidx_intvl = blockidx_intvl;
 	}
 
+
 	/**
 	 * Returns an index depth
 	 * 
@@ -315,6 +308,7 @@
 		return index_depth;
 	}
 
+
 	/**
 	 * Sets an index depth
 	 * 
@@ -324,6 +318,7 @@
 		this.index_depth = index_depth;
 	}
 
+
 	/**
 	 * Returns index root
 	 * 
@@ -333,6 +328,7 @@
 		return index_root;
 	}
 
+
 	/**
 	 * Sets an index root
 	 * 
@@ -342,6 +338,7 @@
 		this.index_root = index_root;
 	}
 
+
 	/**
 	 * Returns an index head
 	 * 
@@ -351,6 +348,7 @@
 		return index_head;
 	}
 
+
 	/**
 	 * Sets an index head
 	 * 
@@ -360,6 +358,7 @@
 		this.index_head = index_head;
 	}
 
+
 	/**
 	 * Returns 0024 unknown bytes
 	 * 
@@ -369,6 +368,7 @@
 		return unknown_0024;
 	}
 
+
 	/**
 	 * Sets 0024 unknown bytes
 	 * 
@@ -378,6 +378,7 @@
 		this.unknown_0024 = unknown_0024;
 	}
 
+
 	/**
 	 * Returns number of blocks
 	 * 
@@ -387,6 +388,7 @@
 		return num_blocks;
 	}
 
+
 	/**
 	 * Sets number of blocks containing in the chm file
 	 * 
@@ -396,6 +398,7 @@
 		this.num_blocks = num_blocks;
 	}
 
+
 	/**
 	 * Returns 002c unknown bytes
 	 * 
@@ -405,6 +408,7 @@
 		return unknown_002c;
 	}
 
+
 	/**
 	 * Sets 002c unknown bytes
 	 * 
@@ -414,15 +418,17 @@
 		this.unknown_002c = unknown_002c;
 	}
 
+
 	/**
 	 * Returns language id
-	 * 
+	 *  
 	 * @return lang_id
 	 */
 	public long getLang_id() {
 		return lang_id;
 	}
 
+
 	/**
 	 * Sets language id
 	 * 
@@ -432,6 +438,7 @@
 		this.lang_id = lang_id;
 	}
 
+
 	/**
 	 * Returns system uuid
 	 * 
@@ -441,6 +448,7 @@
 		return system_uuid;
 	}
 
+
 	/**
 	 * Sets system uuid
 	 * 
@@ -450,6 +458,7 @@
 		this.system_uuid = system_uuid;
 	}
 
+
 	/**
 	 * Returns 0044 unknown bytes
 	 * 
@@ -459,6 +468,7 @@
 		return unknown_0044;
 	}
 
+
 	/**
 	 * Sets 0044 unknown bytes
 	 * 
@@ -467,79 +477,44 @@
 	protected void setUnknown_0044(byte[] unknown_0044) {
 		this.unknown_0044 = unknown_0044;
 	}
+	
 
-	// @Override
+//	@Override
 	public void parse(byte[] data, ChmItspHeader chmItspHeader) {
 		/* we only know how to deal with the 0x58 and 0x60 byte structures */
-		if (data.length != ChmConstants.CHM_ITSP_V1_LEN)
-			throw new ChmParsingException(
-					"we only know how to deal with the 0x58 and 0x60 byte structures");
-
-		/* unmarshal common fields */
-		chmItspHeader.unmarshalCharArray(data, chmItspHeader,
-				ChmConstants.CHM_SIGNATURE_LEN);
-		// ChmCommons.unmarshalCharArray(data, chmItspHeader,
-		// ChmConstants.CHM_SIGNATURE_LEN);
-		chmItspHeader.setVersion(chmItspHeader.unmarshalInt32(data,
-				chmItspHeader.getDataRemained(), chmItspHeader.getVersion()));
-		chmItspHeader
-				.setHeader_len(chmItspHeader.unmarshalInt32(data,
-						chmItspHeader.getDataRemained(),
-						chmItspHeader.getHeader_len()));
-		chmItspHeader.setUnknown_000c(chmItspHeader.unmarshalInt32(data,
-				chmItspHeader.getDataRemained(),
-				chmItspHeader.getUnknown_000c()));
-		chmItspHeader.setBlock_len(chmItspHeader.unmarshalUInt32(data,
-				chmItspHeader.getDataRemained(), chmItspHeader.getBlock_len()));
-		chmItspHeader.setBlockidx_intvl(chmItspHeader.unmarshalInt32(data,
-				chmItspHeader.getDataRemained(),
-				chmItspHeader.getBlockidx_intvl()));
-		chmItspHeader
-				.setIndex_depth(chmItspHeader.unmarshalInt32(data,
-						chmItspHeader.getDataRemained(),
-						chmItspHeader.getIndex_depth()));
-		chmItspHeader
-				.setIndex_root(chmItspHeader.unmarshalInt32(data,
-						chmItspHeader.getDataRemained(),
-						chmItspHeader.getIndex_root()));
-		chmItspHeader
-				.setIndex_head(chmItspHeader.unmarshalInt32(data,
-						chmItspHeader.getDataRemained(),
-						chmItspHeader.getIndex_head()));
-		chmItspHeader.setUnknown_0024(chmItspHeader.unmarshalInt32(data,
-				chmItspHeader.getDataRemained(),
-				chmItspHeader.getUnknown_0024()));
-		chmItspHeader
-				.setNum_blocks(chmItspHeader.unmarshalUInt32(data,
-						chmItspHeader.getDataRemained(),
-						chmItspHeader.getNum_blocks()));
-		chmItspHeader.setUnknown_002c((chmItspHeader.unmarshalInt32(data,
-				chmItspHeader.getDataRemained(),
-				chmItspHeader.getUnknown_002c())));
-		chmItspHeader.setLang_id(chmItspHeader.unmarshalUInt32(data,
-				chmItspHeader.getDataRemained(), chmItspHeader.getLang_id()));
-		chmItspHeader
-				.setSystem_uuid(chmItspHeader.unmarshalUuid(data,
-						chmItspHeader.getDataRemained(),
-						chmItspHeader.getSystem_uuid(),
-						ChmConstants.BYTE_ARRAY_LENGHT));
-		chmItspHeader
-				.setUnknown_0044(chmItspHeader.unmarshalUuid(data,
-						chmItspHeader.getDataRemained(),
-						chmItspHeader.getUnknown_0044(),
-						ChmConstants.BYTE_ARRAY_LENGHT));
-
-		/* Checks validity of the itsp header */
-		if (!new String(chmItspHeader.getSignature()).equals(ChmConstants.ITSP))
+        if (data.length != ChmConstants.CHM_ITSP_V1_LEN)
+        	throw new ChmParsingException("we only know how to deal with the 0x58 and 0x60 byte structures");
+        
+        /* unmarshal common fields */
+        chmItspHeader.unmarshalCharArray(data, chmItspHeader, ChmConstants.CHM_SIGNATURE_LEN);
+//        ChmCommons.unmarshalCharArray(data, chmItspHeader, ChmConstants.CHM_SIGNATURE_LEN);
+        chmItspHeader.setVersion(chmItspHeader.unmarshalInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getVersion()));
+        chmItspHeader.setHeader_len(chmItspHeader.unmarshalInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getHeader_len()));
+        chmItspHeader.setUnknown_000c(chmItspHeader.unmarshalInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getUnknown_000c()));
+        chmItspHeader.setBlock_len(chmItspHeader.unmarshalUInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getBlock_len()));
+        chmItspHeader.setBlockidx_intvl(chmItspHeader.unmarshalInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getBlockidx_intvl()));
+        chmItspHeader.setIndex_depth(chmItspHeader.unmarshalInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getIndex_depth()));
+        chmItspHeader.setIndex_root(chmItspHeader.unmarshalInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getIndex_root()));
+        chmItspHeader.setIndex_head(chmItspHeader.unmarshalInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getIndex_head()));
+        chmItspHeader.setUnknown_0024(chmItspHeader.unmarshalInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getUnknown_0024()));
+        chmItspHeader.setNum_blocks(chmItspHeader.unmarshalUInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getNum_blocks()));
+        chmItspHeader.setUnknown_002c((chmItspHeader.unmarshalInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getUnknown_002c())));
+        chmItspHeader.setLang_id(chmItspHeader.unmarshalUInt32(data, chmItspHeader.getDataRemained(), chmItspHeader.getLang_id()));
+        chmItspHeader.setSystem_uuid(chmItspHeader.unmarshalUuid(data, chmItspHeader.getDataRemained(), chmItspHeader.getSystem_uuid(), ChmConstants.BYTE_ARRAY_LENGHT));
+        chmItspHeader.setUnknown_0044(chmItspHeader.unmarshalUuid(data, chmItspHeader.getDataRemained(), chmItspHeader.getUnknown_0044(), ChmConstants.BYTE_ARRAY_LENGHT));
+        
+        /* Checks validity of the itsp header */
+        if(!new String(chmItspHeader.getSignature()).equals(ChmConstants.ITSP))
 			throw new ChmParsingException("seems not valid signature");
-
-		if (chmItspHeader.getVersion() != ChmConstants.CHM_VER_1)
-			throw new ChmParsingException("!=ChmConstants.CHM_VER_1");
-
-		if (chmItspHeader.getHeader_len() != ChmConstants.CHM_ITSP_V1_LEN)
-			throw new ChmParsingException("!= ChmConstants.CHM_ITSP_V1_LEN");
+        
+        if (chmItspHeader.getVersion() != ChmConstants.CHM_VER_1)
+        	throw new ChmParsingException("!=ChmConstants.CHM_VER_1");
+        
+        if(chmItspHeader.getHeader_len() != ChmConstants.CHM_ITSP_V1_LEN)
+        	throw new ChmParsingException("!= ChmConstants.CHM_ITSP_V1_LEN");
 	}
-
+	
+	
 	/**
 	 * @param args
 	 */
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmPmglHeader.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmPmglHeader.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmPmglHeader.java	(working copy)
@@ -20,69 +20,73 @@
 import org.apache.tika.parser.chm.core.ChmConstants;
 import org.apache.tika.parser.chm.exception.ChmParsingException;
 
+
 /**
- * Description There are two types of directory chunks -- index chunks, and
- * listing chunks. The index chunk will be omitted if there is only one listing
- * chunk. A listing chunk has the following format: 0000: char[4] 'PMGL' 0004:
- * DWORD Length of free space and/or quickref area at end of directory chunk
- * 0008: DWORD Always 0 000C: DWORD Chunk number of previous listing chunk when
- * reading directory in sequence (-1 if this is the first listing chunk) 0010:
- * DWORD Chunk number of next listing chunk when reading directory in sequence
- * (-1 if this is the last listing chunk) 0014: Directory listing entries (to
- * quickref area) Sorted by filename; the sort is case-insensitive The quickref
- * area is written backwards from the end of the chunk. One quickref entry
- * exists for every n entries in the file, where n is calculated as 1 + (1 <<
- * quickref density). So for density = 2, n = 5 Chunklen-0002: WORD Number of
- * entries in the chunk Chunklen-0004: WORD Offset of entry n from entry 0
- * Chunklen-0008: WORD Offset of entry 2n from entry 0 Chunklen-000C: WORD
- * Offset of entry 3n from entry 0 ... The format of a directory listing entry
- * is as follows BYTE: length of name BYTEs: name (UTF-8 encoded) ENCINT:
- * content section ENCINT: offset ENCINT: length The offset is from the
- * beginning of the content section the file is in, after the section has been
- * decompressed (if appropriate). The length also refers to length of the file
- * in the section after decompression. There are two kinds of file represented
- * in the directory: user data and format related files. The files which are
- * format-related have names which begin with '::', the user data files have
- * names which begin with "/".
+ * Description
+ * There are two types of directory chunks -- index chunks, and listing chunks. The index chunk will be omitted 
+ * if there is only one listing chunk. A listing chunk has the following format:
+ * 0000: char[4] 'PMGL'
+ * 0004: DWORD Length of free space and/or quickref area at end of directory chunk 
+ * 0008: DWORD Always 0
+ * 000C: DWORD Chunk number of previous listing chunk when reading
+ * directory in sequence (-1 if this is the first listing chunk)
+ * 0010: DWORD Chunk number of next listing chunk when reading
+ * directory in sequence (-1 if this is the last listing chunk)
+ * 0014: Directory listing entries (to quickref area) Sorted by
+ * filename; the sort is case-insensitive
+ * The quickref area is written backwards from the end of the chunk. One quickref entry exists for every n entries
+ * in the file, where n is calculated as 1 + (1 << quickref density). So for density = 2, n = 5
+ * Chunklen-0002: WORD Number of entries in the chunk
+ * Chunklen-0004: WORD Offset of entry n from entry 0
+ * Chunklen-0008: WORD Offset of entry 2n from entry 0
+ * Chunklen-000C: WORD Offset of entry 3n from entry 0
+ * ...
+ * The format of a directory listing entry is as follows
+ * BYTE: length of name
+ * BYTEs: name (UTF-8 encoded)
+ * ENCINT: content section
+ * ENCINT: offset
+ * ENCINT: length
+ * The offset is from the beginning of the content section the file is in, after the section has been 
+ * decompressed (if appropriate). The length also refers to length of the file in the section after decompression.
+ * There are two kinds of file represented in the directory: user data and format related files. The files which 
+ * are format-related have names which begin with '::', the user data files have names which begin with "/".
  * 
- * {@link http
- * ://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original
- * /?show-translation-form=1 }
+ * {@link http://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original/?show-translation-form=1 }
  * 
  * @author olegt
- * 
+ *
  */
-public class ChmPmglHeader implements ChmAccessor<ChmPmglHeader> {
+public class ChmPmglHeader implements ChmAccessor<ChmPmglHeader>{
 	private static final long serialVersionUID = -6139486487475923593L;
-	private byte[] signature = new String(ChmConstants.PMGL).getBytes(); /*
-																		 * 0
-																		 * (PMGL
-																		 * )
-																		 */
-	private long free_space; /* 4 */
-	private long unknown_0008; /* 8 */
-	private int block_prev; /* c */
-	private int block_next; /* 10 */
+	private byte[] signature = new String(ChmConstants.PMGL).getBytes(); 			/*  0 (PMGL) */
+	private long free_space;														/*  4 */
+	private long unknown_0008;           											/*  8 */
+	private int block_prev;             											/*  c */
+	private int block_next;             											/* 10 */
 
 	/* local usage */
-	private int dataRemained;
-	private int currentPlace = 0;
-
-	private int getDataRemained() {
+    private int dataRemained;
+    private int currentPlace = 0;
+	
+	
+    
+    private int getDataRemained() {
 		return dataRemained;
 	}
 
-	private void setDataRemained(int dataRemained) {
+    private void setDataRemained(int dataRemained) {
 		this.dataRemained = dataRemained;
 	}
 
-	private int getCurrentPlace() {
+    private int getCurrentPlace() {
 		return currentPlace;
 	}
 
-	private void setCurrentPlace(int currentPlace) {
+    private void setCurrentPlace(int currentPlace) {
 		this.currentPlace = currentPlace;
 	}
+	
 
 	public long getFreeSpace() {
 		return free_space;
@@ -92,31 +96,31 @@
 		this.free_space = free_space;
 	}
 
-	public String toString() {
+
+	public String toString(){
 		StringBuilder sb = new StringBuilder();
 		sb.append("signatute:=" + new String(getSignature()) + ", ");
 		sb.append("free space:=" + getFreeSpace() + ", ");
 		sb.append("unknown0008:=" + getUnknown0008() + ", ");
 		sb.append("prev block:=" + getBlockPrev() + ", ");
-		sb.append("next block:=" + getBlockNext()
-				+ System.getProperty("line.separator"));
+		sb.append("next block:=" + getBlockNext() + System.getProperty("line.separator"));
 		return sb.toString();
 	}
-
-	protected void unmarshalCharArray(byte[] data, ChmPmglHeader chmPmglHeader,
-			int count) {
+	
+	protected void unmarshalCharArray(byte[] data, ChmPmglHeader chmPmglHeader, int count) {
 		ChmAssert.assertByteArrayNotNull(data);
 		this.setDataRemained(data.length);
 		System.arraycopy(data, 0, chmPmglHeader.signature, 0, count);
 		this.setCurrentPlace(this.getCurrentPlace() + count);
 		this.setDataRemained(this.getDataRemained() - count);
 	}
-
+	
+	
 	private int unmarshalInt32(byte[] data, int dest) {
 		ChmAssert.assertByteArrayNotNull(data);
 		if (4 > this.getDataRemained())
 			throw new ChmParsingException("4 > dataLenght");
-		dest = data[this.getCurrentPlace()]
+		dest =  data[this.getCurrentPlace()]
 				| data[this.getCurrentPlace() + 1] << 8
 				| data[this.getCurrentPlace() + 2] << 16
 				| data[this.getCurrentPlace() + 3] << 24;
@@ -125,12 +129,13 @@
 		this.setDataRemained(this.getDataRemained() - 4);
 		return dest;
 	}
-
+	
+	
 	private long unmarshalUInt32(byte[] data, long dest) {
 		ChmAssert.assertByteArrayNotNull(data);
 		if (4 > getDataRemained())
 			throw new ChmParsingException("4 > dataLenght");
-		dest = data[this.getCurrentPlace()]
+		dest =  data[this.getCurrentPlace()]
 				| data[this.getCurrentPlace() + 1] << 8
 				| data[this.getCurrentPlace() + 2] << 16
 				| data[this.getCurrentPlace() + 3] << 24;
@@ -139,32 +144,27 @@
 		this.setCurrentPlace(this.getCurrentPlace() + 4);
 		return dest;
 	}
-
-	// @Override
+	
+	
+//	@Override
 	public void parse(byte[] data, ChmPmglHeader chmPmglHeader) {
 		if (data.length < ChmConstants.CHM_PMGL_LEN)
-			throw new ChmParsingException(ChmPmglHeader.class.getName()
-					+ " we only know how to deal with a 0x14 byte structures");
+			throw new ChmParsingException(ChmPmglHeader.class.getName()	+ " we only know how to deal with a 0x14 byte structures");
 
 		/* unmarshal fields */
-		chmPmglHeader.unmarshalCharArray(data, chmPmglHeader,
-				ChmConstants.CHM_SIGNATURE_LEN);
-		chmPmglHeader.setFreeSpace(chmPmglHeader.unmarshalUInt32(data,
-				chmPmglHeader.getFreeSpace()));
-		chmPmglHeader.setUnknown0008(chmPmglHeader.unmarshalUInt32(data,
-				chmPmglHeader.getUnknown0008()));
-		chmPmglHeader.setBlockPrev(chmPmglHeader.unmarshalInt32(data,
-				chmPmglHeader.getBlockPrev()));
-		chmPmglHeader.setBlockNext(chmPmglHeader.unmarshalInt32(data,
-				chmPmglHeader.getBlockNext()));
+		chmPmglHeader.unmarshalCharArray(data, chmPmglHeader, ChmConstants.CHM_SIGNATURE_LEN);
+		chmPmglHeader.setFreeSpace(chmPmglHeader.unmarshalUInt32(data, chmPmglHeader.getFreeSpace()));
+		chmPmglHeader.setUnknown0008(chmPmglHeader.unmarshalUInt32(data, chmPmglHeader.getUnknown0008()));
+		chmPmglHeader.setBlockPrev(chmPmglHeader.unmarshalInt32(data, chmPmglHeader.getBlockPrev()));
+		chmPmglHeader.setBlockNext(chmPmglHeader.unmarshalInt32(data, chmPmglHeader.getBlockNext()));
 
 		/* check structure */
 		if (!new String(chmPmglHeader.getSignature()).equals(ChmConstants.PMGL))
-			throw new ChmParsingException(ChmPmglHeader.class.getName()
-					+ " pmgl != pmgl.signature");
-
+			throw new ChmParsingException(ChmPmglHeader.class.getName() + " pmgl != pmgl.signature");
+		
 	}
-
+	
+	
 	public byte[] getSignature() {
 		return signature;
 	}
@@ -201,6 +201,6 @@
 	 * @param args
 	 */
 	public static void main(String[] args) {
-
+		
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/DirectoryListingEntry.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/DirectoryListingEntry.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/DirectoryListingEntry.java	(working copy)
@@ -19,15 +19,18 @@
 import org.apache.tika.parser.chm.assertion.ChmAssert;
 import org.apache.tika.parser.chm.core.ChmCommons;
 
+
 /**
- * The format of a directory listing entry is as follows: BYTE: length of name
- * BYTEs: name (UTF-8 encoded) ENCINT: content section ENCINT: offset ENCINT:
- * length The offset is from the beginning of the content section the file is
- * in, after the section has been decompressed (if appropriate). The length also
- * refers to length of the file in the section after decompression. There are
- * two kinds of file represented in the directory: user data and format related
- * files. The files which are format-related have names which begin with '::',
- * the user data files have names which begin with "/".
+ * The format of a directory listing entry is as follows:
+ * BYTE: length of name
+ * BYTEs: name (UTF-8 encoded)
+ * ENCINT: content section
+ * ENCINT: offset
+ * ENCINT: length
+ * The offset is from the beginning of the content section the file is in, after the section has been decompressed (if appropriate). 
+ * The length also refers to length of the file in the section after decompression.
+ * There are two kinds of file represented in the directory: user data and format related files. 
+ * The files which are format-related have names which begin with '::', the user data files have names which begin with "/".
  * 
  */
 public class DirectoryListingEntry {
@@ -41,49 +44,40 @@
 	private int offset;
 	/* Entry size */
 	private int length;
+	
 
-	public DirectoryListingEntry() {
-
+	public DirectoryListingEntry(){
+		
 	}
-
+	
 	/**
 	 * Constructs directoryListingEntry
 	 * 
-	 * @param name_length
-	 *            int
-	 * @param name
-	 *            String
-	 * @param isCompressed
-	 *            ChmCommons.EntryType
-	 * @param offset
-	 *            int
-	 * @param length
-	 *            int
+	 * @param name_length int
+	 * @param name String
+	 * @param isCompressed ChmCommons.EntryType
+	 * @param offset int
+	 * @param length int
 	 */
-	public DirectoryListingEntry(int name_length, String name,
-			ChmCommons.EntryType isCompressed, int offset, int length) {
-		ChmAssert.assertDirectoryListingEntry(name_length, name, isCompressed,
-				offset, length);
+	public DirectoryListingEntry(int name_length, String name, ChmCommons.EntryType isCompressed, int offset, int length){
+		ChmAssert.assertDirectoryListingEntry(name_length, name, isCompressed, offset, length);
 		setNameLength(name_length);
 		setName(name);
 		setEntryType(isCompressed);
 		setOffset(offset);
 		setLength(length);
 	}
-
-	public String toString() {
+	
+	public String toString(){
 		StringBuilder sb = new StringBuilder();
-		sb.append("name_length:=" + getNameLength()
-				+ System.getProperty("line.separator"));
+		sb.append("name_length:=" + getNameLength() + System.getProperty("line.separator"));
 		sb.append("name:=" + getName() + System.getProperty("line.separator"));
-		sb.append("entryType:=" + getEntryType()
-				+ System.getProperty("line.separator"));
-		sb.append("offset:=" + getOffset()
-				+ System.getProperty("line.separator"));
+		sb.append("entryType:=" + getEntryType() + System.getProperty("line.separator"));
+		sb.append("offset:=" + getOffset() + System.getProperty("line.separator"));
 		sb.append("length:=" + getLength());
 		return sb.toString();
 	}
-
+	
 	/**
 	 * Returns an entry name length
 	 * 
@@ -96,8 +90,7 @@
 	/**
 	 * Sets an entry name length
 	 * 
-	 * @param name_length
-	 *            int
+	 * @param name_length int
 	 */
 	protected void setNameLength(int name_length) {
 		this.name_length = name_length;
@@ -115,8 +108,7 @@
 	/**
 	 * Sets entry name
 	 * 
-	 * @param name
-	 *            String
+	 * @param name String
 	 */
 	protected void setName(String name) {
 		this.name = name;
@@ -131,6 +123,7 @@
 		return entryType;
 	}
 
+	
 	protected void setEntryType(ChmCommons.EntryType entryType) {
 		this.entryType = entryType;
 	}
@@ -150,7 +143,8 @@
 	protected void setLength(int length) {
 		this.length = length;
 	}
-
-	public static void main(String[] args) {
+	
+	
+	public static void main(String[] args){
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmDirectoryListingSet.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmDirectoryListingSet.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmDirectoryListingSet.java	(working copy)
@@ -18,12 +18,12 @@
 
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import org.apache.tika.parser.chm.core.ChmCommons;
 import org.apache.tika.parser.chm.core.ChmConstants;
 
+
 /**
  * Holds chm listing entries
  */
@@ -34,35 +34,34 @@
 	private long dataOffset = -1;
 	private int controlDataIndex = -1;
 	private int resetTableIndex = -1;
-
+	
 	private boolean isNotControlDataFound = true;
 	private boolean isNotResetTableFound = true;
 
+
 	/**
 	 * Constructs chm directory listing set
 	 * 
-	 * @param data
-	 *            byte[]
+	 * @param data byte[] 
 	 * @param chmItsHeader
 	 * @param chmItspHeader
 	 */
-	public ChmDirectoryListingSet(byte[] data, ChmItsfHeader chmItsHeader,
-			ChmItspHeader chmItspHeader) {
+	public ChmDirectoryListingSet(byte[] data, ChmItsfHeader chmItsHeader, ChmItspHeader chmItspHeader){
 		setDirectoryListingEntryList(new ArrayList<DirectoryListingEntry>());
 		ChmCommons.assertByteArrayNotNull(data);
 		setData(data);
 		enumerateChmDirectoryListingList(chmItsHeader, chmItspHeader);
 	}
-
-	public String toString() {
+	
+	
+	public String toString(){
 		StringBuilder sb = new StringBuilder();
-		sb.append("list:=" + getDirectoryListingEntryList().toString()
-				+ System.getProperty("line.separator"));
-		sb.append("number of list items:="
-				+ getDirectoryListingEntryList().size());
+		sb.append("list:=" + getDirectoryListingEntryList().toString() + System.getProperty("line.separator"));
+		sb.append("number of list items:=" + getDirectoryListingEntryList().size());
 		return sb.toString();
 	}
 
+	
 	/**
 	 * Returns control data index that located in List
 	 * 
@@ -72,6 +71,7 @@
 		return controlDataIndex;
 	}
 
+
 	/**
 	 * Sets control data index
 	 * 
@@ -116,45 +116,37 @@
 	private void setPlaceHolder(int placeHolder) {
 		this.placeHolder = placeHolder;
 	}
-
+	
 	/**
 	 * Enumerates chm directory listing entries
 	 * 
-	 * @param chmItsHeader
-	 *            chm itsf header
-	 * @param chmItspHeader
-	 *            chm itsp header
+	 * @param chmItsHeader chm itsf header
+	 * @param chmItspHeader chm itsp header
 	 */
-	private void enumerateChmDirectoryListingList(ChmItsfHeader chmItsHeader,
-			ChmItspHeader chmItspHeader) {
+	private void enumerateChmDirectoryListingList(ChmItsfHeader chmItsHeader, ChmItspHeader chmItspHeader){
 		try {
 			int startPmgl = chmItspHeader.getIndex_head();
 			int stopPmgl = chmItspHeader.getUnknown_0024();
-			int dir_offset = (int) (chmItsHeader.getDirOffset() + chmItspHeader
-					.getHeader_len());
+			int dir_offset = (int) (chmItsHeader.getDirOffset() + chmItspHeader.getHeader_len());
 			setDataOffset(chmItsHeader.getDataOffset());
-
+			
 			/* loops over all pmgls */
 			int previous_index = 0;
 			byte[] dir_chunk = null;
-			for (int i = startPmgl; i <= stopPmgl; i++) {
-				int data_copied = ((1 + i) * (int) chmItspHeader.getBlock_len())
-						+ dir_offset;
-				if (i == 0) {
-					dir_chunk = new byte[(int) chmItspHeader.getBlock_len()];
-					dir_chunk = Arrays
-							.copyOfRange(getData(), dir_offset,
-									(((1 + i) * (int) chmItspHeader
-											.getBlock_len()) + dir_offset));
+			for(int i = startPmgl; i <= stopPmgl; i++ ){
+				int data_copied = ((1+i) * (int)chmItspHeader.getBlock_len()) + dir_offset ;
+				if(i == 0){
+					dir_chunk = new byte[(int)chmItspHeader.getBlock_len()];
+//					dir_chunk = Arrays.copyOfRange(getData(), dir_offset, (((1+i) * (int)chmItspHeader.getBlock_len()) + dir_offset));
+					dir_chunk = ChmCommons.copyOfRange(getData(), dir_offset, (((1+i) * (int)chmItspHeader.getBlock_len()) + dir_offset));
 					previous_index = data_copied;
-				} else {
-					dir_chunk = new byte[(int) chmItspHeader.getBlock_len()];
-					dir_chunk = Arrays
-							.copyOfRange(getData(), previous_index,
-									(((1 + i) * (int) chmItspHeader
-											.getBlock_len()) + dir_offset));
-					previous_index = data_copied;
 				}
+				else{
+					dir_chunk = new byte[(int)chmItspHeader.getBlock_len()];
+//					dir_chunk = Arrays.copyOfRange(getData(), previous_index, (((1+i) * (int)chmItspHeader.getBlock_len()) + dir_offset));
+					dir_chunk = ChmCommons.copyOfRange(getData(), previous_index, (((1+i) * (int)chmItspHeader.getBlock_len()) + dir_offset));
+					previous_index = data_copied;
+				}	
 				enumerateOneSegment(dir_chunk);
 				dir_chunk = null;
 			}
@@ -164,117 +156,108 @@
 			setData(null);
 		}
 	}
-
+	
 	/**
 	 * Checks control data
 	 * 
-	 * @param dle
-	 *            chm directory listing entry
+	 * @param dle chm directory listing entry
 	 */
-	private void checkControlData(DirectoryListingEntry dle) {
-		if (isNotControlDataFound) {
-			if (dle.getName().contains(ChmConstants.CONTROL_DATA)) {
+	private void checkControlData(DirectoryListingEntry dle){
+		if(isNotControlDataFound){
+			if(dle.getName().contains(ChmConstants.CONTROL_DATA)){
 				setControlDataIndex(getDirectoryListingEntryList().size());
 				isNotControlDataFound = false;
 			}
 		}
 	}
-
+	
 	/**
 	 * Checks reset table
 	 * 
-	 * @param dle
-	 *            chm directory listing entry
+	 * @param dle chm directory listing entry
 	 */
-	private void checkResetTable(DirectoryListingEntry dle) {
-		if (isNotResetTableFound) {
-			if (dle.getName().contains(ChmConstants.RESET_TABLE)) {
+	private void checkResetTable(DirectoryListingEntry dle){
+		if(isNotResetTableFound){
+			if(dle.getName().contains(ChmConstants.RESET_TABLE)){
 				setResetTableIndex(getDirectoryListingEntryList().size());
 				isNotResetTableFound = false;
 			}
 		}
 	}
-
+	
 	/**
 	 * Enumerates chm directory listing entries in single chm segment
 	 * 
 	 * @param dir_chunk
 	 */
-	private void enumerateOneSegment(byte[] dir_chunk) {
+	private void enumerateOneSegment(byte[] dir_chunk){
 		try {
-			if (dir_chunk != null) {
-
-				int indexWorkData = ChmCommons.indexOf(dir_chunk,
-						"::".getBytes());
-				int indexUserData = ChmCommons.indexOf(dir_chunk,
-						"/".getBytes());
-
-				if (indexUserData < indexWorkData)
+			if(dir_chunk != null){
+				
+				int indexWorkData = ChmCommons.indexOf(dir_chunk, "::".getBytes());
+				int indexUserData = ChmCommons.indexOf(dir_chunk, "/".getBytes());
+				
+				if(indexUserData < indexWorkData)
 					setPlaceHolder(indexUserData);
 				else
 					setPlaceHolder(indexWorkData);
-
-				if (getPlaceHolder() > 0
-						&& dir_chunk[getPlaceHolder() - 1] != 115) {// #{
+				
+				if(getPlaceHolder() > 0 && dir_chunk[getPlaceHolder() - 1] != 115){//#{
 					do {
-						if (dir_chunk[getPlaceHolder() - 1] > 0) {
+						if(dir_chunk[getPlaceHolder() - 1] > 0){
 							DirectoryListingEntry dle = new DirectoryListingEntry();
-
-							// two cases: 1. when dir_chunk[getPlaceHolder() -
-							// 1] == 0x73
-							// 2. when dir_chunk[getPlaceHolder() + 1] == 0x2f
+							
+							//two cases: 1. when dir_chunk[getPlaceHolder() - 1] == 0x73
+							//           2. when dir_chunk[getPlaceHolder() + 1] == 0x2f 
 							doNameCheck(dir_chunk, dle);
-
-							dle.setName(new String(Arrays.copyOfRange(
-									dir_chunk, getPlaceHolder(),
-									(getPlaceHolder() + dle.getNameLength()))));
+							
+//							dle.setName(new String(Arrays.copyOfRange(dir_chunk, getPlaceHolder(), (getPlaceHolder() + dle.getNameLength()))));
+							dle.setName(new String(ChmCommons.copyOfRange(dir_chunk, getPlaceHolder(), (getPlaceHolder() + dle.getNameLength()))));
 							checkControlData(dle);
 							checkResetTable(dle);
-							setPlaceHolder(getPlaceHolder()
-									+ dle.getNameLength());
-
+							setPlaceHolder(getPlaceHolder()  + dle.getNameLength() );
+							
 							/* Sets entry type */
-							if (getPlaceHolder() < dir_chunk.length
-									&& dir_chunk[getPlaceHolder()] == 0)
+							if(getPlaceHolder() < dir_chunk.length && dir_chunk[getPlaceHolder()] == 0)
 								dle.setEntryType(ChmCommons.EntryType.UNCOMPRESSED);
 							else
 								dle.setEntryType(ChmCommons.EntryType.COMPRESSED);
 
-							setPlaceHolder(getPlaceHolder() + 1);
+							setPlaceHolder(getPlaceHolder()+1);
 							dle.setOffset(getEncint(dir_chunk));
 							dle.setLength(getEncint(dir_chunk));
 							getDirectoryListingEntryList().add(dle);
-						} else
+						}else
 							setPlaceHolder(getPlaceHolder() + 1);
-
+						
 					} while (hasNext(dir_chunk));
 				}
 			}
-
+			
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
 	}
-
+	
 	/**
-	 * Checks if a name and name length are correct. If not then handles it as
-	 * follows: 1. when dir_chunk[getPlaceHolder() - 1] == 0x73 ('/') 2. when
-	 * dir_chunk[getPlaceHolder() + 1] == 0x2f ('s')
+	 * Checks if a name and name length are correct. If not then handles it as follows:
+	 * 1. when dir_chunk[getPlaceHolder() - 1] == 0x73 ('/')
+	 * 2. when dir_chunk[getPlaceHolder() + 1] == 0x2f ('s')
 	 * 
 	 * @param dir_chunk
 	 * @param dle
 	 */
-	private void doNameCheck(byte[] dir_chunk, DirectoryListingEntry dle) {
-		if (dir_chunk[getPlaceHolder() - 1] == 0x73) {
+	private void doNameCheck(byte[] dir_chunk, DirectoryListingEntry dle){
+		if(dir_chunk[getPlaceHolder() - 1] == 0x73){
 			dle.setNameLength(dir_chunk[getPlaceHolder() - 1] & 0x21);
-		} else if (dir_chunk[getPlaceHolder() + 1] == 0x2f) {
+		}else if(dir_chunk[getPlaceHolder() + 1] == 0x2f){
 			dle.setNameLength(dir_chunk[getPlaceHolder()]);
 			setPlaceHolder(getPlaceHolder() + 1);
-		} else {
+		}else{
 			dle.setNameLength(dir_chunk[getPlaceHolder() - 1]);
 		}
 	}
-
+	
 	/**
 	 * Checks if it's possible move further on byte[]
 	 * 
@@ -282,22 +265,20 @@
 	 * 
 	 * @return boolean
 	 */
-	private boolean hasNext(byte[] dir_chunk) {
-		while (getPlaceHolder() < dir_chunk.length) {
-			if (dir_chunk[getPlaceHolder()] == 47
-					&& dir_chunk[getPlaceHolder() + 1] != ':') {
+	private boolean hasNext(byte[] dir_chunk){
+		while(getPlaceHolder() < dir_chunk.length){
+			if(dir_chunk[getPlaceHolder()] == 47 && dir_chunk[getPlaceHolder() + 1] != ':'){
 				setPlaceHolder(getPlaceHolder());
 				return true;
-			} else if (dir_chunk[getPlaceHolder()] == ':'
-					&& dir_chunk[getPlaceHolder() + 1] == ':') {
+			}else if(dir_chunk[getPlaceHolder()] == ':' && dir_chunk[getPlaceHolder() + 1] == ':'){
 				setPlaceHolder(getPlaceHolder());
 				return true;
 			} else
-				setPlaceHolder(getPlaceHolder() + 1);
+				setPlaceHolder(getPlaceHolder()+1);
 		}
 		return false;
 	}
-
+	
 	/**
 	 * Returns encrypted integer
 	 * 
@@ -309,8 +290,8 @@
 		byte ob;
 		BigInteger bi = BigInteger.ZERO;
 		byte[] nb = new byte[1];
-
-		if (getPlaceHolder() < data_chunk.length) {
+		
+		if(getPlaceHolder() < data_chunk.length){
 			while ((ob = data_chunk[getPlaceHolder()]) < 0) {
 				nb[0] = (byte) ((ob & 0x7f));
 				bi = bi.shiftLeft(7).add(new BigInteger(nb));
@@ -322,7 +303,7 @@
 		}
 		return bi.intValue();
 	}
-
+	
 	/**
 	 * @param args
 	 */
@@ -332,8 +313,7 @@
 	/**
 	 * Sets chm directory listing entry list
 	 * 
-	 * @param dlel
-	 *            chm directory listing entry list
+	 * @param dlel chm directory listing entry list
 	 */
 	public void setDirectoryListingEntryList(List<DirectoryListingEntry> dlel) {
 		this.dlel = dlel;
@@ -366,6 +346,7 @@
 		return data;
 	}
 
+
 	/**
 	 * Sets data offset
 	 * 
@@ -375,6 +356,7 @@
 		this.dataOffset = dataOffset;
 	}
 
+
 	/**
 	 * Returns data offset
 	 * 
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmLzxcControlData.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmLzxcControlData.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmLzxcControlData.java	(working copy)
@@ -22,47 +22,44 @@
 
 /**
  * 
- * ::DataSpace/Storage/<SectionName>/ControlData This file contains $20 bytes of
- * information on the compression. The information is partially known: 0000:
- * DWORD 6 (unknown) 0004: ASCII 'LZXC' Compression type identifier 0008: DWORD
- * 2 (Possibly numeric code for LZX) 000C: DWORD The Huffman reset interval in
- * $8000-byte blocks 0010: DWORD The window size in $8000-byte blocks 0014:
- * DWORD unknown (sometimes 2, sometimes 1, sometimes 0) 0018: DWORD 0 (unknown)
+ * ::DataSpace/Storage/<SectionName>/ControlData
+ * This file contains $20 bytes of information on the compression. The information is partially known:
+ * 0000: DWORD 6 (unknown)
+ * 0004: ASCII 'LZXC' Compression type identifier
+ * 0008: DWORD 2 (Possibly numeric code for LZX)
+ * 000C: DWORD The Huffman reset interval in $8000-byte blocks
+ * 0010: DWORD The window size in $8000-byte blocks
+ * 0014: DWORD unknown (sometimes 2, sometimes 1, sometimes 0)
+ * 0018: DWORD 0 (unknown)
  * 001C: DWORD 0 (unknown)
  * 
- * {@link http
- * ://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original
- * /?page=2 }
+ * {@link http://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original/?page=2 }
  * 
  */
-public class ChmLzxcControlData implements ChmAccessor<ChmLzxcControlData> {
+public class ChmLzxcControlData implements ChmAccessor<ChmLzxcControlData>{
 	private static final long serialVersionUID = -7897854774939631565L;
 	/* class' members */
-	private long size; /* 0 */
-	private byte[] signature = new String(ChmConstants.LZXC).getBytes(); /*
-																		 * 4
-																		 * (LZXC
-																		 * )
-																		 */
-	private long version; /* 8 */
-	private long resetInterval; /* c */
-	private long windowSize; /* 10 */
-	private long windowsPerReset; /* 14 */
-	private long unknown_18; /* 18 */
-
-	/* local usage */
-	private int dataRemained;
-	private int currentPlace = 0;
-
-	/**
-	 * Returns a remained data
-	 * 
-	 * @return dataRemained
-	 */
+	private long size;                   								/*  0  */
+    private byte[] signature= new String(ChmConstants.LZXC).getBytes(); /*  4 (LZXC)  */
+    private long version;                								/*  8  */
+    private long resetInterval;          								/*  c  */
+    private long windowSize;             								/*  10  */
+    private  long windowsPerReset;        								/*  14  */
+    private long unknown_18;             								/*  18  */
+	
+    /* local usage */
+    private int dataRemained;
+    private int currentPlace = 0;
+    
+    /**
+     * Returns a remained data
+     * 
+     * @return dataRemained
+     */
 	private int getDataRemained() {
 		return dataRemained;
 	}
-
+	
 	/**
 	 * Sets a remained data
 	 * 
@@ -71,7 +68,7 @@
 	private void setDataRemained(int dataRemained) {
 		this.dataRemained = dataRemained;
 	}
-
+	
 	/**
 	 * Returns a place holder
 	 * 
@@ -80,7 +77,7 @@
 	private int getCurrentPlace() {
 		return currentPlace;
 	}
-
+	
 	/**
 	 * Sets a place holder
 	 * 
@@ -119,7 +116,7 @@
 
 	/**
 	 * Sets a signature of control data block
-	 * 
+	 *  
 	 * @param signature
 	 */
 	protected void setSignature(byte[] signature) {
@@ -215,12 +212,12 @@
 	protected void setUnknown_18(long unknown_18) {
 		this.unknown_18 = unknown_18;
 	}
-
+    
 	private long unmarshalUInt32(byte[] data, long dest) {
 		assert (data != null && data.length > 0);
 		if (4 > getDataRemained())
 			throw new ChmParsingException("4 > dataLenght");
-		dest = data[this.getCurrentPlace()]
+		dest =  data[this.getCurrentPlace()]
 				| data[this.getCurrentPlace() + 1] << 8
 				| data[this.getCurrentPlace() + 2] << 16
 				| data[this.getCurrentPlace() + 3] << 24;
@@ -229,9 +226,8 @@
 		this.setCurrentPlace(this.getCurrentPlace() + 4);
 		return dest;
 	}
-
-	private void unmarshalCharArray(byte[] data,
-			ChmLzxcControlData chmLzxcControlData, int count) {
+	
+	private void unmarshalCharArray(byte[] data, ChmLzxcControlData chmLzxcControlData, int count) {
 		ChmAssert.assertByteArrayNotNull(data);
 		ChmAssert.assertChmAccessorNotNull(chmLzxcControlData);
 		ChmAssert.assertPositiveInt(count);
@@ -239,73 +235,57 @@
 		this.setCurrentPlace(this.getCurrentPlace() + count);
 		this.setDataRemained(this.getDataRemained() - count);
 	}
-
+	
+	
 	/**
 	 * Returns textual representation of ChmLzxcControlData
 	 */
-	public String toString() {
+	public String toString(){
 		StringBuilder sb = new StringBuilder();
 		sb.append("size(unknown):=" + this.getSize() + ", ");
-		sb.append("signature(Compression type identifier):="
-				+ new String(this.getSignature()) + ", ");
-		sb.append("version(Possibly numeric code for LZX):="
-				+ this.getVersion() + System.getProperty("line.separator"));
-		sb.append("resetInterval(The Huffman reset interval):="
-				+ this.getResetInterval() + ", ");
+		sb.append("signature(Compression type identifier):=" + new String(this.getSignature()) + ", ");
+		sb.append("version(Possibly numeric code for LZX):=" + this.getVersion() + System.getProperty("line.separator"));
+		sb.append("resetInterval(The Huffman reset interval):=" + this.getResetInterval() + ", ");
 		sb.append("windowSize:=" + this.getWindowSize() + ", ");
-		sb.append("windowsPerReset(unknown (sometimes 2, sometimes 1, sometimes 0):="
-				+ this.getWindowsPerReset() + ", ");
-		sb.append("unknown_18:=" + this.getUnknown_18()
-				+ System.getProperty("line.separator"));
+		sb.append("windowsPerReset(unknown (sometimes 2, sometimes 1, sometimes 0):=" + this.getWindowsPerReset() + ", ");
+		sb.append("unknown_18:=" + this.getUnknown_18() + System.getProperty("line.separator"));
 		return sb.toString();
 	}
-
-	// @Override
+	
+//	@Override
 	public void parse(byte[] data, ChmLzxcControlData chmLzxcControlData) {
-		if (data == null || (data.length < ChmConstants.CHM_LZXC_MIN_LEN))
-			throw new ChmParsingException("we want at least 0x18 bytes");
-		chmLzxcControlData.setDataRemained(data.length);
-		chmLzxcControlData.setSize(unmarshalUInt32(data,
-				chmLzxcControlData.getSize()));
-		chmLzxcControlData.unmarshalCharArray(data, chmLzxcControlData,
-				ChmConstants.CHM_SIGNATURE_LEN);
-		chmLzxcControlData.setVersion(unmarshalUInt32(data,
-				chmLzxcControlData.getVersion()));
-		chmLzxcControlData.setResetInterval(unmarshalUInt32(data,
-				chmLzxcControlData.getResetInterval()));
-		chmLzxcControlData.setWindowSize(unmarshalUInt32(data,
-				chmLzxcControlData.getWindowSize()));
-		chmLzxcControlData.setWindowsPerReset(unmarshalUInt32(data,
-				chmLzxcControlData.getWindowsPerReset()));
+	   	if (data == null || (data.length < ChmConstants.CHM_LZXC_MIN_LEN))
+    		throw new ChmParsingException("we want at least 0x18 bytes");
+    	chmLzxcControlData.setDataRemained(data.length);
+    	chmLzxcControlData.setSize(unmarshalUInt32(data, chmLzxcControlData.getSize()));
+    	chmLzxcControlData.unmarshalCharArray(data, chmLzxcControlData, ChmConstants.CHM_SIGNATURE_LEN);
+    	chmLzxcControlData.setVersion(unmarshalUInt32(data, chmLzxcControlData.getVersion()));
+    	chmLzxcControlData.setResetInterval(unmarshalUInt32(data, chmLzxcControlData.getResetInterval()));
+    	chmLzxcControlData.setWindowSize(unmarshalUInt32(data, chmLzxcControlData.getWindowSize()));
+    	chmLzxcControlData.setWindowsPerReset(unmarshalUInt32(data, chmLzxcControlData.getWindowsPerReset()));
+    	
+        if (data.length >= ChmConstants.CHM_LZXC_V2_LEN)
+        	chmLzxcControlData.setUnknown_18(unmarshalUInt32(data, chmLzxcControlData.getUnknown_18()));
+        else
+        	chmLzxcControlData.setUnknown_18(0);
 
-		if (data.length >= ChmConstants.CHM_LZXC_V2_LEN)
-			chmLzxcControlData.setUnknown_18(unmarshalUInt32(data,
-					chmLzxcControlData.getUnknown_18()));
-		else
-			chmLzxcControlData.setUnknown_18(0);
+        if (chmLzxcControlData.getVersion() == 2)
+        {
+        	chmLzxcControlData.setWindowSize( getWindowSize() * ChmConstants.CHM_WINDOW_SIZE_BLOCK);
+        }
+        
+        if (chmLzxcControlData.getWindowSize() == 0 || chmLzxcControlData.getResetInterval() == 0)
+        	throw new ChmParsingException("window size / resetInterval should be more than zero");
 
-		if (chmLzxcControlData.getVersion() == 2) {
-			chmLzxcControlData.setWindowSize(getWindowSize()
-					* ChmConstants.CHM_WINDOW_SIZE_BLOCK);
-		}
+        if (chmLzxcControlData.getWindowSize() == 1)
+        	throw new ChmParsingException("window size / resetInterval should be more than 1");
 
-		if (chmLzxcControlData.getWindowSize() == 0
-				|| chmLzxcControlData.getResetInterval() == 0)
-			throw new ChmParsingException(
-					"window size / resetInterval should be more than zero");
-
-		if (chmLzxcControlData.getWindowSize() == 1)
-			throw new ChmParsingException(
-					"window size / resetInterval should be more than 1");
-
-		/* checks a signature */
-		if (!new String(chmLzxcControlData.getSignature())
-				.equals(ChmConstants.LZXC))
-			throw new ChmParsingException(
-					"the signature does not seem to be correct");
+        /* checks a signature */
+        if (!new String(chmLzxcControlData.getSignature()).equals(ChmConstants.LZXC))
+        	throw new ChmParsingException("the signature does not seem to be correct");
 	}
-
-	/**
+    
+    /**
 	 * @param args
 	 */
 	public static void main(String[] args) {
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmLzxcResetTable.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmLzxcResetTable.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmLzxcResetTable.java	(working copy)
@@ -23,50 +23,53 @@
 import org.apache.tika.parser.chm.core.ChmConstants;
 import org.apache.tika.parser.chm.exception.ChmParsingException;
 
+
 /**
- * LZXC reset table For ensuring a decompression. Reads the block named
- * "::DataSpace/Storage/<SectionName>/Transform/{7FC28940-9D31-11D0-9B27-00A0C91E9C7C}/InstanceData/ResetTable"
- * .
+ * LZXC reset table
+ * For ensuring a decompression. 
+ * Reads the block named "::DataSpace/Storage/<SectionName>/Transform/{7FC28940-9D31-11D0-9B27-00A0C91E9C7C}/InstanceData/ResetTable". 
  * 
- * {@link http
- * ://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original
- * /?page=2 }
+ * {@link http://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original/?page=2 }
  * 
  */
-public class ChmLzxcResetTable implements ChmAccessor<ChmLzxcResetTable> {
+public class ChmLzxcResetTable implements ChmAccessor<ChmLzxcResetTable>{
 	private static final long serialVersionUID = -8209574429411707460L;
 	/* class members */
-	private long version; // 0000: DWORD 2 unknown (possibly a version number)
-	private long block_count; // 0004: DWORD Number of entries in reset table
-	private long unknown; // 0008: DWORD 8 unknown
-	private long table_offset; // 000C: DWORD $28 Length of table header (area
-								// before table entries)
-	private long uncompressed_len; // 0010: QWORD Uncompressed Length
-	private long compressed_len; // 0018: QWORD Compressed Length
-	private long block_len; // 0020: QWORD 0x8000 block size for locations below
+	private long version;				//0000: DWORD 2 unknown (possibly a version number)
+	private long block_count;			//0004: DWORD Number of entries in reset table
+	private long unknown;				//0008: DWORD 8 unknown
+	private long table_offset;			//000C: DWORD $28 Length of table header (area before table entries)
+	private long uncompressed_len;		//0010: QWORD Uncompressed Length
+	private long compressed_len;		//0018: QWORD Compressed Length
+	private long block_len;				//0020: QWORD 0x8000 block size for locations below
 	private long[] block_address;
-
+	
+	
 	/* local usage */
-	private int dataRemained;
-	private int currentPlace = 0;
-
+    private int dataRemained;
+    private int currentPlace = 0;
+	
+    
 	private int getDataRemained() {
 		return dataRemained;
 	}
 
+
 	private void setDataRemained(int dataRemained) {
 		this.dataRemained = dataRemained;
 	}
 
-	/**
-	 * Returns block addresses
-	 * 
-	 * @return block addresses
-	 */
+	
+    /**
+     * Returns block addresses
+     * 
+     * @return block addresses
+     */
 	public long[] getBlockAddress() {
 		return block_address;
 	}
 
+
 	/**
 	 * Sets block addresses
 	 * 
@@ -76,35 +79,32 @@
 		this.block_address = block_address;
 	}
 
+
 	private int getCurrentPlace() {
 		return currentPlace;
 	}
 
+
 	private void setCurrentPlace(int currentPlace) {
 		this.currentPlace = currentPlace;
 	}
 
+
 	@Override
-	public String toString() {
+	public String toString(){
 		StringBuilder sb = new StringBuilder();
-		sb.append("version:=" + getVersion()
-				+ System.getProperty("line.separator"));
-		sb.append("block_count:=" + getBlockCount()
-				+ System.getProperty("line.separator"));
-		sb.append("unknown:=" + getUnknown()
-				+ System.getProperty("line.separator"));
-		sb.append("table_offset:=" + getTableOffset()
-				+ System.getProperty("line.separator"));
-		sb.append("uncompressed_len:=" + getUncompressedLen()
-				+ System.getProperty("line.separator"));
-		sb.append("compressed_len:=" + getCompressedLen()
-				+ System.getProperty("line.separator"));
-		sb.append("block_len:=" + getBlockLen()
-				+ System.getProperty("line.separator"));
+		sb.append("version:=" + getVersion() + System.getProperty("line.separator"));
+		sb.append("block_count:=" + getBlockCount() + System.getProperty("line.separator"));
+		sb.append("unknown:=" + getUnknown() + System.getProperty("line.separator"));
+		sb.append("table_offset:=" + getTableOffset() + System.getProperty("line.separator"));
+		sb.append("uncompressed_len:=" + getUncompressedLen() + System.getProperty("line.separator"));
+		sb.append("compressed_len:=" + getCompressedLen() + System.getProperty("line.separator"));
+		sb.append("block_len:=" + getBlockLen() + System.getProperty("line.separator"));
 		sb.append("block_addresses:=" + Arrays.toString(getBlockAddress()));
 		return sb.toString();
 	}
-
+	
+	
 	/**
 	 * Enumerates chm block addresses
 	 * 
@@ -112,29 +112,29 @@
 	 * 
 	 * @return byte[] of addresses
 	 */
-	private long[] enumerateBlockAddresses(byte[] data) {
+	private long[] enumerateBlockAddresses(byte[] data){
 		ChmAssert.assertByteArrayNotNull(data);
 		/* we have limit of number of blocks to be extracted */
-		if (getBlockCount() > 5000)
+		if(getBlockCount() > 5000)
 			setBlockCount(5000);
-
-		if (getBlockCount() < 0 && (getDataRemained() / 8) > 0)
+		
+		if(getBlockCount() < 0 && (getDataRemained() / 8) > 0)
 			setBlockCount(getDataRemained() / 8);
-
-		long[] addresses = new long[(int) getBlockCount()];
+		
+		long[] addresses = new long[(int)getBlockCount()];
 		int rem = getDataRemained() / 8;
-		for (int i = 0; i < rem; i++) {
-			long num = -1;
-
-			try {
-				addresses[i] = unmarshalUint64(data, num);
+	    for(int i = 0; i < rem; i++){
+	    	long num = -1;
+	    	
+	    	try {
+	    		addresses[i] = unmarshalUint64(data, num);
 			} catch (Exception e) {
-				// System.err.println(e.getMessage());
+//				System.err.println(e.getMessage());
 			}
-		}
-		return addresses;
+	    }
+	    return addresses;
 	}
-
+	
 	/**
 	 * Validates parameters such as byte[] and chm lzxc reset table
 	 * 
@@ -143,8 +143,7 @@
 	 * 
 	 * @return boolean
 	 */
-	private boolean validateParamaters(byte[] data,
-			ChmLzxcResetTable chmLzxcResetTable) {
+	private boolean validateParamaters(byte[] data, ChmLzxcResetTable chmLzxcResetTable){
 		int goodParameter = 0;
 		ChmAssert.assertByteArrayNotNull(data);
 		++goodParameter;
@@ -152,10 +151,11 @@
 		++goodParameter;
 		return (goodParameter == 2);
 	}
-
+	
+	
 	private long unmarshalUInt32(byte[] data, long dest) {
 		ChmAssert.assertByteArrayNotNull(data);
-		dest = data[this.getCurrentPlace()]
+		dest =  data[this.getCurrentPlace()]
 				| data[this.getCurrentPlace() + 1] << 8
 				| data[this.getCurrentPlace() + 2] << 16
 				| data[this.getCurrentPlace() + 3] << 24;
@@ -164,25 +164,25 @@
 		this.setCurrentPlace(this.getCurrentPlace() + 4);
 		return dest;
 	}
+	
 
 	private long unmarshalUint64(byte[] data, long dest) {
 		ChmAssert.assertByteArrayNotNull(data);
 		byte[] temp = new byte[8];
-		int i, j;// counters
-
+		int i,j;//counters
+		
 		for (i = 8, j = 7; i > 0; i--) {
-			if (data.length > this.getCurrentPlace()) {
+			if(data.length > this.getCurrentPlace()){
 				temp[j--] = data[this.getCurrentPlace()];
 				this.setCurrentPlace(this.getCurrentPlace() + 1);
-			} else
-				throw new ChmParsingException(
-						"data is too small to calculate address block");
+			}else
+				throw new ChmParsingException("data is too small to calculate address block");
 		}
 		dest = new BigInteger(temp).longValue();
 		this.setDataRemained(this.getDataRemained() - 8);
 		return dest;
 	}
-
+	
 	/**
 	 * Returns the version
 	 * 
@@ -192,16 +192,17 @@
 		return version;
 	}
 
+
 	/**
 	 * Sets the version
 	 * 
-	 * @param version
-	 *            - long
+	 * @param version - long
 	 */
 	public void setVersion(long version) {
 		this.version = version;
 	}
 
+
 	/**
 	 * Gets a block count
 	 * 
@@ -211,16 +212,17 @@
 		return block_count;
 	}
 
+
 	/**
 	 * Sets a block count
 	 * 
-	 * @param block_count
-	 *            - long
+	 * @param block_count - long
 	 */
 	public void setBlockCount(long block_count) {
 		this.block_count = block_count;
 	}
 
+
 	/**
 	 * Gets unknown
 	 * 
@@ -230,16 +232,17 @@
 		return unknown;
 	}
 
+
 	/**
 	 * Sets an unknown
 	 * 
-	 * @param unknown
-	 *            - long
+	 * @param unknown - long
 	 */
 	public void setUnknown(long unknown) {
 		this.unknown = unknown;
 	}
 
+
 	/**
 	 * Gets a table offset
 	 * 
@@ -249,16 +252,17 @@
 		return table_offset;
 	}
 
+
 	/**
 	 * Sets a table offset
 	 * 
-	 * @param table_offset
-	 *            - long
+	 * @param table_offset - long
 	 */
 	public void setTableOffset(long table_offset) {
 		this.table_offset = table_offset;
 	}
 
+
 	/**
 	 * Gets uncompressed length
 	 * 
@@ -268,16 +272,17 @@
 		return uncompressed_len;
 	}
 
+
 	/**
 	 * Sets uncompressed length
 	 * 
-	 * @param uncompressed_len
-	 *            - {@link BigInteger}
+	 * @param uncompressed_len - {@link BigInteger}
 	 */
 	public void setUncompressedLen(long uncompressed_len) {
 		this.uncompressed_len = uncompressed_len;
 	}
 
+
 	/**
 	 * Gets compressed length
 	 * 
@@ -287,16 +292,17 @@
 		return compressed_len;
 	}
 
+
 	/**
-	 * Sets compressed length
+	 * Sets compressed length 
 	 * 
-	 * @param compressed_len
-	 *            - {@link BigInteger}
+	 * @param compressed_len - {@link BigInteger}
 	 */
 	public void setCompressedLen(long compressed_len) {
 		this.compressed_len = compressed_len;
 	}
 
+
 	/**
 	 * Gets a block length
 	 * 
@@ -306,16 +312,18 @@
 		return block_len;
 	}
 
+
 	/**
 	 * Sets a block length
 	 * 
-	 * @param block_len
-	 *            - {@link BigInteger}
+	 * @param block_len - {@link BigInteger}
 	 */
 	public void setBlockLlen(long block_len) {
 		this.block_len = block_len;
 	}
 
+
+
 	/**
 	 * @param args
 	 */
@@ -323,31 +331,24 @@
 
 	}
 
-	// @Override
+
+//	@Override
 	public void parse(byte[] data, ChmLzxcResetTable chmLzxcResetTable) {
 		setDataRemained(data.length);
-		if (validateParamaters(data, chmLzxcResetTable)) {
+		if(validateParamaters(data, chmLzxcResetTable)){
 			/* unmarshal fields */
-			chmLzxcResetTable.setVersion(unmarshalUInt32(data,
-					chmLzxcResetTable.getVersion()));
-			chmLzxcResetTable.setBlockCount(unmarshalUInt32(data,
-					chmLzxcResetTable.getBlockCount()));
-			chmLzxcResetTable.setUnknown(unmarshalUInt32(data,
-					chmLzxcResetTable.getUnknown()));
-			chmLzxcResetTable.setTableOffset(unmarshalUInt32(data,
-					chmLzxcResetTable.getTableOffset()));
-			chmLzxcResetTable.setUncompressedLen(unmarshalUint64(data,
-					chmLzxcResetTable.getUncompressedLen()));
-			chmLzxcResetTable.setCompressedLen(unmarshalUint64(data,
-					chmLzxcResetTable.getCompressedLen()));
-			chmLzxcResetTable.setBlockLlen(unmarshalUint64(data,
-					chmLzxcResetTable.getBlockLen()));
-			chmLzxcResetTable.setBlockAddress(enumerateBlockAddresses(data));
+		    chmLzxcResetTable.setVersion(unmarshalUInt32(data, chmLzxcResetTable.getVersion()));
+		    chmLzxcResetTable.setBlockCount(unmarshalUInt32(data, chmLzxcResetTable.getBlockCount()));
+		    chmLzxcResetTable.setUnknown(unmarshalUInt32(data, chmLzxcResetTable.getUnknown()));
+		    chmLzxcResetTable.setTableOffset(unmarshalUInt32(data, chmLzxcResetTable.getTableOffset()));
+		    chmLzxcResetTable.setUncompressedLen(unmarshalUint64(data, chmLzxcResetTable.getUncompressedLen()));
+		    chmLzxcResetTable.setCompressedLen(unmarshalUint64(data, chmLzxcResetTable.getCompressedLen()));
+		    chmLzxcResetTable.setBlockLlen(unmarshalUint64(data, chmLzxcResetTable.getBlockLen()));
+		    chmLzxcResetTable.setBlockAddress(enumerateBlockAddresses(data));
 		}
-
-		/* checks chmLzxcResetTable */
-		if (chmLzxcResetTable.getVersion() != ChmConstants.CHM_VER_2)
-			throw new ChmParsingException(
-					"does not seem currect version of chmLzxcResetTable");
+	    
+	    /* checks chmLzxcResetTable */
+	    if (chmLzxcResetTable.getVersion() != ChmConstants.CHM_VER_2)
+	        throw new ChmParsingException("does not seem currect version of chmLzxcResetTable");
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmItsfHeader.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmItsfHeader.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmItsfHeader.java	(working copy)
@@ -22,68 +22,71 @@
 import org.apache.tika.parser.chm.exception.ChmParsingException;
 
 /**
- * The Header 0000: char[4] 'ITSF' 0004: DWORD 3 (Version number) 0008: DWORD
- * Total header length, including header section table and following data. 000C:
- * DWORD 1 (unknown) 0010: DWORD a timestamp 0014: DWORD Windows Language ID
- * 0018: GUID {7C01FD10-7BAA-11D0-9E0C-00A0-C922-E6EC} 0028: GUID
- * {7C01FD11-7BAA-11D0-9E0C-00A0-C922-E6EC} Note: a GUID is $10 bytes, arranged
- * as 1 DWORD, 2 WORDs, and 8 BYTEs. 0000: QWORD Offset of section from
- * beginning of file 0008: QWORD Length of section Following the header section
- * table is 8 bytes of additional header data. In Version 2 files, this data is
- * not there and the content section starts immediately after the directory.
+ * The Header
+ * 0000: char[4] 'ITSF'
+ * 0004: DWORD 3 (Version number)
+ * 0008: DWORD Total header length, including header section table and following data.
+ * 000C: DWORD 1 (unknown)
+ * 0010: DWORD a timestamp
+ * 0014: DWORD Windows Language ID
+ * 0018: GUID {7C01FD10-7BAA-11D0-9E0C-00A0-C922-E6EC}
+ * 0028: GUID {7C01FD11-7BAA-11D0-9E0C-00A0-C922-E6EC}
+ * Note: a GUID is $10 bytes, arranged as 1 DWORD, 2 WORDs, and 8 BYTEs.
+ * 0000: QWORD Offset of section from beginning of file
+ * 0008: QWORD Length of section
+ * Following the header section table is 8 bytes of additional header data. 
+ * In Version 2 files, this data is not there and the content section starts immediately after the directory.
  * 
- * {@link http
- * ://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original
- * /?show-translation-form=1}
+ * {@link http://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original/?show-translation-form=1}
  * 
  */
 /* structure of ITSF headers */
-public class ChmItsfHeader implements ChmAccessor<ChmItsfHeader> {
+public class ChmItsfHeader implements ChmAccessor<ChmItsfHeader>{
 	private static final long serialVersionUID = 2215291838533213826L;
-	private byte[] signature = new String("ITSF").getBytes(); /* 0 (ITSF) */
-	private int version; /* 4 */
-	private int header_len; /* 8 */
-	private int unknown_000c; /* c */
-	private long last_modified; /* 10 */
-	private long lang_id; /* 14 */
-	private byte[] dir_uuid = new byte[ChmConstants.BYTE_ARRAY_LENGHT]; /* 18 */
-	private byte[] stream_uuid = new byte[ChmConstants.BYTE_ARRAY_LENGHT]; /* 28 */
-	private long unknown_offset; /* 38 */
-	private long unknown_len; /* 40 */
-	private long dir_offset; /* 48 */
-	private long dir_len; /* 50 */
-	private long data_offset; /* 58 (Not present before V3) */
+	private byte[] signature = new String("ITSF").getBytes(); 									/* 0 (ITSF) */
+    private int version; 																		/* 4 */
+    private int header_len; 																	/* 8 */
+    private int unknown_000c; 																	/* c */
+    private long last_modified; 																/* 10 */
+    private long lang_id; 																		/* 14 */
+    private byte[] dir_uuid = new byte[ChmConstants.BYTE_ARRAY_LENGHT]; 						/* 18 */
+    private byte[] stream_uuid = new byte[ChmConstants.BYTE_ARRAY_LENGHT]; 						/* 28 */
+    private long unknown_offset; 																/* 38 */
+    private long unknown_len; 																	/* 40 */
+    private long dir_offset; 																	/* 48 */
+    private long dir_len; 																		/* 50 */
+    private long data_offset; 																	/* 58 (Not present before V3) */
+    
+    /* local usage */
+    private int dataRemained;
+    private int currentPlace = 0;
+    
+    /**
+     * Prints the values of ChmfHeader 
+     */
+    public String toString(){
+    	StringBuilder sb = new StringBuilder();
+    	sb.append(new String(getSignature()) + " ");
+    	sb.append(getVersion() + " ");
+    	sb.append(getHeaderLen() + " ");
+    	sb.append(getUnknown_000c() + " ");
+    	sb.append(getLastModified() + " ");
+    	sb.append(getLangId() + " ");
+    	sb.append(getDir_uuid() + " ");
+    	sb.append(getStream_uuid() + " ");
+    	sb.append(getUnknownOffset() + " ");
+    	sb.append(getUnknownLen() + " ");
+    	sb.append(getDirOffset() + " ");
+    	sb.append(getDirLen() + " ");
+    	sb.append(getDataOffset() + " ");
+    	return sb.toString();
+    }
 
-	/* local usage */
-	private int dataRemained;
-	private int currentPlace = 0;
-
-	/**
-	 * Prints the values of ChmfHeader
-	 */
-	public String toString() {
-		StringBuilder sb = new StringBuilder();
-		sb.append(new String(getSignature()) + " ");
-		sb.append(getVersion() + " ");
-		sb.append(getHeaderLen() + " ");
-		sb.append(getUnknown_000c() + " ");
-		sb.append(getLastModified() + " ");
-		sb.append(getLangId() + " ");
-		sb.append(getDir_uuid() + " ");
-		sb.append(getStream_uuid() + " ");
-		sb.append(getUnknownOffset() + " ");
-		sb.append(getUnknownLen() + " ");
-		sb.append(getDirOffset() + " ");
-		sb.append(getDirLen() + " ");
-		sb.append(getDataOffset() + " ");
-		return sb.toString();
-	}
-
-	/**
-	 * Returns a signature of itsf header
-	 * 
-	 * @return itsf header
-	 */
+    /**
+     * Returns a signature of itsf header
+     * 
+     * @return itsf header
+     */
 	public byte[] getSignature() {
 		return signature;
 	}
@@ -312,6 +315,7 @@
 	protected void setDataOffset(long data_offset) {
 		this.data_offset = data_offset;
 	}
+	
 
 	/**
 	 * Copies 4 first bytes of the byte[]
@@ -320,14 +324,13 @@
 	 * @param chmItsfHeader
 	 * @param count
 	 */
-	private void unmarshalCharArray(byte[] data, ChmItsfHeader chmItsfHeader,
-			int count) {
+	private void unmarshalCharArray(byte[] data, ChmItsfHeader chmItsfHeader, int count) {
 		ChmAssert.assertChmAccessorParameters(data, chmItsfHeader, count);
 		System.arraycopy(data, 0, chmItsfHeader.signature, 0, count);
 		this.setCurrentPlace(this.getCurrentPlace() + count);
 		this.setDataRemained(this.getDataRemained() - count);
 	}
-
+	
 	/**
 	 * Copies X bytes of source byte[] to the dest byte[]
 	 * 
@@ -342,7 +345,7 @@
 		this.setDataRemained(this.getDataRemained() - count);
 		return dest;
 	}
-
+	
 	/**
 	 * Takes 8 bytes and reverses them
 	 * 
@@ -352,27 +355,28 @@
 	 */
 	private long unmarshalUint64(byte[] data, long dest) {
 		byte[] temp = new byte[8];
-		int i, j;
-
+		int i,j;
+		
 		if (8 > this.getDataRemained())
 			throw new ChmParsingException("8 > this.getDataRemained()");
-
+		
 		for (i = 8, j = 7; i > 0; i--) {
 			temp[j--] = data[this.getCurrentPlace()];
 			this.setCurrentPlace(this.getCurrentPlace() + 1);
 		}
-
+		
 		dest = new BigInteger(temp).longValue();
 		this.setDataRemained(this.getDataRemained() - 8);
 		return dest;
 	}
 
+	
 	private int unmarshalInt32(byte[] data, int dest) {
 		ChmAssert.assertByteArrayNotNull(data);
 
 		if (4 > this.getDataRemained())
 			throw new ChmParsingException("4 > dataLenght");
-		dest = data[this.getCurrentPlace()]
+		dest =  data[this.getCurrentPlace()]
 				| data[this.getCurrentPlace() + 1] << 8
 				| data[this.getCurrentPlace() + 2] << 16
 				| data[this.getCurrentPlace() + 3] << 24;
@@ -381,12 +385,13 @@
 		this.setDataRemained(this.getDataRemained() - 4);
 		return dest;
 	}
-
+	
+	
 	private long unmarshalUInt32(byte[] data, long dest) {
 		ChmAssert.assertByteArrayNotNull(data);
 		if (4 > getDataRemained())
 			throw new ChmParsingException("4 > dataLenght");
-		dest = data[this.getCurrentPlace()]
+		dest =  data[this.getCurrentPlace()]
 				| data[this.getCurrentPlace() + 1] << 8
 				| data[this.getCurrentPlace() + 2] << 16
 				| data[this.getCurrentPlace() + 3] << 24;
@@ -395,8 +400,8 @@
 		this.setCurrentPlace(this.getCurrentPlace() + 4);
 		return dest;
 	}
-
-	public static void main(String[] args) {
+	
+	public static void main(String[] args){
 	}
 
 	/**
@@ -435,63 +440,45 @@
 		return currentPlace;
 	}
 
-	// @Override
+//	@Override
 	public void parse(byte[] data, ChmItsfHeader chmItsfHeader) {
-		if (data.length < ChmConstants.CHM_ITSF_V2_LEN
-				|| data.length > ChmConstants.CHM_ITSF_V3_LEN)
-			throw new ChmParsingException(
-					"we only know how to deal with the 0x58 and 0x60 byte structures");
-
+		if (data.length < ChmConstants.CHM_ITSF_V2_LEN  ||  data.length > ChmConstants.CHM_ITSF_V3_LEN)
+			throw new ChmParsingException("we only know how to deal with the 0x58 and 0x60 byte structures");
+		
 		chmItsfHeader.setDataRemained(data.length);
-		chmItsfHeader.unmarshalCharArray(data, chmItsfHeader,
-				ChmConstants.CHM_SIGNATURE_LEN);
-		chmItsfHeader.setVersion(chmItsfHeader.unmarshalInt32(data,
-				chmItsfHeader.getVersion()));
-		chmItsfHeader.setHeaderLen(chmItsfHeader.unmarshalInt32(data,
-				chmItsfHeader.getHeaderLen()));
-		chmItsfHeader.setUnknown_000c(chmItsfHeader.unmarshalInt32(data,
-				chmItsfHeader.getUnknown_000c()));
-		chmItsfHeader.setLastModified(chmItsfHeader.unmarshalUInt32(data,
-				chmItsfHeader.getLastModified()));
-		chmItsfHeader.setLangId(chmItsfHeader.unmarshalUInt32(data,
-				chmItsfHeader.getLangId()));
-		chmItsfHeader.setDir_uuid(chmItsfHeader.unmarshalUuid(data,
-				chmItsfHeader.getDir_uuid(), 16));
-		chmItsfHeader.setStream_uuid(chmItsfHeader.unmarshalUuid(data,
-				chmItsfHeader.getStream_uuid(), 16));
-		chmItsfHeader.setUnknownOffset(chmItsfHeader.unmarshalUint64(data,
-				chmItsfHeader.getUnknownOffset()));
-		chmItsfHeader.setUnknownLen(chmItsfHeader.unmarshalUint64(data,
-				chmItsfHeader.getUnknownLen()));
-		chmItsfHeader.setDirOffset(chmItsfHeader.unmarshalUint64(data,
-				chmItsfHeader.getDirOffset()));
-		chmItsfHeader.setDirLen(chmItsfHeader.unmarshalUint64(data,
-				chmItsfHeader.getDirLen()));
-
-		if (!new String(chmItsfHeader.getSignature()).equals(ChmConstants.ITSF))
+		chmItsfHeader.unmarshalCharArray(data, chmItsfHeader, ChmConstants.CHM_SIGNATURE_LEN);
+		chmItsfHeader.setVersion(chmItsfHeader.unmarshalInt32(data, chmItsfHeader.getVersion()));
+		chmItsfHeader.setHeaderLen(chmItsfHeader.unmarshalInt32(data, chmItsfHeader.getHeaderLen()));
+		chmItsfHeader.setUnknown_000c(chmItsfHeader.unmarshalInt32(data, chmItsfHeader.getUnknown_000c()));
+		chmItsfHeader.setLastModified(chmItsfHeader.unmarshalUInt32(data, chmItsfHeader.getLastModified()));
+		chmItsfHeader.setLangId(chmItsfHeader.unmarshalUInt32(data, chmItsfHeader.getLangId()));
+		chmItsfHeader.setDir_uuid(chmItsfHeader.unmarshalUuid(data, chmItsfHeader.getDir_uuid(), 16));
+		chmItsfHeader.setStream_uuid(chmItsfHeader.unmarshalUuid(data, chmItsfHeader.getStream_uuid(), 16));
+		chmItsfHeader.setUnknownOffset(chmItsfHeader.unmarshalUint64(data, chmItsfHeader.getUnknownOffset()));
+		chmItsfHeader.setUnknownLen(chmItsfHeader.unmarshalUint64(data, chmItsfHeader.getUnknownLen()));
+		chmItsfHeader.setDirOffset(chmItsfHeader.unmarshalUint64(data, chmItsfHeader.getDirOffset()));
+		chmItsfHeader.setDirLen(chmItsfHeader.unmarshalUint64(data, chmItsfHeader.getDirLen()));
+		
+		if(!new String(chmItsfHeader.getSignature()).equals(ChmConstants.ITSF))
 			throw new ChmParsingException("seems not valid file");
-		if (chmItsfHeader.getVersion() == ChmConstants.CHM_VER_2) {
-			if (chmItsfHeader.getHeaderLen() < ChmConstants.CHM_ITSF_V2_LEN)
+		if(chmItsfHeader.getVersion() == ChmConstants.CHM_VER_2){
+			if(chmItsfHeader.getHeaderLen() < ChmConstants.CHM_ITSF_V2_LEN)
 				throw new ChmParsingException("something wrong with header");
-		} else if (chmItsfHeader.getVersion() == ChmConstants.CHM_VER_3) {
-			if (chmItsfHeader.getHeaderLen() < ChmConstants.CHM_ITSF_V3_LEN)
+		}else if(chmItsfHeader.getVersion() == ChmConstants.CHM_VER_3){
+			if(chmItsfHeader.getHeaderLen() < ChmConstants.CHM_ITSF_V3_LEN )
 				throw new ChmParsingException("unknown v3 header lenght");
-		} else
+		}else
 			throw new ChmParsingException("unsupported chm format");
-
-		/*
-		 * now, if we have a V3 structure, unmarshal the rest, otherwise,
-		 * compute it
-		 */
+		
+		/* 
+		 * now, if we have a V3 structure, unmarshal the rest, otherwise, compute it
+		*/
 		if (chmItsfHeader.getVersion() == ChmConstants.CHM_VER_3) {
 			if (chmItsfHeader.getDataRemained() >= 0)
-				chmItsfHeader.setDataOffset(chmItsfHeader.getDirOffset()
-						+ chmItsfHeader.getDirLen());
+				chmItsfHeader.setDataOffset(chmItsfHeader.getDirOffset() + chmItsfHeader.getDirLen());
 			else
-				throw new ChmParsingException(
-						"cannot set data offset, no data remained");
+				throw new ChmParsingException("cannot set data offset, no data remained");
 		} else
-			chmItsfHeader.setDataOffset(chmItsfHeader.getDirOffset()
-					+ chmItsfHeader.getDirLen());
+			chmItsfHeader.setDataOffset(chmItsfHeader.getDirOffset() + chmItsfHeader.getDirLen());
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmAccessor.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmAccessor.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmAccessor.java	(working copy)
@@ -21,16 +21,15 @@
 /**
  * 
  * Defines an accessor interface
- * 
+ *
  * @param <T>
  */
-public interface ChmAccessor<T> extends Serializable {
+public interface ChmAccessor<T> extends Serializable{
 	/**
 	 * Parses chm accessor
 	 * 
-	 * @param data
-	 *            chm file
-	 * @param chmAccessor
+	 * @param data chm file
+	 * @param chmAccessor 
 	 */
 	void parse(byte[] data, T chmAccessor);
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmPmgiHeader.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmPmgiHeader.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/accessor/ChmPmgiHeader.java	(working copy)
@@ -23,78 +23,77 @@
 import org.apache.tika.parser.chm.core.ChmConstants;
 import org.apache.tika.parser.chm.exception.ChmParsingException;
 
+
 /**
- * Description Note: not always exists An index chunk has the following format:
- * 0000: char[4] 'PMGI' 0004: DWORD Length of quickref/free area at end of
- * directory chunk 0008: Directory index entries (to quickref/free area) The
- * quickref area in an PMGI is the same as in an PMGL The format of a directory
- * index entry is as follows: BYTE: length of name BYTEs: name (UTF-8 encoded)
- * ENCINT: directory listing chunk which starts with name Encoded Integers aka
- * ENCINT An ENCINT is a variable-length integer. The high bit of each byte
- * indicates "continued to the next byte". Bytes are stored most significant to
- * least significant. So, for example, $EA $15 is (((0xEA&0x7F)<<7)|0x15) =
- * 0x3515.
+ * Description
+ * Note: not always exists
+ * An index chunk has the following format:
+ * 0000: char[4] 'PMGI'
+ * 0004: DWORD Length of quickref/free area at end of directory chunk
+ * 0008: Directory index entries (to quickref/free area)
+ * The quickref area in an PMGI is the same as in an PMGL
+ * The format of a directory index entry is as follows:
+ * BYTE: length of name
+ * BYTEs: name (UTF-8 encoded)
+ * ENCINT: directory listing chunk which starts with name
+ * Encoded Integers aka ENCINT
+ * An ENCINT is a variable-length integer. The high bit of each byte indicates "continued to the next byte". 
+ * Bytes are stored most significant to least significant. So, for example, $EA $15 is (((0xEA&0x7F)<<7)|0x15) = 0x3515.
  * 
- * <p>
- * Note: This class is not in use
+ * <p>Note: This class is not in use
  * 
- * {@link http
- * ://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original
- * /?show-translation-form=1 }
+ * {@link http://translated.by/you/microsoft-s-html-help-chm-format-incomplete/original/?show-translation-form=1 }
  * 
- * 
+ *
  */
-public class ChmPmgiHeader implements ChmAccessor<ChmPmgiHeader> {
+public class ChmPmgiHeader implements ChmAccessor<ChmPmgiHeader>{
 	private static final long serialVersionUID = -2092282339894303701L;
-	private byte[] signature = new String(ChmConstants.CHM_PMGI_MARKER)
-			.getBytes(); /* 0 (PMGI) */
-	private long free_space; /* 4 */
-
+	private byte[] signature = new String(ChmConstants.CHM_PMGI_MARKER).getBytes();	/*  0 (PMGI) */
+	private long free_space;															/*  4 */
+	
 	/* local usage */
-	private int dataRemained;
-	private int currentPlace = 0;
-
-	private int getDataRemained() {
+    private int dataRemained;
+    private int currentPlace = 0;
+	
+	
+    private int getDataRemained() {
 		return dataRemained;
 	}
 
-	private void setDataRemained(int dataRemained) {
+    private void setDataRemained(int dataRemained) {
 		this.dataRemained = dataRemained;
 	}
 
-	private int getCurrentPlace() {
+    private int getCurrentPlace() {
 		return currentPlace;
 	}
 
-	private void setCurrentPlace(int currentPlace) {
+    private void setCurrentPlace(int currentPlace) {
 		this.currentPlace = currentPlace;
 	}
 
-	private void unmarshalCharArray(byte[] data, ChmPmgiHeader chmPmgiHeader,
-			int count) {
+    
+    private void unmarshalCharArray(byte[] data, ChmPmgiHeader chmPmgiHeader, int count) {
 		int index = -1;
 		ChmAssert.assertByteArrayNotNull(data);
 		ChmAssert.assertChmAccessorNotNull(chmPmgiHeader);
 		ChmAssert.assertPositiveInt(count);
 		this.setDataRemained(data.length);
-		index = ChmCommons.indexOf(data,
-				ChmConstants.CHM_PMGI_MARKER.getBytes());
-		if (index >= 0)
-			System.arraycopy(data, index, chmPmgiHeader.getSignature(), 0,
-					count);
+		index = ChmCommons.indexOf(data, ChmConstants.CHM_PMGI_MARKER.getBytes());
+		if(index >= 0)
+			System.arraycopy(data, index, chmPmgiHeader.getSignature(), 0, count);
 		else
-			System.err.println(ChmPmgiHeader.class.getName()
-					+ " does not exist a PMGI, use PMGL instead");
+			System.err.println(ChmPmgiHeader.class.getName() + " does not exist a PMGI, use PMGL instead");
 		this.setCurrentPlace(this.getCurrentPlace() + count);
 		this.setDataRemained(this.getDataRemained() - count);
 	}
-
-	private long unmarshalUInt32(byte[] data, long dest) {
-		ChmAssert.assertByteArrayNotNull(data);
-
+	
+   private long unmarshalUInt32(byte[] data, long dest) {
+    	ChmAssert.assertByteArrayNotNull(data);
+    	
 		if (4 > getDataRemained())
 			throw new ChmParsingException("4 > dataLenght");
-		dest = data[this.getCurrentPlace()]
+		dest =  data[this.getCurrentPlace()]
 				| data[this.getCurrentPlace() + 1] << 8
 				| data[this.getCurrentPlace() + 2] << 16
 				| data[this.getCurrentPlace() + 3] << 24;
@@ -103,16 +102,17 @@
 		this.setCurrentPlace(this.getCurrentPlace() + 4);
 		return dest;
 	}
-
-	/**
-	 * Returns pmgi signature if exists
-	 * 
-	 * @return signature
-	 */
+	
+   /**
+    * Returns pmgi signature if exists
+    * 
+    * @return signature
+    */
 	public byte[] getSignature() {
 		return signature;
 	}
 
+
 	/**
 	 * Sets pmgi signature
 	 * 
@@ -122,6 +122,7 @@
 		this.signature = signature;
 	}
 
+
 	/**
 	 * Returns pmgi free space
 	 * 
@@ -131,6 +132,7 @@
 		return free_space;
 	}
 
+
 	/**
 	 * Sets pmgi free space
 	 * 
@@ -139,43 +141,37 @@
 	protected void setFreeSpace(long free_space) {
 		this.free_space = free_space;
 	}
-
+	
 	/**
 	 * Returns textual representation of the pmgi header
 	 */
-	public String toString() {
+	public String toString(){
 		StringBuilder sb = new StringBuilder();
 		sb.append("signature:=" + new String(getSignature()) + ", ");
-		sb.append("free space:=" + getFreeSpace()
-				+ System.getProperty("line.separator"));
+		sb.append("free space:=" + getFreeSpace() + System.getProperty("line.separator"));
 		return sb.toString();
 	}
-
-	// @Override
+	
+//	@Override
 	public void parse(byte[] data, ChmPmgiHeader chmPmgiHeader) {
 		/* we only know how to deal with a 0x8 byte structures */
-		if (data.length < ChmConstants.CHM_PMGI_LEN)
-			throw new ChmParsingException(
-					"we only know how to deal with a 0x8 byte structures");
+		if(data.length < ChmConstants.CHM_PMGI_LEN)
+			throw new ChmParsingException("we only know how to deal with a 0x8 byte structures");
+		
+	    /* unmarshal fields */
+		chmPmgiHeader.unmarshalCharArray(data, chmPmgiHeader, ChmConstants.CHM_SIGNATURE_LEN);
+		chmPmgiHeader.setFreeSpace(chmPmgiHeader.unmarshalUInt32(data, chmPmgiHeader.getFreeSpace()));
 
-		/* unmarshal fields */
-		chmPmgiHeader.unmarshalCharArray(data, chmPmgiHeader,
-				ChmConstants.CHM_SIGNATURE_LEN);
-		chmPmgiHeader.setFreeSpace(chmPmgiHeader.unmarshalUInt32(data,
-				chmPmgiHeader.getFreeSpace()));
-
-		/* check structure */
-		if (!Arrays.equals(chmPmgiHeader.getSignature(),
-				ChmConstants.CHM_PMGI_MARKER.getBytes()))
-			throw new ChmParsingException(
-					"it does not seem to be valid a PMGI signature, check ChmItsp index_root if it was -1, means no PMGI, use PMGL insted");
-
+	    /* check structure */
+	    if (!Arrays.equals(chmPmgiHeader.getSignature(), ChmConstants.CHM_PMGI_MARKER.getBytes()))
+	    	throw new ChmParsingException("it does not seem to be valid a PMGI signature, check ChmItsp index_root if it was -1, means no PMGI, use PMGL insted");
+		
 	}
 
 	/**
 	 * @param args
 	 */
 	public static void main(String[] args) {
-
+		
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/ChmParser.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/ChmParser.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/ChmParser.java	(working copy)
@@ -29,27 +29,29 @@
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
+
 public class ChmParser extends AbstractParser {
 
 	private static final long serialVersionUID = 5938777307516469802L;
-	private static final Set<MediaType> SUPPORTED_TYPES = Collections
-			.singleton(MediaType.application("chm"));
+	private static final Set<MediaType> SUPPORTED_TYPES =
+        Collections.singleton(MediaType.application("chm"));
 
 	public Set<MediaType> getSupportedTypes(ParseContext context) {
 		return SUPPORTED_TYPES;
 	}
-	
-	public void parse(InputStream stream, ContentHandler handler,
-			Metadata metadata, ParseContext context) throws IOException,
-			SAXException, TikaException {
+
+//	public void parse(InputStream stream, ContentHandler handler, Metadata metadata) throws IOException, SAXException, TikaException {
+//		parse(stream,handler,metadata, new ParseContext());
+//	}
+
+	public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException {
 		CHMDocumentInformation chmInfo = CHMDocumentInformation.load(stream);
 		metadata.set(Metadata.CONTENT_TYPE, "chm");
 		extractMetadata(chmInfo, metadata);
-		CHM2XHTML.process(chmInfo, handler);
+		CHM2XHTML.process(chmInfo,handler);
 	}
-
-	private void extractMetadata(CHMDocumentInformation chmInfo,
-			Metadata metadata) throws TikaException, IOException {
+	
+	private void extractMetadata(CHMDocumentInformation chmInfo, Metadata metadata) throws TikaException, IOException{
 		chmInfo.getCHMDocInformation(metadata);
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/CHM2XHTML.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/CHM2XHTML.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/CHM2XHTML.java	(working copy)
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+
 package org.apache.tika.parser.chm;
 
 import org.apache.tika.exception.TikaException;
@@ -22,37 +23,36 @@
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
+
 /**
  * Utility class
  * 
- * 
+ *
  */
 public class CHM2XHTML {
 
-	public static void process(CHMDocumentInformation chmDoc,
-			ContentHandler handler) throws TikaException {
+	public static void process(CHMDocumentInformation chmDoc, ContentHandler handler) throws TikaException {
 		String text = chmDoc.getText();
 		try {
-			if (text.length() > 0) {
+			if(text.length() > 0){
 				handler.characters(text.toCharArray(), 0, text.length());
-				new CHM2XHTML(chmDoc, handler);
-			} else
-				/* The error handling should be added */
+				new CHM2XHTML(chmDoc,handler);
+			}
+			else /* The error handling should be added */
 				System.err.println("Could not extract content");
-
+			
 		} catch (SAXException e) {
-			// System.err.println(ChmParserUtils.getStackTrace(e.getStackTrace()));
+//			System.err.println(ChmParserUtils.getStackTrace(e.getStackTrace()));
 		}
 	}
 
-	protected String getText(CHMDocumentInformation chmDoc)
-			throws TikaException {
+	protected String getText(CHMDocumentInformation chmDoc) throws TikaException{
 		return chmDoc.getText();
 	}
-
+	
 	protected TextContentHandler handler;
-
-	public CHM2XHTML(CHMDocumentInformation chmDoc, ContentHandler handler) {
+	
+	public CHM2XHTML(CHMDocumentInformation chmDoc,ContentHandler handler) {
 		this.handler = new TextContentHandler(handler);
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/assertion/ChmAssert.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/assertion/ChmAssert.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/assertion/ChmAssert.java	(working copy)
@@ -23,64 +23,53 @@
 import org.apache.tika.parser.chm.core.ChmCommons;
 import org.apache.tika.parser.chm.exception.ChmParsingException;
 
+
 /**
  * Contains chm extractor assertions
  */
-public class ChmAssert {
+public class ChmAssert{
 	/**
 	 * Checks a validity of the chmBlockSegment parameters
 	 * 
-	 * @param data
-	 *            byte[]
-	 * @param resetTable
-	 *            ChmLzxcResetTable
-	 * @param blockNumber
-	 *            int
-	 * @param lzxcBlockOffset
-	 *            int
-	 * @param lzxcBlockLength
-	 *            int
+	 * @param data byte[]
+	 * @param resetTable ChmLzxcResetTable
+	 * @param blockNumber int
+	 * @param lzxcBlockOffset int
+	 * @param lzxcBlockLength int
 	 */
-	public static final void assertChmBlockSegment(byte[] data,
-			ChmLzxcResetTable resetTable, int blockNumber, int lzxcBlockOffset,
-			int lzxcBlockLength) {
-		if ((data == null))
+	public static final void assertChmBlockSegment(byte[] data, ChmLzxcResetTable resetTable, int blockNumber, int lzxcBlockOffset, int lzxcBlockLength){
+		if((data == null))
 			throw new ChmParsingException("data[] is null");
-
-		if ((data.length <= 0))
-			throw new ChmParsingException(
-					"data[] length should be greater than zero");
-
-		if (resetTable == null)
+		
+		if( (data.length <= 0))
+			throw new ChmParsingException("data[] length should be greater than zero");
+		
+		if(resetTable == null)
 			throw new ChmParsingException("resetTable is null");
-
-		if (resetTable.getBlockAddress().length <= 1)
-			throw new ChmParsingException(
-					"resetTable.getBlockAddress().length should be greater than zero");
-
-		if (blockNumber < 0)
-			throw new ChmParsingException(
-					"blockNumber should be positive number");
-
-		if (lzxcBlockOffset < 0)
-			throw new ChmParsingException(
-					"lzxcBlockOffset should be positive number");
-
-		if (lzxcBlockLength < 0)
-			throw new ChmParsingException(
-					"lzxcBlockLength should be positive number");
+		
+		if(resetTable.getBlockAddress().length <= 1)
+			throw new ChmParsingException("resetTable.getBlockAddress().length should be greater than zero");
+		
+		if(blockNumber < 0)
+			throw new ChmParsingException("blockNumber should be positive number");
+		
+		if(lzxcBlockOffset < 0)
+			throw new ChmParsingException("lzxcBlockOffset should be positive number");
+		
+		if(lzxcBlockLength < 0)
+			throw new ChmParsingException("lzxcBlockLength should be positive number");
 	}
-
+	
 	/**
 	 * Checks if InputStream is not null
 	 * 
-	 * @param is
-	 *            InputStream
+	 * @param is InputStream
 	 */
-	public static final void assertInputStreamNotNull(InputStream is) {
-		if (is == null)
+	public static final void assertInputStreamNotNull(InputStream is){
+		if(is == null)
 			throw new ChmParsingException("input sream is null");
 	}
+	
 
 	/**
 	 * Checks validity of ChmAccessor parameters
@@ -89,79 +78,71 @@
 	 * @param chmItsfHeader
 	 * @param count
 	 */
-	public static final void assertChmAccessorParameters(byte[] data,
-			ChmAccessor<?> chmAccessor, int count) {
+	public static final void assertChmAccessorParameters(byte[] data, ChmAccessor<?> chmAccessor, int count){
 		assertByteArrayNotNull(data);
 		assertChmAccessorNotNull(chmAccessor);
 	}
-
+	
 	/**
 	 * Checks if byte[] is not null
 	 * 
 	 * @param data
 	 */
-	public static final void assertByteArrayNotNull(byte[] data) {
-		if (data == null)
+	public static final void assertByteArrayNotNull(byte[] data){
+		if(data == null)
 			throw new ChmParsingException("byte[] data is null");
 	}
-
+	
 	/**
-	 * Checks if ChmAccessor is not null In case of null throws exception
+	 * Checks if ChmAccessor is not null
+	 * In case of null throws exception
 	 * 
 	 * @param ChmAccessor
 	 */
-	public static final void assertChmAccessorNotNull(ChmAccessor<?> chmAccessor) {
-		if (chmAccessor == null)
+	public static final void assertChmAccessorNotNull(ChmAccessor<?> chmAccessor){
+		if(chmAccessor == null)
 			throw new ChmParsingException("chm header is null");
 	}
-
+	
 	/**
-	 * Checks validity of the DirectoryListingEntry's parameters In case of
-	 * invalid parameter(s) throws an exception
+	 * Checks validity of the DirectoryListingEntry's parameters
+	 * In case of invalid parameter(s) throws an exception
 	 * 
-	 * @param name_length
-	 *            length of the chm entry name
-	 * @param name
-	 *            chm entry name
-	 * @param entryType
-	 *            EntryType
+	 * @param name_length length of the chm entry name
+	 * @param name chm entry name
+	 * @param entryType EntryType
 	 * @param offset
 	 * @param length
 	 */
-	public static final void assertDirectoryListingEntry(int name_length,
-			String name, ChmCommons.EntryType entryType, int offset, int length) {
-		if (name_length < 0)
-			throw new ChmParsingException("invalid name length");
-		if (name == null)
+	public static final void assertDirectoryListingEntry(int name_length, String name, ChmCommons.EntryType entryType, int offset, int length){
+		if(name_length < 0)
+			throw new ChmParsingException("invalid name length");	
+		if(name == null)
 			throw new ChmParsingException("invalid name");
-
-		if ((entryType != ChmCommons.EntryType.COMPRESSED)
-				&& (entryType != ChmCommons.EntryType.UNCOMPRESSED))
-			throw new ChmParsingException(
-					"invalid compressed type, should be EntryType.COMPRESSED | EntryType.UNCOMPRESSED");
-
-		if (offset < 0)
+	
+		if((entryType != ChmCommons.EntryType.COMPRESSED) && (entryType != ChmCommons.EntryType.UNCOMPRESSED))	
+			throw new ChmParsingException("invalid compressed type, should be EntryType.COMPRESSED | EntryType.UNCOMPRESSED");
+	
+		if(offset < 0)
 			throw new ChmParsingException("invalid offset");
-
-		if (length < 0)
-			throw new ChmParsingException("invalid length");
+	
+		if(length < 0)
+			throw new ChmParsingException("invalid length");		
 	}
-
-	public static void assertCopyingDataIndex(int index, int dataLength) {
-		if (index >= dataLength)
-			throw new ChmParsingException(
-					"cannot parse chm file index > data.length");
+	
+	public static void assertCopyingDataIndex(int index, int dataLength){
+		if(index >= dataLength)
+			throw new ChmParsingException("cannot parse chm file index > data.length");
 	}
-
+	
 	/**
-	 * Checks if int param is greater than zero In case param <=0 throws an
-	 * exception
+	 * Checks if int param is greater than zero
+	 * In case param <=0 throws an exception
 	 * 
 	 * @param param
 	 */
-	public static void assertPositiveInt(int param) {
-		if (param <= 0)
-			throw new ChmParsingException(
-					"resetTable.getBlockAddress().length should be greater than zero");
+	public static void assertPositiveInt(int param){
+		if(param <= 0)
+			throw new ChmParsingException("resetTable.getBlockAddress().length should be greater than zero");
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmCommons.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmCommons.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmCommons.java	(working copy)
@@ -21,7 +21,6 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -32,49 +31,42 @@
 
 public class ChmCommons {
 	/* Prevents initialization */
-	private ChmCommons() {
-	}
-
-	public static void assertByteArrayNotNull(byte[] data) {
-		if (data == null)
+	private ChmCommons(){}
+	
+	public static void assertByteArrayNotNull(byte[] data){
+		if(data == null)
 			throw new ChmParsingException("byte[] is null");
 	}
-
+	
+	
 	/**
 	 * Represents entry types: uncompressed, compressed
 	 */
-	public enum EntryType {
-		UNCOMPRESSED, COMPRESSED
-	}
-
+	public enum EntryType { UNCOMPRESSED, COMPRESSED }
+	
 	/**
 	 * Represents lzx states: started decoding, not started decoding
 	 */
-	public enum LzxState {
-		STARTED_DECODING, NOT_STARTED_DECODING
-	}
-
+	public enum LzxState { STARTED_DECODING, NOT_STARTED_DECODING }
+	
 	/**
 	 * Represents intel file states during decompression
 	 */
-	public enum IntelState {
-		STARTED, NOT_STARTED
-	}
-
+	public enum IntelState { STARTED, NOT_STARTED }
+	
 	/**
 	 * Represents lzx block types in order to decompress differently
 	 */
-	public final static int UNDEFINED = 0;
-	public final static int VERBATIM = 1;
-	public final static int ALIGNED_OFFSET = 2;
-	public final static int UNCOMPRESSED = 3;
-
+	public final static int UNDEFINED = 		0;
+	public final static int VERBATIM = 			1;
+	public final static int ALIGNED_OFFSET = 	2;
+	public final static int UNCOMPRESSED = 		3;
+	
 	/**
-	 * LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) Returns X,
-	 * i.e 2^X
+	 * LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb)
+	 * Returns X, i.e 2^X
 	 * 
-	 * @param window
-	 *            chmLzxControlData.getWindowSize()
+	 * @param window chmLzxControlData.getWindowSize()
 	 * 
 	 * @return window size
 	 */
@@ -86,34 +78,25 @@
 		}
 		return win;
 	}
-
-	public static byte[] getChmBlockSegment(byte[] data,
-			ChmLzxcResetTable resetTable, int blockNumber, int lzxcBlockOffset,
-			int lzxcBlockLength) {
-		ChmAssert.assertChmBlockSegment(data, resetTable, blockNumber,
-				lzxcBlockOffset, lzxcBlockLength);
+	
+	public static byte[] getChmBlockSegment(byte[] data, ChmLzxcResetTable resetTable, int blockNumber, int lzxcBlockOffset, int lzxcBlockLength){
+		ChmAssert.assertChmBlockSegment(data, resetTable, blockNumber, lzxcBlockOffset, lzxcBlockLength);
 		int blockLength = -1;
-		// TODO add int_max_value checking
-		if (blockNumber < (resetTable.getBlockAddress().length - 1)) {
-			blockLength = (int) (resetTable.getBlockAddress()[blockNumber + 1] - resetTable
-					.getBlockAddress()[blockNumber]);
-		} else {
+		//TODO add int_max_value checking
+		if(blockNumber < (resetTable.getBlockAddress().length - 1) ){
+			blockLength = (int) (resetTable.getBlockAddress()[blockNumber + 1] - resetTable.getBlockAddress()[blockNumber]);
+		}else {
 			/* new code */
-			if (blockNumber >= resetTable.getBlockAddress().length)
+			if(blockNumber >= resetTable.getBlockAddress().length)
 				blockLength = 0;
 			else
 				/* end new code */
-				blockLength = (int) (lzxcBlockLength - resetTable
-						.getBlockAddress()[blockNumber]);
+				blockLength = (int) (lzxcBlockLength - resetTable.getBlockAddress()[blockNumber]);
 		}
-		byte[] t = Arrays
-				.copyOfRange(
-						data,
-						(int) (lzxcBlockOffset + resetTable.getBlockAddress()[blockNumber]),
-						(int) (lzxcBlockOffset
-								+ resetTable.getBlockAddress()[blockNumber] + blockLength));
+		byte[] t = ChmCommons.copyOfRange(data, (int)(lzxcBlockOffset + resetTable.getBlockAddress()[blockNumber]), (int)(lzxcBlockOffset + resetTable.getBlockAddress()[blockNumber] + blockLength));
 		return (t != null) ? t : new byte[1];
 	}
+	
 
 	/**
 	 * Returns textual representation of LangID
@@ -122,9 +105,9 @@
 	 * 
 	 * @return language name
 	 */
-	public static String getLanguage(long langID) {
-		/* Potential problem with casting */
-		switch ((int) langID) {
+	public static String getLanguage(long langID){
+		/*Potential problem with casting*/
+		switch ((int)langID) {
 		case 1025:
 			return "Arabic";
 		case 1069:
@@ -185,7 +168,7 @@
 			return "unknown - http://msdn.microsoft.com/en-us/library/bb165625%28VS.80%29.aspx";
 		}
 	}
-
+	
 	/**
 	 * Checks skippable patterns
 	 * 
@@ -198,17 +181,16 @@
 				|| directoryListingEntry.getName().startsWith("/#") || directoryListingEntry
 				.getName().startsWith("::")) ? true : false;
 	}
-
+	
 	/**
 	 * Writes byte[][] to the file
 	 * 
 	 * @param buffer
-	 * @param fileToBeSaved
-	 *            file name
+	 * @param fileToBeSaved file name
 	 */
 	public static void writeFile(byte[][] buffer, String fileToBeSaved) {
 		FileOutputStream output = null;
-		if (buffer != null && fileToBeSaved != null && !fileToBeSaved.isEmpty()) {
+		if (buffer != null && fileToBeSaved != null && !ChmCommons.isEmpty(fileToBeSaved)) {
 			try {
 				output = new FileOutputStream(fileToBeSaved);
 				if (output != null)
@@ -216,8 +198,7 @@
 						output.write(buffer[i]);
 					}
 			} catch (FileNotFoundException e) {
-				System.err.println("The " + fileToBeSaved
-						+ " does not seem correct");
+				System.err.println("The " + fileToBeSaved + " does not seem correct");
 			} catch (IOException e) {
 				e.printStackTrace();
 			} finally {
@@ -231,33 +212,34 @@
 			}
 		}
 	}
-
+	
 	/**
 	 * Reverses the order of given array
 	 * 
 	 * @param array
 	 */
-	public static void reverse(byte[] array) {
-		if (array == null) {
-			return;
-		}
-		int i = 0;
-		int j = array.length - 1;
-		byte tmp;
-		while (j > i) {
-			tmp = array[j];
-			array[j] = array[i];
-			array[i] = tmp;
-			j--;
-			i++;
-		}
-	}
-
+    public static void reverse(byte[] array) {
+        if (array == null) {
+            return;
+        }
+        int i = 0;
+        int j = array.length - 1;
+        byte tmp;
+        while (j > i) {
+            tmp = array[j];
+            array[j] = array[i];
+            array[i] = tmp;
+            j--;
+            i++;
+        }
+    }
+	
+	
 	/**
-	 * Returns byte array Closes the InputStream
+	 * Returns byte array
+	 * Closes the InputStream
 	 * 
-	 * @param is
-	 *            InputStream of chm file
+	 * @param is InputStream of chm file
 	 * 
 	 * @return byte array
 	 * 
@@ -282,7 +264,7 @@
 		} else
 			throw new ChmParsingException("InputStream is null");
 	}
-
+	
 	/**
 	 * Returns an index of the reset table
 	 * 
@@ -290,31 +272,28 @@
 	 * @param pattern
 	 * @return index of the reset table
 	 */
-	public static final int indexOfResetTableBlock(byte[] text, byte[] pattern) {
+	public static final int indexOfResetTableBlock(byte[] text, byte[] pattern){
 		return (indexOf(text, pattern)) - 4;
 	}
-
+	
 	/**
 	 * Searches some pattern in byte[]
 	 * 
-	 * @param text
-	 *            byte[]
-	 * @param pattern
-	 *            byte[]
+	 * @param text byte[] 
+	 * @param pattern byte[]
 	 * @return an index, if nothing found returns -1
 	 */
 	public static int indexOf(byte[] text, byte[] pattern) {
 		int[] next = null;
 		int i = 0, j = -1;
-
+		
 		/* Preprocessing */
-		if (pattern != null && text != null) {
+		if(pattern != null && text != null){
 			next = new int[pattern.length];
 			next[0] = -1;
-		} else
-			throw new ChmParsingException(
-					"pattern and/or text should not be null");
-
+		}else
+			throw new ChmParsingException("pattern and/or text should not be null");
+		
 		/* Computes a failure function */
 		while (i < pattern.length - 1) {
 			if (j == -1 || pattern[i] == pattern[j]) {
@@ -328,9 +307,9 @@
 				j = next[j];
 		}
 
-		/* Reinitializes local variables */
+		/* Reinitializes local variables */ 
 		i = j = 0;
-
+		
 		/* Matching */
 		while (i < text.length && j < pattern.length) {
 			if (j == -1 || pattern[j] == text[i]) {
@@ -344,7 +323,7 @@
 		else
 			return -1; // not found
 	}
-
+	
 	/**
 	 * Searches for some pattern in the directory listing entry list
 	 * 
@@ -352,19 +331,49 @@
 	 * @param pattern
 	 * @return an index, if nothing found returns -1
 	 */
-	public static int indexOf(List<DirectoryListingEntry> list, String pattern) {
+	public static int indexOf(List<DirectoryListingEntry> list, String pattern){
 		int place = 0;
-		for (Iterator<DirectoryListingEntry> iterator = list.iterator(); iterator
-				.hasNext();) {
+		for (Iterator<DirectoryListingEntry> iterator = list.iterator(); iterator.hasNext();) {
 			DirectoryListingEntry directoryListingEntry = iterator.next();
-			if (directoryListingEntry.toString().contains(pattern)) {
+			if(directoryListingEntry.toString().contains(pattern)){
 				return place;
-			} else
+			}else
 				++place;
 		}
-		return -1;// not found
+		return -1;//not found
 	}
+	
+	/*
+	 * This method is added because of supporting of Java 5
+	 */
+	public static byte[] copyOfRange(byte[] original, int from, int to) {
+		checkCopyOfRangeParams(original, from, to);
+		int newLength = to - from;
+		if (newLength < 0)
+			throw new IllegalArgumentException(from + " > " + to);
+		byte[] copy = new byte[newLength];
+		System.arraycopy(original, from, copy, 0,
+				Math.min(original.length - from, newLength));
+		return copy;
+	}
+	
+	private static void checkCopyOfRangeParams(byte[] original, int from, int to){
+		if(original == null)
+			throw new NullPointerException("array is null");
+		if(from < 0)
+			throw new IllegalArgumentException(from + " should be > 0");
+		if(to < 0)
+			throw new IllegalArgumentException(to + " should be > 0");
+	}
 
+	/*
+	 * This method is added because of supporting of Java 5
+	 */
+	public static boolean isEmpty(String str) {
+		return str == null || str.length() == 0;
+	}
+	
+	
 	/**
 	 * @param args
 	 */
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmExtractor.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmExtractor.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmExtractor.java	(working copy)
@@ -19,7 +19,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -36,7 +35,8 @@
 import org.apache.tika.parser.chm.lzx.ChmLzxBlock;
 
 /**
- * Extracts text from chm file. Enumerates chm entries.
+ * Extracts text from chm file.
+ * Enumerates chm entries.
  */
 public class ChmExtractor {
 	private List<ChmLzxBlock> lzxBlocksCache = null;
@@ -49,7 +49,8 @@
 	private int indexOfContent;
 	private long lzxBlockOffset;
 	private long lzxBlockLength;
-
+	
+	
 	/**
 	 * Returns lzxc control data.
 	 * 
@@ -67,6 +68,8 @@
 	private void setChmLzxcControlData(ChmLzxcControlData chmLzxcControlData) {
 		this.chmLzxcControlData = chmLzxcControlData;
 	}
+	
+	
 
 	private ChmItspHeader getChmItspHeader() {
 		return chmItspHeader;
@@ -144,96 +147,83 @@
 		this.data = data;
 	}
 
-	public ChmExtractor(InputStream is) {
+	public ChmExtractor(InputStream is){
 		ChmAssert.assertInputStreamNotNull(is);
 		try {
 			setData(ChmCommons.toByteArray(is));
-
+			
 			/* Creates and parses chm itsf header */
 			setChmItsfHeader(new ChmItsfHeader());
-			getChmItsfHeader().parse(
-					Arrays.copyOfRange(getData(), 0,
-							ChmConstants.CHM_ITSF_V3_LEN - 1),
-					getChmItsfHeader());
-
+//			getChmItsfHeader().parse(Arrays.copyOfRange(getData(), 0, ChmConstants.CHM_ITSF_V3_LEN - 1), getChmItsfHeader());
+			getChmItsfHeader().parse(ChmCommons.copyOfRange(getData(), 0, ChmConstants.CHM_ITSF_V3_LEN - 1), getChmItsfHeader());
+			
 			/* Creates and parses chm itsp header */
 			setChmItspHeader(new ChmItspHeader());
-			getChmItspHeader().parse(
-					Arrays.copyOfRange(getData(), (int) getChmItsfHeader()
-							.getDirOffset(), (int) getChmItsfHeader()
-							.getDirOffset() + ChmConstants.CHM_ITSP_V1_LEN),
-					getChmItspHeader());
-
+//			getChmItspHeader().parse(Arrays.copyOfRange( getData(), (int) getChmItsfHeader().getDirOffset(),
+//					                                (int) getChmItsfHeader().getDirOffset() + ChmConstants.CHM_ITSP_V1_LEN), getChmItspHeader());
+			getChmItspHeader().parse(ChmCommons.copyOfRange( getData(), (int) getChmItsfHeader().getDirOffset(),
+                    (int) getChmItsfHeader().getDirOffset() + ChmConstants.CHM_ITSP_V1_LEN), getChmItspHeader());
+			
 			/* Creates instance of ChmDirListingContainer */
-			setChmDirList(new ChmDirectoryListingSet(getData(),
-					getChmItsfHeader(), getChmItspHeader()));
-
+			setChmDirList(new ChmDirectoryListingSet(getData(), getChmItsfHeader(), getChmItspHeader()));
+			
 			int indexOfControlData = getChmDirList().getControlDataIndex();
-			int indexOfResetData = ChmCommons.indexOfResetTableBlock(getData(),
-					ChmConstants.LZXC.getBytes());
+			int indexOfResetData = ChmCommons.indexOfResetTableBlock(getData(), ChmConstants.LZXC.getBytes());
 			byte[] dir_chunk = null;
-			if (indexOfResetData > 0)
-				dir_chunk = Arrays.copyOfRange(
-						getData(),
-						indexOfResetData,
-						indexOfResetData
-								+ getChmDirList()
-										.getDirectoryListingEntryList()
-										.get(indexOfControlData).getLength());
-
+			if(indexOfResetData > 0)
+				dir_chunk = ChmCommons.copyOfRange(getData(), indexOfResetData, indexOfResetData
+						+ getChmDirList().getDirectoryListingEntryList().get(indexOfControlData).getLength());
+//				dir_chunk = Arrays.copyOfRange(getData(), indexOfResetData, indexOfResetData
+//								+ getChmDirList().getDirectoryListingEntryList().get(indexOfControlData).getLength());
+			
+			
 			/* Creates and parses chm control data */
 			setChmLzxcControlData(new ChmLzxcControlData());
 			getChmLzxcControlData().parse(dir_chunk, getChmLzxcControlData());
-
-			int indexOfResetTable = getChmDirList().getResetTableIndex();
+			
+			int indexOfResetTable =  getChmDirList().getResetTableIndex();
 			setChmLzxcResetTable(new ChmLzxcResetTable());
-
+			
 			int startIndex = (int) getChmDirList().getDataOffset()
-					+ getChmDirList().getDirectoryListingEntryList()
-							.get(indexOfResetTable).getOffset();
-
-			// assert startIndex < data.length
+					         + getChmDirList().getDirectoryListingEntryList().get(indexOfResetTable).getOffset();
+			
+			//assert startIndex < data.length
 			ChmAssert.assertCopyingDataIndex(startIndex, getData().length);
-
-			dir_chunk = Arrays.copyOfRange(getData(), startIndex,
-					startIndex
-							+ getChmDirList().getDirectoryListingEntryList()
-									.get(indexOfResetTable).getLength());
-
+			
+//			dir_chunk = Arrays.copyOfRange(getData(), startIndex, startIndex
+//							               + getChmDirList().getDirectoryListingEntryList().get(indexOfResetTable).getLength());
+			dir_chunk = ChmCommons.copyOfRange(getData(), startIndex, startIndex
+		               + getChmDirList().getDirectoryListingEntryList().get(indexOfResetTable).getLength());
+			
 			getChmLzxcResetTable().parse(dir_chunk, getChmLzxcResetTable());
-
-			setIndexOfContent(ChmCommons.indexOf(getChmDirList()
-					.getDirectoryListingEntryList(), ChmConstants.CONTENT));
-			setLzxBlockOffset((getChmDirList().getDirectoryListingEntryList()
-					.get(getIndexOfContent()).getOffset() + getChmItsfHeader()
-					.getDataOffset()));
-			setLzxBlockLength(getChmDirList().getDirectoryListingEntryList()
-					.get(getIndexOfContent()).getLength());
-
+			
+			setIndexOfContent(ChmCommons.indexOf(getChmDirList().getDirectoryListingEntryList(), ChmConstants.CONTENT));
+			setLzxBlockOffset((getChmDirList().getDirectoryListingEntryList().get(getIndexOfContent()).getOffset() + getChmItsfHeader().getDataOffset()));
+			setLzxBlockLength(getChmDirList().getDirectoryListingEntryList().get(getIndexOfContent()).getLength());
+			
 			setLzxBlocksCache(new ArrayList<ChmLzxBlock>());
-
+			
 		} catch (IOException e) {
 			System.err.println(e.getMessage());
 		}
 	}
 
 	/**
-	 * Enumerates chm entities
+	 * Enumerates chm entities 
 	 * 
 	 * @return list of chm entities
 	 */
-	public List<String> enumerateChm() {
+	public List<String> enumerateChm(){
 		List<String> listOfEntries = new ArrayList<String>();
-		for (Iterator<DirectoryListingEntry> it = getChmDirList()
-				.getDirectoryListingEntryList().iterator(); it.hasNext();) {
+		for (Iterator<DirectoryListingEntry> it = getChmDirList().getDirectoryListingEntryList().iterator(); it.hasNext();) {
 			listOfEntries.add(it.next().getName());
 		}
 		return listOfEntries;
 	}
-
+	
 	/**
 	 * Decompresses a chm entry
-	 * 
+	 *  
 	 * @param directoryListingEntry
 	 * 
 	 * @return decompressed data
@@ -246,30 +236,33 @@
 			/* UNCOMPRESSED type is easiest one */
 			if (directoryListingEntry.getEntryType() == EntryType.UNCOMPRESSED
 					&& directoryListingEntry.getLength() > 0
-					&& !ChmCommons.hasSkip(directoryListingEntry)) {
-				int dataOffset = (int) (getChmItsfHeader().getDataOffset() + directoryListingEntry
-						.getOffset());
-				dataSegment = Arrays.copyOfRange(getData(), dataOffset,
-						dataOffset + directoryListingEntry.getLength());
+					&& !ChmCommons.hasSkip(directoryListingEntry)) 
+			{
+				int dataOffset = (int) (getChmItsfHeader().getDataOffset() + directoryListingEntry.getOffset());
+//				dataSegment = Arrays.copyOfRange(getData(), dataOffset, dataOffset + directoryListingEntry.getLength());
+				dataSegment = ChmCommons.copyOfRange(getData(), dataOffset, dataOffset + directoryListingEntry.getLength());
 			} else if (directoryListingEntry.getEntryType() == EntryType.COMPRESSED
-					&& !ChmCommons.hasSkip(directoryListingEntry)) {
+					&& !ChmCommons.hasSkip(directoryListingEntry)) 
+			{
 				/* Gets a chm block info */
-				ChmBlockInfo bb = ChmBlockInfo.getChmBlockInfoInstance(
-						directoryListingEntry, (int) getChmLzxcResetTable()
-								.getBlockLen(), getChmLzxcControlData());
+				ChmBlockInfo bb = ChmBlockInfo.getChmBlockInfoInstance(directoryListingEntry, 
+						                                               (int) getChmLzxcResetTable().getBlockLen(), 
+						                                               getChmLzxcControlData());
 				tmp = new byte[bb.getEndBlock() - bb.getStartBlock() + 1][];
-
+				
 				int i = 0, start = 0, block = 0;
-
-				if ((getLzxBlockLength() < Integer.MAX_VALUE)
-						&& (getLzxBlockOffset() < Integer.MAX_VALUE)) {
-					// TODO: Improve the caching
+				
+				if ((getLzxBlockLength() < Integer.MAX_VALUE) && (getLzxBlockOffset() < Integer.MAX_VALUE)) 
+				{
+					//TODO: Improve the caching 
 					// caching ... = O(n^2) - depends on startBlock and endBlock
-					if (getLzxBlocksCache().size() != 0) {
-						for (i = 0; i < getLzxBlocksCache().size(); i++) {
+					if (getLzxBlocksCache().size() != 0) 
+					{
+						for (i = 0; i < getLzxBlocksCache().size(); i++) 
+						{
 							lzxBlock = getLzxBlocksCache().get(i);
-							for (int j = bb.getIniBlock(); j <= bb
-									.getStartBlock(); j++) {
+							for (int j = bb.getIniBlock(); j <= bb.getStartBlock(); j++) 
+							{
 								if (lzxBlock.getBlockNumber() == j)
 									if (j > start) {
 										start = j;
@@ -281,83 +274,82 @@
 						}
 					}
 
-					if (i == getLzxBlocksCache().size() && i == 0) {
+					if (i == getLzxBlocksCache().size() && i == 0) 
+					{
 						start = bb.getIniBlock();
-
-						dataSegment = ChmCommons.getChmBlockSegment(getData(),
-								getChmLzxcResetTable(), start,
-								(int) getLzxBlockOffset(),
-								(int) getLzxBlockLength());
-
-						lzxBlock = new ChmLzxBlock(start, dataSegment,
-								getChmLzxcResetTable().getBlockLen(), null);
-
+						
+						dataSegment = ChmCommons.getChmBlockSegment(getData(), getChmLzxcResetTable(), start,
+								                                   (int) getLzxBlockOffset(), (int) getLzxBlockLength());
+						
+						lzxBlock = new ChmLzxBlock(start, dataSegment, getChmLzxcResetTable().getBlockLen(), null);
+						
 						getLzxBlocksCache().add(lzxBlock);
-					} else {
+					} else
+					{
 						lzxBlock = getLzxBlocksCache().get(block);
 					}
 
 					for (i = start; i <= bb.getEndBlock();) {
-						if (i == bb.getStartBlock() && i == bb.getEndBlock()) {
-							dataSegment = lzxBlock.getContent(
-									bb.getStartOffset(), bb.getEndOffset());
+						if (i == bb.getStartBlock() && i == bb.getEndBlock()) 
+						{
+							dataSegment = lzxBlock.getContent( bb.getStartOffset(), bb.getEndOffset());
 							tmp[0] = dataSegment;
 							break;
 						}
 
-						if (i == bb.getStartBlock()) {
-							dataSegment = lzxBlock.getContent(bb
-									.getStartOffset());
+						if (i == bb.getStartBlock()) 
+						{
+							dataSegment = lzxBlock.getContent(bb.getStartOffset());
 							tmp[0] = dataSegment;
 						}
 
-						if (i > bb.getStartBlock() && i < bb.getEndBlock()) {
+						if (i > bb.getStartBlock() && i < bb.getEndBlock()) 
+						{
 							dataSegment = lzxBlock.getContent();
 							tmp[i - bb.getStartBlock()] = dataSegment;
 						}
 
-						if (i == bb.getEndBlock()) {
-							dataSegment = lzxBlock.getContent(0,
-									bb.getEndOffset());
+						if (i == bb.getEndBlock()) 
+						{
+							dataSegment = lzxBlock.getContent(0, bb.getEndOffset());
 							tmp[i - bb.getStartBlock()] = dataSegment;
 							break;
 						}
 
 						i++;
-
-						if (i % getChmLzxcControlData().getResetInterval() == 0) {
-							lzxBlock = new ChmLzxBlock(i,
-									ChmCommons.getChmBlockSegment(getData(),
-											getChmLzxcResetTable(), i,
-											(int) getLzxBlockOffset(),
-											(int) getLzxBlockLength()),
-									getChmLzxcResetTable().getBlockLen(), null);
-						} else {
-							lzxBlock = new ChmLzxBlock(i,
-									ChmCommons.getChmBlockSegment(getData(),
-											getChmLzxcResetTable(), i,
-											(int) getLzxBlockOffset(),
-											(int) getLzxBlockLength()),
-									getChmLzxcResetTable().getBlockLen(),
-									lzxBlock);
+						
+						if (i % getChmLzxcControlData().getResetInterval() == 0) 
+						{
+							lzxBlock = new ChmLzxBlock(i, ChmCommons.getChmBlockSegment(getData(),
+											                                            getChmLzxcResetTable(), i,
+											                                            (int) getLzxBlockOffset(),
+											                                            (int) getLzxBlockLength()),
+									                                                    getChmLzxcResetTable().getBlockLen(), null);
 						}
+						else {
+							lzxBlock = new ChmLzxBlock(i, ChmCommons.getChmBlockSegment(getData(),
+											                                            getChmLzxcResetTable(), i,
+											                                            (int) getLzxBlockOffset(),
+											                                            (int) getLzxBlockLength()),
+									                                                    getChmLzxcResetTable().getBlockLen(), lzxBlock);
+						}
 
 						getLzxBlocksCache().add(lzxBlock);
 					}
 
-					if (getLzxBlocksCache().size() > getChmLzxcResetTable()
-							.getBlockCount()) {
+					if (getLzxBlocksCache().size() > getChmLzxcResetTable().getBlockCount()) 
+					{
 						getLzxBlocksCache().clear();
 					}
 				}
 			}
 		} catch (ChmParsingException e) {
-			// e.printStackTrace();
-			// System.err.println("Unknown exception");
+//				e.printStackTrace();
+//				System.err.println("Unknown exception");
 		}
 		return (tmp != null) ? tmp : (new byte[1][]);
 	}
-
+	
 	private void setLzxBlocksCache(List<ChmLzxBlock> lzxBlocksCache) {
 		this.lzxBlocksCache = lzxBlocksCache;
 	}
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmConstants.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmConstants.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmConstants.java	(working copy)
@@ -18,79 +18,66 @@
 
 public class ChmConstants {
 	/* Prevents instantiation */
-	private ChmConstants() {
-	}
+	private ChmConstants() { } 
+	
+	public static final String DEFAULT_CHARSET = 			"UTF-8";
+	public static final String ITSF = 						"ITSF";
+	public static final String ITSP = 						"ITSP";
+	public static final String PMGL = 						"PMGL";
+	public static final String LZXC = 						"LZXC";
+	public static final String CHM_PMGI_MARKER = 			"PMGI";
+	public static final int BYTE_ARRAY_LENGHT = 			16;
+	public static final int CHM_ITSF_V2_LEN = 				0x58;
+	public static final int CHM_ITSF_V3_LEN = 				0x60;
+	public static final int CHM_ITSP_V1_LEN = 				0x54;
+	public static final int CHM_PMGL_LEN = 					0x14;
+	public static final int CHM_PMGI_LEN = 					0x08;
+	public static final int CHM_LZXC_RESETTABLE_V1_LEN = 	0x28;
+	public static final int CHM_LZXC_MIN_LEN = 				0x18;
+	public static final int CHM_LZXC_V2_LEN = 				0x1c;
+	public static final int CHM_SIGNATURE_LEN =				4;
+	public static final int CHM_VER_2 = 					2;
+	public static final int CHM_VER_3 = 					3;
+	public static final int CHM_VER_1 = 					1;
+	public static final int CHM_WINDOW_SIZE_BLOCK = 		0x8000;
 
-	public static final String DEFAULT_CHARSET = "UTF-8";
-	public static final String ITSF = "ITSF";
-	public static final String ITSP = "ITSP";
-	public static final String PMGL = "PMGL";
-	public static final String LZXC = "LZXC";
-	public static final String CHM_PMGI_MARKER = "PMGI";
-	public static final int BYTE_ARRAY_LENGHT = 16;
-	public static final int CHM_ITSF_V2_LEN = 0x58;
-	public static final int CHM_ITSF_V3_LEN = 0x60;
-	public static final int CHM_ITSP_V1_LEN = 0x54;
-	public static final int CHM_PMGL_LEN = 0x14;
-	public static final int CHM_PMGI_LEN = 0x08;
-	public static final int CHM_LZXC_RESETTABLE_V1_LEN = 0x28;
-	public static final int CHM_LZXC_MIN_LEN = 0x18;
-	public static final int CHM_LZXC_V2_LEN = 0x1c;
-	public static final int CHM_SIGNATURE_LEN = 4;
-	public static final int CHM_VER_2 = 2;
-	public static final int CHM_VER_3 = 3;
-	public static final int CHM_VER_1 = 1;
-	public static final int CHM_WINDOW_SIZE_BLOCK = 0x8000;
-
 	/* my hacking */
-	public static final int START_PMGL = 0xCC;
-	public static final String CONTROL_DATA = "ControlData";
-	public static final String RESET_TABLE = "ResetTable";
-	public static final String CONTENT = "Content";
-
+	public static final int START_PMGL = 					0xCC;
+	public static final String CONTROL_DATA = 				"ControlData";
+	public static final String RESET_TABLE = 				"ResetTable";
+	public static final String CONTENT = 					"Content";
+	
 	/* some constants defined by the LZX specification */
-	public static final int LZX_MIN_MATCH = 2;
-	public static final int LZX_MAX_MATCH = 257;
-	public static final int LZX_NUM_CHARS = 256;
-	public static final int LZX_BLOCKTYPE_INVALID = 0; /*
-														 * also blocktypes 4-7
-														 * invalid
-														 */
-	public static final int LZX_BLOCKTYPE_VERBATIM = 1;
-	public static final int LZX_BLOCKTYPE_ALIGNED = 2;
-	public static final int LZX_BLOCKTYPE_UNCOMPRESSED = 3;
-	public static final int LZX_PRETREE_NUM_ELEMENTS_BITS = 4; /* ??? */
-	public static final int LZX_PRETREE_NUM_ELEMENTS = 20;
-	public static final int LZX_ALIGNED_NUM_ELEMENTS = 8; /*
-														 * aligned offset tree
-														 * #elements
-														 */
-	public static final int LZX_NUM_PRIMARY_LENGTHS = 7; /*
-														 * this one missing from
-														 * spec!
-														 */
-	public static final int LZX_NUM_SECONDARY_LENGTHS = 249; /*
-															 * length tree
-															 * #elements
-															 */
-
+	public static final int LZX_MIN_MATCH = 					2;
+	public static final int LZX_MAX_MATCH = 					257;
+	public static final int LZX_NUM_CHARS =						256;
+	public static final int LZX_BLOCKTYPE_INVALID =				0;  	/* also blocktypes 4-7 invalid */
+	public static final int LZX_BLOCKTYPE_VERBATIM = 			1;
+	public static final int LZX_BLOCKTYPE_ALIGNED =				2;
+	public static final int LZX_BLOCKTYPE_UNCOMPRESSED =		3;
+	public static final int LZX_PRETREE_NUM_ELEMENTS_BITS =		4;     /* ??? */
+	public static final int LZX_PRETREE_NUM_ELEMENTS =			20;
+	public static final int LZX_ALIGNED_NUM_ELEMENTS = 			8; 		/* aligned offset tree #elements */
+	public static final int LZX_NUM_PRIMARY_LENGTHS = 			7; 		/* this one missing from spec! */
+	public static final int LZX_NUM_SECONDARY_LENGTHS = 		249;	/* length tree #elements */
+	
 	/* LZX huffman defines: tweak tablebits as desired */
-	public static final int LZX_PRETREE_MAXSYMBOLS = LZX_PRETREE_NUM_ELEMENTS;
-	public static final int LZX_PRETREE_TABLEBITS = 6;
-	public static final int LZX_MAINTREE_MAXSYMBOLS = LZX_NUM_CHARS + 50 * 8;
-	public static final int LZX_MAIN_MAXSYMBOLS = LZX_NUM_CHARS * 2;
-	public static final int LZX_MAINTREE_TABLEBITS = 12;
-	public static final int LZX_LENGTH_MAXSYMBOLS = LZX_NUM_SECONDARY_LENGTHS + 1;
-	public static final int LZX_LENGTH_TABLEBITS = 12;
-	public static final int LZX_ALIGNED_MAXSYMBOLS = LZX_ALIGNED_NUM_ELEMENTS;
-	public static final int LZX_ALIGNED_TABLEBITS = 7;
-	public static final int LZX_LENTABLE_SAFETY = 64;
-
+	public static final int LZX_PRETREE_MAXSYMBOLS = 			LZX_PRETREE_NUM_ELEMENTS;
+	public static final int LZX_PRETREE_TABLEBITS = 			6;
+	public static final int LZX_MAINTREE_MAXSYMBOLS =			LZX_NUM_CHARS + 50*8;
+	public static final int LZX_MAIN_MAXSYMBOLS =				LZX_NUM_CHARS * 2;
+	public static final int LZX_MAINTREE_TABLEBITS = 			12;
+	public static final int LZX_LENGTH_MAXSYMBOLS = 			LZX_NUM_SECONDARY_LENGTHS + 1;
+	public static final int LZX_LENGTH_TABLEBITS = 				12;
+	public static final int LZX_ALIGNED_MAXSYMBOLS = 			LZX_ALIGNED_NUM_ELEMENTS;
+	public static final int LZX_ALIGNED_TABLEBITS = 			7;
+	public static final int LZX_LENTABLE_SAFETY = 				64;
+	
 	public static short[] EXTRA_BITS = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5,
 			5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14,
 			15, 15, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
 			17, 17 };
-
+	
 	public static int[] POSITION_BASE = { 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32,
 			48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072,
 			4096, 6144, 8192, 12288, 16384, 24576, 32768, 49152, 65536, 98304,
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmWrapper.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmWrapper.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/core/ChmWrapper.java	(working copy)
@@ -23,107 +23,82 @@
 	private int indexOfResetData;
 	private int indexOfResetTable;
 	private int startIndex;
-
+	
 	protected int getStartIndex() {
 		return startIndex;
 	}
-
 	protected void setStartIndex(int startIndex) {
 		this.startIndex = startIndex;
 	}
-
 	protected int getIndexOfResetTable() {
 		return indexOfResetTable;
 	}
-
 	protected void setIndexOfResetTable(int indexOfResetTable) {
 		this.indexOfResetTable = indexOfResetTable;
 	}
-
 	protected List<ChmLzxBlock> getLzxBlocksCache() {
 		return lzxBlocksCache;
 	}
-
 	protected void setLzxBlocksCache(List<ChmLzxBlock> lzxBlocksCache) {
 		this.lzxBlocksCache = lzxBlocksCache;
 	}
-
 	protected ChmDirectoryListingSet getChmDirList() {
 		return chmDirList;
 	}
-
 	protected void setChmDirList(ChmDirectoryListingSet chmDirList) {
 		this.chmDirList = chmDirList;
 	}
-
 	protected ChmItsfHeader getChmItsfHeader() {
 		return chmItsfHeader;
 	}
-
 	protected void setChmItsfHeader(ChmItsfHeader chmItsfHeader) {
 		this.chmItsfHeader = chmItsfHeader;
 	}
-
 	protected ChmLzxcResetTable getChmLzxcResetTable() {
 		return chmLzxcResetTable;
 	}
-
 	protected void setChmLzxcResetTable(ChmLzxcResetTable chmLzxcResetTable) {
 		this.chmLzxcResetTable = chmLzxcResetTable;
 	}
-
 	protected ChmLzxcControlData getChmLzxcControlData() {
 		return chmLzxcControlData;
 	}
-
 	protected void setChmLzxcControlData(ChmLzxcControlData chmLzxcControlData) {
 		this.chmLzxcControlData = chmLzxcControlData;
 	}
-
 	protected byte[] getData() {
 		return data;
 	}
-
 	protected void setData(byte[] data) {
 		this.data = data;
 	}
-
 	protected int getIndexOfContent() {
 		return indexOfContent;
 	}
-
 	protected void setIndexOfContent(int indexOfContent) {
 		this.indexOfContent = indexOfContent;
 	}
-
 	protected long getLzxBlockOffset() {
 		return lzxBlockOffset;
 	}
-
 	protected void setLzxBlockOffset(long lzxBlockOffset) {
 		this.lzxBlockOffset = lzxBlockOffset;
 	}
-
 	protected long getLzxBlockLength() {
 		return lzxBlockLength;
 	}
-
 	protected void setLzxBlockLength(long lzxBlockLength) {
 		this.lzxBlockLength = lzxBlockLength;
 	}
-
 	protected void setChmItspHeader(ChmItspHeader chmItspHeader) {
 		this.chmItspHeader = chmItspHeader;
 	}
-
 	protected ChmItspHeader getChmItspHeader() {
 		return chmItspHeader;
 	}
-
 	protected void setIndexOfResetData(int indexOfResetData) {
 		this.indexOfResetData = indexOfResetData;
 	}
-
 	protected int getIndexOfResetData() {
 		return indexOfResetData;
 	}
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/CHMDocumentInformation.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/CHMDocumentInformation.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/CHMDocumentInformation.java	(working copy)
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+
 package org.apache.tika.parser.chm;
 
 import java.io.ByteArrayInputStream;
@@ -32,6 +33,7 @@
 import org.apache.tika.sax.BodyContentHandler;
 import org.xml.sax.SAXException;
 
+
 /**
  * Extracts text and metadata from chm file
  * 
@@ -43,68 +45,62 @@
 	/**
 	 * Loads chm file as input stream and returns a new instance of chm doc info
 	 * 
-	 * @param is
-	 *            InputStream
+	 * @param is InputStream
 	 * 
 	 * @return chm document information
 	 */
 	public static CHMDocumentInformation load(InputStream is) {
 		return new CHMDocumentInformation().getInstance(is);
-	}
-
+	} 
+	
 	/**
 	 * Returns instance of chm document information
 	 * 
-	 * @param is
-	 *            InputStream
+	 * @param is InputStream
 	 * 
 	 * @return
 	 */
-	private CHMDocumentInformation getInstance(InputStream is) {
+	private CHMDocumentInformation getInstance(InputStream is){
 		setChmExtractor(new ChmExtractor(is));
 		return this;
 	}
-
+	
 	/**
 	 * Appends extracted data from chm listing entries
 	 * 
 	 * @return extracted content of chm
 	 */
-	private String getContent() {
+	private String getContent(){
 		StringBuilder sb = new StringBuilder();
 		DirectoryListingEntry entry;
-		for (Iterator<DirectoryListingEntry> it = getChmExtractor()
-				.getChmDirList().getDirectoryListingEntryList().iterator(); it
-				.hasNext();) {
+		for (Iterator<DirectoryListingEntry> it = getChmExtractor().getChmDirList().getDirectoryListingEntryList().iterator(); it.hasNext();) {
 			try {
 				entry = it.next();
-				if (isRightEntry(entry)) {
+				if(isRightEntry(entry)){
 					byte[][] tmp = getChmExtractor().extractChmEntry(entry);
-					if (tmp != null) {
+					if(tmp != null){
 						sb.append(extract(tmp));
 					}
 				}
-			} catch (ChmParsingException e) {// catch (IOException e) {
+			} catch (ChmParsingException e) {//catch (IOException e) {
 				System.out.println(e.getMessage());
-			} // catch (IOException e) {//Pushback exception from tagsoup
-			// System.err.println(e.getMessage());
+			} //catch (IOException e) {//Pushback exception from tagsoup
+//				System.err.println(e.getMessage());
 		}
 		return sb.toString();
 	}
-
+	
 	/**
 	 * Checks if an entry is a html or not.
 	 * 
-	 * @param entry
-	 *            chm directory listing entry
+	 * @param entry chm directory listing entry
 	 * 
 	 * @return boolean
 	 */
-	private boolean isRightEntry(DirectoryListingEntry entry) {
-		return (entry.getName().endsWith(".html") || entry.getName().endsWith(
-				".htm"));
+	private boolean isRightEntry(DirectoryListingEntry entry){
+		return (entry.getName().endsWith(".html") || entry.getName().endsWith(".htm"));
 	}
-
+	
 	/**
 	 * Returns chm extractor
 	 * 
@@ -122,6 +118,7 @@
 	private void setChmExtractor(ChmExtractor chmExtractor) {
 		this.chmExtractor = chmExtractor;
 	}
+	
 
 	/**
 	 * Returns chm metadata
@@ -131,16 +128,16 @@
 	 * @throws TikaException
 	 * @throws IOException
 	 */
-	public void getCHMDocInformation(Metadata metadata) throws TikaException,
-			IOException {
-		if (getChmExtractor() != null) {
+	public void getCHMDocInformation(Metadata metadata) throws TikaException, IOException{
+		if(getChmExtractor() != null){
 			/* Checking if file is a chm, done during creating chmItsf header */
 			metadata.add(Metadata.CONTENT_TYPE, "application/x-chm");
 		} else {
 			metadata.add(Metadata.CONTENT_TYPE, "unknown");
 		}
 	}
-
+		
+		
 	/**
 	 * Returns extracted text from chm file
 	 * 
@@ -148,24 +145,24 @@
 	 * 
 	 * @throws TikaException
 	 */
-	public String getText() throws TikaException {
+	public String getText() throws TikaException{
 		return getContent();
 	}
-
+	
 	/**
 	 * Extracts data from byte[][]
 	 * 
 	 * @param byteObject
 	 * @return
 	 * @throws IOException
-	 * @throws SAXException
+	 * @throws SAXException 
 	 */
-	private String extract(byte[][] byteObject) {// throws IOException
+	private String extract(byte[][] byteObject){// throws IOException
 		StringBuilder wBuf = new StringBuilder();
 		InputStream stream = null;
 		Metadata metadata = new Metadata();
 		HtmlParser htmlParser = new HtmlParser();
-		BodyContentHandler handler = new BodyContentHandler(-1);// -1
+		BodyContentHandler handler = new BodyContentHandler(-1);//-1
 		ParseContext parser = new ParseContext();
 		try {
 			for (int i = 0; i < byteObject.length; i++) {
@@ -174,26 +171,23 @@
 					htmlParser.parse(stream, handler, metadata, parser);
 				} catch (TikaException e) {
 					wBuf.append(new String(byteObject[i]));
-					System.err.println("\n"
-							+ CHMDocumentInformation.class.getName()
-							+ " extract " + e.getMessage());
-				} finally {
-					wBuf.append(handler.toString()
-							+ System.getProperty("line.separator"));
+					System.err.println("\n" + CHMDocumentInformation.class.getName() + " extract " + e.getMessage());
+				}finally{
+					wBuf.append(handler.toString() + System.getProperty("line.separator"));
 					stream.close();
 				}
 			}
-		} catch (ChmParsingException e) {
+		} catch (ChmParsingException e) { 	
 			System.err.println(e.getMessage());
 		} catch (SAXException e) {
 			System.err.println(e.getMessage());
-		} catch (IOException e) {// Pushback overflow from tagsoup
-		// System.err.println(e.getMessage());
+		} catch (IOException e) {//Pushback overflow from tagsoup
+//			System.err.println(e.getMessage());
 		}
 		return wBuf.toString();
 	}
-
-	public static void main(String[] args) {
-
+		
+	public static void main(String[] args){
+		
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmLzxBlock.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmLzxBlock.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmLzxBlock.java	(working copy)
@@ -17,7 +17,6 @@
 package org.apache.tika.parser.chm.lzx;
 
 import java.math.BigInteger;
-import java.util.Arrays;
 
 import org.apache.tika.parser.chm.core.ChmCommons;
 import org.apache.tika.parser.chm.core.ChmCommons.IntelState;
@@ -25,14 +24,18 @@
 import org.apache.tika.parser.chm.core.ChmConstants;
 import org.apache.tika.parser.chm.exception.ChmParsingException;
 
+
 /**
- * Decompresses a chm block. Depending on chm block type chooses most relevant
- * decompressing method. A chm block type can be as follows:</br> <li>UNDEFINED
- * - no action taken, i.e. skipping the block <li>VERBATIM <li>ALIGNED_OFFSET
- * <li>UNCOMPRESSED the most simplest In addition there are unknown types (4-7).
- * Currently relying on previous chm block these types changing according to the
- * previous chm block type. We need to invent more appropriate way to handle
- * such types.
+ * Decompresses a chm block.
+ * Depending on chm block type chooses most relevant decompressing method.
+ * A chm block type can be as follows:</br>
+ * <li>UNDEFINED - no action taken, i.e. skipping the block 
+ * <li>VERBATIM
+ * <li>ALIGNED_OFFSET
+ * <li>UNCOMPRESSED the most simplest
+ * In addition there are unknown types (4-7). Currently relying on previous chm block 
+ * these types changing according to the previous chm block type. We need to invent
+ * more appropriate way to handle such types.
  * 
  */
 public class ChmLzxBlock {
@@ -42,44 +45,40 @@
 	private byte[] content = null;
 	private ChmSection chmSection = null;
 	private int contentLength = 0;
-
-	// trying to find solution for bad blocks ...
+	
+	//trying to find solution for bad blocks ...
 	private int previousBlockType = -1;
-
-	public ChmLzxBlock(int blockNumber, byte[] dataSegment, long blockLength,
-			ChmLzxBlock prevBlock) {
+	
+	public ChmLzxBlock(int blockNumber, byte[] dataSegment, long blockLength, ChmLzxBlock prevBlock){
 		try {
-			if (validateConstructorParams(blockNumber, dataSegment, blockLength)) {
+			if(validateConstructorParams(blockNumber, dataSegment, blockLength)){
 				setBlockNumber(blockNumber);
-
-				if (prevBlock != null
-						&& prevBlock.getState().getBlockLength() > prevBlock
-								.getState().getBlockRemaining())
+				
+				if(prevBlock != null && prevBlock.getState().getBlockLength() > prevBlock.getState().getBlockRemaining())
 					setChmSection(new ChmSection(prevBlock.getContent()));
 				else
 					setChmSection(new ChmSection(dataSegment));
 
 				setBlockLength(blockLength);
-
-				// ============================================
+				
+				//============================================
 				// we need to take care of previous context
-				// ============================================
+				//============================================
 				checkLzxBlock(prevBlock);
-				setContent((int) blockLength);
-				if (prevBlock == null
-						|| getContent().length < (int) getBlockLength()) {
-					setContent((int) getBlockLength());
+				setContent((int)blockLength);
+				if(prevBlock == null || getContent().length < (int)getBlockLength()){
+					setContent((int)getBlockLength());
 				}
-
-				if (prevBlock != null && prevBlock.getState() != null)
+				
+				if(prevBlock != null && prevBlock.getState() != null)
 					previousBlockType = prevBlock.getState().getBlockType();
-
+				
 				try {
 					extractContent();
 				} catch (ChmParsingException e) {
-					// System.err.println(e.getMessage());
+//					System.err.println(e.getMessage());
 				}
-			} else
+			}else
 				System.err.println("Check your chm lzx block parameters");
 		} catch (ChmParsingException e) {
 			// TODO: handle exception
@@ -90,34 +89,38 @@
 		return contentLength;
 	}
 
+
+
 	protected void setContentLength(int contentLength) {
 		this.contentLength = contentLength;
 	}
 
+
+
 	private ChmSection getChmSection() {
 		return chmSection;
 	}
 
+
+
 	private void setChmSection(ChmSection chmSection) {
 		this.chmSection = chmSection;
 	}
 
-	private void assertStateNotNull() {
-		if (getState() == null)
+	private void assertStateNotNull(){
+		if(getState() == null)
 			throw new ChmParsingException("state is null");
 	}
 
 	private void extractContent() {
 		assertStateNotNull();
-		if (getChmSection().getData() != null) {
+		if (getChmSection().getData() != null){
 			while (getContentLength() < getBlockLength()) {// && tempStopLoop
 				if (getState() != null && getState().getBlockRemaining() == 0) {
 					if (getState().getHadStarted() == LzxState.NOT_STARTED_DECODING) {
 						getState().setHadStarted(LzxState.STARTED_DECODING);
 						if (getChmSection().getSyncBits(1) == 1) {
-							int intelSizeTemp = (getChmSection()
-									.getSyncBits(16) << 16)
-									+ getChmSection().getSyncBits(16);
+							int intelSizeTemp = (getChmSection().getSyncBits(16) << 16) + getChmSection().getSyncBits(16);
 							if (intelSizeTemp >= 0)
 								getState().setIntelFileSize(intelSizeTemp);
 							else
@@ -125,19 +128,17 @@
 						}
 					}
 					getState().setBlockType(getChmSection().getSyncBits(3));
-					getState().setBlockLength(
-							(getChmSection().getSyncBits(16) << 8)
-									+ getChmSection().getSyncBits(8));
+					getState().setBlockLength((getChmSection().getSyncBits(16) << 8) + getChmSection().getSyncBits(8));
 					getState().setBlockRemaining(getState().getBlockLength());
 
-					// ----------------------------------------
+					//----------------------------------------
 					// Trying to handle 3 - 7 block types
-					// ----------------------------------------
-					if (getState().getBlockType() > 3) {
-						if (previousBlockType >= 0 && previousBlockType < 3)
+					//----------------------------------------
+					if(getState().getBlockType() > 3){
+						if(previousBlockType >= 0 && previousBlockType < 3)
 							getState().setBlockType(previousBlockType);
 					}
-
+					
 					switch (getState().getBlockType()) {
 					case ChmCommons.ALIGNED_OFFSET:
 						createAlignedTreeTable();
@@ -151,23 +152,10 @@
 					case ChmCommons.UNCOMPRESSED:
 						getState().setIntelState(IntelState.STARTED);
 						if (getChmSection().getTotal() > 16)
-							getChmSection().setSwath(
-									getChmSection().getSwath() - 1);
-						getState().setR0(
-								(new BigInteger(getChmSection()
-										.reverseByteOrder(
-												getChmSection().unmarshalBytes(
-														4))).longValue()));
-						getState().setR1(
-								(new BigInteger(getChmSection()
-										.reverseByteOrder(
-												getChmSection().unmarshalBytes(
-														4))).longValue()));
-						getState().setR2(
-								(new BigInteger(getChmSection()
-										.reverseByteOrder(
-												getChmSection().unmarshalBytes(
-														4))).longValue()));
+							getChmSection().setSwath(getChmSection().getSwath() - 1);
+						getState().setR0((new BigInteger(getChmSection().reverseByteOrder(getChmSection().unmarshalBytes(4))).longValue()));
+						getState().setR1((new BigInteger(getChmSection().reverseByteOrder(getChmSection().unmarshalBytes(4))).longValue()));
+						getState().setR2((new BigInteger(getChmSection().reverseByteOrder(getChmSection().unmarshalBytes(4))).longValue()));
 						break;
 					default:
 						break;
@@ -177,46 +165,38 @@
 				int tempLen;
 
 				if (getContentLength() + getState().getBlockRemaining() > getBlockLength()) {
-					getState().setBlockRemaining(
-							getContentLength() + getState().getBlockRemaining()
-									- (int) getBlockLength());
+					getState().setBlockRemaining(getContentLength() + getState().getBlockRemaining() - (int) getBlockLength());
 					tempLen = (int) getBlockLength();
 				} else {
-					tempLen = getContentLength()
-							+ getState().getBlockRemaining();
+					tempLen = getContentLength() + getState().getBlockRemaining();
 					getState().setBlockRemaining(0);
 				}
 
 				switch (getState().getBlockType()) {
 				case ChmCommons.ALIGNED_OFFSET:
 					// if(prevblock.lzxState.length>prevblock.lzxState.remaining)
-					decompressAlignedBlock(tempLen, getChmSection().getData());// prevcontext
+					decompressAlignedBlock(tempLen, getChmSection().getData());//prevcontext
 					break;
 				case ChmCommons.VERBATIM:
 					decompressVerbatimBlock(tempLen, getChmSection().getData());
 					break;
 				case ChmCommons.UNCOMPRESSED:
-					decompressUncompressedBlock(tempLen, getChmSection()
-							.getData());
+					decompressUncompressedBlock(tempLen, getChmSection().getData());
 					break;
 				}
 				getState().increaseFramesRead();
-				if ((getState().getFramesRead() < 32768)
-						&& getState().getIntelFileSize() != 0)
+				if ((getState().getFramesRead() < 32768) && getState().getIntelFileSize() != 0)
 					intelE8Decoding();
 			}
 		}
 	}
-
+	
 	protected void intelE8Decoding() {
-		if (getBlockLength() <= ChmConstants.LZX_PRETREE_TABLEBITS
-				|| (getState().getIntelState() == IntelState.NOT_STARTED)) {
-			getState().setBlockRemaining(
-					getState().getBlockRemaining() - (int) getBlockLength());
+		if (getBlockLength() <= ChmConstants.LZX_PRETREE_TABLEBITS || (getState().getIntelState() == IntelState.NOT_STARTED)) {
+			getState().setBlockRemaining(getState().getBlockRemaining() - (int) getBlockLength());
 		} else {
 			long curpos = getState().getBlockRemaining();
-			getState().setBlockRemaining(
-					getState().getBlockRemaining() - (int) getBlockLength());
+			getState().setBlockRemaining(getState().getBlockRemaining() - (int) getBlockLength());
 			int i = 0;
 			while (i < getBlockLength() - 10) {
 				if (content[i] != 0xe8) {
@@ -229,10 +209,8 @@
 				b[2] = getContent()[i + 1];
 				b[3] = getContent()[i + 0];
 				long absoff = (new BigInteger(b)).longValue();
-				if ((absoff >= -curpos)
-						&& (absoff < getState().getIntelFileSize())) {
-					long reloff = (absoff >= 0) ? absoff - curpos : absoff
-							+ getState().getIntelFileSize();
+				if ((absoff >= -curpos) && (absoff < getState().getIntelFileSize())) {
+					long reloff = (absoff >= 0) ? absoff - curpos : absoff + getState().getIntelFileSize();
 					getContent()[i + 0] = (byte) reloff;
 					getContent()[i + 1] = (byte) (reloff >>> 8);
 					getContent()[i + 2] = (byte) (reloff >>> 16);
@@ -243,90 +221,80 @@
 			}
 		}
 	}
-
+	
+	
 	private short[] createPreLenTable() {
 		short[] tmp = new short[ChmConstants.LZX_PRETREE_MAXSYMBOLS];
 		for (int i = 0; i < ChmConstants.LZX_PRETREE_MAXSYMBOLS; i++) {
-			tmp[i] = (short) getChmSection().getSyncBits(
-					ChmConstants.LZX_PRETREE_NUM_ELEMENTS_BITS);
+			tmp[i] = (short) getChmSection().getSyncBits(ChmConstants.LZX_PRETREE_NUM_ELEMENTS_BITS);
 		}
 		return tmp;
 	}
-
+	
 	private void createLengthTreeTable() {
 		short[] prelentable = createPreLenTable();
-
-		if (prelentable == null) {
+		
+		if(prelentable == null){
 			throw new ChmParsingException("pretreetable is null");
 		}
 
-		short[] pretreetable = createTreeTable2(prelentable,
-				(1 << ChmConstants.LZX_PRETREE_TABLEBITS)
-						+ (ChmConstants.LZX_PRETREE_MAXSYMBOLS << 1),
-				ChmConstants.LZX_PRETREE_TABLEBITS,
-				ChmConstants.LZX_PRETREE_MAXSYMBOLS);
+		short[] pretreetable = createTreeTable2(	prelentable,
+													(1 << ChmConstants.LZX_PRETREE_TABLEBITS)
+													+ (ChmConstants.LZX_PRETREE_MAXSYMBOLS << 1),
+													ChmConstants.LZX_PRETREE_TABLEBITS,
+													ChmConstants.LZX_PRETREE_MAXSYMBOLS);
 
-		if (pretreetable == null) {
+		if(pretreetable == null){
 			throw new ChmParsingException("pretreetable is null");
 		}
+		
+		createLengthTreeLenTable(0, ChmConstants.LZX_NUM_SECONDARY_LENGTHS, pretreetable, prelentable);
 
-		createLengthTreeLenTable(0, ChmConstants.LZX_NUM_SECONDARY_LENGTHS,
-				pretreetable, prelentable);
-
-		getState().setLengthTreeTable(
-				createTreeTable2(getState().getLengthTreeLengtsTable(),
-						(1 << ChmConstants.LZX_MAINTREE_TABLEBITS)
-								+ (ChmConstants.LZX_LENGTH_MAXSYMBOLS << 1),
-						ChmConstants.LZX_MAINTREE_TABLEBITS,
-						ChmConstants.LZX_NUM_SECONDARY_LENGTHS));
+		getState().setLengthTreeTable( 	createTreeTable2(getState().getLengthTreeLengtsTable(),
+				(1 << ChmConstants.LZX_MAINTREE_TABLEBITS)
+				+ (ChmConstants.LZX_LENGTH_MAXSYMBOLS << 1),
+				ChmConstants.LZX_MAINTREE_TABLEBITS,
+				ChmConstants.LZX_NUM_SECONDARY_LENGTHS));
 	}
-
+	
 	public void decompressUncompressedBlock(int len, byte[] prevcontent) {
 		if (getContentLength() + getState().getBlockRemaining() <= getBlockLength()) {
-			for (int i = getContentLength(); i < (getContentLength() + getState()
-					.getBlockRemaining()); i++)
+			for (int i = getContentLength(); i < (getContentLength() + getState().getBlockRemaining()); i++)
 				content[i] = getChmSection().getByte();
-
-			setContentLength(getContentLength()
-					+ getState().getBlockRemaining());
+			
+			setContentLength(getContentLength() + getState().getBlockRemaining());
 			getState().setBlockRemaining(0);
 		} else {
 			for (int i = getContentLength(); i < getBlockLength(); i++)
 				content[i] = getChmSection().getByte();
-			getState().setBlockRemaining(
-					(int) getBlockLength() - getContentLength());// = blockLen -
-																	// contentlen;
-			setContentLength((int) getBlockLength());
+			getState().setBlockRemaining((int)getBlockLength() - getContentLength());// = blockLen - contentlen;
+			setContentLength((int)getBlockLength());
 		}
 	}
-
+	
 	public void decompressAlignedBlock(int len, byte[] prevcontent) {
-
-		if ((getChmSection() == null) || (getState() == null)
-				|| (getState().getMainTreeTable() == null))
+		
+		if((getChmSection() == null) || (getState() == null) || (getState().getMainTreeTable() == null))
 			throw new ChmParsingException("chm section is null");
-
+		
 		short s;
 		int x, i, border;
 		int matchlen = 0, matchfooter = 0, extra, rundest, runsrc;
 		int matchoffset = 0;
 		for (i = getContentLength(); i < len; i++) {
 			/* new code */
-			border = getChmSection().getDesyncBits(
-					ChmConstants.LZX_MAINTREE_TABLEBITS, 0);
-			if (border >= getState().mainTreeTable.length)
+			border = getChmSection().getDesyncBits(ChmConstants.LZX_MAINTREE_TABLEBITS, 0);
+			if(border >= getState().mainTreeTable.length)
 				break;
 			/* end new code */
-			s = getState().mainTreeTable[getChmSection().getDesyncBits(
-					ChmConstants.LZX_MAINTREE_TABLEBITS, 0)];
+			s = getState().mainTreeTable[getChmSection().getDesyncBits(ChmConstants.LZX_MAINTREE_TABLEBITS, 0)];
 			if (s >= getState().getMainTreeElements()) {
 				x = ChmConstants.LZX_MAINTREE_TABLEBITS;
 				do {
 					x++;
 					s <<= 1;
 					s += getChmSection().checkBit(x);
-				} while ((s = getState().mainTreeTable[s]) >= getState()
-						.getMainTreeElements());
+				} while ((s = getState().mainTreeTable[s]) >= getState().getMainTreeElements());
 			}
 			getChmSection().getSyncBits(getState().mainTreeTable[s]);
 			if (s < ChmConstants.LZX_NUM_CHARS) {
@@ -335,9 +303,7 @@
 				s -= ChmConstants.LZX_NUM_CHARS;
 				matchlen = s & ChmConstants.LZX_NUM_PRIMARY_LENGTHS;
 				if (matchlen == ChmConstants.LZX_NUM_PRIMARY_LENGTHS) {
-					matchfooter = getState().lengthTreeTable[getChmSection()
-							.getDesyncBits(ChmConstants.LZX_MAINTREE_TABLEBITS,
-									0)];
+					matchfooter = getState().lengthTreeTable[getChmSection().getDesyncBits(ChmConstants.LZX_MAINTREE_TABLEBITS, 0)];
 					if (matchfooter >= ChmConstants.LZX_MAINTREE_TABLEBITS) {
 						x = ChmConstants.LZX_MAINTREE_TABLEBITS;
 						do {
@@ -346,8 +312,7 @@
 							matchfooter += getChmSection().checkBit(x);
 						} while ((matchfooter = getState().lengthTreeTable[matchfooter]) >= ChmConstants.LZX_NUM_SECONDARY_LENGTHS);
 					}
-					getChmSection().getSyncBits(
-							getState().lengthTreeLengtsTable[matchfooter]);
+					getChmSection().getSyncBits(getState().lengthTreeLengtsTable[matchfooter]);
 					matchlen += matchfooter;
 				}
 				matchlen += ChmConstants.LZX_MIN_MATCH;
@@ -359,8 +324,7 @@
 						extra -= 3;
 						long l = getChmSection().getSyncBits(extra);
 						matchoffset += (l << 3);
-						int g = getChmSection().getDesyncBits(
-								ChmConstants.LZX_NUM_PRIMARY_LENGTHS, 0);
+						int g = getChmSection().getDesyncBits(ChmConstants.LZX_NUM_PRIMARY_LENGTHS, 0);
 						int t = getState().getAlignedTreeTable()[g];
 						if (t >= getState().getMainTreeElements()) {
 							x = ChmConstants.LZX_MAINTREE_TABLEBITS;
@@ -368,15 +332,12 @@
 								x++;
 								t <<= 1;
 								t += getChmSection().checkBit(x);
-							} while ((t = getState().getAlignedTreeTable()[t]) >= getState()
-									.getMainTreeElements());
+							} while ((t = getState().getAlignedTreeTable()[t]) >= getState().getMainTreeElements());
 						}
-						getChmSection().getSyncBits(
-								getState().getAlignedTreeTable()[t]);
+						getChmSection().getSyncBits(getState().getAlignedTreeTable()[t]);
 						matchoffset += t;
 					} else if (extra == 3) {
-						int g = (int) getChmSection().getDesyncBits(
-								ChmConstants.LZX_NUM_PRIMARY_LENGTHS, 0);
+						int g = (int) getChmSection().getDesyncBits(ChmConstants.LZX_NUM_PRIMARY_LENGTHS, 0);
 						int t = getState().getAlignedTreeTable()[g];
 						if (t >= getState().getMainTreeElements()) {
 							x = ChmConstants.LZX_MAINTREE_TABLEBITS;
@@ -384,11 +345,9 @@
 								x++;
 								t <<= 1;
 								t += getChmSection().checkBit(x);
-							} while ((t = getState().getAlignedTreeTable()[t]) >= getState()
-									.getMainTreeElements());
+							} while ((t = getState().getAlignedTreeTable()[t]) >= getState().getMainTreeElements());
 						}
-						getChmSection().getSyncBits(
-								getState().getAlignedTreeTable()[t]);
+						getChmSection().getSyncBits(getState().getAlignedTreeTable()[t]);
 						matchoffset += t;
 					} else if (extra > 0) {
 						long l = getChmSection().getSyncBits(extra);
@@ -445,20 +404,20 @@
 		}
 		setContentLength(len);
 	}
-
-	private void assertShortArrayNotNull(short[] array) {
-		if (array == null)
+	
+	private void assertShortArrayNotNull(short[] array){
+		if(array == null)
 			throw new ChmParsingException("short[] is null");
 	}
-
+	
+	
 	private void decompressVerbatimBlock(int len, byte[] prevcontent) {
 		short s;
 		int x, i;
 		int matchlen = 0, matchfooter = 0, extra, rundest, runsrc;
 		int matchoffset = 0;
 		for (i = getContentLength(); i < len; i++) {
-			int f = (int) getChmSection().getDesyncBits(
-					ChmConstants.LZX_MAINTREE_TABLEBITS, 0);
+			int f = (int) getChmSection().getDesyncBits(ChmConstants.LZX_MAINTREE_TABLEBITS, 0);
 			assertShortArrayNotNull(getState().getMainTreeTable());
 			s = getState().getMainTreeTable()[f];
 			if (s >= ChmConstants.LZX_MAIN_MAXSYMBOLS) {
@@ -474,10 +433,9 @@
 				content[i] = (byte) s;
 			} else {
 				s -= ChmConstants.LZX_NUM_CHARS;
-				matchlen = s & ChmConstants.LZX_NUM_PRIMARY_LENGTHS;
+				matchlen = s & ChmConstants.LZX_NUM_PRIMARY_LENGTHS; 
 				if (matchlen == ChmConstants.LZX_NUM_PRIMARY_LENGTHS) {
-					matchfooter = getState().getLengthTreeTable()[(int) getChmSection()
-							.getDesyncBits(ChmConstants.LZX_LENGTH_TABLEBITS, 0)];
+					matchfooter = getState().getLengthTreeTable()[(int) getChmSection().getDesyncBits(ChmConstants.LZX_LENGTH_TABLEBITS, 0)];
 					if (matchfooter >= ChmConstants.LZX_NUM_SECONDARY_LENGTHS) {
 						x = ChmConstants.LZX_LENGTH_TABLEBITS;
 						do {
@@ -486,8 +444,7 @@
 							matchfooter += getChmSection().checkBit(x);
 						} while ((matchfooter = getState().getLengthTreeTable()[matchfooter]) >= ChmConstants.LZX_NUM_SECONDARY_LENGTHS);
 					}
-					getChmSection().getSyncBits(
-							getState().getLengthTreeLengtsTable()[matchfooter]);
+					getChmSection().getSyncBits(getState().getLengthTreeLengtsTable()[matchfooter]);
 					matchlen += matchfooter;
 				}
 				matchlen += ChmConstants.LZX_MIN_MATCH;
@@ -525,16 +482,13 @@
 				if (runsrc < 0) {
 					if (matchlen + runsrc <= 0) {
 						runsrc = prevcontent.length + runsrc;
-						while ((matchlen-- > 0) && (prevcontent != null)
-								&& ((runsrc + 1) > 0))
-							if ((rundest < content.length)
-									&& (runsrc < content.length))
+						while ((matchlen-- > 0) && (prevcontent != null) && ((runsrc + 1) > 0) )
+							if((rundest < content.length) && (runsrc < content.length))
 								content[rundest++] = prevcontent[runsrc++];
 					} else {
 						runsrc = prevcontent.length + runsrc;
 						while (runsrc < prevcontent.length)
-							if ((rundest < content.length)
-									&& (runsrc < content.length))
+							if((rundest < content.length) && (runsrc < content.length))
 								content[rundest++] = prevcontent[runsrc++];
 						matchlen = matchlen + runsrc - prevcontent.length;
 						runsrc = 0;
@@ -549,9 +503,8 @@
 						runsrc++;
 					}
 					/* copies match data - no worries about destination wraps */
-					while (matchlen-- > 0) {
-						if ((rundest < content.length)
-								&& (runsrc < content.length))
+					while (matchlen-- > 0){
+						if((rundest < content.length) && (runsrc < content.length))
 							content[rundest++] = content[runsrc++];
 					}
 				}
@@ -559,22 +512,20 @@
 		}
 		setContentLength(len);
 	}
-
-	private void createLengthTreeLenTable(int offset, int tablelen,
-			short[] pretreetable, short[] prelentable) {
-		if (prelentable == null || getChmSection() == null
-				|| pretreetable == null || prelentable == null)
+	
+	
+	
+	private void createLengthTreeLenTable(int offset, int tablelen, short[] pretreetable, short[] prelentable) {
+		if(prelentable == null || getChmSection() == null || pretreetable == null || prelentable == null )
 			throw new ChmParsingException("is null");
-
-		int i = offset; // represents offset
+		
+		int i = offset; //represents offset
 		int z, y, x;// local counters
 		while (i < tablelen) {
-			z = pretreetable[(int) getChmSection().getDesyncBits(
-					ChmConstants.LZX_PRETREE_TABLEBITS, 0)];
-			if (z >= ChmConstants.LZX_PRETREE_NUM_ELEMENTS) {// 1 bug, should be
-																// 20
+			z = pretreetable[(int) getChmSection().getDesyncBits(ChmConstants.LZX_PRETREE_TABLEBITS, 0)];
+			if (z >= ChmConstants.LZX_PRETREE_NUM_ELEMENTS) {//1 bug, should be 20
 				x = ChmConstants.LZX_PRETREE_TABLEBITS;
-				do {
+				do { 
 					x++;
 					z <<= 1;
 					z += getChmSection().checkBit(x);
@@ -591,21 +542,20 @@
 				y = (int) getChmSection().getSyncBits(4);
 				y += 4;
 				for (int j = 0; j < y; j++)
-					if (i < getState().getLengthTreeLengtsTable().length)
+					if(i < getState().getLengthTreeLengtsTable().length)
 						getState().getLengthTreeLengtsTable()[i++] = 0;
 			} else if (z == 18) {
 				y = (int) getChmSection().getSyncBits(5);
 				y += 20;
 				for (int j = 0; j < y; j++)
-					if (i < getState().getLengthTreeLengtsTable().length)
+					if(i < getState().getLengthTreeLengtsTable().length)
 						getState().getLengthTreeLengtsTable()[i++] = 0;
 			} else if (z == 19) {
 				y = getChmSection().getSyncBits(1);
 				y += 4;
-				z = pretreetable[(int) getChmSection().getDesyncBits(
-						ChmConstants.LZX_PRETREE_TABLEBITS, 0)];
-				if (z >= ChmConstants.LZX_PRETREE_NUM_ELEMENTS) {// 20
-					x = ChmConstants.LZX_PRETREE_TABLEBITS;// 6
+				z = pretreetable[(int) getChmSection().getDesyncBits(ChmConstants.LZX_PRETREE_TABLEBITS, 0)];
+				if (z >= ChmConstants.LZX_PRETREE_NUM_ELEMENTS) {//20
+					x = ChmConstants.LZX_PRETREE_TABLEBITS;//6
 					do {
 						x++;
 						z <<= 1;
@@ -621,44 +571,38 @@
 			}
 		}
 	}
-
+	 
 	private void createMainTreeTable() {
 		short[] prelentable = createPreLenTable();
 		short[] pretreetable = createTreeTable2(prelentable,
-				(1 << ChmConstants.LZX_PRETREE_TABLEBITS)
-						+ (ChmConstants.LZX_PRETREE_MAXSYMBOLS << 1),
-				ChmConstants.LZX_PRETREE_TABLEBITS,
-				ChmConstants.LZX_PRETREE_MAXSYMBOLS);
-		createMainTreeLenTable(0, ChmConstants.LZX_NUM_CHARS, pretreetable,
-				prelentable);
+												(1 << ChmConstants.LZX_PRETREE_TABLEBITS)
+												+ (ChmConstants.LZX_PRETREE_MAXSYMBOLS << 1),
+												ChmConstants.LZX_PRETREE_TABLEBITS,
+												ChmConstants.LZX_PRETREE_MAXSYMBOLS);
+		createMainTreeLenTable(0, ChmConstants.LZX_NUM_CHARS, pretreetable, prelentable);
 		prelentable = createPreLenTable();
 		pretreetable = createTreeTable2(prelentable,
-				(1 << ChmConstants.LZX_PRETREE_TABLEBITS)
-						+ (ChmConstants.LZX_PRETREE_MAXSYMBOLS << 1),
-				ChmConstants.LZX_PRETREE_TABLEBITS,
-				ChmConstants.LZX_PRETREE_MAXSYMBOLS);
-		createMainTreeLenTable(ChmConstants.LZX_NUM_CHARS,
-				getState().mainTreeLengtsTable.length, pretreetable,
-				prelentable);
+										(1 << ChmConstants.LZX_PRETREE_TABLEBITS)
+										+ (ChmConstants.LZX_PRETREE_MAXSYMBOLS << 1),
+										ChmConstants.LZX_PRETREE_TABLEBITS,
+										ChmConstants.LZX_PRETREE_MAXSYMBOLS);
+		createMainTreeLenTable(ChmConstants.LZX_NUM_CHARS, getState().mainTreeLengtsTable.length, pretreetable, prelentable);
 
-		getState().setMainTreeTable(
-				createTreeTable2(getState().mainTreeLengtsTable,
-						(1 << ChmConstants.LZX_MAINTREE_TABLEBITS)
-								+ (ChmConstants.LZX_MAINTREE_MAXSYMBOLS << 1),
-						ChmConstants.LZX_MAINTREE_TABLEBITS, getState()
-								.getMainTreeElements()));
-
+		getState().setMainTreeTable(createTreeTable2(	getState().mainTreeLengtsTable,
+														(1 << ChmConstants.LZX_MAINTREE_TABLEBITS)
+														+ (ChmConstants.LZX_MAINTREE_MAXSYMBOLS << 1),
+														ChmConstants.LZX_MAINTREE_TABLEBITS, getState().getMainTreeElements()));
+		
 	}
-
-	private void createMainTreeLenTable(int offset, int tablelen,
-			short[] pretreetable, short[] prelentable) {
-		if (pretreetable == null)
+	
+	
+	private void createMainTreeLenTable(int offset, int tablelen, short[] pretreetable, short[] prelentable) {
+		if(pretreetable == null)
 			throw new ChmParsingException("pretreetable is null");
 		int i = offset;
 		int z, y, x;
 		while (i < tablelen) {
-			int f = getChmSection().getDesyncBits(
-					ChmConstants.LZX_PRETREE_TABLEBITS, 0);
+			int f = getChmSection().getDesyncBits(ChmConstants.LZX_PRETREE_TABLEBITS, 0);
 			z = pretreetable[f];
 			if (z >= ChmConstants.LZX_PRETREE_MAXSYMBOLS) {
 				x = ChmConstants.LZX_PRETREE_TABLEBITS;
@@ -678,22 +622,21 @@
 			} else if (z == 17) {
 				y = getChmSection().getSyncBits(4);
 				y += 4;
-				for (int j = 0; j < y; j++) {
+				for (int j = 0; j < y; j++){
 					assertInRange(getState().getMainTreeLengtsTable(), i);
 					getState().mainTreeLengtsTable[i++] = 0;
 				}
 			} else if (z == 18) {
 				y = getChmSection().getSyncBits(5);
 				y += 20;
-				for (int j = 0; j < y; j++) {
+				for (int j = 0; j < y; j++){
 					assertInRange(getState().getMainTreeLengtsTable(), i);
 					getState().mainTreeLengtsTable[i++] = 0;
 				}
 			} else if (z == 19) {
 				y = getChmSection().getSyncBits(1);
 				y += 4;
-				z = pretreetable[getChmSection().getDesyncBits(
-						ChmConstants.LZX_PRETREE_TABLEBITS, 0)];
+				z = pretreetable[getChmSection().getDesyncBits(ChmConstants.LZX_PRETREE_TABLEBITS, 0)];
 				if (z >= ChmConstants.LZX_PRETREE_MAXSYMBOLS) {
 					x = ChmConstants.LZX_PRETREE_TABLEBITS;
 					do {
@@ -707,18 +650,17 @@
 				if (z < 0)
 					z = z + 17;
 				for (int j = 0; j < y; j++)
-					if (i < getState().getMainTreeLengtsTable().length)
+					if(i < getState().getMainTreeLengtsTable().length)
 						getState().mainTreeLengtsTable[i++] = (short) z;
 			}
 		}
 	}
-
-	private void assertInRange(short[] array, int index) {
-		if (index >= array.length)
-			throw new ChmParsingException(index + " is bigger than "
-					+ array.length);
+	
+	private void assertInRange(short[] array, int index){
+		if(index >= array.length)
+			throw new ChmParsingException(index + " is bigger than " + array.length);
 	}
-
+	
 	private short[] createAlignedLenTable() {
 		int tablelen = ChmConstants.LZX_BLOCKTYPE_UNCOMPRESSED;
 		int bits = ChmConstants.LZX_BLOCKTYPE_UNCOMPRESSED;
@@ -728,19 +670,17 @@
 		}
 		return tmp;
 	}
-
+	
 	private void createAlignedTreeTable() {
 		getState().setAlignedLenTable(createAlignedLenTable());
-		getState().setAlignedLenTable(
-				createTreeTable2(getState().getAlignedLenTable(),
-						(1 << ChmConstants.LZX_NUM_PRIMARY_LENGTHS)
-								+ (ChmConstants.LZX_ALIGNED_MAXSYMBOLS << 1),
-						ChmConstants.LZX_NUM_PRIMARY_LENGTHS,
-						ChmConstants.LZX_ALIGNED_MAXSYMBOLS));
+		getState().setAlignedLenTable( 	createTreeTable2(getState().getAlignedLenTable(),
+										(1 << ChmConstants.LZX_NUM_PRIMARY_LENGTHS)
+										+ (ChmConstants.LZX_ALIGNED_MAXSYMBOLS << 1),
+										ChmConstants.LZX_NUM_PRIMARY_LENGTHS,
+										ChmConstants.LZX_ALIGNED_MAXSYMBOLS));
 	}
-
-	private short[] createTreeTable2(short[] lentable, int tablelen, int bits,
-			int maxsymbol) {
+	
+	private short[] createTreeTable2(short[] lentable, int tablelen, int bits, int maxsymbol) {
 		short[] tmp = new short[tablelen];
 		short sym;
 		int leaf;
@@ -748,10 +688,10 @@
 		long fill;
 		int pos = 0;
 		/* the current position in the decode table */
-		long table_mask = (1 << bits);
+		long table_mask = (1 << bits); 
 		long bit_mask = (table_mask >> 1);
 		long next_symbol = bit_mask;
-
+		
 		/* fills entries for short codes for a direct mapping */
 		while (bit_num <= bits) {
 			for (sym = 0; sym < maxsymbol; sym++) {
@@ -791,12 +731,12 @@
 							 * two entries
 							 */
 							if (tmp[leaf] == 0) {
-								if (((next_symbol << 1) + 1) < tmp.length) {
+								if(((next_symbol << 1) + 1) < tmp.length){
 									tmp[(int) (next_symbol << 1)] = 0;
 									tmp[(int) (next_symbol << 1) + 1] = 0;
 									tmp[leaf] = (short) next_symbol++;
 								}
-
+								
 							}
 							/*
 							 * follows the path and select either left or right
@@ -811,8 +751,8 @@
 						if ((pos += bit_mask) > table_mask)
 							return null;
 						/* table overflow */
-					} else {
-						// return null;
+					}else{
+//						return null;
 					}
 				}
 				bit_mask >>= 1;
@@ -820,55 +760,55 @@
 			}
 		}
 
-		/* is it full table? */
+        /* is it full table? */
 		if (pos == table_mask)
 			return tmp;
+ 
+        return tmp;
+    }
+	
 
-		return tmp;
-	}
-
 	public byte[] getContent() {
 		return content;
 	}
-
-	public byte[] getContent(int startOffset, int endOffset) {
+	
+	public byte[] getContent(int startOffset, int endOffset){
 		int length = endOffset - startOffset;
-		return (getContent() != null) ? Arrays.copyOfRange(getContent(),
-				startOffset, (startOffset + length)) : new byte[1];
+//		return (getContent() != null) ? Arrays.copyOfRange(getContent(), startOffset, (startOffset + length)) : new byte[1];
+		return (getContent() != null) ? ChmCommons.copyOfRange(getContent(), startOffset, (startOffset + length)) : new byte[1];
 	}
-
-	public byte[] getContent(int start) {
-		return (getContent() != null) ? Arrays.copyOfRange(getContent(), start,
-				(getContent().length + start)) : new byte[1];
+	
+	public byte[] getContent(int start){
+//		return (getContent() != null) ? Arrays.copyOfRange(getContent(), start, (getContent().length + start)) : new byte[1];
+		return (getContent() != null) ? ChmCommons.copyOfRange(getContent(), start, (getContent().length + start)) : new byte[1];
 	}
 
 	private void setContent(int contentLength) {
 		this.content = new byte[contentLength];
 	}
+	
 
-	private void checkLzxBlock(ChmLzxBlock chmPrevLzxBlock) {
-		if (chmPrevLzxBlock == null && getBlockLength() < Integer.MAX_VALUE)
-			setState(new ChmLzxState((int) getBlockLength()));
+	private void checkLzxBlock(ChmLzxBlock chmPrevLzxBlock){
+		if(chmPrevLzxBlock == null && getBlockLength() < Integer.MAX_VALUE)
+			setState(new ChmLzxState((int)getBlockLength()));
 		else
 			setState(chmPrevLzxBlock.getState());
 	}
-
-	private boolean validateConstructorParams(int blockNumber,
-			byte[] dataSegment, long blockLength) {
+	
+	private boolean validateConstructorParams(int blockNumber, byte[] dataSegment, long blockLength){
 		int goodParameter = 0;
-		if (blockNumber >= 0)
+		if(blockNumber >= 0)
 			++goodParameter;
 		else
 			throw new ChmParsingException("block number should be possitive");
-		if (dataSegment != null && dataSegment.length > 0)
+		if(dataSegment != null && dataSegment.length > 0)
 			++goodParameter;
 		else
 			throw new ChmParsingException("data segment should not be null");
-		if (blockLength > 0)
+		if(blockLength > 0)
 			++goodParameter;
 		else
-			throw new ChmParsingException(
-					"block length should be more than zero");
+			throw new ChmParsingException("block length should be more than zero");
 		return (goodParameter == 3);
 	}
 
@@ -884,14 +824,17 @@
 		return block_length;
 	}
 
+
 	private void setBlockLength(long block_length) {
 		this.block_length = block_length;
 	}
 
+
 	public ChmLzxState getState() {
 		return state;
 	}
 
+
 	private void setState(ChmLzxState state) {
 		this.state = state;
 	}
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmLzxState.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmLzxState.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmLzxState.java	(working copy)
@@ -26,119 +26,122 @@
 
 public class ChmLzxState {
 	/* Class' members */
-	private int window; /* the actual decoding window */
-	private long window_size; /* window size (32Kb through 2Mb) */
-	private int window_position; /* current offset within the window */
-	private int main_tree_elements; /* number of main tree elements */
-	private LzxState hadStarted; /* have we started decoding at all yet? */
-	private int block_type; /* type of this block */
-	private int block_length; /* uncompressed length of this block */
-	private int block_remaining; /* uncompressed bytes still left to decode */
-	private int frames_read; /* the number of CFDATA blocks processed */
-	private int intel_file_size; /* magic header value used for transform */
-	private long intel_current_possition; /* current offset in transform space */
-	private IntelState intel_state; /* have we seen any translatable data yet? */
-	private long R0; /* for the LRU offset system */
-	private long R1; /* for the LRU offset system */
-	private long R2; /* for the LRU offset system */
+	private int 		window;						/* the actual decoding window */
+	private long 		window_size;				/* window size (32Kb through 2Mb) */
+	private int			window_position;			/* current offset within the window */
+	private int			main_tree_elements;			/* number of main tree elements */
+	private LzxState 	hadStarted;					/* have we started decoding at all yet? */
+	private int 		block_type;					/* type of this block */
+	private int			block_length;				/* uncompressed length of this block */
+	private int 		block_remaining;			/* uncompressed bytes still left to decode */
+	private int			frames_read;				/* the number of CFDATA blocks processed */
+	private int			intel_file_size;			/* magic header value used for transform */
+	private long		intel_current_possition;	/* current offset in transform space */
+	private IntelState	intel_state;				/* have we seen any translatable data yet? */
+	private long 		R0;							/* for the LRU offset system */
+	private long 		R1;							/* for the LRU offset system */
+	private long 		R2;							/* for the LRU offset system */
 
-	// Trees - PRETREE, MAINTREE, LENGTH, ALIGNED
+	//Trees - PRETREE, MAINTREE, LENGTH, ALIGNED
 	protected short[] mainTreeLengtsTable;
 	protected short[] mainTreeTable;
-
+	
 	protected short[] lengthTreeTable;
 	protected short[] lengthTreeLengtsTable;
-
+	
+	
 	protected short[] alignedLenTable;
 	protected short[] alignedTreeTable;
+	
 
 	protected short[] getMainTreeTable() {
 		return mainTreeTable;
 	}
 
+
+
+
 	protected short[] getAlignedTreeTable() {
 		return alignedTreeTable;
 	}
 
+
+
+
 	protected void setAlignedTreeTable(short[] alignedTreeTable) {
 		this.alignedTreeTable = alignedTreeTable;
 	}
 
+
+
+
 	protected short[] getLengthTreeTable() {
-		if (lengthTreeTable != null)
+		if(lengthTreeTable != null)
 			return this.lengthTreeTable;
 		else
 			throw new ChmParsingException("lengthTreeTable is null");
 	}
 
+
+
+
 	protected void setLengthTreeTable(short[] lengthTreeTable) {
 		this.lengthTreeTable = lengthTreeTable;
 	}
 
+
+
+
 	protected void setMainTreeTable(short[] mainTreeTable) {
 		this.mainTreeTable = mainTreeTable;
 	}
 
+
 	protected short[] getAlignedLenTable() {
 		return this.alignedLenTable;
 	}
 
+
 	protected void setAlignedLenTable(short[] alignedLenTable) {
 		this.alignedLenTable = alignedLenTable;
 	}
 
+
 	/**
 	 * It suits for informative outlook
 	 */
-	public String toString() {
+	public String toString(){
 		StringBuilder sb = new StringBuilder();
-		sb.append("actual decoding window:=" + getWindow()
-				+ System.getProperty("line.separator"));
-		sb.append("window size (32Kb through 2Mb):=" + getWindowSize()
-				+ System.getProperty("line.separator"));
-		sb.append("current offset within the window:=" + getWindowPosition()
-				+ System.getProperty("line.separator"));
-		sb.append("number of main tree elements:=" + getMainTreeElements()
-				+ System.getProperty("line.separator"));
-		sb.append("have we started decoding at all yet?:=" + getHadStarted()
-				+ System.getProperty("line.separator"));
-		sb.append("type of this block:=" + getBlockType()
-				+ System.getProperty("line.separator"));
-		sb.append("uncompressed length of this block:=" + getBlockLength()
-				+ System.getProperty("line.separator"));
-		sb.append("uncompressed bytes still left to decode:="
-				+ getBlockRemaining() + System.getProperty("line.separator"));
-		sb.append("the number of CFDATA blocks processed:=" + getFramesRead()
-				+ System.getProperty("line.separator"));
-		sb.append("magic header value used for transform:="
-				+ getIntelFileSize() + System.getProperty("line.separator"));
-		sb.append("current offset in transform space:="
-				+ getIntelCurrentPossition()
-				+ System.getProperty("line.separator"));
-		sb.append("have we seen any translatable data yet?:=" + getIntelState()
-				+ System.getProperty("line.separator"));
-		sb.append("R0 for the LRU offset system:=" + getR0()
-				+ System.getProperty("line.separator"));
-		sb.append("R1 for the LRU offset system:=" + getR1()
-				+ System.getProperty("line.separator"));
-		sb.append("R2 for the LRU offset system:=" + getR2()
-				+ System.getProperty("line.separator"));
-		sb.append("main tree length:=" + getMainTreeLengtsTable().length
-				+ System.getProperty("line.separator"));
-		sb.append("secondary tree length:=" + getLengthTreeLengtsTable().length
-				+ System.getProperty("line.separator"));
+		sb.append("actual decoding window:=" + getWindow() + System.getProperty("line.separator"));
+		sb.append("window size (32Kb through 2Mb):=" + getWindowSize() + System.getProperty("line.separator"));
+		sb.append("current offset within the window:=" + getWindowPosition() + System.getProperty("line.separator"));
+		sb.append("number of main tree elements:=" + getMainTreeElements() + System.getProperty("line.separator"));
+		sb.append("have we started decoding at all yet?:=" + getHadStarted() + System.getProperty("line.separator"));
+		sb.append("type of this block:=" + getBlockType() + System.getProperty("line.separator"));
+		sb.append("uncompressed length of this block:=" + getBlockLength() + System.getProperty("line.separator"));
+		sb.append("uncompressed bytes still left to decode:=" + getBlockRemaining() + System.getProperty("line.separator"));
+		sb.append("the number of CFDATA blocks processed:=" + getFramesRead() + System.getProperty("line.separator"));
+		sb.append("magic header value used for transform:=" + getIntelFileSize() + System.getProperty("line.separator"));
+		sb.append("current offset in transform space:=" + getIntelCurrentPossition() + System.getProperty("line.separator"));
+		sb.append("have we seen any translatable data yet?:=" + getIntelState() + System.getProperty("line.separator"));
+		sb.append("R0 for the LRU offset system:=" + getR0() + System.getProperty("line.separator"));
+		sb.append("R1 for the LRU offset system:=" + getR1() + System.getProperty("line.separator"));
+		sb.append("R2 for the LRU offset system:=" + getR2() + System.getProperty("line.separator"));
+		sb.append("main tree length:=" + getMainTreeLengtsTable().length + System.getProperty("line.separator"));
+		sb.append("secondary tree length:=" + getLengthTreeLengtsTable().length + System.getProperty("line.separator"));
 		return sb.toString();
 	}
-
-	public ChmLzxState(int window) {
-		if (window >= 0) {
+	
+	
+	
+	public ChmLzxState(int window){
+		if(window >= 0){
 			int position_slots;
 			int win = ChmCommons.getWindowSize(window);
 			setWindowSize(1 << win);
 			/* LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) */
 			if (win < 15 || win > 21)
-				System.err
-						.println("window less than 15 or window greater than 21");
+		    	System.err.println("window less than 15 or window greater than 21");
 			/* Calculates required position slots */
 			if (win == 20)
 				position_slots = 42;
@@ -146,10 +149,8 @@
 				position_slots = 50;
 			else
 				position_slots = win << 1;
-
-			setR0(1);
-			setR1(1);
-			setR2(1);
+			
+			setR0(1); setR1(1); setR2(1);
 			setMainTreeElements(512);
 			setHadStarted(LzxState.NOT_STARTED_DECODING);
 			setFramesRead(0);
@@ -159,16 +160,15 @@
 			setIntelState(IntelState.NOT_STARTED);
 			setWindowPosition(0);
 			setMainTreeLengtsTable(new short[getMainTreeElements()]);
-			setLengthTreeLengtsTable(new short[ChmConstants.LZX_NUM_SECONDARY_LENGTHS]);
+			setLengthTreeLengtsTable(new short[ChmConstants.LZX_NUM_SECONDARY_LENGTHS]);   
 		} else
-			throw new CancellationException(
-					"window size should be more than zero");
+			throw new CancellationException("window size should be more than zero");
 	}
-
+	
 	protected void setWindow(int window) {
 		this.window = window;
 	}
-
+	
 	protected int getWindow() {
 		return window;
 	}
@@ -232,8 +232,8 @@
 	protected void setFramesRead(int frames_read) {
 		this.frames_read = frames_read;
 	}
-
-	protected void increaseFramesRead() {
+	
+	protected void increaseFramesRead(){
 		this.frames_read = getFramesRead() + 1;
 	}
 
@@ -288,22 +288,32 @@
 	protected long getR2() {
 		return R2;
 	}
-
-	public static void main(String[] args) {
+	
+	
+	
+	public static void main(String[] args){
 	}
 
+
+
 	public void setMainTreeLengtsTable(short[] mainTreeLengtsTable) {
 		this.mainTreeLengtsTable = mainTreeLengtsTable;
 	}
 
+
+
 	public short[] getMainTreeLengtsTable() {
 		return mainTreeLengtsTable;
 	}
 
+
+
 	public void setLengthTreeLengtsTable(short[] lengthTreeLengtsTable) {
 		this.lengthTreeLengtsTable = lengthTreeLengtsTable;
 	}
 
+
+
 	public short[] getLengthTreeLengtsTable() {
 		return lengthTreeLengtsTable;
 	}
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmSection.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmSection.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmSection.java	(working copy)
@@ -23,46 +23,46 @@
 
 public class ChmSection {
 	private byte[] data;
-	private int swath;// kiks
-	private int total;// remains
-	private int buffer;// val
-
-	public ChmSection(byte[] data) {
+	private int swath;//kiks
+	private int total;//remains
+	private int buffer;//val
+	
+	
+	public ChmSection(byte[] data){
 		ChmCommons.assertByteArrayNotNull(data);
 		setData(data);
 	}
-
+	
 	/* Utilities */
-	public byte[] reverseByteOrder(byte[] toBeReversed) {
+	public byte[] reverseByteOrder(byte[] toBeReversed){
 		ChmCommons.assertByteArrayNotNull(toBeReversed);
 		ChmCommons.reverse(toBeReversed);
 		return toBeReversed;
 	}
 
-	public int checkBit(int i) {
-		return ((getBuffer() & (1 << (getTotal() - i))) == 0) ? 0 : 1;
+	public int checkBit(int i){
+		return ((getBuffer() & ( 1 << (getTotal() - i))) == 0) ? 0 : 1;
 	}
-
-	public int getSyncBits(int bit) {
+	
+	public int getSyncBits(int bit){
 		return getDesyncBits(bit, bit);
 	}
-
+	
 	public int getDesyncBits(int bit, int removeBit) {
 		while (getTotal() < 16) {
-			setBuffer((getBuffer() << 16) + unmarshalUByte()
-					+ (unmarshalUByte() << 8));
+			setBuffer((getBuffer() << 16) + unmarshalUByte() + (unmarshalUByte() << 8));
 			setTotal(getTotal() + 16);
 		}
 		int tmp = (getBuffer() >>> (getTotal() - bit));
 		setTotal(getTotal() - removeBit);
-		setBuffer(getBuffer() - ((getBuffer() >>> getTotal()) << getTotal()));
+		setBuffer(getBuffer() - ((getBuffer() >>> getTotal()) << getTotal()));	
 		return tmp;
 	}
-
+	
 	public int unmarshalUByte() {
 		return (int) (getByte() & 255);
 	}
-
+	
 	public byte getByte() {
 		if (getSwath() < getData().length) {
 			setSwath(getSwath() + 1);
@@ -71,10 +71,10 @@
 			return 0;
 	}
 
-	public int getLeft() {
+	public int getLeft(){
 		return (getData().length - getSwath());
 	}
-
+	
 	public byte[] getData() {
 		return data;
 	}
@@ -92,6 +92,7 @@
 		return new BigInteger(tmp);
 	}
 
+	
 	public byte[] stringToAsciiBytes(String s) {
 		char[] c = s.toCharArray();
 		byte[] byteval = new byte[c.length];
@@ -99,19 +100,19 @@
 			byteval[i] = (byte) c[i];
 		return byteval;
 	}
-
+	
 	public BigInteger unmarshalUlong() {
 		return getBigInteger(8);
 	}
-
+	
 	public long unmarshalUInt() {
 		return getBigInteger(4).longValue();
 	}
-
+	
 	public int unmarshalInt() {
 		return getBigInteger(4).intValue();
 	}
-
+	
 	public byte[] unmarshalBytes(int i) {
 		if (i == 0)
 			return new byte[1];
@@ -121,7 +122,7 @@
 		setSwath(getSwath() + i);
 		return t;
 	}
-
+	
 	public BigInteger getEncint() {
 		byte ob;
 		BigInteger bi = BigInteger.ZERO;
@@ -134,7 +135,7 @@
 		bi = bi.shiftLeft(7).add(new BigInteger(nb));
 		return bi;
 	}
-
+	
 	public char unmarshalUtfChar() {
 		byte ob;
 		int i = 1;
@@ -164,45 +165,58 @@
 			return (char) n;
 		}
 	}
-
+	
 	private void setData(byte[] data) {
 		this.data = data;
 	}
 
+
+
 	public int getSwath() {
 		return swath;
 	}
 
+
+
 	public void setSwath(int swath) {
 		this.swath = swath;
 	}
 
+
+
 	public int getTotal() {
 		return total;
 	}
 
+
+
 	public void setTotal(int total) {
 		this.total = total;
 	}
 
+
+
 	private int getBuffer() {
 		return buffer;
 	}
 
+
+
 	private void setBuffer(int buffer) {
 		this.buffer = buffer;
 	}
 
+
+
 	/**
 	 * @param args
 	 */
 	public static void main(String[] args) {
 		int result = 8 & 255;
 		System.out.println("result " + result);
-		byte[] array = { 4, 78, -67, 90, 1, -33 };
+		byte[] array = {4, 78, -67, 90, 1, -33};
 		ChmSection chmSection = new ChmSection(array);
 		System.out.println("before " + Arrays.toString(array));
-		System.out.println("after "
-				+ Arrays.toString(chmSection.reverseByteOrder(array)));
+		System.out.println("after " + Arrays.toString(chmSection.reverseByteOrder(array)));
 	}
 }
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmBlockInfo.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmBlockInfo.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/lzx/ChmBlockInfo.java	(working copy)
@@ -20,13 +20,15 @@
 import org.apache.tika.parser.chm.accessor.DirectoryListingEntry;
 import org.apache.tika.parser.chm.exception.ChmParsingException;
 
+
 /**
- * A container that contains chm block information such as: i. initial block is
- * using to reset main tree ii. start block is using for knowing where to start
- * iii. end block is using for knowing where to stop iv. start offset is using
- * for knowing where to start reading v. end offset is using for knowing where
- * to stop reading
- * 
+ * A container that contains chm block information such as:
+ * i.	initial block is using to reset main tree
+ * ii.	start block is using for knowing where to start
+ * iii.	end block is using for knowing where to stop
+ * iv.	start offset is using for knowing where to start reading
+ * v.	end offset is using for knowing where to stop reading
+ *
  */
 public class ChmBlockInfo {
 	/* class members */
@@ -35,95 +37,77 @@
 	private int endBlock;
 	private int startOffset;
 	private int endOffset;
-
+	
 	private static ChmBlockInfo chmBlockInfo = null;
 
-	private ChmBlockInfo() {
-
+	private ChmBlockInfo(){
+		
 	}
-
+	
 	/**
 	 * Returns an information related to the chmBlockInfo
 	 * 
-	 * @param dle
-	 *            - DirectoryListingEntry
-	 * @param bytesPerBlock
-	 *            - int, = chmLzxcResetTable.block_length
-	 * @param clcd
-	 *            - ChmLzxcControlData
-	 * @param chmBlockInfo
-	 *            - ChmBlockInfo
+	 * @param dle - DirectoryListingEntry
+	 * @param bytesPerBlock - int, = chmLzxcResetTable.block_length
+	 * @param clcd - ChmLzxcControlData
+	 * @param chmBlockInfo - ChmBlockInfo
 	 * 
 	 * @return ChmBlockInfo
 	 */
-	protected ChmBlockInfo getChmBlockInfo(DirectoryListingEntry dle,
-			int bytesPerBlock, ChmLzxcControlData clcd,
-			ChmBlockInfo chmBlockInfo) {
-		if (!validateParameters(dle, bytesPerBlock, clcd, chmBlockInfo))
+	protected ChmBlockInfo getChmBlockInfo(DirectoryListingEntry dle, int bytesPerBlock,  ChmLzxcControlData clcd, ChmBlockInfo chmBlockInfo){
+		if(!validateParameters(dle, bytesPerBlock, clcd, chmBlockInfo))
 			throw new ChmParsingException("Please check you parameters");
 
 		chmBlockInfo.setStartBlock(dle.getOffset() / bytesPerBlock);
-		chmBlockInfo.setEndBlock((dle.getOffset() + dle.getLength())
-				/ bytesPerBlock);
+		chmBlockInfo.setEndBlock((dle.getOffset() + dle.getLength()) / bytesPerBlock);
 		chmBlockInfo.setStartOffset(dle.getOffset() % bytesPerBlock);
-		chmBlockInfo.setEndOffset((dle.getOffset() + dle.getLength())
-				% bytesPerBlock);
-		// potential problem with casting long to int
-		chmBlockInfo
-				.setIniBlock((chmBlockInfo.startBlock - chmBlockInfo.startBlock)
-						% (int) clcd.getResetInterval());
-		return chmBlockInfo;
+		chmBlockInfo.setEndOffset((dle.getOffset() + dle.getLength()) % bytesPerBlock);
+		//potential problem with casting long to int
+		chmBlockInfo.setIniBlock((chmBlockInfo.startBlock - chmBlockInfo.startBlock) % (int) clcd.getResetInterval());
+        return chmBlockInfo;
 	}
-
-	public static ChmBlockInfo getChmBlockInfoInstance(
-			DirectoryListingEntry dle, int bytesPerBlock,
-			ChmLzxcControlData clcd) {
+	
+	public static ChmBlockInfo getChmBlockInfoInstance(DirectoryListingEntry dle, int bytesPerBlock,  ChmLzxcControlData clcd){
 		setChmBlockInfo(new ChmBlockInfo());
 		getChmBlockInfo().setStartBlock(dle.getOffset() / bytesPerBlock);
-		getChmBlockInfo().setEndBlock(
-				(dle.getOffset() + dle.getLength()) / bytesPerBlock);
+		getChmBlockInfo().setEndBlock((dle.getOffset() + dle.getLength()) / bytesPerBlock);
 		getChmBlockInfo().setStartOffset(dle.getOffset() % bytesPerBlock);
-		getChmBlockInfo().setEndOffset(
-				(dle.getOffset() + dle.getLength()) % bytesPerBlock);
-		// potential problem with casting long to int
-		getChmBlockInfo().setIniBlock(
-				(getChmBlockInfo().startBlock - getChmBlockInfo().startBlock)
-						% (int) clcd.getResetInterval());
+		getChmBlockInfo().setEndOffset((dle.getOffset() + dle.getLength()) % bytesPerBlock);
+		//potential problem with casting long to int
+		getChmBlockInfo().setIniBlock((getChmBlockInfo().startBlock - getChmBlockInfo().startBlock) % (int) clcd.getResetInterval());
 		return getChmBlockInfo();
 	}
-
+	
 	/**
 	 * Returns textual representation of ChmBlockInfo
 	 */
-	public String toString() {
+	public String toString(){
 		StringBuilder sb = new StringBuilder();
 		sb.append("iniBlock:=" + getIniBlock() + ", ");
 		sb.append("startBlock:=" + getStartBlock() + ", ");
 		sb.append("endBlock:=" + getEndBlock() + ", ");
 		sb.append("startOffset:=" + getStartOffset() + ", ");
-		sb.append("endOffset:=" + getEndOffset()
-				+ System.getProperty("line.separator"));
+		sb.append("endOffset:=" + getEndOffset() + System.getProperty("line.separator"));
 		return sb.toString();
 	}
-
-	private boolean validateParameters(DirectoryListingEntry dle,
-			int bytesPerBlock, ChmLzxcControlData clcd,
-			ChmBlockInfo chmBlockInfo) {
+	
+	private boolean validateParameters(DirectoryListingEntry dle, int bytesPerBlock,  ChmLzxcControlData clcd, ChmBlockInfo chmBlockInfo){
 		int goodParameter = 0;
-		if (dle != null)
+		if(dle != null)
 			++goodParameter;
-		if (bytesPerBlock > 0)
+		if(bytesPerBlock > 0)
 			++goodParameter;
-		if (clcd != null)
+		if(clcd != null)
 			++goodParameter;
-		if (chmBlockInfo != null)
+		if(chmBlockInfo != null)
 			++goodParameter;
 		return (goodParameter == 4);
 	}
-
-	public static void main(String[] args) {
+	
+	public static void main(String[] args){
 	}
-
+	
+	
 	/**
 	 * Returns an initial block index
 	 * 
@@ -132,17 +116,18 @@
 	public int getIniBlock() {
 		return iniBlock;
 	}
-
+	
+	
 	/**
 	 * Sets the initial block index
 	 * 
-	 * @param iniBlock
-	 *            - int
+	 * @param iniBlock - int
 	 */
 	private void setIniBlock(int iniBlock) {
 		this.iniBlock = iniBlock;
 	}
-
+	
+	
 	/**
 	 * Returns the start block index
 	 * 
@@ -151,17 +136,18 @@
 	public int getStartBlock() {
 		return startBlock;
 	}
-
+	
+	
 	/**
 	 * Sets the start block index
 	 * 
-	 * @param startBlock
-	 *            - int
+	 * @param startBlock - int
 	 */
 	private void setStartBlock(int startBlock) {
 		this.startBlock = startBlock;
 	}
-
+	
+	
 	/**
 	 * Returns the end block index
 	 * 
@@ -170,17 +156,18 @@
 	public int getEndBlock() {
 		return endBlock;
 	}
-
+	
+	
 	/**
 	 * Sets the end block index
 	 * 
-	 * @param endBlock
-	 *            - int
+	 * @param endBlock - int
 	 */
 	private void setEndBlock(int endBlock) {
 		this.endBlock = endBlock;
 	}
-
+	
+	
 	/**
 	 * Returns the start offset index
 	 * 
@@ -189,17 +176,18 @@
 	public int getStartOffset() {
 		return startOffset;
 	}
-
+	
+	
 	/**
 	 * Sets the start offset index
 	 * 
-	 * @param startOffset
-	 *            - int
+	 * @param startOffset - int
 	 */
 	private void setStartOffset(int startOffset) {
 		this.startOffset = startOffset;
 	}
-
+	
+	
 	/**
 	 * Returns the end offset index
 	 * 
@@ -208,12 +196,12 @@
 	public int getEndOffset() {
 		return endOffset;
 	}
-
+	
+	
 	/**
 	 * Sets the end offset index
 	 * 
-	 * @param endOffset
-	 *            - int
+	 * @param endOffset - int
 	 */
 	private void setEndOffset(int endOffset) {
 		this.endOffset = endOffset;
Index: tika-parsers/src/main/java/org/apache/tika/parsers/chm/exception/ChmParsingException.java
===================================================================
--- tika-parsers/src/main/java/org/apache/tika/parsers/chm/exception/ChmParsingException.java	(revision 1133479)
+++ tika-parsers/src/main/java/org/apache/tika/parsers/chm/exception/ChmParsingException.java	(working copy)
@@ -16,14 +16,14 @@
  */
 package org.apache.tika.parser.chm.exception;
 
-public class ChmParsingException extends RuntimeException {
+public class ChmParsingException extends RuntimeException{
 	private static final long serialVersionUID = 6497936044733665210L;
-
-	public ChmParsingException() {
+	
+	public ChmParsingException(){
 		super();
 	}
-
-	public ChmParsingException(String description) {
+	
+	public ChmParsingException(String description){
 		super(description);
 	}
 }
Index: tika-bundle-it/pom.xml
===================================================================
--- tika-bundle-it/pom.xml	(revision 1133479)
+++ tika-bundle-it/pom.xml	(working copy)
@@ -25,7 +25,7 @@
   <parent>
     <groupId>org.apache.tika</groupId>
     <artifactId>tika-parent</artifactId>
-    <version>0.9-SNAPSHOT</version>
+    <version>1.0-SNAPSHOT</version>
     <relativePath>../tika-parent/pom.xml</relativePath>
   </parent>
 
