Example usage for com.liferay.portal.util PropsValues DL_FILE_EXTENSIONS_STRICT_CHECK

List of usage examples for com.liferay.portal.util PropsValues DL_FILE_EXTENSIONS_STRICT_CHECK

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues DL_FILE_EXTENSIONS_STRICT_CHECK.

Prototype

boolean DL_FILE_EXTENSIONS_STRICT_CHECK

To view the source code for com.liferay.portal.util PropsValues DL_FILE_EXTENSIONS_STRICT_CHECK.

Click Source Link

Usage

From source file:com.liferay.document.library.internal.util.DLValidatorImpl.java

License:Open Source License

@Override
public void validateSourceFileExtension(String fileExtension, String sourceFileName)
        throws SourceFileNameException {

    String sourceFileExtension = FileUtil.getExtension(sourceFileName);

    if (Validator.isNotNull(sourceFileName) && PropsValues.DL_FILE_EXTENSIONS_STRICT_CHECK
            && !fileExtension.equals(sourceFileExtension)) {

        throw new SourceFileNameException(sourceFileExtension);
    }/*from   ww w .  jav a 2s  .  com*/
}

From source file:com.liferay.portlet.documentlibrary.store.DLStoreImpl.java

License:Open Source License

protected void validate(String fileName, String fileExtension, String sourceFileName,
        boolean validateFileExtension) throws PortalException, SystemException {

    String sourceFileExtension = FileUtil.getExtension(sourceFileName);

    if (Validator.isNotNull(sourceFileName) && PropsValues.DL_FILE_EXTENSIONS_STRICT_CHECK
            && !fileExtension.equals(sourceFileExtension)) {

        throw new SourceFileNameException(sourceFileExtension);
    }/*  ww w .  j  a v a 2s  .co  m*/

    validate(fileName, validateFileExtension);
}