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

Add createTableIfNotExists methods to clients #14536

Merged
merged 1 commit into from
Aug 31, 2020

Conversation

bsiegel
Copy link
Member

@bsiegel bsiegel commented Aug 27, 2020

Match .NET by adding createTableIfNotExists* methods to the clients.

Fixes: #13683

Class.forName(TableItem.class.getName(), true, TableItem.class.getClassLoader());
} catch (ClassNotFoundException e) {
AssertionError err = new AssertionError("Failed to initialize TablesModelHelper dependency classes.", e);
new ClientLogger(TablesModelHelper.class).logThrowableAsError(err);
Copy link
Member

Choose a reason for hiding this comment

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

I believe the throw should be here

Copy link
Member Author

Choose a reason for hiding this comment

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

That's how it was before but it causes a SpotBugs error. Apparently, a throw block inside a static initializer must throw an AssertionError. However the return type of logThrowableAsError is Throwable. So it complains about an unchecked cast. Since logThrowableAsError just takes a throwable, logs it, and returns the same throwable, I felt this was a better way rather than suppressing the unchecked cast warning.

@bsiegel bsiegel force-pushed the tables-create-if-not-exists branch from 2a6b56d to 72caebc Compare August 31, 2020 17:39
@bsiegel bsiegel merged commit 7fb9af3 into Azure:master Aug 31, 2020
@bsiegel bsiegel deleted the tables-create-if-not-exists branch August 31, 2020 17:54
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.

[Tables] Add createTableIfNotExists
2 participants