[jira] [Commented] (XMLBEANS-583) Duplicated "xmlns" attribute in XmlObject.toString() result

2021-12-23 Thread Dmitry Lastochkin (Jira)


[ 
https://issues.apache.org/jira/browse/XMLBEANS-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17464900#comment-17464900
 ] 

Dmitry Lastochkin commented on XMLBEANS-583:


Thanks!

> Duplicated "xmlns" attribute in XmlObject.toString() result
> ---
>
> Key: XMLBEANS-583
> URL: https://issues.apache.org/jira/browse/XMLBEANS-583
> Project: XMLBeans
>  Issue Type: Bug
>Affects Versions: Version 5.0.0
>Reporter: Dmitry Lastochkin
>Assignee: PJ Fanning
>Priority: Major
> Fix For: Version 5.0.3
>
> Attachments: schemas.zip
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Hello! 
> I ran into the following problem: in some cases, {{XmlObject.toString()}} 
> returns an XML containing duplicated "xmlns" attribute, as shown bellow
> {code:xml}
> 
>   
> Ns1T1E1
>   
> 
> {code}
> I wrote a simple test that reproduces the error (you can find test XSDs in 
> [^schemas.zip]):
> {code:java}
> public class XmlToStringTest {
> @Test
> public void test() {
> try {
> final Ns2E1Document ns2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> ns2e1Doc.addNewNs2E1().addNewNs2T1E1().setNs1T1E1("Ns1T1E1");
> 
> final Ns3E1Document ns3e1Doc = 
> Ns3E1Document.Factory.newInstance();
> 
> ns3e1Doc.addNewNs3E1().setNs3T1E1(Ns1T1.Factory.parse(ns2e1Doc.getNs2E1().getNs2T1E1().toString()));
> 
> final Ns3E1Document pNs3e1Doc = 
> Ns3E1Document.Factory.parse(ns3e1Doc.toString());
> final Ns2E1Document pNs2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> 
> pNs2e1Doc.addNewNs2E1().setNs2T1E1(pNs3e1Doc.getNs3E1().getNs3T1E1());
> 
> System.out.println(pNs2e1Doc.toString());
> Ns2E1Document.Factory.parse(pNs2e1Doc.toString());
> } catch (Exception ex) {
> ex.printStackTrace();
> Assert.fail();
> }
> }
> }
> {code}
> I investigated the problem and found the cause. In the {{Saver.tryPrefix()}} 
> I found the following comment:
> {quote}
> // If the prefix is currently mapped, then try another prefix.  A
> // special case is that of trying to map the default prefix ("").
> // Here, there always exists a default mapping.  If this is the
> // mapping we found, then remap it anyways. *I use != to compare*
> // strings because I want to test for the *specific* initial default
> // uri I added when I initialized the saver.
> {quote}
> But the code following this comment looks like this:
> {code:java}
> return existingUri == null || (prefix.length() <= 0 && 
> Objects.equals(existingUri, _initialDefaultUri)); // Objects.equals, not ==
> {code}
>  
> And {{_initialDefaultUri}} initialized like this:
> {code:java}
> _initialDefaultUri = "";
> {code}
> But should be
> {code:java}
> _initialDefaultUri = new String("");
> {code}
> because we talk about a *specific* value.
> Hopefully this information helps fix this bug.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



[VOTE] Apache XmlBeans 5.0.3 release (RC2)

2021-12-23 Thread PJ Fanning
Hi everyone,

I've prepared artifacts for the release of Apache XmlBeans 5.0.3 (RC2).

The most notable changes in this release are:

* SampleXmlUtil misses root element with only one child
* Duplicated "xmlns" attribute in XmlObject.toString() result
* Upgrade dependencies (javaparser 3.23.1, log4j 2.17.0)


A full list of changes is available in the change log:

https://issues.apache.org/jira/projects/XMLBEANS/versions/12350699


The artifacts are at:

https://dist.apache.org/repos/dist/release/poi/xmlbeans/dev/



You can use this maven URL for your mvn/gradle builds:

https://repository.apache.org/content/repositories/staging



I haven't updated the "provided" dependencies as those have to be activated 
anyway explicitly.


Please vote to release the artifacts.

The vote keeps open until 2021-12-29 23:00 UTC.

Planned release announcement date is Friday, 2021-12-31.


Here is my +1


PJ

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



[jira] [Resolved] (XMLBEANS-583) Duplicated "xmlns" attribute in XmlObject.toString() result

2021-12-23 Thread PJ Fanning (Jira)


 [ 
https://issues.apache.org/jira/browse/XMLBEANS-583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

PJ Fanning resolved XMLBEANS-583.
-
  Assignee: PJ Fanning
Resolution: Fixed

test added

> Duplicated "xmlns" attribute in XmlObject.toString() result
> ---
>
> Key: XMLBEANS-583
> URL: https://issues.apache.org/jira/browse/XMLBEANS-583
> Project: XMLBeans
>  Issue Type: Bug
>Affects Versions: Version 5.0.0
>Reporter: Dmitry Lastochkin
>Assignee: PJ Fanning
>Priority: Major
> Fix For: Version 5.0.3
>
> Attachments: schemas.zip
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Hello! 
> I ran into the following problem: in some cases, {{XmlObject.toString()}} 
> returns an XML containing duplicated "xmlns" attribute, as shown bellow
> {code:xml}
> 
>   
> Ns1T1E1
>   
> 
> {code}
> I wrote a simple test that reproduces the error (you can find test XSDs in 
> [^schemas.zip]):
> {code:java}
> public class XmlToStringTest {
> @Test
> public void test() {
> try {
> final Ns2E1Document ns2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> ns2e1Doc.addNewNs2E1().addNewNs2T1E1().setNs1T1E1("Ns1T1E1");
> 
> final Ns3E1Document ns3e1Doc = 
> Ns3E1Document.Factory.newInstance();
> 
> ns3e1Doc.addNewNs3E1().setNs3T1E1(Ns1T1.Factory.parse(ns2e1Doc.getNs2E1().getNs2T1E1().toString()));
> 
> final Ns3E1Document pNs3e1Doc = 
> Ns3E1Document.Factory.parse(ns3e1Doc.toString());
> final Ns2E1Document pNs2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> 
> pNs2e1Doc.addNewNs2E1().setNs2T1E1(pNs3e1Doc.getNs3E1().getNs3T1E1());
> 
> System.out.println(pNs2e1Doc.toString());
> Ns2E1Document.Factory.parse(pNs2e1Doc.toString());
> } catch (Exception ex) {
> ex.printStackTrace();
> Assert.fail();
> }
> }
> }
> {code}
> I investigated the problem and found the cause. In the {{Saver.tryPrefix()}} 
> I found the following comment:
> {quote}
> // If the prefix is currently mapped, then try another prefix.  A
> // special case is that of trying to map the default prefix ("").
> // Here, there always exists a default mapping.  If this is the
> // mapping we found, then remap it anyways. *I use != to compare*
> // strings because I want to test for the *specific* initial default
> // uri I added when I initialized the saver.
> {quote}
> But the code following this comment looks like this:
> {code:java}
> return existingUri == null || (prefix.length() <= 0 && 
> Objects.equals(existingUri, _initialDefaultUri)); // Objects.equals, not ==
> {code}
>  
> And {{_initialDefaultUri}} initialized like this:
> {code:java}
> _initialDefaultUri = "";
> {code}
> But should be
> {code:java}
> _initialDefaultUri = new String("");
> {code}
> because we talk about a *specific* value.
> Hopefully this information helps fix this bug.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



Jenkins build is back to normal : POI » POI-XMLBeans-DSL-1.8 #82

2021-12-23 Thread Apache Jenkins Server
See 



-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



Build failed in Jenkins: POI » POI-XMLBeans-DSL-1.8 #81

2021-12-23 Thread Apache Jenkins Server
ache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:336:
 error: self-closing element not allowed
  [javadoc]  * to release its responsibility of maintaining its 
position.
  [javadoc]  ^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:336:
 error: self-closing element not allowed
  [javadoc]  * to release its responsibility of maintaining its 
position.
  [javadoc] 
  ^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:340:
 error: self-closing element not allowed
  [javadoc]  * disposal.
  [javadoc] ^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:340:
 error: self-closing element not allowed
  [javadoc]  * disposal.
  [javadoc]  ^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:377:
 error: self-closing element not allowed
  [javadoc]  * {@link java.util.Iterator}).
  [javadoc]^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:377:
 error: self-closing element not allowed
  [javadoc]  * {@link java.util.Iterator}).
  [javadoc] ^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:396:
 error: self-closing element not allowed
  [javadoc]  * java.util.Iterator).
  [javadoc]^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:396:
 error: self-closing element not allowed
  [javadoc]  * java.util.Iterator).
  [javadoc] ^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:555:
 error: self-closing element not allowed
  [javadoc]  * if it is not mapped.
  [javadoc]^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:555:
 error: self-closing element not allowed
  [javadoc]  * if it is not mapped.
  [javadoc] ^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:602:
 error: self-closing element not allowed
  [javadoc]  * STARTDOC, or ATTR. 
  [javadoc]   ^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:602:
 error: self-closing element not allowed
  [javadoc]  * STARTDOC, or ATTR. 
  [javadoc]^
  [javadoc] 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/src/main/java/org/apache/xmlbeans/XmlCursor.java>:606:
 error: self-closing element not allowed
  [javadoc]  * by result.getSchemaType().
  [javadoc]  ^
  [javadoc] Building index for all the packages and classes...
  [javadoc] Building index for all classes...
  [javadoc] Generating 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/build/javadocs/help-doc.html...>
  [javadoc] 100 errors
  [javadoc] 100 warnings

package:
 [copy] Copying 2 files to 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/ws/build/maven>
  [jar] Building jar: 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/81/artifact/build/xmlbeans-5.0.3-SNAPSHOT.jar>
  [jar] Building jar: 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/81/artifact/build/xmlbeans-5.0.3-SNAPSHOT-javadoc.jar>
  [jar] Building jar: 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/81/artifact/build/xmlbeans-5.0.3-SNAPSHOT-sources.jar>
  [zip] Building zip: 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/81/artifact/build/xmlbeans-src-5.0.3-SNAPSHOT-20211223.zip>
  [tar] Building tar: 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/81/artifact/build/xmlbeans-src-5.0.3-SNAPSHOT-20211223.tgz>
  [zip] Building zip: 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/81/artifact/build/xmlbeans-bin-5.0.3-SNAPSHOT-20211223.zip>
  [tar] Building tar: 
<https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/81/artifact/build/xmlbeans-bin-5.0.3-SNAPSHOT-20211223.tgz>

rat-check:
[mkdir] Created dir: 
<ht

[jira] [Commented] (XMLBEANS-583) Duplicated "xmlns" attribute in XmlObject.toString() result

2021-12-23 Thread PJ Fanning (Jira)


[ 
https://issues.apache.org/jira/browse/XMLBEANS-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17464708#comment-17464708
 ] 

PJ Fanning commented on XMLBEANS-583:
-

the jar from 
[https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/80/] seems to 
fix this - need to add a unit test as a follow up

