connectivity/source/drivers/file/FStatement.cxx                 |  110 
++++------
 connectivity/source/drivers/firebird/ResultSet.cxx              |    6 
 connectivity/source/drivers/postgresql/pq_preparedstatement.cxx |    9 
 connectivity/source/manager/mdrivermanager.cxx                  |   15 -
 cppuhelper/source/servicemanager.cxx                            |   48 ++--
 cpputools/source/unoexe/unoexe.cxx                              |   90 ++++----
 cui/source/options/optaboutconfig.cxx                           |   25 --
 dbaccess/source/core/api/RowSet.cxx                             |   58 ++---
 dbaccess/source/core/api/SingleSelectQueryComposer.cxx          |   29 +-
 dbaccess/source/core/api/TableDeco.cxx                          |   27 --
 dbaccess/source/ui/querydesign/JAccess.cxx                      |   25 +-
 desktop/source/app/officeipcthread.cxx                          |   24 +-
 desktop/source/deployment/manager/dp_manager.cxx                |   25 +-
 desktop/source/pkgchk/unopkg/unopkg_app.cxx                     |   10 
 desktop/source/pkgchk/unopkg/unopkg_misc.cxx                    |    7 
 15 files changed, 229 insertions(+), 279 deletions(-)

New commits:
commit 2a612907aef4c9987f906c6b98aa9b400f58f617
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Wed Sep 20 16:14:49 2017 +0200

    loplugin:flatten in connectivity..desktop
    
    Change-Id: Iff59d3049ba40b4338ef8eec67d08a96b0834d2b
    Reviewed-on: https://gerrit.libreoffice.org/42578
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/connectivity/source/drivers/file/FStatement.cxx 
b/connectivity/source/drivers/file/FStatement.cxx
index ec86d0a28603..e275e7d1aa19 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -372,74 +372,72 @@ void OStatement_Base::construct(const OUString& sql)
 {
     OUString aErr;
     m_pParseTree = m_aParser.parseTree(aErr,sql);
-    if(m_pParseTree)
-    {
-        m_aSQLIterator.setParseTree(m_pParseTree);
-        m_aSQLIterator.traverseAll();
-        const OSQLTables& rTabs = m_aSQLIterator.getTables();
+    if(!m_pParseTree)
+        throw SQLException(aErr,*this,OUString(),0,Any());
 
-        // sanity checks
-        if ( rTabs.empty() )
-            // no tables -> nothing to operate on -> error
-            m_pConnection->throwGenericSQLException(STR_QUERY_NO_TABLE,*this);
+    m_aSQLIterator.setParseTree(m_pParseTree);
+    m_aSQLIterator.traverseAll();
+    const OSQLTables& rTabs = m_aSQLIterator.getTables();
 
-        if ( rTabs.size() > 1 || m_aSQLIterator.hasErrors() )
-            // more than one table -> can't operate on them -> error
-            
m_pConnection->throwGenericSQLException(STR_QUERY_MORE_TABLES,*this);
+    // sanity checks
+    if ( rTabs.empty() )
+        // no tables -> nothing to operate on -> error
+        m_pConnection->throwGenericSQLException(STR_QUERY_NO_TABLE,*this);
 
-        if ( (m_aSQLIterator.getStatementType() == OSQLStatementType::Select) 
&& m_aSQLIterator.getSelectColumns()->get().empty() )
-            // SELECT statement without columns -> error
-            m_pConnection->throwGenericSQLException(STR_QUERY_NO_COLUMN,*this);
+    if ( rTabs.size() > 1 || m_aSQLIterator.hasErrors() )
+        // more than one table -> can't operate on them -> error
+        m_pConnection->throwGenericSQLException(STR_QUERY_MORE_TABLES,*this);
 
-        switch(m_aSQLIterator.getStatementType())
-        {
-            case OSQLStatementType::CreateTable:
-            case OSQLStatementType::OdbcCall:
-            case OSQLStatementType::Unknown:
-                
m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
-                break;
-            default:
-                break;
-        }
+    if ( (m_aSQLIterator.getStatementType() == OSQLStatementType::Select) && 
m_aSQLIterator.getSelectColumns()->get().empty() )
+        // SELECT statement without columns -> error
+        m_pConnection->throwGenericSQLException(STR_QUERY_NO_COLUMN,*this);
 
-        // at this moment we support only one table per select statement
-        Reference< css::lang::XUnoTunnel> 
xTunnel(rTabs.begin()->second,UNO_QUERY);
-        if(xTunnel.is())
-        {
-            m_pTable = 
reinterpret_cast<OFileTable*>(xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()));
-        }
-        OSL_ENSURE(m_pTable.is(),"No table!");
-        if ( m_pTable.is() )
-            m_xColNames     = m_pTable->getColumns();
-        Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
-        // set the binding of the resultrow
-        m_aRow          = new OValueRefVector(xNames->getCount());
-        (m_aRow->get())[0]->setBound(true);
-        
std::for_each(m_aRow->get().begin()+1,m_aRow->get().end(),TSetRefBound(false));
+    switch(m_aSQLIterator.getStatementType())
+    {
+        case OSQLStatementType::CreateTable:
+        case OSQLStatementType::OdbcCall:
+        case OSQLStatementType::Unknown:
+            
m_pConnection->throwGenericSQLException(STR_QUERY_TOO_COMPLEX,*this);
+            break;
+        default:
+            break;
+    }
 
-        // set the binding of the resultrow
-        m_aEvaluateRow  = new OValueRefVector(xNames->getCount());
+    // at this moment we support only one table per select statement
+    Reference< css::lang::XUnoTunnel> xTunnel(rTabs.begin()->second,UNO_QUERY);
+    if(xTunnel.is())
+    {
+        m_pTable = 
reinterpret_cast<OFileTable*>(xTunnel->getSomething(OFileTable::getUnoTunnelImplementationId()));
+    }
+    OSL_ENSURE(m_pTable.is(),"No table!");
+    if ( m_pTable.is() )
+        m_xColNames     = m_pTable->getColumns();
+    Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
+    // set the binding of the resultrow
+    m_aRow          = new OValueRefVector(xNames->getCount());
+    (m_aRow->get())[0]->setBound(true);
+    
std::for_each(m_aRow->get().begin()+1,m_aRow->get().end(),TSetRefBound(false));
 
-        (m_aEvaluateRow->get())[0]->setBound(true);
-        
std::for_each(m_aEvaluateRow->get().begin()+1,m_aEvaluateRow->get().end(),TSetRefBound(false));
+    // set the binding of the resultrow
+    m_aEvaluateRow  = new OValueRefVector(xNames->getCount());
 
-        // set the select row
-        m_aSelectRow = new 
OValueRefVector(m_aSQLIterator.getSelectColumns()->get().size());
-        
std::for_each(m_aSelectRow->get().begin(),m_aSelectRow->get().end(),TSetRefBound(true));
+    (m_aEvaluateRow->get())[0]->setBound(true);
+    
std::for_each(m_aEvaluateRow->get().begin()+1,m_aEvaluateRow->get().end(),TSetRefBound(false));
 
-        // create the column mapping
-        createColumnMapping();
+    // set the select row
+    m_aSelectRow = new 
OValueRefVector(m_aSQLIterator.getSelectColumns()->get().size());
+    
std::for_each(m_aSelectRow->get().begin(),m_aSelectRow->get().end(),TSetRefBound(true));
 
-        m_pSQLAnalyzer = new OSQLAnalyzer(m_pConnection.get());
+    // create the column mapping
+    createColumnMapping();
 
-        Reference<XIndexesSupplier> xIndexSup(xTunnel,UNO_QUERY);
-        if(xIndexSup.is())
-            m_pSQLAnalyzer->setIndexes(xIndexSup->getIndexes());
+    m_pSQLAnalyzer = new OSQLAnalyzer(m_pConnection.get());
 
-        anylizeSQL();
-    }
-    else
-        throw SQLException(aErr,*this,OUString(),0,Any());
+    Reference<XIndexesSupplier> xIndexSup(xTunnel,UNO_QUERY);
+    if(xIndexSup.is())
+        m_pSQLAnalyzer->setIndexes(xIndexSup->getIndexes());
+
+    anylizeSQL();
 }
 
 void OStatement_Base::createColumnMapping()
diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx 
b/connectivity/source/drivers/firebird/ResultSet.cxx
index 859b28f48d0c..abb0c03b8be0 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -614,10 +614,10 @@ template <>
 ISC_QUAD* OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const 
ISC_SHORT nType)
 {
     // TODO: this is probably wrong
-    if ((m_pSqlda->sqlvar[nColumnIndex-1].sqltype & ~1) == nType)
-        return 
reinterpret_cast<ISC_QUAD*>(m_pSqlda->sqlvar[nColumnIndex-1].sqldata);
-    else
+    if ((m_pSqlda->sqlvar[nColumnIndex-1].sqltype & ~1) != nType)
         throw SQLException(); // TODO: better exception (can't convert Blob)
+
+    return 
reinterpret_cast<ISC_QUAD*>(m_pSqlda->sqlvar[nColumnIndex-1].sqldata);
 }
 
 template <typename T>
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx 
b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 34ca29b4e55d..d06fa9bcf507 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -600,18 +600,15 @@ void PreparedStatement::setObjectWithInfo(
         {
             x >>= myString;
         }
-        if( !myString.isEmpty() )
-        {
-//              printf( "setObjectWithInfo %s\n", 
OUStringToOString(myString,RTL_TEXTENCODING_ASCII_US).getStr());
-            setString( parameterIndex, myString );
-        }
-        else
+        if( myString.isEmpty() )
         {
             throw SQLException(
                 "pq_preparedstatement::setObjectWithInfo: can't convert value 
of type "
                 +  x.getValueTypeName() + " to type DECIMAL or NUMERIC",
                 *this, OUString(), 1, Any () );
         }
