This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Am I closing Everything In Transformation?
- From: "Scott Purcell" <spurcell at vertisinc dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 23 Aug 2002 10:07:48 -0500
- Subject: [xsl] Am I closing Everything In Transformation?
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello,
I have the following code, that is in a servlet that runs on box A. There is a web-site that does a JSP include on box B, that includes my servlet from box A. We are using the automounter for the nfs mount. All works well, but I am having a problem with something staying open on box B. I am wondering if there is something in the transformation that should be closed to release the connection?
Here is the code, showing the whole transformation, and I bet something should be closed that is not. Has anyone dealt with this before?
Thanks,
Scott
try {
javax.xml.transform.Source xmlSource = new javax.xml.transform.stream.StreamSource(job.getXmlFile());
javax.xml.transform.Source xsltSource = new javax.xml.transform.stream.StreamSource(job.getXslFile());
javax.xml.transform.Result result = new javax.xml.transform.stream.StreamResult(baos);
javax.xml.transform.TransformerFactory transFact = javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.Transformer trans = transFact.newTransformer(xsltSource);
/* ADD USER DEFINED INFO */
Hashtable prefs = (Hashtable)job.getColorPrefs();
Enumeration enum = prefs.keys();
while (enum.hasMoreElements())
{
String tkey = (String)enum.nextElement();
String tval = (String)prefs.get(tkey);
trans.setParameter(tkey, tval);
}
// now set path stuff.
trans.setParameter("userimage", job.getUserDrawerRelative() + "Pv/");
trans.setParameter("systemimage", job.getSystemDrawerRelative() + "Pv/");
// trans.setParameter("userimage", job.getUserDrawerRelative());
//trans.setParameter("systemimage", job.getSystemDrawerRelative());
trans.setParameter("jobname", job.getJobName());
trans.setParameter("url", job.getURL());
trans.setParameter("user", job.getUserId());
trans.setParameter("mxml", job.getJobName() + ".mxml");
trans.setParameter("jpegImage", jpegImage);
trans.setParameter("rhtmlImage", rhtmlImage);
trans.setParameter("defaultImage", common + "/selectImage.jpg");
trans.setParameter("apdf_url", apdf_url + "?itemid=" + job.getItemId() + "&userid=" + job.getUserId() + "&prodid=" + job.getProdId());
trans.setParameter("merchant_url", merchant_url + "?prodID=" + job.getProdId() + "&itemID=" + job.getItemId());
trans.transform(xmlSource, result);
} catch (javax.xml.transform.TransformerException te) {
System.out.println(te.getMessage() + " is error message.\n");
tmp2.append(te.getMessage());
}
tmp2 = tmp2.append(baos.toString());
try {
baos.close();
} catch (Exception e) {
e.printStackTrace(System.out);
}
Scott Purcell | Developer | VERTIS | 555 Washington Ave. 4th Floor | St. Louis, MO 63101 |
T 314.588.0720 | F 314.588.0735 | spurcell@vertisinc.com | http://www.vertisinc.com
Vertis is a global powerhouse for integrated marketing and advertising solutions that seamlessly combine advertising, direct marketing, media, imaging and progressive technology. Vertis' products and services include: consumer and media research, media planning and placement, creative services, digital media production, targetable insert programs, fully integrated direct marketing programs, circulation-building newspaper products and eMarketing.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list