Author: fanningpj
Date: Sat May 26 08:31:14 2018
New Revision: 1832298

URL: http://svn.apache.org/viewvc?rev=1832298&view=rev
Log:
make java 6 the min supported version, fix build and bring in fixes from 
https://github.com/pjfanning/xmlbeans/blob/trunk/CHANGES.txt

Added:
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/NullLogger.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SAXHelper.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogFactory.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogger.java
Removed:
    xmlbeans/trunk/external/lib/piccolo.LICENSE.txt
    xmlbeans/trunk/external/lib/piccolo_apache_dist_20040629.jar
    xmlbeans/trunk/external/lib/piccolo_apache_dist_20040629_v2.jar
    xmlbeans/trunk/external/lib/piccolo_apache_dist_20040711.jar
    xmlbeans/trunk/external/lib/piccolo_apache_dist_20040711_v2.jar
    xmlbeans/trunk/src/store/org/w3c/
    xmlbeans/trunk/src/xmlpublic/javax/
Modified:
    xmlbeans/trunk/build.xml
    xmlbeans/trunk/samples/AbstractTypes/build.xml
    xmlbeans/trunk/samples/Any/build.xml
    xmlbeans/trunk/samples/DateTime/build.xml
    xmlbeans/trunk/samples/MixedContent/build.xml
    xmlbeans/trunk/samples/OrderMatters/build.xml
    xmlbeans/trunk/samples/SampleTemplate/build.xml
    xmlbeans/trunk/samples/SchemaEnum/build.xml
    xmlbeans/trunk/samples/SubstitutionGroup/build.xml
    xmlbeans/trunk/samples/Validation/build.xml
    xmlbeans/trunk/samples/XQueryXPath/build.xml
    xmlbeans/trunk/samples/XmlSort/build.xml
    xmlbeans/trunk/samples/XmlTree/build.xml
    xmlbeans/trunk/samples/XsdConfig/build.xml
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Cur.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java
    xmlbeans/trunk/test/perf/build.xml
    xmlbeans/trunk/test/src/xmlcursor/checkin/StoreTests.java
    xmlbeans/trunk/test/src/xmlobject/checkin/AssortedTests.java
    xmlbeans/trunk/test/src/xmlobject/checkin/CDataTest.java
    xmlbeans/trunk/testbuild.xml

Modified: xmlbeans/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/build.xml (original)
+++ xmlbeans/trunk/build.xml Sat May 26 08:31:14 2018
@@ -15,11 +15,11 @@
 -->
 <project name="Xbean" default="default" basedir=".">
 
-    <property name="build.compiler" value="javac1.4"/>
-    <property name="javac.source" value="1.4"/>
-    <property name="javac.target" value="1.4"/>
+    <property name="build.compiler" value="javac1.6"/>
+    <property name="javac.source" value="1.6"/>
+    <property name="javac.target" value="1.6"/>
 
-    <property name="version.base" value="2.6.0"/>
+    <property name="version.base" value="2.7.0"/>
     <property name="version.rc" value=""/>
 
     <!-- manifest entries -->
@@ -114,7 +114,7 @@
             http://easynews.dl.sourceforge.net/sourceforge/saxon/saxonb8-8j.zip
         -->
         <get dest="external/lib/saxonb9-0-0-4j.zip"
-            src="http://prdownloads.sourceforge.net/saxon/saxonb9-0-0-4j.zip";
+            
src="https://master.dl.sourceforge.net/project/saxon/OldFiles/9.0/9.0.0.4/saxonb9-0-0-4j.zip";
             verbose="true" usetimestamp="true" ignoreerrors="true"/>
         <unzip src="external/lib/saxonb9-0-0-4j.zip" dest="external/lib/">
             <patternset>
@@ -128,39 +128,6 @@
         <copy file="external/lib/saxon9-dom.jar" 
tofile="build/lib/saxon9-dom.jar"/>
     </target>
 
-    <target name="jsr173-bundle.downloaded">
-        <condition property="jsr173-bundle.exists">
-            <available file="external/lib/jsr173_1.0_api_bundle.jar"/>
-        </condition>
-    </target>
-
-    <target name="jsr173-bundle.jar"
-            depends="jsr173-bundle.downloaded, dirs"
-            unless="jsr173-bundle.exists">
-        <get dest="external/lib/jsr173_1.0_api_bundle.jar"
-            
src="http://www.apache.org/dist/java-repository/xmlbeans/jars/jsr173_1.0_api_bundle.jar";
-            verbose="true" usetimestamp="true" ignoreerrors="true"/>
-    </target>
-
-    <target name="jsr173_1.0.jars.extracted">
-        <condition property="jsr173_1.0.jars.exist">
-            <available file="build/lib/jsr173_1.0_api.jar"/>
-        </condition>
-    </target>
-
-    <target name="jsr173_1.0.jars"
-            depends="jsr173-bundle.jar, jsr173_1.0.jars.extracted"
-            unless="jsr173_1.0.jars.exist">
-        <unjar src="external/lib/jsr173_1.0_api_bundle.jar" 
dest="external/lib" >
-            <patternset>
-                <include name="jsr173_1.0_api.jar"/>
-            </patternset>
-        </unjar>
-
-        <!-- copy jsr173 API jar and license files to build/lib -->
-        <copy file="external/lib/jsr173_1.0_api.jar" 
tofile="build/lib/jsr173_1.0_api.jar"/>
-    </target>
-
     <!-- get resolver.jar -->
     <target name="check.xcresolver.zip">
         <condition property="xcresolver.zip.exists">
@@ -353,12 +320,8 @@
             <fileset dir="build/lib">
                 <include name="xbean.jar"/>
                 <include name="xmlpublic.jar"/>
-                <include name="xmlbeans-qname.jar"/>
                 <include name="xbean_xpath.jar"/>
                 <include name="resolver.jar"/>
-                <include name="jsr173_1.0_api.jar"/>
-                <include name="BEA Binary RI License (JSR 173).1(Clean).txt"/>
-                <include name="README(jsr_173 api and ri).txt"/>
             </fileset>
         </copy>
 
@@ -488,8 +451,8 @@
                  store.classes, saaj_api.classes,
                  marshal.classes, xpath.classes, oldxbean.jar, 
xsdschema.classes,
                  xmlinputstream.classes, resolver.jar, xbean_xpath.jar,
-                 piccolo.classes, tools.classes, jamsupport.classes">
-        <jar jarfile="build/lib/xbean.jar" index="true">
+                 tools.classes, jamsupport.classes">
+        <jar jarfile="build/lib/xbean.jar" index="true" duplicate="preserve">
             <fileset dir="build/classes/xmlpublic"
                 excludes="javax/**"/>
             <fileset dir="build/classes/typeholder"/>
