- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.4k
 
fix: make analytic expression visitor null-safe #1944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: make analytic expression visitor null-safe #1944
Conversation
9dd206c    to
    caf17a2      
    Compare
  
    | 
           Can we please conclude on this? I don't like stale PRs.  | 
    
| 
           Sorry @manticore-projects - what is this PR missing?  | 
    
          
 As explained before: _Apologies for being difficult: Without the original expression, I have actually no idea what those code lines want or achieve (simply because I never understood or liked the streaming/functional API). Since I can't stop you from using it (its valid after all), please keep at least the original code lines as comments so we have a clue what this is supposed to mean and to check. Question: the Null test is done rather beautifully in Groovy and much easier to read.  | 
    
| 
           Ah, I don't see that earlier comment for some reason. 
 I mean, you definitely can. It's not in keeping with the style in the rest of the project so I'm more than happy to change it to a more conventional null check, and add some commentary.  | 
    
| 
           Stopping you is not in my interest and your code is correct and good. Thanks a lot!  | 
    
ba41730    to
    8e46e7a      
    Compare
  
    | 
           Run './gradlew :spotlessApply' to fix these violations.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
        
          
                src/main/java/net/sf/jsqlparser/expression/ExpressionVisitorAdapter.java
          
            Show resolved
            Hide resolved
        
      8e46e7a    to
    f23f59c      
    Compare
  
    | 
           (fixed spotless, sorry about that)  | 
    
| 
           Thank you for your contribution and effort!  | 
    
This PR adds some null safety via
Optionals to theExpressionVisitorAdapterwhen handling certain analytic expressions.The added test expression previously parsed fine but resulted in a
NullPointerExceptionwhen visited.