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

(-)sonar/main/pom.xml (+5 lines)
Lines 126-131 Link Here
126
            <version>1.13</version>
126
            <version>1.13</version>
127
        </dependency>
127
        </dependency>
128
        <dependency>
128
        <dependency>
129
            <groupId>com.zaxxer</groupId>
130
            <artifactId>SparseBitSet</artifactId>
131
            <version>1.2</version>
132
        </dependency>
133
        <dependency>
129
            <groupId>commons-logging</groupId>
134
            <groupId>commons-logging</groupId>
130
            <artifactId>commons-logging</artifactId>
135
            <artifactId>commons-logging</artifactId>
131
            <version>1.2</version>
136
            <version>1.2</version>
(-)maven/poi.pom (+5 lines)
Lines 88-93 Link Here
88
      <artifactId>commons-math3</artifactId>
88
      <artifactId>commons-math3</artifactId>
89
      <version>3.6.1</version>
89
      <version>3.6.1</version>
90
    </dependency>
90
    </dependency>
91
    <dependency>
92
      <groupId>com.zaxxer</groupId>
93
      <artifactId>SparseBitSet</artifactId>
94
      <version>1.2</version>
95
    </dependency>
91
96
92
    <dependency>
97
    <dependency>
93
      <groupId>org.hamcrest</groupId>
98
      <groupId>org.hamcrest</groupId>
(-)src/documentation/content/xdocs/changes.xml (+1 lines)
Lines 88-93 Link Here
88
88
89
    <release version="4.1.2" date="2020-01-??">
89
    <release version="4.1.2" date="2020-01-??">
90
      <actions>
90
      <actions>
91
        <action dev="PD" type="fix" fixes-bug="64015" context="POI_Overall">Swap zaxxer.com:SparseBitSet for java.util.BitSet</action>
91
        <action dev="PD" type="fix" fixes-bug="63918" context="SL_Common XSLF">Fix texture fill - scale stretched images correctly</action>
92
        <action dev="PD" type="fix" fixes-bug="63918" context="SL_Common XSLF">Fix texture fill - scale stretched images correctly</action>
92
        <action dev="PD" type="add" context="XSLF">Add, insert and remove columns on XSLFTable</action>
93
        <action dev="PD" type="add" context="XSLF">Add, insert and remove columns on XSLFTable</action>
93
        <action dev="PD" type="fix" fixes-bug="63889" context="XDDF">Produce valid PPTX file with several chart series</action>
94
        <action dev="PD" type="fix" fixes-bug="63889" context="XDDF">Produce valid PPTX file with several chart series</action>
(-)build.gradle (+2 lines)
Lines 185-190 Link Here
185
        compile 'com.sun.xml.bind:jaxb-impl:2.3.2'
185
        compile 'com.sun.xml.bind:jaxb-impl:2.3.2'
186
        compile 'com.sun.xml.bind:jaxb-core:2.3.0.1'
186
        compile 'com.sun.xml.bind:jaxb-core:2.3.0.1'
187
        compile 'javax.activation:activation:1.1.1'
187
        compile 'javax.activation:activation:1.1.1'
188
        compile 'com.zaxxer:SparseBitSet:1.2'
188
189
189
        testCompile 'junit:junit:4.12'
190
        testCompile 'junit:junit:4.12'
190
        testCompile 'org.mockito:mockito-core:3.0.0'
191
        testCompile 'org.mockito:mockito-core:3.0.0'
Lines 236-241 Link Here
236
        compile 'org.apache.santuario:xmlsec:2.1.2'
237
        compile 'org.apache.santuario:xmlsec:2.1.2'
237
        compile 'org.bouncycastle:bcpkix-jdk15on:1.62'
238
        compile 'org.bouncycastle:bcpkix-jdk15on:1.62'
238
        compile 'com.github.virtuald:curvesapi:1.06'
239
        compile 'com.github.virtuald:curvesapi:1.06'
240
        compile 'com.zaxxer:SparseBitSet:1.2'
239
241
240
        // compile only, don't add it to our dist as it blows up the size
242
        // compile only, don't add it to our dist as it blows up the size
241
        compile 'org.apache.xmlgraphics:batik-all:1.11'
243
        compile 'org.apache.xmlgraphics:batik-all:1.11'
(-)build.xml (+8 lines)
Lines 218-223 Link Here
218
    <property name="main.activation.jar" location="${main.lib}/activation-1.1.1.jar"/>
218
    <property name="main.activation.jar" location="${main.lib}/activation-1.1.1.jar"/>
219
    <property name="main.activation.url"
219
    <property name="main.activation.url"
220
              value="${repository.m2}/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
220
              value="${repository.m2}/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
221
    <property name="main.com.zaxxer.jar" location="${main.lib}/SparseBitSet-1.2.jar"/>
222
    <property name="main.com.zaxxer.url"
223
              value="${repository.m2}/maven2/com/zaxxer/SparseBitSet/1.2/SparseBitSet-1.2.jar"/>
221
224
222
    <!-- xml signature libs -->
225
    <!-- xml signature libs -->
223
    <property name="dsig.xmlsec.jar" location="${compile.lib}/xmlsec-2.1.2.jar"/>
226
    <property name="dsig.xmlsec.jar" location="${compile.lib}/xmlsec-2.1.2.jar"/>
Lines 378-383 Link Here
378
        <pathelement location="${main.xmlbind-impl.jar}"/>
381
        <pathelement location="${main.xmlbind-impl.jar}"/>
379
        <pathelement location="${main.xmlbind-core.jar}"/>
382
        <pathelement location="${main.xmlbind-core.jar}"/>
380
        <pathelement location="${main.activation.jar}"/>
383
        <pathelement location="${main.activation.jar}"/>
384
        <pathelement location="${main.com.zaxxer.jar}"/>
381
    </path>
385
    </path>
382
386
383
    <!-- some libraries should only be required for compiling/running tests -->
387
    <!-- some libraries should only be required for compiling/running tests -->
Lines 753-758 Link Here
753
                    <available file="${main.xmlbind-impl.jar}"/>
757
                    <available file="${main.xmlbind-impl.jar}"/>
754
                    <available file="${main.xmlbind-core.jar}"/>
758
                    <available file="${main.xmlbind-core.jar}"/>
755
                    <available file="${main.activation.jar}"/>
759
                    <available file="${main.activation.jar}"/>
760
                    <available file="${main.com.zaxxer.jar}"/>
756
761
757
                    <!-- we had some CI failures when the extracted files for JaCoCo were missing somehow... -->
762
                    <!-- we had some CI failures when the extracted files for JaCoCo were missing somehow... -->
758
                    <available file="${main.lib}/jacocoagent.jar"/>
763
                    <available file="${main.lib}/jacocoagent.jar"/>
Lines 789-794 Link Here
789
        <downloadfile src="${main.xmlbind-impl.url}" dest="${main.xmlbind-impl.jar}"/>
794
        <downloadfile src="${main.xmlbind-impl.url}" dest="${main.xmlbind-impl.jar}"/>
790
        <downloadfile src="${main.xmlbind-core.url}" dest="${main.xmlbind-core.jar}"/>
795
        <downloadfile src="${main.xmlbind-core.url}" dest="${main.xmlbind-core.jar}"/>
791
        <downloadfile src="${main.activation.url}" dest="${main.activation.jar}"/>
796
        <downloadfile src="${main.activation.url}" dest="${main.activation.jar}"/>
797
        <downloadfile src="${main.com.zaxxer.url}" dest="${main.com.zaxxer.jar}"/>
792
        <unzip src="${jacoco.zip}" dest=".">
798
        <unzip src="${jacoco.zip}" dest=".">
793
            <patternset>
799
            <patternset>
794
                <include name="lib/*.jar"/>
800
                <include name="lib/*.jar"/>
