commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r809861 - in /commons/sandbox/runtime/trunk/src: main/java/org/apache/commons/runtime/io/MemoryMapProvider.java test/org/apache/commons/runtime/TestMemoryMap.java
Date Tue, 01 Sep 2009 07:20:07 GMT
Author: mturk
Date: Tue Sep  1 07:20:06 2009
New Revision: 809861

URL: http://svn.apache.org/viewvc?rev=809861&view=rev
Log:
We'll add virtual memory pagesize

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/MemoryMapProvider.java
    commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/MemoryMapProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/MemoryMapProvider.java?rev=809861&r1=809860&r2=809861&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/MemoryMapProvider.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/MemoryMapProvider.java
Tue Sep  1 07:20:06 2009
@@ -98,7 +98,7 @@
     }
 
     private static native Pointer map0(int md, long offset, long size)
-        throws IOException, IllegalArgumentException;
+        throws IOException, SecurityException, IllegalArgumentException;
     /**
      * Map the region of file.
      * @param offset Offset from the file begin.
@@ -106,7 +106,8 @@
      * @return new {@code Pointer} object
      */
     public Pointer map(long offset, long size)
-        throws IOException, IllegalArgumentException, ClosedDescriptorException
+        throws IOException, SecurityException, IllegalArgumentException,
+               ClosedDescriptorException
     {
         /* TODO: Check all provided arguments
          */

Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java?rev=809861&r1=809860&r2=809861&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestMemoryMap.java Tue
Sep  1 07:20:06 2009
@@ -89,6 +89,24 @@
                 System.out.println("Map requires Platform.PAGESIZE (" +
                                    Platform.PAGESIZE + ") bytes offset alignment");
             } catch (IOException e) {
+                // Ignore
+            } catch (SecurityException x) {
+                // File is too small
+                // We should test with some larger file.
+                pa = map.map(0, 128);
+            }
+        }
+        if (pa == null) {
+            try {
+                // Windows requires 64k alignment
+                pa = map.map(65536, 128);
+                System.out.println("Map requires 64k offset alignment");
+            } catch (IOException e) {
+                // Ignore
+            } catch (SecurityException x) {
+                // File is too small
+                // We should test with some larger file.
+                pa = map.map(0, 128);
             }
         }
         assertFalse("Unknown offset alignment", pa == null);



Mime
View raw message