Skip to content
This repository has been archived by the owner on Aug 26, 2020. It is now read-only.

ExamplesBase throws ClassCastException when error occurs #125

Closed
sammefford opened this issue Aug 25, 2016 · 6 comments
Closed

ExamplesBase throws ClassCastException when error occurs #125

sammefford opened this issue Aug 25, 2016 · 6 comments
Assignees
Milestone

Comments

@sammefford
Copy link

This line in ExamplesBase

(CharSequence[]) Arrays.stream(batch.getItems()).map(item -> item.getTargetUri()).toArray())

throws this error

java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.CharSequence;
    at com.marklogic.entityservices.examples.ExamplesBase.lambda$importRDF$2(ExamplesBase.java:108)
@sammefford
Copy link
Author

sammefford commented Aug 25, 2016

I found this to work:

Arrays.stream(batch.getItems())
    .map(item -> item.getTargetUri())
    .collect(Collectors.joining("\n"))

This requires removal of the surrounding String.join call.

@grechaw
Copy link
Contributor

grechaw commented Aug 25, 2016

Ah, nice thanks for the tip.

@grechaw grechaw added fix and removed new labels Aug 25, 2016
@grechaw grechaw added this to the 9.0-ea3 milestone Aug 25, 2016
@grechaw
Copy link
Contributor

grechaw commented Aug 25, 2016

Set to ea-3 because it's in example code, not server.

grechaw pushed a commit to grechaw/entity-services that referenced this issue Aug 25, 2016
@jmakeig
Copy link
Contributor

jmakeig commented Aug 25, 2016

Ha! That’s what I get for trying to turn Java into Python via some Stack Overflow copy-pasta. Thanks, @sammefford and @grechaw.

@grechaw grechaw added test and removed fix labels Aug 25, 2016
@grechaw grechaw assigned bsrikan and unassigned grechaw Aug 25, 2016
@grechaw
Copy link
Contributor

grechaw commented Aug 25, 2016

Hi @bsrikan I implemented Sam's suggestion -- you can just maybe verify tests and close, or maybe you'l lhave similar change to make in e2e.

@bsrikan bsrikan added ship and removed test labels Aug 26, 2016
@bsrikan
Copy link
Collaborator

bsrikan commented Aug 26, 2016

Verified and am able to "run" examples without any exception. Shipping the bug.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants