If I have the following code:
try {
Entity questionEntity = datastore.get(currentKey);
questionEntity.doSomething();
} catch (EntityNotFoundException e) {
Entity questionEntity = new Entity(currentKey);
}
Where the datastore.get() function throws an exception, will the following lines of code (questionEntity.doSomething();) in the try block be executed?
No,
questionEntity.doSomething();will won’t be executed ifdatastore.get(currentKey);throws an exception and this is trivially easy to verify and would have probably taken you less time to try it out yourself rather than posting a question on SO.