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

liuqibj commented on SOLR-6676:
-------------------------------

Thanks. I use the tutorial to post a sample json but I make a change to the 
correct json to invalid.
Here is the json:
[
  {
    "id" : "978-0641723445",
    "cat" : ["book","hardcover"],
    "name" : "The Lightning Thief",
    "author" : "Rick Riordan",
    "series_t" : "Percy Jackson and the Olympians",
    "sequence_i" : 1,
    "genre_s" : "fantasy\",
    "inStock" : true,
    "price" : 12.50,
    "pages_i" : 384
  }
,
  {
    "id" : "978-1423103349",
    "cat" : ["book","paperback"],
    "name" : "The Sea of Monsters",
    "author" : "Rick Riordan",
    "series_t" : "Percy Jackson and the Olympians",
    "sequence_i" : 2,
    "genre_s" : "fantasy",
    "inStock" : true,
    "price" : 6.49,
    "pages_i" : 304
  }
,
  {
    "id" : "978-1857995879",
    "cat" : ["book","paperback"],
    "name" : "Sophie's World : The Greek Philosophers",
    "author" : "Jostein Gaarder",
    "sequence_i" : 1,
    "genre_s" : "fantasy",
    "inStock" : true,
    "price" : 3.07,
    "pages_i" : 64
  }
,
  {
    "id" : "978-1933988177",
    "cat" : ["book","paperback"],
    "name" : "Lucene in Action, Second Edition",
    "author" : "Michael McCandless",
    "sequence_i" : 1,
    "genre_s" : "IT",
    "inStock" : true,
    "price" : 30.50,
    "pages_i" : 475
  }
]

The results:
C:\solr4.7.0\solr-4.7.0\solr-4.7.0\example\exampledocs>java -Dtype=application/j
son -jar post.jar books.json
SimplePostTool version 1.5
Posting files to base url http://localhost:8983/solr/update using content-type a
pplication/json..
POSTing file books.json
SimplePostTool: WARNING: Solr returned an error #500 Server Error
SimplePostTool: WARNING: IOException while reading response: java.io.IOException
: Server returned HTTP response code: 500 for URL: http://localhost:8983/solr/up
date
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/update..
Time spent: 0:00:00.141

> Return 500 if bad json data is posted to Solr?
> ----------------------------------------------
>
>                 Key: SOLR-6676
>                 URL: https://issues.apache.org/jira/browse/SOLR-6676
>             Project: Solr
>          Issue Type: Bug
>          Components: update
>    Affects Versions: 4.7.2
>            Reporter: liuqibj
>
> When posting  invalid json data to Solr and we often get 400 response code 
> but some cases return 500 if bad json data is posted. The call stack looks 
> like this(see below). There are multiple reasons if Solr return 500 errors.  
> Is there any way to distinguish whether the 500 errors is due to bad json 
> data or other reasons?
> at org.apache.noggit.JSONParser.err
> at org.apache.noggit.JSONParser.next
> at org.apache.noggit.JSONParser.nextEvent
> at 
> org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.processUpdate
> at org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.load
> at org.apache.solr.handler.loader.JsonLoader.load



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to