Changed method name
This commit is contained in:
parent
7d6c451c00
commit
bae2d91e8c
2 changed files with 5 additions and 5 deletions
|
|
@ -249,8 +249,8 @@ public class FileUtil {
|
||||||
* @param file is the file
|
* @param file is the file
|
||||||
* @return The extension
|
* @return The extension
|
||||||
*/
|
*/
|
||||||
public static String fileExtension(File file){
|
public static String getFileExtension(File file){
|
||||||
return fileExtension(file.getName());
|
return getFileExtension(file.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -259,7 +259,7 @@ public class FileUtil {
|
||||||
* @param file is the file
|
* @param file is the file
|
||||||
* @return The extension
|
* @return The extension
|
||||||
*/
|
*/
|
||||||
public static String fileExtension(String file){
|
public static String getFileExtension(String file){
|
||||||
if( file == null || file.lastIndexOf(".") == -1 )
|
if( file == null || file.lastIndexOf(".") == -1 )
|
||||||
return "";
|
return "";
|
||||||
return file.substring(file.lastIndexOf(".")+1, file.length());
|
return file.substring(file.lastIndexOf(".")+1, file.length());
|
||||||
|
|
|
||||||
|
|
@ -194,8 +194,8 @@ public abstract class AjaxFileUpload extends HttpServlet {
|
||||||
while( it.hasNext() ) {
|
while( it.hasNext() ) {
|
||||||
FileItemStream item = it.next();
|
FileItemStream item = it.next();
|
||||||
// Is the file type allowed?
|
// Is the file type allowed?
|
||||||
if( !item.isFormField() && !ALLOWED_EXTENSIONS.contains( FileUtil.fileExtension(item.getName()) )){
|
if( !item.isFormField() && !ALLOWED_EXTENSIONS.contains( FileUtil.getFileExtension(item.getName()) )){
|
||||||
String msg = "Filetype "+FileUtil.fileExtension(item.getName())+" is not allowed!";
|
String msg = "Filetype "+FileUtil.getFileExtension(item.getName())+" is not allowed!";
|
||||||
logger.warning( msg );
|
logger.warning( msg );
|
||||||
listener.setStatus(Status.Error);
|
listener.setStatus(Status.Error);
|
||||||
listener.setFileName( item.getName() );
|
listener.setFileName( item.getName() );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue