- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2k
 
Refactor: Add null check, optimize string joining, and add JavaDocs #3663
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
          
     Merged
      
      
            ilayaperumalg
  merged 2 commits into
  spring-projects:main
from
KoreaNirsa:refactor/getTextContent-joining-and-null-check
  
      
      
   
  Jul 2, 2025 
      
    
                
     Merged
            
            Refactor: Add null check, optimize string joining, and add JavaDocs #3663
                    ilayaperumalg
  merged 2 commits into
  spring-projects:main
from
KoreaNirsa:refactor/getTextContent-joining-and-null-check
  
      
      
   
  Jul 2, 2025 
              
            Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    Signed-off-by: nirsa <[email protected]> Signed-off-by: nirsa <[email protected]>
4f0489b    to
    399e419      
    Compare
  
    
              
                    sunyuhan1998
  
              
              approved these changes
              
                  
                    Jun 25, 2025 
                  
              
              
            
            
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.
LGTM!
        
          
                models/spring-ai-openai/src/main/java/org/springframework/ai/openai/api/OpenAiApi.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
      Signed-off-by: nirsa <[email protected]>
              
                    yuluo-yx
  
              
              approved these changes
              
                  
                    Jun 26, 2025 
                  
              
              
            
            
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.
Good job
| 
           @KoreaNirsa Thanks for the cleanup and documentation!  | 
    
    
  spring-builds 
      pushed a commit
      that referenced
      this pull request
    
      Jul 2, 2025 
    
    
      
  
    
      
    
  
…3663) * Refactor: Add null check, optimize string joining, and add JavaDocs Fixes #3663 Signed-off-by: nirsa <[email protected]> (cherry picked from commit 8d45caf)
    
  TheEterna 
      added a commit
        to TheEterna/spring-ai
      that referenced
      this pull request
    
      Jul 2, 2025 
    
    
      
  
    
      
    
  
…vaDocs (spring-projects#3663)" This reverts commit 8d45caf.
    
  scionaltera 
      pushed a commit
        to scionaltera/spring-ai
      that referenced
      this pull request
    
      Sep 3, 2025 
    
    
      
  
    
      
    
  
…pring-projects#3663) * Refactor: Add null check, optimize string joining, and add JavaDocs Auto-cherry-pick to 1.0.x Fixes spring-projects#3663 Signed-off-by: nirsa <[email protected]>
    
  chedim 
      pushed a commit
        to couchbaselabs/spring-ai
      that referenced
      this pull request
    
      Sep 19, 2025 
    
    
      
  
    
      
    
  
…pring-projects#3663) * Refactor: Add null check, optimize string joining, and add JavaDocs Auto-cherry-pick to 1.0.x Fixes spring-projects#3663 Signed-off-by: nirsa <[email protected]>
    
  Willam2004 
      pushed a commit
        to Willam2004/spring-ai
      that referenced
      this pull request
    
      Oct 11, 2025 
    
    
      
  
    
      
    
  
…pring-projects#3663) * Refactor: Add null check, optimize string joining, and add JavaDocs Auto-cherry-pick to 1.0.x Fixes spring-projects#3663 Signed-off-by: nirsa <[email protected]> Signed-off-by: 家娃 <[email protected]>
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Summary
This PR improves the
getTextContentmethod inOpenAiApiwith better performance, input validation, and complete documentation.Changes
Assert.notNull(content, "content cannot be null")to prevent potentialNullPointerException.reduce("", (a, b) -> a + b)with.collect(Collectors.joining())for O(n) string concatenation