Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
1989f919
Commit
1989f919
authored
Oct 30, 2015
by
Christian Schudt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error, which was introduced with
e0bc007f
.
parent
5e2f097a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
XMLProperties.java
src/java/org/jivesoftware/util/XMLProperties.java
+22
-6
No files found.
src/java/org/jivesoftware/util/XMLProperties.java
View file @
1989f919
...
...
@@ -742,24 +742,40 @@ public class XMLProperties {
Log
.
error
(
"Unable to save XML properties; no file specified"
);
return
;
}
boolean
error
=
false
;
// Write data out to a temporary file first.
File
tempFile
=
new
File
(
file
.
getParentFile
(),
file
.
getName
()
+
".tmp"
);
File
tempFile
=
new
File
(
file
.
getParentFile
(),
file
.
getName
()
+
".tmp"
);
;
try
(
Writer
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
new
FileOutputStream
(
tempFile
),
"UTF-8"
)))
{
OutputFormat
prettyPrinter
=
OutputFormat
.
createPrettyPrint
();
XMLWriter
xmlWriter
=
new
XMLWriter
(
writer
,
prettyPrinter
);
xmlWriter
.
write
(
document
);
}
catch
(
Exception
e
)
{
Log
.
error
(
e
.
getMessage
(),
e
);
// There were errors so abort replacing the old property file.
error
=
true
;
}
// No errors occurred, so delete the main file.
if
(!
error
)
{
// Delete the old file so we can replace it.
if
(!
file
.
delete
())
{
Log
.
error
(
"Error deleting property file: "
+
file
.
getAbsolutePath
());
return
;
}
// Copy new contents to the file.
try
{
copy
(
tempFile
,
file
);
}
catch
(
Exception
e
)
{
Log
.
error
(
e
.
getMessage
(),
e
);
// There were errors so abort replacing the old property file.
error
=
true
;
}
// If no errors, delete the temp file.
if
(!
error
)
{
tempFile
.
delete
();
}
catch
(
Exception
e
)
{
Log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment