diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-05-21 17:53:00 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-05-21 17:53:00 -0400 |
| commit | 3c435325eecc038c43526288454f9fe4ac161648 (patch) | |
| tree | df7463060559c268461d5c740d5796aa5b84acb9 | |
| parent | 3403adc8ac690439605072f9c4dc30995abac99f (diff) | |
Tweak
Clean a few things up
| -rw-r--r-- | projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponent.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponent.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponent.java index c99768c..327e024 100644 --- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponent.java +++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOComponent.java @@ -160,9 +160,10 @@ public class WOComponent extends WOElement implements WOActionResults, net.woton if (context != null) { languages = context.request().browserLanguages(); } - WOElement result = templateWithHTMLString( - readTemplateResource(aComponentName, aFramework, TEMPLATE_SUFFIX, languages), - readTemplateResource(aComponentName, aFramework, DECLARATION_SUFFIX, languages), languages); + String htmlString = readTemplateResource(aComponentName, aFramework, TEMPLATE_SUFFIX, languages); + String declarationString = readTemplateResource(aComponentName, aFramework, DECLARATION_SUFFIX, languages); + + WOElement result = templateWithHTMLString(htmlString, declarationString, languages); if (result == null) { System.out.println("WOComponent.templateWithName: failed for " + aComponentName); } @@ -170,7 +171,7 @@ public class WOComponent extends WOElement implements WOActionResults, net.woton } /** - * Returns the root of the tree of elements produced by parsing the specfified + * Returns the root of the tree of elements produced by parsing the specified * HTML string and bindings declaration string. Note: language list is currently * ignored. */ @@ -770,6 +771,7 @@ public class WOComponent extends WOElement implements WOActionResults, net.woton if (name == null) return null; name = name + DIRECTORY_SUFFIX + '/' + name + suffix; + InputStream is = null; if (isCachingEnabled()) { byte[] data = WOApplication.application().resourceManager().bytesForResourceNamed(name, framework, @@ -829,7 +831,10 @@ public class WOComponent extends WOElement implements WOActionResults, net.woton buf.append('\n'); } is.close(); // release the resource - return buf.toString(); + + String resourceBody = buf.toString(); + + return resourceBody; } catch (IOException exc) { System.err.println("Error while reading: " + name); exc.printStackTrace(); |
