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 2012/01/27 16:12:11 UTC
svn commit: r1236709 -
/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Author: jukka
Date: Fri Jan 27 15:12:11 2012
New Revision: 1236709
URL: http://svn.apache.org/viewvc?rev=1236709&view=rev
Log:
JCR-3223: Disallow unregistering of node types still (possibly) in use
Add a feature flag to restore the unfortunate functionality in Jackrabbit 2.1 and 2.2 for those users who've already started to rely on this functionality
Modified:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?rev=1236709&r1=1236708&r2=1236709&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java Fri Jan 27 15:12:11 2012
@@ -77,6 +77,20 @@ public class NodeTypeRegistry implements
"/nodetypes/custom_nodetypes.xml";
/**
+ * Feature flag for the unfortunate behavior in Jackrabbit 2.1 and 2.2
+ * where the exception from {@link #checkForReferencesInContent(Name)}
+ * was never thrown because of a mistaken commit for
+ * <a href="https://issues.apache.org/jira/browse/JCR-2587">JCR-2587</a>.
+ * Setting this flag to <code>true</code> (the default value comes from
+ * the "disableCheckForReferencesInContentException" system property)
+ * will disable the exception thrown by default by the method.
+ *
+ * @see <a href="https://issues.apache.org/jira/browse/JCR-3223">JCR-3223</a>
+ */
+ public static volatile boolean disableCheckForReferencesInContentException =
+ Boolean.getBoolean("disableCheckForReferencesInContentException");
+
+ /**
* resource holding custom node type definitions which are represented as
* nodes in the repository; it is needed in order to make the registrations
* persistent.
@@ -978,7 +992,18 @@ public class NodeTypeRegistry implements
*/
protected void checkForReferencesInContent(Name nodeTypeName)
throws RepositoryException {
- throw new RepositoryException("not yet implemented");
+ if (!disableCheckForReferencesInContentException) {
+ throw new RepositoryException(
+ "The check for the existence of content using the"
+ + " given node type is not yet implemented, so to"
+ + " guarantee repository consistency the request to"
+ + " unregister the type is denied. Contributions to"
+ + " implement this feature would be welcome! To restore"
+ + " the broken behavior of previous Jackrabbit versions"
+ + " where this check was simply skipped, please set the"
+ + " disableCheckForReferencesInContentException system"
+ + " property to true.");
+ }
}
//-------------------------------------------------------< implementation >