users@jaxb.java.net

help - possible unmarshaller bug

From: <john.mcclain_at_homeq.com>
Date: Wed, 7 Feb 2007 18:25:32 -0500

Howdy - I am not understanding this problem. It may be a bug.

When I execute the following line of code, it fails with the exception
below:
[line of code]
ResponseListContainer = (AppraisalStatusResponses)
unmarshaller.unmarshal(request.getInputStream());

[exception output]
15:13:24,718 INFO [STDOUT] DefaultValidationEventHandler: [FATAL_ERROR]:
Premature end of file.
     Location:
15:13:26,109 ERROR [STDERR] javax.xml.bind.UnmarshalException
 - with linked exception:
[org.xml.sax.SAXParseException: Premature end of file.]
15:13:26,109 ERROR [STDERR] at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(
AbstractUnmarshallerImpl.java:315)
15:13:26,109 ERROR [STDERR] at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(
UnmarshallerImpl.java:481)
15:13:26,125 ERROR [STDERR] at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(
UnmarshallerImpl.java:199)
15:13:26,125 ERROR [STDERR] at com.sun.xml.bind.v2.runt......
.
.

HOWEVER, when I take the input stream and put it to a stringbuffer, as
follows, it succeeds.
 StringBuffer sb1 = new StringBuffer();
  int c1;
  InputStream in1 = request.getInputStream();
  while ((c1 = in1.read()) != -1) sb1.append((char) c1);
  String h1 = sb1.toString();

ResponseListContainer = (AppraisalStatusResponses)
unmarshaller.unmarshal(new StringReader( sb1.toString() ));

Why does the unmarshaller fail with an inputStream and succeed with the
StringBuffer???


The XML from the input stream looks as follows (This is a copy of the
variable h1 from above as viewed in the eclipse variables view)
<AppraisalStatusResponses>
        <AppraisalStatusResponse LoginAccountIdentifier="xxxxx"
LoginAccountPassword="yyyyy">
                <AccountIdentifier>1274</AccountIdentifier>
                <TransactionID>24566</TransactionID>
                <LenderCaseIdentifier>72613557</LenderCaseIdentifier>
                <ValuationRequestID>1391450</ValuationRequestID>
                <Status>Activated</Status>
                <ProductID>51</ProductID>
                <ProductName>Value View BPO3S3L</ProductName>
                <FinalAppraisedValue/>
                <DueDate>Feb 09 2007 15:13:02AM</DueDate>
                <ReceivedDate>Feb 05 2007 15:13:02AM</ReceivedDate>
                <AssignedDate/>
                <InspectedDate/>
                <InvoiceAmount/>
                <HouseNumber>123</HouseNumber>
                <StreetName>Test St</StreetName>
                <PropertyCity>Layton</PropertyCity>
                <PostalCode>84041</PostalCode>
                <BorrowerName>John Doe</BorrowerName>
                <OnHold>N</OnHold>
                <LenderTrackingCode>xyz1234</LenderTrackingCode>
                <AppraisalDoc/>
                <InvoiceDoc/>
                <Notes>
                        <Note>
                                <NoteID>8</NoteID>
                                <NoteDate>2007-02-07T15:13:02</NoteDate>
               <NoteDescription>Order has been Created.</NoteDescription>
                        </Note>
                </Notes>
                <ResultsData>
                        <AsIsValue/>
                        <AsRepairedValue/>
                        <AsOfDate/>
                </ResultsData>
        </AppraisalStatusResponse>
</AppraisalStatusResponses>