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

Fixes #1451

@chingor13 chingor13 requested a review from a team as a code owner December 17, 2019 19:11
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 17, 2019
Copy link
Contributor

@elharo elharo left a 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)

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

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

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
Contributor

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");
Copy link
Contributor

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
@chingor13 chingor13 deleted the version-constant branch December 17, 2019 23:28
@Samikay
Copy link

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
Contributor

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 This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android/Java 1.30.6 causing crash due to PR #1419
5 participants