+
+        setString( parameterIndex, myString );
     }
     else
     {
diff --git a/connectivity/source/manager/mdrivermanager.cxx 
b/connectivity/source/manager/mdrivermanager.cxx
index e32934774d8a..e2a3d0ddf360 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -566,16 +566,13 @@ void SAL_CALL OSDBCDriverManager::registerObject( const 
OUString& _rName, const
     );
 
     DriverCollection::const_iterator aSearch = m_aDriversRT.find(_rName);
-    if (aSearch == m_aDriversRT.end())
-    {
-        Reference< XDriver > xNewDriver(_rxObject, UNO_QUERY);
-        if (xNewDriver.is())
-            m_aDriversRT.emplace(_rName, xNewDriver);
-        else
-            throw IllegalArgumentException();
-    }
-    else
+    if (aSearch != m_aDriversRT.end())
         throw ElementExistException();
+    Reference< XDriver > xNewDriver(_rxObject, UNO_QUERY);
+    if (!xNewDriver.is())
+        throw IllegalArgumentException();
+
+    m_aDriversRT.emplace(_rName, xNewDriver);
 
     m_aEventLogger.log( LogLevel::INFO,
         "new driver registered for name $1$",
diff --git a/cppuhelper/source/servicemanager.cxx 
b/cppuhelper/source/servicemanager.cxx
index c77526de6441..7e6c178c4e7c 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -410,23 +410,22 @@ rtl::OUString Parser::getNameAttribute() {
     xmlreader::Span name;
     int nsId;
     while (reader_.nextAttribute(&nsId, &name)) {
-        if (nsId == xmlreader::XmlReader::NAMESPACE_NONE
-            && name.equals(RTL_CONSTASCII_STRINGPARAM("name")))
+        if (nsId != xmlreader::XmlReader::NAMESPACE_NONE
+            || !name.equals(RTL_CONSTASCII_STRINGPARAM("name")))
         {
-            if (!attrName.isEmpty()) {
-                throw css::registry::InvalidRegistryException(
-                    reader_.getUrl()
-                     + ": element has multiple \"name\" attributes");
-            }
-            attrName = reader_.getAttributeValue(false).convertFromUtf8();
-            if (attrName.isEmpty()) {
-                throw css::registry::InvalidRegistryException(
-                    reader_.getUrl() + ": element has empty \"name\" 
attribute");
-            }
-        } else {
             throw css::registry::InvalidRegistryException(
                 reader_.getUrl() + ": expected element attribute \"name\"");
         }
+        if (!attrName.isEmpty()) {
+            throw css::registry::InvalidRegistryException(
+                reader_.getUrl()
+                 + ": element has multiple \"name\" attributes");
+        }
+        attrName = reader_.getAttributeValue(false).convertFromUtf8();
+        if (attrName.isEmpty()) {
+            throw css::registry::InvalidRegistryException(
+                reader_.getUrl() + ": element has empty \"name\" attribute");
+        }
     }
     if (attrName.isEmpty()) {
         throw css::registry::InvalidRegistryException(
@@ -910,15 +909,14 @@ void cppuhelper::ServiceManager::initialize(
     css::uno::Sequence<css::uno::Any> const & aArguments)
 {
     OUString arg;
-    if (aArguments.getLength() == 1 && (aArguments[0] >>= arg)
-        && arg == "preload")
+    if (aArguments.getLength() != 1 || !(aArguments[0] >>= arg)
+        || arg != "preload")
     {
-        preloadImplementations();
-    } else {
         throw css::lang::IllegalArgumentException(
             "invalid ServiceManager::initialize argument",
             css::uno::Reference<css::uno::XInterface>(), 0);
     }
+    preloadImplementations();
 }
 
 rtl::OUString cppuhelper::ServiceManager::getImplementationName()
@@ -1106,19 +1104,17 @@ void cppuhelper::ServiceManager::remove(css::uno::Any 
const & aElement)
     if (aElement >>= args) {
         std::vector< rtl::OUString > uris;
         for (sal_Int32 i = 0; i < args.getLength(); ++i) {
-            if (args[i].Name == "uri") {
-                rtl::OUString uri;
-                if (!(args[i].Value >>= uri)) {
-                    throw css::lang::IllegalArgumentException(
-                        "Bad uri argument",
-                        static_cast< cppu::OWeakObject * >(this), 0);
-                }
-                uris.push_back(uri);
-            } else {
+            if (args[i].Name != "uri") {
                 throw css::lang::IllegalArgumentException(
                     "Bad argument " + args[i].Name,
                     static_cast< cppu::OWeakObject * >(this), 0);
+            }              rtl::OUString uri;
+            if (!(args[i].Value >>= uri)) {
+                throw css::lang::IllegalArgumentException(
+                    "Bad uri argument",
+                    static_cast< cppu::OWeakObject * >(this), 0);
             }
+            uris.push_back(uri);
         }
         removeRdbFiles(uris);
         return;
diff --git a/cpputools/source/unoexe/unoexe.cxx 
b/cpputools/source/unoexe/unoexe.cxx
index 3d9a18a31931..bc35b6ef9d0f 100644
--- a/cpputools/source/unoexe/unoexe.cxx
+++ b/cpputools/source/unoexe/unoexe.cxx
@@ -165,66 +165,64 @@ static Reference< XInterface > loadComponent(
 {
     // determine loader to be used
     sal_Int32 nDot = rLocation.lastIndexOf( '.' );
-    if (nDot > 0 && nDot < rLocation.getLength())
+    if (nDot <= 0 || nDot >= rLocation.getLength())
     {
-        Reference< XImplementationLoader > xLoader;
+        throw RuntimeException(
+            "location \"" + rLocation + "\" has no extension!  Cannot 
determine loader to be used!" );
+    }
 
-        OUString aExt( rLocation.copy( nDot +1 ) );
+    Reference< XImplementationLoader > xLoader;
 
-        if (aExt == "dll" || aExt == "exe" || aExt == "dylib" || aExt == "so")
-        {
-            createInstance(
-                xLoader, xContext, "com.sun.star.loader.SharedLibrary" );
-        }
-        else if (aExt == "jar" || aExt == "class")
+    OUString aExt( rLocation.copy( nDot +1 ) );
+
+    if (aExt == "dll" || aExt == "exe" || aExt == "dylib" || aExt == "so")
+    {
+        createInstance(
+            xLoader, xContext, "com.sun.star.loader.SharedLibrary" );
+    }
+    else if (aExt == "jar" || aExt == "class")
+    {
+        createInstance(
+            xLoader, xContext, "com.sun.star.loader.Java" );
+    }
+    else
+    {
+        throw RuntimeException(
+            "unknown extension of \"" + rLocation + "\"!  No loader 
available!" );
+    }
+
+    Reference< XInterface > xInstance;
+
+    // activate
+    Reference< XInterface > xFactory( xLoader->activate(
+        rImplName, OUString(), rLocation, Reference< XRegistryKey >() ) );
+    if (xFactory.is())
+    {
+        Reference< XSingleComponentFactory > xCFac( xFactory, UNO_QUERY );
+        if (xCFac.is())
         {
-            createInstance(
-                xLoader, xContext, "com.sun.star.loader.Java" );
+            xInstance = xCFac->createInstanceWithContext( xContext );
         }
         else
         {
-            throw RuntimeException(
-                "unknown extension of \"" + rLocation + "\"!  No loader 
available!" );
-        }
-
-        Reference< XInterface > xInstance;
-
-        // activate
-        Reference< XInterface > xFactory( xLoader->activate(
-            rImplName, OUString(), rLocation, Reference< XRegistryKey >() ) );
-        if (xFactory.is())
-        {
-            Reference< XSingleComponentFactory > xCFac( xFactory, UNO_QUERY );
-            if (xCFac.is())
+            Reference< XSingleServiceFactory > xSFac( xFactory, UNO_QUERY );
+            if (xSFac.is())
             {
-                xInstance = xCFac->createInstanceWithContext( xContext );
-            }
-            else
-            {
-                Reference< XSingleServiceFactory > xSFac( xFactory, UNO_QUERY 
);
-                if (xSFac.is())
-                {
-                    out( "\n> warning: ignoring context for implementation \"" 
);
-                    out( rImplName );
-                    out( "\"!" );
-                    xInstance = xSFac->createInstance();
-                }
+                out( "\n> warning: ignoring context for implementation \"" );
+                out( rImplName );
+                out( "\"!" );
+                xInstance = xSFac->createInstance();
             }
         }
-
-        if (! xInstance.is())
-        {
-            throw RuntimeException(
-                "activating component \"" + rImplName + "\" from location \"" 
+ rLocation + "\" failed!" );
-        }
-
-        return xInstance;
     }
-    else
+
+    if (! xInstance.is())
     {
         throw RuntimeException(
-            "location \"" + rLocation + "\" has no extension!  Cannot 
determine loader to be used!" );
+            "activating component \"" + rImplName + "\" from location \"" + 
rLocation + "\" failed!" );
     }
+
+    return xInstance;
 }
 
 class OInstanceProvider
diff --git a/cui/source/options/optaboutconfig.cxx 
b/cui/source/options/optaboutconfig.cxx
index 717ae6d9ccf9..a006e71639ee 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -649,43 +649,38 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, 
Button*, void )
                         sal_Int32 nNumb = sNewValue.toInt32();
 
                         //if the value is 0 and length is not 1, there is 
something wrong
-                        if( !( nNumb==0 && sNewValue.getLength()!=1 ) && nNumb 
< SAL_MAX_INT16 && nNumb > SAL_MIN_INT16)
-                            nShort = (sal_Int16) nNumb;
-                        else
+                        if( ( nNumb==0 && sNewValue.getLength()!=1 ) || nNumb 
>= SAL_MAX_INT16 || nNumb <= SAL_MIN_INT16)
                             throw uno::Exception();
+                        nShort = (sal_Int16) nNumb;
                         pProperty->Value <<= nShort;
                     }
                     else if( sPropertyType == "long" )
                     {
                         sal_Int32 nLong = sNewValue.toInt32();
-                        if( !( nLong==0 && sNewValue.getLength()!=1 ) && nLong 
< SAL_MAX_INT32 && nLong > SAL_MIN_INT32)
-                            pProperty->Value <<= nLong;
-                        else
+                        if( ( nLong==0 && sNewValue.getLength()!=1 ) || nLong 
>= SAL_MAX_INT32 || nLong <= SAL_MIN_INT32)
                             throw uno::Exception();
+                        pProperty->Value <<= nLong;
                     }
                     else if( sPropertyType == "hyper")
                     {
                         sal_Int64 nHyper = sNewValue.toInt64();
-                        if( !( nHyper==0 && sNewValue.getLength()!=1 ) && 
nHyper < SAL_MAX_INT32 && nHyper > SAL_MIN_INT32)
-                            pProperty->Value <<= nHyper;
-                        else
+                        if( ( nHyper==0 && sNewValue.getLength()!=1 ) || 
nHyper >= SAL_MAX_INT32 || nHyper <= SAL_MIN_INT32)
                             throw uno::Exception();
+                        pProperty->Value <<= nHyper;
                     }
                     else if( sPropertyType == "double")
                     {
                         double nDoub = sNewValue.toDouble();
-                        if( !( nDoub ==0 && sNewValue.getLength()!=1 ) && 
nDoub < SAL_MAX_INT32 && nDoub > SAL_MIN_INT32)
-                            pProperty->Value <<= nDoub;
-                        else
+                        if( ( nDoub ==0 && sNewValue.getLength()!=1 ) || nDoub 
>= SAL_MAX_INT32 || nDoub <= SAL_MIN_INT32)
                             throw uno::Exception();
+                        pProperty->Value <<= nDoub;
                     }
                     else if( sPropertyType == "float")
                     {
                         float nFloat = sNewValue.toFloat();
-                        if( !( nFloat ==0 && sNewValue.getLength()!=1 ) && 
nFloat < SAL_MAX_INT32 && nFloat > SAL_MIN_INT32)
-                            pProperty->Value <<= nFloat;
-                        else
+                        if( ( nFloat ==0 && sNewValue.getLength()!=1 ) || 
nFloat >= SAL_MAX_INT32 || nFloat <= SAL_MIN_INT32)
                             throw uno::Exception();
+                         pProperty->Value <<= nFloat;
                     }
                     else if( sPropertyType == "string" )
                     {
diff --git a/dbaccess/source/core/api/RowSet.cxx 
b/dbaccess/source/core/api/RowSet.cxx
index 03aa81dab5f3..063c37318e5a 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -2391,40 +2391,37 @@ bool ORowSet::impl_buildActiveCommand_throw()
         case CommandType::QUERY:
         {
             Reference< XQueriesSupplier >  xQueriesAccess(m_xActiveConnection, 
UNO_QUERY);
-            if (xQueriesAccess.is())
+            if (!xQueriesAccess.is())
+                throw 
SQLException(DBA_RES(RID_STR_NO_XQUERIESSUPPLIER),*this,OUString(),0,Any());
+            Reference< css::container::XNameAccess >  
xQueries(xQueriesAccess->getQueries());
+            if (xQueries->hasByName(m_aCommand))
             {
-                Reference< css::container::XNameAccess >  
xQueries(xQueriesAccess->getQueries());
-                if (xQueries->hasByName(m_aCommand))
+                Reference< XPropertySet > 
xQuery(xQueries->getByName(m_aCommand),UNO_QUERY);
+                
OSL_ENSURE(xQuery.is(),"ORowSet::impl_buildActiveCommand_throw: Query is 
NULL!");
+                if ( xQuery.is() )
                 {
-                    Reference< XPropertySet > 
xQuery(xQueries->getByName(m_aCommand),UNO_QUERY);
-                    
OSL_ENSURE(xQuery.is(),"ORowSet::impl_buildActiveCommand_throw: Query is 
NULL!");
-                    if ( xQuery.is() )
+                    xQuery->getPropertyValue(PROPERTY_COMMAND) >>= sCommand;
+                    xQuery->getPropertyValue(PROPERTY_ESCAPE_PROCESSING) >>= 
bDoEscapeProcessing;
+                    if ( bDoEscapeProcessing != m_bUseEscapeProcessing )
                     {
-                        xQuery->getPropertyValue(PROPERTY_COMMAND) >>= 
sCommand;
-                        xQuery->getPropertyValue(PROPERTY_ESCAPE_PROCESSING) 
>>= bDoEscapeProcessing;
-                        if ( bDoEscapeProcessing != m_bUseEscapeProcessing )
-                        {
-                            bool bOldValue = m_bUseEscapeProcessing;
-                            m_bUseEscapeProcessing = bDoEscapeProcessing;
-                            
fireProperty(PROPERTY_ID_ESCAPE_PROCESSING,bOldValue,bDoEscapeProcessing);
-                        }
-
-                        OUString aCatalog,aSchema,aTable;
-                        xQuery->getPropertyValue(PROPERTY_UPDATE_CATALOGNAME)  
 >>= aCatalog;
-                        xQuery->getPropertyValue(PROPERTY_UPDATE_SCHEMANAME)   
 >>= aSchema;
-                        xQuery->getPropertyValue(PROPERTY_UPDATE_TABLENAME)    
 >>= aTable;
-                        if(!aTable.isEmpty())
-                            m_aUpdateTableName = composeTableName( 
m_xActiveConnection->getMetaData(), aCatalog, aSchema, aTable, false, 
::dbtools::EComposeRule::InDataManipulation );
+                        bool bOldValue = m_bUseEscapeProcessing;
+                        m_bUseEscapeProcessing = bDoEscapeProcessing;
+                        
fireProperty(PROPERTY_ID_ESCAPE_PROCESSING,bOldValue,bDoEscapeProcessing);
                     }
-                }
-                else
-                {
-                    OUString sMessage( DBA_RES( RID_STR_QUERY_DOES_NOT_EXIST ) 
);
-                    throwGenericSQLException(sMessage.replaceAll( "$table$", 
m_aCommand ),*this);
+
+                    OUString aCatalog,aSchema,aTable;
+                    xQuery->getPropertyValue(PROPERTY_UPDATE_CATALOGNAME)   
>>= aCatalog;
+                    xQuery->getPropertyValue(PROPERTY_UPDATE_SCHEMANAME)    
>>= aSchema;
+                    xQuery->getPropertyValue(PROPERTY_UPDATE_TABLENAME)     
>>= aTable;
+                    if(!aTable.isEmpty())
+                        m_aUpdateTableName = composeTableName( 
m_xActiveConnection->getMetaData(), aCatalog, aSchema, aTable, false, 
::dbtools::EComposeRule::InDataManipulation );
                 }
             }
             else
-                throw 
SQLException(DBA_RES(RID_STR_NO_XQUERIESSUPPLIER),*this,OUString(),0,Any());
+            {
+                OUString sMessage( DBA_RES( RID_STR_QUERY_DOES_NOT_EXIST ) );
+                throwGenericSQLException(sMessage.replaceAll( "$table$", 
m_aCommand ),*this);
+            }
         }
         break;
 
@@ -2626,14 +2623,11 @@ void SAL_CALL ORowSet::setCharacterStream( sal_Int32 
parameterIndex, const Refer
 
 void SAL_CALL ORowSet::setObject( sal_Int32 parameterIndex, const Any& x )
 {
-    if ( ::dbtools::implSetObject( this, parameterIndex, x ) )
-    {
-        m_bParametersDirty = true;
-    }
-    else
+    if ( !::dbtools::implSetObject( this, parameterIndex, x ) )
     {   // there is no other setXXX call which can handle the value in x
         throw SQLException();
     }
+    m_bParametersDirty = true;
 }
 
 void SAL_CALL ORowSet::setObjectWithInfo( sal_Int32 parameterIndex, const Any& 
x, sal_Int32 targetSqlType, sal_Int32 /*scale*/ )
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx 
b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index f51b8f2b0177..3a5490d07585 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -1632,24 +1632,21 @@ void OSingleSelectQueryComposer::setConditionByColumn( 
const Reference< XPropert
             case DataType::LONGVARBINARY:
                 {
                     Sequence<sal_Int8> aSeq;
-                    if(aValue >>= aSeq)
+                    if(!(aValue >>= aSeq))
+                        throw 
SQLException(DBA_RES(RID_STR_NOT_SEQUENCE_INT8),*this,SQLSTATE_GENERAL,1000,Any()
 );
+                    if(nSearchable == ColumnSearch::CHAR)
                     {
-                        if(nSearchable == ColumnSearch::CHAR)
-                        {
-                            aSQL.append( "\'" );
-                        }
-                        aSQL.append( "0x" );
-                        const sal_Int8* pBegin  = aSeq.getConstArray();
-                        const sal_Int8* pEnd    = pBegin + aSeq.getLength();
-                        for(;pBegin != pEnd;++pBegin)
-                        {
-                            aSQL.append( (sal_Int32)*pBegin, 16 );
-                        }
-                        if(nSearchable == ColumnSearch::CHAR)
-                            aSQL.append( "\'" );
+                        aSQL.append( "\'" );
                     }
-                    else
-                        throw 
SQLException(DBA_RES(RID_STR_NOT_SEQUENCE_INT8),*this,SQLSTATE_GENERAL,1000,Any()
 );
+                    aSQL.append( "0x" );
+                    const sal_Int8* pBegin  = aSeq.getConstArray();
+                    const sal_Int8* pEnd    = pBegin + aSeq.getLength();
+                    for(;pBegin != pEnd;++pBegin)
+                    {
+                        aSQL.append( (sal_Int32)*pBegin, 16 );
+                    }
+                    if(nSearchable == ColumnSearch::CHAR)
+                        aSQL.append( "\'" );
                 }
                 break;
             case DataType::BIT:
diff --git a/dbaccess/source/core/api/TableDeco.cxx 
b/dbaccess/source/core/api/TableDeco.cxx
index dd167c116d3e..a8dd84297af8 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -387,12 +387,10 @@ void SAL_CALL ODBTableDecorator::rename( const OUString& 
_rNewName )
     ::osl::MutexGuard aGuard(m_aMutex);
     ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed);
     Reference<XRename> xRename(m_xTable,UNO_QUERY);
-    if(xRename.is())
-    {
-        xRename->rename(_rNewName);
-    }
-    else // not supported
+    if(!xRename.is())
         throw 
SQLException(DBA_RES(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() 
);
+    // not supported
+    xRename->rename(_rNewName);
 }
 
 // XAlterTable,
@@ -401,12 +399,9 @@ void SAL_CALL ODBTableDecorator::alterColumnByName( const 
OUString& _rName, cons
     ::osl::MutexGuard aGuard(m_aMutex);
     ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed);
     Reference<XAlterTable> xAlter(m_xTable,UNO_QUERY);
-    if(xAlter.is())
-    {
-        xAlter->alterColumnByName(_rName,_rxDescriptor);
-    }
-    else
+    if(!xAlter.is())
         throw 
SQLException(DBA_RES(RID_STR_COLUMN_ALTER_BY_NAME),*this,SQLSTATE_GENERAL,1000,Any()
 );
+    xAlter->alterColumnByName(_rName,_rxDescriptor);
     if(m_pColumns)
         m_pColumns->refresh();
 }
@@ -416,14 +411,12 @@ void SAL_CALL ODBTableDecorator::alterColumnByIndex( 
sal_Int32 _nIndex, const Re
     ::osl::MutexGuard aGuard(m_aMutex);
     ::connectivity::checkDisposed(OTableDescriptor_BASE::rBHelper.bDisposed);
     Reference<XAlterTable> xAlter(m_xTable,UNO_QUERY);
-    if(xAlter.is())
-    {
-        xAlter->alterColumnByIndex(_nIndex,_rxDescriptor);
-        if(m_pColumns)
-            m_pColumns->refresh();
-    }
-    else // not supported
+    if(!xAlter.is())
         throw 
SQLException(DBA_RES(RID_STR_COLUMN_ALTER_BY_INDEX),*this,SQLSTATE_GENERAL,1000,Any()
 );
+    // not supported
+    xAlter->alterColumnByIndex(_nIndex,_rxDescriptor);
+    if(m_pColumns)
+        m_pColumns->refresh();
 }
 
 Reference< XNameAccess> ODBTableDecorator::getIndexes()
diff --git a/dbaccess/source/ui/querydesign/JAccess.cxx 
b/dbaccess/source/ui/querydesign/JAccess.cxx
index d4a63176b8ee..70f152588e85 100644
--- a/dbaccess/source/ui/querydesign/JAccess.cxx
+++ b/dbaccess/source/ui/querydesign/JAccess.cxx
@@ -62,22 +62,19 @@ namespace dbaui
     {
         Reference< XAccessible > aRet;
         ::osl::MutexGuard aGuard( m_aMutex  );
-        if(i >= 0 && i < getAccessibleChildCount() && m_pTableView )
+        if(i < 0 || i >= getAccessibleChildCount() || !m_pTableView)
+            throw IndexOutOfBoundsException();
+        // check if we should return a table window or a connection
+        sal_Int32 nTableWindowCount = m_pTableView->GetTabWinCount();
+        if( i < nTableWindowCount )
         {
-            // check if we should return a table window or a connection
-            sal_Int32 nTableWindowCount = m_pTableView->GetTabWinCount();
-            if( i < nTableWindowCount )
-            {
-                OJoinTableView::OTableWindowMap::const_iterator aIter = 
m_pTableView->GetTabWinMap().begin();
-                for (sal_Int32 j=i; j; ++aIter,--j)
-                    ;
-                aRet = aIter->second->GetAccessible();
-            }
-            else if( size_t(i - nTableWindowCount) < 
m_pTableView->getTableConnections().size() )
-                aRet = m_pTableView->getTableConnections()[i - 
nTableWindowCount]->GetAccessible();
+            OJoinTableView::OTableWindowMap::const_iterator aIter = 
m_pTableView->GetTabWinMap().begin();
+            for (sal_Int32 j=i; j; ++aIter,--j)
+                ;
+            aRet = aIter->second->GetAccessible();
         }
-        else
-            throw IndexOutOfBoundsException();
+        else if( size_t(i - nTableWindowCount) < 
m_pTableView->getTableConnections().size() )
+            aRet = m_pTableView->getTableConnections()[i - 
nTableWindowCount]->GetAccessible();
         return aRet;
     }
     sal_Int16 SAL_CALL OJoinDesignViewAccess::getAccessibleRole(  )
diff --git a/desktop/source/app/officeipcthread.cxx 
b/desktop/source/app/officeipcthread.cxx
index 01abf03b9a6f..303def43540f 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -162,19 +162,17 @@ private:
                 }
                 ++m_index;
                 if (c == '\\') {
-                    if (m_index < m_input.getLength()) {
-                        c = m_input[m_index++];
-                        switch (c) {
-                        case '0':
-                            c = '\0';
-                            break;
-                        case ',':
-                        case '\\':
-                            break;
-                        default:
-                            throw CommandLineArgs::Supplier::Exception();
-                        }
-                    } else {
+                    if (m_index >= m_input.getLength())
+                        throw CommandLineArgs::Supplier::Exception();
+                    c = m_input[m_index++];
+                    switch (c) {
+                    case '0':
+                        c = '\0';
+                        break;
+                    case ',':
+                    case '\\':
+                        break;
+                    default:
                         throw CommandLineArgs::Supplier::Exception();
                     }
                 }
diff --git a/desktop/source/deployment/manager/dp_manager.cxx 
b/desktop/source/deployment/manager/dp_manager.cxx
index 8244d4f88ee3..b9b849d31b8a 100644
--- a/desktop/source/deployment/manager/dp_manager.cxx
+++ b/desktop/source/deployment/manager/dp_manager.cxx
@@ -1499,26 +1499,23 @@ sal_Int32 PackageManagerImpl::checkPrerequisites(
 
         ActivePackages::Data dbData;
         OUString id = dp_misc::getIdentifier(extension);
-        if (m_activePackagesDB->get( &dbData, id, OUString()))
-        {
-            //If the license was already displayed, then do not show it again
-            Reference<ucb::XCommandEnvironment> _xCmdEnv = xCmdEnv;
-            sal_Int32 prereq = dbData.failedPrerequisites.toInt32();
-            if ( !(prereq & deployment::Prerequisites::LICENSE))
-                _xCmdEnv = new 
NoLicenseCommandEnv(xCmdEnv->getInteractionHandler());
-
-            sal_Int32 failedPrereq = extension->checkPrerequisites(
-                xAbortChannel, _xCmdEnv, false);
-            dbData.failedPrerequisites = OUString::number(failedPrereq);
-            insertToActivationLayerDB(id, dbData);
-        }
-        else
+        if (!m_activePackagesDB->get( &dbData, id, OUString()))
         {
             throw lang::IllegalArgumentException(
                 "PackageManagerImpl::checkPrerequisites: unknown extension",
                 nullptr, 0);
 
         }
+        //If the license was already displayed, then do not show it again
+        Reference<ucb::XCommandEnvironment> _xCmdEnv = xCmdEnv;
+        sal_Int32 prereq = dbData.failedPrerequisites.toInt32();
+        if ( !(prereq & deployment::Prerequisites::LICENSE))
+            _xCmdEnv = new 
NoLicenseCommandEnv(xCmdEnv->getInteractionHandler());
+
+        sal_Int32 failedPrereq = extension->checkPrerequisites(
+            xAbortChannel, _xCmdEnv, false);
+        dbData.failedPrerequisites = OUString::number(failedPrereq);
+        insertToActivationLayerDB(id, dbData);
         return 0;
     }
     catch ( const deployment::DeploymentException& ) {
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx 
b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index ee1729fb7604..a928a7e3c336 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -475,16 +475,12 @@ extern "C" int unopkg_main()
                         }
                     }
 
-                    if (extension.is())
-                    {
-                        allExtensions.push_back(extension);
-                        vecUnaccepted.push_back(bUnacceptedLic);
-                    }
-
-                    else
+                    if (!extension.is())
                         throw lang::IllegalArgumentException(
                             "There is no such extension deployed: " +
                             cmdPackage,nullptr,-1);
+                    allExtensions.push_back(extension);
+                    vecUnaccepted.push_back(bUnacceptedLic);
                 }
 
             }
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx 
b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index 774e30fae122..0aafe484a21d 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -198,15 +198,12 @@ OUString makeAbsoluteFileUrl(
     oslFileError rc = osl_getFileURLFromSystemPath( sys_path.pData, 
&file_url.pData );
     if ( rc != osl_File_E_None) {
         OUString tempPath;
-        if ( osl_getSystemPathFromFileURL( sys_path.pData, &tempPath.pData) == 
osl_File_E_None )
-        {
-            file_url = sys_path;
-        }
-        else
+        if ( osl_getSystemPathFromFileURL( sys_path.pData, &tempPath.pData) != 
osl_File_E_None )
         {
             throw RuntimeException("cannot get file url from system path: " +
                 sys_path );
         }
+        file_url = sys_path;
     }
 
     OUString abs;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to