Skip to content

Commit

Permalink
fixing base64 dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
sboesebeck committed Apr 5, 2019
1 parent 9cb2b42 commit 734962a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/de/caluga/morphium/ObjectMapperImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import org.json.simple.parser.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import sun.reflect.ReflectionFactory;

import java.io.*;
import java.lang.reflect.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Base64.Decoder;
import java.util.Base64.Encoder;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -221,9 +221,9 @@ public Map<String, Object> serialize(Object o) {
oout.writeObject(o);
oout.flush();

BASE64Encoder enc = new BASE64Encoder();
Encoder enc = Base64.getEncoder();

String str = enc.encode(out.toByteArray());
String str = new String(enc.encode(out.toByteArray()));
obj.setB64Data(str);
return serialize(obj);

Expand Down Expand Up @@ -1007,8 +1007,8 @@ public Type[] getActualTypeArguments() {

if (ret instanceof BinarySerializedObject) {
BinarySerializedObject bso = (BinarySerializedObject) ret;
BASE64Decoder dec = new BASE64Decoder();
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(dec.decodeBuffer(bso.getB64Data())));
Decoder dec = Base64.getDecoder();
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(dec.decode(bso.getB64Data())));
return (T) in.readObject();
}
return (T) ret;
Expand Down Expand Up @@ -1055,10 +1055,10 @@ private Object unmarshallInternal(Object val) {
if (d == null) {
d = (String) mapVal.get("b64Data");
}
BASE64Decoder dec = new BASE64Decoder();
Decoder dec = Base64.getDecoder();
ObjectInputStream in;
try {
in = new ObjectInputStream(new ByteArrayInputStream(dec.decodeBuffer(d)));
in = new ObjectInputStream(new ByteArrayInputStream(dec.decode(d)));
return in.readObject();
} catch (IOException | ClassNotFoundException e) {
throw new RuntimeException(e);
Expand Down

0 comments on commit 734962a

Please sign in to comment.