maxsatula / ocp

Oracle Copy utility
GNU General Public License v2.0
13 stars 2 forks source link

ocp.exe crashes when directory on filesystem is missing #41

Closed eurodba closed 5 years ago

eurodba commented 7 years ago

Dear @maxsatula, I found following behavior: if Oracle DIRECTORY object points to the directory on filesystem, which physically does not exists - ocp.exe crashes with error:

C:\> ocp test$schema/password@db01 --ls=FFFFF_DATA_UNLOAD
Contents of FFFFF_DATA_UNLOAD directory
File Name                                    Size     Last Modified
---------------------------------------- ------------ -------------------
Failed to list files in oracle directory
ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException

C:\>

I have made tracing of Oracle session, and found following:

Exception in thread "Root Thread" java.lang.NullPointerException

    at j_ocp_DirList.getList(j_ocp_DirList:41)

Line 41 in j_ocp_DirList is:

Object[][] result = new Object[files.length][4];

Thanks a lot for so useful utility, it's great!

If you can add some verbose or logging parameter - then it would be much easier to understand, what is going on and where is problem + it will allow to open much more qualitative issues for you here on GitHub.

maxsatula commented 7 years ago

Hi Rostislav @eurodba ,

Thank you for the detailed info. I would refrain adding verbose/logging to avoid the code being bloated at this time. Your issue description is of higher quality than I needed. Currently, the code is not big, and there is no big problem to find an exact place in the code simply based on your console output.

Despite the configuration when someone creates an Oracle directory and fails to create a filesystem directory is not ocp issue, but a wider problem, I guess ocp still should be smart enough to deliver a proper error message. To be fixed.

Thanks, Max

eurodba commented 7 years ago

Dear Max @maxsatula, sorry for a bit late reply. I agree of course that before using ocp.exe, everything should be tested and checked with Data Pump - i.e. to be sure, that DIRECTORY object is correctly created, configured permissions on object and correctly created directory on FS / configured permissions on it.

But app should not crash in any case, with NullPointerException, I believe you agree :)

... is no big problem to find an exact place in the code simply based on your console output.

If I correctly interpret output I have posted above, error java.lang.NullPointerException does not explain, where it was raised. Maybe for you it's more obvious, but not for us! So, I was able to find exact row in Java stored code only after tracing Oracle session.

maxsatula commented 7 years ago

After bc2cdbb server side objects will need to be reinstalled by running ocp <connection_string> --install