Exception thrown if there is a validation problem with a path template, http config, or related
framework methods. Comes as an illegal argument exception subclass. Allows to globally set a
thread-local validation context description which each exception inherits.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eValidationException\u003c/code\u003e class is 2.46.1, accessible via a direct link.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eValidationException\u003c/code\u003e is a subclass of \u003ccode\u003eIllegalArgumentException\u003c/code\u003e and is thrown when issues are found in path templates, HTTP configurations, or related framework methods.\u003c/p\u003e\n"],["\u003cp\u003eThe class allows for the management of a thread-local validation context description, which can be set using \u003ccode\u003epushCurrentThreadValidationContext\u003c/code\u003e and cleared with \u003ccode\u003epopCurrentThreadValidationContext\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt includes inherited members from \u003ccode\u003eObject\u003c/code\u003e and \u003ccode\u003eThrowable\u003c/code\u003e, such as methods for managing stack traces, messages, and object comparisons.\u003c/p\u003e\n"],["\u003cp\u003eThe class has a constructor \u003ccode\u003eValidationException(String format, Object[] args)\u003c/code\u003e for constructing exceptions with implicit context, and static methods for handling thread-local validation context descriptions.\u003c/p\u003e\n"]]],[],null,["# Exception ValidationException (2.52.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.52.0 (latest)](/java/docs/reference/api-common/latest/com.google.api.pathtemplate.ValidationException)\n- [2.51.2](/java/docs/reference/api-common/2.51.2/com.google.api.pathtemplate.ValidationException)\n- [2.50.0](/java/docs/reference/api-common/2.50.0/com.google.api.pathtemplate.ValidationException)\n- [2.49.0](/java/docs/reference/api-common/2.49.0/com.google.api.pathtemplate.ValidationException)\n- [2.48.0](/java/docs/reference/api-common/2.48.0/com.google.api.pathtemplate.ValidationException)\n- [2.46.1](/java/docs/reference/api-common/2.46.1/com.google.api.pathtemplate.ValidationException)\n- [2.45.0](/java/docs/reference/api-common/2.45.0/com.google.api.pathtemplate.ValidationException)\n- [2.44.0](/java/docs/reference/api-common/2.44.0/com.google.api.pathtemplate.ValidationException)\n- [2.43.0](/java/docs/reference/api-common/2.43.0/com.google.api.pathtemplate.ValidationException)\n- [2.42.1](/java/docs/reference/api-common/2.42.1/com.google.api.pathtemplate.ValidationException)\n- [2.41.0](/java/docs/reference/api-common/2.41.0/com.google.api.pathtemplate.ValidationException)\n- [2.40.0](/java/docs/reference/api-common/2.40.0/com.google.api.pathtemplate.ValidationException)\n- [2.38.0](/java/docs/reference/api-common/2.38.0/com.google.api.pathtemplate.ValidationException)\n- [2.37.1](/java/docs/reference/api-common/2.37.1/com.google.api.pathtemplate.ValidationException)\n- [2.36.0](/java/docs/reference/api-common/2.36.0/com.google.api.pathtemplate.ValidationException)\n- [2.35.0](/java/docs/reference/api-common/2.35.0/com.google.api.pathtemplate.ValidationException)\n- [2.34.0](/java/docs/reference/api-common/2.34.0/com.google.api.pathtemplate.ValidationException)\n- [2.33.0](/java/docs/reference/api-common/2.33.0/com.google.api.pathtemplate.ValidationException)\n- [2.32.0](/java/docs/reference/api-common/2.32.0/com.google.api.pathtemplate.ValidationException)\n- [2.31.1](/java/docs/reference/api-common/2.31.1/com.google.api.pathtemplate.ValidationException)\n- [2.30.0](/java/docs/reference/api-common/2.30.0/com.google.api.pathtemplate.ValidationException)\n- [2.29.1](/java/docs/reference/api-common/2.29.1/com.google.api.pathtemplate.ValidationException)\n- [2.28.0](/java/docs/reference/api-common/2.28.0/com.google.api.pathtemplate.ValidationException)\n- [2.26.0](/java/docs/reference/api-common/2.26.0/com.google.api.pathtemplate.ValidationException)\n- [2.25.0](/java/docs/reference/api-common/2.25.0/com.google.api.pathtemplate.ValidationException)\n- [2.24.0](/java/docs/reference/api-common/2.24.0/com.google.api.pathtemplate.ValidationException)\n- [2.22.0](/java/docs/reference/api-common/2.22.0/com.google.api.pathtemplate.ValidationException)\n- [2.21.0](/java/docs/reference/api-common/2.21.0/com.google.api.pathtemplate.ValidationException)\n- [2.20.0](/java/docs/reference/api-common/2.20.0/com.google.api.pathtemplate.ValidationException)\n- [2.19.0](/java/docs/reference/api-common/2.19.0/com.google.api.pathtemplate.ValidationException)\n- [2.18.0](/java/docs/reference/api-common/2.18.0/com.google.api.pathtemplate.ValidationException)\n- [2.17.1](/java/docs/reference/api-common/2.17.1/com.google.api.pathtemplate.ValidationException)\n- [2.16.0](/java/docs/reference/api-common/2.16.0/com.google.api.pathtemplate.ValidationException)\n- [2.15.1](/java/docs/reference/api-common/2.15.1/com.google.api.pathtemplate.ValidationException)\n- [2.14.1](/java/docs/reference/api-common/2.14.1/com.google.api.pathtemplate.ValidationException)\n- [2.13.1](/java/docs/reference/api-common/2.13.1/com.google.api.pathtemplate.ValidationException)\n- [2.7.0](/java/docs/reference/api-common/2.7.0/com.google.api.pathtemplate.ValidationException)\n- [2.6.3](/java/docs/reference/api-common/2.6.3/com.google.api.pathtemplate.ValidationException)\n- [2.5.0](/java/docs/reference/api-common/2.5.0/com.google.api.pathtemplate.ValidationException)\n- [2.4.0](/java/docs/reference/api-common/2.4.0/com.google.api.pathtemplate.ValidationException)\n- [2.3.1](/java/docs/reference/api-common/2.3.1/com.google.api.pathtemplate.ValidationException)\n- [2.1.2](/java/docs/reference/api-common/2.1.2/com.google.api.pathtemplate.ValidationException) \n\n public class ValidationException extends IllegalArgumentException\n\nException thrown if there is a validation problem with a path template, http config, or related\nframework methods. Comes as an illegal argument exception subclass. Allows to globally set a\nthread-local validation context description which each exception inherits. \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-) \n[Throwable.addSuppressed(Throwable)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#addSuppressed-java.lang.Throwable-) \n[Throwable.fillInStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#fillInStackTrace--) \n[Throwable.getCause()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getCause--) \n[Throwable.getLocalizedMessage()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getLocalizedMessage--) \n[Throwable.getMessage()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getMessage--) \n[Throwable.getStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getStackTrace--) \n[Throwable.getSuppressed()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getSuppressed--) \n[Throwable.initCause(Throwable)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#initCause-java.lang.Throwable-) \n[Throwable.printStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace--) \n[Throwable.printStackTrace(PrintStream)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintStream-) \n[Throwable.printStackTrace(PrintWriter)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintWriter-) \n[Throwable.setStackTrace(StackTraceElement\\[\\])](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#setStackTrace-java.lang.StackTraceElement[]-) \n[Throwable.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#toString--)\n\nStatic Methods\n--------------\n\n### popCurrentThreadValidationContext()\n\n public static void popCurrentThreadValidationContext()\n\nClears the validation context.\n\n### pushCurrentThreadValidationContext(ValidationException.Supplier\\\u003cString\\\u003e supplier)\n\n public static void pushCurrentThreadValidationContext(ValidationException.Supplier\u003cString\u003e supplier)\n\nSets the validation context description. Each thread has its own description, so this is thread\nsafe.\n\n### pushCurrentThreadValidationContext(String context)\n\n public static void pushCurrentThreadValidationContext(String context)\n\nConstructors\n------------\n\n### ValidationException(String format, Object\\[\\] args)\n\n public ValidationException(String format, Object[] args)\n\nConstruct validation exception with implicit context."]]