Torque
  1. Torque
  2. TORQUE-148

remove throws clause in setter for referenced object by a foreign key

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-beta1
    • Component/s: None
    • Labels:
      None

      Description

      for the schema
      <table name="book" description="Book table">
      ....
      <foreign-key foreignTable="author">
      <reference local="author_id" foreign="author_id"/>
      </foreign-key>
      </table>

      Torque generates (complexObjectModel=true) in BaseBook:

      public void setAuthor(Author v) throws TorqueException
      {
      if (v == null)

      { setAuthorId(0); }

      else

      { setAuthorId(v.getAuthorId()); }

      aAuthor = v;
      }

      the TorqueException in the throws clause of the method is never thrown and should be removed.

        Activity

        Thomas Fox created issue -
        Thomas Fox made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 4.0 [ 12312102 ]
        Resolution Fixed [ 1 ]
        Hide
        CG Monroe added a comment -

        As has been said in the dev list, exception handling is a beast. I think a good solution would be to replace this with TorqueRuntimeException.

        The reason being is that this make re-writing code that currently has to handle TorqueExceptions easier. Just change the exception type. Plus it simplifies future code by removing the exception handing requirement because Runtime Exceptions don't get flagged by compiler.

        Show
        CG Monroe added a comment - As has been said in the dev list, exception handling is a beast. I think a good solution would be to replace this with TorqueRuntimeException. The reason being is that this make re-writing code that currently has to handle TorqueExceptions easier. Just change the exception type. Plus it simplifies future code by removing the exception handing requirement because Runtime Exceptions don't get flagged by compiler.
        Hide
        Thomas Fox added a comment -

        In this special case no runtime Exception is needed. It will never be thrown.

        If we want to change the Torque exception handling in a global manner we should first discuss on the dev list and then open another jira issue. Personally I like checked exceptions as long as the exception hierarchy makes sense. But IMO this is a matter of taste.

        Show
        Thomas Fox added a comment - In this special case no runtime Exception is needed. It will never be thrown. If we want to change the Torque exception handling in a global manner we should first discuss on the dev list and then open another jira issue. Personally I like checked exceptions as long as the exception hierarchy makes sense. But IMO this is a matter of taste.
        Thomas Fox made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        14m 48s 1 Thomas Fox 01/Oct/10 21:34
        Resolved Resolved Closed Closed
        723d 10h 32m 1 Thomas Fox 24/Sep/12 08:06

          People

          • Assignee:
            Thomas Fox
            Reporter:
            Thomas Fox
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development