Pop an array or object scope.
@param closer Closing character
@throws JSONException If nesting is wrong.
545801
private void pop(char closer) throws JSONException {
        if (m_top <= -1) {
            throw new JSONException("Nesting error.");
        }
        try {
            m_writer.write(closer);
        }
        catch (IOException e) {
            throw new JSONException(e);
        }
        --m_top;
        m_mode = (m_top == -1) ?
                'd' :
                (m_scopeStack[m_top] == null) ? 'a' : 'k';
        m_expectingComma = true;
    }
539159
@Override
    public void close() {
        if (!this.closed.get()) {
            Futures.await(Services.stopAsync(this, this.executor));
            log.info("{}: Closed.", this.traceObjectId);
            this.closed.set(true);
        }
    }
274541
void closeResultData() throws SQLException {

        if (currentResultSet != null) {
            currentResultSet.close();
        }

        if (generatedResultSet != null) {
            generatedResultSet.close();
        }
        generatedResultSet = null;
        generatedResult    = null;
        resultIn           = null;
    }
191814
private JSONWriter end(char m, char c) throws JSONException {

        if (m_mode != m) {
            throw new JSONException(m == 'o' ? "Misplaced endObject." : "Misplaced endArray.");
        }
        pop(m);
        try {
            m_writer.write(c);
        } catch (IOException e) {
            throw new JSONException(e);
        }
        m_comma = true;
        return this;
    }
1305487
public void endMethod() throws IOException {
    Scope popped = popScope();
    if (popped == Scope.NON_ABSTRACT_METHOD) {
      indent();
      out.write("}\n");
    } else if (popped != Scope.ABSTRACT_METHOD) {
      throw new IllegalStateException();
    }
  }
986557
public static void closeEL(Object obj) {
	if (obj instanceof InputStream) IOUtil.closeEL((InputStream) obj);
	else if (obj instanceof OutputStream) IOUtil.closeEL((OutputStream) obj);
	else if (obj instanceof Writer) IOUtil.closeEL((Writer) obj);
	else if (obj instanceof Reader) IOUtil.closeEL((Reader) obj);
	else if (obj instanceof Closeable) IOUtil.closeEL((Closeable) obj);
	else if (obj instanceof ZipFile) IOUtil.closeEL((ZipFile) obj);
	else if (obj instanceof ResultSet) IOUtil.closeEL((ResultSet) obj);
	else if (obj instanceof Connection) IOUtil.closeEL((Connection) obj);
	else {
	    try {
		Method method = obj.getClass().getMethod("close", new Class[0]);
		method.invoke(obj, new Object[0]);
	    }
	    catch (Throwable e) {
		ExceptionUtil.rethrowIfNecessary(e);
	    }
	}
    }
515315
public boolean close(int closedReason, SIBUuid8 qpoint)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "close", 
          new Object[] { Integer.valueOf(closedReason), 
                         qpoint});

    /*
     * Indicate that the consumer is closed, due to the local destination
     * being deleted/receiveExclusive/unreachable
     */
    this.closedReason = closedReason;
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "close", true);
    return true;
  }
373288
public void closeRetain(Collection<String> retain) {
		Set<String> close = new HashSet<>(cache.keySet());
		close.removeAll(retain);
		for (String name : close) {
			close(name);
		}
	}
345432
private void beforeKey() throws JSONException {
        Scope context = peek();
        if (context == Scope.NONEMPTY_OBJECT) { // first in object
            out.append(',');
        } else if (context != Scope.EMPTY_OBJECT) { // not in an object!
            throw new JSONException("Nesting problem");
        }
        newline();
        replaceTop(Scope.DANGLING_KEY);
    }
752376
@Override public void close() throws IOException {
    sink.close();

    int size = stackSize;
    if (size > 1 || (size == 1 && scopes[size - 1] != NONEMPTY_DOCUMENT)) {
      throw new IOException("Incomplete document");
    }
    stackSize = 0;
  }
815487
@Override @DefinedBy(Api.COMPILER)
    public void close() throws IOException {
        if (deferredCloseTimeout > 0) {
            deferredClose();
            return;
        }

        locations.close();
        for (Container container: containers.values()) {
            container.close();
        }
        containers.clear();
        contentCache.clear();
    }
735978
public void closeJsonStream() throws IOException {
		if (generator == null) {
			return;
		}

		while (!stack.isEmpty()) {
			writeEndComponent();
		}

		if (wrapInArray) {
			generator.writeEndArray();
		}

		if (closeGenerator) {
			generator.close();
		}
	}
360811
private void pop(char c) throws JSONException {
    if (this.top <= 0) {
      throw new JSONException("Nesting error.");
    }
    char m = this.stack[this.top - 1] == null ? 'a' : 'k';
    if (m != c) {
      throw new JSONException("Nesting error.");
    }
    this.top -= 1;
    this.mode = this.top == 0 ? 'd' : this.stack[this.top - 1] == null ? 'a' : 'k';
  }
319932
protected void closeResources(Connection connection, Statement statement, ResultSet results) {
        if (results != null) {
            try {
                results.close();
            } catch (SQLException e) {
                LOG.finest("Caught exception closing resultSet: " + e.getMessage() + " - continuing");
            }
        }
        closeResources(connection, statement);
    }
265555
private JSONWriter end(char m, char c) throws JSONException {
        if (this.mode != m) {
            throw new JSONException(m == 'a'
                ? "Misplaced endArray."
                : "Misplaced endObject.");
        }
        this.pop(m);
        try {
            this.writer.append(c);
        } catch (IOException e) {
        	// Android as of API 25 does not support this exception constructor
        	// however we won't worry about it. If an exception is happening here
        	// it will just throw a "Method not found" exception instead.
            throw new JSONException(e);
        }
        this.comma = true;
        return this;
    }
278508
public JSONWriter arrayEnd() throws IOException {
        writer.write(JSON.RSQUARE);
        state = stack.pop();
        return this;
    }
615638
public void back() throws JSONException {
		if (this.usePrevious || this.index <= 0) {
			throw new JSONException("Stepping back two steps is not supported");
		}
		this.index -= 1;
		this.character -= 1;
		this.usePrevious = true;
		this.eof = false;
	}