~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to java/io/File.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
396
396
   * This method initializes a new <code>File</code> object to represent
397
397
   * a file corresponding to the specified <code>file:</code> protocol URI.
398
398
   *
399
 
   * @param uri The uri.
 
399
   * @param uri The URI
 
400
   * @throws IllegalArgumentException if the URI is not hierarchical
400
401
   */
401
402
  public File(URI uri)
402
403
  {
406
407
    if (!uri.getScheme().equals("file"))
407
408
        throw new IllegalArgumentException("invalid uri protocol");
408
409
 
409
 
    path = normalizePath(uri.getPath());
 
410
    String name = uri.getPath();
 
411
    if (name == null)
 
412
      throw new IllegalArgumentException("URI \"" + uri
 
413
                     + "\" is not hierarchical");
 
414
    path = normalizePath(name);
410
415
  }
411
416
 
412
417
  /**
457
462
        else
458
463
          return drvDir;
459
464
      }
 
465
    else if (path.equals(""))
 
466
      return System.getProperty ("user.dir");
460
467
    else
461
468
      return System.getProperty ("user.dir") + separatorChar + path;
462
469
  }
543
550
  {
544
551
    String prefix = null;
545
552
    int nameSeqIndex = 0;
 
553
    
 
554
    if (path.equals(""))
 
555
      return null;
546
556
 
547
557
    // The "prefix", if present, is the leading "/" on UNIX and 
548
558
    // either the drive specifier (e.g. "C:") or the leading "\\"
954
964
  public URI toURI()
955
965
  {
956
966
    String abspath = getAbsolutePath();
957
 
 
958
 
    if (isDirectory())
 
967
       
 
968
    if (isDirectory() || path.equals(""))
959
969
      abspath = abspath + separatorChar;
960
970
 
961
971
    if (separatorChar == '\\')