Skip to content

Commit 8671f75

Browse files
committed
Fixed: Remove unused imports and comment out potentially risky logic in ContentWorker class
1 parent addf3bd commit 8671f75

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@
3333

3434
import org.apache.ofbiz.base.util.Debug;
3535
import org.apache.ofbiz.base.util.GeneralException;
36-
import org.apache.ofbiz.base.util.GroovyUtil;
3736
import org.apache.ofbiz.base.util.StringUtil;
3837
import org.apache.ofbiz.base.util.UtilCodec;
3938
import org.apache.ofbiz.base.util.UtilDateTime;
4039
import org.apache.ofbiz.base.util.UtilGenerics;
4140
import org.apache.ofbiz.base.util.UtilMisc;
4241
import org.apache.ofbiz.base.util.UtilProperties;
4342
import org.apache.ofbiz.base.util.UtilValidate;
44-
import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
4543
import org.apache.ofbiz.content.ContentManagementWorker;
4644
import org.apache.ofbiz.content.data.DataResourceWorker;
4745
import org.apache.ofbiz.entity.Delegator;
@@ -61,7 +59,6 @@
6159
import org.apache.ofbiz.service.LocalDispatcher;
6260
import org.apache.ofbiz.service.ModelService;
6361
import org.apache.ofbiz.service.ServiceUtil;
64-
import org.codehaus.groovy.control.CompilationFailedException;
6562
import org.xml.sax.InputSource;
6663
import org.xml.sax.SAXException;
6764

@@ -684,6 +681,11 @@ public static void selectKids(Map<String, Object> currentNode, Map<String, Objec
684681
*/
685682
public static boolean checkWhen(Map<String, Object> context, String whenStr, boolean defaultReturn) {
686683
boolean isWhen = defaultReturn;
684+
/*
685+
* The logic has been commented out, as it represents a potential security risk.
686+
* Moreover, the usage of this method is limited to a small group of custom Freemarker transforms,
687+
* that can be removed since they are essentially old experiments.
688+
687689
if (UtilValidate.isNotEmpty(whenStr)) {
688690
FlexibleStringExpander fse = FlexibleStringExpander.getInstance(whenStr);
689691
String newWhen = fse.expandString(context);
@@ -702,6 +704,7 @@ public static boolean checkWhen(Map<String, Object> context, String whenStr, boo
702704
throw new RuntimeException(e.getMessage());
703705
}
704706
}
707+
*/
705708
return isWhen;
706709
}
707710

0 commit comments

Comments
 (0)