Skip to content

Fix: Computation of Raster Metadata Value Length#836

Merged
rfecher merged 2 commits intolocationtech:masterfrom
jamesmcclain:fix/metadata-reading
Jun 22, 2016
Merged

Fix: Computation of Raster Metadata Value Length#836
rfecher merged 2 commits intolocationtech:masterfrom
jamesmcclain:fix/metadata-reading

Conversation

@jamesmcclain
Copy link
Copy Markdown
Member

It appears that the length of raster metadata values is currently being computed incorrectly. The line valueBinary = new byte[entryBinary.length - keyLength] produces an array which is four bytes longer than the actual number of available bytes because the subtraction does not account for the length of the 32-bit integer which is also included in the entry.

That results in errors such as this:

Exception in thread "main" java.nio.BufferUnderflowException
        at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:151)
        at java.nio.ByteBuffer.get(ByteBuffer.java:715)
        at mil.nga.giat.geowave.adapter.raster.adapter.RasterDataAdapter.fromBinary(RasterDataAdapter.java:1395)
        at mil.nga.giat.geowave.core.index.PersistenceUtils.fromBinary(PersistenceUtils.java:96)
        at mil.nga.giat.geowave.datastore.accumulo.metadata.AbstractAccumuloPersistence.entryToValue(AbstractAccumuloPersistence.java:365)
        at mil.nga.giat.geowave.datastore.accumulo.metadata.AbstractAccumuloPersistence$NativeIteratorWrapper.next(AbstractAccumuloPersistence.java:573)
        at mil.nga.giat.geowave.datastore.accumulo.metadata.AbstractAccumuloPersistence$NativeIteratorWrapper.next(AbstractAccumuloPersistence.java:556)
        at mil.nga.giat.geowave.core.store.CloseableIteratorWrapper.next(CloseableIteratorWrapper.java:64)

The present patch attempts to address this issue.

@rfecher rfecher merged commit 1021ab4 into locationtech:master Jun 22, 2016
@jamesmcclain jamesmcclain deleted the fix/metadata-reading branch June 23, 2016 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants