From e69bb19115b36d336e886263e70aee2007639b54 Mon Sep 17 00:00:00 2001 From: "etsai%netscape.com" Date: Wed, 25 Feb 2004 23:11:43 +0000 Subject: [PATCH] fix for Schema retrieval crashes, bug 232298 git-svn-id: svn://10.0.0.236/trunk@153245 18797224-902f-48f8-a5cc-f745e15eee43 --- .../netscape/ldap/LDAPMatchingRuleSchema.java | 18 +++++++++++++----- .../ldap/LDAPMatchingRuleUseSchema.java | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPMatchingRuleSchema.java b/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPMatchingRuleSchema.java index 863c31dffc9..19d2e1bc1ee 100644 --- a/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPMatchingRuleSchema.java +++ b/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPMatchingRuleSchema.java @@ -18,6 +18,7 @@ * Rights Reserved. * * Contributor(s): + * Ingo Schaefer (ingo.schaefer@fh-brandenburg.de) */ package netscape.ldap; @@ -220,12 +221,19 @@ public class LDAPMatchingRuleSchema extends LDAPAttributeSchema { if ( use != null ) { parseValue( use ); } - Vector v = (Vector)properties.get( "APPLIES" ); - if ( v != null ) { - attributes = new String[v.size()]; - v.copyInto( attributes ); - v.removeAllElements(); + Object p = properties.get( "APPLIES" ); + if ( p instanceof Vector ) { + Vector v = (Vector) p; + if ( v != null ) { + attributes = new String[v.size()]; + v.copyInto( attributes ); + v.removeAllElements(); + } } + else if ( p instanceof String ) { + attributes = new String[1]; + attributes[0] = (String) p; + } String val = (String)properties.get( "SYNTAX" ); if ( val != null ) { syntaxElement.syntaxString = val; diff --git a/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPMatchingRuleUseSchema.java b/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPMatchingRuleUseSchema.java index 30292fc0b51..8d53fdd6693 100644 --- a/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPMatchingRuleUseSchema.java +++ b/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPMatchingRuleUseSchema.java @@ -132,11 +132,18 @@ public class LDAPMatchingRuleUseSchema extends LDAPAttributeSchema { public LDAPMatchingRuleUseSchema( String use ) { attrName = "matchingruleuse"; parseValue( use ); - Vector v = (Vector)properties.get( "APPLIES" ); - if ( v != null ) { - attributes = new String[v.size()]; - v.copyInto( attributes ); - v.removeAllElements(); + Object p = properties.get( "APPLIES" ); + if ( p instanceof Vector ) { + Vector v = (Vector)p; + if ( v != null ) { + attributes = new String[v.size()]; + v.copyInto( attributes ); + v.removeAllElements(); + } + } + else if ( p instanceof String ) { + attributes = new String[1]; + attributes[0] = (String)p; } }