< prev index next >

src/com/sun/javatest/TestDescription.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


  74 
  75                 // cache root->rootDir map to avoid making extra files
  76                 cachedRoot = root;
  77                 cachedRootDir = rootDir;
  78             }
  79         }
  80 
  81         String fp = file.getPath();
  82         String rootRelativeFile;
  83         if (file.isAbsolute()) {
  84             String rp = rootDir;
  85             if (! (fp.startsWith(rp) && fp.charAt(rp.length()) == File.separatorChar))
  86                 throw new IllegalArgumentException("file must be relative to root: " + file);
  87             rootRelativeFile = fp.substring(rp.length() + 1);
  88         }
  89         else
  90             rootRelativeFile = fp;
  91         rootRelativePath = rootRelativeFile.replace(File.separatorChar, '/');
  92 
  93         Vector<String> v = new Vector<>(0, params.size() * 2);
  94         for (Map.Entry entry : params.entrySet()) {
  95             insert(v, (String) entry.getKey(), (String) entry.getValue());
  96         }
  97         fields = new String[v.size()];
  98         v.copyInto(fields);
  99     }
 100 
 101     /**
 102      * Internal constructor used by load()
 103      */
 104     private TestDescription(String root, String file, String[] params) {
 105         rootDir = root;
 106         // skip over the root part of the filename.
 107         char sep = file.charAt(root.length());
 108         rootRelativePath = file.substring(root.length() + 1).replace(sep, '/');
 109 
 110         Vector<String> v = new Vector<>(0, params.length);
 111         for (int i = 0; i < params.length; i += 2) {
 112             String key = params[i];
 113             if (!(key.startsWith("$") || key.equals("testsuite") ||  key.equals("file"))) {
 114                 // don't keep synthetic values from save;




  74 
  75                 // cache root->rootDir map to avoid making extra files
  76                 cachedRoot = root;
  77                 cachedRootDir = rootDir;
  78             }
  79         }
  80 
  81         String fp = file.getPath();
  82         String rootRelativeFile;
  83         if (file.isAbsolute()) {
  84             String rp = rootDir;
  85             if (! (fp.startsWith(rp) && fp.charAt(rp.length()) == File.separatorChar))
  86                 throw new IllegalArgumentException("file must be relative to root: " + file);
  87             rootRelativeFile = fp.substring(rp.length() + 1);
  88         }
  89         else
  90             rootRelativeFile = fp;
  91         rootRelativePath = rootRelativeFile.replace(File.separatorChar, '/');
  92 
  93         Vector<String> v = new Vector<>(0, params.size() * 2);
  94         for (Map.Entry<?, ?> entry : params.entrySet()) {
  95             insert(v, (String) entry.getKey(), (String) entry.getValue());
  96         }
  97         fields = new String[v.size()];
  98         v.copyInto(fields);
  99     }
 100 
 101     /**
 102      * Internal constructor used by load()
 103      */
 104     private TestDescription(String root, String file, String[] params) {
 105         rootDir = root;
 106         // skip over the root part of the filename.
 107         char sep = file.charAt(root.length());
 108         rootRelativePath = file.substring(root.length() + 1).replace(sep, '/');
 109 
 110         Vector<String> v = new Vector<>(0, params.length);
 111         for (int i = 0; i < params.length; i += 2) {
 112             String key = params[i];
 113             if (!(key.startsWith("$") || key.equals("testsuite") ||  key.equals("file"))) {
 114                 // don't keep synthetic values from save;


< prev index next >