]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsImpl.java
Replace instantiations of DatabaseException in indexing
[simantics/platform.git] / bundles / org.simantics.db.indexing / src / org / simantics / db / indexing / IndexedRelationsImpl.java
index 60e824cad0bf4f84592e25dbeda6b0a1b4939112..b2b65a67f74a3e4725fc51a5d29257e6849e123a 100644 (file)
@@ -38,6 +38,7 @@ import org.simantics.db.common.utils.NameUtils;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.exception.InvalidResourceReferenceException;
 import org.simantics.db.indexing.IndexedRelationsSearcherBase.State;
+import org.simantics.db.indexing.exception.IndexingException;
 import org.simantics.db.layer0.adapter.GenericRelation;
 import org.simantics.db.layer0.genericrelation.IndexException;
 import org.simantics.db.layer0.genericrelation.IndexedRelations;
@@ -230,16 +231,18 @@ public class IndexedRelationsImpl implements IndexedRelations {
                                                                        searcher.startAccess(null, graph.getSession(), false);
                                                                        // At this point we have three options:
                                                                        // 1. we have access
-                                                                       if(searcher.hasAccess(false)) loaded = true;
+                                                                       if(searcher.hasAccess(false))
+                                                                           loaded = true;
                                                                        // 2. something is wrong and the index cannot be cleaned
-                                                                       if(searcher.checkState(State.PROBLEM)) throw new DatabaseException("Searcher is in problematic state", searcher.getException());
+                                                                       if(searcher.checkState(State.PROBLEM))
+                                                                           throw new IndexingException("Searcher is in problematic state", searcher.getException());
                                                                        // 3. something was wrong, but the index has been successfully cleaned
                                                                }
 
                                                                if(!loaded) {
                                                                        
                                                                if(!searcher.checkState(State.NONE)) 
-                                                                       throw new DatabaseException("Illegal searcher state " + searcher.state());
+                                                                       throw new IndexingException("Illegal searcher state " + searcher.state());
 
                                                                        try {
                                                                            SerialisationSupport ss = graph.getService(SerialisationSupport.class);
@@ -247,7 +250,7 @@ public class IndexedRelationsImpl implements IndexedRelations {
                                                                                searcher.setReady();
                                                                        } catch (IOException e) {
                                                                                searcher.setProblem(e);
-                                                                               throw new DatabaseException(e);
+                                                                               throw new IndexingException(e);
                                                                        }    
 
                                                                }
@@ -558,7 +561,7 @@ public class IndexedRelationsImpl implements IndexedRelations {
                     try {
                         fullRebuild(monitor, graph);
                     } catch (IOException e) {
-                        throw new DatabaseException(e);
+                        throw new IndexingException(e);
                     }
                 }
             });
@@ -582,7 +585,7 @@ public class IndexedRelationsImpl implements IndexedRelations {
 
             GenericRelation r = graph.adapt(relation, GenericRelation.class);
             if (r == null)
-                throw new DatabaseException("Given resource " + relation + "could not be adapted to GenericRelation.");
+                throw new IndexingException("Given resource " + relation + "could not be adapted to GenericRelation.");
 
             Object[] bound = new Object[] { ss.getRandomAccessId(indexRoot) };
             GenericRelation selection = r.select(IndexedRelationsSearcherBase.getPattern(r, bound.length), bound);