langtools/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java
changeset 22163 3651128c74eb
parent 20241 1e178dbe29c1
child 24067 76e7b6bbbd85
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
    99     /**
    99     /**
   100      * Acquire the port file. Synchronized since several threads inside an smart javac wrapper client acquires the same port file at the same time.
   100      * Acquire the port file. Synchronized since several threads inside an smart javac wrapper client acquires the same port file at the same time.
   101      */
   101      */
   102     private static synchronized PortFile getPortFile(String filename) throws FileNotFoundException {
   102     private static synchronized PortFile getPortFile(String filename) throws FileNotFoundException {
   103         if (allPortFiles == null) {
   103         if (allPortFiles == null) {
   104             allPortFiles = new HashMap<String, PortFile>();
   104             allPortFiles = new HashMap<>();
   105         }
   105         }
   106         PortFile pf = allPortFiles.get(filename);
   106         PortFile pf = allPortFiles.get(filename);
   107         if (pf == null) {
   107         if (pf == null) {
   108             pf = new PortFile(filename);
   108             pf = new PortFile(filename);
   109             allPortFiles.put(filename, pf);
   109             allPortFiles.put(filename, pf);
   369             sjavac = sjavac.replaceAll("%20", " ");
   369             sjavac = sjavac.replaceAll("%20", " ");
   370             sjavac = sjavac.replaceAll("%2C", ",");
   370             sjavac = sjavac.replaceAll("%2C", ",");
   371             // If the java/sh/cmd launcher fails the failure will be captured by stdouterr because of the redirection here.
   371             // If the java/sh/cmd launcher fails the failure will be captured by stdouterr because of the redirection here.
   372             String[] cmd = {"/bin/sh", "-c", sjavac + " >> " + stdouterrfile + " 2>&1"};
   372             String[] cmd = {"/bin/sh", "-c", sjavac + " >> " + stdouterrfile + " 2>&1"};
   373             if (!(new File("/bin/sh")).canExecute()) {
   373             if (!(new File("/bin/sh")).canExecute()) {
   374                 ArrayList<String> wincmd = new ArrayList<String>();
   374                 ArrayList<String> wincmd = new ArrayList<>();
   375                 wincmd.add("cmd");
   375                 wincmd.add("cmd");
   376                 wincmd.add("/c");
   376                 wincmd.add("/c");
   377                 wincmd.add("start");
   377                 wincmd.add("start");
   378                 wincmd.add("cmd");
   378                 wincmd.add("cmd");
   379                 wincmd.add("/c");
   379                 wincmd.add("/c");
   565                 if (l.equals(PROTOCOL_PACKAGE_DEPENDENCIES)) {
   565                 if (l.equals(PROTOCOL_PACKAGE_DEPENDENCIES)) {
   566                     break;
   566                     break;
   567                 }
   567                 }
   568                 if (l.length() > 1 && l.charAt(0) == '+') {
   568                 if (l.length() > 1 && l.charAt(0) == '+') {
   569                     String pkg = l.substring(1);
   569                     String pkg = l.substring(1);
   570                     lastUriSet = new HashSet<URI>();
   570                     lastUriSet = new HashSet<>();
   571                     packageArtifacts.put(pkg, lastUriSet);
   571                     packageArtifacts.put(pkg, lastUriSet);
   572                 } else if (l.length() > 1 && lastUriSet != null) {
   572                 } else if (l.length() > 1 && lastUriSet != null) {
   573                     lastUriSet.add(new URI(l.substring(1)));
   573                     lastUriSet.add(new URI(l.substring(1)));
   574                 }
   574                 }
   575             }
   575             }
   583                 if (l.equals(PROTOCOL_PACKAGE_PUBLIC_APIS)) {
   583                 if (l.equals(PROTOCOL_PACKAGE_PUBLIC_APIS)) {
   584                     break;
   584                     break;
   585                 }
   585                 }
   586                 if (l.length() > 1 && l.charAt(0) == '+') {
   586                 if (l.length() > 1 && l.charAt(0) == '+') {
   587                     String pkg = l.substring(1);
   587                     String pkg = l.substring(1);
   588                     lastPackageSet = new HashSet<String>();
   588                     lastPackageSet = new HashSet<>();
   589                     packageDependencies.put(pkg, lastPackageSet);
   589                     packageDependencies.put(pkg, lastPackageSet);
   590                 } else if (l.length() > 1 && lastPackageSet != null) {
   590                 } else if (l.length() > 1 && lastPackageSet != null) {
   591                     lastPackageSet.add(l.substring(1));
   591                     lastPackageSet.add(l.substring(1));
   592                 }
   592                 }
   593             }
   593             }
   594             // Load package pubapis
   594             // Load package pubapis
   595             Map<String, StringBuffer> tmp = new HashMap<String, StringBuffer>();
   595             Map<String, StringBuffer> tmp = new HashMap<>();
   596             StringBuffer lastPublicApi = null;
   596             StringBuffer lastPublicApi = null;
   597             for (;;) {
   597             for (;;) {
   598                 String l = in.readLine();
   598                 String l = in.readLine();
   599                 if (l == null) {
   599                 if (l == null) {
   600                     return ERROR_FATAL;
   600                     return ERROR_FATAL;