moved back to java6. webid-java6
authorHenry Story <henry.story@bblfish.net>
Fri, 11 May 2012 17:27:57 +0200
branchwebid-java6
changeset 203 0e6fc253828c
parent 202 d12da8212f7c
child 204 3ed197d09cba
moved back to java6.
src/main/scala/Filesystem.scala
src/main/scala/auth/X509Cert.scala
src/main/scala/netty/server.scala
--- a/src/main/scala/Filesystem.scala	Tue Apr 17 08:31:53 2012 +0200
+++ b/src/main/scala/Filesystem.scala	Fri May 11 17:27:57 2012 +0200
@@ -10,7 +10,7 @@
 import Scalaz._
 
 import scala.sys
-import java.nio.file.{StandardOpenOption, Files}
+
 import com.hp.hpl.jena.vocabulary.RDF
 import org.w3.readwriteweb.Image
 
@@ -140,9 +140,10 @@
       }
 
     def delete: Validation[Throwable, Unit] = try {
-      Files.delete(fileOnDisk.toPath).success
+      if (fileOnDisk.delete()) ().success
+      else new Exception("Failed to delete file "+fileOnDisk).fail
     } catch {
-      case e: IOException => e.fail
+      case e: SecurityException => e.fail
     }
 
     def create(contentType: Representation): Validation[Throwable, Resource] = {
@@ -157,8 +158,8 @@
           case ImageRepr(tpe) => tpe.suffix
           case l => lang.suffix
         }
-        val path = Files.createTempFile(fileOnDisk.toPath, "res", suffix)
-        resource(new URL(name(), path.getFileName.toString)).success
+        val path = File.createTempFile("res", suffix, fileOnDisk)
+        resource(new URL(name(), path.getName)).success
       } catch {
         case ioe: IOException => ioe.fail
       }
--- a/src/main/scala/auth/X509Cert.scala	Tue Apr 17 08:31:53 2012 +0200
+++ b/src/main/scala/auth/X509Cert.scala	Fri May 11 17:27:57 2012 +0200
@@ -138,7 +138,7 @@
       List(SSL_CLIENT, S_MIME) foreach { ext => netscapeExt.set(ext, true) }
       extensions.set(
         netscapeExt.getName,
-        new NetscapeCertTypeExtension(false, netscapeExt.getValue))
+        new NetscapeCertTypeExtension(false, netscapeExt.getExtensionValue().clone))
     }
       
     val subjectKeyExt =
--- a/src/main/scala/netty/server.scala	Tue Apr 17 08:31:53 2012 +0200
+++ b/src/main/scala/netty/server.scala	Fri May 11 17:27:57 2012 +0200
@@ -28,8 +28,7 @@
 import java.lang.String
 import org.jboss.netty.channel.{ChannelPipelineFactory, ChannelHandler}
 import java.security.cert.X509Certificate
-import javax.net.ssl.{SSLEngine, X509ExtendedTrustManager}
-import java.net.Socket
+import javax.net.ssl.X509TrustManager
 
 trait NormalPlan extends cycle.Plan with cycle.ThreadPool with ServerErrorResponse
 
@@ -50,21 +49,12 @@
 
   val nullArray = Array[X509Certificate]()
 
-  val trustManagers = Array[TrustManager](new X509ExtendedTrustManager {
-
-    def checkClientTrusted(chain: Array[X509Certificate], authType: String, socket: Socket) {}
-
-    def checkClientTrusted(chain: Array[X509Certificate], authType: String, engine: SSLEngine) {}
+  val trustManagers = Array[TrustManager](new X509TrustManager {
+    def getAcceptedIssuers = nullArray
 
-    def checkClientTrusted(x509Certificates: Array[X509Certificate], s: String) {}
-
-    def checkServerTrusted(chain: Array[X509Certificate], authType: String, socket: Socket) {}
+    def checkClientTrusted(p1: Array[X509Certificate], p2: String) {}
 
-    def checkServerTrusted(chain: Array[X509Certificate], authType: String, engine: SSLEngine) {}
-
-    def checkServerTrusted(x509Certificates: Array[X509Certificate], s: String) {}
-
-    def getAcceptedIssuers() = nullArray
+    def checkServerTrusted(p1: Array[X509Certificate], p2: String) {}
   })