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 e3e27f781..34bbce92e 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 @@ -177,7 +177,7 @@ public class RtfSink private int charSet = DEFAULT_CHAR_SET; - private final Hashtable fontTable; + private final Hashtable fontTable; private Context context; @@ -189,9 +189,9 @@ public class RtfSink private int listItemIndent; - private final Vector numbering; + private final Vector numbering; - private final Vector itemNumber; + private final Vector itemNumber; private int style = STYLE_ROMAN; @@ -220,7 +220,7 @@ public class RtfSink /** Map of warn messages with a String as key to describe the error type and a Set as value. * Using to reduce warn messages. */ - private Map warnMessages; + private Map> warnMessages; // ----------------------------------------------------------------------- @@ -252,14 +252,14 @@ protected RtfSink( OutputStream output ) * * @param output not null * @param encoding a valid charset - * @throws java.io.IOException if any. + * @throws java.io.IOException if any */ protected RtfSink( OutputStream output, String encoding ) throws IOException { - this.fontTable = new Hashtable(); - this.numbering = new Vector(); - this.itemNumber = new Vector(); + this.fontTable = new Hashtable<>(); + this.numbering = new Vector<>(); + this.itemNumber = new Vector<>(); Writer w; this.stream = new BufferedOutputStream( output ); @@ -1351,7 +1351,7 @@ private void writeImage( String source ) bytesPerLine = 4 * ( ( srcWidth + 3 ) / 4 ); byte[] bitmap = new byte[srcHeight * bytesPerLine]; - Vector colors = new Vector( 256 ); + Vector colors = new Vector<>( 256 ); colors.addElement( Color.white ); colors.addElement( Color.black ); @@ -1920,16 +1920,13 @@ public void close() if ( getLog().isWarnEnabled() && this.warnMessages != null ) { - for ( Object o1 : this.warnMessages.entrySet() ) + for ( Map.Entry> entry : this.warnMessages.entrySet() ) { - Map.Entry entry = (Map.Entry) o1; - Set set = (Set) entry.getValue(); + Set set = entry.getValue(); - for ( Object o : set ) + for ( String msg : set ) { - String msg = (String) o; - getLog().warn( msg ); } } @@ -1960,13 +1957,13 @@ private void logMessage( String key, String msg ) if ( warnMessages == null ) { - warnMessages = new HashMap(); + warnMessages = new HashMap<>(); } - Set set = (Set) warnMessages.get( key ); + Set set = warnMessages.get( key ); if ( set == null ) { - set = new TreeSet(); + set = new TreeSet<>(); } set.add( msg ); warnMessages.put( key, set ); @@ -2039,7 +2036,7 @@ static class Context { private int context = CONTEXT_UNDEFINED; - private Vector stack = new Vector(); + private Vector stack = new Vector<>(); void set( int context ) { @@ -2051,7 +2048,7 @@ void restore() { if ( !stack.isEmpty() ) { - context = (Integer) stack.lastElement(); + context = stack.lastElement(); stack.removeElementAt( stack.size() - 1 ); } } @@ -2172,7 +2169,7 @@ class Space private int next; - private Vector stack = new Vector(); + private Vector stack = new Vector<>(); Space( int space /*twips*/ ) { @@ -2196,7 +2193,7 @@ void restore() { if ( !stack.isEmpty() ) { - space = (Integer) stack.lastElement(); + space = stack.lastElement(); stack.removeElementAt( stack.size() - 1 ); next = space; } @@ -2234,7 +2231,7 @@ static class Indentation { private int indent; - private Vector stack = new Vector(); + private Vector stack = new Vector<>(); Indentation( int indent /*twips*/ ) { @@ -2256,7 +2253,7 @@ void restore() { if ( !stack.isEmpty() ) { - indent = (Integer) stack.lastElement(); + indent = stack.lastElement(); stack.removeElementAt( stack.size() - 1 ); } } @@ -2277,7 +2274,7 @@ static class Table boolean grid; - Vector rows; + Vector rows; Table( int[] justification, boolean grid ) { @@ -2285,7 +2282,7 @@ static class Table columnWidths = new int[numColumns]; this.justification = justification; this.grid = grid; - rows = new Vector(); + rows = new Vector<>(); } void add( Row row ) @@ -2298,7 +2295,7 @@ void add( Row row ) { break; } - Cell cell = (Cell) row.cells.elementAt( i ); + Cell cell = row.cells.elementAt( i ); int width = cell.boundingBox().width; if ( width > columnWidths[i] ) { @@ -2324,7 +2321,7 @@ int width() static class Row { - Vector cells = new Vector(); + Vector cells = new Vector<>(); void add( Cell cell ) { @@ -2337,7 +2334,7 @@ int height() int numCells = cells.size(); for ( int i = 0; i < numCells; ++i ) { - Cell cell = (Cell) cells.elementAt( i ); + Cell cell = cells.elementAt( i ); Box box = cell.boundingBox(); if ( box.height > height ) { @@ -2350,7 +2347,7 @@ int height() class Cell { - Vector lines = new Vector(); + Vector lines = new Vector<>(); void add( Line line ) { @@ -2403,7 +2400,7 @@ Box boundingBox() static class Line { - Vector items = new Vector(); + Vector items = new Vector<>(); void add( Item item ) { diff --git a/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/WMFWriter.java b/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/WMFWriter.java index 1cdbd420a..10a97ab5f 100644 --- a/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/WMFWriter.java +++ b/doxia-modules/doxia-module-rtf/src/main/java/org/apache/maven/doxia/module/rtf/WMFWriter.java @@ -57,7 +57,7 @@ class WMFWriter private short numOfParams; - private Vector records; + private Vector records; WMFWriter() { @@ -69,7 +69,7 @@ class WMFWriter maxRecordSize = trailer.size(); numOfParams = 0; - records = new Vector(); + records = new Vector<>(); } void add( Record record )