Skip to content

Query can be null and thrown an NPE in the CLI #637

@esteban

Description

@esteban

I've been trying to find out why the analytics jar is failing now and it seems that it was caused by 349afd7 it looks like in PropertyManagement it doesn't check if the value is null and we attempt to convert it:

private Serializable convertIfNecessary(
            final ParameterEnum property,
            final Object value )
            throws Exception {

        if (!(value instanceof Serializable)) {
            for (@SuppressWarnings("rawtypes")
            final PropertyConverter converter : converters) {
                if (converter.baseClass().isAssignableFrom(
                        property.getHelper().getBaseClass())) {
                    return converter.convert(value);
                }
            }
        }

Digging further, in PersistenceUtils.toBinary() it neither checks if persistable is null and we throw the NPE in persistable.getClass():

public static byte[] toBinary(
            final Persistable persistable ) {
        // preface the payload with the class name and a length of the class
        // name
        final byte[] className = StringUtils.stringToBinary(persistable.getClass().getName());
        final byte[] persistableBinary = persistable.toBinary();
        final int classNameLength = className.length;
        final ByteBuffer buf = ByteBuffer.allocate(4 + classNameLength + persistableBinary.length);
        buf.putInt(classNameLength);
        buf.put(className);
        buf.put(persistableBinary);
        return buf.array();
    }

I'm not too familiar with geowave but I'd expect that if there is no -eq value passed in to the CLI it should use a default query. Also I tried to pass a query with no luck.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions