Author: fanningpj
Date: Sat Jan 8 19:20:00 2022
New Revision: 1896841
URL: http://svn.apache.org/viewvc?rev=1896841&view=rev
Log:
sonar issues
Modified:
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/JarHelper.java
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.java
Modified:
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/JarHelper.java
URL:
http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/JarHelper.java?rev=1896841&r1=1896840&r2=1896841&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/JarHelper.java
(original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/common/JarHelper.java
Sat Jan 8 19:20:00 2022
@@ -82,7 +82,6 @@ public class JarHelper {
* directory.
*/
public void unjar(InputStream in, File destDir) throws IOException {
- BufferedOutputStream dest;
try (JarInputStream jis = new JarInputStream(in)) {
JarEntry entry;
while ((entry = jis.getNextJarEntry()) != null) {
@@ -101,13 +100,16 @@ public class JarHelper {
System.out.println("unjarring " + destFile +
" from " + entry.getName());
}
- FileOutputStream fos = new FileOutputStream(destFile);
- dest = new BufferedOutputStream(fos, BUFFER_SIZE);
- while ((count = jis.read(data, 0, BUFFER_SIZE)) != -1) {
- dest.write(data, 0, count);
+
+ try (
+ FileOutputStream fos = new FileOutputStream(destFile);
+ BufferedOutputStream dest = new
BufferedOutputStream(fos, BUFFER_SIZE)
+ ) {
+ while ((count = jis.read(data, 0, BUFFER_SIZE)) != -1) {
+ dest.write(data, 0, count);
+ }
+ dest.flush();
}
- dest.flush();
- dest.close();
if (entry.getTime() != -1) {
destFile.setLastModified(entry.getTime());
}
Modified:
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.java
URL:
http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.java?rev=1896841&r1=1896840&r2=1896841&view=diff
==============================================================================
---
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.java
(original)
+++
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/xsd2inst/SampleXmlUtil.java
Sat Jan 8 19:20:00 2022
@@ -95,7 +95,7 @@ public class SampleXmlUtil {
return object.xmlText(options);
}
- Random _picker = new Random(1);
+ Random _picker = new Random();
/**
* Cursor position
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]