@@ -509,7 +472,6 @@
             <fileset dir="build/classes/marshal"/>
             <fileset dir="build/classes/repackage"/>
             <fileset dir="build/classes/jam"/>
-            <fileset dir="build/classes/piccolo"/>
             <fileset dir="build/classes/tools"/>
             <fileset file="LICENSE.txt"/>
             <fileset file="NOTICE.txt"/>
@@ -523,10 +485,6 @@
                 </section>
             </manifest>
         </jar>
-        <jar jarfile="build/lib/xmlbeans-qname.jar">
-            <fileset dir="build/classes/xmlpublic"
-                
includes="javax/xml/namespace/QName.class,javax/xml/namespace/NamespaceContext.class"/>
-        </jar>
     </target>
 
     <!-- build XMLInputStream interface 
============================================= -->
@@ -545,12 +503,10 @@
 
     <!-- xmlpublic target ============================================== -->
 
-    <target name="xmlpublic.classes" depends="dirs, jsr173_1.0.jars">
+    <target name="xmlpublic.classes" depends="dirs">
         <mkdir dir="build/classes/xmlpublic"/>
         <javac srcdir="src/xmlpublic" sourcepath="src/xmlinputstream" 
destdir="build/classes/xmlpublic" source="${javac.source}" 
target="${javac.target}" debug="on">
-            <classpath>
-                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
-            </classpath>
+            <classpath/>
         </javac>
 
         <!-- Need properties files for XmlError -->
@@ -586,7 +542,6 @@
         <mkdir dir="build/classes/typestore"/>
         <javac srcdir="src/typestore" destdir="build/classes/typestore" 
source="${javac.source}" target="${javac.target}" debug="on">
             <classpath>
-                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
                 <pathelement location="build/classes/xmlinputstream"/>
                 <pathelement location="build/classes/xmlpublic"/>
                 <pathelement location="build/classes/common"/>
@@ -597,11 +552,10 @@
 
     <!-- common target ============================================= -->
 
-    <target name="common.classes" depends="dirs, xmlpublic.classes, 
xmlinputstream.classes, jsr173_1.0.jars">
+    <target name="common.classes" depends="dirs, xmlpublic.classes, 
xmlinputstream.classes">
         <mkdir dir="build/classes/common"/>
         <javac srcdir="src/common" destdir="build/classes/common" 
source="${javac.source}" target="${javac.target}" debug="on">
             <classpath>
-                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
                 <pathelement location="build/classes/xmlinputstream"/>
                 <pathelement location="build/classes/xmlpublic"/>
             </classpath>
@@ -639,7 +593,7 @@
 
     <target name="typeimpl.classes" depends="dirs, store.classes,
         repackage.classes, xmlpublic.classes, typeholder.template, 
typestore.classes, xsdschema.classes,
-        configschema.classes, toolschema.classes, jsr173_1.0.jars, 
jam.classes">
+        configschema.classes, toolschema.classes, jam.classes">
         <mkdir dir="build/classes/typeimpl"/>
         <javac destdir="build/classes/typeimpl" source="${javac.source}" 
target="${javac.target}" debug="on">
             <classpath>
@@ -655,7 +609,6 @@
                 <pathelement location="build/classes/xmlschema"/>
                 <pathelement location="build/classes/toolschema"/>
                 <pathelement location="build/classes/jam"/>
-                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
             </classpath>
 
             <src path="src/typeimpl"/>
@@ -681,7 +634,6 @@
         <mkdir dir="build/classes/xmlcomp"/>
         <javac srcdir="src/xmlcomp" destdir="build/classes/xmlcomp" 
source="${javac.source}" target="${javac.target}" debug="on">
             <classpath>
-                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
                 <pathelement location="build/classes/xmlinputstream"/>
                 <pathelement location="build/classes/xmlpublic"/>
                 <pathelement location="build/classes/common"/>
@@ -691,17 +643,17 @@
                 <pathelement location="build/classes/configschema"/>
                 <pathelement location="build/classes/toolschema"/>
                 <pathelement location="build/classes/xsdschema"/>
+                <pathelement location="build/classes/typestore"/>
             </classpath>
         </javac>
     </target>
 
     <!-- marshal target =============================================== -->
 
-    <target name="marshal.classes" depends="dirs, typeimpl.classes, 
xmlpublic.classes, jsr173_1.0.jars">
+    <target name="marshal.classes" depends="dirs, typeimpl.classes, 
xmlpublic.classes">
         <mkdir dir="build/classes/marshal"/>
         <javac srcdir="src/marshal" destdir="build/classes/marshal" 
source="${javac.source}" target="${javac.target}" debug="on">
             <classpath>
-                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
                 <pathelement location="build/classes/configschema"/>
                 <pathelement location="build/classes/xmlinputstream"/>
                 <pathelement location="build/classes/xmlpublic"/>
@@ -738,17 +690,15 @@
     <!-- store target ============================================== -->
 
     <target name="store.classes"
-        depends="dirs, common.classes, xmlpublic.classes, typestore.classes, 
saaj_api.classes, piccolo.classes">
+        depends="dirs, common.classes, xmlpublic.classes, typestore.classes, 
saaj_api.classes">
         <mkdir dir="build/classes/store"/>
         <javac srcdir="src/store" destdir="build/classes/store" 
source="${javac.source}" target="${javac.target}" debug="on">
             <classpath id="store.compile.path">
                 <pathelement location="build/classes/typestore"/>
-                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
                 <pathelement location="build/classes/xmlinputstream"/>
                 <pathelement location="build/classes/xmlpublic"/>
                 <pathelement location="build/classes/common"/>
                 <pathelement location="build/classes/saaj_api"/>
-                <pathelement location="build/classes/piccolo"/>
             </classpath>
         </javac>
     </target>
@@ -756,18 +706,16 @@
     <!-- tools target ============================================== -->
 
     <target name="tools.classes"
-        depends="dirs, common.classes, xmlpublic.classes, typestore.classes, 
saaj_api.classes, piccolo.classes,
+        depends="dirs, common.classes, xmlpublic.classes, typestore.classes, 
saaj_api.classes,
         typeimpl.classes, xmlcomp.classes">
         <mkdir dir="build/classes/tools"/>
         <javac srcdir="src/tools" destdir="build/classes/tools" 
source="${javac.source}" target="${javac.target}" debug="on">
             <classpath id="tools.compile.path">
                 <pathelement location="build/classes/typestore"/>
-                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
                 <pathelement location="build/classes/xmlinputstream"/>
                 <pathelement location="build/classes/xmlpublic"/>
                 <pathelement location="build/classes/common"/>
                 <pathelement location="build/classes/saaj_api"/>
-                <pathelement location="build/classes/piccolo"/>
                 <pathelement location="build/classes/typeimpl"/>
                 <pathelement location="build/classes/xmlcomp"/>
             </classpath>
