• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Sybex 816, contribution to errata of Java OCP 11 Programmer II Study Guide

 
Greenhorn
Posts: 13
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some issues not mentioned on https://www.selikoff.net/ocp11-2/ from Java OCP 11 Programmer II Study Guide:

page 200, 4rd sentence: The noneMatch() method also returns false because one matches. => 2 match. Although you could argue that one match would be enough to result in false, this would not be in line with sentence 2 "The anyMatch() method returns true because two of the three elements match"  
page 326, just above figure 6.9: Notice the new module zoo.tickets.discount => the newly introduced module here is named zoo.tickets.etech
page 362, first sentence of the section "Submitting Task Collections": The last two methods listed in Table 7.2 that... => that should be table 7.1
page 375: section title "Applying a ReentrantLock Interface" ReentrantLock is a class. I guess this should either be something like "Applying a Lock Interface" or "Applying the ReentrantLock Class"
 
Marshal
Posts: 70654
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jos Roseboom wrote:. . . . one match would be enough to result in false . . . The anyMatch() method returns true because two of the three elements match . . .

Those two sentences don't actually contradict each other.

. . . ReentrantLock is a class. . . . "Applying the ReentrantLock Class"[/i]

I would say using a Lock object or a ReentrantLock object.
 
Jos Roseboom
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some more issues not mentioned on https://www.selikoff.net/ocp11-2/ from Java OCP 11 Programmer II Study Guide:

page 469, question 11: the questions mentions execution deleteTree("/storage"). This should be deleteTree(new File("/storage")).
page 473, question 22: ...created on line 15 => ...created on line 17
page 491, the tip: On the exam, when you see Files.resolve() => Path.resolve()
page 511, Walking a Directory with walk(), first sentence: Steam API => Stream API
page 514, table 9.6: nest.gif => wings.gif
page 525, question 18: the questions asks about possible results. If the directory consists solely of .java files, all files are printed. B is a possible answer.
page 607, question 7: stmt.executeQuery(sql) is called on a PreparedStatement. Since sql contains a bind variable, a SQLException is thrown. This still makes the correct answer F, but since the explanation did not mention throwing an exception, I guess the code should be stmt.executeQuery()
page 608, question 12, answer says whitelist, but should be blacklist? : The code checks a condition. If the condition is true, an exception is thrown to block the protected code. This seems the recipe for Blacklist, not for Whitelist (which checks on a condition to be true and only if so runs the protected code)

Those two sentences don't actually contradict each other.


They do not contradict, but the reasoning is not in line with eachother, which could be confusing.
 
author & internet detective
Posts: 40239
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Jos Roseboom wrote:page 200, 4rd sentence: The noneMatch() method also returns false because one matches. => 2 match. Although you could argue that one match would be enough to result in false, this would not be in line with sentence 2 "The anyMatch() method returns true because two of the three elements match"  


They go with the example. There are three elements in the list. Two match; one does not. For noneMatch(), it is only true if exactly zero match. In this example, there is one that doesn't match. For anyMatch(), it is true if one or more match. In this example, there are two that match. This is why we used those particular numbers. We were explaining the example the paragraph immediately follows.So the reasoning is in line with the example. Definitely not an errata

Jos Roseboom wrote:page 326, just above figure 6.9: Notice the new module zoo.tickets.discount => the newly introduced module here is named zoo.tickets.etech


Agreed. Added to errata

Jos Roseboom wrote:page 362, first sentence of the section "Submitting Task Collections": The last two methods listed in Table 7.2 that... => that should be table 7.1


Agreed. Added to errata

Jos Roseboom wrote:page 375: section title "Applying a ReentrantLock Interface" ReentrantLock is a class. I guess this should either be something like "Applying a Lock Interface" or "Applying the ReentrantLock Class"


Agreed. Added to errata
 
Jeanne Boyarsky
author & internet detective
Posts: 40239
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jos Roseboom wrote:page 469, question 11: the questions mentions execution deleteTree("/storage"). This should be deleteTree(new File("/storage")).


Agreed. Added to errata

Jos Roseboom wrote:page 473, question 22: ...created on line 15 => ...created on line 17