> Duplicated "xmlns" attribute in XmlObject.toString() result
> ---
>
> Key: XMLBEANS-583
> URL: https://issues.apache.org/jira/browse/XMLBEANS-583
> Project: XMLBeans
>  Issue Type: Bug
>Affects Versions: Version 5.0.0
>Reporter: Dmitry Lastochkin
>Priority: Major
> Fix For: Version 5.0.3
>
> Attachments: schemas.zip
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Hello! 
> I ran into the following problem: in some cases, {{XmlObject.toString()}} 
> returns an XML containing duplicated "xmlns" attribute, as shown bellow
> {code:xml}
> 
>   
> Ns1T1E1
>   
> 
> {code}
> I wrote a simple test that reproduces the error (you can find test XSDs in 
> [^schemas.zip]):
> {code:java}
> public class XmlToStringTest {
> @Test
> public void test() {
> try {
> final Ns2E1Document ns2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> ns2e1Doc.addNewNs2E1().addNewNs2T1E1().setNs1T1E1("Ns1T1E1");
> 
> final Ns3E1Document ns3e1Doc = 
> Ns3E1Document.Factory.newInstance();
> 
> ns3e1Doc.addNewNs3E1().setNs3T1E1(Ns1T1.Factory.parse(ns2e1Doc.getNs2E1().getNs2T1E1().toString()));
> 
> final Ns3E1Document pNs3e1Doc = 
> Ns3E1Document.Factory.parse(ns3e1Doc.toString());
> final Ns2E1Document pNs2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> 
> pNs2e1Doc.addNewNs2E1().setNs2T1E1(pNs3e1Doc.getNs3E1().getNs3T1E1());
> 
> System.out.println(pNs2e1Doc.toString());
> Ns2E1Document.Factory.parse(pNs2e1Doc.toString());
> } catch (Exception ex) {
> ex.printStackTrace();
> Assert.fail();
> }
> }
> }
> {code}
> I investigated the problem and found the cause. In the {{Saver.tryPrefix()}} 
> I found the following comment:
> {quote}
> // If the prefix is currently mapped, then try another prefix.  A
> // special case is that of trying to map the default prefix ("").
> // Here, there always exists a default mapping.  If this is the
> // mapping we found, then remap it anyways. *I use != to compare*
> // strings because I want to test for the *specific* initial default
> // uri I added when I initialized the saver.
> {quote}
> But the code following this comment looks like this:
> {code:java}
> return existingUri == null || (prefix.length() <= 0 && 
> Objects.equals(existingUri, _initialDefaultUri)); // Objects.equals, not ==
> {code}
>  
> And {{_initialDefaultUri}} initialized like this:
> {code:java}
> _initialDefaultUri = "";
> {code}
> But should be
> {code:java}
> _initialDefaultUri = new String("");
> {code}
> because we talk about a *specific* value.
> Hopefully this information helps fix this bug.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



[jira] [Commented] (XMLBEANS-583) Duplicated "xmlns" attribute in XmlObject.toString() result

2021-12-23 Thread PJ Fanning (Jira)


[ 
https://issues.apache.org/jira/browse/XMLBEANS-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17464567#comment-17464567
 ] 

PJ Fanning commented on XMLBEANS-583:
-

toString() is just for debugging - could you use xmlText()?

This works.

The toString() uses xmlText() but with a special set of XML options to prefer 
default namespaces over namespaces with explicit prefixes. The explicit 
prefixes fix the parse issue.

It would probably still be a good idea to fix this issue but it doesn't feel 
that urgent since xmlText() and xmlText(XMLOptions) can be made to work.

 

One or both of these is contributing to the issue:

options.setSaveAggressiveNamespaces();
options.setUseDefaultNamespace();

 

Plain xmlText() produces:

 

  
Ns1T1E1
  

 

> Duplicated "xmlns" attribute in XmlObject.toString() result
> ---
>
> Key: XMLBEANS-583
> URL: https://issues.apache.org/jira/browse/XMLBEANS-583
> Project: XMLBeans
>  Issue Type: Bug
>Affects Versions: Version 5.0.0
>Reporter: Dmitry Lastochkin
>Priority: Major
> Fix For: Version 5.0.3
>
> Attachments: schemas.zip
>
>
> Hello! 
> I ran into the following problem: in some cases, {{XmlObject.toString()}} 
> returns an XML containing duplicated "xmlns" attribute, as shown bellow
> {code:xml}
> 
>   
> Ns1T1E1
>   
> 
> {code}
> I wrote a simple test that reproduces the error (you can find test XSDs in 
> [^schemas.zip]):
> {code:java}
> public class XmlToStringTest {
> @Test
> public void test() {
> try {
> final Ns2E1Document ns2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> ns2e1Doc.addNewNs2E1().addNewNs2T1E1().setNs1T1E1("Ns1T1E1");
> 
> final Ns3E1Document ns3e1Doc = 
> Ns3E1Document.Factory.newInstance();
> 
> ns3e1Doc.addNewNs3E1().setNs3T1E1(Ns1T1.Factory.parse(ns2e1Doc.getNs2E1().getNs2T1E1().toString()));
> 
> final Ns3E1Document pNs3e1Doc = 
> Ns3E1Document.Factory.parse(ns3e1Doc.toString());
> final Ns2E1Document pNs2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> 
> pNs2e1Doc.addNewNs2E1().setNs2T1E1(pNs3e1Doc.getNs3E1().getNs3T1E1());
> 
> System.out.println(pNs2e1Doc.toString());
> Ns2E1Document.Factory.parse(pNs2e1Doc.toString());
> } catch (Exception ex) {
> ex.printStackTrace();
> Assert.fail();
> }
> }
> }
> {code}
> I investigated the problem and found the cause. In the {{Saver.tryPrefix()}} 
> I found the following comment:
> {quote}
> // If the prefix is currently mapped, then try another prefix.  A
> // special case is that of trying to map the default prefix ("").
> // Here, there always exists a default mapping.  If this is the
> // mapping we found, then remap it anyways. *I use != to compare*
> // strings because I want to test for the *specific* initial default
> // uri I added when I initialized the saver.
> {quote}
> But the code following this comment looks like this:
> {code:java}
> return existingUri == null || (prefix.length() <= 0 && 
> Objects.equals(existingUri, _initialDefaultUri)); // Objects.equals, not ==
> {code}
>  
> And {{_initialDefaultUri}} initialized like this:
> {code:java}
> _initialDefaultUri = "";
> {code}
> But should be
> {code:java}
> _initialDefaultUri = new String("");
> {code}
> because we talk about a *specific* value.
> Hopefully this information helps fix this bug.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



