jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java
changeset 46901 f63587417ae6
parent 43193 a8e490921d20
equal deleted inserted replaced
46900:e92e67ed12b4 46901:f63587417ae6
   308         return (parent == null) ? other : parent.resolve(other);
   308         return (parent == null) ? other : parent.resolve(other);
   309     }
   309     }
   310 
   310 
   311     @Override
   311     @Override
   312     public boolean startsWith(Path other) {
   312     public boolean startsWith(Path other) {
   313         final ZipPath o = checkPath(other);
   313         Objects.requireNonNull(other, "other");
       
   314         if (!(other instanceof ZipPath))
       
   315             return false;
       
   316         final ZipPath o = (ZipPath)other;
   314         if (o.isAbsolute() != this.isAbsolute() ||
   317         if (o.isAbsolute() != this.isAbsolute() ||
   315             o.path.length > this.path.length)
   318             o.path.length > this.path.length)
   316             return false;
   319             return false;
   317         int olast = o.path.length;
   320         int olast = o.path.length;
   318         for (int i = 0; i < olast; i++) {
   321         for (int i = 0; i < olast; i++) {
   325                this.path[olast + 1] == '/';
   328                this.path[olast + 1] == '/';
   326     }
   329     }
   327 
   330 
   328     @Override
   331     @Override
   329     public boolean endsWith(Path other) {
   332     public boolean endsWith(Path other) {
   330         final ZipPath o = checkPath(other);
   333         Objects.requireNonNull(other, "other");
       
   334         if (!(other instanceof ZipPath))
       
   335             return false;
       
   336         final ZipPath o = (ZipPath)other;
   331         int olast = o.path.length - 1;
   337         int olast = o.path.length - 1;
   332         if (olast > 0 && o.path[olast] == '/')
   338         if (olast > 0 && o.path[olast] == '/')
   333             olast--;
   339             olast--;
   334         int last = this.path.length - 1;
   340         int last = this.path.length - 1;
   335         if (last > 0 && this.path[last] == '/')
   341         if (last > 0 && this.path[last] == '/')