[MAGNOLIA-4858] info.magnolia.objectfactory.ObjectManufacturer: wrong constructor resolving Created: 21/Feb/13  Updated: 19/May/22  Resolved: 19/May/22

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: None
Fix Version/s: 4.5.x

Type: Bug Priority: Neutral
Reporter: Ondrej Chytil Assignee: Ondrej Chytil
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Due to changes in Oracle java 7 bug was exposed in process of providing components by MockComponentProvider. Possible constructor are checked in order provided by JVM but should check for exact match instead.

Test case - info.magnolia.test.mock.MockComponentProviderTest.testThrowsExceptionWhenEncounteringConstructorTakingStringArgument()
With Oracle JDK 1.6.0_39 - test passes
Constructors order for String type:

[public java.lang.String(), public java.lang.String(java.lang.String), public java.lang.String(char[]), public java.lang.String(char[],int,int), public java.lang.String(int[],int,int), public java.lang.String(byte[],int,int,int), public java.lang.String(byte[],int), public java.lang.String(byte[],int,int,java.lang.String) throws java.io.UnsupportedEncodingException, public java.lang.String(byte[],int,int,java.nio.charset.Charset), public java.lang.String(byte[],java.lang.String) throws java.io.UnsupportedEncodingException, public java.lang.String(byte[],java.nio.charset.Charset), public java.lang.String(byte[],int,int), public java.lang.String(byte[]), public java.lang.String(java.lang.StringBuffer), public java.lang.String(java.lang.StringBuilder), java.lang.String(int,int,char[])]

With Oracle JDK 1.7.0_13 - test fails
Constructors order for String type:

[public java.lang.String(byte[]), public java.lang.String(byte[],int,int), public java.lang.String(byte[],java.nio.charset.Charset), public java.lang.String(byte[],java.lang.String) throws java.io.UnsupportedEncodingException, public java.lang.String(byte[],int,int,java.nio.charset.Charset), java.lang.String(int,int,char[]), java.lang.String(char[],boolean), public java.lang.String(java.lang.StringBuilder), public java.lang.String(java.lang.StringBuffer), public java.lang.String(int[],int,int), public java.lang.String(char[],int,int), public java.lang.String(char[]), public java.lang.String(java.lang.String), public java.lang.String(), public java.lang.String(byte[],int,int,java.lang.String) throws java.io.UnsupportedEncodingException, public java.lang.String(byte[],int), public java.lang.String(byte[],int,int,int)]

Point of this test case is to catch CircularDependencyException (re-thrown as MgnlInstantiationException) thrown when certain type is checked for more times but with new order of possible constructors exception with message "No suitable constructor found for class" is thrown when wrong constructor is used to instantiate the object.



 Comments   
Comment by Roman Kovařík [ 19/May/22 ]

Hello,

This ticket is now marked as closed due to one of the following reasons:

  • A long period of inactivity
  • Uses an old or Beta version of an application, module, or framework that we no longer support
  • The issue is no longer reproducible or has been fixed in later versions

If you are still facing a problem or consider this issue still relevant, please feel free to re-open the ticket and we will reach out to you.

Thank you,
The Magnolia Team

Generated at Mon Feb 12 03:59:42 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.