Buggy code:
public class JSONStatusBuilder { @ SuppressWarnings ( "unchecked" ) public static JSONObject status ( Question question ) { JSONObject document = new JSONObject ( ) ; document . put ( "input_question" , question . languageToQuestion . get ( "en" ) ) ; if ( ! ( question . languageToNamedEntites . isEmpty ( ) ) ) { JSONArray tmp = new JSONArray ( ) ; for ( Entity key : question . languageToNamedEntites . get ( "en" ) ) { JSONObject tmpobj = new JSONObject ( ) ; tmpobj . put ( "key" , key . label ) ; tmpobj . put ( "value" , new org . apache . jena . atlas . json . JsonString ( key . uris . get ( 0 ) . getURI ( ) ) ) ; tmp . add ( tmpobj ) ; } document . put ( "named_entities" , tmp ) ; } if ( ! ( question . languageToNounPhrases . isEmpty ( ) ) ) { JSONArray tmp = new JSONArray ( ) ; for ( Entity key : question . languageToNounPhrases . get ( "en" ) ) { JSONObject tmpobj = new JSONObject ( ) ; tmpobj . put ( "key" , key . label ) ; tmpobj . put ( "value" , new org . apache . jena . atlas . json . JsonString ( key . uris . get ( 0 ) . getURI ( ) ) ) ; tmp . add ( tmpobj ) ; } document . put ( "combined_nouns" , tmp ) ; } if ( ( question . tree ) != null ) { Stack < MutableTreeNode > stack = new Stack < MutableTreeNode > ( ) ; stack . push ( question . tree . getRoot ( ) ) ; JSONArray tmp = new JSONArray ( ) ; while ( ! ( stack . isEmpty ( ) ) ) { MutableTreeNode node = stack . pop ( ) ; JSONObject tmpobj = new JSONObject ( ) ; tmpobj . put ( "key" , node . label ) ; tmpobj . put ( "POS" , node . posTag ) ; tmp . add ( tmpobj ) ; for ( MutableTreeNode child : node . children ) { stack . push ( child ) ; } } document . put ( "POS_tags" , tmp ) ; } if ( ( question . tree_full ) != null ) { document . put ( "tree_full" , question . tree_full ) ; } if ( ( question . tree_pruned ) != null ) { document . put ( "tree_pruned" , question . tree_pruned ) ; } if ( ( question . tree_final ) != null ) { <START_BUG> document . put ( "tree_pruned" , question . tree_final ) ; <END_BUG> } if ( ( question . tree ) != null ) { Stack < MutableTreeNode > stack = new Stack < MutableTreeNode > ( ) ; stack . push ( question . tree . getRoot ( ) ) ; JSONArray tmp = new JSONArray ( ) ; while ( ! ( stack . isEmpty ( ) ) ) { MutableTreeNode node = stack . pop ( ) ; if ( ! ( node . getAnnotations ( ) . isEmpty ( ) ) ) { JSONObject tmpobj = new JSONObject ( ) ; tmpobj . put ( "label" , node . label ) ; JSONArray tmpArray = new JSONArray ( ) ; tmpArray . addAll ( node . getAnnotations ( ) ) ; tmpobj . put ( "annotations" , tmpArray ) ; tmp . add ( tmpobj ) ; } for ( MutableTreeNode child : node . children ) { stack . push ( child ) ; } } document . put ( "annotation" , tmp ) ; } if ( ! ( question . pruning_messages . isEmpty ( ) ) ) { document . put ( "pruning_messages" , question . pruning_messages ) ; } if ( ( ( question . finalAnswer ) != null ) && ( ! ( question . finalAnswer . isEmpty ( ) ) ) ) { document . put ( "final_sparql_base64" , new String ( Base64 . encodeBase64 ( question . finalAnswer . get ( 0 ) . queryString . getBytes ( ) ) ) ) ; JSONArray array = new JSONArray ( ) ; for ( RDFNode answer : question . finalAnswer . get ( 0 ) . answerSet ) { array . add ( AnswerBox . buildAnswerBoxFeatures ( answer . asResource ( ) . getURI ( ) ) ) ; } document . put ( "answer" , array ) ; } return document ; } public static JSONObject treeToJSON ( MutableTree tree ) { } @ SuppressWarnings ( "unchecked" ) private static JSONObject recursiveNodeLabel ( MutableTreeNode node , JSONObject document ) { } }

Fix:
document . put ( "tree_final" , question . tree_final ) ;