• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Sybex 829 - Errata - page 847 - Table 14.13

 
Greenhorn
Posts: 1
IntelliJ IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
Whilst reading the study guide, specifically page 847 in Chapter 14, I noticed that the example given in Table 14.13 appears to be correct all the way up to the last line.

The next-to-last line reads as follows:
DepthPath reached
3/birds/robin/allBirds/robin/pictures
-> /birds/robin/pictures


This makes sense since 'allBirds' is a symlink/symbolic link to '/birds/'.

However, the next and final line in the table reads:
DepthPath reached
3/birds/robin/allBirds/robin/pictures/allBirds
/birds/robin/allBirds
-> /birds

(Bold emphasis added by me).

The issue I see is that 'allBirds' appears to be a child of 'pictures' at this point?
I think that this may be a confusion which occurred since the next-to-last line is '/birds/robin/allBirds/robin/pictures', so it may have just been copied and '/allBirds' appended to this line.

I put together a small demo to verify this with a directory structure as follows:

using the PowerShell command:

where '->' is a symlink and which when traversed using Windows' 'tree' command, results in the following output:

I named the symlink 'xallBirds' instead of 'allBirds' in order to get the code below and the 'tree' command to traverse the 'pictures' directory first (and keep the example simple).

And executed the following code over this directory structure:


Now, I am aware that the example in the book uses a breadth-first search and I am using a method which does a depth-first search. However, the issue here lies in the path given and not in search order.
Notice that I start past the first filesystem cycle  (by setting the 'pathToTraverse' variable on the first line accordingly) to avoid a FileSystemLoopException before I get output similar to (but correct) the last scenario in Table 14.13:

Of course, I still get a FileSystemLoopException on the next traversal, but that's besides the point. The output above is of importance.

Is this a legitimate error in the book or am I missing something?

Thank you.
 
author & internet detective
Posts: 42056
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct! I've added this to the Java 11 and 17 errata and credited you. (This text wasn't in the Java 8 edition of the book)
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic