Modified: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/security/URIGrant.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/security/URIGrant.java?rev=1456399&r1=1456398&r2=1456399&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/security/URIGrant.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/security/URIGrant.java Thu Mar 14 12:13:47 2013 @@ -64,7 +64,7 @@ class URIGrant extends CertificateGrant } location = Collections.unmodifiableCollection(uris); int hash = 3; - hash = 67 * hash + (this.location != null ? location.hashCode() : 0); + hash = 67 * hash + location.hashCode(); hash = 67 * hash + (super.hashCode()); hashCode = hash; }
Modified: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/util/Facade.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/util/Facade.java?rev=1456399&r1=1456398&r2=1456399&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/util/Facade.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/util/Facade.java Thu Mar 14 12:13:47 2013 @@ -1,15 +1,34 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.river.api.util; /** + * Interface definition of the facade pattern. * @author Peter Firmstone. * @since 2.2.0 */ public interface Facade<T> { + /** + * Reveals the object from behind the facade. + * + * @return the object behind the facade. + */ public T reveal(); /** * Equals must be implemented to check against another Facade by utilising Modified: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/util/ResultStream.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/util/ResultStream.java?rev=1456399&r1=1456398&r2=1456399&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/util/ResultStream.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/util/ResultStream.java Thu Mar 14 12:13:47 2013 @@ -38,6 +38,8 @@ public interface ResultStream<T> { /** * Close the result stream, this allows the implementer to close any * resources prior to deleting reference. + * + * At an arbitrary future date, this interface will extend Closeable in Java 8. */ public void close() throws IOException; } Modified: river/jtsk/skunk/qa_refactor/trunk/test/src/org/apache/river/api/security/ConcurrentPolicyFileTest.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/test/src/org/apache/river/api/security/ConcurrentPolicyFileTest.java?rev=1456399&r1=1456398&r2=1456399&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/test/src/org/apache/river/api/security/ConcurrentPolicyFileTest.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/test/src/org/apache/river/api/security/ConcurrentPolicyFileTest.java Thu Mar 14 12:13:47 2013 @@ -22,6 +22,7 @@ package org.apache.river.api.security; +import java.net.URI; import tests.support.FakePrincipal; import java.net.URL; import java.security.cert.Certificate; @@ -72,9 +73,9 @@ public class ConcurrentPolicyFileTest ex Permission sp = new SecurityPermission("sdf"); PermissionGrantBuilder pgb = PermissionGrantBuilder.newBuilder(); PermissionGrant[] pe = new PermissionGrant[] { - pgb.codeSource(null).principals(null) + pgb.uri(null).principals(null) .permissions(new Permission[] { sp }) - .context(PermissionGrantBuilder.CODESOURCE) + .context(PermissionGrantBuilder.URI) .build() }; TestParser tp = new TestParser(pe); @@ -108,21 +109,23 @@ public class ConcurrentPolicyFileTest ex */ public void testGetPermissions_CodeSource() throws Exception { PermissionGrantBuilder pgb = PermissionGrantBuilder.newBuilder(); - pgb.context(PermissionGrantBuilder.CODESOURCE); + pgb.context(PermissionGrantBuilder.URI); CodeSource cs = new CodeSource(null, (Certificate[])null); CodeSource cs2 = new CodeSource(new URL("http://a.b.c"), (Certificate[])null); Permission sp1 = new SecurityPermission("aaa"); Permission sp2 = new SecurityPermission("bbb"); Permission sp3 = new SecurityPermission("ccc"); - PermissionGrant pe1 = pgb.codeSource(cs) + PermissionGrant pe1 = pgb.uri(null) .permissions(new Permission[] { sp1 }) .build(); - PermissionGrant pe2 = pgb.codeSource(cs2) + pgb.reset().context(PermissionGrantBuilder.URI); + PermissionGrant pe2 = pgb.uri(new URI("http://a.b.c")) .principals(new Principal[0]) .permissions(new Permission[] { sp2 }) .build(); - PermissionGrant pe3 = pgb.codeSource(cs) + pgb.reset().context(PermissionGrantBuilder.URI); + PermissionGrant pe3 = pgb.uri(null) .principals( new Principal[] {new FakePrincipal("qqq") }) .permissions(new Permission[] { sp3 }) .build(); @@ -147,7 +150,7 @@ public class ConcurrentPolicyFileTest ex */ public void testGetPermissions_ProtectionDomain() throws Exception { PermissionGrantBuilder pgb = PermissionGrantBuilder.newBuilder(); - pgb.context(PermissionGrantBuilder.CODESOURCE); + pgb.context(PermissionGrantBuilder.URI); Permission sp1 = new SecurityPermission("aaa"); Permission sp2 = new SecurityPermission("bbb"); Permission sp3 = new SecurityPermission("ccc"); @@ -162,20 +165,20 @@ public class ConcurrentPolicyFileTest ex ProtectionDomain pd2 = new ProtectionDomain(cs2, pcZ, null, new Principal[] { new FakePrincipal("qqq") }); - PermissionGrant pe1 = pgb.codeSource(cs) + PermissionGrant pe1 = pgb.uri(null) .permissions(new Permission[] { sp1 }) .build(); - PermissionGrant pe2 = pgb.codeSource(cs2) + PermissionGrant pe2 = pgb.uri(cs2.getLocation().toURI()) .principals(new Principal[] { new UnresolvedPrincipal( UnresolvedPrincipal.WILDCARD, UnresolvedPrincipal.WILDCARD) }) .permissions(new Permission[] { sp2 }) .build(); - PermissionGrant pe3 = pgb.codeSource(cs) + PermissionGrant pe3 = pgb.uri(null) .principals(new Principal[] { new UnresolvedPrincipal( FakePrincipal.class.getName(), "qqq") }) .permissions(new Permission[] { sp3 }) .build(); - PermissionGrant pe4 = pgb.codeSource(cs2) + PermissionGrant pe4 = pgb.uri(cs2.getLocation().toURI()) .principals(new Principal[] { new UnresolvedPrincipal( FakePrincipal.class.getName(), "ttt") }) .permissions(new Permission[] { sp4 }) Modified: river/jtsk/skunk/qa_refactor/trunk/test/src/org/apache/river/api/security/PolicyEntryTest.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/test/src/org/apache/river/api/security/PolicyEntryTest.java?rev=1456399&r1=1456398&r2=1456399&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/test/src/org/apache/river/api/security/PolicyEntryTest.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/test/src/org/apache/river/api/security/PolicyEntryTest.java Thu Mar 14 12:13:47 2013 @@ -54,10 +54,10 @@ public class PolicyEntryTest extends Tes // pe = new PolicyEntry(new CodeSource(null, (Certificate[])null), // new ArrayList<Principal>(), new ArrayList<Permission>()); - pe = pgb.codeSource(new CodeSource(null, (Certificate[])null)) + pe = pgb.uri(null) .principals(new Principal[0]) .permissions(new Permission[0]) - .context(PermissionGrantBuilder.CODESOURCE) + .context(PermissionGrantBuilder.URI) .build(); assertTrue(pe.isVoid()); assertTrue(pe.getPermissions().isEmpty()); @@ -65,7 +65,7 @@ public class PolicyEntryTest extends Tes Permission[] perms = new Permission[] { new SecurityPermission("dsfg"), new AllPermission() }; //pe = new PolicyEntry((CodeSource) null, (Collection<Principal>) null, perms); - pe = pgb.codeSource(null) + pe = pgb.uri(null) .principals(null) .permissions(perms) .build();
