diff --git a/README.md b/README.md
index b97c92b..c19d07f 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ cd api; RUST_LOG=info cargo run
Start your java with
```
java22 -javaagent:$EXCEPTIONAL_PROJECT/exceptional/agent/target/exceptional-agent-1.0-SNAPSHOT.jar
--Dagentlib="$EXCEPTIONAL_PROJECT/rustlib/target/debug/librustlib.dylib"
+-Dagentlib="$EXCEPTIONAL_PROJECT/rustlib/target/release/librustlib.dylib"
--enable-preview --enable-native-access=ALL-UNNAMED
-classpath $YOUR_CLASSPATH YourMain
```
diff --git a/lib/dependency-reduced-pom.xml b/agent/dependency-reduced-pom.xml
similarity index 71%
rename from lib/dependency-reduced-pom.xml
rename to agent/dependency-reduced-pom.xml
index d4cf151..a05d25e 100644
--- a/lib/dependency-reduced-pom.xml
+++ b/agent/dependency-reduced-pom.xml
@@ -6,18 +6,10 @@
1.0-SNAPSHOT
4.0.0
- exceptional-lib
+ exceptional-agent
1.0-SNAPSHOT
-
- maven-compiler-plugin
-
- 22
- 22
- --enable-preview
-
-
maven-shade-plugin
3.2.4
@@ -31,6 +23,34 @@
+
+ maven-compiler-plugin
+
+ 22
+ 22
+ --enable-preview
+
+
+
+ maven-jar-plugin
+ 3.1.0
+
+
+
+ com.github.shautvast.exceptional.Agent
+ true
+ true
+
+
+
+
+
+ maven-surefire-plugin
+ 3.2.3
+
+ -Dagentlib=${project.basedir}/rustlib/target/release/librustlib.dylib
+
+
diff --git a/agent/pom.xml b/agent/pom.xml
index 2ea49d2..cccf4d8 100644
--- a/agent/pom.xml
+++ b/agent/pom.xml
@@ -21,14 +21,35 @@
- org.github.shautvast.exceptional
- exceptional-lib
- 1.0-SNAPSHOT
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.16.0
+
+
+ org.junit.jupiter
+ junit-jupiter
+ RELEASE
+ test
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.2.4
+
+
+ package
+
+ shade
+
+
+
+
+
+
org.apache.maven.plugins
maven-compiler-plugin
@@ -47,14 +68,21 @@
com.github.shautvast.exceptional.Agent
true
true
-
- /Users/Shautvast/dev/exceptional/lib/target/exceptional-lib-1.0-SNAPSHOT.jar
-
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.3
+
+ -Dagentlib=${project.basedir}/rustlib/target/release/librustlib.dylib
+
+
+
\ No newline at end of file
diff --git a/agent/src/main/java/com/github/shautvast/exceptional/Agent.java b/agent/src/main/java/com/github/shautvast/exceptional/Agent.java
index 0917ce2..7f5b56f 100644
--- a/agent/src/main/java/com/github/shautvast/exceptional/Agent.java
+++ b/agent/src/main/java/com/github/shautvast/exceptional/Agent.java
@@ -21,13 +21,22 @@ public class Agent {
// add transformer
instrumentation.addTransformer(new ClassFileTransformer() {
@Override
- public byte[] transform(ClassLoader loader, String className, Class> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
- return injectExceptionLoggerBeforeThrow(className, classfileBuffer);
+ public byte[] transform(ClassLoader loader, String className, Class> classBeingRedefined,
+ ProtectionDomain protectionDomain, byte[] classfileBuffer) {
+ return bytecode(className, classfileBuffer);
}
@Override
public byte[] transform(Module module, ClassLoader loader, String className, Class> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) {
- return injectExceptionLoggerBeforeThrow(className, classfileBuffer);
+ return bytecode(className, classfileBuffer);
+ }
+
+ private static byte[] bytecode(String className, byte[] classfileBuffer) {
+ if (!className.startsWith("com/fasterxml/jackson")) {
+ return injectExceptionLoggerBeforeThrow(className, classfileBuffer);
+ } else {
+ return classfileBuffer;
+ }
}
}, true);
}
diff --git a/lib/src/main/java/com/github/shautvast/exceptional/CircularBufferWriter.java b/agent/src/main/java/com/github/shautvast/exceptional/CircularBufferWriter.java
similarity index 100%
rename from lib/src/main/java/com/github/shautvast/exceptional/CircularBufferWriter.java
rename to agent/src/main/java/com/github/shautvast/exceptional/CircularBufferWriter.java
diff --git a/lib/src/main/java/com/github/shautvast/exceptional/CircularByteBuffer.java b/agent/src/main/java/com/github/shautvast/exceptional/CircularByteBuffer.java
similarity index 100%
rename from lib/src/main/java/com/github/shautvast/exceptional/CircularByteBuffer.java
rename to agent/src/main/java/com/github/shautvast/exceptional/CircularByteBuffer.java
diff --git a/lib/src/main/java/com/github/shautvast/exceptional/ExceptionLogger.java b/agent/src/main/java/com/github/shautvast/exceptional/ExceptionLogger.java
similarity index 100%
rename from lib/src/main/java/com/github/shautvast/exceptional/ExceptionLogger.java
rename to agent/src/main/java/com/github/shautvast/exceptional/ExceptionLogger.java
diff --git a/lib/src/test/java/com/github/shautvast/exceptional/CircularByteBufferTest.java b/agent/src/test/java/com/github/shautvast/exceptional/CircularByteBufferTest.java
similarity index 100%
rename from lib/src/test/java/com/github/shautvast/exceptional/CircularByteBufferTest.java
rename to agent/src/test/java/com/github/shautvast/exceptional/CircularByteBufferTest.java
diff --git a/lib/pom.xml b/lib/pom.xml
deleted file mode 100644
index b4e8b59..0000000
--- a/lib/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
- 4.0.0
-
-
- org.github.shautvast.exceptional
- exceptional-parent
- 1.0-SNAPSHOT
-
-
- exceptional-lib
- 1.0-SNAPSHOT
-
-
- 22
- 22
- UTF-8
-
-
-
- com.fasterxml.jackson.core
- jackson-databind
- 2.16.0
-
-
- org.junit.jupiter
- junit-jupiter
- RELEASE
- test
-
-
- org.postgresql
- postgresql
- 42.6.2
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 22
- 22
- --enable-preview
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 3.2.4
-
-
- package
-
- shade
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 1ea99c0..abdbd18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,9 +10,8 @@
pom
- agent
rustlib
- lib
+ agent
\ No newline at end of file
diff --git a/rustlib/pom.xml b/rustlib/pom.xml
index b68c175..bc66480 100644
--- a/rustlib/pom.xml
+++ b/rustlib/pom.xml
@@ -31,6 +31,7 @@
${project.basedir}/rustlib
build
+ --release
diff --git a/rustlib/src/lib.rs b/rustlib/src/lib.rs
index 3f67226..33ca148 100644
--- a/rustlib/src/lib.rs
+++ b/rustlib/src/lib.rs
@@ -3,7 +3,6 @@ use std::ffi::c_char;
use std::slice;
use reqwest::blocking::Client;
-use tracing::error;
// same value, but different meanings
// TODO find a way to set the buffer size from java.
@@ -45,7 +44,7 @@ pub extern "C" fn buffer_updated(buffer: *mut c_char) {
let result = std::str::from_utf8_unchecked(slice::from_raw_parts(buffer.offset(read_pos).cast::(), len as usize));
_ = client.post("http://localhost:3000/api/stacktraces")
.body(result)
- .send()
+ .send();
}
read_pos += len;
} else {
@@ -57,7 +56,7 @@ pub extern "C" fn buffer_updated(buffer: *mut c_char) {
s.push_str(s2);
_ = client.post("http://localhost:3000/api/stacktraces")
.body(s)
- .send()
+ .send();
}
read_pos = len - remaining;
}