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

2021-12-22 Thread Dmitry Lastochkin (Jira)


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

Dmitry Lastochkin commented on XMLBEANS-583:


When I ran this test on XMLBeans 2.4 I got the following XML:
{code:xml}

  
Ns1T1E1
  

{code}
I expected the same result on XMLBeans 5.0.0.


bq. PS shouldn't the URIs look like URLs or URNs (which normally look like 
`urn:epc:id:imovn:9176187`)?
Do you mean namespaces URI? I wrote this XSD for testing purposes only and 
didn't care about the format of the namespace URI.

> 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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774323457



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   Done




-- 
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



Build failed in Jenkins: POI » POI-DSL-Windows-1.8 #405

2021-12-22 Thread Apache Jenkins Server
See 


Changes:

[PJ Fanning] add tests

[PJ Fanning] add tests

[PJ Fanning] extra constructors


--
[...truncated 86.89 KB...]
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi\src\main\java\org\apache\poi\poifs\filesystem\POIFSFileSystem.java:222:
 warning - Tag @see: missing '#': "POIFSFileSystem(FileChannel, boolean, 
boolean) this constructor gives more control over whether to
 close the provided channel"
3 warnings

> Task :poi-ooxml:test

> Task :allJavaDoc
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-ooxml\src\main\java\org\apache\poi\xssf\usermodel\XSSFWorkbook.java:313:
 warning: no description for @throws
 * @throws IOException
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-ooxml\src\main\java\org\apache\poi\xssf\usermodel\XSSFWorkbook.java:314:
 warning: no description for @throws
 * @throws InvalidFormatException
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-ooxml\src\main\java\org\apache\poi\xssf\usermodel\XSSFWorkbook.java:293:
 warning: no description for @throws
 * @throws IOException
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-ooxml\src\main\java\org\apache\poi\xssf\usermodel\XSSFWorkbook.java:261:
 warning: no description for @throws
 * @throws IOException
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-ooxml\src\main\java\org\apache\poi\xssf\usermodel\XSSFWorkbook.java:348:
 warning: no description for @throws
 * @throws IOException
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-ooxml\src\main\java\org\apache\poi\xssf\usermodel\XSSFWorkbook.java:335:
 warning: no description for @throws
 * @throws IOException
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-ooxml\src\main\java\org\apache\poi\xslf\usermodel\XMLSlideShow.java:131:
 warning: no description for @throws
 * @throws IOException
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hmef\HMEFMessage.java:53:
 warning: no description for @throws
 * @throws IOException
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-ooxml\src\main\java\org\apache\poi\xssf\eventusermodel\XSSFReader.java:122:
 warning: no description for @param
 * @param useReadOnlySharedStringsTable
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hslf\blip\Bitmap.java:49:
 warning - Tag @link: can't find addPicture(byte[], PictureType) in 
org.apache.poi.hslf.usermodel.HSLFSlideShow
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hslf\blip\DIB.java:46:
 warning - Tag @link: can't find addPicture(byte[], PictureType) in 
org.apache.poi.hslf.usermodel.HSLFSlideShow
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hslf\blip\EMF.java:49:
 warning - Tag @link: can't find addPicture(byte[], PictureType) in 
org.apache.poi.hslf.usermodel.HSLFSlideShow
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hslf\blip\JPEG.java:43:
 warning - Tag @link: can't find addPicture(byte[], PictureType) in 
org.apache.poi.hslf.usermodel.HSLFSlideShow
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hslf\blip\PICT.java:54:
 warning - Tag @link: can't find addPicture(byte[], PictureType) in 
org.apache.poi.hslf.usermodel.HSLFSlideShow
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hslf\blip\PNG.java:39:
 warning - Tag @link: can't find addPicture(byte[], PictureType) in 
org.apache.poi.hslf.usermodel.HSLFSlideShow
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hslf\blip\WMF.java:49:
 warning - Tag @link: can't find addPicture(byte[], PictureType) in 