Lines 2039-2044 Link Here
2039
                    <include name="activation-*.jar"/>
2045
                    <include name="activation-*.jar"/>
2040
                    <include name="junit-*.jar"/>
2046
                    <include name="junit-*.jar"/>
2041
                    <include name="log4j-*.jar"/>
2047
                    <include name="log4j-*.jar"/>
2048
                    <include name="SparseBitSet-*.jar"/>
2042
                </fileset>
2049
                </fileset>
2043
                <globmapper from="*" to="${zipdir}/lib/*"/>
2050
                <globmapper from="*" to="${zipdir}/lib/*"/>
2044
            </mappedresources>
2051
            </mappedresources>
Lines 2321-2326 Link Here
2321
            <auxClasspath path="${main.xmlbind-impl.jar}" />
2328
            <auxClasspath path="${main.xmlbind-impl.jar}" />
2322
            <auxClasspath path="${main.xmlbind-core.jar}" />
2329
            <auxClasspath path="${main.xmlbind-core.jar}" />
2323
            <auxClasspath path="${main.activation.jar}" />
2330
            <auxClasspath path="${main.activation.jar}" />
2331
            <auxClasspath path="${main.com.zaxxer.jar}" />
2324
            <auxClasspath path="${svg.batik-all.jar}"/>
2332
            <auxClasspath path="${svg.batik-all.jar}"/>
2325
            <auxClasspath path="${svg.xml-apis-ext.jar}"/>
2333
            <auxClasspath path="${svg.xml-apis-ext.jar}"/>
2326
            <auxClasspath path="${svg.xmlgraphics-commons.jar}"/>
2334
            <auxClasspath path="${svg.xmlgraphics-commons.jar}"/>
(-)src/java/org/apache/poi/poifs/crypt/xor/XOREncryptor.java (-1 / +2 lines)
Lines 26-31 Link Here
26
import javax.crypto.Cipher;
26
import javax.crypto.Cipher;
27
import javax.crypto.spec.SecretKeySpec;
27
import javax.crypto.spec.SecretKeySpec;
28
28
29
import com.zaxxer.sparsebits.SparseBitSet;
29
import org.apache.poi.EncryptedDocumentException;
30
import org.apache.poi.EncryptedDocumentException;
30
import org.apache.poi.poifs.crypt.ChunkedCipherOutputStream;
31
import org.apache.poi.poifs.crypt.ChunkedCipherOutputStream;
31
import org.apache.poi.poifs.crypt.CryptoFunctions;
32
import org.apache.poi.poifs.crypt.CryptoFunctions;
Lines 136-142 Link Here
136
137
137
            final int start = Math.max(posInChunk-(recordEnd-recordStart), 0);
138
            final int start = Math.max(posInChunk-(recordEnd-recordStart), 0);
138
139
139
            final BitSet plainBytes = getPlainByteFlags();
140
            final SparseBitSet plainBytes = getPlainByteFlags();
140
            final byte[] xorArray = getEncryptionInfo().getEncryptor().getSecretKey().getEncoded();
141
            final byte[] xorArray = getEncryptionInfo().getEncryptor().getSecretKey().getEncoded();
141
            final byte[] chunk = getChunk();
142
            final byte[] chunk = getChunk();
142
            final byte[] plain = (plainBytes.isEmpty()) ? null : chunk.clone();
143
            final byte[] plain = (plainBytes.isEmpty()) ? null : chunk.clone();
(-)src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java (-4 / +5 lines)
Lines 32-37 Link Here
32
import javax.crypto.IllegalBlockSizeException;
32
import javax.crypto.IllegalBlockSizeException;
33
import javax.crypto.ShortBufferException;
33
import javax.crypto.ShortBufferException;
34
34
35
import com.zaxxer.sparsebits.SparseBitSet;
35
import org.apache.poi.EncryptedDocumentException;
36
import org.apache.poi.EncryptedDocumentException;
36
import org.apache.poi.poifs.filesystem.DirectoryNode;
37
import org.apache.poi.poifs.filesystem.DirectoryNode;
37
import org.apache.poi.poifs.filesystem.POIFSWriterEvent;
38
import org.apache.poi.poifs.filesystem.POIFSWriterEvent;
Lines 56-62 Link Here
56
    private final int chunkBits;
