Hi Chris, I will look at the issue ASAP. Indeed, you need to create an account on Tigris.org to be able to report bugs/RFEs.
Best regards, Jerome > -----Message d'origine----- > De : Chris Grindstaff [mailto:[EMAIL PROTECTED] > Envoyé : samedi 18 novembre 2006 03:25 > À : [email protected] > Objet : Bug: EncoderRepresentation causes NPE > > Hello , > > I tried to file this via the Issue tracker but maybe you need to login > to create a defect? > > As you can see in the shortened stack trace below I have a Person > representation that I'm trying to encode with gzip. > > Short aside: > This is one of several reasons why Factory methods are > better than constructors. It's easy to have unintentional side-effects > with constructors and subclasses. (Also why composition is preferred > to subclassing) > > EncoderRepresentation(WrapperRepresentation).getWrappedReprese > ntation() line: 289 > EncoderRepresentation(WrapperRepresentation).getVariants() > line: 280 > EncoderRepresentation(Representation).<init>(MediaType) line: > 125 > EncoderRepresentation(Representation).<init>() line: 101 > EncoderRepresentation(WrapperRepresentation).<init>(Representa > tion) line: 61 > EncoderRepresentation.<init>(Encoding, Representation) line: 60 > Person.asJSON() line: 105 > > The way EncoderRepresentation subclasses WrapperRepresentation means > this isn't currently possible since getWrappedRepresentation is being > called from the superclasses constructor before it has been assigned > in EncoderRepresentation. > > I'm not a big fan of adding null checks and duplicating code but this > will solve the problem, although in the end maybe it makes more sense > to restructure this code. > > Few other things I noticed about the constructors: > Curious why nulls are being assigned to several of the fields in > Representation(MediaType) since these isn't needed. > > Thoughts? > Chris > -- > Chris Grindstaff | http://gstaff.org

