Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. /**
  2. * Initialises cache file member variable if not already initialised.
  3. */
  4. private void initCacheFile() {
  5. if (cacheFile == null) {
  6. if (cacheFileName == null || cacheFileName.equals(""))
  7. { /* Old Code that broke under Linux
  8. * cacheFileName = System.getProperty("java.io.tmpdir")
  9. * + "ExchangeRates.xml";
  10. */
  11.  
  12. /*
  13. * The name of the cache file is saved as a part of the package
  14. * Preferences. This code checks to see if a name has been saved.
  15. * If not a new File is created in the temp directory identified
  16. * by java.util.tmpdir. The Preferences are then updated.
  17. */
  18. if (prefs.get("cacheFileName", "").equals(""))
  19. {
  20. cacheFile = new File(System.getProperty("java.util.tmpdir",
  21. "ExchangeRates.xml"));
  22. prefs.put("cacheFileName", cacheFile.getName());
  23. }
  24. else {
  25. cacheFile = new File(prefs.get("cacheFileName",""));
  26. }
  27.  
  28. }
  29. }
  30. cacheFileName = cacheFile.getName();
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement