< prev index next >
src/java.base/share/classes/sun/net/www/content/text/plain.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1994, 1996, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 38,48 ****
* can be read.
*/
public Object getContent(URLConnection uc) {
try {
InputStream is = uc.getInputStream();
! return new PlainTextInputStream(uc.getInputStream());
} catch (IOException e) {
return "Error reading document:\n" + e.toString();
}
}
}
--- 38,51 ----
* can be read.
*/
public Object getContent(URLConnection uc) {
try {
InputStream is = uc.getInputStream();
! if (is == null) {
! is = InputStream.nullInputStream();
! }
! return new PlainTextInputStream(is);
} catch (IOException e) {
return "Error reading document:\n" + e.toString();
}
}
}
< prev index next >