abhijeetjais20 / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Object with a byte[] attribute for storing images cannot be converted to Object from JSON #497

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create this POJO (this is generated by Hibernate reverse engineering tool)

package com.alinean.network.orm.entities;
// Generated Nov 29, 2012 4:41:16 PM by Hibernate Tools 3.2.1.GA

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * Community generated by hbm2java
 */
@Entity
@Table(name="community"
    ,catalog="network"
)
public class Community  implements java.io.Serializable {

     private String communityId;
     private String name;
     private byte status;
     private boolean privateCommunity;
     private String blacklist;
     private String manager;
     private String networkContact;
     private boolean allowDisclosureLevel;
     private String disclosureText;
     private long createdTimestamp;
     private Long modifiedTimestamp;
     private Long expirationTimestamp;
     private byte[] brandingLogo;
     private Set<UserCommunityDisclosure> userCommunityDisclosures = new HashSet<UserCommunityDisclosure>(0);
     private Set<CommunityRegistration> communityRegistrations = new HashSet<CommunityRegistration>(0);
     private Set<CommunityActionResponse> communityActionResponses = new HashSet<CommunityActionResponse>(0);
     private Set<UserCommunitySubscription> userCommunitySubscriptions = new HashSet<UserCommunitySubscription>(0);
     private Set<CommunitySubscription> communitySubscriptions = new HashSet<CommunitySubscription>(0);
     private Set<CommunityRole> communityRoles = new HashSet<CommunityRole>(0);
     private Set<VignetteLibrary> vignetteLibraries = new HashSet<VignetteLibrary>(0);
     private Set<Group> groups = new HashSet<Group>(0);

    public Community() {
    }

    public Community(String communityId, String name, byte status, boolean privateCommunity, String manager, String networkContact, boolean allowDisclosureLevel, long createdTimestamp) {
        this.communityId = communityId;
        this.name = name;
        this.status = status;
        this.privateCommunity = privateCommunity;
        this.manager = manager;
        this.networkContact = networkContact;
        this.allowDisclosureLevel = allowDisclosureLevel;
        this.createdTimestamp = createdTimestamp;
    }
    public Community(String communityId, String name, byte status, boolean privateCommunity, String blacklist, String manager, String networkContact, boolean allowDisclosureLevel, String disclosureText, long createdTimestamp, Long modifiedTimestamp, Long expirationTimestamp, byte[] brandingLogo, Set<UserCommunityDisclosure> userCommunityDisclosures, Set<CommunityRegistration> communityRegistrations, Set<CommunityActionResponse> communityActionResponses, Set<UserCommunitySubscription> userCommunitySubscriptions, Set<CommunitySubscription> communitySubscriptions, Set<CommunityRole> communityRoles, Set<VignetteLibrary> vignetteLibraries, Set<Group> groups) {
       this.communityId = communityId;
       this.name = name;
       this.status = status;
       this.privateCommunity = privateCommunity;
       this.blacklist = blacklist;
       this.manager = manager;
       this.networkContact = networkContact;
       this.allowDisclosureLevel = allowDisclosureLevel;
       this.disclosureText = disclosureText;
       this.createdTimestamp = createdTimestamp;
       this.modifiedTimestamp = modifiedTimestamp;
       this.expirationTimestamp = expirationTimestamp;
       this.brandingLogo = brandingLogo;
       this.userCommunityDisclosures = userCommunityDisclosures;
       this.communityRegistrations = communityRegistrations;
       this.communityActionResponses = communityActionResponses;
       this.userCommunitySubscriptions = userCommunitySubscriptions;
       this.communitySubscriptions = communitySubscriptions;
       this.communityRoles = communityRoles;
       this.vignetteLibraries = vignetteLibraries;
       this.groups = groups;
    }

    @Id 
    @GenericGenerator(name="id", strategy="com.alinean.network.orm.generators.RandomUUIDGenerator")
    @GeneratedValue(generator="id")
    @Column(name="community_id", unique=true, nullable=false, length=36)
    public String getCommunityId() {
        return this.communityId;
    }

    public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }

    @Column(name="name", nullable=false, length=128)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name="status", nullable=false)
    public byte getStatus() {
        return this.status;
    }

    public void setStatus(byte status) {
        this.status = status;
    }

    @Column(name="private_community", nullable=false)
    public boolean isPrivateCommunity() {
        return this.privateCommunity;
    }

    public void setPrivateCommunity(boolean privateCommunity) {
        this.privateCommunity = privateCommunity;
    }

    @Column(name="blacklist")
    public String getBlacklist() {
        return this.blacklist;
    }

    public void setBlacklist(String blacklist) {
        this.blacklist = blacklist;
    }

    @Column(name="manager", nullable=false, length=65535)
    public String getManager() {
        return this.manager;
    }

    public void setManager(String manager) {
        this.manager = manager;
    }

    @Column(name="network_contact", nullable=false, length=65535)
    public String getNetworkContact() {
        return this.networkContact;
    }

    public void setNetworkContact(String networkContact) {
        this.networkContact = networkContact;
    }

    @Column(name="allow_disclosure_level", nullable=false)
    public boolean isAllowDisclosureLevel() {
        return this.allowDisclosureLevel;
    }

    public void setAllowDisclosureLevel(boolean allowDisclosureLevel) {
        this.allowDisclosureLevel = allowDisclosureLevel;
    }

    @Column(name="disclosure_text")
    public String getDisclosureText() {
        return this.disclosureText;
    }

    public void setDisclosureText(String disclosureText) {
        this.disclosureText = disclosureText;
    }

    @Column(name="created_timestamp", nullable=false)
    public long getCreatedTimestamp() {
        return this.createdTimestamp;
    }

    public void setCreatedTimestamp(long createdTimestamp) {
        this.createdTimestamp = createdTimestamp;
    }

    @Column(name="modified_timestamp")
    public Long getModifiedTimestamp() {
        return this.modifiedTimestamp;
    }

    public void setModifiedTimestamp(Long modifiedTimestamp) {
        this.modifiedTimestamp = modifiedTimestamp;
    }

    @Column(name="expiration_timestamp")
    public Long getExpirationTimestamp() {
        return this.expirationTimestamp;
    }

    public void setExpirationTimestamp(Long expirationTimestamp) {
        this.expirationTimestamp = expirationTimestamp;
    }

    @Column(name="branding_logo")
    public byte[] getBrandingLogo() {
        return this.brandingLogo;
    }

    public void setBrandingLogo(byte[] brandingLogo) {
        this.brandingLogo = brandingLogo;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="community")
    public Set<UserCommunityDisclosure> getUserCommunityDisclosures() {
        return this.userCommunityDisclosures;
    }

    public void setUserCommunityDisclosures(Set<UserCommunityDisclosure> userCommunityDisclosures) {
        this.userCommunityDisclosures = userCommunityDisclosures;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="community")
    public Set<CommunityRegistration> getCommunityRegistrations() {
        return this.communityRegistrations;
    }

    public void setCommunityRegistrations(Set<CommunityRegistration> communityRegistrations) {
        this.communityRegistrations = communityRegistrations;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="community")
    public Set<CommunityActionResponse> getCommunityActionResponses() {
        return this.communityActionResponses;
    }

    public void setCommunityActionResponses(Set<CommunityActionResponse> communityActionResponses) {
        this.communityActionResponses = communityActionResponses;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="community")
    public Set<UserCommunitySubscription> getUserCommunitySubscriptions() {
        return this.userCommunitySubscriptions;
    }

    public void setUserCommunitySubscriptions(Set<UserCommunitySubscription> userCommunitySubscriptions) {
        this.userCommunitySubscriptions = userCommunitySubscriptions;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="community")
    public Set<CommunitySubscription> getCommunitySubscriptions() {
        return this.communitySubscriptions;
    }

    public void setCommunitySubscriptions(Set<CommunitySubscription> communitySubscriptions) {
        this.communitySubscriptions = communitySubscriptions;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="community")
    public Set<CommunityRole> getCommunityRoles() {
        return this.communityRoles;
    }

    public void setCommunityRoles(Set<CommunityRole> communityRoles) {
        this.communityRoles = communityRoles;
    }
@ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @JoinTable(name="community_vignette_library", catalog="network", uniqueConstraints=@UniqueConstraint(columnNames="vignette_library_id"), joinColumns = { 
        @JoinColumn(name="community_id", nullable=false, updatable=false) }, inverseJoinColumns = { 
        @JoinColumn(name="vignette_library_id", unique=true, nullable=false, updatable=false) })
    public Set<VignetteLibrary> getVignetteLibraries() {
        return this.vignetteLibraries;
    }

    public void setVignetteLibraries(Set<VignetteLibrary> vignetteLibraries) {
        this.vignetteLibraries = vignetteLibraries;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="community")
    public Set<Group> getGroups() {
        return this.groups;
    }

    public void setGroups(Set<Group> groups) {
        this.groups = groups;
    }

    @Override
    public String toString() {
        return "Community{" + 
                "communityId=" + communityId + 
                ", name=" + name + 
                ", status=" + status + 
                ", privateCommunity=" + privateCommunity + 
                ", manager=" + manager + 
                ", networkContact=" + networkContact + 
                ", allowDisclosureLevel=" + allowDisclosureLevel + 
                ", createdTimestamp=" + createdTimestamp + 
                ", modifiedTimestamp=" + modifiedTimestamp + 
                ", expirationTimestamp=" + expirationTimestamp + 
                '}';
    }

}

