Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repositories {
}

group 'io.sqreen'
version '17.1.0'
version '17.2.0'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down
11 changes: 8 additions & 3 deletions src/main/c/waf_jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ static bool _cache_methods(JNIEnv *env)
"Ljava/lang/String;"
"Ljava/util/Map;"
"Ljava/util/Map;"
"ZJ"
"Ljava/lang/Boolean;J"
"Z)V",
JMETHOD_CONSTRUCTOR)) {
goto error;
Expand Down Expand Up @@ -2213,9 +2213,14 @@ static jobject _create_result_checked(JNIEnv *env, DDWAF_RET_CODE code,

// Get keep and duration from the ddwaf_object structure
const ddwaf_object *keep_obj = ddwaf_object_find(ddwaf_result, "keep", 4);
jboolean keep = JNI_TRUE; // Default to true when NULL/missing
jobject keep = NULL; // Default to NULL
if (keep_obj != NULL && keep_obj->type == DDWAF_OBJ_BOOL) {
keep = (jboolean) ddwaf_object_get_bool(keep_obj);
jboolean keep_value = (jboolean) ddwaf_object_get_bool(keep_obj);
jclass boolean_class = JNI(FindClass, "java/lang/Boolean");
jmethodID boolean_valueOf = JNI(GetStaticMethodID, boolean_class,
"valueOf", "(Z)Ljava/lang/Boolean;");
keep = JNI(CallStaticObjectMethod, boolean_class, boolean_valueOf,
keep_value);
}

const ddwaf_object *duration_obj =
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/datadog/ddwaf/Waf.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static class ResultWithData {
public final String data;
public final Map<String, Map<String, Object>> actions;
public final Map<String, Object> attributes;
public final boolean keep;
public final Boolean keep;
public final long duration; // in nanoseconds
public final boolean events;

Expand All @@ -113,7 +113,7 @@ public ResultWithData(
String data,
Map<String, Map<String, Object>> actions,
Map<String, Object> attributes,
boolean keep,
Boolean keep,
long duration,
boolean events) {
this.result = result;
Expand Down