Error with XStream

581 views
Skip to first unread message

RafaelViana

unread,
Jan 28, 2011, 9:51:06 AM1/28/11
to restfulie-java
Hi,

I ran the ClientTest from rest_from_scratch_part_1_client, and got
this error:

com.thoughtworks.xstream.io.StreamException: : ParseError at
[row,col]:[1,1]
Message: Premature end of file.
at
com.thoughtworks.xstream.io.xml.StaxReader.pullNextEvent(StaxReader.java:
64)
at
com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:
137)
at
com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:
130)
at
com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:
109)
at
com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:
94)
at com.thoughtworks.xstream.io.xml.StaxReader.<init>(StaxReader.java:
44)
at
com.thoughtworks.xstream.io.xml.StaxDriver.createStaxReader(StaxDriver.java:
126)
at
com.thoughtworks.xstream.io.xml.StaxDriver.createReader(StaxDriver.java:
77)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:845)
at
br.com.caelum.restfulie.mediatype.XmlMediaType.unmarshal(XmlMediaType.java:
73)
at
br.com.caelum.restfulie.http.apache.ApacheResponse.getResource(ApacheResponse.java:
60)
at
br.com.caelum.client.ClientTests.shouldBeAbleToGetAnItem(ClientTests.java:
30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.junit.runners.model.FrameworkMethod
$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:
41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:
20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:
28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
31)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
73)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:
46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:
28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:
49)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:
38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
197)
Caused by: javax.xml.stream.XMLStreamException: ParseError at
[row,col]:[1,1]
Message: Premature end of file.
at
com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:
591)
at
com.thoughtworks.xstream.io.xml.StaxReader.pullNextEvent(StaxReader.java:
49)
... 36 more

What could be this?

Lucas Cavalcanti

unread,
Jan 28, 2011, 10:03:32 AM1/28/11
to restful...@googlegroups.com
are you passing an empty stream on the test? or returning a blank response on a request?

RafaelViana

unread,
Jan 28, 2011, 10:10:41 AM1/28/11
to restfulie-java
I just ran the ClientTest :S
Try to ran this test. Did it worked?

On 28 jan, 13:03, Lucas Cavalcanti <lucasmrtu...@gmail.com> wrote:
> are you passing an empty stream on the test? or returning a blank response
> on a request?
>

Lucas Cavalcanti

unread,
Jan 28, 2011, 10:17:19 AM1/28/11
to restful...@googlegroups.com
have you started the server app?

RafaelViana

unread,
Jan 28, 2011, 10:19:01 AM1/28/11
to restfulie-java
Yes.

On 28 jan, 13:17, Lucas Cavalcanti <lucasmrtu...@gmail.com> wrote:
> have you started the server app?
>

Lucas Cavalcanti

unread,
Jan 28, 2011, 10:30:38 AM1/28/11
to restful...@googlegroups.com
I also get this error here =S

What about part 2? It works?

RafaelViana

unread,
Jan 28, 2011, 11:01:23 AM1/28/11
to restfulie-java
I didn't try to fix this error. Because it occurs in a class inside
the XStream.
And I know Guilherme is commiter in this project. Maybe he knows how
to fix it easily.

On 28 jan, 13:30, Lucas Cavalcanti <lucasmrtu...@gmail.com> wrote:
> I also get this error here =S
>
> What about part 2? It works?
>

Guilherme Silveira

unread,
Jan 28, 2011, 11:09:27 AM1/28/11
to restfulie-java
The ClientTests from rest_from_scratch example project?
Can you try it in the original branch?

Let me know if its not working and I will get it fixed.

Regards

Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/

RafaelViana

unread,
Jan 28, 2011, 11:29:03 AM1/28/11
to restfulie-java
Yes, it's from the example project part 1.
What do I need to do to try it in the original branch?

I ran it without changes using the lastest restfulie code from
github.

On 28 jan, 14:09, Guilherme Silveira
<guilherme.silve...@caelum.com.br> wrote:
> The ClientTests from rest_from_scratch example project?
> Can you try it in the original branch?
>
> Let me know if its not working and I will get it fixed.
>
> Regards
>
> Guilherme Silveira
> Caelum | Ensino e Inovaçãohttp://www.caelum.com.br/

RafaelViana

unread,
Jan 28, 2011, 11:31:04 AM1/28/11
to restfulie-java
I didn't get to import the part 2 to eclipse. But, I copied the class
but this example seems to be out of date.

For example:
br.com.caelum.example.model
Payment.java

@Override
public void configureRelations(RelationBuilder builder) {
builder.relation("self").uses(PaymentsController.class).show(id);
}

Using the current HypermediaResource signature:

@Override
public List<Relation> getRelations(Restfulie client) {
client.relation("self").uses(PaymentsController.class).show(id);
}

But what do I need to return?

On 28 jan, 13:30, Lucas Cavalcanti <lucasmrtu...@gmail.com> wrote:
> I also get this error here =S
>
> What about part 2? It works?
>

Lucas Cavalcanti

unread,
Jan 28, 2011, 3:57:31 PM1/28/11
to restful...@googlegroups.com
Rafael, I've just fixed this bug. Pull the changes and test it again please

[]'s

RafaelViana

unread,
Jan 28, 2011, 4:48:31 PM1/28/11
to restfulie-java
Thanks. Now It works!

Now, I'll get explore more the Restfulie :D

On 28 jan, 18:57, Lucas Cavalcanti <lucasmrtu...@gmail.com> wrote:
> Rafael, I've just fixed this bug. Pull the changes and test it again please
>
> []'s
>
Reply all
Reply to author
Forward
0 new messages