[jira] [Commented] (XMLBEANS-583) Duplicated "xmlns" attribute in XmlObject.toString() result

2021-12-23 Thread PJ Fanning (Jira)


[ 
https://issues.apache.org/jira/browse/XMLBEANS-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17464555#comment-17464555
 ] 

PJ Fanning commented on XMLBEANS-583:
-

I created this test project - that reproduces the issue - still need to debug 
though.

https://github.com/pjfanning/xmlbeans-583

> Duplicated "xmlns" attribute in XmlObject.toString() result
> ---
>
> Key: XMLBEANS-583
> URL: https://issues.apache.org/jira/browse/XMLBEANS-583
> Project: XMLBeans
>  Issue Type: Bug
>Affects Versions: Version 5.0.0
>Reporter: Dmitry Lastochkin
>Priority: Major
> Fix For: Version 5.0.3
>
> Attachments: schemas.zip
>
>
> Hello! 
> I ran into the following problem: in some cases, {{XmlObject.toString()}} 
> returns an XML containing duplicated "xmlns" attribute, as shown bellow
> {code:xml}
> 
>   
> Ns1T1E1
>   
> 
> {code}
> I wrote a simple test that reproduces the error (you can find test XSDs in 
> [^schemas.zip]):
> {code:java}
> public class XmlToStringTest {
> @Test
> public void test() {
> try {
> final Ns2E1Document ns2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> ns2e1Doc.addNewNs2E1().addNewNs2T1E1().setNs1T1E1("Ns1T1E1");
> 
> final Ns3E1Document ns3e1Doc = 
> Ns3E1Document.Factory.newInstance();
> 
> ns3e1Doc.addNewNs3E1().setNs3T1E1(Ns1T1.Factory.parse(ns2e1Doc.getNs2E1().getNs2T1E1().toString()));
> 
> final Ns3E1Document pNs3e1Doc = 
> Ns3E1Document.Factory.parse(ns3e1Doc.toString());
> final Ns2E1Document pNs2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> 
> pNs2e1Doc.addNewNs2E1().setNs2T1E1(pNs3e1Doc.getNs3E1().getNs3T1E1());
> 
> System.out.println(pNs2e1Doc.toString());
> Ns2E1Document.Factory.parse(pNs2e1Doc.toString());
> } catch (Exception ex) {
> ex.printStackTrace();
> Assert.fail();
> }
> }
> }
> {code}
> I investigated the problem and found the cause. In the {{Saver.tryPrefix()}} 
> I found the following comment:
> {quote}
> // If the prefix is currently mapped, then try another prefix.  A
> // special case is that of trying to map the default prefix ("").
> // Here, there always exists a default mapping.  If this is the
> // mapping we found, then remap it anyways. *I use != to compare*
> // strings because I want to test for the *specific* initial default
> // uri I added when I initialized the saver.
> {quote}
> But the code following this comment looks like this:
> {code:java}
> return existingUri == null || (prefix.length() <= 0 && 
> Objects.equals(existingUri, _initialDefaultUri)); // Objects.equals, not ==
> {code}
>  
> And {{_initialDefaultUri}} initialized like this:
> {code:java}
> _initialDefaultUri = "";
> {code}
> But should be
> {code:java}
> _initialDefaultUri = new String("");
> {code}
> because we talk about a *specific* value.
> Hopefully this information helps fix this bug.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



