From: Dave B. <bla...@us...> - 2013-07-23 16:29:25
|
Update of /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/wbem In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22885/src/org/sblim/cimclient/internal/wbem Modified Files: Tag: Experimental WBEMClientCIMXML.java Log Message: 2651 IOException when tracing the cimxml Index: WBEMClientCIMXML.java =================================================================== RCS file: /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/wbem/WBEMClientCIMXML.java,v retrieving revision 1.21.2.71 retrieving revision 1.21.2.72 diff -u -d -r1.21.2.71 -r1.21.2.72 --- WBEMClientCIMXML.java 23 Feb 2013 19:56:54 -0000 1.21.2.71 +++ WBEMClientCIMXML.java 23 Jul 2013 16:29:23 -0000 1.21.2.72 @@ -72,6 +72,7 @@ * 3601894 2013-01-23 blaschke-oss Enhance HTTP and CIM-XML tracing * 2614 2013-02-21 blaschke-oss Remove redundant code in transmitRequest * 2616 2013-02-23 blaschke-oss Add new API WBEMClientSBLIM.sendIndication() + * 2651 2013-07-23 blaschke-oss IOException when tracing the cimxml */ package org.sblim.cimclient.internal.wbem; @@ -163,7 +164,9 @@ private final WBEMConfiguration iConfiguration = new WBEMConfiguration(new Properties()); - private FileOutputStream iCimXmlTraceFile = null; + private static FileOutputStream iCimXmlTraceFile = null; + + private static int iActiveInstances = 0; private Locale[] iLocales; // final @@ -258,15 +261,17 @@ if (this.iConfiguration.isCimXmlTracingEnabled() && LogAndTraceBroker.getBroker().getXmlTraceStream() == null) { String filename = this.iConfiguration.getCimXmlTraceStream(); - if (filename != null && filename.length() > 0) { + if (filename != null && filename.length() > 0 + && WBEMClientCIMXML.iCimXmlTraceFile == null) { if (filename.equalsIgnoreCase("System.out")) { LogAndTraceBroker.getBroker().setXmlTraceStream(System.out); } else if (filename.equalsIgnoreCase("System.err")) { LogAndTraceBroker.getBroker().setXmlTraceStream(System.err); } else { try { - this.iCimXmlTraceFile = new FileOutputStream(filename); - LogAndTraceBroker.getBroker().setXmlTraceStream(this.iCimXmlTraceFile); + WBEMClientCIMXML.iCimXmlTraceFile = new FileOutputStream(filename); + LogAndTraceBroker.getBroker().setXmlTraceStream( + WBEMClientCIMXML.iCimXmlTraceFile); } catch (IOException e) { logger.trace(Level.FINE, "Unable to open " + WBEMConfigurationProperties.CIMXML_TRACE_STREAM + "=" @@ -277,6 +282,7 @@ } this.iInitialized = true; + ++WBEMClientCIMXML.iActiveInstances; } finally { logger.exit(); @@ -629,12 +635,17 @@ if (this.iHttpClientPool != null) { this.iHttpClientPool.closePool(); } - if (this.iCimXmlTraceFile != null) { - this.iCimXmlTraceFile.close(); - } - } catch (IOException e) { - // Ignore CIM-XML trace file exception } finally { + if (--WBEMClientCIMXML.iActiveInstances <= 0 + && WBEMClientCIMXML.iCimXmlTraceFile != null) { + try { + System.out.println("***DEB CLOSING CLIENT!!!"); + WBEMClientCIMXML.iCimXmlTraceFile.close(); + } catch (IOException e) { + // Ignore CIM-XML trace file exception + } + WBEMClientCIMXML.iCimXmlTraceFile = null; + } this.iClosed = true; logger.exit(); } |