Author: fanningpj
Date: Thu Apr 14 13:40:36 2022
New Revision: 1899853

URL: http://svn.apache.org/viewvc?rev=1899853&view=rev
Log:
[XMLBEANS-604] add broken test

Added:
    xmlbeans/trunk/src/test/java/xmlobject/checkin/SaverTest.java
Modified:
    xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Saver.java

Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Saver.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Saver.java?rev=1899853&r1=1899852&r2=1899853&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Saver.java 
(original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Saver.java Thu 
Apr 14 13:40:36 2022
@@ -1708,7 +1708,7 @@ abstract class Saver {
                 assert _free == _buf.length - _in;
 
                 try {
-//System.out.println("-------------\nWriting in corverter: 
TextSaver.write():1703  " + charsAvailable + " chars\n" + new String(_buf, 0, 
charsAvailable));
+//System.out.println("-------------\nWriting in converter: 
TextSaver.write():1703  " + charsAvailable + " chars\n" + new String(_buf, 0, 
charsAvailable));
                     writer.write(_buf, 0, charsAvailable);
                     writer.flush();
                 } catch (IOException e) {

Added: xmlbeans/trunk/src/test/java/xmlobject/checkin/SaverTest.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/test/java/xmlobject/checkin/SaverTest.java?rev=1899853&view=auto
==============================================================================
--- xmlbeans/trunk/src/test/java/xmlobject/checkin/SaverTest.java (added)
+++ xmlbeans/trunk/src/test/java/xmlobject/checkin/SaverTest.java Thu Apr 14 
13:40:36 2022
@@ -0,0 +1,43 @@
+/*   Copyright 2004 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 xmlobject.checkin;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class SaverTest {
+
+    @Disabled("https://issues.apache.org/jira/browse/XMLBEANS-604";)
+    @Test
+    void testLengthAssertion() throws IOException, XmlException {
+        final String lineSeparator = System.getProperty("line.separator");
+        System.setProperty("line.separator", "\n");
+        try {
+            String xml = "<test>" + new String(new char[16339]).replace('\0', 
'x') + "</test>";
+            XmlObject object = XmlObject.Factory.parse(xml);
+            try (InputStream is = object.newInputStream()) {
+                byte[] readBytes = IOUtils.toByteArray(is);
+            }
+        } finally {
+            System.setProperty("line.separator", lineSeparator);
+        }
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to