polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject zest-java git commit: Wrong handling of zero-argument invocations in Restlet library.
Date Sat, 07 Nov 2015 04:41:43 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop 79aa83408 -> 688d9adc3


Wrong handling of zero-argument invocations in Restlet library.


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/688d9adc
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/688d9adc
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/688d9adc

Branch: refs/heads/develop
Commit: 688d9adc3e2d3969d557bfda5912b3f67840e031
Parents: 79aa834
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Sat Nov 7 12:41:23 2015 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Sat Nov 7 12:41:23 2015 +0800

----------------------------------------------------------------------
 .../apache/zest/library/restlet/crud/EntityResource.java    | 9 ++++-----
 .../zest/library/restlet/resource/EntryPointResource.java   | 6 +++---
 2 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/688d9adc/libraries/restlet/src/main/java/org/apache/zest/library/restlet/crud/EntityResource.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/crud/EntityResource.java
b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/crud/EntityResource.java
index ca7cafe..a93e91b 100644
--- a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/crud/EntityResource.java
+++ b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/crud/EntityResource.java
@@ -111,19 +111,18 @@ public interface EntityResource<T extends Identity> extends ServerResource<T>
                 {
                     throw new IllegalArgumentException( "Method '" + methodName + "' is not
present on " + type.getName() );
                 }
+                Class entityType = parameters.entityType().get();
+                //noinspection unchecked
+                T entity = (T) locator.find( entityType ).get( identity() );
                 if( method.getParameterCount() == 1 )
                 {
-                    Class entityType = parameters.entityType().get();
-                    //noinspection unchecked
-                    T entity = (T) locator.find( entityType ).get( identity() );
-
                     Class argType = method.getParameterTypes()[ 0 ];
                     Object parameters = createParametersComposite( form, argType );
                     method.invoke( entity, parameters );
                 }
                 else
                 {
-                    method.invoke( me );
+                    method.invoke( entity );
                 }
             }
             catch( Exception e )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/688d9adc/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/EntryPointResource.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/EntryPointResource.java
b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/EntryPointResource.java
index 57a855e..c2cdfb0 100644
--- a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/EntryPointResource.java
+++ b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/EntryPointResource.java
@@ -75,15 +75,15 @@ public interface EntryPointResource extends ServerResource<EntryPoint>
                     if( template.getVariableNames().isEmpty() && route.getName().indexOf(
'>' ) == -1 )
                     {
                         Reference hostRef = parameters.request().get().getOriginalRef();
-                        Reference reference = new Reference( hostRef, template.getPattern()
);
+//                        Reference reference = new Reference( hostRef, template.getPattern()
);
                         RestLink link;
                         if( route.getDescription() == null )
                         {
-                            link = resourceBuilder.createRestLink( route.getName(), reference,
Method.GET );
+                            link = resourceBuilder.createRestLink( template.getPattern()
, hostRef, Method.GET );
                         }
                         else
                         {
-                            link = resourceBuilder.createRestLink( route.getName(), reference,
Method.GET, route.getDescription() );
+                            link = resourceBuilder.createRestLink( template.getPattern()
, hostRef, Method.GET, route.getDescription() );
                         }
                         entryPoints.put( route.getName(), link );
                     }


Mime
View raw message