Github user isper3at commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/48#discussion_r67537827
--- Diff: dao/mongodb.rya/src/main/java/mvm/rya/mongodb/MongoDBRyaDAO.java
---
@@ -179,85 +145,85 @@ public void destroy() throws RyaDAOException {
IOUtils.closeQuietly(queryEngine);
}
- public void add(RyaStatement statement) throws RyaDAOException {
- // add it to the collection
- try {
- coll.insert(storageStrategy.serialize(statement));
- for(RyaSecondaryIndexer index: secondaryIndexers) {
- index.storeStatement(statement);
- }
- }
- catch (com.mongodb.MongoException.DuplicateKey exception){
- // ignore
- }
- catch (com.mongodb.DuplicateKeyException exception){
- // ignore
- }
- catch (Exception ex){
- // ignore single exceptions
- ex.printStackTrace();
- }
- }
-
- public void add(Iterator<RyaStatement> statement) throws
RyaDAOException {
- List<DBObject> dbInserts = new ArrayList<DBObject>();
- while (statement.hasNext()){
- RyaStatement ryaStatement = statement.next();
- DBObject insert =
storageStrategy.serialize(ryaStatement);
- dbInserts.add(insert);
-
+ @Override
+ public void add(final RyaStatement statement) throws RyaDAOException {
+ // add it to the collection
+ try {
+ coll.insert(storageStrategy.serialize(statement));
+ for(final RyaSecondaryIndexer index: secondaryIndexers) {
+ index.storeStatement(statement);
+ }
+ } catch (final IOException e) {
--- End diff --
since both are just ignored and the actual exception that is caught is a
type of IOException it makes it more clear where the exception is coming from.
Its dangerous to catch exceptions just to ignore...
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---