From ea9338f20259f92ccb818876e27cd83908cef0d0 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 04 Dec 2013 16:23:38 +0000
Subject: [PATCH] Backport fix for OPENDJ-1200: Upgrade tool loses one ds-cfg-character-set value

---
 opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java b/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java
index 9e3eee1..33949db 100644
--- a/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java
+++ b/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java
@@ -22,6 +22,7 @@
  *
  *
  *      Copyright 2009 Sun Microsystems, Inc.
+ *      Portions copyright 2013 ForgeRock AS.
  */
 
 package org.forgerock.opendj.ldap.schema;
@@ -63,14 +64,24 @@
     private Schema schema;
     private SyntaxImpl impl;
 
-    Syntax(final String oid) {
-        super("", Collections.singletonMap("X-SUBST", Collections.singletonList(Schema
+    /**
+     * Creates a syntax representing an unrecognized syntax and whose
+     * implementation is substituted by the schema's default syntax.
+     *
+     * @param schema
+     *            The parent schema.
+     * @param oid
+     *            The numeric OID of the unrecognized syntax.
+     */
+    Syntax(final Schema schema, final String oid) {
+        super("", Collections.singletonMap("X-SUBST", Collections.singletonList(schema
                 .getDefaultSyntax().getOID())));
 
         Validator.ensureNotNull(oid);
         this.oid = oid;
         this.definition = buildDefinition();
-        this.impl = Schema.getDefaultSyntax().impl;
+        this.schema = schema;
+        this.impl = schema.getDefaultSyntax().impl;
     }
 
     Syntax(final String oid, final String description,
@@ -307,10 +318,10 @@
             }
 
             if (impl == null) {
-                impl = Schema.getDefaultSyntax().impl;
-                final LocalizableMessage message =
-                        WARN_ATTR_SYNTAX_NOT_IMPLEMENTED1.get(getDescription(), oid, Schema
-                                .getDefaultSyntax().getOID());
+                impl = schema.getDefaultSyntax().impl;
+                final LocalizableMessage message = WARN_ATTR_SYNTAX_NOT_IMPLEMENTED1
+                        .get(getDescription(), oid, schema.getDefaultSyntax()
+                                .getOID());
                 warnings.add(message);
             }
         }

--
Gitblit v1.10.0