diff --git a/docgen/parameters.json b/docgen/parameters.json
index 94266f1dd..0b71502dc 100644
--- a/docgen/parameters.json
+++ b/docgen/parameters.json
@@ -1,7 +1,7 @@
{
"title" : "Venus (Fugerit Document Generation Framework)",
"name": "Venus",
- "version" : "0.5.2",
+ "version" : "0.5.3",
"date" : "21/11/2022",
"organization" : {
"name" : "Fugerit Org",
diff --git a/docgen/release-notes.txt b/docgen/release-notes.txt
index 1fa263016..cf43d6c25 100644
--- a/docgen/release-notes.txt
+++ b/docgen/release-notes.txt
@@ -1,4 +1,9 @@
-0.5.2 (2022-11-21)
+0.5.3 (2022-11-21)
+------------------
++ fj-doc-base fixed xsd version comparison (before was a normal string comparison)
++ fj-doc-mod-fop Fixed legacy compatibility of FopConfigClassLoader see [0.5.2](https://github.com/fugerit-org/fj-doc/issues/7)
+
+0.5.2 (2022-11-21)
------------------
+ fj-doc-sample semplified. (Reduced to only one test facade.)
+ Introduce new FopPrtTypeHandler config attribute 'fop-config-mode' (previous mode is deprecated) see [0.5.2](https://github.com/fugerit-org/fj-doc/issues/7)
diff --git a/fj-doc-base/pom.xml b/fj-doc-base/pom.xml
index 71abb748d..158b7615f 100644
--- a/fj-doc-base/pom.xml
+++ b/fj-doc-base/pom.xml
@@ -7,7 +7,7 @@
org.fugerit.java
fj-doc
- 0.5.2
+ 0.5.3
fj-doc-base
diff --git a/fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocVersion.java b/fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocVersion.java
new file mode 100644
index 000000000..b22e93857
--- /dev/null
+++ b/fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocVersion.java
@@ -0,0 +1,76 @@
+package org.fugerit.java.doc.base.config;
+
+import java.io.Serializable;
+
+public final class DocVersion implements Serializable, Comparable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8717045616792106442L;
+
+ public static final DocVersion VERSION_1_0 = DocVersion.newVersion( "1-0" );
+ public static final DocVersion VERSION_1_1 = DocVersion.newVersion( "1-1" );
+ public static final DocVersion VERSION_1_2 = DocVersion.newVersion( "1-2" );
+ public static final DocVersion VERSION_1_3 = DocVersion.newVersion( "1-3" );
+ public static final DocVersion VERSION_1_4 = DocVersion.newVersion( "1-4" );
+ public static final DocVersion VERSION_1_5 = DocVersion.newVersion( "1-5" );
+ public static final DocVersion VERSION_1_6 = DocVersion.newVersion( "1-6" );
+ public static final DocVersion VERSION_1_7 = DocVersion.newVersion( "1-7" );
+ public static final DocVersion VERSION_1_8 = DocVersion.newVersion( "1-8" );
+ public static final DocVersion VERSION_1_9 = DocVersion.newVersion( "1-9" );
+ public static final DocVersion VERSION_1_10 = DocVersion.newVersion( "1-10" );
+
+ public static final DocVersion CURRENT_VERSION = VERSION_1_10;
+
+ public static final String VERSION_SEPARATOR ="-";
+
+ private int major;
+
+ private int minor;
+
+ private DocVersion( String version ) {
+ String[] split = version.split( VERSION_SEPARATOR );
+ this.major = Integer.parseInt( split[0] );
+ this.minor = Integer.parseInt( split[1] );
+ }
+
+ public int getMajor() {
+ return major;
+ }
+
+ public int getMinor() {
+ return minor;
+ }
+
+ public String stringVersion() {
+ return this.getMajor()+VERSION_SEPARATOR+this.getMinor();
+ }
+
+ @Override
+ public String toString() {
+ return this.stringVersion();
+ }
+
+ @Override
+ public int compareTo(DocVersion o) {
+ return compare( this , o );
+ }
+
+ public static int compare( String v1, String v2 ) {
+ return compare( newVersion( v1 ) , newVersion( v2 ) );
+ }
+
+ public static int compare( DocVersion v1, DocVersion v2 ) {
+ int res = v1.getMajor() - v2.getMajor();
+ if ( res == 0 ) {
+ res = v1.getMinor() - v2.getMinor();
+ }
+ return res;
+ }
+
+ public static DocVersion newVersion( String version ) {
+ return new DocVersion(version);
+ }
+
+}
diff --git a/fj-doc-base/src/main/java/org/fugerit/java/doc/base/facade/DocFacade.java b/fj-doc-base/src/main/java/org/fugerit/java/doc/base/facade/DocFacade.java
index 91f814db1..fd81dff10 100644
--- a/fj-doc-base/src/main/java/org/fugerit/java/doc/base/facade/DocFacade.java
+++ b/fj-doc-base/src/main/java/org/fugerit/java/doc/base/facade/DocFacade.java
@@ -43,6 +43,7 @@ The Apache Software Foundation (http://www.apache.org/).
import org.fugerit.java.core.xml.sax.XMLValidatorSAX;
import org.fugerit.java.core.xml.sax.dh.DefaultHandlerComp;
import org.fugerit.java.core.xml.sax.er.ByteArrayEntityResolver;
+import org.fugerit.java.doc.base.config.DocVersion;
import org.fugerit.java.doc.base.model.DocBase;
import org.fugerit.java.doc.base.model.DocContainer;
import org.fugerit.java.doc.base.model.DocElement;
@@ -60,7 +61,7 @@ The Apache Software Foundation (http://www.apache.org/).
*/
public class DocFacade {
- public static final String CURRENT_VERSION = "1-10";
+ public static final String CURRENT_VERSION = DocVersion.CURRENT_VERSION.stringVersion();
private static Logger logger = LoggerFactory.getLogger( DocFacade.class );
@@ -146,8 +147,12 @@ public static DocBase parse( Reader is, DocHelper docHelper, Properties params )
DocBase docBase = dch.getDocBase();
is.close();
String xsdVersion = docBase.getXsdVersion();
- if ( StringUtils.isNotEmpty( xsdVersion ) && xsdVersion.compareTo( CURRENT_VERSION ) > 0 ) {
- logger.warn( "Document version {} is higher than maximum version supported by this release od fj-doc {}, some feature may be not supported.", xsdVersion, CURRENT_VERSION );
+ try {
+ if ( StringUtils.isNotEmpty( xsdVersion ) && DocVersion.compare( xsdVersion, CURRENT_VERSION ) > 0 ) {
+ logger.warn( "Document version {} is higher than maximum version supported by this release od fj-doc {}, some feature may be not supported.", xsdVersion, CURRENT_VERSION );
+ }
+ } catch (Exception e) {
+ logger.warn( "Failed to check xsd version : {} (current version: {})", xsdVersion, CURRENT_VERSION );
}
return docBase;
}
diff --git a/fj-doc-base/src/test/java/test/org/fugerit/java/doc/base/config/TestDocVersion.java b/fj-doc-base/src/test/java/test/org/fugerit/java/doc/base/config/TestDocVersion.java
new file mode 100644
index 000000000..3392d46c7
--- /dev/null
+++ b/fj-doc-base/src/test/java/test/org/fugerit/java/doc/base/config/TestDocVersion.java
@@ -0,0 +1,51 @@
+package test.org.fugerit.java.doc.base.config;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.fugerit.java.doc.base.config.DocVersion;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestDocVersion {
+
+ private static final Logger logger = LoggerFactory.getLogger( TestDocVersion.class );
+
+ private void testCompareWorker( int expected, DocVersion v1, DocVersion v2 ) {
+ int result = DocVersion.compare( v1, v2 );
+ logger.info( "Test compare {} to {} , expected:{}, result:{}", v1, v2, expected, result );
+ Assert.assertEquals( "Wrong compare result", expected, result );
+ }
+
+ @Test
+ public void testCompareMajorThan01() {
+ this.testCompareWorker( 9, DocVersion.VERSION_1_10, DocVersion.VERSION_1_1 );
+ }
+
+ @Test
+ public void testCompareMinorThan01() {
+ this.testCompareWorker( -2, DocVersion.VERSION_1_1, DocVersion.VERSION_1_3 );
+ }
+
+ @Test
+ public void testCompareEqual01() {
+ this.testCompareWorker( 0, DocVersion.VERSION_1_5, DocVersion.VERSION_1_5 );
+ }
+
+ @Test
+ public void testSort() {
+ List list = new ArrayList();
+ list.add( DocVersion.VERSION_1_8 );
+ list.add( DocVersion.VERSION_1_2 );
+ list.add( DocVersion.VERSION_1_10 );
+ list.add( DocVersion.VERSION_1_9 );
+ logger.info( "list pre sort : {}", list );
+ Collections.sort( list );
+ logger.info( "list post sort : {}", list );
+ Assert.assertEquals( "Version list sort", "[1-2, 1-8, 1-9, 1-10]", String.valueOf( list ) );
+ }
+
+}
diff --git a/fj-doc-base/src/test/resources/log4j2.xml b/fj-doc-base/src/test/resources/log4j2.xml
new file mode 100644
index 000000000..51b9129fc
--- /dev/null
+++ b/fj-doc-base/src/test/resources/log4j2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fj-doc-freemarker/pom.xml b/fj-doc-freemarker/pom.xml
index db7a229d3..e29ebae4a 100644
--- a/fj-doc-freemarker/pom.xml
+++ b/fj-doc-freemarker/pom.xml
@@ -7,7 +7,7 @@
org.fugerit.java
fj-doc
- 0.5.2
+ 0.5.3
fj-doc-freemarker
diff --git a/fj-doc-mod-fop/pom.xml b/fj-doc-mod-fop/pom.xml
index f511ed51b..b3285e292 100644
--- a/fj-doc-mod-fop/pom.xml
+++ b/fj-doc-mod-fop/pom.xml
@@ -7,7 +7,7 @@
org.fugerit.java
fj-doc
- 0.5.2
+ 0.5.3
fj-doc-mod-fop
diff --git a/fj-doc-mod-poi/pom.xml b/fj-doc-mod-poi/pom.xml
index 553e26861..aac4437b1 100644
--- a/fj-doc-mod-poi/pom.xml
+++ b/fj-doc-mod-poi/pom.xml
@@ -7,7 +7,7 @@
org.fugerit.java
fj-doc
- 0.5.2
+ 0.5.3
fj-doc-mod-poi
diff --git a/fj-doc-sample/pom.xml b/fj-doc-sample/pom.xml
index fb11a552d..c4ed2f254 100644
--- a/fj-doc-sample/pom.xml
+++ b/fj-doc-sample/pom.xml
@@ -7,7 +7,7 @@
org.fugerit.java
fj-doc
- 0.5.2
+ 0.5.3
fj-doc-sample
diff --git a/pom.xml b/pom.xml
index 5cddd0c72..4261ca2a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
fj-doc
- 0.5.2
+ 0.5.3
pom
fj-doc