[exo-jcr-commits] exo-jcr SVN: r993 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Dec 10 11:39:01 EST 2009


Author: tolusha
Date: 2009-12-10 11:39:00 -0500 (Thu, 10 Dec 2009)
New Revision: 993

Modified:
   jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
Log:
EXOJCR-300: fix ClassCastException in ValueFileIOHelper

Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java	2009-12-10 16:29:10 UTC (rev 992)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java	2009-12-10 16:39:00 UTC (rev 993)
@@ -117,9 +117,7 @@
     */
    protected void writeValue(File file, ValueData value) throws IOException
    {
-      StreamPersistedValueData streamValue = (StreamPersistedValueData)value;
-
-      if (streamValue.isByteArray())
+      if (value.isByteArray())
       {
          OutputStream out = new FileOutputStream(file);
          try
@@ -135,7 +133,7 @@
       {
          // transient Value
          File tempFile;
-         if ((tempFile = streamValue.getTempFile()) != null)
+         if ((tempFile = ((StreamPersistedValueData)value).getTempFile()) != null)
          {
             // it's spooled Value, try move its file to VS
             if (!tempFile.renameTo(file))
@@ -154,10 +152,10 @@
          else
          {
             // not spooled, use InputStream
-            copyClose(streamValue.getAsStream(), new FileOutputStream(file));
+            copyClose(value.getAsStream(), new FileOutputStream(file));
          }
          // map this transient Value to file in VS
-         streamValue.setPersistedFile(file);
+         ((StreamPersistedValueData)value).setPersistedFile(file);
       }
    }
 



More information about the exo-jcr-commits mailing list