Re: TextBox bug
I know that Yegor knows less about "auto-fill" TextBoxes than the other types. It is time for him to find out ;-) Regards, Dave On Jul 13, 2006, at 9:31 AM, Nick Burch wrote: On Thu, 13 Jul 2006, Tales Paiva Nogueira wrote: This piece of code doesn't work in all cases, I made some tests and the NullPointerException still happens. I wonder if in this case, it's a TextBox that doesn't actually have any text in it. I leave it for Yegor to confirm or deny though, since he knows the most about TextBoxes :) Nick - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
RE: TextBox bug
Well, obviously, since we know that the member _txtrun might be null, there are more changes to be made to TextBox class - for everytime there is an attempt to call to any method of _txtrun. -Original Message- From: Tales Paiva Nogueira [mailto:[EMAIL PROTECTED] Sent: Thursday, July 13, 2006 4:16 PM To: POI Users List Subject: RE: TextBox bug This piece of code doesn't work in all cases, I made some tests and the NullPointerException still happens. This time it happens in the TextBox.getRichTextRuns() when it tries to return _txtrun.getRichTextRuns(). -- Tales > Hi, > > This is the changes I make (works just the same): > > > RichTextRun[] rt; > if (_txtrun == null) rt = new RichTextRun[0]; > else rt = _txtrun.getRichTextRuns(); > > > > > Thanks > > > > > -Original Message- > From: Tales Paiva Nogueira [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 13, 2006 3:15 PM > To: POI Users List > Subject: RE: TextBox bug > > Hi, > > I noticed this problem few days ago, I made a little change in the > code, > and it worked properly for my needs. The change I made was add an test > to > ensure that the _txtrun isn't null. > > Below is the code for the setSheet(Sheet sheet) in the TextBox class: > > public void setSheet(Sheet sheet){ > _sheet = sheet; > > //initialize _txtrun object. > //we can't do it in the constructor because the sheet is not > assigned yet > if(_txtrun == null) initTextRun(); > > if (_txtrun != null){ > RichTextRun[] rt = _txtrun.getRichTextRuns(); > for (int i = 0; i < rt.length; i++) { > rt[i].supplySlideShow(_sheet.getSlideShow()); > } > if (_fontname != null) { > setFontName(_fontname); > _fontname = null; > } > } > } > > I hope it can help you. > > -- > Tales > > >> I am not creating a TextBox myself... >> >> I have an instance of Slide, and I call the getShapes() method (some > of >> the shapes are TextBox instances) >> >> >> >> -Original Message- >> From: Nick Burch [mailto:[EMAIL PROTECTED] >> Sent: Thursday, July 13, 2006 11:23 AM >> To: POI Users List >> Subject: Re: TextBox bug >> >> On Thu, 13 Jul 2006, Erez Eisenstein wrote: >>> If I create a new ppt file, with an empty textbox in it (that says: >>> "click to add subtitle"), than the _txtrun is null. This causes the >>> TextBox class to throw NullPointerExceptions, in methods getText(), >>> setSheet(). >> >> When you create a TextBox, it does create and set _txtrun (line 160 in >> createSpContainer), so I'm not sure where your problem is? >> >> Could you supply the code you use to generate the > NullPointerExceptions? >> >> Nick >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> Mailing List: http://jakarta.apache.org/site/mail2.html#poi >> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> Mailing List: http://jakarta.apache.org/site/mail2.html#poi >> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
RE: TextBox bug
On Thu, 13 Jul 2006, Tales Paiva Nogueira wrote: This piece of code doesn't work in all cases, I made some tests and the NullPointerException still happens. I wonder if in this case, it's a TextBox that doesn't actually have any text in it. I leave it for Yegor to confirm or deny though, since he knows the most about TextBoxes :) Nick - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
RE: TextBox bug
This piece of code doesn't work in all cases, I made some tests and the NullPointerException still happens. This time it happens in the TextBox.getRichTextRuns() when it tries to return _txtrun.getRichTextRuns(). -- Tales > Hi, > > This is the changes I make (works just the same): > > > RichTextRun[] rt; > if (_txtrun == null) rt = new RichTextRun[0]; > else rt = _txtrun.getRichTextRuns(); > > > > > Thanks > > > > > -Original Message- > From: Tales Paiva Nogueira [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 13, 2006 3:15 PM > To: POI Users List > Subject: RE: TextBox bug > > Hi, > > I noticed this problem few days ago, I made a little change in the > code, > and it worked properly for my needs. The change I made was add an test > to > ensure that the _txtrun isn't null. > > Below is the code for the setSheet(Sheet sheet) in the TextBox class: > > public void setSheet(Sheet sheet){ > _sheet = sheet; > > //initialize _txtrun object. > //we can't do it in the constructor because the sheet is not > assigned yet > if(_txtrun == null) initTextRun(); > > if (_txtrun != null){ > RichTextRun[] rt = _txtrun.getRichTextRuns(); > for (int i = 0; i < rt.length; i++) { > rt[i].supplySlideShow(_sheet.getSlideShow()); > } > if (_fontname != null) { > setFontName(_fontname); > _fontname = null; > } > } > } > > I hope it can help you. > > -- > Tales > > >> I am not creating a TextBox myself... >> >> I have an instance of Slide, and I call the getShapes() method (some > of >> the shapes are TextBox instances) >> >> >> >> -Original Message- >> From: Nick Burch [mailto:[EMAIL PROTECTED] >> Sent: Thursday, July 13, 2006 11:23 AM >> To: POI Users List >> Subject: Re: TextBox bug >> >> On Thu, 13 Jul 2006, Erez Eisenstein wrote: >>> If I create a new ppt file, with an empty textbox in it (that says: >>> "click to add subtitle"), than the _txtrun is null. This causes the >>> TextBox class to throw NullPointerExceptions, in methods getText(), >>> setSheet(). >> >> When you create a TextBox, it does create and set _txtrun (line 160 in >> createSpContainer), so I'm not sure where your problem is? >> >> Could you supply the code you use to generate the > NullPointerExceptions? >> >> Nick >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> Mailing List: http://jakarta.apache.org/site/mail2.html#poi >> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> Mailing List: http://jakarta.apache.org/site/mail2.html#poi >> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
RE: TextBox bug
Hi, This is the changes I make (works just the same): RichTextRun[] rt; if (_txtrun == null) rt = new RichTextRun[0]; else rt = _txtrun.getRichTextRuns(); Thanks -Original Message- From: Tales Paiva Nogueira [mailto:[EMAIL PROTECTED] Sent: Thursday, July 13, 2006 3:15 PM To: POI Users List Subject: RE: TextBox bug Hi, I noticed this problem few days ago, I made a little change in the code, and it worked properly for my needs. The change I made was add an test to ensure that the _txtrun isn't null. Below is the code for the setSheet(Sheet sheet) in the TextBox class: public void setSheet(Sheet sheet){ _sheet = sheet; //initialize _txtrun object. //we can't do it in the constructor because the sheet is not assigned yet if(_txtrun == null) initTextRun(); if (_txtrun != null){ RichTextRun[] rt = _txtrun.getRichTextRuns(); for (int i = 0; i < rt.length; i++) { rt[i].supplySlideShow(_sheet.getSlideShow()); } if (_fontname != null) { setFontName(_fontname); _fontname = null; } } } I hope it can help you. -- Tales > I am not creating a TextBox myself... > > I have an instance of Slide, and I call the getShapes() method (some of > the shapes are TextBox instances) > > > > -Original Message- > From: Nick Burch [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 13, 2006 11:23 AM > To: POI Users List > Subject: Re: TextBox bug > > On Thu, 13 Jul 2006, Erez Eisenstein wrote: >> If I create a new ppt file, with an empty textbox in it (that says: >> "click to add subtitle"), than the _txtrun is null. This causes the >> TextBox class to throw NullPointerExceptions, in methods getText(), >> setSheet(). > > When you create a TextBox, it does create and set _txtrun (line 160 in > createSpContainer), so I'm not sure where your problem is? > > Could you supply the code you use to generate the NullPointerExceptions? > > Nick > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
RE: TextBox bug
Hi, I noticed this problem few days ago, I made a little change in the code, and it worked properly for my needs. The change I made was add an test to ensure that the _txtrun isn't null. Below is the code for the setSheet(Sheet sheet) in the TextBox class: public void setSheet(Sheet sheet){ _sheet = sheet; //initialize _txtrun object. //we can't do it in the constructor because the sheet is not assigned yet if(_txtrun == null) initTextRun(); if (_txtrun != null){ RichTextRun[] rt = _txtrun.getRichTextRuns(); for (int i = 0; i < rt.length; i++) { rt[i].supplySlideShow(_sheet.getSlideShow()); } if (_fontname != null) { setFontName(_fontname); _fontname = null; } } } I hope it can help you. -- Tales > I am not creating a TextBox myself... > > I have an instance of Slide, and I call the getShapes() method (some of > the shapes are TextBox instances) > > > > -Original Message- > From: Nick Burch [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 13, 2006 11:23 AM > To: POI Users List > Subject: Re: TextBox bug > > On Thu, 13 Jul 2006, Erez Eisenstein wrote: >> If I create a new ppt file, with an empty textbox in it (that says: >> "click to add subtitle"), than the _txtrun is null. This causes the >> TextBox class to throw NullPointerExceptions, in methods getText(), >> setSheet(). > > When you create a TextBox, it does create and set _txtrun (line 160 in > createSpContainer), so I'm not sure where your problem is? > > Could you supply the code you use to generate the NullPointerExceptions? > > Nick > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
RE: TextBox bug
Bug number - 40036 -Original Message- From: Nick Burch [mailto:[EMAIL PROTECTED] Sent: Thursday, July 13, 2006 11:42 AM To: POI Users List Subject: RE: TextBox bug On Thu, 13 Jul 2006, Erez Eisenstein wrote: > I have an instance of Slide, and I call the getShapes() method (some of > the shapes are TextBox instances) OK, can you create a new bug on bugzilla, and upload both your code and the problem powerpoint file? (We need to be able to fully replicate your bug before we can fix it!) Thanks Nick - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
RE: TextBox bug
On Thu, 13 Jul 2006, Erez Eisenstein wrote: I have an instance of Slide, and I call the getShapes() method (some of the shapes are TextBox instances) OK, can you create a new bug on bugzilla, and upload both your code and the problem powerpoint file? (We need to be able to fully replicate your bug before we can fix it!) Thanks Nick - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
RE: TextBox bug
I am not creating a TextBox myself... I have an instance of Slide, and I call the getShapes() method (some of the shapes are TextBox instances) -Original Message- From: Nick Burch [mailto:[EMAIL PROTECTED] Sent: Thursday, July 13, 2006 11:23 AM To: POI Users List Subject: Re: TextBox bug On Thu, 13 Jul 2006, Erez Eisenstein wrote: > If I create a new ppt file, with an empty textbox in it (that says: > "click to add subtitle"), than the _txtrun is null. This causes the > TextBox class to throw NullPointerExceptions, in methods getText(), > setSheet(). When you create a TextBox, it does create and set _txtrun (line 160 in createSpContainer), so I'm not sure where your problem is? Could you supply the code you use to generate the NullPointerExceptions? Nick - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: TextBox bug
On Thu, 13 Jul 2006, Erez Eisenstein wrote: If I create a new ppt file, with an empty textbox in it (that says: "click to add subtitle"), than the _txtrun is null. This causes the TextBox class to throw NullPointerExceptions, in methods getText(), setSheet(). When you create a TextBox, it does create and set _txtrun (line 160 in createSpContainer), so I'm not sure where your problem is? Could you supply the code you use to generate the NullPointerExceptions? Nick - To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/