Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate gives a error.table.bad_field_read error #544

Closed
Tracked by #30
msbentley opened this issue Nov 2, 2022 · 6 comments
Closed
Tracked by #30

validate gives a error.table.bad_field_read error #544

msbentley opened this issue Nov 2, 2022 · 6 comments

Comments

@msbentley
Copy link

🐛 Describe the bug

validate 2.4.0 reading a browse product which previously passed validation gives this error:

  FAIL: file:/Users/mbentley/Downloads/TEST_V1/bc_mpo_mag/browse_calibrated/near_earth_commissioning/sc/ob/scf/mag_cal_sc_browse_ob_s2_scf_00000_20181024.xml
      ERROR  [error.table.bad_field_read]   line 0: Cannot invoke "gov.nasa.arc.pds.xml.generated.ObjectLength.getValue()" because the return value of "gov.nasa.arc.pds.xml.generated.EncodedByteStream.getObjectLength()" is null

📜 To Reproduce

Steps to reproduce the behavior:

  1. validate the attached product

🕵️ Expected behavior

Product passes validation

📚 Version of Software Used

validate 2.4.0

🩺 Test Data / Additional context

mag_cal_sc_browse_example.zip

🏞Screenshots

🖥 System Info

  • OS: macOS
  • Browser N/A
  • Version 12.5.1

🦄 Related requirements

⚙️ Engineering Details

@msbentley msbentley added bug Something isn't working needs:triage labels Nov 2, 2022
@msbentley
Copy link
Author

I also get the same results with validate 3.0.0

@jimmie
Copy link
Member

jimmie commented Nov 3, 2022

PR out for review and approval - needed for validate release.

@nutjob4life
Copy link
Member

Well, even with the newly-released, non-SNAPSHOT pds4-jparser version 2.3.0, this error still occurs.

But I'm out of time for today so I'll have to investigate tomorrow.

@nutjob4life
Copy link
Member

Okay, here's an (interesting?) observation. If I add the indicated line to @msbentley's mag_cal_sc_browse_ob_s4_scf_00000_20181024.xml file …

<Encoded_Image>
    <offset unit="byte">0</offset>
    <object_length unit="byte">12345</object_length> <!-- 👈 this line -->
    <encoding_standard_id>PNG</encoding_standard_id>
</Encoded_Image>

… then validate works just fine.

So I'm suspecting that <object_length> is somehow being marked as "required" when it isn't—or, possibly, it is now required 🤷‍♀️

@nutjob4life
Copy link
Member

In the file Label.java at line 666–669, we have:

    if (stream instanceof EncodedByteStream) {
      EncodedByteStream ebs = (EncodedByteStream) stream;
      size = ebs.getObjectLength().getValue().longValueExact(); // 👈 There's your problem
      offset = ebs.getOffset().getValue().longValueExact();

The getObjectLength() is returning null, so we can't call getValue() on it.

However, this code hasn't changed in … well, in a while! So the assumption it's made that it would never be null was incorrect for some time.

Looking at the src/build/resources/schema files, though, I don't see any place that has <object_length> as required (except in <Parsable_Byte_Stream>s where minOccurs="1").

So something else has changed. Maybe the "object length" had a default value before?

@miguelp1986
Copy link

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

No branches or pull requests

7 participants