langtools/src/share/classes/com/sun/tools/sjavac/CleanProperties.java
changeset 22163 3651128c74eb
parent 15368 2577ddb7e710
child 22449 1fd6d4bec7dd
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
    95             Log.error("Error reading file "+src.getPath());
    95             Log.error("Error reading file "+src.getPath());
    96             return false;
    96             return false;
    97         }
    97         }
    98 
    98 
    99         // Sort the properties in increasing key order.
    99         // Sort the properties in increasing key order.
   100         List<String> sortedKeys = new ArrayList<String>();
   100         List<String> sortedKeys = new ArrayList<>();
   101         for (Object key : p.keySet()) {
   101         for (Object key : p.keySet()) {
   102             sortedKeys.add((String)key);
   102             sortedKeys.add((String)key);
   103         }
   103         }
   104         Collections.sort(sortedKeys);
   104         Collections.sort(sortedKeys);
   105         Iterator<String> keys = sortedKeys.iterator();
       
   106 
   105 
   107         // Collect the properties into a string buffer.
   106         // Collect the properties into a string buffer.
   108         StringBuilder data = new StringBuilder();
   107         StringBuilder data = new StringBuilder();
   109         while (keys.hasNext()) {
   108         for (String key : sortedKeys) {
   110             String key = keys.next();
   109             data.append(CompileProperties.escape(key))
   111             data.append(CompileProperties.escape(key)+":"+CompileProperties.escape((String)p.get(key))+"\n");
   110                 .append(":")
       
   111                 .append(CompileProperties.escape((String) p.get(key)))
       
   112                 .append("\n");
   112         }
   113         }
   113 
   114 
   114         String destFilename = destRoot.getPath()+File.separator+pkgNameF+File.separator+src.getName();
   115         String destFilename = destRoot.getPath()+File.separator+pkgNameF+File.separator+src.getName();
   115         File dest = new File(destFilename);
   116         File dest = new File(destFilename);
   116 
   117 
   122             }
   123             }
   123         }
   124         }
   124 
   125 
   125         Set<URI> as = packageArtifacts.get(pkgName);
   126         Set<URI> as = packageArtifacts.get(pkgName);
   126         if (as == null) {
   127         if (as == null) {
   127             as = new HashSet<URI>();
   128             as = new HashSet<>();
   128             packageArtifacts.put(pkgName, as);
   129             packageArtifacts.put(pkgName, as);
   129         }
   130         }
   130         as.add(dest.toURI());
   131         as.add(dest.toURI());
   131 
   132 
   132         if (dest.exists() && dest.lastModified() > src.lastModified()) {
   133         if (dest.exists() && dest.lastModified() > src.lastModified()) {