- Timestamp:
- 2006-03-17T14:36:57+13:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java
r10726 r11391 218 218 * @return the filename as a String 219 219 */ 220 public String getName() { 221 // Retrieve the first 8 non-whitespace characters of title_final. 220 public String getName() 221 { 222 // Retrieve the first 8 non-whitespace ASCII characters of title_final. 222 223 StringBuffer name_buffer = new StringBuffer(""); 223 224 int i = 0; 225 int u = 0; 226 while(i < title_final.length() && u < 8) { 224 for (int i = 0, u = 0; (i < title_final.length() && u < 8); i++) { 225 // To be safe we make sure the internal collection name (folder name) contains only ASCII characters 227 226 char c = title_final.charAt(i); 228 // Arg. We need a few more tests than just whitespace 229 if(Character.isLetterOrDigit(c)) { 227 if ((int) c < 128 && Character.isLetterOrDigit(c)) { 230 228 name_buffer.append(Character.toLowerCase(c)); 231 229 u++; 232 230 } 233 i++; 234 } 231 } 232 233 // Use "col" as the base collection name if we have nothing left 234 if (name_buffer.length() == 0) { 235 name_buffer = new StringBuffer("col"); 236 } 237 235 238 // We need to ensure the filename is unique 236 239 int counter = 0;
Note:
See TracChangeset
for help on using the changeset viewer.