-
Bug
-
Resolution: Not an Issue
-
P3
-
7, 8
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Grep.java is just one example ... more files are affected.
The examples won't compile due to every few lines some code was duplicated.
Maybe some automatic formatter tool messed up the examples on updating whitespace? Some of the lines are indented with spaces and their duplicates are indented using tabs.
Hopefully you can resurrect a better version from some previous release?
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
// Search for occurrences of the input pattern in the given file
//
private static void grep(File f) throws IOException {
// Open the file and then get a channel from the stream
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
// Get the file's size and then map it into memory
int sz = (int)fc.size();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
// Decode the file into a char buffer
CharBuffer cb = decoder.decode(bb);
// Perform the search
grep(f, cb);
// Close the channel and the stream
fc.close();
}
ACTUAL -
// Search for occurrences of the input pattern in the given file
//
private static void grep(File f) throws IOException {
// Open the file and then get a channel from the stream
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
// Open the file and then get a channel from the stream
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
// Get the file's size and then map it into memory
int sz = (int)fc.size();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
// Get the file's size and then map it into memory
int sz = (int)fc.size();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
// Decode the file into a char buffer
CharBuffer cb = decoder.decode(bb);
// Decode the file into a char buffer
CharBuffer cb = decoder.decode(bb);
// Perform the search
grep(f, cb);
// Perform the search
grep(f, cb);
// Close the channel and the stream
fc.close();
// Close the channel and the stream
fc.close();
}
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/8/docs/technotes/guides/io/example/Grep.java
Grep.java is just one example ... more files are affected.
The examples won't compile due to every few lines some code was duplicated.
Maybe some automatic formatter tool messed up the examples on updating whitespace? Some of the lines are indented with spaces and their duplicates are indented using tabs.
Hopefully you can resurrect a better version from some previous release?
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
// Search for occurrences of the input pattern in the given file
//
private static void grep(File f) throws IOException {
// Open the file and then get a channel from the stream
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
// Get the file's size and then map it into memory
int sz = (int)fc.size();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
// Decode the file into a char buffer
CharBuffer cb = decoder.decode(bb);
// Perform the search
grep(f, cb);
// Close the channel and the stream
fc.close();
}
ACTUAL -
// Search for occurrences of the input pattern in the given file
//
private static void grep(File f) throws IOException {
// Open the file and then get a channel from the stream
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
// Open the file and then get a channel from the stream
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();
// Get the file's size and then map it into memory
int sz = (int)fc.size();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
// Get the file's size and then map it into memory
int sz = (int)fc.size();
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
// Decode the file into a char buffer
CharBuffer cb = decoder.decode(bb);
// Decode the file into a char buffer
CharBuffer cb = decoder.decode(bb);
// Perform the search
grep(f, cb);
// Perform the search
grep(f, cb);
// Close the channel and the stream
fc.close();
// Close the channel and the stream
fc.close();
}
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/8/docs/technotes/guides/io/example/Grep.java