← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20668: CORS filter, moved expensive call last in logical expression.

 

------------------------------------------------------------
revno: 20668
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-10-13 11:51:30 +0200
message:
  CORS filter, moved expensive call last in logical expression.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CorsFilter.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java	2015-08-27 11:49:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java	2015-10-13 09:51:30 +0000
@@ -147,7 +147,8 @@
 
     }
 
-    public ProgramRuleAction( String name, ProgramRule programRule, ProgramRuleActionType programRuleActionType, DataElement dataElement, TrackedEntityAttribute attribute, String location, String content, String data )
+    public ProgramRuleAction( String name, ProgramRule programRule, ProgramRuleActionType programRuleActionType, 
+        DataElement dataElement, TrackedEntityAttribute attribute, String location, String content, String data )
     {
         this.name = name;
         this.programRule = programRule;

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CorsFilter.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CorsFilter.java	2015-10-09 10:49:19 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CorsFilter.java	2015-10-13 09:51:30 +0000
@@ -29,7 +29,6 @@
  */
 
 import java.io.IOException;
-import java.util.Set;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -145,9 +144,8 @@
                 .scheme( forwardedProto ).build().toUriString();
         }
 
-        Set<String> whitelist = configurationService.getConfiguration().getCorsWhitelist();
-
-        return !StringUtils.isEmpty( origin ) && (localUrl.equals( origin ) || whitelist.contains( origin ));
+        return !StringUtils.isEmpty( origin ) && ( localUrl.equals( origin ) || 
+            configurationService.getConfiguration().getCorsWhitelist().contains( origin ) );
     }
 
     @Override