You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2006/08/07 19:36:02 UTC

svn commit: r429409 - in /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol: cache/CacheBase.java cache/InMemoryCache.java client/RequestOptions.java client/ResponseBase.java

Author: jmsnell
Date: Mon Aug  7 10:36:02 2006
New Revision: 429409

URL: http://svn.apache.org/viewvc?rev=429409&view=rev
Log:
Had a bit of a brain fart on the bitwise operators

Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java?rev=429409&r1=429408&r2=429409&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java Mon Aug  7 10:36:02 2006
@@ -122,6 +122,10 @@
     RequestOptions options,
     Response response) {
     CacheKey key = getCacheKey(uri, options,response);
+System.out.println(response);
+System.out.println(response.isNoStore());
+System.out.println(options);
+System.out.println(options.getNoStore());
     if ((response != null && response.isNoStore()) ||
         options != null && options.getNoStore()) {
      remove(key);

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java?rev=429409&r1=429408&r2=429409&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java Mon Aug  7 10:36:02 2006
@@ -46,7 +46,7 @@
   }
 
   public CachedResponse get(
-    CacheKey key) {
+    CacheKey key) {   
       return cache.get(key);
   }
 

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?rev=429409&r1=429408&r2=429409&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java Mon Aug  7 10:36:02 2006
@@ -230,7 +230,7 @@
   
   public void setOnlyIfCached(boolean condition) {
     if (condition) flags |= ONLYIFCACHED;
-    else flags ^= ONLYIFCACHED;
+    else if (getOnlyIfCached()) flags ^= ONLYIFCACHED;
   }
   
   public boolean getNoTransform() {
@@ -239,7 +239,7 @@
   
   public void setNoTransform(boolean condition) {
     if (condition) flags |= NOTRANSFORM;
-    else flags ^= NOTRANSFORM;
+    else if (getNoTransform()) flags ^= NOTRANSFORM;
   }
   
   public boolean getNoCache() {
@@ -248,7 +248,7 @@
   
   public void setNoCache(boolean condition) {
     if (condition) flags |= NOCACHE;
-    else flags ^= NOCACHE;
+    else if (getNoCache()) flags ^= NOCACHE;
   }
   
   public boolean getNoStore() {
@@ -257,7 +257,7 @@
   
   public void setNoStore(boolean condition) {
     if (condition) flags |= NOSTORE;
-    else flags ^= NOSTORE;
+    else if (getNoStore()) flags ^= NOSTORE;
   }
   
   public long getMaxAge() {

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java?rev=429409&r1=429408&r2=429409&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java Mon Aug  7 10:36:02 2006
@@ -29,13 +29,13 @@
 
 public abstract class ResponseBase implements Response {
 
-  protected byte flags = 0;
-  protected final static byte NOCACHE = 1;
-  protected final static byte NOSTORE = 2;
-  protected final static byte NOTRANSFORM = 4;
-  protected final static byte PUBLIC = 8;
-  protected final static byte PRIVATE = 16;
-  protected final static byte REVALIDATE = 32;
+  protected int flags = 0;
+  protected final static int NOCACHE = 1;
+  protected final static int NOSTORE = 2;
+  protected final static int NOTRANSFORM = 4;
+  protected final static int PUBLIC = 8;
+  protected final static int PRIVATE = 16;
+  protected final static int REVALIDATE = 32;
   protected String[] nocache_headers = null;
   protected String[] private_headers = null;
   protected long max_age = -1;
@@ -155,32 +155,32 @@
   
   public void setMustRevalidate(boolean val) {
     if (val) flags |= REVALIDATE;
-    else flags ^= REVALIDATE;
+    else if (isMustRevalidate()) flags ^= REVALIDATE;
   }
   
   public void setNoCache(boolean val) {
     if (val) flags |= NOCACHE;
-    else flags ^= NOCACHE;
+    else if (isNoCache()) flags ^= NOCACHE;
   }
   
   public void setNoStore(boolean val) {
     if (val) flags |= NOSTORE;
-    else flags ^= NOSTORE;
+    else if (isNoStore()) flags ^= NOSTORE;
   }
   
   public void setNoTransform(boolean val) {
     if (val) flags |= NOTRANSFORM;
-    else flags ^= NOTRANSFORM;
+    else if (isNoTransform()) flags ^= NOTRANSFORM;
   }
   
   public void setPublic(boolean val) {
     if (val) flags |= PUBLIC;
-    else flags ^= PUBLIC;
+    else if (isPublic()) flags ^= PUBLIC;
   }
   
   public void setPrivate(boolean val) {
     if (val) flags |= PRIVATE;
-    else flags ^= PRIVATE;
+    else if (isPrivate()) flags ^= PRIVATE;
   }
   
   public void setPrivateHeaders(String... headers) {



Re: svn commit: r429409 - in /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol: cache/CacheBase.java cache/InMemoryCache.java client/RequestOptions.java client/ResponseBase.java

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 8/7/06, James M Snell <ja...@gmail.com> wrote:
> Sorry, I keep getting distracted here on this end.  Just committed
> another one where I realized the log message was wrong.. after
> committing it.  In any case, the code should be ok, even if the person
> committing needs a few whacks upside the head.

Can you please update the log message to accurately reflect what was changed.

It should be as simple as svn pedit --revprop svn:log -r 429409
https://svn.apache.org/repos/asf

-garrett

Re: svn commit: r429409 - in /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol: cache/CacheBase.java cache/InMemoryCache.java client/RequestOptions.java client/ResponseBase.java

Posted by James M Snell <ja...@gmail.com>.
Sorry, I keep getting distracted here on this end.  Just committed
another one where I realized the log message was wrong.. after
committing it.  In any case, the code should be ok, even if the person
committing needs a few whacks upside the head.

- James

Garrett Rooney wrote:
> On 8/7/06, jmsnell@apache.org <jm...@apache.org> wrote:
>> Author: jmsnell
>> Date: Mon Aug  7 10:36:02 2006
>> New Revision: 429409
>>
>> URL: http://svn.apache.org/viewvc?rev=429409&view=rev
>> Log:
>> Had a bit of a brain fart on the bitwise operators
>>
>> Modified:
>>    
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
>>
>>    
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
>>
>>    
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
>>
>>    
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java
>>
>>
>> Modified:
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
>>
>> URL:
>> http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java?rev=429409&r1=429408&r2=429409&view=diff
>>
>> ==============================================================================
>>
>> ---
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
>> (original)
>> +++
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
>> Mon Aug  7 10:36:02 2006
>> @@ -122,6 +122,10 @@
>>      RequestOptions options,
>>      Response response) {
>>      CacheKey key = getCacheKey(uri, options,response);
>> +System.out.println(response);
>> +System.out.println(response.isNoStore());
>> +System.out.println(options);
>> +System.out.println(options.getNoStore());
>>      if ((response != null && response.isNoStore()) ||
>>          options != null && options.getNoStore()) {
>>       remove(key);
> 
> That probably wasn't intended...
> 
>> Modified:
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
>>
>> URL:
>> http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java?rev=429409&r1=429408&r2=429409&view=diff
>>
>> ==============================================================================
>>
>> ---
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
>> (original)
>> +++
>> incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
>> Mon Aug  7 10:36:02 2006
>> @@ -46,7 +46,7 @@
>>    }
>>
>>    public CachedResponse get(
>> -    CacheKey key) {
>> +    CacheKey key) {
>>        return cache.get(key);
>>    }
> 
> Is this just a whitespace change?  No objection to those, but they
> should be committed separately.
> 
> -garrett
> 

Re: svn commit: r429409 - in /incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol: cache/CacheBase.java cache/InMemoryCache.java client/RequestOptions.java client/ResponseBase.java

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 8/7/06, jmsnell@apache.org <jm...@apache.org> wrote:
> Author: jmsnell
> Date: Mon Aug  7 10:36:02 2006
> New Revision: 429409
>
> URL: http://svn.apache.org/viewvc?rev=429409&view=rev
> Log:
> Had a bit of a brain fart on the bitwise operators
>
> Modified:
>     incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
>     incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
>     incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
>     incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/ResponseBase.java
>
> Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java
> URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java?rev=429409&r1=429408&r2=429409&view=diff
> ==============================================================================
> --- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java (original)
> +++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/CacheBase.java Mon Aug  7 10:36:02 2006
> @@ -122,6 +122,10 @@
>      RequestOptions options,
>      Response response) {
>      CacheKey key = getCacheKey(uri, options,response);
> +System.out.println(response);
> +System.out.println(response.isNoStore());
> +System.out.println(options);
> +System.out.println(options.getNoStore());
>      if ((response != null && response.isNoStore()) ||
>          options != null && options.getNoStore()) {
>       remove(key);

That probably wasn't intended...

> Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java
> URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java?rev=429409&r1=429408&r2=429409&view=diff
> ==============================================================================
> --- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java (original)
> +++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/cache/InMemoryCache.java Mon Aug  7 10:36:02 2006
> @@ -46,7 +46,7 @@
>    }
>
>    public CachedResponse get(
> -    CacheKey key) {
> +    CacheKey key) {
>        return cache.get(key);
>    }

Is this just a whitespace change?  No objection to those, but they
should be committed separately.

-garrett