private String getCurrentTokenDescription()

in commons-geometry-io-core/src/main/java/org/apache/commons/geometry/io/core/internal/SimpleTextParser.java [971:997]


    private String getCurrentTokenDescription() {
        if (currentToken == null || currentToken.isEmpty()) {
            // attempt to return a more helpful message about the location
            // of empty tokens by checking the buffer content; if this fails
            // we'll ignore the error and continue with a more generic message
            try {
                if (!hasMoreCharacters()) {
                    return "end of content";
                } else if (currentToken != null) {
                    if (!hasMoreCharactersOnLine()) {
                        return "end of line";
                    }
                    return "empty token followed by [" + peek(1) + "]";
                }
            } catch (IllegalStateException exc) {
                // ignore
            }
        }

        if (currentToken == null) {
            return "no current token";
        } else if (currentToken.isEmpty()) {
            return "empty token";
        }

        return "[" + currentToken + "]";
    }