[forge-issues] [JBoss JIRA] (FORGE-2500) Cant set Json array as FileResource content
George Gastaldi (JIRA)
issues at jboss.org
Sun Oct 18 22:04:00 EDT 2015
George Gastaldi created FORGE-2500:
--------------------------------------
Summary: Cant set Json array as FileResource content
Key: FORGE-2500
URL: https://issues.jboss.org/browse/FORGE-2500
Project: Forge
Issue Type: Bug
Components: Parsers / File Manipulation
Affects Versions: 2.20.0.Final
Reporter: George Gastaldi
Assignee: George Gastaldi
Fix For: 2.20.1.Final
I'm trying to set the contents of a FileResource with an unNamed array, example:
{code:java}
FileResource<?> fileResource = root.getChild("test").reify(FileResource.class);
fileResource.setContents("[]"); //same as Json.createArrayBuilder().build().toString()
{code}
here it throws the exception:
{code}
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)
{code}
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());}}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the forge-issues
mailing list