Source:
<code>private Map<String, DataColumn> readTableColumnMetaData(String tableName, DatabaseMetaData meta) throws ODataServiceFault { ResultSet resultSet = null; Map<String, DataColumn> columnMap = new HashMap<>(); try { if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER)) { resultSet = meta.getColumns(null, meta.getUserName(), tableName, null); <START> if(!meta.getConnection().getSchema().equals(meta.getUserName())){ <END> resultSet = meta.getColumns(null, meta.getConnection().getSchema(), tableName, null); } } else { resultSet = meta.getColumns(null, null, tableName, null); } int i = 1; while (resultSet.next()) { String columnName = resultSet.getString("COLUMN_NAME"); int columnType = resultSet.getInt("DATA_TYPE"); int size = resultSet.getInt("COLUMN_SIZE"); boolean nullable = resultSet.getBoolean("NULLABLE"); String columnDefaultVal = resultSet.getString("COLUMN_DEF"); String autoIncrement = resultSet.getString("IS_AUTOINCREMENT").toLowerCase(); boolean isAutoIncrement = false; if (autoIncrement.contains("yes") || autoIncrement.contains("true")) { isAutoIncrement = true; } DataColumn column = new DataColumn(columnName, getODataDataType(columnType), i, nullable, size, isAutoIncrement); if (null != columnDefaultVal) { column.setDefaultValue(columnDefaultVal); } if (Types.DOUBLE == columnType || Types.FLOAT == columnType || Types.DECIMAL == columnType || Types.NUMERIC == columnType || Types.REAL == columnType) { int scale = resultSet.getInt("DECIMAL_DIGITS"); column.setPrecision(size); if (scale == 0) { scale = 5; column.setScale(scale); } else { column.setScale(scale); } } columnMap.put(columnName, column); addDataType(tableName, columnName, columnType); i++; } return columnMap; } catch (SQLException e) { throw new ODataServiceFault(e, "Error in reading table meta data in " + tableName + " table. :" + e.getMessage()); } finally { releaseResources(resultSet, null); } }</code><technical_language>do a null check for meta.getConnection().getSchema(). is switch meta.getUserName() meta.getConnection().getSchema() do a null check meta.getUserName(), meta null</technical_language>

Target:
private Map<String, DataColumn> readTableColumnMetaData(String tableName, DatabaseMetaData meta) throws ODataServiceFault { ResultSet resultSet = null; Map<String, DataColumn> columnMap = new HashMap<>(); try { if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER)) { resultSet = meta.getColumns(null, meta.getUserName(), tableName, null); if (meta.getConnection().getSchema() != null) { if (!meta.getConnection().getSchema().equals(meta.getUserName())) { resultSet = meta.getColumns(null, meta.getConnection().getSchema(), tableName, null); } } } else { resultSet = meta.getColumns(null, null, tableName, null); } int i = 1; while (resultSet.next()) { String columnName = resultSet.getString("COLUMN_NAME"); int columnType = resultSet.getInt("DATA_TYPE"); int size = resultSet.getInt("COLUMN_SIZE"); boolean nullable = resultSet.getBoolean("NULLABLE"); String columnDefaultVal = resultSet.getString("COLUMN_DEF"); String autoIncrement = resultSet.getString("IS_AUTOINCREMENT").toLowerCase(); boolean isAutoIncrement = false; if (autoIncrement.contains("yes") || autoIncrement.contains("true")) { isAutoIncrement = true; } DataColumn column = new DataColumn(columnName, getODataDataType(columnType), i, nullable, size, isAutoIncrement); if (null != columnDefaultVal) { column.setDefaultValue(columnDefaultVal); } if (Types.DOUBLE == columnType || Types.FLOAT == columnType || Types.DECIMAL == columnType || Types.NUMERIC == columnType || Types.REAL == columnType) { int scale = resultSet.getInt("DECIMAL_DIGITS"); column.setPrecision(size); if (scale == 0) { scale = 5; column.setScale(scale); } else { column.setScale(scale); } } columnMap.put(columnName, column); addDataType(tableName, columnName, columnType); i++; } return columnMap; } catch (SQLException e) { throw new ODataServiceFault(e, "Error in reading table meta data in " + tableName + " table. :" + e.getMessage()); } finally { releaseResources(resultSet, null); } }