tag r1873869 as 4.1.2

git-svn-id: https://svn.apache.org/repos/asf/poi/tags/REL_4_1_2@1873870 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/jenkins/create_jobs.groovy b/jenkins/create_jobs.groovy
index 29d64ee..9b8cb88 100644
--- a/jenkins/create_jobs.groovy
+++ b/jenkins/create_jobs.groovy
@@ -10,7 +10,7 @@
 H H * * 0
 '''
 
-def xercesUrl = 'http://repo1.maven.org/maven2/xerces/xercesImpl/2.6.1/xercesImpl-2.6.1.jar'
+def xercesUrl = 'https://repo1.maven.org/maven2/xerces/xercesImpl/2.6.1/xercesImpl-2.6.1.jar'
 def xercesLib = './xercesImpl-2.6.1.jar'
 
 def poijobs = [
diff --git a/legal/NOTICE b/legal/NOTICE
index b753523..cb1d700 100644
--- a/legal/NOTICE
+++ b/legal/NOTICE
@@ -1,5 +1,5 @@
 Apache POI
-Copyright 2003-2019 The Apache Software Foundation
+Copyright 2003-2020 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (https://www.apache.org/).
@@ -17,7 +17,7 @@
 This product contains the chunks_parse_cmds.tbl file from the vsdump program.
 Copyright (C) 2006-2007 Valek Filippov (frob@df.ru)
 
-This product contains parts of the eID Applet project 
+This product contains parts of the eID Applet project
 <http://eid-applet.googlecode.com> and <https://github.com/e-Contract/eid-applet>.
 Copyright (c) 2009-2014
 FedICT (federal ICT department of Belgium), e-Contract.be BVBA (https://www.e-contract.be),
diff --git a/osgi/build.xml b/osgi/build.xml
index 24a0688..3176722 100644
--- a/osgi/build.xml
+++ b/osgi/build.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- 
+<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
@@ -25,7 +25,7 @@
     <property name="bundle.lib" location="osgi/lib"/>
 
     <!-- TODO Import these from the parent build file -->
-    <property name="repository.m2" value="http://repo1.maven.org"/>
+    <property name="repository.m2" value="https://repo1.maven.org"/>
     <property name="version.id" value="4.1.2-SNAPSHOT"/>
     <property name="dist.dir" value="build/dist"/>
 
@@ -54,13 +54,13 @@
     <target name="bundle" depends="init, check-bundle-jars, fetch-bundle-jars">
         <taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${bundle.bnd.jar}"/>
         <mkdir dir="build/osgi"/>
-        <bnd 
+        <bnd
            classpath="${dist.dir}/poi-${version.id}-${DSTAMP}.jar,${dist.dir}/poi-scratchpad-${version.id}-${DSTAMP}.jar,${dist.dir}/poi-ooxml-${version.id}-${DSTAMP}.jar"
-           eclipse="false" 
-           failok="false" 
-           exceptions="true" 
+           eclipse="false"
+           failok="false"
+           exceptions="true"
            output="build/osgi"
-           files="test.bnd"/> 
+           files="test.bnd"/>
         <!-- TODO Include the settings from http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/poi-3.9/pom.xml -->
         <!-- TODO Make this actually spit out an OSGi Jar -->
     </target>
diff --git a/src/integrationtest/org/apache/poi/TestAllFiles.java b/src/integrationtest/org/apache/poi/TestAllFiles.java
index 8f9ba82..7a57398 100644
--- a/src/integrationtest/org/apache/poi/TestAllFiles.java
+++ b/src/integrationtest/org/apache/poi/TestAllFiles.java
@@ -327,6 +327,7 @@
         "spreadsheet/testEXCEL_95.xls",
         "spreadsheet/59074.xls",
         "spreadsheet/60284.xls",
+        "spreadsheet/64130.xls",
 
         // OOXML Strict is not yet supported, see bug #57699
         "spreadsheet/SampleSS.strict.xlsx",
diff --git a/src/java/org/apache/poi/hssf/record/OldSheetRecord.java b/src/java/org/apache/poi/hssf/record/OldSheetRecord.java
index 6c0e81c..2abec6c 100644
--- a/src/java/org/apache/poi/hssf/record/OldSheetRecord.java
+++ b/src/java/org/apache/poi/hssf/record/OldSheetRecord.java
@@ -47,15 +47,17 @@
         field_2_visibility = in.readUByte();
         field_3_type = in.readUByte();
         int field_4_sheetname_length = in.readUByte();
-        in.mark(1);
-        byte b = in.readByte();
-        // if the sheet name starts with a 0, we need to skip one byte, otherwise the following records will
-        // fail with a LeftOverDataException
-        if (b != 0) {
-            try {
-                in.reset();
-            } catch (IOException e) {
-                throw new RecordFormatException(e);
+        if (field_4_sheetname_length > 0) {
+            in.mark(1);
+            byte b = in.readByte();
+            // if the sheet name starts with a 0, we need to skip one byte, otherwise the following records will
+            // fail with a LeftOverDataException
+            if (b != 0) {
+                try {
+                    in.reset();
+                } catch (IOException e) {
+                    throw new RecordFormatException(e);
+                }
             }
         }
         field_5_sheetname = IOUtils.safelyAllocate(field_4_sheetname_length, MAX_RECORD_LENGTH);
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java
index f493036..17b43f0 100644
--- a/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java
+++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffDrawingToXml.java
@@ -45,6 +45,7 @@
         EXCLUDED.put("43493.xls", RecordInputStream.LeftoverDataException.class);  // HSSFWorkbook cannot open it as well
         EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class);
         EXCLUDED.put("61300.xls", RecordFormatException.class);
+        EXCLUDED.put("64130.xls", OldExcelFormatException.class); // BIFF 5
     }
 	
 	@Override
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java
index a62431b..82a4632 100644
--- a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java
+++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java
@@ -54,6 +54,7 @@
         EXCLUDED.put("50833.xls", IllegalArgumentException.class);       // "Name is too long" when setting username
         EXCLUDED.put("XRefCalc.xls", RuntimeException.class);            // "Buffer overrun"
         EXCLUDED.put("61300.xls", RecordFormatException.class);
+        EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5
     }
 
     @Override
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java
index 3daf938..a24b496 100644
--- a/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java
+++ b/src/testcases/org/apache/poi/hssf/dev/TestEFBiffViewer.java
@@ -47,6 +47,7 @@
         EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class);
         EXCLUDED.put("XRefCalc.xls", RuntimeException.class);            // "Buffer overrun"
         EXCLUDED.put("61300.xls", RecordFormatException.class);
+        EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5
     }
 	
 	@Override
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java
index e94d55d..ec69abb 100644
--- a/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java
+++ b/src/testcases/org/apache/poi/hssf/dev/TestFormulaViewer.java
@@ -47,6 +47,7 @@
         EXCLUDED.put("43493.xls", RecordInputStream.LeftoverDataException.class);  // HSSFWorkbook cannot open it as well
         EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class);
         EXCLUDED.put("61300.xls", RecordFormatException.class);
+        EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5
     }
 	
     @Override
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java
index a8d5987..97b84e2 100644
--- a/src/testcases/org/apache/poi/hssf/dev/TestReSave.java
+++ b/src/testcases/org/apache/poi/hssf/dev/TestReSave.java
@@ -51,6 +51,7 @@
         EXCLUDED.put("44958_1.xls", RecordInputStream.LeftoverDataException.class);
         EXCLUDED.put("XRefCalc.xls", RuntimeException.class);            // "Buffer overrun"
         EXCLUDED.put("61300.xls", RecordFormatException.class);
+        EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5
     }
 
 	@Override
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java
index ec7cd8c..f158013 100644
--- a/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java
+++ b/src/testcases/org/apache/poi/hssf/dev/TestRecordLister.java
@@ -38,7 +38,7 @@
         EXCLUDED.put("60284.xls", OldExcelFormatException.class); // Biff 5 / Excel 5
         EXCLUDED.put("testEXCEL_95.xls", OldExcelFormatException.class); // Biff 5 / Excel 95
         EXCLUDED.put("61300.xls", RecordFormatException.class);
-
+        EXCLUDED.put("64130.xls", OldExcelFormatException.class); //Biff 5
     }
 	
 	@Override
diff --git a/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java b/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
index 1ce8a92..6403fe4 100644
--- a/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
+++ b/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
@@ -267,6 +267,10 @@
 
     @Test
     public void testInputStreamNPOIHeader() throws IOException {
+        //TODO: the worksheet names are currently mangled.  They're treated
+        //as if UTF-16, but they're just ascii.  Need to fix this.
+        //Is it possible that the leading 0 byte in the worksheet name is a signal
+        //that these worksheet names should be interpreted as ascii/1252?
         File file = HSSFTestDataSamples.getSampleFile("FormulaRefs.xls");
         try (InputStream stream = new FileInputStream(file);
              OldExcelExtractor extractor = new OldExcelExtractor(stream)) {
@@ -350,6 +354,17 @@
         }
     }
 
+    @Test
+    public void testSheetWithNoName() throws IOException {
+        File file = HSSFTestDataSamples.getSampleFile("64130.xls");
+
+        try (OldExcelExtractor ex = new OldExcelExtractor(file)) {
+            assertEquals(5, ex.getBiffVersion());
+            assertEquals(5, ex.getFileType());
+            assertContains(ex.getText(), "Dawn");
+        }
+    }
+
     private static class NoExitSecurityManager extends SecurityManager {
         @Override
         public void checkPermission(Permission perm) {
diff --git a/test-data/spreadsheet/64130.xls b/test-data/spreadsheet/64130.xls
new file mode 100644
index 0000000..9d7d42d
--- /dev/null
+++ b/test-data/spreadsheet/64130.xls
Binary files differ