[Scilab-users] Calling a java method in a Scilab function

Pierre Vuillemin contact at pierre-vuillemin.fr
Mon Dec 19 15:51:54 CET 2016


Glad to know that it has been fixed. Thank you for your answer. 

Best regards, 

Pierre 

Le 10.12.2016 15:09, Samuel Gougeon a écrit :

> Hello Pierre,
> 
> Le 07/12/2016 10:04, Pierre Vuillemin a écrit : 
> 
>> Hi all, 
>> 
>> I have to create unique IDs for some object in Scilab. For that purpose, someone kindly guided me towards the UUID class of java, which lead me to create this function in Scilab, 
>> 
>> function id = make_id() 
>> UUID     = jimport("java.util.UUID", %f) 
>> tmp      = jinvoke(UUID,"randomUUID") 
>> id       = jinvoke(tmp,"toString") 
>> endfunction 
>> 
>> It works fine. 
>> 
>> An a priori similar function is 
>> 
>> function id = make_id_err() 
>> UUID     = jimport("java.util.UUID", %f) 
>> tmp      = UUID.randomUUID() 
>> id       = tmp.toString() 
>> endfunction 
>> 
>> where the methods are called without jinvoke. While the instructions of the latter function work well in the terminal, they lead to an error when trying to exec the function 'make_id_err'. 
>> 
>> I was wondering if it is a normal behaviour?
> No, but the bug is fixed in Scilab 6.0:
> 
> In Scilab 5.5.2:
> -->endfunction
> UUID     = jimport("java.util.UUID", %f)
> !--error 26 
> Récursivité trop complexe ! (Les tables de récurrence sont pleines)
> at line       2 of function make_id_err called by :  
> tmp      = UUID.randomUUID()
> at line       3 of function make_id_err called by :  
> tmp      = UUID.randomUUID()
> at line       3 of function make_id_err called by :  
> ... etc
> 
> In Scilab 6.0:
> --> getversion("scilab")
> ans  =
> 6.   0.   0.   1.477D+09
> 
> --> function id = make_id_err()
>>    UUID     = jimport("java.util.UUID", %f)
>>    tmp      = UUID.randomUUID()
>>    id       = tmp.toString()
>> endfunction
> 
> --> make_id_err()
> ans  =
> 49e4f3f1-736a-435f-bc26-f7061f10de27
> 
> BR
> Samuel 
> 
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161219/8689ef7f/attachment.htm>


More information about the users mailing list