Return-Path: X-Original-To: apmail-jackrabbit-commits-archive@www.apache.org Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 716977376 for ; Fri, 16 Sep 2011 21:52:24 +0000 (UTC) Received: (qmail 89590 invoked by uid 500); 16 Sep 2011 21:52:24 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 89563 invoked by uid 500); 16 Sep 2011 21:52:24 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 89553 invoked by uid 99); 16 Sep 2011 21:52:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Sep 2011 21:52:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Sep 2011 21:52:12 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 674ED238897D; Fri, 16 Sep 2011 21:51:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1171815 [2/3] - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ jackrabbit-jcr2spi/src/main/java/org/apache/jac... Date: Fri, 16 Sep 2011 21:51:46 -0000 To: commits@jackrabbit.apache.org From: mduerig@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20110916215150.674ED238897D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/SpiLoggerFactory.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/SpiLoggerFactory.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/SpiLoggerFactory.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/SpiLoggerFactory.java Fri Sep 16 21:51:43 2011 @@ -24,6 +24,8 @@ import org.apache.jackrabbit.spi.PathFac import org.apache.jackrabbit.spi.QValueFactory; import org.apache.jackrabbit.spi.RepositoryService; import org.apache.jackrabbit.spi.SessionInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.Credentials; import javax.jcr.RepositoryException; @@ -65,6 +67,7 @@ import javax.jcr.RepositoryException; * level enabled. */ public final class SpiLoggerFactory { + private static final Logger log = LoggerFactory.getLogger(SpiLoggerFactory.class); private SpiLoggerFactory() { } @@ -93,10 +96,14 @@ public final class SpiLoggerFactory { */ public static RepositoryService create(RepositoryService service, LogWriterProvider logWriterProvider) { if (service == null) { - throw new IllegalArgumentException("Service must not be null"); + IllegalArgumentException e = new IllegalArgumentException("Service must not be null"); + log.error(e.getMessage(), e); + throw e; } if (logWriterProvider == null) { - throw new IllegalArgumentException("LogWriterProvider must not be null"); + IllegalArgumentException e = new IllegalArgumentException("LogWriterProvider must not be null"); + log.error(e.getMessage(), e); + throw e; } LogWriter logWriter = logWriterProvider.getLogWriter(service); @@ -119,10 +126,14 @@ public final class SpiLoggerFactory { */ public static NameFactory create(NameFactory nameFactory, LogWriterProvider logWriterProvider) { if (nameFactory == null) { - throw new IllegalArgumentException("NameFactory must not be null"); + IllegalArgumentException e = new IllegalArgumentException("NameFactory must not be null"); + log.error(e.getMessage(), e); + throw e; } if (logWriterProvider == null) { - throw new IllegalArgumentException("LogWriterProvider must not be null"); + IllegalArgumentException e = new IllegalArgumentException("LogWriterProvider must not be null"); + log.error(e.getMessage(), e); + throw e; } LogWriter logWriter = logWriterProvider.getLogWriter(nameFactory); @@ -145,10 +156,14 @@ public final class SpiLoggerFactory { */ public static PathFactory create(PathFactory pathFactory, LogWriterProvider logWriterProvider) { if (pathFactory == null) { - throw new IllegalArgumentException("PathFactory must not be null"); + IllegalArgumentException e = new IllegalArgumentException("PathFactory must not be null"); + log.error(e.getMessage(), e); + throw e; } if (logWriterProvider == null) { - throw new IllegalArgumentException("LogWriterProvider must not be null"); + IllegalArgumentException e = new IllegalArgumentException("LogWriterProvider must not be null"); + log.error(e.getMessage(), e); + throw e; } LogWriter logWriter = logWriterProvider.getLogWriter(pathFactory); @@ -171,10 +186,14 @@ public final class SpiLoggerFactory { */ public static IdFactory create(IdFactory idFactory, LogWriterProvider logWriterProvider) { if (idFactory == null) { - throw new IllegalArgumentException("IdFactory must not be null"); + IllegalArgumentException e = new IllegalArgumentException("IdFactory must not be null"); + log.error(e.getMessage(), e); + throw e; } if (logWriterProvider == null) { - throw new IllegalArgumentException("LogWriterProvider must not be null"); + IllegalArgumentException e = new IllegalArgumentException("LogWriterProvider must not be null"); + log.error(e.getMessage(), e); + throw e; } LogWriter logWriter = logWriterProvider.getLogWriter(idFactory); @@ -197,10 +216,14 @@ public final class SpiLoggerFactory { */ public static QValueFactory create(QValueFactory qValueFactory, LogWriterProvider logWriterProvider) { if (qValueFactory == null) { - throw new IllegalArgumentException("QValueFactory must not be null"); + IllegalArgumentException e = new IllegalArgumentException("QValueFactory must not be null"); + log.error(e.getMessage(), e); + throw e; } if (logWriterProvider == null) { - throw new IllegalArgumentException("LogWriterProvider must not be null"); + IllegalArgumentException e = new IllegalArgumentException("LogWriterProvider must not be null"); + log.error(e.getMessage(), e); + throw e; } LogWriter logWriter = logWriterProvider.getLogWriter(qValueFactory); @@ -223,10 +246,14 @@ public final class SpiLoggerFactory { */ public static SessionInfo create(SessionInfo sessionInfo, LogWriterProvider logWriterProvider) { if (sessionInfo == null) { - throw new IllegalArgumentException("SessionInfo must not be null"); + IllegalArgumentException e = new IllegalArgumentException("SessionInfo must not be null"); + log.error(e.getMessage(), e); + throw e; } if (logWriterProvider == null) { - throw new IllegalArgumentException("LogWriterProvider must not be null"); + IllegalArgumentException e = new IllegalArgumentException("LogWriterProvider must not be null"); + log.error(e.getMessage(), e); + throw e; } LogWriter logWriter = logWriterProvider.getLogWriter(sessionInfo); @@ -249,10 +276,14 @@ public final class SpiLoggerFactory { */ public static Batch create(Batch batch, LogWriterProvider logWriterProvider) { if (batch == null) { - throw new IllegalArgumentException("Batch must not be null"); + IllegalArgumentException e = new IllegalArgumentException("Batch must not be null"); + log.error(e.getMessage(), e); + throw e; } if (logWriterProvider == null) { - throw new IllegalArgumentException("LogWriterProvider must not be null"); + IllegalArgumentException e = new IllegalArgumentException("LogWriterProvider must not be null"); + log.error(e.getMessage(), e); + throw e; } LogWriter logWriter = logWriterProvider.getLogWriter(batch); Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/AbstractPath.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/AbstractPath.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/AbstractPath.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/AbstractPath.java Fri Sep 16 21:51:43 2011 @@ -17,6 +17,8 @@ package org.apache.jackrabbit.spi.commons.name; import org.apache.jackrabbit.spi.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; @@ -24,6 +26,7 @@ import javax.jcr.RepositoryException; * Abstract base class for paths. */ abstract class AbstractPath implements Path, Path.Element { + private static final Logger log = LoggerFactory.getLogger(AbstractPath.class); /** Serial version UID */ private static final long serialVersionUID = 3018771833963770499L; @@ -149,8 +152,9 @@ abstract class AbstractPath implements P return NamePath.create(this, element.getName(), element.getIndex()); } else if (element.denotesParent()) { if (isAbsolute() && getDepth() == 0) { - throw new IllegalArgumentException( - "An absolute paths with negative depth is not allowed"); + IllegalArgumentException e = new IllegalArgumentException("An absolute paths with negative depth is not allowed"); + log.error(e.getMessage(), e); + throw e; } return new ParentPath(this); } else if (element.denotesCurrent()) { @@ -160,8 +164,9 @@ abstract class AbstractPath implements P } else if (element.denotesIdentifier()) { return new IdentifierPath(element.getIdentifier()); } else { - throw new IllegalArgumentException( - "Unknown path element type: " + element); + IllegalArgumentException e = new IllegalArgumentException("Unknown path element type: " + element); + log.error(e.getMessage(), e); + throw e; } } @@ -180,8 +185,9 @@ abstract class AbstractPath implements P } else if (relative.denotesName()) { return NamePath.create(this, relative.getName(), relative.getIndex()); } else { - throw new IllegalArgumentException( - "Unknown path type: " + relative); + IllegalArgumentException e = new IllegalArgumentException("Unknown path type: " + relative); + log.error(e.getMessage(), e); + throw e; } } @@ -258,13 +264,13 @@ abstract class AbstractPath implements P * @throws RepositoryException if an error occurs */ @Override - public final boolean isEquivalentTo(Path other) - throws IllegalArgumentException, RepositoryException { + public final boolean isEquivalentTo(Path other) throws IllegalArgumentException, RepositoryException { if (other != null) { return getNormalizedPath().equals(other.getNormalizedPath()); } else { - throw new IllegalArgumentException( - this + ".isEquivalentTo(" + other + ')'); + IllegalArgumentException e = new IllegalArgumentException(this + ".isEquivalentTo(" + other + ')' + ')'); + log.error(e.getMessage(), e); + throw e; } } @@ -282,16 +288,16 @@ abstract class AbstractPath implements P * @throws RepositoryException if an error occurs */ @Override - public final boolean isAncestorOf(Path other) - throws IllegalArgumentException, RepositoryException { + public final boolean isAncestorOf(Path other) throws IllegalArgumentException, RepositoryException { if (other != null && isAbsolute() == other.isAbsolute() && isIdentifierBased() == other.isIdentifierBased()) { int d = other.getDepth() - getDepth(); return d > 0 && isEquivalentTo(other.getAncestor(d)); } else { - throw new IllegalArgumentException( - this + ".isAncestorOf(" + other + ')'); + IllegalArgumentException e = new IllegalArgumentException(this + ".isAncestorOf(" + other + ')'); + log.error(e.getMessage(), e); + throw e; } } @@ -309,16 +315,16 @@ abstract class AbstractPath implements P * @throws RepositoryException if an error occurs */ @Override - public final boolean isDescendantOf(Path other) - throws IllegalArgumentException, RepositoryException { + public final boolean isDescendantOf(Path other) throws IllegalArgumentException, RepositoryException { if (other != null && isAbsolute() == other.isAbsolute() && isIdentifierBased() == other.isIdentifierBased()) { int d = getDepth() - other.getDepth(); return d > 0 && getAncestor(d).isEquivalentTo(other); } else { - throw new IllegalArgumentException( - this + ".isDescendantOf(" + other + ')'); + IllegalArgumentException e = new IllegalArgumentException(this + ".isDescendantOf(" + other + ')'); + log.error(e.getMessage(), e); + throw e; } } Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/IdentifierPath.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/IdentifierPath.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/IdentifierPath.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/IdentifierPath.java Fri Sep 16 21:51:43 2011 @@ -18,10 +18,13 @@ package org.apache.jackrabbit.spi.common import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; final class IdentifierPath extends AbstractPath { + private static final Logger log = LoggerFactory.getLogger(IdentifierPath.class); /** Serial version UID */ private static final long serialVersionUID = 1602959709588338642L; @@ -30,7 +33,9 @@ final class IdentifierPath extends Abstr public IdentifierPath(String identifier) { if (identifier == null) { - throw new IllegalArgumentException("Identifier must not be null"); + IllegalArgumentException e = new IllegalArgumentException("Identifier must not be null"); + log.error(e.getMessage(), e); + throw e; } this.identifier = identifier; } @@ -118,8 +123,9 @@ final class IdentifierPath extends Abstr public Path getAncestor(int degree) throws IllegalArgumentException, RepositoryException { if (degree < 0) { - throw new IllegalArgumentException( - this + ".getAncestor(" + degree + ')'); + IllegalArgumentException e = new IllegalArgumentException(this + ".getAncestor(" + degree + ')'); + log.error(e.getMessage(), e); + throw e; } else if (degree > 0) { throw new RepositoryException( "Cannot construct ancestor path from an identifier"); @@ -148,8 +154,9 @@ final class IdentifierPath extends Abstr if (from == 0 && to == 1) { return this; } else { - throw new IllegalArgumentException( - this + ".subPath(" + from + ", " + to + ')'); + IllegalArgumentException e = new IllegalArgumentException(this + ".subPath(" + from + ", " + to + ')'); + log.error(e.getMessage(), e); + throw e; } } Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/MatchResult.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/MatchResult.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/MatchResult.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/MatchResult.java Fri Sep 16 21:51:43 2011 @@ -17,12 +17,16 @@ package org.apache.jackrabbit.spi.commons.name; import org.apache.jackrabbit.spi.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A MatchResult instance represents the result of matching a {@link Pattern} against * a {@link Path}. */ public class MatchResult { + private static final Logger log = LoggerFactory.getLogger(MatchResult.class); + private final Path path; private final int pathLength; private int matchPos; @@ -34,7 +38,9 @@ public class MatchResult { MatchResult(Path path, int pos, int length) { if (!path.isNormalized()) { - throw new IllegalArgumentException("Path not normalized"); + IllegalArgumentException e = new IllegalArgumentException("Path not normalized"); + log.error(e.getMessage(), e); + throw e; } this.path = path; matchPos = pos; Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Matcher.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Matcher.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Matcher.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Matcher.java Fri Sep 16 21:51:43 2011 @@ -17,11 +17,14 @@ package org.apache.jackrabbit.spi.commons.name; import org.apache.jackrabbit.spi.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Utility class for matching {@link Pattern}s against {@link Path}es. */ public final class Matcher { + private static final Logger log = LoggerFactory.getLogger(Matcher.class); private Matcher() { // Don't instantiate @@ -74,7 +77,9 @@ public final class Matcher { public static MatchResult findMatch(Pattern pattern, Path input, int pos) { int length = input.getLength(); if (pos < 0 || pos >= length) { - throw new IllegalArgumentException("Index out of bounds"); + IllegalArgumentException e = new IllegalArgumentException("Index out of bounds"); + log.error(e.getMessage(), e); + throw e; } for (int k = pos; k < length; k++) { Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java Fri Sep 16 21:51:43 2011 @@ -16,8 +16,10 @@ */ package org.apache.jackrabbit.spi.commons.name; -import org.apache.jackrabbit.spi.NameFactory; import org.apache.jackrabbit.spi.Name; +import org.apache.jackrabbit.spi.NameFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast; @@ -25,6 +27,7 @@ import static org.apache.jackrabbit.spi. * {@code NameFactoryImpl}... */ public class NameFactoryImpl implements NameFactory { + private static final Logger log = LoggerFactory.getLogger(NameFactoryImpl.class); private static final NameFactory INSTANCE = new NameFactoryImpl(); @@ -50,10 +53,14 @@ public class NameFactoryImpl implements 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("No namespaceURI specified"); + IllegalArgumentException e = new IllegalArgumentException("No namespaceURI specified"); + log.error(e.getMessage(), e); + throw e; } if (localName == null) { - throw new IllegalArgumentException("No localName specified"); + IllegalArgumentException e = new IllegalArgumentException("No localName specified"); + log.error(e.getMessage(), e); + throw e; } return cache.get(new NameImpl(namespaceURI, localName)); } @@ -64,20 +71,25 @@ public class NameFactoryImpl implements @Override public Name create(String nameString) throws IllegalArgumentException { if (nameString == null || "".equals(nameString)) { - throw new IllegalArgumentException("No Name literal specified"); + IllegalArgumentException e = new IllegalArgumentException("No Name literal specified"); + log.error(e.getMessage(), e); + throw e; } if (nameString.charAt(0) != '{') { - throw new IllegalArgumentException( - "Invalid Name literal: " + nameString); + IllegalArgumentException e = new IllegalArgumentException("Invalid Name literal: " + nameString); + log.error(e.getMessage(), e); + throw e; } int i = nameString.indexOf('}'); if (i == -1) { - throw new IllegalArgumentException( - "Invalid Name literal: " + nameString); + IllegalArgumentException e = new IllegalArgumentException("Invalid Name literal: " + nameString); + log.error(e.getMessage(), e); + throw e; } if (i == nameString.length() - 1) { - throw new IllegalArgumentException( - "Invalid Name literal: " + nameString); + IllegalArgumentException e = new IllegalArgumentException("Invalid Name literal: " + nameString); + log.error(e.getMessage(), e); + throw e; } return cache.get(new NameImpl( nameString.substring(1, i), nameString.substring(i + 1))); Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NamePath.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NamePath.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NamePath.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NamePath.java Fri Sep 16 21:51:43 2011 @@ -18,10 +18,13 @@ package org.apache.jackrabbit.spi.common import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; class NamePath extends RelativePath { + private static final Logger log = LoggerFactory.getLogger(NamePath.class); /** Serial version UID */ private static final long serialVersionUID = -2887665244213430950L; @@ -40,7 +43,9 @@ class NamePath extends RelativePath { protected NamePath(Path parent, Name name) { super(parent, 1); if (name == null) { - throw new IllegalArgumentException("Name must not be null"); + IllegalArgumentException e = new IllegalArgumentException("Name must not be null"); + log.error(e.getMessage(), e); + throw e; } this.name = name; Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NamePathWithIndex.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NamePathWithIndex.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NamePathWithIndex.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NamePathWithIndex.java Fri Sep 16 21:51:43 2011 @@ -2,8 +2,11 @@ package org.apache.jackrabbit.spi.common import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; class NamePathWithIndex extends NamePath { + private static final Logger log = LoggerFactory.getLogger(NamePathWithIndex.class); /** * Optional index of the last path element. Set to @@ -15,7 +18,9 @@ class NamePathWithIndex extends NamePath public NamePathWithIndex(Path parent, Name name, int index) { super(parent, name); if (index < 0) { - throw new IllegalArgumentException("Index must be non negative"); + IllegalArgumentException e = new IllegalArgumentException("Index must be non negative"); + log.error(e.getMessage(), e); + throw e; } this.index = index; Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/PathFactoryImpl.java Fri Sep 16 21:51:43 2011 @@ -20,6 +20,8 @@ import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.NameFactory; import org.apache.jackrabbit.spi.Path; import org.apache.jackrabbit.spi.PathFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; import java.util.ArrayList; @@ -28,6 +30,8 @@ import java.util.ArrayList; * {@code PathFactoryImpl}... */ public class PathFactoryImpl implements PathFactory { + private static final Logger log = LoggerFactory.getLogger(PathFactoryImpl.class); + private static final PathFactory FACTORY = new PathFactoryImpl(); private PathFactoryImpl() {} @@ -44,8 +48,9 @@ public class PathFactoryImpl implements @Override public Path create(Path parent, Path relPath, boolean normalize) throws IllegalArgumentException, RepositoryException { if (relPath.isAbsolute()) { - throw new IllegalArgumentException( - "relPath is not a relative path: " + relPath); + IllegalArgumentException e = new IllegalArgumentException("relPath is not a relative path: " + relPath); + log.error(e.getMessage(), e); + throw e; } else { Path path = parent.resolve(relPath); if (normalize) { @@ -70,8 +75,11 @@ public class PathFactoryImpl implements @Override public Path create(Path parent, Name name, int index, boolean normalize) throws IllegalArgumentException, RepositoryException { if (RootPath.NAME.equals(name)) { - throw new IllegalArgumentException(); + IllegalArgumentException e = new IllegalArgumentException("Cannot create root path"); + log.error(e.getMessage(), e); + throw e; } + Path path = NamePath.create(parent, name, index); if (normalize) { return path.getNormalizedPath(); @@ -88,7 +96,9 @@ public class PathFactoryImpl implements if (name != null) { return create(name, Path.INDEX_UNDEFINED); } else { - throw new IllegalArgumentException("PathFactory.create(null)"); + IllegalArgumentException e = new IllegalArgumentException("PathFactory.create(null)"); + log.error(e.getMessage(), e); + throw e; } } @@ -98,27 +108,37 @@ public class PathFactoryImpl implements @Override public Path create(Name name, int index) throws IllegalArgumentException { if (name == null) { - throw new IllegalArgumentException("PathFactory.create(null, index"); + IllegalArgumentException e = new IllegalArgumentException("PathFactory.create(null, index"); + log.error(e.getMessage(), e); + throw e; } else if (index < Path.INDEX_UNDEFINED) { - throw new IllegalArgumentException( + IllegalArgumentException e = new IllegalArgumentException( "Index must not be negative: " + name + '[' + index + ']'); + log.error(e.getMessage(), e); + throw e; } else if (CurrentPath.NAME.equals(name)) { if (index == Path.INDEX_UNDEFINED) { return CurrentPath.CURRENT_PATH; } else { - throw new IllegalArgumentException(); + IllegalArgumentException e = new IllegalArgumentException("Invalid index"); + log.error(e.getMessage(), e); + throw e; } } else if (ParentPath.NAME.equals(name)) { if (index == Path.INDEX_UNDEFINED) { return ParentPath.PARENT_PATH; } else { - throw new IllegalArgumentException(); + IllegalArgumentException e = new IllegalArgumentException("Invalid index"); + log.error(e.getMessage(), e); + throw e; } } else if (RootPath.NAME.equals(name)) { if (index == Path.INDEX_UNDEFINED) { return RootPath.ROOT_PATH; } else { - throw new IllegalArgumentException(); + IllegalArgumentException e = new IllegalArgumentException("Invalid index"); + log.error(e.getMessage(), e); + throw e; } } else { return NamePath.create(null, name, index); @@ -138,8 +158,9 @@ public class PathFactoryImpl implements } else if (element.denotesRoot()) { return RootPath.ROOT_PATH; } else { - throw new IllegalArgumentException( - "Unknown path element type: " + element); + IllegalArgumentException e = new IllegalArgumentException("Unknown path element type: " + element); + log.error(e.getMessage(), e); + throw e; } } @@ -154,19 +175,25 @@ public class PathFactoryImpl implements path = new CurrentPath(path); } else if (element.denotesIdentifier()) { if (path != null) { - throw new IllegalArgumentException(); + IllegalArgumentException e = new IllegalArgumentException("Path not allowed for identifier"); + log.error(e.getMessage(), e); + throw e; } path = new IdentifierPath(element.getIdentifier()); } else if (element.denotesName()) { path = NamePath.create(path, element.getName(), element.getIndex()); } else if (element.denotesParent()) { if (path != null && path.isAbsolute() && path.getDepth() == 0) { - throw new IllegalArgumentException(); + IllegalArgumentException e = new IllegalArgumentException("Invalid path"); + log.error(e.getMessage(), e); + throw e; } path = new ParentPath(path); } else if (element.denotesRoot()) { if (path != null) { - throw new IllegalArgumentException(); + IllegalArgumentException e = new IllegalArgumentException("Path not allowed for root"); + log.error(e.getMessage(), e); + throw e; } path = RootPath.ROOT_PATH; } @@ -180,7 +207,9 @@ public class PathFactoryImpl implements @Override public Path create(String pathString) throws IllegalArgumentException { if (pathString == null || "".equals(pathString)) { - throw new IllegalArgumentException("No Path literal specified"); + IllegalArgumentException e = new IllegalArgumentException("No Path literal specified"); + log.error(e.getMessage(), e); + throw e; } // split into path elements int lastPos = 0; @@ -207,7 +236,9 @@ public class PathFactoryImpl implements @Override public Path.Element createElement(Name name) throws IllegalArgumentException { if (name == null) { - throw new IllegalArgumentException("name must not be null"); + IllegalArgumentException e = new IllegalArgumentException("name must not be null"); + log.error(e.getMessage(), e); + throw e; } else if (name.equals(ParentPath.NAME)) { return ParentPath.PARENT_PATH; } else if (name.equals(CurrentPath.NAME)) { @@ -225,16 +256,22 @@ public class PathFactoryImpl implements @Override public Path.Element createElement(Name name, int index) throws IllegalArgumentException { if (index < Path.INDEX_UNDEFINED) { - throw new IllegalArgumentException( + IllegalArgumentException e = new IllegalArgumentException( "The index may not be negative: " + name + '[' + index + ']'); + log.error(e.getMessage(), e); + throw e; } else if (name == null) { - throw new IllegalArgumentException("The name must not be null"); + IllegalArgumentException e = new IllegalArgumentException("The name must not be null"); + log.error(e.getMessage(), e); + throw e; } else if (name.equals(ParentPath.NAME) || name.equals(CurrentPath.NAME) || name.equals(RootPath.NAME)) { - throw new IllegalArgumentException( + IllegalArgumentException e = new IllegalArgumentException( "Special path elements (root, '.' and '..') can not have an explicit index: " + name + '[' + index + ']'); + log.error(e.getMessage(), e); + throw e; } else { return NamePath.create(null, name, index); } @@ -243,7 +280,9 @@ public class PathFactoryImpl implements @Override public Path.Element createElement(String identifier) throws IllegalArgumentException { if (identifier == null) { - throw new IllegalArgumentException("The id must not be null."); + IllegalArgumentException e = new IllegalArgumentException("The id must not be null."); + log.error(e.getMessage(), e); + throw e; } else { return new IdentifierPath(identifier); } @@ -254,7 +293,9 @@ public class PathFactoryImpl implements */ private static Path.Element createElementFromString(String elementString) { if (elementString == null) { - throw new IllegalArgumentException("null PathElement literal"); + IllegalArgumentException e = new IllegalArgumentException("null PathElement literal"); + log.error(e.getMessage(), e); + throw e; } if (elementString.equals(RootPath.NAME.toString())) { return RootPath.ROOT_PATH; @@ -276,16 +317,27 @@ public class PathFactoryImpl implements Name name = factory.create(elementString.substring(0, pos)); int pos1 = elementString.indexOf(']'); if (pos1 == -1) { - throw new IllegalArgumentException("invalid PathElement literal: " + elementString + " (missing ']')"); + IllegalArgumentException e = new IllegalArgumentException("invalid PathElement literal: " + + elementString + " (missing ']')"); + log.error(e.getMessage(), e); + throw e; } try { int index = Integer.valueOf(elementString.substring(pos + 1, pos1)); if (index < 1) { - throw new IllegalArgumentException("invalid PathElement literal: " + elementString + " (index is 1-based)"); + IllegalArgumentException e = new IllegalArgumentException("invalid PathElement literal: " + + elementString + " (index is 1-based)"); + log.error(e.getMessage(), e); + throw e; } return NamePath.create(null, name, index); } catch (NumberFormatException e) { - throw new IllegalArgumentException("invalid PathElement literal: " + elementString + " (" + e.getMessage() + ')'); + IllegalArgumentException e0 = new IllegalArgumentException("invalid PathElement literal: " + elementString + + " (" + e.getMessage() + ')'); + + log.error(e.getMessage(), e0); + e0.initCause(e); + throw e0; } } Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Pattern.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Pattern.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Pattern.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/Pattern.java Fri Sep 16 21:51:43 2011 @@ -19,6 +19,8 @@ package org.apache.jackrabbit.spi.common import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.Path; import org.apache.jackrabbit.spi.Path.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; @@ -32,6 +34,7 @@ import javax.jcr.RepositoryException; * Use the {@link Matcher} class for matching a whole path or finding matches inside a path. */ public abstract class Pattern { + private static final Logger log = LoggerFactory.getLogger(Pattern.class); /** * Matches this pattern against the input. @@ -44,8 +47,10 @@ public abstract class Pattern { return match(new Context(input)).getMatchResult(); } catch (RepositoryException e) { - throw (IllegalArgumentException) new IllegalArgumentException("Path not normalized") - .initCause(e); + IllegalArgumentException e0 = new IllegalArgumentException("Path not normalized"); + e0.initCause(e); + log.error(e0.getMessage(), e0); + throw e0; } } @@ -59,7 +64,9 @@ public abstract class Pattern { */ public static Pattern path(Path path) { if (path == null) { - throw new IllegalArgumentException("path cannot be null"); + IllegalArgumentException e = new IllegalArgumentException("path cannot be null"); + log.error(e.getMessage(), e); + throw e; } return new PathPattern(path); } @@ -72,7 +79,9 @@ public abstract class Pattern { */ public static Pattern name(Name name) { if (name == null) { - throw new IllegalArgumentException("name cannot be null"); + IllegalArgumentException e = new IllegalArgumentException("name cannot be null"); + log.error(e.getMessage(), e); + throw e; } return new NamePattern(name); } @@ -93,7 +102,9 @@ public abstract class Pattern { */ public static Pattern name(String namespaceUri, String localName) { if (namespaceUri == null || localName == null) { - throw new IllegalArgumentException("neither namespaceUri nor localName can be null"); + IllegalArgumentException e = new IllegalArgumentException("neither namespaceUri nor localName can be null"); + log.error(e.getMessage(), e); + throw e; } return new RegexPattern(namespaceUri, localName); } @@ -147,7 +158,9 @@ public abstract class Pattern { */ public static Pattern selection(Pattern pattern1, Pattern pattern2) { if (pattern1 == null || pattern2 == null) { - throw new IllegalArgumentException("Neither pattern can be null"); + IllegalArgumentException e = new IllegalArgumentException("Neither pattern can be null"); + log.error(e.getMessage(), e); + throw e; } return new SelectPattern(pattern1, pattern2); } @@ -160,7 +173,9 @@ public abstract class Pattern { */ public static Pattern sequence(Pattern pattern1, Pattern pattern2) { if (pattern1 == null || pattern2 == null) { - throw new IllegalArgumentException("Neither pattern can be null"); + IllegalArgumentException e = new IllegalArgumentException("Neither pattern can be null"); + log.error(e.getMessage(), e); + throw e; } return new SequencePattern(pattern1, pattern2); } @@ -172,7 +187,9 @@ public abstract class Pattern { */ public static Pattern repeat(Pattern pattern) { if (pattern == null) { - throw new IllegalArgumentException("Pattern can not be null"); + IllegalArgumentException e = new IllegalArgumentException("Pattern can not be null"); + log.error(e.getMessage(), e); + throw e; } return new RepeatPattern(pattern); } @@ -187,7 +204,9 @@ public abstract class Pattern { */ public static Pattern repeat(Pattern pattern, int min, int max) { if (pattern == null) { - throw new IllegalArgumentException("Pattern can not be null"); + IllegalArgumentException e = new IllegalArgumentException("Pattern can not be null"); + log.error(e.getMessage(), e); + throw e; } return new RepeatPattern(pattern, min, max); } @@ -213,7 +232,9 @@ public abstract class Pattern { this.pos = pos; isMatch = matched; if (pos > length) { - throw new IllegalArgumentException("Cannot match beyond end of input"); + IllegalArgumentException e = new IllegalArgumentException("Cannot match beyond end of input"); + log.error(e.getMessage(), e); + throw e; } } @@ -394,7 +415,9 @@ public abstract class Pattern { Path inputPath = input.getRemainder(); if (!inputPath.isNormalized()) { - throw new IllegalArgumentException("Not normalized"); + IllegalArgumentException e = new IllegalArgumentException("Not normalized"); + log.error(e.getMessage(), e); + throw e; } Element[] inputElements = inputPath.getElements(); @@ -435,7 +458,9 @@ public abstract class Pattern { Path inputPath = input.getRemainder(); if (!inputPath.isNormalized()) { - throw new IllegalArgumentException("Not normalized"); + IllegalArgumentException e = new IllegalArgumentException("Not normalized"); + log.error(e.getMessage(), e); + throw e; } Element[] inputElements = inputPath.getElements(); Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RelativePath.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RelativePath.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RelativePath.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RelativePath.java Fri Sep 16 21:51:43 2011 @@ -17,12 +17,15 @@ package org.apache.jackrabbit.spi.commons.name; import org.apache.jackrabbit.spi.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast; abstract class RelativePath extends AbstractPath { + private static final Logger log = LoggerFactory.getLogger(RelativePath.class); /** Serial version UID */ private static final long serialVersionUID = 5707676677044863127L; @@ -69,8 +72,9 @@ abstract class RelativePath extends Abst @Override public final Path getAncestor(int degree) throws RepositoryException { if (degree < 0) { - throw new IllegalArgumentException( - "Invalid ancestor degree " + degree); + IllegalArgumentException e = new IllegalArgumentException("Invalid ancestor degree " + degree); + log.error(e.getMessage(), e); + throw e; } else if (degree == 0) { return getNormalizedPath(); } else { @@ -100,8 +104,9 @@ abstract class RelativePath extends Abst @Override public final Path subPath(int from, int to) { if (from < 0 || length < to || to <= from) { - throw new IllegalArgumentException( - this + ".subPath(" + from + ", " + to + ')'); + IllegalArgumentException e = new IllegalArgumentException(this + ".subPath(" + from + ", " + to + ')'); + log.error(e.getMessage(), e); + throw e; } else if (from == 0 && to == length) { // this is only case where parent can be null (from = 0, to = 1) return this; Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RootPath.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RootPath.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RootPath.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/RootPath.java Fri Sep 16 21:51:43 2011 @@ -18,10 +18,13 @@ package org.apache.jackrabbit.spi.common import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.PathNotFoundException; final class RootPath extends AbstractPath { + private static final Logger log = LoggerFactory.getLogger(RootPath.class); /** Singleton instance */ public static final RootPath ROOT_PATH = new RootPath(); @@ -113,11 +116,11 @@ final class RootPath extends AbstractPat } @Override - public Path getAncestor(int degree) - throws IllegalArgumentException, PathNotFoundException { + public Path getAncestor(int degree) throws IllegalArgumentException, PathNotFoundException { if (degree < 0) { - throw new IllegalArgumentException( - "/.getAncestor(" + degree + ')'); + IllegalArgumentException e = new IllegalArgumentException("/.getAncestor(" + degree + ')'); + log.error(e.getMessage(), e); + throw e; } else if (degree > 0) { throw new PathNotFoundException( "/.getAncestor(" + degree + ')'); @@ -161,8 +164,9 @@ final class RootPath extends AbstractPat if (from == 0 && to == 1) { return this; } else { - throw new IllegalArgumentException( - "/.subPath(" + from + ", " + to + ')'); + IllegalArgumentException e = new IllegalArgumentException("/.subPath(" + from + ", " + to + ')'); + log.error(e.getMessage(), e); + throw e; } } Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ItemDefinitionImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ItemDefinitionImpl.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ItemDefinitionImpl.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ItemDefinitionImpl.java Fri Sep 16 21:51:43 2011 @@ -34,10 +34,6 @@ import javax.jcr.NamespaceException; * (and vice versa) where necessary. */ abstract class ItemDefinitionImpl implements ItemDefinition { - - /** - * Logger instance for this class - */ private static final Logger log = LoggerFactory.getLogger(ItemDefinitionImpl.class); /** Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionImpl.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionImpl.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionImpl.java Fri Sep 16 21:51:43 2011 @@ -36,10 +36,6 @@ import javax.jcr.NamespaceException; * where necessary. */ public class NodeDefinitionImpl extends ItemDefinitionImpl implements NodeDefinition { - - /** - * logger instance - */ private static final Logger log = LoggerFactory.getLogger(NodeDefinitionImpl.class); /** Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java Fri Sep 16 21:51:43 2011 @@ -23,6 +23,8 @@ import org.apache.jackrabbit.spi.QNodeTy import org.apache.jackrabbit.spi.QPropertyDefinition; import org.apache.jackrabbit.spi.QValueConstraint; import org.apache.jackrabbit.spi.commons.name.NameConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.PropertyType; import java.util.ArrayList; @@ -75,6 +77,7 @@ import static org.apache.jackrabbit.spi. * @see #getType() */ public class NodeTypeDefDiff { + private static final Logger log = LoggerFactory.getLogger(NodeTypeDefDiff.class); /** * no modification @@ -162,10 +165,14 @@ public class NodeTypeDefDiff { */ public static NodeTypeDefDiff create(QNodeTypeDefinition oldDef, QNodeTypeDefinition newDef) { if (oldDef == null || newDef == null) { - throw new IllegalArgumentException("arguments can not be null"); + IllegalArgumentException e = new IllegalArgumentException("arguments can not be null"); + log.error(e.getMessage(), e); + throw e; } if (!oldDef.getName().equals(newDef.getName())) { - throw new IllegalArgumentException("at least node type names must be matching"); + IllegalArgumentException e = new IllegalArgumentException("at least node type names must be matching"); + log.error(e.getMessage(), e); + throw e; } return new NodeTypeDefDiff(oldDef, newDef); } Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionImpl.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionImpl.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionImpl.java Fri Sep 16 21:51:43 2011 @@ -34,10 +34,6 @@ import javax.jcr.ValueFactory; * {@code AbstractNodeTypeDefinition}... */ public class NodeTypeDefinitionImpl implements NodeTypeDefinition { - - /** - * logger instance - */ private static final Logger log = LoggerFactory.getLogger(NodeTypeDefinitionImpl.class); protected final QNodeTypeDefinition ntd; Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeStorageImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeStorageImpl.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeStorageImpl.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeStorageImpl.java Fri Sep 16 21:51:43 2011 @@ -18,6 +18,8 @@ package org.apache.jackrabbit.spi.common import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.QNodeTypeDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; import javax.jcr.nodetype.NoSuchNodeTypeException; @@ -33,6 +35,7 @@ import java.util.Map; * in memory. */ public class NodeTypeStorageImpl implements NodeTypeStorage { + private static final Logger log = LoggerFactory.getLogger(NodeTypeStorageImpl.class); private final Map definitions = new HashMap(); @@ -72,7 +75,9 @@ public class NodeTypeStorageImpl impleme throws RepositoryException { if (nodeTypeDefs == null) { - throw new IllegalArgumentException("nodeTypeDefs must not be null"); + IllegalArgumentException e = new IllegalArgumentException("nodeTypeDefs must not be null"); + log.error(e.getMessage(), e); + throw e; } if (!allowUpdate) { Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeTemplateImpl.java Fri Sep 16 21:51:43 2011 @@ -39,7 +39,6 @@ import java.util.List; * A {@code NodeTypeTemplateImpl} ... */ public class NodeTypeTemplateImpl implements NodeTypeTemplate { - private static final Logger log = LoggerFactory.getLogger(NodeTypeTemplateImpl.class); private Name name; Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionImpl.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionImpl.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionImpl.java Fri Sep 16 21:51:43 2011 @@ -37,10 +37,6 @@ import javax.jcr.nodetype.PropertyDefini * (and vice versa) where necessary. */ public class PropertyDefinitionImpl extends ItemDefinitionImpl implements PropertyDefinition { - - /** - * logger instance - */ private static final Logger log = LoggerFactory.getLogger(PropertyDefinitionImpl.class); private final ValueFactory valueFactory; Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/constraint/ValueConstraint.java Fri Sep 16 21:51:43 2011 @@ -117,6 +117,7 @@ public abstract class ValueConstraint im } //-----------------------------------< static factory and check methods >--- + /** * Create a new {@code ValueConstraint} from the String representation. * Note, that the definition must be independent of session specific namespace @@ -134,10 +135,11 @@ public abstract class ValueConstraint im * method that allows to pass the JCR representation of a constraint * definition. */ - public static ValueConstraint create(int type, String definition) - throws InvalidConstraintException { + public static ValueConstraint create(int type, String definition) throws InvalidConstraintException { if (definition == null) { - throw new IllegalArgumentException("illegal definition (null)"); + IllegalArgumentException e = new IllegalArgumentException("illegal definition (null)"); + log.error(e.getMessage(), e); + throw e; } switch (type) { // constraints which are not qName sensitive @@ -170,8 +172,10 @@ public abstract class ValueConstraint im return ReferenceConstraint.create(definition); default: - throw new IllegalArgumentException("unknown/unsupported target type for constraint: " + IllegalArgumentException e = new IllegalArgumentException("unknown/unsupported target type for constraint: " + PropertyType.nameFromValue(type)); + log.error(e.getMessage(), e); + throw e; } } @@ -231,12 +235,15 @@ public abstract class ValueConstraint im * @return a new value constraint * @throws InvalidConstraintException if the constraint is invalid */ - public static ValueConstraint create(int type, String jcrDefinition, - NamePathResolver resolver) + public static ValueConstraint create(int type, String jcrDefinition, NamePathResolver resolver) throws InvalidConstraintException { + if (jcrDefinition == null) { - throw new IllegalArgumentException("Illegal definition (null) for ValueConstraint."); + IllegalArgumentException e = new IllegalArgumentException("Illegal definition (null) for ValueConstraint."); + log.error(e.getMessage(), e); + throw e; } + switch (type) { case PropertyType.STRING: case PropertyType.URI: @@ -267,7 +274,11 @@ public abstract class ValueConstraint im return ReferenceConstraint.create(jcrDefinition, resolver); default: - throw new IllegalArgumentException("Unknown/unsupported target type for constraint: " + PropertyType.nameFromValue(type)); + IllegalArgumentException e = new IllegalArgumentException("Unknown/unsupported target type for " + + "constraint: " + PropertyType.nameFromValue(type)); + + log.error(e.getMessage(), e); + throw e; } } Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionReader.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionReader.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionReader.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionReader.java Fri Sep 16 21:51:43 2011 @@ -17,6 +17,8 @@ package org.apache.jackrabbit.spi.commons.privilege; import org.apache.jackrabbit.spi.PrivilegeDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.InputStream; import java.io.Reader; @@ -28,6 +30,7 @@ import java.util.Map; * that this reader will not apply any validation. */ public class PrivilegeDefinitionReader { + private static final Logger log = LoggerFactory.getLogger(PrivilegeDefinitionReader.class); private final PrivilegeDefinition[] privilegeDefinitions; private final Map namespaces = new HashMap(); @@ -50,7 +53,9 @@ public class PrivilegeDefinitionReader { privilegeDefinitions = pxh.readDefinitions(in, namespaces); } else { // not yet supported - throw new IllegalArgumentException("Unsupported content type " + contentType); + IllegalArgumentException e = new IllegalArgumentException("Unsupported content type " + contentType); + log.error(e.getMessage(), e); + throw e; } } @@ -72,7 +77,9 @@ public class PrivilegeDefinitionReader { privilegeDefinitions = pxh.readDefinitions(reader, namespaces); } else { // not yet supported - throw new IllegalArgumentException("Unsupported content type " + contentType); + IllegalArgumentException e = new IllegalArgumentException("Unsupported content type " + contentType); + log.error(e.getMessage(), e); + throw e; } } Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionWriter.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionWriter.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionWriter.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeDefinitionWriter.java Fri Sep 16 21:51:43 2011 @@ -17,6 +17,8 @@ package org.apache.jackrabbit.spi.commons.privilege; import org.apache.jackrabbit.spi.PrivilegeDefinition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.OutputStream; @@ -27,6 +29,7 @@ import java.util.Map; * Writes privilege definitions to an output stream. */ public class PrivilegeDefinitionWriter { + static final Logger log = LoggerFactory.getLogger(PrivilegeDefinitionWriter.class); private final PrivilegeHandler ph; @@ -43,7 +46,9 @@ public class PrivilegeDefinitionWriter { ph = new PrivilegeXmlHandler(); } else { // not yet supported - throw new IllegalArgumentException("Unsupported content type"); + IllegalArgumentException e = new IllegalArgumentException("Unsupported content type"); + log.error(e.getMessage(), e); + throw e; } } Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeXmlHandler.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeXmlHandler.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeXmlHandler.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/privilege/PrivilegeXmlHandler.java Fri Sep 16 21:51:43 2011 @@ -21,6 +21,8 @@ import org.apache.jackrabbit.spi.NameFac import org.apache.jackrabbit.spi.PrivilegeDefinition; import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl; import org.apache.jackrabbit.util.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -68,6 +70,7 @@ import java.util.Set; * */ class PrivilegeXmlHandler implements PrivilegeHandler { + private static final Logger log = LoggerFactory.getLogger(PrivilegeXmlHandler.class); private static final String TEXT_XML = "text/xml"; private static final String APPLICATION_XML = "application/xml"; @@ -161,7 +164,9 @@ class PrivilegeXmlHandler implements Pri Document doc = builder.parse(input); Element root = doc.getDocumentElement(); if (!XML_PRIVILEGES.equals(root.getNodeName())) { - throw new IllegalArgumentException("root element must be named 'privileges'"); + IllegalArgumentException e = new IllegalArgumentException("root element must be named 'privileges'"); + log.error(e.getMessage(), e); + throw e; } updateNamespaceMapping(root, namespaces); Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/OrderQueryNode.java Fri Sep 16 21:51:43 2011 @@ -17,6 +17,8 @@ package org.apache.jackrabbit.spi.commons.query; import org.apache.jackrabbit.spi.Path; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; import java.util.ArrayList; @@ -29,6 +31,7 @@ import static org.apache.jackrabbit.spi. * values of properties. */ public class OrderQueryNode extends QueryNode { + private static final Logger log = LoggerFactory.getLogger(OrderQueryNode.class); /** * The order specs @@ -72,7 +75,9 @@ public class OrderQueryNode extends Quer */ public void setAscending(boolean value) { if (specs.isEmpty()) { - throw new IllegalStateException("No order specification set"); + IllegalStateException e = new IllegalStateException("PropertyInfo not built yet"); + log.error(e.getMessage(), e); + throw e; } OrderSpec orderSpec = specs.get(specs.size() - 1); @@ -88,7 +93,9 @@ public class OrderQueryNode extends Quer */ public void setPath(Path path) { if (specs.isEmpty()) { - throw new IllegalStateException("No order specification set"); + IllegalStateException e = new IllegalStateException("No order specification set"); + log.error(e.getMessage(), e); + throw e; } OrderSpec orderSpec = specs.get(specs.size() - 1); @@ -104,7 +111,9 @@ public class OrderQueryNode extends Quer */ public void setFunction(String name) { if (specs.isEmpty()) { - throw new IllegalStateException("No order specification set"); + IllegalStateException e = new IllegalStateException("No order specification set"); + log.error(e.getMessage(), e); + throw e; } OrderSpec orderSpec = specs.get(specs.size() - 1); Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PropertyFunctionQueryNode.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PropertyFunctionQueryNode.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PropertyFunctionQueryNode.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/PropertyFunctionQueryNode.java Fri Sep 16 21:51:43 2011 @@ -16,6 +16,9 @@ */ package org.apache.jackrabbit.spi.commons.query; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import javax.jcr.RepositoryException; import java.util.Collections; import java.util.HashSet; @@ -32,6 +35,7 @@ import static org.apache.jackrabbit.spi. * */ public class PropertyFunctionQueryNode extends QueryNode { + private static final Logger log = LoggerFactory.getLogger(PropertyFunctionQueryNode.class); /** * Requests that property values in a {@link RelationQueryNode} are @@ -76,7 +80,9 @@ public class PropertyFunctionQueryNode e protected PropertyFunctionQueryNode(QueryNode parent, String functionName) throws IllegalArgumentException { super(parent); if (!SUPPORTED_FUNCTION_NAMES.contains(functionName)) { - throw new IllegalArgumentException("unknown function name"); + IllegalArgumentException e = new IllegalArgumentException("unknown function name"); + log.error(e.getMessage(), e); + throw e; } this.functionName = functionName; } Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryTreeBuilderRegistry.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryTreeBuilderRegistry.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryTreeBuilderRegistry.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryTreeBuilderRegistry.java Fri Sep 16 21:51:43 2011 @@ -33,10 +33,6 @@ import java.util.Set; * Implements a central access to QueryTreeBuilder instances. */ public final class QueryTreeBuilderRegistry { - - /** - * Logger instance for this class. - */ private static final Logger log = LoggerFactory.getLogger(QueryTreeBuilderRegistry.class); /** Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/RelationQueryNode.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/RelationQueryNode.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/RelationQueryNode.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/RelationQueryNode.java Fri Sep 16 21:51:43 2011 @@ -20,17 +20,24 @@ import org.apache.jackrabbit.spi.Name; import org.apache.jackrabbit.spi.Path; import org.apache.jackrabbit.spi.Path.Element; import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; import java.util.Date; -import static org.apache.jackrabbit.spi.commons.query.QueryConstants.*; +import static org.apache.jackrabbit.spi.commons.query.QueryConstants.TYPE_DATE; +import static org.apache.jackrabbit.spi.commons.query.QueryConstants.TYPE_DOUBLE; +import static org.apache.jackrabbit.spi.commons.query.QueryConstants.TYPE_LONG; +import static org.apache.jackrabbit.spi.commons.query.QueryConstants.TYPE_POSITION; +import static org.apache.jackrabbit.spi.commons.query.QueryConstants.TYPE_STRING; import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast; /** * Implements a query node that defines property value relation. */ public class RelationQueryNode extends NAryQueryNode { + private static final Logger log = LoggerFactory.getLogger(RelationQueryNode.class); /** * Acts as an synthetic placeholder for a location step that matches any @@ -160,7 +167,9 @@ public class RelationQueryNode extends N */ public void setRelativePath(Path relPath) { if (relPath.isAbsolute()) { - throw new IllegalArgumentException("relPath must be relative"); + IllegalArgumentException e = new IllegalArgumentException("relPath must be relative"); + log.error(e.getMessage(), e); + throw e; } Element[] elements = relPath.getElements(); Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/TextsearchQueryNode.java Fri Sep 16 21:51:43 2011 @@ -19,6 +19,8 @@ package org.apache.jackrabbit.spi.common import org.apache.jackrabbit.spi.Path; import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException; import org.apache.jackrabbit.spi.commons.name.PathBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; @@ -28,6 +30,7 @@ import static org.apache.jackrabbit.spi. * Implements a query node that defines a textsearch clause. */ public class TextsearchQueryNode extends QueryNode { + private static final Logger log = LoggerFactory.getLogger(TextsearchQueryNode.class); /** * The query statement inside the textsearch clause @@ -106,7 +109,9 @@ public class TextsearchQueryNode extends */ public void setRelativePath(Path relPath) { if (relPath != null && relPath.isAbsolute()) { - throw new IllegalArgumentException("relPath must be relative"); + IllegalArgumentException e = new IllegalArgumentException("relPath must be relative"); + log.error(e.getMessage(), e); + throw e; } this.relPath = relPath; if (relPath == null) { Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelFactoryImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelFactoryImpl.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelFactoryImpl.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/qom/QueryObjectModelFactoryImpl.java Fri Sep 16 21:51:43 2011 @@ -23,6 +23,8 @@ import org.apache.jackrabbit.spi.Path; import org.apache.jackrabbit.spi.commons.conversion.NameException; import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver; import org.apache.jackrabbit.spi.commons.util.Unchecked; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; import javax.jcr.Value; @@ -69,6 +71,7 @@ import static org.apache.jackrabbit.spi. * factory from JSR 283. */ public abstract class QueryObjectModelFactoryImpl implements QueryObjectModelFactory { + private static final Logger log = LoggerFactory.getLogger(QueryObjectModelFactoryImpl.class); /** * The name and path resolver for this QOM factory. @@ -521,8 +524,9 @@ public abstract class QueryObjectModelFa throws RepositoryException { if (fullTextSearchExpression == null) { - throw new IllegalArgumentException( - "Full text search expression is null"); + IllegalArgumentException e = new IllegalArgumentException("Full text search expression is null"); + log.error(e.getMessage(), e); + throw e; } Name propName = null; if (propertyName != null) { Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLQueryBuilder.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLQueryBuilder.java?rev=1171815&r1=1171814&r2=1171815&view=diff ============================================================================== --- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLQueryBuilder.java (original) +++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/sql/JCRSQLQueryBuilder.java Fri Sep 16 21:51:43 2011 @@ -64,10 +64,6 @@ import static org.apache.jackrabbit.spi. * Implements the query builder for the JCR SQL syntax. */ public class JCRSQLQueryBuilder implements JCRSQLParserVisitor { - - /** - * logger instance for this class - */ private static final Logger log = LoggerFactory.getLogger(JCRSQLQueryBuilder.class); /** @@ -241,7 +237,9 @@ public class JCRSQLQueryBuilder implemen } } if (path == null) { - throw new IllegalArgumentException("Invalid combination of jcr:path clauses"); + IllegalArgumentException e = new IllegalArgumentException("Invalid combination of jcr:path clauses"); + log.error(e.getMessage(), e); + throw e; } else { pathConstraints.remove(path); MergingPathQueryNode[] paths = pathConstraints.toArray(new MergingPathQueryNode[pathConstraints.size()]); @@ -251,7 +249,9 @@ public class JCRSQLQueryBuilder implemen } } } catch (NoSuchElementException e) { - throw new IllegalArgumentException("Invalid combination of jcr:path clauses"); + IllegalArgumentException e0 = new IllegalArgumentException("Invalid combination of jcr:path clauses", e); + log.error(e0.getMessage(), e0); + throw e0; } MergingPathQueryNode path = pathConstraints.get(0); LocationStepQueryNode[] steps = path.getPathSteps(); @@ -419,8 +419,10 @@ public class JCRSQLQueryBuilder implemen // backslash is the escape character we use internally pattern.setValue(translateEscaping(pattern.getValue(), node.getEscapeString().charAt(0), '\\')); } else { - throw new IllegalArgumentException("ESCAPE string value must have length 1: '" + - node.getEscapeString() + '\''); + IllegalArgumentException e = new IllegalArgumentException("ESCAPE string value must have " + + "length 1: '" + node.getEscapeString() + '\''); + log.error(e.getMessage(), e); + throw e; } } else { // no escape character specified. @@ -457,10 +459,14 @@ public class JCRSQLQueryBuilder implemen NameConstants.JCR_PRIMARYTYPE, type, (ASTLiteral) node.children[0]); } else { - throw new IllegalArgumentException("Unknown operation type: " + type); + IllegalArgumentException e = new IllegalArgumentException("Unknown operation type: " + type); + log.error(e.getMessage(), e); + throw e; } } catch (ArrayIndexOutOfBoundsException e) { - throw new IllegalArgumentException("Too few arguments in predicate"); + IllegalArgumentException e0 = new IllegalArgumentException("Too few arguments in predicate", e); + log.error(e0.getMessage(), e0); + throw e0; } if (predicateNode != null) { @@ -606,8 +612,9 @@ public class JCRSQLQueryBuilder implemen public Object visit(ASTLowerFunction node, Object data) { RelationQueryNode parent = (RelationQueryNode) data; if (parent.getValueType() != QueryConstants.TYPE_STRING) { - String msg = "LOWER() function is only supported for String literal"; - throw new IllegalArgumentException(msg); + IllegalArgumentException e = new IllegalArgumentException("LOWER() function is only supported for String literal"); + log.error(e.getMessage(), e); + throw e; } parent.addOperand(factory.createPropertyFunctionQueryNode(parent, PropertyFunctionQueryNode.LOWER_CASE)); return parent; @@ -617,8 +624,9 @@ public class JCRSQLQueryBuilder implemen public Object visit(ASTUpperFunction node, Object data) { RelationQueryNode parent = (RelationQueryNode) data; if (parent.getValueType() != QueryConstants.TYPE_STRING) { - String msg = "UPPER() function is only supported for String literal"; - throw new IllegalArgumentException(msg); + IllegalArgumentException e = new IllegalArgumentException("UPPER() function is only supported for String literal"); + log.error(e.getMessage(), e); + throw e; } parent.addOperand(factory.createPropertyFunctionQueryNode(parent, PropertyFunctionQueryNode.UPPER_CASE)); return parent; @@ -690,16 +698,23 @@ public class JCRSQLQueryBuilder implemen node.setDateValue(c.getTime()); } } catch (java.text.ParseException e) { - throw new IllegalArgumentException(e.toString()); + IllegalArgumentException e0 = new IllegalArgumentException(e.getMessage(), e); + log.error(e0.getMessage(), e0); + throw e0; } catch (NumberFormatException e) { - throw new IllegalArgumentException(e.toString()); + IllegalArgumentException e0 = new IllegalArgumentException(e.getMessage(), e); + log.error(e0.getMessage(), e0); + throw e0; } catch (MalformedPathException e) { - // path is always valid, but throw anyway - throw new IllegalArgumentException(e.getMessage()); + IllegalArgumentException e0 = new IllegalArgumentException(e.getMessage(), e); + log.error(e0.getMessage(), e0); + throw e0; } if (node == null) { - throw new IllegalArgumentException("Unknown type for literal: " + literal.getType()); + IllegalArgumentException e = new IllegalArgumentException("Unknown type for literal: " + literal.getType()); + log.error(e.getMessage(), e); + throw e; } return node; } @@ -766,10 +781,16 @@ public class JCRSQLQueryBuilder implemen qName = resolver.getQName(name); } catch (NamespaceException e) { - throw new IllegalArgumentException("Illegal name: " + name); + IllegalArgumentException e0 = new IllegalArgumentException("Illegal name: " + name); + log.error(e.getMessage(), e0); + e.initCause(e); + throw e0; } catch (NameException e) { - throw new IllegalArgumentException("Illegal name: " + name); + IllegalArgumentException e0 = new IllegalArgumentException("Illegal name: " + name); + log.error(e.getMessage(), e0); + e.initCause(e); + throw e0; } } // if name test is % this means also search descendants @@ -876,7 +897,9 @@ public class JCRSQLQueryBuilder implemen int operation, Collection validJcrSystemNodeTypeNames) { super(null, validJcrSystemNodeTypeNames); if (operation != QueryNode.TYPE_OR && operation != QueryNode.TYPE_AND && operation != QueryNode.TYPE_NOT) { - throw new IllegalArgumentException("operation"); + IllegalArgumentException e = new IllegalArgumentException("operation"); + log.error(e.getMessage(), e); + throw e; } this.operation = operation; }