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

fix: update GoogleUtils#getVersion() to use stable logic #1452

Merged
merged 3 commits into from Dec 17, 2019

Conversation

chingor13
Copy link
Collaborator

@chingor13 chingor13 commented Dec 17, 2019

Fixes #1451

@chingor13 chingor13 requested a review from as a code owner Dec 17, 2019
@googlebot googlebot added the cla: yes label Dec 17, 2019
Copy link
Collaborator

@elharo elharo left a comment

[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)

if (inputStream != null) {
final Properties properties = new Properties();
properties.load(inputStream);
version = properties.getProperty("google-api-client.version");
Copy link
Collaborator

@elharo elharo Dec 17, 2019

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.

Copy link
Collaborator Author

@chingor13 chingor13 Dec 17, 2019

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.

Copy link
Collaborator

@elharo elharo Dec 17, 2019

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.

elharo
elharo approved these changes Dec 17, 2019
if (inputStream != null) {
final Properties properties = new Properties();
properties.load(inputStream);
version = properties.getProperty("google-api-client.version");
Copy link
Collaborator

@elharo elharo Dec 17, 2019

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.

@chingor13 chingor13 merged commit 744839f into googleapis:master Dec 17, 2019
6 checks passed
@chingor13 chingor13 deleted the version-constant branch Dec 17, 2019
@Samikay
Copy link

@Samikay Samikay commented Jan 11, 2020

Did this make it into 1.30.7? Cause it's still broken. Or is it because it's minified? I should test that...

 Caused by: java.lang.IllegalStateException: No successful match so far
    at java.util.regex.Matcher.ensureMatch(Matcher.java:1116)
    at java.util.regex.Matcher.group(Matcher.java:382)
    at c.c.b.a.c.a.<clinit>(:66)
    at com.google.api.services.drive.Drive.<clinit>(:44) 
    at com.google.api.services.drive.Drive$Builder.build(:9813) 

Post-edit: Nevermind, proguard issue. Needed this to stop the crash:
-keep class com.google.api.client.googleapis.** { *; }

Sorry about that.

@elharo
Copy link
Collaborator

@elharo elharo commented Jan 11, 2020

related #1467

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

Successfully merging this pull request may close these issues.

5 participants