Some updates and code improvements (#1288)

* try with resources

* StringBuilder

* removed ant and updated spring boot
This commit is contained in:
René Zubcevic
2022-07-10 17:13:26 +02:00
committed by GitHub
parent 7dd0dd0923
commit e4eb5d783a
17 changed files with 46 additions and 62 deletions

View File

@ -51,7 +51,7 @@ even if it is hidden it is easy to find the sensitive date. In this
stage you will add a filter to the XPath queries. In this file you will find
following construct:<br><br></p>
<code>
StringBuffer sb = new StringBuffer();<br>
StringBuilder sb = new StringBuilder();<br>
sb.append("/Employees/Employee/UserID | ");<br>
sb.append("/Employees/Employee/FirstName | ");<br>
@ -66,7 +66,7 @@ This string will be used for the XPath query. You have to guarantee that a mange
can see employees which are working for him. To archive this you can use
filters in XPath. Following code will exactly do this:</p>
<code>
StringBuffer sb = new StringBuffer();<br>
StringBuilder sb = new StringBuilder();<br>
sb.append("/Employees/Employee[Managers/Manager/text() = " + userId + "]/UserID | ");<br>
sb.append("/Employees/Employee[Managers/Manager/text() = " + userId + "]/FirstName | ");<br>
@ -81,4 +81,4 @@ Now only information is sent to your client you are authorized for. You can clic
</p>
</body>
</html>
</html>

View File

@ -831,7 +831,7 @@ var JavaHighlightRules = function() {
"Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
"NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
"NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
"Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
"Character|Boolean|StackTraceElement|Appendable|StringBuilder|"+
"Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
"StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
"ArrayStoreException|ClassCastException|LinkageError|"+

View File

@ -311,14 +311,14 @@ define(['module'], function (module) {
typeof Packages !== 'undefined' && typeof java !== 'undefined')) {
//Why Java, why is this so awkward?
text.get = function (url, callback) {
var stringBuffer, line,
var stringBuilder, line,
encoding = "utf-8",
file = new java.io.File(url),
lineSeparator = java.lang.System.getProperty("line.separator"),
input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
content = '';
try {
stringBuffer = new java.lang.StringBuffer();
stringBuilder = new java.lang.StringBuilder();
line = input.readLine();
// Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
@ -334,15 +334,15 @@ define(['module'], function (module) {
}
if (line !== null) {
stringBuffer.append(line);
stringBuilder.append(line);
}
while ((line = input.readLine()) !== null) {
stringBuffer.append(lineSeparator);
stringBuffer.append(line);
stringBuilder.append(lineSeparator);
stringBuilder.append(line);
}
//Make sure we return a JavaScript string and not a Java string.
content = String(stringBuffer.toString()); //String
content = String(stringBuilder.toString()); //String
} finally {
input.close();
}