[jira] [Commented] (XMLBEANS-583) Duplicated "xmlns" attribute in XmlObject.toString() result

2021-12-23 Thread Dmitry Lastochkin (Jira)


[ 
https://issues.apache.org/jira/browse/XMLBEANS-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17464532#comment-17464532
 ] 

Dmitry Lastochkin commented on XMLBEANS-583:


When I ran the test on XMLBeans 2.4, I was generating source code using 
XMLBeans 2.4. 
When I ran the test on XMLBeans 5.0.0, I was generating source code using 
XMLBeans 5.0.0. 

> Duplicated "xmlns" attribute in XmlObject.toString() result
> ---
>
> Key: XMLBEANS-583
> URL: https://issues.apache.org/jira/browse/XMLBEANS-583
> Project: XMLBeans
>  Issue Type: Bug
>Affects Versions: Version 5.0.0
>Reporter: Dmitry Lastochkin
>Priority: Major
> Fix For: Version 5.0.3
>
> Attachments: schemas.zip
>
>
> Hello! 
> I ran into the following problem: in some cases, {{XmlObject.toString()}} 
> returns an XML containing duplicated "xmlns" attribute, as shown bellow
> {code:xml}
> 
>   
> Ns1T1E1
>   
> 
> {code}
> I wrote a simple test that reproduces the error (you can find test XSDs in 
> [^schemas.zip]):
> {code:java}
> public class XmlToStringTest {
> @Test
> public void test() {
> try {
> final Ns2E1Document ns2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> ns2e1Doc.addNewNs2E1().addNewNs2T1E1().setNs1T1E1("Ns1T1E1");
> 
> final Ns3E1Document ns3e1Doc = 
> Ns3E1Document.Factory.newInstance();
> 
> ns3e1Doc.addNewNs3E1().setNs3T1E1(Ns1T1.Factory.parse(ns2e1Doc.getNs2E1().getNs2T1E1().toString()));
> 
> final Ns3E1Document pNs3e1Doc = 
> Ns3E1Document.Factory.parse(ns3e1Doc.toString());
> final Ns2E1Document pNs2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> 
> pNs2e1Doc.addNewNs2E1().setNs2T1E1(pNs3e1Doc.getNs3E1().getNs3T1E1());
> 
> System.out.println(pNs2e1Doc.toString());
> Ns2E1Document.Factory.parse(pNs2e1Doc.toString());
> } catch (Exception ex) {
> ex.printStackTrace();
> Assert.fail();
> }
> }
> }
> {code}
> I investigated the problem and found the cause. In the {{Saver.tryPrefix()}} 
> I found the following comment:
> {quote}
> // If the prefix is currently mapped, then try another prefix.  A
> // special case is that of trying to map the default prefix ("").
> // Here, there always exists a default mapping.  If this is the
> // mapping we found, then remap it anyways. *I use != to compare*
> // strings because I want to test for the *specific* initial default
> // uri I added when I initialized the saver.
> {quote}
> But the code following this comment looks like this:
> {code:java}
> return existingUri == null || (prefix.length() <= 0 && 
> Objects.equals(existingUri, _initialDefaultUri)); // Objects.equals, not ==
> {code}
>  
> And {{_initialDefaultUri}} initialized like this:
> {code:java}
> _initialDefaultUri = "";
> {code}
> But should be
> {code:java}
> _initialDefaultUri = new String("");
> {code}
> because we talk about a *specific* value.
> Hopefully this information helps fix this bug.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



[jira] [Commented] (XMLBEANS-583) Duplicated "xmlns" attribute in XmlObject.toString() result

2021-12-23 Thread PJ Fanning (Jira)


[ 
https://issues.apache.org/jira/browse/XMLBEANS-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17464526#comment-17464526
 ] 

PJ Fanning commented on XMLBEANS-583:
-

