Selaa lähdekoodia

FOP-2643: Java 9 warnings

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1780541 13f79535-47bb-0310-9956-ffa450edef68
pull/57/head
Simon Steiner 7 vuotta sitten
vanhempi
commit
bee2a52a96

+ 9
- 2
fop-core/src/main/java/org/apache/fop/cli/InputHandler.java Näytä tiedosto

import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.Vector; import java.util.Vector;


import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
return; return;
} }
try { try {
entityResolver = (EntityResolver) resolverClass.newInstance();
uriResolver = (URIResolver) resolverClass.newInstance();
entityResolver = (EntityResolver) resolverClass.getDeclaredConstructor().newInstance();
uriResolver = (URIResolver) resolverClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException e) { } catch (InstantiationException e) {
log.error("Error creating the catalog resolver: " + e.getMessage()); log.error("Error creating the catalog resolver: " + e.getMessage());
eventProducer.catalogResolverNotCreated(this, e.getMessage()); eventProducer.catalogResolverNotCreated(this, e.getMessage());
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
log.error("Error creating the catalog resolver: " + e.getMessage()); log.error("Error creating the catalog resolver: " + e.getMessage());
eventProducer.catalogResolverNotCreated(this, e.getMessage()); eventProducer.catalogResolverNotCreated(this, e.getMessage());
} catch (NoSuchMethodException e) {
log.error("Error creating the catalog resolver: " + e.getMessage());
eventProducer.catalogResolverNotCreated(this, e.getMessage());
} catch (InvocationTargetException e) {
log.error("Error creating the catalog resolver: " + e.getMessage());
eventProducer.catalogResolverNotCreated(this, e.getMessage());
} }
} }



+ 6
- 1
fop-core/src/main/java/org/apache/fop/fo/ElementMappingRegistry.java Näytä tiedosto



package org.apache.fop.fo; package org.apache.fop.fo;


import java.lang.reflect.InvocationTargetException;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;


throws IllegalArgumentException { throws IllegalArgumentException {
try { try {
ElementMapping mapping ElementMapping mapping
= (ElementMapping)Class.forName(mappingClassName).newInstance();
= (ElementMapping)Class.forName(mappingClassName).getDeclaredConstructor().newInstance();
addElementMapping(mapping); addElementMapping(mapping);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " throw new IllegalArgumentException("Could not find "
} catch (ClassCastException e) { } catch (ClassCastException e) {
throw new IllegalArgumentException(mappingClassName throw new IllegalArgumentException(mappingClassName
+ " is not an ElementMapping"); + " is not an ElementMapping");
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
} }
} }



+ 6
- 1
fop-core/src/main/java/org/apache/fop/render/ImageHandlerRegistry.java Näytä tiedosto



package org.apache.fop.render; package org.apache.fop.render;


import java.lang.reflect.InvocationTargetException;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
public void addHandler(String classname) { public void addHandler(String classname) {
try { try {
ImageHandler handlerInstance ImageHandler handlerInstance
= (ImageHandler)Class.forName(classname).newInstance();
= (ImageHandler)Class.forName(classname).getDeclaredConstructor().newInstance();
addHandler(handlerInstance); addHandler(handlerInstance);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " throw new IllegalArgumentException("Could not find "
throw new IllegalArgumentException(classname throw new IllegalArgumentException(classname
+ " is not an " + " is not an "
+ ImageHandler.class.getName()); + ImageHandler.class.getName());
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
} }
} }



+ 16
- 3
fop-core/src/main/java/org/apache/fop/render/RendererFactory.java Näytä tiedosto

package org.apache.fop.render; package org.apache.fop.render;


