You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/01/08 20:29:26 UTC

svn commit: r1650361 - in /directory/shared/trunk/ldap/schema/converter/src: main/java/org/apache/directory/api/ldap/schema/converter/ test/java/org/apache/directory/api/ldap/schema/converter/ test/resources/org/apache/directory/api/ldap/schema/converter/

Author: elecharny
Date: Thu Jan  8 19:29:26 2015
New Revision: 1650361

URL: http://svn.apache.org/r1650361
Log:
Propagated the antlr error message

Added:
    directory/shared/trunk/ldap/schema/converter/src/test/resources/org/apache/directory/api/ldap/schema/converter/testWrongLdif.schema
Modified:
    directory/shared/trunk/ldap/schema/converter/src/main/java/org/apache/directory/api/ldap/schema/converter/SchemaToLdif.java
    directory/shared/trunk/ldap/schema/converter/src/test/java/org/apache/directory/api/ldap/schema/converter/TestSchemaToLdif.java

Modified: directory/shared/trunk/ldap/schema/converter/src/main/java/org/apache/directory/api/ldap/schema/converter/SchemaToLdif.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/converter/src/main/java/org/apache/directory/api/ldap/schema/converter/SchemaToLdif.java?rev=1650361&r1=1650360&r2=1650361&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/converter/src/main/java/org/apache/directory/api/ldap/schema/converter/SchemaToLdif.java (original)
+++ directory/shared/trunk/ldap/schema/converter/src/main/java/org/apache/directory/api/ldap/schema/converter/SchemaToLdif.java Thu Jan  8 19:29:26 2015
@@ -20,14 +20,14 @@
 package org.apache.directory.api.ldap.schema.converter;
 
 
-import org.apache.directory.api.i18n.I18n;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.InputStream;
 import java.io.Writer;
 import java.util.List;
 
+import org.apache.directory.api.i18n.I18n;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 
 /**
  * A class used to translate a OpenLdap schema file to a Ldif file compatible
@@ -105,7 +105,8 @@ public final class SchemaToLdif
             }
             catch ( Exception e )
             {
-                throw new ParserException( I18n.err( I18n.ERR_06004_CANNOT_GENERATE_SOURCES, schema.getName() ) );
+                throw new ParserException( I18n.err( I18n.ERR_06004_CANNOT_GENERATE_SOURCES, schema.getName(),
+                    e.getMessage() ) );
             }
         }
     }

Modified: directory/shared/trunk/ldap/schema/converter/src/test/java/org/apache/directory/api/ldap/schema/converter/TestSchemaToLdif.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/converter/src/test/java/org/apache/directory/api/ldap/schema/converter/TestSchemaToLdif.java?rev=1650361&r1=1650360&r2=1650361&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/converter/src/test/java/org/apache/directory/api/ldap/schema/converter/TestSchemaToLdif.java (original)
+++ directory/shared/trunk/ldap/schema/converter/src/test/java/org/apache/directory/api/ldap/schema/converter/TestSchemaToLdif.java Thu Jan  8 19:29:26 2015
@@ -28,15 +28,12 @@ import java.io.Writer;
 import java.util.ArrayList;
 import java.util.List;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
-import org.apache.directory.api.ldap.schema.converter.ParserException;
-import org.apache.directory.api.ldap.schema.converter.Schema;
-import org.apache.directory.api.ldap.schema.converter.SchemaToLdif;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
@@ -886,4 +883,10 @@ public class TestSchemaToLdif
         assertEquals( expected, transform( "testMozillaATWithOidLen" ) );
     }
 
+
+    @Test(expected = ParserException.class)
+    public void testConvertWrongLdif() throws ParserException, IOException
+    {
+        transform( "testWrongLdif" );
+    }
 }

Added: directory/shared/trunk/ldap/schema/converter/src/test/resources/org/apache/directory/api/ldap/schema/converter/testWrongLdif.schema
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/converter/src/test/resources/org/apache/directory/api/ldap/schema/converter/testWrongLdif.schema?rev=1650361&view=auto
==============================================================================
--- directory/shared/trunk/ldap/schema/converter/src/test/resources/org/apache/directory/api/ldap/schema/converter/testWrongLdif.schema (added)
+++ directory/shared/trunk/ldap/schema/converter/src/test/resources/org/apache/directory/api/ldap/schema/converter/testWrongLdif.schema Thu Jan  8 19:29:26 2015
@@ -0,0 +1,20 @@
+#############################################################################
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You under the Apache License, Version 2.0
+#    (the "License"); you may not use this file except in compliance with
+#    the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#############################################################################
+attributetype ( 1.3.6.1.4.1.13769.3.2 NAME 'mozillaHomeStreet2'
+         EQUALITY caseIgnoreMatch
+         SUBSTR caseIgnoreSubstringsMatch
+         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} SINGLE-VALUE
\ No newline at end of file