Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Creating inline views using Ektorp CouchDbRepositorySupport throws NullPointerException when compiling view #84

@bhaskarmurthy

Description

@bhaskarmurthy

I'm using inline views provided by the CouchDbRepositorySupport class from Ektorp.
Whenever the inline view is reference, I get a NullReferenceException at the following line:

TDRouter.java:L1327

        TDViewMapBlock mapBlock = TDView.getCompiler().compileMapFunction(mapSource, language);

Checking the debugger tells me that TDView.getCompiler() is null.

My view repository looks like:

public class BadgeRepository extends CouchDbRepositorySupport<Badge> {
    public BadgeRepository(CouchDbConnector db) {
        super(Badge.class, db);
        initStandardDesignDocument();
    }

    @View(name = "byId", map = "function(doc) { if (doc.groupId && doc.userId) emit([doc.groupId,doc.userId]) }")
    public Badge get(String groupId, String userId) {
        try {
            ViewQuery query = createQuery("byId")
                    .key(ComplexKey.of(groupId, userId));
            List<Badge> result = db.queryView(query, Badge.class);
            if (result.size() > 0) {
                return result.get(0);
            }
        } catch (DocumentNotFoundException e) {
            return null;
        }

        return null;
    }
}

Is this an issue with the TDRouter for TouchDB-Android? or something related to Ektorp?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions