All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.fge.uritemplate.URITemplateParseException Maven / Gradle / Ivy

There is a newer version: 0.9
Show newest version
package com.github.fge.uritemplate;

import java.nio.CharBuffer;

/**
 * Exception class on URI template parsing error
 *
 * 

The exception message will always contain the offset at which the error * was encountered.

*/ public final class URITemplateParseException extends URITemplateException { private final String originalMessage; private final int offset; /** * Constructor * * @param message the message to display * @param buffer the buffer in which the error occurred * @param previousChar whether the error relates to the current buffer * position or the character immediately preceding it */ public URITemplateParseException(final String message, final CharBuffer buffer, final boolean previousChar) { super(message); originalMessage = message; offset = previousChar ? buffer.position() - 1 : buffer.position(); } /** * Alternate constructor * *

This is equivalent to calling {@link * #URITemplateParseException(String, CharBuffer, boolean)} with the third * argument being false.

* * @param message the message to display * @param buffer the buffer in which the error occurred */ public URITemplateParseException(final String message, final CharBuffer buffer) { this(message, buffer, false); } public String getOriginalMessage() { return originalMessage; } public int getOffset() { return offset; } @Override public String getMessage() { return super.getMessage() + " (at offset " + offset + ')'; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy