@Test public void failsWhenEndArrayIsBeforeStartArray() throws Exception { thrown.expect(JsonException.class); jsonWriter.writeEndArray(); }
public void writeEndArray() throws JsonException { JsonToken token = stack.pop(); try { if (token == array) { writer.write(']'); commaFirst = true; } else { throw new JsonException("Syntax error. Unexpected element ']'."); } } catch (IOException e) { throw new JsonException(e.getMessage(), e); } }
JsonWriter { public void writeEndArray() throws JsonException { JsonToken token = stack.pop(); try { if (token == array) { writer.write(']'); commaFirst = true; } else { throw new JsonException("Syntax error. Unexpected element ']'."); } } catch (IOException e) { throw new JsonException(e.getMessage(), e); } } }
JsonWriter { public void writeEndArray() throws JsonException { JsonToken token = stack.pop(); try { if (token == array) { writer.write(']'); commaFirst = true; } else { throw new JsonException("Syntax error. Unexpected element ']'."); } } catch (IOException e) { throw new JsonException(e.getMessage(), e); } } JsonWriter(Writer writer);  JsonWriter(OutputStream out); }
JsonWriter { public void writeEndArray() throws JsonException { JsonToken token = stack.pop(); try { if (token == array) { writer.write(']'); commaFirst = true; } else { throw new JsonException("Syntax error. Unexpected element ']'."); } } catch (IOException e) { throw new JsonException(e.getMessage(), e); } } JsonWriter(Writer writer);  JsonWriter(OutputStream out); final boolean isWriteNulls(); final void setWriteNulls(boolean writeNulls); void writeStartObject(); void writeEndObject(); void writeStartArray(); void writeEndArray(); void writeKey(String key); void writeString(String value); void writeValue(String value); void writeValue(long value); void writeValue(double value); void writeValue(boolean value); void writeNull(); void flush(); void close(); }
JsonWriter { public void writeEndArray() throws JsonException { JsonToken token = stack.pop(); try { if (token == array) { writer.write(']'); commaFirst = true; } else { throw new JsonException("Syntax error. Unexpected element ']'."); } } catch (IOException e) { throw new JsonException(e.getMessage(), e); } } JsonWriter(Writer writer);  JsonWriter(OutputStream out); final boolean isWriteNulls(); final void setWriteNulls(boolean writeNulls); void writeStartObject(); void writeEndObject(); void writeStartArray(); void writeEndArray(); void writeKey(String key); void writeString(String value); void writeValue(String value); void writeValue(long value); void writeValue(double value); void writeValue(boolean value); void writeNull(); void flush(); void close();  }