Commits

Anonymous committed 9e2dd05

tl88:#i100744# Better exception handling while retrieving information from packages

  • Participants
  • Parent commits e93b31d

Comments (0)

Files changed (2)

File desktop/source/deployment/gui/dp_gui_extlistbox.cxx

     m_pPublisher( NULL ),
     m_xPackage( xPackage )
 {
-    m_sTitle = xPackage->getDisplayName();
-    m_sVersion = xPackage->getVersion();
-    m_sDescription = xPackage->getDescription();
+    try
+    {
+        m_sTitle = xPackage->getDisplayName();
+        m_sVersion = xPackage->getVersion();
+        m_sDescription = xPackage->getDescription();
 
-    beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
-    m_sPublisher = aInfo.First;
-    m_sPublisherURL = aInfo.Second;
-    
-    // get the icons for the package if there are any
-    uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
-    if ( xGraphic.is() )
-        m_aIcon = Image( xGraphic );
+        beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
+        m_sPublisher = aInfo.First;
+        m_sPublisherURL = aInfo.Second;
 
-    xGraphic = xPackage->getIcon( true );
-    if ( xGraphic.is() )
-        m_aIconHC = Image( xGraphic );
-    else
-        m_aIconHC = m_aIcon;
+        // get the icons for the package if there are any
+        uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
+        if ( xGraphic.is() )
+            m_aIcon = Image( xGraphic );
 
-    if ( eState == AMBIGUOUS )
-        m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
-    else if ( eState == NOT_REGISTERED )
-        checkDependencies();
+        xGraphic = xPackage->getIcon( true );
+        if ( xGraphic.is() )
+            m_aIconHC = Image( xGraphic );
+        else
+            m_aIconHC = m_aIcon;
+
+        if ( eState == AMBIGUOUS )
+            m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
+        else if ( eState == NOT_REGISTERED )
+            checkDependencies();
+    }
+    catch (deployment::ExtensionRemovedException &) {}
+    catch (uno::RuntimeException &) {}
 }
 
 //------------------------------------------------------------------------------
     bool         bLocked = m_pManager->isReadOnly( xPackage );
 
     TEntry_Impl pEntry( new Entry_Impl( xPackage, eState, bLocked ) );
+
+    // Don't add empty entries
+    if ( ! pEntry->m_sTitle.Len() )
+        return 0;
+
     xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
 
     ::osl::ClearableMutexGuard guard(m_entriesMutex);

File desktop/source/deployment/registry/package/dp_package.cxx

     if (sRelativeURL.getLength())   
     {
         OUString sURL = m_url_expanded + OUSTR("/") + sRelativeURL;
-        sDescription = getTextFromURL(
-            css::uno::Reference< css::ucb::XCommandEnvironment >(), sURL);
 
+        try
+        {
+            sDescription = getTextFromURL( css::uno::Reference< css::ucb::XCommandEnvironment >(), sURL );
+        }
+        catch ( css::deployment::DeploymentException& )
+        {
+            OSL_ENSURE( 0, ::rtl::OUStringToOString( ::comphelper::anyToString( ::cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 ).getStr() );
+        }
     }
+
     if (sDescription.getLength())
-        return sDescription;       
-    else if(m_oldDescription.getLength())
-        return m_oldDescription;
-    else
-        return OUString();
+        return sDescription;
+    return m_oldDescription;
 }
 
 //______________________________________________________________________________