Replaces the simple calls with no arguments to newInstance()

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5078 8810af33-2d31-482b-a856-94f89814c4df
baka 2017-10-25 13:26:01 +00:00
parent 82597bc384
commit a78c71fa20
17 changed files with 109 additions and 56 deletions

View File

@ -35,6 +35,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap; import java.util.HashMap;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -137,8 +138,8 @@ public class CMSPage extends Page implements ResourceHandler {
final Class<PresentationManager> presenterClass = BebopConfig.getConfig().getPresenterClass(); final Class<PresentationManager> presenterClass = BebopConfig.getConfig().getPresenterClass();
final PresentationManager pm; final PresentationManager pm;
try { try {
pm = presenterClass.newInstance(); pm = presenterClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException ex) { } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }

View File

@ -133,7 +133,7 @@ public class CMSApplicationPage extends Page {
.getConfig().getPresenterClass(); .getConfig().getPresenterClass();
final PresentationManager presenter; final PresentationManager presenter;
try { try {
presenter = presenterClass.newInstance(); presenter = presenterClass.class.getDeclaredConstructor().newInstance();
} catch (InstantiationException | } catch (InstantiationException |
IllegalAccessException ex) { IllegalAccessException ex) {
throw new RuntimeException("Failed to create PresentationManager", throw new RuntimeException("Failed to create PresentationManager",

View File

@ -108,7 +108,7 @@ public class AssetManager {
final T asset; final T asset;
try { try {
asset = assetType.newInstance(); asset = assetType.class.getDeclaredConstructor().newInstance();
} catch (IllegalAccessException | InstantiationException ex) { } catch (IllegalAccessException | InstantiationException ex) {
throw new UnexpectedErrorException(ex); throw new UnexpectedErrorException(ex);
} }

View File

@ -230,7 +230,7 @@ public class LifecycleManager {
final Object object; final Object object;
try { try {
object = listenerClass.newInstance(); object = listenerClass.class.getDeclaredConstructor().newInstance();
} catch (IllegalAccessException } catch (IllegalAccessException
| InstantiationException ex) { | InstantiationException ex) {
LOGGER.error("Failed to create instance of LifecycleEventListener " LOGGER.error("Failed to create instance of LifecycleEventListener "
@ -275,7 +275,7 @@ public class LifecycleManager {
final Object object; final Object object;
try { try {
object = listenerClass.newInstance(); object = listenerClass.class.getDeclaredConstructor().newInstance();
} catch (IllegalAccessException } catch (IllegalAccessException
| InstantiationException ex) { | InstantiationException ex) {
LOGGER.error("Failed to create instance of PhaseEventListener " LOGGER.error("Failed to create instance of PhaseEventListener "

View File

@ -45,7 +45,7 @@ public class CmsTaskManager {
.getTaskType().getUrlGenerator(); .getTaskType().getUrlGenerator();
final TaskURLGenerator urlGenerator; final TaskURLGenerator urlGenerator;
try { try {
urlGenerator = urlGeneratorClass.newInstance(); urlGenerator = urlGeneratorClass.class.getDeclaredConstructor().newInstance();
} catch (IllegalAccessException } catch (IllegalAccessException
| InstantiationException ex) { | InstantiationException ex) {
throw new UnexpectedErrorException(ex); throw new UnexpectedErrorException(ex);

View File

@ -24,6 +24,7 @@ import com.arsdigita.web.RedirectSignal;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -154,7 +155,7 @@ public abstract class BaseDispatcherServlet extends HttpServlet
File file = new File(getServletContext().getRealPath( File file = new File(getServletContext().getRealPath(
"/WEB-INF/web.xml")); "/WEB-INF/web.xml"));
// all we care about is the welcome-file-list element // all we care about is the welcome-file-list element
SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParserFactory spf = SAXParserFactory.class.getDeclaredConstructor().newInstance();
spf.setValidating(false); spf.setValidating(false);
SAXParser parser = spf.newSAXParser(); SAXParser parser = spf.newSAXParser();
parser.parse(file, new WebXMLReader()); parser.parse(file, new WebXMLReader());
@ -164,6 +165,8 @@ public abstract class BaseDispatcherServlet extends HttpServlet
LOGGER.error("error in init", pce); LOGGER.error("error in init", pce);
} catch (IOException ioe) { } catch (IOException ioe) {
LOGGER.error("error in init", ioe); LOGGER.error("error in init", ioe);
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
LOGGER.error(e);
} }
// default to index.jsp, index.html // default to index.jsp, index.html
if (m_welcomeFiles.isEmpty()) { if (m_welcomeFiles.isEmpty()) {

View File

@ -30,6 +30,7 @@ import com.arsdigita.bebop.parameters.LongParameter;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal; import java.math.BigDecimal;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -338,9 +339,9 @@ public class ACSObjectSelectionModel implements SingleSelectionModel {
Assert.exists(javaClassName, Class.class); Assert.exists(javaClassName, Class.class);
try { try {
final CcmObject object = (CcmObject) javaClassName.newInstance(); final CcmObject object = (CcmObject) javaClassName.getDeclaredConstructor().newInstance();
return object; return object;
} catch (InstantiationException | IllegalAccessException ex) { } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
throw new ServletException(ex); throw new ServletException(ex);
} }
} }

View File

@ -26,6 +26,7 @@ import java.io.PrintWriter;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL; import java.net.URL;
import java.util.Date; import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
@ -97,7 +98,7 @@ public final class XSLTemplate {
try { try {
LOGGER.debug("Getting new templates object"); LOGGER.debug("Getting new templates object");
final TransformerFactory factory = TransformerFactory.newInstance(); final TransformerFactory factory = TransformerFactory.class.getDeclaredConstructor().newInstance();
factory.setURIResolver(resolver); factory.setURIResolver(resolver);
factory.setErrorListener(listener); factory.setErrorListener(listener);
@ -109,6 +110,9 @@ public final class XSLTemplate {
throw new WrappedTransformerException(ex); throw new WrappedTransformerException(ex);
} catch (TransformerException ex) { } catch (TransformerException ex) {
throw new WrappedTransformerException(ex); throw new WrappedTransformerException(ex);
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
LOGGER.error(e);
throw new RuntimeException(e);
} }
// List contains each include/import URL found in the style sheet // List contains each include/import URL found in the style sheet

View File

@ -27,6 +27,8 @@ import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.toolbox.ui.LayoutPanel; import com.arsdigita.toolbox.ui.LayoutPanel;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import com.arsdigita.util.SystemInformation; import com.arsdigita.util.SystemInformation;
import java.lang.reflect.InvocationTargetException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -251,29 +253,41 @@ public class SystemInformationTab extends LayoutPanel {
public String getValue() { public String getValue() {
switch (currentIndex) { switch (currentIndex) {
case TRANSFORMER_FACTORY_INDEX: case TRANSFORMER_FACTORY_INDEX:
return TransformerFactory.newInstance().getClass().getName(); try {
return TransformerFactory.class.getDeclaredConstructor().newInstance().getClass().getName();
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
}
case TRANSFORMER_INDEX: case TRANSFORMER_INDEX:
try { try {
return TransformerFactory.newInstance().newTransformer().getClass().getName(); return TransformerFactory.class.getDeclaredConstructor().newInstance().newTransformer().getClass().getName();
} catch(TransformerConfigurationException ex) { } catch(TransformerConfigurationException ex) {
return "???"; return "???";
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
} }
case DOCUMENT_BUILDER_FACTORY_INDEX: case DOCUMENT_BUILDER_FACTORY_INDEX:
return DocumentBuilderFactory.newInstance().getClass().getName(); try {
return DocumentBuilderFactory.class.getDeclaredConstructor().newInstance().getClass().getName();
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
}
case DOCUMENT_BUILDER_INDEX: case DOCUMENT_BUILDER_INDEX:
try{ try{
return DocumentBuilderFactory.newInstance().newDocumentBuilder().getClass() return DocumentBuilderFactory.class.getDeclaredConstructor().newInstance().newDocumentBuilder().getClass()
.getName(); .getName();
} catch(ParserConfigurationException ex) { } catch(ParserConfigurationException ex) {
return "???"; return "???";
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
} }
case SAX_PARSER_FACTORY_INDEX: case SAX_PARSER_FACTORY_INDEX:
return SAXParserFactory.newInstance().getClass().getName(); try {
return SAXParserFactory.class.getDeclaredConstructor().newInstance().getClass().getName();
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
}
case SAX_PARSER_INDEX: case SAX_PARSER_INDEX:
try { try {
return SAXParserFactory.newInstance().newSAXParser().getClass().getName(); return SAXParserFactory.class.getDeclaredConstructor().newInstance().newSAXParser().getClass().getName();
} catch(ParserConfigurationException | SAXException ex) { } catch(ParserConfigurationException | SAXException ex) {
return "???"; return "???";
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
} }
default: default:
return ""; return "";

View File

@ -34,6 +34,7 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
/** /**
* A wrapper class that implements some functionality of * A wrapper class that implements some functionality of
@ -41,7 +42,7 @@ import java.io.UnsupportedEncodingException;
* *
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* pboy (Jan. 09) * pboy (Jan. 09)
* Class uses "DocumentBuilderFactory.newInstance()" to setup the parser * Class uses "DocumentBuilderFactory.class.getDeclaredConstructor().newInstance()" to setup the parser
* (according to the javax.xml specification). This is a simple and * (according to the javax.xml specification). This is a simple and
* straightforward, but rather thumb method. It requires a JVM wide acceptable * straightforward, but rather thumb method. It requires a JVM wide acceptable
* configuration (using a system.property or a static JRE configuration file) and * configuration (using a system.property or a static JRE configuration file) and
@ -116,8 +117,9 @@ public class Document {
// instead to achieve independence from a JVM wide configuration. // instead to achieve independence from a JVM wide configuration.
// Requires additional modifications in c.ad.util.xml.XML // Requires additional modifications in c.ad.util.xml.XML
static { static {
try {
LOGGER.debug("Static initalizer starting..."); LOGGER.debug("Static initalizer starting...");
s_builder = DocumentBuilderFactory.newInstance(); s_builder = DocumentBuilderFactory.class.getDeclaredConstructor().newInstance();
s_builder.setNamespaceAware(true); s_builder.setNamespaceAware(true);
s_db = new ThreadLocal() { s_db = new ThreadLocal() {
@ -131,6 +133,9 @@ public class Document {
} }
}; };
LOGGER.debug("Static initalized finished."); LOGGER.debug("Static initalized finished.");
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
LOGGER.error(e);
}
} }
/* Used to build the DOM Documents that this class wraps */ /* Used to build the DOM Documents that this class wraps */
@ -311,7 +316,7 @@ public class Document {
try { try {
StreamSource identitySource = StreamSource identitySource =
new StreamSource(new StringReader(identityXSL)); new StreamSource(new StringReader(identityXSL));
identity = TransformerFactory.newInstance().newTransformer( identity = TransformerFactory.class.getDeclaredConstructor().newInstance().newTransformer(
identitySource); identitySource);
identity.setOutputProperty("method", "xml"); identity.setOutputProperty("method", "xml");
identity.setOutputProperty("indent", (indent ? "yes" : "no")); identity.setOutputProperty("indent", (indent ? "yes" : "no"));
@ -320,6 +325,9 @@ public class Document {
} catch (javax.xml.transform.TransformerException e) { } catch (javax.xml.transform.TransformerException e) {
LOGGER.error("error in toString", e); LOGGER.error("error in toString", e);
return document.toString(); return document.toString();
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
LOGGER.error(e);
return null; // This shouldn't be possible
} }
try { try {

View File

@ -20,10 +20,13 @@ package com.arsdigita.xml;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
@ -32,6 +35,7 @@ import java.util.List;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Attr; import org.w3c.dom.Attr;
/** /**
* A wrapper class that implements some functionality of * A wrapper class that implements some functionality of
* <code>org.jdom.Element</code> using <code>org.w3c.dom.Element</code>. * <code>org.jdom.Element</code> using <code>org.w3c.dom.Element</code>.
@ -56,7 +60,7 @@ public class Element {
public Object initialValue() { public Object initialValue() {
try { try {
DocumentBuilderFactory builder = DocumentBuilderFactory builder =
DocumentBuilderFactory.newInstance(); DocumentBuilderFactory.class.getDeclaredConstructor().newInstance();
builder.setNamespaceAware(true); builder.setNamespaceAware(true);
return builder.newDocumentBuilder().newDocument(); return builder.newDocumentBuilder().newDocument();
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {
@ -64,6 +68,9 @@ public class Element {
throw new UncheckedWrapperException( throw new UncheckedWrapperException(
"INTERNAL: Could not create thread local DOM document.", "INTERNAL: Could not create thread local DOM document.",
e); e);
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
LOGGER.error(e);
return null; // This shouldn't be possible
} }
} }

View File

@ -28,6 +28,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -203,7 +204,7 @@ public class XML {
// configuration (affecting all CCM instances which may run in a // configuration (affecting all CCM instances which may run in a
// container). // container).
// Requires additional modifications in c.ad.util.xml.XML // Requires additional modifications in c.ad.util.xml.XML
SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParserFactory spf = SAXParserFactory.class.getDeclaredConstructor().newInstance();
spf.setFeature("http://xml.org/sax/features/namespaces", true); spf.setFeature("http://xml.org/sax/features/namespaces", true);
SAXParser parser = spf.newSAXParser(); SAXParser parser = spf.newSAXParser();
parser.parse(source, handler); parser.parse(source, handler);
@ -218,6 +219,8 @@ public class XML {
} }
} catch (IOException e) { } catch (IOException e) {
throw new UncheckedWrapperException("error parsing stream", e); throw new UncheckedWrapperException("error parsing stream", e);
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
LOGGER.error(e);
} }
} }

View File

@ -34,6 +34,7 @@ import javax.inject.Inject;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -357,13 +358,16 @@ public class ConfigurationManager implements Serializable {
final T conf; final T conf;
try { try {
conf = confClass.newInstance(); conf = confClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException ex) { } catch (InstantiationException | IllegalAccessException ex) {
LOGGER.warn(String.format( LOGGER.warn(String.format(
"Failed to instantiate configuration \"%s\".", "Failed to instantiate configuration \"%s\".",
confClass.getName()), confClass.getName()),
ex); ex);
return null; return null;
} catch (InvocationTargetException | NoSuchMethodException e) {
LOGGER.error(e);
return null;
} }
final List<AbstractSetting> settingList = settingManager final List<AbstractSetting> settingList = settingManager

View File

@ -29,6 +29,7 @@ import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@ -79,47 +80,54 @@ public class SysInfoController {
final ResourceBundle texts = ResourceBundle.getBundle( final ResourceBundle texts = ResourceBundle.getBundle(
"com.arsdigita.ui.admin.AdminResources"); "com.arsdigita.ui.admin.AdminResources");
try {
xmlProps.add(new SysInfoProperty( xmlProps.add(new SysInfoProperty(
texts.getString("ui.admin.sysinfo.xml_transformer_factory"), texts.getString("ui.admin.sysinfo.xml_transformer_factory"),
TransformerFactory.newInstance().getClass().getName())); TransformerFactory.class.getDeclaredConstructor().newInstance().getClass().getName()));
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
}
try { try {
xmlProps.add(new SysInfoProperty( xmlProps.add(new SysInfoProperty(
texts.getString("ui.admin.sysinfo.xml_transformer"), texts.getString("ui.admin.sysinfo.xml_transformer"),
TransformerFactory.newInstance().newTransformer().getClass() TransformerFactory.class.getDeclaredConstructor().newInstance().newTransformer().getClass()
.getName())); .getName()));
} catch (TransformerConfigurationException ex) { } catch (TransformerConfigurationException ex) {
xmlProps.add(new SysInfoProperty( xmlProps.add(new SysInfoProperty(
texts.getString("ui.admin.sysinfo.xml_transformer"), "???")); texts.getString("ui.admin.sysinfo.xml_transformer"), "???"));
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
} }
try {
xmlProps.add(new SysInfoProperty( xmlProps.add(new SysInfoProperty(
texts.getString("ui.admin.sysinfo.xml_document_builder_factory"), texts.getString("ui.admin.sysinfo.xml_document_builder_factory"),
DocumentBuilderFactory.newInstance().getClass().getName())); DocumentBuilderFactory.class.getDeclaredConstructor().newInstance().getClass().getName()));
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
}
try { try {
xmlProps.add(new SysInfoProperty( xmlProps.add(new SysInfoProperty(
texts.getString("ui.admin.sysinfo.xml_document_builder"), texts.getString("ui.admin.sysinfo.xml_document_builder"),
DocumentBuilderFactory.newInstance().newDocumentBuilder() DocumentBuilderFactory.class.getDeclaredConstructor().newInstance().newDocumentBuilder()
.getClass().getName())); .getClass().getName()));
} catch (ParserConfigurationException ex) { } catch (ParserConfigurationException ex) {
xmlProps.add(new SysInfoProperty( xmlProps.add(new SysInfoProperty(
texts.getString("ui.admin.sysinfo.xml_document_builder"), texts.getString("ui.admin.sysinfo.xml_document_builder"),
"???")); "???"));
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
} }
try {
xmlProps.add(new SysInfoProperty( xmlProps.add(new SysInfoProperty(
texts.getString("ui.admin.sysinfo.sax_parser_factory"), texts.getString("ui.admin.sysinfo.sax_parser_factory"),
SAXParserFactory.newInstance().getClass().getName())); SAXParserFactory.class.getDeclaredConstructor().newInstance().getClass().getName()));
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
}
try { try {
xmlProps.add(new SysInfoProperty( xmlProps.add(new SysInfoProperty(
texts.getString("ui.admin.sysinfo.sax_parser"), texts.getString("ui.admin.sysinfo.sax_parser"),
SAXParserFactory.newInstance().newSAXParser().getClass() SAXParserFactory.class.getDeclaredConstructor().newInstance().newSAXParser().getClass()
.getName())); .getName()));
} catch (ParserConfigurationException | SAXException ex) { } catch (ParserConfigurationException | SAXException ex) {
xmlProps.add(new SysInfoProperty( xmlProps.add(new SysInfoProperty(
texts.getString("ui.admin.sysinfo.sax_parser"), "???")); texts.getString("ui.admin.sysinfo.sax_parser"), "???"));
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
} }
return xmlProps; return xmlProps;

View File

@ -185,8 +185,8 @@ public class WorkflowManager {
final Class<? extends Task> templateClass = template.getClass(); final Class<? extends Task> templateClass = template.getClass();
final Task task; final Task task;
try { try {
task = templateClass.newInstance(); task = templateClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException ex) { } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }

View File

@ -47,7 +47,7 @@ public class EntitiesTestCore {
IllegalAccessException, IllegalAccessException,
IllegalArgumentException, IllegalArgumentException,
InvocationTargetException { InvocationTargetException {
final Object obj = entityClass.newInstance(); final Object obj = entityClass.class.getDeclaredConstructor().newInstance();
final Field[] fields = entityClass.getDeclaredFields(); final Field[] fields = entityClass.getDeclaredFields();
for (Field field : fields) { for (Field field : fields) {

View File

@ -33,7 +33,7 @@
response.getOutputStream().print("requestURI = " + request.getRequestURI()); response.getOutputStream().print("requestURI = " + request.getRequestURI());
response.getOutputStream().print("requestURL = " + request.getRequestURL());*/ response.getOutputStream().print("requestURL = " + request.getRequestURL());*/
TransformerFactory factory = TransformerFactory.newInstance(); TransformerFactory factory = TransformerFactory.class.getDeclaredConstructor().newInstance();
Transformer transformer = factory.newTransformer(new StreamSource(themeURL + "/start.xsl")); Transformer transformer = factory.newTransformer(new StreamSource(themeURL + "/start.xsl"));
transformer.setParameter("theme-prefix", themeURL); transformer.setParameter("theme-prefix", themeURL);
transformer.transform(new StreamSource(themeURL + "/doc/foundry-documentation.xml"), transformer.transform(new StreamSource(themeURL + "/doc/foundry-documentation.xml"),