Skip to content

Commit

Permalink
Merge pull request #181 from bugsnag/release-v3.6.4
Browse files Browse the repository at this point in the history
Release v3.6.4
  • Loading branch information
yousif-bugsnag authored Jul 12, 2022
2 parents b163992 + a762451 commit 885bcaa
Show file tree
Hide file tree
Showing 65 changed files with 646 additions and 587 deletions.
33 changes: 33 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,36 @@ steps:
plugins:
- docker-compose#v3.7.0:
run: license-audit

- label: ':docker: Assemble project'
key: 'java-jvm-build'
timeout_in_minutes: 30
plugins:
- docker-compose#v3.7.0:
run: java-common
command: './gradlew :bugsnag:assemble :bugsnag-spring:assemble'

- label: ':docker: Run JVM tests'
key: 'java-jvm-tests'
timeout_in_minutes: 30
plugins:
- docker-compose#v3.7.0:
run: java-common
command: './gradlew check test'

- label: ':docker: Mazerunner tests batch 1'
key: 'java-mazerunner-tests-1'
timeout_in_minutes: 30
plugins:
- docker-compose#v3.7.0:
run: java-mazerunner
command: 'bundle exec maze-runner --exclude=features/[^a-m].*.feature'

- label: ':docker: Mazerunner tests batch 2'
key: 'java-mazerunner-tests-2'
timeout_in_minutes: 30
plugins:
- docker-compose#v3.7.0:
pull: java-mazerunner
run: java-mazerunner
command: 'bundle exec maze-runner --exclude=features/[^n-z].*.feature'
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 3.6.4 (2022-07-12)

