[forge-dev] Cant set Json array as FileResource content

Rafael Pestano rmpestano at gmail.com
Sun Oct 18 19:33:08 EDT 2015


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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20151018/b9e1c71e/attachment.html 


More information about the forge-dev mailing list