You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by st...@apache.org on 2004/09/02 13:02:32 UTC
cvs commit: jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core ItemManager.java NodeImpl.java PropertyImpl.java
stefan 2004/09/02 04:02:32
Modified: proposals/jcrri/src/org/apache/slide/jcr/core
ItemManager.java NodeImpl.java PropertyImpl.java
Log:
#0000: fixing problem PropertyType.NAME related problems
Revision Changes Path
1.16 +11 -8 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/ItemManager.java
Index: ItemManager.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/ItemManager.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ItemManager.java 30 Aug 2004 16:15:15 -0000 1.15
+++ ItemManager.java 2 Sep 2004 11:02:31 -0000 1.16
@@ -149,8 +149,8 @@
*/
boolean itemExists(Path path) {
try {
- Item item = getItem(path);
- return (item != null);
+ getItem(path);
+ return true;
} catch (PathNotFoundException pnfe) {
return false;
} catch (AccessDeniedException ade) {
@@ -178,8 +178,11 @@
synchronized ItemImpl getItem(Path path)
throws PathNotFoundException, AccessDeniedException, RepositoryException {
ItemId id = hierMgr.resolvePath(path);
-
- return getItem(id);
+ try {
+ return getItem(id);
+ } catch (ItemNotFoundException infe) {
+ throw new PathNotFoundException(safeGetJCRPath(path));
+ }
}
/**
@@ -215,7 +218,7 @@
/**
* @param parentId
* @return
- * @throws PathNotFoundException
+ * @throws ItemNotFoundException
* @throws AccessDeniedException
* @throws RepositoryException
*/
@@ -271,12 +274,12 @@
/**
* @param parentId
* @return
- * @throws PathNotFoundException
+ * @throws ItemNotFoundException
* @throws AccessDeniedException
* @throws RepositoryException
*/
synchronized PropertyIterator getChildProperties(NodeId parentId)
- throws PathNotFoundException, AccessDeniedException, RepositoryException {
+ throws ItemNotFoundException, AccessDeniedException, RepositoryException {
// check privileges
if (!session.getAccessManager().isGranted(parentId, Permission.READ_ITEM)) {
ItemImpl item = retrieveItem(parentId);
1.36 +9 -9 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/NodeImpl.java
Index: NodeImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/NodeImpl.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- NodeImpl.java 1 Sep 2004 15:39:41 -0000 1.35
+++ NodeImpl.java 2 Sep 2004 11:02:31 -0000 1.36
@@ -878,7 +878,7 @@
// check state of this instance
checkItemState();
- PropertyImpl prop = getOrCreateProperty(name, PropertyType.STRING);
+ PropertyImpl prop = getOrCreateProperty(name, PropertyType.NAME);
prop.setValue(value);
return prop;
}
@@ -898,7 +898,7 @@
// check state of this instance
checkItemState();
- PropertyImpl prop = getOrCreateProperty(name, PropertyType.STRING);
+ PropertyImpl prop = getOrCreateProperty(name, PropertyType.NAME);
prop.setValue(values);
return prop;
}
@@ -1415,10 +1415,10 @@
*/
try {
return itemMgr.getChildNodes((NodeId) id);
- } catch (PathNotFoundException pnfe) {
+ } catch (ItemNotFoundException infe) {
String msg = "failed to list the child nodes of " + safeGetJCRPath();
- log.error(msg, pnfe);
- throw new RepositoryException(msg, pnfe);
+ log.error(msg, infe);
+ throw new RepositoryException(msg, infe);
} catch (AccessDeniedException ade) {
String msg = "failed to list the child nodes of " + safeGetJCRPath();
log.error(msg, ade);
@@ -1442,10 +1442,10 @@
*/
try {
return itemMgr.getChildProperties((NodeId) id);
- } catch (PathNotFoundException pnfe) {
+ } catch (ItemNotFoundException infe) {
String msg = "failed to list the child properties of " + safeGetJCRPath();
- log.error(msg, pnfe);
- throw new RepositoryException(msg, pnfe);
+ log.error(msg, infe);
+ throw new RepositoryException(msg, infe);
} catch (AccessDeniedException ade) {
String msg = "failed to list the child properties of " + safeGetJCRPath();
log.error(msg, ade);
1.27 +8 -6 jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyImpl.java
Index: PropertyImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyImpl.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- PropertyImpl.java 30 Aug 2004 16:15:16 -0000 1.26
+++ PropertyImpl.java 2 Sep 2004 11:02:31 -0000 1.27
@@ -230,9 +230,7 @@
// check type according to definition of this property
int reqType = definition.getRequiredType();
if (reqType == PropertyType.UNDEFINED) {
- reqType = PropertyType.STRING;
- } else if (reqType != PropertyType.STRING) {
- throw new ValueFormatException("the type of the specified values is incompatible with the type of this property");
+ reqType = PropertyType.NAME;
}
InternalValue[] internalValues = null;
@@ -243,9 +241,11 @@
QName name = names[i];
InternalValue internalValue = null;
if (name != null) {
- if (reqType != PropertyType.STRING) {
+ if (reqType != PropertyType.NAME) {
// type conversion required
- internalValue = InternalValue.create(name);
+ internalValue =
+ InternalValue.create(InternalValue.create(name).toJCRValue(session.getNamespaceResolver()),
+ reqType, session.getNamespaceResolver());
} else {
// no type conversion required
internalValue = InternalValue.create(name);
@@ -882,6 +882,7 @@
try {
return name.toJCRName(session.getNamespaceResolver()).length();
} catch (NoPrefixDeclaredException npde) {
+ // should never happen...
log.warn(safeGetJCRPath() + ": the value represents an invalid name", npde);
return -1;
}
@@ -891,6 +892,7 @@
try {
return path.toJCRPath(session.getNamespaceResolver()).length();
} catch (NoPrefixDeclaredException npde) {
+ // should never happen...
log.warn(safeGetJCRPath() + ": the value represents an invalid path", npde);
return -1;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org