You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/06/30 16:52:40 UTC
svn commit: r789771 - in /jackrabbit/branches/1.x: ./
jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java
Author: jukka
Date: Tue Jun 30 14:52:40 2009
New Revision: 789771
URL: http://svn.apache.org/viewvc?rev=789771&view=rev
Log:
1.x: Merged revision 779076 (JCR-2123)
Modified:
jackrabbit/branches/1.x/ (props changed)
jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java
Propchange: jackrabbit/branches/1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 30 14:52:40 2009
@@ -1 +1 @@
-/jackrabbit/trunk:770143-773197,773483,773525-773554,773584,773588,773828,773835-775756,775833,775836,775840,775868,775981,775986,776036,776256,776310,776313,776321-776322,776332,776356-776357,776362,776373,776650-776693,776737,776757,776776-776777,777024,777029,777034,777478,777509,777541,777548,777936,778445,778613,778616,778621,778645,778720,778802,779032,779040
+/jackrabbit/trunk:770143-773197,773483,773525-773554,773584,773588,773828,773835-775756,775833,775836,775840,775868,775981,775986,776036,776256,776310,776313,776321-776322,776332,776356-776357,776362,776373,776650-776693,776737,776757,776776-776777,777024,777029,777034,777478,777509,777541,777548,777936,778445,778613,778616,778621,778645,778720,778802,779032,779040,779068-779071,779074,779076
Modified: jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java?rev=789771&r1=789770&r2=789771&view=diff
==============================================================================
--- jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java (original)
+++ jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java Tue Jun 30 14:52:40 2009
@@ -46,10 +46,10 @@
public Name create(String namespaceURI, String localName) throws IllegalArgumentException {
// NOTE: an empty localName and/or URI is valid (e.g. the root node name)
if (namespaceURI == null) {
- throw new IllegalArgumentException("invalid namespaceURI specified");
+ throw new IllegalArgumentException("No namespaceURI specified");
}
if (localName == null) {
- throw new IllegalArgumentException("invalid localName specified");
+ throw new IllegalArgumentException("No localName specified");
}
return (Name) cache.get(new NameImpl(namespaceURI, localName));
}
@@ -59,17 +59,20 @@
*/
public Name create(String nameString) throws IllegalArgumentException {
if (nameString == null || "".equals(nameString)) {
- throw new IllegalArgumentException("Invalid Name literal.");
+ throw new IllegalArgumentException("No Name literal specified");
}
if (nameString.charAt(0) != '{') {
- throw new IllegalArgumentException("Invalid Name literal");
+ throw new IllegalArgumentException(
+ "Invalid Name literal: " + nameString);
}
int i = nameString.indexOf('}');
if (i == -1) {
- throw new IllegalArgumentException("Invalid Name literal");
+ throw new IllegalArgumentException(
+ "Invalid Name literal: " + nameString);
}
if (i == nameString.length() - 1) {
- throw new IllegalArgumentException("Invalid Name literal");
+ throw new IllegalArgumentException(
+ "Invalid Name literal: " + nameString);
}
return (Name) cache.get(new NameImpl(
nameString.substring(1, i), nameString.substring(i + 1)));
@@ -228,4 +231,5 @@
return new NameImpl(namespaceURI, localName);
}
}
-}
\ No newline at end of file
+
+}
Modified: jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java?rev=789771&r1=789770&r2=789771&view=diff
==============================================================================
--- jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java (original)
+++ jackrabbit/branches/1.x/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java Tue Jun 30 14:52:40 2009
@@ -68,7 +68,8 @@
*/
public Path create(Path parent, Path relPath, boolean normalize) throws IllegalArgumentException, RepositoryException {
if (relPath.isAbsolute()) {
- throw new IllegalArgumentException("relPath is not a relative path");
+ throw new IllegalArgumentException(
+ "relPath is not a relative path: " + relPath);
}
List l = new ArrayList();
l.addAll(Arrays.asList(parent.getElements()));
@@ -130,7 +131,8 @@
*/
public Path create(Name name, int index) throws IllegalArgumentException {
if (index < Path.INDEX_UNDEFINED) {
- throw new IllegalArgumentException("Index must not be negative: " + index);
+ throw new IllegalArgumentException(
+ "Index must not be negative: " + name + "[" + index + "]");
}
Path.Element elem = createElement(name, index);
return new Builder(new Path.Element[]{elem}).getPath();
@@ -148,7 +150,7 @@
*/
public Path create(String pathString) throws IllegalArgumentException {
if (pathString == null || "".equals(pathString)) {
- throw new IllegalArgumentException("Invalid Path literal");
+ throw new IllegalArgumentException("No Path literal specified");
}
// split into path elements
int lastPos = 0;
@@ -191,14 +193,16 @@
*/
public Path.Element createElement(Name name, int index) throws IllegalArgumentException {
if (index < Path.INDEX_UNDEFINED) {
- throw new IllegalArgumentException("The index may not be negative.");
+ throw new IllegalArgumentException(
+ "The index may not be negative: " + name + "[" + index + "]");
} else if (name == null) {
throw new IllegalArgumentException("The name must not be null");
} else if (name.equals(PARENT_NAME)
|| name.equals(CURRENT_NAME)
|| name.equals(ROOT_NAME)) {
throw new IllegalArgumentException(
- "Special path elements (root, '.' and '..') can not have an explicit index.");
+ "Special path elements (root, '.' and '..') can not have an explicit index: "
+ + name + "[" + index + "]");
} else {
return new Element(name, index);
}
@@ -371,7 +375,8 @@
return this;
}
if (!isAbsolute()) {
- throw new RepositoryException("Only an absolute path can be canonicalized.");
+ throw new RepositoryException(
+ "Only an absolute path can be canonicalized: " + this);
}
return getNormalizedPath();
}
@@ -386,7 +391,9 @@
// make sure both paths are absolute
if (!isAbsolute() || !other.isAbsolute()) {
- throw new RepositoryException("Cannot compute relative path from relative paths");
+ throw new RepositoryException(
+ "Cannot compute relative path from relative paths: "
+ + this + " vs. " + other);
}
// make sure we're comparing canonical paths
@@ -432,7 +439,8 @@
*/
public Path getAncestor(int degree) throws IllegalArgumentException, PathNotFoundException {
if (degree < 0) {
- throw new IllegalArgumentException("degree must be >= 0");
+ throw new IllegalArgumentException(
+ "degree must be >= 0: " + this);
} else if (degree == 0) {
return this.getNormalizedPath();
}
@@ -441,7 +449,8 @@
Path.Element[] normElems = getNormalizedPath().getElements();
int length = normElems.length - degree;
if (length < 1) {
- throw new PathNotFoundException("no such ancestor path of degree " + degree);
+ throw new PathNotFoundException(
+ "no ancestor at degree " + degree + ": " + this);
}
Path.Element[] ancestorElements = new Element[length];
System.arraycopy(normElems, 0, ancestorElements, 0, length);
@@ -495,7 +504,9 @@
throw new IllegalArgumentException("null argument");
}
if (isAbsolute() != other.isAbsolute()) {
- throw new IllegalArgumentException("Cannot compare a relative path with an absolute path");
+ throw new IllegalArgumentException(
+ "Cannot compare a relative path with an absolute path: "
+ + this + " vs. " + other);
}
if (getDepth() != other.getDepth()) {
@@ -524,7 +535,9 @@
}
// make sure both paths are either absolute or relative
if (isAbsolute() != other.isAbsolute()) {
- throw new IllegalArgumentException("Cannot compare a relative path with an absolute path");
+ throw new IllegalArgumentException(
+ "Cannot compare a relative path with an absolute path: "
+ + this + " vs. " + other);
}
int delta = other.getDepth() - getDepth();
@@ -552,7 +565,9 @@
throw new IllegalArgumentException();
}
if (!isNormalized()) {
- throw new RepositoryException("Cannot extract sub-Path from a non-normalized Path.");
+ throw new RepositoryException(
+ "Cannot extract sub-Path from a non-normalized Path: "
+ + this);
}
Path.Element[] dest = new Path.Element[to-from];
System.arraycopy(elements, from, dest, 0, dest.length);
@@ -965,4 +980,5 @@
return new PathImpl(elements, isNormalized);
}
}
+
}