FasterXML / woodstox

@@ -96,9 +96,8 @@
Loading
96 96
            //trimmed = true;
97 97
        }
98 98
99 -
        /* Ok, now, need to check we only have valid chars, and maybe
100 -
         * also coalesce multiple spaces, if any.
101 -
         */
99 +
        // Ok, now, need to check we only have valid chars, and maybe
100 +
        // also coalesce multiple spaces, if any.
102 101
        StringBuilder sb = null;
103 102
104 103
        while (start <= end) {
@@ -131,7 +130,7 @@
Loading
131 130
         *   avoid using StringBuilder... but let's only do it if it turns
132 131
         *   out dealing with NMTOKENS normalization shows up on profiling...
133 132
         */
134 -
        return sb.toString();
133 +
        return (sb == null) ? null : sb.toString();
135 134
    }
136 135
137 136
    /**
@@ -201,7 +200,7 @@
Loading
201 200
            return;
202 201
        }
203 202
204 -
        if (normalize) {
203 +
        if (sb != null) {
205 204
            mDefValue.setValue(sb.toString());
206 205
        }
207 206
    }

@@ -1738,8 +1738,9 @@
Loading
1738 1738
                newInput = DefaultInputResolver.resolveEntityUsing
1739 1739
                    (oldInput, id, null, null, resolver, mConfig, xmlVersion);
1740 1740
                if (mCfgTreatCharRefsAsEntities) {
1741 -
                    return new IntEntity(WstxInputLocation.getEmptyLocation(), newInput.getEntityId(),
1742 -
                            newInput.getSource(), new char[]{}, WstxInputLocation.getEmptyLocation());
1741 +
                    return new IntEntity(WstxInputLocation.getEmptyLocation(),
1742 +
                            newInput.getEntityId(), newInput.getSource(), // lgtm [java/dereferenced-value-may-be-null]
1743 +
                            new char[]{}, WstxInputLocation.getEmptyLocation());
1743 1744
                }
1744 1745
            } catch (IOException ioe) {
1745 1746
                throw constructFromIOE(ioe);

@@ -822,46 +822,6 @@
Loading
822 822
        return true;
823 823
    }
824 824
825 -
    /**
826 -
     * Method that can be used to check if the contents of the buffer end
827 -
     * in specified String.
828 -
     *
829 -
     * @return True if the textual content buffer contains ends with the
830 -
     *   specified String; false otherwise
831 -
     */
832 -
    public boolean endsWith(String str)
833 -
    {
834 -
        // Let's just play this safe; should seldom if ever happen...
835 -
        // and because of that, can be sub-optimal, performancewise, to
836 -
        // alternatives.
837 -
        if (mInputStart >= 0) {
838 -
            unshare(16);
839 -
        }
840 -
841 -
        int segIndex = (mSegments == null) ? 0 : mSegments.size();
842 -
        int inIndex = str.length() - 1;
843 -
        char[] buf = mCurrentSegment;
844 -
        int bufIndex = mCurrentSize-1;
845 -
846 -
        while (inIndex >= 0) {
847 -
            if (str.charAt(inIndex) != buf[bufIndex]) {
848 -
                return false;
849 -
            }
850 -
            if (--inIndex == 0) {
851 -
                break;
852 -
            }
853 -
            if (--bufIndex < 0) {
854 -
                if (--segIndex < 0) { // no more data?
855 -
                    return false;
856 -
                }
857 -
                buf = mSegments.get(segIndex);
858 -
                bufIndex = buf.length-1;
859 -
            }
860 -
        }
861 -
862 -
        return true;
863 -
    }
864 -
865 825
    /**
866 826
     * Note: it is assumed that this method is not used often enough to
867 827
     * be a bottleneck, or for long segments. Based on this, it is optimized

@@ -384,9 +384,10 @@
Loading
384 384
                             +"'; empty String is not a valid name value");
385 385
        }
386 386
387 -
        return normalize ? sb.toString() : defValue;
387 +
        return (sb != null) ? sb.toString() : defValue;
388 388
    }
389 389
390 +
390 391
    protected String validateDefaultNmToken(InputProblemReporter rep, boolean normalize)
391 392
        throws XMLStreamException
392 393
    {

@@ -2448,9 +2448,11 @@
Loading
2448 2448
                break;
2449 2449
            }
2450 2450
            if (c < CHAR_SPACE || c == '<') {
2451 -
                throwUnexpectedChar(c, SUFFIX_IN_XML_DECL);
2452 -
            } else if (c == CHAR_NULL) {
2453 -
                throwNullChar();
2451 +
                if (c == CHAR_NULL) {
2452 +
                    throwNullChar();
2453 +
                } else {
2454 +
                    throwUnexpectedChar(c, SUFFIX_IN_XML_DECL);
2455 +
                }
2454 2456
            }
2455 2457
            if (outPtr >= outBuf.length) {
2456 2458
                outBuf = tbuf.finishCurrentSegment();
@@ -5274,8 +5276,6 @@
Loading
5274 5276
                    } else {
5275 5277
                        ; // !!! TBI: how to check past boundary?
5276 5278
                    }
5277 -
                } else if (c == CHAR_NULL) {
5278 -
                    throwNullChar();
5279 5279
                }
5280 5280
            }
5281 5281
        } // while (true)
Files Complexity Coverage
src/main/java/com/ctc/wstx 51.16% 60.54%
Project Totals (168 files) 51.16% 60.54%
1485824264
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