Skip to content

Commit

Permalink
add 'java.security.ProtectionDomain' to ignore properties
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed May 11, 2024
1 parent a3ea6c9 commit 77c1c44
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public abstract class BeanUtils {
-4863137578837233966L,
-3653547262287832698L,
-2819277587813726773L,
-2458634727370886912L,
-2291619803571459675L,
-1811306045128064037L,
-864440709753525476L,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.alibaba.fastjson2.issues_2500;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import org.junit.jupiter.api.Test;

import java.security.ProtectionDomain;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

public class Issue2562 {
@Test
public void test() {
Bean bean = new Bean();
String str = JSON.toJSONString(bean);
assertEquals("{}", str);
}

@Test
public void test1() {
String str = JSONObject.of("", new JSONObject()).toJSONString();
Bean bean = JSON.parseObject(str, Bean.class);
assertNotNull(bean);
}

public static class Bean {
public ProtectionDomain getProtectionDomain() {
throw new IllegalStateException();
}

public void setProtectionDomain(ProtectionDomain protectionDomain) {
throw new IllegalStateException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ public void buildIgnores() {
"org.mockito.internal.creation.bytebuddy.MockMethodInterceptor",
"sun.nio.ch.FileChannelImpl",
"java.io.InputStream",
"java.util.concurrent.locks.ReentrantLock"
"java.util.concurrent.locks.ReentrantLock",
"java.security.ProtectionDomain"
};

long[] hashCodes = new long[names.length];
Expand Down

0 comments on commit 77c1c44

Please sign in to comment.