-
Notifications
You must be signed in to change notification settings - Fork 702
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
fix: update GoogleUtils#getVersion() to use stable logic #1452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 s <<< FAILURE! - in com.google.api.client.googleapis.services.json.CommonGoogleJsonClientRequestInitializerTest
[ERROR] testInitialize(com.google.api.client.googleapis.services.json.CommonGoogleJsonClientRequestInitializerTest) Time elapsed: 0 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class com.google.api.client.googleapis.GoogleUtils
at com.google.api.client.googleapis.services.json.CommonGoogleJsonClientRequestInitializerTest.testInitialize(CommonGoogleJsonClientRequestInitializerTest.java:47)
google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java
Show resolved
Hide resolved
google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java
Outdated
Show resolved
Hide resolved
google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java
Show resolved
Hide resolved
if (inputStream != null) { | ||
final Properties properties = new Properties(); | ||
properties.load(inputStream); | ||
version = properties.getProperty("google-api-client.version"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be null. You should supply a default here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Moved the default to the return statement while checking for null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you could write
version = properties.getProperty("google-api-client.version". "unknown-version");
up to you.
if (inputStream != null) { | ||
final Properties properties = new Properties(); | ||
properties.load(inputStream); | ||
version = properties.getProperty("google-api-client.version"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you could write
version = properties.getProperty("google-api-client.version". "unknown-version");
up to you.
Did this make it into 1.30.7? Cause it's still broken. Or is it because it's minified? I should test that...
Post-edit: Nevermind, proguard issue. Needed this to stop the crash: Sorry about that. |
related #1467 |
Fixes #1451