File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
library/src/main/java/com/loopj/android/http Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ class JsonStreamerEntity implements HttpEntity {
5757
5858 private static final byte [] JSON_TRUE = "true" .getBytes ();
5959 private static final byte [] JSON_FALSE = "false" .getBytes ();
60+ private static final byte [] JSON_NULL = "null" .getBytes ();
6061 private static final byte [] STREAM_NAME = escape ("name" );
6162 private static final byte [] STREAM_TYPE = escape ("type" );
6263 private static final byte [] STREAM_CONTENTS = escape ("contents" );
@@ -204,11 +205,13 @@ public void writeTo(final OutputStream outstream) throws IOException {
204205 upload .write (STREAM_NAME );
205206 upload .write (':' );
206207 upload .write (escape (entry .name ));
208+ upload .write (',' );
207209
208210 // Send the streams's content type.
209211 upload .write (STREAM_TYPE );
210212 upload .write (':' );
211213 upload .write (escape (entry .contentType ));
214+ upload .write (',' );
212215
213216 // Prepare the file content's key.
214217 upload .write (STREAM_CONTENTS );
@@ -252,6 +255,11 @@ public void writeTo(final OutputStream outstream) throws IOException {
252255 // Curtosy of Simple-JSON: http://goo.gl/XoW8RF
253256 // Changed a bit to suit our needs in this class.
254257 static byte [] escape (String string ) {
258+ // If it's null, just return prematurely.
259+ if (string == null ) {
260+ return JSON_NULL ;
261+ }
262+
255263 // Surround with quotations.
256264 BUILDER .append ('"' );
257265
You can’t perform that action at this time.
0 commit comments