XContentBuilder.copyCurrentStructure() fails with .JsonParseException: Unexpected end-of-input expected close marker for OBJECT

$ curl -XGET 'http://localhost:9200/_search' -d '{
"query" : {
"term" : { "user" : "kimchy" }
}
'

public class MyRestFilterDoingSpecialThings extends RestFilter {
...
Override
public void process(RestRequest request, RestChannel channel,
RestFilterChain filterChain) { ...

XContentType xContentType =
XContentFactory.xContentType(request.content()); //json
XContentParser parser =
XContentFactory.xContent(xContentType).createParser(request.content());
XContentParser.Token t = parser.nextToken();
//t is START_OBJECT
XContentBuilder builder =
XContentFactory.contentBuilder( xContentType).copyCurrentStructure(parser);
<-- fails with

org.elasticsearch.common.jackson.core.JsonParseException: Unexpected
end-of-input: expected close marker for OBJECT (from [Source: [B@29569b73; line: 1, column: 0])
at [Source: [B@29569b73; line: 5, column: 64]
at
org.elasticsearch.common.jackson.core.JsonParser._constructError(JsonParser.java:1369)
at
org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:532)
at
org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportInvalidEOF(ParserMinimalBase.java:465)
at
org.elasticsearch.common.jackson.core.base.ParserBase._handleEOF(ParserBase.java:491)
at
org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser._skipWSOrEnd(UTF8StreamJsonParser.java:2513)
at
org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:617)
at
org.elasticsearch.common.jackson.core.base.GeneratorBase.copyCurrentStructure(GeneratorBase.java:401)
at
org.elasticsearch.common.xcontent.json.JsonXContentGenerator.copyCurrentStructure(JsonXContentGenerator.java:310)
at
org.elasticsearch.common.xcontent.XContentBuilder.copyCurrentStructure(XContentBuilder.java:1035)

What did i wrong?
Thanks
Hendrik

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Hendrik,

Your query lack last close brace.
Maybe this error say "incorrect JSON object ".

2013/10/19 Hendrik h.j.saly@googlemail.com

$ curl -XGET 'http://localhost:9200/_search' -d '{
"query" : {
"term" : { "user" : "kimchy" }
}
'

public class MyRestFilterDoingSpecialThings extends RestFilter {
...
Override
public void process(RestRequest request, RestChannel channel,
RestFilterChain filterChain) { ...

XContentType xContentType =
XContentFactory.xContentType(request.content()); //json
XContentParser parser =
XContentFactory.xContent(xContentType).createParser(request.content());
XContentParser.Token t = parser.nextToken();
//t is START_OBJECT
XContentBuilder builder =
XContentFactory.contentBuilder( xContentType).copyCurrentStructure(parser);
<-- fails with

org.elasticsearch.common.jackson.core.JsonParseException: Unexpected
end-of-input: expected close marker for OBJECT (from [Source: [B@29569b73; line: 1, column: 0])
at [Source: [B@29569b73; line: 5, column: 64]
at
org.elasticsearch.common.jackson.core.JsonParser._constructError(JsonParser.java:1369)
at
org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:532)
at
org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportInvalidEOF(ParserMinimalBase.java:465)
at
org.elasticsearch.common.jackson.core.base.ParserBase._handleEOF(ParserBase.java:491)
at
org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser._skipWSOrEnd(UTF8StreamJsonParser.java:2513)
at
org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:617)
at
org.elasticsearch.common.jackson.core.base.GeneratorBase.copyCurrentStructure(GeneratorBase.java:401)
at
org.elasticsearch.common.xcontent.json.JsonXContentGenerator.copyCurrentStructure(JsonXContentGenerator.java:310)
at
org.elasticsearch.common.xcontent.XContentBuilder.copyCurrentStructure(XContentBuilder.java:1035)

What did i wrong?
Thanks
Hendrik

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--

Jun Ohtani
blog : http://blog.johtani.info

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Awkwardhttp://dict.leo.org/#/search=awkward&searchLoc=0&resultOrder=basic&multiwordShowSingle=on,
thanks.
Typical example for nothttp://dict.leo.org/#/search=not&searchLoc=0&resultOrder=basic&multiwordShowSingle=on
tohttp://dict.leo.org/#/search=to&searchLoc=0&resultOrder=basic&multiwordShowSingle=on
seehttp://dict.leo.org/#/search=see&searchLoc=0&resultOrder=basic&multiwordShowSingle=on
thehttp://dict.leo.org/#/search=the&searchLoc=0&resultOrder=basic&multiwordShowSingle=on
woodhttp://dict.leo.org/#/search=wood&searchLoc=0&resultOrder=basic&multiwordShowSingle=on
forhttp://dict.leo.org/#/search=for&searchLoc=0&resultOrder=basic&multiwordShowSingle=on
thehttp://dict.leo.org/#/search=the&searchLoc=0&resultOrder=basic&multiwordShowSingle=on
treeshttp://dict.leo.org/#/search=trees&searchLoc=0&resultOrder=basic&multiwordShowSingle=on
:slight_smile:

Am Sonntag, 20. Oktober 2013 18:07:23 UTC+2 schrieb Jun Ohtani:

Hi Hendrik,

Your query lack last close brace.
Maybe this error say "incorrect JSON object ".

2013/10/19 Hendrik <h.j....@googlemail.com <javascript:>>

$ curl -XGET 'http://localhost:9200/_search' -d '{
"query" : {
"term" : { "user" : "kimchy" }
}
'

public class MyRestFilterDoingSpecialThings extends RestFilter {
...
Override
public void process(RestRequest request, RestChannel channel,
RestFilterChain filterChain) { ...

XContentType xContentType =
XContentFactory.xContentType(request.content()); //json
XContentParser parser =
XContentFactory.xContent(xContentType).createParser(request.content());
XContentParser.Token t = parser.nextToken();
//t is START_OBJECT
XContentBuilder builder =
XContentFactory.contentBuilder( xContentType).copyCurrentStructure(parser);
<-- fails with

org.elasticsearch.common.jackson.core.JsonParseException: Unexpected
end-of-input: expected close marker for OBJECT (from [Source: [B@29569b73; line: 1, column: 0])
at [Source: [B@29569b73; line: 5, column: 64]
at
org.elasticsearch.common.jackson.core.JsonParser._constructError(JsonParser.java:1369)
at
org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:532)
at
org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportInvalidEOF(ParserMinimalBase.java:465)
at
org.elasticsearch.common.jackson.core.base.ParserBase._handleEOF(ParserBase.java:491)
at
org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser._skipWSOrEnd(UTF8StreamJsonParser.java:2513)
at
org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:617)
at
org.elasticsearch.common.jackson.core.base.GeneratorBase.copyCurrentStructure(GeneratorBase.java:401)
at
org.elasticsearch.common.xcontent.json.JsonXContentGenerator.copyCurrentStructure(JsonXContentGenerator.java:310)
at
org.elasticsearch.common.xcontent.XContentBuilder.copyCurrentStructure(XContentBuilder.java:1035)

What did i wrong?
Thanks
Hendrik

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--

Jun Ohtani
blog : http://blog.johtani.info

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi,
CREATE EXTERNAL TABLE message (
messageId string,
messageSize int,
sender string,
recipients array,
messageParts array<struct<
extension: string,
size: int>>,
headers map<string,string>
)ROW FORMAT SERDE 'com.cloudera.hive.serde.JSONSerDe'
LOCATION '/Loca1';

JSON:
{
"messageId": "34dd0d3c-f53b-11e0-ac12-d3e782dff199",
"messageSize": 12345,
"sender": "alice@example.com",
"recipients": [
"joe@example.com",
"bob@example.com"
],
"messageParts": [
{
"extension": "pdf",
"size": 4567
},
{
"extension": "jpg",
"size": 9451
}
],
"headers": {
"Received-SPF": "pass",
"X-Broadcast-Id": "9876"
}
}

I get JSONParseException with unexpected end-of-input. Could you please
correct?

On Saturday, October 19, 2013 2:09:30 PM UTC+5:30, Hendrik wrote:

$ curl -XGET 'http://localhost:9200/_search' -d '{
"query" : {
"term" : { "user" : "kimchy" }
}
'

public class MyRestFilterDoingSpecialThings extends RestFilter {
...
Override
public void process(RestRequest request, RestChannel channel,
RestFilterChain filterChain) { ...

XContentType xContentType =
XContentFactory.xContentType(request.content()); //json
XContentParser parser =
XContentFactory.xContent(xContentType).createParser(request.content());
XContentParser.Token t = parser.nextToken();
//t is START_OBJECT
XContentBuilder builder =
XContentFactory.contentBuilder( xContentType).copyCurrentStructure(parser);
<-- fails with

org.elasticsearch.common.jackson.core.JsonParseException: Unexpected
end-of-input: expected close marker for OBJECT (from [Source: [B@29569b73; line: 1, column: 0])
at [Source: [B@29569b73; line: 5, column: 64]
at
org.elasticsearch.common.jackson.core.JsonParser._constructError(JsonParser.java:1369)
at
org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:532)
at
org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportInvalidEOF(ParserMinimalBase.java:465)
at
org.elasticsearch.common.jackson.core.base.ParserBase._handleEOF(ParserBase.java:491)
at
org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser._skipWSOrEnd(UTF8StreamJsonParser.java:2513)
at
org.elasticsearch.common.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:617)
at
org.elasticsearch.common.jackson.core.base.GeneratorBase.copyCurrentStructure(GeneratorBase.java:401)
at
org.elasticsearch.common.xcontent.json.JsonXContentGenerator.copyCurrentStructure(JsonXContentGenerator.java:310)
at
org.elasticsearch.common.xcontent.XContentBuilder.copyCurrentStructure(XContentBuilder.java:1035)

What did i wrong?
Thanks
Hendrik

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/162685e1-d872-474c-a30f-a651bf7ceb5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.