8228338: tools/pack200/TimeStamp.java fails with NullPointerException
Reviewed-by: lancea
This commit is contained in:
parent
fc0b8141d3
commit
9b23ca4eb4
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -75,6 +75,8 @@ class PackageReader extends BandStructure {
|
||||
*/
|
||||
static
|
||||
class LimitedBuffer extends BufferedInputStream {
|
||||
static final InputStream NULL_STREAM = InputStream.nullInputStream();
|
||||
|
||||
long served; // total number of charburgers served
|
||||
int servedPos; // ...as of this value of super.pos
|
||||
long limit; // current declared limit
|
||||
@ -123,7 +125,7 @@ class PackageReader extends BandStructure {
|
||||
throw new RuntimeException("no skipping");
|
||||
}
|
||||
LimitedBuffer(InputStream originalIn) {
|
||||
super(null, 1<<14);
|
||||
super(NULL_STREAM, 1<<14);
|
||||
servedPos = pos;
|
||||
super.in = new FilterInputStream(originalIn) {
|
||||
public int read() throws IOException {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 1996, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,7 +40,10 @@ public class plain extends ContentHandler {
|
||||
public Object getContent(URLConnection uc) {
|
||||
try {
|
||||
InputStream is = uc.getInputStream();
|
||||
return new PlainTextInputStream(uc.getInputStream());
|
||||
if (is == null) {
|
||||
is = InputStream.nullInputStream();
|
||||
}
|
||||
return new PlainTextInputStream(is);
|
||||
} catch (IOException e) {
|
||||
return "Error reading document:\n" + e.toString();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user