Agreed. Added to errata

Jos Roseboom wrote:page 491, the tip: On the exam, when you see Files.resolve() => Path.resolve()


I would say just resolve() would a better fix. But yeah, definitely an errata!

Jos Roseboom wrote:page 511, Walking a Directory with walk(), first sentence: Steam API => Stream API


Hey! Where did the "r" run off to? (Good catch; added to errata)

Jos Roseboom wrote:page 514, table 9.6: nest.gif => wings.gif


Agreed. Added to errata

Jos Roseboom wrote:page 525, question 18: the questions asks about possible results. If the directory consists solely of .java files, all files are printed. B is a possible answer.


Technically no. The question suggests /animals/fluffy exists. Since in java a "file" could be a directory, it doesn't  print fluffy

Jos Roseboom wrote:page 607, question 7: stmt.executeQuery(sql) is called on a PreparedStatement. Since sql contains a bind variable, a SQLException is thrown. This still makes the correct answer F, but since the explanation did not mention throwing an exception, I guess the code should be stmt.executeQuery()


The question is about  what attack can be made on that code. Whether the code is right or not is not relevant to the answer. This is actually important for the exam. If you get a question on the exam that looks like it is about security, it is about security. Don't read into the question and get it wrong!

Jos Roseboom wrote:page 608, question 12, answer says whitelist, but should be blacklist? : The code checks a condition. If the condition is true, an exception is thrown to block the protected code. This seems the recipe for Blacklist, not for Whitelist (which checks on a condition to be true and only if so runs the protected code)


Since the book came out, people have been starting to move away from the terms whitelist/blacklist. So I'm going to use both the original terms and terminology I'm trying to adopt in my answer. (The exam was written before the recent BLM activity though so you should expect they will still use whitelist/blacklist.)

A whitelist/allow list specifies all the characters that are allowed. In this case, it is the characters 0-9. A blacklist/deny list specifies the characters that are not allowed. So if I said you can't use &^*, that is a blacklist.  The reason whitelist/allow list is the answer is because the characters typed in the code specify what is allowed. Remember that it isn't about the true/false which runs the code. It's about what the validation is looking for.

I think an alternate definition might help you:  "A whitelist/allow list fails validation if any unexpected characters show up. A blacklist/deny list fails validation is specific characters show up". It's good practice to fail/throw san exception when validation fails regardless of which type of validation is it.
 
Jeanne Boyarsky
author & internet detective
Posts: 40239
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, have a cow for the detailed and useful errata reports!

And good luck on the exam.
 
Jos Roseboom
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,

thanks for your explanations and judging my findings.

There is one finding you didn't judge: https://coderanch.com/t/734474/certification/Sybex-Java-OCP-Programmer-II . Do you agree with the reply of Thomasz there? I've had some Enthuware questions that try to trick me into the difference of autoboxing/unboxing.

Also, have a cow for the detailed and useful errata reports!


Thanks. I've always loved cows.

And good luck on the exam.


Thanks. I passed the exam last Friday.



 
Campbell Ritchie
Marshal
Posts: 70654
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Congratulations Please search for “Wall of Fame” and add your name.
 
Jos Roseboom
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Congratulations Please search for “Wall of Fame” and add your name.


Thanks. I found and did.
 
Jeanne Boyarsky
author & internet detective
Posts: 40239
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jos Roseboom wrote:There is one finding you didn't judge: https://coderanch.com/t/734474/certification/Sybex-Java-OCP-Programmer-II . Do you agree with the reply of Thomasz there? I've had some Enthuware questions that try to trick me into the difference of autoboxing/unboxing.


Yes. In fact Thomasz was quoting me.

And congrats on your pass!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more possible errata. Table 9.3, Path methods:

This should be or some other variant. I've checked and I cannot find the overloaded method that has no parameters. If correct, this could also apply to page 756 (Kindle edition), with paragraph that starts with "Deriving a Path with relativize()".
 
Jeanne Boyarsky
author & internet detective
Posts: 40239
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Confirmed and added to errata.

Thanks for pointing that out Dario. Also, welcome to CodeRanch!
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic