re PR libgcj/37636 (java tools are unable to find resource files)

libjava/ChangeLog:

2008-10-21  Andrew John Hughes  <gnu_andrew@member.fsf.org>

        * sources.am, Makfile.in: Regenerate.

2008-10-17  Matthias Klose  <doko@ubuntu.com>

	* configure.ac: Fix bashisms.
	* configure: Regenerate.

2008-10-15  Matthias Klose  <doko@ubuntu.com>

	* configure.ac: Disable build of gjdoc, if configured without
	--with-antlr-jar or if no antlr.jar found.
	* configure: Regenerate.

2008-10-09  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* classpath/configure.ac,
	* classpath/m4/ac_prog_antlr.m4,
	* classpath/m4/ac_prog_java.m4,
	* classpath/tools/Makefile.am:
	Ported --regen-gjdoc-parser patch and
	cantlr support from GNU Classpath.

2008-10-06  Andrew Haley  <aph@redhat.com>

	* java/lang/Thread.java (Thread): Always create the ThreadLocalMap
	when creating a thread.
	(getThreadLocals) Don't lazily create the ThreadLocalMap.

2008-09-28  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* classpath/java/lang/ThreadLocalMap.java,
	* java/lang/ThreadLocalMap$Entry.h,
	* java/lang/ThreadLocalMap.h,
	* lib/java/lang/ThreadLocalMap.class,
	* lib/java/lang/ThreadLocalMap$Entry.class:
	Add the new files for the ThreadLocal patch.

2008-09-28  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* classpath/ChangeLog,
	* classpath/java/lang/InheritableThreadLocal.java,
	* classpath/java/lang/Thread.java,
	* classpath/java/lang/ThreadLocal.java:
	Merge Daniel Frampton's ThreadLocal patch.
	* gcj/javaprims.h: Updated.
	* java/lang/Thread.h: Regenerated.
	* java/lang/Thread.java:
	Replace WeakIdentityHashMap with ThreadLocalMap.
	(getThreadLocals()): Likewise.
	* java/lang/ThreadLocal.h: Regenerated.
	* java/lang/ThreadLocal.java:
	(computeNextHash()): New method.
	(ThreadLocal()): Initialise fastHash.
	(internalGet()): Updated to match Classpath's get().
	(internalSet(Object)): Likewise for set(Object).
	(internalRemove()): Likewise for remove().
	
2008-09-25  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* classpath/configure,
	* classpath/configure.ac:
	Resynchronise with Classpath's configure.
	* classpath/examples/Makefile.in:
	Add equivalent support for building as in
	tools/Makefile.in.
	* classpath/java/nio/Buffer.java,
	* classpath/java/nio/ByteBuffer.java,
	* classpath/java/nio/ByteBufferImpl.java,
	* classpath/java/nio/CharBuffer.java,
	* classpath/java/nio/CharBufferImpl.java,
	* classpath/java/nio/CharSequenceBuffer.java,
	* classpath/java/nio/CharViewBufferImpl.java,
	* classpath/java/nio/DirectByteBufferImpl.java,
	* classpath/java/nio/DoubleBuffer.java,
	* classpath/java/nio/DoubleBufferImpl.java,
	* classpath/java/nio/DoubleViewBufferImpl.java,
	* classpath/java/nio/FloatBuffer.java,
	* classpath/java/nio/FloatBufferImpl.java,
	* classpath/java/nio/FloatViewBufferImpl.java,
	* classpath/java/nio/IntBuffer.java,
	* classpath/java/nio/IntBufferImpl.java,
	* classpath/java/nio/IntViewBufferImpl.java,
	* classpath/java/nio/LongBuffer.java,
	* classpath/java/nio/LongBufferImpl.java,
	* classpath/java/nio/LongViewBufferImpl.java,
	* classpath/java/nio/MappedByteBuffer.java,
	* classpath/java/nio/MappedByteBufferImpl.java,
	* classpath/java/nio/ShortBuffer.java,
	* classpath/java/nio/ShortBufferImpl.java,
	* classpath/java/nio/ShortViewBufferImpl.java:
	Replace use of gnu.classpath.Pointer with gnu.gcj.RawData,
	and fix some formatting issues.
	* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaLexer.java,
	* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaLexer.smap,
	* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaRecognizer.java,
	* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaRecognizer.smap,
	* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaTokenTypes.java,
	* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaTokenTypes.txt:
	Regenerated (later version of antlr).
	* java/nio/Buffer.h: Regenerated.
	* java/nio/Buffer.java: Ported changes from Classpath.
	* java/nio/ByteBuffer.h,
	* java/nio/CharBuffer.h: Regenerated.
	* java/nio/DirectByteBufferImpl.java: Ported changes from
	Classpath.
	* java/nio/DoubleBuffer.h,
	* java/nio/FloatBuffer.h,
	* java/nio/IntBuffer.h,
	* java/nio/LongBuffer.h,
	* java/nio/MappedByteBuffer.h,
	* java/nio/MappedByteBufferImpl.h: Regenerated.
	* java/nio/MappedByteBufferImpl.java: Ported changes from
	Classpath.
	* java/nio/ShortBuffer.h: Regenerated.

2008-09-24  Matthias Klose  <doko@ubuntu.com>

	* configure.ac: Search for antlr.jar, if not configured.
	* configure: Regenerate.

2008-09-24  Matthias Klose  <doko@ubuntu.com>

	* Makefile.am: Build a gjdoc binary, if enabled.
	* configure.ac: Add options --disable-gjdoc, --with-antlr-jar=file.
	* Makefile.in, */Makefile.in, configure: Regenerate.

2008-09-22  Andrew Haley  <aph@redhat.com>

	* java/lang/String.java (toString(char[], int, int)): New method.

2008-09-14  Matthias Klose  <doko@ubuntu.com>

	Import GNU Classpath (libgcj-import-20080914).

	* Regenerate class and header files.
	* Regenerate auto* files.
	* configure.ac: Don't pass --disable-gjdoc to classpath.
	* sources.am: Regenerated.
	* HACKING: Mention to build gjdoc in maintainer builds.
	* gnu/classpath/Configuration.java: Update classpath version.
	* gcj/javaprims.h: Update.

2008-09-08  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* Makefile.am: Replace natStringBuffer.cc
	and natStringBuilder.cc with natAbstractStringBuffer.cc.
	* Makefile.in: Regenerated.
	* java/lang/AbstractStringBuffer.java:
	(append(int)): Made native.
	(regionMatches(int,String)): Likewise.
	* java/lang/StringBuffer.h: Regenerated.
	* java/lang/StringBuffer.java: Remerged with GNU Classpath.
	* java/lang/StringBuilder.h: Regenerated.
	* java/lang/StringBuilder.java: Remerged with GNU Classpath.
	* java/lang/natAbstractStringBuffer.cc: Provide common
	native methods for StringBuffer and StringBuilder.
	* java/lang/natStringBuffer.cc,
	* java/lang/natStringBuilder.cc: Removed.

2008-09-04  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* Makefile.in,
	* classpath/configure: Regenerated.
	* gnu/gcj/util/natDebug.cc,
	* gnu/gcj/xlib/natColormap.cc,
	* gnu/gcj/xlib/natDisplay.cc,
	* gnu/gcj/xlib/natDrawable.cc,
	* gnu/gcj/xlib/natFont.cc,
	* gnu/gcj/xlib/natWMSizeHints.cc,
	* gnu/gcj/xlib/natWindow.cc,
	* gnu/gcj/xlib/natXImage.cc:
	Add :: prefix to namespaces.
	* java/io/CharArrayWriter.h,
	* java/lang/StringBuffer.h:
	Regenerated using patched gjavah.
	* java/lang/natStringBuffer.cc:
	Fix naming of append(jint).
	* java/sql/Timestamp.h: Regenerated
	using patched gjavah.
	* jni.cc: Rename p to functions
	to match change in GNU Classpath.
	* scripts/makemake.tcl: Switch
	gnu.java.math to BC compilation.
	* sources.am: Regenerated.

2008-08-21  Andrew John Hughes  <gnu_andrew@member.fsf.org>
	
	* Makefile.in: Updated location of Configuration.java.
	* classpath/lib/gnu/java/locale/LocaleData.class: Regenerated.

2008-08-18  Andrew John Hughes  <gnu_andrew@member.fsf.org>
	
	* Makefile.in: Updated with new Java files.
	* classpath/configure: Regenerated.
	* classpath/tools/Makefile.am: Add missing
	use of GJDOC_EX so --disable-gjdoc works.
	* classpath/tools/Makefile.in: Regenerated.

2008-08-15  Matthias Klose  <doko@ubuntu.com>

	Import GNU Classpath (libgcj-import-20080811).

	* Regenerate class and header files.
	* Regenerate auto* files.
	* configure.ac: Don't pass --with-fastjar to classpath, substitute new
	dummy value in classpath/gnu/classpath/Configuration.java.in, pass
	--disable-gjdoc to classpath.
	* scripts/makemake.tcl:
	* sources.am: Regenerated.
	* java/lang/AbstractStringBuffer.java, gnu/java/lang/VMCPStringBuilder.java:
	New, copied from classpath, use System instead of VMSystem.
	* java/lang/StringBuffer.java: Merge from classpath.
	* java/lang/ClassLoader.java: Merge from classpath.
	* gcj/javaprims.h: Update class definitions,
	remove _Jv_jobjectRefType, jobjectRefType definitions.

libjava/classpath/ChangeLog.gcj:

2008-10-21  Matthias Klose  <doko@ubuntu.com>

        * classpath/tools/gnu/classpath/tools/gjdoc/expr/Java*: Move from ...
        * classpath/tools/generated/gnu/classpath/tools/gjdoc/expr/ ... here.
        * Update .class files.
        
2008-10-21  Andrew John Hughes  <gnu_andrew@member.fsf.org>

        * tools/Makefile.am:
        Always generate parser in the srcdir.

2008-10-21  Matthias Klose  <doko@ubuntu.com>

        * doc/Makefile.am (MAINTAINERCLEANFILES): Add gjdoc.1.
        * doc/Makefile.in: Regenerate.

2008-10-20  Matthias Klose  <doko@ubuntu.com>

	* configure.ac: Don't check for working java, if not configured
        with --enable-java-maintainer-mode.
	* configure: Regenerate.

2008-10-19  Matthias Klose  <doko@ubuntu.com>

	* m4/ac_prog_java.m4: Revert previous change.
	* m4/ac_prog_javac.m4: Apply it here.
	* configure: Regenerate.

2008-10-19  Matthias Klose  <doko@ubuntu.com>

	* m4/ac_prog_javac.m4: Don't check for working javac, if not configured
	with --enable-java-maintainer-mode.
	* configure: Regenerate.
	* Makefile.in, */Makefile.in: Regenerate.

2008-09-30  Matthias Klose  <doko@ubuntu.com>

	* m4/ac_prog_antlr.m4: Check for cantlr binary as well.

2008-09-29  Matthias Klose  <doko@ubuntu.com>

	* m4/ac_prog_antlr.m4: Check for antlr binary as well.

2008-09-28  Matthias Klose  <doko@ubuntu.com>

	* PR libgcj/37636. Revert:
	2008-02-20  Matthias Klose  <doko@ubuntu.com>

	* tools/Makefile.am ($(TOOLS_ZIP)): Revert part of previous change,
	Do copy resource files in JAVA_MAINTAINER_MODE only.
	* tools/Makefile.in: Regenerate.

2008-09-14  Matthias Klose  <doko@ubuntu.com>

	* m4/ac_prog_javac_works.m4, m4/ac_prog_javac.m4, m4/acinclude.m4:
	Revert local changes.
	* m4/ac_prog_antlr.m4: Check for an runantlr binary.
	* tools/Makefile.am, lib/Makefile.am: Revert local changes (JCOMPILER).
	* tools/Makefile.am: Remove USE_JAVAC_FLAGS, pass ANTLR_JAR in
	GLIBJ_CLASSPATH.

2008-09-14  Matthias Klose  <doko@ubuntu.com>

	Revert:
	Daniel Frampton  <zyridium at zyridium.net>

	* AUTHORS: Added.
	* java/lang/InheritableThreadLocal.java,
	* java/lang/Thread.java,
	* java/lang/ThreadLocal.java:
	Modified to use java.lang.ThreadLocalMap.
	* java/lang/ThreadLocalMap.java:
	New cheaper ThreadLocal-specific WeakHashMap.

2008-08-15  Matthias Klose  <doko@ubuntu.com>

	* m4/acinclude.m4 (CLASSPATH_JAVAC_MEM_CHECK): Remove unknown
	args for javac.

libjava/classpath/ChangeLog:

2008-10-20  Andrew John Hughes  <gnu_andrew@member.fsf.org>

        * m4/ac_prog_antlr.m4:
        Remove redundant checks.
        * tools/Makefile.am:
        Use gjdoc_gendir when calling antlr.

2008-10-15  Andrew John Hughes  <gnu_andrew@member.fsf.org>

        * configure.ac:
        Remove superfluous AC_PROG_JAVA call.

2008-10-06  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* m4/ac_prog_antlr:
	Check for cantlr as well.
	* tools/Makefile.am:
	Only build GJDoc parser when both
	CREATE_GJDOC and CREATE_GJDOC_PARSER
	are on.
	
2008-10-02  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* configure.ac:
	Add regen-gjdoc-parser option,
	and separate antlr tests.
	* m4/ac_prog_antlr.m4:
	Turn single test into AC_LIB_ANTLR
	and AC_PROG_ANTLR.
	* m4/ac_prog_java.m4:
	Quote tests.
	* tools/Makefile.am:
	Support CREATE_GJDOC_PARSER option.

2008-09-14  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* examples/Makefile.am:
        Check lib directly as well as glibj.zip
        for boot classes.
	* m4/acinclude.m4:
        Only require the class files to be built
        to allow the tools and examples to be built,
        not the installation of glibj.zip.
	* tools/Makefile.am:
	Check lib directly as well as glibj.zip
	for boot classes.

2008-09-13  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* examples/Makefile.am,
	* lib/Makefile.am:
	Add GCJ rules.
	* m4/ac_prog_javac.m4:
	Check whether JAVAC is gcj.
	* m4/ac_prog_javac_works.m4:
	Add GCJ rules.
	* m4/acinclude.m4:
	Don't bother checking for -J
	if using GCJ.
	* tools/Makefile.am:
	Add GCJ rules.

2007-08-23  Daniel Frampton  <zyridium@zyridium.net>

	* AUTHORS: Added.
	* java/lang/InheritableThreadLocal.java,
	* java/lang/Thread.java,
	* java/lang/ThreadLocal.java:
	Modified to use java.lang.ThreadLocalMap.
	* java/lang/ThreadLocalMap.java:
	New cheaper ThreadLocal-specific WeakHashMap.

2008-02-07  Ian Rogers  <ian.rogers@manchester.ac.uk>

	* java/util/zip/ZipEntry.java:
	Use byte fields instead of integer fields,
	store the time as well as the DOS time and
	don't retain a global Calendar instance.
	(setDOSTime(int)): Set KNOWN_DOSTIME instead
	of KNOWN_TIME, and unset KNOWN_TIME.
	(getDOSTime()): Compute DOS time from UNIX time
	only when needed.
	(clone()): Provide cloning via the ZipEntry constructor
	where possible.
	(setTime(long)): Don't compute DOS time at this point.
	(getCalendar()): Removed.
	
2008-09-09  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* tools/gnu/classpath/tools/getopt/Parser.java:
	(setHeader(String)): Make synchronized.
	(setFooter(String)): Likewise.
	* tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java,
	(reset()): Make synchronized.
	(name(Class)): Likewise.
	
2008-09-04  Robert Schuster  <robertschuster@fsfe.org>

	* gnu/java/nio/charset/ByteDecodeLoopHelper:
	(arrayDecodeLoop): Added new break label, escape to that label.
	* gnu/java/nio/charset/ByteEncodeLoopHelper:
	(arrayDecodeLoop): Added new break label, escape to that label.

2008-09-04  Robert Schuster  <robertschuster@fsfe.org>

	* java/text/DecimalFormat.java:
	(scanFix): Use 'i + 1' when looking at following character.
	(scanNegativePattern): Dito.

