FasterXML / woodstox

@@ -46,7 +46,7 @@
Loading
46 46
 */
47 47
public final class AttributeCollector
48 48
{
49 -
    final static int INT_SPACE = 0x0020;
49 +
    protected final static int INT_SPACE = 0x0020;
50 50
51 51
    /**
52 52
     * Threshold value that indicates minimum length for lists instances
@@ -798,7 +798,7 @@
Loading
798 798
            mAttributes[0] = new Attribute(attrPrefix, attrLocalName, 0);
799 799
        } else {
800 800
            int valueStart = mValueBuilder.getCharSize();
801 -
            if (mAttrCount >= mAttributes.length) {
801 +
            if (mAttrCount >= mAttributes.length) { // lgtm [java/dereferenced-value-may-be-null]
802 802
                if ((mAttrCount + mNsCount) >= mMaxAttributesPerElement) {
803 803
                    throw new XMLStreamException("Attribute limit ("+mMaxAttributesPerElement+") exceeded");
804 804
                }
@@ -920,18 +920,17 @@
Loading
920 920
            mNamespaces[0] = new Attribute(null, prefix, 0);
921 921
        } else {
922 922
            int len = mNsCount;
923 -
            /* Ok: must ensure that there are no duplicate namespace
924 -
             * declarations (ie. decls with same prefix being bound)
925 -
             */
923 +
            // Ok: must ensure that there are no duplicate namespace
924 +
            // declarations (ie. decls with same prefix being bound)
926 925
            if (prefix != null) { // null == default ns
927 926
                for (int i = 0; i < len; ++i) {
928 927
                    // note: for ns decls, bound prefix is in 'local name'
929 -
                    if (prefix == mNamespaces[i].mLocalName) {
928 +
                    if (prefix == mNamespaces[i].mLocalName) { // lgtm [java/dereferenced-value-may-be-null]
930 929
                        return null;
931 930
                    }
932 931
                }
933 932
            }
934 -
            if (len >= mNamespaces.length) {
933 +
            if (len >= mNamespaces.length) { // lgtm [java/dereferenced-value-may-be-null]
935 934
                if ((mAttrCount + mNsCount) >= mMaxAttributesPerElement) {
936 935
                    throw new XMLStreamException("Attribute limit ("+mMaxAttributesPerElement+") exceeded");
937 936
                }
@@ -1000,15 +999,13 @@
Loading
1000 999
         */
1001 1000
        int[] map = mAttrMap;
1002 1001
1003 -
        /* What's minimum size to contain at most 80% full hash area,
1004 -
         * plus 1/8 spill area (12.5% spilled entries, two ints each)?
1005 -
         */
1002 +
        // What's minimum size to contain at most 80% full hash area,
1003 +
        // plus 1/8 spill area (12.5% spilled entries, two ints each)?
1006 1004
        int hashCount = 4;
1007 1005
        {
1008 1006
            int min = attrCount + (attrCount >> 2); // == 80% fill rate
1009 -
            /* Need to get 2^N size that can contain all elements, with
1010 -
             * 80% fill rate
1011 -
             */
1007 +
            // Need to get 2^N size that can contain all elements, with
1008 +
            // 80% fill rate
1012 1009
            while (hashCount < min) {
1013 1010
                hashCount += hashCount; // 2x
1014 1011
            }
@@ -1018,10 +1015,9 @@
Loading
1018 1015
            if (map == null || map.length < min) {
1019 1016
                map = new int[min];
1020 1017
            } else {
1021 -
                /* Need to clear old hash entries (if any). But note that
1022 -
                 * spilled entries we can leave alone -- they are just ints,
1023 -
                 * and get overwritten if and as needed
1024 -
                 */
1018 +
                // Need to clear old hash entries (if any). But note that
1019 +
                // spilled entries we can leave alone -- they are just ints,
1020 +
                // and get overwritten if and as needed
1025 1021
                Arrays.fill(map, 0, hashCount, 0);
1026 1022
            }
1027 1023
        }
@@ -1041,14 +1037,13 @@
Loading
1041 1037
                }
1042 1038
                int index = hash & mask;
1043 1039
                // Hash slot available?
1044 -
                if (map[index] == 0) {
1040 +
                if (map[index] == 0) { // lgtm [java/dereferenced-value-may-be-null]
1045 1041
                    map[index] = i+1; // since 0 is marker
1046 1042
                } else {
1047 1043
                    int currIndex = map[index]-1;
1048 -
                    /* nope, need to spill; let's extract most of that code to
1049 -
                     * a separate method for clarity (and maybe it'll be
1050 -
                     * easier to inline by JVM too)
1051 -
                     */
1044 +
                    // nope, need to spill; let's extract most of that code to
1045 +
                    // a separate method for clarity (and maybe it'll be
1046 +
                    // easier to inline by JVM too)
1052 1047
                    map = spillAttr(uri, name, map, currIndex, spillIndex,
1053 1048
                                    hash, hashCount);
1054 1049
                    if (map == null) {

@@ -18,9 +18,9 @@
Loading
18 18
    extends DTDAttribute
19 19
{
20 20
    /*
21 -
    ///////////////////////////////////////////////////
21 +
    ///////////////////////////////////////////////////////////////////////
22 22
    // Life-cycle
23 -
    ///////////////////////////////////////////////////
23 +
    ///////////////////////////////////////////////////////////////////////
24 24
     */
25 25
26 26
    /**
@@ -44,9 +44,9 @@
Loading
44 44
    }
45 45
46 46
    /*
47 -
    ///////////////////////////////////////////////////
47 +
    ///////////////////////////////////////////////////////////////////////
48 48
    // Public API
49 -
    ///////////////////////////////////////////////////
49 +
    ///////////////////////////////////////////////////////////////////////
50 50
     */
51 51
52 52
    @Override
@@ -60,9 +60,9 @@
Loading
60 60
    }
61 61
62 62
    /*
63 -
    ///////////////////////////////////////////////////
63 +
    ///////////////////////////////////////////////////////////////////////
64 64
    // Public API, validation
65 -
    ///////////////////////////////////////////////////
65 +
    ///////////////////////////////////////////////////////////////////////
66 66
     */
67 67
68 68
    /**

@@ -37,10 +37,10 @@
Loading
37 37
public class DTDTypingNonValidator
38 38
    extends DTDValidatorBase
39 39
{
40 -
	/*
41 -
    ///////////////////////////////////////////
40 +
    /*
41 +
    ///////////////////////////////////////////////////////////////////////
42 42
    // Element def/spec/validator stack, state
43 -
    ///////////////////////////////////////////
43 +
    ///////////////////////////////////////////////////////////////////////
44 44
    */
45 45
46 46
    /**
@@ -63,21 +63,21 @@
Loading
63 63
    protected boolean mHasNormalizableAttrs = false;
64 64
65 65
    /*
66 -
    ///////////////////////////////////////
66 +
    ///////////////////////////////////////////////////////////////////////
67 67
    // Temporary helper objects
68 -
    ///////////////////////////////////////
68 +
    ///////////////////////////////////////////////////////////////////////
69 69
    */
70 70
71 71
    /**
72 72
     * Reusable lazily instantiated BitSet; needed to keep track of
73 73
     * 'missing' attributes with default values (normal default, #FIXED).
74 74
     */
75 -
    BitSet mTmpDefaultAttrs;
75 +
    protected BitSet mTmpDefaultAttrs;
76 76
77 77
    /*
78 -
    ///////////////////////////////////////////
78 +
    ///////////////////////////////////////////////////////////////////////
79 79
    // Life-cycle
80 -
    ///////////////////////////////////////////
80 +
    ///////////////////////////////////////////////////////////////////////
81 81
    */
82 82
83 83
    public DTDTypingNonValidator(DTDSubset schema, ValidationContext ctxt, boolean hasNsDefaults,
@@ -93,9 +93,9 @@
Loading
93 93
    public final boolean reallyValidating() { return false; }
94 94
95 95
    /*
96 -
    ///////////////////////////////////////
96 +
    ///////////////////////////////////////////////////////////////////////
97 97
    // Configuration
98 -
    ///////////////////////////////////////
98 +
    ///////////////////////////////////////////////////////////////////////
99 99
    */
100 100
101 101
    /**
@@ -108,9 +108,9 @@
Loading
108 108
    }
109 109
110 110
    /*
111 -
    ///////////////////////////////////////
111 +
    ///////////////////////////////////////////////////////////////////////
112 112
    // XMLValidator implementation
113 -
    ///////////////////////////////////////
113 +
    ///////////////////////////////////////////////////////////////////////
114 114
    */
115 115
116 116
    //public XMLValidationSchema getSchema()
@@ -253,7 +253,11 @@
Loading
253 253
         * attribute default values, and return "anything goes"
254 254
         * as the allowable content:
255 255
         */
256 -
        DTDElement elem = mCurrElem;
256 +
        final DTDElement elem = mCurrElem;
257 +
        if (elem == null) { // can this ever occur really?
258 +
            return XMLValidator.CONTENT_ALLOW_ANY_TEXT;
259 +
        }
260 +
        
257 261
        if (mHasAttrDefaults) {
258 262
            BitSet specBits = mCurrDefaultAttrs;
259 263
            int specCount = elem.getSpecialCount();
@@ -271,11 +275,9 @@
Loading
271 275
         * to occur -- although it won't be considered an error, when not
272 276
         * validating, info is needed to determine type of SPACE instead
273 277
         * of CHARACTERS. Other validation types are not to be returned,
274 -
         * however, since caller doesn't know how to deal with such
275 -
         * cases.
278 +
         * however, since caller doesn't know how to deal with such cases.
276 279
         */
277 -
        return (elem == null) ? XMLValidator.CONTENT_ALLOW_ANY_TEXT :
278 -
            elem.getAllowedContentIfSpace();
280 +
        return elem.getAllowedContentIfSpace();
279 281
    }
280 282
281 283
    @Override
@@ -307,9 +309,9 @@
Loading
307 309
    }
308 310
309 311
    /*
310 -
    ///////////////////////////////////////
312 +
    ///////////////////////////////////////////////////////////////////////
311 313
    // Package methods, accessors
312 -
    ///////////////////////////////////////
314 +
    ///////////////////////////////////////////////////////////////////////
313 315
    */
314 316
315 317
    @Override
Files Complexity Coverage
src/main/java/com/ctc/wstx 51.16% 60.54%
Project Totals (168 files) 51.16% 60.54%
1500654321
unittests

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading