Hi Rafael,
This is definitely a bug. I created a JIRA and pushed the fix (along with a
reproducible test case):
https://issues.jboss.org/browse/FORGE-2500
Thanks for catching this :)
Best Regards,
George Gastaldi
On Sun, Oct 18, 2015 at 9:33 PM, Rafael Pestano <rmpestano(a)gmail.com> wrote:
Hi guys,
I'm trying to set the contents of a FileResource with an unNamed array,
example:
FileResource<?> fileResource =
root.getChild("test").reify(FileResource.class);
fileResource.setContents("[]"); //same as
Json.createArrayBuilder().build().toString()
here it throws the exception:
org.jboss.forge.addon.resource.ResourceException: Error while setting the
Json contents
at
org.jboss.forge.addon.parser.json.resource.JsonResourceImpl.setContents(JsonResourceImpl.java:98)
at
org.jboss.forge.addon.parser.json.resource.JsonResourceImpl.setContents(JsonResourceImpl.java:29)
I think the error is because JsonResource tries to read an object (instead
of an array in the case) in set contents(JsonResourceImpl line 93):
setContents(reader.readObject());
is this a bug or intended behaviour?
--
<
http://www.advancedit.com.br/>Att,
Rafael M. Pestano
Desenvolvedor Java Cia. de Processamento de Dados do Rio Grande do Sul
http://rpestano.wordpress.com/
@realpestano <
https://twitter.com/realpestano>
_______________________________________________
forge-dev mailing list
forge-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev
--
*George Gastaldi | Senior Software Engineer*
JBoss Forge Team
T: +55 11 3524-6169
M: +55 47 9711-1000