graphhopper icon indicating copy to clipboard operation
graphhopper copied to clipboard

No error when flushing DataAccess that was not created, but cannot load it either

Open easbar opened this issue 4 years ago • 1 comments

In RAMIntDataAccess.java:

    @Test
    public void flushWithoutCreate() {
        DataAccess da = createDataAccess("abc");
        da.setHeader(0, 6);
        assertEquals(6, da.getHeader(0));
        // no error here...
        da.flush();
        da.close();

        DataAccess loaded = createDataAccess("abc");
        // this will fail because we did not call create() before flush()
        assertTrue(loaded.loadExisting());
    }

Should we throw an error when trying to flush before calling create? Or should it just be possible to do this and we have to call create after loadExisting?

easbar avatar Sep 12 '21 21:09 easbar

Should we throw an error when trying to flush before calling create?

Yes, sounds like a good idea. Either loadExisting or create should be called before using the DataAccess.

karussell avatar Sep 13 '21 09:09 karussell