57
    private final int chunkBits;
57
58
58
    private final byte[] chunk;
59
    private final byte[] chunk;
59
    private final BitSet plainByteFlags;
60
    private final SparseBitSet plainByteFlags;
60
    private final File fileOut;
61
    private final File fileOut;
61
    private final DirectoryNode dir;
62
    private final DirectoryNode dir;
62
63
Lines 74-80 Link Here
74
        this.chunkSize = chunkSize;
75
        this.chunkSize = chunkSize;
75
        int cs = chunkSize == STREAMING ? 4096 : chunkSize;
76
        int cs = chunkSize == STREAMING ? 4096 : chunkSize;
76
        this.chunk = IOUtils.safelyAllocate(cs, MAX_RECORD_LENGTH);
77
        this.chunk = IOUtils.safelyAllocate(cs, MAX_RECORD_LENGTH);
77
        this.plainByteFlags = new BitSet(cs);
78
        this.plainByteFlags = new SparseBitSet(cs);
78
        this.chunkBits = Integer.bitCount(cs-1);
79
        this.chunkBits = Integer.bitCount(cs-1);
79
        this.fileOut = TempFile.createTempFile("encrypted_package", "crypt");
80
        this.fileOut = TempFile.createTempFile("encrypted_package", "crypt");
80
        this.fileOut.deleteOnExit();
81
        this.fileOut.deleteOnExit();
Lines 88-94 Link Here
88
        this.chunkSize = chunkSize;
89
        this.chunkSize = chunkSize;
89
        int cs = chunkSize == STREAMING ? 4096 : chunkSize;
90
        int cs = chunkSize == STREAMING ? 4096 : chunkSize;
90
        this.chunk = IOUtils.safelyAllocate(cs, MAX_RECORD_LENGTH);
91
        this.chunk = IOUtils.safelyAllocate(cs, MAX_RECORD_LENGTH);
91
        this.plainByteFlags = new BitSet(cs);
92
        this.plainByteFlags = new SparseBitSet(cs);
92
        this.chunkBits = Integer.bitCount(cs-1);
93
        this.chunkBits = Integer.bitCount(cs-1);
93
        this.fileOut = null;
94
        this.fileOut = null;
94
        this.dir = null;
95
        this.dir = null;
Lines 283-289 Link Here
283
        return chunk;
284
        return chunk;
284
    }
285
    }
285
286
286
    protected BitSet getPlainByteFlags() {
287
    protected SparseBitSet getPlainByteFlags() {
287
        return plainByteFlags;
288
        return plainByteFlags;
288
    }
289
    }
289
290
(-)src/java/org/apache/poi/ddf/EscherDggRecord.java (-1 / +2 lines)
Lines 24-29 Link Here
24
import java.util.Map;
24
import java.util.Map;
25
import java.util.function.Supplier;
25
import java.util.function.Supplier;
26
26
27
import com.zaxxer.sparsebits.SparseBitSet;
27
import org.apache.poi.common.usermodel.GenericRecord;
28
import org.apache.poi.common.usermodel.GenericRecord;
28
import org.apache.poi.util.GenericRecordUtil;
29
import org.apache.poi.util.GenericRecordUtil;
29
import org.apache.poi.util.LittleEndian;
30
import org.apache.poi.util.LittleEndian;
Lines 301-307 Link Here
301
     * @return the next available drawing group id
302
     * @return the next available drawing group id
302
     */
303
     */
