incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmatth...@apache.org
Subject svn commit: r1079825 - in /incubator/isis/trunk: core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/title/ core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/object/ident/title/ runtimes/dflt/runtime/src/main/java...
Date Wed, 09 Mar 2011 15:09:31 GMT
Author: rmatthews
Date: Wed Mar  9 15:09:31 2011
New Revision: 1079825

URL: http://svn.apache.org/viewvc?rev=1079825&view=rev
Log:
Made failures in title methods more visible (rather then than being hidden)

Modified:
    incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/title/TitleFacetViaTitleMethod.java
    incubator/isis/trunk/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/object/ident/title/TitleFacetViaMethodTest.java
    incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adapterfactory/pojo/PojoAdapter.java

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/title/TitleFacetViaTitleMethod.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/title/TitleFacetViaTitleMethod.java?rev=1079825&r1=1079824&r2=1079825&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/title/TitleFacetViaTitleMethod.java
(original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/title/TitleFacetViaTitleMethod.java
Wed Mar  9 15:09:31 2011
@@ -30,10 +30,12 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.ImperativeFacet;
 import org.apache.isis.core.metamodel.facets.object.title.TitleFacetAbstract;
+import org.apache.log4j.Logger;
 
 
 public class TitleFacetViaTitleMethod extends TitleFacetAbstract implements ImperativeFacet
{
 
+    private static final Logger LOG = Logger.getLogger(TitleFacetViaTitleMethod.class);
     private final Method method;
 
     public TitleFacetViaTitleMethod(
@@ -62,7 +64,8 @@ public class TitleFacetViaTitleMethod ex
         try {
 			return (String) AdapterInvokeUtils.invoke(method, owningAdapter);
 		} catch (RuntimeException ex) {
-			return null;
+		    LOG.warn("title failure", ex);
+			return "Failed Title";
 		}
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/object/ident/title/TitleFacetViaMethodTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/object/ident/title/TitleFacetViaMethodTest.java?rev=1079825&r1=1079824&r2=1079825&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/object/ident/title/TitleFacetViaMethodTest.java
(original)
+++ incubator/isis/trunk/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/object/ident/title/TitleFacetViaMethodTest.java
Wed Mar  9 15:09:31 2011
@@ -80,7 +80,7 @@ public class TitleFacetViaMethodTest  {
     @Test
     public void testTitleThrowsException() {
     	String title = facet.title(mockOwningAdapter, null);
-    	assertThat(title, is(nullValue()));
+    	assertThat(title, is("Failed Title"));
     }
 
 }

Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adapterfactory/pojo/PojoAdapter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adapterfactory/pojo/PojoAdapter.java?rev=1079825&r1=1079824&r2=1079825&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adapterfactory/pojo/PojoAdapter.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adapterfactory/pojo/PojoAdapter.java
Wed Mar  9 15:09:31 2011
@@ -282,6 +282,9 @@ public class PojoAdapter extends Instanc
         if (resolveState.isNew()) {
             return "";
         } else {
+            if (getObject() instanceof String) {
+                return (String) getObject();
+            }
             final ObjectSpecification specification = getSpecification();
             Localization localization = IsisContext.getUserProfile().getLocalization();
             String title = specification.getTitle(this, localization);



Mime
View raw message