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

ISPN-14108 StoreMigrator throws NPE with JDBC source store #10285

Merged
merged 1 commit into from Sep 13, 2022

Conversation

ryanemerson
Copy link
Contributor

@wburns
Copy link
Member

wburns commented Aug 31, 2022

Looks fine to me. Will CI cover the NPE if for example the marshaller or factory are an issue?

@ryanemerson
Copy link
Contributor Author

Unfortunately we don't have any test coverage of the JDBC StoreMigrator use-case, which is why the NPE was not detected earlier. I guess we could add a h2 test that populates the DB with some data using the latest JdbcStringBasedStore, then configures the migrator to read from that as the source and write to a SIFS as the target.

@wburns
Copy link
Member

wburns commented Aug 31, 2022

Unfortunately we don't have any test coverage of the JDBC StoreMigrator use-case, which is why the NPE was not detected earlier. I guess we could add a h2 test that populates the DB with some data using the latest JdbcStringBasedStore, then configures the migrator to read from that as the source and write to a SIFS as the target.

If it isn't too much work, sure. Otherwise, I guess I am fine with it the way it is.

@ryanemerson
Copy link
Contributor Author

I've added a test and it's a good job I did, as calls to TableManager#size also failed with a NPE.

@ryanemerson ryanemerson force-pushed the ISPN-14108 branch 4 times, most recently from 8fa5937 to 97ee3d8 Compare September 1, 2022 15:52
@tristantarrant
Copy link
Member

There are a couple of JDBC failing tests. Could they be caused by the changes to AbstractTableManager ?

@ryanemerson
Copy link
Contributor Author

There are a couple of JDBC failing tests. Could they be caused by the changes to AbstractTableManager ?

I don't think so. If the tests somehow passed a null ctx then a NPE would have been thrown previously. I have started a new build to be sure.

@ryanemerson
Copy link
Contributor Author

Looks like we're good 👍

ps.setLong(1, System.currentTimeMillis());
rs = ps.executeQuery();
rs.next();
numberOfRows = rs.getInt(1);
Copy link
Member

Choose a reason for hiding this comment

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

We need to close the ps and rs variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're already closed by #close in normal circumstances. I have added an explicit call to #close in the event of an exception.

Copy link
Member

@wburns wburns Sep 7, 2022

Choose a reason for hiding this comment

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

No, they aren't closed in close, because they are reassigned in the lines below. Sorry I wasn't more explicit as to what was exactly wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Argh of course 🤦‍♂️, updated!

@wburns
Copy link
Member

wburns commented Sep 13, 2022

Integrated into main, thanks @ryanemerson !

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