View | Details | Raw Unified | Return to bug 53972
Collapse All | Expand All

(-)a/src/java/org/apache/poi/hssf/model/RecordOrderer.java (+1 lines)
Lines 344-349 final class RecordOrderer { Link Here
344
		switch(sid) {
344
		switch(sid) {
345
			case UnknownRecord.SHEETEXT_0862:
345
			case UnknownRecord.SHEETEXT_0862:
346
			case UnknownRecord.SHEETPROTECTION_0867:
346
			case UnknownRecord.SHEETPROTECTION_0867:
347
			case UnknownRecord.PLV_MAC:
347
			case FeatRecord.sid:
348
			case FeatRecord.sid:
348
			case EOFRecord.sid:
349
			case EOFRecord.sid:
349
				return true;
350
				return true;
(-)a/src/java/org/apache/poi/hssf/record/UnknownRecord.java (-1 / +2 lines)
Lines 57-63 public final class UnknownRecord extends StandardRecord { Link Here
57
	public static final int SHEETEXT_0862        = 0x0862; // OOO calls this SHEETLAYOUT
57
	public static final int SHEETEXT_0862        = 0x0862; // OOO calls this SHEETLAYOUT
58
	public static final int SHEETPROTECTION_0867 = 0x0867;
58
	public static final int SHEETPROTECTION_0867 = 0x0867;
59
	public static final int HEADER_FOOTER_089C   = 0x089C;
59
	public static final int HEADER_FOOTER_089C   = 0x089C;
60
    public static final int CODENAME_1BA         = 0x01BA;
60
	public static final int CODENAME_1BA         = 0x01BA;
61
	public static final int PLV_MAC              = 0x08C8;
61
62
62
	private int _sid;
63
	private int _sid;
63
	private byte[] _rawData;
64
	private byte[] _rawData;
(-)a/src/testcases/org/apache/poi/hssf/record/AllRecordTests.java (+1 lines)
Lines 77-82 public final class AllRecordTests { Link Here
77
		result.addTestSuite(TestObjRecord.class);
77
		result.addTestSuite(TestObjRecord.class);
78
		result.addTestSuite(TestPaletteRecord.class);
78
		result.addTestSuite(TestPaletteRecord.class);
79
		result.addTestSuite(TestPaneRecord.class);
79
		result.addTestSuite(TestPaneRecord.class);
80
		result.addTestSuite(TestPLVRecord.class);
80
		result.addTestSuite(TestRecalcIdRecord.class);
81
		result.addTestSuite(TestRecalcIdRecord.class);
81
		result.addTestSuite(TestRecordFactory.class);
82
		result.addTestSuite(TestRecordFactory.class);
82
		result.addTestSuite(TestRecordFactoryInputStream.class);
83
		result.addTestSuite(TestRecordFactoryInputStream.class);
(-)a/src/testcases/org/apache/poi/hssf/record/TestPLVRecord.java (+59 lines)
Line 0 Link Here
1
/* ====================================================================
2
   Licensed to the Apache Software Foundation (ASF) under one or more
3
   contributor license agreements.  See the NOTICE file distributed with
4
   this work for additional information regarding copyright ownership.
5
   The ASF licenses this file to You under the Apache License, Version 2.0
6
   (the "License"); you may not use this file except in compliance with
7
   the License.  You may obtain a copy of the License at
8
9
       http://www.apache.org/licenses/LICENSE-2.0
10
11
   Unless required by applicable law or agreed to in writing, software
12
   distributed under the License is distributed on an "AS IS" BASIS,
13
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
   See the License for the specific language governing permissions and
15
   limitations under the License.
16
==================================================================== */
17
18
package org.apache.poi.hssf.record;
19
20
import junit.framework.AssertionFailedError;
21
import junit.framework.TestCase;
22
import org.apache.poi.hssf.HSSFTestDataSamples;
23
import org.apache.poi.hssf.usermodel.DVConstraint;
24
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
25
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
26
import org.apache.poi.ss.usermodel.DataValidationConstraint;
27
import org.apache.poi.ss.util.CellRangeAddressList;
28
29
import java.io.InputStream;
30
31
/**
32
 * Verify that presence of PLV record doesn't break data
33
 * validation, bug #53972:
34
 * https://issues.apache.org/bugzilla/show_bug.cgi?id=53972
35
 *
36
 * @author Andrew Novikov
37
 */
38
39
public final class TestPLVRecord extends TestCase {
40
    private final static String DV_DEFINITION = "$A$1:$A$5";
41
    private final static String XLS_FILENAME = "53972.xls";
42
    private final static String SHEET_NAME = "S2";
43
44
    public void testPLVRecord() throws Exception {
45
        InputStream is = HSSFTestDataSamples.openSampleFileStream(XLS_FILENAME);
46
        HSSFWorkbook workbook = new HSSFWorkbook(is);
47
48
        CellRangeAddressList cellRange = new CellRangeAddressList(0, 0, 1, 1);
49
        DataValidationConstraint constraint = DVConstraint.createFormulaListConstraint(DV_DEFINITION);
50
        HSSFDataValidation dataValidation = new HSSFDataValidation(cellRange, constraint);
51
52
        // This used to throw an error before
53
        try {
54
            workbook.getSheet(SHEET_NAME).addValidationData(dataValidation);
55
        } catch (IllegalStateException ex) {
56
            throw new AssertionFailedError("Identified bug 53972, PLV record breaks addDataValidation()");
57
        }
58
    }
59
}

Return to bug 53972