1 22 package org.jboss.ejb3.cache.tree; 23 24 import java.util.List ; 25 import java.util.regex.Matcher ; 26 import java.util.regex.Pattern ; 27 28 import org.apache.commons.logging.Log; 29 import org.apache.commons.logging.LogFactory; 30 import org.jboss.cache.Fqn; 31 import org.jboss.cache.loader.FileCacheLoader; 32 33 public class SFSBFileCacheLoader extends FileCacheLoader 34 { 35 Log log = LogFactory.getLog(SFSBFileCacheLoader.class); 36 37 @Override 38 39 protected boolean isCharacterPortableTree(Fqn fqn) 40 { 41 42 Pattern fqnPattern = Pattern.compile("[\\\\\\/:*<>|\"?]"); 43 44 List elements = fqn.peekElements(); 45 for (Object anElement : elements) 46 { 47 Matcher matcher = fqnPattern.matcher(anElement.toString()); 48 if (matcher.find()) 49 { 50 log.warn("One of the Fqn ( " + fqn + " ) elements contains one of these characters: '*' '<' '>' '|' '\"' '?' '\\' '/' ':' "); 51 log.warn("Directories containing these characters are illegal in some operative systems and could lead to portability issues"); 52 return false; 53 } 54 } 55 56 return true; 57 } 58 59 } 60 | Popular Tags |