Skip to content

Commit 188ea20

Browse files
Merge pull request #98 from bugsnag/next
v3.2.1
2 parents b17d7f3 + 646f862 commit 188ea20

14 files changed

Lines changed: 57 additions & 22 deletions

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 3.2.1 (2018-08-21)
4+
5+
* Add null check when disconnecting HttpUrlConnection
6+
[#92](https://github.com/bugsnag/bugsnag-java/pull/92)
7+
8+
* Make constructors public for SyncHttpDelivery
9+
[#97](https://github.com/bugsnag/bugsnag-java/pull/97)
10+
311
## 3.2.0 (2018-07-03)
412

513
This release introduces automatic tracking of sessions, which by

build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,10 @@ test {
4444
checkstyle {
4545
toolVersion = "6.16"
4646
}
47+
48+
gradle.projectsEvaluated {
49+
tasks.withType(JavaCompile) {
50+
// fail build on warnings, disable options complaining about Java 6 compatibility when building with JDK 7+
51+
options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-options"
52+
}
53+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=3.2.0
1+
version=3.2.1
22
group=com.bugsnag
33

44
# Default properties

src/main/java/com/bugsnag/MetaData.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import java.util.Map;
55

66
class MetaData extends HashMap<String, Object> {
7+
private static final long serialVersionUID = 2530038179702722770L;
8+
79
public void addToTab(String tabName, String key, Object value) {
810
Map<String, Object> tab = getTab(tabName);
911
tab.put(key, value);

src/main/java/com/bugsnag/Notifier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class Notifier {
66
private static final String NOTIFIER_NAME = "Bugsnag Java";
7-
private static final String NOTIFIER_VERSION = "3.2.0";
7+
private static final String NOTIFIER_VERSION = "3.2.1";
88
private static final String NOTIFIER_URL = "https://github.com/bugsnag/bugsnag-java";
99

1010
@Expose

src/main/java/com/bugsnag/Report.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,22 @@ public String getContext() {
9999
}
100100

101101
@Expose
102-
public Map getApp() {
102+
public Map<String, Object> getApp() {
103103
return diagnostics.app;
104104
}
105105

106106
@Expose
107-
public Map getDevice() {
107+
public Map<String, Object> getDevice() {
108108
return diagnostics.device;
109109
}
110110

111111
@Expose
112-
public Map getUser() {
112+
public Map<String, String> getUser() {
113113
return diagnostics.user;
114114
}
115115

116116
@Expose
117-
public Map getMetaData() {
117+
public Map<String, Object> getMetaData() {
118118
return new FilteredMap(diagnostics.metaData, Arrays.asList(config.filters));
119119
}
120120

src/main/java/com/bugsnag/callbacks/ServletCallback.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ private String getClientIp(HttpServletRequest request) {
6161

6262
private Map<String, String> getHeaderMap(HttpServletRequest request) {
6363
Map<String, String> map = new HashMap<String, String>();
64-
Enumeration headerNames = request.getHeaderNames();
64+
Enumeration<String> headerNames = request.getHeaderNames();
6565
while (headerNames.hasMoreElements()) {
66-
String key = (String) headerNames.nextElement();
66+
String key = headerNames.nextElement();
6767
map.put(key, request.getHeader(key));
6868
}
6969

src/main/java/com/bugsnag/delivery/SyncHttpDelivery.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,21 @@ public class SyncHttpDelivery implements HttpDelivery {
2222
public static final String DEFAULT_SESSION_ENDPOINT = "https://sessions.bugsnag.com";
2323
protected static final int DEFAULT_TIMEOUT = 5000;
2424

25-
protected String endpoint = DEFAULT_NOTIFY_ENDPOINT;
25+
protected String endpoint;
2626
protected int timeout = DEFAULT_TIMEOUT;
2727
protected Proxy proxy;
2828

29-
SyncHttpDelivery(String endpoint) {
29+
/**
30+
* Creates a new instance, which defaults to the https://notify.bugsnag.com endpoint
31+
*/
32+
public SyncHttpDelivery() {
33+
this(SyncHttpDelivery.DEFAULT_NOTIFY_ENDPOINT);
34+
}
35+
36+
/**
37+
* Creates a new instance, which uses a custom endpoint
38+
*/
39+
public SyncHttpDelivery(String endpoint) {
3040
this.endpoint = endpoint;
3141
}
3242

@@ -97,7 +107,9 @@ public void deliver(Serializer serializer, Object object, Map<String, String> he
97107
} catch (IOException ex) {
98108
logger.warn("Error not reported to Bugsnag - exception when making request", ex);
99109
} finally {
100-
connection.disconnect();
110+
if (connection != null) {
111+
connection.disconnect();
112+
}
101113
}
102114
}
103115

src/main/java/com/bugsnag/serialization/SerializationException.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.bugsnag.serialization;
22

33
public class SerializationException extends Exception {
4+
private static final long serialVersionUID = -6782171186575335048L;
5+
46
public SerializationException(String message, Throwable cause) {
57
super(message, cause);
68
}

src/main/java/com/bugsnag/util/FilteredMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ public Set<Entry<String, Object>> entrySet() {
9999
return filteredCopy.entrySet();
100100
}
101101

102+
@SuppressWarnings("unchecked")
102103
private Object transformEntry(Object key, Object value) {
103104
if (value instanceof Map) {
104-
//noinspection unchecked
105105
return new FilteredMap((Map<String, Object>) value, keyFilters);
106106
}
107107
return shouldFilterKey((String) key) ? FILTERED_PLACEHOLDER : value;

0 commit comments

Comments
 (0)