Error when getOSMNode

Got the list of edges of map-matching result. Got its internal basenode and adjnode id by

int nodeId = edge.getBaseNode();
int nodeId2 = edge.getAdjNode();

error when

long osmNodeId = hopper.getOSMNode(nodeId);

error info:

[main] ERROR - node_mapping, segments:3, bufIndex:2982656, bytePos:2982656, segPower:0
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2982656
at MapMatchingTest.MyGraphHopper.getOSMNode(

getOSMNode() function in

public long getOSMNode(int internalNodeId) {
    if (internalNodeId >= getGraphHopperStorage().getNodes()){
        return -1;
    long pointer = 8L * internalNodeId;
    nodeMapping.ensureCapacity(pointer + 8L);
    return bitUtil.combineIntsToLong(nodeMapping.getInt(pointer), nodeMapping.getInt(pointer + 4L));

how to solve it?

This looks good. Is the ArrayIndex exception thrown for nodeMapping.getInt? Did you call nodeMapping.create at some earlier point?