[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Paperclips-discuss] HEAD, was: API_23_ALPHA_2_1
From: |
Nic Ferrier |
Subject: |
Re: [Paperclips-discuss] HEAD, was: API_23_ALPHA_2_1 |
Date: |
Tue, 26 Jun 2001 00:54:51 +0100 |
>>> "Christopher K. St. John" <address@hidden> 25-Jun-01
11:32:02 PM >>>
HTTPResponse.java:
001: public void setContentType(String type) {
002: if(type!=null || type.length()<1)
003: setHeader("Content-Type",type);
004: }
NullPointerException's on type==null,
Whoops! yes, that's a bad one isn't it... bugs like this may have
crept in since I introduced the HTTPResponse which used to be part of
HTTPConnection (till the 2.2 API forced seperate classes by having
duplicate method names in request and response classes).
002: if (type==null || type.length()<1) return;
003: setHeader("Content-Type", type);
Seems to me that this would be better:
if(type!=null && type.length()>0)
setHeader("Content-Type",type);
It's just clearer, that's what I've done (it's checking in as I
write). If you can find a performance reason for doing the simpler
equality check then I'll change it to what you suggested.
Nic