* Support log messages that use `{}` formatting
[#178](https://github.com/bugsnag/bugsnag-java/pull/178)

* Fix potential hang when resolving DNS hostname
[#179](https://github.com/bugsnag/bugsnag-java/pull/179)

* Bump Jackson from 2.12.5 and JUnit from 4.12 for critical vulnerability fixes
[#180](https://github.com/bugsnag/bugsnag-java/pull/180)

## 3.6.3 (2021-10-12)

* Bump Jackson from 2.9.1 for critical vulnerability fixes
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

gem 'bugsnag-maze-runner', :git => 'https://github.com/bugsnag/maze-runner', :branch => 'v1'
gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner', tag: 'v6.8.0'
gem 'os'
122 changes: 88 additions & 34 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,48 +1,102 @@
GIT
remote: https://github.com/bugsnag/maze-runner
revision: ba232513f88c18149ab5b4595c9f5a81174bdee5
revision: fe12189f83aad154f54221ee0fcd41b483d3c0d1
tag: v6.8.0
specs:
bugsnag-maze-runner (1.0.0)
cucumber (~> 3.1.0)
cucumber-expressions (= 5.0.15)
minitest (~> 5.0)
bugsnag-maze-runner (6.8.0)
appium_lib (~> 11.2.0)
bugsnag (~> 6.24)
cucumber (~> 7.1)
cucumber-expressions (~> 6.0.0)
curb (~> 0.9.6)
optimist (~> 3.0.1)
os (~> 1.0.0)
rack (~> 2.0.0)
rake (~> 12.3.0)
test-unit (~> 3.2.0)
rake (~> 12.3.3)
rubyzip (~> 2.3.2)
selenium-webdriver (~> 3.11)
test-unit (~> 3.5.2)
webrick (~> 1.7.0)

GEM
remote: https://rubygems.org/
specs:
backports (3.11.4)
builder (3.2.3)
cucumber (3.1.0)
builder (>= 2.1.2)
cucumber-core (~> 3.1.0)
cucumber-expressions (~> 5.0.4)
cucumber-wire (~> 0.0.1)
diff-lcs (~> 1.3)
gherkin (~> 5.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
cucumber-core (3.1.0)
backports (>= 3.8.0)
cucumber-tag_expressions (~> 1.1.0)
gherkin (>= 5.0.0)
cucumber-expressions (5.0.15)
cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
diff-lcs (1.3)
gherkin (5.1.0)
minitest (5.11.3)
multi_json (1.13.1)
appium_lib (11.2.0)
appium_lib_core (~> 4.1)
nokogiri (~> 1.8, >= 1.8.1)
tomlrb (~> 1.1)
appium_lib_core (4.7.1)
faye-websocket (~> 0.11.0)
selenium-webdriver (~> 3.14, >= 3.14.1)
bugsnag (6.24.1)
concurrent-ruby (~> 1.0)
builder (3.2.4)
childprocess (3.0.0)
concurrent-ruby (1.1.9)
cucumber (7.1.0)
builder (~> 3.2, >= 3.2.4)
cucumber-core (~> 10.1, >= 10.1.0)
cucumber-create-meta (~> 6.0, >= 6.0.1)
cucumber-cucumber-expressions (~> 14.0, >= 14.0.0)
cucumber-gherkin (~> 22.0, >= 22.0.0)
cucumber-html-formatter (~> 17.0, >= 17.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
cucumber-wire (~> 6.2, >= 6.2.0)
diff-lcs (~> 1.4, >= 1.4.4)
mime-types (~> 3.3, >= 3.3.1)
multi_test (~> 0.1, >= 0.1.2)
sys-uname (~> 1.2, >= 1.2.2)
cucumber-core (10.1.0)
cucumber-gherkin (~> 22.0, >= 22.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
cucumber-tag-expressions (~> 4.0, >= 4.0.2)
cucumber-create-meta (6.0.4)
cucumber-messages (~> 17.1, >= 17.1.1)
sys-uname (~> 1.2, >= 1.2.2)
cucumber-cucumber-expressions (14.0.0)
cucumber-expressions (6.0.1)
cucumber-gherkin (22.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
cucumber-html-formatter (17.0.0)
cucumber-messages (~> 17.1, >= 17.1.0)
cucumber-messages (17.1.1)
cucumber-tag-expressions (4.1.0)
cucumber-wire (6.2.0)
cucumber-core (~> 10.1, >= 10.1.0)
cucumber-cucumber-expressions (~> 14.0, >= 14.0.0)
cucumber-messages (~> 17.1, >= 17.1.1)
curb (0.9.11)
diff-lcs (1.5.0)
eventmachine (1.2.7)
faye-websocket (0.11.1)
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1)
ffi (1.15.4)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.1115)
mini_portile2 (2.6.1)
multi_test (0.1.2)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
optimist (3.0.1)
os (1.0.0)
power_assert (1.1.3)
rack (2.0.6)
rake (12.3.1)
test-unit (3.2.8)
power_assert (2.0.1)
racc (1.6.0)
rake (12.3.3)
rubyzip (2.3.2)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
sys-uname (1.2.2)
ffi (~> 1.1)
test-unit (3.5.3)
power_assert
tomlrb (1.3.0)
webrick (1.7.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)

PLATFORMS
ruby
Expand Down
2 changes: 1 addition & 1 deletion bugsnag-spring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies {
compileOnly "org.springframework.boot:spring-boot:${springBootVersion}"
compileOnly "ch.qos.logback:logback-core:${logbackVersion}"

testCompile "junit:junit:4.12"
testCompile "junit:junit:4.13.2"
testCompile "javax.servlet:javax.servlet-api:${servletApiVersion}"
testCompile "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
testCompile "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
Expand Down
4 changes: 2 additions & 2 deletions bugsnag/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ repositories {
}

dependencies {
compile "com.fasterxml.jackson.core:jackson-databind:2.12.5"
compile "com.fasterxml.jackson.core:jackson-databind:2.13.3"
compile "org.slf4j:slf4j-api:1.7.25"
compileOnly "javax.servlet:javax.servlet-api:${servletApiVersion}"
compileOnly("ch.qos.logback:logback-classic:${logbackVersion}") {
exclude group: "org.slf4j"
}

testCompile "junit:junit:4.12"
testCompile "junit:junit:4.13.2"
testCompile "org.slf4j:log4j-over-slf4j:1.7.25"
testCompile "javax.servlet:javax.servlet-api:${servletApiVersion}"
testCompile "org.mockito:mockito-core:2.10.0"
Expand Down
2 changes: 1 addition & 1 deletion bugsnag/src/main/java/com/bugsnag/BugsnagAppender.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void beforeNotify(Report report) {

// Add some data from the logging event
report.addToTab("Log event data",
"Message", event.getMessage());
"Message", event.getFormattedMessage());
report.addToTab("Log event data",
"Logger name", event.getLoggerName());

Expand Down
2 changes: 1 addition & 1 deletion bugsnag/src/main/java/com/bugsnag/Notifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Notifier {

private static final String NOTIFIER_NAME = "Bugsnag Java";
private static final String NOTIFIER_VERSION = "3.6.3";
private static final String NOTIFIER_VERSION = "3.6.4";
private static final String NOTIFIER_URL = "https://github.com/bugsnag/bugsnag-java";

private String notifierName = NOTIFIER_NAME;
Expand Down
41 changes: 36 additions & 5 deletions bugsnag/src/main/java/com/bugsnag/callbacks/DeviceCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Locale;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class DeviceCallback implements Callback {

private static volatile String hostname;
private static transient volatile boolean hostnameInitialised;
private static volatile boolean hostnameInitialised;
private static final Object LOCK = new Object();
private static final int HOSTNAME_LOOKUP_TIMEOUT = 10000;

/**
* Memoises the hostname, as lookup can be expensive
Expand Down Expand Up @@ -39,17 +45,42 @@ private static String lookupHostname() {
return hostname;
}

// Resort to dns hostname lookup
// Resort to dns hostname lookup with a timeout of HOSTNAME_LOOKUP_TIMEOUT,
// as this can potentially take a very long time to resolve
FutureTask<String> future = new FutureTask<String>(new Callable<String>() {
@Override
public String call() throws UnknownHostException {
return InetAddress.getLocalHost().getHostName();
}
});
Thread resolverThread = new Thread(future, "Hostname Resolver");
resolverThread.setDaemon(true);
resolverThread.start();

try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException ex) {
return future.get(HOSTNAME_LOOKUP_TIMEOUT, TimeUnit.MILLISECONDS);
} catch (ExecutionException ex) {
// Give up
} catch (InterruptedException ex) {
// Give up
} catch (TimeoutException ex) {
// Give up
}
return null;
}

/**
* Cache the hostname on a background thread to avoid blocking on initialization
*/
public static void initializeCache() {
getHostnameValue();
Thread hostnameLookup = new Thread("Hostname Lookup") {
@Override
public void run() {
getHostnameValue();
}
};
hostnameLookup.setDaemon(true);
hostnameLookup.start();
}

@Override
Expand Down
25 changes: 25 additions & 0 deletions bugsnag/src/test/java/com/bugsnag/AppenderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
public class AppenderTest {

private static final Logger LOGGER = Logger.getLogger(AppenderTest.class);

private static final org.slf4j.Logger SLF_LOGGER = LoggerFactory.getLogger(AppenderTest.class);

private StubNotificationDelivery delivery;
private StubSessionDelivery sessionDelivery;
private Delivery originalDelivery;
Expand Down Expand Up @@ -87,6 +90,28 @@ public void testSimpleException() {
getMetaDataMap(notification, "Log event data").get("Message"));
}

@Test
public void testFormattedMessage() {
int value = 1234;

// Send a test log
SLF_LOGGER.warn("Test exception, errorCode: {}", value, new RuntimeException("test"));

String message = "no exception";
// Send a log with no exception
SLF_LOGGER.warn("Test log with {}", message);

// Check that one report was sent to Bugsnag
assertEquals(1, delivery.getNotifications().size());

// Check the correct event was created
Notification notification = delivery.getNotifications().get(0);
assertEquals("test", notification.getEvents().get(0).getExceptionMessage());
assertEquals(Severity.WARNING.getValue(), notification.getEvents().get(0).getSeverity());
assertEquals("Test exception, errorCode: " + value,
getMetaDataMap(notification, "Log event data").get("Message"));
}

@Test
public void testExceptionSeverities() {

Expand Down
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ services:
build:
context: .
dockerfile: dockerfiles/Dockerfile.license-audit
java-common:
build:
context: .
dockerfile: dockerfiles/Dockerfile.java-common
java-mazerunner:
build:
context: .
dockerfile: dockerfiles/Dockerfile.java-mazerunner
Loading

0 comments on commit 885bcaa

Please sign in to comment.