471985 NPE in HttpFields.putField
The problem had several aspects: * HttpField.add should not let a null entry be added to the fields * The putHeaders methods should have checked for a null field before trying to add it * But the fundamental problem was the JarFileResource.close was leaving exist==true, so a new entry was never created.
This commit is contained in:
parent
8c72d04415
commit
7fbf512b17
|
@ -681,11 +681,14 @@ public class HttpFields implements Iterable<HttpField>
|
|||
}
|
||||
|
||||
public void add(HttpField field)
|
||||
{
|
||||
if (field!=null)
|
||||
{
|
||||
if (_size==_fields.length)
|
||||
_fields=Arrays.copyOf(_fields,_size*2);
|
||||
_fields[_size++]=field;
|
||||
}
|
||||
}
|
||||
|
||||
public void addAll(HttpFields fields)
|
||||
{
|
||||
|
|
|
@ -57,11 +57,11 @@ class JarFileResource extends JarResource
|
|||
super(url, useCaches);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public synchronized void close()
|
||||
{
|
||||
_exists=false;
|
||||
_list=null;
|
||||
_entry=null;
|
||||
_file=null;
|
||||
|
@ -144,7 +144,6 @@ class JarFileResource extends JarResource
|
|||
|
||||
if (_urlString.endsWith("!/"))
|
||||
{
|
||||
|
||||
String file_url=_urlString.substring(4,_urlString.length()-2);
|
||||
try{return newResource(file_url).exists();}
|
||||
catch(Exception e) {LOG.ignore(e); return false;}
|
||||
|
|
Loading…
Reference in New Issue