User-friendliness when inputting illegal analysis options
addaddgo opened this issue · 5 comments
If the options for an analysis is blank on tai-e-analyses.yml, the ObjectMapper will set the Analysis.config.options as Collections$EmptyMap. see Planconfig.parseConfig
I set options by CLI argument which overwrite the Analyssi.config.options managed by ConfigManager. see ConfigManager.overwriteOptions
But the options is an Collections$EmptyMap which is fixed-size. Calling putAll on it throws UsuprotedOperationException.
List<AnalysisConfig> analysisConfigs = AnalysisConfig.parseConfigs(content); // EmptyMap
ConfigManager manager = new ConfigManager(analysisConfigs);
AnalysisPlanner planner = new AnalysisPlanner(
manager, options.getKeepResult());
boolean reachableScope = options.getScope().equals(Scope.REACHABLE);
if (!options.getAnalyses().isEmpty()) {
// Analyses are specified by options
List<PlanConfig> planConfigs = PlanConfig.readConfigs(options);
manager.overwriteOptions(planConfigs); // overwrite
Maybe my java version (jdk 17) is not right, or maybe it's a bug.
Could you provide the following information?
- Tai-e arguments (the arguments you set up that caused this bug)
- Runtime environment infomation (Provide your OS, IDE, and version/commit of Tai-e)
in tai-e-analyses.yml:
- description: the API collected from android.jar
analysisClass: qingren.extractor.APIExtractor
id: api-extractor
Tai-e arguments
-acp ...../android.jar -scope ALL -a "api-extractor=outPath:xxxxx"
I didn't set the main class. I think it is irrelevant to this problem.
Exception:
Exception in thread "main" java.lang.UnsupportedOperationException
at java.base/java.util.AbstractMap.put(AbstractMap.java:209)
at java.base/java.util.AbstractMap.putAll(AbstractMap.java:281)
at pascal.taie.config.AnalysisOptions.update(AnalysisOptions.java:74)
at pascal.taie.config.ConfigManager.lambda$overwriteOptions$0(ConfigManager.java:79)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at pascal.taie.config.ConfigManager.overwriteOptions(ConfigManager.java:77)
at pascal.taie.Main.processConfigs(Main.java:84)
at pascal.taie.Main.lambda$main$0(Main.java:51)
at pascal.taie.util.Timer.lambda$runAndCount$0(Timer.java:112)
at pascal.taie.util.Timer.runAndCount(Timer.java:93)
at pascal.taie.util.Timer.runAndCount(Timer.java:111)
at pascal.taie.util.Timer.runAndCount(Timer.java:107)
at pascal.taie.Main.main(Main.java:49)
If the options in tai-e-analyses is set, AbstarctMap shoulds be LinkedHashMap, if not, then it should be EmptyMap.
I think this is caused by the use of EmptyMap in the fastxml library to fill in the missing AnalysisCOnfig.options. Have to fill in options in plan.yml?
Runtime Environment:
OS: Ubuntu 22.04.1 LTS
IDE: IntelliJ IDEA 2022.2.2
commit: efbf256
Thanks, we will fix it.
Before that, we suggest you change
- description: the API collected from android.jar
analysisClass: qingren.extractor.APIExtractor
id: api-extractor
to
- description: the API collected from android.jar
analysisClass: qingren.extractor.APIExtractor
id: api-extractor
options:
outPath: null
Nice, is worked, thank you.
Updated in 64ee605.