2008-09-02  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* tools/gnu/classpath/tools/javah/ClassWrapper.java:
	(makeVtable()): Populate methodNameMap.
	(printMethods(CniPrintStream)): Always use pre-populated
	methodNameMap for bridge targets.

2008-09-01  Mario Torre  <neugens@aicas.com>

	* gnu/java/awt/peer/x/XImage.java (XImageProducer): remove @Override
	annotation to allow compilation on javac < 1.6 and ecj < 3.4.

2008-09-01  Mario Torre  <neugens@aicas.com>

	* gnu/java/awt/peer/x/XGraphicsDevice.java (getDisplay): fix to support
	new Escher API.
	* gnu/java/awt/peer/x/XImage.java (getSource): method implemented.
	* gnu/java/awt/peer/x/XImage.java (XImageProducer): implement ImageProducer
	for getSource.
	 
2008-09-01  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* gnu/java/util/regex/BacktrackStack.java,
	* gnu/java/util/regex/CharIndexed.java,
	* gnu/java/util/regex/CharIndexedCharArray.java,
	* gnu/java/util/regex/CharIndexedCharSequence.java,
	* gnu/java/util/regex/CharIndexedInputStream.java,
	* gnu/java/util/regex/CharIndexedString.java,
	* gnu/java/util/regex/CharIndexedStringBuffer.java,
	* gnu/java/util/regex/RE.java,
	* gnu/java/util/regex/REException.java,
	* gnu/java/util/regex/REFilterInputStream.java,
	* gnu/java/util/regex/REMatch.java,
	* gnu/java/util/regex/REMatchEnumeration.java,
	* gnu/java/util/regex/RESyntax.java,
	* gnu/java/util/regex/REToken.java,
	* gnu/java/util/regex/RETokenAny.java,
	* gnu/java/util/regex/RETokenBackRef.java,
	* gnu/java/util/regex/RETokenChar.java,
	* gnu/java/util/regex/RETokenEnd.java,
	* gnu/java/util/regex/RETokenEndOfPreviousMatch.java,
	* gnu/java/util/regex/RETokenEndSub.java,
	* gnu/java/util/regex/RETokenIndependent.java,
	* gnu/java/util/regex/RETokenLookAhead.java,
	* gnu/java/util/regex/RETokenLookBehind.java,
	* gnu/java/util/regex/RETokenNamedProperty.java,
	* gnu/java/util/regex/RETokenOneOf.java,
	* gnu/java/util/regex/RETokenPOSIX.java,
	* gnu/java/util/regex/RETokenRange.java,
	* gnu/java/util/regex/RETokenRepeated.java,
	* gnu/java/util/regex/RETokenStart.java,
	* gnu/java/util/regex/RETokenWordBoundary.java,
	* gnu/java/util/regex/UncheckedRE.java:
	Fix indentation.

2008-09-01  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* gnu/java/util/regex/RETokenStart.java:
	(getMaximumLength()): Add Override annotation.
	(matchThis(CharIndexed, REMatch)): Likewise.
	(returnsFixedLengthMatches()): Renamed from
	returnsFixedLengthmatches and added Override
	annotation.
	(findFixedLengthMatches(CharIndexed,REMatch,int)):
	Add Override annotation.
	(dump(CPStringBuilder)): Likewise.
	* gnu/javax/print/ipp/IppRequest.java:
	(RequestWriter.writeOperationAttributes(AttributeSet)):
	Throw exception, don't just create and drop it.
	* javax/management/MBeanServerPermission.java:
	(MBeanServerPermissionCollection.add(Permission)): Compare
	against individual Strings not the entire array, and
	store the result of replace.
	* javax/swing/text/html/StyleSheet.java:
	(setBaseFontSize(size)): Store result of trim().

2008-09-01  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* javax/tools/FileObject.java:
	(openReader(boolean)): Document new parameter.
	
2008-03-27  Michael Franz  <mvfranz@gmail.com>

	PR classpath/35690:
	* javax/tools/FileObject.java:
	(toUri()): Fix case from toURI.
	(openReader(boolean)): Add missing boolean argument.
	
2008-08-26  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	PR classpath/35487:
	* gnu/javax/management/Server.java:
	(beans): Change to ConcurrentHashMap.
	(defaultDomain): Make final.
	(outer): Likewise.
	(LazyListenersHolder): Added to wrap
	listeners, also now a ConcurrentHashMap,
	providing lazy initialisation safely.
	(sequenceNumber): Documented.
	(getBean(ObjectName)): Remove redundant cast.
	(addNotificationListener(ObjectName,NotificationListener,
	NotificationFilter,Object)): Remove map initialisation
	and use holder.
	(getObjectInstance(ObjectName)): Remove redundant cast.
	(registerMBean(Object,ObjectName)): Add bean atomically.
	(removeNotificationListener(ObjectName,NotificationListener)):
	Simplified.
	(removeNotificationListener(ObjectName,NotificationListener,
	NotificationFilter,Object)): Likewise.
	(notify(ObjectName,String)): Documented.
	
2008-08-26  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* gnu/javax/management/Server.java:
	Genericised.

2008-08-26  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* gnu/javax/management/Translator.java:
	Genericised.

2008-08-26  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* javax/management/DefaultLoaderRepository.java,
	* javax/management/JMX.java,
	* javax/management/MBeanAttributeInfo.java,
	* javax/management/MBeanConstructorInfo.java,
	* javax/management/MBeanOperationInfo.java,
	* javax/management/MBeanServerDelegate.java:
	Fix warnings due to generics.

2008-08-25  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* javax/management/MBeanPermission.java,
	* javax/management/MBeanServerDelegate.java,
	* javax/management/MBeanServerFactory.java,
	* javax/management/MBeanServerInvocationHandler.java,
	* javax/management/MBeanServerPermission.java:
	Fix warnings due to use of non-generic collections.

2008-08-25  Mario Torre  <neugens@aicas.com>

	* gnu/javax/rmi/CORBA/RmiUtilities.java (readValue): check if sender is
	null to avoid NPE.
	
2008-08-22  Mario Torre  <neugens@aicas.com>
 
	* gnu/CORBA/OrbFunctional.java (set_parameters): Fix
	NullPointerException checking when param is null. 

2008-08-23  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* java/util/regex/Matcher.java:
	(reset()): Reset append position so
	we don't try and append to the end of
	the old input.
	
2008-08-22  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	PR classpath/32028:
	* m4/acinclude.m4:
	Also allow versions of GJDoc from 0.8* on, as
	CVS is 0.8.0-pre.
	
2008-08-21  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	PR classpath/32028:
	* m4/acinclude.m4:
	(CLASSPATH_WITH_GJDOC): Ensure version 0.7.9 is
	being used.
	
2008-08-20  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* tools/Makefile.am:
	Add taglets subdirectory to list of excluded
	paths when GJDoc is not compiled.
	
2008-08-19  David P Grove  <groved@us.ibm.com>

	* scripts/check_jni_methods.sh.in:
	Fix build issue on AIX by splitting generation
	of method list.
	
2008-08-18  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* native/jni/gstreamer-peer/gst_native_pipeline.c:
	(get_free_space(int)): Use #else not #elif when
	there is no condition.

2008-08-17  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	PR classpath/31895:
	* java/text/DecimalFormat.java:
	(setCurrency(Currency)): Update prefixes and
	suffixes when currency changes.
	* java/text/DecimalFormatSymbols.java:
	(DecimalFormatSymbols(Locale)): Set locale earlier
	so it can be used by setCurrency(Currency).
	(setCurrency(Currency)): Set the symbol correctly using
	the locale of the instance.
	* java/util/Currency.java:
	Throw error instead of just printing a message.

2008-08-17  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* javax/activation/ActivationDataFlavor.java:
	Suppress warnings from public API.
	(mimeType): Made final.
	(representationClass): Added generic type and
	made final.
	(normalizeMimeTypeParameter(String,String)):
	Use CPStringBuilder.
	* javax/activation/CommandInfo.java:
	(verb): Made final.
	(className): Made final.
	* javax/activation/DataHandler.java:
	(dataSource): Made final.
	* javax/activation/FileDataSource.java:
	(file): Made final.
	* javax/activation/MailcapCommandMap.java:
	Use generics on collections and CPStringBuilder
	instead of StringBuffer.
	* javax/activation/MimeType.java:
	(toString()): Use CPStringBuilder.
	(getBaseType()): Likewise.
	* javax/activation/MimeTypeParameterList.java:
	Use generics on collections and CPStringBuilder
	instead of StringBuffer.
	* javax/activation/MimeTypeParseException.java:
	(MimeTypeParseException(String,String)): Use
	CPStringBuilder.
	* javax/activation/MimetypesFileTypeMap.java:
	Use generics on collections and CPStringBuilder
	instead of StringBuffer.	
	* javax/activation/URLDataSource.java:
	(url): Made final.

2008-08-17  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* gnu/javax/activation/viewers/ImageViewer.java,
	* gnu/javax/activation/viewers/TextEditor.java,
	* gnu/javax/activation/viewers/TextViewer.java,
	* javax/activation/ActivationDataFlavor.java,
	* javax/activation/CommandInfo.java,
	* javax/activation/CommandMap.java,
	* javax/activation/CommandObject.java,
	* javax/activation/DataContentHandler.java,
	* javax/activation/DataContentHandlerFactory.java,
	* javax/activation/DataHandler.java,
	* javax/activation/DataHandlerDataSource.java,
	* javax/activation/DataSource.java,
	* javax/activation/DataSourceDataContentHandler.java,
	* javax/activation/FileDataSource.java,
	* javax/activation/FileTypeMap.java,
	* javax/activation/MailcapCommandMap.java,
	* javax/activation/MimeType.java,
	* javax/activation/MimeTypeParameterList.java,
	* javax/activation/MimeTypeParseException.java,
	* javax/activation/MimetypesFileTypeMap.java,
	* javax/activation/ObjectDataContentHandler.java,
	* javax/activation/URLDataSource.java,
	* javax/activation/UnsupportedDataTypeException.java,
	* javax/activation/package.html,
	* resource/META-INF/mailcap.default,
	* resource/META-INF/mimetypes.default:
	Import GNU JAF CVS as of 17/08/2008.

2006-04-25  Archit Shah  <ashah@redhat.com>

	* javax/activation/MimeTypeParameterList.java:
	Insert ';' separator before parameter list.

2005-06-29  Xavier Poinsard  <xpoinsard@openpricer.com>

	* javax/activation/ObjectDataContentHandler.java:
	Fixed typo.

2005-05-28  Chris Burdess  <dog@bluezoo.org>

	* javax/activation/CommandMap.java, 
	* javax/activation/MailcapCommandMap.java:
	Updated to JAF 1.1.

2004-06-09  Chris Burdess  <dog@bluezoo.org>

	* javax/activation/MailcapCommandMap.java:
	Fixed bug whereby x-java prefix was not
	attempted.

2008-08-17  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* AUTHORS: Added Laszlo.

2008-04-20  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	PR classpath/30436:
	* java/util/Scanner.java:
	Fix package to be java.util and correct
	indentation.

2007-07-25  Laszlo Andras Hernadi  <e0327023@student.tuwien.ac.at>

	PR classpath/30436:
	* java/util/Scanner.java:
	Initial implementation.

2008-08-17  Andrew John Hughes  <gnu_andrew@member.fsf.org>

	* java/util/regex/Matcher.java:
	(toMatchResult()): Implemented.
	
2008-08-13  Joshua Sumali  <jsumali@redhat.com>

	* doc/Makefile.am (gjdoc.pod): Generate gjdoc pod from cp-tools.texinfo
	instead of invoke.texi. Remove invoke.texi from EXTRA_DIST.
	* doc/invoke.texi: Removed and merged into ...
	* doc/cp-tools.texinfo: Here

2008-08-12  Robert Schuster  <robertschuster@fsfe.org>

	* native/jni/java-net/local.c
	(local_bind): Removed fprintf call, fixed access outside
	of array bounds.

