我正在尝试在我的项目中使用 OWASP ESAPI。但问题是owasp文档对我来说太复杂了。我正在尝试使用 esapi 的验证,但即使没有错误,我也无法获得结果。
import org.owasp.esapi.ESAPI;
import org.owasp.esapi.Validator;
public void security(String s) {
System.out.println("connect 1");
Validator instance = ESAPI.validator();
System.out.println("connect 2");
System.out.println(instance.isValidInput("test", "xxxxx@gmail.com", "Email", 100, false));
}
如果我尝试运行 3 次,结果如下:
connect 1
Attempting to load ESAPI.properties via file I/O.
Attempting to load ESAPI.properties as resource file via file I/O.
Not found in 'org.owasp.esapi.resources' directory or file not readable: C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\bin\ESAPI.properties
Not found in SystemResource Directory/resourceDirectory: .esapi\ESAPI.properties
Found in 'user.home' directory: C:\Users\xxxx\esapi\ESAPI.properties
Loaded 'ESAPI.properties' properties file
Attempting to load validation.properties via file I/O.
Attempting to load validation.properties as resource file via file I/O.
Not found in 'org.owasp.esapi.resources' directory or file not readable: C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\bin\validation.properties
Not found in SystemResource Directory/resourceDirectory: .esapi\validation.properties
Found in 'user.home' directory: C:\Users\xxxx\esapi\validation.properties
Loaded 'validation.properties' properties file
connect 1
connect 1
如您所见,没有错误并且属性已正确加载。我的问题是为什么它停在那里。为什么没有打印“连接 2”?为什么 instance.isValidInput 的结果也没有打印出来?