diff --git a/context.xml b/context.xml
index 17ef068..00e6566 100644
--- a/context.xml
+++ b/context.xml
@@ -1,14 +1,14 @@
-
-
-
-
-
- MongoDB is an open source document-oriented database system developed and supported by 10gen. It is part of the NoSQL family of database systems. Instead of storing data in tables as is done in a "classical" relational database, MongoDB stores structured data as JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster.
-
-
-
- From this dialog you can change the dataset query, define new parameters or change the adapter used to retrive the data.
-
-
+
+
+
+
+
+ MongoDB is an open source document-oriented database system developed and supported by 10gen. It is part of the NoSQL family of database systems. Instead of storing data in tables as is done in a "classical" relational database, MongoDB stores structured data as JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster.
+
-
+
+ From this dialog you can change the dataset query, define new parameters or change the adapter used to retrive the data.
+
+
+
+
diff --git a/pom.xml b/pom.xml
index d186c1a..b20f4eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
com.jaspersoft.studio.data.mongodb
jar
- 5.1.0.soluvas1
+ 5.1.1-SNAPSHOT
diff --git a/src/com/jaspersoft/mongodb/connection/MongoDbConnection.java b/src/com/jaspersoft/mongodb/connection/MongoDbConnection.java
index 6bfa777..ba427ac 100644
--- a/src/com/jaspersoft/mongodb/connection/MongoDbConnection.java
+++ b/src/com/jaspersoft/mongodb/connection/MongoDbConnection.java
@@ -31,9 +31,10 @@
import java.sql.Statement;
import java.sql.Struct;
import java.util.Arrays;
-import java.util.List;
+import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import java.util.concurrent.Executor;
import net.sf.jasperreports.engine.JRException;
@@ -66,11 +67,12 @@ public class MongoDbConnection implements Connection {
private static final Logger logger = LoggerFactory.getLogger(MongoDbConnection.class);
- protected static final List AUTH_ERROR_CODES = Arrays.asList(new Integer[] {
+ protected static final Set AUTH_ERROR_CODES = new HashSet(Arrays.asList(new Integer[] {
16550, // not authorized for query on foo.system.namespaces
10057, // unauthorized db:admin ns:admin.system.users lock type:1 client:127.0.0.1
- 15845 // unauthorized
- });
+ 15845, // unauthorized
+ 13 // MongoDB 2.6.0: not authorized on DB to execute command { count: \"system.namespaces\", query: {}, fields: {} }
+ }));
public MongoDbConnection(String mongoURI, String username, String password)
throws JRException {
@@ -86,7 +88,7 @@ private void create(String mongoURI) throws JRException {
client = new Mongo(mongoURIObject = new MongoURI(mongoURI));
} catch (Exception e) {
logger.error("Cannot create connection", e);
- throw new JRException(e.getMessage());
+ throw new JRException(e.getMessage(), e);
}
}
@@ -105,15 +107,16 @@ private void setDatabase() throws JRException {
} catch (Exception e) {
String message = e.getMessage();
if (e instanceof MongoException) {
- if (AUTH_ERROR_CODES.contains(((MongoException) e).getCode())) {
+ final MongoException mongoE = (MongoException) e;
+ if (AUTH_ERROR_CODES.contains(mongoE.getCode())) {
performaAuthentication = true;
} else {
- logger.error("Cannot set database", e);
- throw new JRException(message);
+ logger.error("Cannot set database. Code " + mongoE.getCode() + ": " + mongoE, mongoE);
+ throw new JRException("Error " + mongoE.getCode() + ": " + mongoE, mongoE);
}
} else {
- logger.error("Cannot set database", e);
- throw new JRException(message);
+ logger.error("Cannot set database: " + e, e);
+ throw new JRException(message, e);
}
}
if (performaAuthentication) {