@@ -784,13 +732,11 @@
 
     <path id="bootstrap.run.path">
         <pathelement location="build/private/lib/oldxbean.jar"/>
-        <pathelement location="build/lib/jsr173_1.0_api.jar"/>
         <pathelement location="build/classes/xmlpublic"/>
     </path>
 
     <path id="bootstrap.compile.path">
         <pathelement location="build/classes/xmlpublic"/>
-        <pathelement location="build/lib/jsr173_1.0_api.jar"/>
     </path>
 
     <property name="bootstrap.compile.path" refid="bootstrap.compile.path"/>
@@ -834,7 +780,7 @@
         </condition>
     </target>
 
-    <target name="xmlschema.classes" depends="xmlschema.check, 
xmlpublic.classes, oldxbean.jar, jsr173_1.0.jars" 
unless="xmlschema.notRequired">
+    <target name="xmlschema.classes" depends="xmlschema.check, 
xmlpublic.classes, oldxbean.jar" unless="xmlschema.notRequired">
         <delete dir="build/classes/xmlschema"/>
         <delete dir="build/src/xmlschema"/>
         <java classname="${bootstrap_schema_compiler}" 
classpathref="bootstrap.run.path" fork="true" failonerror="true">
@@ -919,7 +865,6 @@
     <property name="repackage_arg" value=""/>
     <property name="schema_compiler" 
value="org.apache.xmlbeans.impl.tool.SchemaCompiler"/>
     <property name="bootstrap_schema_compiler" 
value="org.apache.xmlbeans.impl.tool.SchemaCompiler"/>
-    <property name="piccolo_package_name" 
value="org.apache.xmlbeans.impl.piccolo"/>
     <property name="jam_package_name" value="org.apache.xmlbeans.impl.jam"/>
 
     <!--
@@ -1063,7 +1008,6 @@
         <pathelement location="build/classes/common"/>
         <pathelement location="external/lib/junit.jar"/>
         <pathelement location="build/ar/xbean.jar"/>
-        <pathelement location="build/lib/jsr173_1.0_api.jar"/>
         <pathelement location="build/classes/xmlinputstream"/>
     </path>
 
@@ -1073,7 +1017,7 @@
     </path>
 
 
-    <target name="drt.classes" depends="dirs,jsr173_1.0.jars">
+    <target name="drt.classes" depends="dirs">
         <mkdir dir="build/private/classes/drt"/>
         <javac
             destdir="build/private/classes/drt"
@@ -1093,7 +1037,6 @@
 
     <path id="scomp.run.path">
         <pathelement location="build/lib/xbean.jar"/>
-        <pathelement location="build/lib/jsr173_1.0_api.jar"/>
     </path>
 
     <target name="stsschema.check">
@@ -1118,7 +1061,7 @@
         </uptodate>
     </target>
 
-    <target name="jam.classes" depends="jam.classes.check, dirs, 
repackage.classes, jsr173_1.0.jars" unless="jam.classes.notRequired">
+    <target name="jam.classes" depends="jam.classes.check, dirs, 
repackage.classes" unless="jam.classes.notRequired">
         <delete dir="build/private/jam"/>
         <mkdir dir="build/private/jam"/>
         <unjar src="external/lib/jam-0.1.0-src.jar" dest="build/private/jam"/>
@@ -1137,46 +1080,10 @@
         <mkdir dir="build/classes/jam"/>
         <javac
             destdir="build/classes/jam"
-            source="1.4" target="1.4"
+            source="${javac.source}" target="${javac.target}"
             debug="on">
             <src path="build/private/jam/src_repackage"/>
-            <classpath>
-                <pathelement location="build/lib/jsr173_1.0_api.jar"/>
-            </classpath>
-        </javac>
-    </target>
-
-    <!-- Piccolo deployment -->
-    <target name="piccolo.classes.check">
-        <uptodate property="piccolo.classes.notRequired"
-            targetfile="build/ar/xbean.jar">
-            <srcfiles dir="external/lib" includes="**/piccolo_*.jar"/>
-        </uptodate>
-    </target>
-
-    <target name="piccolo.classes" depends="piccolo.classes.check, dirs, 
repackage.classes" unless="piccolo.classes.notRequired">
-        <delete dir="build/private/piccolo"/>
-        <mkdir dir="build/private/piccolo"/>
-        <unjar src="external/lib/piccolo_apache_dist_20040711_v2.jar" 
dest="build/private/piccolo"/>
-
-        <echo message="Re-packaging Piccolo"/>
-
-        <java classname="repackage.Repackage" fork="true" failonerror="true">
-            <classpath>
-                <pathelement location="build/classes/repackage"/>
-            </classpath>
-            <arg line="-repackage com.bluecast:${piccolo_package_name} -f 
build/private/piccolo/src -t build/private/piccolo/src_repackage"/>
-        </java>
-
-        <delete dir="build/classes/piccolo"/>
-        <mkdir dir="build/classes/piccolo"/>
-        <javac
-            destdir="build/classes/piccolo"
-            classpath=""
-            source="1.3" target="1.4"
-            debug="on">
-            <src path="build/private/piccolo/src_repackage"/>
+            <classpath/>
         </javac>
     </target>
-
 </project>

Modified: xmlbeans/trunk/samples/AbstractTypes/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/AbstractTypes/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/AbstractTypes/build.xml (original)
+++ xmlbeans/trunk/samples/AbstractTypes/build.xml Sat May 26 08:31:14 2018
@@ -70,7 +70,7 @@
                 <path refid="xmlbeans.classpath"/>
             </classpath>
         </scomp>
-        <javac srcdir="src" destdir="build" debug="on" source="1.4">
+        <javac srcdir="src" destdir="build" debug="on" source="1.6">
             <classpath>
                 <path refid="xmlbeans.classpath"/>
                 <pathelement location="build/${abstract.jar}"/>

Modified: xmlbeans/trunk/samples/Any/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/Any/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/Any/build.xml (original)
+++ xmlbeans/trunk/samples/Any/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="Any.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/DateTime/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/DateTime/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/DateTime/build.xml (original)
+++ xmlbeans/trunk/samples/DateTime/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="DateTime.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />  
     </target>
        

