[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-07-03 Thread Dmitry Volodin (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16531097#comment-16531097
 ] 

Dmitry Volodin commented on CAMEL-12607:


Waiting until camel-2.22.x branch will create

> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
> Fix For: 2.21.2, 2.22.1, 2.23.0
>
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-07-03 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16531082#comment-16531082
 ] 

ASF GitHub Bot commented on CAMEL-12607:


Github user dmvolod closed the pull request at:

https://github.com/apache/camel/pull/2402


> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-07-03 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16531081#comment-16531081
 ] 

ASF GitHub Bot commented on CAMEL-12607:


dmvolod closed pull request #2402: CAMEL-12607: When using Tokenizer skipFirst 
java.util.NoSuchElementException if only one element [will merge after 2.22.0 
release]
URL: https://github.com/apache/camel/pull/2402
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java 
b/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java
index 0bfd2689a4b..2f05116d8f0 100644
--- a/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java
+++ b/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java
@@ -50,7 +50,7 @@
 private final ByteArrayOutputStream bos = new ByteArrayOutputStream();
 
 /**
- * Creates a new token based group titerator
+ * Creates a new token based group iterator
  *
  * @param camelContext  the camel context
  * @param itthe iterator to group
@@ -155,7 +155,12 @@ private Object doNext() throws IOException, 
NoTypeConversionAvailableException {
 data = it.next();
 
 if (skipFirst && hasSkipFirst.compareAndSet(false, true)) {
-data = it.next();
+if (it.hasNext()) {
+data = it.next();
+} else {
+// Content with header only which is marked to skip
+data = "";
+}
 }
 
 // include token in between
diff --git 
a/camel-core/src/test/java/org/apache/camel/processor/SplitGroupSkipFirstTest.java
 
b/camel-core/src/test/java/org/apache/camel/processor/SplitGroupSkipFirstTest.java
index d85cac27c21..5c09847c27e 100644
--- 
a/camel-core/src/test/java/org/apache/camel/processor/SplitGroupSkipFirstTest.java
+++ 
b/camel-core/src/test/java/org/apache/camel/processor/SplitGroupSkipFirstTest.java
@@ -31,6 +31,14 @@ public void testSplitSkipFirst() throws Exception {
 
 assertMockEndpointsSatisfied();
 }
+
+public void testSplitSkipFirstOnlyHeader() throws Exception {
+getMockEndpoint("mock:group").expectedBodiesReceived("");
+
+template.sendBody("direct:start", "##comment\n");
+
+assertMockEndpointsSatisfied();
+}
 
 @Override
 protected RouteBuilder createRouteBuilder() throws Exception {


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-07-03 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16531080#comment-16531080
 ] 

ASF GitHub Bot commented on CAMEL-12607:


dmvolod commented on issue #2402: CAMEL-12607: When using Tokenizer skipFirst 
java.util.NoSuchElementException if only one element [will merge after 2.22.0 
release]
URL: https://github.com/apache/camel/pull/2402#issuecomment-402073041
 
 
   @oscerd , thanks, merged.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-07-03 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16531068#comment-16531068
 ] 

ASF GitHub Bot commented on CAMEL-12607:


oscerd commented on issue #2402: CAMEL-12607: When using Tokenizer skipFirst 
java.util.NoSuchElementException if only one element [will merge after 2.22.0 
release]
URL: https://github.com/apache/camel/pull/2402#issuecomment-402069131
 
 
   You can merge it, I guess.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-06-29 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16527978#comment-16527978
 ] 

ASF GitHub Bot commented on CAMEL-12607:


dmvolod commented on issue #2402: CAMEL-12607: When using Tokenizer skipFirst 
java.util.NoSuchElementException if only one element [will merge after 2.22.0 
release]
URL: https://github.com/apache/camel/pull/2402#issuecomment-401418510
 
 
   Thanks, @oscerd , yes, will wait for release to avoid conflicts with build 
process


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-06-29 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16527975#comment-16527975
 ] 

ASF GitHub Bot commented on CAMEL-12607:


oscerd edited a comment on issue #2402: CAMEL-12607: When using Tokenizer 
skipFirst java.util.NoSuchElementException if only one element [will merge 
after 2.22.0 release]
URL: https://github.com/apache/camel/pull/2402#issuecomment-401417881
 
 
   LGTM lets wait for release


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-06-29 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16527974#comment-16527974
 ] 

ASF GitHub Bot commented on CAMEL-12607:


oscerd commented on issue #2402: CAMEL-12607: When using Tokenizer skipFirst 
java.util.NoSuchElementException if only one element [will merge after 2.22.0 
release]
URL: https://github.com/apache/camel/pull/2402#issuecomment-401417881
 
 
   LGTM l'età wait for release


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-06-29 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16527932#comment-16527932
 ] 

ASF GitHub Bot commented on CAMEL-12607:


dmvolod opened a new pull request #2402: CAMEL-12607: When using Tokenizer 
skipFirst java.util.NoSuchElementException if only one element [will merge 
after 2.22.0 release]
URL: https://github.com/apache/camel/pull/2402
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CAMEL-12607) When using Tokenizer skipFirst - java.util.NoSuchElementException if only one element

2018-06-29 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/CAMEL-12607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16527933#comment-16527933
 ] 

ASF GitHub Bot commented on CAMEL-12607:


GitHub user dmvolod opened a pull request:

https://github.com/apache/camel/pull/2402

CAMEL-12607: When using Tokenizer skipFirst 
java.util.NoSuchElementException if only one element [will merge after 2.22.0 
release]



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/dmvolod/camel CAMEL-12607

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/camel/pull/2402.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2402


commit 6c634aa249c4ca788cda6f77ffe87d9b6ec48e9a
Author: Dmitry Volodin 
Date:   2018-06-29T16:43:12Z

CAMEL-12607: When using Tokenizer skipFirst -
java.util.NoSuchElementException if only one element




> When using Tokenizer skipFirst - java.util.NoSuchElementException if only one 
> element
> -
>
> Key: CAMEL-12607
> URL: https://issues.apache.org/jira/browse/CAMEL-12607
> Project: Camel
>  Issue Type: Bug
>  Components: camel-core
>Affects Versions: 2.21.1
>Reporter: Sergey Savenko
>Assignee: Dmitry Volodin
>Priority: Minor
>
> I use {{.split().tokenize("\n", 1, true).streaming()}} to stream csv file 
> with header row and skip first line.
>  When file contains ONLY header row - {{java.util.NoSuchElementException}} is 
> thrown in 
> [https://github.com/apache/camel/blob/camel-2.21.1/camel-core/src/main/java/org/apache/camel/util/GroupTokenIterator.java#L158],
>  because when it skips first line - it does not check if it has next line and 
> just calls next().



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)