Results 1 to 4 of 4

Thread: Trouble with exception

  1. #1
    Join Date
    Feb 2012
    Location
    Russia, Siberia
    Posts
    8

    Default Trouble with exception

    My application build with Spring roo. The first string in main class is
    Code:
    		new ClassPathXmlApplicationContext("META-INF/spring/applicationContext.xml");
    I want to handling a possible exception which appear with instantiating this constructor, because file "database.properties" can be edited by user. At start my application show error SQLNestedException and i can not
    handling it because SQLNestedException is deprecated. I want if appear any error with " new ClassPathXmlA..." execute a my method ~doWithError(). What can I do?


    Truly yours, Nafanya.

  2. #2

    Default

    Maybe you could validate the properties file before you start up spring. You say the properties file is user input, so maybe do validation before using it?

    Cheers,

    Matt

  3. #3
    Join Date
    Feb 2012
    Location
    Russia, Siberia
    Posts
    8

    Default

    Thank you. But how could i validate properties file before start up spring?

  4. #4
    Join Date
    Jan 2012
    Posts
    11

    Default

    Why don't you add the ' @SuppressWarnings("deprecation")' at your method?

    If you are receiving that exception, I would sorround the call with a try-catch for that exception.

    If you want to validate the database.properties file, you can build a class wich read the file and try to connect to the database using the configuration data inside the file (maybe with a JDBC connection).

    If it goes allright, it should be a valid file, isn't it?
    Last edited by manuelcr; Mar 1st, 2012 at 04:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •