summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorMikhail Voitenko <mav@openoffice.org>2002-12-09 15:29:09 +0000
committerMikhail Voitenko <mav@openoffice.org>2002-12-09 15:29:09 +0000
commit2f7858fd1ea0e51a3a02fd83614af4179cdaf275 (patch)
tree391051e33ec74b2042e6ba4e36ba5b23aaf2a1dd /unotools
parente6e224d2a8d9258dd6acbcf629b32e6abb60ed63 (diff)
#106116# file-content throws NameClashException in case catalog exists
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/ucbhelper/ucbhelper.cxx26
1 files changed, 20 insertions, 6 deletions
diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx
index 76bee5189a11..f508cd756a51 100644
--- a/unotools/source/ucbhelper/ucbhelper.cxx
+++ b/unotools/source/ucbhelper/ucbhelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ucbhelper.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: mav $ $Date: 2002-11-05 09:00:53 $
+ * last change: $Author: mav $ $Date: 2002-12-09 16:29:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,9 @@
#ifndef _COM_SUN_STAR_UCB_ILLEGALIDENTIFIEREXCEPTION_HPP_
#include <com/sun/star/ucb/IllegalIdentifierException.hpp>
#endif
+#ifndef _COM_SUN_STAR_UCB_NAMECLASHEXCEPTION_HPP_
+#include <com/sun/star/ucb/NameClashException.hpp>
+#endif
#ifndef _COM_SUN_STAR_UCB_NAMECLASH_HPP_
#include <com/sun/star/ucb/NameClash.hpp>
#endif
@@ -604,6 +607,8 @@ sal_Bool UCBContentHelper::MakeFolder( const String& rFolder )
sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Content& rNew )
{
+ sal_Bool bRecover = sal_False;
+
try
{
Reference< XContentCreator > xCreator = Reference< XContentCreator >( aCnt.get(), UNO_QUERY );
@@ -648,12 +653,13 @@ sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Cont
{
if ( r.Code == IOErrorCode_ALREADY_EXISTING )
{
- INetURLObject aObj( aCnt.getURL() );
- aObj.Append( aTitle );
- rNew = Content( aObj.GetMainURL( INetURLObject::NO_DECODE ), Reference < XCommandEnvironment >() );
- return TRUE;
+ bRecover = sal_True;
}
}
+ catch ( NameClashException& )
+ {
+ bRecover = sal_True;
+ }
catch( ::com::sun::star::ucb::CommandAbortedException& )
{
}
@@ -664,6 +670,14 @@ sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Cont
{
}
+ if( bRecover )
+ {
+ INetURLObject aObj( aCnt.getURL() );
+ aObj.Append( aTitle );
+ rNew = Content( aObj.GetMainURL( INetURLObject::NO_DECODE ), Reference < XCommandEnvironment >() );
+ return sal_True;
+ }
+
return sal_False;
}