< prev index next >
src/java.base/share/classes/jdk/internal/jrtfs/AbstractJrtPath.java
Print this page
@@ -121,11 +121,12 @@
@Override
public final AbstractJrtPath getName(int index) {
initOffsets();
if (index < 0 || index >= offsets.length) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("index: " +
+ index + ", offsets length: " + offsets.length);
}
int begin = offsets[index];
int len;
if (index == (offsets.length - 1)) {
len = path.length - begin;
@@ -143,11 +144,12 @@
initOffsets();
if (beginIndex < 0
|| beginIndex >= offsets.length
|| endIndex > offsets.length
|| beginIndex >= endIndex) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("beginIndex: " + beginIndex +
+ ", endIndex: " + endIndex + ", offsets length: " + offsets.length);
}
// starting offset and length
int begin = offsets[beginIndex];
int len;
@@ -239,11 +241,11 @@
final AbstractJrtPath o = checkPath(other);
if (o.equals(this)) {
return newJrtPath(new byte[0], true);
}
if (/* this.getFileSystem() != o.getFileSystem() || */this.isAbsolute() != o.isAbsolute()) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("this.isAbsolute(): " + this.isAbsolute());
}
int mc = this.getNameCount();
int oc = o.getNameCount();
int n = Math.min(mc, oc);
int i = 0;
@@ -309,11 +311,11 @@
}
@Override
public final Path resolveSibling(Path other) {
if (other == null) {
- throw new NullPointerException();
+ throw new NullPointerException("other");
}
Path parent = getParent();
return (parent == null) ? other : parent.resolve(other);
}
@@ -394,14 +396,15 @@
return newJrtPath(res, true);
}
private AbstractJrtPath checkPath(Path path) {
if (path == null) {
- throw new NullPointerException();
+ throw new NullPointerException("path");
}
if (!(path instanceof AbstractJrtPath)) {
- throw new ProviderMismatchException();
+ throw new ProviderMismatchException("path class:" +
+ path.getClass().getName());
}
return (AbstractJrtPath) path;
}
// create offset list if not already created
@@ -473,11 +476,11 @@
if (c == (byte) '/' && prevC == '/') {
return normalize(path, i - 1);
}
if (c == '\u0000') {
throw new InvalidPathException(JrtFileSystem.getString(path),
- "Path: nul character not allowed");
+ "Path: null character not allowed");
}
prevC = c;
}
if (path.length > 1 && path[path.length - 1] == '/') {
< prev index next >