How handle stale breadcrumb (or any other) links?

Editor
Oct 25, 2011 at 11:04 AM

In dev, I dropped and recreated my database, and then tried to follow a breadcrumb link that was still in my browser.

What I expected was some sort of error message generated by the system, or perhaps a simple 404.

Instead, I got a nullpointer exception and a 500.

Looking at the stack trace (below), I can't see any obvious places where application code might be given this error to handle.

Is this a defect?

Dan

the stack trace is below:

at NakedObjects.Core.Util.Assert.AssertTrue(String message, Object target, Boolean flag)   at NakedObjects.Core.Util.Assert.AssertTrue(String message, Boolean flag)   at NakedObjects.Core.Util.Assert.AssertNotNull(String message, Object obj)   at NakedObjects.Core.Persist.NakedObjectPersistorAbstract.GetAdapterFor(Object obj)   at NakedObjects.Core.Persist.NakedObjectPersistorAbstract.AdapterForExistingObject(Object domainObject, IOid oid)   at NakedObjects.Core.Persist.NakedObjectPersistorAbstract.AdapterFor(Object domainObject, IOid oid, IVersion version)   at NakedObjects.Core.Persist.PersistorUtils.AdapterForPersistent(IOid oid, Object domainObject)   at NakedObjects.EntityObjectStore.EntityObjectStore.GetObject(IOid oid, INakedObjectSpecification hint)   at NakedObjects.Persistor.Objectstore.ObjectStorePersistor.LoadObject(IOid oid, INakedObjectSpecification specification)   at NakedObjects.Web.Mvc.Html.FrameworkHelper.RestoreObject(IOid oid)   at NakedObjects.Web.Mvc.Html.FrameworkHelper.GetNakedObjectFromId(String encodedId)   at NakedObjects.Web.Mvc.Models.ObjectAndControlData.GetNakedObject()   at NakedObjects.Web.Mvc.Controllers.GenericControllerImpl.Details(ObjectAndControlData controlData)   at QuickCommsMvcApp.Controllers.GenericController.Details(ObjectAndControlData controlData) in C:\SDM_SUPPORT\Trunk\Code\DELIVERY4\mvc\QuickComms\QuickCommsMvcApp\Controllers\GenericController.cs:line 17   at lambda_method(Closure , ControllerBase , Object[] )   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)

Coordinator
Oct 25, 2011 at 1:30 PM

I tend to think dropping and recreating the database under the feet of a running app is sufficient reason for a crash. But if you feel it should be more elegantly handled feel free to raise an issue.

Editor
Oct 25, 2011 at 1:39 PM

Well, the point is more that even in a production system:

1) user A and user B could both view an object

2) user A could then delete it from the database

3) when user B follows a breadcrumb link to that object, their app will crash.

I've raised an issue (http://nakedobjects.codeplex.com/workitem/6)

Dan

Oct 25, 2011 at 1:40 PM
:) That was funny.

My question would be, if I have in entity link in my history, and another user deletes it, and I then click on it, will it not do the same? Or will it handle it differently?
Coordinator
Oct 25, 2011 at 1:49 PM

A link to a deleted object is explicitly handled and should take you to the 'DestroyedError' page with the text:

The object you wish to view does not exist in the database. It may have been deleted by you or another user. If not, please contact your system administrator.

Oct 25, 2011 at 2:00 PM
Sounds good. :)
Editor
Oct 25, 2011 at 2:03 PM
ah ok. That issue I raised probably overstates things, then. I'll update it.
Thx.



On 25 October 2011 14:49, scascarini <notifications@codeplex.com> wrote:

From: scascarini

A link to a deleted object is explicitly handled and should take you to the 'DestroyedError' page with the text:

The object you wish to view does not exist in the database. It may have been deleted by you or another user. If not, please contact your system administrator.

Read the full discussion online.

To add a post to this discussion, reply to this email (nakedobjects@discussions.codeplex.com)

To start a new discussion for this project, email nakedobjects@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com