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

ASF subversion and git services commented on SOLR-16101:
--------------------------------------------------------

Commit 4918187cc0aa3299ba6a8addefb388b010ce2603 in solr's branch 
refs/heads/branch_9_0 from Anshum Gupta
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=4918187 ]

SOLR-16101: Add empty constructor for SolrInputDocument (#746) (#751) (#752)



> Add an empty constructor for SolrInputDocument
> ----------------------------------------------
>
>                 Key: SOLR-16101
>                 URL: https://issues.apache.org/jira/browse/SOLR-16101
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrJ
>    Affects Versions: 5.5, 6.6, 7.7, 8.11.1
>            Reporter: Anshum Gupta
>            Assignee: Anshum Gupta
>            Priority: Major
>             Fix For: 9.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> While trying to serialize and deserialize {{SolrInputDocument}} using the 
> following code, 
> {code:java}
> final SolrInputDocument inputDoc = new SolrInputDocument();
>         inputDoc.addField("foo", "bar");
>         Gson gson = new Gson();
>         String docString = gson.toJson(inputDoc);
>         SolrInputDocument solrInputDocument = new 
> SolrInputDocument(gson.fromJson(docString, SolrInputDocument.class));
> {code}
> the deserializing fails w/ 
> bq. "java.lang.ClassCastException: Cannot cast 
> com.google.gson.internal.LinkedTreeMap to 
> org.apache.solr.common.SolrInputDocument"
> {{SolrInputDocument}} needs an empty constructor for this.
> There seem to be some ways to get around this for older versions but with 
> vanilla code this affects all versions starting 5.5 all the way until 8.11.1



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

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

Reply via email to