File tree
Expand file treeCollapse file tree1 file changed
+12
-14
lines changed google-api-client/src/main/java/com/google/api/client/googleapis
Expand file treeCollapse file tree1 file changed
+12
-14
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -89,22 +89,20 @@ public static synchronized KeyStore getCertificateTrustStore()
|
89 | 89 | }
|
90 | 90 |
|
91 | 91 | private static String getVersion() {
|
92 |
| -String version = GoogleUtils.class.getPackage().getImplementationVersion(); |
93 |
| -// in a non-packaged environment (local), there's no implementation version to read |
94 |
| -if (version == null) { |
95 |
| -// fall back to reading from a properties file - note this value is expected to be cached |
96 |
| -try (InputStream inputStream = |
97 |
| -GoogleUtils.class.getResourceAsStream("google-api-client.properties")) { |
98 |
| -if (inputStream != null) { |
99 |
| -Properties properties = new Properties(); |
100 |
| -properties.load(inputStream); |
101 |
| -version = properties.getProperty("google-api-client.version"); |
102 |
| -} |
103 |
| -} catch (IOException e) { |
104 |
| -// ignore |
| 92 | +// attempt to read the library's version from a properties file generated during the build |
| 93 | +// this value should be read and cached for later use |
| 94 | +String version = null; |
| 95 | +try (InputStream inputStream = |
| 96 | +GoogleUtils.class.getResourceAsStream("google-api-client.properties")) { |
| 97 | +if (inputStream != null) { |
| 98 | +Properties properties = new Properties(); |
| 99 | +properties.load(inputStream); |
| 100 | +version = properties.getProperty("google-api-client.version"); |
105 | 101 | }
|
| 102 | +} catch (IOException e) { |
| 103 | +// ignore |
106 | 104 | }
|
107 |
| -return version; |
| 105 | +return version == null ? "unknown-version" : version; |
108 | 106 | }
|
109 | 107 |
|
110 | 108 | private GoogleUtils() {}
|
|
You can’t perform that action at this time.
0 commit comments