32
32
import java .util .Map ;
33
33
34
34
import io .swagger .v3 .oas .models .SpecVersion ;
35
- import org .apache .commons .lang3 .StringUtils ;
35
+ import java .util .stream .Collectors ;
36
+
36
37
import org .slf4j .Logger ;
37
38
import org .slf4j .LoggerFactory ;
38
39
import org .springdoc .core .properties .SpringDocConfigProperties ;
@@ -119,18 +120,17 @@ public String resolve(String parameterProperty, Locale locale) {
119
120
* @return The string with leading indentation removed from each line.
120
121
*/
121
122
public String trimIndent (String text ) {
123
+ if (text == null ) {
124
+ return null ;
125
+ }
126
+ final String newLine = "\n " ;
127
+ String [] lines = text .split ("\\ r?\\ n" );
128
+ int minIndent = resolveMinIndent (lines );
122
129
try {
123
- if (text == null ) {
124
- return null ;
125
- }
126
- final String newLine = "\n " ;
127
- String [] lines = text .split (newLine );
128
- int minIndent = resolveMinIndent (lines );
129
130
return Arrays .stream (lines )
130
- .map (line -> line .substring (Math .min (line .length (), minIndent )))
131
- .reduce ((a , b ) -> a + newLine + b )
132
- .orElse (StringUtils .EMPTY );
133
- } catch (Exception ex ){
131
+ .map (line -> line .substring (Math .min (line .length (), minIndent )))
132
+ .collect (Collectors .joining (newLine ));
133
+ } catch (Exception ex ) {
134
134
LOGGER .warn (ex .getMessage ());
135
135
return text ;
136
136
}
@@ -239,4 +239,4 @@ public Map<String, Object> resolveExtensions(Locale locale, Map<String, Object>
239
239
else
240
240
return extensions ;
241
241
}
242
- }
242
+ }
0 commit comments