Package net.rim.tumbler.exception

Examples of net.rim.tumbler.exception.ValidationException


                    else if (entry.isDirectory()) {
                        // check for reservedDirs
                        for (String reserved : RESERVED_DIRS) {
                            // the dir entry name has a trailing / like "dir/"
                            if (entryName.equals(reserved + "/")) {
                                throw new ValidationException("EXCEPTION_ARCHIVE_RESERVED_DIR");
                            }
                        }
                    }
                    // Validate the resource name
                    // Allow "_" and "." anywhere in file name
                    // Disallow "-" as leading character, but allow it in other positions
                    Pattern patternEntryName = Pattern.compile("[a-zA-Z_0-9\\.][a-zA-Z_0-9\\-\\.]*");
                    String entity;
                    String fullEntryName = entryName;
                    boolean noMoreEntity = false;
                   
                    while (!noMoreEntity) {
                        if (entryName.charAt(entryName.length() - 1) == '/') {
                            entryName = entryName.substring(0, entryName.length() - 1); // Remove the ending '/'
                        }
                       
                        if (entryName.lastIndexOf('/') >= 0) {
                            entity = entryName.substring(entryName.lastIndexOf('/') + 1);
                            entryName = entryName.substring(0, entryName.lastIndexOf('/'));
                        } else {
                            entity = entryName;
                            noMoreEntity = true;
                        }
                       
                        if (!patternEntryName.matcher(entity).matches()) {
                            throw new ValidationException("EXCEPTION_INVALID_RESOURCE_NAME", fullEntryName);
                        }
                    }
                }
            }
            if (_configXML.length == 0) {
View Full Code Here

TOP

Related Classes of net.rim.tumbler.exception.ValidationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.