InvalidFileNameException (Apache Tomcat 11.0.23 API Documentation)
Description: declaration: package: org.apache.tomcat.util.http.fileupload, class: InvalidFileNameException

# Class InvalidFileNameException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.apache.tomcat.util.http.fileupload.InvalidFileNameException

All Implemented Interfaces:
  `Serializable`

public class InvalidFileNameException extends RuntimeException
This exception is thrown in case of an invalid file name. A file name is invalid, if it contains a NUL character. Attackers might use this to circumvent security checks: For example, a malicious user might upload a file with the name "foo.exe\0.png". This file name might pass security checks (i.e. checks for the extension ".png"), while, depending on the underlying C library, it might create a file named "foo.exe", as the NUL character is the string terminator in C.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InvalidFileNameException(String name, String message)`
  Creates a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getName()`
  Returns the invalid file name.

  ### Methods inherited from class Throwable

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### InvalidFileNameException

    public InvalidFileNameException(String name, String message)
    Creates a new instance.
    Parameters:
      `name` - The file name causing the exception.
      `message` - A human readable error message.

- ## Method Details

  - ### getName

    public String getName()
    Returns the invalid file name.
    Returns:
      the invalid file name.