Skip to content

Commit a107318

Browse files
committed
[refactor] avoid unneeded conversions to String
1 parent 26e39d2 commit a107318

File tree

110 files changed

+183
-183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+183
-183
lines changed

exist-ant/src/main/java/org/exist/ant/ListGroupsTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void execute() throws BuildException
6666
}
6767

6868
if( buffer.length() > 0 ) {
69-
log( "Setting output property " + outputproperty + " to " + buffer.toString(), Project.MSG_DEBUG );
69+
log( "Setting output property " + outputproperty + " to " + buffer, Project.MSG_DEBUG );
7070
getProject().setNewProperty( outputproperty, buffer.toString() );
7171
}
7272
}

exist-ant/src/main/java/org/exist/ant/ListUsersTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void execute() throws BuildException
6767
}
6868

6969
if( buffer.length() > 0 ) {
70-
log( "Setting output property " + outputproperty + " to " + buffer.toString(), Project.MSG_DEBUG );
70+
log( "Setting output property " + outputproperty + " to " + buffer, Project.MSG_DEBUG );
7171
getProject().setNewProperty( outputproperty, buffer.toString() );
7272
}
7373
}

exist-ant/src/main/java/org/exist/ant/XMLDBExtractTask.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void execute() throws BuildException {
7878
if ((resource != null) && (destDir == null)) {
7979

8080
// extraction of a single resource
81-
log("Extracting resource: " + resource + " to " + destFile.toAbsolutePath().toString(), Project.MSG_INFO);
81+
log("Extracting resource: " + resource + " to " + destFile.toAbsolutePath(), Project.MSG_INFO);
8282
final Resource res = base.getResource(resource);
8383

8484
if (res == null) {
@@ -138,7 +138,7 @@ private void extractResources(final Collection base, final String path) throws X
138138
if (!resources.isEmpty()) {
139139
Path dir = destDir;
140140

141-
log("Extracting to directory " + destDir.toAbsolutePath().toString(), Project.MSG_DEBUG);
141+
log("Extracting to directory " + destDir.toAbsolutePath(), Project.MSG_DEBUG);
142142

143143
if (path != null) {
144144
dir = destDir.resolve(path);
@@ -241,7 +241,7 @@ private void writeXMLResource(final XMLResource res, final Path dest) throws IOE
241241
final SAXSerializer serializer = (SAXSerializer) SerializerPool.getInstance().borrowObject(SAXSerializer.class);
242242

243243
try (final Writer writer = getWriter(res, dest)) {
244-
log("Writing resource " + res.getId() + " to destination " + dest.toAbsolutePath().toString(), Project.MSG_DEBUG);
244+
log("Writing resource " + res.getId() + " to destination " + dest.toAbsolutePath(), Project.MSG_DEBUG);
245245
serializer.setOutput(writer, outputProperties);
246246
res.getContentAsSAX(serializer);
247247
} finally {

exist-core/src/main/java/org/exist/BTreeTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void create(int count) throws DBException, IOException {
6565

6666
String prefixStr = "KEY";
6767
for (int i = 1; i <= count; i++) {
68-
Value value = new Value(prefixStr + Integer.toString(i));
68+
Value value = new Value(prefixStr + i);
6969
btree.addValue(value, i);
7070
}
7171
btree.flush();
@@ -107,7 +107,7 @@ public void read(int count) throws DBException, IOException, TerminatedException
107107

108108
String prefixStr = "KEY";
109109
for (int i = 1; i <= count; i++) {
110-
Value value = new Value(prefixStr + Integer.toString(i));
110+
Value value = new Value(prefixStr + i);
111111
long r = btree.findValue(value);
112112
if (r == -1) {
113113
System.out.println("Key not found: " + i);

exist-core/src/main/java/org/exist/backup/ExportGUI.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ protected boolean checkOutputDir() {
113113

114114
if (!Files.exists(dir)) {
115115

116-
if (JOptionPane.showConfirmDialog(this, "The output directory " + dir.toAbsolutePath().toString() + " does not exist. Create it?", "Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
116+
if (JOptionPane.showConfirmDialog(this, "The output directory " + dir.toAbsolutePath() + " does not exist. Create it?", "Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
117117
try {
118118
Files.createDirectories(dir);
119119
} catch (final IOException e) {
120-
JOptionPane.showMessageDialog(this, "Could not create output dir: " + dir.toAbsolutePath().toString(), "Configuration Error", JOptionPane.ERROR_MESSAGE);
120+
JOptionPane.showMessageDialog(this, "Could not create output dir: " + dir.toAbsolutePath(), "Configuration Error", JOptionPane.ERROR_MESSAGE);
121121
e.printStackTrace();
122122
System.err.println("ERROR: Failed to create output dir: " + e.getMessage());
123123
}
@@ -136,7 +136,7 @@ protected boolean startDB() {
136136
final Path confFile = Paths.get(dbConfig.getText()).normalize();
137137

138138
if (!(Files.exists(confFile) && Files.isReadable(confFile))) {
139-
JOptionPane.showMessageDialog(this, "The selected database configuration file " + confFile.toAbsolutePath().toString() + " does not exist or is not readable.", "Configuration Error", JOptionPane.ERROR_MESSAGE);
139+
JOptionPane.showMessageDialog(this, "The selected database configuration file " + confFile.toAbsolutePath() + " does not exist or is not readable.", "Configuration Error", JOptionPane.ERROR_MESSAGE);
140140
return false;
141141
}
142142

@@ -494,7 +494,7 @@ public void error(final String message, final Throwable exception) {
494494

495495
final long end = System.currentTimeMillis();
496496

497-
displayMessage("Export to " + file.toAbsolutePath().toString() + " completed successfully.");
497+
displayMessage("Export to " + file.toAbsolutePath() + " completed successfully.");
498498
displayMessage("Export took " + (end - start) + "ms.");
499499

500500
} catch (final EXistException e) {

exist-core/src/main/java/org/exist/backup/ExportMain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private static void process(final ParsedArguments arguments) {
196196
if (!Files.exists(exportTarget)) {
197197
Files.createDirectories(exportTarget);
198198
} else if(!Files.isDirectory(exportTarget)) {
199-
System.err.println("Output dir already exists and is a file: " + exportTarget.toAbsolutePath().toString());
199+
System.err.println("Output dir already exists and is a file: " + exportTarget.toAbsolutePath());
200200
System.exit(SystemExitCodes.INVALID_ARGUMENT_EXIT_CODE);
201201
}
202202
final SystemExport sysexport = new SystemExport(broker, transaction, new Callback(verbose), null, direct);

exist-core/src/main/java/org/exist/backup/FileSystemBackupDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class FileSystemBackupDescriptor extends AbstractBackupDescriptor {
5454

5555
public FileSystemBackupDescriptor(final Path root, final Path descriptor) throws FileNotFoundException {
5656
if (!FileUtils.fileName(descriptor).equals(BackupDescriptor.COLLECTION_DESCRIPTOR) || Files.isDirectory(descriptor) || !Files.isReadable(descriptor)) {
57-
throw new FileNotFoundException(descriptor.toAbsolutePath().toString() + " is not a valid collection descriptor");
57+
throw new FileNotFoundException(descriptor.toAbsolutePath() + " is not a valid collection descriptor");
5858
}
5959
this.descriptor = descriptor;
6060
this.root = root;

exist-core/src/main/java/org/exist/backup/Restore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private Deque<BackupDescriptor> getBackupDescriptors(Path contents) throws IOExc
145145
contents = bd.getParentDir().resolve(previous);
146146

147147
if(!Files.isReadable(contents)) {
148-
throw new IOException("Required part of incremental backup not found: " + contents.toAbsolutePath().toString());
148+
throw new IOException("Required part of incremental backup not found: " + contents.toAbsolutePath());
149149
}
150150
}
151151
}

exist-core/src/main/java/org/exist/backup/SystemImport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private Deque<BackupDescriptor> getBackupDescriptors(Path contents) throws IOExc
141141
contents = bd.getParentDir().resolve(previous);
142142

143143
if(!Files.isReadable(contents)) {
144-
throw new IOException("Required part of incremental backup not found: " + contents.toAbsolutePath().toString());
144+
throw new IOException("Required part of incremental backup not found: " + contents.toAbsolutePath());
145145
}
146146
}
147147
}

exist-core/src/main/java/org/exist/backup/ZipArchiveBackupDescriptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ public ZipArchiveBackupDescriptor(final Path fileArchive) throws IOException {
9595
}
9696

9797
if (descriptor == null) {
98-
throw new FileNotFoundException("Archive " + fileArchive.toAbsolutePath().toString() + " is not a valid eXist backup archive");
98+
throw new FileNotFoundException("Archive " + fileArchive.toAbsolutePath() + " is not a valid eXist backup archive");
9999
}
100100

101101
final Path fakeDbRoot = Paths.get("/db");
102102
if (!fakeDbRoot.resolve(Paths.get(base)).normalize().startsWith(fakeDbRoot)) {
103-
throw new IOException("Detected archive exit attack! zipFile=" + fileArchive.toAbsolutePath().normalize().toString());
103+
throw new IOException("Detected archive exit attack! zipFile=" + fileArchive.toAbsolutePath().normalize());
104104
}
105105

106106
// Count number of files

0 commit comments

Comments
 (0)