aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv/egovernment
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2015-02-19 14:46:06 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-02-19 14:46:06 +0100
commit1679466b77e29ff8181b1b01a320c3548e28a349 (patch)
tree8b9cd65d06d8c38398e35dee70e1d9c9791aab6a /id/ConfigWebTool/src/main/java/at/gv/egovernment
parent299c1b3679abecdae88d71002acb626661616b0d (diff)
downloadmoa-id-spss-1679466b77e29ff8181b1b01a320c3548e28a349.tar.gz
moa-id-spss-1679466b77e29ff8181b1b01a320c3548e28a349.tar.bz2
moa-id-spss-1679466b77e29ff8181b1b01a320c3548e28a349.zip
fix some possible problems
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment')
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/servlets/Authenticate.java52
1 files changed, 30 insertions, 22 deletions
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/servlets/Authenticate.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/servlets/Authenticate.java
index f7406c42e..a511a3c88 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/servlets/Authenticate.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/auth/pvp2/servlets/Authenticate.java
@@ -75,34 +75,42 @@ public class Authenticate extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final Logger log = LoggerFactory
- .getLogger(Authenticate.class);
- /**
- * @see HttpServlet#HttpServlet()
- */
- public Authenticate() {
- super();
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ .getLogger(Authenticate.class);
+
+ private static DocumentBuilderFactory factory = null;
+
+ static {
+ initialDocumentBuilderFactory();
+ }
+
+ synchronized private static void initialDocumentBuilderFactory() {
+ factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
+
+ }
+
+ public Document asDOMDocument(XMLObject object) throws IOException,
+ MarshallingException, TransformerException, ParserConfigurationException {
try {
- // FIXME[tlenz]: Neither DocumentBuilderFactory nor DocumentBuilder is guaranteed to be thread-safe!
- builder = factory.newDocumentBuilder();
+ DocumentBuilder builder = null;
+ synchronized (factory) {
+ builder = factory.newDocumentBuilder();
+
+ }
+
+ Document document = builder.newDocument();
+ Marshaller out = Configuration.getMarshallerFactory().getMarshaller(
+ object);
+ out.marshall(object, document);
+ return document;
+
} catch (ParserConfigurationException e) {
log.warn("PVP2 AuthenticationServlet can not be initialized.", e);
-
+ throw e;
}
+
}
-
- DocumentBuilder builder;
-
- public Document asDOMDocument(XMLObject object) throws IOException,
- MarshallingException, TransformerException {
- Document document = builder.newDocument();
- Marshaller out = Configuration.getMarshallerFactory().getMarshaller(
- object);
- out.marshall(object, document);
- return document;
- }
-
+
protected void process(HttpServletRequest request,
HttpServletResponse response, Map<String,String> legacyParameter) throws ServletException, IOException {
try {