Uploaded image for project: 'OpenOLAT'
  1. OpenOLAT
  2. OO-1382

Hardening ShibbolethHelper against null values

    XMLWordPrintable

    Details

      Description

      I had a situation where the attrVal in ShibbolethHelper was null and therefore a Redscreen occured. This patch helps in such a situtation:

      diff -r 40bbd42b918d src/main/java/org/olat/shibboleth/util/ShibbolethHelper.java
      --- a/src/main/java/org/olat/shibboleth/util/ShibbolethHelper.java	Fri Jan 09 13:37:46 2015 +0100
      +++ b/src/main/java/org/olat/shibboleth/util/ShibbolethHelper.java	Fri Jan 09 14:56:19 2015 +0100
      @@ -37,8 +37,11 @@
       	 */
       	public static String getFirstValueOf(String attributeName, Map<String, String> shibbolethAttributesMap) {
       		String attrVal = shibbolethAttributesMap.get(attributeName);
      -		ShibbolethAttribute multivalueShibbAttributeEmail = new ShibbolethAttribute(attributeName, attrVal);
      -		return multivalueShibbAttributeEmail.getFirstValue();	
      +		if (attrVal != null) {
      +			ShibbolethAttribute multivalueShibbAttributeEmail = new ShibbolethAttribute(attributeName, attrVal);
      +			return multivalueShibbAttributeEmail.getFirstValue();
      +		}
      +		else return null;
       	}
       
       }
      

        Attachments

          Activity

            People

            Assignee:
            srosse Stéphane Rossé
            Reporter:
            stephan Stephan Clemenz
            Tester:
            Stephan Clemenz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 10 minutes
                10m