Develop and Download Open Source Software

Browse Subversion Repository

Diff of /dvibrowser-1.2.0/trunk/dvicore/src/main/java/jp/sourceforge/dvibrowser/dvicore/ctx/FileLocationResolver.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 122 by nagaotakeyuki, Mon Jan 10 11:46:29 2011 UTC revision 123 by nagaotakeyuki, Fri Mar 4 13:56:55 2011 UTC
# Line 33  Line 33 
33  package jp.sourceforge.dvibrowser.dvicore.ctx;  package jp.sourceforge.dvibrowser.dvicore.ctx;
34  import java.io.File;  import java.io.File;
35  import java.net.URL;  import java.net.URL;
36    import java.security.AccessControlException;
37  import java.util.ArrayList;  import java.util.ArrayList;
38  import java.util.Collection;  import java.util.Collection;
39  import java.util.List;  import java.util.List;
# Line 64  implements Computation<String, Collectio Line 65  implements Computation<String, Collectio
65      ProgressItem progress = getDviContext().getProgressRecorder().open("preparing " + filename);      ProgressItem progress = getDviContext().getProgressRecorder().open("preparing " + filename);
66      List<URL> list = new ArrayList<URL>();      List<URL> list = new ArrayList<URL>();
67      try {      try {
68        {        try {
69          if ("true".equals(System.getProperty("dvi.ctx.DefaultDviContext.usePackageShareDir"))) {          if ("true".equals(System.getProperty("dvi.ctx.DefaultDviContext.usePackageShareDir"))) {
70            File f = new File("share", filename);            File f = new File("share", filename);
71            if (f.exists() && f.canRead()) {            if (f.exists() && f.canRead()) {
# Line 73  implements Computation<String, Collectio Line 74  implements Computation<String, Collectio
74              return list;              return list;
75            }            }
76          }          }
77          } catch (AccessControlException ex) {
78              LOGGER.warning(ex.toString());
79        }        }
80                
81        LOGGER.finer("running kpsewhich: " + filename);        LOGGER.finer("running kpsewhich: " + filename);
82        {        try {
83          URL url = null;          URL url = null;
84          KpseWhich kpseWhich = new KpseWhich(this);          KpseWhich kpseWhich = new KpseWhich(this);
85          url = kpseWhich.findURL(filename, true);          url = kpseWhich.findURL(filename, true);
86          LOGGER.finer("kpsewhich result: " + filename + " => " + url);          LOGGER.finer("kpsewhich result: " + filename + " => " + url);
87          if (url != null)          if (url != null)
88            list.add(url);            list.add(url);
89          } catch (RuntimeException ex) {
90              LOGGER.warning(ex.toString());
91        }        }
92                
93        {        try {
94          URL u = ClassLoader.getSystemResource(systemResourcePath + "/"          URL u = ClassLoader.getSystemResource(systemResourcePath + "/"
95              + filename);              + filename);
96          LOGGER.fine("system resource by kpsewhich: " + filename + " => " + u);          LOGGER.fine("system resource by classloader: " + filename + " => " + u);
97          if (u != null)          if (u != null)
98            list.add(u);            list.add(u);
99          } catch (RuntimeException ex) {
100              LOGGER.warning(ex.toString());
101          }
102          
103          try {
104              URL u = getClass().getResource(systemResourcePath + "/"
105                  + filename);
106              LOGGER.fine("resource by classloader: " + filename + " => " + u);
107              if (u != null)
108                list.add(u);
109            } catch (RuntimeException ex) {
110                LOGGER.warning(ex.toString());
111            }
112    
113          
114          if (list.size() == 0) {
115              LOGGER.warning("Failed to resolve file: " + filename);
116        }        }
     } catch (RuntimeException e) {  
       LOGGER.warning(e.toString());  
117      } finally {      } finally {
118        progress.close();        progress.close();
119      }      }

Legend:
Removed from v.122  
changed lines
  Added in v.123

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26