ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1540067 - /ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java
Date Fri, 08 Nov 2013 15:10:54 GMT
Author: jawi
Date: Fri Nov  8 15:10:53 2013
New Revision: 1540067

URL: http://svn.apache.org/r1540067
Log:
Some minor tweaks and fixes:

- in case we want to remove a stateful target, we shouldn't assume that
  it is always registered;
- use Version#parseVersion to properly handle null-values, instead of
  catching a NPE.


Modified:
    ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java

Modified: ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java?rev=1540067&r1=1540066&r2=1540067&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java
(original)
+++ ace/trunk/org.apache.ace.client.repository/src/org/apache/ace/client/repository/stateful/impl/StatefulTargetRepositoryImpl.java
Fri Nov  8 15:10:53 2013
@@ -122,7 +122,9 @@ public class StatefulTargetRepositoryImp
     public void remove(StatefulTargetObject entity) {
         synchronized (m_repository) {
             StatefulTargetObjectImpl statefulTarget = (StatefulTargetObjectImpl) entity;
-            unregister(statefulTarget.getID());
+            if (statefulTarget.isRegistered()) {
+                unregister(statefulTarget.getID());
+            }
             removeStateful(statefulTarget);
             // Ensure the external side sees the changes we've made...
             statefulTarget.updateTargetObject(false);
@@ -740,7 +742,8 @@ public class StatefulTargetRepositoryImp
      */
     private static String nextVersion(String version) {
         try {
-            Version v = new Version(version);
+            // in case the given version is null or empty, v will be '0.0.0'... 
+            Version v = Version.parseVersion(version);
             Version result = new Version(v.getMajor() + 1, 0, 0);
             return result.toString();
         }



Mime
View raw message