Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7770545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:26:06+00:00 2026-06-01T16:26:06+00:00

I have some problem with the Google’s AutoBean serialization and deserialization. I have an

  • 0

I have some problem with the Google’s AutoBean serialization and deserialization.
I have an AutoBean that contains primitive types and Maps as well. I can serialize and deserialize the primitive types without any problem, but when i try to read the deserialized Map, i get NullPointerException.
Have you ever met with a similar problem before? There is a JUnit test that representes my problem. The first two asserts are passes, but the third fails.

public class AutoBeanTest {

    @Test
    public void test() throws Exception {
        MyFactory myFactory = AutoBeanFactorySource.create(MyFactory.class);

        Options options = myFactory.options().as();
        options.setMyInt(5);
        HashMap<Double, Boolean> map = newHashMap();
        map.put(8.0, true);
        map.put(9.1, false);

        options.setMyMap(map);

        Options deserialized = AutoBeanCodex.decode(myFactory, Options.class, AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(options)).getPayload()).as();
        assertEquals(deserialized.getMyInt(),5);
        assertTrue(options.getMyMap().containsKey(8d));
        assertTrue(deserialized.getMyMap().containsKey(8d));
    }

    public interface MyFactory extends AutoBeanFactory {
        AutoBean<Options> options();
    }

    public interface Options {

        public int getMyInt();

        void setMyInt(int myInt);

        Map<Double, Boolean> getMyMap();

        void setMyMap(Map<Double, Boolean> myMap);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:26:07+00:00Added an answer on June 1, 2026 at 4:26 pm

    I’ve been playing around with the AutoBean functionality a while ago. I think it is still kind a buggy. I’m quite sure the exceptions is caused by a bug in the AutoBean code, not in your code.

    If you run the above sample code in a debugger and check the generated JSON, things look fine. You can even call deserialized.getMyMap().size() and get the correct value, but once you want to access the content errors occur.

    There is a workaround, just use Map<String, String> instead of Double or Boolean and it works…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problem with adding Google Maps to my project. When i get
I have some problem with my open new window popup which it can read
I have some python code for Google App Engine that responds with the string
I have some problem to get the Google Analytics to work. I have got
I have some problem to get lat/lng from google map in my application. When
I have some problem using JSF <h:selectManyListbox> and Google Chrome. When my page is
I have some trobule using Google Maps API on Android. In onLocationChanged() I create
I have some problem with my code public IQueryable<PageItems> GetPageById(Guid Id) { var xml
I have some problem with Jquery Autocomplete plugin ( http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ ) I got it
I have some problem with my .htaccess file. Here I am adding my problem.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.