cancel
Showing results for 
Search instead for 
Did you mean: 

Exception encoding

fararjeh
Champ in-the-making
Champ in-the-making
Hi


I created action in alfresco to execute some business logic before create document and when error occurred then throws exception to workdesk, In previous version is running but in new version the exception is encoding .

Old version:
[img=600x480]https://forums.alfresco.com/sites/forums/files/old%20version.png[/img]

New version:
[img=600x480]https://forums.alfresco.com/sites/forums/files/new%20version.png[/img]


14 REPLIES 14

fararjeh
Champ in-the-making
Champ in-the-making
Is there any update on this issue?

d_evil
Champ in-the-making
Champ in-the-making
Hey, could you check the encoding of your localize files.

What encoding does it have? UTF-8 (with or w/o BOM)
I don't see any code changes, but maybe I my sources are not up to date.

Did you changed something in the localize files?
Are the screens taken with the same localize files?

I will try to check again, but no guarantee I can help.

fararjeh
Champ in-the-making
Champ in-the-making
Hey, Thank you for replying

My code is UTF-8 encoding and in old version is working properly but in new version is not working .

deko
Star Contributor
Star Contributor
Hi fararjeh,

When you talk about versions (old and new), are you talking about Workdesk versions? If yes, which are the versions you used?

If you are talking about Alfresco versions, which are the ones you used?

On your screenshot I can see that the exception is coming from the CMIS side, so my next question is, are all exceptions encoded in wrong format or can you only confirm for this exception?

Is your file encoding really UTF-8 or is it UTF-8 with BOM? You should try it with BOM.

Best regards,
deko

fararjeh
Champ in-the-making
Champ in-the-making
Hi deko

Of course I'm talking about workdesk version and I'm currently using workdesk version 4.1.1.1 and old version is 4.1.0.0.

About exception yes It comes from cmis exactly from alfresco policy when create new content

if(employeeVacationDurationAfter>90){
       throw new AlfrescoRuntimeException("لا يمكن اخذ اجازة أكثر من 90 يوم متتاليه ");
}else{
      ……..
}

My java class encoding is UTF-8 and I think by default is with BOM , If not default encode with BOM So how  can I determine it ?

deko
Star Contributor
Star Contributor
Hi farajeh,

D.Evil and me were not talking about java class encoding but about the file encoding of the localize.properties file, which includes the values for all localize keys.

You are throwing this exception in Alfresco itself and there is no localized value in Workdesk at all, right? So the exception might be passed as is from Alfresco resp. the CMIS component. Workdesk is displaying the exception as passed through.

Did your Alfresco versions also change in between? I don´t know of any code change on the encoding side of Workdesk at the moment. Only difference on the Workdesk side I could think of here is again the different usage of two different CMIS adapter implementations => Old version using Sun Metro and new version using Apache Chemistry OpenCMIS.

Best regards,
deko

fararjeh
Champ in-the-making
Champ in-the-making
Hi deko,

About changing alfesco version, I didn't change it , only change workdesk version and I guess when workdesk change from Sun Metro to Apache Chemistry OpenCMIS, It didn't encode exception  to UTF-8 in OpenCMIS .

This issue is very important because I do some buisness validation in alfresco policy before add content and when any error occured must user know that error .can you resolve this issue ?

Regards,
fararjeh

deko
Star Contributor
Star Contributor
HI farajeh,

I can´t fix it at the moment as I don´t see this behavior when throwing any exception. Mine are encoded correctly. Maybe you need to change the way you throw that exception and localize it so that it is encoded correctly. Can you show me how to reproduce this in the standard product by generating any exception? Is it only occuring for your exception or also for other CMIS exceptions?

Best regards,
Dennis

fararjeh
Champ in-the-making
Champ in-the-making
Hi deko,

Firstly, I can't use localization Technic because all validation exceptions of the type is alfresco run time exception so in workdesk it define as one typeSmiley Sad[com.wewebu.ow.server.ecmimpl.opencmis.OwCMISNetwork.err.createNewObject.runtime] )

[img=730x650]https://forums.alfresco.com/sites/forums/files/encoding.png[/img]

I want to acknowledge a point when you view the details of the exception,It appears correctly as shown in the picture below:
[img=730x650]https://forums.alfresco.com/sites/forums/files/21.png[/img]

Any exception that created from alfresco policy, It appears correctly but If the exception contain arabic language character does not appear correctly.