Problem with license file (CCSID)

Hello,

I'm using aspose.cells (java) for a while.

I had to modify the file.encoding of the JVM for correct conversion of all symbols.

This works fine, but I'm having troubles with the license-file !

How do I set the CCSID of the license file ? Does it have to be the same as other strings passed to the JVM, or must it be UTF-8 ?

I'm working on an iSeries, so all strings are passed to the JVM in EBCDIC format.

Thanks,

Hendrik Goddeau

Hi,

Because License.setLicense() accepts InputStream as parameter, I think you can read the license file’s content into memory and encode it to build a new ByteArrayInputStream from it for License.setLicense().

Code sample can be following:

File file = new File("…"); //license file
byte[] buffer = new byte[(int)file.length()];
FileInputStream fis = new FileInputStream(file);
fis.read(buffer);
fis.close();
String xml = new String(buffer, charset1);
buffer = xml.getBytes(charset2);
ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
new License().setLicense(bais);

Thank you.


Thanks,


I managed to change the encoding of the license-file, but the license is not accepted !
I still get the extra sheet with the evaluation comment.

Can you tell me in which codepage the license-data must be ?

Thanks again !

file.encoding=Cp1140

The excel-file is created as expected, but I get a license error.

"Evaluation only. Created with Aspose.Cells for Java."

Help !

HGOAS4:

file.encoding=Cp1140

The excel-file is created as expected, but I get a license error.

"Evaluation only. Created with Aspose.Cells for Java."

Help !

Could this have to do with a conversion of the signature ?

How is this enterpreted (hex?) ?

Hi,

Well, it looks strange to us. Do you mean you got no exception when you set the license, but an evaluation sheet appears in the generated file? If no exception caused by License.setLicense() method, the license should be set successfully and there should be no more evaluation sheet. By the way, if you could try the attached version v2.4.7, you can use License.isLicenseSet() method to check whether the license has been set or not.

Thanks.

I always get an error on setLicense , but no error is logged !

In some cases I get error :

"¬Fatal Error| :2:1: Content is not allowed in prolog."

Hi,

For this error, I am afraid you have not changed the encoding of license file correctly. To isolate the encoding problem, I think you can take the license file as a common xml file and parse it without using Aspose.Cells API. you may try the following code:

DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = builderFactory.newDocumentBuilder();
document = builder.parse(streamFromXmlFile);

With the same file encoding settings, if you can parse the xml file sucessfully, you should be able to set the license successfully too.

Thank you.

I set my file.encoding to Cp1140, so I converted the license-file to CCSID 1140.
When I google for this kind of error, I find the xml-parser finds symbols before the <?xml> tag
I also find solutions saying to change UTF-8 by utf-8 (lower case).

Will the signature still be valid when I change this in the license file ?

Thanks !

Yes, it is true that signature will be valid if you only change the encoding value of xml.

Thank you.

Does setLicense accept a BufferedReader ?

new BufferedReader( 
    new InputStreamReader( 
        new FileInputStream(file), UTF8)); 
HGOAS4:

Does setLicense accept a BufferedReader ?

new BufferedReader( 
    new InputStreamReader( 
        new FileInputStream(file), UTF8)); 
I create a ByteArrayInputStream with the buffer, and pass this to "setLicense".

I tried to pass the converted stream to setLicense, but I still get an error.
Is UTF8 the correct charset to pass to "SETLICENSE" ?
Which charset is expected ?

I don't see any additional info in STDERR !
Can you provide additional info ?

Thanks !

When I pass the license file in Cp1140 I receive error:

"Fatal Error ! : 16:11: Content is not allowed in trailing section."

It seems like some data is found after tag !?

HGOAS4:
When I pass the license file in Cp1140 I receive error:
"Fatal Error ! : 16:11: Content is not allowed in trailing section."

It seems like some data is found after tag !?

I managed to trim the trailing characters. I no longer receive any errors in stderr, but setlicense crashes ! I don't know what's going wrong !

Any advice ?

javap -classpath ".../aspose-cells-2.4.2.7.jar" -s com.aspose.cells.License

public class com.aspose.cells.License extends java.lang.Object{
static com.aspose.cells.License a; static java.lang.Class b;
public com.aspose.cells.License();
public void setLicense(java.io.InputStream) throws com.aspose.cells.AsposeLicenseException; final void a(org.w3c.dom.Element) throws com.aspose.cells.AsposeLicenseException;
static {}; }

I don't see anything like "isLicenseSet" ?

How can I use “AsposeLicenseException” ?

Hi,

Well, the method is there in the latest version/fix v2.4.3.x (you may try to download and try it: http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/default.aspx).
http://www.aspose.com/documentation/java-components/aspose.cells-for-java/com/aspose/cells/license.html

Thank you.

Hi,
We have tried to set file.encoding=cp1140 and found the license can be set successfully by License.setLicense(InputStream), where the stream is a FileInputStream built from the license file. And we need no any extra code to process the encoding. Are you using the original license file or have modified the file mannually? And would you please test the sample code we provided in previous reply(http://www.aspose.com/community/forums/permalink/270963/270563/showthread.aspx#270563) to check whether the xml can be parsed successfully? The result of this test can help us to find what's the problem.
Thank you.

Ok, I'll have a try.

Could there be a problem with the CRLF ? I always get error "Fatal Error| :2:1: Content is not allowed in prolog." --> Line 2 position 1

When I try to parse the xml, I get error :"Fatal Error| :2:1: Content is not allowed in prolog. "

Error on lin 2 pos 1 : Could there be a problem with the CRLF ?