Changeset 2467

Show
Ignore:
Timestamp:
09/19/08 14:30:04 (4 months ago)
Author:
dsanders
Message:

Added calls to cancelUpdates when we fail to do update operations.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/otis/src/org/bandit/otis/server/EntityHandler.java

    r2463 r2467  
    823823                boolean                         bApplyUpdates) throws OtisException 
    824824        { 
    825                 String  strEntityType; 
    826                 String  strEntityID = null; 
    827                 String  strAttrID; 
    828                 Element attributeElement; 
    829                 Element attributeValueElement; 
    830                 Element simpleDataElement; 
    831                 IEntity entity = null; 
    832                  
    833                 // Root element must be an Entity element 
    834                  
    835                 if (!DomFuncs.isElementNode( entityElement, RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ENTITY_ELEMENT)) 
    836                 { 
    837                         throwException( new OtisErrMsg( "EntityHandler(adding entity", 
    838                                 OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
    839                                 "): Request body has no " + RESTConstants.REST_ENTITY_ELEMENT + " element"), 
    840                                 null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    841                 } 
    842                  
    843                 // Entity element must have an entityType attribute 
    844                  
    845                 if ((strEntityType = entityElement.getAttribute( RESTConstants.REST_ENTITY_TYPE_ATTR)) == null) 
    846                 { 
    847                         throwException( new OtisErrMsg( "EntityHandler(adding entity", 
    848                                 OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
    849                                 "): Entity element has no " + RESTConstants.REST_ENTITY_TYPE_ATTR + " attribute"), 
    850                                 null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    851                 } 
    852                  
    853                 // Loop through all of the attributes - find the one containing the entity ID. 
    854                  
    855                 attributeElement = DomFuncs.getFirstChildElement( entityElement, RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ATTRIBUTE_ELEMENT); 
    856                 while (attributeElement != null) 
    857                 { 
    858                         if ((strAttrID = attributeElement.getAttribute( RESTConstants.REST_ATTR_ID_ATTR)) == null) 
     825                try 
     826                { 
     827                        String  strEntityType; 
     828                        String  strEntityID = null; 
     829                        String  strAttrID; 
     830                        Element attributeElement; 
     831                        Element attributeValueElement; 
     832                        Element simpleDataElement; 
     833                        IEntity entity = null; 
     834                 
     835                        // Root element must be an Entity element 
     836                         
     837                        if (!DomFuncs.isElementNode( entityElement, RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ENTITY_ELEMENT)) 
    859838                        { 
    860839                                throwException( new OtisErrMsg( "EntityHandler(adding entity", 
    861840                                        OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
    862                                         "): Attribute element has no " + RESTConstants.REST_ATTR_ID_ATTR + " attribute"), 
     841                                        "): Request body has no " + RESTConstants.REST_ENTITY_ELEMENT + " element"), 
    863842                                        null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    864843                        } 
    865                         if (strAttrID.equals( ITypedValue.ENTITYID_ATTR_VALUE_TYPE_URI_STR)) 
    866                         { 
    867                                 // There better be a single AttributeValue element with a simple Data element. 
    868                                  
    869                                 if ((attributeValueElement = DomFuncs.getFirstChildElement( attributeElement, 
    870                                                                         RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ATTRIBUTE_VALUE_ELEMENT)) == null) 
     844                         
     845                        // Entity element must have an entityType attribute 
     846                         
     847                        if ((strEntityType = entityElement.getAttribute( RESTConstants.REST_ENTITY_TYPE_ATTR)) == null) 
     848                        { 
     849                                throwException( new OtisErrMsg( "EntityHandler(adding entity", 
     850                                        OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
     851                                        "): Entity element has no " + RESTConstants.REST_ENTITY_TYPE_ATTR + " attribute"), 
     852                                        null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
     853                        } 
     854                         
     855                        // Loop through all of the attributes - find the one containing the entity ID. 
     856                         
     857                        attributeElement = DomFuncs.getFirstChildElement( entityElement, RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ATTRIBUTE_ELEMENT); 
     858                        while (attributeElement != null) 
     859                        { 
     860                                if ((strAttrID = attributeElement.getAttribute( RESTConstants.REST_ATTR_ID_ATTR)) == null) 
    871861                                { 
    872862                                        throwException( new OtisErrMsg( "EntityHandler(adding entity", 
    873863                                                OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
    874                                                 "): Attribute element containing the entity ID has no " + RESTConstants.REST_ATTRIBUTE_VALUE_ELEMENT + " element"), 
     864                                                "): Attribute element has no " + RESTConstants.REST_ATTR_ID_ATTR + " attribute"), 
    875865                                                null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    876866                                } 
     867                                if (strAttrID.equals( ITypedValue.ENTITYID_ATTR_VALUE_TYPE_URI_STR)) 
     868                                { 
     869                                        // There better be a single AttributeValue element with a simple Data element. 
     870                                         
     871                                        if ((attributeValueElement = DomFuncs.getFirstChildElement( attributeElement, 
     872                                                                                RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ATTRIBUTE_VALUE_ELEMENT)) == null) 
     873                                        { 
     874                                                throwException( new OtisErrMsg( "EntityHandler(adding entity", 
     875                                                        OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
     876                                                        "): Attribute element containing the entity ID has no " + RESTConstants.REST_ATTRIBUTE_VALUE_ELEMENT + " element"), 
     877                                                        null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
     878                                        } 
     879                                         
     880                                        // Make sure there are no other attribute value elements 
     881                                         
     882                                        if (DomFuncs.getNextSiblingElement( attributeValueElement, RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ATTRIBUTE_VALUE_ELEMENT) != null) 
     883                                        { 
     884                                                throwException( new OtisErrMsg( "EntityHandler(adding entity", 
     885                                                                OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
     886                                                                "): Attribute element containing the entity ID has multiple " + RESTConstants.REST_ATTRIBUTE_VALUE_ELEMENT + 
     887                                                                " elements, entity ID attribute must be single-valued"), 
     888                                                        null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
     889                                        } 
     890                                         
     891                                        // Better be a data element 
     892                                         
     893                                        if ((simpleDataElement = DomFuncs.getFirstChildElement( attributeValueElement, 
     894                                                                                RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_SIMPLE_DATA_ELEMENT)) == null) 
     895                                        { 
     896                                                throwException( new OtisErrMsg( "EntityHandler(adding entity", 
     897                                                        OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
     898                                                        "): AttributeValue element containing the entity ID has no " + 
     899                                                        RESTConstants.REST_SIMPLE_DATA_ELEMENT + " element"), 
     900                                                        null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
     901                                        } 
     902                                        strEntityID = DomFuncs.getNodeText( simpleDataElement); 
     903                                        if (strEntityID.trim().equals( "")) 
     904                                        { 
     905                                                throwException( new OtisErrMsg( "EntityHandler(adding entity", 
     906                                                        OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
     907                                                        "): AttributeValue element containing the entity ID has empty value"), 
     908                                                        null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
     909                                        } 
     910                                        break; 
     911                                } 
    877912                                 
    878                                 // Make sure there are no other attribute value elements 
     913                                // Go to the next attribute element. 
    879914                                 
    880                                 if (DomFuncs.getNextSiblingElement( attributeValueElement, RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ATTRIBUTE_VALUE_ELEMENT) != null) 
    881                                 { 
    882                                         throwException( new OtisErrMsg( "EntityHandler(adding entity", 
    883                                                         OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
    884                                                         "): Attribute element containing the entity ID has multiple " + RESTConstants.REST_ATTRIBUTE_VALUE_ELEMENT + 
    885                                                         " elements, entity ID attribute must be single-valued"), 
    886                                                 null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    887                                 } 
    888                                  
    889                                 // Better be a data element 
    890                                  
    891                                 if ((simpleDataElement = DomFuncs.getFirstChildElement( attributeValueElement, 
    892                                                                         RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_SIMPLE_DATA_ELEMENT)) == null) 
    893                                 { 
    894                                         throwException( new OtisErrMsg( "EntityHandler(adding entity", 
    895                                                 OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
    896                                                 "): AttributeValue element containing the entity ID has no " + 
    897                                                 RESTConstants.REST_SIMPLE_DATA_ELEMENT + " element"), 
    898                                                 null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    899                                 } 
    900                                 strEntityID = DomFuncs.getNodeText( simpleDataElement); 
    901                                 if (strEntityID.trim().equals( "")) 
    902                                 { 
    903                                         throwException( new OtisErrMsg( "EntityHandler(adding entity", 
    904                                                 OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
    905                                                 "): AttributeValue element containing the entity ID has empty value"), 
    906                                                 null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    907                                 } 
    908                                 break; 
    909                         } 
    910                          
    911                         // Go to the next attribute element. 
    912                          
    913                         attributeElement = DomFuncs.getNextSiblingElement( attributeElement, RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ATTRIBUTE_ELEMENT); 
    914                 } 
    915                  
    916                 if (strEntityID == null) 
    917                 { 
    918                         throwException( new OtisErrMsg( "EntityHandler(adding entity", 
    919                                 OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
    920                                 "): No '" + ITypedValue.ENTITYID_ATTR_VALUE_TYPE_URI_STR + "' attribute specified for " + 
    921                                 "the entity being added, cannot determine entity ID without it"), 
    922                                                 null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    923                 } 
    924                  
    925                 // We can now create the entity object, as we have an entity type and entity ID. 
    926                  
    927                 try 
    928                 { 
    929                         entity = localAuthSession.addEntity( new URI( strEntityType), strEntityID); 
    930                 } 
    931                 catch (URISyntaxException e) 
    932                 { 
    933                         throwException( new OtisErrMsg( "EntityHandler", 
    934                                         OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', Entity='" + strEntityID + "')"), 
    935                                         ": Entity type ", 
    936                                         OtisErrMsg.OPTIONAL_STR( "'" + strEntityType + "' "), 
    937                                         "is not a valid URI"), 
    938                                         e, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    939                 } 
    940                 catch (IdASException e) 
    941                 { 
    942                         throwException( new OtisErrMsg( "EntityHandler", 
    943                                         OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', Entity='" + strEntityID + "')"), 
    944                                         ": Exception " + e.getClass().getName() + " occurred while creating entity", 
    945                                         OtisErrMsg.OPTIONAL_STR( ": " + e.getMessage())), 
    946                                         e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); 
    947                 } 
    948                  
    949                 // Go through all of the child elements and process them.  They better all be 
    950                 // attribute elements at this point. 
    951                  
    952                 Node    childNode = entityElement.getFirstChild(); 
    953                 while (childNode != null) 
    954                 { 
    955                         if (childNode.getNodeType() == Node.ELEMENT_NODE) 
    956                         { 
    957                                 String  strNodeElementName = childNode.getLocalName(); 
    958                                 String  strNodeNamespace = childNode.getNamespaceURI(); 
    959                                  
    960                                 if (!strNodeNamespace.equals( RESTConstants.IDAS_REST_NAMESPACE)) 
    961                                 { 
    962                                         throwException( new OtisErrMsg( "EntityHandler", 
     915                                attributeElement = DomFuncs.getNextSiblingElement( attributeElement, RESTConstants.IDAS_REST_NAMESPACE, RESTConstants.REST_ATTRIBUTE_ELEMENT); 
     916                        } 
     917                         
     918                        if (strEntityID == null) 
     919                        { 
     920                                throwException( new OtisErrMsg( "EntityHandler(adding entity", 
     921                                        OtisErrMsg.OPTIONAL_STR( ", session='" + strSessionID + "'"), 
     922                                        "): No '" + ITypedValue.ENTITYID_ATTR_VALUE_TYPE_URI_STR + "' attribute specified for " + 
     923                                        "the entity being added, cannot determine entity ID without it"), 
     924                                                        null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
     925                        } 
     926                         
     927                        // We can now create the entity object, as we have an entity type and entity ID. 
     928                         
     929                        try 
     930                        { 
     931                                entity = localAuthSession.addEntity( new URI( strEntityType), strEntityID); 
     932                        } 
     933                        catch (URISyntaxException e) 
     934                        { 
     935                                throwException( new OtisErrMsg( "EntityHandler", 
    963936                                                OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', Entity='" + strEntityID + "')"), 
    964                                                 ": Unexpected element ", 
    965                                                 OtisErrMsg.OPTIONAL_STR( strNodeElementName + " (namespace='" + strNodeNamespace + "') "), 
    966                                                 "found as child element of the " + RESTConstants.REST_ENTITY_ELEMENT + " element"), 
    967                                                 null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    968                                 } 
    969                                 if (strNodeElementName.equals( RESTConstants.REST_ATTRIBUTE_ELEMENT)) 
    970                                 { 
    971                                         this.addAttribute( strSessionID, "Entity='" + strEntityID, entity, (Element)childNode, false, responseMap); 
    972                                 } 
    973                                 else 
    974                                 { 
    975                                         throwException( new OtisErrMsg( "EntityHandler", 
     937                                                ": Entity type ", 
     938                                                OtisErrMsg.OPTIONAL_STR( "'" + strEntityType + "' "), 
     939                                                "is not a valid URI"), 
     940                                                e, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
     941                        } 
     942                        catch (IdASException e) 
     943                        { 
     944                                throwException( new OtisErrMsg( "EntityHandler", 
    976945                                                OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', Entity='" + strEntityID + "')"), 
    977                                                 ": Unexpected element ", 
    978                                                 OtisErrMsg.OPTIONAL_STR( strNodeElementName + " (namespace='" + strNodeNamespace + "') "), 
    979                                                 "found as child element of the " + RESTConstants.REST_ENTITY_ELEMENT + " element"), 
    980                                                 null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
    981                                 } 
    982                         } 
    983                         childNode = childNode.getNextSibling(); 
    984                 } 
    985                  
    986                 // Call apply updates 
    987  
    988                 if (bApplyUpdates) 
    989                 { 
    990                         try 
    991                         { 
    992                                 localAuthSession.applyUpdates(); 
    993                         } 
    994                         catch (IdASException e) 
    995                         { 
    996                                 throwException( new OtisErrMsg( "EntityHandler", 
    997                                                 OtisErrMsg.OPTIONAL_STR( "(Entity='" + strEntityID + "', session='" + strSessionID + "')"), 
    998                                                 ": Exception " + e.getClass().getName() + " occurred calling applyUpdates", 
     946                                                ": Exception " + e.getClass().getName() + " occurred while creating entity", 
    999947                                                OtisErrMsg.OPTIONAL_STR( ": " + e.getMessage())), 
    1000948                                                e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); 
    1001949                        } 
     950                         
     951                        // Go through all of the child elements and process them.  They better all be 
     952                        // attribute elements at this point. 
     953                         
     954                        Node    childNode = entityElement.getFirstChild(); 
     955                        while (childNode != null) 
     956                        { 
     957                                if (childNode.getNodeType() == Node.ELEMENT_NODE) 
     958                                { 
     959                                        String  strNodeElementName = childNode.getLocalName(); 
     960                                        String  strNodeNamespace = childNode.getNamespaceURI(); 
     961                                         
     962                                        if (!strNodeNamespace.equals( RESTConstants.IDAS_REST_NAMESPACE)) 
     963                                        { 
     964                                                throwException( new OtisErrMsg( "EntityHandler", 
     965                                                        OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', Entity='" + strEntityID + "')"), 
     966                                                        ": Unexpected element ", 
     967                                                        OtisErrMsg.OPTIONAL_STR( strNodeElementName + " (namespace='" + strNodeNamespace + "') "), 
     968                                                        "found as child element of the " + RESTConstants.REST_ENTITY_ELEMENT + " element"), 
     969                                                        null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
     970                                        } 
     971                                        if (strNodeElementName.equals( RESTConstants.REST_ATTRIBUTE_ELEMENT)) 
     972                                        { 
     973                                                this.addAttribute( strSessionID, "Entity='" + strEntityID, entity, (Element)childNode, false, responseMap); 
     974                                        } 
     975                                        else 
     976                                        { 
     977                                                throwException( new OtisErrMsg( "EntityHandler", 
     978                                                        OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', Entity='" + strEntityID + "')"), 
     979                                                        ": Unexpected element ", 
     980                                                        OtisErrMsg.OPTIONAL_STR( strNodeElementName + " (namespace='" + strNodeNamespace + "') "), 
     981                                                        "found as child element of the " + RESTConstants.REST_ENTITY_ELEMENT + " element"), 
     982                                                        null, HttpServletResponse.SC_BAD_REQUEST, responseMap); 
     983                                        } 
     984                                } 
     985                                childNode = childNode.getNextSibling(); 
     986                        } 
     987                         
     988                        // Call apply updates 
     989         
     990                        if (bApplyUpdates) 
     991                        { 
     992                                try 
     993                                { 
     994                                        localAuthSession.applyUpdates(); 
     995                                } 
     996                                catch (IdASException e) 
     997                                { 
     998                                        throwException( new OtisErrMsg( "EntityHandler", 
     999                                                        OtisErrMsg.OPTIONAL_STR( "(Entity='" + strEntityID + "', session='" + strSessionID + "')"), 
     1000                                                        ": Exception " + e.getClass().getName() + " occurred calling applyUpdates", 
     1001                                                        OtisErrMsg.OPTIONAL_STR( ": " + e.getMessage())), 
     1002                                                        e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); 
     1003                                } 
     1004                        } 
     1005                } 
     1006                catch (OtisException e) 
     1007                { 
     1008                        if (bApplyUpdates) 
     1009                        { 
     1010                                try 
     1011                                { 
     1012                                        localAuthSession.cancelUpdates(); 
     1013                                } 
     1014                                catch (IdASException e2) 
     1015                                { 
     1016                                } 
     1017                        } 
     1018                        throw e; 
    10021019                } 
    10031020        } 
     
    14471464                Map                                     responseMap) throws OtisException 
    14481465        { 
    1449                 validateAttrID( strSessionID, strAttrContainer, strAttrID, "remove", null, responseMap); 
    14501466                try 
    14511467                { 
    1452                         attrContainer.removeAttribute( new URI( strAttrID)); 
    1453                 } 
    1454                 catch (URISyntaxException e) 
    1455                 { 
    1456                         throwException( new OtisErrMsg( "EntityHandler", 
    1457                                 OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', " + strAttrContainer + ")"), 
    1458                                 ": URISyntaxException parsing attribute URI", 
    1459                                 OtisErrMsg.OPTIONAL_STR( " '" + strAttrID + "': " + e.getMessage())), 
    1460                                 null, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); 
    1461                 } 
    1462                 catch (IdASException e) 
    1463                 { 
    1464                         throwException( new OtisErrMsg( "EntityHandler", 
    1465                                                 OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', " + strAttrContainer + ")"), 
    1466                                                 ": Exception " + e.getClass().getName() + " occurred while removing attribute", 
    1467                                                 OtisErrMsg.OPTIONAL_STR( " '" + strAttrID + "': " + e.getMessage())), 
    1468                                         e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); 
    1469                 } 
    1470                  
    1471                 if (localAuthSession != null) 
    1472                 { 
     1468                        validateAttrID( strSessionID, strAttrContainer, strAttrID, "remove", null, responseMap); 
    14731469                        try 
    14741470                        { 
    1475                                 localAuthSession.applyUpdates(); 
     1471                                attrContainer.removeAttribute( new URI( strAttrID)); 
     1472                        } 
     1473                        catch (URISyntaxException e) 
     1474                        { 
     1475                                throwException( new OtisErrMsg( "EntityHandler", 
     1476                                        OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', " + strAttrContainer + ")"), 
     1477                                        ": URISyntaxException parsing attribute URI", 
     1478                                        OtisErrMsg.OPTIONAL_STR( " '" + strAttrID + "': " + e.getMessage())), 
     1479                                        null, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); 
    14761480                        } 
    14771481                        catch (IdASException e) 
    14781482                        { 
    14791483                                throwException( new OtisErrMsg( "EntityHandler", 
    1480                                                 OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', " + strAttrContainer + ")"), 
    1481                                                 ": Exception " + e.getClass().getName() + " occurred calling applyUpdates", 
    1482                                                 OtisErrMsg.OPTIONAL_STR( ": " + e.getMessage())), 
     1484                                                        OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', " + strAttrContainer + ")"), 
     1485                                                        ": Exception " + e.getClass().getName() + " occurred while removing attribute", 
     1486                                                        OtisErrMsg.OPTIONAL_STR( " '" + strAttrID + "': " + e.getMessage())), 
    14831487                                                e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); 
    14841488                        } 
    1485                 } 
    1486                  
     1489                         
     1490                        if (localAuthSession != null) 
     1491                        { 
     1492                                try 
     1493                                { 
     1494                                        localAuthSession.applyUpdates(); 
     1495                                } 
     1496                                catch (IdASException e) 
     1497                                { 
     1498                                        throwException( new OtisErrMsg( "EntityHandler", 
     1499                                                        OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', " + strAttrContainer + ")"), 
     1500                                                        ": Exception " + e.getClass().getName() + " occurred calling applyUpdates", 
     1501                                                        OtisErrMsg.OPTIONAL_STR( ": " + e.getMessage())), 
     1502                                                        e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, responseMap); 
     1503                                } 
     1504                        } 
     1505                } 
     1506                catch (OtisException e) 
     1507                { 
     1508                        if (localAuthSession != null) 
     1509                        { 
     1510                                try 
     1511                                { 
     1512                                        localAuthSession.cancelUpdates(); 
     1513                                } 
     1514                                catch (IdASException e2) 
     1515                                { 
     1516                                } 
     1517                        } 
     1518                        throw e; 
     1519                } 
    14871520        } 
    14881521         
     
    15001533                Node            childNode; 
    15011534                String  strElementName = RESTConstants.REST_ATTRIBUTE_CHANGE_ELEMENT; 
    1502                  
    1503                 if ((strAttrID = attributeChangeElement.getAttribute( RESTConstants.REST_ATTR_ID_ATTR)) == null) 
    1504                 { 
    1505                         if (strURLAttrID == null) 
    1506                         { 
    1507                                 throwException( new OtisErrMsg( "EntityHandler", 
    1508                                         OtisErrMsg.OPTIONAL_STR( "(session='" + strSessionID + "', " + strAttrContainer + ")"), 
    1509                                         ": Missing " + RESTConstants.REST_ATTR_ID_ATTR + " on the " + RESTConstants.REST_ATTRIBUTE_CHANGE_ELEMENT + " element"),