Tag: cws_src680_dba23a User: fs Date: 2007/03/08 01:09:40 Modified: dba/dbaccess/source/core/dataaccess/documentdefinition.cxx
Log: #i73084# rename: don't allow slashes in the name File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: documentdefinition.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentdefinition.cxx?r1=1.40.70.2&r2=1.40.70.3 Delta lines: +16 -8 -------------------- --- documentdefinition.cxx 26 Feb 2007 11:48:07 -0000 1.40.70.2 +++ documentdefinition.cxx 8 Mar 2007 09:09:36 -0000 1.40.70.3 @@ -4,9 +4,9 @@ * * $RCSfile: documentdefinition.cxx,v $ * - * $Revision: 1.40.70.2 $ + * $Revision: 1.40.70.3 $ * - * last change: $Author: fs $ $Date: 2007/02/26 11:48:07 $ + * last change: $Author: fs $ $Date: 2007/03/08 09:09:36 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1424,21 +1424,29 @@ return xComp; } // ----------------------------------------------------------------------------- -void SAL_CALL ODocumentDefinition::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException) +void SAL_CALL ODocumentDefinition::rename( const ::rtl::OUString& _rNewName ) throw (SQLException, ElementExistException, RuntimeException) { try { osl::ClearableGuard< osl::Mutex > aGuard(m_aMutex); - if ( newName.equals( m_pImpl->m_aProps.aTitle ) ) + if ( _rNewName.equals( m_pImpl->m_aProps.aTitle ) ) return; + // document definitions are organized in a hierarchicalway, so reject names + // which contain a /, as this is reserved for hierarchy level separation + if ( _rNewName.indexOf( '/' ) != -1 ) + { + ::dbtools::throwGenericSQLException( + DBA_RES( RID_STR_NO_SLASH_IN_OBJECT_NAME ), *this ); + } + sal_Int32 nHandle = PROPERTY_ID_NAME; - Any aOld = makeAny(m_pImpl->m_aProps.aTitle); - Any aNew = makeAny(newName); + Any aOld = makeAny( m_pImpl->m_aProps.aTitle ); + Any aNew = makeAny( _rNewName ); aGuard.clear(); fire(&nHandle, &aNew, &aOld, 1, sal_True ); - m_pImpl->m_aProps.aTitle = newName; + m_pImpl->m_aProps.aTitle = _rNewName; fire(&nHandle, &aNew, &aOld, 1, sal_False ); ::osl::ClearableGuard< ::osl::Mutex > aGuard2( m_aMutex ); @@ -1447,7 +1455,7 @@ } catch(const PropertyVetoException&) { - throw ElementExistException(newName,*this); + throw ElementExistException(_rNewName,*this); } } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