org.apache.poi.hslf.usermodel.HSLFSlideShow
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hwmf\usermodel\HwmfPicture.java:84:
 warning: no description for @param
 * @param inputStream
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-scratchpad\src\main\java\org\apache\poi\hwmf\usermodel\HwmfPicture.java:85:
 warning: no description for @throws
 * @throws IOException
   ^
F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-ooxml\src\main\java\org\apache\poi\xwpf\usermodel\XWPFDocument.java:149:
 warning: no description for @throws
 * @throws IOException
   ^
F:\jenk

XWPF - worth adding helpers for creating styles?

2021-12-22 Thread Nick Burch

Hi All

I found myself wanting to create a DOCX file from scratch today, and in 
order to have it look nice that meant setting up a bunch of styles. It's a 
bit fiddly, and would've been pretty tough if I hadn't already been happy 
with reading the XML from word and re-doing that in CT xmlbeans classes. 
Based on StackOverflow posts, it's a fairly common thing for our users to 
want to do.


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?


(I wouldn't be doing a full set of XWPFStyle get/set/etc methods, just 
enough to help you easily create new ones. The alternative to all this is 
to start with a template .docx file, having set the styles up by hand in 
Word, but I wanted to avoid that.)


Cheers
Nick

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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774070490



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   fair enough - use the cast




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774068923



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   I tried, it doesn't work. Using `Spliterators.spliterator(this, 
Spliterator.ORDERED)` avoids having to cast because 
[Spliterators.spliterator(Collection, 
int)](https://docs.oracle.com/javase/8/docs/api/java/util/Spliterators.html#spliterator-java.util.Collection-int-)
 takes in `Collection` and returns `Spliterator`. If only 
`Iterable#spliterator()` returned `Spliterator` instead of 
`Spliterator` 🤦‍♂️ 




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774062182



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   can you try omitting the cast and see if it compiles? I just added 
spliterators in another project and was suprised that I didn't need to cast but 
it worked without the cast - 
https://github.com/pjfanning/excel-streaming-reader/commit/4ac5fb854498bf18a900c5ef95da6f07a37a7570




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774062182



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   can you try omitting the cast and see if it compiles? I just added 
spliterators in another project and was suprised that I didn't need to cast but 
it worked with the cast - 
https://github.com/pjfanning/excel-streaming-reader/commit/4ac5fb854498bf18a900c5ef95da6f07a37a7570




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774062182



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   can you try omitting the cast and see if compiles? I just added 
spliterators in another project and was suprised that I didn't need to cast but 
it worked with the cast - 
https://github.com/pjfanning/excel-streaming-reader/commit/4ac5fb854498bf18a900c5ef95da6f07a37a7570




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774059777



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   Unfortunately `sheets.spliterator()` returns `Spliterator`




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774058914



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   I don't think you'll need to cast.




-- 
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



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

2021-12-22 Thread PJ Fanning (Jira)


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

PJ Fanning edited comment on XMLBEANS-583 at 12/22/21, 5:34 PM:


So is the XML you are looking for?

 
  
    
      Ns1T1E1
    
  

 

PS shouldn't the URIs look like URLs or URNs (which normally look like 
`urn:epc:id:imovn:9176187`)?


was (Author: pj.fanning):
So is the XML you are looking for?

 
  
    
      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] [Comment Edited] (XMLBEANS-583) Duplicated "xmlns" attribute in XmlObject.toString() result

2021-12-22 Thread PJ Fanning (Jira)


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

PJ Fanning edited comment on XMLBEANS-583 at 12/22/21, 5:31 PM:


So is the XML you are looking for?

 
  
    
      Ns1T1E1
    
  

 


was (Author: pj.fanning):
So is the XML you are looking for?

 

```
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-22 Thread PJ Fanning (Jira)


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

PJ Fanning commented on XMLBEANS-583:
-

So is the XML you are looking for?

 

```
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774054291



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   Its actually the same, because `SheetSpliterator` is delegating to 
`sheets.spliterator()`, which is actually calling 
`Spliterators.spliterator(this, Spliterator.ORDERED)`.
   
   IMO its still better to delegate to the backing `Collection`'s 
