
/*
 * Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
 */

package org.jsimpledb.core;

/**
 * Thrown when a field of a deleted object is accessed.
 */
@SuppressWarnings("serial")
public class DeletedObjectException extends DatabaseException {

    private final ObjId id;

    /**
     * Constructor.
     *
     * @param id the ID of the object that was not found
     */
    public DeletedObjectException(ObjId id) {
        super("object with ID " + id + " not found");
        this.id = id;
    }

    /**
     * Constructor.
     *
     * @param tx the transaction within which this exception was generated
     * @param id the ID of the object that was not found
     */
    public DeletedObjectException(Transaction tx, ObjId id) {
        super("object with ID " + id + " (" + DeletedObjectException.getTypeDescription(tx, id) + ") not found");
        this.id = id;
    }

    /**
     * Get the ID of the object that could not be accessed.
     *
     * @return deleted object's ID
     */
    public ObjId getId() {
        return this.id;
    }

    private static String getTypeDescription(Transaction tx, ObjId id) {
        final int storageId = id.getStorageId();
        final ObjType type = tx != null ? tx.schema.objTypeMap.get(id.getStorageId()) : null;
        if (type == null)
            return "storage ID " + storageId;
        return "type `" + type.getName() + "' having storage ID " + storageId;
    }
}


@@ -423,38 +423,41 @@
 d id) %7B%0A        
-super(
+this(id, 
 %22object with ID 
@@ -480,38 +480,16 @@
 ound%22);%0A
-        this.id = id;%0A
     %7D%0A%0A 
@@ -736,14 +736,17 @@
     
-super(
+this(id, 
 %22obj
@@ -837,24 +837,329 @@
 ot found%22);%0A
+    %7D%0A%0A    /**%0A     * Constructor.%0A     *%0A     * @param tx the transaction within which this exception was generated%0A     * @param id the ID of the object that was not found%0A     * @param message detail message%0A     */%0A    public DeletedObjectException(ObjId id, String message) %7B%0A        super(message);%0A
         this
@@ -1355,24 +1355,16 @@
  %7D%0A%0A    
-private 
 static S
@@ -1585,16 +1585,16 @@
 = null)%0A
-
         
@@ -1605,16 +1605,28 @@
 return %22
+type having 
 storage 

Add constructor to DeletedObjectException taking custom message.