[seam-commits] Seam SVN: r9833 - trunk/src/pdf/org/jboss/seam/pdf/ui.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Tue Dec 23 14:46:35 EST 2008
Author: norman.richards at jboss.com
Date: 2008-12-23 14:46:35 -0500 (Tue, 23 Dec 2008)
New Revision: 9833
Modified:
trunk/src/pdf/org/jboss/seam/pdf/ui/UIField.java
trunk/src/pdf/org/jboss/seam/pdf/ui/UIForm.java
Log:
JBSEAM-3808
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIField.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIField.java 2008-12-23 15:45:36 UTC (rev 9832)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIField.java 2008-12-23 19:46:35 UTC (rev 9833)
@@ -42,7 +42,12 @@
if (theValue instanceof String) {
success = fields.setField(theName, (String) theValue);
} else if (theValue instanceof String[]){
- success = fields.setField(theName, ((String[])theValue)[0]);
+ String[] stringValue = (String[])theValue;
+ if (stringValue.length>0) {
+ success = fields.setField(theName, stringValue[0]);
+ } else {
+ success = true;
+ }
} else {
String message = Interpolator.instance().interpolate("Field #0 expected String or String[] but got #0", getName(), theValue.getClass().getName());
throw new IllegalArgumentException(message);
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIForm.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIForm.java 2008-12-23 15:45:36 UTC (rev 9832)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIForm.java 2008-12-23 19:46:35 UTC (rev 9833)
@@ -17,6 +17,7 @@
import org.jboss.seam.log.Log;
import org.jboss.seam.log.Logging;
import org.jboss.seam.navigation.Pages;
+import org.jboss.seam.core.ResourceLoader;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.AcroFields;
@@ -47,13 +48,12 @@
@Override
public void encodeBegin(FacesContext facesContext) throws IOException {
+ log.info("Loading template #0", getURL());
if (getURL().indexOf("://") < 0) {
- reader = new PdfReader(getClass().getClassLoader()
- .getResourceAsStream(getURL()));
+ reader = new PdfReader(ResourceLoader.instance().getResourceAsStream(getURL()));
} else {
reader = new PdfReader(new URL(getURL()));
}
- log.debug("Loading template #0", getURL());
buffer = new ByteArrayOutputStream();
try {
stamper = new PdfStamper(reader, buffer);
More information about the seam-commits
mailing list