ResourceBundle exception bug

Hi;

First off, thanks for the help. I am now up and running. And I posted how to do this at http://thielen.typepad.com/programming/2005/11/using_java_reso.html

Second, if a bad name is passed in, for example:
resources = ResourceBundle.getBundle("not_my_resources");

Then you get the exception:
+  [System.ArgumentOutOfRangeException] {"Length cannot be less than zero.\r\nParameter name: length"} System.ArgumentOutOfRangeException

This is a bug I think. You should get the exception MissingResourceException

thanks - dave



Answer this question

ResourceBundle exception bug

  • Rich M Turner

    Hi;

    I understand that. But I think it's a misleading exception that is thrown.

    thanks - dave

  • BruceWang.Korea

    Hi,

    If you execute both vjsresgen and resgen commands and pass a bad name to
    ResourceBundle.getBundle then you would get the following exception:

    java.util.MissingResourceException: Resource Bundle not Found
       at java.util.ResourceBundle.getBundle(String baseName)

    You would get the following exception when you havent executed resgen command or added the .resx file to your project using Visual Studio IDE:
      [System.ArgumentOutOfRangeException] {"Length cannot be less than  zero.\r\nParameter name: length"} System.ArgumentOutOfRangeException

    It is necessary to execute resgen command if you are working from the command prompt.
    If you are using Visual Studio then you can add the .resx file to your project.

    Correct order of commands to execute:
    vjsresgen /out:myResource.resx" <input files>
    resgen myResource.resx 
    vjc /res:<myResource.resources> <source file>

    Regards,
    Ritesh.


  • ResourceBundle exception bug