Modified: xmlbeans/trunk/samples/MixedContent/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/MixedContent/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/MixedContent/build.xml (original)
+++ xmlbeans/trunk/samples/MixedContent/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="MixedContent.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/OrderMatters/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/OrderMatters/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/OrderMatters/build.xml (original)
+++ xmlbeans/trunk/samples/OrderMatters/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="OrderMatters.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/SampleTemplate/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/SampleTemplate/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/SampleTemplate/build.xml (original)
+++ xmlbeans/trunk/samples/SampleTemplate/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="SampleTemplate.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/SchemaEnum/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/SchemaEnum/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/SchemaEnum/build.xml (original)
+++ xmlbeans/trunk/samples/SchemaEnum/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="SchemaEnum.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/SubstitutionGroup/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/SubstitutionGroup/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/SubstitutionGroup/build.xml (original)
+++ xmlbeans/trunk/samples/SubstitutionGroup/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="SubstitutionGroup.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/Validation/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/Validation/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/Validation/build.xml (original)
+++ xmlbeans/trunk/samples/Validation/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="Validation.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/XQueryXPath/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/XQueryXPath/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/XQueryXPath/build.xml (original)
+++ xmlbeans/trunk/samples/XQueryXPath/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="XQueryXPath.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/XmlSort/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/XmlSort/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/XmlSort/build.xml (original)
+++ xmlbeans/trunk/samples/XmlSort/build.xml Sat May 26 08:31:14 2018
@@ -65,7 +65,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="XmlSort.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/XmlTree/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/XmlTree/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/XmlTree/build.xml (original)
+++ xmlbeans/trunk/samples/XmlTree/build.xml Sat May 26 08:31:14 2018
@@ -89,7 +89,7 @@ limitations under the License.
             destdir="build/classes"
             classpathref="XmlTree.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />
     </target>
 

Modified: xmlbeans/trunk/samples/XsdConfig/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/samples/XsdConfig/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/samples/XsdConfig/build.xml (original)
+++ xmlbeans/trunk/samples/XsdConfig/build.xml Sat May 26 08:31:14 2018
@@ -120,13 +120,13 @@ limitations under the License.
             destdir="build/classes"
             classpathref="XsdConfig.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />  
         <javac srcdir="src" 
includes="org/apache/xmlbeans/samples/xsdconfig/CatalogXsd.java 
org/apache/xmlbeans/samples/xsdconfig/XsdTest.java "
             destdir="build/classes"
             classpathref="Xsd.path"
             debug="on"
