Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3386

CyclicMetadataException gives misleading stack trace

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

      Description

      Calcite currently reuses the same instance when throwing CyclicMetadataException as shown below. 

      /** Singleton instance. Since this exception is thrown for signaling purposes, * rather than on an actual error, re-using a singleton instance saves the * effort of constructing an exception instance. */ 
      @SuppressWarnings("ThrowableInstanceNeverThrown") 
      public static final CyclicMetadataException INSTANCE = new CyclicMetadataException();
      

       

      Reusing the same exception instance gives the wrong stack trace, see: https://stackoverflow.com/questions/15090664/is-it-safe-to-store-an-instance-of-an-exception-and-reuse-it

      The misleading stack trace causes many confusions when debugging. The potential performance impact because of object construction is minor compared to the time spent on debugging. Therefore it should be changed to not reuse the singleton instance.

      A pull request have been opened to fix this issue: https://github.com/apache/calcite/pull/1484

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              zuozhiw Zuozhi Wang

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1.5h
                1.5h

                  Issue deployment