FasterXML / woodstox

Compare c9f1c03 ... +1 ... e313616

Coverage Reach
sr/BasicStreamReader.java sr/StreamScanner.java sr/AttributeCollector.java sr/InputElementStack.java sr/TypedStreamReader.java sr/ValidatingStreamReader.java sr/CompactNsContext.java sr/ElemAttrs.java sr/Attribute.java sr/Element.java sr/ElemCallback.java sw/BufferingXmlWriter.java sw/BaseStreamWriter.java sw/ISOLatin1XmlWriter.java sw/AsciiXmlWriter.java sw/EncodingXmlWriter.java sw/BaseNsStreamWriter.java sw/RepairingNsStreamWriter.java sw/NonNsStreamWriter.java sw/SimpleNsStreamWriter.java sw/OutputElementBase.java sw/TypedStreamWriter.java sw/SimpleOutputElement.java sw/XmlWriter.java sw/XmlWriterWrapper.java dtd/FullDTDReader.java dtd/DTDElement.java dtd/DTDValidator.java dtd/DTDSubsetImpl.java dtd/DTDAttribute.java dtd/MinimalDTDReader.java dtd/DTDValidatorBase.java dtd/DTDTypingNonValidator.java dtd/SeqContentSpec.java dtd/ChoiceContentSpec.java dtd/DFAState.java dtd/DTDNmTokensAttr.java dtd/LargePrefixedNameSet.java dtd/DTDEntitiesAttr.java dtd/DTDIdRefsAttr.java dtd/DTDId.java dtd/DTDSchemaFactory.java dtd/ChoiceModel.java dtd/ConcatModel.java dtd/DTDWriter.java dtd/SmallPrefixedNameSet.java dtd/DefaultAttrValue.java dtd/TokenContentSpec.java dtd/DTDIdAttr.java dtd/DTDIdRefAttr.java dtd/DTDEntityAttr.java dtd/DTDNmTokenAttr.java dtd/TokenModel.java dtd/StarModel.java dtd/DFAValidator.java dtd/DTDEnumAttr.java dtd/DTDNotationAttr.java dtd/OptionalModel.java dtd/EmptyValidator.java dtd/DTDCdataAttr.java dtd/ContentSpec.java dtd/PrefixedNameSet.java dtd/DTDSubset.java dtd/StructValidator.java dtd/ModelNode.java util/TextBuffer.java util/XmlChars.java util/SymbolTable.java util/WordResolver.java util/WordSet.java util/StringUtil.java util/ElementIdMap.java util/BijectiveNsMap.java util/StringVector.java util/URLUtil.java util/PrefixedName.java util/DataUtil.java util/TextBuilder.java util/ElementId.java util/ArgUtil.java util/TextAccumulator.java util/BaseNsContext.java util/ExceptionUtil.java util/DefaultXmlSymbolTable.java util/InternCache.java util/SimpleCache.java util/EmptyNamespaceContext.java io/StreamBootstrapper.java io/EBCDICCodec.java io/UTF8Writer.java io/UTF8Reader.java io/WstxInputData.java io/InputBootstrapper.java io/ReaderBootstrapper.java io/CharsetNames.java io/UTF32Reader.java io/DefaultInputResolver.java io/ReaderSource.java io/WstxInputLocation.java io/MergedStream.java io/MergedReader.java io/BranchingReaderSource.java io/BaseReader.java io/ISOLatinReader.java io/TextEscaper.java io/AsciiReader.java io/BaseInputSource.java io/WstxInputSource.java io/BufferRecycler.java io/CharArraySource.java io/SystemId.java io/InputSourceFactory.java api/ReaderConfig.java api/WriterConfig.java api/CommonConfig.java api/EmptyElementHandler.java api/InvalidCharHandler.java api/ValidatorConfig.java api/WstxInputProperties.java api/WstxOutputProperties.java sax/WstxSAXParser.java sax/WstxSAXParserFactory.java sax/SAXFeature.java sax/SAXProperty.java sax/WrappedSaxException.java evt/WstxEventReader.java evt/MergedNsContext.java evt/DefaultEventAllocator.java evt/SimpleStartElement.java evt/CompactStartElement.java evt/BaseStartElement.java evt/WEntityDeclaration.java evt/WDTD.java evt/WEntityReference.java evt/WNotationDeclaration.java msv/GenericMsvValidator.java msv/W3CMultiSchemaFactory.java msv/AttributeProxy.java msv/BaseSchemaFactory.java msv/W3CSchemaFactory.java msv/RelaxNGSchemaFactory.java msv/RelaxNGSchema.java msv/W3CSchema.java stax/WstxInputFactory.java stax/WstxOutputFactory.java stax/WstxEventFactory.java dom/WstxDOMWrappingWriter.java dom/DOMOutputElement.java dom/WstxDOMWrappingReader.java ent/IntEntity.java ent/ParsedExtEntity.java ent/UnparsedExtEntity.java ent/EntityDecl.java ent/ExtEntity.java cfg/ErrorConsts.java exc/WstxException.java exc/WstxValidationException.java exc/WstxLazyException.java exc/WstxIOException.java exc/WstxUnexpectedCharException.java exc/WstxParsingException.java exc/WstxEOFException.java exc/WstxOutputException.java osgi/ValidationSchemaFactoryProviderImpl.java osgi/WstxBundleActivator.java osgi/InputFactoryProviderImpl.java osgi/OutputFactoryProviderImpl.java compat/QNameCreator.java

Flags

Flags have been temporarily removed from this view while the flagging feature is refactored for better performance and user experience.

You can still use flags when viewing individual files. Flag-level thresholds will also remain on pull and merge requests in your repository provider.

More information can be found in our documentation.


@@ -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
    {

@@ -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
    }

@@ -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

@@ -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);

@@ -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)

Learn more Showing 1 files with coverage changes found.

Changes in src/main/java/com/ctc/wstx/sr/BasicStreamReader.java
-1
Loading file...
Files Complexity Coverage
src/main/java/com/ctc/wstx -8.00% 51.16% 0.01% 60.54%
Project Totals (168 files) 51.16% 60.54%
Loading