Search code examples
javainfinispan

Infinispan deserialization white list : Class '[I'


I am using Infinispan alongside hibernate on my project and I encountered a strange error log:

ISPN000936: Class '[I' blocked by deserialization white list. Adjust the configuration serialization white list regular expression to include this class

I already have this issue but with normal class name so I could resolve the problem by adding the class to the serialization white-list like this:

globalConfigurationBuilder
        .serialization()
        .marshaller(new JavaSerializationMarshaller())
        .whiteList()
        .addClass(MyClass.class.getName());

but with this strange class name ('[I') I can't do this. I can solve the problem by authorizing all the class in the serialization white-list like this :

globalConfigurationBuilder
        .serialization()
        .marshaller(new JavaSerializationMarshaller())
        .whiteList()
        .addRegexp(".*");

But I would like handle the problem in a more proper way.
Does someone have encountered the same issue and managed to solved it ?


Solution

  • [I is the internal name for an int[], so you can use any of the following:

    .addClass​("[I")
    
    .addClass​(int[].class.getName())
    
    .addClasses(int[].class)
    

    When you have more than one, I'd use the last one, which is a vararg method, e.g.

    .addClasses(MyClass.class,
                FooClass.class,
                BarClass.class,
                int[].class)