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:
@@ -38,6 +38,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
/**
|
||||
@@ -434,7 +436,7 @@ public abstract class AbstractCollection<E>
|
||||
public String toString()
|
||||
{
|
||||
Iterator itr = iterator();
|
||||
StringBuffer r = new StringBuffer("[");
|
||||
CPStringBuilder r = new CPStringBuilder("[");
|
||||
boolean hasNext = itr.hasNext();
|
||||
while (hasNext)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -524,7 +526,7 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
|
||||
public String toString()
|
||||
{
|
||||
Iterator<Map.Entry<K, V>> entries = entrySet().iterator();
|
||||
StringBuilder r = new StringBuilder("{");
|
||||
CPStringBuilder r = new CPStringBuilder("{");
|
||||
for (int pos = size(); pos > 0; pos--)
|
||||
{
|
||||
Map.Entry<K, V> entry = entries.next();
|
||||
|
||||
@@ -472,8 +472,7 @@ public class ArrayList<E> extends AbstractList<E>
|
||||
// use of a negative index will cause an ArrayIndexOutOfBoundsException,
|
||||
// a subclass of the required exception, with no effort on our part.
|
||||
if (index > size)
|
||||
throw new IndexOutOfBoundsException("Index: " + index + ", Size: "
|
||||
+ size);
|
||||
raiseBoundsError(index);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -488,10 +487,24 @@ public class ArrayList<E> extends AbstractList<E>
|
||||
// use of a negative index will cause an ArrayIndexOutOfBoundsException,
|
||||
// a subclass of the required exception, with no effort on our part.
|
||||
if (index >= size)
|
||||
throw new IndexOutOfBoundsException("Index: " + index + ", Size: "
|
||||
+ size);
|
||||
raiseBoundsError(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise the ArrayIndexOfOutBoundsException.
|
||||
*
|
||||
* @param index the index of the access
|
||||
* @throws IndexOutOfBoundsException unconditionally
|
||||
*/
|
||||
private void raiseBoundsError(int index)
|
||||
{
|
||||
// Implementaion note: put in a separate method to make the JITs job easier
|
||||
// (separate common from uncommon code at method boundaries when trivial to
|
||||
// do so).
|
||||
throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove from this list all elements contained in the given collection.
|
||||
* This is not public, due to Sun's API, but this performs in linear
|
||||
|
||||
@@ -39,6 +39,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
@@ -2935,7 +2937,7 @@ public class Arrays
|
||||
{
|
||||
if (v == null)
|
||||
return "null";
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
CPStringBuilder b = new CPStringBuilder("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
@@ -2957,7 +2959,7 @@ public class Arrays
|
||||
{
|
||||
if (v == null)
|
||||
return "null";
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
CPStringBuilder b = new CPStringBuilder("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
@@ -2979,7 +2981,7 @@ public class Arrays
|
||||
{
|
||||
if (v == null)
|
||||
return "null";
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
CPStringBuilder b = new CPStringBuilder("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
@@ -3001,7 +3003,7 @@ public class Arrays
|
||||
{
|
||||
if (v == null)
|
||||
return "null";
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
CPStringBuilder b = new CPStringBuilder("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
@@ -3023,7 +3025,7 @@ public class Arrays
|
||||
{
|
||||
if (v == null)
|
||||
return "null";
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
CPStringBuilder b = new CPStringBuilder("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
@@ -3045,7 +3047,7 @@ public class Arrays
|
||||
{
|
||||
if (v == null)
|
||||
return "null";
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
CPStringBuilder b = new CPStringBuilder("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
@@ -3067,7 +3069,7 @@ public class Arrays
|
||||
{
|
||||
if (v == null)
|
||||
return "null";
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
CPStringBuilder b = new CPStringBuilder("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
@@ -3089,7 +3091,7 @@ public class Arrays
|
||||
{
|
||||
if (v == null)
|
||||
return "null";
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
CPStringBuilder b = new CPStringBuilder("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
@@ -3111,7 +3113,7 @@ public class Arrays
|
||||
{
|
||||
if (v == null)
|
||||
return "null";
|
||||
StringBuilder b = new StringBuilder("[");
|
||||
CPStringBuilder b = new CPStringBuilder("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
@@ -3122,7 +3124,7 @@ public class Arrays
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
private static void deepToString(Object[] v, StringBuilder b, HashSet seen)
|
||||
private static void deepToString(Object[] v, CPStringBuilder b, HashSet seen)
|
||||
{
|
||||
b.append("[");
|
||||
for (int i = 0; i < v.length; ++i)
|
||||
@@ -3171,7 +3173,7 @@ public class Arrays
|
||||
if (v == null)
|
||||
return "null";
|
||||
HashSet seen = new HashSet();
|
||||
StringBuilder b = new StringBuilder();
|
||||
CPStringBuilder b = new CPStringBuilder();
|
||||
deepToString(v, b, seen);
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
|
||||
@@ -687,7 +690,7 @@ public class BitSet implements Cloneable, Serializable
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer r = new StringBuffer("{");
|
||||
CPStringBuilder r = new CPStringBuilder("{");
|
||||
boolean first = true;
|
||||
for (int i = 0; i < bits.length; ++i)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
@@ -484,6 +486,28 @@ public abstract class Calendar
|
||||
ClassLoader.getSystemClassLoader());
|
||||
}
|
||||
|
||||
/**
|
||||
* The set of properties for obtaining the minimum number of days in
|
||||
* the first week.
|
||||
*/
|
||||
private static transient final Properties properties;
|
||||
|
||||
/**
|
||||
* Reads in the properties.
|
||||
*/
|
||||
static
|
||||
{
|
||||
properties = new Properties();
|
||||
try
|
||||
{
|
||||
properties.load(Calendar.class.getResourceAsStream("weeks.properties"));
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
System.out.println("Failed to load weeks resource: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new Calendar with the default time zone and the default
|
||||
* locale.
|
||||
@@ -505,9 +529,13 @@ public abstract class Calendar
|
||||
lenient = true;
|
||||
String[] days = { "", "sun", "mon", "tue", "wed", "thu", "fri", "sat" };
|
||||
|
||||
ResourceBundle rb = getBundle(locale);
|
||||
String min = (String) rb.getObject("minNumberOfDaysInFirstWeek");
|
||||
String first = (String) rb.getObject("firstDayOfWeek");
|
||||
String country = locale.getCountry();
|
||||
String min = properties.getProperty("minDays." + country);
|
||||
if (min == null)
|
||||
min = properties.getProperty("minDays.DEFAULT");
|
||||
String first = properties.getProperty("firstDay." + country);
|
||||
if (first == null)
|
||||
first = properties.getProperty("firstDay.DEFAULT");
|
||||
try
|
||||
{
|
||||
if (min != null)
|
||||
@@ -1328,7 +1356,7 @@ public abstract class Calendar
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(getClass().getName());
|
||||
CPStringBuilder sb = new CPStringBuilder(getClass().getName());
|
||||
sb.append('[');
|
||||
sb.append("time=");
|
||||
if (isTimeSet)
|
||||
|
||||
@@ -39,6 +39,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -1135,7 +1137,7 @@ public class Collections
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer r = new StringBuffer("{");
|
||||
CPStringBuilder r = new CPStringBuilder("{");
|
||||
for (int i = n - 1; --i > 0; )
|
||||
r.append(element).append(", ");
|
||||
r.append(element).append("}");
|
||||
|
||||
@@ -139,7 +139,7 @@ public final class Currency
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
System.out.println("Failed to load currency resource: " + exception);
|
||||
throw new InternalError("Failed to load currency resource: " + exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
@@ -722,7 +724,7 @@ public class Date
|
||||
boolean localTimezone = true;
|
||||
|
||||
// Trim out any nested stuff in parentheses now to make parsing easier.
|
||||
StringBuilder buf = new StringBuilder();
|
||||
CPStringBuilder buf = new CPStringBuilder();
|
||||
int parenNesting = 0;
|
||||
int len = string.length();
|
||||
for (int i = 0; i < len; i++)
|
||||
|
||||
@@ -38,6 +38,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -470,7 +472,7 @@ public final class Formatter
|
||||
* @param width the width of the numeric value.
|
||||
* @param isNegative true if the value is negative.
|
||||
*/
|
||||
private void applyLocalization(StringBuilder builder, int flags, int width,
|
||||
private void applyLocalization(CPStringBuilder builder, int flags, int width,
|
||||
boolean isNegative)
|
||||
{
|
||||
DecimalFormatSymbols dfsyms;
|
||||
@@ -741,9 +743,9 @@ public final class Formatter
|
||||
* @param conversion the conversion character.
|
||||
* @return the result.
|
||||
*/
|
||||
private StringBuilder basicIntegralConversion(Object arg, int flags,
|
||||
int width, int precision,
|
||||
int radix, char conversion)
|
||||
private CPStringBuilder basicIntegralConversion(Object arg, int flags,
|
||||
int width, int precision,
|
||||
int radix, char conversion)
|
||||
{
|
||||
assert radix == 8 || radix == 10 || radix == 16;
|
||||
noPrecision(precision);
|
||||
@@ -798,7 +800,7 @@ public final class Formatter
|
||||
else
|
||||
throw new IllegalFormatConversionException(conversion, arg.getClass());
|
||||
|
||||
return new StringBuilder(result);
|
||||
return new CPStringBuilder(result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -819,9 +821,9 @@ public final class Formatter
|
||||
{
|
||||
assert radix == 8 || radix == 16;
|
||||
|
||||
StringBuilder builder = basicIntegralConversion(arg, flags, width,
|
||||
precision, radix,
|
||||
conversion);
|
||||
CPStringBuilder builder = basicIntegralConversion(arg, flags, width,
|
||||
precision, radix,
|
||||
conversion);
|
||||
int insertPoint = 0;
|
||||
|
||||
// Insert the sign.
|
||||
@@ -897,9 +899,9 @@ public final class Formatter
|
||||
int precision, char conversion)
|
||||
throws IOException
|
||||
{
|
||||
StringBuilder builder = basicIntegralConversion(arg, flags, width,
|
||||
precision, 10,
|
||||
conversion);
|
||||
CPStringBuilder builder = basicIntegralConversion(arg, flags, width,
|
||||
precision, 10,
|
||||
conversion);
|
||||
boolean isNegative = false;
|
||||
if (builder.charAt(0) == '-')
|
||||
{
|
||||
@@ -920,7 +922,7 @@ public final class Formatter
|
||||
* @param conversion the formatting character to specify the type of data.
|
||||
* @param syms the date formatting symbols.
|
||||
*/
|
||||
private void singleDateTimeConversion(StringBuilder builder, Calendar cal,
|
||||
private void singleDateTimeConversion(CPStringBuilder builder, Calendar cal,
|
||||
char conversion,
|
||||
DateFormatSymbols syms)
|
||||
{
|
||||
@@ -1151,7 +1153,7 @@ public final class Formatter
|
||||
else
|
||||
syms = new DateFormatSymbols(fmtLocale);
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
CPStringBuilder result = new CPStringBuilder();
|
||||
singleDateTimeConversion(result, cal, subConversion, syms);
|
||||
|
||||
genericFormat(result.toString(), flags, width, precision);
|
||||
|
||||
@@ -39,6 +39,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
@@ -579,7 +581,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
|
||||
// would repeatedly re-lock/release the monitor, we directly use the
|
||||
// unsynchronized EntryIterator instead.
|
||||
Iterator<Map.Entry<K, V>> entries = new EntryIterator();
|
||||
StringBuilder r = new StringBuilder("{");
|
||||
CPStringBuilder r = new CPStringBuilder("{");
|
||||
for (int pos = size; pos > 0; pos--)
|
||||
{
|
||||
r.append(entries.next());
|
||||
|
||||
@@ -39,6 +39,9 @@ exception statement from your version. */
|
||||
package java.util;
|
||||
|
||||
import gnu.classpath.SystemProperties;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import gnu.java.locale.LocaleHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -548,7 +551,7 @@ public final class Locale implements Serializable, Cloneable
|
||||
return "";
|
||||
else if (country.length() == 0 && variant.length() == 0)
|
||||
return language;
|
||||
StringBuffer result = new StringBuffer(language);
|
||||
CPStringBuilder result = new CPStringBuilder(language);
|
||||
result.append('_').append(country);
|
||||
if (variant.length() != 0)
|
||||
result.append('_').append(variant);
|
||||
@@ -922,7 +925,7 @@ public final class Locale implements Serializable, Cloneable
|
||||
*/
|
||||
public String getDisplayName(Locale locale)
|
||||
{
|
||||
StringBuffer result = new StringBuffer();
|
||||
CPStringBuilder result = new CPStringBuilder();
|
||||
int count = 0;
|
||||
String[] delimiters = {"", " (", ","};
|
||||
if (language.length() != 0)
|
||||
|
||||
@@ -38,6 +38,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -46,6 +48,7 @@ import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamConstants;
|
||||
@@ -155,7 +158,7 @@ public class Properties extends Hashtable<Object, Object>
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a property list from an input stream. The stream should
|
||||
* Reads a property list from a character stream. The stream should
|
||||
* have the following format: <br>
|
||||
*
|
||||
* An empty line or a line starting with <code>#</code> or
|
||||
@@ -187,15 +190,14 @@ weekdays: Sunday,Monday,Tuesday,Wednesday,\\
|
||||
# The safest way to include a space at the end of a value:
|
||||
label = Name:\\u0020</pre>
|
||||
*
|
||||
* @param inStream the input stream
|
||||
* @param inReader the input {@link java.io.Reader}.
|
||||
* @throws IOException if an error occurred when reading the input
|
||||
* @throws NullPointerException if in is null
|
||||
* @since 1.6
|
||||
*/
|
||||
public void load(InputStream inStream) throws IOException
|
||||
public void load(Reader inReader) throws IOException
|
||||
{
|
||||
// The spec says that the file must be encoded using ISO-8859-1.
|
||||
BufferedReader reader =
|
||||
new BufferedReader(new InputStreamReader(inStream, "ISO-8859-1"));
|
||||
BufferedReader reader = new BufferedReader(inReader);
|
||||
String line;
|
||||
|
||||
while ((line = reader.readLine()) != null)
|
||||
@@ -217,7 +219,7 @@ label = Name:\\u0020</pre>
|
||||
// Try to short-circuit when there is no escape char.
|
||||
int start = pos;
|
||||
boolean needsEscape = line.indexOf('\\', pos) != -1;
|
||||
StringBuilder key = needsEscape ? new StringBuilder() : null;
|
||||
CPStringBuilder key = needsEscape ? new CPStringBuilder() : null;
|
||||
while (pos < line.length()
|
||||
&& ! Character.isWhitespace(c = line.charAt(pos++))
|
||||
&& c != '=' && c != ':')
|
||||
@@ -360,6 +362,24 @@ label = Name:\\u0020</pre>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a property list from the supplied input stream.
|
||||
* This method has the same functionality as {@link #load(Reader)}
|
||||
* but the character encoding is assumed to be ISO-8859-1.
|
||||
* Unicode characters not within the Latin1 set supplied by
|
||||
* ISO-8859-1 should be escaped using '\\uXXXX' where XXXX
|
||||
* is the UTF-16 code unit in hexadecimal.
|
||||
*
|
||||
* @param inStream the byte stream to read the property list from.
|
||||
* @throws IOException if an I/O error occurs.
|
||||
* @see #load(Reader)
|
||||
* @since 1.2
|
||||
*/
|
||||
public void load(InputStream inStream) throws IOException
|
||||
{
|
||||
load(new InputStreamReader(inStream, "ISO-8859-1"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls <code>store(OutputStream out, String header)</code> and
|
||||
* ignores the IOException that may be thrown.
|
||||
@@ -421,7 +441,7 @@ label = Name:\\u0020</pre>
|
||||
|
||||
Iterator iter = entrySet ().iterator ();
|
||||
int i = size ();
|
||||
StringBuilder s = new StringBuilder (); // Reuse the same buffer.
|
||||
CPStringBuilder s = new CPStringBuilder (); // Reuse the same buffer.
|
||||
while (--i >= 0)
|
||||
{
|
||||
Map.Entry entry = (Map.Entry) iter.next ();
|
||||
@@ -564,7 +584,7 @@ label = Name:\\u0020</pre>
|
||||
* leading spaces must be escaped for the value
|
||||
* @see #store(OutputStream, String)
|
||||
*/
|
||||
private void formatForOutput(String str, StringBuilder buffer, boolean key)
|
||||
private void formatForOutput(String str, CPStringBuilder buffer, boolean key)
|
||||
{
|
||||
if (key)
|
||||
{
|
||||
@@ -745,7 +765,7 @@ label = Name:\\u0020</pre>
|
||||
Boolean.FALSE);
|
||||
XMLStreamReader reader = factory.createXMLStreamReader(in);
|
||||
String name, key = null;
|
||||
StringBuffer buf = null;
|
||||
CPStringBuilder buf = null;
|
||||
while (reader.hasNext())
|
||||
{
|
||||
switch (reader.next())
|
||||
@@ -760,7 +780,7 @@ label = Name:\\u0020</pre>
|
||||
String msg = "missing 'key' attribute";
|
||||
throw new InvalidPropertiesFormatException(msg);
|
||||
}
|
||||
buf = new StringBuffer();
|
||||
buf = new CPStringBuilder();
|
||||
}
|
||||
else if (!"properties".equals(name) && !"comment".equals(name))
|
||||
{
|
||||
|
||||
@@ -40,6 +40,7 @@ package java.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
|
||||
/**
|
||||
* This class is a concrete <code>ResourceBundle</code> that gets it
|
||||
@@ -97,7 +98,8 @@ public class PropertyResourceBundle extends ResourceBundle
|
||||
private Properties properties;
|
||||
|
||||
/**
|
||||
* Creates a new property resource bundle.
|
||||
* Creates a new property resource bundle. The property file must
|
||||
* be encoded using ISO-8859-1.
|
||||
*
|
||||
* @param stream an input stream, where the resources are read from
|
||||
* @throws NullPointerException if stream is null
|
||||
@@ -109,6 +111,21 @@ public class PropertyResourceBundle extends ResourceBundle
|
||||
properties.load(stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new property resource bundle. The encoding of the property
|
||||
* file is determined by the supplied {@link Reader} object.
|
||||
*
|
||||
* @param reader an input stream, where the resources are read from
|
||||
* @throws NullPointerException if stream is null
|
||||
* @throws IOException if reading the stream fails
|
||||
* @since 1.6
|
||||
*/
|
||||
public PropertyResourceBundle(Reader reader) throws IOException
|
||||
{
|
||||
properties = new Properties();
|
||||
properties.load(reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by <code>getObject</code> when a resource is needed. This
|
||||
* returns the resource given by the key.
|
||||
|
||||
@@ -41,6 +41,8 @@ package java.util;
|
||||
|
||||
import gnu.classpath.VMStackWalker;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@@ -121,9 +123,10 @@ public abstract class ResourceBundle
|
||||
*
|
||||
* @see BundleKey
|
||||
*/
|
||||
private static Map bundleCache = new LinkedHashMap(CACHE_SIZE + 1, 0.75F, true)
|
||||
private static Map<BundleKey,Object> bundleCache =
|
||||
new LinkedHashMap<BundleKey,Object>(CACHE_SIZE + 1, 0.75F, true)
|
||||
{
|
||||
public boolean removeEldestEntry(Map.Entry entry)
|
||||
public boolean removeEldestEntry(Map.Entry<BundleKey,Object> entry)
|
||||
{
|
||||
return size() > CACHE_SIZE;
|
||||
}
|
||||
@@ -294,14 +297,29 @@ public abstract class ResourceBundle
|
||||
&& locale.equals(key.locale)
|
||||
&& classLoader.equals(key.classLoader);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
CPStringBuilder builder = new CPStringBuilder(getClass().getName());
|
||||
builder.append("[defaultLocale=");
|
||||
builder.append(defaultLocale);
|
||||
builder.append(",baseName=");
|
||||
builder.append(baseName);
|
||||
builder.append(",locale=");
|
||||
builder.append(locale);
|
||||
builder.append(",classLoader=");
|
||||
builder.append(classLoader);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/** A cache lookup key. This avoids having to a new one for every
|
||||
* getBundle() call. */
|
||||
private static BundleKey lookupKey = new BundleKey();
|
||||
private static final BundleKey lookupKey = new BundleKey();
|
||||
|
||||
/** Singleton cache entry to represent previous failed lookups. */
|
||||
private static Object nullEntry = new Object();
|
||||
private static final Object nullEntry = new Object();
|
||||
|
||||
/**
|
||||
* Get the appropriate ResourceBundle for the given locale. The following
|
||||
@@ -452,7 +470,7 @@ public abstract class ResourceBundle
|
||||
ResourceBundle bundle = null;
|
||||
try
|
||||
{
|
||||
Class rbClass;
|
||||
Class<?> rbClass;
|
||||
if (classloader == null)
|
||||
rbClass = Class.forName(localizedName);
|
||||
else
|
||||
@@ -495,7 +513,7 @@ public abstract class ResourceBundle
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to load a the bundle for a given locale, also loads the backup
|
||||
* Tries to load the bundle for a given locale, also loads the backup
|
||||
* locales with the same language.
|
||||
*
|
||||
* @param baseName the raw bundle name, without locale qualifiers
|
||||
@@ -515,9 +533,9 @@ public abstract class ResourceBundle
|
||||
|
||||
int baseLen = baseName.length();
|
||||
|
||||
// Build up a StringBuffer containing the complete bundle name, fully
|
||||
// Build up a CPStringBuilder containing the complete bundle name, fully
|
||||
// qualified by locale.
|
||||
StringBuffer sb = new StringBuffer(baseLen + variant.length() + 7);
|
||||
CPStringBuilder sb = new CPStringBuilder(baseLen + variant.length() + 7);
|
||||
|
||||
sb.append(baseName);
|
||||
|
||||
@@ -568,4 +586,40 @@ public abstract class ResourceBundle
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all resources from the cache that were loaded
|
||||
* using the class loader of the calling class.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public static final void clearCache()
|
||||
{
|
||||
clearCache(VMStackWalker.getCallingClassLoader());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all resources from the cache that were loaded
|
||||
* using the specified class loader.
|
||||
*
|
||||
* @param loader the loader used for the bundles that will be removed.
|
||||
* @throws NullPointerException if {@code loader} is {@code null}.
|
||||
* @since 1.6
|
||||
*/
|
||||
public static final void clearCache(ClassLoader loader)
|
||||
{
|
||||
if (loader == null)
|
||||
throw new NullPointerException("The loader can not be null.");
|
||||
synchronized (ResourceBundle.class)
|
||||
{
|
||||
Iterator<BundleKey> iter = bundleCache.keySet().iterator();
|
||||
while (iter.hasNext())
|
||||
{
|
||||
BundleKey key = iter.next();
|
||||
if (key.classLoader == loader)
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -102,13 +102,14 @@ public class Stack<T> extends Vector<T>
|
||||
* @return the Object popped from the stack
|
||||
* @throws EmptyStackException if the stack is empty
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized T pop()
|
||||
{
|
||||
if (elementCount == 0)
|
||||
throw new EmptyStackException();
|
||||
|
||||
modCount++;
|
||||
T obj = elementData[--elementCount];
|
||||
T obj = (T) elementData[--elementCount];
|
||||
|
||||
// Set topmost element to null to assist the gc in cleanup.
|
||||
elementData[elementCount] = null;
|
||||
@@ -121,12 +122,13 @@ public class Stack<T> extends Vector<T>
|
||||
* @return the top Object on the stack
|
||||
* @throws EmptyStackException if the stack is empty
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized T peek()
|
||||
{
|
||||
if (elementCount == 0)
|
||||
throw new EmptyStackException();
|
||||
|
||||
return elementData[elementCount - 1];
|
||||
return (T) elementData[elementCount - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,9 @@ exception statement from your version. */
|
||||
package java.util;
|
||||
|
||||
import gnu.classpath.SystemProperties;
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
import gnu.java.util.ZoneInfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
@@ -1404,7 +1406,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
{
|
||||
int offset = getRawOffset() + (dst ? getDSTSavings() : 0);
|
||||
|
||||
StringBuffer sb = new StringBuffer(9);
|
||||
CPStringBuilder sb = new CPStringBuilder(9);
|
||||
sb.append("GMT");
|
||||
|
||||
offset = offset / (1000 * 60);
|
||||
@@ -1564,7 +1566,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
|
||||
}
|
||||
|
||||
// Custom IDs have to be normalized
|
||||
StringBuffer sb = new StringBuffer(9);
|
||||
CPStringBuilder sb = new CPStringBuilder(9);
|
||||
sb.append("GMT");
|
||||
|
||||
sb.append(offset_direction >= 0 ? '+' : '-');
|
||||
|
||||
@@ -39,6 +39,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
@@ -2720,7 +2722,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder r = new StringBuilder("{");
|
||||
CPStringBuilder r = new CPStringBuilder("{");
|
||||
final Iterator<Entry<DK,DV>> it = entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
@@ -3158,7 +3160,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder r = new StringBuilder("[");
|
||||
CPStringBuilder r = new CPStringBuilder("[");
|
||||
final Iterator<D> it = iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
|
||||
@@ -95,7 +95,7 @@ public class Vector<T> extends AbstractList<T>
|
||||
* in positions 0 through elementCount - 1, and all remaining slots are null.
|
||||
* @serial the elements
|
||||
*/
|
||||
protected T[] elementData;
|
||||
protected Object[] elementData;
|
||||
|
||||
/**
|
||||
* The number of elements currently in the vector, also returned by
|
||||
@@ -133,7 +133,7 @@ public class Vector<T> extends AbstractList<T>
|
||||
public Vector(Collection<? extends T> c)
|
||||
{
|
||||
elementCount = c.size();
|
||||
elementData = c.toArray((T[]) new Object[elementCount]);
|
||||
elementData = c.toArray(new Object[elementCount]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,7 +149,7 @@ public class Vector<T> extends AbstractList<T>
|
||||
{
|
||||
if (initialCapacity < 0)
|
||||
throw new IllegalArgumentException();
|
||||
elementData = (T[]) new Object[initialCapacity];
|
||||
elementData = new Object[initialCapacity];
|
||||
this.capacityIncrement = capacityIncrement;
|
||||
}
|
||||
|
||||
@@ -295,11 +295,12 @@ public class Vector<T> extends AbstractList<T>
|
||||
return i < elementCount;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public T nextElement()
|
||||
{
|
||||
if (i >= elementCount)
|
||||
throw new NoSuchElementException();
|
||||
return elementData[i++];
|
||||
return (T) elementData[i++];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -385,10 +386,11 @@ public class Vector<T> extends AbstractList<T>
|
||||
* @throws ArrayIndexOutOfBoundsException index < 0 || index >= size()
|
||||
* @see #get(int)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized T elementAt(int index)
|
||||
{
|
||||
checkBoundExclusive(index);
|
||||
return elementData[index];
|
||||
return (T) elementData[index];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -397,12 +399,13 @@ public class Vector<T> extends AbstractList<T>
|
||||
* @return the first Object in the Vector
|
||||
* @throws NoSuchElementException the Vector is empty
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized T firstElement()
|
||||
{
|
||||
if (elementCount == 0)
|
||||
throw new NoSuchElementException();
|
||||
|
||||
return elementData[0];
|
||||
return (T) elementData[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -411,12 +414,13 @@ public class Vector<T> extends AbstractList<T>
|
||||
* @return the last Object in the Vector
|
||||
* @throws NoSuchElementException the Vector is empty
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized T lastElement()
|
||||
{
|
||||
if (elementCount == 0)
|
||||
throw new NoSuchElementException();
|
||||
|
||||
return elementData[elementCount - 1];
|
||||
return (T) elementData[elementCount - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -604,10 +608,11 @@ public class Vector<T> extends AbstractList<T>
|
||||
* @throws ArrayIndexOutOfBoundsException index < 0 || index >= size()
|
||||
* @since 1.2
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized T set(int index, T element)
|
||||
{
|
||||
checkBoundExclusive(index);
|
||||
T temp = elementData[index];
|
||||
T temp = (T) elementData[index];
|
||||
elementData[index] = element;
|
||||
return temp;
|
||||
}
|
||||
@@ -660,10 +665,11 @@ public class Vector<T> extends AbstractList<T>
|
||||
* @throws ArrayIndexOutOfBoundsException index < 0 || index >= size()
|
||||
* @since 1.2
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized T remove(int index)
|
||||
{
|
||||
checkBoundExclusive(index);
|
||||
T temp = elementData[index];
|
||||
T temp = (T) elementData[index];
|
||||
modCount++;
|
||||
elementCount--;
|
||||
if (index < elementCount)
|
||||
@@ -903,7 +909,7 @@ public class Vector<T> extends AbstractList<T>
|
||||
// use of a negative index will cause an ArrayIndexOutOfBoundsException
|
||||
// with no effort on our part.
|
||||
if (index > elementCount)
|
||||
throw new ArrayIndexOutOfBoundsException(index + " > " + elementCount);
|
||||
raiseBoundsError(index, " > ");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -918,9 +924,24 @@ public class Vector<T> extends AbstractList<T>
|
||||
// use of a negative index will cause an ArrayIndexOutOfBoundsException
|
||||
// with no effort on our part.
|
||||
if (index >= elementCount)
|
||||
throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount);
|
||||
raiseBoundsError(index, " >= ");
|
||||
}
|
||||
|
||||
/**
|
||||
* Raise the ArrayIndexOfOutBoundsException.
|
||||
*
|
||||
* @param index the index of the access
|
||||
* @param operator the operator to include in the error message
|
||||
* @throws IndexOutOfBoundsException unconditionally
|
||||
*/
|
||||
private void raiseBoundsError(int index, String operator)
|
||||
{
|
||||
// Implementaion note: put in a separate method to make the JITs job easier
|
||||
// (separate common from uncommon code at method boundaries when trivial to
|
||||
// do so).
|
||||
throw new ArrayIndexOutOfBoundsException(index + operator + elementCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes this object to the given stream.
|
||||
*
|
||||
|
||||
@@ -38,6 +38,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util.logging;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FilterOutputStream;
|
||||
@@ -478,7 +480,7 @@ public class FileHandler
|
||||
int uniqueNumber,
|
||||
int count)
|
||||
{
|
||||
StringBuffer buf = new StringBuffer(pattern);
|
||||
CPStringBuilder buf = new CPStringBuilder(pattern);
|
||||
String replaceWith;
|
||||
boolean foundGeneration = false;
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util.logging;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
@@ -776,7 +778,7 @@ public class Logger
|
||||
{
|
||||
if (isLoggable(Level.FINER))
|
||||
{
|
||||
StringBuffer buf = new StringBuffer(80);
|
||||
CPStringBuilder buf = new CPStringBuilder(80);
|
||||
buf.append("ENTRY");
|
||||
for (int i = 0; i < params.length; i++)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util.logging;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.text.DateFormat;
|
||||
@@ -98,7 +100,7 @@ public class SimpleFormatter
|
||||
*/
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
StringBuffer buf = new StringBuffer(180);
|
||||
CPStringBuilder buf = new CPStringBuilder(180);
|
||||
|
||||
if (dateFormat == null)
|
||||
dateFormat = DateFormat.getDateTimeInstance();
|
||||
|
||||
@@ -39,6 +39,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util.logging;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.ResourceBundle;
|
||||
@@ -86,10 +88,10 @@ public class XMLFormatter
|
||||
/**
|
||||
* Appends a line consisting of indentation, opening element tag,
|
||||
* element content, closing element tag and line separator to
|
||||
* a StringBuffer, provided that the element content is
|
||||
* a CPStringBuilder, provided that the element content is
|
||||
* actually existing.
|
||||
*
|
||||
* @param buf the StringBuffer to which the line will be appended.
|
||||
* @param buf the CPStringBuilder to which the line will be appended.
|
||||
*
|
||||
* @param indent the indentation level.
|
||||
*
|
||||
@@ -98,7 +100,7 @@ public class XMLFormatter
|
||||
* @param content the element content, or <code>null</code> to
|
||||
* have no output whatsoever appended to <code>buf</code>.
|
||||
*/
|
||||
private static void appendTag(StringBuffer buf, int indent,
|
||||
private static void appendTag(CPStringBuilder buf, int indent,
|
||||
String tag, String content)
|
||||
{
|
||||
int i;
|
||||
@@ -163,9 +165,9 @@ public class XMLFormatter
|
||||
/**
|
||||
* Appends a line consisting of indentation, opening element tag,
|
||||
* numeric element content, closing element tag and line separator
|
||||
* to a StringBuffer.
|
||||
* to a CPStringBuilder.
|
||||
*
|
||||
* @param buf the StringBuffer to which the line will be appended.
|
||||
* @param buf the CPStringBuilder to which the line will be appended.
|
||||
*
|
||||
* @param indent the indentation level.
|
||||
*
|
||||
@@ -173,7 +175,7 @@ public class XMLFormatter
|
||||
*
|
||||
* @param content the element content.
|
||||
*/
|
||||
private static void appendTag(StringBuffer buf, int indent,
|
||||
private static void appendTag(CPStringBuilder buf, int indent,
|
||||
String tag, long content)
|
||||
{
|
||||
appendTag(buf, indent, tag, Long.toString(content));
|
||||
@@ -182,7 +184,7 @@ public class XMLFormatter
|
||||
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
StringBuffer buf = new StringBuffer(400);
|
||||
CPStringBuilder buf = new CPStringBuilder(400);
|
||||
Level level = record.getLevel();
|
||||
long millis = record.getMillis();
|
||||
Object[] params = record.getParameters();
|
||||
@@ -314,10 +316,10 @@ public class XMLFormatter
|
||||
*/
|
||||
public String getHead(Handler h)
|
||||
{
|
||||
StringBuffer buf;
|
||||
CPStringBuilder buf;
|
||||
String encoding;
|
||||
|
||||
buf = new StringBuffer(80);
|
||||
buf = new CPStringBuilder(80);
|
||||
buf.append("<?xml version=\"1.0\" encoding=\"");
|
||||
|
||||
encoding = h.getEncoding();
|
||||
|
||||
@@ -38,7 +38,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util.prefs;
|
||||
|
||||
import gnu.java.util.prefs.EventDispatcher;
|
||||
import gnu.classpath.toolkit.DefaultDaemonThreadFactory;
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
import gnu.java.util.prefs.NodeWriter;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -49,6 +50,8 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Partial implementation of a Preference node.
|
||||
@@ -841,7 +844,7 @@ public abstract class AbstractPreferences extends Preferences {
|
||||
* Helper method for encoding an array of bytes as a Base64 String.
|
||||
*/
|
||||
private static String encode64(byte[] b) {
|
||||
StringBuffer sb = new StringBuffer((b.length/3)*4);
|
||||
CPStringBuilder sb = new CPStringBuilder((b.length/3)*4);
|
||||
|
||||
int i = 0;
|
||||
int remaining = b.length;
|
||||
@@ -1236,17 +1239,18 @@ public abstract class AbstractPreferences extends Preferences {
|
||||
*/
|
||||
private void fire(final PreferenceChangeEvent event)
|
||||
{
|
||||
Iterator it = preferenceListeners.iterator();
|
||||
while (it.hasNext())
|
||||
for (final PreferenceChangeListener listener : preferenceListeners)
|
||||
{
|
||||
final PreferenceChangeListener l = (PreferenceChangeListener) it.next();
|
||||
EventDispatcher.dispatch(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
l.preferenceChange(event);
|
||||
}
|
||||
});
|
||||
Runnable dispatcher = new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
listener.preferenceChange(event);
|
||||
}
|
||||
};
|
||||
|
||||
Executor executor =
|
||||
Executors.newSingleThreadExecutor(new DefaultDaemonThreadFactory());
|
||||
executor.execute(dispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1258,20 +1262,21 @@ public abstract class AbstractPreferences extends Preferences {
|
||||
*/
|
||||
private void fire(final NodeChangeEvent event, final boolean added)
|
||||
{
|
||||
Iterator it = nodeListeners.iterator();
|
||||
while (it.hasNext())
|
||||
for (final NodeChangeListener listener : nodeListeners)
|
||||
{
|
||||
final NodeChangeListener l = (NodeChangeListener) it.next();
|
||||
EventDispatcher.dispatch(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (added)
|
||||
l.childAdded(event);
|
||||
else
|
||||
l.childRemoved(event);
|
||||
}
|
||||
});
|
||||
Runnable dispatcher = new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
if (added)
|
||||
listener.childAdded(event);
|
||||
else
|
||||
listener.childRemoved(event);
|
||||
}
|
||||
};
|
||||
|
||||
Executor executor =
|
||||
Executors.newSingleThreadExecutor(new DefaultDaemonThreadFactory());
|
||||
executor.execute(dispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util.regex;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
import gnu.java.util.regex.CharIndexed;
|
||||
import gnu.java.util.regex.RE;
|
||||
import gnu.java.util.regex.REMatch;
|
||||
@@ -59,11 +61,45 @@ public final class Matcher implements MatchResult
|
||||
private int appendPosition;
|
||||
private REMatch match;
|
||||
|
||||
/**
|
||||
* The start of the region of the input on which to match.
|
||||
*/
|
||||
private int regionStart;
|
||||
|
||||
/**
|
||||
* The end of the region of the input on which to match.
|
||||
*/
|
||||
private int regionEnd;
|
||||
|
||||
/**
|
||||
* True if the match process should look beyond the
|
||||
* region marked by regionStart to regionEnd when
|
||||
* performing lookAhead, lookBehind and boundary
|
||||
* matching.
|
||||
*/
|
||||
private boolean transparentBounds;
|
||||
|
||||
/**
|
||||
* The flags that affect the anchoring bounds.
|
||||
* If {@link #hasAnchoringBounds()} is {@code true},
|
||||
* the match process will honour the
|
||||
* anchoring bounds: ^, \A, \Z, \z and $. If
|
||||
* {@link #hasAnchoringBounds()} is {@code false},
|
||||
* the anchors are ignored and appropriate flags,
|
||||
* stored in this variable, are used to provide this
|
||||
* behaviour.
|
||||
*/
|
||||
private int anchoringBounds;
|
||||
|
||||
Matcher(Pattern pattern, CharSequence input)
|
||||
{
|
||||
this.pattern = pattern;
|
||||
this.input = input;
|
||||
this.inputCharIndexed = RE.makeCharIndexed(input, 0);
|
||||
regionStart = 0;
|
||||
regionEnd = input.length();
|
||||
transparentBounds = false;
|
||||
anchoringBounds = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,13 +161,17 @@ public final class Matcher implements MatchResult
|
||||
public boolean find ()
|
||||
{
|
||||
boolean first = (match == null);
|
||||
match = pattern.getRE().getMatch(inputCharIndexed, position);
|
||||
if (transparentBounds || (regionStart == 0 && regionEnd == input.length()))
|
||||
match = pattern.getRE().getMatch(inputCharIndexed, position, anchoringBounds);
|
||||
else
|
||||
match = pattern.getRE().getMatch(input.subSequence(regionStart, regionEnd),
|
||||
position, anchoringBounds);
|
||||
if (match != null)
|
||||
{
|
||||
int endIndex = match.getEndIndex();
|
||||
// Are we stuck at the same position?
|
||||
if (!first && endIndex == position)
|
||||
{
|
||||
{
|
||||
match = null;
|
||||
// Not at the end of the input yet?
|
||||
if (position < input.length() - 1)
|
||||
@@ -156,7 +196,11 @@ public final class Matcher implements MatchResult
|
||||
*/
|
||||
public boolean find (int start)
|
||||
{
|
||||
match = pattern.getRE().getMatch(inputCharIndexed, start);
|
||||
if (transparentBounds || (regionStart == 0 && regionEnd == input.length()))
|
||||
match = pattern.getRE().getMatch(inputCharIndexed, start, anchoringBounds);
|
||||
else
|
||||
match = pattern.getRE().getMatch(input.subSequence(regionStart, regionEnd),
|
||||
start, anchoringBounds);
|
||||
if (match != null)
|
||||
{
|
||||
position = match.getEndIndex();
|
||||
@@ -218,7 +262,12 @@ public final class Matcher implements MatchResult
|
||||
|
||||
public boolean lookingAt ()
|
||||
{
|
||||
match = pattern.getRE().getMatch(inputCharIndexed, 0, RE.REG_FIX_STARTING_POSITION, null);
|
||||
if (transparentBounds || (regionStart == 0 && regionEnd == input.length()))
|
||||
match = pattern.getRE().getMatch(inputCharIndexed, regionStart,
|
||||
anchoringBounds|RE.REG_FIX_STARTING_POSITION|RE.REG_ANCHORINDEX);
|
||||
else
|
||||
match = pattern.getRE().getMatch(input.subSequence(regionStart, regionEnd), 0,
|
||||
anchoringBounds|RE.REG_FIX_STARTING_POSITION);
|
||||
if (match != null)
|
||||
{
|
||||
if (match.getStartIndex() == 0)
|
||||
@@ -243,7 +292,12 @@ public final class Matcher implements MatchResult
|
||||
*/
|
||||
public boolean matches ()
|
||||
{
|
||||
match = pattern.getRE().getMatch(inputCharIndexed, 0, RE.REG_TRY_ENTIRE_MATCH|RE.REG_FIX_STARTING_POSITION, null);
|
||||
if (transparentBounds || (regionStart == 0 && regionEnd == input.length()))
|
||||
match = pattern.getRE().getMatch(inputCharIndexed, regionStart,
|
||||
anchoringBounds|RE.REG_TRY_ENTIRE_MATCH|RE.REG_FIX_STARTING_POSITION|RE.REG_ANCHORINDEX);
|
||||
else
|
||||
match = pattern.getRE().getMatch(input.subSequence(regionStart, regionEnd), 0,
|
||||
anchoringBounds|RE.REG_TRY_ENTIRE_MATCH|RE.REG_FIX_STARTING_POSITION);
|
||||
if (match != null)
|
||||
{
|
||||
if (match.getStartIndex() == 0)
|
||||
@@ -265,15 +319,40 @@ public final class Matcher implements MatchResult
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the internal state of the matcher, including
|
||||
* resetting the region to its default state of encompassing
|
||||
* the whole input. The state of {@link #hasTransparentBounds()}
|
||||
* and {@link #hasAnchoringBounds()} are unaffected.
|
||||
*
|
||||
* @return a reference to this matcher.
|
||||
* @see #regionStart()
|
||||
* @see #regionEnd()
|
||||
* @see #hasTransparentBounds()
|
||||
* @see #hasAnchoringBounds()
|
||||
*/
|
||||
public Matcher reset ()
|
||||
{
|
||||
position = 0;
|
||||
match = null;
|
||||
regionStart = 0;
|
||||
regionEnd = input.length();
|
||||
appendPosition = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param input The new input character sequence
|
||||
* Resets the internal state of the matcher, including
|
||||
* resetting the region to its default state of encompassing
|
||||
* the whole input. The state of {@link #hasTransparentBounds()}
|
||||
* and {@link #hasAnchoringBounds()} are unaffected.
|
||||
*
|
||||
* @param input The new input character sequence.
|
||||
* @return a reference to this matcher.
|
||||
* @see #regionStart()
|
||||
* @see #regionEnd()
|
||||
* @see #hasTransparentBounds()
|
||||
* @see #hasAnchoringBounds()
|
||||
*/
|
||||
public Matcher reset (CharSequence input)
|
||||
{
|
||||
@@ -283,7 +362,7 @@ public final class Matcher implements MatchResult
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns the index of a capturing group in this matcher's pattern
|
||||
* @return the index of a capturing group in this matcher's pattern
|
||||
*
|
||||
* @exception IllegalStateException If no match has yet been attempted,
|
||||
* or if the previous match operation failed
|
||||
@@ -312,6 +391,7 @@ public final class Matcher implements MatchResult
|
||||
|
||||
/**
|
||||
* @return True if and only if the matcher hit the end of input.
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean hitEnd()
|
||||
{
|
||||
@@ -323,10 +403,12 @@ public final class Matcher implements MatchResult
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
CPStringBuilder sb = new CPStringBuilder();
|
||||
sb.append(this.getClass().getName())
|
||||
.append("[pattern=").append(pattern.pattern())
|
||||
.append(" region=").append("0").append(",").append(input.length())
|
||||
.append(" region=").append(regionStart).append(",").append(regionEnd)
|
||||
.append(" anchoringBounds=").append(anchoringBounds == 0)
|
||||
.append(" transparentBounds=").append(transparentBounds)
|
||||
.append(" lastmatch=").append(match == null ? "" : match.toString())
|
||||
.append("]");
|
||||
return sb.toString();
|
||||
@@ -336,4 +418,193 @@ public final class Matcher implements MatchResult
|
||||
{
|
||||
if (match == null) throw new IllegalStateException();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Defines the region of the input on which to match.
|
||||
* By default, the {@link Matcher} attempts to match
|
||||
* the whole string (from 0 to the length of the input),
|
||||
* but a region between {@code start} (inclusive) and
|
||||
* {@code end} (exclusive) on which to match may instead
|
||||
* be defined using this method.
|
||||
* </p>
|
||||
* <p>
|
||||
* The behaviour of region matching is further affected
|
||||
* by the use of transparent or opaque bounds (see
|
||||
* {@link #useTransparentBounds(boolean)}) and whether or not
|
||||
* anchors ({@code ^} and {@code $}) are in use
|
||||
* (see {@link #useAnchoringBounds(boolean)}). With transparent
|
||||
* bounds, the matcher is aware of input outside the bounds
|
||||
* set by this method, whereas, with opaque bounds (the default)
|
||||
* only the input within the bounds is used. The use of
|
||||
* anchors are affected by this setting; with transparent
|
||||
* bounds, anchors will match the beginning of the real input,
|
||||
* while with opaque bounds they match the beginning of the
|
||||
* region. {@link #useAnchoringBounds(boolean)} can be used
|
||||
* to turn on or off the matching of anchors.
|
||||
* </p>
|
||||
*
|
||||
* @param start the start of the region (inclusive).
|
||||
* @param end the end of the region (exclusive).
|
||||
* @return a reference to this matcher.
|
||||
* @throws IndexOutOfBoundsException if either {@code start} or
|
||||
* {@code end} are less than zero,
|
||||
* if either {@code start} or
|
||||
* {@code end} are greater than the
|
||||
* length of the input, or if
|
||||
* {@code start} is greater than
|
||||
* {@code end}.
|
||||
* @see #regionStart()
|
||||
* @see #regionEnd()
|
||||
* @see #hasTransparentBounds()
|
||||
* @see #useTransparentBounds(boolean)
|
||||
* @see #hasAnchoringBounds()
|
||||
* @see #useAnchoringBounds(boolean)
|
||||
* @since 1.5
|
||||
*/
|
||||
public Matcher region(int start, int end)
|
||||
{
|
||||
int length = input.length();
|
||||
if (start < 0)
|
||||
throw new IndexOutOfBoundsException("The start position was less than zero.");
|
||||
if (start >= length)
|
||||
throw new IndexOutOfBoundsException("The start position is after the end of the input.");
|
||||
if (end < 0)
|
||||
throw new IndexOutOfBoundsException("The end position was less than zero.");
|
||||
if (end > length)
|
||||
throw new IndexOutOfBoundsException("The end position is after the end of the input.");
|
||||
if (start > end)
|
||||
throw new IndexOutOfBoundsException("The start position is after the end position.");
|
||||
reset();
|
||||
regionStart = start;
|
||||
regionEnd = end;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The start of the region on which to perform matches (inclusive).
|
||||
*
|
||||
* @return the start index of the region.
|
||||
* @see #region(int,int)
|
||||
* #see #regionEnd()
|
||||
* @since 1.5
|
||||
*/
|
||||
public int regionStart()
|
||||
{
|
||||
return regionStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* The end of the region on which to perform matches (exclusive).
|
||||
*
|
||||
* @return the end index of the region.
|
||||
* @see #region(int,int)
|
||||
* @see #regionStart()
|
||||
* @since 1.5
|
||||
*/
|
||||
public int regionEnd()
|
||||
{
|
||||
return regionEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the bounds of the region marked by
|
||||
* {@link #regionStart()} and {@link #regionEnd()} are
|
||||
* transparent. When these bounds are transparent, the
|
||||
* matching process can look beyond them to perform
|
||||
* lookahead, lookbehind and boundary matching operations.
|
||||
* By default, the bounds are opaque.
|
||||
*
|
||||
* @return true if the bounds of the matching region are
|
||||
* transparent.
|
||||
* @see #useTransparentBounds(boolean)
|
||||
* @see #region(int,int)
|
||||
* @see #regionStart()
|
||||
* @see #regionEnd()
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean hasTransparentBounds()
|
||||
{
|
||||
return transparentBounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the transparency of the bounds of the region
|
||||
* marked by {@link #regionStart()} and {@link #regionEnd()}.
|
||||
* A value of {@code true} makes the bounds transparent,
|
||||
* so the matcher can see beyond them to perform lookahead,
|
||||
* lookbehind and boundary matching operations. A value
|
||||
* of {@code false} (the default) makes the bounds opaque,
|
||||
* restricting the match to the input region denoted
|
||||
* by {@link #regionStart()} and {@link #regionEnd()}.
|
||||
*
|
||||
* @param transparent true if the bounds should be transparent.
|
||||
* @return a reference to this matcher.
|
||||
* @see #hasTransparentBounds()
|
||||
* @see #region(int,int)
|
||||
* @see #regionStart()
|
||||
* @see #regionEnd()
|
||||
* @since 1.5
|
||||
*/
|
||||
public Matcher useTransparentBounds(boolean transparent)
|
||||
{
|
||||
transparentBounds = transparent;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the matcher will honour the use of
|
||||
* the anchoring bounds: {@code ^}, {@code \A}, {@code \Z},
|
||||
* {@code \z} and {@code $}. By default, the anchors
|
||||
* are used. Note that the effect of the anchors is
|
||||
* also affected by {@link #hasTransparentBounds()}.
|
||||
*
|
||||
* @return true if the matcher will attempt to match
|
||||
* the anchoring bounds.
|
||||
* @see #useAnchoringBounds(boolean)
|
||||
* @see #hasTransparentBounds()
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean hasAnchoringBounds()
|
||||
{
|
||||
return anchoringBounds == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the use of the anchoring bounds:
|
||||
* {@code ^}, {@code \A}, {@code \Z}, {@code \z} and
|
||||
* {@code $}. By default, their use is enabled. When
|
||||
* disabled, the matcher will not attempt to match
|
||||
* the anchors.
|
||||
*
|
||||
* @param useAnchors true if anchoring bounds should be used.
|
||||
* @return a reference to this matcher.
|
||||
* @since 1.5
|
||||
* @see #hasAnchoringBounds()
|
||||
*/
|
||||
public Matcher useAnchoringBounds(boolean useAnchors)
|
||||
{
|
||||
if (useAnchors)
|
||||
anchoringBounds = 0;
|
||||
else
|
||||
anchoringBounds = RE.REG_NOTBOL|RE.REG_NOTEOL;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a read-only snapshot of the current state of
|
||||
* the {@link Matcher} as a {@link MatchResult}. Any
|
||||
* subsequent changes to this instance are not reflected
|
||||
* in the returned {@link MatchResult}.
|
||||
*
|
||||
* @return a {@link MatchResult} instance representing the
|
||||
* current state of the {@link Matcher}.
|
||||
*/
|
||||
public MatchResult toMatchResult()
|
||||
{
|
||||
Matcher snapshot = new Matcher(pattern, input);
|
||||
snapshot.match = (REMatch) match.clone();
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ public final class Pattern implements Serializable
|
||||
public String[] split (CharSequence input, int limit)
|
||||
{
|
||||
Matcher matcher = new Matcher(this, input);
|
||||
ArrayList list = new ArrayList();
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
int empties = 0;
|
||||
int count = 0;
|
||||
int start = 0;
|
||||
@@ -251,9 +251,7 @@ public final class Pattern implements Serializable
|
||||
list.add(t);
|
||||
}
|
||||
|
||||
String[] output = new String [list.size()];
|
||||
list.toArray(output);
|
||||
return output;
|
||||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
|
||||
public String pattern ()
|
||||
|
||||
@@ -37,6 +37,8 @@ exception statement from your version. */
|
||||
|
||||
package java.util.regex;
|
||||
|
||||
import gnu.java.lang.CPStringBuilder;
|
||||
|
||||
/**
|
||||
* Indicates illegal pattern for regular expression.
|
||||
* Includes state to inspect the pattern and what and where the expression
|
||||
@@ -115,7 +117,7 @@ public class PatternSyntaxException extends IllegalArgumentException
|
||||
public String getMessage()
|
||||
{
|
||||
String lineSep = System.getProperty("line.separator");
|
||||
StringBuffer sb = new StringBuffer(desc);
|
||||
CPStringBuilder sb = new CPStringBuilder(desc);
|
||||
sb.append(lineSep);
|
||||
sb.append('\t');
|
||||
sb.append(pattern);
|
||||
|
||||
@@ -241,7 +241,6 @@ public class Deflater
|
||||
/**
|
||||
* Gets the number of input bytes processed so far.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getTotalIn()
|
||||
{
|
||||
return (int) engine.getTotalIn();
|
||||
@@ -259,7 +258,6 @@ public class Deflater
|
||||
/**
|
||||
* Gets the number of output bytes so far.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getTotalOut()
|
||||
{
|
||||
return (int) totalOut;
|
||||
|
||||
@@ -246,7 +246,6 @@ public class Inflater
|
||||
* Gets the total number of processed compressed input bytes.
|
||||
* @return the total number of bytes of processed input bytes.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getTotalIn()
|
||||
{
|
||||
return (int) (totalIn - getRemaining());
|
||||
@@ -266,7 +265,6 @@ public class Inflater
|
||||
* Gets the total number of output bytes returned by inflate().
|
||||
* @return the total number of output bytes.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getTotalOut()
|
||||
{
|
||||
return (int) totalOut;
|
||||
|
||||
@@ -50,23 +50,39 @@ import java.util.Calendar;
|
||||
*/
|
||||
public class ZipEntry implements ZipConstants, Cloneable
|
||||
{
|
||||
private static final int KNOWN_SIZE = 1;
|
||||
private static final int KNOWN_CSIZE = 2;
|
||||
private static final int KNOWN_CRC = 4;
|
||||
private static final int KNOWN_TIME = 8;
|
||||
private static final int KNOWN_EXTRA = 16;
|
||||
private static final byte KNOWN_SIZE = 1;
|
||||
private static final byte KNOWN_CSIZE = 2;
|
||||
private static final byte KNOWN_CRC = 4;
|
||||
private static final byte KNOWN_TIME = 8;
|
||||
private static final byte KNOWN_DOSTIME = 16;
|
||||
private static final byte KNOWN_EXTRA = 32;
|
||||
|
||||
private static Calendar cal;
|
||||
|
||||
private String name;
|
||||
/** Immutable name of the entry */
|
||||
private final String name;
|
||||
/** Uncompressed size */
|
||||
private int size;
|
||||
/** Compressed size */
|
||||
private long compressedSize = -1;
|
||||
/** CRC of uncompressed data */
|
||||
private int crc;
|
||||
private int dostime;
|
||||
private short known = 0;
|
||||
private short method = -1;
|
||||
private byte[] extra = null;
|
||||
/** Comment or null if none */
|
||||
private String comment = null;
|
||||
/** The compression method. Either DEFLATED or STORED, by default -1. */
|
||||
private byte method = -1;
|
||||
/** Flags specifying what we know about this entry */
|
||||
private byte known = 0;
|
||||
/**
|
||||
* The 32bit DOS encoded format for the time of this entry. Only valid if
|
||||
* KNOWN_DOSTIME is set in known.
|
||||
*/
|
||||
private int dostime;
|
||||
/**
|
||||
* The 64bit Java encoded millisecond time since the beginning of the epoch.
|
||||
* Only valid if KNOWN_TIME is set in known.
|
||||
*/
|
||||
private long time;
|
||||
/** Extra data */
|
||||
private byte[] extra = null;
|
||||
|
||||
int flags; /* used by ZipOutputStream */
|
||||
int offset; /* used by ZipFile and ZipOutputStream */
|
||||
@@ -113,6 +129,7 @@ public class ZipEntry implements ZipConstants, Cloneable
|
||||
compressedSize = e.compressedSize;
|
||||
crc = e.crc;
|
||||
dostime = e.dostime;
|
||||
time = e.time;
|
||||
method = e.method;
|
||||
extra = e.extra;
|
||||
comment = e.comment;
|
||||
@@ -121,37 +138,60 @@ public class ZipEntry implements ZipConstants, Cloneable
|
||||
final void setDOSTime(int dostime)
|
||||
{
|
||||
this.dostime = dostime;
|
||||
known |= KNOWN_TIME;
|
||||
known |= KNOWN_DOSTIME;
|
||||
known &= ~KNOWN_TIME;
|
||||
}
|
||||
|
||||
final int getDOSTime()
|
||||
{
|
||||
if ((known & KNOWN_TIME) == 0)
|
||||
return 0;
|
||||
else
|
||||
if ((known & KNOWN_DOSTIME) != 0)
|
||||
return dostime;
|
||||
else if ((known & KNOWN_TIME) != 0)
|
||||
{
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(time);
|
||||
dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25
|
||||
| (cal.get(Calendar.MONTH) + 1) << 21
|
||||
| (cal.get(Calendar.DAY_OF_MONTH)) << 16
|
||||
| (cal.get(Calendar.HOUR_OF_DAY)) << 11
|
||||
| (cal.get(Calendar.MINUTE)) << 5
|
||||
| (cal.get(Calendar.SECOND)) >> 1;
|
||||
known |= KNOWN_DOSTIME;
|
||||
return dostime;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a copy of this zip entry.
|
||||
*/
|
||||
/**
|
||||
* Clones the entry.
|
||||
*/
|
||||
public Object clone()
|
||||
{
|
||||
try
|
||||
// JCL defines this as being the same as the copy constructor above,
|
||||
// except that value of the "extra" field is also copied. Take care
|
||||
// that in the case of a subclass we use clone() rather than the copy
|
||||
// constructor.
|
||||
ZipEntry clone;
|
||||
if (this.getClass() == ZipEntry.class)
|
||||
clone = new ZipEntry(this);
|
||||
else
|
||||
{
|
||||
// The JCL says that the `extra' field is also copied.
|
||||
ZipEntry clone = (ZipEntry) super.clone();
|
||||
if (extra != null)
|
||||
clone.extra = (byte[]) extra.clone();
|
||||
return clone;
|
||||
try
|
||||
{
|
||||
clone = (ZipEntry) super.clone();
|
||||
}
|
||||
catch (CloneNotSupportedException e)
|
||||
{
|
||||
throw new InternalError();
|
||||
}
|
||||
}
|
||||
catch (CloneNotSupportedException ex)
|
||||
if (extra != null)
|
||||
{
|
||||
throw new InternalError();
|
||||
clone.extra = new byte[extra.length];
|
||||
System.arraycopy(extra, 0, clone.extra, 0, extra.length);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,18 +209,9 @@ public class ZipEntry implements ZipConstants, Cloneable
|
||||
*/
|
||||
public void setTime(long time)
|
||||
{
|
||||
Calendar cal = getCalendar();
|
||||
synchronized (cal)
|
||||
{
|
||||
cal.setTimeInMillis(time);
|
||||
dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25
|
||||
| (cal.get(Calendar.MONTH) + 1) << 21
|
||||
| (cal.get(Calendar.DAY_OF_MONTH)) << 16
|
||||
| (cal.get(Calendar.HOUR_OF_DAY)) << 11
|
||||
| (cal.get(Calendar.MINUTE)) << 5
|
||||
| (cal.get(Calendar.SECOND)) >> 1;
|
||||
}
|
||||
this.time = time;
|
||||
this.known |= KNOWN_TIME;
|
||||
this.known &= ~KNOWN_DOSTIME;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,39 +223,34 @@ public class ZipEntry implements ZipConstants, Cloneable
|
||||
// The extra bytes might contain the time (posix/unix extension)
|
||||
parseExtra();
|
||||
|
||||
if ((known & KNOWN_TIME) == 0)
|
||||
if ((known & KNOWN_TIME) != 0)
|
||||
return time;
|
||||
else if ((known & KNOWN_DOSTIME) != 0)
|
||||
{
|
||||
int sec = 2 * (dostime & 0x1f);
|
||||
int min = (dostime >> 5) & 0x3f;
|
||||
int hrs = (dostime >> 11) & 0x1f;
|
||||
int day = (dostime >> 16) & 0x1f;
|
||||
int mon = ((dostime >> 21) & 0xf) - 1;
|
||||
int year = ((dostime >> 25) & 0x7f) + 1980; /* since 1900 */
|
||||
|
||||
try
|
||||
{
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(year, mon, day, hrs, min, sec);
|
||||
time = cal.getTimeInMillis();
|
||||
known |= KNOWN_TIME;
|
||||
return time;
|
||||
}
|
||||
catch (RuntimeException ex)
|
||||
{
|
||||
/* Ignore illegal time stamp */
|
||||
known &= ~KNOWN_TIME;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
|
||||
int sec = 2 * (dostime & 0x1f);
|
||||
int min = (dostime >> 5) & 0x3f;
|
||||
int hrs = (dostime >> 11) & 0x1f;
|
||||
int day = (dostime >> 16) & 0x1f;
|
||||
int mon = ((dostime >> 21) & 0xf) - 1;
|
||||
int year = ((dostime >> 25) & 0x7f) + 1980; /* since 1900 */
|
||||
|
||||
try
|
||||
{
|
||||
cal = getCalendar();
|
||||
synchronized (cal)
|
||||
{
|
||||
cal.set(year, mon, day, hrs, min, sec);
|
||||
return cal.getTimeInMillis();
|
||||
}
|
||||
}
|
||||
catch (RuntimeException ex)
|
||||
{
|
||||
/* Ignore illegal time stamp */
|
||||
known &= ~KNOWN_TIME;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private static synchronized Calendar getCalendar()
|
||||
{
|
||||
if (cal == null)
|
||||
cal = Calendar.getInstance();
|
||||
|
||||
return cal;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,7 +324,7 @@ public class ZipEntry implements ZipConstants, Cloneable
|
||||
if (method != ZipOutputStream.STORED
|
||||
&& method != ZipOutputStream.DEFLATED)
|
||||
throw new IllegalArgumentException();
|
||||
this.method = (short) method;
|
||||
this.method = (byte) method;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -340,7 +340,7 @@ public class ZipFile implements ZipConstants
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
return EmptyEnumeration.getInstance();
|
||||
return new EmptyEnumeration<ZipEntry>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user