2. Try to convert a Community object from a JSON text using:
//Convert the JSON string to community
Gson gson = new Gson();
community = gson.fromJson(communityJSON, Community.class);

3. This is the JSON:
"{"communityId":null,"name":"Image6","status":1,"privateCommunity":false,"blackl
ist":null,"manager":"avillalobos@alinean.com","networkContact":"avillalobos@alin
ean.com","allowDisclosureLevel":false,"disclosureText":null,"createdTimestamp":0
,"modifiedTimestamp":null,"expirationTimestamp":null,"brandingLogo":"/9j/4AAQSkZ
JRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAc
HCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAC2AcEDASIAAhEBAxEB/8QAHwAAAQUBAQE
BAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJ
xFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZ
naGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NX
W19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8Q
AtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOE
l8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpO
UlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn
6/9oADAMBAAIRAxEAPwD9DKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiig
AooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiig
AooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiig
AooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiig
AooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiig
AooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiig
AooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiig
AooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiig
AooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAq1odsl5rdnDIu6OWdEYZxkFgCKq1e8M
/8jHp/wD18x/+hCrpq80n3Jn8LPqb/hmXwR/0BP8AycuP/i6+XPF1jFpfivU7aBNkFvdyxRrknaquQBk
89B3r7fr4l8e/8j1rX/X/AD/+jGrFv30vJ/oaL4X/AF3PYf2cvg14a8efD577VtN+13Qu5Ig/2iWP5QF
IGFYDue1d7/wzL4I/6An/AJOXH/xdZP7If/JKJP8Ar/l/9BSof2oviZr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h8Tf+Sb+IP+wdcf8Aotq+K6+8KKxtrc1vpY+D6K+8KKok+D6K2/iV/wAlE17/ALC
E/wD6MasSpjK8UypKzaCiiiqJCiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAo
oooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAt6Nr994dujPp97d2MzLsMlvM0TFc
g4ypBxwOParmo/EHX9YspLa71zV7q3lGHimvJHR+c8gnB5rIooAKKKKACiiigAooooAKKKKACiiigAoo
ooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoo
ooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoo
ooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoo
ooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoo
ooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoo
ooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoo
ooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoo
ooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoo
ooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//2Q==","userCommunityDisclos
ures":[],"communityRegistrations":[],"communityActionResponses":[],"userCommunit
ySubscriptions":[],"communitySubscriptions":[],"communityRoles":[],"vignetteLibr
aries":[],"groups":[]}"

What is the expected output? What do you see instead?
The expected output is the Community Object converted from that JSON, the JSON 
is generated by Spring Web Services like this:

HttpEntity<Community> entity = new HttpEntity<>(community);
ResponseEntity<Community> response = 
restTemplate.postForEntity(getSyncServiceURL("url.sync.community.create"), 
entity, Community.class, userID);

The problem seems to be with the brandingLogo property, which is a byte[] type.

The output is:
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected 
BEGIN_ARRAY but was STRING at line 1 column 5178
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:180)
    at com.google.gson.Gson.fromJson(Gson.java:755)
    at com.google.gson.Gson.fromJson(Gson.java:721)
    at com.google.gson.Gson.fromJson(Gson.java:670)
    at com.google.gson.Gson.fromJson(Gson.java:642)
    at com.alinean.network.remote.CommunityNetworkWebService.createCommunity(CommunityNetworkWebService.java:120)
    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:601)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1483)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1414)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353)
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING 
at line 1 column 5178
    at com.google.gson.stream.JsonReader.expect(JsonReader.java:339)
    at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:306)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:70)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176)
    at com.google.gson.Gson.fromJson(Gson.java:755)
    at com.google.gson.Gson.fromJson(Gson.java:721)
    at com.google.gson.Gson.fromJson(Gson.java:670)
    at com.google.gson.Gson.fromJson(Gson.java:642)
    at com.alinean.network.remote.CommunityNetworkWebService.createCommunity(CommunityNetworkWebService.java:120)
    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:601)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)

What version of the product are you using? On what operating system?
Gson 2.1
Operating System: OS X
Processor:2.2 Ghz Intel Core i7
RAM: 8GB 1333 MHz DDR3

Please provide any additional information below.
The issue only happens when an image is sent in a byte[]

Original issue reported on code.google.com by alevill...@gmail.com on 22 Jan 2013 at 12:03

GoogleCodeExporter commented 9 years ago
Please be more concise and direct in bug reports! I'm not sure what the bug is 
here.

Original comment by limpbizkit on 4 Feb 2013 at 4:07