src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/sax/SAXBufferProcessor.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 86,95 **** --- 86,96 ---- protected AttributesHolder _attributes = new AttributesHolder(); protected String[] _namespacePrefixes = new String[16]; protected int _namespacePrefixesIndex; + protected int[] _namespaceAttributesStartingStack = new int[16]; protected int[] _namespaceAttributesStack = new int[16]; protected int _namespaceAttributesStackIndex; public SAXBufferProcessor() { }
*** 434,443 **** --- 435,445 ---- boolean hasAttributes = false; boolean hasNamespaceAttributes = false; int item = peekStructure(); Set<String> prefixSet = inscope ? new HashSet<String>() : Collections.<String>emptySet(); if ((item & TYPE_MASK) == T_NAMESPACE_ATTRIBUTE) { + cacheNamespacePrefixStartingIndex(); hasNamespaceAttributes = true; item = processNamespaceAttributes(item, inscope, prefixSet); } if (inscope) { readInscopeNamespaces(prefixSet);
*** 568,578 **** processComment(_contentCharactersBuffer, start, length); } private void processEndPrefixMapping() throws SAXException { final int end = _namespaceAttributesStack[--_namespaceAttributesStackIndex]; ! final int start = (_namespaceAttributesStackIndex > 0) ? _namespaceAttributesStack[_namespaceAttributesStackIndex] : 0; for (int i = end - 1; i >= start; i--) { _contentHandler.endPrefixMapping(_namespacePrefixes[i]); } _namespacePrefixesIndex = start; --- 570,581 ---- processComment(_contentCharactersBuffer, start, length); } private void processEndPrefixMapping() throws SAXException { final int end = _namespaceAttributesStack[--_namespaceAttributesStackIndex]; ! // final int start = (_namespaceAttributesStackIndex > 0) ? _namespaceAttributesStack[_namespaceAttributesStackIndex] : 0; ! final int start = (_namespaceAttributesStackIndex >= 0) ? _namespaceAttributesStartingStack[_namespaceAttributesStackIndex] : 0; for (int i = end - 1; i >= start; i--) { _contentHandler.endPrefixMapping(_namespacePrefixes[i]); } _namespacePrefixesIndex = start;
*** 697,706 **** --- 700,718 ---- } _namespaceAttributesStack[_namespaceAttributesStackIndex++] = _namespacePrefixesIndex; } + private void cacheNamespacePrefixStartingIndex() { + if (_namespaceAttributesStackIndex == _namespaceAttributesStartingStack.length) { + final int[] namespaceAttributesStart = new int[_namespaceAttributesStackIndex * 3 /2 + 1]; + System.arraycopy(_namespaceAttributesStartingStack, 0, namespaceAttributesStart, 0, _namespaceAttributesStackIndex); + _namespaceAttributesStartingStack = namespaceAttributesStart; + } + _namespaceAttributesStartingStack[_namespaceAttributesStackIndex] = _namespacePrefixesIndex; + } + private void processComment(String s) throws SAXException { processComment(s.toCharArray(), 0, s.length()); } private void processComment(char[] ch, int start, int length) throws SAXException {