Skip to content

Commit

Permalink
#11441 update spring expression dependency to get rid of security issue
Browse files Browse the repository at this point in the history
SpEL is need for campaigns. Added test to make sure needed dependencies are available on Android
  • Loading branch information
MartinWahnschaffe committed Feb 6, 2023
1 parent 13ba9de commit 04854d5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.symeda.sormas.app.campaign;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;

import java.util.Arrays;

import org.junit.Test;
import org.springframework.expression.spel.standard.SpelExpressionParser;

import de.symeda.sormas.api.campaign.data.CampaignFormDataEntry;

/**
* This test is part of the android tests, to make sure
* Spring expression languages and it's dependencies are correctly working.
*
* Execute this on a device with minimum android SDK version!
*/
public class CampaignFormDataFragmentUtilsTest {

@Test
public void handleExpression() {
Object result = CampaignFormDataFragmentUtils.getExpressionValue(
new SpelExpressionParser(),
Arrays.asList(new CampaignFormDataEntry("missedChildren", 3), new CampaignFormDataEntry("teamDidNotVisit", 2)),
"missedChildren > 2 and teamDidNotVisit >= 2");
assertEquals(Boolean.TRUE, result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.j256.ormlite.logger.Logger;
import com.j256.ormlite.logger.LoggerFactory;

import org.springframework.util.CollectionUtils;
import org.apache.commons.collections.CollectionUtils;

import java.io.IOException;
import java.sql.SQLException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
import java.util.Locale;
import java.util.Map;

import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.SpelEvaluationException;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.View;

import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.SpelEvaluationException;

import de.symeda.sormas.api.campaign.data.CampaignFormDataEntry;
import de.symeda.sormas.api.campaign.form.CampaignFormElement;
import de.symeda.sormas.api.campaign.form.CampaignFormElementType;
Expand Down
3 changes: 1 addition & 2 deletions sormas-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -930,8 +930,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.30.RELEASE</version>
<!-- downgraded because of missing support in android api 24-->
<version>5.3.25</version>
</dependency>

<dependency>
Expand Down

0 comments on commit 04854d5

Please sign in to comment.