You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2022/04/18 13:04:46 UTC

[maven-doxia-converter] branch drop-sinks created (now a1946b3)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch drop-sinks
in repository https://gitbox.apache.org/repos/asf/maven-doxia-converter.git


      at a1946b3  drop not supported source/sinks

This branch includes the following new commits:

     new 8feeb2c  refactoring
     new a1946b3  drop not supported source/sinks

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-doxia-converter] 02/02: drop not supported source/sinks

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch drop-sinks
in repository https://gitbox.apache.org/repos/asf/maven-doxia-converter.git

commit a1946b320a550fd315904dbc8fee3179b0e1bff4
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Mon Apr 18 15:04:06 2022 +0200

    drop not supported source/sinks
---
 .../org/apache/maven/doxia/DefaultConverter.java   |  50 +------
 .../java/org/apache/maven/doxia/ConverterTest.java | 126 -----------------
 src/test/resources/unit/confluence/test.confluence |  98 -------------
 src/test/resources/unit/docbook/test.xml           | 153 ---------------------
 src/test/resources/unit/twiki/test.twiki           | 109 ---------------
 5 files changed, 3 insertions(+), 533 deletions(-)

diff --git a/src/main/java/org/apache/maven/doxia/DefaultConverter.java b/src/main/java/org/apache/maven/doxia/DefaultConverter.java
index 0991900..e6330a4 100644
--- a/src/main/java/org/apache/maven/doxia/DefaultConverter.java
+++ b/src/main/java/org/apache/maven/doxia/DefaultConverter.java
@@ -76,14 +76,8 @@ public class DefaultConverter
 {
     private static final String APT_PARSER = "apt";
 
-    private static final String CONFLUENCE_PARSER = "confluence";
-
-    private static final String DOCBOOK_PARSER = "docbook";
-
     private static final String FML_PARSER = "fml";
 
-    private static final String TWIKI_PARSER = "twiki";
-
     private static final String XDOC_PARSER = "xdoc";
 
     private static final String XHTML_PARSER = "xhtml";
@@ -92,25 +86,10 @@ public class DefaultConverter
 
     /** Supported input format, i.e. supported Doxia parser */
     public static final List<String> SUPPORTED_FROM_FORMAT =
-            Arrays.asList(APT_PARSER, CONFLUENCE_PARSER, DOCBOOK_PARSER, FML_PARSER, TWIKI_PARSER, XDOC_PARSER, XHTML_PARSER,
-                XHTML5_PARSER);
+            Arrays.asList(APT_PARSER, FML_PARSER, XDOC_PARSER, XHTML_PARSER, XHTML5_PARSER);
 
     private static final String APT_SINK = "apt";
 
-    private static final String CONFLUENCE_SINK = "confluence";
-
-    private static final String DOCBOOK_SINK = "docbook";
-
-    private static final String FO_SINK = "fo";
-
-    private static final String ITEXT_SINK = "itext";
-
-    private static final String LATEX_SINK = "latex";
-
-    private static final String RTF_SINK = "rtf";
-
-    private static final String TWIKI_SINK = "twiki";
-
     private static final String XDOC_SINK = "xdoc";
 
     private static final String XHTML_SINK = "xhtml";
@@ -119,8 +98,7 @@ public class DefaultConverter
 
     /** Supported output format, i.e. supported Doxia Sink */
     public static final List<String> SUPPORTED_TO_FORMAT =
-        Arrays.asList( APT_SINK, CONFLUENCE_SINK, DOCBOOK_SINK, FO_SINK, ITEXT_SINK, LATEX_SINK, RTF_SINK, TWIKI_SINK, XDOC_SINK,
-            XHTML_SINK, XHTML5_SINK) ;
+            Arrays.asList( APT_SINK, XDOC_SINK, XHTML_SINK, XHTML5_SINK) ;
 
     /** Flag to format the generated files, actually only for XML based sinks. */
     private boolean formatOutput;
@@ -435,17 +413,9 @@ public class DefaultConverter
 
         parse( parser, reader, sink );
 
-        if ( formatOutput && ( DOCBOOK_SINK.equals( output.getFormat() ) || FO_SINK.equals( output.getFormat() )
-            || ITEXT_SINK.equals( output.getFormat() ) || XDOC_SINK.equals( output.getFormat() )
+        if ( formatOutput && ( XDOC_SINK.equals( output.getFormat() )
             || XHTML_SINK.equals( output.getFormat() ) || XHTML5_SINK.equals( output.getFormat() ) ) )
         {
-            // format all xml files excluding docbook which is buggy
-            // TODO Add doc book format
-            if ( DOCBOOK_SINK.equals( output.getFormat() ) || DOCBOOK_PARSER.equals( inputFormat ) )
-            {
-                return;
-            }
-            
             try ( Reader r = ReaderFactory.newXmlReader( outputFile );
                   Writer w = WriterFactory.newXmlWriter( outputFile ) )
             {
@@ -591,16 +561,6 @@ public class DefaultConverter
             {
                 return supportedFromFormat;
             }
-            else if ( CONFLUENCE_PARSER.equalsIgnoreCase( supportedFromFormat ) && isDoxiaFileName( f,
-                    supportedFromFormat ) )
-            {
-                return supportedFromFormat;
-            }
-            else if ( TWIKI_PARSER.equalsIgnoreCase( supportedFromFormat ) && isDoxiaFileName( f,
-                    supportedFromFormat ) )
-            {
-                return supportedFromFormat;
-            }
 
             // Handle Doxia xml files
             String firstTag = getFirstTag( f );
@@ -609,10 +569,6 @@ public class DefaultConverter
                 //noinspection UnnecessaryContinue
                 continue;
             }
-            else if ( "article".equals( firstTag ) && DOCBOOK_PARSER.equalsIgnoreCase( supportedFromFormat ) )
-            {
-                return supportedFromFormat;
-            }
             else if ( "faqs".equals( firstTag ) && FML_PARSER.equalsIgnoreCase( supportedFromFormat ) )
             {
                 return supportedFromFormat;
diff --git a/src/test/java/org/apache/maven/doxia/ConverterTest.java b/src/test/java/org/apache/maven/doxia/ConverterTest.java
index fc380f0..d1cc8ce 100644
--- a/src/test/java/org/apache/maven/doxia/ConverterTest.java
+++ b/src/test/java/org/apache/maven/doxia/ConverterTest.java
@@ -179,42 +179,6 @@ public class ConverterTest
         assertTrue( new File( out ).length() != 0 );
     }
 
-    /**
-     * Input confluence file / output file
-     *
-     * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
-     * @throws Exception if any
-     */
-    public void testConfluenceFileConverter()
-        throws Exception
-    {
-        String in = getBasedir() + "/src/test/resources/unit/confluence/test.confluence";
-        String from = "confluence";
-        String out = getBasedir() + "/target/unit/file/confluence/test.confluence.xhtml";
-        String to = "xhtml";
-
-        InputFileWrapper input =
-            InputFileWrapper.valueOf( in, from, ReaderFactory.UTF_8, converter.getInputFormats() );
-        OutputFileWrapper output =
-            OutputFileWrapper.valueOf( out, to, WriterFactory.UTF_8, converter.getOutputFormats() );
-
-        converter.setFormatOutput( formatOutput );
-        converter.convert( input, output );
-        assertTrue( new File( out ).exists() );
-        assertTrue( new File( out ).length() != 0 );
-
-        in = getBasedir() + "/target/unit/file/confluence/test.confluence.xhtml";
-        from = "xhtml";
-        out = getBasedir() + "/target/unit/file/confluence/test.confluence";
-        to = "confluence";
-
-        input = InputFileWrapper.valueOf( in, from, ReaderFactory.UTF_8, converter.getInputFormats() );
-        output = OutputFileWrapper.valueOf( out, to, WriterFactory.UTF_8, converter.getOutputFormats() );
-
-        converter.setFormatOutput( formatOutput );
-        converter.convert( input, output );
-    }
-
     /**
      * Input docbook file / output file
      *
@@ -297,53 +261,6 @@ public class ConverterTest
         }
     }
 
-    /**
-     * Input twiki file / output file
-     *
-     * @see Converter#convert(InputFileWrapper, OutputFileWrapper)
-     * @throws Exception if any
-     */
-    public void testTwikiFileConverter()
-        throws Exception
-    {
-        String in = getBasedir() + "/src/test/resources/unit/twiki/test.twiki";
-        String from = "twiki";
-        String out = getBasedir() + "/target/unit/file/twiki/test.twiki.xhtml";
-        String to = "xhtml";
-
-        InputFileWrapper input =
-            InputFileWrapper.valueOf( in, from, ReaderFactory.UTF_8, converter.getInputFormats() );
-        OutputFileWrapper output =
-            OutputFileWrapper.valueOf( out, to, WriterFactory.UTF_8, converter.getOutputFormats() );
-
-        converter.setFormatOutput( formatOutput );
-        converter.convert( input, output );
-        assertTrue( new File( out ).exists() );
-        assertTrue( new File( out ).length() != 0 );
-
-        in = getBasedir() + "/target/unit/file/twiki/test.twiki.xhtml";
-        from = "xhtml";
-        out = getBasedir() + "/target/unit/file/twiki/test.twiki";
-        to = "twiki";
-
-        input = InputFileWrapper.valueOf( in, from, ReaderFactory.UTF_8, converter.getInputFormats() );
-        output = OutputFileWrapper.valueOf( out, to, WriterFactory.UTF_8, converter.getOutputFormats() );
-
-        converter.setFormatOutput( formatOutput );
-        try
-        {
-            converter.convert( input, output );
-        }
-        catch ( ConverterException e )
-        {
-            // The TWiki parser is wrong for *  <pre>some text</pre>
-            if ( !e.getMessage().contains( "Error validating the model" ) )
-            {
-                throw e;
-            }
-        }
-    }
-
     /**
      * Input xdoc file / output dir
      *
@@ -494,43 +411,6 @@ public class ConverterTest
         assertTrue( outFile.length() != 0 );
     }
 
-    /**
-     * Input confluence reader / output writer
-     *
-     * @see Converter#convert(InputReaderWrapper, OutputStreamWrapper)
-     * @throws Exception if any
-     */
-    public void testConfluenceWriterConverter()
-        throws Exception
-    {
-        String in = getBasedir() + "/src/test/resources/unit/confluence/test.confluence";
-        String from = "confluence";
-        String out = getBasedir() + "/target/unit/writer/confluence/test.confluence.xhtml";
-        String to = "xhtml";
-
-        File inFile = new File( in );
-        File outFile = new File( out );
-        outFile.getParentFile().mkdirs();
-
-        try ( OutputStream fo = new FileOutputStream( outFile ) )
-        {
-            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-
-            InputReaderWrapper input = InputReaderWrapper.valueOf( new FileReader( inFile ), from,
-                    converter.getInputFormats() );
-            OutputStreamWrapper output = OutputStreamWrapper.valueOf( outputStream, to, "UTF-8",
-                    converter.getOutputFormats() );
-
-            converter.setFormatOutput( formatOutput );
-            converter.convert( input, output );
-
-            IOUtil.copy( outputStream.toByteArray(), fo );
-        }
-
-        assertTrue( outFile.exists() );
-        assertTrue( outFile.length() != 0 );
-    }
-
     /**
      * Input xdoc (autodetect) reader / output writer
      *
@@ -662,10 +542,7 @@ public class ConverterTest
     public void testAutodetectEncoding()
     {
         assertEquals( "ISO-8859-1", autoDetectEncoding( "apt/test.apt" ) );
-        assertEquals( "ISO-8859-1", autoDetectEncoding( "confluence/test.confluence" ) );
-        assertEquals( "UTF-8", autoDetectEncoding( "docbook/test.xml" ) );
         assertEquals( "UTF-8", autoDetectEncoding( "fml/test.fml" ) ); // plexus-utils should detect ISO-8859-1
-        assertEquals( "ISO-8859-1", autoDetectEncoding( "twiki/test.twiki" ) );
         assertEquals( "UTF-8", autoDetectEncoding( "xhtml/test.xhtml" ) );
     }
 
@@ -697,10 +574,7 @@ public class ConverterTest
             assertTrue( true );
         }
 
-        assertEquals( autoDetectFormat( "confluence/test.confluence", "UTF-8" ), "confluence" );
-        assertEquals( autoDetectFormat( "docbook/test.xml", "UTF-8" ), "docbook" );
         assertEquals( autoDetectFormat( "fml/test.fml", "UTF-8" ), "fml" );
-        assertEquals( autoDetectFormat( "twiki/test.twiki", "UTF-8" ), "twiki" );
         assertEquals( autoDetectFormat( "xhtml/test.xhtml", "UTF-8" ), "xhtml" );
     }
 }
diff --git a/src/test/resources/unit/confluence/test.confluence b/src/test/resources/unit/confluence/test.confluence
deleted file mode 100644
index 71d3d10..0000000
--- a/src/test/resources/unit/confluence/test.confluence
+++ /dev/null
@@ -1,98 +0,0 @@
-This the way that we would like to *translate* sites that are primarily
-authored in confluence while at the same time having the site be rendered in
-a _standard way on a static website_.
-
-----
-
-Here is a link to [JIRA|http://jira.codehaus.org]
-
-Here is a link with no text [http://jira.codehaus.org]
-
-This is some {{monospaced}} text.
-
-* item one
-** foo
-** bar
-* item two
-* item three
-
-Some more text
-
-# number one
-# number two
-# number three
-
-||one||two||three||
-|foo|bar|baz|
-
-h1. I am h1
-
-this is how you would code a mojo!
-
-{code}
-public class MyMojo
-    extends AbstractMojo
-{
-    /**
-     * @parameter expression="${plugin.artifacts}"
-     * @required
-     */
-    private List pluginArtifacts;
-
-    public void execute()
-        throws MojoExecutionException
-    {
-        ...
-        for ( Iterator i = pluginArtifacts.iterator(); i.hasNext(); )
-        {
-            Artifact pluginArtifact = (Artifact) i.next();
-        }
-        ...
-    }
-}
-{code}
-
-h2. I am h2
-
-this is the way of the world
-
-{noformat}
-public class MyMojo
-    extends AbstractMojo
-{
-    /**
-     * @parameter expression="${plugin.artifacts}"
-     * @required
-     */
-    private List pluginArtifacts;
-
-    public void execute()
-        throws MojoExecutionException
-    {
-        ...
-        for ( Iterator i = pluginArtifacts.iterator(); i.hasNext(); )
-        {
-            Artifact pluginArtifact = (Artifact) i.next();
-        }
-        ...
-    }
-}
-{noformat}
-
-h3. I am h3
-
-this is the way of the world
-
-h4. I am h4
-
-this is the way of the world
-
-h5. I am h5
-
-this is the way of the world
-
-h1. Answered Questions
-
-h3. What can I do to get the Maven love?
-
-Well, you just have to be calm and the maven love will come your way.
diff --git a/src/test/resources/unit/docbook/test.xml b/src/test/resources/unit/docbook/test.xml
deleted file mode 100644
index cd73649..0000000
--- a/src/test/resources/unit/docbook/test.xml
+++ /dev/null
@@ -1,153 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!--
-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.
--->
-
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.1//EN"
-  "http://www.oasis-open.org/docbook/xml/simple/1.1/sdocbook.dtd">
-
-<article id="index">
-  <articleinfo>
-    <title>Geotools2 Developer Guide</title>
-
-    <author>
-      <firstname>Cameron</firstname>
-
-      <surname>Shorter</surname>
-    </author>
-
-    <date>22 May 2002</date>
-
-    <abstract>
-      <para>Guide to aid <filename>geotools2</filename> development.</para>
-    </abstract>
-  </articleinfo>
-
-  <section id="intro">
-    <title>Introduction</title>
-
-    <para>This document aims to help new geotools developers get up to speed
-    and track practices of existing developers in order to keep the project
-    consistent.</para>
-
-    <para>If you feel something is missing, feel free to contribute a new
-    section.</para>
-  </section>
-
-  <section id="design">
-    <title>Design</title>
-    <figure>
-        <title>Geotools Logo</title>
-        <mediaobject>
-            <imageobject>
-                <imagedata fileref="images/developersguide/geotools_logo.png"
-                    format="PNG"/>
-                </imageobject>
-            <textobject><phrase>Geotools Logo</phrase></textobject>
-        </mediaobject>
-    </figure>
-
-    <para>To do: Explain</para><itemizedlist><listitem><para>Key design structure
-    (core interfaces, data sources, rendering, tools)</para></listitem><listitem><para>Design
-    Drivers (Our design goals: modular, derives structure from netbeans,
-    support multiple version of java, ..)</para></listitem><listitem><para>Directory
-    structure</para></listitem><listitem><para></para></listitem></itemizedlist>
-  </section>
-
-  <section id="development">
-    <title>Development</title>
-
-    <section id="building">
-      <title>Building</title>
-
-      <para>To do:</para><itemizedlist><listitem><para>using ant</para></listitem><listitem><para>what
-      ant checks</para></listitem><listitem><para>insert the
-      &#34;howto-build.html&#34; doc into here</para></listitem><listitem><para></para></listitem></itemizedlist>
-    </section>
-
-    <section id="cvs">
-      <title>Code Versioning (using CVS)</title>
-
-      <para>To do:</para><itemizedlist><listitem><para>Point to sourceforge CVS howto
-      links.</para></listitem><listitem><para>Also point to some HOWTOs for
-      windows users.</para></listitem><listitem><para>What is acceptable to
-      commit to CVS, what is not. (Ie, code should compile)</para></listitem><listitem><para>Talk
-      about version numbering convention, use of branches, etc (if we decide
-      to do this).</para></listitem></itemizedlist>
-
-      <para>To do:</para>
-    </section>
-
-    <section id="CodingStandards">
-      <title>Coding Standards</title>
-
-      <para>To do:</para><itemizedlist><listitem><para>Using Sun&#39;s coding
-      standard, need to note any exceptions to it.</para></listitem><listitem><para>Note
-      the auto checking of coding standards.</para></listitem><listitem><para>Javadocs</para></listitem><listitem><para></para></listitem></itemizedlist>
-    </section>
-
-    <section id="templates">
-      <title>Template File</title>
-
-      <para>To do:</para><itemizedlist><listitem><para>Provide a template file.</para></listitem><listitem><para>Link
-      it to sections explaining the different parts of the template.</para></listitem><listitem><para>Include
-      headers, footers, example logging, example coding style, CVS key tags,
-      sample javadocs.</para></listitem><listitem><para></para></listitem></itemizedlist>
-    </section>
-
-    <section id="logging">
-      <title>Logging</title>
-
-      <para>To do:</para><itemizedlist><listitem><para>Talk about log4j, links to</para></listitem><listitem><para></para></listitem><listitem><para></para></listitem><listitem><para></para></listitem></itemizedlist>
-    </section>
-
-    <section id="testing">
-      <title>Testing</title>
-
-      <para>To do:</para><itemizedlist><listitem><para>Explain use of junit. Might be
-      a link to another web site.</para></listitem><listitem><para></para></listitem><listitem><para></para></listitem><listitem><para></para></listitem></itemizedlist>
-    </section>
-
-    <section>
-      <title>Documentation</title>
-
-      <para>To do:</para><itemizedlist><listitem><para>Talk about docbook, why we
-      decided to use it (most commonly used format of LDP, converts to
-      multiple formats, tools coming which can support it. Need to mention
-      which version of docbook we are using.</para></listitem><listitem><para>Mention
-      tools that can be used.</para></listitem><listitem><para>Links to
-      docbook references.</para></listitem><listitem><para>Process for
-      updating this document.</para></listitem><listitem><para>How to use ant
-      tools to build doc.</para></listitem></itemizedlist>
-    </section>
-  </section>
-
-  <section id="tools">
-    <title>Development Tools</title>
-
-    <section id="netbeans">
-      <title>Netbeans</title>
-
-      <para>To do:</para><itemizedlist><listitem><para>Where to get it.</para></listitem><listitem><para>Aim
-      is to make geotools a module within Netbeans</para></listitem><listitem><para>How
-      to setup getools to fit the multiple directory structure</para></listitem><listitem><para>The
-      extra Netbeans modules that are useful and should be downloaded.</para></listitem></itemizedlist>
-    </section>
-  </section>
-</article>
-
diff --git a/src/test/resources/unit/twiki/test.twiki b/src/test/resources/unit/twiki/test.twiki
deleted file mode 100644
index d64d7ed..0000000
--- a/src/test/resources/unit/twiki/test.twiki
+++ /dev/null
@@ -1,109 +0,0 @@
----+ Twiki Java Parser
-
----++ Features
-
-This parser of the [[http://www.twiki.org][TWiki]] text format supports most
-of http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules formatting commands.
-
----+++ General
-
-   * Paragraps,
-   * Wiki Words
-      * WikiWord
-      * Web.WikiWord#anchor,  
-      * escaped: !WikiWord
-   * Forced Links:
-      * [[wiki word]]
-      * escaped ![[wiki word]]
-   * Specific links: 
-      * [[http://www.zauber.com.ar][Zauber]],
-      * prevention: ![[http://www.zauber.com.ar][Forced links]]
-   * Anchors: [[#AnchorEnd][End]]
-   * inline urls:
-      * http://twiki.org/
-   * mailto link:
-      * [[mailto:a@z.com Mail]]
-      * [[mailto:?subject=Hi Hi]]
-
----+++ Text Format:
-
-   * *bold*
-   * _italic_
-   * __bold italic__
-   * =Fixedfont=
-   * ==Bold fixed==
-
-And nested formats like:
-   * *bold with _italic_ and some =fixed= and bold*
-Make sure there is no space between the text and the bold, italic, or other
-indicators (* _ __ = ==).
-
----+++ Lists
-
-   * items
-      * nested items
-      * ordered list
-         * arabic numerals
-            1. item
-            1. item
-            1. ...
-         * uppercase letters
-            A. item
-            A. item
-            A. ...
-         * lowercase letters
-            a. item
-            a. item
-            a. ...
-         * uppercase roman numerals
-            A. item
-            A. item
-            A. ....
-         * Uppercase Roman Numerals
-            I. item
-            I. item
-            I. ...
-         * Lowercase Roman Numerals
-            i. item
-            i. item
-            i. ....
-
----+++ Separators
-
-Up
----------------------------
-Down
-
----+++ Table
-
- | *A* | *B* | *C* |
- | Foo | bar | Foo |
- | Bar | Foo | bar |
- | Foo | bar | Foo |
-
----++ Missing things
----+++ Verbating Mode
-<verbatim>
-class CatAnimal {
-  void purr() {
-      <code here>
-}
-</verbatim>
-
----+++ Definition List
-(i don't use it)
-   $ Sushi: Japan
-      $ Dim Sum: S.F.
-   $ Asado: Argentina
-
----+++ Diable Links
-
-<noautolink>
-   RedHat &
-  SuSE
-</noautolink>
-   
----+++ Html
-    *  <pre>some text</pre>
-
-#EndAnchor


[maven-doxia-converter] 01/02: refactoring

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch drop-sinks
in repository https://gitbox.apache.org/repos/asf/maven-doxia-converter.git

commit 8feeb2cf9a31460993173ed1b8f30e0e13d1adaa
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Mon Apr 18 12:28:50 2022 +0200

    refactoring
---
 .../java/org/apache/maven/doxia/Converter.java     |  6 +++--
 .../org/apache/maven/doxia/DefaultConverter.java   | 26 ++++++++++------------
 .../maven/doxia/UnsupportedFormatException.java    |  6 +++--
 .../org/apache/maven/doxia/cli/CLIManager.java     |  4 ++--
 .../org/apache/maven/doxia/util/ConverterUtil.java |  5 +++--
 .../maven/doxia/wrapper/AbstractFileWrapper.java   |  3 ++-
 .../maven/doxia/wrapper/AbstractWrapper.java       | 11 ++++-----
 .../maven/doxia/wrapper/InputFileWrapper.java      |  7 +++---
 .../maven/doxia/wrapper/InputReaderWrapper.java    |  5 +++--
 .../maven/doxia/wrapper/OutputFileWrapper.java     |  7 +++---
 .../maven/doxia/wrapper/OutputStreamWrapper.java   |  5 +++--
 11 files changed, 47 insertions(+), 38 deletions(-)

diff --git a/src/main/java/org/apache/maven/doxia/Converter.java b/src/main/java/org/apache/maven/doxia/Converter.java
index 3c625e4..8bc3245 100644
--- a/src/main/java/org/apache/maven/doxia/Converter.java
+++ b/src/main/java/org/apache/maven/doxia/Converter.java
@@ -25,6 +25,8 @@ import org.apache.maven.doxia.wrapper.InputReaderWrapper;
 import org.apache.maven.doxia.wrapper.OutputFileWrapper;
 import org.apache.maven.doxia.wrapper.OutputStreamWrapper;
 
+import java.util.List;
+
 /**
  * Interface to convert a Doxia input wrapper to a Doxia output wrapper.
  *
@@ -36,12 +38,12 @@ public interface Converter
     /**
      * @return a not null array containing supported input formats, i.e. <code>apt</code>.
      */
-    String[] getInputFormats();
+    List<String> getInputFormats();
 
     /**
      * @return a not null array containing supported output formats, i.e. <code>xhtml</code>.
      */
-    String[] getOutputFormats();
+    List<String> getOutputFormats();
 
     /**
      * @param input an input file wrapper, not null.
diff --git a/src/main/java/org/apache/maven/doxia/DefaultConverter.java b/src/main/java/org/apache/maven/doxia/DefaultConverter.java
index e6b7223..0991900 100644
--- a/src/main/java/org/apache/maven/doxia/DefaultConverter.java
+++ b/src/main/java/org/apache/maven/doxia/DefaultConverter.java
@@ -29,11 +29,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -95,9 +91,9 @@ public class DefaultConverter
     private static final String XHTML5_PARSER = "xhtml5";
 
     /** Supported input format, i.e. supported Doxia parser */
-    public static final String[] SUPPORTED_FROM_FORMAT =
-        { APT_PARSER, CONFLUENCE_PARSER, DOCBOOK_PARSER, FML_PARSER, TWIKI_PARSER, XDOC_PARSER, XHTML_PARSER,
-                XHTML5_PARSER};
+    public static final List<String> SUPPORTED_FROM_FORMAT =
+            Arrays.asList(APT_PARSER, CONFLUENCE_PARSER, DOCBOOK_PARSER, FML_PARSER, TWIKI_PARSER, XDOC_PARSER, XHTML_PARSER,
+                XHTML5_PARSER);
 
     private static final String APT_SINK = "apt";
 
@@ -122,9 +118,9 @@ public class DefaultConverter
     private static final String XHTML5_SINK = "xhtml5";
 
     /** Supported output format, i.e. supported Doxia Sink */
-    public static final String[] SUPPORTED_TO_FORMAT =
-        { APT_SINK, CONFLUENCE_SINK, DOCBOOK_SINK, FO_SINK, ITEXT_SINK, LATEX_SINK, RTF_SINK, TWIKI_SINK, XDOC_SINK,
-            XHTML_SINK, XHTML5_SINK };
+    public static final List<String> SUPPORTED_TO_FORMAT =
+        Arrays.asList( APT_SINK, CONFLUENCE_SINK, DOCBOOK_SINK, FO_SINK, ITEXT_SINK, LATEX_SINK, RTF_SINK, TWIKI_SINK, XDOC_SINK,
+            XHTML_SINK, XHTML5_SINK) ;
 
     /** Flag to format the generated files, actually only for XML based sinks. */
     private boolean formatOutput;
@@ -160,14 +156,16 @@ public class DefaultConverter
 
     /** {@inheritDoc} */
     @Override
-    public String[] getInputFormats()
+    public List<String> getInputFormats()
     {
         return SUPPORTED_FROM_FORMAT;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public String[] getOutputFormats()
+    public List<String> getOutputFormats()
     {
         return SUPPORTED_TO_FORMAT;
     }
diff --git a/src/main/java/org/apache/maven/doxia/UnsupportedFormatException.java b/src/main/java/org/apache/maven/doxia/UnsupportedFormatException.java
index 78b3681..e400f96 100644
--- a/src/main/java/org/apache/maven/doxia/UnsupportedFormatException.java
+++ b/src/main/java/org/apache/maven/doxia/UnsupportedFormatException.java
@@ -21,6 +21,8 @@ package org.apache.maven.doxia;
 
 import org.codehaus.plexus.util.StringUtils;
 
+import java.util.List;
+
 /**
  * Wrap an exception that occurs if a format is not supported.
  *
@@ -39,10 +41,10 @@ public class UnsupportedFormatException
      * @param format the unsupported format, not null
      * @param supportedFormat the supported formats, not null
      */
-    public UnsupportedFormatException( String format, String[] supportedFormat )
+    public UnsupportedFormatException( String format, List<String> supportedFormat )
     {
         super( "Unsupported format '" + format + "'. The allowed format are: "
-            + StringUtils.join( supportedFormat, ", " ) );
+            + String.join( ", ", supportedFormat ) );
     }
 
     /**
diff --git a/src/main/java/org/apache/maven/doxia/cli/CLIManager.java b/src/main/java/org/apache/maven/doxia/cli/CLIManager.java
index 85756de..d56d5eb 100644
--- a/src/main/java/org/apache/maven/doxia/cli/CLIManager.java
+++ b/src/main/java/org/apache/maven/doxia/cli/CLIManager.java
@@ -159,8 +159,8 @@ class CLIManager
 
     private static String getSupportedFormat()
     {
-        return "\nSupported Formats:\n from: " + join( DefaultConverter.SUPPORTED_FROM_FORMAT, ", " )
-            + " or autodetect" + "\n to:   " + join( DefaultConverter.SUPPORTED_TO_FORMAT, ", " )
+        return "\nSupported Formats:\n from: " + String.join(", ", DefaultConverter.SUPPORTED_FROM_FORMAT)
+            + " or autodetect" + "\n to:   " + String.join( ", ", DefaultConverter.SUPPORTED_TO_FORMAT )
             + "\n";
     }
 
diff --git a/src/main/java/org/apache/maven/doxia/util/ConverterUtil.java b/src/main/java/org/apache/maven/doxia/util/ConverterUtil.java
index 18983d6..e6b1786 100644
--- a/src/main/java/org/apache/maven/doxia/util/ConverterUtil.java
+++ b/src/main/java/org/apache/maven/doxia/util/ConverterUtil.java
@@ -25,6 +25,7 @@ import org.apache.maven.doxia.sink.SinkFactory;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 
+import java.util.List;
 import java.util.Objects;
 
 /**
@@ -43,7 +44,7 @@ public class ConverterUtil
      * @throws UnsupportedFormatException if the found parser is not instantiated.
      * @throws IllegalArgumentException if any parameter is null
      */
-    public static Parser getParser( PlexusContainer plexus, String format, String[] supportedFormats )
+    public static Parser getParser( PlexusContainer plexus, String format, List<String> supportedFormats )
         throws ComponentLookupException, UnsupportedFormatException
     {
         Objects.requireNonNull( plexus, "plexus is required" );
@@ -77,7 +78,7 @@ public class ConverterUtil
      * @throws UnsupportedFormatException if the found sink is not instantiated.
      * @throws IllegalArgumentException if any parameter is null
      */
-    public static SinkFactory getSinkFactory( PlexusContainer plexus, String format, String[] supportedFormats )
+    public static SinkFactory getSinkFactory( PlexusContainer plexus, String format, List<String> supportedFormats )
         throws ComponentLookupException, UnsupportedFormatException
     {
         Objects.requireNonNull( plexus, "plexus is required" );
diff --git a/src/main/java/org/apache/maven/doxia/wrapper/AbstractFileWrapper.java b/src/main/java/org/apache/maven/doxia/wrapper/AbstractFileWrapper.java
index 9936d91..31d1209 100644
--- a/src/main/java/org/apache/maven/doxia/wrapper/AbstractFileWrapper.java
+++ b/src/main/java/org/apache/maven/doxia/wrapper/AbstractFileWrapper.java
@@ -22,6 +22,7 @@ package org.apache.maven.doxia.wrapper;
 import java.io.File;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
+import java.util.List;
 import java.util.Objects;
 
 import org.codehaus.plexus.util.StringUtils;
@@ -54,7 +55,7 @@ abstract class AbstractFileWrapper
      * @throws UnsupportedEncodingException if the encoding is unsupported.
      * @throws IllegalArgumentException if any
      */
-    AbstractFileWrapper( String absolutePath, String format, String encoding, String[] supportedFormat )
+    AbstractFileWrapper( String absolutePath, String format, String encoding, List<String> supportedFormat )
         throws UnsupportedEncodingException
     {
         super( format, supportedFormat );
diff --git a/src/main/java/org/apache/maven/doxia/wrapper/AbstractWrapper.java b/src/main/java/org/apache/maven/doxia/wrapper/AbstractWrapper.java
index f6e759a..374315c 100644
--- a/src/main/java/org/apache/maven/doxia/wrapper/AbstractWrapper.java
+++ b/src/main/java/org/apache/maven/doxia/wrapper/AbstractWrapper.java
@@ -20,6 +20,7 @@ package org.apache.maven.doxia.wrapper;
  */
 
 import java.io.Serializable;
+import java.util.List;
 import java.util.Objects;
 
 import static org.codehaus.plexus.util.StringUtils.isNotEmpty;
@@ -36,17 +37,17 @@ abstract class AbstractWrapper
 
     private String format;
 
-    private String[] supportedFormat;
+    private List<String> supportedFormat;
 
     /**
      * @param format could be null.
      * @param supportedFormat not null.
      * @throws IllegalArgumentException if supportedFormat is null.
      */
-    AbstractWrapper( String format, String[] supportedFormat )
+    AbstractWrapper( String format, List<String> supportedFormat )
     {
         this.format = ( isNotEmpty( format ) ? format : AUTO_FORMAT );
-        if ( supportedFormat == null )
+        if ( supportedFormat == null || supportedFormat.isEmpty() )
         {
             throw new IllegalArgumentException( "supportedFormat is required" );
         }
@@ -72,7 +73,7 @@ abstract class AbstractWrapper
     /**
      * @return the supportedFormat
      */
-    public String[] getSupportedFormat()
+    public List<String> getSupportedFormat()
     {
         return supportedFormat;
     }
@@ -80,7 +81,7 @@ abstract class AbstractWrapper
     /**
      * @param supportedFormat the supportedFormat to set
      */
-    void setSupportedFormat( String[] supportedFormat )
+    void setSupportedFormat( List<String> supportedFormat )
     {
         this.supportedFormat = supportedFormat;
     }
diff --git a/src/main/java/org/apache/maven/doxia/wrapper/InputFileWrapper.java b/src/main/java/org/apache/maven/doxia/wrapper/InputFileWrapper.java
index fdedd88..ec516b4 100644
--- a/src/main/java/org/apache/maven/doxia/wrapper/InputFileWrapper.java
+++ b/src/main/java/org/apache/maven/doxia/wrapper/InputFileWrapper.java
@@ -21,6 +21,7 @@ package org.apache.maven.doxia.wrapper;
 
 import java.io.FileNotFoundException;
 import java.io.UnsupportedEncodingException;
+import java.util.List;
 
 /**
  * Wrapper for an input file.
@@ -43,7 +44,7 @@ public class InputFileWrapper
      * @throws UnsupportedEncodingException if the encoding is unsupported.
      * @throws FileNotFoundException if the file for absolutePath is not found.
      */
-    private InputFileWrapper( String absolutePath, String format, String charsetName, String[] supportedFormat )
+    private InputFileWrapper( String absolutePath, String format, String charsetName, List<String> supportedFormat )
         throws UnsupportedEncodingException, FileNotFoundException
     {
         super( absolutePath, format, charsetName, supportedFormat );
@@ -63,7 +64,7 @@ public class InputFileWrapper
      * @throws FileNotFoundException if the file for absolutePath is not found.
      * @see #valueOf(String, String, String, String[]) using AUTO_FORMAT
      */
-    public static InputFileWrapper valueOf( String absolutePath, String format, String[] supportedFormat )
+    public static InputFileWrapper valueOf( String absolutePath, String format, List<String> supportedFormat )
         throws UnsupportedEncodingException, FileNotFoundException
     {
         return valueOf( absolutePath, format, AUTO_FORMAT, supportedFormat );
@@ -79,7 +80,7 @@ public class InputFileWrapper
      * @throws FileNotFoundException if the file for absolutePath is not found.
      */
     public static InputFileWrapper valueOf( String absolutePath, String format, String charsetName,
-                                            String[] supportedFormat )
+                                            List<String> supportedFormat )
         throws UnsupportedEncodingException, FileNotFoundException
     {
         return new InputFileWrapper( absolutePath, format, charsetName, supportedFormat );
diff --git a/src/main/java/org/apache/maven/doxia/wrapper/InputReaderWrapper.java b/src/main/java/org/apache/maven/doxia/wrapper/InputReaderWrapper.java
index d74004f..56ca904 100644
--- a/src/main/java/org/apache/maven/doxia/wrapper/InputReaderWrapper.java
+++ b/src/main/java/org/apache/maven/doxia/wrapper/InputReaderWrapper.java
@@ -20,6 +20,7 @@ package org.apache.maven.doxia.wrapper;
  */
 
 import java.io.Reader;
+import java.util.List;
 
 /**
  * Wrapper for an input reader.
@@ -41,7 +42,7 @@ public class InputReaderWrapper
      * @param supportedFormat not null
      * @throws IllegalArgumentException if the format equals AUTO_FORMAT.
      */
-    private InputReaderWrapper( Reader reader, String format, String[] supportedFormat )
+    private InputReaderWrapper( Reader reader, String format, List<String> supportedFormat )
     {
         super( format, supportedFormat );
 
@@ -71,7 +72,7 @@ public class InputReaderWrapper
      * @param supportedFormat not null
      * @return a type safe input reader
      */
-    public static InputReaderWrapper valueOf( Reader reader, String format, String[] supportedFormat )
+    public static InputReaderWrapper valueOf( Reader reader, String format, List<String> supportedFormat )
     {
         return new InputReaderWrapper( reader, format, supportedFormat );
     }
diff --git a/src/main/java/org/apache/maven/doxia/wrapper/OutputFileWrapper.java b/src/main/java/org/apache/maven/doxia/wrapper/OutputFileWrapper.java
index a90a1e1..e7a0e03 100644
--- a/src/main/java/org/apache/maven/doxia/wrapper/OutputFileWrapper.java
+++ b/src/main/java/org/apache/maven/doxia/wrapper/OutputFileWrapper.java
@@ -20,6 +20,7 @@ package org.apache.maven.doxia.wrapper;
  */
 
 import java.io.UnsupportedEncodingException;
+import java.util.List;
 
 import org.codehaus.plexus.util.WriterFactory;
 
@@ -46,7 +47,7 @@ public class OutputFileWrapper
      * @throws IllegalArgumentException if any.
      * @throws UnsupportedEncodingException if the encoding is unsupported.
      */
-    private OutputFileWrapper( String absolutePath, String format, String charsetName, String[] supportedFormat )
+    private OutputFileWrapper( String absolutePath, String format, String charsetName, List<String> supportedFormat )
         throws UnsupportedEncodingException
     {
         super( absolutePath, format, charsetName, supportedFormat );
@@ -64,7 +65,7 @@ public class OutputFileWrapper
      * @return a type safe output writer
      * @throws UnsupportedEncodingException if the encoding is unsupported.
      */
-    public static OutputFileWrapper valueOf( String absolutePath, String format, String[] supportedFormat )
+    public static OutputFileWrapper valueOf( String absolutePath, String format, List<String> supportedFormat )
         throws UnsupportedEncodingException
     {
         return valueOf( absolutePath, format, WriterFactory.UTF_8, supportedFormat );
@@ -79,7 +80,7 @@ public class OutputFileWrapper
      * @throws UnsupportedEncodingException if the encoding is unsupported.
      */
     public static OutputFileWrapper valueOf( String absolutePath, String format, String charsetName,
-                                             String[] supportedFormat )
+                                             List<String> supportedFormat )
         throws UnsupportedEncodingException
     {
         if ( isEmpty( format ) )
diff --git a/src/main/java/org/apache/maven/doxia/wrapper/OutputStreamWrapper.java b/src/main/java/org/apache/maven/doxia/wrapper/OutputStreamWrapper.java
index 2357504..b12be0d 100644
--- a/src/main/java/org/apache/maven/doxia/wrapper/OutputStreamWrapper.java
+++ b/src/main/java/org/apache/maven/doxia/wrapper/OutputStreamWrapper.java
@@ -20,6 +20,7 @@ package org.apache.maven.doxia.wrapper;
  */
 
 import java.io.OutputStream;
+import java.util.List;
 import java.util.Objects;
 
 import static org.codehaus.plexus.util.StringUtils.isEmpty;
@@ -46,7 +47,7 @@ public class OutputStreamWrapper
      * @param supportedFormat not null
      * @throws IllegalArgumentException if any.
      */
-    private OutputStreamWrapper( OutputStream out, String format, String encoding, String[] supportedFormat )
+    private OutputStreamWrapper( OutputStream out, String format, String encoding, List<String> supportedFormat )
     {
         super( format, supportedFormat );
 
@@ -83,7 +84,7 @@ public class OutputStreamWrapper
      * @return a type safe output stream wrapper
      */
     public static OutputStreamWrapper valueOf( OutputStream out, String format, String encoding,
-            String[] supportedFormat )
+            List<String> supportedFormat )
     {
         Objects.requireNonNull( out, "output writer is required" );
         if ( isEmpty( format ) )