public boolean isSourceModified(Resource resource){
  boolean modified=true;
  String fileName=resource.getName();
  String path=(String)templatePaths.get(fileName);
  File currentFile=null;
  for (int i=0; currentFile == null && i < paths.size(); i++) {
    String testPath=(String)paths.get(i);
    File testFile=new File(testPath,fileName);
    if (testFile.canRead()) {
      currentFile=testFile;
    }
  }
  File file=new File(path,fileName);
  if (currentFile == null || !file.exists()) {
  }
 else   if (currentFile.equals(file) && file.canRead()) {
    modified=(file.lastModified() != resource.getLastModified());
  }
  return modified;
}

public boolean isSourceModified ( Resource resource ) { boolean modified = true ; String fileName = resource . getName ( ) ; String path = ( String ) templatePaths . get ( fileName ) ; File currentFile = null ; for ( int i = 0 ; currentFile == null && i < paths . size ( ) ; i ++ ) { String testPath = ( String ) paths . get ( i ) ; File testFile = new File ( testPath , fileName ) ; if ( testFile . canRead ( ) ) { currentFile = testFile ; } } File file = new File ( path , fileName ) ; if ( currentFile == null || ! file . exists ( ) ) { } else if ( currentFile . equals ( file ) && file . canRead ( ) ) { modified = ( file . lastModified ( ) != resource . getLastModified ( ) ) ; } return modified ; }
how to keep track of all the modified times across the paths . note that a file might have appeared in a directory which is earlier in the path ; so we should search the path and see if the file we find that way is the same as the one that we have cached .