From-SVN: r141271
This commit is contained in:
Matthias Klose
2008-10-21 17:55:01 +00:00
parent d9cc481a35
commit cd6d4007aa
2325 changed files with 121399 additions and 23635 deletions
+34 -2
View File
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
@@ -106,7 +108,37 @@ public class DomAttr
// and character data change events and when they happen,
// report self-mutation
}
/**
* Constructs an Attr node associated with the specified document.
* The "specified" flag is initialized to true, since this DOM has
* no current "back door" mechanisms to manage default values so
* that every value must effectively be "specified".
*
* <p>This constructor should only be invoked by a Document as part of
* its createAttribute functionality, or through a subclass which is
* similarly used in a "Sub-DOM" style layer.
* <p>
* With this constructor, the prefix and local part are given explicitly
* rather than being computed. This allows them to be explicitly set to
* {@code null} as required by {@link Document#createAttribute(String)}.
* </p>
*
* @param owner The document with which this node is associated
* @param namespaceURI Combined with the local part of the name,
* this is used to uniquely identify a type of attribute
* @param name Name of this attribute, which may include a prefix
* @param prefix the namespace prefix of the name. May be {@code null}.
* @param localName the local part of the name. May be {@code null}.
*/
protected DomAttr(DomDocument owner, String namespaceURI, String name,
String prefix, String localName)
{
super(ATTRIBUTE_NODE, owner, namespaceURI, name, prefix, localName);
specified = true;
length = 1;
}
/**
* <b>DOM L1</b>
* Returns the attribute name (same as getNodeName)
@@ -147,7 +179,7 @@ public class DomAttr
return (value == null) ? "" : value;
}
// Otherwise collect child node-values
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
for (DomNode ctx = first; ctx != null; ctx = ctx.next)
{
switch (ctx.nodeType)
@@ -597,6 +597,8 @@ public class DomDocument
/**
* <b>DOM L1</b>
* Returns a newly created element with the specified name.
* The node name of the created element will be equal to {@code name}.
* The namespace, prefix and local name will all be {@code null}.
*/
public Element createElement(String name)
{
@@ -612,8 +614,7 @@ public class DomDocument
}
else
{
DomElement domElement = new DomElement(this, null, name);
domElement.localName = null;
DomElement domElement = new DomElement(this, null, name, null, null);
element = domElement;
}
if (defaultAttributes)
@@ -813,8 +814,7 @@ public class DomDocument
}
else
{
DomAttr ret = new DomAttr(this, null, name);
ret.localName = null;
DomAttr ret = new DomAttr(this, null, name, null, null);
return ret;
}
}
@@ -89,6 +89,32 @@ public class DomElement
super(ELEMENT_NODE, owner, namespaceURI, name);
}
/**
* <p>
* Constructs an Element node associated with the specified document.
* This constructor should only be invoked by a Document as part
* of its createElement functionality, or through a subclass which is
* similarly used in a "Sub-DOM" style layer.
* </p>
* <p>
* With this constructor, the prefix and local part are given explicitly
* rather than being computed. This allows them to be explicitly set to
* {@code null} as required by {@link Document#createElement(String)}.
* </p>
*
* @param owner The document with which this node is associated
* @param namespaceURI Combined with the local part of the name,
* this is used to uniquely identify a type of element
* @param name Name of this element, which may include a prefix
* @param prefix the namespace prefix of the name. May be {@code null}.
* @param localName the local part of the name. May be {@code null}.
*/
protected DomElement(DomDocument owner, String namespaceURI, String name,
String prefix, String localName)
{
super(ELEMENT_NODE, owner, namespaceURI, name, prefix, localName);
}
/**
* <b>DOM L1</b>
* Returns the element's attributes
+10 -3
View File
@@ -37,8 +37,15 @@ exception statement from your version. */
package gnu.xml.dom;
import org.w3c.dom.*;
import org.w3c.dom.events.*;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.Node;
import org.w3c.dom.events.Event;
import org.w3c.dom.events.EventTarget;
import org.w3c.dom.events.MutationEvent;
import org.w3c.dom.events.UIEvent;
import org.w3c.dom.views.AbstractView; // used by UIEvent
/**
@@ -180,7 +187,7 @@ public class DomEvent
*/
public String toString()
{
StringBuffer buf = new StringBuffer("[Event ");
CPStringBuilder buf = new CPStringBuilder("[Event ");
buf.append(type);
switch (eventPhase)
{
+7 -5
View File
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.dom;
import gnu.java.lang.CPStringBuilder;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -1939,7 +1941,7 @@ public abstract class DomNode
case ENTITY_NODE:
case ENTITY_REFERENCE_NODE:
case DOCUMENT_FRAGMENT_NODE:
StringBuffer buffer = new StringBuffer();
CPStringBuilder buffer = new CPStringBuilder();
for (DomNode ctx = first; ctx != null; ctx = ctx.next)
{
String textContent = ctx.getTextContent(false);
@@ -2124,7 +2126,7 @@ public abstract class DomNode
{
String nodeName = getNodeName();
String nodeValue = getNodeValue();
StringBuffer buf = new StringBuffer(getClass().getName());
CPStringBuilder buf = new CPStringBuilder(getClass().getName());
buf.append('[');
if (nodeName != null)
{
@@ -2146,7 +2148,7 @@ public abstract class DomNode
String encode(String value)
{
StringBuffer buf = null;
CPStringBuilder buf = null;
int len = value.length();
for (int i = 0; i < len; i++)
{
@@ -2155,7 +2157,7 @@ public abstract class DomNode
{
if (buf == null)
{
buf = new StringBuffer(value.substring(0, i));
buf = new CPStringBuilder(value.substring(0, i));
}
buf.append("\\n");
}
@@ -2163,7 +2165,7 @@ public abstract class DomNode
{
if (buf == null)
{
buf = new StringBuffer(value.substring(0, i));
buf = new CPStringBuilder(value.substring(0, i));
}
buf.append("\\r");
}
+28 -1
View File
@@ -54,7 +54,7 @@ public abstract class DomNsNode
private String name;
private String namespace;
private String prefix;
String localName;
private String localName;
/**
* Constructs a node associated with the specified document, and
@@ -75,6 +75,33 @@ public abstract class DomNsNode
setNamespaceURI(namespaceURI);
}
/**
* Constructs a node associated with the specified document, and
* with the specified namespace information. The prefix and local part
* are given explicitly rather than being computed. This allows them
* to be explicitly set to {@code null} as required by
* {@link Document#createElement(String)}.
*
* @param owner The document with which this entity is associated
* @param namespaceURI Combined with the local part of the name,
* this identifies a type of element or attribute; may be null.
* If this is the empty string, it is reassigned as null so that
* applications only need to test that case.
* @param name Name of this node, which may include a prefix
* @param prefix the namespace prefix of the name. May be {@code null}.
* @param localName the local part of the name. May be {@code null}.
*/
// package private
DomNsNode(short nodeType, DomDocument owner, String namespaceURI, String name,
String prefix, String localName)
{
super(nodeType, owner);
this.name = name.intern();
this.prefix = prefix == null ? null : prefix.intern();
this.localName = localName == null ? null : localName.intern();
setNamespaceURI(namespaceURI);
}
/**
* <b>DOM L1</b>
* Returns the node's name, including any namespace prefix.
+3 -1
View File
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.DOMException;
import org.w3c.dom.Text;
@@ -172,7 +174,7 @@ public class DomText
{
ref = ctx;
}
StringBuffer buf = new StringBuffer(ref.getNodeValue());
CPStringBuilder buf = new CPStringBuilder(ref.getNodeValue());
for (ctx = ref.next; ctx != null &&
(ctx.nodeType == TEXT_NODE || ctx.nodeType == CDATA_SECTION_NODE);
ctx = ctx.next)
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.dom.ls;
import gnu.java.lang.CPStringBuilder;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
@@ -82,7 +84,7 @@ public class DomLSInput
public String getStringData()
{
StringBuffer acc = new StringBuffer();
CPStringBuilder acc = new CPStringBuilder();
Reader reader = getCharacterStream();
try
{
@@ -253,7 +253,7 @@ public class DomLSParser
eventSink = (filter == null) ? new SAXEventSink() :
new FilteredSAXEventSink(filter);
// configure sink
eventSink.namespaceAware = namespaceAware;
eventSink.setNamespaceAware(namespaceAware);
eventSink.ignoreWhitespace = ignoreWhitespace;
eventSink.expandEntityReferences = expandEntityReferences;
eventSink.ignoreComments = ignoreComments;
@@ -89,7 +89,7 @@ public class SAXEventSink
PREDEFINED_ENTITIES.add("apos");
}
boolean namespaceAware;
private boolean namespaceAware;
boolean ignoreWhitespace;
boolean expandEntityReferences;
boolean ignoreComments;
@@ -128,6 +128,11 @@ public class SAXEventSink
this.locator = locator;
}
public void setNamespaceAware(boolean namespaceAware)
{
this.namespaceAware = namespaceAware;
}
public void startDocument()
throws SAXException
{
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
@@ -103,7 +105,7 @@ class GnomeAttr
public String toString()
{
StringBuffer buffer = new StringBuffer(getClass().getName());
CPStringBuilder buffer = new CPStringBuilder(getClass().getName());
buffer.append("[name=");
buffer.append(getName());
buffer.append(",value=");
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.CharacterData;
import org.w3c.dom.DOMException;
@@ -107,7 +109,7 @@ abstract class GnomeCharacterData
public String toString()
{
StringBuffer buffer = new StringBuffer(getClass().getName());
CPStringBuilder buffer = new CPStringBuilder(getClass().getName());
buffer.append("[data=");
buffer.append(getData());
buffer.append("]");
@@ -37,6 +37,9 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import gnu.xml.dom.DomNodeIterator;
import java.util.Iterator;
import org.w3c.dom.Attr;
@@ -66,8 +69,6 @@ import org.w3c.dom.xpath.XPathException;
import org.w3c.dom.xpath.XPathExpression;
import org.w3c.dom.xpath.XPathNSResolver;
import gnu.xml.dom.DomNodeIterator;
/**
* A DOM document node implemented in libxml2.
*
@@ -549,7 +550,7 @@ public class GnomeDocument
public String toString()
{
StringBuffer buffer = new StringBuffer(getClass().getName());
CPStringBuilder buffer = new CPStringBuilder(getClass().getName());
buffer.append("[version=");
buffer.append(getXmlVersion());
buffer.append(",standalone=");
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.DocumentType;
import org.w3c.dom.NamedNodeMap;
@@ -79,7 +81,7 @@ implements DocumentType
public String toString ()
{
String publicId = getPublicId ();
StringBuffer buffer = new StringBuffer (getClass ().getName ());
CPStringBuilder buffer = new CPStringBuilder (getClass ().getName ());
buffer.append ("[");
if (publicId != null)
{
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import java.util.HashSet;
import java.util.Set;
@@ -172,7 +174,7 @@ class GnomeElement
public String toString()
{
StringBuffer buffer = new StringBuffer(getClass().getName());
CPStringBuilder buffer = new CPStringBuilder(getClass().getName());
buffer.append("[tagName=");
buffer.append(getTagName());
buffer.append("]");
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.Entity;
/**
@@ -83,7 +85,7 @@ implements Entity
public String toString ()
{
String publicId = getPublicId ();
StringBuffer buffer = new StringBuffer (getClass ().getName ());
CPStringBuilder buffer = new CPStringBuilder (getClass ().getName ());
buffer.append ("[");
if (publicId != null)
{
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -368,7 +370,7 @@ class GnomeNode
case ENTITY_NODE:
case ENTITY_REFERENCE_NODE:
case DOCUMENT_FRAGMENT_NODE:
StringBuffer buffer = new StringBuffer();
CPStringBuilder buffer = new CPStringBuilder();
NodeList children = getChildNodes();
int len = children.getLength();
for (int i = 0; i < len; i++)
@@ -489,7 +491,7 @@ class GnomeNode
public String toString()
{
StringBuffer buffer = new StringBuffer(getClass().getName());
CPStringBuilder buffer = new CPStringBuilder(getClass().getName());
buffer.append("[nodeName=");
buffer.append(getNodeName());
buffer.append("]");
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.Notation;
/**
@@ -61,7 +63,7 @@ implements Notation
public String toString ()
{
String publicId = getPublicId ();
StringBuffer buffer = new StringBuffer (getClass ().getName ());
CPStringBuilder buffer = new CPStringBuilder (getClass ().getName ());
buffer.append ("[");
if (publicId != null)
{
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.DOMException;
import org.w3c.dom.ProcessingInstruction;
@@ -67,7 +69,7 @@ implements ProcessingInstruction
public String toString ()
{
StringBuffer buffer = new StringBuffer (getClass ().getName ());
CPStringBuilder buffer = new CPStringBuilder (getClass ().getName ());
buffer.append ("[data=");
buffer.append (getData ());
buffer.append ("]");
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
@@ -84,7 +86,7 @@ implements Text
first = node;
node = node.getPreviousSibling ();
}
StringBuffer buf = new StringBuffer (first.getNodeValue ());
CPStringBuilder buf = new CPStringBuilder (first.getNodeValue ());
node = first.getNextSibling ();
while (node != null && node instanceof Text)
{
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.libxmlj.dom;
import gnu.java.lang.CPStringBuilder;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import org.w3c.dom.xpath.XPathException;
@@ -112,7 +114,7 @@ implements XPathResult
case 1:
return getSingleNodeValue ().toString ();
default:
StringBuffer buffer = new StringBuffer ();
CPStringBuilder buffer = new CPStringBuilder ();
for (int i = 0; i < len; i++)
{
if (i > 0)
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.stream;
import gnu.java.lang.CPStringBuilder;
import java.io.Writer;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
@@ -141,7 +143,7 @@ public abstract class XMLEventImpl
protected String encode(String text, boolean inAttr)
{
int len = text.length();
StringBuffer buf = null;
CPStringBuilder buf = null;
for (int i = 0; i < len; i++)
{
char c = text.charAt(i);
@@ -149,7 +151,7 @@ public abstract class XMLEventImpl
{
if (buf == null)
{
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
}
buf.append("&lt;");
}
@@ -157,7 +159,7 @@ public abstract class XMLEventImpl
{
if (buf == null)
{
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
}
buf.append("&gt;");
}
@@ -165,7 +167,7 @@ public abstract class XMLEventImpl
{
if (buf == null)
{
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
}
buf.append("&amp;");
}
@@ -173,7 +175,7 @@ public abstract class XMLEventImpl
{
if (buf == null)
{
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
}
buf.append("&apos;");
}
@@ -181,7 +183,7 @@ public abstract class XMLEventImpl
{
if (buf == null)
{
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
}
buf.append("&quot;");
}
+15 -13
View File
@@ -53,6 +53,8 @@ Partly derived from code which carried the following notice:
package gnu.xml.stream;
import gnu.java.lang.CPStringBuilder;
import java.io.BufferedInputStream;
import java.io.EOFException;
import java.io.File;
@@ -691,7 +693,7 @@ public class XMLParser
{
if (event != XMLStreamConstants.START_ELEMENT)
throw new XMLStreamException("current event must be START_ELEMENT");
StringBuffer elementText = new StringBuffer();
CPStringBuilder elementText = new CPStringBuilder();
int depth = stack.size();
while (event != XMLStreamConstants.END_ELEMENT || stack.size() > depth)
{
@@ -2011,7 +2013,7 @@ public class XMLParser
else
{
ContentModel model;
StringBuffer acc = new StringBuffer();
CPStringBuilder acc = new CPStringBuilder();
require('(');
acc.append('(');
skipWhitespace();
@@ -2058,7 +2060,7 @@ public class XMLParser
/**
* Parses an element content model.
*/
private ElementContentModel readElements(StringBuffer acc)
private ElementContentModel readElements(CPStringBuilder acc)
throws IOException, XMLStreamException
{
int separator;
@@ -2159,7 +2161,7 @@ public class XMLParser
/**
* Parse a cp production.
*/
private ContentParticle readContentParticle(StringBuffer acc)
private ContentParticle readContentParticle(CPStringBuilder acc)
throws IOException, XMLStreamException
{
ContentParticle cp = new ContentParticle();
@@ -2228,7 +2230,7 @@ public class XMLParser
{
String name = readNmtoken(true);
requireWhitespace();
StringBuffer acc = new StringBuffer();
CPStringBuilder acc = new CPStringBuilder();
HashSet values = new HashSet();
String type = readAttType(acc, values);
if (validating)
@@ -2277,7 +2279,7 @@ public class XMLParser
/**
* Parse an attribute type.
*/
private String readAttType(StringBuffer acc, HashSet values)
private String readAttType(CPStringBuilder acc, HashSet values)
throws IOException, XMLStreamException
{
if (tryRead('('))
@@ -2313,7 +2315,7 @@ public class XMLParser
/**
* Parse an enumeration.
*/
private void readEnumeration(boolean isNames, StringBuffer acc,
private void readEnumeration(boolean isNames, CPStringBuilder acc,
HashSet values)
throws IOException, XMLStreamException
{
@@ -2344,7 +2346,7 @@ public class XMLParser
/**
* Parse a notation type for an attribute.
*/
private void readNotationType(StringBuffer acc, HashSet values)
private void readNotationType(CPStringBuilder acc, HashSet values)
throws IOException, XMLStreamException
{
requireWhitespace();
@@ -3518,7 +3520,7 @@ public class XMLParser
private char[] readCharacterRef(int base)
throws IOException, XMLStreamException
{
StringBuffer b = new StringBuffer();
CPStringBuilder b = new CPStringBuilder();
for (int c = readCh(); c != 0x3b && c != -1; c = readCh())
b.append(Character.toChars(c));
try
@@ -4246,7 +4248,7 @@ public class XMLParser
throws XMLStreamException
{
// Use regular expression
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
for (Iterator i = children.iterator(); i.hasNext(); )
{
buf.append((String) i.next());
@@ -4266,7 +4268,7 @@ public class XMLParser
{
if (model.regex == null)
{
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
buf.append('(');
for (Iterator i = model.contentParticles.iterator(); i.hasNext(); )
{
@@ -4476,7 +4478,7 @@ public class XMLParser
*/
private static String encodeText(String text)
{
StringBuffer b = new StringBuffer();
CPStringBuilder b = new CPStringBuilder();
int len = text.length();
for (int i = 0; i < len; i++)
{
@@ -4584,7 +4586,7 @@ public class XMLParser
public String toString()
{
StringBuffer buf = new StringBuffer(getClass().getName());
CPStringBuilder buf = new CPStringBuilder(getClass().getName());
buf.append('[');
buf.append("name=");
buf.append(name);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -140,7 +142,7 @@ abstract class AbstractNumberNode
start = end;
}
// Process tokens
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
len = tokens.size();
int pos = 0;
for (int i = 0; i < len; i++)
@@ -188,7 +190,7 @@ abstract class AbstractNumberNode
return l;
}*/
void format(StringBuffer buf, int number, String formatToken)
void format(CPStringBuilder buf, int number, String formatToken)
{
int len = formatToken.length();
char c = formatToken.charAt(len - 1);
@@ -254,7 +256,7 @@ abstract class AbstractNumberNode
static final String alphabetic(char offset, int number)
{
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
while (number > 0)
{
int r = number % 26;
@@ -269,7 +271,7 @@ abstract class AbstractNumberNode
static final String roman(boolean upper, int number)
{
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
for (int pos = roman_numbers.length - 1; pos >= 0; pos -= 2)
{
int f = number / roman_numbers[pos];
@@ -317,7 +319,7 @@ abstract class AbstractNumberNode
public String toString()
{
StringBuffer buf = new StringBuffer("number");
CPStringBuilder buf = new CPStringBuilder("number");
buf.append('[');
buf.append("format=");
buf.append(format);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -192,7 +194,7 @@ final class ApplyTemplatesNode
public String toString()
{
StringBuffer buf = new StringBuffer("apply-templates");
CPStringBuilder buf = new CPStringBuilder("apply-templates");
buf.append('[');
boolean o = false;
if (select != null)
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
@@ -231,7 +233,7 @@ final class AttributeNode
public String toString()
{
StringBuffer buf = new StringBuffer("attribute");
CPStringBuilder buf = new CPStringBuilder("attribute");
buf.append('[');
buf.append("name=");
buf.append(name);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -259,7 +261,7 @@ public class Bindings
public String toString()
{
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
boolean next = false;
Collection seen = new HashSet();
Map wctx = (Map) withParameters.getFirst();
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
@@ -86,7 +88,7 @@ final class CallTemplateNode
TemplateNode t = stylesheet.getTemplate(mode, name);
if (t != null)
{
if (withParams != null)
if (!withParams.isEmpty())
{
// compute the parameter values
LinkedList values = new LinkedList();
@@ -118,7 +120,7 @@ final class CallTemplateNode
}
t.apply(stylesheet, mode, context, pos, len,
parent, nextSibling);
if (withParams != null)
if (!withParams.isEmpty())
{
// pop the variable context
stylesheet.bindings.pop(Bindings.WITH_PARAM);
@@ -133,20 +135,17 @@ final class CallTemplateNode
public boolean references(QName var)
{
if (withParams != null)
for (Iterator i = withParams.iterator(); i.hasNext(); )
{
for (Iterator i = withParams.iterator(); i.hasNext(); )
{
if (((WithParam) i.next()).references(var))
return true;
}
if (((WithParam) i.next()).references(var))
return true;
}
return super.references(var);
}
public String toString()
{
StringBuffer buf = new StringBuffer("call-template");
CPStringBuilder buf = new CPStringBuilder("call-template");
buf.append('[');
buf.append("name=");
buf.append(name);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
import org.w3c.dom.Node;
@@ -77,7 +79,7 @@ final class ChooseNode
public String toString()
{
StringBuffer buf = new StringBuffer("choose");
CPStringBuilder buf = new CPStringBuilder("choose");
buf.append('[');
buf.append(']');
return buf.toString();
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.Iterator;
import java.util.StringTokenizer;
import javax.xml.namespace.QName;
@@ -152,7 +154,7 @@ final class CopyNode
public String toString()
{
StringBuffer buf = new StringBuffer("copy");
CPStringBuilder buf = new CPStringBuilder("copy");
if (uas != null)
{
buf.append('[');
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -161,7 +163,7 @@ final class CopyOfNode
public String toString()
{
StringBuffer buf = new StringBuffer("copy-of");
CPStringBuilder buf = new CPStringBuilder("copy-of");
buf.append('[');
buf.append("select=");
buf.append(select);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -238,7 +240,7 @@ final class ElementNode
public String toString()
{
StringBuffer buf = new StringBuffer("element");
CPStringBuilder buf = new CPStringBuilder("element");
buf.append('[');
buf.append("name=");
if (namespace != null)
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -57,9 +59,9 @@ final class ForEachNode
{
final Expr select;
final List sortKeys;
final List<SortKey> sortKeys;
ForEachNode(Expr select, List sortKeys)
ForEachNode(Expr select, List<SortKey> sortKeys)
{
this.select = select;
this.sortKeys = sortKeys;
@@ -67,10 +69,10 @@ final class ForEachNode
TemplateNode clone(Stylesheet stylesheet)
{
int len = sortKeys != null ? sortKeys.size() : 0;
List sortKeys2 = new ArrayList(len);
int len = sortKeys.size();
List<SortKey> sortKeys2 = new ArrayList<SortKey>(len);
for (int i = 0; i < len; i++)
sortKeys2.add(((Key) sortKeys.get(i)).clone(stylesheet));
sortKeys2.add(sortKeys.get(i).clone(stylesheet));
TemplateNode ret = new ForEachNode(select.clone(stylesheet),
sortKeys2);
if (children != null)
@@ -80,6 +82,7 @@ final class ForEachNode
return ret;
}
@Override
void doApply(Stylesheet stylesheet, QName mode,
Node context, int pos, int len,
Node parent, Node nextSibling)
@@ -94,26 +97,26 @@ final class ForEachNode
//System.err.println(toString() + ": " + context+" -> "+ret);
if (ret instanceof Collection)
{
Collection ns = (Collection) ret;
List list = new ArrayList(ns);
if (sortKeys != null)
{
for (Iterator i = sortKeys.iterator(); i.hasNext(); )
{
SortKey sortKey = (SortKey) i.next();
sortKey.init(stylesheet, mode, context, pos, len, parent,
nextSibling);
}
Collections.sort(list, new XSLComparator(sortKeys));
}
else
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> ns = (Collection<Node>) ret;
List<Node> list = new ArrayList<Node>(ns);
if (!sortKeys.isEmpty())
{
for (SortKey sortKey : sortKeys)
{
sortKey.init(stylesheet, mode, context, pos, len, parent,
nextSibling);
}
Collections.sort(list, new XSLComparator(sortKeys));
}
else
Collections.sort(list, documentOrderComparator);
// Perform children for each node
int l = list.size();
int p = 1;
for (Iterator i = list.iterator(); i.hasNext(); )
for (Node node : list)
{
Node node = (Node) i.next();
stylesheet.current = node;
children.apply(stylesheet, mode,
node, p++, l,
@@ -129,24 +132,23 @@ final class ForEachNode
parent, nextSibling);
}
@Override
public boolean references(QName var)
{
if (select != null && select.references(var))
return true;
if (sortKeys != null)
for (Iterator<SortKey> i = sortKeys.iterator(); i.hasNext(); )
{
for (Iterator i = sortKeys.iterator(); i.hasNext(); )
{
if (((SortKey) i.next()).references(var))
return true;
}
if (i.next().references(var))
return true;
}
return super.references(var);
}
@Override
public String toString()
{
StringBuffer buf = new StringBuffer("for-each");
CPStringBuilder buf = new CPStringBuilder("for-each");
buf.append('[');
buf.append("select=");
buf.append(select);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
import org.w3c.dom.Node;
@@ -99,7 +101,7 @@ final class IfNode
public String toString()
{
StringBuffer buf = new StringBuffer("if");
CPStringBuilder buf = new CPStringBuilder("if");
buf.append('[');
buf.append("test=");
buf.append(test);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
@@ -95,7 +97,7 @@ final class MessageNode
public String toString()
{
StringBuffer buf = new StringBuffer("message");
CPStringBuilder buf = new CPStringBuilder("message");
if (terminate)
{
buf.append('[');
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.Collections;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
@@ -53,7 +55,7 @@ import gnu.xml.xpath.Expr;
*/
final class ParameterNode
extends TemplateNode
implements Comparable
implements Comparable<ParameterNode>
{
final QName name;
@@ -67,11 +69,12 @@ final class ParameterNode
this.type = type;
}
TemplateNode clone(Stylesheet stylesheet)
@Override
ParameterNode clone(Stylesheet stylesheet)
{
TemplateNode ret = new ParameterNode(name,
select.clone(stylesheet),
type);
ParameterNode ret = new ParameterNode(name,
select == null ? null : select.clone(stylesheet),
type);
if (children != null)
ret.children = children.clone(stylesheet);
if (next != null)
@@ -129,26 +132,22 @@ final class ParameterNode
return super.references(var);
}
public int compareTo(Object other)
public int compareTo(ParameterNode pn)
{
if (other instanceof ParameterNode)
{
ParameterNode pn = (ParameterNode) other;
boolean r1 = references(pn.name);
boolean r2 = pn.references(name);
if (r1 && r2)
throw new IllegalArgumentException("circular definitions");
if (r1)
return 1;
if (r2)
return -1;
}
boolean r1 = references(pn.name);
boolean r2 = pn.references(name);
if (r1 && r2)
throw new IllegalArgumentException("circular definitions");
if (r1)
return 1;
if (r2)
return -1;
return 0;
}
public String toString()
{
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
switch (type)
{
case Bindings.VARIABLE:
@@ -164,11 +163,8 @@ final class ParameterNode
buf.append('[');
buf.append("name=");
buf.append(name);
if (select != null)
{
buf.append(",select=");
buf.append(select);
}
buf.append(",select=");
buf.append(select);
buf.append(']');
return buf.toString();
}
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
import org.w3c.dom.Document;
@@ -105,7 +107,7 @@ final class ProcessingInstructionNode
public String toString()
{
StringBuffer buf = new StringBuffer("processing-instruction");
CPStringBuilder buf = new CPStringBuilder("processing-instruction");
buf.append('[');
buf.append("name=");
buf.append(name);
@@ -45,7 +45,22 @@ import org.w3c.dom.Node;
import gnu.xml.xpath.Expr;
/**
* An XSL sort key.
* <p>
* An XSL sort key, as specified by section 10 of the XSL
* Transformations specification. This takes the form:
* </p>
* <pre>
* &lt;xsl:sort
* select = string-expression
* lang = { nmtoken }
* data-type = { "text" | "number" | qname-but-not-ncname }
* order = { "ascending" | "descending" }
* case-order = { "upper-first" | "lower-first" } /&rt;
* </pre>
* <p>
* Note that all but the selection expression are optional,
* and so may be {@code null}.
* </p>
*
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
@@ -67,6 +82,20 @@ final class SortKey
transient boolean descending;
transient int caseOrder;
/**
* Constructs a new {@link SortKey} to represent an &lt;xsl:sort&rt;
* tag.
*
* @param select the XPath expression which selects the nodes to be sorted.
* @param lang the language of the sort keys or {@code null} if unspecified.
* @param dataType the data type of the strings. May be "string", "number",
* a QName or {@code null} if unspecified.
* @param order the ordering of the nodes, which may be "ascending", "descending"
* or {@code null} if unspecified.
* @param caseOrder the treatment of case when the data type is a string. This
* may be "upper-first", "lower-first" or {@code null} if
* unspecified.
*/
SortKey(Expr select, TemplateNode lang, TemplateNode dataType,
TemplateNode order, TemplateNode caseOrder)
{
@@ -176,4 +205,35 @@ final class SortKey
return false;
}
/**
* Provides a clone of this {@link SortKey}, using the given
* stylesheet as a context.
*
* @param stylesheet the stylesheet which provides context for the cloning.
* @return a clone of this instance.
*/
SortKey clone(Stylesheet stylesheet)
{
return new SortKey(select.clone(stylesheet),
langTemplate == null ? null : cloneAttributeValueTemplate(langTemplate, stylesheet),
dataTypeTemplate == null ? null : cloneAttributeValueTemplate(dataTypeTemplate, stylesheet),
orderTemplate == null ? null : cloneAttributeValueTemplate(orderTemplate, stylesheet),
caseOrderTemplate == null ? null : cloneAttributeValueTemplate(caseOrderTemplate, stylesheet));
}
/**
* Clones an attribute value template as created by
* {@link Stylesheet#parseAttributeValueTemplate(String, Node)}.
* The node may either by a literal node or an xsl:value-of expression.
*
* @param node the node to clone.
* @param stylesheet the stylesheet which provides context for the cloning.
* @return the cloned node.
*/
private TemplateNode cloneAttributeValueTemplate(TemplateNode node, Stylesheet stylesheet)
{
if (node instanceof ValueOfNode)
return ((ValueOfNode) node).clone(stylesheet);
return ((LiteralNode) node).clone(stylesheet);
}
}
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -595,7 +597,7 @@ public class StreamSerializer
if (!encoder.canEncode(text) || htmlNeedingEncoding)
{
// Check each character
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
int len = text.length();
for (int i = 0; i < len; i++)
{
@@ -648,20 +650,20 @@ public class StreamSerializer
String encode(String text, boolean encodeCtl, boolean inAttr)
{
int len = text.length();
StringBuffer buf = null;
CPStringBuilder buf = null;
for (int i = 0; i < len; i++)
{
char c = text.charAt(i);
if (c == '<')
{
if (buf == null)
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
buf.append("&lt;");
}
else if (c == '>')
{
if (buf == null)
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
buf.append("&gt;");
}
else if (c == '&')
@@ -675,14 +677,14 @@ public class StreamSerializer
else
{
if (buf == null)
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
buf.append("&amp;");
}
}
else if (c == '\'' && inAttr)
{
if (buf == null)
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
if (mode == Stylesheet.OUTPUT_HTML)
// HTML does not define &apos;, use character entity ref
buf.append("&#x27;");
@@ -692,7 +694,7 @@ public class StreamSerializer
else if (c == '"' && inAttr)
{
if (buf == null)
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
buf.append("&quot;");
}
else if (encodeCtl)
@@ -700,7 +702,7 @@ public class StreamSerializer
if (c < 0x20)
{
if (buf == null)
buf = new StringBuffer(text.substring(0, i));
buf = new CPStringBuilder(text.substring(0, i));
buf.append('&');
buf.append('#');
buf.append((int) c);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
@@ -108,18 +110,18 @@ class Stylesheet
*/
String version;
Collection extensionElementPrefixes;
Collection excludeResultPrefixes;
Collection<String> extensionElementPrefixes;
Collection<String> excludeResultPrefixes;
/**
* Set of element names for which we should strip whitespace.
*/
Set stripSpace;
Set<StrippingInstruction> stripSpace;
/**
* Set of element names for which we should preserve whitespace.
*/
Set preserveSpace;
Set<StrippingInstruction> preserveSpace;
/**
* Output options.
@@ -132,34 +134,34 @@ class Stylesheet
boolean outputStandalone;
String outputPublicId;
String outputSystemId;
Collection outputCdataSectionElements;
Collection<String> outputCdataSectionElements;
boolean outputIndent;
String outputMediaType;
/**
* Keys.
*/
Collection keys;
Collection<Key> keys;
/**
* Decimal formats.
*/
Map decimalFormats;
Map<String,DecimalFormat> decimalFormats;
/**
* Namespace aliases.
*/
Map namespaceAliases;
Map<String,String> namespaceAliases;
/**
* Attribute-sets.
*/
List attributeSets;
List<AttributeSet> attributeSets;
/**
* Variables.
*/
List variables;
List<ParameterNode> variables;
/**
* Variable and parameter bindings.
@@ -169,7 +171,7 @@ class Stylesheet
/**
* Templates.
*/
LinkedList templates;
LinkedList<Template> templates;
TemplateNode builtInNodeTemplate;
TemplateNode builtInTextTemplate;
@@ -203,22 +205,22 @@ class Stylesheet
this.systemId = systemId;
this.precedence = precedence;
this.parent = parent;
extensionElementPrefixes = new HashSet();
excludeResultPrefixes = new HashSet();
stripSpace = new LinkedHashSet();
preserveSpace = new LinkedHashSet();
outputCdataSectionElements = new LinkedHashSet();
extensionElementPrefixes = new HashSet<String>();
excludeResultPrefixes = new HashSet<String>();
stripSpace = new LinkedHashSet<StrippingInstruction>();
preserveSpace = new LinkedHashSet<StrippingInstruction>();
outputCdataSectionElements = new LinkedHashSet<String>();
xpath = (XPathImpl) factory.xpathFactory.newXPath();
xpath.setNamespaceContext(this);
if (parent == null)
{
bindings = new Bindings(this);
attributeSets = new LinkedList();
variables = new LinkedList();
namespaceAliases = new LinkedHashMap();
templates = new LinkedList();
keys = new LinkedList();
decimalFormats = new LinkedHashMap();
attributeSets = new LinkedList<AttributeSet>();
variables = new LinkedList<ParameterNode>();
namespaceAliases = new LinkedHashMap<String,String>();
templates = new LinkedList<Template>();
keys = new LinkedList<Key>();
decimalFormats = new LinkedHashMap<String,DecimalFormat>();
initDefaultDecimalFormat();
xpath.setXPathFunctionResolver(this);
}
@@ -247,7 +249,7 @@ class Stylesheet
xpath.setXPathVariableResolver(bindings);
Test anyNode = new NodeTypeTest((short) 0);
List tests = Collections.singletonList(anyNode);
List<Test> tests = Collections.singletonList(anyNode);
builtInNodeTemplate =
new ApplyTemplatesNode(new Selector(Selector.CHILD, tests),
null, null, null, true);
@@ -263,9 +265,8 @@ class Stylesheet
if (debug)
{
System.err.println("Stylesheet: " + doc.getDocumentURI());
for (Iterator i = templates.iterator(); i.hasNext(); )
for (Template t : templates)
{
Template t = (Template) i.next();
t.list(System.err);
System.err.println("--------------------");
}
@@ -307,34 +308,30 @@ class Stylesheet
Stylesheet clone = (Stylesheet) super.clone();
clone.bindings = (Bindings) bindings.clone();
LinkedList templates2 = new LinkedList();
for (Iterator i = templates.iterator(); i.hasNext(); )
LinkedList<Template> templates2 = new LinkedList<Template>();
for (Template t : templates)
{
Template t = (Template) i.next();
templates2.add(t.clone(clone));
}
clone.templates = templates2;
LinkedList attributeSets2 = new LinkedList();
for (Iterator i = attributeSets.iterator(); i.hasNext(); )
LinkedList<AttributeSet> attributeSets2 = new LinkedList<AttributeSet>();
for (AttributeSet as : attributeSets)
{
AttributeSet as = (AttributeSet) i.next();
attributeSets2.add(as.clone(clone));
}
clone.attributeSets = attributeSets2;
LinkedList variables2 = new LinkedList();
for (Iterator i = variables.iterator(); i.hasNext(); )
LinkedList<ParameterNode> variables2 = new LinkedList<ParameterNode>();
for (ParameterNode var : variables)
{
ParameterNode var = (ParameterNode) i.next();
variables2.add(var.clone(clone));
}
clone.variables = variables2;
LinkedList keys2 = new LinkedList();
for (Iterator i = keys.iterator(); i.hasNext(); )
LinkedList<Key> keys2 = new LinkedList<Key>();
for (Key k : keys)
{
Key k = (Key) i.next();
keys2.add(k.clone(clone));
}
clone.keys = keys2;
@@ -357,11 +354,10 @@ class Stylesheet
// See XSLT 11.4: "If the template or expression specifying the value of
// a global variable x references a global variable y, then the value
// for y must be computed before the value of x."
List topLevel = new ArrayList(variables);
List<ParameterNode> topLevel = new ArrayList<ParameterNode>(variables);
Collections.sort(topLevel);
for (Iterator i = topLevel.iterator(); i.hasNext(); )
for (ParameterNode var : topLevel)
{
ParameterNode var = (ParameterNode) i.next();
bindings.set(var.name,
var.getValue(this, null, context, 1, 1),
var.type);
@@ -381,7 +377,7 @@ class Stylesheet
return (current == null) ? null : current.lookupPrefix(namespaceURI);
}
public Iterator getPrefixes(String namespaceURI)
public Iterator<String> getPrefixes(String namespaceURI)
{
// TODO
return Collections.singleton(getPrefix(namespaceURI)).iterator();
@@ -408,9 +404,8 @@ class Stylesheet
if (debug)
System.err.println("getTemplate: mode="+mode+" context="+context);
Template selected = null;
for (Iterator j = templates.iterator(); j.hasNext(); )
for (Template t : templates)
{
Template t = (Template) j.next();
boolean isMatch = t.matches(mode, context);
if (applyImports)
{
@@ -472,9 +467,8 @@ class Stylesheet
throws TransformerException
{
Template selected = null;
for (Iterator j = templates.iterator(); j.hasNext(); )
for (Template t : templates)
{
Template t = (Template) j.next();
boolean isMatch = t.matches(name);
if (isMatch)
{
@@ -862,8 +856,8 @@ class Stylesheet
// Tokenize
int len = value.length();
int off = 0;
List tokens = new ArrayList(); // text tokens
List types = new ArrayList(); // literal or expression
List<String> tokens = new ArrayList<String>(); // text tokens
List<Boolean> types = new ArrayList<Boolean>(); // literal or expression
int depth = 0;
for (int i = 0; i < len; i++)
{
@@ -936,8 +930,8 @@ class Stylesheet
len = tokens.size();
for (int i = len - 1; i >= 0; i--)
{
String token = (String) tokens.get(i);
Boolean type = (Boolean) types.get(i);
String token = tokens.get(i);
Boolean type = types.get(i);
if (type == Boolean.TRUE)
{
// Expression text
@@ -989,9 +983,8 @@ class Stylesheet
{
// Conflict resolution
StrippingInstruction ssi = null, psi = null;
for (Iterator i = stripSpace.iterator(); i.hasNext(); )
for (StrippingInstruction si : stripSpace)
{
StrippingInstruction si = (StrippingInstruction) i.next();
if (si.element.matches(ctx, 1, 1))
{
if (ssi != null)
@@ -1005,9 +998,8 @@ class Stylesheet
ssi = si;
}
}
for (Iterator i = preserveSpace.iterator(); i.hasNext(); )
for (StrippingInstruction si : preserveSpace)
{
StrippingInstruction si = (StrippingInstruction) i.next();
if (si.element.matches(ctx, 1, 1))
{
if (psi != null)
@@ -1114,8 +1106,8 @@ class Stylesheet
if (s == null)
s = "child::node()";
Node children = node.getFirstChild();
List sortKeys = parseSortKeys(children);
List withParams = parseWithParams(children);
List<SortKey> sortKeys = parseSortKeys(children);
List<WithParam> withParams = parseWithParams(children);
Expr select = (Expr) xpath.compile(s);
return new ApplyTemplatesNode(select, mode,
sortKeys, withParams, false);
@@ -1131,7 +1123,7 @@ class Stylesheet
String n = getRequiredAttribute(attrs, "name", node);
QName name = getQName(n);
Node children = node.getFirstChild();
List withParams = parseWithParams(children);
List<WithParam> withParams = parseWithParams(children);
return new CallTemplateNode(name, withParams);
}
@@ -1158,7 +1150,7 @@ class Stylesheet
NamedNodeMap attrs = node.getAttributes();
String s = getRequiredAttribute(attrs, "select", node);
Node children = node.getFirstChild();
List sortKeys = parseSortKeys(children);
List<SortKey> sortKeys = parseSortKeys(children);
Expr select = (Expr) xpath.compile(s);
ForEachNode ret = new ForEachNode(select, sortKeys);
ret.children = parse(children);
@@ -1620,10 +1612,10 @@ class Stylesheet
return ret;
}
final List parseSortKeys(Node node)
final List<SortKey> parseSortKeys(Node node)
throws TransformerConfigurationException, XPathExpressionException
{
List ret = new LinkedList();
List<SortKey> ret = new LinkedList<SortKey>();
while (node != null)
{
String namespaceUri = node.getNamespaceURI();
@@ -1652,13 +1644,13 @@ class Stylesheet
}
node = node.getNextSibling();
}
return ret.isEmpty() ? null : ret;
return ret;
}
final List parseWithParams(Node node)
final List<WithParam> parseWithParams(Node node)
throws TransformerConfigurationException, XPathExpressionException
{
List ret = new LinkedList();
List<WithParam> ret = new LinkedList<WithParam>();
while (node != null)
{
String namespaceUri = node.getNamespaceURI();
@@ -1688,7 +1680,7 @@ class Stylesheet
}
node = node.getNextSibling();
}
return ret.isEmpty() ? null : ret;
return ret;
}
/**
@@ -1697,7 +1689,7 @@ class Stylesheet
* exclude-result-prefixes.
*/
final void addNamespaceNodes(Node source, Node target, Document doc,
Collection elementExcludeResultPrefixes)
Collection<String> elementExcludeResultPrefixes)
{
NamedNodeMap attrs = source.getAttributes();
if (attrs != null)
@@ -1768,5 +1760,14 @@ class Stylesheet
dst.setUserData(key, data, this);
}
public String toString()
{
CPStringBuilder b = new CPStringBuilder(getClass().getName());
b.append("[templates=");
b.append(templates);
b.append("]");
return b.toString();
}
}
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.io.PrintStream;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
@@ -226,7 +228,7 @@ class Template
public String toString()
{
StringBuffer buf = new StringBuffer(getClass().getName());
CPStringBuilder buf = new CPStringBuilder(getClass().getName());
buf.append('[');
if (name != null)
{
@@ -243,6 +245,8 @@ class Template
buf.append(",mode=");
buf.append(mode);
}
buf.append(",node=");
buf.append(node);
buf.append(']');
return buf.toString();
@@ -52,7 +52,7 @@ import gnu.xml.xpath.DocumentOrderComparator;
abstract class TemplateNode
{
static final Comparator documentOrderComparator =
static final Comparator<Node> documentOrderComparator =
new DocumentOrderComparator();
TemplateNode children;
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.Properties;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
@@ -76,5 +78,18 @@ class TemplatesImpl
{
return (Properties) outputProperties.clone();
}
public String toString()
{
CPStringBuilder b = new CPStringBuilder(getClass().getName());
b.append("[factory=");
b.append(factory);
b.append(",stylesheet=");
b.append(stylesheet);
b.append(",outputProperties=");
b.append(outputProperties);
b.append("]");
return b.toString();
}
}
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
import org.w3c.dom.Document;
@@ -106,7 +108,7 @@ final class TextNode
public String toString()
{
StringBuffer buf = new StringBuffer("text");
CPStringBuilder buf = new CPStringBuilder("text");
if (disableOutputEscaping)
{
buf.append('[');
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -722,7 +724,7 @@ class TransformerImpl
}
else
{
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
buf.append('\n');
for (int i = 0; i < offset + 1; i++)
buf.append(INDENT_WHITESPACE);
@@ -733,7 +735,7 @@ class TransformerImpl
node.insertBefore(doc.createTextNode(ws), ctx);
reindent(doc, ctx, offset + 1);
}
buf = new StringBuffer();
buf = new CPStringBuilder();
buf.append('\n');
for (int i = 0; i < offset; i++)
buf.append(INDENT_WHITESPACE);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -95,7 +97,7 @@ class TransformerOutputProperties
defaultProperties.put(OutputKeys.DOCTYPE_SYSTEM,
stylesheet.outputSystemId);
}
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
for (Iterator i = stylesheet.outputCdataSectionElements.iterator();
i.hasNext(); )
{
@@ -61,27 +61,28 @@ final class UnparsedEntityUriFunction
implements XPathFunction, Function
{
List args;
List<Expr> args;
public Object evaluate(List args)
throws XPathFunctionException
{
// Useless...
return Collections.EMPTY_SET;
return Collections.emptySet();
}
public void setArguments(List args)
public void setArguments(List<Expr> args)
{
this.args = args;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
int arity = args.size();
List values = new ArrayList(arity);
List<Object> values = new ArrayList<Object>(arity);
for (int i = 0; i < arity; i++)
{
Expr arg = (Expr) args.get(i);
Expr arg = args.get(i);
values.add(arg.evaluate(context, pos, len));
}
String name = _string(context, values.get(0));
@@ -107,10 +108,10 @@ final class UnparsedEntityUriFunction
{
UnparsedEntityUriFunction f = new UnparsedEntityUriFunction();
int len = args.size();
List args2 = new ArrayList(len);
List<Expr> args2 = new ArrayList<Expr>(len);
for (int i = 0; i < len; i++)
{
args2.add(((Expr) args.get(i)).clone(context));
args2.add(args.get(i).clone(context));
}
f.setArguments(args2);
return f;
@@ -118,9 +119,9 @@ final class UnparsedEntityUriFunction
public boolean references(QName var)
{
for (Iterator i = args.iterator(); i.hasNext(); )
for (Iterator<Expr> i = args.iterator(); i.hasNext(); )
{
if (((Expr) i.next()).references(var))
if (i.next().references(var))
{
return true;
}
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import java.util.Collection;
import java.util.Iterator;
import javax.xml.namespace.QName;
@@ -74,7 +76,8 @@ final class ValueOfNode
ret.next = next.clone(stylesheet);
return ret;
}
@Override
void doApply(Stylesheet stylesheet, QName mode,
Node context, int pos, int len,
Node parent, Node nextSibling)
@@ -84,10 +87,9 @@ final class ValueOfNode
String value;
if (ret instanceof Collection)
{
StringBuffer buf = new StringBuffer();
for (Iterator i = ((Collection) ret).iterator(); i.hasNext(); )
CPStringBuilder buf = new CPStringBuilder();
for (Node node : ((Collection<Node>) ret))
{
Node node = (Node) i.next();
buf.append(Expr.stringValue(node));
}
value = buf.toString();
@@ -126,7 +128,7 @@ final class ValueOfNode
public String toString()
{
StringBuffer buf = new StringBuffer("value-of");
CPStringBuilder buf = new CPStringBuilder("value-of");
buf.append('[');
buf.append("select=");
buf.append(select);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.transform;
import gnu.java.lang.CPStringBuilder;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
import org.w3c.dom.Node;
@@ -102,7 +104,7 @@ final class WhenNode
public String toString()
{
StringBuffer buf = new StringBuffer("when");
CPStringBuilder buf = new CPStringBuilder("when");
buf.append('[');
buf.append("test=");
buf.append(test);
@@ -51,72 +51,66 @@ import gnu.xml.xpath.Expr;
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
class XSLComparator
implements Comparator
implements Comparator<Node>
{
final List sortKeys;
final List<SortKey> sortKeys;
XSLComparator(List sortKeys)
XSLComparator(List<SortKey> sortKeys)
{
this.sortKeys = sortKeys;
}
public int compare(Object o1, Object o2)
public int compare(Node n1, Node n2)
{
if (o1 instanceof Node && o2 instanceof Node)
for (SortKey sortKey : sortKeys)
{
Node n1 = (Node) o1;
Node n2 = (Node) o2;
for (Iterator i = sortKeys.iterator(); i.hasNext(); )
{
SortKey sortKey = (SortKey) i.next();
String k1 = sortKey.key(n1);
String k2 = sortKey.key(n2);
if ("text".equals(sortKey.dataType))
{
Locale locale = (sortKey.lang == null) ? Locale.getDefault() :
new Locale(sortKey.lang);
Collator collator = Collator.getInstance(locale);
int d = collator.compare(k1, k2);
if (d != 0)
{
switch (sortKey.caseOrder)
{
case SortKey.UPPER_FIRST:
// TODO
break;
case SortKey.LOWER_FIRST:
// TODO
break;
}
if (sortKey.descending)
{
d = -d;
}
return d;
}
}
else if ("number".equals(sortKey.dataType))
{
double kn1 = Expr._number(n1, k1);
double kn2 = Expr._number(n2, k2);
int d;
if (Double.isNaN(kn1) || Double.isInfinite(kn2))
{
d = -1;
}
else if (Double.isNaN(kn2) || Double.isInfinite(kn1))
{
d = 1;
}
else
{
// conversion to int may give 0 for small numbers
d = (kn1 > kn2) ? 1 : (kn1 < kn2) ? -1 : 0;
}
return (sortKey.descending) ? -d : d;
}
}
String k1 = sortKey.key(n1);
String k2 = sortKey.key(n2);
if ("text".equals(sortKey.dataType))
{
Locale locale = (sortKey.lang == null) ? Locale.getDefault() :
new Locale(sortKey.lang);
Collator collator = Collator.getInstance(locale);
int d = collator.compare(k1, k2);
if (d != 0)
{
switch (sortKey.caseOrder)
{
case SortKey.UPPER_FIRST:
// TODO
break;
case SortKey.LOWER_FIRST:
// TODO
break;
}
if (sortKey.descending)
{
d = -d;
}
return d;
}
}
else if ("number".equals(sortKey.dataType))
{
double kn1 = Expr._number(n1, k1);
double kn2 = Expr._number(n2, k2);
int d;
if (Double.isNaN(kn1) || Double.isInfinite(kn2))
{
d = -1;
}
else if (Double.isNaN(kn2) || Double.isInfinite(kn1))
{
d = 1;
}
else
{
// conversion to int may give 0 for small numbers
d = (kn1 > kn2) ? 1 : (kn1 < kn2) ? -1 : 0;
}
return (sortKey.descending) ? -d : d;
}
}
return 0;
}
@@ -75,8 +75,8 @@ class XSLURIResolver
implements URIResolver
{
Map lastModifiedCache = new HashMap();
Map nodeCache = new HashMap();
final Map<String,Long> lastModifiedCache = new HashMap<String,Long>();
final Map<String,Node> nodeCache = new HashMap<String,Node>();
DocumentBuilder builder;
URIResolver userResolver;
ErrorListener userListener;
@@ -157,10 +157,10 @@ class XSLURIResolver
if (url != null)
{
systemId = url.toString();
node = (Node) nodeCache.get(systemId);
node = nodeCache.get(systemId);
// Is the resource up to date?
URLConnection conn = url.openConnection();
Long llm = (Long) lastModifiedCache.get(systemId);
Long llm = lastModifiedCache.get(systemId);
if (llm != null)
{
lastLastModified = llm.longValue();
@@ -301,6 +301,7 @@ class XSLURIResolver
{
SAXEventSink eventSink = new SAXEventSink();
eventSink.setReader(reader);
eventSink.setNamespaceAware(true);
reader.setContentHandler(eventSink);
reader.setDTDHandler(eventSink);
reader.setProperty("http://xml.org/sax/properties/lexical-handler",
+3 -1
View File
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.util;
import gnu.java.lang.CPStringBuilder;
import java.io.IOException;
import org.xml.sax.ErrorHandler;
@@ -271,7 +273,7 @@ final public class DoParse
String label,
SAXParseException e
) {
StringBuffer buf = new StringBuffer ();
CPStringBuilder buf = new CPStringBuilder ();
int temp;
buf.append ("** ");
+4 -2
View File
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.xml.util;
import gnu.java.lang.CPStringBuilder;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
@@ -623,7 +625,7 @@ public class XCat implements EntityResolver2
private static String normalizePublicId (boolean full, String publicId)
{
if (publicId.startsWith ("urn:publicid:")) {
StringBuffer buf = new StringBuffer ();
CPStringBuilder buf = new CPStringBuilder ();
char chars [] = publicId.toCharArray ();
boolean hasbug = false;
@@ -814,7 +816,7 @@ System.err.println ("nyet unhexing public id: " + publicId);
replace = (String) rewrites.get (temp);
}
if (prefix != null) {
StringBuffer buf = new StringBuffer (replace);
CPStringBuilder buf = new CPStringBuilder (replace);
buf.append (uri.substring (prefixLen));
// IF the URI is accessible ...
return new InputSource (buf.toString ());
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.util;
import gnu.java.lang.CPStringBuilder;
import java.io.BufferedWriter;
import java.io.CharConversionException;
import java.io.IOException;
@@ -152,7 +154,7 @@ public class XMLWriter
private String eol = sysEOL;
private short dangerMask;
private StringBuffer stringBuf;
private CPStringBuilder stringBuf;
private Locator locator;
private ErrorHandler errHandler;
@@ -289,7 +291,7 @@ public class XMLWriter
}
if (dangerMask != 0)
stringBuf = new StringBuffer ();
stringBuf = new CPStringBuilder ();
}
this.encoding = encoding;
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
import gnu.java.lang.CPStringBuilder;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import org.relaxng.datatype.DatatypeException;
@@ -75,7 +77,7 @@ final class EntitiesType
throws DatatypeException
{
super.checkValid(value, context);
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
int len = value.length();
for (int i = 0; i < len; i++)
{
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
import gnu.java.lang.CPStringBuilder;
import java.io.IOException;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
@@ -79,7 +81,7 @@ final class NMTokensType
{
super.checkValid(value, context);
int len = value.length();
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
for (int i = 0; i < len; i++)
{
char c = value.charAt(i);
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import javax.xml.namespace.QName;
import org.w3c.dom.Node;
@@ -139,7 +141,7 @@ final class ArithmeticExpr
public String toString()
{
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
buf.append(lhs);
buf.append(' ');
switch (op)
@@ -61,9 +61,9 @@ final class BooleanFunction
final Expr arg;
BooleanFunction(List args)
BooleanFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
BooleanFunction(Expr arg)
@@ -54,9 +54,9 @@ final class CeilingFunction
final Expr arg;
CeilingFunction(List args)
CeilingFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
CeilingFunction(Expr arg)
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -52,19 +54,19 @@ final class ConcatFunction
extends Expr
{
final List args;
final List<Expr> args;
ConcatFunction(List args)
ConcatFunction(List<Expr> args)
{
this.args = args;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
StringBuffer buf = new StringBuffer();
for (Iterator i = args.iterator(); i.hasNext(); )
CPStringBuilder buf = new CPStringBuilder();
for (Expr arg : args)
{
Expr arg = (Expr) i.next();
Object val = arg.evaluate(context, pos, len);
buf.append(_string(context, val));
}
@@ -74,19 +76,19 @@ final class ConcatFunction
public Expr clone(Object context)
{
int len = args.size();
List args2 = new ArrayList(len);
List<Expr> args2 = new ArrayList<Expr>(len);
for (int i = 0; i < len; i++)
{
args2.add(((Expr) args.get(i)).clone(context));
args2.add(args.get(i).clone(context));
}
return new ConcatFunction(args2);
}
public boolean references(QName var)
{
for (Iterator i = args.iterator(); i.hasNext(); )
for (Iterator<Expr> i = args.iterator(); i.hasNext(); )
{
if (((Expr) i.next()).references(var))
if (i.next().references(var))
{
return true;
}
@@ -96,7 +98,7 @@ final class ConcatFunction
public String toString()
{
StringBuffer buf = new StringBuffer("concat(");
CPStringBuilder buf = new CPStringBuilder("concat(");
int len = args.size();
for (int i = 0; i < len; i++)
{
@@ -54,9 +54,9 @@ final class ContainsFunction
final Expr arg1;
final Expr arg2;
ContainsFunction(List args)
ContainsFunction(List<Expr> args)
{
this((Expr) args.get(0), (Expr) args.get(1));
this(args.get(0), args.get(1));
}
ContainsFunction(Expr arg1, Expr arg2)
@@ -65,6 +65,7 @@ final class ContainsFunction
this.arg2 = arg2;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val1 = arg1.evaluate(context, pos, len);
@@ -54,9 +54,9 @@ final class CountFunction
final Expr arg;
CountFunction(List args)
CountFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
CountFunction(Expr arg)
@@ -64,10 +64,11 @@ final class CountFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
return new Double((double) ((Collection) val).size());
return new Double((double) ((Collection<?>) val).size());
}
public Expr clone(Object context)
@@ -46,18 +46,12 @@ import org.w3c.dom.Node;
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
*/
public class DocumentOrderComparator
implements Comparator
implements Comparator<Node>
{
public int compare(Object o1, Object o2)
public int compare(Node n1, Node n2)
{
if (o1 instanceof Node && o2 instanceof Node)
{
Node n1 = (Node)o1;
Node n2 = (Node)o2;
return (int) n1.compareDocumentPosition(n2);
}
return 0;
return (int) n1.compareDocumentPosition(n2);
}
}
@@ -62,6 +62,7 @@ final class EqualityExpr
this.invert = invert;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
boolean val = evaluateImpl(context, pos, len);
@@ -90,19 +91,20 @@ final class EqualityExpr
boolean frns = right instanceof Collection;
if (flns && frns)
{
Collection lns = (Collection) left;
Collection rns = (Collection) right;
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> lns = (Collection<Node>) left;
@SuppressWarnings("unchecked")
Collection<Node> rns = (Collection<Node>) right;
if (lns.isEmpty())
{
return false;
}
boolean all = true;
for (Iterator i = lns.iterator(); i.hasNext(); )
{
Node ltest = (Node) i.next();
for (Iterator j = rns.iterator(); j.hasNext(); )
{
Node rtest = (Node) j.next();
for (Node ltest : lns)
{
for (Node rtest : rns)
{
if (ltest == rtest || ltest.equals(rtest))
{
// much shorter
@@ -138,13 +140,14 @@ final class EqualityExpr
boolean frn = right instanceof Double;
if ((flns && frn) || (frns && fln))
{
Collection ns = flns ? (Collection) left : (Collection) right;
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> ns = flns ? (Collection<Node>) left : (Collection<Node>) right;
double n = fln ? ((Double) left).doubleValue() :
((Double) right).doubleValue();
boolean all = true;
for (Iterator i = ns.iterator(); i.hasNext(); )
for (Node test : ns)
{
Node test = (Node) i.next();
double nn = _number(context, stringValue(test));
if (nn == n)
{
@@ -171,12 +174,13 @@ final class EqualityExpr
boolean frs = right instanceof String;
if ((flns && frs) || (frns && fls))
{
Collection ns = flns ? (Collection) left : (Collection) right;
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> ns = flns ? (Collection<Node>) left : (Collection<Node>) right;
String s = fls ? (String) left : (String) right;
boolean all = true;
for (Iterator i = ns.iterator(); i.hasNext(); )
for (Node test : ns)
{
Node test = (Node) i.next();
if (stringValue(test).equals(s))
{
if (!invert)
@@ -202,7 +206,9 @@ final class EqualityExpr
boolean frb = right instanceof Boolean;
if ((flns && frb) || (frns && flb))
{
Collection ns = flns ? (Collection) left : (Collection) right;
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> ns = flns ? (Collection<Node>) left : (Collection<Node>) right;
boolean b = flb ? ((Boolean) left).booleanValue() :
((Boolean) right).booleanValue();
return _boolean(context, ns) == b;
+47 -28
View File
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
@@ -73,7 +75,7 @@ public abstract class Expr
implements XPathExpression
{
protected static final Comparator documentOrderComparator =
protected static final Comparator<Node> documentOrderComparator =
new DocumentOrderComparator();
protected static final DecimalFormat decimalFormat =
@@ -84,14 +86,14 @@ public abstract class Expr
static class ExprNodeSet implements NodeList
{
private ArrayList list;
private ArrayList<Node> list;
ExprNodeSet(Collection collection)
ExprNodeSet(Collection<Node> collection)
{
if (collection instanceof ArrayList)
list = (ArrayList) collection;
list = (ArrayList<Node>) collection;
else
list = new ArrayList(collection);
list = new ArrayList<Node>(collection);
}
public int getLength()
@@ -103,7 +105,7 @@ public abstract class Expr
{
try
{
return (Node) list.get(index);
return list.get(index);
}
catch (ArrayIndexOutOfBoundsException e)
{
@@ -141,14 +143,17 @@ public abstract class Expr
{
if (ret instanceof Collection)
{
Collection ns = (Collection) ret;
/* Suppression is safe, as we know context
produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> ns = (Collection<Node>) ret;
switch (ns.size())
{
case 0:
ret = null;
break;
case 1:
ret = (Node) ns.iterator().next();
ret = ns.iterator().next();
break;
default:
throw new XPathExpressionException("multiple nodes in node-set");
@@ -166,7 +171,12 @@ public abstract class Expr
throw new XPathExpressionException("return value is not a node-set");
}
if (ret != null)
ret = new ExprNodeSet((Collection) ret);
{
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> nodes = (Collection<Node>) ret;
ret = new ExprNodeSet(nodes);
}
}
}
return ret;
@@ -229,15 +239,17 @@ public abstract class Expr
* same document as the context node that have a unique ID equal to any of
* the tokens in the list.
*/
public static Collection _id(Node context, Object object)
public static Collection<Node> _id(Node context, Object object)
{
Set ret = new HashSet();
Set<Node> ret = new HashSet<Node>();
if (object instanceof Collection)
{
Collection nodeSet = (Collection) object;
for (Iterator i = nodeSet.iterator(); i.hasNext(); )
/* Suppression is safe, as the iteration will check each value is a Node */
@SuppressWarnings("unchecked")
Collection<Node> nodeSet = (Collection<Node>) object;
for (Iterator<Node> i = nodeSet.iterator(); i.hasNext(); )
{
String string = stringValue((Node) i.next());
String string = stringValue(i.next());
ret.addAll(_id (context, string));
}
}
@@ -266,7 +278,7 @@ public abstract class Expr
* an empty string is returned. If the argument is omitted, it defaults to
* a node-set with the context node as its only member.
*/
public static String _local_name(Node context, Collection nodeSet)
public static String _local_name(Node context, Collection<Node> nodeSet)
{
if (nodeSet == null || nodeSet.isEmpty())
return "";
@@ -283,7 +295,7 @@ public abstract class Expr
* empty string is returned. If the argument is omitted, it defaults to a
* node-set with the context node as its only member.
*/
public static String _namespace_uri(Node context, Collection nodeSet)
public static String _namespace_uri(Node context, Collection<Node> nodeSet)
{
if (nodeSet == null || nodeSet.isEmpty())
return "";
@@ -308,7 +320,7 @@ public abstract class Expr
* string is returned. If the argument it omitted, it defaults to a
* node-set with the context node as its only member.
*/
public static String _name(Node context, Collection nodeSet)
public static String _name(Node context, Collection<Node> nodeSet)
{
if (nodeSet == null || nodeSet.isEmpty())
return "";
@@ -327,11 +339,11 @@ public abstract class Expr
/**
* Returns the first node in the set in document order.
*/
static Node firstNode(Collection nodeSet)
static Node firstNode(Collection<Node> nodeSet)
{
List list = new ArrayList(nodeSet);
List<Node> list = new ArrayList<Node>(nodeSet);
Collections.sort(list, documentOrderComparator);
return (Node) list.get(0);
return list.get(0);
}
/* -- 4.2 String Functions -- */
@@ -387,7 +399,10 @@ public abstract class Expr
}
if (object instanceof Collection)
{
Collection nodeSet = (Collection) object;
/* Suppression is safe, as we fail immediately if the
* first element is not a Node and don't use the rest */
@SuppressWarnings("unchecked")
Collection<Node> nodeSet = (Collection<Node>) object;
if (nodeSet.isEmpty())
{
return "";
@@ -422,7 +437,7 @@ public abstract class Expr
}
if (object instanceof Collection)
{
return ((Collection) object).size() != 0;
return ((Collection<?>) object).size() != 0;
}
return false; // TODO user defined types
}
@@ -448,8 +463,12 @@ public abstract class Expr
}
if (object instanceof Collection)
{
/* Suppression is safe, as we fail immediately if one
* of the elements is not a Node */
@SuppressWarnings("unchecked")
Collection<Node> nodeSet = (Collection<Node>) object;
// Convert node-set to string
object = stringValue((Collection) object);
object = stringValue(nodeSet);
}
if (object instanceof String)
{
@@ -469,12 +488,12 @@ public abstract class Expr
/**
* Computes the XPath string-value of the specified node-set.
*/
public static String stringValue(Collection nodeSet)
public static String stringValue(Collection<Node> nodeSet)
{
StringBuffer buf = new StringBuffer();
for (Iterator i = nodeSet.iterator(); i.hasNext(); )
CPStringBuilder buf = new CPStringBuilder();
for (Iterator<Node> i = nodeSet.iterator(); i.hasNext(); )
{
buf.append(stringValue((Node) i.next()));
buf.append(stringValue(i.next()));
}
return buf.toString();
}
@@ -494,7 +513,7 @@ public abstract class Expr
case Node.DOCUMENT_NODE: // 5.1 Root Node
case Node.DOCUMENT_FRAGMENT_NODE:
case Node.ELEMENT_NODE: // 5.2 Element Nodes
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
for (Node ctx = node.getFirstChild(); ctx != null;
ctx = ctx.getNextSibling())
{
@@ -54,9 +54,9 @@ final class FloorFunction
final Expr arg;
FloorFunction(List args)
FloorFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
FloorFunction(Expr arg)
@@ -64,6 +64,7 @@ final class FloorFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
@@ -51,7 +51,7 @@ public interface Function
/**
* Sets the list of expressions to evaluate as parameter values.
*/
void setArguments(List args);
void setArguments(List<Expr> args);
}
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -58,20 +60,24 @@ public final class FunctionCall
final XPathFunctionResolver resolver;
final String name;
final List args;
final List<Expr> args;
public FunctionCall(XPathFunctionResolver resolver, String name)
{
this(resolver, name, Collections.EMPTY_LIST);
this(resolver, name, null);
}
public FunctionCall(XPathFunctionResolver resolver, String name, List args)
public FunctionCall(XPathFunctionResolver resolver, String name, List<Expr> args)
{
this.resolver = resolver;
this.name = name;
this.args = args;
if (args == null)
this.args = Collections.emptyList();
else
this.args = args;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
if (resolver != null)
@@ -92,7 +98,7 @@ public final class FunctionCall
}
else
{
List values = new ArrayList(arity);
List<Object> values = new ArrayList<Object>(arity);
for (int i = 0; i < arity; i++)
{
Expr arg = (Expr) args.get(i);
@@ -117,10 +123,10 @@ public final class FunctionCall
public Expr clone(Object context)
{
int len = args.size();
List args2 = new ArrayList(len);
List<Expr> args2 = new ArrayList<Expr>(len);
for (int i = 0; i < len; i++)
{
args2.add(((Expr) args.get(i)).clone(context));
args2.add(args.get(i).clone(context));
}
XPathFunctionResolver r = resolver;
if (context instanceof XPathFunctionResolver)
@@ -132,9 +138,9 @@ public final class FunctionCall
public boolean references(QName var)
{
for (Iterator i = args.iterator(); i.hasNext(); )
for (Iterator<Expr> i = args.iterator(); i.hasNext(); )
{
if (((Expr) i.next()).references(var))
if (i.next().references(var))
{
return true;
}
@@ -144,7 +150,7 @@ public final class FunctionCall
public String toString()
{
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
buf.append(name);
buf.append('(');
int len = args.size();
@@ -62,9 +62,9 @@ public final class IdFunction
final Expr arg;
IdFunction(List args)
IdFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
public IdFunction(Expr arg)
@@ -75,9 +75,10 @@ public final class IdFunction
public boolean matches(Node context)
{
Object ret = evaluate(context, 1, 1);
return !((Collection) ret).isEmpty();
return !((Collection<?>) ret).isEmpty();
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
@@ -64,9 +64,9 @@ final class LangFunction
final Expr arg;
LangFunction(List args)
LangFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
LangFunction(Expr arg)
@@ -74,6 +74,7 @@ final class LangFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
@@ -59,9 +59,9 @@ final class LocalNameFunction
final Expr arg;
LocalNameFunction(List args)
LocalNameFunction(List<Expr> args)
{
this(args.size() > 0 ? (Expr) args.get(0) : null);
this(args.size() > 0 ? args.get(0) : null);
}
LocalNameFunction(Expr arg)
@@ -69,11 +69,14 @@ final class LocalNameFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = (arg == null) ? Collections.singleton(context) :
arg.evaluate(context, pos, len);
return _local_name(context, (Collection) val);
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> val = (arg == null) ? Collections.singleton(context) :
(Collection<Node>) arg.evaluate(context, pos, len);
return _local_name(context, val);
}
public Expr clone(Object context)
@@ -67,9 +67,9 @@ final class NameFunction
final Expr arg;
NameFunction(List args)
NameFunction(List<Expr> args)
{
this(args.size() > 0 ? (Expr) args.get(0) : null);
this(args.size() > 0 ? args.get(0) : null);
}
NameFunction(Expr arg)
@@ -77,24 +77,30 @@ final class NameFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = (arg == null) ? Collections.singleton(context) :
arg.evaluate(context, pos, len);
return _name(context, (Collection) val);
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> val = (arg == null) ? Collections.singleton(context) :
(Collection<Node>) arg.evaluate(context, pos, len);
return _name(context, val);
}
@Override
public Expr clone(Object context)
{
return new NameFunction((arg == null) ? null :
arg.clone(context));
}
@Override
public boolean references(QName var)
{
return (arg == null) ? false : arg.references(var);
}
@Override
public String toString()
{
return (arg == null) ? "name()" : "name(" + arg + ")";
@@ -59,9 +59,9 @@ final class NamespaceUriFunction
final Expr arg;
NamespaceUriFunction(List args)
NamespaceUriFunction(List<Expr> args)
{
this(args.size() > 0 ? (Expr) args.get(0) : null);
this(args.size() > 0 ? args.get(0) : null);
}
NamespaceUriFunction(Expr arg)
@@ -69,11 +69,14 @@ final class NamespaceUriFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = (arg == null) ? Collections.singleton(context) :
arg.evaluate(context, pos, len);
return _namespace_uri(context, (Collection) val);
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> val = (arg == null) ? Collections.singleton(context) :
(Collection<Node>) arg.evaluate(context, pos, len);
return _namespace_uri(context, val);
}
public Expr clone(Object context)
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import java.util.List;
import java.util.StringTokenizer;
import javax.xml.namespace.QName;
@@ -59,9 +61,9 @@ final class NormalizeSpaceFunction
final Expr arg;
NormalizeSpaceFunction(List args)
NormalizeSpaceFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
NormalizeSpaceFunction(Expr arg)
@@ -69,12 +71,13 @@ final class NormalizeSpaceFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
String s = _string(context, val);
StringTokenizer st = new StringTokenizer(s, " \t\r\n");
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
if (st.hasMoreTokens())
{
buf.append(st.nextToken());
@@ -53,9 +53,9 @@ final class NotFunction
final Expr arg;
NotFunction(List args)
NotFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
NotFunction(Expr arg)
@@ -63,6 +63,7 @@ final class NotFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
@@ -68,9 +68,9 @@ final class NumberFunction
final Expr arg;
NumberFunction(List args)
NumberFunction(List<Expr> args)
{
this(args.size() > 0 ? (Expr) args.get(0) : null);
this(args.size() > 0 ? args.get(0) : null);
}
NumberFunction(Expr arg)
@@ -78,6 +78,7 @@ final class NumberFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
@@ -60,12 +60,17 @@ final class ParenthesizedExpr
this.expr = expr;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object ret = expr.evaluate(context, pos, len);
if (ret instanceof Collection)
{
List list = new ArrayList((Collection) ret);
/* Suppression is safe, as we know context produces
Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> nodes = (Collection<Node>) ret;
List<Node> list = new ArrayList<Node>(nodes);
Collections.sort(list, documentOrderComparator);
ret = list;
}
+1 -1
View File
@@ -49,6 +49,6 @@ abstract class Path
extends Pattern
{
abstract Collection evaluate(Node context, Collection nodeSet);
abstract Collection<Node> evaluate(Node context, Collection<Node> nodeSet);
}
+7 -3
View File
@@ -39,6 +39,8 @@ package gnu.xml.xpath;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import javax.xml.namespace.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -59,12 +61,14 @@ public final class Root
public Object evaluate(Node context, int pos, int len)
{
return evaluate(context, Collections.EMPTY_SET);
Set<Node> emptySet = Collections.emptySet();
return evaluate(context, emptySet);
}
Collection evaluate(Node context, Collection ns)
@Override
Collection<Node> evaluate(Node context, Collection<Node> ns)
{
Document doc = (context instanceof Document) ? (Document) context :
Node doc = (context instanceof Document) ? context :
context.getOwnerDocument();
return Collections.singleton(doc);
}
@@ -60,9 +60,9 @@ final class RoundFunction
final Expr arg;
RoundFunction(List args)
RoundFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
RoundFunction(Expr arg)
@@ -70,6 +70,7 @@ final class RoundFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
+26 -22
View File
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -82,7 +84,7 @@ public final class Selector
*/
final Test[] tests;
public Selector(int axis, List tests)
public Selector(int axis, List<? extends Test> tests)
{
this.axis = axis;
int len = tests.size();
@@ -177,29 +179,31 @@ public final class Selector
return count;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Set acc = new LinkedHashSet();
Set<Node> acc = new LinkedHashSet<Node>();
addCandidates(context, acc);
List candidates = new ArrayList(acc);
List ret = filterCandidates(candidates, false);
List<Node> candidates = new ArrayList<Node>(acc);
List<Node> ret = filterCandidates(candidates, false);
return ret;
}
Collection evaluate(Node context, Collection ns)
Collection<Node> evaluate(Node context, Collection<Node> ns)
{
Set acc = new LinkedHashSet();
for (Iterator i = ns.iterator(); i.hasNext(); )
addCandidates((Node) i.next(), acc);
List candidates = new ArrayList(acc);
List ret = filterCandidates(candidates, true);
Set<Node> acc = new LinkedHashSet<Node>();
for (Iterator<Node> i = ns.iterator(); i.hasNext(); )
addCandidates(i.next(), acc);
List<Node> candidates = new ArrayList<Node>(acc);
List<Node> ret = filterCandidates(candidates, true);
return ret;
}
/**
* Filter the given list of candidates according to the node tests.
*/
List filterCandidates(List candidates, boolean cascade)
List<Node> filterCandidates(List<Node> candidates, boolean cascade)
{
int len = candidates.size();
int tlen = tests.length;
@@ -209,10 +213,10 @@ public final class Selector
for (int j = 0; j < tlen && len > 0; j++)
{
Test test = tests[j];
List successful = new ArrayList(len);
List<Node> successful = new ArrayList<Node>(len);
for (int i = 0; i < len; i++)
{
Node node = (Node) candidates.get(i);
Node node = candidates.get(i);
if (cascade)
{
// Documents and DocumentFragments should be considered
@@ -242,7 +246,7 @@ public final class Selector
return candidates;
}
void addCandidates(Node context, Collection candidates)
void addCandidates(Node context, Collection<Node> candidates)
{
// Build list of candidates
switch (axis)
@@ -291,7 +295,7 @@ public final class Selector
}
}
void addChildNodes(Node context, Collection acc, boolean recurse)
void addChildNodes(Node context, Collection<Node> acc, boolean recurse)
{
Node child = context.getFirstChild();
while (child != null)
@@ -303,7 +307,7 @@ public final class Selector
}
}
void addParentNode(Node context, Collection acc, boolean recurse)
void addParentNode(Node context, Collection<Node> acc, boolean recurse)
{
Node parent = (context.getNodeType() == Node.ATTRIBUTE_NODE) ?
((Attr) context).getOwnerElement() : context.getParentNode();
@@ -315,7 +319,7 @@ public final class Selector
}
}
void addFollowingNodes(Node context, Collection acc, boolean recurse)
void addFollowingNodes(Node context, Collection<Node> acc, boolean recurse)
{
if (context != null && recurse)
addChildNodes(context, acc, true);
@@ -349,7 +353,7 @@ public final class Selector
}
}
void addPrecedingNodes(Node context, Collection acc, boolean recurse)
void addPrecedingNodes(Node context, Collection<Node> acc, boolean recurse)
{
Node cur = (context.getNodeType() == Node.ATTRIBUTE_NODE) ? null :
context.getPreviousSibling();
@@ -370,7 +374,7 @@ public final class Selector
}
}
void addAttributes(Node context, Collection acc)
void addAttributes(Node context, Collection<Node> acc)
{
NamedNodeMap attrs = context.getAttributes();
if (attrs != null)
@@ -387,7 +391,7 @@ public final class Selector
}
}
void addNamespaceAttributes(Node context, Collection acc)
void addNamespaceAttributes(Node context, Collection<Node> acc)
{
NamedNodeMap attrs = context.getAttributes();
if (attrs != null)
@@ -413,7 +417,7 @@ public final class Selector
public Expr clone(Object context)
{
int len = tests.length;
List tests2 = new ArrayList(len);
List<Test> tests2 = new ArrayList<Test>(len);
for (int i = 0; i < len; i++)
tests2.add(tests[i].clone(context));
return new Selector(axis, tests2);
@@ -431,7 +435,7 @@ public final class Selector
public String toString()
{
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
switch (axis)
{
case ANCESTOR:
@@ -54,9 +54,9 @@ final class StartsWithFunction
final Expr arg1;
final Expr arg2;
StartsWithFunction(List args)
StartsWithFunction(List<Expr> args)
{
this((Expr) args.get(0), (Expr) args.get(1));
this(args.get(0), args.get(1));
}
StartsWithFunction(Expr arg1, Expr arg2)
+34 -27
View File
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@@ -56,14 +58,14 @@ public final class Steps
extends Path
{
final LinkedList path;
final LinkedList<Expr> path;
public Steps()
{
this(new LinkedList());
this(new LinkedList<Expr>());
}
Steps(LinkedList path)
Steps(LinkedList<Expr> path)
{
this.path = path;
}
@@ -84,10 +86,8 @@ public final class Steps
if (pos > 0)
{
Pattern left = (Pattern) path.get(pos - 1);
Iterator j = possibleContexts(right, context).iterator();
while (j.hasNext())
for (Node candidate : possibleContexts(right, context))
{
Node candidate = (Node) j.next();
if (left.matches(candidate) &&
matches(candidate, pos - 1))
{
@@ -104,12 +104,12 @@ public final class Steps
* Essentially the reverse of Selector.addCandidates.
* The idea is to determine possible context nodes for a match.
*/
Collection possibleContexts(Pattern pattern, Node context)
Collection<Node> possibleContexts(Pattern pattern, Node context)
{
if (pattern instanceof Selector)
{
Selector s = (Selector) pattern;
Collection candidates = new LinkedHashSet();
Collection<Node> candidates = new LinkedHashSet<Node>();
switch (s.axis)
{
case Selector.PARENT:
@@ -157,46 +157,53 @@ public final class Steps
}
return candidates;
}
return Collections.EMPTY_SET;
return Collections.emptySet();
}
@Override
public Object evaluate(Node context, int pos, int len)
{
//System.err.println(toString()+" evaluate");
// Left to right
Iterator i = path.iterator();
Expr lhs = (Expr) i.next();
Iterator<Expr> i = path.iterator();
Expr lhs = i.next();
Object val = lhs.evaluate(context, pos, len);
//System.err.println("\tevaluate "+lhs+" = "+val);
while (val instanceof Collection && i.hasNext())
{
Path rhs = (Path) i.next();
val = rhs.evaluate(context, (Collection) val);
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> nodes = (Collection<Node>) val;
val = rhs.evaluate(context, nodes);
//System.err.println("\tevaluate "+rhs+" = "+val);
}
return val;
}
Collection evaluate(Node context, Collection ns)
@Override
Collection<Node> evaluate(Node context, Collection<Node> ns)
{
// Left to right
Iterator i = path.iterator();
Expr lhs = (Expr) i.next();
Iterator<Expr> i = path.iterator();
Expr lhs = i.next();
if (lhs instanceof Path)
{
ns = ((Path) lhs).evaluate(context, ns);
}
else
{
Set acc = new LinkedHashSet();
Set<Node> acc = new LinkedHashSet<Node>();
int pos = 1, len = ns.size();
for (Iterator j = ns.iterator(); j.hasNext(); )
for (Node node : ns)
{
Node node = (Node) j.next();
Object ret = lhs.evaluate(node, pos++, len);
if (ret instanceof Collection)
{
acc.addAll((Collection) ret);
/* Suppression is safe, as we know context produces Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> nodes = (Collection<Node>) ret;
acc.addAll(nodes);
}
}
ns = acc;
@@ -212,19 +219,19 @@ public final class Steps
public Expr clone(Object context)
{
int len = path.size();
LinkedList path2 = new LinkedList();
LinkedList<Expr> path2 = new LinkedList<Expr>();
for (int i = 0; i < len; i++)
{
path2.add(((Expr) path.get(i)).clone(context));
path2.add(path.get(i).clone(context));
}
return new Steps(path2);
}
public boolean references(QName var)
{
for (Iterator i = path.iterator(); i.hasNext(); )
for (Iterator<Expr> i = path.iterator(); i.hasNext(); )
{
if (((Expr) i.next()).references(var))
if (i.next().references(var))
{
return true;
}
@@ -234,16 +241,16 @@ public final class Steps
public String toString()
{
StringBuffer buf = new StringBuffer();
Iterator i = path.iterator();
Expr expr = (Expr) i.next();
CPStringBuilder buf = new CPStringBuilder();
Iterator<Expr> i = path.iterator();
Expr expr = i.next();
if (!(expr instanceof Root))
{
buf.append(expr);
}
while (i.hasNext())
{
expr = (Expr) i.next();
expr = i.next();
buf.append('/');
buf.append(expr);
}
@@ -84,9 +84,9 @@ final class StringFunction
final Expr arg;
StringFunction(List args)
StringFunction(List<Expr> args)
{
this(args.size() > 0 ? (Expr) args.get(0) : null);
this(args.size() > 0 ? args.get(0) : null);
}
StringFunction(Expr arg)
@@ -55,7 +55,7 @@ final class StringLengthFunction
final Expr arg;
StringLengthFunction(List args)
StringLengthFunction(List<Expr> args)
{
this(args.isEmpty() ? null : (Expr) args.get(0));
}
@@ -65,6 +65,7 @@ final class StringLengthFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = (arg == null) ? null : arg.evaluate(context, pos, len);
@@ -58,9 +58,9 @@ final class SubstringAfterFunction
final Expr arg1;
final Expr arg2;
SubstringAfterFunction(List args)
SubstringAfterFunction(List<Expr> args)
{
this((Expr) args.get(0), (Expr) args.get(1));
this(args.get(0), args.get(1));
}
SubstringAfterFunction(Expr arg1, Expr arg2)
@@ -57,9 +57,9 @@ final class SubstringBeforeFunction
final Expr arg1;
final Expr arg2;
SubstringBeforeFunction(List args)
SubstringBeforeFunction(List<Expr> args)
{
this((Expr) args.get(0), (Expr) args.get(1));
this(args.get(0), args.get(1));
}
SubstringBeforeFunction(Expr arg1, Expr arg2)
@@ -60,10 +60,10 @@ final class SubstringFunction
final Expr arg2;
final Expr arg3;
SubstringFunction(List args)
SubstringFunction(List<Expr> args)
{
this((Expr) args.get(0), (Expr) args.get(1),
(args.size() > 2) ? (Expr) args.get(2) : null);
this(args.get(0), args.get(1),
(args.size() > 2) ? args.get(2) : null);
}
SubstringFunction(Expr arg1, Expr arg2, Expr arg3)
@@ -73,6 +73,7 @@ final class SubstringFunction
this.arg3 = arg3;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val1 = arg1.evaluate(context, pos, len);
@@ -56,9 +56,9 @@ final class SumFunction
final Expr arg;
SumFunction(List args)
SumFunction(List<Expr> args)
{
this((Expr) args.get(0));
this(args.get(0));
}
SumFunction(Expr arg)
@@ -66,15 +66,19 @@ final class SumFunction
this.arg = arg;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object val = arg.evaluate(context, pos, len);
double sum = 0.0d;
if (val instanceof Collection)
{
for (Iterator i = ((Collection) val).iterator(); i.hasNext(); )
/* Suppression is safe, as we know context produces
Collection<Node> */
@SuppressWarnings("unchecked")
Collection<Node> nodes = (Collection<Node>) val;
for (Node node : nodes)
{
Node node = (Node) i.next();
String s = stringValue(node);
sum += _number(context, s);
}
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import java.util.List;
import javax.xml.namespace.QName;
import org.w3c.dom.Node;
@@ -66,9 +68,9 @@ final class TranslateFunction
final Expr arg2;
final Expr arg3;
TranslateFunction(List args)
TranslateFunction(List<Expr> args)
{
this((Expr) args.get(0), (Expr) args.get(1), (Expr) args.get(2));
this(args.get(0), args.get(1), args.get(2));
}
TranslateFunction(Expr arg1, Expr arg2, Expr arg3)
@@ -86,7 +88,7 @@ final class TranslateFunction
String string = _string(context, val1);
String search = _string(context, val2);
String replace = _string(context, val3);
StringBuffer buf = new StringBuffer();
CPStringBuilder buf = new CPStringBuilder();
int l1 = string.length();
int l2 = search.length();
int l3 = replace.length();
@@ -110,7 +112,7 @@ final class TranslateFunction
buf.append(c);
}
}
return new String(buf);
return buf.toString();
}
public Expr clone(Object context)
+15 -6
View File
@@ -74,20 +74,29 @@ public final class UnionExpr
return false;
}
@Override
public Object evaluate(Node context, int pos, int len)
{
Object left = lhs.evaluate(context, pos, len);
Object right = rhs.evaluate(context, pos, len);
List<Node> list;
if (left instanceof Collection && right instanceof Collection)
{
Set set = new HashSet();
set.addAll ((Collection) left);
set.addAll ((Collection) right);
List list = new ArrayList(set);
Set<Node> set = new HashSet<Node>();
/* Suppression is safe as addAll will check the types
of the elements and throw a ClassCastException as necessary */
@SuppressWarnings("unchecked")
Collection<Node> l = (Collection<Node>) left;
@SuppressWarnings("unchecked")
Collection<Node> r = (Collection<Node>) right;
set.addAll (l);
set.addAll (r);
list = new ArrayList<Node>(set);
Collections.sort(list, documentOrderComparator);
return list;
}
return Collections.EMPTY_SET;
else
list = Collections.emptyList();
return list;
}
public Expr clone(Object context)
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import javax.xml.namespace.QName;
import javax.xml.xpath.XPathVariableResolver;
import org.w3c.dom.Node;
@@ -86,7 +88,7 @@ public class VariableReference
public String toString()
{
StringBuffer buf = new StringBuffer("$");
CPStringBuilder buf = new CPStringBuilder("$");
String prefix = name.getPrefix();
if (prefix != null && !"".equals(prefix))
{
@@ -79,7 +79,7 @@ public class XPathParser
return qName;
}
Expr lookupFunction(String name, List args)
Expr lookupFunction(String name, List<Expr> args)
{
int arity = args.size();
if ("position".equals(name) && arity == 0)
@@ -491,7 +491,7 @@ case 5:
else
{
steps = new Steps();
steps.path.addFirst(yyVals[0+yyTop]);
steps.path.addFirst((Expr) yyVals[0+yyTop]);
}
steps.path.addFirst(new Root());
yyVal = steps;
@@ -512,7 +512,7 @@ case 6:
else
{
steps = new Steps();
steps.path.addFirst(yyVals[0+yyTop]);
steps.path.addFirst((Expr) yyVals[0+yyTop]);
}
steps.path.addFirst(s);
steps.path.addFirst(new Root());
@@ -532,9 +532,9 @@ case 8:
else
{
steps = new Steps();
steps.path.addFirst(yyVals[-2+yyTop]);
steps.path.addFirst((Expr) yyVals[-2+yyTop]);
}
steps.path.addLast(yyVals[0+yyTop]);
steps.path.addLast((Expr) yyVals[0+yyTop]);
yyVal = steps;
/*$$ = new Step((Expr) $1, (Path) $3);*/
}
@@ -553,10 +553,10 @@ case 9:
else
{
steps = new Steps();
steps.path.addFirst(yyVals[-2+yyTop]);
steps.path.addFirst((Expr) yyVals[-2+yyTop]);
}
steps.path.addLast(s);
steps.path.addLast(yyVals[0+yyTop]);
steps.path.addLast((Expr) yyVals[0+yyTop]);
yyVal = steps;
/*Step step = new Step(s, (Path) $3);*/
/*$$ = new Step((Expr) $1, step);*/
@@ -565,48 +565,56 @@ case 9:
case 10:
// line 362 "XPathParser.y"
{
yyVal = new Selector (Selector.CHILD, (List) yyVals[0+yyTop]);
}
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>) yyVals[0+yyTop];
yyVal = new Selector (Selector.CHILD, tests);
}
break;
case 11:
// line 366 "XPathParser.y"
{
yyVal = new Selector (Selector.ATTRIBUTE, (List) yyVals[0+yyTop]);
}
/* This is safe as we create this in one of the other cases */
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>) yyVals[0+yyTop];
yyVal = new Selector (Selector.ATTRIBUTE, tests);
}
break;
case 12:
// line 370 "XPathParser.y"
{
yyVal = new Selector (((Integer) yyVals[-2+yyTop]).intValue (), (List) yyVals[0+yyTop]);
}
/* This is safe as we create this in one of the other cases */
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>) yyVals[0+yyTop];
yyVal = new Selector (((Integer) yyVals[-2+yyTop]).intValue (), tests);
}
break;
case 13:
// line 374 "XPathParser.y"
{
yyVal = new Selector (Selector.SELF, Collections.EMPTY_LIST);
}
List<Test> emptyList = Collections.emptyList();
yyVal = new Selector (Selector.SELF, emptyList);
}
break;
case 14:
// line 378 "XPathParser.y"
{
yyVal = new Selector (Selector.PARENT, Collections.EMPTY_LIST);
}
List<Test> emptyList = Collections.emptyList();
yyVal = new Selector (Selector.PARENT, emptyList);
}
break;
case 15:
// line 385 "XPathParser.y"
{
List list = new ArrayList();
list.add(yyVals[0+yyTop]);
List<Test> list = new ArrayList<Test>();
list.add((Test) yyVals[0+yyTop]);
yyVal = list;
}
break;
case 16:
// line 391 "XPathParser.y"
{
List list = (List)yyVals[-1+yyTop];
list.add(yyVals[0+yyTop]);
yyVal = list;
}
/* This is safe as we create this in one of the other cases */
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>)yyVals[-1+yyTop];
tests.add((Test) yyVals[0+yyTop]);
yyVal = tests;
}
break;
case 17:
// line 415 "XPathParser.y"
@@ -725,30 +733,34 @@ case 37:
case 39:
// line 508 "XPathParser.y"
{
yyVal = lookupFunction((String) yyVals[-2+yyTop], Collections.EMPTY_LIST);
}
List<Expr> emptyList = Collections.emptyList();
yyVal = lookupFunction((String) yyVals[-2+yyTop], emptyList);
}
break;
case 40:
// line 512 "XPathParser.y"
{
yyVal = lookupFunction((String) yyVals[-3+yyTop], (List) yyVals[-1+yyTop]);
}
/* This is safe as we create this below */
@SuppressWarnings("unchecked") List<Expr> exprs = (List<Expr>) yyVals[-1+yyTop];
yyVal = lookupFunction((String) yyVals[-3+yyTop], exprs);
}
break;
case 41:
// line 519 "XPathParser.y"
{
List list = new ArrayList();
list.add(yyVals[0+yyTop]);
List<Expr> list = new ArrayList<Expr>();
list.add((Expr) yyVals[0+yyTop]);
yyVal = list;
}
break;
case 42:
// line 525 "XPathParser.y"
{
List list = (List) yyVals[0+yyTop];
list.add(0, yyVals[-2+yyTop]);
yyVal = list;
}
/* This is safe as we create this above */
@SuppressWarnings("unchecked") List<Expr> list = (List<Expr>) yyVals[0+yyTop];
list.add(0, (Expr) yyVals[-2+yyTop]);
yyVal = list;
}
break;
case 44:
// line 535 "XPathParser.y"
@@ -767,9 +779,9 @@ case 47:
else
{
steps = new Steps();
steps.path.addFirst(yyVals[0+yyTop]);
steps.path.addFirst((Expr) yyVals[0+yyTop]);
}
steps.path.addFirst(yyVals[-2+yyTop]);
steps.path.addFirst((Expr) yyVals[-2+yyTop]);
yyVal = steps;
/*$$ = new Step ((Expr) $1, (Path) $3);*/
}
@@ -788,10 +800,10 @@ case 48:
else
{
steps = new Steps();
steps.path.addFirst(yyVals[0+yyTop]);
steps.path.addFirst((Expr) yyVals[0+yyTop]);
}
steps.path.addFirst(s);
steps.path.addFirst(yyVals[-2+yyTop]);
steps.path.addFirst((Expr) yyVals[-2+yyTop]);
yyVal = steps;
/*Step step = new Step (s, (Path) $3);*/
/*$$ = new Step ((Expr) $1, step);*/
@@ -811,7 +823,7 @@ case 50:
else
{
steps = new Steps();
steps.path.addFirst(yyVals[-1+yyTop]);
steps.path.addFirst((Expr) yyVals[-1+yyTop]);
}
steps.path.addLast(s);
yyVal = steps;
+36 -26
View File
@@ -78,7 +78,7 @@ public class XPathParser
return qName;
}
Expr lookupFunction(String name, List args)
Expr lookupFunction(String name, List<Expr> args)
{
int arity = args.size();
if ("position".equals(name) && arity == 0)
@@ -287,7 +287,7 @@ absolute_location_path:
else
{
steps = new Steps();
steps.path.addFirst($2);
steps.path.addFirst((Expr) $2);
}
steps.path.addFirst(new Root());
$$ = steps;
@@ -306,7 +306,7 @@ absolute_location_path:
else
{
steps = new Steps();
steps.path.addFirst($2);
steps.path.addFirst((Expr) $2);
}
steps.path.addFirst(s);
steps.path.addFirst(new Root());
@@ -328,9 +328,9 @@ relative_location_path:
else
{
steps = new Steps();
steps.path.addFirst($1);
steps.path.addFirst((Expr) $1);
}
steps.path.addLast($3);
steps.path.addLast((Expr) $3);
$$ = steps;
//$$ = new Step((Expr) $1, (Path) $3);
}
@@ -347,10 +347,10 @@ relative_location_path:
else
{
steps = new Steps();
steps.path.addFirst($1);
steps.path.addFirst((Expr) $1);
}
steps.path.addLast(s);
steps.path.addLast($3);
steps.path.addLast((Expr) $3);
$$ = steps;
//Step step = new Step(s, (Path) $3);
//$$ = new Step((Expr) $1, step);
@@ -360,37 +360,43 @@ relative_location_path:
step:
step_node_test
{
$$ = new Selector (Selector.CHILD, (List) $1);
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>) $1;
$$ = new Selector (Selector.CHILD, tests);
}
| AT step_node_test
{
$$ = new Selector (Selector.ATTRIBUTE, (List) $2);
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>) $2;
$$ = new Selector (Selector.ATTRIBUTE, tests);
}
| axis_name DOUBLE_COLON step_node_test
{
$$ = new Selector (((Integer) $1).intValue (), (List) $3);
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>) $3;
$$ = new Selector (((Integer) $1).intValue (), tests);
}
| DOT
{
$$ = new Selector (Selector.SELF, Collections.EMPTY_LIST);
List<Test> emptyList = Collections.emptyList();
$$ = new Selector (Selector.SELF, emptyList);
}
| DOUBLE_DOT
{
$$ = new Selector (Selector.PARENT, Collections.EMPTY_LIST);
List<Test> emptyList = Collections.emptyList();
$$ = new Selector (Selector.PARENT, emptyList);
}
;
step_node_test:
node_test
{
List list = new ArrayList();
list.add($1);
List<Test> list = new ArrayList<Test>();
list.add((Test) $1);
$$ = list;
}
| step_node_test predicate
{
List list = (List)$1;
list.add($2);
/* This is safe as we create this in one of the other cases */
@SuppressWarnings("unchecked") List<Test> tests = (List<Test>)$1;
tests.add((Test) $2);
$$ = list;
}
;
@@ -506,25 +512,29 @@ primary_expr:
function_call:
function_name LP RP
{
$$ = lookupFunction((String) $1, Collections.EMPTY_LIST);
List<Expr> emptyList = Collections.emptyList();
$$ = lookupFunction((String) $1, emptyList);
}
| function_name LP argument_list RP
{
$$ = lookupFunction((String) $1, (List) $3);
/* This is safe as we create this below */
@SuppressWarnings("unchecked") List<Expr> exprs = (List<Expr>) $3;
$$ = lookupFunction((String) $1, (List) exprs);
}
;
argument_list:
expr
{
List list = new ArrayList();
list.add($1);
List<Expr> list = new ArrayList<Expr>();
list.add((Expr) $1);
$$ = list;
}
| expr COMMA argument_list
{
List list = (List) $3;
list.add(0, $1);
/* This is safe as we create this above */
@SuppressWarnings("unchecked") List<Expr> list = (List<Expr>) $3;
list.add(0, (Expr) $1);
$$ = list;
}
;
@@ -550,9 +560,9 @@ path_expr:
else
{
steps = new Steps();
steps.path.addFirst($3);
steps.path.addFirst((Expr) $3);
}
steps.path.addFirst($1);
steps.path.addFirst((Expr) $1);
$$ = steps;
//$$ = new Step ((Expr) $1, (Path) $3);
}
@@ -572,7 +582,7 @@ path_expr:
steps.path.addFirst($3);
}
steps.path.addFirst(s);
steps.path.addFirst($1);
steps.path.addFirst((Expr) $1);
$$ = steps;
//Step step = new Step (s, (Path) $3);
//$$ = new Step ((Expr) $1, step);
@@ -594,7 +604,7 @@ filter_expr:
else
{
steps = new Steps();
steps.path.addFirst($1);
steps.path.addFirst((Expr) $1);
}
steps.path.addLast(s);
$$ = steps;
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.xml.xpath;
import gnu.java.lang.CPStringBuilder;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
@@ -90,7 +92,7 @@ implements XPathParser.yyInput
}
static final Map keywords = new TreeMap ();
static final Map<String,Integer> keywords = new TreeMap<String,Integer> ();
static
{
keywords.put ("ancestor", new Integer (XPathParser.ANCESTOR));
@@ -314,7 +316,7 @@ implements XPathParser.yyInput
XPathToken consume_literal (int delimiter)
throws IOException
{
StringBuffer buf = new StringBuffer ();
CPStringBuilder buf = new CPStringBuilder ();
while (true)
{
int c = in.read ();
@@ -336,7 +338,7 @@ implements XPathParser.yyInput
XPathToken consume_digits (int c)
throws IOException
{
StringBuffer buf = new StringBuffer ();
CPStringBuilder buf = new CPStringBuilder ();
buf.append ((char) c);
while (true)
{
@@ -357,7 +359,7 @@ implements XPathParser.yyInput
XPathToken consume_name (int c)
throws IOException
{
StringBuffer buf = new StringBuffer ();
CPStringBuilder buf = new CPStringBuilder ();
buf.append ((char) c);
while (true)
{