Skip to content

Commit 4b6067d

Browse files
committed
Add the class name and serial version uid to the class itself and also, add comments describing the the fields
1 parent 0e379b5 commit 4b6067d

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

redisinsight/ui/src/utils/formatters/bufferFormatters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from 'uiSrc/slices/interfaces'
1414
import { Nullable } from '../types'
1515

16-
ObjectInputStream.RegisterObjectClass(JavaDate, 'java.util.Date', '7523967970034938905')
16+
ObjectInputStream.RegisterObjectClass(JavaDate, JavaDate.ClassName, JavaDate.SerialVersionUID)
1717

1818
const decoder = new TextDecoder('utf-8')
1919
const encoder = new TextEncoder()

redisinsight/ui/src/utils/formatters/java-date.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { ObjectInputStream, JavaSerializable } from 'java-object-serialization'
22

33
export default class JavaDate implements JavaSerializable {
4+
// The class name in the serialized data
5+
static readonly ClassName = 'java.util.Date'
6+
7+
// The serial version UID followed for 'java.util.Date'
8+
static readonly SerialVersionUID = '7523967970034938905'
9+
410
time: bigint = 0n
511

612
readObject(stream: ObjectInputStream): void {

redisinsight/ui/src/utils/tests/formatters/bufferFormatters.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919

2020
try {
2121
// Register JavaDate class for deserialization
22-
ObjectInputStream.RegisterObjectClass(JavaDate, 'java.util.Date', '7523967970034938905')
22+
ObjectInputStream.RegisterObjectClass(JavaDate, JavaDate.ClassName, JavaDate.SerialVersionUID)
2323
// eslint-disable-next-line no-empty
2424
} catch (e) {}
2525

0 commit comments

Comments
 (0)