Looking at the source for RtfDestinationFontTable, I'm guessing the call to 
getEnvironmentVariables returned null.  This code is taken from 2.0.8-ish.

private Properties getEnvironmentVariables() throws Throwable {
                Properties environmentVariables = new Properties();
                String operatingSystem = 
System.getProperty("os.name").toLowerCase();
                Runtime runtime = Runtime.getRuntime();
                Process process = null;
                if (operatingSystem.indexOf("windows 95") > -1
                                || operatingSystem.indexOf("windows 98") > -1
                                || operatingSystem.indexOf("me") > -1) {
                        process = runtime.exec("command.com /c set");
                } else if ((operatingSystem.indexOf("nt") > -1)
                                || (operatingSystem.indexOf("windows 2000") > 
-1)
                                || (operatingSystem.indexOf("windows xp") > -1)
                                || (operatingSystem.indexOf("windows 2003") > 
-1)) {
                        process = runtime.exec("cmd.exe /c set");
                } else {
                        process = runtime.exec("env");
                }
                BufferedReader environmentStream = new BufferedReader(new 
InputStreamReader(process.getInputStream()));
                String inputLine = "";
                int idx = -1;
                while ((inputLine = environmentStream.readLine()) != null) {
                        idx = inputLine.indexOf('=');
                        environmentVariables.setProperty(inputLine.substring(0, 
idx),
                                        inputLine.substring(idx + 1));
                }
                return environmentVariables;
        }


Because this is a version of windows unrecognised by the code, it'll call 
"env", which isn't going to get very far.  The parsing code here will return an 
empty properties object, so the call to getProperty( "SystemRoot" ) will return 
a null string.  When that null is later used in string concatenation:  Boom.

The RTF code needs to be updated to support windows 7.  It probably already 
has.  What version of iText are you using?


--Mark Storer 
  Senior Software Engineer 
  Cardiff.com

#include <disclaimer> 
typedef std::Disclaimer<Cardiff> DisCard; 



> -----Original Message-----
> From: SergeTk [mailto:[email protected]]
> Sent: Monday, February 01, 2010 10:13 PM
> To: [email protected]
> Subject: Re: [iText-questions] importRtfDocument(Unknown Source)
> 
> 
> 
> I have same issue on my widows 7 64 bit os with 64bit java .....
> 
> But no issues with my xp 32 bit........ is itext compatable 
> with windows 7
> 64bit and 64bit java??
> 
> raghav_m wrote:
> > 
> > Hi ,
> > 
> > I need to append text to an  RTF document and am trying to 
> use the iText
> > API for the same. But I am having problems with RTFWriter2 -
> > importRTFDocument method. The constructor for an instance 
> of RTFWriter2
> > creates one correclty, but call to thhe importRTFDocument 
> method throws an
> > error. Here is the  StackTrace :-
> > 
> > Stacktrace follows:
> > java.lang.NullPointerException
> >     at
> > 
> com.lowagie.text.rtf.parser.destinations.RtfDestinationFontTab
> le.importSystemFonts(Unknown
> > Source)
> >     at
> > 
> com.lowagie.text.rtf.parser.destinations.RtfDestinationFontTab
> le.init(Unknown
> > Source)
> >     at
> > 
> com.lowagie.text.rtf.parser.destinations.RtfDestinationFontTab
> le.setParser(Unknown
> > Source)
> >     at
> > 
> com.lowagie.text.rtf.parser.destinations.RtfDestinationMgr.add
> Destination(Unknown
> > Source)
> >     at
> > 
> com.lowagie.text.rtf.parser.ctrlwords.RtfCtrlWordHandler.<init
> >(Unknown
> > Source)
> >     at 
> com.lowagie.text.rtf.parser.ctrlwords.RtfCtrlWordMap.<init>(Unknown
> > Source)
> >     at 
> com.lowagie.text.rtf.parser.ctrlwords.RtfCtrlWordMgr.<init>(Unknown
> > Source)
> >     at com.lowagie.text.rtf.parser.RtfParser.init(Unknown Source)
> >     at 
> com.lowagie.text.rtf.parser.RtfParser.importRtfDocument(Unknown
> > Source)
> >     at 
> com.lowagie.text.rtf.RtfWriter2.importRtfDocument(Unknown Source)
> >     at 
> com.lowagie.text.rtf.RtfWriter2.importRtfDocument(Unknown Source)
> >     at CbayThreadApplet$ESignThread.run(CbayThreadApplet.java:1484)
> > 
> > The line 1484 points to : writer.importRtfDocument(); where 
> writer is an
> > instance of RTFWriter2. I am passing a valid 
> FileInputStream to the method
> > and cannot seem to figure out why this error occurs...
> > 
> > Any suggestions please.
> > 
> > Thanks in advance.
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
http://old.nabble.com/importRtfDocument%28Unknown-Source%29-tp21286482p27415932.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to