did you generate the source code using xmlbeans 5.0.0?

> Duplicated "xmlns" attribute in XmlObject.toString() result
> ---
>
> Key: XMLBEANS-583
> URL: https://issues.apache.org/jira/browse/XMLBEANS-583
> Project: XMLBeans
>  Issue Type: Bug
>Affects Versions: Version 5.0.0
>Reporter: Dmitry Lastochkin
>Priority: Major
> Fix For: Version 5.0.3
>
> Attachments: schemas.zip
>
>
> Hello! 
> I ran into the following problem: in some cases, {{XmlObject.toString()}} 
> returns an XML containing duplicated "xmlns" attribute, as shown bellow
> {code:xml}
> 
>   
> Ns1T1E1
>   
> 
> {code}
> I wrote a simple test that reproduces the error (you can find test XSDs in 
> [^schemas.zip]):
> {code:java}
> public class XmlToStringTest {
> @Test
> public void test() {
> try {
> final Ns2E1Document ns2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> ns2e1Doc.addNewNs2E1().addNewNs2T1E1().setNs1T1E1("Ns1T1E1");
> 
> final Ns3E1Document ns3e1Doc = 
> Ns3E1Document.Factory.newInstance();
> 
> ns3e1Doc.addNewNs3E1().setNs3T1E1(Ns1T1.Factory.parse(ns2e1Doc.getNs2E1().getNs2T1E1().toString()));
> 
> final Ns3E1Document pNs3e1Doc = 
> Ns3E1Document.Factory.parse(ns3e1Doc.toString());
> final Ns2E1Document pNs2e1Doc = 
> Ns2E1Document.Factory.newInstance();
> 
> pNs2e1Doc.addNewNs2E1().setNs2T1E1(pNs3e1Doc.getNs3E1().getNs3T1E1());
> 
> System.out.println(pNs2e1Doc.toString());
> Ns2E1Document.Factory.parse(pNs2e1Doc.toString());
> } catch (Exception ex) {
> ex.printStackTrace();
> Assert.fail();
> }
> }
> }
> {code}
> I investigated the problem and found the cause. In the {{Saver.tryPrefix()}} 
> I found the following comment:
> {quote}
> // If the prefix is currently mapped, then try another prefix.  A
> // special case is that of trying to map the default prefix ("").
> // Here, there always exists a default mapping.  If this is the
> // mapping we found, then remap it anyways. *I use != to compare*
> // strings because I want to test for the *specific* initial default
> // uri I added when I initialized the saver.
> {quote}
> But the code following this comment looks like this:
> {code:java}
> return existingUri == null || (prefix.length() <= 0 && 
> Objects.equals(existingUri, _initialDefaultUri)); // Objects.equals, not ==
> {code}
>  
> And {{_initialDefaultUri}} initialized like this:
> {code:java}
> _initialDefaultUri = "";
> {code}
> But should be
> {code:java}
> _initialDefaultUri = new String("");
> {code}
> because we talk about a *specific* value.
> Hopefully this information helps fix this bug.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



Re: XWPF - worth adding helpers for creating styles?

2021-12-23 Thread Nick Burch

On Wed, 22 Dec 2021, Nick Burch wrote:
I was wondering about adding a couple of friendly helper methods on 
XWPFStyles, which would either set you up with some sensible default styles 
(inspired by the ones Word pops in a new file), or let you quickly add a 
bunch of header or paragraph styles by font size/colour/family.


Anyone have any objections to me doing that? Anyone have strong preferences 
for what to call the methods / what to put on XWPFStyles vs XWPFStyle?


My current idea, if no objections, would be
 * XWPFStyle.createHeaderStyle(String name, int headingLevel,
 String fontFamily, String fontColor, int fontSizeHalfPoints)
 * XWPFStyle.createParagraphStyle(String name, String fontFamily,
 String fontColor, int fontSizeHalfPoints)
 * XWPFStyle.createDefaults()
- calls the XWPFStyle.create* methods with sensible defaults

Nick

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



[GitHub] [poi] asfgit closed pull request #290: Customize Spliterator implementations for better parallelism

2021-12-23 Thread GitBox


asfgit closed pull request #290:
URL: https://github.com/apache/poi/pull/290


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org