Browse Source

null is valid now

JNI-44
Volker Birk 10 years ago
parent
commit
7c6e1af2f1
  1. 6
      src/org/pEp/jniadapter/Blob.java
  2. 6
      src/org/pEp/jniadapter/_Blob.java
  3. 15
      src/org/pEp/jniadapter/_Identity.java
  4. 8
      test/Testing.java

6
src/org/pEp/jniadapter/Blob.java

@ -11,10 +11,8 @@ public class Blob {
Blob(_Blob b) {
data = b.data;
if (b.mime_type != null)
mime_type = AbstractEngine.toUTF16(b.mime_type);
if (b.filename != null)
filename = AbstractEngine.toUTF16(b.filename);
mime_type = AbstractEngine.toUTF16(b.mime_type);
filename = AbstractEngine.toUTF16(b.filename);
}
}

6
src/org/pEp/jniadapter/_Blob.java

@ -9,10 +9,8 @@ public class _Blob {
_Blob(Blob b) {
data = b.data;
if (b.mime_type != null)
mime_type = AbstractEngine.toUTF8(b.mime_type);
if (b.filename != null)
filename = AbstractEngine.toUTF8(b.filename);
mime_type = AbstractEngine.toUTF8(b.mime_type);
filename = AbstractEngine.toUTF8(b.filename);
}
}

15
src/org/pEp/jniadapter/_Identity.java

@ -18,17 +18,12 @@ public class _Identity {
}
public _Identity(Identity i) {
if (i.address != null)
address = AbstractEngine.toUTF8(i.address);
if (i.fpr != null)
fpr = AbstractEngine.toUTF8(i.fpr);
if (i.user_id != null)
user_id = AbstractEngine.toUTF8(i.user_id);
if (i.username != null)
username = AbstractEngine.toUTF8(i.username);
address = AbstractEngine.toUTF8(i.address);
fpr = AbstractEngine.toUTF8(i.fpr);
user_id = AbstractEngine.toUTF8(i.user_id);
username = AbstractEngine.toUTF8(i.username);
comm_type = i.comm_type.value;
if (i.lang != null)
lang = AbstractEngine.toUTF8(i.lang);
lang = AbstractEngine.toUTF8(i.lang);
me = i.me;
}
}

8
test/Testing.java

@ -2,6 +2,7 @@ import org.pEp.jniadapter.Engine;
import org.pEp.jniadapter.pEpException;
import org.pEp.jniadapter.Identity;
import org.pEp.jniadapter.Message;
import org.pEp.jniadapter.Blob;
import java.util.Vector;
class Testing {
@ -45,13 +46,18 @@ class Testing {
msg.setShortmsg("hello, world");
msg.setLongmsg("this is a test");
Message enc = null;
try {
Message enc = e.encrypt_message(msg, null);
enc = e.encrypt_message(msg, null);
System.out.println("encrypted");
}
catch (pEpException ex) {
System.out.println("cannot encrypt");
}
System.out.println(enc.getLongmsg());
Vector<Blob> attachments = enc.getAttachments();
System.out.println(attachments.get(1).data);
}
}

Loading…
Cancel
Save