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

Handlers #186

Merged
merged 7 commits into from
Aug 7, 2024
Merged

Handlers #186

merged 7 commits into from
Aug 7, 2024

Conversation

ayushsingh01042003
Copy link
Contributor

Description

  • EDDTableFromFilesHandler, EDDTableFromAsciiFilesHandler
  • EDDGridAggregateExistingDimensionHandler
  • EDDGridCopyHandler
  • EDDGridFromEDDTableHandler
  • EDDGridLon0360Handler

Copy link
Contributor

@ChrisJohnNOAA ChrisJohnNOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some additional handling of incorrect xml noted in the comments.

@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
if (localName.equals("dataset")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this throw an exception if it sees a second dataset?

Copy link
Contributor Author

@ayushsingh01042003 ayushsingh01042003 Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the old code specifies throwing an exception on getting a second child dataset,
https://github.com/ERDDAP/erddap/blob/main/WEB-INF/classes/gov/noaa/pfel/erddap/dataset/EDDGridFromEDDTable.java#L113-L127

But I am guessing since the tEDDTable variable will update to the last child dataset which means there is no point in adding multiple, you are implying to add a check so that we only have one child dataset?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, add a check to make sure there's only one child dataset. Allowing multiple to be parsed could cause issues, and I think it's better to catch those early with explicit error messages.

public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
switch (localName) {
case "dataset" -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this throw an exception if it sees a second dataset?

@ayushsingh01042003
Copy link
Contributor Author

How does this look?
I think there are handlers that would need this (all unless there are some that can have multiple child datasets)
If this looks fine I can make the changes to the other ones too.

@ChrisJohnNOAA
Copy link
Contributor

How does this look? I think there are handlers that would need this (all unless there are some that can have multiple child datasets) If this looks fine I can make the changes to the other ones too.

This is good, thanks for adding the checks.

There are some types that can have multiple children (EDDGridSideBySide, EDDTableAggregateRows, EDDGridAggregateExistingDimension).

@srstsavage
Copy link
Contributor

Don't forget the GSoC-2024 label 😁

@ChrisJohnNOAA ChrisJohnNOAA merged commit 51e3c61 into ERDDAP:main Aug 7, 2024
@ayushsingh01042003 ayushsingh01042003 deleted the SAXParser branch August 7, 2024 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants