[udig-devel] Udig trunk and printing

Mauro Bartolomeoli m.bartolomeoli at esalab.it
Fri Apr 18 03:24:56 PDT 2008


Unfortunately not, but I found what was the problem. I had to change the 
getText method of LegendGraphic to this:

private String getText( Rule rule ) {
        String text = ""; //$NON-NLS-1$
        if (rule.getTitle()!=null && !"".equals(rule.getTitle())) { 
//$NON-NLS-1$
            text = rule.getTitle();
        } else if (rule.getTitle()!=null && !"".equals(rule.getName())) 
{ //$NON-NLS-1$
            text = rule.getName();
        } else if(rule.getFilter()!=null){
            text = rule.getFilter().toString();
        }
        if (text.length() > 19) {
            return text.substring(0, 18) + "..."; //$NON-NLS-1$
        } else {
            return text;
        }
    }

In short, title, name and filter were null, but the code was looking for 
empty strings, so a null value was assigned to text, bringing 
text.length() test to a NullPointerException.



Jody Garnett wrote:
> Mauro Bartolomeoli wrote:
>> Sure :-) My problem was that the menu entry "Print" in the File menu 
>> had disappeared... I did an svn update and the print command was 
>> available again... maybe some problem in my working copy. Now I can 
>> open the Printing Page, but I get an infinite loop of exceptions, 
>> related to the legend part I presume (the remaining parts are 
>> appearing in the preview, the only one missing is the legend).
> We were able to solve this problem on trunk; by looking what had 
> changed on 1.1.x.
> Can you give this another go Mauro I would like to confirm it is 
> working for you.
>
> Jody
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel


More information about the udig-devel mailing list