You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2019/06/12 22:56:39 UTC
svn commit: r1861203 -
/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
Author: rwhitcomb
Date: Wed Jun 12 22:56:39 2019
New Revision: 1861203
URL: http://svn.apache.org/viewvc?rev=1861203&view=rev
Log:
PIVOT-1044: Fix BXMLExplorerDocument to use the new Files methods to
avoid instantiating a FileInputStream.
Modified:
pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java?rev=1861203&r1=1861202&r2=1861203&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java Wed Jun 12 22:56:39 2019
@@ -18,9 +18,10 @@ package org.apache.pivot.tutorials.bxmle
import java.awt.Color;
import java.io.File;
-import java.io.FileInputStream;
+import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
+import java.nio.file.Files;
import java.util.HashMap;
import javax.xml.parsers.ParserConfigurationException;
@@ -205,7 +206,7 @@ public class BXMLExplorerDocument extend
ParserConfigurationException, SAXException {
BXMLSerializer serializer = new BXMLSerializer();
serializer.setLocation(f.toURI().toURL());
- try (FileInputStream in = new FileInputStream(f)) {
+ try (InputStream in = Files.newInputStream(f.toPath())) {
Object obj = serializer.readObject(in);
if (!(obj instanceof Component)) {
throw new IllegalStateException("obj " + obj + " is of class " + obj.getClass()
@@ -231,7 +232,7 @@ public class BXMLExplorerDocument extend
this.loadedComponent = (Component) obj;
playgroundCardPane.add((Component) obj);
}
- try (FileInputStream in2 = new FileInputStream(f)) {
+ try (InputStream in2 = Files.newInputStream(f.toPath())) {
CreateHighlightedXML xml = new CreateHighlightedXML();
bxmlSourceTextPane.setDocument(xml.prettyPrint(in2));
}