Ignore:
Timestamp:
05/01/08 17:55:18 (16 years ago)
Author:
ra33
Message:

Remove non alpha numeric chars from frameset names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameIO.java

    r10 r12  
    774774        }
    775775
    776         private static String NameValidation(String toValidate) throws Exception {
     776        public static String ConvertToValidFramesetName(String toValidate) {
    777777                String result = "";
    778778
     
    781781                        char cur = toValidate.charAt(i);
    782782
    783                         // check for illegal characters
    784                         if (ILLEGAL_CHARS.contains("" + cur)) {
    785                                 throw new Exception(
    786                                                 "Frameset name contains illegal character '" + cur
    787                                                                 + "' at position " + (i + 1));
    788                         }
    789 
    790783                        // capitalize all characters after spaces
    791                         if (cur == ' ') {
    792                                 capital = true;
    793                         } else {
     784                        if (Character.isLetterOrDigit(cur)) {
    794785                                if (capital) {
    795786                                        capital = false;
     
    799790
    800791                                if (result.length() >= MAX_NAME_LENGTH) {
    801                                         throw new Exception("Frameset name is too long (Max "
    802                                                         + MAX_NAME_LENGTH + " characters)");
     792                                        result = result.substring(0,MAX_NAME_LENGTH);
    803793                                }
    804                         }
    805                 }
    806 
     794                        } else {
     795                                capital = true;
     796                        }
     797                }
     798               
    807799                return result;
    808800        }
     
    900892
    901893                // ensure the framename is valid
    902                 frameset = NameValidation(frameset);
     894                frameset = ConvertToValidFramesetName(frameset);
    903895
    904896                if (frameset == null)
     
    970962                if (!FrameIO.DoesFramesetExist(framesetName))
    971963                        return false;
    972                
     964
    973965                for (String path : UserSettings.FrameDirs) {
    974966                        String source = path + framesetName.toLowerCase() + File.separator;
Note: See TracChangeset for help on using the changeset viewer.