File tree Expand file tree Collapse file tree
trunk/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
2- refs/heads/master: bf3687b1c526aeaa55d31db80f0ef9a5906b1f0f
2+ refs/heads/master: 3d009ca310a49f40f0fa5d7c7861dfc97da8121a
33refs/heads/gh-pages: e987e2a9ec867bfa17876e1e9ff673a9bc2cc085
44refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
55refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
Original file line number Diff line number Diff line change @@ -73,10 +73,11 @@ public static String getAttribute(String attributeName) {
7373 connection .setConnectTimeout (TIMEOUT_MS );
7474 connection .setReadTimeout (TIMEOUT_MS );
7575 connection .setRequestProperty ("Metadata-Flavor" , "Google" );
76- InputStream input = connection .getInputStream ();
77- if (connection .getResponseCode () == 200 ) {
78- try (BufferedReader reader = new BufferedReader (new InputStreamReader (input , UTF_8 ))) {
79- return reader .readLine ();
76+ try (InputStream input = connection .getInputStream ()) {
77+ if (connection .getResponseCode () == 200 ) {
78+ try (BufferedReader reader = new BufferedReader (new InputStreamReader (input , UTF_8 ))) {
79+ return reader .readLine ();
80+ }
8081 }
8182 }
8283 } catch (IOException ignore ) {
You can’t perform that action at this time.
0 commit comments