You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2015/07/09 15:28:23 UTC
svn commit: r1690100 -
/pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
Author: smartini
Date: Thu Jul 9 13:28:23 2015
New Revision: 1690100
URL: http://svn.apache.org/r1690100
Log:
PIVOT-949, first part of the fix (add a fallback in case something goes wrong in the specific case of this issue)
Modified:
pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
Modified: pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java?rev=1690100&r1=1690099&r2=1690100&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java Thu Jul 9 13:28:23 2015
@@ -599,13 +599,9 @@ public class BXMLSerializer implements S
this.location = locationArgument;
this.resources = resourcesArgument;
- InputStream inputStream = new BufferedInputStream(locationArgument.openStream());
-
Object object;
- try {
+ try (InputStream inputStream = new BufferedInputStream(locationArgument.openStream())) {
object = readObject(inputStream);
- } finally {
- inputStream.close();
}
this.location = null;
@@ -873,11 +869,8 @@ public class BXMLSerializer implements S
}
// Read the object
- InputStream inputStream = new BufferedInputStream(locationLocal.openStream());
- try {
+ try (InputStream inputStream = new BufferedInputStream(locationLocal.openStream())) {
element.value = serializer.readObject(inputStream);
- } finally {
- inputStream.close();
}
} else if (element.type == Element.Type.REFERENCE) {
// Dereference the value
@@ -1303,8 +1296,8 @@ public class BXMLSerializer implements S
case SCRIPT: {
String src = null;
- if (element.properties.containsKey(INCLUDE_SRC_ATTRIBUTE)) {
- src = element.properties.get(INCLUDE_SRC_ATTRIBUTE);
+ if (element.properties.containsKey(SCRIPT_SRC_ATTRIBUTE)) {
+ src = element.properties.get(SCRIPT_SRC_ATTRIBUTE);
}
if (src != null) {
@@ -1329,6 +1322,9 @@ public class BXMLSerializer implements S
URL scriptLocation;
if (src.charAt(0) == SLASH_PREFIX) {
scriptLocation = classLoader.getResource(src.substring(1));
+ if (scriptLocation == null) { // add a fallback
+ scriptLocation = new URL(location, src.substring(1));
+ }
} else {
scriptLocation = new URL(location, src);
}