`spliterator()`, so that if the backing `Collection` changes, there is no risk 
of the `Spliterator`'s characteristics going out of sync.
   
   I added `SheetSpliterator` to be consistent with `sheetIterator()`, which 
creates an instance of `SheetIterator` to delegate `sheets.iterator()`. But now 
that I think about it, its probably better to simply do a cast, reducing an 
object instantiation, eg.
   ```java
   @Override
   @SuppressWarnings("unchecked")
   public Spliterator spliterator() {
   return (Spliterator)(Spliterator) 
sheets.spliterator();
   }
   ```




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774054291



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   Its actually the same, because `SheetSpliterator` is delegating to 
`sheets.spliterator()`, which is actually calling 
`Spliterators.spliterator(this, Spliterator.ORDERED)`.
   
   I added `SheetSpliterator` to be consistent with `sheetIterator()`, which 
creates an instance of `SheetIterator` to delegate `sheets.iterator()`. But now 
that I think about it, its probably better to simply do a cast, reducing an 
object instantiation, eg.
   ```java
   @Override
   @SuppressWarnings("unchecked")
   public Spliterator spliterator() {
   return (Spliterator)(Spliterator) 
sheets.spliterator();
   }
   ```




-- 
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



[jira] [Updated] (XMLBEANS-582) Make XmlCursor AutoCloseable

2021-12-22 Thread PJ Fanning (Jira)


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

PJ Fanning updated XMLBEANS-582:

Fix Version/s: Version 5.1.0
   (was: Version 5.0.3)

> Make XmlCursor AutoCloseable 
> -
>
> Key: XMLBEANS-582
> URL: https://issues.apache.org/jira/browse/XMLBEANS-582
> Project: XMLBeans
>  Issue Type: Improvement
>  Components: Cursor
>Reporter: Robert Marcano
>Priority: Minor
> Fix For: Version 5.1.0
>
>
> In order to help users forgetting to dispose instances of {{{}XmlCursor{}}}, 
> It could be changed to be an {{AutoCloseable}} so IDE's are able to detect 
> them not being disposed and recommend the try with resources pattern.
> This will involve renaming the {{dispose()}} method to {{close()}} and 
> creating a deprecated method named as the old one {{dispose()}} on all 
> {{XmlCursor}} implementations.
> If this is agreed to be a good change, I can prepare a patch for it.



--
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] [Updated] (XMLBEANS-583) Duplicated "xmlns" attribute in XmlObject.toString() result

2021-12-22 Thread PJ Fanning (Jira)


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

PJ Fanning updated XMLBEANS-583:

Fix Version/s: Version 5.0.3

> 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] [Updated] (XMLBEANS-582) Make XmlCursor AutoCloseable

2021-12-22 Thread PJ Fanning (Jira)


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

PJ Fanning updated XMLBEANS-582:

Fix Version/s: Version 5.0.3

> Make XmlCursor AutoCloseable 
> -
>
> Key: XMLBEANS-582
> URL: https://issues.apache.org/jira/browse/XMLBEANS-582
> Project: XMLBeans
>  Issue Type: Improvement
>  Components: Cursor
>Reporter: Robert Marcano
>Priority: Minor
> Fix For: Version 5.0.3
>
>
> In order to help users forgetting to dispose instances of {{{}XmlCursor{}}}, 
> It could be changed to be an {{AutoCloseable}} so IDE's are able to detect 
> them not being disposed and recommend the try with resources pattern.
> This will involve renaming the {{dispose()}} method to {{close()}} and 
> creating a deprecated method named as the old one {{dispose()}} on all 
> {{XmlCursor}} implementations.
> If this is agreed to be a good change, I can prepare a patch for it.



--
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774047111



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
 return sheetIterator();
 }
 
