String result = reader.readLine(); MSIToken msiToken = adapter.deserialize(result, MSIToken.class); return msiToken.accessToken(); } catch (Exception e) {
String result = reader.readLine(); MSIToken msiToken = adapter.deserialize(result, MSIToken.class); return msiToken.accessToken(); } catch (Exception e) {
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"), 100); String result = reader.readLine(); return adapter.deserialize(result, MSIToken.class); } catch (Exception exception) { int responseCode = connection.getResponseCode();
String content = errorBody(response.body()); AzureJacksonAdapter jacksonAdapter = new AzureJacksonAdapter(); CloudError cloudError = jacksonAdapter.deserialize(content, CloudError.class); if (cloudError != null && "MissingSubscriptionRegistration".equals(cloudError.code())) { Pattern pattern = Pattern.compile("/subscriptions/([\\w-]+)/", Pattern.CASE_INSENSITIVE);
String content = errorBody(response.body()); AzureJacksonAdapter jacksonAdapter = new AzureJacksonAdapter(); CloudError cloudError = jacksonAdapter.deserialize(content, CloudError.class); if (cloudError != null && "MissingSubscriptionRegistration".equals(cloudError.code())) { Pattern pattern = Pattern.compile("/subscriptions/([\\w-]+)/", Pattern.CASE_INSENSITIVE);
@Override public Response intercept(Chain chain) throws IOException { if ("PUT".equals(chain.request().method()) && chain.request().url().uri().toString().contains("/resourcegroups/") && LOGGING_CONTEXT.equals(chain.request().header("x-ms-logging-context"))) { String body = bodyToString(chain.request()); ResourceGroupInner rg = adapter.deserialize(body, ResourceGroupInner.class); if (rg == null) { throw new RuntimeException("Failed to deserialize " + body); } Map<String, String> tags = rg.tags(); if (tags == null) { tags = new HashMap<>(); } tags.put("product", "javasdk"); tags.put("cause", "automation"); tags.put("date", DateTime.now(DateTimeZone.UTC).toString()); if (System.getenv("ENV_JOB_NAME") != null) { tags.put("job", System.getenv("ENV_JOB_NAME")); } rg.withTags(tags); String newBody = adapter.serialize(rg); Request newRequest = chain.request().newBuilder() .put(RequestBody.create(chain.request().body().contentType(), newBody)) .header("Content-Length", String.valueOf(newBody.length())).build(); return chain.proceed(newRequest); } return chain.proceed(chain.request()); }