Index: trunk/src/org/glassfish/json/BufferPoolImpl.java
===================================================================
--- trunk/src/org/glassfish/json/BufferPoolImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import java.lang.ref.WeakReference;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-/**
- * char[] pool that pool instances of char[] which are expensive to create.
- *
- * @author Jitendra Kotamraju
- */
-class BufferPoolImpl implements BufferPool {
-
-    // volatile since multiple threads may access queue reference
-    private volatile WeakReference<ConcurrentLinkedQueue<char[]>> queue;
-
-    /**
-     * Gets a new object from the pool.
-     *
-     * <p>
-     * If no object is available in the pool, this method creates a new one.
-     *
-     * @return
-     *      always non-null.
-     */
-    @Override
-    public final char[] take() {
-        char[] t = getQueue().poll();
-        if (t==null)
-            return new char[4096];
-        return t;
-    }
-
-    private ConcurrentLinkedQueue<char[]> getQueue() {
-        WeakReference<ConcurrentLinkedQueue<char[]>> q = queue;
-        if (q != null) {
-            ConcurrentLinkedQueue<char[]> d = q.get();
-            if (d != null)
-                return d;
-        }
-
-        // overwrite the queue
-        ConcurrentLinkedQueue<char[]> d = new ConcurrentLinkedQueue<>();
-        queue = new WeakReference<>(d);
-
-        return d;
-    }
-
-    /**
-     * Returns an object back to the pool.
-     */
-    @Override
-    public final void recycle(char[] t) {
-        getQueue().offer(t);
-    }
-
-}
Index: trunk/src/org/glassfish/json/JsonArrayBuilderImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonArrayBuilderImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,503 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.*;
-import java.io.StringWriter;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * JsonArrayBuilder implementation
- *
- * @author Jitendra Kotamraju
- * @author Kin-man Chung
- */
-
-class JsonArrayBuilderImpl implements JsonArrayBuilder {
-    private ArrayList<JsonValue> valueList;
-    private final BufferPool bufferPool;
-
-    JsonArrayBuilderImpl(BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-    }
-
-    JsonArrayBuilderImpl(JsonArray array, BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-        valueList = new ArrayList<>();
-        valueList.addAll(array);
-    }
-
-    JsonArrayBuilderImpl(Collection<?> collection, BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-        valueList = new ArrayList<>();
-        populate(collection);
-    }
-
-    @Override
-    public JsonArrayBuilder add(JsonValue value) {
-        validateValue(value);
-        addValueList(value);
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(String value) {
-        validateValue(value);
-        addValueList(new JsonStringImpl(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(BigDecimal value) {
-        validateValue(value);
-        addValueList(JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(BigInteger value) {
-        validateValue(value);
-        addValueList(JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int value) {
-        addValueList(JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(long value) {
-        addValueList(JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(double value) {
-        addValueList(JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(boolean value) {
-        addValueList(value ? JsonValue.TRUE : JsonValue.FALSE);
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder addNull() {
-        addValueList(JsonValue.NULL);
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(JsonObjectBuilder builder) {
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.ARRBUILDER_OBJECT_BUILDER_NULL());
-        }
-        addValueList(builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(JsonArrayBuilder builder) {
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.ARRBUILDER_ARRAY_BUILDER_NULL());
-        }
-        addValueList(builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder addAll(JsonArrayBuilder builder) {
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.ARRBUILDER_ARRAY_BUILDER_NULL());
-        }
-        if (valueList == null) {
-            valueList = new ArrayList<>();
-        }
-        valueList.addAll(builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, JsonValue value) {
-        validateValue(value);
-        addValueList(index, value);
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, String value) {
-        validateValue(value);
-        addValueList(index, new JsonStringImpl(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, BigDecimal value) {
-        validateValue(value);
-        addValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, BigInteger value) {
-        validateValue(value);
-        addValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, int value) {
-        addValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, long value) {
-        addValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, double value) {
-        addValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, boolean value) {
-        addValueList(index, value ? JsonValue.TRUE : JsonValue.FALSE);
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder addNull(int index) {
-        addValueList(index, JsonValue.NULL);
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, JsonObjectBuilder builder) {
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.ARRBUILDER_OBJECT_BUILDER_NULL());
-        }
-        addValueList(index, builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder add(int index, JsonArrayBuilder builder) {
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.ARRBUILDER_OBJECT_BUILDER_NULL());
-        }
-        addValueList(index, builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, JsonValue value) {
-        validateValue(value);
-        setValueList(index, value);
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, String value) {
-        validateValue(value);
-        setValueList(index, new JsonStringImpl(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, BigDecimal value) {
-        validateValue(value);
-        setValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, BigInteger value) {
-        validateValue(value);
-        setValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, int value) {
-        setValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, long value) {
-        setValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, double value) {
-        setValueList(index, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, boolean value) {
-        setValueList(index, value ? JsonValue.TRUE : JsonValue.FALSE);
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder setNull(int index) {
-        setValueList(index, JsonValue.NULL);
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, JsonObjectBuilder builder) {
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.ARRBUILDER_OBJECT_BUILDER_NULL());
-        }
-        setValueList(index, builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder set(int index, JsonArrayBuilder builder) {
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.ARRBUILDER_OBJECT_BUILDER_NULL());
-        }
-        setValueList(index, builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonArrayBuilder remove(int index) {
-        if (valueList == null) {
-            throw new IndexOutOfBoundsException(JsonMessages.ARRBUILDER_VALUELIST_NULL(index, 0));
-        }
-        valueList.remove(index);
-        return this;
-    }
-
-    @Override
-    public JsonArray build() {
-        List<JsonValue> snapshot;
-        if (valueList == null) {
-            snapshot = Collections.emptyList();
-        } else {
-            // Should we trim to minimize storage ?
-            // valueList.trimToSize();
-            snapshot = Collections.unmodifiableList(valueList);
-        }
-        valueList = null;
-        return new JsonArrayImpl(snapshot, bufferPool);
-    }
-
-    private void populate(Collection<?> collection) {
-        for (Object value : collection) {
-            if (value != null && value instanceof Optional) {
-                ((Optional<?>) value).ifPresent(v ->
-                        this.valueList.add(MapUtil.handle(v, bufferPool)));
-            } else {
-                this.valueList.add(MapUtil.handle(value, bufferPool));
-            }
-        }
-    }
-
-    private void addValueList(JsonValue value) {
-        if (valueList == null) {
-            valueList = new ArrayList<>();
-        }
-        valueList.add(value);
-    }
-
-    private void addValueList(int index, JsonValue value) {
-        if (valueList == null) {
-            valueList = new ArrayList<>();
-        }
-        valueList.add(index, value);
-    }
-
-    private void setValueList(int index, JsonValue value) {
-        if (valueList == null) {
-            throw new IndexOutOfBoundsException(JsonMessages.ARRBUILDER_VALUELIST_NULL(index, 0));
-        }
-        valueList.set(index, value);
-    }
-
-    private void validateValue(Object value) {
-        if (value == null) {
-            throw new NullPointerException(JsonMessages.ARRBUILDER_VALUE_NULL());
-        }
-    }
-
-    private static final class JsonArrayImpl extends AbstractList<JsonValue> implements JsonArray {
-        private final List<JsonValue> valueList;    // Unmodifiable
-        private final BufferPool bufferPool;
-
-        JsonArrayImpl(List<JsonValue> valueList, BufferPool bufferPool) {
-            this.valueList = valueList;
-            this.bufferPool = bufferPool;
-        }
-
-        @Override
-        public int size() {
-            return valueList.size();
-        }
-
-        @Override
-        public JsonObject getJsonObject(int index) {
-            return (JsonObject)valueList.get(index);
-        }
-
-        @Override
-        public JsonArray getJsonArray(int index) {
-            return (JsonArray)valueList.get(index);
-        }
-
-        @Override
-        public JsonNumber getJsonNumber(int index) {
-            return (JsonNumber)valueList.get(index);
-        }
-
-        @Override
-        public JsonString getJsonString(int index) {
-            return (JsonString)valueList.get(index);
-        }
-
-        @Override
-        @SuppressWarnings("unchecked")
-        public <T extends JsonValue> List<T> getValuesAs(Class<T> clazz) {
-            return (List<T>)valueList;
-        }
-
-        @Override
-        public String getString(int index) {
-            return getJsonString(index).getString();
-        }
-
-        @Override
-        public String getString(int index, String defaultValue) {
-            try {
-                return getString(index);
-            } catch (Exception e) {
-                return defaultValue;
-            }
-        }
-
-        @Override
-        public int getInt(int index) {
-            return getJsonNumber(index).intValue();
-        }
-
-        @Override
-        public int getInt(int index, int defaultValue) {
-            try {
-                return getInt(index);
-            } catch (Exception e) {
-                return defaultValue;
-            }
-        }
-
-        @Override
-        public boolean getBoolean(int index) {
-            JsonValue jsonValue = get(index);
-            if (jsonValue == JsonValue.TRUE) {
-                return true;
-            } else if (jsonValue == JsonValue.FALSE) {
-                return false;
-            } else {
-                throw new ClassCastException();
-            }
-        }
-
-        @Override
-        public boolean getBoolean(int index, boolean defaultValue) {
-            try {
-                return getBoolean(index);
-            } catch (Exception e) {
-                return defaultValue;
-            }
-        }
-
-        @Override
-        public boolean isNull(int index) {
-            return valueList.get(index).equals(JsonValue.NULL);
-        }
-
-        @Override
-        public ValueType getValueType() {
-            return ValueType.ARRAY;
-        }
-
-        @Override
-        public JsonValue get(int index) {
-            return valueList.get(index);
-        }
-
-        @Override
-        public String toString() {
-            StringWriter sw = new StringWriter();
-            try (JsonWriter jw = new JsonWriterImpl(sw, bufferPool)) {
-                jw.write(this);
-            }
-            return sw.toString();
-        }
-
-        @Override
-        public JsonArray asJsonArray() {
-            return this;
-        }
-    }
-}
-
Index: trunk/src/org/glassfish/json/JsonBuilderFactoryImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonBuilderFactoryImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import java.util.Collection;
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.JsonObject;
-import javax.json.JsonArray;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonBuilderFactory;
-import javax.json.JsonObjectBuilder;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * @author Jitendra Kotamraju
- */
-class JsonBuilderFactoryImpl implements JsonBuilderFactory {
-    private final Map<String, ?> config;
-    private final BufferPool bufferPool;
-
-    JsonBuilderFactoryImpl(BufferPool bufferPool) {
-        this.config = Collections.emptyMap();
-        this.bufferPool = bufferPool;
-    }
-
-    @Override
-    public JsonObjectBuilder createObjectBuilder() {
-        return new JsonObjectBuilderImpl(bufferPool);
-    }
- 
-    @Override
-    public JsonObjectBuilder createObjectBuilder(JsonObject object) {
-        return new JsonObjectBuilderImpl(object, bufferPool);
-    }
-
-    @Override
-    public JsonObjectBuilder createObjectBuilder(Map<String, Object> object) {
-        return new JsonObjectBuilderImpl(object, bufferPool);
-    }
-
-    @Override
-    public JsonArrayBuilder createArrayBuilder() {
-        return new JsonArrayBuilderImpl(bufferPool);
-    }
-
-    @Override
-    public JsonArrayBuilder createArrayBuilder(JsonArray array) {
-        return new JsonArrayBuilderImpl(array, bufferPool);
-    }
-
-    @Override
-    public JsonArrayBuilder createArrayBuilder(Collection<?> collection) {
-        return new JsonArrayBuilderImpl(collection, bufferPool);
-    }
-
-    @Override
-    public Map<String, ?> getConfigInUse() {
-        return config;
-    }
-}
Index: trunk/src/org/glassfish/json/JsonGeneratorFactoryImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonGeneratorFactoryImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.stream.JsonGenerator;
-import javax.json.stream.JsonGeneratorFactory;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.Map;
-
-/**
- * @author Jitendra Kotamraju
- */
-class JsonGeneratorFactoryImpl implements JsonGeneratorFactory {
-
-    private final boolean prettyPrinting;
-    private final Map<String, ?> config;    // unmodifiable map
-    private final BufferPool bufferPool;
-
-    JsonGeneratorFactoryImpl(Map<String, ?> config, boolean prettyPrinting,
-            BufferPool bufferPool) {
-        this.config = config;
-        this.prettyPrinting = prettyPrinting;
-        this.bufferPool = bufferPool;
-    }
-
-    @Override
-    public JsonGenerator createGenerator(Writer writer) {
-        return prettyPrinting
-                ? new JsonPrettyGeneratorImpl(writer, bufferPool)
-                : new JsonGeneratorImpl(writer, bufferPool);
-    }
-
-    @Override
-    public JsonGenerator createGenerator(OutputStream out) {
-        return prettyPrinting
-                ? new JsonPrettyGeneratorImpl(out, bufferPool)
-                : new JsonGeneratorImpl(out, bufferPool);
-    }
-
-    @Override
-    public JsonGenerator createGenerator(OutputStream out, Charset charset) {
-        return prettyPrinting
-                ? new JsonPrettyGeneratorImpl(out, charset, bufferPool)
-                : new JsonGeneratorImpl(out, charset, bufferPool);
-    }
-
-    @Override
-    public Map<String, ?> getConfigInUse() {
-        return config;
-    }
-
-}
Index: trunk/src/org/glassfish/json/JsonGeneratorImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonGeneratorImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,731 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.*;
-import javax.json.stream.JsonGenerationException;
-import javax.json.stream.JsonGenerator;
-import java.io.*;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayDeque;
-import java.util.Deque;
-import java.util.Map;
-
-/**
- * @author Jitendra Kotamraju
- */
-class JsonGeneratorImpl implements JsonGenerator {
-
-    private static final char[] INT_MIN_VALUE_CHARS = "-2147483648".toCharArray();
-    private static final int[] INT_CHARS_SIZE_TABLE = { 9, 99, 999, 9999, 99999,
-            999999, 9999999, 99999999, 999999999, Integer.MAX_VALUE };
-
-    private static final char [] DIGIT_TENS = {
-            '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
-            '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
-            '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
-            '3', '3', '3', '3', '3', '3', '3', '3', '3', '3',
-            '4', '4', '4', '4', '4', '4', '4', '4', '4', '4',
-            '5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
-            '6', '6', '6', '6', '6', '6', '6', '6', '6', '6',
-            '7', '7', '7', '7', '7', '7', '7', '7', '7', '7',
-            '8', '8', '8', '8', '8', '8', '8', '8', '8', '8',
-            '9', '9', '9', '9', '9', '9', '9', '9', '9', '9',
-    } ;
-
-    private static final char [] DIGIT_ONES = {
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-    } ;
-
-    /**
-     * All possible chars for representing a number as a String
-     */
-    private static final char[] DIGITS = {
-            '0' , '1' , '2' , '3' , '4' , '5' ,
-            '6' , '7' , '8' , '9'
-    };
-
-    private static enum Scope {
-        IN_NONE,
-        IN_OBJECT,
-        IN_FIELD,
-        IN_ARRAY
-    }
-
-    private final BufferPool bufferPool;
-    private final Writer writer;
-    private Context currentContext = new Context(Scope.IN_NONE);
-    private final Deque<Context> stack = new ArrayDeque<>();
-
-    // Using own buffering mechanism as JDK's BufferedWriter uses synchronized
-    // methods. Also, flushBuffer() is useful when you don't want to actually
-    // flush the underlying output source
-    private final char buf[];     // capacity >= INT_MIN_VALUE_CHARS.length
-    private int len = 0;
-
-    JsonGeneratorImpl(Writer writer, BufferPool bufferPool) {
-        this.writer = writer;
-        this.bufferPool = bufferPool;
-        this.buf = bufferPool.take();
-    }
-
-    JsonGeneratorImpl(OutputStream out, BufferPool bufferPool) {
-        this(out, StandardCharsets.UTF_8, bufferPool);
-    }
-
-    JsonGeneratorImpl(OutputStream out, Charset encoding, BufferPool bufferPool) {
-        this(new OutputStreamWriter(out, encoding), bufferPool);
-    }
-
-    @Override
-    public void flush() {
-        flushBuffer();
-        try {
-            writer.flush();
-        } catch (IOException ioe) {
-            throw new JsonException(JsonMessages.GENERATOR_FLUSH_IO_ERR(), ioe);
-        }
-    }
-
-    @Override
-    public JsonGenerator writeStartObject() {
-        if (currentContext.scope == Scope.IN_OBJECT) {
-            throw new JsonGenerationException(JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        if (currentContext.scope == Scope.IN_NONE && !currentContext.first) {
-            throw new JsonGenerationException(JsonMessages.GENERATOR_ILLEGAL_MULTIPLE_TEXT());
-        }
-        writeComma();
-        writeChar('{');
-        stack.push(currentContext);
-        currentContext = new Context(Scope.IN_OBJECT);
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeStartObject(String name) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        writeChar('{');
-        stack.push(currentContext);
-        currentContext = new Context(Scope.IN_OBJECT);
-        return this;
-    }
-
-    private JsonGenerator writeName(String name) {
-        writeComma();
-        writeEscapedString(name);
-        writeColon();
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(String name, String fieldValue) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        writeEscapedString(fieldValue);
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(String name, int value) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        writeInt(value);
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(String name, long value) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        writeString(String.valueOf(value));
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(String name, double value) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        if (Double.isInfinite(value) || Double.isNaN(value)) {
-            throw new NumberFormatException(JsonMessages.GENERATOR_DOUBLE_INFINITE_NAN());
-        }
-        writeName(name);
-        writeString(String.valueOf(value));
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(String name, BigInteger value) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        writeString(String.valueOf(value));
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(String name, BigDecimal value) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        writeString(String.valueOf(value));
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(String name, boolean value) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        writeString(value? "true" : "false");
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeNull(String name) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        writeString("null");
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(JsonValue value) {
-        checkContextForValue();
-
-        switch (value.getValueType()) {
-            case ARRAY:
-                JsonArray array = (JsonArray)value;
-                writeStartArray();
-                for(JsonValue child: array) {
-                    write(child);
-                }
-                writeEnd();
-                break;
-            case OBJECT:
-                JsonObject object = (JsonObject)value;
-                writeStartObject();
-                for(Map.Entry<String, JsonValue> member: object.entrySet()) {
-                    write(member.getKey(), member.getValue());
-                }
-                writeEnd();
-                break;
-            case STRING:
-                JsonString str = (JsonString)value;
-                write(str.getString());
-                break;
-            case NUMBER:
-                JsonNumber number = (JsonNumber)value;
-                writeValue(number.toString());
-                popFieldContext();
-                break;
-            case TRUE:
-                write(true);
-                break;
-            case FALSE:
-                write(false);
-                break;
-            case NULL:
-                writeNull();
-                break;
-        }
-
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeStartArray() {
-        if (currentContext.scope == Scope.IN_OBJECT) {
-            throw new JsonGenerationException(JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        if (currentContext.scope == Scope.IN_NONE && !currentContext.first) {
-            throw new JsonGenerationException(JsonMessages.GENERATOR_ILLEGAL_MULTIPLE_TEXT());
-        }
-        writeComma();
-        writeChar('[');
-        stack.push(currentContext);
-        currentContext = new Context(Scope.IN_ARRAY);
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeStartArray(String name) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        writeChar('[');
-        stack.push(currentContext);
-        currentContext = new Context(Scope.IN_ARRAY);
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(String name, JsonValue value) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        switch (value.getValueType()) {
-            case ARRAY:
-                JsonArray array = (JsonArray)value;
-                writeStartArray(name);
-                for(JsonValue child: array) {
-                    write(child);
-                }
-                writeEnd();
-                break;
-            case OBJECT:
-                JsonObject object = (JsonObject)value;
-                writeStartObject(name);
-                for(Map.Entry<String, JsonValue> member: object.entrySet()) {
-                    write(member.getKey(), member.getValue());
-                }
-                writeEnd();
-                break;
-            case STRING:
-                JsonString str = (JsonString)value;
-                write(name, str.getString());
-                break;
-            case NUMBER:
-                JsonNumber number = (JsonNumber)value;
-                writeValue(name, number.toString());
-                break;
-            case TRUE:
-                write(name, true);
-                break;
-            case FALSE:
-                write(name, false);
-                break;
-            case NULL:
-                writeNull(name);
-                break;
-        }
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(String value) {
-        checkContextForValue();
-        writeComma();
-        writeEscapedString(value);
-        popFieldContext();
-        return this;
-    }
-
-
-    @Override
-    public JsonGenerator write(int value) {
-        checkContextForValue();
-        writeComma();
-        writeInt(value);
-        popFieldContext();
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(long value) {
-        checkContextForValue();
-        writeValue(String.valueOf(value));
-        popFieldContext();
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(double value) {
-        checkContextForValue();
-        if (Double.isInfinite(value) || Double.isNaN(value)) {
-            throw new NumberFormatException(JsonMessages.GENERATOR_DOUBLE_INFINITE_NAN());
-        }
-        writeValue(String.valueOf(value));
-        popFieldContext();
-        return this;
-    }
-
-    @Override
-    public JsonGenerator write(BigInteger value) {
-        checkContextForValue();
-        writeValue(value.toString());
-        popFieldContext();
-        return this;
-    }
-
-    private void checkContextForValue() {
-        if ((!currentContext.first && currentContext.scope != Scope.IN_ARRAY && currentContext.scope != Scope.IN_FIELD)
-                || (currentContext.first && currentContext.scope == Scope.IN_OBJECT)) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-    }
-
-    @Override
-    public JsonGenerator write(BigDecimal value) {
-        checkContextForValue();
-        writeValue(value.toString());
-        popFieldContext();
-
-        return this;
-    }
-
-    private void popFieldContext() {
-        if (currentContext.scope == Scope.IN_FIELD) {
-            currentContext = stack.pop();
-        }
-    }
-
-    @Override
-    public JsonGenerator write(boolean value) {
-        checkContextForValue();
-        writeComma();
-        writeString(value ? "true" : "false");
-        popFieldContext();
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeNull() {
-        checkContextForValue();
-        writeComma();
-        writeString("null");
-        popFieldContext();
-        return this;
-    }
-
-    private void writeValue(String value) {
-        writeComma();
-        writeString(value);
-    }
-
-    private void writeValue(String name, String value) {
-        writeComma();
-        writeEscapedString(name);
-        writeColon();
-        writeString(value);
-    }
-
-    @Override
-    public JsonGenerator writeKey(String name) {
-        if (currentContext.scope != Scope.IN_OBJECT) {
-            throw new JsonGenerationException(
-                    JsonMessages.GENERATOR_ILLEGAL_METHOD(currentContext.scope));
-        }
-        writeName(name);
-        stack.push(currentContext);
-        currentContext = new Context(Scope.IN_FIELD);
-        currentContext.first = false;
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeEnd() {
-        if (currentContext.scope == Scope.IN_NONE) {
-            throw new JsonGenerationException("writeEnd() cannot be called in no context");
-        }
-        writeChar(currentContext.scope == Scope.IN_ARRAY ? ']' : '}');
-        currentContext = stack.pop();
-        popFieldContext();
-        return this;
-    }
-
-    protected void writeComma() {
-        if (!currentContext.first && currentContext.scope != Scope.IN_FIELD) {
-            writeChar(',');
-        }
-        currentContext.first = false;
-    }
-
-    protected void writeColon() {
-        writeChar(':');
-    }
-
-    private static class Context {
-        boolean first = true;
-        final Scope scope;
-
-        Context(Scope scope) {
-            this.scope = scope;
-        }
-
-    }
-
-    @Override
-    public void close() {
-        if (currentContext.scope != Scope.IN_NONE || currentContext.first) {
-            throw new JsonGenerationException(JsonMessages.GENERATOR_INCOMPLETE_JSON());
-        }
-        flushBuffer();
-        try {
-            writer.close();
-        } catch (IOException ioe) {
-            throw new JsonException(JsonMessages.GENERATOR_CLOSE_IO_ERR(), ioe);
-        }
-        bufferPool.recycle(buf);
-    }
-
-    // begin, end-1 indexes represent characters that need not
-    // be escaped
-    //
-    // XXXssssssssssssXXXXXXXXXXXXXXXXXXXXXXrrrrrrrrrrrrrrXXXXXX
-    //    ^           ^                     ^             ^
-    //    |           |                     |             |
-    //   begin       end                   begin         end
-    void writeEscapedString(String string) {
-        writeChar('"');
-        int len = string.length();
-        for(int i = 0; i < len; i++) {
-            int begin = i, end = i;
-            char c = string.charAt(i);
-            // find all the characters that need not be escaped
-            // unescaped = %x20-21 | %x23-5B | %x5D-10FFFF
-            while(c >= 0x20 && c <= 0x10ffff && c != 0x22 && c != 0x5c) {
-                i++; end = i;
-                if (i < len) {
-                    c = string.charAt(i);
-                } else {
-                    break;
-                }
-            }
-            // Write characters without escaping
-            if (begin < end) {
-                writeString(string, begin, end);
-                if (i == len) {
-                    break;
-                }
-            }
-
-            switch (c) {
-                case '"':
-                case '\\':
-                    writeChar('\\'); writeChar(c);
-                    break;
-                case '\b':
-                    writeChar('\\'); writeChar('b');
-                    break;
-                case '\f':
-                    writeChar('\\'); writeChar('f');
-                    break;
-                case '\n':
-                    writeChar('\\'); writeChar('n');
-                    break;
-                case '\r':
-                    writeChar('\\'); writeChar('r');
-                    break;
-                case '\t':
-                    writeChar('\\'); writeChar('t');
-                    break;
-                default:
-                    String hex = "000" + Integer.toHexString(c);
-                    writeString("\\u" + hex.substring(hex.length() - 4));
-            }
-        }
-        writeChar('"');
-    }
-
-    void writeString(String str, int begin, int end) {
-        while (begin < end) {       // source begin and end indexes
-            int no = Math.min(buf.length - len, end - begin);
-            str.getChars(begin, begin + no, buf, len);
-            begin += no;            // Increment source index
-            len += no;              // Increment dest index
-            if (len >= buf.length) {
-                flushBuffer();
-            }
-        }
-    }
-
-    void writeString(String str) {
-        writeString(str, 0, str.length());
-    }
-
-    void writeChar(char c) {
-        if (len >= buf.length) {
-            flushBuffer();
-        }
-        buf[len++] = c;
-    }
-
-    // Not using Integer.toString() since it creates intermediary String
-    // Also, we want the chars to be copied to our buffer directly
-    void writeInt(int num) {
-        int size;
-        if (num == Integer.MIN_VALUE) {
-            size = INT_MIN_VALUE_CHARS.length;
-        } else {
-            size = (num < 0) ? stringSize(-num) + 1 : stringSize(num);
-        }
-        if (len+size >= buf.length) {
-            flushBuffer();
-        }
-        if (num == Integer.MIN_VALUE) {
-            System.arraycopy(INT_MIN_VALUE_CHARS, 0, buf, len, size);
-        } else {
-            fillIntChars(num, buf, len+size);
-        }
-        len += size;
-    }
-
-    // flushBuffer writes the buffered contents to writer. But incase of
-    // byte stream, an OuputStreamWriter is created and that buffers too.
-    // We may need to call OutputStreamWriter#flushBuffer() using
-    // reflection if that is really required (commented out below)
-    void flushBuffer() {
-        try {
-            if (len > 0) {
-                writer.write(buf, 0, len);
-                len = 0;
-            }
-        } catch (IOException ioe) {
-            throw new JsonException(JsonMessages.GENERATOR_WRITE_IO_ERR(), ioe);
-        }
-    }
-
-//    private static final Method flushBufferMethod;
-//    static {
-//        Method m = null;
-//        try {
-//            m = OutputStreamWriter.class.getDeclaredMethod("flushBuffer");
-//            m.setAccessible(true);
-//        } catch (Exception e) {
-//            // no-op
-//        }
-//        flushBufferMethod = m;
-//    }
-//    void flushBufferOSW() {
-//        flushBuffer();
-//        if (writer instanceof OutputStreamWriter) {
-//            try {
-//                flushBufferMethod.invoke(writer);
-//            } catch (Exception e) {
-//                // no-op
-//            }
-//        }
-//    }
-
-    // Requires positive x
-    private static int stringSize(int x) {
-        for (int i=0; ; i++)
-            if (x <= INT_CHARS_SIZE_TABLE[i])
-                return i+1;
-    }
-
-    /**
-     * Places characters representing the integer i into the
-     * character array buf. The characters are placed into
-     * the buffer backwards starting with the least significant
-     * digit at the specified index (exclusive), and working
-     * backwards from there.
-     *
-     * Will fail if i == Integer.MIN_VALUE
-     */
-    private static void fillIntChars(int i, char[] buf, int index) {
-        int q, r;
-        int charPos = index;
-        char sign = 0;
-
-        if (i < 0) {
-            sign = '-';
-            i = -i;
-        }
-
-        // Generate two digits per iteration
-        while (i >= 65536) {
-            q = i / 100;
-            // really: r = i - (q * 100);
-            r = i - ((q << 6) + (q << 5) + (q << 2));
-            i = q;
-            buf [--charPos] = DIGIT_ONES[r];
-            buf [--charPos] = DIGIT_TENS[r];
-        }
-
-        // Fall thru to fast mode for smaller numbers
-        // assert(i <= 65536, i);
-        for (;;) {
-            q = (i * 52429) >>> (16+3);
-            r = i - ((q << 3) + (q << 1));  // r = i-(q*10) ...
-            buf [--charPos] = DIGITS[r];
-            i = q;
-            if (i == 0) break;
-        }
-        if (sign != 0) {
-            buf [--charPos] = sign;
-        }
-    }
-
-}
Index: trunk/src/org/glassfish/json/JsonLocationImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonLocationImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.stream.JsonLocation;
-
-/**
- * @author Jitendra Kotamraju
- */
-class JsonLocationImpl implements JsonLocation {
-    static final JsonLocation UNKNOWN = new JsonLocationImpl(-1, -1, -1);
-
-    private final long columnNo;
-    private final long lineNo;
-    private final long offset;
-
-    JsonLocationImpl(long lineNo, long columnNo, long streamOffset) {
-        this.lineNo = lineNo;
-        this.columnNo = columnNo;
-        this.offset = streamOffset;
-    }
-
-    @Override
-    public long getLineNumber() {
-        return lineNo;
-    }
-
-    @Override
-    public long getColumnNumber() {
-        return columnNo;
-    }
-
-    @Override
-    public long getStreamOffset() {
-        return offset;
-    }
-
-    @Override
-    public String toString() {
-        return "(line no="+lineNo+", column no="+columnNo+", offset="+ offset +")";
-    }
-
-}
Index: trunk/src/org/glassfish/json/JsonMergePatchImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonMergePatchImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2015-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.Json;
-import javax.json.JsonMergePatch;
-import javax.json.JsonObject;
-import javax.json.JsonObjectBuilder;
-import javax.json.JsonValue;
-
-/**
- * This class is an implementation of a JSON Merge Patch as specified in
- * <a href="http://tools.ietf.org/html/rfc7396">RFC 7396</a>.
- *
- * @since 1.1
- */
-
-public final class JsonMergePatchImpl implements JsonMergePatch {
-
-    private JsonValue patch;
-
-    public JsonMergePatchImpl(JsonValue patch) {
-        this.patch = patch;
-    }
-
-    @Override
-    public JsonValue apply(JsonValue target) {
-        return mergePatch(target, patch);
-    }
-
-    @Override
-    public JsonValue toJsonValue() {
-        return patch;
-    }
-    /**
-     * Applies the specified patch to the specified target.
-     * The target is not modified by the patch.
-     *
-     * @param target the {@code JsonValue} to apply the patch operations
-     * @param patch the patch
-     * @return the {@code JsonValue} as the result of applying the patch
-     *    operations on the target.
-     */
-    private static JsonValue mergePatch(JsonValue target, JsonValue patch) {
-
-        if (patch.getValueType() != JsonValue.ValueType.OBJECT) {
-            return patch;
-        }
-        if (target.getValueType() != JsonValue.ValueType.OBJECT) {
-            target = JsonValue.EMPTY_JSON_OBJECT;
-        }
-        JsonObject targetJsonObject = target.asJsonObject();
-        JsonObjectBuilder builder =
-            Json.createObjectBuilder(targetJsonObject);
-        patch.asJsonObject().forEach((key, value) -> {
-            if (value == JsonValue.NULL) {
-                if (targetJsonObject.containsKey(key)) {
-                    builder.remove(key);
-                }
-            } else if (targetJsonObject.containsKey(key)) {
-                builder.add(key, mergePatch(targetJsonObject.get(key), value));
-            } else {
-                builder.add(key, mergePatch(JsonValue.EMPTY_JSON_OBJECT, value));
-            }
-        });
-        return builder.build();
-    }
-
-    /**
-     * Generate a JSON Merge Patch from the source and target {@code JsonValue}.
-     * @param source the source
-     * @param target the target
-     * @return a JSON Patch which when applied to the source, yields the target
-     */
-    static JsonValue diff(JsonValue source, JsonValue target) {
-        if (source.getValueType() != JsonValue.ValueType.OBJECT ||
-                target.getValueType() != JsonValue.ValueType.OBJECT) {
-            return target;
-        }
-        JsonObject s = (JsonObject) source;
-        JsonObject t = (JsonObject) target;
-        JsonObjectBuilder builder = Json.createObjectBuilder();
-        // First find members to be replaced or removed
-        s.forEach((key, value) -> {
-            if (t.containsKey(key)) {
-                // key present in both.
-                if (! value.equals(t.get(key))) {
-                    // If the values are equal, nop, else get diff for the values
-                    builder.add(key, diff(value, t.get(key)));
-                }
-            } else {
-                builder.addNull(key);
-            }
-        });
-        // Then find members to be added
-        t.forEach((key, value) -> {
-            if (! s.containsKey(key))
-                builder.add(key, value);
-        });
-        return builder.build();
-    }
-
-}
-
Index: trunk/src/org/glassfish/json/JsonMessages.java
===================================================================
--- trunk/src/org/glassfish/json/JsonMessages.java	(revision 16017)
+++ 	(revision )
@@ -1,310 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-
-import javax.json.stream.JsonLocation;
-import javax.json.stream.JsonParser;
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-import javax.json.JsonObject;
-import javax.json.JsonValue;
-
-/**
- * Defines string formatting method for each constant in the resource file
- *
- * @author Jitendra Kotamraju
- */
-final class JsonMessages {
-    private static final ResourceBundle BUNDLE =
-            ResourceBundle.getBundle("org.glassfish.json.messages");
-
-    // global/shared messages
-    static String INTERNAL_ERROR() {
-        return localize("internal.error");
-    }
-
-    // tokenizer messages
-    static String TOKENIZER_UNEXPECTED_CHAR(int unexpected, JsonLocation location) {
-        return localize("tokenizer.unexpected.char", unexpected, location);
-    }
-
-    static String TOKENIZER_EXPECTED_CHAR(int unexpected, JsonLocation location, char expected) {
-        return localize("tokenizer.expected.char", unexpected, location, expected);
-    }
-
-    static String TOKENIZER_IO_ERR() {
-        return localize("tokenizer.io.err");
-    }
-
-
-    // parser messages
-    static String PARSER_GETSTRING_ERR(JsonParser.Event event) {
-        return localize("parser.getString.err", event);
-    }
-
-    static String PARSER_ISINTEGRALNUMBER_ERR(JsonParser.Event event) {
-        return localize("parser.isIntegralNumber.err", event);
-    }
-
-    static String PARSER_GETINT_ERR(JsonParser.Event event) {
-        return localize("parser.getInt.err", event);
-    }
-
-    static String PARSER_GETLONG_ERR(JsonParser.Event event) {
-        return localize("parser.getLong.err", event);
-    }
-
-    static String PARSER_GETBIGDECIMAL_ERR(JsonParser.Event event) {
-        return localize("parser.getBigDecimal.err", event);
-    }
-
-    static String PARSER_GETARRAY_ERR(JsonParser.Event event) {
-        return localize("parser.getArray.err", event);
-    }
-
-    static String PARSER_GETOBJECT_ERR(JsonParser.Event event) {
-        return localize("parser.getObject.err", event);
-    }
-
-    static String PARSER_GETVALUE_ERR(JsonParser.Event event) {
-        return localize("parser.getValue.err", event);
-    }
-
-    static String PARSER_GETVALUESTREAM_ERR() {
-        return localize("parser.getValueStream.err");
-    }
-
-    static String PARSER_EXPECTED_EOF(JsonTokenizer.JsonToken token) {
-        return localize("parser.expected.eof", token);
-    }
-
-    static String PARSER_TOKENIZER_CLOSE_IO() {
-        return localize("parser.tokenizer.close.io");
-    }
-
-    static String PARSER_INVALID_TOKEN(JsonTokenizer.JsonToken token, JsonLocation location, String expectedTokens) {
-        return localize("parser.invalid.token", token, location, expectedTokens);
-    }
-
-    static String PARSER_STATE_ERR(JsonValue.ValueType type) {
-        return localize("parser.state.err", type);
-    }
-
-    static String PARSER_SCOPE_ERR(JsonValue value) {
-        return localize("parser.scope.err", value);
-    }
-
-    static String PARSER_INPUT_ENC_DETECT_FAILED() {
-        return localize("parser.input.enc.detect.failed");
-    }
-
-    static String PARSER_INPUT_ENC_DETECT_IOERR() {
-        return localize("parser.input.enc.detect.ioerr");
-    }
-
-    // generator messages
-    static String GENERATOR_FLUSH_IO_ERR() {
-        return localize("generator.flush.io.err");
-    }
-
-    static String GENERATOR_CLOSE_IO_ERR() {
-        return localize("generator.close.io.err");
-    }
-
-    static String GENERATOR_WRITE_IO_ERR() {
-        return localize("generator.write.io.err");
-    }
-
-    static String GENERATOR_ILLEGAL_METHOD(Object scope) {
-        return localize("generator.illegal.method", scope);
-    }
-
-    static String GENERATOR_DOUBLE_INFINITE_NAN() {
-        return localize("generator.double.infinite.nan");
-    }
-
-    static String GENERATOR_INCOMPLETE_JSON() {
-        return localize("generator.incomplete.json");
-    }
-
-    static String GENERATOR_ILLEGAL_MULTIPLE_TEXT() {
-        return localize("generator.illegal.multiple.text");
-    }
-
-
-
-    // writer messages
-    static String WRITER_WRITE_ALREADY_CALLED() {
-        return localize("writer.write.already.called");
-    }
-
-    // reader messages
-    static String READER_READ_ALREADY_CALLED() {
-        return localize("reader.read.already.called");
-    }
-
-
-    // obj builder messages
-    static String OBJBUILDER_NAME_NULL() {
-        return localize("objbuilder.name.null");
-    }
-
-    static String OBJBUILDER_VALUE_NULL() {
-        return localize("objbuilder.value.null");
-    }
-
-    static String OBJBUILDER_OBJECT_BUILDER_NULL() {
-        return localize("objbuilder.object.builder.null");
-    }
-
-    static String OBJBUILDER_ARRAY_BUILDER_NULL() {
-        return localize("objbuilder.array.builder.null");
-    }
-
-
-    // array builder messages
-    static String ARRBUILDER_VALUE_NULL() {
-        return localize("arrbuilder.value.null");
-    }
-
-    static String ARRBUILDER_OBJECT_BUILDER_NULL() {
-        return localize("arrbuilder.object.builder.null");
-    }
-
-    static String ARRBUILDER_ARRAY_BUILDER_NULL() {
-        return localize("arrbuilder.array.builder.null");
-    }
-
-    static String ARRBUILDER_VALUELIST_NULL(int index, int size) {
-        return localize("arrbuilder.valuelist.null", index, size);
-    }
-
-    // json pointer messages
-    static String POINTER_FORMAT_INVALID() {
-        return localize("pointer.format.invalid");
-    }
-
-    static String POINTER_MAPPING_MISSING(JsonObject object, String key) {
-        return localize("pointer.mapping.missing", object, key);
-    }
-
-    static String POINTER_REFERENCE_INVALID(JsonValue.ValueType type) {
-        return localize("pointer.reference.invalid", type.name());
-    }
-
-    static String POINTER_ARRAY_INDEX_ERR(String token) {
-        return localize("pointer.array.index.err", token);
-    }
-
-    static String POINTER_ARRAY_INDEX_ILLEGAL(String token) {
-        return localize("pointer.array.index.illegal", token);
-    }
-
-    // nodereference messages
-    static String NODEREF_VALUE_ADD_ERR() {
-        return localize("noderef.value.add.err");
-    }
-
-    static String NODEREF_VALUE_CANNOT_REMOVE() {
-        return localize("noderef.value.cannot.remove");
-    }
-
-    static String NODEREF_OBJECT_MISSING(String key) {
-        return localize("noderef.object.missing", key);
-    }
-
-    static String NODEREF_ARRAY_INDEX_ERR(int index, int size) {
-        return localize("noderef.array.index.err", index, size);
-    }
-
-    // json patch messages
-    static String PATCH_MUST_BE_ARRAY() {
-        return localize("patch.must.be.array");
-    }
-
-    static String PATCH_MOVE_PROPER_PREFIX(String from, String path) {
-        return localize("patch.move.proper.prefix", from, path);
-    }
-
-    static String PATCH_MOVE_TARGET_NULL(String from) {
-        return localize("patch.move.target.null", from);
-    }
-
-    static String PATCH_TEST_FAILED(String path, String value) {
-        return localize("patch.test.failed", path, value);
-    }
-
-    static String PATCH_ILLEGAL_OPERATION(String operation) {
-        return localize("patch.illegal.operation", operation);
-    }
-
-    static String PATCH_MEMBER_MISSING(String operation, String member) {
-        return localize("patch.member.missing", operation, member);
-    }
-
-
-    private static String localize(String key, Object ... args) {
-        try {
-            String msg = BUNDLE.getString(key);
-            return MessageFormat.format(msg, args);
-        } catch (Exception e) {
-            return getDefaultMessage(key, args);
-        }
-    }
-
-    private static String getDefaultMessage(String key, Object ... args) {
-        StringBuilder sb = new StringBuilder();
-        sb.append("[failed to localize] ");
-        sb.append(key);
-        if (args != null) {
-            sb.append('(');
-            for (int i = 0; i < args.length; ++i) {
-                if (i != 0)
-                    sb.append(", ");
-                sb.append(String.valueOf(args[i]));
-            }
-            sb.append(')');
-        }
-        return sb.toString();
-    }
-
-}
Index: trunk/src/org/glassfish/json/JsonNumberImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonNumberImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,288 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.JsonNumber;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-/**
- * JsonNumber impl. Subclasses provide optimized implementations
- * when backed by int, long, BigDecimal
- *
- * @author Jitendra Kotamraju
- */
-abstract class JsonNumberImpl implements JsonNumber {
-
-    static JsonNumber getJsonNumber(int num) {
-        return new JsonIntNumber(num);
-    }
-
-    static JsonNumber getJsonNumber(long num) {
-        return new JsonLongNumber(num);
-    }
-
-    static JsonNumber getJsonNumber(BigInteger value) {
-        return new JsonBigDecimalNumber(new BigDecimal(value));
-    }
-
-    static JsonNumber getJsonNumber(double value) {
-        //bigDecimal = new BigDecimal(value);
-        // This is the preferred way to convert double to BigDecimal
-        return new JsonBigDecimalNumber(BigDecimal.valueOf(value));
-    }
-
-    static JsonNumber getJsonNumber(BigDecimal value) {
-        return new JsonBigDecimalNumber(value);
-    }
-
-    // Optimized JsonNumber impl for int numbers.
-    private static final class JsonIntNumber extends JsonNumberImpl {
-        private final int num;
-        private BigDecimal bigDecimal;  // assigning it lazily on demand
-
-        JsonIntNumber(int num) {
-            this.num = num;
-        }
-
-        @Override
-        public boolean isIntegral() {
-            return true;
-        }
-
-        @Override
-        public int intValue() {
-            return num;
-        }
-
-        @Override
-        public int intValueExact() {
-            return num;
-        }
-
-        @Override
-        public long longValue() {
-            return num;
-        }
-
-        @Override
-        public long longValueExact() {
-            return num;
-        }
-
-        @Override
-        public double doubleValue() {
-            return num;
-        }
-
-        @Override
-        public BigDecimal bigDecimalValue() {
-            // reference assignments are atomic. At the most some more temp
-            // BigDecimal objects are created
-            BigDecimal bd = bigDecimal;
-            if (bd == null) {
-                bigDecimal = bd = new BigDecimal(num);
-            }
-            return bd;
-        }
-
-        @Override
-        public Number numberValue() {
-            return num;
-        }
-
-        @Override
-        public String toString() {
-            return Integer.toString(num);
-        }
-    }
-
-    // Optimized JsonNumber impl for long numbers.
-    private static final class JsonLongNumber extends JsonNumberImpl {
-        private final long num;
-        private BigDecimal bigDecimal;  // assigning it lazily on demand
-
-        JsonLongNumber(long num) {
-            this.num = num;
-        }
-
-        @Override
-        public boolean isIntegral() {
-            return true;
-        }
-
-        @Override
-        public int intValue() {
-            return (int) num;
-        }
-
-        @Override
-        public int intValueExact() {
-            return Math.toIntExact(num);
-        }
-
-        @Override
-        public long longValue() {
-            return num;
-        }
-
-        @Override
-        public long longValueExact() {
-            return num;
-        }
-
-        @Override
-        public double doubleValue() {
-            return num;
-        }
-
-        @Override
-        public BigDecimal bigDecimalValue() {
-            // reference assignments are atomic. At the most some more temp
-            // BigDecimal objects are created
-            BigDecimal bd = bigDecimal;
-            if (bd == null) {
-                bigDecimal = bd = new BigDecimal(num);
-            }
-            return bd;
-        }
-
-        @Override
-        public Number numberValue() {
-            return num;
-        }
-
-        @Override
-        public String toString() {
-            return Long.toString(num);
-        }
-
-    }
-
-    // JsonNumber impl using BigDecimal numbers.
-    private static final class JsonBigDecimalNumber extends JsonNumberImpl {
-        private final BigDecimal bigDecimal;
-
-        JsonBigDecimalNumber(BigDecimal value) {
-            this.bigDecimal = value;
-        }
-
-        @Override
-        public BigDecimal bigDecimalValue() {
-            return bigDecimal;
-        }
-
-        @Override
-        public Number numberValue() {
-            return bigDecimalValue();
-        }
-
-    }
-
-    @Override
-    public boolean isIntegral() {
-        return bigDecimalValue().scale() == 0;
-    }
-
-    @Override
-    public int intValue() {
-        return bigDecimalValue().intValue();
-    }
-
-    @Override
-    public int intValueExact() {
-        return bigDecimalValue().intValueExact();
-    }
-
-    @Override
-    public long longValue() {
-        return bigDecimalValue().longValue();
-    }
-
-    @Override
-    public long longValueExact() {
-        return bigDecimalValue().longValueExact();
-    }
-
-    @Override
-    public double doubleValue() {
-        return bigDecimalValue().doubleValue();
-    }
-
-    @Override
-    public BigInteger bigIntegerValue() {
-        return bigDecimalValue().toBigInteger();
-    }
-
-    @Override
-    public BigInteger bigIntegerValueExact() {
-        return bigDecimalValue().toBigIntegerExact();
-    }
-
-    @Override
-    public ValueType getValueType() {
-        return ValueType.NUMBER;
-    }
-
-    @Override
-    public int hashCode() {
-        return bigDecimalValue().hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj){
-            return true;
-        }
-        if (!(obj instanceof JsonNumber)) {
-            return false;
-        }
-        JsonNumber other = (JsonNumber)obj;
-        return bigDecimalValue().equals(other.bigDecimalValue());
-    }
-
-    @Override
-    public String toString() {
-        return bigDecimalValue().toString();
-    }
-
-}
-
Index: trunk/src/org/glassfish/json/JsonObjectBuilderImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonObjectBuilderImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,351 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.JsonArrayBuilder;
-import javax.json.*;
-import java.io.StringWriter;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.*;
-
-/**
- * JsonObjectBuilder implementation
- *
- * @author Jitendra Kotamraju
- * @author Kin-man Chung
- */
-class JsonObjectBuilderImpl implements JsonObjectBuilder {
-
-    private Map<String, JsonValue> valueMap;
-    private final BufferPool bufferPool;
-
-    JsonObjectBuilderImpl(BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-    }
-
-    JsonObjectBuilderImpl(JsonObject object, BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-        valueMap = new LinkedHashMap<>();
-        valueMap.putAll(object);
-    }
-
-    JsonObjectBuilderImpl(Map<String, Object> map, BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-        valueMap = new LinkedHashMap<>();
-        populate(map);
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, JsonValue value) {
-        validateName(name);
-        validateValue(value);
-        putValueMap(name, value);
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, String value) {
-        validateName(name);
-        validateValue(value);
-        putValueMap(name, new JsonStringImpl(value));
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, BigInteger value) {
-        validateName(name);
-        validateValue(value);
-        putValueMap(name, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, BigDecimal value) {
-        validateName(name);
-        validateValue(value);
-        putValueMap(name, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, int value) {
-        validateName(name);
-        putValueMap(name, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, long value) {
-        validateName(name);
-        putValueMap(name, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, double value) {
-        validateName(name);
-        putValueMap(name, JsonNumberImpl.getJsonNumber(value));
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, boolean value) {
-        validateName(name);
-        putValueMap(name, value ? JsonValue.TRUE : JsonValue.FALSE);
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder addNull(String name) {
-        validateName(name);
-        putValueMap(name, JsonValue.NULL);
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, JsonObjectBuilder builder) {
-        validateName(name);
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.OBJBUILDER_OBJECT_BUILDER_NULL());
-        }
-        putValueMap(name, builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder add(String name, JsonArrayBuilder builder) {
-        validateName(name);
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.OBJBUILDER_ARRAY_BUILDER_NULL());
-        }
-        putValueMap(name, builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder addAll(JsonObjectBuilder builder) {
-        if (builder == null) {
-            throw new NullPointerException(JsonMessages.OBJBUILDER_OBJECT_BUILDER_NULL());
-        }
-        if (valueMap == null) {
-            this.valueMap = new LinkedHashMap<>();
-        }
-        this.valueMap.putAll(builder.build());
-        return this;
-    }
-
-    @Override
-    public JsonObjectBuilder remove(String name) {
-        validateName(name);
-        this.valueMap.remove(name);
-        return this;
-    }
-
-    @Override
-    public JsonObject build() {
-        Map<String, JsonValue> snapshot = (valueMap == null)
-                ? Collections.<String, JsonValue>emptyMap()
-                : Collections.unmodifiableMap(valueMap);
-        valueMap = null;
-        return new JsonObjectImpl(snapshot, bufferPool);
-    }
-
-    private void populate(Map<String, Object> map) {
-        final Set<String> fields = map.keySet();
-        for (String field : fields) {
-            Object value = map.get(field);
-            if (value != null && value instanceof Optional) {
-                ((Optional<?>) value).ifPresent(v ->
-                        this.valueMap.put(field, MapUtil.handle(v, bufferPool)));
-            } else {
-                this.valueMap.put(field, MapUtil.handle(value, bufferPool));
-            }
-        }
-    }
-
-    private void putValueMap(String name, JsonValue value) {
-        if (valueMap == null) {
-            this.valueMap = new LinkedHashMap<>();
-        }
-        valueMap.put(name, value);
-    }
-
-    private void validateName(String name) {
-        if (name == null) {
-            throw new NullPointerException(JsonMessages.OBJBUILDER_NAME_NULL());
-        }
-    }
-
-    private void validateValue(Object value) {
-        if (value == null) {
-            throw new NullPointerException(JsonMessages.OBJBUILDER_VALUE_NULL());
-        }
-    }
-
-    private static final class JsonObjectImpl extends AbstractMap<String, JsonValue> implements JsonObject {
-        private final Map<String, JsonValue> valueMap;      // unmodifiable
-        private final BufferPool bufferPool;
-
-        JsonObjectImpl(Map<String, JsonValue> valueMap, BufferPool bufferPool) {
-            this.valueMap = valueMap;
-            this.bufferPool = bufferPool;
-        }
-
-        @Override
-        public JsonArray getJsonArray(String name) {
-            return (JsonArray)get(name);
-        }
-
-        @Override
-        public JsonObject getJsonObject(String name) {
-            return (JsonObject)get(name);
-        }
-
-        @Override
-        public JsonNumber getJsonNumber(String name) {
-            return (JsonNumber)get(name);
-        }
-
-        @Override
-        public JsonString getJsonString(String name) {
-            return (JsonString)get(name);
-        }
-
-        @Override
-        public String getString(String name) {
-            return getJsonString(name).getString();
-        }
-
-        @Override
-        public String getString(String name, String defaultValue) {
-            try {
-                return getString(name);
-            } catch (Exception e) {
-                return defaultValue;
-            }
-        }
-
-        @Override
-        public int getInt(String name) {
-            return getJsonNumber(name).intValue();
-        }
-
-        @Override
-        public int getInt(String name, int defaultValue) {
-            try {
-                return getInt(name);
-            } catch (Exception e) {
-                return defaultValue;
-            }
-        }
-
-        @Override
-        public boolean getBoolean(String name) {
-            JsonValue value = get(name);
-            if (value == null) {
-                throw new NullPointerException();
-            } else if (value == JsonValue.TRUE) {
-                return true;
-            } else if (value == JsonValue.FALSE) {
-                return false;
-            } else {
-                throw new ClassCastException();
-            }
-        }
-
-        @Override
-        public boolean getBoolean(String name, boolean defaultValue) {
-            try {
-                return getBoolean(name);
-            } catch (Exception e) {
-                return defaultValue;
-            }
-        }
-
-        @Override
-        public boolean isNull(String name) {
-            return get(name).equals(JsonValue.NULL);
-        }
-
-        @Override
-        public ValueType getValueType() {
-            return ValueType.OBJECT;
-        }
-
-        @Override
-        public Set<Entry<String, JsonValue>> entrySet() {
-            return valueMap.entrySet();
-        }
-
-        @Override
-        public String toString() {
-            StringWriter sw = new StringWriter();
-            try (JsonWriter jw = new JsonWriterImpl(sw, bufferPool)) {
-                jw.write(this);
-            }
-            return sw.toString();
-        }
-
-        @Override
-        public JsonObject asJsonObject() {
-            return this;
-        }
-
-        @Override
-        public int size() {
-            return valueMap.size();
-        }
-
-        @Override
-        public JsonValue get(Object key) {
-            return valueMap.get(key);
-        }
-
-        @Override
-        public boolean containsKey(Object key) {
-            return valueMap.containsKey(key);
-        }
-    }
-
-}
Index: trunk/src/org/glassfish/json/JsonParserFactoryImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonParserFactoryImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.JsonArray;
-import javax.json.JsonObject;
-import javax.json.stream.JsonParserFactory;
-import javax.json.stream.JsonParser;
-import java.io.InputStream;
-import java.io.Reader;
-import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * @author Jitendra Kotamraju
- */
-class JsonParserFactoryImpl implements JsonParserFactory {
-    private final Map<String, ?> config = Collections.emptyMap();
-    private final BufferPool bufferPool;
-
-    JsonParserFactoryImpl(BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-    }
-
-    @Override
-    public JsonParser createParser(Reader reader) {
-        return new JsonParserImpl(reader, bufferPool);
-    }
-
-    @Override
-    public JsonParser createParser(InputStream in) {
-        return new JsonParserImpl(in, bufferPool);
-    }
-
-    @Override
-    public JsonParser createParser(InputStream in, Charset charset) {
-        return new JsonParserImpl(in, charset, bufferPool);
-    }
-
-    @Override
-    public JsonParser createParser(JsonArray array) {
-        return new JsonStructureParser(array);
-    }
-
-    @Override
-    public Map<String, ?> getConfigInUse() {
-        return config;
-    }
-
-    @Override
-    public JsonParser createParser(JsonObject object) {
-        return new JsonStructureParser(object);
-    }
-}
Index: trunk/src/org/glassfish/json/JsonParserImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonParserImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,563 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.nio.charset.Charset;
-import java.util.AbstractMap;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Spliterator;
-import java.util.Spliterators;
-import java.util.function.Consumer;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-
-import javax.json.JsonArray;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonException;
-import javax.json.JsonObject;
-import javax.json.JsonObjectBuilder;
-import javax.json.JsonValue;
-import javax.json.stream.JsonLocation;
-import javax.json.stream.JsonParser;
-import javax.json.stream.JsonParser.Event;
-import javax.json.stream.JsonParsingException;
-
-import org.glassfish.json.JsonTokenizer.JsonToken;
-import org.glassfish.json.api.BufferPool;
-
-/**
- * JSON parser implementation. NoneContext, ArrayContext, ObjectContext is used
- * to go to next parser state.
- *
- * @author Jitendra Kotamraju
- * @author Kin-man Chung
- */
-public class JsonParserImpl implements JsonParser {
-
-    private final BufferPool bufferPool;
-    private Context currentContext = new NoneContext();
-    private Event currentEvent;
-
-    private final Stack stack = new Stack();
-    private final JsonTokenizer tokenizer;
-
-    public JsonParserImpl(Reader reader, BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-        tokenizer = new JsonTokenizer(reader, bufferPool);
-    }
-
-    public JsonParserImpl(InputStream in, BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-        UnicodeDetectingInputStream uin = new UnicodeDetectingInputStream(in);
-        tokenizer = new JsonTokenizer(new InputStreamReader(uin, uin.getCharset()), bufferPool);
-    }
-
-    public JsonParserImpl(InputStream in, Charset encoding, BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-        tokenizer = new JsonTokenizer(new InputStreamReader(in, encoding), bufferPool);
-    }
-
-    @Override
-    public String getString() {
-        if (currentEvent == Event.KEY_NAME || currentEvent == Event.VALUE_STRING
-                || currentEvent == Event.VALUE_NUMBER) {
-            return tokenizer.getValue();
-        }
-        throw new IllegalStateException(
-                JsonMessages.PARSER_GETSTRING_ERR(currentEvent));
-    }
-
-    @Override
-    public boolean isIntegralNumber() {
-        if (currentEvent != Event.VALUE_NUMBER) {
-            throw new IllegalStateException(
-                    JsonMessages.PARSER_ISINTEGRALNUMBER_ERR(currentEvent));
-        }
-        return tokenizer.isIntegral();
-    }
-
-    @Override
-    public int getInt() {
-        if (currentEvent != Event.VALUE_NUMBER) {
-            throw new IllegalStateException(
-                    JsonMessages.PARSER_GETINT_ERR(currentEvent));
-        }
-        return tokenizer.getInt();
-    }
-
-    boolean isDefinitelyInt() {
-        return tokenizer.isDefinitelyInt();
-    }
-
-    boolean isDefinitelyLong() {
-    	return tokenizer.isDefinitelyLong();
-    }
-
-    @Override
-    public long getLong() {
-        if (currentEvent != Event.VALUE_NUMBER) {
-            throw new IllegalStateException(
-                    JsonMessages.PARSER_GETLONG_ERR(currentEvent));
-        }
-        return tokenizer.getLong();
-    }
-
-    @Override
-    public BigDecimal getBigDecimal() {
-        if (currentEvent != Event.VALUE_NUMBER) {
-            throw new IllegalStateException(
-                    JsonMessages.PARSER_GETBIGDECIMAL_ERR(currentEvent));
-        }
-        return tokenizer.getBigDecimal();
-    }
-
-    @Override
-    public JsonArray getArray() {
-        if (currentEvent != Event.START_ARRAY) {
-            throw new IllegalStateException(
-                JsonMessages.PARSER_GETARRAY_ERR(currentEvent));
-        }
-        return getArray(new JsonArrayBuilderImpl(bufferPool));
-    }
-
-    @Override
-    public JsonObject getObject() {
-        if (currentEvent != Event.START_OBJECT) {
-            throw new IllegalStateException(
-                JsonMessages.PARSER_GETOBJECT_ERR(currentEvent));
-        }
-        return getObject(new JsonObjectBuilderImpl(bufferPool));
-    }
-
-    @Override
-    public JsonValue getValue() {
-        switch (currentEvent) {
-            case START_ARRAY:
-                return getArray(new JsonArrayBuilderImpl(bufferPool));
-            case START_OBJECT:
-                return getObject(new JsonObjectBuilderImpl(bufferPool));
-            case KEY_NAME:
-            case VALUE_STRING:
-                return new JsonStringImpl(getString());
-            case VALUE_NUMBER:
-                if (isDefinitelyInt()) {
-                    return JsonNumberImpl.getJsonNumber(getInt());
-                } else if (isDefinitelyLong()) {
-                    return JsonNumberImpl.getJsonNumber(getLong());
-                }
-                return JsonNumberImpl.getJsonNumber(getBigDecimal());
-            case VALUE_TRUE:
-                return JsonValue.TRUE;
-            case VALUE_FALSE:
-                return JsonValue.FALSE;
-            case VALUE_NULL:
-                return JsonValue.NULL;
-            case END_ARRAY:
-            case END_OBJECT:
-            default:
-            	throw new IllegalStateException(JsonMessages.PARSER_GETVALUE_ERR(currentEvent));
-        }
-    }
-
-    @Override
-    public Stream<JsonValue> getArrayStream() {
-        if (currentEvent != Event.START_ARRAY) {
-            throw new IllegalStateException(
-                JsonMessages.PARSER_GETARRAY_ERR(currentEvent));
-        }
-        Spliterator<JsonValue> spliterator =
-                new Spliterators.AbstractSpliterator<JsonValue>(Long.MAX_VALUE, Spliterator.ORDERED) {
-            @Override
-            public Spliterator<JsonValue> trySplit() {
-                return null;
-            }
-            @Override
-            public boolean tryAdvance(Consumer<? super JsonValue> action) {
-                if (action == null) {
-                    throw new NullPointerException();
-                }
-                if (! hasNext()) {
-                    return false;
-                }
-                if (next() == JsonParser.Event.END_ARRAY) {
-                    return false;
-                }
-                action.accept(getValue());
-                return true;
-            }
-        };
-        return StreamSupport.stream(spliterator, false);
-    }
-
-    @Override
-    public Stream<Map.Entry<String, JsonValue>> getObjectStream() {
-        if (currentEvent != Event.START_OBJECT) {
-            throw new IllegalStateException(
-                JsonMessages.PARSER_GETOBJECT_ERR(currentEvent));
-        }
-        Spliterator<Map.Entry<String, JsonValue>> spliterator =
-                new Spliterators.AbstractSpliterator<Map.Entry<String, JsonValue>>(Long.MAX_VALUE, Spliterator.ORDERED) {
-            @Override
-            public Spliterator<Map.Entry<String,JsonValue>> trySplit() {
-                return null;
-            }
-            @Override
-            public boolean tryAdvance(Consumer<? super Map.Entry<String, JsonValue>> action) {
-                if (action == null) {
-                    throw new NullPointerException();
-                }
-                if (! hasNext()) {
-                    return false;
-                }
-                JsonParser.Event e = next();
-                if (e == JsonParser.Event.END_OBJECT) {
-                    return false;
-                }
-                if (e != JsonParser.Event.KEY_NAME) {
-                    throw new JsonException(JsonMessages.INTERNAL_ERROR());
-                }
-                String key = getString();
-                if (! hasNext()) {
-                    throw new JsonException(JsonMessages.INTERNAL_ERROR());
-                }
-                next();
-                JsonValue value = getValue();
-                action.accept(new AbstractMap.SimpleImmutableEntry<>(key, value));
-                return true;
-            }
-        };
-        return StreamSupport.stream(spliterator, false);
-    }
-
-    @Override
-    public Stream<JsonValue> getValueStream() {
-        if (! (currentContext instanceof NoneContext)) {
-            throw new IllegalStateException(
-                JsonMessages.PARSER_GETVALUESTREAM_ERR());
-        }
-        Spliterator<JsonValue> spliterator =
-                new Spliterators.AbstractSpliterator<JsonValue>(Long.MAX_VALUE, Spliterator.ORDERED) {
-            @Override
-            public Spliterator<JsonValue> trySplit() {
-                return null;
-            }
-            @Override
-            public boolean tryAdvance(Consumer<? super JsonValue> action) {
-                if (action == null) {
-                    throw new NullPointerException();
-                }
-                if (! hasNext()) {
-                    return false;
-                }
-                next();
-                action.accept(getValue());
-                return true;
-            }
-        };
-        return StreamSupport.stream(spliterator, false);
-    }
-
-    @Override
-    public void skipArray() {
-        if (currentEvent == Event.START_ARRAY) {
-            currentContext.skip();
-            currentContext = stack.pop();
-        }
-    }
-
-    @Override
-    public void skipObject() {
-        if (currentEvent == Event.START_OBJECT) {
-            currentContext.skip();
-            currentContext = stack.pop();
-        }
-    }
-
-    private JsonArray getArray(JsonArrayBuilder builder) {
-        while(hasNext()) {
-            JsonParser.Event e = next();
-            if (e == JsonParser.Event.END_ARRAY) {
-                return builder.build();
-            }
-            builder.add(getValue());
-        }
-        throw parsingException(JsonToken.EOF, "[CURLYOPEN, SQUAREOPEN, STRING, NUMBER, TRUE, FALSE, NULL, SQUARECLOSE]");
-    }
-
-    private JsonObject getObject(JsonObjectBuilder builder) {
-        while(hasNext()) {
-            JsonParser.Event e = next();
-            if (e == JsonParser.Event.END_OBJECT) {
-                return builder.build();
-            }
-            String key = getString();
-            next();
-            builder.add(key, getValue());
-        }
-        throw parsingException(JsonToken.EOF, "[STRING, CURLYCLOSE]");
-    }
-
-    @Override
-    public JsonLocation getLocation() {
-        return tokenizer.getLocation();
-    }
-
-    public JsonLocation getLastCharLocation() {
-        return tokenizer.getLastCharLocation();
-    }
-
-    @Override
-    public boolean hasNext() {
-        return tokenizer.hasNextToken();
-    }
-
-    @Override
-    public Event next() {
-        if (!hasNext()) {
-            throw new NoSuchElementException();
-        }
-        return currentEvent = currentContext.getNextEvent();
-    }
-
-    @Override
-    public void close() {
-        try {
-            tokenizer.close();
-        } catch (IOException e) {
-            throw new JsonException(JsonMessages.PARSER_TOKENIZER_CLOSE_IO(), e);
-        }
-    }
-
-    // Using the optimized stack impl as we don't require other things
-    // like iterator etc.
-    private static final class Stack {
-        private Context head;
-
-        private void push(Context context) {
-            context.next = head;
-            head = context;
-        }
-
-        private Context pop() {
-            if (head == null) {
-                throw new NoSuchElementException();
-            }
-            Context temp = head;
-            head = head.next;
-            return temp;
-        }
-
-        private Context peek() {
-            return head;
-        }
-
-        private boolean isEmpty() {
-            return head == null;
-        }
-    }
-
-    private abstract class Context {
-        Context next;
-        abstract Event getNextEvent();
-        abstract void skip();
-    }
-
-    private final class NoneContext extends Context {
-        @Override
-        public Event getNextEvent() {
-            // Handle 1. {   2. [   3. value
-            JsonToken token = tokenizer.nextToken();
-            if (token == JsonToken.CURLYOPEN) {
-                stack.push(currentContext);
-                currentContext = new ObjectContext();
-                return Event.START_OBJECT;
-            } else if (token == JsonToken.SQUAREOPEN) {
-                stack.push(currentContext);
-                currentContext = new ArrayContext();
-                return Event.START_ARRAY;
-            } else if (token.isValue()) {
-                return token.getEvent();
-            }
-            throw parsingException(token, "[CURLYOPEN, SQUAREOPEN, STRING, NUMBER, TRUE, FALSE, NULL]");
-        }
-
-        @Override
-        void skip() {
-            // no-op
-        }
-    }
-
-    private JsonParsingException parsingException(JsonToken token, String expectedTokens) {
-        JsonLocation location = getLastCharLocation();
-        return new JsonParsingException(
-                JsonMessages.PARSER_INVALID_TOKEN(token, location, expectedTokens), location);
-    }
-
-    private final class ObjectContext extends Context {
-        private boolean firstValue = true;
-
-        /*
-         * Some more things could be optimized. For example, instead
-         * tokenizer.nextToken(), one could use tokenizer.matchColonToken() to
-         * match ':'. That might optimize a bit, but will fragment nextToken().
-         * I think the current one is more readable.
-         *
-         */
-        @Override
-        public Event getNextEvent() {
-            // Handle 1. }   2. name:value   3. ,name:value
-            JsonToken token = tokenizer.nextToken();
-            if (currentEvent == Event.KEY_NAME) {
-                // Handle 1. :value
-                if (token != JsonToken.COLON) {
-                    throw parsingException(token, "[COLON]");
-                }
-                token = tokenizer.nextToken();
-                if (token.isValue()) {
-                    return token.getEvent();
-                } else if (token == JsonToken.CURLYOPEN) {
-                    stack.push(currentContext);
-                    currentContext = new ObjectContext();
-                    return Event.START_OBJECT;
-                } else if (token == JsonToken.SQUAREOPEN) {
-                    stack.push(currentContext);
-                    currentContext = new ArrayContext();
-                    return Event.START_ARRAY;
-                }
-                throw parsingException(token, "[CURLYOPEN, SQUAREOPEN, STRING, NUMBER, TRUE, FALSE, NULL]");
-            } else {
-                // Handle 1. }   2. name   3. ,name
-                if (token == JsonToken.CURLYCLOSE) {
-                    currentContext = stack.pop();
-                    return Event.END_OBJECT;
-                }
-                if (firstValue) {
-                    firstValue = false;
-                } else {
-                    if (token != JsonToken.COMMA) {
-                        throw parsingException(token, "[COMMA]");
-                    }
-                    token = tokenizer.nextToken();
-                }
-                if (token == JsonToken.STRING) {
-                    return Event.KEY_NAME;
-                }
-                throw parsingException(token, "[STRING]");
-            }
-        }
-
-        @Override
-        void skip() {
-            JsonToken token;
-            int depth = 1;
-            do {
-                token = tokenizer.nextToken();
-                switch (token) {
-                    case CURLYCLOSE:
-                        depth--;
-                        break;
-                    case CURLYOPEN:
-                        depth++;
-                        break;
-                }
-            } while (!(token == JsonToken.CURLYCLOSE && depth == 0));
-        }
-
-    }
-
-    private final class ArrayContext extends Context {
-        private boolean firstValue = true;
-
-        // Handle 1. ]   2. value   3. ,value
-        @Override
-        public Event getNextEvent() {
-            JsonToken token = tokenizer.nextToken();
-            if (token == JsonToken.SQUARECLOSE) {
-                currentContext = stack.pop();
-                return Event.END_ARRAY;
-            }
-            if (firstValue) {
-                firstValue = false;
-            } else {
-                if (token != JsonToken.COMMA) {
-                    throw parsingException(token, "[COMMA]");
-                }
-                token = tokenizer.nextToken();
-            }
-            if (token.isValue()) {
-                return token.getEvent();
-            } else if (token == JsonToken.CURLYOPEN) {
-                stack.push(currentContext);
-                currentContext = new ObjectContext();
-                return Event.START_OBJECT;
-            } else if (token == JsonToken.SQUAREOPEN) {
-                stack.push(currentContext);
-                currentContext = new ArrayContext();
-                return Event.START_ARRAY;
-            }
-            throw parsingException(token, "[CURLYOPEN, SQUAREOPEN, STRING, NUMBER, TRUE, FALSE, NULL]");
-        }
-
-        @Override
-        void skip() {
-            JsonToken token;
-            int depth = 1;
-            do {
-                token = tokenizer.nextToken();
-                switch (token) {
-                    case SQUARECLOSE:
-                        depth--;
-                        break;
-                    case SQUAREOPEN:
-                        depth++;
-                        break;
-                }
-            } while (!(token == JsonToken.SQUARECLOSE && depth == 0));
-        }
-    }
-
-}
Index: trunk/src/org/glassfish/json/JsonPatchBuilderImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonPatchBuilderImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,362 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2015-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonException;
-import javax.json.JsonPatch;
-import javax.json.JsonPatch.Operation;
-import javax.json.JsonPatchBuilder;
-import javax.json.JsonStructure;
-import javax.json.JsonValue;
-
-/**
- * A builder for constructing a JSON Patch by adding
- * JSON Patch operations incrementally.
- * <p>
- * The following illustrates the approach.
- * <pre>
- *   JsonPatchBuilder builder = Json.createPatchBuilder();
- *   JsonPatch patch = builder.add("/John/phones/office", "1234-567")
- *                            .remove("/Amy/age")
- *                            .build();
- * </pre>
- * The result is equivalent to the following JSON Patch.
- * <pre>
- * [
- *    {"op" = "add", "path" = "/John/phones/office", "value" = "1234-567"},
- *    {"op" = "remove", "path" = "/Amy/age"}
- * ] </pre>
- *
- * @since 1.1
- */
-public final class JsonPatchBuilderImpl implements JsonPatchBuilder {
-
-    private final JsonArrayBuilder builder;
-
-    /**
-     * Creates a JsonPatchBuilderImpl, starting with the specified
-     * JSON Patch
-     * @param patch the JSON Patch
-     */
-    public JsonPatchBuilderImpl(JsonArray patch) {
-        builder = Json.createArrayBuilder(patch);
-    }
-
-    /**
-     * Creates JsonPatchBuilderImpl with empty JSON Patch
-     */
-    public JsonPatchBuilderImpl() {
-        builder = Json.createArrayBuilder();
-    }
-
-    /**
-     * A convenience method for {@code new JsonPatchImpl(build()).apply(target)}.
-     * The target is not modified by the patch.
-     *
-     * @param <T> the target type, must be a subtype of {@link JsonStructure}
-     * @param target the target to apply the patch operations
-     * @return the transformed target after the patch
-     * @throws JsonException if the supplied JSON Patch is malformed or if
-     *    it contains references to non-existing members
-     */
-    public <T extends JsonStructure> T apply(T target) {
-        return build().apply(target);
-    }
-
-    /**
-     * Adds an "add" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder add(String path, JsonValue value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.ADD.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                   );
-        return this;
-    }
-
-    /**
-     * Adds an "add" JSON Patch operation
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder add(String path, String value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.ADD.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                   );
-        return this;
-    }
-
-    /**
-     * Adds an "add" JSON Patch operation
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder add(String path, int value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.ADD.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds an "add" JSON Patch operation
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder add(String path, boolean value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.ADD.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                   );
-        return this;
-    }
-
-    /**
-     * Adds a "remove" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder remove(String path) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.REMOVE.operationName())
-                           .add("path", path)
-                    );
-        return this;
-    }
-
-    /**
-     * Adds a "replace" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder replace(String path, JsonValue value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.REPLACE.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds a "replace" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder replace(String path, String value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.REPLACE.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds a "replace" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder replace(String path, int value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.REPLACE.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds a "replace" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder replace(String path, boolean value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.REPLACE.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds a "move" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param from the "from" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder move(String path, String from) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.MOVE.operationName())
-                           .add("path", path)
-                           .add("from", from)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds a "copy" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param from the "from" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder copy(String path, String from) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.COPY.operationName())
-                           .add("path", path)
-                           .add("from", from)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds a "test" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder test(String path, JsonValue value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.TEST.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds a "test" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder test(String path, String value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.TEST.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds a "test" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder test(String path, int value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.TEST.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                  );
-        return this;
-    }
-
-    /**
-     * Adds a "test" JSON Patch operation.
-     * @param path the "path" member of the operation
-     * @param value the "value" member of the operation
-     * @return this JsonPatchBuilder
-     */
-    @Override
-    public JsonPatchBuilder test(String path, boolean value) {
-        builder.add(Json.createObjectBuilder()
-                           .add("op", Operation.TEST.operationName())
-                           .add("path", path)
-                           .add("value", value)
-                  );
-        return this;
-    }
-
-    /**
-     * Returns the patch operations in a JsonArray
-     * @return the patch operations in a JsonArray
-     */
-    public JsonArray buildAsJsonArray() {
-        return builder.build();
-    }
-
-    /**
-     * Returns the patch operation in a JsonPatch
-     * @return the patch operation in a JsonPatch
-     */
-    @Override
-    public JsonPatch build() {
-        return new JsonPatchImpl(buildAsJsonArray());
-    }
-}
-
Index: trunk/src/org/glassfish/json/JsonPatchImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonPatchImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,321 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2015-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.*;
-import javax.json.JsonValue.ValueType;
-
-/**
- * This class is an immutable representation of a JSON Patch as specified in
- * <a href="http://tools.ietf.org/html/rfc6902">RFC 6902</a>.
- * <p>A {@code JsonPatch} can be instantiated with {@link Json#createPatch(JsonArray)}
- * by specifying the patch operations in a JSON Patch. Alternately, it
- * can also be constructed with a {@link JsonPatchBuilder}.
- * </p>
- * The following illustrates both approaches.
- * <p>1. Construct a JsonPatch with a JSON Patch.
- * <pre>{@code
- *   JsonArray contacts = ... // The target to be patched
- *   JsonArray patch = ...  ; // JSON Patch
- *   JsonPatch jsonpatch = Json.createPatch(patch);
- *   JsonArray result = jsonpatch.apply(contacts);
- * } </pre>
- * 2. Construct a JsonPatch with JsonPatchBuilder.
- * <pre>{@code
- *   JsonPatchBuilder builder = Json.createPatchBuilder();
- *   JsonArray result = builder.add("/John/phones/office", "1234-567")
- *                             .remove("/Amy/age")
- *                             .build()
- *                             .apply(contacts);
- * } </pre>
- *
- * @since 1.1
- */
-public class JsonPatchImpl implements JsonPatch {
-
-    private final JsonArray patch;
-
-    /**
-     * Constructs a JsonPatchImpl
-     * @param patch the JSON Patch
-     */
-    public JsonPatchImpl(JsonArray patch) {
-        this.patch = patch;
-    }
-
-    /**
-     * Compares this {@code JsonPatchImpl} with another object.
-     * @param obj the object to compare this {@code JsonPatchImpl} against
-     * @return true if the given object is a {@code JsonPatchImpl} with the same
-     * reference tokens as this one, false otherwise.
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null || obj.getClass() != JsonPatchImpl.class)
-            return false;
-        return patch.equals(((JsonPatchImpl)obj).patch);
-    }
-
-    /**
-     * Returns the hash code value for this {@code JsonPatchImpl}.
-     *
-     * @return the hash code value for this {@code JsonPatchImpl} object
-     */
-    @Override
-    public int hashCode() {
-        return patch.hashCode();
-    }
-
-    /**
-     * Returns the JSON Patch text
-     * @return the JSON Patch text
-     */
-    @Override
-    public String toString() {
-        return patch.toString();
-    }
-
-    /**
-     * Applies the patch operations to the specified {@code target}.
-     * The target is not modified by the patch.
-     *
-     * @param target the target to apply the patch operations
-     * @return the transformed target after the patch
-     * @throws JsonException if the supplied JSON Patch is malformed or if
-     *    it contains references to non-existing members
-     */
-    @Override
-    public JsonStructure apply(JsonStructure target) {
-
-        JsonStructure result = target;
-
-        for (JsonValue operation: patch) {
-            if (operation.getValueType() != ValueType.OBJECT) {
-                throw new JsonException(JsonMessages.PATCH_MUST_BE_ARRAY());
-            }
-            result = apply(result, (JsonObject) operation);
-        }
-        return result;
-    }
-
-    @Override
-    public JsonArray toJsonArray() {
-        return patch;
-    }
-
-    /**
-     * Generates a JSON Patch from the source and target {@code JsonStructure}.
-     * The generated JSON Patch need not be unique.
-     * @param source the source
-     * @param target the target, must be the same type as the source
-     * @return a JSON Patch which when applied to the source, yields the target
-     */
-    public static JsonArray diff(JsonStructure source, JsonStructure target) {
-        return (new DiffGenerator()).diff(source, target);
-    }
-
-    /**
-     * Applies a JSON Patch operation to the target.
-     * @param target the target to apply the operation
-     * @param operation the JSON Patch operation
-     * @return the target after the patch
-     */
-    private JsonStructure apply(JsonStructure target, JsonObject operation) {
-
-        JsonPointer pointer = getPointer(operation, "path");
-        JsonPointer from;
-        switch (Operation.fromOperationName(operation.getString("op"))) {
-            case ADD:
-                return pointer.add(target, getValue(operation));
-            case REPLACE:
-                return pointer.replace(target, getValue(operation));
-            case REMOVE:
-                return pointer.remove(target);
-            case COPY:
-                from = getPointer(operation, "from");
-                return pointer.add(target, from.getValue(target));
-            case MOVE:
-                // Check if from is a proper prefix of path
-                String dest = operation.getString("path");
-                String src = operation.getString("from");
-                if (dest.startsWith(src) && src.length() < dest.length()) {
-                    throw new JsonException(JsonMessages.PATCH_MOVE_PROPER_PREFIX(src, dest));
-                }
-                from = getPointer(operation, "from");
-                // Check if 'from' exists in target object
-                if (!from.containsValue(target)) {
-                    throw new JsonException(JsonMessages.PATCH_MOVE_TARGET_NULL(src));
-                }
-                if (pointer.equals(from)) {
-                    // nop
-                    return target;
-                }
-                return pointer.add(from.remove(target), from.getValue(target));
-            case TEST:
-                if (! getValue(operation).equals(pointer.getValue(target))) {
-                    throw new JsonException(JsonMessages.PATCH_TEST_FAILED(operation.getString("path"), getValue(operation).toString()));
-                }
-                return target;
-            default:
-                throw new JsonException(JsonMessages.PATCH_ILLEGAL_OPERATION(operation.getString("op")));
-        }
-    }
-
-    private JsonPointer getPointer(JsonObject operation, String member) {
-        JsonString pointerString = operation.getJsonString(member);
-        if (pointerString == null) {
-            missingMember(operation.getString("op"), member);
-        }
-        return Json.createPointer(pointerString.getString());
-    }
-
-    private JsonValue getValue(JsonObject operation) {
-        JsonValue value = operation.get("value");
-        if (value == null) {
-            missingMember(operation.getString("op"), "value");
-        }
-        return value;
-    }
-
-    private void missingMember(String op, String  member) {
-        throw new JsonException(JsonMessages.PATCH_MEMBER_MISSING(op, member));
-    }
-
-    static class DiffGenerator {
-        private JsonPatchBuilder builder;
-
-        JsonArray diff(JsonStructure source, JsonStructure target) {
-            builder = Json.createPatchBuilder();
-            diff("", source, target);
-            return builder.build().toJsonArray();
-        }
-
-        private void diff(String path, JsonValue source, JsonValue target) {
-            if (source.equals(target)) {
-                return;
-            }
-            ValueType s = source.getValueType();
-            ValueType t = target.getValueType();
-            if (s == ValueType.OBJECT && t == ValueType.OBJECT) {
-                diffObject(path, (JsonObject) source, (JsonObject) target);
-            } else if (s == ValueType.ARRAY && t == ValueType.ARRAY) {
-                diffArray(path, (JsonArray) source, (JsonArray) target);
-            } else {
-                builder.replace(path, target);
-            }
-        }
-
-        private void diffObject(String path, JsonObject source, JsonObject target) {
-            source.forEach((key, value) -> {
-                if (target.containsKey(key)) {
-                    diff(path + '/' + key, value, target.get(key));
-                } else {
-                    builder.remove(path + '/' + key);
-                }
-            });
-            target.forEach((key, value) -> {
-                if (! source.containsKey(key)) {
-                    builder.add(path + '/' + key, value);
-                }
-            });
-        }
-
-        /*
-         * For array element diff, find the longest common subsequence, per
-         * http://en.wikipedia.org/wiki/Longest_common_subsequence_problem .
-         * We modify the algorithm to generate a replace if possible.
-         */
-        private void diffArray(String path, JsonArray source, JsonArray target) {
-            /* The array c keeps track of length of the subsequence. To avoid
-             * computing the equality of array elements again, we
-             * left shift its value by 1, and use the low order bit to mark
-             * that two items are equal.
-             */
-            int m = source.size();
-            int n = target.size();
-            int [][] c = new int[m+1][n+1];
-            for (int i = 0; i < m+1; i++)
-                c[i][0] = 0;
-            for (int i = 0; i < n+1; i++)
-                c[0][i] = 0;
-            for (int i = 0; i < m; i++) {
-                for (int j = 0; j < n; j++) {
-                    if (source.get(i).equals(target.get(j))) {
-                        c[i+1][j+1] = ((c[i][j]) & ~1) + 3;
-                        // 3 = (1 << 1) | 1;
-                    } else {
-                        c[i+1][j+1] = Math.max(c[i+1][j], c[i][j+1]) & ~1;
-                    }
-                }
-            }
-
-            int i = m;
-            int j = n;
-            while (i > 0 || j > 0) {
-                if (i == 0) {
-                    j--;
-                    builder.add(path + '/' + j, target.get(j));
-                } else if (j == 0) {
-                    i--;
-                    builder.remove(path + '/' + i);
-                } else if ((c[i][j] & 1) == 1) {
-                    i--; j--;
-                } else {
-                    int f = c[i][j-1] >> 1;
-                    int g = c[i-1][j] >> 1;
-                    if (f > g) {
-                        j--;
-                        builder.add(path + '/' + j, target.get(j));
-                    } else if (f < g) {
-                        i--;
-                        builder.remove(path + '/' + i);
-                    } else { // f == g) {
-                       i--; j--;
-                       diff(path + '/' + i, source.get(i), target.get(j));
-                    }
-                }
-            }
-        }
-    }
-}
-
Index: trunk/src/org/glassfish/json/JsonPointerImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonPointerImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,316 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2015-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.JsonArray;
-import javax.json.JsonException;
-import javax.json.JsonObject;
-import javax.json.JsonPointer;
-import javax.json.JsonStructure;
-import javax.json.JsonValue;
-import java.io.Serializable;
-import java.util.function.BiFunction;
-
-/**
- * <p>This class is an immutable representation of a JSON Pointer as specified in
- * <a href="http://tools.ietf.org/html/rfc6901">RFC 6901</a>.
- * </p>
- * <p> A JSON Pointer, when applied to a target {@link JsonValue},
- * defines a reference location in the target.</p>
- * <p> An empty JSON Pointer string defines a reference to the target itself.</p>
- * <p> If the JSON Pointer string is non-empty, it must be a sequence
- * of '/' prefixed tokens, and the target must either be a {@link JsonArray}
- * or {@link JsonObject}. If the target is a {@code JsonArray}, the pointer
- * defines a reference to an array element, and the last token specifies the index.
- * If the target is a {@link JsonObject}, the pointer defines a reference to a
- * name/value pair, and the last token specifies the name.
- * </p>
- * <p> The method {@link #getValue getValue()} returns the referenced value.
- * The methods {@link #add add()}, {@link #replace replace()},
- * and {@link #remove remove()} executes the operations specified in
- * <a href="http://tools.ietf.org/html/rfc6902">RFC 6902</a>. </p>
- *
- * @since 1.1
- */
-
-public final class JsonPointerImpl implements JsonPointer, Serializable {
-
-    private static final long serialVersionUID = -8123110179640843141L;
-    private final String[] tokens;
-    private final String jsonPointer;
-
-    /**
-     * Constructs and initializes a JsonPointerImpl.
-     * @param jsonPointer the JSON Pointer string
-     * @throws NullPointerException if {@code jsonPointer} is {@code null}
-     * @throws JsonException if {@code jsonPointer} is not a valid JSON Pointer
-     */
-    public JsonPointerImpl(String jsonPointer) {
-        this.jsonPointer = jsonPointer;
-        tokens = jsonPointer.split("/", -1);  // keep the trailing blanks
-        if (! "".equals(tokens[0])) {
-            throw new JsonException(JsonMessages.POINTER_FORMAT_INVALID());
-        }
-        for (int i = 1; i < tokens.length; i++) {
-            String token = tokens[i];
-            StringBuilder reftoken = new StringBuilder();
-            for (int j = 0; j < token.length(); j++) {
-                char ch = token.charAt(j);
-                if (ch == '~' && j < token.length() - 1) {
-                    char ch1 = token.charAt(j+1);
-                    if (ch1 == '0') {
-                        ch = '~'; j++;
-                    } else if (ch1 == '1') {
-                        ch = '/'; j++;
-                    }
-                }
-                reftoken.append(ch);
-            }
-            tokens[i] = reftoken.toString();
-        }
-    }
-
-    /**
-     * Compares this {@code JsonPointer} with another object.
-     * @param obj the object to compare this {@code JsonPointer} against
-     * @return true if the given object is a {@code JsonPointer} with the same
-     * reference tokens as this one, false otherwise.
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null || obj.getClass() != JsonPointerImpl.class)
-            return false;
-        return jsonPointer.equals(((JsonPointerImpl)obj).jsonPointer);
-    }
-
-    /**
-     * Returns the hash code value for this {@code JsonPointer} object.
-     * The hash code of this object is defined by the hash codes of it's reference tokens.
-     *
-     * @return the hash code value for this {@code JsonPointer} object
-     */
-    @Override
-    public int hashCode() {
-        return jsonPointer.hashCode();
-    }
-
-    /**
-     * Returns {@code true} if there is a value at the referenced location in the specified {@code target}.
-     *
-     * @param target the target referenced by this {@code JsonPointer}
-     * @return {@code true} if this pointer points to a value in a specified {@code target}.
-     */
-    @Override
-    public boolean containsValue(JsonStructure target) {
-        NodeReference[] refs = getReferences(target);
-        return refs[0].contains();
-    }
-
-    /**
-     * Returns the value at the referenced location in the specified {@code target}
-     *
-     * @param target the target referenced by this {@code JsonPointer}
-     * @return the referenced value in the target.
-     * @throws NullPointerException if {@code target} is null
-     * @throws JsonException if the referenced value does not exist
-     */
-    @Override
-    public JsonValue getValue(JsonStructure target) {
-        NodeReference[] refs = getReferences(target);
-        return refs[0].get();
-    }
-
-    /**
-     * Adds or replaces a value at the referenced location in the specified
-     * {@code target} with the specified {@code value}.
-     * <ol>
-     * <li>If the reference is the target (empty JSON Pointer string),
-     * the specified {@code value}, which must be the same type as
-     * specified {@code target}, is returned.</li>
-     * <li>If the reference is an array element, the specified {@code value} is inserted
-     * into the array, at the referenced index. The value currently at that location, and
-     * any subsequent values, are shifted to the right (adds one to the indices).
-     * Index starts with 0. If the reference is specified with a "-", or if the
-     * index is equal to the size of the array, the value is appended to the array.</li>
-     * <li>If the reference is a name/value pair of a {@code JsonObject}, and the
-     * referenced value exists, the value is replaced by the specified {@code value}.
-     * If the value does not exist, a new name/value pair is added to the object.</li>
-     * </ol>
-     *
-     * @param target the target referenced by this {@code JsonPointer}
-     * @param value the value to be added
-     * @return the transformed {@code target} after the value is added.
-     * @throws NullPointerException if {@code target} is {@code null}
-     * @throws JsonException if the reference is an array element and
-     * the index is out of range ({@code index < 0 || index > array size}),
-     * or if the pointer contains references to non-existing objects or arrays.
-     */
-    @Override
-    public JsonStructure add(JsonStructure target, JsonValue value) {
-        return execute(NodeReference::add, target, value);
-    }
-
-    /**
-     * Replaces the value at the referenced location in the specified
-     * {@code target} with the specified {@code value}.
-     *
-     * @param target the target referenced by this {@code JsonPointer}
-     * @param value the value to be stored at the referenced location
-     * @return the transformed {@code target} after the value is replaced.
-     * @throws NullPointerException if {@code target} is {@code null}
-     * @throws JsonException if the referenced value does not exist,
-     *    or if the reference is the target.
-     */
-    @Override
-    public JsonStructure replace(JsonStructure target, JsonValue value) {
-        return execute(NodeReference::replace, target, value);
-    }
-
-    /**
-     * Removes the value at the reference location in the specified {@code target}
-     *
-     * @param target the target referenced by this {@code JsonPointer}
-     * @return the transformed {@code target} after the value is removed.
-     * @throws NullPointerException if {@code target} is {@code null}
-     * @throws JsonException if the referenced value does not exist,
-     *    or if the reference is the target.
-     */
-    @Override
-    public JsonStructure remove(JsonStructure target) {
-        return execute((r,v)->r.remove(), target, null);
-    }
-
-    /**
-     * Executes the operation
-     * @param op a {code BiFunction} used to specify the operation to execute on
-     *    the leaf node of the Json Pointer
-     * @param target the target JsonStructure for this JsonPointer
-     * @param value the JsonValue for add and replace, can be null for getvalue and remove
-     */
-    private JsonStructure execute(BiFunction<NodeReference, JsonValue, JsonStructure> op,
-            JsonStructure target, JsonValue value) {
-
-        NodeReference[] refs = getReferences(target);
-        JsonStructure result = op.apply(refs[0], value);
-        for (int i = 1; i < refs.length; i++) {
-            result = refs[i].replace(result);
-        }
-        return result;
-    }
-
-    /**
-     * Computes the {@code NodeReference}s for each node on the path of
-     * the JSON Pointer, in reverse order, starting from the leaf node
-     */
-    private NodeReference[] getReferences(JsonStructure target) {
-        NodeReference[] references;
-        // First check if this is a reference to a JSON value tree
-        if (tokens.length == 1) {
-            references = new NodeReference[1];
-            references[0] = NodeReference.of(target);
-            return references;
-        }
-
-        references = new NodeReference[tokens.length-1];
-        JsonValue value = target;
-        int s = tokens.length;
-        for (int i = 1; i < s; i++) {
-             // Start with index 1, skipping the "" token
-            switch (value.getValueType()) {
-                case OBJECT:
-                    JsonObject object = (JsonObject) value;
-                    references[s-i-1] = NodeReference.of(object, tokens[i]);
-                    if (i < s-1) {
-                        value = object.get(tokens[i]);
-                        if (value == null) {
-                            // Except for the last name, the mapping must exist
-                            throw new JsonException(JsonMessages.POINTER_MAPPING_MISSING(object, tokens[i]));
-                        }
-                    }
-                    break;
-                case ARRAY:
-                    int index = getIndex(tokens[i]);
-                    JsonArray array = (JsonArray) value;
-                    references[s-i-1] = NodeReference.of(array, index);
-                    if (i < s-1 && index != -1) {
-                        if (index >= array.size()) {
-                            throw new JsonException(JsonMessages.NODEREF_ARRAY_INDEX_ERR(index, array.size()));
-                        }
-                        // The last array index in the path can have index value of -1
-                        // ("-" in the JSON pointer)
-                        value = array.get(index);
-                    }
-                    break;
-                default:
-                    throw new JsonException(JsonMessages.POINTER_REFERENCE_INVALID(value.getValueType()));
-             }
-        }
-        return references;
-    }
-
-    /**
-     * Computes the array index
-     * @param token the input string token
-     * @return the array index. -1 if the token is "-"
-     * @throws JsonException if the string token is not in correct format
-     */
-    static private int getIndex(String token) {
-        if (token == null || token.length() == 0) {
-            throw new JsonException(JsonMessages.POINTER_ARRAY_INDEX_ERR(token));
-        }
-        if (token.equals("-")) {
-            return -1;
-        }
-        if (token.equals("0")) {
-            return 0;
-        }
-        if (token.charAt(0) == '+' || token.charAt(0) == '-') {
-            throw new JsonException(JsonMessages.POINTER_ARRAY_INDEX_ERR(token));
-        }
-        try {
-            return Integer.parseInt(token);
-        } catch (NumberFormatException ex) {
-            throw new JsonException(JsonMessages.POINTER_ARRAY_INDEX_ILLEGAL(token), ex);
-       }
-    }
-}
Index: trunk/src/org/glassfish/json/JsonPrettyGeneratorImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonPrettyGeneratorImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.stream.JsonGenerator;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.nio.charset.Charset;
-
-/**
- * @author Jitendra Kotamraju
- */
-public class JsonPrettyGeneratorImpl extends JsonGeneratorImpl {
-    private int indentLevel;
-    private static final String INDENT = "    ";
-
-    public JsonPrettyGeneratorImpl(Writer writer, BufferPool bufferPool) {
-        super(writer, bufferPool);
-    }
-
-    public JsonPrettyGeneratorImpl(OutputStream out, BufferPool bufferPool) {
-        super(out, bufferPool);
-    }
-
-    public JsonPrettyGeneratorImpl(OutputStream out, Charset encoding, BufferPool bufferPool) {
-        super(out, encoding, bufferPool);
-    }
-
-    @Override
-    public JsonGenerator writeStartObject() {
-        super.writeStartObject();
-        indentLevel++;
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeStartObject(String name) {
-        super.writeStartObject(name);
-        indentLevel++;
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeStartArray() {
-        super.writeStartArray();
-        indentLevel++;
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeStartArray(String name) {
-        super.writeStartArray(name);
-        indentLevel++;
-        return this;
-    }
-
-    @Override
-    public JsonGenerator writeEnd() {
-        writeNewLine();
-        indentLevel--;
-        writeIndent();
-        super.writeEnd();
-        return this;
-    }
-
-    private void writeIndent() {
-        for(int i=0; i < indentLevel; i++) {
-            writeString(INDENT);
-        }
-    }
-
-    @Override
-    protected void writeComma() {
-        super.writeComma();
-        writeChar('\n');
-        writeIndent();
-    }
-
-    @Override
-    protected void writeColon() {
-        super.writeColon();
-        writeChar(' ');
-    }
-
-    private void writeNewLine() {
-        writeChar('\n');
-    }
-}
Index: trunk/src/org/glassfish/json/JsonProviderImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonProviderImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,296 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.*;
-import javax.json.stream.JsonGenerator;
-import javax.json.stream.JsonGeneratorFactory;
-import javax.json.stream.JsonParser;
-import javax.json.stream.JsonParserFactory;
-import javax.json.spi.JsonProvider;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-/**
- * @author Jitendra Kotamraju
- * @author Kin-man Chung
- * @author Alex Soto
- */
-public class JsonProviderImpl extends JsonProvider {
-
-    private final BufferPool bufferPool = new BufferPoolImpl();
-
-    @Override
-    public JsonGenerator createGenerator(Writer writer) {
-        return new JsonGeneratorImpl(writer, bufferPool);
-    }
-
-    @Override
-    public JsonGenerator createGenerator(OutputStream out) {
-        return new JsonGeneratorImpl(out, bufferPool);
-    }
-
-    @Override
-    public JsonParser createParser(Reader reader) {
-        return new JsonParserImpl(reader, bufferPool);
-    }
-
-    @Override
-    public JsonParser createParser(InputStream in) {
-        return new JsonParserImpl(in, bufferPool);
-    }
-
-    @Override
-    public JsonParserFactory createParserFactory(Map<String, ?> config) {
-        BufferPool pool = null;
-        if (config != null && config.containsKey(BufferPool.class.getName())) {
-            pool = (BufferPool)config.get(BufferPool.class.getName());
-        }
-        if (pool == null) {
-            pool = bufferPool;
-        }
-        return new JsonParserFactoryImpl(pool);
-    }
-
-    @Override
-    public JsonGeneratorFactory createGeneratorFactory(Map<String, ?> config) {
-        Map<String, Object> providerConfig;
-        boolean prettyPrinting;
-        BufferPool pool;
-        if (config == null) {
-            providerConfig = Collections.emptyMap();
-            prettyPrinting = false;
-            pool = bufferPool;
-        } else {
-            providerConfig = new HashMap<>();
-            if (prettyPrinting=JsonProviderImpl.isPrettyPrintingEnabled(config)) {
-                providerConfig.put(JsonGenerator.PRETTY_PRINTING, true);
-            }
-            pool = (BufferPool)config.get(BufferPool.class.getName());
-            if (pool != null) {
-                providerConfig.put(BufferPool.class.getName(), pool);
-            } else {
-                pool = bufferPool;
-            }
-            providerConfig = Collections.unmodifiableMap(providerConfig);
-        }
-
-        return new JsonGeneratorFactoryImpl(providerConfig, prettyPrinting, pool);
-    }
-
-    @Override
-    public JsonReader createReader(Reader reader) {
-        return new JsonReaderImpl(reader, bufferPool);
-    }
-
-    @Override
-    public JsonReader createReader(InputStream in) {
-        return new JsonReaderImpl(in, bufferPool);
-    }
-
-    @Override
-    public JsonWriter createWriter(Writer writer) {
-        return new JsonWriterImpl(writer, bufferPool);
-    }
-
-    @Override
-    public JsonWriter createWriter(OutputStream out) {
-        return new JsonWriterImpl(out, bufferPool);
-    }
-
-    @Override
-    public JsonWriterFactory createWriterFactory(Map<String, ?> config) {
-        Map<String, Object> providerConfig;
-        boolean prettyPrinting;
-        BufferPool pool;
-        if (config == null) {
-            providerConfig = Collections.emptyMap();
-            prettyPrinting = false;
-            pool = bufferPool;
-        } else {
-            providerConfig = new HashMap<>();
-            if (prettyPrinting=JsonProviderImpl.isPrettyPrintingEnabled(config)) {
-                providerConfig.put(JsonGenerator.PRETTY_PRINTING, true);
-            }
-            pool = (BufferPool)config.get(BufferPool.class.getName());
-            if (pool != null) {
-                providerConfig.put(BufferPool.class.getName(), pool);
-            } else {
-                pool = bufferPool;
-            }
-            providerConfig = Collections.unmodifiableMap(providerConfig);
-        }
-        return new JsonWriterFactoryImpl(providerConfig, prettyPrinting, pool);
-    }
-
-    @Override
-    public JsonReaderFactory createReaderFactory(Map<String, ?> config) {
-        BufferPool pool = null;
-        if (config != null && config.containsKey(BufferPool.class.getName())) {
-            pool = (BufferPool)config.get(BufferPool.class.getName());
-        }
-        if (pool == null) {
-            pool = bufferPool;
-        }
-        return new JsonReaderFactoryImpl(pool);
-    }
-
-    @Override
-    public JsonObjectBuilder createObjectBuilder() {
-        return new JsonObjectBuilderImpl(bufferPool);
-    }
-
-    @Override
-    public JsonObjectBuilder createObjectBuilder(JsonObject object) {
-        return new JsonObjectBuilderImpl(object, bufferPool);
-    }
-
-    @Override
-    public JsonObjectBuilder createObjectBuilder(Map<String, Object> map) {
-        return new JsonObjectBuilderImpl(map, bufferPool);
-    }
-
-    @Override
-    public JsonArrayBuilder createArrayBuilder() {
-        return new JsonArrayBuilderImpl(bufferPool);
-    }
-
-    @Override
-    public JsonArrayBuilder createArrayBuilder(JsonArray array) {
-        return new JsonArrayBuilderImpl(array, bufferPool);
-    }
-
-    @Override
-    public JsonArrayBuilder createArrayBuilder(Collection<?> collection) {
-        return new JsonArrayBuilderImpl(collection, bufferPool);
-    }
-
-    @Override
-    public JsonPointer createPointer(String jsonPointer) {
-        return new JsonPointerImpl(jsonPointer);
-    }
-
-    @Override
-    public JsonPatchBuilder createPatchBuilder() {
-        return new JsonPatchBuilderImpl();
-    }
-
-    @Override
-    public JsonPatchBuilder createPatchBuilder(JsonArray array) {
-        return new JsonPatchBuilderImpl(array);
-    }
-
-    @Override
-    public JsonPatch createPatch(JsonArray array) {
-        return new JsonPatchImpl(array);
-    }
-
-    @Override
-    public JsonPatch createDiff(JsonStructure source, JsonStructure target) {
-        return new JsonPatchImpl(JsonPatchImpl.diff(source, target));
-    }
-
-    @Override
-    public JsonMergePatch createMergePatch(JsonValue patch) {
-        return new JsonMergePatchImpl(patch);
-    }
-
-    @Override
-    public JsonMergePatch createMergeDiff(JsonValue source, JsonValue target) {
-        return new JsonMergePatchImpl(JsonMergePatchImpl.diff(source, target));
-    }
-
-    @Override
-    public JsonString createValue(String value) {
-        return new JsonStringImpl(value);
-    }
-
-    @Override
-    public JsonNumber createValue(int value) {
-        return JsonNumberImpl.getJsonNumber(value);
-    }
-
-    @Override
-    public JsonNumber createValue(long value) {
-        return JsonNumberImpl.getJsonNumber(value);
-    }
-
-    @Override
-    public JsonNumber createValue(double value) {
-        return JsonNumberImpl.getJsonNumber(value);
-    }
-
-    @Override
-    public JsonNumber createValue(BigInteger value) {
-        return JsonNumberImpl.getJsonNumber(value);
-    }
-
-    @Override
-    public JsonNumber createValue(BigDecimal value) {
-        return JsonNumberImpl.getJsonNumber(value);
-    }
-
-    @Override
-    public JsonBuilderFactory createBuilderFactory(Map<String,?> config) {
-        BufferPool pool = null ;
-        if (config != null && config.containsKey(BufferPool.class.getName())) {
-            pool = (BufferPool)config.get(BufferPool.class.getName());
-        }
-        if (pool == null) {
-            pool = bufferPool;
-        }
-        return new JsonBuilderFactoryImpl(pool);
-    }
-
-    static boolean isPrettyPrintingEnabled(Map<String, ?> config) {
-        return config.containsKey(JsonGenerator.PRETTY_PRINTING);
-    }
-}
Index: trunk/src/org/glassfish/json/JsonReaderFactoryImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonReaderFactoryImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.JsonReader;
-import javax.json.JsonReaderFactory;
-import java.io.InputStream;
-import java.io.Reader;
-import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * @author Jitendra Kotamraju
- */
-class JsonReaderFactoryImpl implements JsonReaderFactory {
-    private final Map<String, ?> config = Collections.emptyMap();
-    private final BufferPool bufferPool;
-
-    JsonReaderFactoryImpl(BufferPool bufferPool) {
-        this.bufferPool = bufferPool;
-    }
-
-    @Override
-    public JsonReader createReader(Reader reader) {
-        return new JsonReaderImpl(reader, bufferPool);
-    }
-
-    @Override
-    public JsonReader createReader(InputStream in) {
-        return new JsonReaderImpl(in, bufferPool);
-    }
-
-    @Override
-    public JsonReader createReader(InputStream in, Charset charset) {
-        return new JsonReaderImpl(in, charset, bufferPool);
-    }
-
-    @Override
-    public Map<String, ?> getConfigInUse() {
-        return config;
-    }
-}
Index: trunk/src/org/glassfish/json/JsonReaderImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonReaderImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,159 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.nio.charset.Charset;
-import javax.json.JsonArray;
-import javax.json.JsonException;
-import javax.json.JsonObject;
-import javax.json.JsonReader;
-import javax.json.JsonStructure;
-import javax.json.JsonValue;
-import javax.json.stream.JsonParser;
-import javax.json.stream.JsonParsingException;
-
-/**
- * JsonReader impl using parser and builders.
- *
- * @author Jitendra Kotamraju
- */
-class JsonReaderImpl implements JsonReader {
-    private final JsonParserImpl parser;
-    private boolean readDone;
-    private final BufferPool bufferPool;
-
-    JsonReaderImpl(Reader reader, BufferPool bufferPool) {
-        parser = new JsonParserImpl(reader, bufferPool);
-        this.bufferPool = bufferPool;
-    }
-
-    JsonReaderImpl(InputStream in, BufferPool bufferPool) {
-        parser = new JsonParserImpl(in, bufferPool);
-        this.bufferPool = bufferPool;
-    }
-
-    JsonReaderImpl(InputStream in, Charset charset, BufferPool bufferPool) {
-        parser = new JsonParserImpl(in, charset, bufferPool);
-        this.bufferPool = bufferPool;
-    }
-
-    @Override
-    public JsonStructure read() {
-        if (readDone) {
-            throw new IllegalStateException(JsonMessages.READER_READ_ALREADY_CALLED());
-        }
-        readDone = true;
-        if (parser.hasNext()) {
-            try {
-                JsonParser.Event e = parser.next();
-                if (e == JsonParser.Event.START_ARRAY) {
-                    return parser.getArray();
-                } else if (e == JsonParser.Event.START_OBJECT) {
-                    return parser.getObject();
-                }
-            } catch (IllegalStateException ise) {
-                throw new JsonParsingException(ise.getMessage(), ise, parser.getLastCharLocation());
-            }
-        }
-        throw new JsonException(JsonMessages.INTERNAL_ERROR());
-    }
-
-    @Override
-    public JsonObject readObject() {
-        if (readDone) {
-            throw new IllegalStateException(JsonMessages.READER_READ_ALREADY_CALLED());
-        }
-        readDone = true;
-        if (parser.hasNext()) {
-            try {
-                parser.next();
-                return parser.getObject();
-            } catch (IllegalStateException ise) {
-                throw new JsonParsingException(ise.getMessage(), ise, parser.getLastCharLocation());
-            }
-        }
-        throw new JsonException(JsonMessages.INTERNAL_ERROR());
-    }
-
-    @Override
-    public JsonArray readArray() {
-        if (readDone) {
-            throw new IllegalStateException(JsonMessages.READER_READ_ALREADY_CALLED());
-        }
-        readDone = true;
-        if (parser.hasNext()) {
-            try {
-                parser.next();
-                return parser.getArray();
-            } catch (IllegalStateException ise) {
-                throw new JsonParsingException(ise.getMessage(), ise, parser.getLastCharLocation());
-            }
-        }
-        throw new JsonException(JsonMessages.INTERNAL_ERROR());
-    }
-
-    @Override
-    public JsonValue readValue() {
-        if (readDone) {
-            throw new IllegalStateException(JsonMessages.READER_READ_ALREADY_CALLED());
-        }
-        readDone = true;
-        if (parser.hasNext()) {
-            try {
-                parser.next();
-                return parser.getValue();
-            } catch (IllegalStateException ise) {
-                throw new JsonParsingException(ise.getMessage(), ise, parser.getLastCharLocation());
-            }
-        }
-        throw new JsonException(JsonMessages.INTERNAL_ERROR());
-    }
-
-    @Override
-    public void close() {
-        readDone = true;
-        parser.close();
-    }
-}
Index: trunk/src/org/glassfish/json/JsonStringImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonStringImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.JsonString;
-
-/**
- * JsonString impl
- *
- * @author Jitendra Kotamraju
- */
-final class JsonStringImpl implements JsonString {
-
-    private final String value;
-
-    JsonStringImpl(String value) {
-        this.value = value;
-    }
-
-    @Override
-    public String getString() {
-        return value;
-    }
-
-    @Override
-    public CharSequence getChars() {
-        return value;
-    }
-
-    @Override
-    public ValueType getValueType() {
-        return ValueType.STRING;
-    }
-
-    @Override
-    public int hashCode() {
-        return getString().hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj){
-            return true;
-        }
-        if (!(obj instanceof JsonString)) {
-            return false;
-        }
-        JsonString other = (JsonString)obj;
-        return getString().equals(other.getString());
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append('"');
-
-        for(int i = 0; i < value.length(); i++) {
-            char c = value.charAt(i);
-            // unescaped = %x20-21 | %x23-5B | %x5D-10FFFF
-            if (c >= 0x20 && c <= 0x10ffff && c != 0x22 && c != 0x5c) {
-                sb.append(c);
-            } else {
-                switch (c) {
-                    case '"':
-                    case '\\':
-                        sb.append('\\'); sb.append(c);
-                        break;
-                    case '\b':
-                        sb.append('\\'); sb.append('b');
-                        break;
-                    case '\f':
-                        sb.append('\\'); sb.append('f');
-                        break;
-                    case '\n':
-                        sb.append('\\'); sb.append('n');
-                        break;
-                    case '\r':
-                        sb.append('\\'); sb.append('r');
-                        break;
-                    case '\t':
-                        sb.append('\\'); sb.append('t');
-                        break;
-                    default:
-                        String hex = "000" + Integer.toHexString(c);
-                        sb.append("\\u").append(hex.substring(hex.length() - 4));
-                }
-            }
-        }
-
-        sb.append('"');
-        return sb.toString();
-    }
-}
-
Index: trunk/src/org/glassfish/json/JsonStructureParser.java
===================================================================
--- trunk/src/org/glassfish/json/JsonStructureParser.java	(revision 16017)
+++ 	(revision )
@@ -1,335 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.*;
-import javax.json.stream.JsonLocation;
-import javax.json.stream.JsonParser;
-import java.math.BigDecimal;
-import java.util.ArrayDeque;
-import java.util.Deque;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-/**
- * {@link JsonParser} implementation on top of JsonArray/JsonObject
- *
- * @author Jitendra Kotamraju
- */
-class JsonStructureParser implements JsonParser {
-
-    private Scope current;
-    private Event state;
-    private final Deque<Scope> scopeStack = new ArrayDeque<>();
-
-    JsonStructureParser(JsonArray array) {
-        current = new ArrayScope(array);
-    }
-
-    JsonStructureParser(JsonObject object) {
-        current = new ObjectScope(object);
-    }
-
-    @Override
-    public String getString() {
-        switch (state) {
-            case KEY_NAME:
-                return ((ObjectScope)current).key;
-            case VALUE_STRING:
-                return ((JsonString)current.getJsonValue()).getString();
-            case VALUE_NUMBER:
-                return ((JsonNumber)current.getJsonValue()).toString();
-            default:
-                throw new IllegalStateException(JsonMessages.PARSER_GETSTRING_ERR(state));
-        }
-    }
-
-    @Override
-    public boolean isIntegralNumber() {
-        if (state == Event.VALUE_NUMBER) {
-            return ((JsonNumber)current.getJsonValue()).isIntegral();
-        }
-        throw new IllegalStateException(JsonMessages.PARSER_ISINTEGRALNUMBER_ERR(state));
-    }
-
-    @Override
-    public int getInt() {
-        if (state == Event.VALUE_NUMBER) {
-            return ((JsonNumber)current.getJsonValue()).intValue();
-        }
-        throw new IllegalStateException(JsonMessages.PARSER_GETINT_ERR(state));
-    }
-
-    @Override
-    public long getLong() {
-        if (state == Event.VALUE_NUMBER) {
-            return ((JsonNumber)current.getJsonValue()).longValue();
-        }
-        throw new IllegalStateException(JsonMessages.PARSER_GETLONG_ERR(state));
-    }
-
-    @Override
-    public BigDecimal getBigDecimal() {
-        if (state == Event.VALUE_NUMBER) {
-            return ((JsonNumber)current.getJsonValue()).bigDecimalValue();
-        }
-        throw new IllegalStateException(JsonMessages.PARSER_GETBIGDECIMAL_ERR(state));
-    }
-
-    @Override
-    public JsonLocation getLocation() {
-        return JsonLocationImpl.UNKNOWN;
-    }
-
-    @Override
-    public boolean hasNext() {
-        return !((state == Event.END_OBJECT || state == Event.END_ARRAY) && scopeStack.isEmpty());
-    }
-
-    @Override
-    public Event next() {
-        if (!hasNext()) {
-            throw new NoSuchElementException();
-        }
-        transition();
-        return state;
-    }
-
-    private void transition() {
-        if (state == null) {
-            state = current instanceof ArrayScope ? Event.START_ARRAY : Event.START_OBJECT;
-        } else {
-            if (state == Event.END_OBJECT || state == Event.END_ARRAY) {
-                current = scopeStack.pop();
-            }
-            if (current instanceof ArrayScope) {
-                if (current.hasNext()) {
-                    current.next();
-                    state = getState(current.getJsonValue());
-                    if (state == Event.START_ARRAY || state == Event.START_OBJECT) {
-                        scopeStack.push(current);
-                        current = Scope.createScope(current.getJsonValue());
-                    }
-                } else {
-                    state = Event.END_ARRAY;
-                }
-            } else {
-                // ObjectScope
-                if (state == Event.KEY_NAME) {
-                    state = getState(current.getJsonValue());
-                    if (state == Event.START_ARRAY || state == Event.START_OBJECT) {
-                        scopeStack.push(current);
-                        current = Scope.createScope(current.getJsonValue());
-                    }
-                } else {
-                    if (current.hasNext()) {
-                        current.next();
-                        state = Event.KEY_NAME;
-                    } else {
-                        state = Event.END_OBJECT;
-                    }
-                }
-            }
-        }
-    }
-
-    @Override
-    public void close() {
-        // no-op
-    }
-
-    @Override
-    public void skipObject() {
-        if (current instanceof ObjectScope) {
-            int depth = 1;
-            do {
-                if (state == Event.KEY_NAME) {
-                    state = getState(current.getJsonValue());
-                    switch (state) {
-                        case START_OBJECT:
-                            depth++;
-                            break;
-                        case END_OBJECT:
-                            depth--;
-                            break;
-                        default:
-                            //no-op
-                    }
-                } else {
-                    if (current.hasNext()) {
-                        current.next();
-                        state = Event.KEY_NAME;
-                    } else {
-                        state = Event.END_OBJECT;
-                        depth--;
-                    }
-                }
-            } while (state != Event.END_OBJECT && depth > 0);
-        }
-    }
-
-    @Override
-    public void skipArray() {
-        if (current instanceof ArrayScope) {
-            int depth = 1;
-            do {
-                if (current.hasNext()) {
-                    current.next();
-                    state = getState(current.getJsonValue());
-                    switch (state) {
-                        case START_ARRAY:
-                            depth++;
-                            break;
-                        case END_ARRAY:
-                            depth--;
-                            break;
-                        default:
-                            //no-op
-                    }
-                } else {
-                    state = Event.END_ARRAY;
-                    depth--;
-                }
-            } while (!(state == Event.END_ARRAY && depth == 0));
-        }
-    }
-
-    private static Event getState(JsonValue value) {
-        switch (value.getValueType()) {
-            case ARRAY:
-                return Event.START_ARRAY;
-            case OBJECT:
-                return Event.START_OBJECT;
-            case STRING:
-                return Event.VALUE_STRING;
-            case NUMBER:
-                return Event.VALUE_NUMBER;
-            case TRUE:
-                return Event.VALUE_TRUE;
-            case FALSE:
-                return Event.VALUE_FALSE;
-            case NULL:
-                return Event.VALUE_NULL;
-            default:
-                throw new JsonException(JsonMessages.PARSER_STATE_ERR(value.getValueType()));
-        }
-    }
-
-    private static abstract class Scope implements Iterator {
-        abstract JsonValue getJsonValue();
-
-        static Scope createScope(JsonValue value) {
-            if (value instanceof JsonArray) {
-                return new ArrayScope((JsonArray)value);
-            } else if (value instanceof JsonObject) {
-                return new ObjectScope((JsonObject)value);
-            }
-            throw new JsonException(JsonMessages.PARSER_SCOPE_ERR(value));
-        }
-    }
-
-    private static class ArrayScope extends Scope {
-        private final Iterator<JsonValue> it;
-        private JsonValue value;
-
-        ArrayScope(JsonArray array) {
-            this.it = array.iterator();
-        }
-
-        @Override
-        public boolean hasNext() {
-            return it.hasNext();
-        }
-
-        @Override
-        public JsonValue next() {
-            value = it.next();
-            return value;
-        }
-
-        @Override
-        public void remove() {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        JsonValue getJsonValue() {
-            return value;
-        }
-
-    }
-
-    private static class ObjectScope extends Scope {
-        private final Iterator<Map.Entry<String, JsonValue>> it;
-        private JsonValue value;
-        private String key;
-
-        ObjectScope(JsonObject object) {
-            this.it = object.entrySet().iterator();
-        }
-
-        @Override
-        public boolean hasNext() {
-            return it.hasNext();
-        }
-
-        @Override
-        public Map.Entry<String, JsonValue> next() {
-            Map.Entry<String, JsonValue> next = it.next();
-            this.key = next.getKey();
-            this.value = next.getValue();
-            return next;
-        }
-
-        @Override
-        public void remove() {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        JsonValue getJsonValue() {
-            return value;
-        }
-
-    }
-
-}
Index: trunk/src/org/glassfish/json/JsonTokenizer.java
===================================================================
--- trunk/src/org/glassfish/json/JsonTokenizer.java	(revision 16017)
+++ 	(revision )
@@ -1,610 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.JsonException;
-import javax.json.stream.JsonLocation;
-import javax.json.stream.JsonParser;
-import javax.json.stream.JsonParsingException;
-import java.io.*;
-import java.math.BigDecimal;
-import java.util.Arrays;
-
-import javax.json.stream.JsonParser.Event;
-
-/**
- * JSON Tokenizer
- *
- * @author Jitendra Kotamraju
- */
-final class JsonTokenizer implements Closeable {
-    // Table to look up hex ch -> value (for e.g HEX['F'] = 15, HEX['5'] = 5)
-    private final static int[] HEX = new int[128];
-    static {
-        Arrays.fill(HEX, -1);
-        for (int i='0'; i <= '9'; i++) {
-            HEX[i] = i-'0';
-        }
-        for (int i='A'; i <= 'F'; i++) {
-            HEX[i] = 10+i-'A';
-        }
-        for (int i='a'; i <= 'f'; i++) {
-            HEX[i] = 10+i-'a';
-        }
-    }
-    private final static int HEX_LENGTH = HEX.length;
-
-    private final BufferPool bufferPool;
-
-    private final Reader reader;
-
-    // Internal buffer that is used for parsing. It is also used
-    // for storing current string and number value token
-    private char[] buf;
-
-    // Indexes in buffer
-    //
-    // XXXssssssssssssXXXXXXXXXXXXXXXXXXXXXXrrrrrrrrrrrrrrXXXXXX
-    //    ^           ^                     ^             ^
-    //    |           |                     |             |
-    //   storeBegin  storeEnd            readBegin      readEnd
-    private int readBegin;
-    private int readEnd;
-    private int storeBegin;
-    private int storeEnd;
-
-    // line number of the current pointer of parsing char
-    private long lineNo = 1;
-
-    // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-    // ^
-    // |
-    // bufferOffset
-    //
-    // offset of the last \r\n or \n. will be used to calculate column number
-    // of a token or an error. This may be outside of the buffer.
-    private long lastLineOffset = 0;
-    // offset in the stream for the start of the buffer, will be used in
-    // calculating JsonLocation's stream offset, column no.
-    private long bufferOffset = 0;
-
-    private boolean minus;
-    private boolean fracOrExp;
-    private BigDecimal bd;
-
-    enum JsonToken {
-        CURLYOPEN(Event.START_OBJECT, false),
-        SQUAREOPEN(Event.START_ARRAY, false),
-        COLON(null, false),
-        COMMA(null, false),
-        STRING(Event.VALUE_STRING, true),
-        NUMBER(Event.VALUE_NUMBER, true),
-        TRUE(Event.VALUE_TRUE, true),
-        FALSE(Event.VALUE_FALSE, true),
-        NULL(Event.VALUE_NULL, true),
-        CURLYCLOSE(Event.END_OBJECT, false),
-        SQUARECLOSE(Event.END_ARRAY, false),
-        EOF(null, false);
-
-        private final JsonParser.Event event;
-        private final boolean value;
-
-        JsonToken(JsonParser.Event event, boolean value) {
-            this.event = event;
-            this.value = value;
-        }
-
-        JsonParser.Event getEvent() {
-            return event;
-        }
-
-        boolean isValue() {
-            return value;
-        }
-    }
-
-    JsonTokenizer(Reader reader, BufferPool bufferPool) {
-        this.reader = reader;
-        this.bufferPool = bufferPool;
-        buf = bufferPool.take();
-    }
-
-    private void readString() {
-        // when inPlace is true, no need to copy chars
-        boolean inPlace = true;
-        storeBegin = storeEnd = readBegin;
-
-        do {
-            // Write unescaped char block within the current buffer
-            if (inPlace) {
-                int ch;
-                while(readBegin < readEnd && ((ch=buf[readBegin]) >= 0x20) && ch != '\\') {
-                    if (ch == '"') {
-                        storeEnd = readBegin++; // ++ to consume quote char
-                        return;                 // Got the entire string
-                    }
-                    readBegin++;                // consume unescaped char
-                }
-                storeEnd = readBegin;
-            }
-
-            // string may be crossing buffer boundaries and may contain
-            // escaped characters.
-            int ch = read();
-            if (ch >= 0x20 && ch != 0x22 && ch != 0x5c) {
-                if (!inPlace) {
-                    buf[storeEnd] = (char)ch;
-                }
-                storeEnd++;
-                continue;
-            }
-            switch (ch) {
-                case '\\':
-                    inPlace = false;        // Now onwards need to copy chars
-                    unescape();
-                    break;
-                case '"':
-                    return;
-                default:
-                    throw unexpectedChar(ch);
-            }
-        } while (true);
-    }
-
-    private void unescape() {
-        int ch = read();
-        switch (ch) {
-            case 'b':
-                buf[storeEnd++] = '\b';
-                break;
-            case 't':
-                buf[storeEnd++] = '\t';
-                break;
-            case 'n':
-                buf[storeEnd++] = '\n';
-                break;
-            case 'f':
-                buf[storeEnd++] = '\f';
-                break;
-            case 'r':
-                buf[storeEnd++] = '\r';
-                break;
-            case '"':
-            case '\\':
-            case '/':
-                buf[storeEnd++] = (char)ch;
-                break;
-            case 'u': {
-                int unicode = 0;
-                for (int i = 0; i < 4; i++) {
-                    int ch3 = read();
-                    int digit = (ch3 >= 0 && ch3 < HEX_LENGTH) ? HEX[ch3] : -1;
-                    if (digit < 0) {
-                        throw unexpectedChar(ch3);
-                    }
-                    unicode = (unicode << 4)|digit;
-                }
-                buf[storeEnd++] = (char)unicode;
-                break;
-            }
-            default:
-                throw unexpectedChar(ch);
-        }
-    }
-
-    // Reads a number char. If the char is within the buffer, directly
-    // reads from the buffer. Otherwise, uses read() which takes care
-    // of resizing, filling up the buf, adjusting the pointers
-    private int readNumberChar() {
-        if (readBegin < readEnd) {
-            return buf[readBegin++];
-        } else {
-            storeEnd = readBegin;
-            return read();
-        }
-    }
-
-    private void readNumber(int ch)  {
-        storeBegin = storeEnd = readBegin-1;
-        // sign
-        if (ch == '-') {
-            this.minus = true;
-            ch = readNumberChar();
-            if (ch < '0' || ch >'9') {
-                throw unexpectedChar(ch);
-            }
-        }
-
-        // int
-        if (ch == '0') {
-            ch = readNumberChar();
-        } else {
-            do {
-                ch = readNumberChar();
-            } while (ch >= '0' && ch <= '9');
-        }
-
-        // frac
-        if (ch == '.') {
-            this.fracOrExp = true;
-            int count = 0;
-            do {
-                ch = readNumberChar();
-                count++;
-            } while (ch >= '0' && ch <= '9');
-            if (count == 1) {
-                throw unexpectedChar(ch);
-            }
-        }
-
-        // exp
-        if (ch == 'e' || ch == 'E') {
-            this.fracOrExp = true;
-            ch = readNumberChar();
-            if (ch == '+' || ch == '-') {
-                ch = readNumberChar();
-            }
-            int count;
-            for (count = 0; ch >= '0' && ch <= '9'; count++) {
-                ch = readNumberChar();
-            }
-            if (count == 0) {
-                throw unexpectedChar(ch);
-            }
-        }
-        if (ch != -1) {
-            // Only reset readBegin if eof has not been reached
-            readBegin--;
-            storeEnd = readBegin;
-        }
-    }
-
-    private void readTrue() {
-        int ch1 = read();
-        if (ch1 != 'r') {
-            throw expectedChar(ch1, 'r');
-        }
-        int ch2 = read();
-        if (ch2 != 'u') {
-            throw expectedChar(ch2, 'u');
-        }
-        int ch3 = read();
-        if (ch3 != 'e') {
-            throw expectedChar(ch3, 'e');
-        }
-    }
-
-    private void readFalse() {
-        int ch1 = read();
-        if (ch1 != 'a') {
-            throw expectedChar(ch1, 'a');
-        }
-        int ch2 = read();
-        if (ch2 != 'l') {
-            throw expectedChar(ch2, 'l');
-        }
-        int ch3 = read();
-        if (ch3 != 's') {
-            throw expectedChar(ch3, 's');
-        }
-        int ch4 = read();
-        if (ch4 != 'e') {
-            throw expectedChar(ch4, 'e');
-        }
-    }
-
-    private void readNull() {
-        int ch1 = read();
-        if (ch1 != 'u') {
-            throw expectedChar(ch1, 'u');
-        }
-        int ch2 = read();
-        if (ch2 != 'l') {
-            throw expectedChar(ch2, 'l');
-        }
-        int ch3 = read();
-        if (ch3 != 'l') {
-            throw expectedChar(ch3, 'l');
-        }
-    }
-
-    /*
-     * Could be optimized if the parser uses separate methods to match colon
-     * etc (that would avoid the switch statement cost in certain cases)
-     */
-    JsonToken nextToken() {
-        reset();
-        int ch = read();
-
-        // whitespace
-        while (ch == 0x20 || ch == 0x09 || ch == 0x0a || ch == 0x0d) {
-            if (ch == '\r') {
-                ++lineNo;
-                ch = read();
-                if (ch == '\n') {
-                    lastLineOffset = bufferOffset+readBegin;
-                } else {
-                    lastLineOffset = bufferOffset+readBegin-1;
-                    continue;
-                }
-            } else if (ch == '\n') {
-                ++lineNo;
-                lastLineOffset = bufferOffset+readBegin;
-            }
-            ch = read();
-        }
-
-        switch (ch) {
-            case '"':
-                readString();
-                return JsonToken.STRING;
-            case '{':
-                return JsonToken.CURLYOPEN;
-            case '[':
-                return JsonToken.SQUAREOPEN;
-            case ':':
-                return JsonToken.COLON;
-            case ',':
-                return JsonToken.COMMA;
-            case 't':
-                readTrue();
-                return JsonToken.TRUE;
-            case 'f':
-                readFalse();
-                return JsonToken.FALSE;
-            case 'n':
-                readNull();
-                return JsonToken.NULL;
-            case ']':
-                return JsonToken.SQUARECLOSE;
-            case '}':
-                return JsonToken.CURLYCLOSE;
-            case '0':
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':
-            case '-':
-                readNumber(ch);
-                return JsonToken.NUMBER;
-            case -1:
-                return JsonToken.EOF;
-            default:
-                throw unexpectedChar(ch);
-        }
-    }
-
-    boolean hasNextToken() {
-        reset();
-        int ch = peek();
-
-        // whitespace
-        while (ch == 0x20 || ch == 0x09 || ch == 0x0a || ch == 0x0d) {
-            if (ch == '\r') {
-                ++lineNo;
-                ++readBegin;
-                ch = peek();
-                if (ch == '\n') {
-                    lastLineOffset = bufferOffset+readBegin+1;
-                } else {
-                    lastLineOffset = bufferOffset+readBegin;
-                    continue;
-                }
-            } else if (ch == '\n') {
-                ++lineNo;
-                lastLineOffset = bufferOffset+readBegin+1;
-            }
-            ++readBegin;
-            ch = peek();
-        }
-        return ch != -1;
-    }
-
-    private int peek() {
-        try {
-            if (readBegin == readEnd) {     // need to fill the buffer
-                int len = fillBuf();
-                if (len == -1) {
-                    return -1;
-                }
-                assert len != 0;
-                readBegin = storeEnd;
-                readEnd = readBegin+len;
-            }
-            return buf[readBegin];
-        } catch (IOException ioe) {
-            throw new JsonException(JsonMessages.TOKENIZER_IO_ERR(), ioe);
-        }
-    }
-
-    // Gives the location of the last char. Used for
-    // JsonParsingException.getLocation
-    JsonLocation getLastCharLocation() {
-        // Already read the char, so subtracting -1
-        return new JsonLocationImpl(lineNo, bufferOffset +readBegin-lastLineOffset, bufferOffset +readBegin-1);
-    }
-
-    // Gives the parser location. Used for JsonParser.getLocation
-    JsonLocation getLocation() {
-        return new JsonLocationImpl(lineNo, bufferOffset +readBegin-lastLineOffset+1, bufferOffset +readBegin);
-    }
-
-    private int read() {
-        try {
-            if (readBegin == readEnd) {     // need to fill the buffer
-                int len = fillBuf();
-                if (len == -1) {
-                    return -1;
-                }
-                assert len != 0;
-                readBegin = storeEnd;
-                readEnd = readBegin+len;
-            }
-            return buf[readBegin++];
-        } catch (IOException ioe) {
-            throw new JsonException(JsonMessages.TOKENIZER_IO_ERR(), ioe);
-        }
-    }
-
-    private int fillBuf() throws IOException {
-        if (storeEnd != 0) {
-            int storeLen = storeEnd-storeBegin;
-            if (storeLen > 0) {
-                // there is some store data
-                if (storeLen == buf.length) {
-                    // buffer is full, double the capacity
-                    char[] doubleBuf = Arrays.copyOf(buf, 2 * buf.length);
-                    bufferPool.recycle(buf);
-                    buf = doubleBuf;
-                } else {
-                    // Left shift all the stored data to make space
-                    System.arraycopy(buf, storeBegin, buf, 0, storeLen);
-                    storeEnd = storeLen;
-                    storeBegin = 0;
-                    bufferOffset += readBegin-storeEnd;
-                }
-            } else {
-                storeBegin = storeEnd = 0;
-                bufferOffset += readBegin;
-            }
-        } else {
-            bufferOffset += readBegin;
-        }
-        // Fill the rest of the buf
-        return reader.read(buf, storeEnd, buf.length-storeEnd);
-    }
-
-    // state associated with the current token is no more valid
-    private void reset() {
-        if (storeEnd != 0) {
-            storeBegin = 0;
-            storeEnd = 0;
-            bd = null;
-            minus = false;
-            fracOrExp = false;
-        }
-    }
-
-    String getValue() {
-        return new String(buf, storeBegin, storeEnd-storeBegin);
-    }
-
-    BigDecimal getBigDecimal() {
-        if (bd == null) {
-            bd = new BigDecimal(buf, storeBegin, storeEnd-storeBegin);
-        }
-        return bd;
-    }
-
-    int getInt() {
-        // no need to create BigDecimal for common integer values (1-9 digits)
-        int storeLen = storeEnd-storeBegin;
-        if (!fracOrExp && (storeLen <= 9 || (minus && storeLen <= 10))) {
-            int num = 0;
-            int i = minus ? 1 : 0;
-            for(; i < storeLen; i++) {
-                num = num * 10 + (buf[storeBegin+i] - '0');
-            }
-            return minus ? -num : num;
-        } else {
-            return getBigDecimal().intValue();
-        }
-    }
-    
-    long getLong() {
-        // no need to create BigDecimal for common integer values (1-18 digits)
-        int storeLen = storeEnd-storeBegin;
-        if (!fracOrExp && (storeLen <= 18 || (minus && storeLen <= 19))) {
-            long num = 0;
-            int i = minus ? 1 : 0;
-            for(; i < storeLen; i++) {
-                num = num * 10 + (buf[storeBegin+i] - '0');
-            }
-            return minus ? -num : num;
-        } else {
-            return getBigDecimal().longValue();
-        }
-    }
-
-    // returns true for common integer values (1-9 digits).
-    // So there are cases it will return false even though the number is int
-    boolean isDefinitelyInt() {
-        int storeLen = storeEnd-storeBegin;
-        return !fracOrExp && (storeLen <= 9 || (minus && storeLen <= 10));
-    }
-    
-    // returns true for common long values (1-18 digits).
-    // So there are cases it will return false even though the number is long
-    boolean isDefinitelyLong() {
-    	int storeLen = storeEnd-storeBegin;
-    	return !fracOrExp && (storeLen <= 18 || (minus && storeLen <= 19));
-    }
-
-    boolean isIntegral() {
-        return !fracOrExp || getBigDecimal().scale() == 0;
-    }
-
-    @Override
-    public void close() throws IOException {
-        reader.close();
-        bufferPool.recycle(buf);
-    }
-
-    private JsonParsingException unexpectedChar(int ch) {
-        JsonLocation location = getLastCharLocation();
-        return new JsonParsingException(
-            JsonMessages.TOKENIZER_UNEXPECTED_CHAR(ch, location), location);
-    }
-
-    private JsonParsingException expectedChar(int unexpected, char expected) {
-        JsonLocation location = getLastCharLocation();
-        return new JsonParsingException(
-                JsonMessages.TOKENIZER_EXPECTED_CHAR(unexpected, location, expected), location);
-    }
-    
-}
Index: trunk/src/org/glassfish/json/JsonUtil.java
===================================================================
--- trunk/src/org/glassfish/json/JsonUtil.java	(revision 16017)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2015-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import java.io.StringReader;
-import javax.json.Json;
-import javax.json.JsonReader;
-import javax.json.JsonValue;
-import javax.json.stream.JsonParsingException;
-
-/**
- * A utility class
- * 
- * @since 1.1
- */
-public final class JsonUtil {
-
-    private JsonUtil() {
-    }
-
-    /**
-     * Reads the input JSON text and returns a JsonValue.
-     * <p>For convenience, single quotes as well as double quotes
-     * are allowed to delimit JSON strings. If single quotes are
-     * used, any quotes, single or double, in the JSON string must be
-     * escaped (prepend with a '\').
-     *
-     * @param jsonString the input JSON data
-     * @return the object model for {@code jsonString}
-     * @throws JsonParsingException if the input is not legal JSON text
-     */
-    public static JsonValue toJson(String jsonString) {
-        StringBuilder builder = new StringBuilder();
-        boolean single_context = false;
-        for (int i = 0; i < jsonString.length(); i++) {
-            char ch = jsonString.charAt(i);
-            if (ch == '\\') {
-                i = i + 1;
-                if (i < jsonString.length()) {
-                    ch = jsonString.charAt(i);
-                    if (!(single_context && ch == '\'')) {
-                        // unescape ' inside single quotes
-                        builder.append('\\');
-                    }
-                }
-            } else if (ch == '\'') {
-                // Turn ' into ", for proper JSON string
-                ch = '"';
-                single_context = ! single_context;
-            }
-            builder.append(ch);
-        }
-                   
-        JsonReader reader = Json.createReader(
-                                new StringReader(builder.toString()));
-        JsonValue value = reader.readValue();
-        reader.close();
-        return value;
-    }
-}
-
Index: trunk/src/org/glassfish/json/JsonWriterFactoryImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonWriterFactoryImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.JsonWriter;
-import javax.json.JsonWriterFactory;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.Map;
-
-/**
- * @author Jitendra Kotamraju
- */
-class JsonWriterFactoryImpl implements JsonWriterFactory {
-    private final Map<String, ?> config;        // unmodifiable map
-    private final boolean prettyPrinting;
-    private final BufferPool bufferPool;
-
-    JsonWriterFactoryImpl(Map<String, ?> config, boolean prettyPrinting,
-            BufferPool bufferPool) {
-        this.config = config;
-        this.prettyPrinting = prettyPrinting;
-        this.bufferPool = bufferPool;
-    }
-
-    @Override
-    public JsonWriter createWriter(Writer writer) {
-        return new JsonWriterImpl(writer, prettyPrinting, bufferPool);
-    }
-
-    @Override
-    public JsonWriter createWriter(OutputStream out) {
-        return new JsonWriterImpl(out, prettyPrinting, bufferPool);
-    }
-
-    @Override
-    public JsonWriter createWriter(OutputStream out, Charset charset) {
-        return new JsonWriterImpl(out, charset, prettyPrinting, bufferPool);
-    }
-
-    @Override
-    public Map<String, ?> getConfigInUse() {
-        return config;
-    }
-}
Index: trunk/src/org/glassfish/json/JsonWriterImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonWriterImpl.java	(revision 16017)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.*;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.Map;
-
-/**
- * JsonWriter impl using generator.
- *
- * @author Jitendra Kotamraju
- */
-class JsonWriterImpl implements JsonWriter {
-
-    private final JsonGeneratorImpl generator;
-    private boolean writeDone;
-    private final NoFlushOutputStream os;
-
-    JsonWriterImpl(Writer writer, BufferPool bufferPool) {
-        this(writer, false, bufferPool);
-    }
-
-    JsonWriterImpl(Writer writer, boolean prettyPrinting, BufferPool bufferPool) {
-        generator = prettyPrinting
-                ? new JsonPrettyGeneratorImpl(writer, bufferPool)
-                : new JsonGeneratorImpl(writer, bufferPool);
-        os = null;
-    }
-
-    JsonWriterImpl(OutputStream out, BufferPool bufferPool) {
-        this(out, StandardCharsets.UTF_8, false, bufferPool);
-    }
-
-    JsonWriterImpl(OutputStream out, boolean prettyPrinting, BufferPool bufferPool) {
-        this(out, StandardCharsets.UTF_8, prettyPrinting, bufferPool);
-    }
-
-    JsonWriterImpl(OutputStream out, Charset charset,
-                   boolean prettyPrinting, BufferPool bufferPool) {
-        // Decorating the given stream, so that buffered contents can be
-        // written without actually flushing the stream.
-        this.os = new NoFlushOutputStream(out);
-        generator = prettyPrinting
-                ? new JsonPrettyGeneratorImpl(os, charset, bufferPool)
-                : new JsonGeneratorImpl(os, charset, bufferPool);
-    }
-
-    @Override
-    public void writeArray(JsonArray array) {
-        if (writeDone) {
-            throw new IllegalStateException(JsonMessages.WRITER_WRITE_ALREADY_CALLED());
-        }
-        writeDone = true;
-        generator.writeStartArray();
-        for(JsonValue value : array) {
-            generator.write(value);
-        }
-        generator.writeEnd();
-        // Flush the generator's buffered contents. This won't work for byte
-        // streams as intermediary OutputStreamWriter buffers.
-        generator.flushBuffer();
-        // Flush buffered contents but not the byte stream. generator.flush()
-        // does OutputStreamWriter#flushBuffer (package private) and underlying
-        // byte stream#flush(). Here underlying stream's flush() is no-op.
-        if (os != null) {
-            generator.flush();
-        }
-    }
-
-    @Override
-    public void writeObject(JsonObject object) {
-        if (writeDone) {
-            throw new IllegalStateException(JsonMessages.WRITER_WRITE_ALREADY_CALLED());
-        }
-        writeDone = true;
-        generator.writeStartObject();
-        for(Map.Entry<String, JsonValue> e : object.entrySet()) {
-            generator.write(e.getKey(), e.getValue());
-        }
-        generator.writeEnd();
-        // Flush the generator's buffered contents. This won't work for byte
-        // streams as intermediary OutputStreamWriter buffers.
-        generator.flushBuffer();
-        // Flush buffered contents but not the byte stream. generator.flush()
-        // does OutputStreamWriter#flushBuffer (package private) and underlying
-        // byte stream#flush(). Here underlying stream's flush() is no-op.
-        if (os != null) {
-            generator.flush();
-        }
-    }
-
-    @Override
-    public void write(JsonStructure value) {
-        if (value instanceof JsonArray) {
-            writeArray((JsonArray)value);
-        } else {
-            writeObject((JsonObject)value);
-        }
-    }
-
-    @Override
-    public void write(JsonValue value) {
-        switch (value.getValueType()) {
-            case OBJECT:
-                writeObject((JsonObject) value);
-                return;
-            case ARRAY:
-                writeArray((JsonArray) value);
-                return;
-            default:
-                if (writeDone) {
-                    throw new IllegalStateException(JsonMessages.WRITER_WRITE_ALREADY_CALLED());
-                }
-                writeDone = true;
-                generator.write(value);
-                generator.flushBuffer();
-                if (os != null) {
-                    generator.flush();
-                }
-        }
-    }
-
-    @Override
-    public void close() {
-        writeDone = true;
-        generator.close();
-    }
-
-    private static final class NoFlushOutputStream extends FilterOutputStream {
-        public NoFlushOutputStream(OutputStream out) {
-            super(out);
-        }
-
-        @Override
-        public void write(byte b[], int off, int len) throws IOException {
-            out.write(b, off ,len);
-        }
-
-        @Override
-        public void flush() {
-            // no-op
-        }
-    }
-
-}
Index: trunk/src/org/glassfish/json/MapUtil.java
===================================================================
--- trunk/src/org/glassfish/json/MapUtil.java	(revision 16017)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import org.glassfish.json.api.BufferPool;
-
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonObjectBuilder;
-import javax.json.JsonValue;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * Util for transforming a Map to a Json objects.
- *
- * @author asotobu
- */
-public final class MapUtil {
-
-    private MapUtil() {
-        super();
-    }
-
-    static JsonValue handle(Object value, BufferPool bufferPool) {
-
-        if (value == null) {
-            return JsonValue.NULL;
-        }
-
-        if (value instanceof BigDecimal) {
-            return JsonNumberImpl.getJsonNumber((BigDecimal) value);
-        } else {
-            if (value instanceof BigInteger) {
-                return JsonNumberImpl.getJsonNumber((BigInteger) value);
-            } else {
-                if ( value instanceof Boolean) {
-                    Boolean b = (Boolean) value;
-                    return b ? JsonValue.TRUE : JsonValue.FALSE;
-                } else {
-                    if (value instanceof Double) {
-                        return JsonNumberImpl.getJsonNumber((Double) value);
-                    } else {
-                        if (value instanceof Integer) {
-                            return JsonNumberImpl.getJsonNumber((Integer) value);
-                        } else {
-                            if (value instanceof Long) {
-                                return JsonNumberImpl.getJsonNumber((Long) value);
-                            } else {
-                                if (value instanceof String) {
-                                    return new JsonStringImpl((String) value);
-                                } else {
-                                    if (value instanceof Collection) {
-                                        @SuppressWarnings("unchecked")
-                                        Collection<?> collection = (Collection<?>) value;
-                                        JsonArrayBuilder jsonArrayBuilder = new JsonArrayBuilderImpl(collection, bufferPool);
-                                        return jsonArrayBuilder.build();
-                                    } else {
-                                        if (value instanceof Map) {
-                                            @SuppressWarnings("unchecked")
-                                            JsonObjectBuilder object = new JsonObjectBuilderImpl((Map<String, Object>) value, bufferPool);
-                                            return object.build();
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        throw new IllegalArgumentException(String.format("Type %s is not supported.", value.getClass()));
-    }
-
-}
Index: trunk/src/org/glassfish/json/NodeReference.java
===================================================================
--- trunk/src/org/glassfish/json/NodeReference.java	(revision 16017)
+++ 	(revision )
@@ -1,307 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2015-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.Json;
-import javax.json.JsonArray;
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonException;
-import javax.json.JsonObject;
-import javax.json.JsonStructure;
-import javax.json.JsonValue;
-
-/**
- * This class is a helper class for JsonPointer implementation,
- * and is not part of the API.
- *
- * This class encapsulates a reference to a JSON node.
- * There are three types of references.
- * <ol><li>a reference to the root of a JSON tree.</li>
- *     <li>a reference to a name/value (possibly non-existing) pair of a JSON object, identified by a name.</li>
- *     <li>a reference to a member value of a JSON array, identified by an index.</li>
- * </ol>
- * Static factory methods are provided for creating these references.
- *
- * <p>A referenced value can be retrieved or replaced.
- * The value of a JSON object or JSON array can be
- * removed.  A new value can be added to a JSON object or
- * inserted into a JSON array</p>
- *
- * <p>Since a {@code JsonObject} or {@code JsonArray} is immutable, these operations
- * must not modify the referenced JSON object or array. The methods {@link #add},
- * {@link #replace}, and {@link #remove} returns a new
- * JSON object or array after the execution of the operation.</p>
- */
-abstract class NodeReference {
-
-    /**
-     * Return {@code true} if a reference points to a valid value, {@code false} otherwise.
-     *
-     * @return {@code true} if a reference points to a value
-     */
-    abstract public boolean contains();
-
-    /**
-     * Get the value at the referenced location.
-     *
-     * @return the JSON value referenced
-     * @throws JsonException if the referenced value does not exist
-     */
-    abstract public JsonValue get();
-
-    /**
-     * Add or replace a value at the referenced location.
-     * If the reference is the root of a JSON tree, the added value must be
-     * a JSON object or array, which becomes the referenced JSON value.
-     * If the reference is an index of a JSON array, the value is inserted
-     * into the array at the index.  If the index is -1, the value is
-     * appended to the array.
-     * If the reference is a name of a JSON object, the name/value pair is added
-     * to the object, replacing any pair with the same name.
-     *
-     * @param value the value to be added
-     * @return the JsonStructure after the operation
-     * @throws JsonException if the index to the array is not -1 or is out of range
-     */
-    abstract public JsonStructure add(JsonValue value);
-
-    /**
-     * Remove the name/value pair from the JSON object, or the value in a JSON array, as specified by the reference
-     *
-     * @return the JsonStructure after the operation
-     * @throws JsonException if the name/value pair of the referenced JSON object
-     *    does not exist, or if the index of the referenced JSON array is
-     *    out of range, or if the reference is a root reference
-     */
-    abstract public JsonStructure remove();
-
-    /**
-     * Replace the referenced value with the specified value.
-     *
-     * @param value the JSON value to be stored at the referenced location
-     * @return the JsonStructure after the operation
-     * @throws JsonException if the name/value pair of the referenced JSON object
-     *    does not exist, or if the index of the referenced JSON array is
-     *    out of range, or if the reference is a root reference
-     */
-    abstract public JsonStructure replace(JsonValue value);
-
-    /**
-     * Returns a {@code NodeReference} for a {@code JsonStructure}.
-     *
-     * @param structure the {@code JsonStructure} referenced
-     * @return the {@code NodeReference}
-     */
-    public static NodeReference of(JsonStructure structure) {
-        return new RootReference(structure);
-    }
-
-    /**
-     * Returns a {@code NodeReference} for a name/value pair in a
-     * JSON object.
-     *
-     * @param object the referenced JSON object
-     * @param name the name of the name/pair
-     * @return the {@code NodeReference}
-     */
-    public static NodeReference of(JsonObject object, String name) {
-        return new ObjectReference(object, name);
-    }
-
-    /**
-     * Returns a {@code NodeReference} for a member value in a
-     * JSON array.
-     *
-     * @param array the referenced JSON array
-     * @param index the index of the member value in the JSON array
-     * @return the {@code NodeReference}
-     */
-    public static NodeReference of(JsonArray array, int index) {
-        return new ArrayReference(array, index);
-    }
-
-    static class RootReference extends NodeReference {
-
-        private JsonStructure root;
-
-        RootReference(JsonStructure root) {
-            this.root = root;
-        }
-
-        @Override
-        public boolean contains() {
-            return root != null;
-        }
-
-        @Override
-        public JsonValue get() {
-            return root;
-        }
-
-        @Override
-        public JsonStructure add(JsonValue value) {
-            switch (value.getValueType() ) {
-                case OBJECT:
-                case ARRAY:
-                    this.root = (JsonStructure) value;
-                    break;
-                default:
-                    throw new JsonException(JsonMessages.NODEREF_VALUE_ADD_ERR());
-            }
-            return root;
-        }
-
-        @Override
-        public JsonStructure remove() {
-            throw new JsonException(JsonMessages.NODEREF_VALUE_CANNOT_REMOVE());
-        }
-
-        @Override
-        public JsonStructure replace(JsonValue value) {
-            return add(value);
-        }
-    }
-
-    static class ObjectReference extends NodeReference {
-
-        private final JsonObject object;
-        private final String key;
-
-        ObjectReference(JsonObject object, String key) {
-            this.object = object;
-            this.key = key;
-        }
-
-        @Override
-        public boolean contains() {
-            return object != null && object.containsKey(key);
-        }
-
-        @Override
-        public JsonValue get() {
-            if (!contains()) {
-                throw new JsonException(JsonMessages.NODEREF_OBJECT_MISSING(key));
-            }
-            return object.get(key);
-        }
-
-        @Override
-        public JsonObject add(JsonValue value) {
-            return Json.createObjectBuilder(object).add(key, value).build();
-        }
-
-        @Override
-        public JsonObject remove() {
-            if (!contains()) {
-                throw new JsonException(JsonMessages.NODEREF_OBJECT_MISSING(key));
-            }
-            return Json.createObjectBuilder(object).remove(key).build();
-        }
-
-        @Override
-        public JsonObject replace(JsonValue value) {
-            if (!contains()) {
-                throw new JsonException(JsonMessages.NODEREF_OBJECT_MISSING(key));
-            }
-            return add(value);
-        }
-    }
-
-    static class ArrayReference extends NodeReference {
-
-        private final JsonArray array;
-        private final int index; // -1 means "-" in JSON Pointer
-
-        ArrayReference(JsonArray array, int index) {
-            this.array = array;
-            this.index = index;
-        }
-
-        @Override
-        public boolean contains() {
-            return array != null && index > -1 && index < array.size();
-        }
-
-        @Override
-        public JsonValue get() {
-            if (!contains()) {
-                throw new JsonException(JsonMessages.NODEREF_ARRAY_INDEX_ERR(index, array.size()));
-            }
-            return array.get(index);
-        }
-
-        @Override
-        public JsonArray add(JsonValue value) {
-            //TODO should we check for arrayoutofbounds?
-            // The spec seems to say index = array.size() is allowed. This is handled as append
-            JsonArrayBuilder builder = Json.createArrayBuilder(this.array);
-            if (index == -1 || index == array.size()) {
-                builder.add(value);
-            } else {
-                if(index < array.size()) {
-                    builder.add(index, value);
-                } else {
-                    throw new JsonException(JsonMessages.NODEREF_ARRAY_INDEX_ERR(index, array.size()));
-                }
-            }
-            return builder.build();
-        }
-
-        @Override
-        public JsonArray remove() {
-            if (!contains()) {
-                throw new JsonException(JsonMessages.NODEREF_ARRAY_INDEX_ERR(index, array.size()));
-            }
-            JsonArrayBuilder builder = Json.createArrayBuilder(this.array);
-            return builder.remove(index).build();
-        }
-
-        @Override
-        public JsonArray replace(JsonValue value) {
-            if (!contains()) {
-                throw new JsonException(JsonMessages.NODEREF_ARRAY_INDEX_ERR(index, array.size()));
-            }
-            JsonArrayBuilder builder = Json.createArrayBuilder(this.array);
-            return builder.set(index, value).build();
-        }
-    }
-}
-
Index: trunk/src/org/glassfish/json/UnicodeDetectingInputStream.java
===================================================================
--- trunk/src/org/glassfish/json/UnicodeDetectingInputStream.java	(revision 16017)
+++ 	(revision )
@@ -1,188 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json;
-
-import javax.json.JsonException;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-
-/**
- * A filter stream that detects the unicode encoding for the original
- * stream
- *
- * @author Jitendra Kotamraju
- */
-class UnicodeDetectingInputStream extends FilterInputStream {
-
-    private static final Charset UTF_32LE = Charset.forName("UTF-32LE");
-    private static final Charset UTF_32BE = Charset.forName("UTF-32BE");
-
-    private static final byte FF = (byte)0xFF;
-    private static final byte FE = (byte)0xFE;
-    private static final byte EF = (byte)0xEF;
-    private static final byte BB = (byte)0xBB;
-    private static final byte BF = (byte)0xBF;
-    private static final byte NUL = (byte)0x00;
-
-    private final byte[] buf = new byte[4];
-    private int bufLen;
-    private int curIndex;
-    private final Charset charset;
-
-    UnicodeDetectingInputStream(InputStream is) {
-        super(is);
-        charset = detectEncoding();
-    }
-
-    Charset getCharset() {
-        return charset;
-    }
-
-    private void fillBuf() {
-        int b1;
-        int b2;
-        int b3;
-        int b4;
-
-        try {
-            b1 = in.read();
-            if (b1 == -1) {
-                return;
-            }
-
-            b2 = in.read();
-            if (b2 == -1) {
-                bufLen = 1;
-                buf[0] = (byte)b1;
-                return;
-            }
-
-            b3 = in.read();
-            if (b3 == -1) {
-                bufLen = 2;
-                buf[0] = (byte)b1;
-                buf[1] = (byte)b2;
-                return;
-            }
-
-            b4 = in.read();
-            if (b4 == -1) {
-                bufLen = 3;
-                buf[0] = (byte)b1;
-                buf[1] = (byte)b2;
-                buf[2] = (byte)b3;
-                return;
-            }
-            bufLen = 4;
-            buf[0] = (byte)b1;
-            buf[1] = (byte)b2;
-            buf[2] = (byte)b3;
-            buf[3] = (byte)b4;
-        } catch (IOException ioe) {
-            throw new JsonException(JsonMessages.PARSER_INPUT_ENC_DETECT_IOERR(), ioe);
-        }
-    }
-
-    private Charset detectEncoding() {
-        fillBuf();
-        if (bufLen < 2) {
-            throw new JsonException(JsonMessages.PARSER_INPUT_ENC_DETECT_FAILED());
-        } else if (bufLen == 4) {
-            // Use BOM to detect encoding
-            if (buf[0] == NUL && buf[1] == NUL && buf[2] == FE && buf[3] == FF) {
-                curIndex = 4;
-                return UTF_32BE;
-            } else if (buf[0] == FF && buf[1] == FE && buf[2] == NUL && buf[3] == NUL) {
-                curIndex = 4;
-                return UTF_32LE;
-            } else if (buf[0] == FE && buf[1] == FF) {
-                curIndex = 2;
-                return StandardCharsets.UTF_16BE;
-            } else if (buf[0] == FF && buf[1] == FE) {
-                curIndex = 2;
-                return StandardCharsets.UTF_16LE;
-            } else if (buf[0] == EF && buf[1] == BB && buf[2] == BF) {
-                curIndex = 3;
-                return StandardCharsets.UTF_8;
-            }
-            // No BOM, just use JSON RFC's encoding algo to auto-detect
-            if (buf[0] == NUL && buf[1] == NUL && buf[2] == NUL) {
-                return UTF_32BE;
-            } else if (buf[0] == NUL && buf[2] == NUL) {
-                return StandardCharsets.UTF_16BE;
-            } else if (buf[1] == NUL && buf[2] == NUL && buf[3] == NUL) {
-                return UTF_32LE;
-            } else if (buf[1] == NUL && buf[3] == NUL) {
-                return StandardCharsets.UTF_16LE;
-            }
-        }
-        return StandardCharsets.UTF_8;
-    }
-
-    @Override
-    public int read() throws IOException {
-        if (curIndex < bufLen) {
-            return buf[curIndex++];
-        }
-        return in.read();
-    }
-
-    @Override
-    public int read(byte b[], int off, int len) throws IOException {
-        if (curIndex < bufLen) {
-            if (len == 0) {
-                return 0;
-            }
-            if (off < 0 || len < 0 || len > b.length -off) {
-                throw new IndexOutOfBoundsException();
-            }
-            int min = Math.min(bufLen-curIndex, len);
-            System.arraycopy(buf, curIndex, b, off, min);
-            curIndex += min;
-            return min;
-        }
-        return in.read(b, off, len);
-    }
-
-}
Index: trunk/src/org/glassfish/json/api/BufferPool.java
===================================================================
--- trunk/src/org/glassfish/json/api/BufferPool.java	(revision 16017)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License").  You
- * may not use this file except in compliance with the License.  You can
- * obtain a copy of the License at
- * https://oss.oracle.com/licenses/CDDL+GPL-1.1
- * or LICENSE.txt.  See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at LICENSE.txt.
- *
- * GPL Classpath Exception:
- * Oracle designates this particular file as subject to the "Classpath"
- * exception as provided by Oracle in the GPL Version 2 section of the License
- * file that accompanied this code.
- *
- * Modifications:
- * If applicable, add the following below the License Header, with the fields
- * enclosed by brackets [] replaced by your own identifying information:
- * "Portions Copyright [year] [name of copyright owner]"
- *
- * Contributor(s):
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license."  If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above.  However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package org.glassfish.json.api;
-
-/**
- * char[] pool that pool instances of char[] which are expensive to create.
- *
- * @author Jitendra Kotamraju
- */
-public interface BufferPool {
-
-    /**
-     * Gets a new char[] object from the pool.
-     *
-     * <p>
-     * If no object is available in the pool, this method creates a new one.
-     *
-     * @return
-     *      always non-null.
-     */
-    char[] take();
-
-    /**
-     * Returns an object back to the pool.
-     *
-     * @param buf object to return back to the pool
-     */
-    void recycle(char[] buf);
-
-}
