[DOXIA-591] More style updates
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/DefaultMacroManager.java b/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/DefaultMacroManager.java
index fbf749a..1e251a3 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/DefaultMacroManager.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/macro/manager/DefaultMacroManager.java
@@ -36,6 +36,7 @@
public class DefaultMacroManager
implements MacroManager
{
+ @SuppressWarnings( "MismatchedQueryAndUpdateOfCollection" )
@Requirement( role = Macro.class )
private Map<String, Macro> macros;
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
index 1ac62fb..3891bd3 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/AbstractXmlParser.java
@@ -604,7 +604,7 @@
* @param entityName not null
* @param entityValue not null
* @throws XmlPullParserException if any
- * @see {@link XmlPullParser#defineEntityReplacementText(String, String)}
+ * @see XmlPullParser#defineEntityReplacementText(String, String)
*/
private void addEntity( XmlPullParser parser, String entityName, String entityValue )
throws XmlPullParserException
@@ -815,16 +815,15 @@
// The default user-agent is "Apache-HttpClient/4.5.8 (java 7)"
.setUserAgent( "Apache-Doxia/" + doxiaVersion() );
- CloseableHttpResponse response = null;
- try
+ try ( CloseableHttpResponse response = httpClientBuilder.build().execute( new HttpGet( url.toString() ) ) )
{
- response = httpClientBuilder.build( ).execute( new HttpGet( url.toString( ) ) );
int statusCode = response.getStatusLine().getStatusCode();
if ( statusCode != HttpStatus.SC_OK )
{
- throw new IOException( "The status code when accessing the URL '" + url.toString() + "' was "
- + statusCode + ", which is not allowed. The server gave this reason for the failure '"
- + response.getStatusLine().getReasonPhrase() + "'." );
+ throw new IOException(
+ "The status code when accessing the URL '" + url.toString() + "' was " + statusCode
+ + ", which is not allowed. The server gave this reason for the failure '"
+ + response.getStatusLine().getReasonPhrase() + "'." );
}
return EntityUtils.toByteArray( response.getEntity() );
@@ -837,20 +836,6 @@
{
throw new SAXException( "IOException: Fatal transport error: " + e.getMessage(), e );
}
- finally
- {
- if ( response != null )
- {
- try
- {
- response.close();
- }
- catch ( IOException e )
- {
- // Ignore
- }
- }
- }
}
/**
@@ -859,7 +844,7 @@
* @param res not null array of byte
* @param f the file where to write the bytes
* @throws SAXException if any
- * @see {@link IOUtil#copy(byte[], OutputStream)}
+ * @see IOUtil#copy(byte[], OutputStream)
*/
private void copy( byte[] res, File f )
throws SAXException
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/DefaultParserManager.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/DefaultParserManager.java
index dbef0d6..ef7b277 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/DefaultParserManager.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/manager/DefaultParserManager.java
@@ -36,6 +36,7 @@
public class DefaultParserManager
implements ParserManager
{
+ @SuppressWarnings( "MismatchedQueryAndUpdateOfCollection" )
@Requirement( role = Parser.class )
private Map<String, Parser> parsers;
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/DefaultParserModuleManager.java b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/DefaultParserModuleManager.java
index 7b88cb6..06e59ca 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/DefaultParserModuleManager.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/parser/module/DefaultParserModuleManager.java
@@ -35,6 +35,7 @@
public class DefaultParserModuleManager
implements ParserModuleManager
{
+ @SuppressWarnings( "MismatchedQueryAndUpdateOfCollection" )
@Requirement( role = ParserModule.class )
private Map<String, ParserModule> parserModules;
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkEventAttributeSet.java b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkEventAttributeSet.java
index 818f6b5..152a912 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkEventAttributeSet.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/sink/impl/SinkEventAttributeSet.java
@@ -97,18 +97,18 @@
static
{
UNDERLINE = new SinkEventAttributeSet( DECORATION, "underline" ).unmodifiable();
- OVERLINE = new SinkEventAttributeSet( new String[] {DECORATION, "overline"} ).unmodifiable();
- LINETHROUGH = new SinkEventAttributeSet( new String[] {DECORATION, "line-through"} ).unmodifiable();
- BOXED = new SinkEventAttributeSet( new String[] {DECORATION, "boxed"} ).unmodifiable();
+ OVERLINE = new SinkEventAttributeSet( DECORATION, "overline" ).unmodifiable();
+ LINETHROUGH = new SinkEventAttributeSet( DECORATION, "line-through" ).unmodifiable();
+ BOXED = new SinkEventAttributeSet( DECORATION, "boxed" ).unmodifiable();
- BOLD = new SinkEventAttributeSet( new String[] {STYLE, "bold"} ).unmodifiable();
- ITALIC = new SinkEventAttributeSet( new String[] {STYLE, "italic"} ).unmodifiable();
- MONOSPACED = new SinkEventAttributeSet( new String[] {STYLE, "monospaced"} ).unmodifiable();
+ BOLD = new SinkEventAttributeSet( STYLE, "bold" ).unmodifiable();
+ ITALIC = new SinkEventAttributeSet( STYLE, "italic" ).unmodifiable();
+ MONOSPACED = new SinkEventAttributeSet( STYLE, "monospaced" ).unmodifiable();
- LEFT = new SinkEventAttributeSet( new String[] {ALIGN, "left"} ).unmodifiable();
- RIGHT = new SinkEventAttributeSet( new String[] {ALIGN, "right"} ).unmodifiable();
- CENTER = new SinkEventAttributeSet( new String[] {ALIGN, "center"} ).unmodifiable();
- JUSTIFY = new SinkEventAttributeSet( new String[] {ALIGN, "justify"} ).unmodifiable();
+ LEFT = new SinkEventAttributeSet( ALIGN, "left" ).unmodifiable();
+ RIGHT = new SinkEventAttributeSet( ALIGN, "right" ).unmodifiable();
+ CENTER = new SinkEventAttributeSet( ALIGN, "center" ).unmodifiable();
+ JUSTIFY = new SinkEventAttributeSet( ALIGN, "justify" ).unmodifiable();
}
private Map<String, Object> attribs;
@@ -568,39 +568,35 @@
static
{
- EMPHASIS = new SinkEventAttributeSet( new String[] {SEMANTICS, "emphasis"} ).unmodifiable();
- STRONG = new SinkEventAttributeSet( new String[] {SEMANTICS, "strong"} ).unmodifiable();
- SMALL = new SinkEventAttributeSet( new String[] {SEMANTICS, "small"} ).unmodifiable();
- LINE_THROUGH = new SinkEventAttributeSet( new String[] {SEMANTICS, "line-through"} ).unmodifiable();
- CITATION = new SinkEventAttributeSet( new String[] {SEMANTICS, "citation"} ).unmodifiable();
- QUOTE = new SinkEventAttributeSet( new String[] {SEMANTICS, "quote"} ).unmodifiable();
- DEFINITION = new SinkEventAttributeSet( new String[] {SEMANTICS, "definition"} ).unmodifiable();
- ABBREVIATION = new SinkEventAttributeSet( new String[] {SEMANTICS, "abbreviation"} ).unmodifiable();
- ITALIC = new SinkEventAttributeSet( new String[] {SEMANTICS, "italic"} ).unmodifiable();
- BOLD = new SinkEventAttributeSet( new String[] {SEMANTICS, "bold"} ).unmodifiable();
- MONOSPACED = new SinkEventAttributeSet( new String[] {SEMANTICS, "monospaced"} ).unmodifiable();
- CODE = new SinkEventAttributeSet( new String[] {SEMANTICS, "code"} ).unmodifiable();
- VARIABLE = new SinkEventAttributeSet( new String[] {SEMANTICS, "variable"} ).unmodifiable();
- SAMPLE = new SinkEventAttributeSet( new String[] {SEMANTICS, "sample"} ).unmodifiable();
- KEYBOARD = new SinkEventAttributeSet( new String[] {SEMANTICS, "keyboard"} ).unmodifiable();
- SUPERSCRIPT = new SinkEventAttributeSet( new String[] {SEMANTICS, "superscript"} ).unmodifiable();
- SUBSCRIPT = new SinkEventAttributeSet( new String[] {SEMANTICS, "subscript"} ).unmodifiable();
- ANNOTATION = new SinkEventAttributeSet( new String[] {SEMANTICS, "annotation"} ).unmodifiable();
- HIGHLIGHT = new SinkEventAttributeSet( new String[] {SEMANTICS, "highlight"} ).unmodifiable();
- RUBY = new SinkEventAttributeSet( new String[] {SEMANTICS, "ruby"} ).unmodifiable();
- RUBY_BASE = new SinkEventAttributeSet( new String[] {SEMANTICS, "rubyBase"} ).unmodifiable();
- RUBY_TEXT = new SinkEventAttributeSet( new String[] {SEMANTICS, "rubyText"} ).unmodifiable();
- RUBY_TEXT_CONTAINER = new SinkEventAttributeSet( new String[] {SEMANTICS,
- "rubyTextContainer"} ).unmodifiable();
- RUBY_PARANTHESES = new SinkEventAttributeSet( new String[] {SEMANTICS,
- "rubyParentheses"} ).unmodifiable();
- BIDIRECTIONAL_ISOLATION = new SinkEventAttributeSet( new String[] {SEMANTICS,
- "bidirectionalIsolation"} ).unmodifiable();
- BIDIRECTIONAL_OVERRIDE = new SinkEventAttributeSet( new String[] {SEMANTICS,
- "bidirectionalOverride"} ).unmodifiable();
- PHRASE = new SinkEventAttributeSet( new String[] {SEMANTICS, "phrase"} ).unmodifiable();
- INSERT = new SinkEventAttributeSet( new String[] {SEMANTICS, "insert"} ).unmodifiable();
- DELETE = new SinkEventAttributeSet( new String[] {SEMANTICS, "delete"} ).unmodifiable();
+ EMPHASIS = new SinkEventAttributeSet( SEMANTICS, "emphasis" ).unmodifiable();
+ STRONG = new SinkEventAttributeSet( SEMANTICS, "strong" ).unmodifiable();
+ SMALL = new SinkEventAttributeSet( SEMANTICS, "small" ).unmodifiable();
+ LINE_THROUGH = new SinkEventAttributeSet( SEMANTICS, "line-through" ).unmodifiable();
+ CITATION = new SinkEventAttributeSet( SEMANTICS, "citation" ).unmodifiable();
+ QUOTE = new SinkEventAttributeSet( SEMANTICS, "quote" ).unmodifiable();
+ DEFINITION = new SinkEventAttributeSet( SEMANTICS, "definition" ).unmodifiable();
+ ABBREVIATION = new SinkEventAttributeSet( SEMANTICS, "abbreviation" ).unmodifiable();
+ ITALIC = new SinkEventAttributeSet( SEMANTICS, "italic" ).unmodifiable();
+ BOLD = new SinkEventAttributeSet( SEMANTICS, "bold" ).unmodifiable();
+ MONOSPACED = new SinkEventAttributeSet( SEMANTICS, "monospaced" ).unmodifiable();
+ CODE = new SinkEventAttributeSet( SEMANTICS, "code" ).unmodifiable();
+ VARIABLE = new SinkEventAttributeSet( SEMANTICS, "variable" ).unmodifiable();
+ SAMPLE = new SinkEventAttributeSet( SEMANTICS, "sample" ).unmodifiable();
+ KEYBOARD = new SinkEventAttributeSet( SEMANTICS, "keyboard" ).unmodifiable();
+ SUPERSCRIPT = new SinkEventAttributeSet( SEMANTICS, "superscript" ).unmodifiable();
+ SUBSCRIPT = new SinkEventAttributeSet( SEMANTICS, "subscript" ).unmodifiable();
+ ANNOTATION = new SinkEventAttributeSet( SEMANTICS, "annotation" ).unmodifiable();
+ HIGHLIGHT = new SinkEventAttributeSet( SEMANTICS, "highlight" ).unmodifiable();
+ RUBY = new SinkEventAttributeSet( SEMANTICS, "ruby" ).unmodifiable();
+ RUBY_BASE = new SinkEventAttributeSet( SEMANTICS, "rubyBase" ).unmodifiable();
+ RUBY_TEXT = new SinkEventAttributeSet( SEMANTICS, "rubyText" ).unmodifiable();
+ RUBY_TEXT_CONTAINER = new SinkEventAttributeSet( SEMANTICS, "rubyTextContainer" ).unmodifiable();
+ RUBY_PARANTHESES = new SinkEventAttributeSet( SEMANTICS, "rubyParentheses" ).unmodifiable();
+ BIDIRECTIONAL_ISOLATION = new SinkEventAttributeSet( SEMANTICS, "bidirectionalIsolation" ).unmodifiable();
+ BIDIRECTIONAL_OVERRIDE = new SinkEventAttributeSet( SEMANTICS, "bidirectionalOverride" ).unmodifiable();
+ PHRASE = new SinkEventAttributeSet( SEMANTICS, "phrase" ).unmodifiable();
+ INSERT = new SinkEventAttributeSet( SEMANTICS, "insert" ).unmodifiable();
+ DELETE = new SinkEventAttributeSet( SEMANTICS, "delete" ).unmodifiable();
}
}
}
diff --git a/doxia-core/src/main/java/org/apache/maven/doxia/util/DoxiaUtils.java b/doxia-core/src/main/java/org/apache/maven/doxia/util/DoxiaUtils.java
index c35628c..07e9c8d 100644
--- a/doxia-core/src/main/java/org/apache/maven/doxia/util/DoxiaUtils.java
+++ b/doxia-core/src/main/java/org/apache/maven/doxia/util/DoxiaUtils.java
@@ -398,7 +398,7 @@
public static MutableAttributeSet getImageAttributes( final String logo )
throws IOException
{
- BufferedImage img = null;
+ BufferedImage img;
if ( isExternalLink( logo ) )
{
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/AbstractModuleTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/AbstractModuleTest.java
index 2cdf688..650edd9 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/AbstractModuleTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/AbstractModuleTest.java
@@ -41,7 +41,7 @@
extends PlexusTestCase
implements Markup
{
- /**
+ /*
* Set the system properties:
* <ul>
* <li><code>line.separator</code> to <code>\n</code> (Unix) to prevent
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/document/DocumentModelTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/document/DocumentModelTest.java
index 01657ed..120a879 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/document/DocumentModelTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/document/DocumentModelTest.java
@@ -79,6 +79,7 @@
private void verifyModel( DocumentModel model )
{
assertNotNull( model );
+ //noinspection EqualsWithItself
assertTrue( model.equals( model ) );
assertTrue ( model.hashCode() != 0 );
assertTrue( model.toString().length() > 0 );
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/macro/manager/MacroManagerTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/macro/manager/MacroManagerTest.java
index e1a6462..df635b6 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/macro/manager/MacroManagerTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/macro/manager/MacroManagerTest.java
@@ -44,7 +44,7 @@
try
{
- macro = mm.getMacro( "weirdId" );
+ mm.getMacro( "weirdId" );
fail( "should not exist!" );
}
catch ( MacroNotFoundException macroNotFoundException )
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTest.java
index f4120c1..64803e3 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/parser/AbstractParserTest.java
@@ -25,7 +25,6 @@
import org.apache.maven.doxia.sink.impl.TextSink;
import org.apache.maven.doxia.sink.impl.WellformednessCheckingSink;
import org.apache.maven.doxia.sink.Sink;
-import org.codehaus.plexus.util.IOUtil;
import org.junit.Assert;
import java.io.IOException;
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/RandomAccessSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/RandomAccessSinkTest.java
index d9a88e7..84624d5 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/RandomAccessSinkTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/RandomAccessSinkTest.java
@@ -19,7 +19,7 @@
* under the License.
*/
-/**
+/*
* @author Robert Scholte
*/
import java.io.ByteArrayOutputStream;
@@ -27,8 +27,6 @@
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.sink.SinkFactory;
-import org.apache.maven.doxia.sink.impl.AbstractXmlSinkFactory;
-import org.apache.maven.doxia.sink.impl.RandomAccessSink;
import junit.framework.TestCase;
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/SinkEventAttributeSetTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/SinkEventAttributeSetTest.java
index 3fd137a..0199d2e 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/SinkEventAttributeSetTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/SinkEventAttributeSetTest.java
@@ -24,7 +24,6 @@
import javax.swing.text.AttributeSet;
import org.apache.maven.doxia.sink.SinkEventAttributes;
-import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import junit.framework.TestCase;
@@ -56,7 +55,7 @@
{
try
{
- SinkEventAttributeSet aset = new SinkEventAttributeSet( "key" );
+ new SinkEventAttributeSet( "key" );
fail( "missing attribute value!" );
}
catch ( IllegalArgumentException e )
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java
index 0ef7c34..1509e1f 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/Xhtml5BaseSinkTest.java
@@ -1402,7 +1402,7 @@
final Object[] startTag = new Object[] { Xhtml5BaseSink.TAG_TYPE_START };
final Object[] endTag = new Object[] { Xhtml5BaseSink.TAG_TYPE_END };
final String script = Xhtml5BaseSink.SCRIPT.toString();
- final SinkEventAttributes src = new SinkEventAttributeSet( SinkEventAttributes.SRC.toString(),
+ final SinkEventAttributes src = new SinkEventAttributeSet( SinkEventAttributes.SRC,
"http://ex.com/ex.js?v=l&l=e" );
try
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
index ce71988..26151eb 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/XhtmlBaseSinkTest.java
@@ -955,7 +955,7 @@
final Object[] startTag = new Object[] { XhtmlBaseSink.TAG_TYPE_START };
final Object[] endTag = new Object[] { XhtmlBaseSink.TAG_TYPE_END };
final String script = XhtmlBaseSink.SCRIPT.toString();
- final SinkEventAttributes src = new SinkEventAttributeSet( SinkEventAttributes.SRC.toString(),
+ final SinkEventAttributes src = new SinkEventAttributeSet( SinkEventAttributes.SRC,
"http://ex.com/ex.js?v=l&l=e" );
try
diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/xsd/AbstractXmlValidatorTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/xsd/AbstractXmlValidatorTest.java
index 4a4a6ea..cd7a057 100644
--- a/doxia-core/src/test/java/org/apache/maven/doxia/xsd/AbstractXmlValidatorTest.java
+++ b/doxia-core/src/test/java/org/apache/maven/doxia/xsd/AbstractXmlValidatorTest.java
@@ -192,7 +192,7 @@
continue;
}
- Reader reader = null;
+ Reader reader;
if ( XmlUtil.isXml( file ) )
{
reader = ReaderFactory.newXmlReader( file );
diff --git a/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java b/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
index 479865c..21cf716 100644
--- a/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
+++ b/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
@@ -701,7 +701,7 @@
{
if ( end > begin )
{
- replaced.append( string.substring( begin, end ) );
+ replaced.append( string, begin, end );
}
replaced.append( newSub );
begin = end + oldSubLength;
diff --git a/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java b/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
index 595e6ec..c1223d1 100644
--- a/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
+++ b/doxia-modules/doxia-module-fml/src/main/java/org/apache/maven/doxia/module/fml/FmlParser.java
@@ -538,7 +538,6 @@
/**
* Writes the faqs to the specified sink.
*
- * @param faqs The faqs to emit.
* @param sink The sink to consume the event.
* @throws ParseException if something goes wrong.
*/
diff --git a/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java b/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java
index b32c171..e22af15 100644
--- a/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java
+++ b/doxia-modules/doxia-module-fml/src/test/java/org/apache/maven/doxia/module/fml/FmlParserTest.java
@@ -34,7 +34,6 @@
import org.apache.maven.doxia.sink.impl.SinkEventElement;
import org.apache.maven.doxia.sink.impl.SinkEventTestingSink;
import org.apache.maven.doxia.sink.impl.XhtmlBaseSink;
-import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
/**
diff --git a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
index 8852e66..1c6df37 100644
--- a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
+++ b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
@@ -1115,7 +1115,7 @@
}
String subtitle = null;
- String title = null;
+ String title;
String type = null;
String version = null;
if ( cover == null )
@@ -1213,7 +1213,7 @@
}
String date = null;
- String compName = null;
+ String compName;
if ( cover == null )
{
// aleady checked that meta != null
diff --git a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java
index 3cdbc83..c60c5f0 100644
--- a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java
+++ b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java
@@ -42,7 +42,6 @@
import org.apache.fop.apps.FopFactoryBuilder;
import org.apache.fop.apps.MimeConstants;
import org.apache.maven.doxia.document.DocumentModel;
-import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
/**
@@ -114,49 +113,22 @@
public static void convertFO2PDF( File fo, File pdf, String resourceDir, DocumentModel documentModel )
throws TransformerException
{
- OutputStream out = null;
- try
+ try ( OutputStream out = new BufferedOutputStream( new FileOutputStream( pdf ) ) )
{
- try
- {
- out = new BufferedOutputStream( new FileOutputStream( pdf ) );
- }
- catch ( IOException e )
- {
- throw new TransformerException( e );
- }
+ URI baseURI = getBaseURI( fo, resourceDir );
+ FopFactory fopFactory = new FopFactoryBuilder( baseURI ).build();
+ FOUserAgent userAgent = fopFactory.newFOUserAgent();
+ prepareUserAgent( userAgent, documentModel );
+ Fop fop = fopFactory.newFop( MimeConstants.MIME_PDF, userAgent, out );
+ Result res = new SAXResult( fop.getDefaultHandler() );
- Result res = null;
- try
- {
- URI baseURI = getBaseURI( fo, resourceDir );
- FopFactory fopFactory = new FopFactoryBuilder( baseURI ).build();
- FOUserAgent userAgent = fopFactory.newFOUserAgent();
- prepareUserAgent( userAgent, documentModel );
- Fop fop = fopFactory.newFop( MimeConstants.MIME_PDF, userAgent, out );
- res = new SAXResult( fop.getDefaultHandler() );
- }
- catch ( FOPException e )
- {
- throw new TransformerException( e );
- }
-
- Transformer transformer = null;
- try
- {
- // identity transformer
- transformer = TRANSFORMER_FACTORY.newTransformer();
- }
- catch ( TransformerConfigurationException e )
- {
- throw new TransformerException( e );
- }
-
+ // identity transformer
+ Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
transformer.transform( new StreamSource( fo ), res );
}
- finally
+ catch ( FOPException | TransformerConfigurationException | IOException e )
{
- IOUtil.close( out );
+ throw new TransformerException( e );
}
}
diff --git a/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java b/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
index ba73aa6..86ea862 100644
--- a/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
+++ b/doxia-modules/doxia-module-latex/src/main/java/org/apache/maven/doxia/module/latex/LatexSink.java
@@ -363,7 +363,7 @@
/** {@inheritDoc} */
public void sectionTitle_( int level )
{
- String command = "";
+ String command;
switch ( level )
{
case SECTION_LEVEL_1:
diff --git a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
index f14bed7..14d878d 100644
--- a/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
+++ b/doxia-modules/doxia-module-markdown/src/test/java/org/apache/maven/doxia/module/markdown/MarkdownParserTest.java
@@ -27,10 +27,8 @@
import org.apache.maven.doxia.parser.AbstractParserTest;
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.parser.Parser;
-import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.doxia.sink.impl.SinkEventElement;
import org.apache.maven.doxia.sink.impl.SinkEventTestingSink;
-import org.codehaus.plexus.util.IOUtil;
/**
* Tests for {@link MarkdownParser}.
@@ -309,7 +307,7 @@
*/
protected SinkEventTestingSink parseFileToEventTestingSink( String file ) throws ParseException, IOException
{
- SinkEventTestingSink sink = null;
+ SinkEventTestingSink sink;
try ( Reader reader = getTestReader( file ) )
{
sink = new SinkEventTestingSink();
diff --git a/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java b/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java
index 68195d2..9768494 100644
--- a/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java
+++ b/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/RtfSink.java
@@ -1732,11 +1732,11 @@
font = new Font( style, size );
fontTable.put( key, font );
}
- catch ( Exception ignored )
+ catch ( Exception e )
{
if ( getLog().isDebugEnabled() )
{
- getLog().debug( ignored.getMessage(), ignored );
+ getLog().debug( e.getMessage(), e );
}
}
}
diff --git a/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java b/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
index 4e1af88..2ccb09b 100644
--- a/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
+++ b/doxia-modules/doxia-module-twiki/src/main/java/org/apache/maven/doxia/module/twiki/parser/SectionBlock.java
@@ -20,7 +20,6 @@
*/
import java.lang.reflect.Method;
-import java.util.Collections;
import org.apache.maven.doxia.sink.Sink;
@@ -111,7 +110,7 @@
try
{
final Method m = sink.getClass().getMethod( name );
- m.invoke( sink, Collections.EMPTY_LIST.toArray() );
+ m.invoke( sink );
}
catch ( Exception e )
{
diff --git a/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java b/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java
index f9cfd5e..1673f2a 100644
--- a/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java
+++ b/doxia-sink-api/src/main/java/org/apache/maven/doxia/sink/Sink.java
@@ -1250,7 +1250,7 @@
/**
* Starts a data element which groups together other elements representing microformats.
*
- * @see #data(SinkEventAttributes)
+ * @see #data(String, SinkEventAttributes)
*/
void data( String value );
@@ -1276,7 +1276,7 @@
/**
* Starts a time element which groups together other elements representing a time.
*
- * @see #time(SinkEventAttributes)
+ * @see #time(String, SinkEventAttributes)
*/
void time( String datetime );
@@ -1519,7 +1519,7 @@
/**
* Starts an inline element.
*
- * @see #inline(String,SinkEventAttributes)
+ * @see #inline(SinkEventAttributes)
*/
void inline();
@@ -1543,7 +1543,6 @@
* "bidirectionalOverride", "phrase", "insert", "delete").
* </blockquote>
*
- * @param text The text to write.
* @param attributes A set of {@link SinkEventAttributes}, may be <code>null</code>.
* @since 2.0
*/