import java.io.OutputStream; import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
public void addRendererMaker(String className) { public void addRendererMaker(String className) {
try { try {
AbstractRendererMaker makerInstance AbstractRendererMaker makerInstance
= (AbstractRendererMaker)Class.forName(className).newInstance();
= (AbstractRendererMaker)Class.forName(className).getDeclaredConstructor().newInstance();
addRendererMaker(makerInstance); addRendererMaker(makerInstance);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " throw new IllegalArgumentException("Could not find "
throw new IllegalArgumentException(className throw new IllegalArgumentException(className
+ " is not an " + " is not an "
+ AbstractRendererMaker.class.getName()); + AbstractRendererMaker.class.getName());
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
} }
} }


public void addFOEventHandlerMaker(String className) { public void addFOEventHandlerMaker(String className) {
try { try {
AbstractFOEventHandlerMaker makerInstance AbstractFOEventHandlerMaker makerInstance
= (AbstractFOEventHandlerMaker)Class.forName(className).newInstance();
= (AbstractFOEventHandlerMaker)Class.forName(className).getDeclaredConstructor().newInstance();
addFOEventHandlerMaker(makerInstance); addFOEventHandlerMaker(makerInstance);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " throw new IllegalArgumentException("Could not find "
throw new IllegalArgumentException(className throw new IllegalArgumentException(className
+ " is not an " + " is not an "
+ AbstractFOEventHandlerMaker.class.getName()); + AbstractFOEventHandlerMaker.class.getName());
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
} }
} }


public void addDocumentHandlerMaker(String className) { public void addDocumentHandlerMaker(String className) {
try { try {
AbstractIFDocumentHandlerMaker makerInstance AbstractIFDocumentHandlerMaker makerInstance
= (AbstractIFDocumentHandlerMaker)Class.forName(className).newInstance();
= (AbstractIFDocumentHandlerMaker)Class.forName(className).getDeclaredConstructor().newInstance();
addDocumentHandlerMaker(makerInstance); addDocumentHandlerMaker(makerInstance);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " throw new IllegalArgumentException("Could not find "
throw new IllegalArgumentException(className throw new IllegalArgumentException(className
+ " is not an " + " is not an "
+ AbstractIFDocumentHandlerMaker.class.getName()); + AbstractIFDocumentHandlerMaker.class.getName());
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
} }
} }



+ 6
- 1
fop-core/src/main/java/org/apache/fop/render/XMLHandlerRegistry.java Näytä tiedosto



package org.apache.fop.render; package org.apache.fop.render;


import java.lang.reflect.InvocationTargetException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
*/ */
public void addXMLHandler(String classname) { public void addXMLHandler(String classname) {
try { try {
XMLHandler handlerInstance = (XMLHandler)Class.forName(classname).newInstance();
XMLHandler handlerInstance = (XMLHandler)Class.forName(classname).getDeclaredConstructor().newInstance();
addXMLHandler(handlerInstance); addXMLHandler(handlerInstance);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " throw new IllegalArgumentException("Could not find "
throw new IllegalArgumentException(classname throw new IllegalArgumentException(classname
+ " is not an " + " is not an "
+ XMLHandler.class.getName()); + XMLHandler.class.getName());
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
} }
} }



+ 6
- 1
fop-core/src/main/java/org/apache/fop/render/afp/AFPFontConfig.java Näytä tiedosto

package org.apache.fop.render.afp; package org.apache.fop.render.afp;


import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
try { try {
Class<? extends Typeface> clazz = Class.forName("org.apache.fop.fonts.base14." Class<? extends Typeface> clazz = Class.forName("org.apache.fop.fonts.base14."
+ base14Name).asSubclass(Typeface.class); + base14Name).asSubclass(Typeface.class);
return clazz.newInstance();
return clazz.getDeclaredConstructor().newInstance();
} catch (IllegalAccessException iae) { } catch (IllegalAccessException iae) {
LOG.error(iae.getMessage()); LOG.error(iae.getMessage());
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
LOG.error(cnfe.getMessage()); LOG.error(cnfe.getMessage());
} catch (InstantiationException ie) { } catch (InstantiationException ie) {
LOG.error(ie.getMessage()); LOG.error(ie.getMessage());
} catch (NoSuchMethodException e) {
LOG.error(e.getMessage());
} catch (InvocationTargetException e) {
LOG.error(e.getMessage());
} }
throw new ClassNotFoundException("Couldn't load file for AFP font with base14 name: " throw new ClassNotFoundException("Couldn't load file for AFP font with base14 name: "
+ base14Name); + base14Name);

