com.atlassian.jira.web.util
Class FileNameCharacterCheckerUtil
java.lang.Object
com.atlassian.jira.web.util.FileNameCharacterCheckerUtil
public class FileNameCharacterCheckerUtil
- extends Object
This is a centralized object for checking illegal characters in attachment file names. This is used by the
AttachmentManager, the Screenshot Applet, the Abstract Message Handler and others.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileNameCharacterCheckerUtil
public FileNameCharacterCheckerUtil()
assertFileNameDoesNotContainInvalidChars
public String assertFileNameDoesNotContainInvalidChars(String filename)
- This will test the given filename string for any invalid characters. If it contains an invalid
character then the string returned will be the character. A return value of null means that the
string is a valid filename. if the filename is null it will return null for the caller to handle
the null filename.
- Parameters:
filename
- the filename to be checked.
- Returns:
- null if the filename is valid, else the character that is invalid.
replaceInvalidChars
public String replaceInvalidChars(String filename,
char replacementChar)
- Replaces each invalid character of the given filename with the replacementChar. If the filename is null, returns
null so that the caller can handle the null filename
- Parameters:
filename
- file name to replace invalid characters fromreplacementChar
- character to replace invalid characters
- Returns:
- new filename with valid characters
- Throws:
IllegalArgumentException
- if replacementChar is an invalid character itself
getPrintableInvalidCharacters
public String getPrintableInvalidCharacters()
getInvalidCharacters
public static char[] getInvalidCharacters()
Copyright © 2002-2013 Atlassian. All Rights Reserved.