Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000134 [Resin] minor always 05-04-05 00:00 02-03-06 09:54
Reporter user154 View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0000134: Hessian Deserializer and constructors
Description RSN-125
Hi,

it seems that the deserializer of hessian chooses the constructor undeterminsticily. We have a class with a private default constructor (it's not allowed to call it despite hessian) and a constructor with a pointer argument. On some systems hessian chooses the correct default constructor and on others the wrong constructor with argument. On the faulty systems it helped, if we change the visibility to public, why ever.

I don't understand the code in "com.caucho.hessian.io.JavaDeserializer.java". There I can find:

Constructor []constructors = cl.getDeclaredConstructors();
int bestLength = Integer.MAX_VALUE;

[...]
for (int i = 0; i < constructors.length; i++) {
  if (constructors[i].getParameterTypes().length < bestLength) {
    _constructor = constructors[i];
    bestLength = _constructor.getParameterTypes().length;
  }
}
[...]

This is not deterministic (a new constructor with fewer args will always be choosen), and the constructor arguments are only guessed afterwards (with null).

Why doesn't hessian use "__type.newInstance()" all the time?

Ciao,

  Marc Ewert
Additional Information JDK 1.4.2
Attached Files

- Relationships

- Notes
(0000160)
user154
05-04-05 00:00

if there are several constructors with the same number of parameters, than the choosen constructor is indetermistic choosen, depending on plattform and runtime environment (If they are the constructors with the smallest number of parameters).
 
(0000860)
ferg
02-03-06 09:54

ejb/331[7-9]
 

- Issue History
Date Modified Username Field Change
05-04-05 00:00 user154 New Issue
02-03-06 09:54 ferg Note Added: 0000860
02-03-06 09:54 ferg Assigned To  => ferg
02-03-06 09:54 ferg Status acknowledged => closed
02-03-06 09:54 ferg Resolution open => fixed
02-03-06 09:54 ferg version 3.0.12 =>
02-03-06 09:54 ferg Fixed in Version  => 3.0.18


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
37 total queries executed.
28 unique queries executed.
Powered by Mantis Bugtracker