Some Aspose.Cells API are throwing Exception

Hello,

There are a few methods in the Aspose.Cells API that are throwing an Exception. This is all very fine when it is a specific SomethingException, but it is against all coding practices to just throw a java.lang.Exception.

For example, the Workbook constructor is throwing java.lang.Exception.

An issue for us is that we are forced to use try/catch blocks with this generic exception and our static code analysis tools (checkstyle, PMD, Sonar…) are all complaining about major coding rules violations. And there is nothing we can do about it except ignore these warnings.

Can you please let us know if you plan to change anything about this? For example, you could easily change all these methods signatures with a generic AsposeException. That would be a very nice first step. The next one would be for you to implement specific and documented exceptions.

Thanks and regards,
VR

Hi VR,

Thanks for your posting and using Aspose.Cells for Java.

We are sorry for inconvenience.

If you are getting any generic exception, then please provide us your sample code and source file replicating the exception. We will evaluate your issue and log it in our database for consideration and fix.

Also, if you are using some older version, then we will recommend you to use the latest version: Aspose.Cells
for Java v7.7.1.4
it might fix the issues of older version.

Hi,

I am not getting any exception. But, the Aspose API forces me to catch java.lang.Exception anyway. And this is not compliant to Java coding best practices.

Regards,
VR

Hello,

We encounter the same issue here.
As explained by RoukVinc, it’s here a matter of coding conventions. In others words, when you write a method, you should not do that:

public void someMethod() throws Exception { … }

but instead:

public void someMethod() throws AsposeException { … }

or even better (if needed):

public void someMethod() throws AsposeFileException, AsposeProcessingException { … }

This way, the developer that uses the API can process a different treatment regarding the kind of exception thrown.

Hi,

Thanks for your posting and using Aspose.Cells for Java.

We have logged this issue in our database for consideration. Aspose.Cells should not throw any generic exception and the exceptions should be specific e.g AsposeException.

We will look into it and implement it if possible. Once, we will have some fix or some other update for you, we will let you know asap.

This issue has been logged as CELLSJAVA-40726.

Hello,

Thanks a lot.
Please note that this issue is not related to AsposeCells, but to all Aspose products (AsposeWords, etc.).

Regards

Hi Romain,

We have currently logged a ticket in reference to Aspose.Cells for Java API only. If you wish to expand the scope of your request to other Aspose products then I would suggest you to either create threads in their respective forums or bring your concerns to Aspose.Total support forum. The teams from other Aspose products will address your concerns accordingly.