Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

FRM-92480 Set_custom_property causes java.lang.ClassCastException

juliojgsOct 1 2014 — edited Oct 8 2014

This is forms 11g

I'm getting an FRM when using a Bean

FRM-92480 Set_custom_property causes java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String.

The problem is that I'm calling set_custom_property with the overload value number instead of the varchar one.

The property I'm trying to set was added by me, and I'm not very fluent in java, so I more or less did a little copy/paste. I copied it from a string property set.

This is my code in forms:

set_custom_property (l_print_item, 1, 'SET_NUM_COPIAS', p_num_copias);

being "p_num_copias" a pls_integer

And the other side in java:

    //*******************************

    //* SET FORMS PROPERTIES

    //*******************************

  /**

   * Uses to set properties of the ID object.

   * @return The status of the set property

   * @param _args Value passed in from the forms bean call.

   * @param _ID The ID of the parameter that was called.

   */

    public boolean setProperty(ID _ID, Object _args) {

        /*=========================

         * SET_NUM_COPIAS

         * ========================*/

        if (_ID == pSetNumCopias) {

        int lNumCopias = 1;

          if ((_args != null) && (((String) _args).length() != 0))

          {

          try

          {

          lNumCopias = Integer.parseInt((String) _args);

          }

          catch (Exception ex)

          {

          write_message("SET_NUM_COPIAS: "  + (String) _args + " No es un entero.");

          }

        }

        write_message("SET_NUM_COPIAS: " + lNumCopias);

        this.setNumCopias (lNumCopias);

        return true;

        }

As you see, java is not my area of expertise.

I can workaround the error calling SET_CUSTOM_PROPERTY with a to_char, but it's an ugly solution, I'd like to know if there is better practice to pass integer properties to a bean.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 5 2014
Added on Oct 1 2014
2 comments
1,541 views