diff --git a/AppInsights Java.iml b/AppInsights Java.iml index 83217bc63cf..de6d974c427 100644 --- a/AppInsights Java.iml +++ b/AppInsights Java.iml @@ -1,5 +1,5 @@ - + @@ -14,9 +14,8 @@ - - + + - - + \ No newline at end of file diff --git a/Core/Core.iml b/Core/Core.iml index 5d96d9c26c1..2f38486104a 100644 --- a/Core/Core.iml +++ b/Core/Core.iml @@ -1,5 +1,5 @@ - + @@ -14,13 +14,12 @@ - - - - - - - + + + + + + + - - + \ No newline at end of file diff --git a/Core/src/main/java/com/microsoft/applicationinsights/channel/SimpleHttpChannel.java b/Core/src/main/java/com/microsoft/applicationinsights/channel/SimpleHttpChannel.java index 6b3b3b32e90..a6a4ff6bea6 100644 --- a/Core/src/main/java/com/microsoft/applicationinsights/channel/SimpleHttpChannel.java +++ b/Core/src/main/java/com/microsoft/applicationinsights/channel/SimpleHttpChannel.java @@ -50,15 +50,31 @@ public void send(Telemetry item) CloseableHttpClient httpClient = HttpClients.createDefault(); - try (CloseableHttpResponse response = httpClient.execute(request)) + CloseableHttpResponse response = null; + try { + response = httpClient.execute(request); HttpEntity respEntity = response.getEntity(); if (respEntity != null) respEntity.getContent().close(); if (developerMode) System.out.println("Status: " + response.getStatusLine()); } - + catch (IOException ioe) + { + ioe.printStackTrace(System.err); + try + { + if (response != null) + { + response.close(); + } + } + catch (IOException ioeIn) + { + ioeIn.printStackTrace(System.err); + } + } } catch (IOException ioe) { diff --git a/Core/src/main/java/com/microsoft/applicationinsights/datacontracts/ExceptionTelemetry.java b/Core/src/main/java/com/microsoft/applicationinsights/datacontracts/ExceptionTelemetry.java index a68e90d5e9d..98361371b83 100644 --- a/Core/src/main/java/com/microsoft/applicationinsights/datacontracts/ExceptionTelemetry.java +++ b/Core/src/main/java/com/microsoft/applicationinsights/datacontracts/ExceptionTelemetry.java @@ -191,7 +191,7 @@ private void serialize(StackFrame frame, JsonWriter writer) throws IOException private void updateException(Exception exception) { - ArrayList exceptions = new ArrayList<>(); + ArrayList exceptions = new ArrayList(); convertExceptionTree(exception, null, exceptions); this.data.setExceptions(exceptions); diff --git a/Core/src/main/java/com/microsoft/applicationinsights/extensibility/TelemetryConfiguration.java b/Core/src/main/java/com/microsoft/applicationinsights/extensibility/TelemetryConfiguration.java index 28261a276aa..3e69325ccec 100644 --- a/Core/src/main/java/com/microsoft/applicationinsights/extensibility/TelemetryConfiguration.java +++ b/Core/src/main/java/com/microsoft/applicationinsights/extensibility/TelemetryConfiguration.java @@ -16,7 +16,7 @@ public class TelemetryConfiguration private String instrumentationKey; - private final List contextInitializers = new ArrayList<>(); + private final List contextInitializers = new ArrayList(); private TelemetryChannel channel; private boolean trackingIsDisabled = true; diff --git a/build.gradle b/build.gradle index 9314ea39303..a2c8fa63974 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,3 @@ - apply plugin: 'java' jar { diff --git a/src/main/java/com/microsoft/applicationinsights/tests/manual/Program.java b/src/main/java/com/microsoft/applicationinsights/tests/manual/Program.java index 3a7f4cc8587..90a469cd6c8 100644 --- a/src/main/java/com/microsoft/applicationinsights/tests/manual/Program.java +++ b/src/main/java/com/microsoft/applicationinsights/tests/manual/Program.java @@ -16,7 +16,7 @@ public static void main(String[] args) throws IOException TelemetryClient appInsights = new TelemetryClient(); appInsights.getContext().getProperties().put("programmatic", "works"); - Map metrics = new HashMap<>(); + Map metrics = new HashMap(); metrics.put("Answers", (double)15); appInsights.trackEvent("A test event", null, metrics);