303
    public short findNewDrawingGroupId() {
304
    public short findNewDrawingGroupId() {
304
        BitSet bs = new BitSet();
305
        SparseBitSet bs = new SparseBitSet();
305
        bs.set(0);
306
        bs.set(0);
306
        for (FileIdCluster fic : field_5_fileIdClusters) {
307
        for (FileIdCluster fic : field_5_fileIdClusters) {
307
            bs.set(fic.getDrawingGroupId());
308
            bs.set(fic.getDrawingGroupId());
(-)src/java/org/apache/poi/sl/extractor/SlideShowExtractor.java (+27 lines)
Lines 25-30 Link Here
25
import java.util.function.Function;
25
import java.util.function.Function;
26
import java.util.function.Predicate;
26
import java.util.function.Predicate;
27
27
28
import com.zaxxer.sparsebits.SparseBitSet;
28
import org.apache.poi.extractor.POITextExtractor;
29
import org.apache.poi.extractor.POITextExtractor;
29
import org.apache.poi.sl.usermodel.MasterSheet;
30
import org.apache.poi.sl.usermodel.MasterSheet;
30
import org.apache.poi.sl.usermodel.Notes;
31
import org.apache.poi.sl.usermodel.Notes;
Lines 382-388 Link Here
382
     * @param bold use {@code true} for bold TextRuns, {@code false} for non-bold ones and
383
     * @param bold use {@code true} for bold TextRuns, {@code false} for non-bold ones and
383
     *      {@code null} if it doesn't matter
384
     *      {@code null} if it doesn't matter
384
     * @return a bitset with the marked/used codepoints
385
     * @return a bitset with the marked/used codepoints
386
     * @deprecated use {@link #getCodepointsInSparseBitSet(String, Boolean, Boolean)}
385
     */
387
     */
388
    @Deprecated
386
    public BitSet getCodepoints(String typeface, Boolean italic, Boolean bold) {
389
    public BitSet getCodepoints(String typeface, Boolean italic, Boolean bold) {
387
        final BitSet glyphs = new BitSet();
390
        final BitSet glyphs = new BitSet();
388
391
Lines 399-404 Link Here
399
        return glyphs;
402
        return glyphs;
400
    }
403
    }
401
404
405
    /**
406
     * Extract the used codepoints for font embedding / subsetting
407
     * @param typeface the typeface/font family of the textruns to examine
408
     * @param italic use {@code true} for italic TextRuns, {@code false} for non-italic ones and
409
     *      {@code null} if it doesn't matter
410
     * @param bold use {@code true} for bold TextRuns, {@code false} for non-bold ones and
411
     *      {@code null} if it doesn't matter
412
     * @return a bitset with the marked/used codepoints
413
     */
414
    public SparseBitSet getCodepointsInSparseBitSet(String typeface, Boolean italic, Boolean bold) {
415
        final SparseBitSet glyphs = new SparseBitSet();
416
417
        Predicate<Object> filterOld = filter;
418
        try {
419
            filter = o -> filterFonts(o, typeface, italic, bold);
420
            slideshow.getSlides().forEach(slide ->
421
                    getText(slide, s -> s.codePoints().forEach(glyphs::set))
422
            );
423
        } finally {
424
            filter = filterOld;
425
        }
426
427
        return glyphs;
428
    }
402
    private static boolean filterFonts(Object o, String typeface, Boolean italic, Boolean bold) {
429
    private static boolean filterFonts(Object o, String typeface, Boolean italic, Boolean bold) {
403
        if (!(o instanceof TextRun)) {
430
        if (!(o instanceof TextRun)) {
404
            return false;
431
            return false;
(-)src/java/org/apache/poi/ss/format/CellNumberFormatter.java (-1 / +2 lines)
Lines 30-35 Link Here
30
import java.util.Set;
30
import java.util.Set;
31
import java.util.TreeSet;
31
import java.util.TreeSet;
32
32
33
import com.zaxxer.sparsebits.SparseBitSet;
33
import org.apache.poi.util.LocaleUtil;
34
import org.apache.poi.util.LocaleUtil;
34
import org.apache.poi.util.POILogFactory;
35
import org.apache.poi.util.POILogFactory;
35
import org.apache.poi.util.POILogger;
36
import org.apache.poi.util.POILogger;
Lines 475-481 Link Here
475
        Iterator<CellNumberStringMod> changes = mods.iterator();
476
        Iterator<CellNumberStringMod> changes = mods.iterator();
476
        CellNumberStringMod nextChange = (changes.hasNext() ? changes.next() : null);
477
        CellNumberStringMod nextChange = (changes.hasNext() ? changes.next() : null);
477
        // records chars already deleted
478
        // records chars already deleted
478
        BitSet deletedChars = new BitSet();
479
        SparseBitSet deletedChars = new SparseBitSet();
479
        int adjust = 0;
480
        int adjust = 0;
480
        for (Special s : specials) {
481
        for (Special s : specials) {
481
            int adjustedPos = s.pos + adjust;
482
            int adjustedPos = s.pos + adjust;
(-)src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePartCollection.java (-2 / +10 lines)
Lines 28-33 Link Here
28
import java.util.regex.Matcher;
28
import java.util.regex.Matcher;
29
import java.util.regex.Pattern;
29
import java.util.regex.Pattern;
30
30
31
import com.zaxxer.sparsebits.SparseBitSet;
31
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
32
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
32
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;
33
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;
33
34
Lines 136-144 Link Here
136
            Matcher m = pattern.matcher(name);
137
            Matcher m = pattern.matcher(name);
137
            return m.matches() ? Integer.parseInt(m.group(1)) : 0;
138
            return m.matches() ? Integer.parseInt(m.group(1)) : 0;
138
        };
139
        };
139
        
140
140
        return packagePartLookup.keySet().stream()
141
        return packagePartLookup.keySet().stream()
141
            .mapToInt(indexFromName)
142
            .mapToInt(indexFromName)
142
            .collect(BitSet::new, BitSet::set, BitSet::or).nextClearBit(1);
143
            .collect(MySparseBitSet::new, MySparseBitSet::set, MySparseBitSet::myOr).nextClearBit(1);
143
    }
144
    }
145
    
146
    private class MySparseBitSet extends SparseBitSet {
147
148
		public void myOr(MySparseBitSet other) {
149
    		this.or(other);
150
		}
151
	}
144
}
152
}
(-)src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java (-1 / +2 lines)
Lines 34-39 Link Here
34
34
35
import javax.xml.namespace.QName;
35
import javax.xml.namespace.QName;
36
36
37
import com.zaxxer.sparsebits.SparseBitSet;
37
import org.apache.poi.ooxml.POIXMLDocumentPart;
38
import org.apache.poi.ooxml.POIXMLDocumentPart;
38
import org.apache.poi.ooxml.POIXMLException;
39
import org.apache.poi.ooxml.POIXMLException;
39
import org.apache.poi.openxml4j.opc.OPCPackage;
40
import org.apache.poi.openxml4j.opc.OPCPackage;
Lines 82-88 Link Here
82
    private Map<Integer, XSLFSimpleShape> _placeholderByIdMap;
83
    private Map<Integer, XSLFSimpleShape> _placeholderByIdMap;
83
    private Map<Integer, XSLFSimpleShape> _placeholderByTypeMap;
84
    private Map<Integer, XSLFSimpleShape> _placeholderByTypeMap;
84
85
85
    private final BitSet shapeIds = new BitSet();
86
    private final SparseBitSet shapeIds = new SparseBitSet();
86
87
87
    protected XSLFSheet() {
88
    protected XSLFSheet() {
88
        super();
89
        super();
(-)src/ooxml/java/org/apache/poi/xssf/binary/XSSFBHyperlinksTable.java (-2 / +2 lines)
Lines 21-33 Link Here
21
import java.io.InputStream;
21
import java.io.InputStream;
22
import java.io.Serializable;
22
import java.io.Serializable;
23
import java.util.ArrayList;
23
import java.util.ArrayList;
24
import java.util.BitSet;
25
import java.util.Comparator;
24
import java.util.Comparator;
26
import java.util.HashMap;
25
import java.util.HashMap;
27
import java.util.List;
26
import java.util.List;
28
import java.util.Map;
27
import java.util.Map;
29
import java.util.TreeMap;
28
import java.util.TreeMap;
30
29
30
import com.zaxxer.sparsebits.SparseBitSet;
31
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
31
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
32
import org.apache.poi.openxml4j.opc.PackagePart;
32
import org.apache.poi.openxml4j.opc.PackagePart;
33
import org.apache.poi.openxml4j.opc.PackageRelationship;
33
import org.apache.poi.openxml4j.opc.PackageRelationship;
Lines 43-49 Link Here
43
@Internal
43
@Internal
44
public class XSSFBHyperlinksTable {
44
public class XSSFBHyperlinksTable {
45
45
46
    private static final BitSet RECORDS = new BitSet();
46
    private static final SparseBitSet RECORDS = new SparseBitSet();
47
47
48
48
49
    static {
49
    static {
(-)src/ooxml/java/org/apache/poi/xssf/binary/XSSFBParser.java (-3 / +3 lines)
Lines 19-26 Link Here
19
19
20
import java.io.IOException;
20
import java.io.IOException;
21
import java.io.InputStream;
21
import java.io.InputStream;
22
import java.util.BitSet;
23
22
23
import com.zaxxer.sparsebits.SparseBitSet;
24
import org.apache.poi.util.IOUtils;
24
import org.apache.poi.util.IOUtils;
25
import org.apache.poi.util.Internal;
25
import org.apache.poi.util.Internal;
26
import org.apache.poi.util.LittleEndianInputStream;
26
import org.apache.poi.util.LittleEndianInputStream;
Lines 39-45 Link Here
39
    private static final int MAX_RECORD_LENGTH = 1_000_000;
39
    private static final int MAX_RECORD_LENGTH = 1_000_000;
40
40
41
    private final LittleEndianInputStream is;
41
    private final LittleEndianInputStream is;
42
    private final BitSet records;
42
    private final SparseBitSet records;
43
43
44
    public XSSFBParser(InputStream is) {
44
    public XSSFBParser(InputStream is) {
45
        this.is = new LittleEndianInputStream(is);
45
        this.is = new LittleEndianInputStream(is);
Lines 51-57 Link Here
51
     * @param is inputStream
51
     * @param is inputStream
52
     * @param bitSet call {@link #handleRecord(int, byte[])} only on those records in this bitSet
52
     * @param bitSet call {@link #handleRecord(int, byte[])} only on those records in this bitSet
53
     */
53
     */
54
    protected XSSFBParser(InputStream is, BitSet bitSet) {
54
    protected XSSFBParser(InputStream is, SparseBitSet bitSet) {
55
        this.is = new LittleEndianInputStream(is);
55
        this.is = new LittleEndianInputStream(is);
56
        records = bitSet;
56
        records = bitSet;
57
    }
57
    }
(-)src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFBReader.java (-1 / +2 lines)
Lines 28-33 Link Here
28
import java.util.List;
28
import java.util.List;
29
import java.util.Set;
29
import java.util.Set;
30
30
31
import com.zaxxer.sparsebits.SparseBitSet;
31
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
32
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
32
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
33
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
33
import org.apache.poi.openxml4j.opc.OPCPackage;
34
import org.apache.poi.openxml4j.opc.OPCPackage;
Lines 173-179 Link Here
173
174
174
175
175
    private static class PathExtractor extends XSSFBParser {
176
    private static class PathExtractor extends XSSFBParser {
176
        private static BitSet RECORDS = new BitSet();
177
        private static SparseBitSet RECORDS = new SparseBitSet();
177
        static {
178
        static {
178
            RECORDS.set(XSSFBRecordType.BrtAbsPath15.getId());
179
            RECORDS.set(XSSFBRecordType.BrtAbsPath15.getId());
179
        }
180
        }

Return to bug 64015