Changeset 8357 in josm for trunk/src/org/openstreetmap/josm
- Timestamp:
- 2015-05-15T23:49:31+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r8342 r8357 337 337 * Class that represent a line 338 338 */ 339 private class Line { 339 private static class Line { 340 340 341 341 /** -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r8342 r8357 765 765 List<WayInPolygon> result = new ArrayList<>(); 766 766 767 //prepare prev and next maps767 //prepare next map 768 768 Map<Way, Way> nextWayMap = new HashMap<>(); 769 Map<Way, Way> prevWayMap = new HashMap<>();770 769 771 770 for (int pos = 0; pos < parts.size(); pos ++) { … … 775 774 776 775 nextWayMap.put(parts.get(pos), parts.get((pos + 1) % parts.size())); 777 prevWayMap.put(parts.get(pos), parts.get((pos + parts.size() - 1) % parts.size()));778 776 } 779 777 -
trunk/src/org/openstreetmap/josm/actions/RestartAction.java
r8356 r8357 114 114 String[] mainCommand = System.getProperty("sun.java.command").split(" "); 115 115 // look for a .jar in all chunks to support paths with spaces (fix #9077) 116 String jarPath = mainCommand[0]; 117 for (int i = 1; i < mainCommand.length && !jarPath.endsWith(".jar"); i++) { 118 jarPath += " " + mainCommand[i]; 119 } 116 StringBuilder sb = new StringBuilder(mainCommand[0]); 117 for (int i = 1; i < mainCommand.length && !mainCommand[i-1].endsWith(".jar"); i++) { 118 sb.append(" ").append(mainCommand[i]); 119 } 120 String jarPath = sb.toString(); 120 121 // program main is a jar 121 122 if (jarPath.endsWith(".jar")) { -
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r8308 r8357 197 197 Main.warn(tr("Unable to delete old backup file {0}", oldFile.getAbsolutePath())); 198 198 } else { 199 getPidFile(oldFile).delete(); 199 File pidFile = getPidFile(oldFile); 200 if (!pidFile.delete()) { 201 Main.warn(tr("Unable to delete old backup file {0}", pidFile.getAbsolutePath())); 202 } 200 203 } 201 204 } -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r8344 r8357 815 815 File tmpFile = new File(prefFile + "_tmp"); 816 816 Utils.copyFile(tmpFile, prefFile); 817 tmpFile.delete(); 817 if (!tmpFile.delete()) { 818 Main.warn(tr("Unable to delete temporary file {0}", tmpFile.getAbsolutePath())); 819 } 818 820 819 821 setCorrectPermissions(prefFile); … … 822 824 823 825 private void setCorrectPermissions(File file) { 824 file.setReadable(false, false); 825 file.setWritable(false, false); 826 file.setExecutable(false, false); 827 file.setReadable(true, true); 828 file.setWritable(true, true); 826 if (!file.setReadable(false, false) && Main.isDebugEnabled()) { 827 Main.debug(tr("Unable to set file non-readable {0}", file.getAbsolutePath())); 828 } 829 if (!file.setWritable(false, false) && Main.isDebugEnabled()) { 830 Main.debug(tr("Unable to set file non-writable {0}", file.getAbsolutePath())); 831 } 832 if (!file.setExecutable(false, false) && Main.isDebugEnabled()) { 833 Main.debug(tr("Unable to set file non-executable {0}", file.getAbsolutePath())); 834 } 835 if (!file.setReadable(true, true) && Main.isDebugEnabled()) { 836 Main.debug(tr("Unable to set file readable {0}", file.getAbsolutePath())); 837 } 838 if (!file.setWritable(true, true) && Main.isDebugEnabled()) { 839 Main.debug(tr("Unable to set file writable {0}", file.getAbsolutePath())); 840 } 829 841 } 830 842 -
trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
r8345 r8357 56 56 57 57 File cacheDirLockPath = new File(cacheDir, ".lock"); 58 if (!cacheDirLockPath.exists()) 59 cacheDirLockPath.createNewFile(); 58 if (!cacheDirLockPath.exists() && !cacheDirLockPath.createNewFile()) { 59 log.log(Level.WARNING, "Cannot create cache dir lock file"); 60 } 60 61 cacheDirLock = new FileOutputStream(cacheDirLockPath).getChannel().tryLock(); 61 62 -
trunk/src/org/openstreetmap/josm/data/coor/CachedLatLon.java
r8308 r8357 9 9 * 10 10 * This class is convenient to use, but has relatively high memory costs. 11 * It keeps a pointer to the last known projection in order to detect projection 12 * changes. 11 * It keeps a pointer to the last known projection in order to detect projection changes. 13 12 * 14 13 * Node and WayPoint have another, optimized, cache for projected coordinates. 15 14 */ 16 15 public class CachedLatLon extends LatLon { 16 17 private static final long serialVersionUID = 1L; 18 17 19 private EastNorth eastNorth; 18 20 private transient Projection proj; 19 21 22 /** 23 * Constructs a new {@code CachedLatLon}. 24 * @param lat latitude 25 * @param lon longitude 26 */ 20 27 public CachedLatLon(double lat, double lon) { 21 28 super(lat, lon); 22 29 } 23 30 31 /** 32 * Constructs a new {@code CachedLatLon}. 33 * @param coor lat/lon 34 */ 24 35 public CachedLatLon(LatLon coor) { 25 36 super(coor.lat(), coor.lon()); … … 27 38 } 28 39 40 /** 41 * Constructs a new {@code CachedLatLon}. 42 * @param eastNorth easting/northing 43 */ 29 44 public CachedLatLon(EastNorth eastNorth) { 30 45 super(Main.getProjection().eastNorth2latlon(eastNorth)); … … 39 54 */ 40 55 public final EastNorth getEastNorth() { 41 if(proj != Main.getProjection()) 42 { 56 if (proj != Main.getProjection()) { 43 57 proj = Main.getProjection(); 44 58 eastNorth = proj.latlon2eastNorth(this); … … 46 60 return eastNorth; 47 61 } 48 @Override public String toString() { 62 63 @Override 64 public String toString() { 49 65 return "CachedLatLon[lat="+lat()+",lon="+lon()+"]"; 50 66 } 51 52 // Only for Node.get3892DebugInfo()53 public Projection getProjection() {54 return proj;55 }56 67 } -
trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java
r8345 r8357 112 112 public WmsCache(String url, int tileSize) { 113 113 File globalCacheDir = new File(cacheDirPath()); 114 globalCacheDir.mkdirs(); 114 if (!globalCacheDir.mkdirs()) { 115 Main.warn("Unable to create global cache directory: "+globalCacheDir.getAbsolutePath()); 116 } 115 117 cacheDir = new File(globalCacheDir, getCacheDirectory(url)); 116 118 cacheDir.mkdirs(); … … 230 232 if (files != null) { 231 233 for (File file: files) { 232 if (!referencedFiles.contains(file.getName())) { 233 file.delete();234 if (!referencedFiles.contains(file.getName()) && !file.delete()) { 235 Main.warn("Unable to delete file: "+file.getAbsolutePath()); 234 236 } 235 237 } … … 530 532 } 531 533 532 imageFile.getParentFile().mkdirs(); 534 if (!imageFile.getParentFile().mkdirs()) { 535 Main.warn("Unable to create parent directory: "+imageFile.getParentFile().getAbsolutePath()); 536 } 533 537 534 538 if (img != null) { … … 555 559 } 556 560 totalFileSize -= size; 557 file.delete(); 561 if (!file.delete()) { 562 Main.warn("Unable to delete file: "+file.getAbsolutePath()); 563 } 558 564 it.remove(); 559 565 }
Note:
See TracChangeset
for help on using the changeset viewer.