voxforge.org
VoxForge Dev

Changeset 2329

Show
Ignore:
Timestamp:
10/11/07 23:04:37 (1 year ago)
Author:
kmaclean
Message:

fix ticket #262 Validate username

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Trunk/SpeechSubmission/VFSpeechSubmission/java/src/speechrecorder/CapturePlayback.java

    r2328 r2329  
    15171517                   usernameTextField.selectAll(); 
    15181518                   userName = usernameTextField.getText(); 
     1519                   //!!!!!! 
     1520                   // see   java.util.regex.Pattern 
     1521                   //      \w   A word character: [a-zA-Z_0-9] 
     1522                   //      \W   A non-word character: [^\w] 
     1523                           userName = (usernameTextField.getText().replaceAll("\\W","")); 
     1524                   // !!!!!! 
    15191525                   if (userName.length() == 0 ) { 
    15201526                       userName = "anonymous"; 
    15211527                   } else { 
    1522                 // !!!!!!        
    1523                // see   java.util.regex.Pattern 
    1524                //         \w   A word character: [a-zA-Z_0-9] 
    1525                 //        \W   A non-word character: [^\w] 
    1526                   userName = (usernameTextField.getText().replaceAll("\\W","")).substring(0,25); 
     1528                          // !!!!!!      
     1529                                  if (userName.length() > 25 ) { 
     1530                                          userName = userName.substring(0,25); 
     1531                          }  
     1532                                  // !!!!!! 
    15271533                   } 
    1528 // !!!!!!                 
     1534                  
    15291535                } catch (NullPointerException ex) {  
    15301536               userName = "anonymous";