Author: konstantin.mishin
Date: 2007-11-30 14:16:10 -0500 (Fri, 30 Nov 2007)
New Revision: 4397
Modified:
   trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
   trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
Log:
RF-1214
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java	2007-11-30
19:14:53 UTC (rev 4396)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/java/org/richfaces/Bean.java	2007-11-30
19:16:10 UTC (rev 4397)
@@ -45,16 +45,18 @@
 	public void printFile() {
 		int i = -1;
 		InputStream stream = fileUpload.getLocalInputStream();
-		do {
-			try {
-				i = stream.read();
-			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			System.out.print((char)i);
-		} while (i!=-1);
-		System.out.println();
+		if (stream != null) {
+			do {
+				try {
+					i = stream.read();
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+				System.out.print((char) i);
+			} while (i != -1);
+			System.out.println();
+		}
 
 	}
 }
\ No newline at end of file
Modified: trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp	2007-11-30
19:14:53 UTC (rev 4396)
+++ trunk/sandbox/samples/fileUploadDemo/src/main/webapp/pages/index.jsp	2007-11-30
19:16:10 UTC (rev 4397)
@@ -8,7 +8,7 @@
 	<body>
 		<f:view>
 			<h:form enctype="multipart/form-data" >
-				<fu:fileUpload binding="#{bean.fileUpload}"></fu:fileUpload>
+				<fu:fileUpload binding="#{bean.fileUpload}"
onclick="window.status=this.value"/>
 				<h:commandButton type="submit"
action="#{bean.printFile}"></h:commandButton>
 			</h:form>
 		</f:view>