We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fastjson2 2.0.28一直到最新版本,在对json字符串反序列化的时候,如果有字段为字符串"1",并且在反序列化之前对相应字符串做过以下操作时, 然后再序列化时读取不到值
public class TestFastJson { public static void main(String[] args) { User user = new User(); user.setId("test1"); user.setName("1"); user.setPassword("1"); String str1 = JSONObject.toJSONString(user); JSONObject jsonObject = JSONObject.parseObject(str1); // 模拟清理内存中的密码 clearPassword(jsonObject.getString("password")); JSONObject jsonObject2 = JSONObject.parseObject(str1); } private static void clearPassword(String pw) { try { Field field = String.class.getDeclaredField("value"); field.setAccessible(true); char[] value = (char[]) field.get(pw); Arrays.fill(value,'\u0000'); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } }
希望能够正常反序列化,业务代码经常会有清除内存敏感数据的场景,不确定是否还有别的问题,希望能够解答问题的具体原因,十分感谢
The text was updated successfully, but these errors were encountered:
这种引发的bug太奇怪了,目前没有计划去排查和修复,既然做了这样魔改,问题你要自己去诊断
Sorry, something went wrong.
No branches or pull requests
问题描述
fastjson2 2.0.28一直到最新版本,在对json字符串反序列化的时候,如果有字段为字符串"1",并且在反序列化之前对相应字符串做过以下操作时,
然后再序列化时读取不到值
环境信息
重现步骤
读取不到所有值为“1”的字段了
【测试代码】
期待的正确结果
希望能够正常反序列化,业务代码经常会有清除内存敏感数据的场景,不确定是否还有别的问题,希望能够解答问题的具体原因,十分感谢
The text was updated successfully, but these errors were encountered: