Skip to content

Commit fd6f30c

Browse files
committed
TIKA-4397: use isBlank()
1 parent 3001701 commit fd6f30c

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

tika-core/src/main/java/org/apache/tika/pipes/fetcher/FetcherManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static FetcherManager load(Path p) throws IOException, TikaConfigExceptio
4848
public FetcherManager(List<Fetcher> fetchers) throws TikaConfigException {
4949
for (Fetcher fetcher : fetchers) {
5050
String name = fetcher.getName();
51-
if (name == null || name.trim().isEmpty()) {
51+
if (name == null || name.isBlank()) {
5252
throw new TikaConfigException("fetcher name must not be blank");
5353
}
5454
if (fetcherMap.containsKey(fetcher.getName())) {

tika-core/src/main/java/org/apache/tika/pipes/fetcher/fs/FileSystemFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public void initialize(Map<String, Param> params) throws TikaConfigException {
155155
@Override
156156
public void checkInitialization(InitializableProblemHandler problemHandler)
157157
throws TikaConfigException {
158-
if (basePath == null || basePath.toString().trim().isEmpty()) {
158+
if (basePath == null || basePath.toString().isBlank()) {
159159
LOG.warn("'basePath' has not been set. " +
160160
"This means that client code or clients can read from any file that this " +
161161
"process has permissions to read. If you are running tika-server, make " +

tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/envi/EnviHeaderParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ private String[] convertMapInfoValuesToLatLngAndSetMetadata(String[] mapInfoValu
157157
double pixelEasting = Double.parseDouble(mapInfoValues[3].trim());
158158
double pixelNorthing = Double.parseDouble(mapInfoValues[4].trim());
159159
int zone = 0;
160-
if (!mapInfoValues[7].trim().isEmpty()) {
160+
if (!mapInfoValues[7].isBlank()) {
161161
zone = Integer.parseInt(mapInfoValues[7].trim());
162162
}
163163

tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-html-module/src/main/java/org/apache/tika/parser/html/HtmlHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ private void handleDataURIScheme(String string) throws SAXException {
378378
private void writeScript() throws SAXException {
379379
//don't write an attached macro if there is no content
380380
//we may want to revisit this behavior
381-
if (script.toString().trim().isEmpty()) {
381+
if (script.toString().isBlank()) {
382382
return;
383383
}
384384
//do anything with attrs?

tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/ooxml/xps/XPSPageContentHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ private static List<GlyphRun> splitRow(List<GlyphRun> row) {
415415
private static void sortRow(List<GlyphRun> row) {
416416
boolean allRTL = true;
417417
for (GlyphRun run : row) {
418-
if (run.unicodeString.trim().isEmpty()) {
418+
if (run.unicodeString.isBlank()) {
419419
// ignore whitespace for all RTL check
420420
continue;
421421
}

tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/pdf/XFAExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void extract(InputStream xfaIs, XHTMLContentHandler xhtml, Metadata m, ParseCont
121121
String fieldName = e.getKey();
122122
XFAField field = e.getValue();
123123
String displayFieldName =
124-
(field.toolTip == null || field.toolTip.trim().isEmpty()) ? fieldName :
124+
(field.toolTip == null || field.toolTip.isBlank()) ? fieldName :
125125
field.toolTip;
126126
String[] fieldValues = pdfObjRToValues.getValues(fieldName);
127127
if (fieldValues.length == 0) {

0 commit comments

Comments
 (0)