Contextual adapters must throw instead of returning null
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / diagram / monitor / ObtainedFormatterAdapter.java
index d8bd993bd40cec57c5ea621b2d5efce4d500016c..3f0200c961ecfbe34c4bcc82123c9f95d08a8305 100644 (file)
@@ -10,6 +10,7 @@ import org.simantics.db.RelationContext;
 import org.simantics.db.Resource;
 import org.simantics.db.Statement;
 import org.simantics.db.common.adaption.SimpleContextualAdapter;
+import org.simantics.db.exception.AdaptionException;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.property.OrderedResource;
 import org.simantics.diagram.stubs.DiagramResource;
@@ -34,7 +35,7 @@ public class ObtainedFormatterAdapter extends SimpleContextualAdapter<Formatter,
                        if(result != null) return result;
                }
                
-               return null;
+               throw new AdaptionException("No obtained formatter available");
                
        }