Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

writeEnumData raises NPE with empty section.getStride() #1072

Closed
skynet2982 opened this issue Mar 29, 2018 · 2 comments
Closed

writeEnumData raises NPE with empty section.getStride() #1072

skynet2982 opened this issue Mar 29, 2018 · 2 comments

Comments

@skynet2982
Copy link

Hello,

I have a dataset of netcdf4 files and I try to read/write this dataset using netcdf library version 4.6.11

Reading the files works but writing fails on

Nc4Iosp::writeEnumData()

This is an extract of my test

NetcdfFile ncFile = NetcdfFile.open(inputFile.getAbsolutePath());
final Nc4Chunking chunker = Nc4ChunkingStrategy.factory(Strategy.standard, 0, true);
final FileWriter2 fw = new FileWriter2(ncFile, outputFileName, NetcdfFileWriter.Version.netcdf4, chunker);
    fw.write();

The problem comes from Nc4Iosp::writeEnumData().
Line 2946

SizeT[] stride = convertSizeT(section.getStride());

the 'stride' reference is null. This is because method 'convertSizeT' does:

if (from.length == 0) return null;

And just after in writeEnumData their is a loop trying to use 'stride.length' (which in my case is null)

for(int i = 0; i < stride.length; i++)

I will try to provide a fix for this problem.

Regards,
Robin

PS: Unfortunately I cannot provide you the dataset I'm using.

@cwardgar
Copy link
Contributor

Can you provide a similar dataset that demonstrates the bug?

@skynet2982
Copy link
Author

Sorry but I'm not authorized to provide my dataset. I don't have the time to search or build a similar dataset that provokes the NPE.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants