提交 b1963e4a 编写于 作者: C chegar

7125055: ContentHandler.getContent API changed in error

Reviewed-by: alanb
上级 2cb4a1ed
...@@ -96,7 +96,7 @@ abstract public class ContentHandler { ...@@ -96,7 +96,7 @@ abstract public class ContentHandler {
* @exception IOException if an I/O error occurs while reading the object. * @exception IOException if an I/O error occurs while reading the object.
* @since 1.3 * @since 1.3
*/ */
public Object getContent(URLConnection urlc, Class<?>[] classes) throws IOException { public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
Object obj = getContent(urlc); Object obj = getContent(urlc);
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
......
...@@ -37,15 +37,16 @@ public class gif extends ContentHandler { ...@@ -37,15 +37,16 @@ public class gif extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class<?>[] classes) throws IOException { public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
for (int i = 0; i < classes.length; i++) { Class<?>[] cls = classes;
if (classes[i].isAssignableFrom(URLImageSource.class)) { for (int i = 0; i < cls.length; i++) {
if (cls[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
if (classes[i].isAssignableFrom(Image.class)) { if (cls[i].isAssignableFrom(Image.class)) {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
return tk.createImage(new URLImageSource(urlc)); return tk.createImage(new URLImageSource(urlc));
} }
} }
return null; return null;
} }
......
...@@ -36,15 +36,16 @@ public class jpeg extends ContentHandler { ...@@ -36,15 +36,16 @@ public class jpeg extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class<?>[] classes) throws IOException { public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
for (int i = 0; i < classes.length; i++) { Class<?>[] cls = classes;
if (classes[i].isAssignableFrom(URLImageSource.class)) { for (int i = 0; i < cls.length; i++) {
if (cls[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
if (classes[i].isAssignableFrom(Image.class)) { if (cls[i].isAssignableFrom(Image.class)) {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
return tk.createImage(new URLImageSource(urlc)); return tk.createImage(new URLImageSource(urlc));
} }
} }
return null; return null;
} }
......
...@@ -36,15 +36,16 @@ public class png extends ContentHandler { ...@@ -36,15 +36,16 @@ public class png extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class<?>[] classes) throws IOException { public Object getContent(URLConnection urlc, Class[] classes) throws IOException {
for (int i = 0; i < classes.length; i++) { Class<?>[] cls = classes;
if (classes[i].isAssignableFrom(URLImageSource.class)) { for (int i = 0; i < cls.length; i++) {
if (cls[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
if (classes[i].isAssignableFrom(Image.class)) { if (cls[i].isAssignableFrom(Image.class)) {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
return tk.createImage(new URLImageSource(urlc)); return tk.createImage(new URLImageSource(urlc));
} }
} }
return null; return null;
} }
......
...@@ -35,15 +35,16 @@ public class x_xbitmap extends ContentHandler { ...@@ -35,15 +35,16 @@ public class x_xbitmap extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class<?>[] classes) throws java.io.IOException { public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException {
for (int i = 0; i < classes.length; i++) { Class<?>[] cls = classes;
if (classes[i].isAssignableFrom(URLImageSource.class)) { for (int i = 0; i < cls.length; i++) {
if (cls[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
if (classes[i].isAssignableFrom(Image.class)) { if (cls[i].isAssignableFrom(Image.class)) {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
return tk.createImage(new URLImageSource(urlc)); return tk.createImage(new URLImageSource(urlc));
} }
} }
return null; return null;
} }
......
...@@ -35,15 +35,16 @@ public class x_xpixmap extends ContentHandler { ...@@ -35,15 +35,16 @@ public class x_xpixmap extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class<?>[] classes) throws java.io.IOException { public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException {
for (int i = 0; i < classes.length; i++) { Class<?>[] cls = classes;
if (classes[i].isAssignableFrom(URLImageSource.class)) { for (int i = 0; i < cls.length; i++) {
if (cls[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
if (classes[i].isAssignableFrom(Image.class)) { if (cls[i].isAssignableFrom(Image.class)) {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
return tk.createImage(new URLImageSource(urlc)); return tk.createImage(new URLImageSource(urlc));
} }
} }
return null; return null;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册