Author: fguillaume
Date: Wed Aug 5 22:28:14 2009
New Revision: 801444
URL: http://svn.apache.org/viewvc?rev=801444&view=rev
Log:
work with repos that don't have all the optional base types
Modified:
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleTypeManager.java
Modified:
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleTypeManager.java
URL:
http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleTypeManager.java?rev=801444&r1=801443&r2=801444&view=diff
==============================================================================
---
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleTypeManager.java
(original)
+++
incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleTypeManager.java
Wed Aug 5 22:28:14 2009
@@ -34,7 +34,15 @@
// linked so that values() returns things in a parent-before-children order
protected final Map<String, Type> types = new LinkedHashMap<String,
Type>();
- protected final Map<String, Collection<Type>> typesChildren = new
HashMap<String, Collection<Type>>();
+ protected final Map<String, Collection<Type>> typesChildren;
+
+ public SimpleTypeManager() {
+ typesChildren = new HashMap<String, Collection<Type>>();
+ // make sure base types are there
+ for (String bid : BaseType.ALL_IDS) {
+ typesChildren.put(bid, new LinkedList<Type>());
+ }
+ }
public void addType(Type type) {
String typeId = type.getId();
@@ -81,7 +89,12 @@
if (typeId == null) {
// ignore depth
for (String tid : BaseType.ALL_IDS) {
- list.add(types.get(tid));
+ Type type = types.get(tid);
+ if (type == null) {
+ // some optional base types may be absent
+ continue;
+ }
+ list.add(type);
collectSubTypes(tid, -1, returnPropertyDefinitions, list,
done);
}
} else {