[Fedora-directory-commits] directoryconsole/src/com/netscape/admin/dirserv DSSchemaHelper.java, 1.1.1.1, 1.2

Richard Allen Megginson rmeggins at fedoraproject.org
Fri Dec 5 23:46:27 UTC 2008


Author: rmeggins

Update of /cvs/dirsec/directoryconsole/src/com/netscape/admin/dirserv
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25087/directoryconsole/src/com/netscape/admin/dirserv

Modified Files:
	DSSchemaHelper.java 
Log Message:
Resolves: bug 234948
Bug Description: Console hangs when adding a custom entry and schema items are in certain order
Reviewed by: nkinder (Thanks!)
Fix Description: The problem is primarily due to https://bugzilla.redhat.com/show_bug.cgi?id=170791 "Schema file parsing overly picky?" - the console schema editor expects an objectclass to always have at least 1 superior.  The bug causes SUP not to be present in the schema entry in the directory server.  The fix is to use a schema helper function to make sure the list of superior objectclasses always contains at least "top".  I also added a check for a null value to avoid the NullPointerException console error.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no



Index: DSSchemaHelper.java
===================================================================
RCS file: /cvs/dirsec/directoryconsole/src/com/netscape/admin/dirserv/DSSchemaHelper.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- DSSchemaHelper.java	18 Jul 2005 00:55:40 -0000	1.1.1.1
+++ DSSchemaHelper.java	5 Dec 2008 23:46:25 -0000	1.2
@@ -110,7 +110,7 @@
 		
 		String[] superiors;
 		Integer integer;
-		superiors = oc.getSuperiors();
+		superiors = getSuperiors(oc);
 		if (superiors != null) {
 			int i;
 			for (i=0; i<superiors.length; i++) {
@@ -164,7 +164,7 @@
 		
 		String[] superiors;
 		Integer integer;
-		superiors = oc.getSuperiors();
+		superiors = getSuperiors(oc);
 		if (superiors != null) {
 			int i;
 			for (i=0; i<superiors.length; i++) {
@@ -222,7 +222,7 @@
 			
 			String[] superiors;			
 			Integer integer;
-			superiors = oc.getSuperiors();
+			superiors = getSuperiors(oc);
 			if (superiors != null) {
 				int i;
 				for (i=0; i<superiors.length; i++) {
@@ -284,7 +284,7 @@
 			
 			String[] superiors;			
 			Integer integer;
-			superiors = oc.getSuperiors();
+			superiors = getSuperiors(oc);
 			if (superiors != null) {
 				int i;
 				for (i=0; i<superiors.length; i++) {
@@ -345,7 +345,7 @@
 			oc = schema.getObjectClass( value );
 			String[] superiors;
 			if ( oc != null ) {
-				superiors = oc.getSuperiors();
+				superiors = getSuperiors(oc);
 				if (superiors != null) {
 					int i;
 					Integer integer;
@@ -480,6 +480,18 @@
 		_operationalAttributes = null;
 	}
 
+    public static String[] getSuperiors(LDAPObjectClassSchema oc) {
+        String[] superiors = oc.getSuperiors();
+        if ((superiors == null) && (oc.getType() == LDAPObjectClassSchema.STRUCTURAL)) {
+            // a structural objectclass must always have top as a superior
+            // due to https://bugzilla.redhat.com/show_bug.cgi?id=170791 the SUP
+            // may not have shown up, so we add it if necessary
+            superiors = new String[1];
+            superiors[0] = "top";
+        }
+
+        return superiors;
+    }
 
 	private static String[] _editableOperationalAttributes = null;
 	private static String[] _operationalAttributes = null;




More information about the Fedora-directory-commits mailing list