Flush the correct stream
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / JsonPage.java
index 2f84d27..21f44d2 100644 (file)
@@ -100,7 +100,8 @@ public abstract class JsonPage implements FreenetPage {
         *            The request to handle
         * @return The created JSON object
         */
-       protected abstract JsonReturnObject createJsonObject(FreenetRequest request);
+       @Nonnull
+       protected abstract JsonReturnObject createJsonObject(@Nonnull FreenetRequest request);
 
        /**
         * Returns whether this command needs the form password for authentication
@@ -224,10 +225,10 @@ public abstract class JsonPage implements FreenetPage {
                OutputStreamWriter writer = null;
                PrintWriter printWriter = null;
                try {
-                       writer = new OutputStreamWriter(byteArrayOutputStream, "uTF-8");
+                       writer = new OutputStreamWriter(byteArrayOutputStream, "UTF-8");
                        printWriter = new PrintWriter(writer);
                        t.printStackTrace(printWriter);
-                       byteArrayOutputStream.flush();
+                       printWriter.flush();
                        return byteArrayOutputStream.toByteArray();
                } catch (IOException ioe1) {
                        /* quite not possible. */