diff -r ebf7c13df6c0 -r 4ee7de0684f5 src/share/classes/com/sun/tools/javadoc/DocImpl.java --- a/src/share/classes/com/sun/tools/javadoc/DocImpl.java Fri Mar 04 19:53:03 2011 -0800 +++ b/src/share/classes/com/sun/tools/javadoc/DocImpl.java Fri Mar 04 19:56:02 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 @@ -25,6 +25,7 @@ package com.sun.tools.javadoc; +import java.io.DataInputStream; import java.io.InputStream; import java.io.IOException; import java.text.CollationKey; @@ -33,6 +34,8 @@ import com.sun.javadoc.*; import com.sun.tools.javac.util.Position; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * abstract base class of all Doc classes. Doc item's are representations @@ -166,51 +169,28 @@ * Utility for subclasses which read HTML documentation files. */ String readHTMLDocumentation(InputStream input, FileObject filename) throws IOException { - int filesize = input.available(); - byte[] filecontents = new byte[filesize]; - input.read(filecontents, 0, filesize); - input.close(); + byte[] filecontents = new byte[input.available()]; + try { + DataInputStream dataIn = new DataInputStream(input); + dataIn.readFully(filecontents); + } finally { + input.close(); + } String encoding = env.getEncoding(); String rawDoc = (encoding!=null) ? new String(filecontents, encoding) : new String(filecontents); - String upper = null; - int bodyIdx = rawDoc.indexOf("', bodyIdx); - if (bodyIdx == -1) { - env.error(SourcePositionImpl.make(filename, Position.NOPOS, null), - "javadoc.Body_missing_from_html_file"); + Pattern bodyPat = Pattern.compile("(?is).*]*>(.*)