+/**
+ * Returns a spliterator of the sheets in the workbook
+ * in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ *
+ * @since POI 5.2.0
+ */
+@Override
+public Spliterator spliterator() {
+return new SheetSpliterator();

Review comment:
   Is this better than `Spliterators.spliterator(sheets, 
Spliterator.ORDERED)`?




-- 
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



[Bug 65718] Charts imported without blip fills

2021-12-22 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65718

Roman Melnik  changed:

   What|Removed |Added

 CC||roman.mel...@storied.co

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



[Bug 65711] XSLFSheet.importBlip overrides relation IDs

2021-12-22 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65711

Roman Melnik  changed:

   What|Removed |Added

 CC||roman.mel...@storied.co

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



[GitHub] [poi] pjfanning commented on pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on pull request #290:
URL: https://github.com/apache/poi/pull/290#issuecomment-999653538


   @daniel-shuy generally looks good - but could you add some test coverage for 
some of the new methods? We don't necessarily need full coverage but some 
regression tests would be a pre-req for a merge.


-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773959043



##
File path: poi/src/main/java/org/apache/poi/ss/usermodel/Workbook.java
##
@@ -220,6 +222,32 @@ Licensed to the Apache Software Foundation (ASF) under one 
or more
  */
 Iterator sheetIterator();
 
+/**
+ * Alias for {@link #sheetIterator()} to allow foreach loops
+ */
+@Override
+default Iterator iterator() {
+return sheetIterator();
+}
+
+/**
+ *  Returns a spliterator of the sheets in the workbook
+ *  in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ */
+default Spliterator sheetSpliterator() {

Review comment:
   Done




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773958948



##
File path: poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
##
@@ -31,17 +31,8 @@ Licensed to the Apache Software Foundation (ASF) under one 
or more
 import java.io.PrintWriter;
 import java.nio.charset.Charset;
 import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
+import java.util.*;

Review comment:
   Done




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773958641



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
##
@@ -373,6 +373,14 @@ public PackageRelationshipCollection 
getRelationships(String typeFilter) {
 return relationshipsByID.values().iterator();
 }
 
+/**
+ * Get this collection's spliterator.
+ */

Review comment:
   Done




-- 
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



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

2021-12-22 Thread Dmitry Lastochkin (Jira)
Dmitry Lastochkin created XMLBEANS-583:
--

 Summary: 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
 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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773929659



##
File path: poi/src/main/java/org/apache/poi/ss/usermodel/Workbook.java
##
@@ -220,6 +222,32 @@ Licensed to the Apache Software Foundation (ASF) under one 
or more
  */
 Iterator sheetIterator();
 
+/**
+ * Alias for {@link #sheetIterator()} to allow foreach loops
+ */
+@Override
+default Iterator iterator() {
+return sheetIterator();
+}
+
+/**
+ *  Returns a spliterator of the sheets in the workbook
+ *  in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ */
+default Spliterator sheetSpliterator() {

Review comment:
   ok, will remove it, I agree its better to have 1 method




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773928779



##
File path: poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
##
@@ -31,17 +31,8 @@ Licensed to the Apache Software Foundation (ASF) under one 
or more
 import java.io.PrintWriter;
 import java.nio.charset.Charset;
 import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
+import java.util.*;

Review comment:
   Sorry, this was automatically formatted by my IDE, will remove it




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773928358



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
##
@@ -373,6 +373,14 @@ public PackageRelationshipCollection 
getRelationships(String typeFilter) {
 return relationshipsByID.values().iterator();
 }
 
+/**
+ * Get this collection's spliterator.
+ */

Review comment:
   Sure




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773928157



##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFRow.java
##
@@ -100,15 +103,6 @@ public void setCollapsed(Boolean collapsed) {
 this._collapsed = collapsed;
 }
 //begin of interface implementation
-/**
- * {@inheritDoc}
- */
-@Override

Review comment:
   I see - you can ignore the other comments about removed iterator() 
methods




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773927305



##
File path: poi/src/main/java/org/apache/poi/ss/usermodel/Workbook.java
##
@@ -220,6 +222,32 @@ Licensed to the Apache Software Foundation (ASF) under one 
or more
  */
 Iterator sheetIterator();
 
+/**
+ * Alias for {@link #sheetIterator()} to allow foreach loops
+ */
+@Override
+default Iterator iterator() {
+return sheetIterator();
+}
+
+/**
+ *  Returns a spliterator of the sheets in the workbook
+ *  in sheet order. Includes hidden and very hidden sheets.
+ *
+ * @return a spliterator of the sheets.
+ */
+default Spliterator sheetSpliterator() {

Review comment:
   maybe, we only need spliterator() - I know we have 2 iterator methods 
but that is some legacy stuff - I don't think new stuff needs to add 2 separate 
methods




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773925706



##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java
##
@@ -120,18 +121,14 @@ public XSSFSheet getSheet() {
 }
 
 /**
- * Alias for {@link #cellIterator()} to allow  foreach loops:
- * 
- * for(Cell cell : row){
- * ...
- * }
- * 
+ * Cell spliterator over the physically defined cells
  *
- * @return an iterator over cells in this row.
+ * @return a spliterator over cells in this row.
  */
 @Override
-public Iterator iterator() {

Review comment:
   I've moved it to the `Row` parent interface, so its essentially the same 
(alias for `cellIterator()`), see 
https://github.com/apache/poi/pull/290/files#diff-41fe318702760f407b9cfab2d3e3ceb3693f848c2255e3e5c993a0d7b4832624




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773925498



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
##
@@ -786,15 +798,6 @@ public void remove() throws IllegalStateException {
 }
 }
 
-/**
- * Alias for {@link #sheetIterator()} to allow
- * foreach loops
- */
-@Override
-public Iterator iterator() {

Review comment:
   I've moved this to the `Workbook` parent interface, so its essentially 
the same (alias for `sheetIterator()`), see 
https://github.com/apache/poi/pull/290/files#diff-a4d997b0b0814dae7bbc74ef62d8b413d102a7eae2b40aa5bf1ce4a7840a9233




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773924678



##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
##
@@ -100,11 +101,6 @@ public InputStream getWorksheetXMLInputStream() throws 
IOException {
 }
 
 //start of interface implementation
-@Override
-public Iterator iterator() {
-return rowIterator();

Review comment:
   I've moved it to the `Sheet` parent interface, so it essentially the 
same (alias for `rowIterator()`), see 
https://github.com/apache/poi/pull/290/files#diff-c77e303b24d9da0a72d46cf8ae7319ba6876b1b5c7d89e6ddc51acea6a6571ce

##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFRow.java
##
@@ -100,15 +103,6 @@ public void setCollapsed(Boolean collapsed) {
 this._collapsed = collapsed;
 }
 //begin of interface implementation
-/**
- * {@inheritDoc}
- */
-@Override

Review comment:
   I've moved it to the `Row` parent interface, so its essentially the same 
(alias for `cellIterator()`), see 
https://github.com/apache/poi/pull/290/files#diff-41fe318702760f407b9cfab2d3e3ceb3693f848c2255e3e5c993a0d7b4832624

##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
##
@@ -100,11 +101,6 @@ public InputStream getWorksheetXMLInputStream() throws 
IOException {
 }
 
 //start of interface implementation
-@Override
-public Iterator iterator() {
-return rowIterator();

Review comment:
   I've moved it to the `Sheet` parent interface, so its essentially the 
same (alias for `rowIterator()`), see 
https://github.com/apache/poi/pull/290/files#diff-c77e303b24d9da0a72d46cf8ae7319ba6876b1b5c7d89e6ddc51acea6a6571ce




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773923177



##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFRow.java
##
@@ -100,15 +103,6 @@ public void setCollapsed(Boolean collapsed) {
 this._collapsed = collapsed;
 }
 //begin of interface implementation
-/**
- * {@inheritDoc}
- */
-@Override

Review comment:
   I've moved it to the `Row` parent interface, so it essentially the same 
(alias for `cellIterator()`), see 
https://github.com/apache/poi/pull/290/files#diff-41fe318702760f407b9cfab2d3e3ceb3693f848c2255e3e5c993a0d7b4832624




-- 
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



[GitHub] [poi] daniel-shuy commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773923177



##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFRow.java
##
@@ -100,15 +103,6 @@ public void setCollapsed(Boolean collapsed) {
 this._collapsed = collapsed;
 }
 //begin of interface implementation
-/**
- * {@inheritDoc}
- */
-@Override

Review comment:
   I've moved it to the `Row` parent interface, so it essentially the same 
(alias for `cellIterator()`)




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773921922



##
File path: poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
##
@@ -31,17 +31,8 @@ Licensed to the Apache Software Foundation (ASF) under one 
or more
 import java.io.PrintWriter;
 import java.nio.charset.Charset;
 import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
+import java.util.*;

Review comment:
   can you keep the explicit imports and remove the * import?




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773866857



##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java
##
@@ -120,18 +121,14 @@ public XSSFSheet getSheet() {
 }
 
 /**
- * Alias for {@link #cellIterator()} to allow  foreach loops:
- * 
- * for(Cell cell : row){
- * ...
- * }
- * 
+ * Cell spliterator over the physically defined cells
  *
- * @return an iterator over cells in this row.
+ * @return a spliterator over cells in this row.
  */
 @Override
-public Iterator iterator() {

Review comment:
   add back the original iterator




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773866414



##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
##
@@ -100,11 +101,6 @@ public InputStream getWorksheetXMLInputStream() throws 
IOException {
 }
 
 //start of interface implementation
-@Override
-public Iterator iterator() {
-return rowIterator();

Review comment:
   ditto - please add this back




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773866618



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
##
@@ -786,15 +798,6 @@ public void remove() throws IllegalStateException {
 }
 }
 
-/**
- * Alias for {@link #sheetIterator()} to allow
- * foreach loops
- */
-@Override
-public Iterator iterator() {

Review comment:
   add this back




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773866066



##
File path: poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFRow.java
##
@@ -100,15 +103,6 @@ public void setCollapsed(Boolean collapsed) {
 this._collapsed = collapsed;
 }
 //begin of interface implementation
-/**
- * {@inheritDoc}
- */
-@Override

Review comment:
   I'm not sure we can remove a public method without first deprecating it




-- 
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



[GitHub] [poi] pjfanning commented on a change in pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


pjfanning commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r773864898



##
File path: 
poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
##
@@ -373,6 +373,14 @@ public PackageRelationshipCollection 
getRelationships(String typeFilter) {
 return relationshipsByID.values().iterator();
 }
 
+/**
+ * Get this collection's spliterator.
+ */

Review comment:
   could you add `@since POI 5.2.0` on any new public methods?




-- 
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



Build failed in Jenkins: POI » POI-DSL-Windows-1.8 #404

2021-12-22 Thread Apache Jenkins Server
See 


Changes:

[PJ Fanning] small refactor of ThemesTable

[PJ Fanning] small refactor of ThemesTable

[PJ Fanning] small refactor of XSSFReader

[PJ Fanning] small refactor of XSSFReader

[PJ Fanning] small refactor of XSSFReader


--
Started by an SCM change
Running as SYSTEM
[EnvInject] - Loading node environment variables.
[EnvInject] - Preparing an environment for the build.
[EnvInject] - Keeping Jenkins system variables.
[EnvInject] - Keeping Jenkins build variables.
[EnvInject] - Injecting as environment variables the properties content 
LANG=en_US.UTF-8
FORREST_HOME=f:\jenkins\tools\forrest\latest
CI_BUILD=TRUE

[EnvInject] - Variables injected successfully.
[EnvInject] - Injecting contributions.
Building remotely on jenkins-win-azr-5 (Windows) in workspace 

[WS-CLEANUP] Deleting project workspace...
[WS-CLEANUP] Done
Updating https://svn.apache.org/repos/asf/poi/trunk at revision 
'2021-12-22T12:48:29.807 +'
U poi-ooxml\src\main\java\org\apache\poi\xssf\model\ThemesTable.java
U 
poi-ooxml\src\main\java\org\apache\poi\xssf\eventusermodel\XSSFReader.java
U 
poi-ooxml\src\test\java\org\apache\poi\xssf\eventusermodel\TestXSSFReader.java
U 
poi-examples\src\main\java\org\apache\poi\examples\xssf\eventusermodel\FromHowTo.java

<-- Got one external: forrest.properties, svn url: 
https://svn.apache.org/repos/asf/poi/site/forrest.properties -->
Fetching 'https://svn.apache.org/repos/asf/poi/site/forrest.properties' at -1 
into 
'F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\forrest.properties'
At revision 1896276


<-- Got one external: documentation, svn url: 
https://svn.apache.org/repos/asf/poi/site/src/documentation -->
Fetching 'https://svn.apache.org/repos/asf/poi/site/src/documentation' at -1 
into 
'F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\src\documentation'
U src\documentation\content\xdocs\changes.xml
At revision 1896276

At revision 1896276

No changes for https://svn.apache.org/repos/asf/poi/site/forrest.properties 
since the previous build
[POI-DSL-Windows-1.8] $ cmd /c call 
F:\jenkins\jenkins-home\temp\jenkins5357442163368630217.bat
X   forrest.properties
X   src\documentation

Performing status on external item at 'src\documentation':
svn: E155010: The node 
'F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi*\src\*' 
was not found.
Java-Home: f:\\jenkins\\tools\\java\\latest1.8
 Volume in drive F is Data
 Volume Serial Number is 56F7-1E0B

 Directory of f:\jenkins\tools\java\latest1.8

08/03/2021  04:35 PM  .
08/03/2021  04:35 PM  ..
04/16/2020  07:15 AM 1,522 ASSEMBLY_EXCEPTION
08/03/2021  04:35 PM  bin
08/03/2021  04:35 PM  include
08/03/2021  04:35 PM  jre
08/03/2021  04:35 PM  lib
04/16/2020  07:15 AM19,274 LICENSE
04/16/2020  07:15 AM86 release
08/03/2021  04:35 PM  sample
04/16/2020  07:15 AM51,408,032 src.zip
04/16/2020  07:15 AM   153,250 THIRD_PARTY_README
   5 File(s) 51,582,164 bytes
   7 Dir(s)  1,009,855,963,136 bytes free
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)
[Gradle] - Launching build.
[POI-DSL-Windows-1.8] $ cmd.exe /C 
" 
clean jenkins && exit %%ERRORLEVEL%%"
Starting a Gradle Daemon, 1 busy and 4 incompatible and 1 stopped Daemons could 
not be reused, use --status for details
Configuration on demand is an incubating feature.

> Configure project :
Trying to override old definition of datatype junit
Run with reduced parallelism for CI build
Run with reduced parallelism for CI build
Run with reduced parallelism for CI build
Run with reduced parallelism for CI build
Run with reduced parallelism for CI build
Run with reduced parallelism for CI build
Run with reduced parallelism for CI build
Run with reduced parallelism for CI build
Run with reduced parallelism for CI build

> Task :poi-excelant:clean UP-TO-DATE
> Task :poi:clean UP-TO-DATE
> Task :poi-examples:clean UP-TO-DATE
> Task :poi-integration:clean FAILED
> Task :clean FAILED
> Task :poi-ooxml:clean
> Task :poi-ooxml-full:clean

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
---
* What went wrong:
Execution failed for task ':poi-integration:clean'.
> java.io.IOException: Unable to delete directory 
> 'F:\jenkins\jenkins-home\712657a4\workspace\POI\POI-DSL-Windows-1.8\poi-integration\build'
Failed to delete some children. This might happen because a process has 
files open or has its working direc

[GitHub] [poi] daniel-shuy opened a new pull request #290: Customize Spliterator implementations for better parallelism

2021-12-22 Thread GitBox


daniel-shuy opened a new pull request #290:
URL: https://github.com/apache/poi/pull/290


   # Why
   
   There are many classes in Apache POI that implements 
[Iterable](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html), 
but only implements 
[Iterable#iterator()](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html#iterator--)
 without overriding 
[Iterable#spliterator()](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html#spliterator--).
   
   The default implementation of 
[Iterable#spliterator()](https://github.com/openjdk/jdk/blob/9a9add8825a040565051a09010b29b099c2e7d49/jdk/src/share/classes/java/lang/Iterable.java#L100-L102)
 is:
   ```java
   default Spliterator spliterator() {
   return Spliterators.spliteratorUnknownSize(iterator(), 0);
   }
   ```
   [Spliterator#spliteratorUnknownSize(Iterator, 
int)](https://docs.oracle.com/javase/8/docs/api/java/util/Spliterators.html#spliteratorUnknownSize-java.util.Iterator-int-)
 returns a `Spliterator` with no initial size estimate, which has poor 
splitting capabilities. The default implementation has to do this because not 
all `Iterable`s have a fixed size.
   
   This is important when trying to convert the `Iterable` to a parallel 
`Stream`. For example, when trying to process 
[Row](https://poi.apache.org/apidocs/5.0/org/apache/poi/ss/usermodel/Row.html)s 
in a 
[XSSFSheet](https://poi.apache.org/apidocs/5.0/org/apache/poi/xssf/usermodel/XSSFSheet.html)
 (`XSSFSheet` implements `Iterable`) in parallel, the performance is 
terrible:
   ```java
   StreamSupport.stream(sheet.spliterator(), true)
   .forEach(row -> {
   // ...
   });
   ```
   
   The `XSSFSheet`'s `Iterator` is backed by a 
[TreeMap#values()](https://docs.oracle.com/javase/8/docs/api/java/util/TreeMap.html#values--):
   
https://github.com/apache/poi/blob/cf1354dc6c6128d8fd024ee1f57359761cd5fd1f/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java#L95
   
https://github.com/apache/poi/blob/cf1354dc6c6128d8fd024ee1f57359761cd5fd1f/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java#L2049-L2067
   
   `TreeMap#values()` returns a 
[Collection](https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html),
 and thus has a fixed size. Its `Spliterator` is hence sized and has good 
splitting capabilities, allowing it to be properly parallelized. Therefore an 
easy way to customize `XSSFSheet#spliterator()` is to simply delegate to the 
underlying `TreeMap#values()`, eg.
   ```java
   @Override
   @SuppressWarnings("unchecked")
   public Spliterator spliterator() {
   return (Spliterator)(Spliterator) 
_rows.values().spliterator();
   }
   ```
   
   # How
   
   - For classes that expose an `Iterator` factory method with a backing 
`Collection`/`Iterable`, I simply delegated the `Spliterator` factory method to 
the underlying `Collection`/`Iterable`.
   - For classes that expose an `Iterator` factory method but do not have a 
backing `Collection`/`Iterable`, but have a fixed size, I customized the 
`Spliterator` factory method to return a sized `Spliterator` using 
[Spliterators#spliterator(Iterator, long, 
int)](https://docs.oracle.com/javase/8/docs/api/java/util/Spliterators.html#spliterator-java.util.Iterator-long-int-).
   - Classes that expose an `Iterator` factory method but do not have a fixed 
size remain unchanged.
   
   I also took the liberty to perform the following refactors:
   - Move `iterator()` implementation in child classes to 
`Workbook`/`Sheet`/`Row` interface using `default` methods (the `iterator()` 
method is an alias of `sheetIterator()`/`rowIterator()`/`cellIterator()`, and 
is currently being duplicated in all child classes)
   - Add `Iterable` interface to `IntMapper` and `XDDFTextParagraph` (so that 
they can be iterated using an enhanced-`for` loop)
   
   None of the changes break source/binary compatibility.


-- 
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