Ignore:
Timestamp:
03/26/10 10:36:39 (10 years ago)
Author:
sander
Message:

Do not crash factory when the oooserver dies mid-conversion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/factory/src/backends/oooserver.py

    r172 r335  
    1616 
    1717from backends import Backend, BackendException 
     18from com.sun.star.uno import RuntimeException 
    1819from com.sun.star.beans import PropertyValue 
    1920from com.sun.star.connection import NoConnectException 
     
    122123                src_file_url = self.file_url(src_file) 
    123124                filter_name = self.filter_name(job['doctype'], job['format']) 
    124                 document = self.desktop.loadComponentFromURL(src_file_url, "_blank", 0, _unoProps(Hidden=True, ReadOnly=True, UpdateDocMode=QUIET_UPDATE)) 
    125125 
    126                 if document is None: 
    127                         raise OOOServerException("The document '%s' could not be opened." % src_file_url, True) 
     126                try: 
     127                        document = self.desktop.loadComponentFromURL(src_file_url, "_blank", 0, _unoProps(Hidden=True, ReadOnly=True, UpdateDocMode=QUIET_UPDATE)) 
    128128 
    129                 document.storeToURL(self.file_url(dst_file), _unoProps(FilterName=filter_name)) 
    130                 document.close(True) 
     129                        if document is None: 
     130                                raise OOOServerException("The document '%s' could not be opened." % src_file_url, True) 
     131 
     132                        document.storeToURL(self.file_url(dst_file), _unoProps(FilterName=filter_name)) 
     133                        document.close(True) 
     134                except RuntimeException: 
     135                        raise OOOServerException("UNO RuntimeException in OOOServer. The server probably died. Unloading backend.", False) 
    131136 
    132137                logging.info('OOOServer converted %s to %s' % (src_file, dst_file)) 
Note: See TracChangeset for help on using the changeset viewer.