-            source="1.4"
+            source="1.6"
             />  
             
     </target>

Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Cur.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Cur.java?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Cur.java (original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Cur.java Sat May 26 
08:31:14 2018
@@ -3466,28 +3466,36 @@ final class Cur
 
         String s = CharUtil.getString( src, off, cch );
 
-        for ( int i = 0 ; i < s.length() ; i++ )
+        for ( int i = 0 ; i < s.length(); )
         {
-            if (i== 36)
+            if (i == 36)
             {
                 o.print( "..." );
                 break;
             }
 
-            char ch = s.charAt( i );
-
-            if (ch >= 32 && ch < 127)
-                o.print( ch );
-            else if (ch == '\n')
-                o.print( "\\n" );
-            else if (ch == '\r')
-                o.print( "\\r" );
-            else if (ch == '\t')
-                o.print( "\\t" );
-            else if (ch == '\"')
-                o.print( "\\\"" );
-            else
-                o.print( "<#" + ((int) ch) + ">" );
+            int codePoint = s.codePointAt( i );
+            char[] chars = Character.toChars(codePoint);
+            
+            if ( chars.length == 1 ) {
+                char ch = chars[0];
+                if (ch >= 32 && ch < 127)
+                    o.print( ch );
+                else if (ch == '\n')
+                    o.print( "\\n" );
+                else if (ch == '\r')
+                    o.print( "\\r" );
+                else if (ch == '\t')
+                    o.print( "\\t" );
+                else if (ch == '\"')
+                    o.print( "\\\"" );
+                else
+                    o.print( "<#" + ((int) ch) + ">" );
+            } else {
+                o.print( "<#" + codePoint + ">" );
+            }
+            
+            i += Character.charCount(codePoint);
         }
 
         o.print( "\"" );

Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java 
(original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Locale.java Sat May 
26 08:31:14 2018
@@ -1,4 +1,4 @@
-/*   Copyright 2004 The Apache Software Foundation
+/*   Copyright 2004-2017 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@ import org.xml.sax.InputSource;
 import org.xml.sax.ext.LexicalHandler;
 import org.xml.sax.ext.DeclHandler;
 import org.xml.sax.SAXParseException;
-import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 import org.xml.sax.SAXException;
 import org.xml.sax.DTDHandler;
@@ -38,8 +37,6 @@ import java.lang.ref.Reference;
 import java.lang.ref.PhantomReference;
 import java.lang.ref.SoftReference;
 
-import java.lang.reflect.Method;
-
 import java.io.InputStream;
 import java.io.Reader;
 import java.io.StringReader;
@@ -106,9 +103,6 @@ import org.apache.xmlbeans.impl.values.T
 import org.apache.xmlbeans.impl.values.TypeStoreUser;
 import org.apache.xmlbeans.impl.values.TypeStoreUserFactory;
 
-import org.apache.xmlbeans.impl.piccolo.xml.Piccolo;
-import org.apache.xmlbeans.impl.piccolo.io.FileFormatException;
-
 public final class Locale
     implements DOMImplementation, SaajCallback, XmlLocale
 {
@@ -3035,18 +3029,7 @@ public final class Locale
         }
     }
 
-    private static SaxLoader getPiccoloSaxLoader()
-    {
-        SaxLoader piccoloLoader = (SaxLoader) SystemCache.get().getSaxLoader();
-        if (piccoloLoader == null)
-        {
-            piccoloLoader = PiccoloSaxLoader.newInstance();
-            SystemCache.get().setSaxLoader(piccoloLoader);
-        }
-        return piccoloLoader;
-    }
-
-    private static SaxLoader getSaxLoader(XmlOptions options)
+    private static SaxLoader getSaxLoader(XmlOptions options) throws 
XmlException
     {
         options = XmlOptions.maskNull(options);
 
@@ -3063,31 +3046,23 @@ public final class Locale
                 er = new DefaultEntityResolver();
         }
 
-        SaxLoader sl;
-
-        if (options.hasOption(XmlOptions.LOAD_USE_XMLREADER))
-        {
-            XMLReader xr = (XMLReader) options.get(
-                XmlOptions.LOAD_USE_XMLREADER);
+        XMLReader xr = (XMLReader) options.get(
+            XmlOptions.LOAD_USE_XMLREADER);
 
-            if (xr == null)
-                throw new IllegalArgumentException("XMLReader is null");
-
-            sl = new XmlReaderSaxLoader(xr);
-
-            // I've noticed that most XMLReaders don't like a null 
EntityResolver...
-
-            if (er != null)
-                xr.setEntityResolver(er);
+        if (xr == null) {
+            try {
+                xr = SAXHelper.newXMLReader();
+            } catch(Exception e) {
+                throw new XmlException("Problem creating XMLReader", e);
+            } 
         }
-        else
-        {
-            sl = getPiccoloSaxLoader();
 
-            // Piccolo doesnot mind a null entity resolver ...
+        SaxLoader sl = new XmlReaderSaxLoader(xr);
 
-            sl.setEntityResolver(er);
-        }
+        // I've noticed that most XMLReaders don't like a null 
EntityResolver...
+
+        if (er != null)
+            xr.setEntityResolver(er);
 
         return sl;
     }
@@ -3101,34 +3076,6 @@ public final class Locale
         }
     }
 
-    private static class PiccoloSaxLoader
-        extends SaxLoader
-    {
-        private PiccoloSaxLoader(Piccolo p)
-        {
-            super(p, p.getStartLocator());
-
-            _piccolo = p;
-        }
-
-        static PiccoloSaxLoader newInstance()
-        {
-            return new PiccoloSaxLoader(new Piccolo());
-        }
-
-        void postLoad(Cur c)
-        {
-            XmlDocumentProperties props = getDocProps(c, true);
-
-            props.setEncoding(_piccolo.getEncoding());
-            props.setVersion(_piccolo.getVersion());
-
-            super.postLoad(c);
-        }
-
-        private Piccolo _piccolo;
-    }
-
     private static abstract class SaxHandler
         implements ContentHandler, LexicalHandler , DeclHandler, DTDHandler
     {
@@ -3183,7 +3130,7 @@ public final class Locale
             if (local.length() == 0)
                 local = qName;
 
-            // Out current parser (Piccolo) does not error when a
+            // Out current parser does not error when a
             // namespace is used and not defined.  Check for these here
 
             if (qName.indexOf(':') >= 0 && uri.length() == 0)
@@ -3473,12 +3420,6 @@ public final class Locale
 
                 return c;
             }
-            catch (FileFormatException e)
-            {
-                _context.abort();
-
-                throw new XmlException(e.getMessage(), e);
-            }
             catch (XmlRuntimeException e)
             {
                 _context.abort();

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/NullLogger.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/NullLogger.java?rev=1832298&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/NullLogger.java 
(added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/NullLogger.java Sat 
May 26 08:31:14 2018
@@ -0,0 +1,81 @@
+/*   Copyright 2017 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.store;
+
+/**
+ * A logger class that strives to make it as easy as possible for
+ * developers to write log calls, while simultaneously making those
+ * calls as cheap as possible by performing lazy evaluation of the log
+ * message.<p>
+ */
+public class NullLogger extends XBLogger {
+    @Override
+    public void initialize(final String cat) {
+       // do nothing
+    }
+
+    /**
+     * Log a message
+     *
+     * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
+     * @param obj1 The object to log.
+     */
+
+    @Override
+    protected void _log(final int level, final Object obj1) {
+        // do nothing
+    }
+
+    /**
+     * Log a message
+     *
+     * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
+     * @param obj1 The object to log.  This is converted to a string.
+     * @param exception An exception to be logged
+     */
+    @Override
+    protected void _log(int level, Object obj1, final Throwable exception) {
+        // do nothing
+    }
+
+    /**
+     * Log a message. Lazily appends Object parameters together.
+     * If the last parameter is a {@link Throwable} it is logged specially.
+     *
+     * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
+     * @param objs the objects to place in the message
+     */
+    @Override
+    public void log(int level, Object... objs) {
+        // do nothing
+    }
+
+    
+    /**
+     * Check if a logger is enabled to log at the specified level
+     *
+     * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
+     */
+    @Override
+    public boolean check(final int level) {
+       return false;
+    }
+}
+
+
+
+
+

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SAXHelper.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SAXHelper.java?rev=1832298&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SAXHelper.java 
(added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/SAXHelper.java Sat 
May 26 08:31:14 2018
@@ -0,0 +1,99 @@
+/*   Copyright 2017 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.store;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.lang.reflect.Method;
+import java.util.concurrent.TimeUnit;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/**
+ * Provides handy methods for working with SAX parsers and readers
+ */
+public final class SAXHelper {
+    private static final XBLogger logger = 
XBLogFactory.getLogger(SAXHelper.class);
+    private static long lastLog;
+
+    private SAXHelper() {}
+
+    /**
+     * Creates a new SAX XMLReader, with sensible defaults
+     */
+    public static synchronized XMLReader newXMLReader() throws SAXException, 
ParserConfigurationException {
+        XMLReader xmlReader = saxFactory.newSAXParser().getXMLReader();
+        xmlReader.setEntityResolver(IGNORING_ENTITY_RESOLVER);
+        trySetSAXFeature(xmlReader, XMLConstants.FEATURE_SECURE_PROCESSING);
+        trySetXercesSecurityManager(xmlReader);
+        return xmlReader;
+    }
+    
+    static final EntityResolver IGNORING_ENTITY_RESOLVER = new 
EntityResolver() {
+        @Override
+        public InputSource resolveEntity(String publicId, String systemId)
+                throws SAXException, IOException {
+            return new InputSource(new StringReader(""));
+        }
+    };
+    
+    private static final SAXParserFactory saxFactory;
+    static {
+        saxFactory = SAXParserFactory.newInstance();
+        saxFactory.setValidating(false);
+        saxFactory.setNamespaceAware(true);
+    }
+            
+    private static void trySetSAXFeature(XMLReader xmlReader, String feature) {
+        try {
+            xmlReader.setFeature(feature, true);
+        } catch (Exception e) {
+            logger.log(XBLogger.WARN, "SAX Feature unsupported", feature, e);
+        } catch (AbstractMethodError ame) {
+            logger.log(XBLogger.WARN, "Cannot set SAX feature because outdated 
XML parser in classpath", feature, ame);
+        }
+    }
+    
+    private static void trySetXercesSecurityManager(XMLReader xmlReader) {
+        // Try built-in JVM one first, standalone if not
+        for (String securityManagerClassName : new String[] {
+                "com.sun.org.apache.xerces.internal.util.SecurityManager",
+                "org.apache.xerces.util.SecurityManager"
+        }) {
+            try {
+                Object mgr = 
Class.forName(securityManagerClassName).newInstance();
+                Method setLimit = 
mgr.getClass().getMethod("setEntityExpansionLimit", Integer.TYPE);
+                setLimit.invoke(mgr, 4096);
+                
xmlReader.setProperty("http://apache.org/xml/properties/security-manager";, mgr);
+                // Stop once one can be setup without error
+                return;
+            } catch (Throwable e) {     // NOSONAR - also catch things like 
NoClassDefError here
+                // throttle the log somewhat as it can spam the log otherwise
+                if(System.currentTimeMillis() > lastLog + 
TimeUnit.MINUTES.toMillis(5)) {
+                    logger.log(XBLogger.WARN, "SAX Security Manager could not 
be setup [log suppressed for 5 minutes]", e);
+                    lastLog = System.currentTimeMillis();
+                }
+            }
+        }
+    }
+}

Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java 
(original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java Sat May 
26 08:31:14 2018
@@ -275,7 +275,23 @@ abstract class Saver
         end.moveToCur( c );
         end.toEnd();
     }
-
+    
+    /**
+     * Test if a character is valid in xml character content. See
+     * http://www.w3.org/TR/REC-xml#NT-Char
+     */
+    static boolean isBadChar ( char ch )
+    {
+        return ! (
+            Character.isHighSurrogate(ch) ||
+            Character.isLowSurrogate(ch) ||
+            (ch >= 0x20 && ch <= 0xD7FF ) ||
+            (ch >= 0xE000 && ch <= 0xFFFD) ||
+            (ch >= 0x10000 && ch <= 0x10FFFF) ||
+            (ch == 0x9) || (ch == 0xA) || (ch == 0xD)
+        );
+    }
+        
     protected boolean saveNamespacesFirst ( )
     {
         return _saveNamespacesFirst;
@@ -1387,7 +1403,7 @@ abstract class Saver
                 if (++i == _buf.length)
                     i = 0;
 
-                for ( int cch = _lastEmitCch ; cch > 0 ; cch-- )
+                for ( int cch = _lastEmitCch - 2 ; cch > 0 ; cch-- )
                 {
                     char ch = _buf[ i ];
 
@@ -1552,21 +1568,6 @@ abstract class Saver
         }
 
         /**
-         * Test if a character is valid in xml character content. See
-         * http://www.w3.org/TR/REC-xml#NT-Char
-         */
-
-        private boolean isBadChar ( char ch )
-        {
-            return ! (
-                (ch >= 0x20 && ch <= 0xD7FF ) ||
-                (ch >= 0xE000 && ch <= 0xFFFD) ||
-                (ch >= 0x10000 && ch <= 0x10FFFF) ||
-                (ch == 0x9) || (ch == 0xA) || (ch == 0xD)
-                );
-        }
-
-        /**
          * Test if a character is to be replaced with an escaped value
          */
         private boolean isEscapedChar ( char ch )
@@ -2190,20 +2191,6 @@ abstract class Saver
             }
         }
 
-        /**
-         * Test if a character is valid in xml character content. See
-         * http://www.w3.org/TR/REC-xml#NT-Char
-         */
-        private boolean isBadChar ( char ch )
-        {
-            return ! (
-                (ch >= 0x20 && ch <= 0xD7FF ) ||
-                (ch >= 0xE000 && ch <= 0xFFFD) ||
-                (ch >= 0x10000 && ch <= 0x10FFFF) ||
-                (ch == 0x9) || (ch == 0xA) || (ch == 0xD)
-                );
-        }
-
         private void emitLiteral ( String literal )
         {
             // TODO: systemId production 
http://www.w3.org/TR/REC-xml/#NT-SystemLiteral

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogFactory.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogFactory.java?rev=1832298&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogFactory.java 
(added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogFactory.java 
Sat May 26 08:31:14 2018
@@ -0,0 +1,119 @@
+/*   Copyright 2017 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.store;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Provides logging without clients having to mess with
+ * configuration/initialization.
+ *
+ * @author Andrew C. Oliver (acoliver at apache dot org)
+ * @author Marc Johnson (mjohnson at apache dot org)
+ * @author Nicola Ken Barozzi (nicolaken at apache.org)
+ */
+public final class XBLogFactory {
+    /**
+     * Map of XBLogger instances, with classes as keys
+     */
+    private static final Map<String,XBLogger> _loggers = new 
HashMap<String,XBLogger>();
+
+    /**
+     * A common instance of NullLogger, as it does nothing
+     *  we only need the one
+     */
+    private static final XBLogger _nullLogger = new NullLogger();
+    /**
+     * The name of the class to use. Initialised the
+     *  first time we need it
+     */
+    static String _loggerClassName = null;
+
+    /**
+     * Construct a XBLogFactory.
+     */
+    private XBLogFactory() {}
+
+    /**
+     * Get a logger, based on a class name
+     *
+     * @param theclass the class whose name defines the log
+     *
+     * @return a XBLogger for the specified class
+     */
+    public static XBLogger getLogger(final Class<?> theclass) {
+        return getLogger(theclass.getName());
+    }
+
+    /**
+     * Get a logger, based on a String
+     *
+     * @param cat the String that defines the log
+     *
+     * @return a XBLogger for the specified class
+     */
+    public static XBLogger getLogger(final String cat) {
+        // If we haven't found out what logger to use yet,
+        //  then do so now
+        // Don't look it up until we're first asked, so
+        //  that our users can set the system property
+        //  between class loading and first use
+        if(_loggerClassName == null) {
+               try {
+                       _loggerClassName = 
System.getProperty("org.apache.xmlbeans.impl.store.XBLogger");
+               } catch(Exception e) {
+                // ignore any exception here
+            }
+
+               // Use the default logger if none specified,
+               //  or none could be fetched
+               if(_loggerClassName == null) {
+                _loggerClassName = _nullLogger.getClass().getName();
+               }
+        }
+
+        // Short circuit for the null logger, which
+        //  ignores all categories
+        if(_loggerClassName.equals(_nullLogger.getClass().getName())) {
+               return _nullLogger;
+        }
+
+
+        // Fetch the right logger for them, creating
+        //  it if that's required
+        XBLogger logger = _loggers.get(cat);
+        if (logger == null) {
+            try {
+                @SuppressWarnings("unchecked")
+                Class<? extends XBLogger> loggerClass =
+                    (Class<? extends XBLogger>) 
Class.forName(_loggerClassName);
+                logger = loggerClass.newInstance();
+                logger.initialize(cat);
+            } catch(Exception e) {
+                // Give up and use the null logger
+                logger = _nullLogger;
+                _loggerClassName = _nullLogger.getClass().getName();
+            }
+
+            // Save for next time
+            _loggers.put(cat, logger);
+        }
+        return logger;
+    }
+}
+
+

Added: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogger.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogger.java?rev=1832298&view=auto
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogger.java 
(added)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/XBLogger.java Sat 
May 26 08:31:14 2018
@@ -0,0 +1,115 @@
+/*   Copyright 2017 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.xmlbeans.impl.store;
+
+/**
+ * A logger interface that strives to make it as easy as possible for
+ * developers to write log calls, while simultaneously making those
+ * calls as cheap as possible by performing lazy evaluation of the log
+ * message.<p>
+ */
+public abstract class XBLogger {
+
+    public static final int DEBUG = 1;
+    public static final int INFO  = 3;
+    public static final int WARN  = 5;
+    public static final int ERROR = 7;
+    public static final int FATAL = 9;
+
+    /** Short strings for numeric log level. Use level as array index. */
+    protected static final String LEVEL_STRINGS_SHORT[] = {"?", "D", "?", "I", 
"?", "W", "?", "E", "?", "F", "?"};
+    /** Long strings for numeric log level. Use level as array index. */
+    protected static final String LEVEL_STRINGS[] = {"?0?", "DEBUG", "?2?", 
"INFO", "?4?", "WARN", "?6?", "ERROR", "?8?", "FATAL", "?10+?"};
+
+
+    /**
+     * package scope so it cannot be instantiated outside of the util
+     * package. You need a XBLogger? Go to the XBLogFactory for one
+     */
+    XBLogger() {
+        // no fields to initialize
+    }
+
+    abstract public void initialize(String cat);
+
+    /**
+     * Log a message
+     *
+     * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
+     * @param obj1 The object to log.  This is converted to a string.
+     */
+    abstract protected void _log(int level, Object obj1);
+
+    /**
+     * Log a message
+     *
+     * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
+     * @param obj1 The object to log.  This is converted to a string.
+     * @param exception An exception to be logged
+     */
+    abstract protected void _log(int level, Object obj1, final Throwable 
exception);
+
+
+    /**
+     * Check if a logger is enabled to log at the specified level
+     * This allows code to avoid building strings or evaluating functions in
+     * the arguments to log.
+     * 
+     * An example:
+     * <code><pre>
+     * if (logger.check(XBLogger.INFO)) {
+     *     logger.log(XBLogger.INFO, "Avoid concatenating " + " strings and 
evaluating " + functions());
+     * }
+     * </pre></code>
+     *
+     * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
+     */
+    abstract public boolean check(int level);
+
+   /**
+     * Log a message. Lazily appends Object parameters together.
+     * If the last parameter is a {@link Throwable} it is logged specially.
+     *
+     * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
+     * @param objs the objects to place in the message
+     */
+    public void log(int level, Object... objs) {
+        if (!check(level)) return;
+        StringBuilder sb = new StringBuilder(32);
+        Throwable lastEx = null;
+        for (int i=0; i<objs.length; i++) {
+            if (i == objs.length-1 && objs[i] instanceof Throwable) {
+                lastEx = (Throwable)objs[i];
+            } else {
+                sb.append(objs[i]);
+            }
+        }
+        
+        String msg = sb.toString();
+        msg = msg.replaceAll("[\r\n]+", " ");  // log forging escape
+        
+        // somehow this ambiguity works and doesn't lead to a loop,
+        // but it's confusing ...
+        if (lastEx == null) {
+            _log(level, msg);
+        } else {
+            _log(level, msg, lastEx);
+        }
+    }
+}
+
+
+

Modified: xmlbeans/trunk/test/perf/build.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/test/perf/build.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/test/perf/build.xml (original)
+++ xmlbeans/trunk/test/perf/build.xml Sat May 26 08:31:14 2018
@@ -348,7 +348,7 @@
                        executable="${env.JAVA_HOME}/bin/javac"
                        classpathref="tools.classpath"
                        includes="org/apache/xmlbeans/test/tools/**"
-                       source="1.4">
+                       source="1.6">
                </javac>
        </target>
 
@@ -363,7 +363,7 @@
                        executable="${env.JAVA_HOME}/bin/javac"
                        classpathref="svn.classpath"
                        
includes="org/apache/xmlbeans/test/performance/svn/**,org/apache/xmlbeans/test/performance/utils/**"
-                       source="1.4">
+                       source="1.6">
                </javac>
        </target>
 
@@ -378,7 +378,7 @@
                        executable="${env.JAVA_HOME}/bin/javac"
                        classpathref="v1.classpath"
                        
includes="org/apache/xmlbeans/test/performance/v1/**,org/apache/xmlbeans/test/performance/utils/**"
-                       source="1.4">
+                       source="1.6">
                </javac>
        </target>
 
@@ -393,7 +393,7 @@
             executable="${env.JAVA_HOME}/bin/javac"
             classpathref="v2.classpath"
             
includes="org/apache/xmlbeans/test/performance/v2/**,org/apache/xmlbeans/test/performance/utils/**"
-            source="1.4">
+            source="1.6">
         </javac>
     </target>
 
@@ -408,7 +408,7 @@
                        executable="${env.JAVA_HOME}/bin/javac"
                        classpathref="castor.classpath"
                        
includes="org/apache/xmlbeans/test/performance/castor/**,org/apache/xmlbeans/test/performance/utils/**"
-                       source="1.4">
+                       source="1.6">
                </javac>
        </target>
 
@@ -424,7 +424,7 @@
                        classpathref="jibx.classpath"
                        
includes="org/apache/xmlbeans/test/performance/jibx/**,org/apache/xmlbeans/test/performance/utils/**"
                        
excludes="org/apache/xmlbeans/test/performance/jibx/binding/**"
-                       source="1.4">
+                       source="1.6">
                </javac>
        </target>
 
@@ -439,7 +439,7 @@
                        executable="${env.JAVA_HOME}/bin/javac"
                        classpathref="jaxb.classpath"
                        
includes="org/apache/xmlbeans/test/performance/jaxb/**,org/apache/xmlbeans/test/performance/utils/**"
-                       source="1.4">
+                       source="1.6">
                </javac>
        </target>
 
@@ -470,7 +470,7 @@
                        executable="${env.JAVA_HOME}/bin/javac"
                        classpathref="xerces.classpath"
                        
includes="org/apache/xmlbeans/test/performance/xerces/**,org/apache/xmlbeans/test/performance/utils/**"
-                       source="1.4">
+                       source="1.6">
                </javac>
        </target>
 
@@ -667,7 +667,7 @@
                        memoryMaximumSize="1000M"
                        compiler="modern"
                        executable="${env.JAVA_HOME}/bin/javac"
-                       source="1.4"
+                       source="1.6"
                        classpathref="castor.classpath"/>
                <jar destfile="${schema.jar.build.dir}/${jar.name}"
                                 basedir="${castor.temp.dir}"/>
@@ -689,7 +689,7 @@
                        classpathref="jibx.binding.classpath"
                        
includes="org/apache/xmlbeans/test/performance/jibx/binding/**"
                        
excludes="org/apache/xmlbeans/test/performance/castor/**,org/apache/xmlbeans/test/performance/svn/**,org/apache/xmlbeans/test/performance/utils/**"
-                       source="1.4">
+                       source="1.6">
                </javac>
                <java classname="org.jibx.binding.Compile"
                                        fork="true"
@@ -750,7 +750,7 @@
                        compiler="modern"
                        executable="${env.JAVA_HOME}/bin/javac"
                        classpathref="jaxb.classpath"
-                       source="1.4">
+                       source="1.6">
                </javac>
                <jar destfile="${schema.jar.build.dir}/${jar.name}"
                                 basedir="${jaxb.temp.dir}"/>

Modified: xmlbeans/trunk/test/src/xmlcursor/checkin/StoreTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlcursor/checkin/StoreTests.java?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlcursor/checkin/StoreTests.java (original)
+++ xmlbeans/trunk/test/src/xmlcursor/checkin/StoreTests.java Sat May 26 
08:31:14 2018
@@ -1112,7 +1112,7 @@ public class StoreTests extends TestCase
         throws Exception
     {
         XmlCursor c = XmlObject.Factory.parse( xml ).newCursor();
-        Assert.assertTrue( c.xmlText().equals( xml ) );
+        Assert.assertEquals( xml, c.xmlText() );
     }
     
     private void doSaveTest ( String xml )
@@ -1121,6 +1121,16 @@ public class StoreTests extends TestCase
         doSaverTest( xml );
     }
 
+    public void testCDATA() throws Exception
+    {
+        // https://issues.apache.org/jira/browse/XMLBEANS-404
+        String xml = "<foo>Unable to render embedded object: 
<![CDATA[>>>>>>>><<<<<<<<<<<]]></foo>";
+        String expected = "<foo><![CDATA[Unable to render embedded object: 
>>>>>>>><<<<<<<<<<<]]></foo>";
+        XmlOptions options = new XmlOptions().setSaveCDataLengthThreshold(0);
+        XmlCursor c = XmlObject.Factory.parse(xml, options).newCursor();
+        Assert.assertEquals( expected, c.xmlText(options) );
+    }
+
     public void testSaving ( )
         throws Exception
     {

Modified: xmlbeans/trunk/test/src/xmlobject/checkin/AssortedTests.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlobject/checkin/AssortedTests.java?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlobject/checkin/AssortedTests.java (original)
+++ xmlbeans/trunk/test/src/xmlobject/checkin/AssortedTests.java Sat May 26 
08:31:14 2018
@@ -40,7 +40,6 @@ public class AssortedTests extends TestC
     // bug 27489
     public static void testSaverCharEscaping() throws XmlException
     {
-        String newLine = System.getProperty( "line.separator" );
         XmlObject xdoc = XmlObject.Factory.parse("<test>something</test>");
         XmlCursor cur = xdoc.newCursor();
         cur.toFirstChild();
@@ -48,9 +47,14 @@ public class AssortedTests extends TestC
         cur.setTextValue("<something or other:\u03C0\uD7FF>");
         Assert.assertEquals("<test>&lt;something or 
other:\u03C0\uD7FF></test>", xdoc.toString());
         
-        // invalid chars - control chars, unicode surrogates, FFFF/FFFE, etc
-        
cur.setTextValue("<something\0or\1other:\u0045\uFFFE\uD800\uDFFF\uDB80\uDC00\u03C0\uD7FF\u001F>");
-        
Assert.assertEquals("<test>&lt;something?or?other:\u0045?????\u03C0\uD7FF?></test>",
 xdoc.toString());
+        // invalid chars - control chars, FFFF/FFFE, etc
+        cur.setTextValue("<something\0or\1other:\u0045\u001F>");
+        Assert.assertEquals("<test>&lt;something?or?other:\u0045?></test>", 
xdoc.toString());
+        
+        String greekChars = 
"\uD835\uDF4A\uD835\uDF4B\uD835\uDF4C\uD835\uDF4D\uD835\uDF4E\uD835\uDF4F\uD835\uDF50\uD835"
+               + "\uDF51\uD835\uDF52\uD835\uDF53\uD835\uDF54\uD835\uDF55";
+        cur.setTextValue(greekChars);
+        Assert.assertEquals("<test>" + greekChars + "</test>", 
xdoc.toString());
     }
     
     // bug 26140/26104

Modified: xmlbeans/trunk/test/src/xmlobject/checkin/CDataTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/xmlobject/checkin/CDataTest.java?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/xmlobject/checkin/CDataTest.java (original)
+++ xmlbeans/trunk/test/src/xmlobject/checkin/CDataTest.java Sat May 26 
08:31:14 2018
@@ -53,8 +53,8 @@ public class CDataTest
             throws Exception
     {
         String xmlText = "<a><![CDATA[cdata text]]></a>";
-
-        checkCData(xmlText, xmlText, xmlText);
+        String resultText = "<a>cdata text</a>";
+        checkCData(xmlText, resultText, resultText);
     }
 
     public void testCData2()
@@ -64,10 +64,10 @@ public class CDataTest
                 "<b><![CDATA[cdata text]]> regular text</b>" + NL +
                 "</a>";
         String expected1 = "<a>\n" +
-                           "<b><![CDATA[cdata text regular text]]></b>\n" +
+                           "<b>cdata text regular text</b>\n" +
                            "</a>";
         String expected2 = "<a>" + NL +
-                           "  <b><![CDATA[cdata text regular text]]></b>" + NL 
+
+                           "  <b>cdata text regular text</b>" + NL +
                            "</a>";
 
         checkCData(xmlText, expected1, expected2);
@@ -88,6 +88,23 @@ public class CDataTest
 
         checkCData(xmlText, expected1, expected2);
     }
+
+    // https://issues.apache.org/jira/browse/XMLBEANS-404
+    public void testXmlBeans404()
+            throws Exception
+    {
+        String xmlText = "<a>\n" +
+                "<c>text <![CDATA[cdata text]]]]></c>\n" +
+                "</a>";
+        String expected1 = "<a>\n" +
+                "<c>text cdata text]]</c>\n" +
+                "</a>";
+        String expected2 = "<a>" + NL +
+                "  <c>text cdata text]]</c>" + NL +
+                "</a>";
+
+        checkCData(xmlText, expected1, expected2);
+    }
 
     private void checkCData(String xmlText, String expected1, String expected2)
             throws XmlException

Modified: xmlbeans/trunk/testbuild.xml
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/testbuild.xml?rev=1832298&r1=1832297&r2=1832298&view=diff
==============================================================================
--- xmlbeans/trunk/testbuild.xml (original)
+++ xmlbeans/trunk/testbuild.xml Sat May 26 08:31:14 2018
@@ -580,7 +580,7 @@
             destdir="${build.dir.test.src}"
             classpathref="test.run.classpath"
             debug="on"
-            source="1.4"
+            source="1.6"
             optimize="on"
             verbose="false"
             failonerror="true">
@@ -662,7 +662,7 @@
             excludes="${excludes}"
             classpathref="test.run.classpath"
             optimize="on"
-            source="1.4"
+            source="1.6"
             debug="on"
             verbose="false"
             failonerror="true"/>
@@ -914,7 +914,7 @@
             classpathref="test.run.classpath"
             optimize="on"
             debug="on"
-            source="1.4"
+            source="1.6"
             verbose="false"
             failonerror="true"/>
         <property name="test.area.run" value="${excludes}"/>


Reply via email to