{"record":{"id":"58ef6f4987bea5ff","repo":"qishibo/AnotherRedisDesktopManager","slug":"java-unserialization-is-readonly-now","errorCode":null,"errorMessage":"Java unserialization is readonly now!","messagePattern":"Java unserialization is readonly now!","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/viewers/ViewerJavaSerialize.vue","lineNumber":31,"sourceCode":"    newContent() {\n      try {\n        // ref RedisInsight\n        const result = (new ObjectInputStream(this.content)).readObject();\n\n        if (typeof result !== 'object') {\n          return result;\n        }\n\n        const fields = Array.from(result.fields, ([key, value]) => ({ [key]: value }));\n        return { ...result, fields };\n      } catch (e) {\n        return 'Java unserialize failed!';\n      }\n    },\n  },\n  methods: {\n    getContent() {\n      this.$message.error('Java unserialization is readonly now!');\n      return false;\n    },\n    copyContent() {\n      return this.$refs.editor.getRawContent();\n    },\n  },\n};\n</script>\n","sourceCodeStart":13,"sourceCodeEnd":40,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/viewers/ViewerJavaSerialize.vue#L13-L40","documentation":"Element UI toast deliberately returned by the Java serialization viewer's getContent() — the viewer is read-only by design. Java serialized streams (AC ED 00 05 magic) encode class descriptors and object graphs tied to specific Java classes on the JVM that wrote them; re-serializing an edited structure without the original classes is not possible from JavaScript, so the component blocks writes: getContent() always toasts 'Java unserialization is readonly now!' and returns false. Decoding for display (newContent, returning 'Java unserialize failed!' on failure) and copying raw bytes still work.","triggerScenarios":"Opening a key detected as Java-serialized (e.g. written by a Java service via Jedis/Lettuce sessions or Spring Session), editing the decoded tree, and clicking save — getContent() unconditionally rejects; no input makes the write succeed.","commonSituations":"Java/Spring developers inspecting session or cache payloads expecting inline editing like the JSON viewer; users trying to patch a serialized enum value by hand.","solutions":["Treat the Java-serialize view as read-only; change the value in the Java application that owns it","If you must replace the value, delete the key and write new bytes produced by the JVM","If the payload is actually JSON or another writable format, switch the viewer mode and edit there","Long-term: prefer storing JSON/POJO-as-text in Redis if you need in-place edits"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// viewer contract: getContent() === false blocks the write; check readonly flag first","typeGuard":"const isWritableViewer = (viewer) => viewer.isReadOnly !== true && typeof viewer.getContent === 'function';","tryCatchPattern":null,"preventionTips":["Hide save for read-only viewers rather than toasting on click","Produce replacement Java-serialized bytes in the owning JVM and SET them","Prefer JSON payloads in Redis when in-place editing is a requirement"],"tags":["java-serialization","readonly-viewer","vue","redis-viewer"],"backgroundTag":"readonly-format-viewer","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}