+ 1
- 1
fop-core/src/main/java/org/apache/fop/tools/anttasks/RunTest.java Näytä tiedosto

Map diff = null; Map diff = null;
try { try {
Class cla = Class.forName(converter, true, loader); Class cla = Class.forName(converter, true, loader);
Object tc = cla.newInstance();
Object tc = cla.getDeclaredConstructor().newInstance();
Method meth; Method meth;


meth = cla.getMethod("setBaseDir", new Class[] { meth = cla.getMethod("setBaseDir", new Class[] {

+ 6
- 1
fop-core/src/main/java/org/apache/fop/util/ContentHandlerFactoryRegistry.java Näytä tiedosto



package org.apache.fop.util; package org.apache.fop.util;


import java.lang.reflect.InvocationTargetException;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;


public void addContentHandlerFactory(String classname) { public void addContentHandlerFactory(String classname) {
try { try {
ContentHandlerFactory factory ContentHandlerFactory factory
= (ContentHandlerFactory)Class.forName(classname).newInstance();
= (ContentHandlerFactory)Class.forName(classname).getDeclaredConstructor().newInstance();
addContentHandlerFactory(factory); addContentHandlerFactory(factory);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Could not find " throw new IllegalArgumentException("Could not find "
throw new IllegalArgumentException(classname throw new IllegalArgumentException(classname
+ " is not an " + " is not an "
+ ContentHandlerFactory.class.getName()); + ContentHandlerFactory.class.getName());
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException(e);
} }
} }



+ 6
- 1
fop-core/src/main/java/org/apache/fop/util/bitmap/BitmapImageUtil.java Näytä tiedosto

import java.awt.image.IndexColorModel; import java.awt.image.IndexColorModel;
import java.awt.image.RenderedImage; import java.awt.image.RenderedImage;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.lang.reflect.InvocationTargetException;


/** /**
* Utility method for dealing with bitmap images. * Utility method for dealing with bitmap images.
try { try {
String clName = "org.apache.fop.util.bitmap.JAIMonochromeBitmapConverter"; String clName = "org.apache.fop.util.bitmap.JAIMonochromeBitmapConverter";
Class clazz = Class.forName(clName); Class clazz = Class.forName(clName);
converter = (MonochromeBitmapConverter)clazz.newInstance();
converter = (MonochromeBitmapConverter)clazz.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
// Class was not compiled so is not available. Simply ignore. // Class was not compiled so is not available. Simply ignore.
} catch (LinkageError le) { } catch (LinkageError le) {
// Problem instantiating the class, simply continue with the backup implementation // Problem instantiating the class, simply continue with the backup implementation
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
// Problem instantiating the class, simply continue with the backup implementation // Problem instantiating the class, simply continue with the backup implementation
} catch (NoSuchMethodException e) {
// Problem instantiating the class, simply continue with the backup implementation
} catch (InvocationTargetException e) {
// Problem instantiating the class, simply continue with the backup implementation
} }
if (converter == null) { if (converter == null) {
converter = new DefaultMonochromeBitmapConverter(); converter = new DefaultMonochromeBitmapConverter();

+ 2
- 2
fop-core/src/test/java/org/apache/fop/afp/goca/GraphicsCharacterStringTestCase.java Näytä tiedosto

CharacterSetBuilder csb = CharacterSetBuilder.getSingleByteInstance(); CharacterSetBuilder csb = CharacterSetBuilder.getSingleByteInstance();
CharacterSet cs1146 = csb.build("C0H200B0", "T1V10500", "Cp1146", CharacterSet cs1146 = csb.build("C0H200B0", "T1V10500", "Cp1146",
Class.forName("org.apache.fop.fonts.base14.Helvetica").asSubclass(Typeface.class) Class.forName("org.apache.fop.fonts.base14.Helvetica").asSubclass(Typeface.class)
.newInstance(), null);
.getDeclaredConstructor().newInstance(), null);
gcsCp1146 = new GraphicsCharacterString(poundsText, 0, 0, cs1146); gcsCp1146 = new GraphicsCharacterString(poundsText, 0, 0, cs1146);
CharacterSet cs500 = csb.build("C0H200B0", "T1V10500", "Cp500", CharacterSet cs500 = csb.build("C0H200B0", "T1V10500", "Cp500",
Class.forName("org.apache.fop.fonts.base14.Helvetica").asSubclass(Typeface.class) Class.forName("org.apache.fop.fonts.base14.Helvetica").asSubclass(Typeface.class)
.newInstance(), null);
.getDeclaredConstructor().newInstance(), null);
gcsCp500 = new GraphicsCharacterString(dollarsText, 0, 0, cs500); gcsCp500 = new GraphicsCharacterString(dollarsText, 0, 0, cs500);
} }



+ 6
- 1
fop-core/src/test/java/org/apache/fop/apps/FopConfBuilder.java Näytä tiedosto

import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;


import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
*/ */
public <T extends RendererConfBuilder> T startRendererConfig(Class<T> rendererConfigClass) { public <T extends RendererConfBuilder> T startRendererConfig(Class<T> rendererConfigClass) {
try { try {
currentRendererConfig = rendererConfigClass.newInstance();
currentRendererConfig = rendererConfigClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException e) { } catch (InstantiationException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

+ 1
- 1
fop-core/src/test/java/org/apache/fop/render/rtf/rtflib/testdocs/CreateTestDocuments.java Näytä tiedosto

className = TESTDOCS_PACKAGE + "." + className; className = TESTDOCS_PACKAGE + "." + className;
TestDocument td = null; TestDocument td = null;
try { try {
td = (TestDocument)Class.forName(className).newInstance();
td = (TestDocument)Class.forName(className).getDeclaredConstructor().newInstance();
} catch (Exception e) { } catch (Exception e) {
throw new Exception("unable to instantiate '" + className throw new Exception("unable to instantiate '" + className
+ " as a TestDocument object: " + e); + " as a TestDocument object: " + e);

+ 1
- 1
fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java Näytä tiedosto

try { try {
Class clazz = Class.forName(this.fopCfg.getAttribute("class", Class clazz = Class.forName(this.fopCfg.getAttribute("class",
"org.apache.fop.threading.FOProcessorImpl")); "org.apache.fop.threading.FOProcessorImpl"));
Processor fop = (Processor)clazz.newInstance();
Processor fop = (Processor)clazz.getDeclaredConstructor().newInstance();
ContainerUtil.enableLogging(fop, getLogger()); ContainerUtil.enableLogging(fop, getLogger());
ContainerUtil.configure(fop, this.fopCfg); ContainerUtil.configure(fop, this.fopCfg);
ContainerUtil.initialize(fop); ContainerUtil.initialize(fop);

+ 2
- 2
fop/build.xml Näytä tiedosto

<property name="javac.debug" value="on"/> <property name="javac.debug" value="on"/>
<property name="javac.optimize" value="off"/> <property name="javac.optimize" value="off"/>
<property name="javac.deprecation" value="on"/> <property name="javac.deprecation" value="on"/>
<property name="javac.source" value="1.5"/>
<property name="javac.target" value="1.5"/>
<property name="javac.source" value="1.6"/>
<property name="javac.target" value="1.6"/>
<property name="javac.fork" value="no"/> <property name="javac.fork" value="no"/>
<property name="junit.fork" value="yes"/> <property name="junit.fork" value="yes"/>
<property name="junit.haltonfailure" value="off"/> <property name="junit.haltonfailure" value="off"/>

Loading…
Peruuta
Tallenna