felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r820698 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java
Date Thu, 01 Oct 2009 16:02:40 GMT
Author: rickhall
Date: Thu Oct  1 16:02:40 2009
New Revision: 820698

URL: http://svn.apache.org/viewvc?rev=820698&view=rev
Log:
Use finals for thread safety. (FELIX-1679)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java?rev=820698&r1=820697&r2=820698&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/VersionRange.java
Thu Oct  1 16:02:40 2009
@@ -22,14 +22,14 @@
 
 public class VersionRange
 {
-    private Version m_low = null;
-    private boolean m_isLowInclusive = false;
-    private Version m_high = null;
-    private boolean m_isHighInclusive = false;
-    private String m_toString = null;
+    private final Version m_low;
+    private final boolean m_isLowInclusive;
+    private final Version m_high;
+    private final boolean m_isHighInclusive;
     public static final VersionRange infiniteRange = new VersionRange(Version.emptyVersion,
true, null, true);
 
-    public VersionRange(Version low, boolean isLowInclusive,
+    public VersionRange(
+        Version low, boolean isLowInclusive,
         Version high, boolean isHighInclusive)
     {
         m_low = low;
@@ -140,23 +140,19 @@
 
     public String toString()
     {
-        if (m_toString == null)
+        if (m_high != null)
         {
-            if (m_high != null)
-            {
-                StringBuffer sb = new StringBuffer();
-                sb.append(m_isLowInclusive ? '[' : '(');
-                sb.append(m_low.toString());
-                sb.append(',');
-                sb.append(m_high.toString());
-                sb.append(m_isHighInclusive ? ']' : ')');
-                m_toString = sb.toString();
-            }
-            else
-            {
-                m_toString = m_low.toString();
-            }
+            StringBuffer sb = new StringBuffer();
+            sb.append(m_isLowInclusive ? '[' : '(');
+            sb.append(m_low.toString());
+            sb.append(',');
+            sb.append(m_high.toString());
+            sb.append(m_isHighInclusive ? ']' : ')');
+            return sb.toString();
+        }
+        else
+        {
+            return m_low.toString();
         }
-        return m_toString;
     }
 }
\ No newline at end of file



Mime
View raw message