myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dennisby...@apache.org
Subject svn commit: r413819 - /myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
Date Tue, 13 Jun 2006 07:07:14 GMT
Author: dennisbyrne
Date: Tue Jun 13 00:07:13 2006
New Revision: 413819

URL: http://svn.apache.org/viewvc?rev=413819&view=rev
Log:
improved buffer, removed dead code

Modified:
    myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java

Modified: myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java?rev=413819&r1=413818&r2=413819&view=diff
==============================================================================
--- myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
(original)
+++ myfaces/shared/branches/3_0_0/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
Tue Jun 13 00:07:13 2006
@@ -34,7 +34,6 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPOutputStream;
@@ -82,7 +81,7 @@
  * strength jurisdiction policy files from a place like
  * http://java.sun.com/j2se/1.4.2/download.html .</p>
  *
- * @author Dennis C. Byrne, ich
+ * @author Dennis C. Byrne
  * @see org.apache.myfaces.webapp.StartupServletContextListener
  */
 
@@ -176,7 +175,6 @@
         try
         {
             ObjectOutputStream writer = serialFactory.getObjectOutputStream(outputStream);
-            //new ObjectOutputStream(outputStream);
             writer.writeObject(object);
             byte[] bytes = outputStream.toByteArray();
             writer.close();
@@ -253,9 +251,12 @@
 
     public static final byte[] decompress(byte[] bytes)
     {
+    	if(bytes == null)
+    		throw new NullPointerException("byte[] bytes");
+    	
     	ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
     	ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    	byte[] buffer = new byte[2048];
+    	byte[] buffer = new byte[bytes.length];
         int length;
 
         try
@@ -301,7 +302,6 @@
     	try
         {
             ObjectInputStream s = serialFactory.getObjectInputStream(input); 
-            //new MyFacesObjectInputStream(input);
             Object object = s.readObject();
             s.close();
             input.close();
@@ -313,27 +313,6 @@
         {
             throw new FacesException(e);
         }
-    }
-
-   public static String encode64(Object obj)
-    {
-       try
-       {
-           ByteArrayOutputStream baos = new ByteArrayOutputStream();
-           OutputStream zos = new GZIPOutputStream(baos);
-           ObjectOutputStream oos = new ObjectOutputStream(zos);
-           oos.writeObject(obj);
-           oos.close();
-           zos.close();
-           baos.close();
-           Base64 base64Codec = new Base64();
-           return new String(base64Codec.encode( baos.toByteArray() ), ZIP_CHARSET);
-       }
-       catch (IOException e)
-       {
-           log.fatal("Cannot encode Object with Base64", e);
-           throw new FacesException(e);
-       }
     }
 
     public static void main (String[] args) throws UnsupportedEncodingException



Mime
View raw message