Comments (13)
@harawata what do you think about this ^^?
from ognl.
Are you sure you call request()
with no params? OGNL has a test to confirm calling VarArgs method with null params, also I've added an additional test case and worked as expected.
from ognl.
I've just double-checked all other OGNL statements that are configured and all of them call request()
.
I built a unit test myself which appears to reproduce the issue against ognl:ognl:3.2.20 in central:
https://gist.github.com/petergeneric/d898dd50477d690cdedf9672ae945dc7
For me, the first assert passes (OGNL calls the right method), but the second assert that there's no stderr output fails
Hopefully it's not caused by me setting something up incorrectly - apologies in advance if that is the case!
from ognl.
Thanks a lot for your example, I was able reproduce this problem locally and what is more interesting it only happens in nested expressions like get().request()
from ognl.
I found the source of the problem, by introducing #69 something has been broken, using
-Dognl.security.manager=forceDisableOnInit
solves the problem.
from ognl.
Which version of Java do you use? Upgrading Java to version 8 solves the problem, so maybe it's time to abound Java 1.7 in OGNL and start using Java 8 🤔
from ognl.
I'm using a range of versions (it's an app suport framework), 1.8 LTS, 11 LTS and 16 (16 to be dropped whe 17 LTS comes out), this particular app was running on 16 (as was the unit test)
from ognl.
Hi @lukaszlenart @petergeneric !
I just took a quick look and the error does not depend on Java version, but it is not 100% reproducible.
Basically, the test result depends on the order of the methods returned from Class#getDeclaredMethods()
which varies on every run.
There are several logical issues.
- The method
OgnlRuntime#areArgsCompatible()
currently returns the same score for the threerequest
methods, but it should give the one with no argumentshigherlower score when there is no arguments. The condition of this line looks incorrect (mm.score > score
should bemm.score < score
).- To eliminate the order-dependency that I mentioned, reporting this particular error (i.e. "Two vararg methods with same score ...") may have to wait until all methods are evaluated.
[EDIT]
Sorry! Smaller score means better match. Edited 1 and deleted 2.
from ognl.
Thanks a lot @harawata for your insights! I will try to improve the code base on your ideas. Yet I would like to know if switching to Java 8 would be a problem for you?
from ognl.
Hi @lukaszlenart ,
MyBatis 3.5.x requires Java 8, so there is no problem on our side.
Thank you for checking!
from ognl.
@petergeneric I have pushed OGNL 3.2.21-SNAPSHOT into https://s01.oss.sonatype.org/content/repositories/snapshots/ - could you test it?
from ognl.
@lukaszlenart looks good to me, thanks (Maven couldn't find 3.2.21-SNAPSHOT on s01.oss or oss., but I found and used 3.2.21-20210509.182701-1 on oss.sonatype which looks like the right artifact from the timestamp).
I ran the test several times against JDK10 and JDK11 and didn't get any errors.
from ognl.
@petergeneric great, thanks a lot for your help!
from ognl.
Related Issues (20)
- IllegalArgumentException when calling Ognl.getValue(Object, Object, Class) HOT 1
- Should this null-check be here? HOT 2
- Varargs method not found if no varargs are given HOT 2
- Developer Guide uses deprecated code HOT 4
- The 3.2.18 version of ognl.Ognl#getValue(..) is not easy to use at all HOT 3
- Move OGNL under a dedicated organisation HOT 10
- java.lang.ArithmeticException: / by zero HOT 3
- Illegal reflective access warning when using "_parameter.containsKey() and Collections.singletonMap HOT 6
- OGNL issues with java 16 and 17 HOT 9
- Struts2 2.5 and struts2-jquery-plugin HOT 2
- In 3.3.3 (and before) compileExpression fails without add-opens on Java 17 HOT 13
- 如何解决安全问题。How ognl solve safety problem HOT 5
- Ognl.createDefaultContext(Object, ClassResolver) throws "IllegalArgumentException" HOT 4
- method with varargs invoked result exception: java.lang.ArrayStoreException HOT 6
- Most unit tests no longer running? HOT 2
- Cannot call static method through interface? HOT 8
- Request for posting of Maven signing key(s) HOT 2
- Dependency Dashboard
- Ognl choosing method on unexported class rather than exported interface
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ognl.