]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/testUtils/TestEmailReciever.java
Fix: some nullpointer references (coverity).
[gigi.git] / tests / org / cacert / gigi / testUtils / TestEmailReciever.java
index 50e3aace1f1cd3ebe77ff8e1df7b46cffaf00a8b..7cb410d8e2ee15424f6aeba4ca5d289efe93764d 100644 (file)
@@ -74,7 +74,7 @@ public class TestEmailReciever extends EmailProvider implements Runnable {
             URLConnection uc = u.openConnection();
             ManagedTest.cookie(uc, ManagedTest.stripCookie(csrfConn.getHeaderField("Set-Cookie")));
             uc.setDoOutput(true);
-            uc.getOutputStream().write((parts[1] + "&csrf=" + csrf).getBytes());
+            uc.getOutputStream().write((parts[1] + "&csrf=" + csrf).getBytes("UTF-8"));
             uc.connect();
             uc.getInputStream().close();
         }
@@ -94,14 +94,18 @@ public class TestEmailReciever extends EmailProvider implements Runnable {
         s.setSoTimeout(1000 * 60 * 60);
         dis = new DataInputStream(s.getInputStream());
         dos = new DataOutputStream(s.getOutputStream());
-        new Thread(this).start();
         setInstance(this);
     }
 
+    public void start() {
+        new Thread(this).start();
+    }
+
     LinkedBlockingQueue<TestMail> mails = new LinkedBlockingQueue<TestEmailReciever.TestMail>();
 
     public TestMail recieve() throws InterruptedException {
-        return mails.poll(5, TimeUnit.SECONDS);
+        TestMail poll = mails.poll(5, TimeUnit.SECONDS);
+        return poll;
     }
 
     @Override