You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Pe...@ibi.com on 2009/01/20 10:29:08 UTC

PDLineDashPattern missing call to super.clone()

PDLineDashPattern should be declared as a final class or in the clone
method you should call super.clone()

 

If another class sub-classed PDLineDashPattern, then a call to the clone
method would return the incorrect type of the parent class and not the
child class.

 

A simple solution is to add a call to super.clone() as the first line in
the clone method

 

 

 

   public Object clone()

    {

        super.clone() ; // add this line to resolve the issue.

 

        COSArray dash = getCOSDashPattern();

        COSArray copy = new COSArray();

        copy.addAll(dash);

        PDLineDashPattern pattern = new
PDLineDashPattern(copy,getPhaseStart() );

        return pattern;

    }

 

 

Peter