harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r590591 [10/12] - in /harmony/enhanced/classlib/branches/java6: depends/build/platform/ depends/files/ depends/jars/icu4j_3.8/ depends/libs/freebsd.x86/ depends/manifests/icu4j_3.4.4/ depends/manifests/icu4j_3.8/ depends/manifests/icu4j_3.8...
Date Wed, 31 Oct 2007 08:42:35 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java Wed Oct 31 01:42:07 2007
@@ -313,57 +313,53 @@
 
     private void parseCpUtf8(InputStream in) throws IOException,
             Pack200Exception {
-        int cpUTF8Count = header.getCpUTF8Count();
-        // TODO Update codec.decode -> decodeScalar
+        int cpUTF8Count = header.getCpUTF8Count();        
         cpUTF8 = new String[cpUTF8Count];
         cpUTF8[0] = ""; //$NON-NLS-1$
-        int[] suffix = new int[cpUTF8Count];
-        long last = 0;
         int[] prefix = decodeBandInt("cpUTF8Prefix", in, Codec.DELTA5, cpUTF8Count-2);
-        int chars = 0;
-        int bigSuffix = 0;
-        for (int i = 1; i < cpUTF8Count; i++) {
-            last = suffix[i] = (int) Codec.UNSIGNED5.decode(in);
-            if (last == 0) {
-                bigSuffix++;
+        int charCount = 0;
+        int bigSuffixCount = 0;
+        int[] suffix = decodeBandInt("cpUTF8Suffix", in, Codec.UNSIGNED5, cpUTF8Count-1);
+
+        for (int i = 0; i < suffix.length; i++) {
+            if (suffix[i] == 0) {
+                bigSuffixCount++;
             } else {
-                chars += last;
+                charCount += suffix[i];
             }
         }
-        char data[] = new char[chars];
+        char[] data = new char[charCount];
+        int[] dataBand = decodeBandInt("cp_Utf8_chars", in, Codec.CHAR3, charCount);
         for (int i = 0; i < data.length; i++) {
-            data[i] = (char) Codec.CHAR3.decode(in);
-        }
-        // read in the big suffix data
-        char bigSuffixData[][] = new char[bigSuffix][];
-        last = 0;
-        for (int i = 0; i < bigSuffix; i++) {
-            last = (int) Codec.DELTA5.decode(in, last);
-            bigSuffixData[i] = new char[(int) last];
-        }
-        // initialize big suffix data
-        for (int i = 0; i < bigSuffix; i++) {
-            char[] singleBigSuffixData = bigSuffixData[i];
-            last = 0;
-            for (int j = 0; j < singleBigSuffixData.length; j++) {
-                last = singleBigSuffixData[j] = (char) Codec.DELTA5.decode(in,
-                        last);
+            data[i] = (char) dataBand[i];
+        } 
+        
+        // Read in the big suffix data
+        int[] bigSuffixCounts = decodeBandInt("cp_Utf8_big_suffix", in, Codec.DELTA5, bigSuffixCount);
+        int[][] bigSuffixDataBand = decodeBandInt("cp_Utf8_big_chars", in, Codec.DELTA5, bigSuffixCounts);
+        
+        // Convert big suffix data to characters
+        char bigSuffixData[][] = new char[bigSuffixCount][];        
+        for (int i = 0; i < bigSuffixDataBand.length; i++) {
+            bigSuffixData[i] = new char[bigSuffixDataBand[i].length];
+            for (int j = 0; j < bigSuffixDataBand[i].length; j++) {
+                bigSuffixData[i][j] = (char) bigSuffixDataBand[i][j];
             }
         }
-        // go through the strings
-        chars = 0;
-        bigSuffix = 0;
+        // Go through the strings
+        charCount = 0;
+        bigSuffixCount = 0;
         for (int i = 1; i < cpUTF8Count; i++) {
             String lastString = cpUTF8[i - 1];
-            if (suffix[i] == 0) {
+            if (suffix[i-1] == 0) {
                 // The big suffix stuff hasn't been tested, and I'll be
                 // surprised if it works first time w/o errors ...
                 cpUTF8[i] = lastString.substring(0, i>1 ? prefix[i-2] : 0)
-                        + new String(bigSuffixData[bigSuffix++]);
+                        + new String(bigSuffixData[bigSuffixCount++]);
             } else {
                 cpUTF8[i] = lastString.substring(0, i>1 ? prefix[i-2]: 0)
-                        + new String(data, chars, suffix[i]);
-                chars += suffix[i];
+                        + new String(data, charCount, suffix[i-1]);
+                charCount += suffix[i-1];
             }
         }
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java Wed Oct 31 01:42:07 2007
@@ -18,6 +18,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Arrays;
 
 public class PopulationCodec extends Codec {
 	private Codec favouredCodec;
@@ -91,15 +92,15 @@
 		// read favorites
 		result = tokenCodec.decode(n, in);
 		// read unfavorites
-		last = 0;
-		for(int i=0;i<n;i++) {
-			int index = (int) result[i];
-			if (index == 0) {
-				result[i] = unvafouredCodec.decode(in, last);
-			} else {
-				result[i] = favoured[index-1];
-			}
-		}
+        last = 0;
+        for(int i = 0; i < n; i++) {
+            int index = (int) result[i];
+            if (index == 0) {
+                result[i] = last = unvafouredCodec.decode(in, last);
+            } else {
+                result[i] = favoured[index-1];
+            }
+        }
 		return result;
-	}	
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/ClassBandsTest.java Wed Oct 31 01:42:07 2007
@@ -62,6 +62,7 @@
     
     public void testSimple() throws IOException, Pack200Exception {
         cpClasses = new String[] { "Class1", "Class2", "Class3", "Interface1", "Interface2" };
+        cpDescriptor = new String[0];
         byte[] classThis = Codec.DELTA5.encode(1, 0);
         byte[] classSuper = Codec.DELTA5.encode(2, 0);
         byte[] classInterfaceCount = Codec.DELTA5.encode(2, 0);

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java Wed Oct 31 01:42:07 2007
@@ -57,6 +57,14 @@
     
     }
     
+    // Test with an archive containing Harmony's SQL module
+    public void testWithSql() throws Exception {
+        assertNotNull(Segment
+                .parse(Segment.class
+                        .getResourceAsStream("/org/apache/harmony/pack200/tests/sql.pack.gz")));
+    
+    }
+    
     // Test with an archive containing Harmony's Pack200 module, packed with -E1
     public void testWithPack200E1() throws Exception {
         assertNotNull(Segment
@@ -64,12 +72,19 @@
                         .getResourceAsStream("/org/apache/harmony/pack200/tests/pack200-e1.pack.gz")));
     
     }
+    
+    // Test with an archive containing Harmony's Pack200 module
+    public void testWithPack200() throws Exception {
+        assertNotNull(Segment
+                .parse(Segment.class
+                        .getResourceAsStream("/org/apache/harmony/pack200/tests/pack200.pack.gz")));
+    
+    }
  
     public void testInterfaceOnly() throws Exception {
         assertNotNull(Segment
                 .parse(Segment.class
                         .getResourceAsStream("/org/apache/harmony/pack200/tests/InterfaceOnly.pack")));
     }
-
 
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentUtilsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentUtilsTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentUtilsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentUtilsTest.java Wed Oct 31 01:42:07 2007
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
 package org.apache.harmony.pack200.tests;
 
 import junit.framework.TestCase;

Added: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/pack200.pack.gz
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/pack200.pack.gz?rev=590591&view=auto
==============================================================================
Binary file - no diff available.

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/pack200.pack.gz
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/sql.pack.gz
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/sql.pack.gz?rev=590591&view=auto
==============================================================================
Binary file - no diff available.

Propchange: harmony/enhanced/classlib/branches/java6/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/sql.pack.gz
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Propchange: harmony/enhanced/classlib/branches/java6/modules/portlib/make/hyproperties.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/freebsd/hyvmem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/freebsd/hyvmem.c?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/freebsd/hyvmem.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/unix/freebsd/hyvmem.c Wed Oct 31 01:42:07 2007
@@ -15,6 +15,443 @@
  *  limitations under the License.
  */
 
-/* Temporary placeholder so FreeBSD port still compiles. FreeBSD requires it's own
-   implementation of these functions, but for now just let it build against the Linux ones. */
-#include "../linux/hyvmem.c"
+#define CDEV_CURRENT_FUNCTION _comment_
+/**
+ * @file
+ * @ingroup Port
+ * @brief Virtual memory
+ */
+
+#undef CDEV_CURRENT_FUNCTION
+
+#include "hyport.h"
+#include "portpriv.h"
+#include "hyportpg.h"
+#include "ut_hyprt.h"
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <sys/shm.h>
+#include <unistd.h>
+
+#if !defined(MAP_FAILED)
+#define MAP_FAILED -1
+#endif
+
+#define VMEM_MEMINFO_SIZE_MAX	1024
+#define VMEM_PROC_MEMINFO_FNAME	"/proc/meminfo"
+
+typedef struct vmem_hugepage_info_t
+{
+  UDATA enabled;                /*!< boolean enabling hy large page support */
+  UDATA pages_total;            /*!< total number of pages maintained by the kernel */
+  UDATA pages_free;             /*!< number of free pages that may be allocated by us */
+  UDATA page_size;              /*!< page size in bytes */
+} vmem_hugepage_info_t;
+
+#define CDEV_CURRENT_FUNCTION _prototypes_private
+void *VMCALL default_pageSize_reserve_memory (struct HyPortLibrary
+                                              *portLibrary, void *address,
+                                              UDATA byteAmount,
+                                              struct HyPortVmemIdentifier
+                                              *identifier, UDATA mode,
+                                              UDATA pageSize);
+static UDATA get_hugepages_info (struct HyPortLibrary *portLibrary,
+                                 vmem_hugepage_info_t * page_info);
+void VMCALL update_vmemIdentifier (HyPortVmemIdentifier * identifier,
+                                   void *address, void *handle,
+                                   UDATA byteAmount, UDATA mode,
+                                   UDATA pageSize);
+int VMCALL get_protectionBits (UDATA mode);
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hyvmem_shutdown
+/**
+ * PortLibrary shutdown.
+ *
+ * This function is called during shutdown of the portLibrary.  Any resources that were created by @ref hyvmem_startup
+ * should be destroyed here.
+ *
+ * @param[in] portLibrary The port library.
+ *
+ * @note Most implementations will be empty.
+ */
+void VMCALL
+hyvmem_shutdown (struct HyPortLibrary *portLibrary)
+{
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hyvmem_startup
+/**
+ * PortLibrary startup.
+ *
+ * This function is called during startup of the portLibrary.  Any resources that are required for
+ * the virtual memory operations may be created here.  All resources created here should be destroyed
+ * in @ref hyvmem_shutdown.
+ *
+ * @param[in] portLibrary The port library.
+ *
+ * @return 0 on success, negative error code on failure.  Error code values returned are
+ * \arg HYPORT_ERROR_STARTUP_VMEM
+ *
+ * @note Most implementations will simply return success.
+ */
+I_32 VMCALL
+hyvmem_startup (struct HyPortLibrary *portLibrary)
+{
+  vmem_hugepage_info_t vmem_page_info;
+
+  /* clear page info data, this has the effect of starting off in a standard state */
+  memset (&vmem_page_info, 0x00, sizeof (vmem_hugepage_info_t));
+  get_hugepages_info (portLibrary, &vmem_page_info);
+
+  /* 0 terminate the table */
+  memset (PPG_vmem_pageSize, 0, HYPORT_VMEM_PAGESIZE_COUNT * sizeof (UDATA));
+
+  /* First the default page size */
+  PPG_vmem_pageSize[0] = (UDATA) getpagesize ();
+
+  /* Now the large pages */
+  if (vmem_page_info.enabled)
+    {
+      PPG_vmem_pageSize[1] = vmem_page_info.page_size;
+    }
+
+  return 0;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hyvmem_commit_memory
+/**
+ * Commit memory in virtual address space.
+ *
+ * @param[in] portLibrary The port library.
+ * @param[in] address The page aligned starting address of the memory to commit.
+ * @param[in] byteAmount The number of bytes to commit.
+ * @param[in] identifier Descriptor for virtual memory block.
+ *
+ * @return pointer to the allocated memory on success, NULL on failure.
+ */
+void *VMCALL
+hyvmem_commit_memory (struct HyPortLibrary *portLibrary, void *address,
+                      UDATA byteAmount,
+                      struct HyPortVmemIdentifier *identifier)
+{
+  Trc_PRT_vmem_hyvmem_commit_memory_Entry (address, byteAmount);
+
+  /* Default page size */
+  if (PPG_vmem_pageSize[0] == identifier->pageSize)
+    {
+      if (0 ==
+          mprotect (address, byteAmount,
+                    get_protectionBits (identifier->mode)))
+        {
+          Trc_PRT_vmem_hyvmem_commit_memory_Exit (address);
+          return address;
+        }
+    }
+  if (PPG_vmem_pageSize[1] == identifier->pageSize)
+    {
+      Trc_PRT_vmem_hyvmem_commit_memory_Exit (address);
+      return address;
+    }
+
+  Trc_PRT_vmem_hyvmem_commit_memory_Exit (NULL);
+  return NULL;
+
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hyvmem_decommit_memory
+/**
+ * Decommit memory in virtual address space.
+ *
+ * Decommits physical storage of the size specified starting at the address specified.
+ *
+ * @param[in] portLibrary The port library.
+ * @param[in] address The starting address of the memory to be decommitted.
+ * @param[in] byteAmount The number of bytes to be decommitted.
+ * @param[in] identifier Descriptor for virtual memory block.
+ *
+ * @return 0 on success, non zero on failure.
+ */
+IDATA VMCALL
+hyvmem_decommit_memory (struct HyPortLibrary * portLibrary, void *address,
+                        UDATA byteAmount,
+                        struct HyPortVmemIdentifier * identifier)
+{
+  Trc_PRT_vmem_hyvmem_decommit_memory_Entry (address, byteAmount);
+  Trc_PRT_vmem_hyvmem_decommit_memory_Exit (0);
+  return (IDATA) 0;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hyvmem_free_memory
+/**
+ * Free memory in virtual address space.
+ *
+ * Frees physical storage of the size specified starting at the address specified.
+ *
+ * @param[in] portLibrary The port library.
+ * @param[in] address The starting address of the memory to be de-allocated.
+ * @param[in] byteAmount The number of bytes to be allocated.
+ * @param[in] identifier Descriptor for virtual memory block.
+ *
+ * @return 0 on success, non zero on failure.
+ */
+I_32 VMCALL
+hyvmem_free_memory (struct HyPortLibrary * portLibrary, void *address,
+                    UDATA byteAmount,
+                    struct HyPortVmemIdentifier * identifier)
+{
+  Trc_PRT_vmem_hyvmem_free_memory_Entry (address, byteAmount);
+
+  /* Default page Size */
+  if (PPG_vmem_pageSize[0] == identifier->pageSize)
+    {
+      I_32 ret = 0;
+
+      update_vmemIdentifier (identifier, NULL, NULL, 0, 0, 0);
+      ret = (I_32) munmap (address, (size_t) byteAmount);
+      Trc_PRT_vmem_hyvmem_free_memory_Exit (ret);
+      return ret;
+    }
+  if (PPG_vmem_pageSize[1] == identifier->pageSize)
+    {
+      shmdt (identifier->address);
+      update_vmemIdentifier (identifier, NULL, NULL, 0, 0, 0);
+      Trc_PRT_vmem_hyvmem_free_memory_Exit (0);
+      return 0;
+    }
+
+  Trc_PRT_vmem_hyvmem_free_memory_Exit (-1);
+  return -1;
+
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hyvmem_reserve_memory
+/**
+ * Reserve memory in virtual address space.
+ *
+ * Reserves a range of  virtual address space without allocating any actual physical storage.
+ * The memory is not available for use until committed @ref hyvmem_commit_memory.
+ * The memory may not be used by other memory allocation routines until it is explicitly released.
+ *
+ * @param[in] portLibrary The port library.
+ * @param[in] address The starting address of the memory to be reserved.
+ * @param[in] byteAmount The number of bytes to be reserved.
+ * @param[in] identifier Descriptor for virtual memory block.
+ * @param[in] mode Bitmap indicating how memory is to be reserved.  Expected values combination of:
+ * \arg HYPORT_VMEM_MEMORY_MODE_READ memory is readable
+ * \arg HYPORT_VMEM_MEMORY_MODE_WRITE memory is writable
+ * \arg HYPORT_VMEM_MEMORY_MODE_EXECUTE memory is executable
+ * \arg HYPORT_VMEM_MEMORY_MODE_COMMIT commits memory as part of the reserve
+ * @param[in] pageSize Size of the page requested, a value returned by @ref hyvmem_supported_page_sizes,
+ * or the constant HYPORT_VMEM_PAGE_SIZE_DEFAULT for the system default page size.
+ *
+ * @return pointer to the reserved memory on success, NULL on failure.
+ *
+ * @internal @warning Do not call error handling code @ref hyerror upon error as 
+ * the error handling code uses per thread buffers to store the last error.  If memory
+ * can not be allocated the result would be an infinite loop.
+ */
+void *VMCALL
+hyvmem_reserve_memory (struct HyPortLibrary *portLibrary, void *address,
+                       UDATA byteAmount,
+                       struct HyPortVmemIdentifier *identifier, UDATA mode,
+                       UDATA pageSize)
+{
+
+  Trc_PRT_vmem_hyvmem_reserve_memory_Entry (address, byteAmount);
+  /* Invalid input */
+  if (0 == pageSize)
+    {
+      update_vmemIdentifier (identifier, NULL, NULL, 0, 0, 0);
+      Trc_PRT_vmem_hyvmem_reserve_memory_Exit1 ();
+      return NULL;
+    }
+
+  /* Handle default page size differently, don't use shmget */
+  if ((HYPORT_VMEM_PAGE_SIZE_DEFAULT == pageSize)
+      || (PPG_vmem_pageSize[0] == pageSize))
+    {
+      void *defptr =
+        default_pageSize_reserve_memory (portLibrary, address, byteAmount,
+                                         identifier, mode,
+                                         PPG_vmem_pageSize[0]);
+      Trc_PRT_vmem_hyvmem_reserve_memory_Exit2 (defptr);
+      return defptr;
+    }
+
+  /* If the pageSize is not one of the large page sizes supported, error */
+  if (PPG_vmem_pageSize[1] != pageSize)
+    {
+      update_vmemIdentifier (identifier, NULL, NULL, 0, 0, 0);
+      Trc_PRT_vmem_hyvmem_reserve_memory_Exit3 (pageSize);
+      return NULL;
+    }
+
+  /* TODO: large page support */
+  update_vmemIdentifier (identifier, NULL, NULL, 0, 0, 0);
+  Trc_PRT_vmem_hyvmem_reserve_memory_Exit3 (pageSize);
+  return NULL;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hyvmem_supported_page_sizes
+/**
+ * Determine the page sizes supported.
+ *
+ * @param[in] portLibrary The port library.
+ *
+ * @return A 0 terminated array of supported page sizes.  The first entry is the default page size, other entries
+ * are the large page sizes supported.
+ */
+UDATA *VMCALL
+hyvmem_supported_page_sizes (struct HyPortLibrary * portLibrary)
+{
+  return PPG_vmem_pageSize;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION get_hugepages_info
+static UDATA
+get_hugepages_info (struct HyPortLibrary *portLibrary,
+                    vmem_hugepage_info_t * page_info)
+{
+  return 1;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION default_pageSize_reserve_memory
+void *VMCALL
+default_pageSize_reserve_memory (struct HyPortLibrary *portLibrary,
+                                 void *address, UDATA byteAmount,
+                                 struct HyPortVmemIdentifier *identifier,
+                                 UDATA mode, UDATA pageSize)
+{
+  /* This function is cloned in HySourceUnixHyVMem (hyvmem_reserve_memory).  
+   * Any changes made here may need to be reflected in that version .
+   */
+  int fd = -1;
+  int flags = MAP_PRIVATE;
+  void *result;
+  int protectionFlags = PROT_NONE;
+
+#if defined(MAP_ANONYMOUS)
+  flags |= MAP_ANONYMOUS;
+#elif defined(MAP_ANON)
+  flags |= MAP_ANON;
+#else
+  fd =
+    portLibrary->file_open (portLibrary, "/dev/zero",
+                            HyOpenRead | HyOpenWrite, 0);
+  if (fd == -1)
+    {
+      update_vmemIdentifier (identifier, NULL, NULL, 0, 0, 0);
+      return NULL;
+    }
+#endif
+
+  if (0 != (HYPORT_VMEM_MEMORY_MODE_COMMIT & mode))
+    {
+      protectionFlags = get_protectionBits (mode);
+    }
+  else
+    {
+      flags |= MAP_NORESERVE;
+    }
+  result = mmap (address, (size_t) byteAmount, protectionFlags, flags, fd, 0);
+
+#if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
+  portLibrary->file_close (portLibrary, fd);
+#endif
+
+  if (MAP_FAILED == result)
+    {
+      update_vmemIdentifier (identifier, NULL, NULL, 0, 0, 0);
+      return NULL;
+    }
+  else
+    {
+      /* Update identifier and commit memory if required, else return reserved memory */
+      update_vmemIdentifier (identifier, result, result, byteAmount, mode,
+                             pageSize);
+      if (0 != (HYPORT_VMEM_MEMORY_MODE_COMMIT & mode))
+        {
+          portLibrary->vmem_commit_memory (portLibrary, result, byteAmount,
+                                           identifier);
+        }
+      return result;
+    }
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION update_vmemIdentifier
+/**
+ * @internal
+ * Update HyPortVmIdentifier structure
+ *
+ * @param[in] identifier The structure to be updated
+ * @param[in] address Base address
+ * @param[in] handle Platform specific handle for reserved memory
+ * @param[in] byteAmount Size of allocated area
+ * @param[in] mode Access Mode
+ * @param[in] pageSize Constant describing pageSize
+ */
+void VMCALL
+update_vmemIdentifier (HyPortVmemIdentifier * identifier, void *address,
+                       void *handle, UDATA byteAmount, UDATA mode,
+                       UDATA pageSize)
+{
+  identifier->address = address;
+  identifier->handle = handle;
+  identifier->size = byteAmount;
+  identifier->pageSize = pageSize;
+  identifier->mode = mode;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION get_protectionBits
+int VMCALL
+get_protectionBits (UDATA mode)
+{
+  int protectionFlags = 0;
+
+  if (0 != (HYPORT_VMEM_MEMORY_MODE_EXECUTE & mode))
+    {
+      protectionFlags |= PROT_EXEC;
+    }
+  if (0 != (HYPORT_VMEM_MEMORY_MODE_READ & mode))
+    {
+      protectionFlags |= PROT_READ;
+    }
+  if (0 != (HYPORT_VMEM_MEMORY_MODE_WRITE & mode))
+    {
+      protectionFlags |= PROT_WRITE;
+    }
+  if (0 == protectionFlags)
+    {
+      protectionFlags = PROT_NONE;
+    }
+
+  return protectionFlags;
+}
+
+#undef CDEV_CURRENT_FUNCTION

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/IsAttributeValueSupportedTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/IsAttributeValueSupportedTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/IsAttributeValueSupportedTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/IsAttributeValueSupportedTest.java Wed Oct 31 01:42:07 2007
@@ -50,57 +50,52 @@
             System.out.println("----------- " + services[i].getName()
                     + "----------");
 
-            try {
-                uri1 = new URI("file:///foo/bar");
-                uri2 = new URI("file:///F:/printing/tmp/print.out");
-                uri3 = new URI("file:///F:/printing/tmp/xxx/print.out");
+            uri1 = new URI("file:///foo/bar");
+            uri2 = new URI("file:///F:/printing/tmp/print.out");
+            uri3 = new URI("file:///F:/printing/tmp/xxx/print.out");
 
-                Attribute[] attrs = { MediaSizeName.ISO_A0,
-                        Finishings.NONE,
-                        Finishings.EDGE_STITCH,
-                        MediaSizeName.ISO_A2,
-                        MediaSizeName.ISO_A3,
-                        new Destination(uri1),
-                        new Destination(uri2),
-                        new Destination(uri3),
-                        new DocumentName("xyz", Locale.US),
-                        new JobName("xyz", Locale.US),
-                        new RequestingUserName("xyz", Locale.US),
-                        Sides.DUPLEX,
-                        Sides.ONE_SIDED,
-                        Sides.TUMBLE,
-                        Sides.TWO_SIDED_LONG_EDGE,
-                        Sides.TWO_SIDED_SHORT_EDGE,
-                        null };
-                for (int a = 0, ac = attrs.length; a < ac; a++) {
-                    try {
-                        supported = services[i].isAttributeValueSupported(
-                                attrs[a], DocFlavor.INPUT_STREAM.GIF, null);
-                    } catch (NullPointerException e1) {
-                        if (attrs[a] != null) {
-                            fail(e1.toString());
-                        }
-                    } catch (IllegalArgumentException e) {
-                        if (services[i]
-                                .isDocFlavorSupported(DocFlavor.INPUT_STREAM.GIF)) {
-                            fail(e.toString());
-                        }
-                    } catch (Exception e) {
+            Attribute[] attrs = { MediaSizeName.ISO_A0,
+                    Finishings.NONE,
+                    Finishings.EDGE_STITCH,
+                    MediaSizeName.ISO_A2,
+                    MediaSizeName.ISO_A3,
+                    new Destination(uri1),
+                    new Destination(uri2),
+                    new Destination(uri3),
+                    new DocumentName("xyz", Locale.US),
+                    new JobName("xyz", Locale.US),
+                    new RequestingUserName("xyz", Locale.US),
+                    Sides.DUPLEX,
+                    Sides.ONE_SIDED,
+                    Sides.TUMBLE,
+                    Sides.TWO_SIDED_LONG_EDGE,
+                    Sides.TWO_SIDED_SHORT_EDGE,
+                    null };
+            for (int a = 0, ac = attrs.length; a < ac; a++) {
+                try {
+                    supported = services[i].isAttributeValueSupported(
+                            attrs[a], DocFlavor.INPUT_STREAM.GIF, null);
+                } catch (NullPointerException e1) {
+                    if (attrs[a] != null) {
+                        fail(e1.toString());
+                    }
+                } catch (IllegalArgumentException e) {
+                    if (services[i]
+                            .isDocFlavorSupported(DocFlavor.INPUT_STREAM.GIF)) {
                         fail(e.toString());
                     }
-                    System.out.println(attrs[a]
-
-                            + (attrs[a] == null ? "" : "("
-                                    + attrs[a].getCategory().toString() + ")")
-                            + " : " + supported);
+                } catch (Exception e) {
+                    fail(e.toString());
                 }
-            } catch (Exception e) {
-                fail(e.toString());
+                System.out.println(attrs[a]
+
+                        + (attrs[a] == null ? "" : "("
+                                + attrs[a].getCategory().toString() + ")")
+                        + " : " + supported);
             }
         }
 
-        System.out
-                .println("============= END testIsAttributeValueSupported ================");
+        System.out.println("============= END testIsAttributeValueSupported ================");
     }
 
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupDefaultPrintServiceTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupDefaultPrintServiceTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupDefaultPrintServiceTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupDefaultPrintServiceTest.java Wed Oct 31 01:42:07 2007
@@ -34,7 +34,7 @@
 import junit.framework.TestCase;
 
 public class LookupDefaultPrintServiceTest extends TestCase {
-    public void testLookupDefaultPrintService() {
+    public void testLookupDefaultPrintService() throws Exception {
         System.out
                 .println("======= START LookupDefaultPrintServiceTest ======");
 
@@ -51,29 +51,24 @@
         daset.add(MediaName.ISO_A4_WHITE);
         daset.add(Sides.TWO_SIDED_LONG_EDGE);
 
-        try {
-            service = PrintServiceLookup.lookupDefaultPrintService();
-            if (service != null) {
-                if (service.isDocFlavorSupported(psFlavor)) {
-                    if (service.getUnsupportedAttributes(psFlavor, aset)==null) {
-                        fis = this.getClass().getResourceAsStream(
-                                "/Resources/GIF.gif");
-                        doc = new SimpleDoc(fis, psFlavor, daset);
+        service = PrintServiceLookup.lookupDefaultPrintService();
+        if (service != null) {
+            if (service.isDocFlavorSupported(psFlavor)) {
+                if (service.getUnsupportedAttributes(psFlavor, aset)==null) {
+                    fis = this.getClass().getResourceAsStream(
+                            "/Resources/GIF.gif");
+                    doc = new SimpleDoc(fis, psFlavor, daset);
 
-                        pj = service.createPrintJob();
-                        pj.print(doc, aset);
-                        System.out.println(fis.toString() + " printed on "
-                                + service.getName());
-                    }
-                } else {
-                    System.out.println("flavor is not supported");
+                    pj = service.createPrintJob();
+                    pj.print(doc, aset);
+                    System.out.println(fis.toString() + " printed on "
+                            + service.getName());
                 }
             } else {
-                System.out.println("service not found");
+                System.out.println("flavor is not supported");
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
+        } else {
+            System.out.println("service not found");
         }
 
         System.out.println("======= END LookupDefaultPrintServiceTest =======");

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupMultiDocPrintServicesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupMultiDocPrintServicesTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupMultiDocPrintServicesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupMultiDocPrintServicesTest.java Wed Oct 31 01:42:07 2007
@@ -34,7 +34,7 @@
 import junit.framework.TestCase;
 
 public class LookupMultiDocPrintServicesTest extends TestCase {
-    public void testLookupMultiDocPrintServices() {
+    public void testLookupMultiDocPrintServices() throws Exception {
         System.out
                 .println("============= START LookupMultiDocPrintServicesTest ================");
 
@@ -51,27 +51,21 @@
         daset.add(MediaName.ISO_A4_WHITE);
         daset.add(Sides.TWO_SIDED_LONG_EDGE);
 
-        try {
-            services = PrintServiceLookup.lookupMultiDocPrintServices(
-                    new DocFlavor[] { psFlavor }, aset);
-            if (services != null && services.length > 0) {
-                fis = new FileInputStream("/Resources/1M.GIF");
-                doc = new SimpleDoc(fis, psFlavor, daset);
+        services = PrintServiceLookup.lookupMultiDocPrintServices(
+                new DocFlavor[] { psFlavor }, aset);
+        if (services != null && services.length > 0) {
+            fis = new FileInputStream("/Resources/1M.GIF");
+            doc = new SimpleDoc(fis, psFlavor, daset);
 
-                pj = services[0].createPrintJob();
-                pj.print(doc, aset);
-                System.out.println(fis.toString() + " printed on "
-                        + services[0].getName());
-            } else {
-                System.out.println("services not found");
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
+            pj = services[0].createPrintJob();
+            pj.print(doc, aset);
+            System.out.println(fis.toString() + " printed on "
+                    + services[0].getName());
+        } else {
+            System.out.println("services not found");
         }
 
-        System.out
-                .println("============= END LookupMultiDocPrintServicesTest ================");
+        System.out.println("============= END LookupMultiDocPrintServicesTest ================");
     }
 
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupPrintServicesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupPrintServicesTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupPrintServicesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/LookupPrintServicesTest.java Wed Oct 31 01:42:07 2007
@@ -29,7 +29,7 @@
 import junit.framework.TestCase;
 
 public class LookupPrintServicesTest extends TestCase {
-    public void testLookupPrintServices() {
+    public void testLookupPrintServices() throws Exception {
         System.out.println("======== START LookupPrintServicesTest ========");
 
         PrintService[] services;
@@ -41,31 +41,27 @@
         Object[][] filetoprint = { { "/Resources/JPEG.jpg",
                 DocFlavor.INPUT_STREAM.JPEG },
                 { "/Resources/GIF.gif", DocFlavor.INPUT_STREAM.GIF } };
-        try {
-            DocFlavor df;
-            InputStream fis;
-
-            for (int i = 0; i < filetoprint.length; i++) {
-                df = (DocFlavor) filetoprint[i][1];
-
-                services = PrintServiceLookup.lookupPrintServices(df, aset);
-                TestUtil.checkServices(services);
-
-                for (int j = 0; j < services.length; j++) {
-                    fis = this.getClass().getResourceAsStream(
-                            (String) filetoprint[i][0]);
-                    doc = new SimpleDoc(fis, df, daset);
-                    PrintService printer = services[j];
-
-                    pj = printer.createPrintJob();
-                    pj.print(doc, aset);
-                    System.out.println(fis.toString() + " printed on "
-                            + printer.getName());
-                }
+
+        DocFlavor df;
+        InputStream fis;
+
+        for (int i = 0; i < filetoprint.length; i++) {
+            df = (DocFlavor) filetoprint[i][1];
+
+            services = PrintServiceLookup.lookupPrintServices(df, aset);
+            TestUtil.checkServices(services);
+
+            for (int j = 0; j < services.length; j++) {
+                fis = this.getClass().getResourceAsStream(
+                        (String) filetoprint[i][0]);
+                doc = new SimpleDoc(fis, df, daset);
+                PrintService printer = services[j];
+
+                pj = printer.createPrintJob();
+                pj.print(doc, aset);
+                System.out.println(fis.toString() + " printed on "
+                        + printer.getName());
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
         }
 
         System.out.println("====== END LookupPrintServicesTest ========");

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/PrintAutosenseTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/PrintAutosenseTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/PrintAutosenseTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/PrintAutosenseTest.java Wed Oct 31 01:42:07 2007
@@ -29,11 +29,11 @@
 import junit.framework.TestCase;
 
 public class PrintAutosenseTest extends TestCase {
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         new PrintAutosenseTest().testPrintAutosense();
     }
 
-    public void testPrintAutosense() {
+    public void testPrintAutosense() throws Exception {
         System.out.println("======== START PrintAutosenseTest ========");
 
         PrintService[] services;
@@ -43,28 +43,23 @@
 
         daset.add(MediaSizeName.ISO_A4);
 
-        try {
-            DocFlavor df = DocFlavor.INPUT_STREAM.AUTOSENSE;
-            InputStream fis = this.getClass().getResourceAsStream(
-                    "/Resources/hello_ps.ps");
-            services = PrintServiceLookup.lookupPrintServices(df, null);
-            TestUtil.checkServices(services);
-
-            for (int j = 0; j < services.length; j++) {
-                PrintService printer = services[j];
-                if (printer.toString().indexOf("print-to-file") >= 0) {
-                    doc = new SimpleDoc(fis, df, null);
-
-                    pj = printer.createPrintJob();
-                    pj.print(doc, null);
-                    System.out.println(fis.toString() + " printed on "
-                            + printer.getName());
-                    break;
-                }
+        DocFlavor df = DocFlavor.INPUT_STREAM.AUTOSENSE;
+        InputStream fis = this.getClass().getResourceAsStream(
+                "/Resources/hello_ps.ps");
+        services = PrintServiceLookup.lookupPrintServices(df, null);
+        TestUtil.checkServices(services);
+
+        for (int j = 0; j < services.length; j++) {
+            PrintService printer = services[j];
+            if (printer.toString().indexOf("print-to-file") >= 0) {
+                doc = new SimpleDoc(fis, df, null);
+
+                pj = printer.createPrintJob();
+                pj.print(doc, null);
+                System.out.println(fis.toString() + " printed on "
+                        + printer.getName());
+                break;
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
         }
 
         System.out.println("====== END PrintAutosenseTest ========");

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/PrintJpegTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/PrintJpegTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/PrintJpegTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/PrintJpegTest.java Wed Oct 31 01:42:07 2007
@@ -31,11 +31,11 @@
 import junit.framework.TestCase;
 
 public class PrintJpegTest extends TestCase {
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         new PrintJpegTest().testPrintJpeg();
     }
     
-    public void testPrintJpeg() {
+    public void testPrintJpeg() throws Exception {
         System.out.println("======== START PrintJpegTest ========");
 
         PrintService[] services;
@@ -46,28 +46,23 @@
 
         daset.add(MediaSizeName.ISO_A4);
 
-        try {
-            DocFlavor df = DocFlavor.INPUT_STREAM.JPEG;
-            InputStream fis = this.getClass().getResourceAsStream(
-                    "/Resources/JPEG.jpg");
-            services = PrintServiceLookup.lookupPrintServices(df, aset);
-            TestUtil.checkServices(services);
+        DocFlavor df = DocFlavor.INPUT_STREAM.JPEG;
+        InputStream fis = this.getClass().getResourceAsStream(
+                "/Resources/JPEG.jpg");
+        services = PrintServiceLookup.lookupPrintServices(df, aset);
+        TestUtil.checkServices(services);
 
-            for (int j = 0; j < services.length; j++) {
-                PrintService printer = services[j];
-                if (printer.toString().indexOf("print-to-file") >= 0) {
-                    doc = new SimpleDoc(fis, df, daset);
+        for (int j = 0; j < services.length; j++) {
+            PrintService printer = services[j];
+            if (printer.toString().indexOf("print-to-file") >= 0) {
+                doc = new SimpleDoc(fis, df, daset);
 
-                    pj = printer.createPrintJob();
-                    pj.print(doc, aset);
-                    System.out.println(fis.toString() + " printed on "
-                            + printer.getName());
-                    break;
-                }
+                pj = printer.createPrintJob();
+                pj.print(doc, aset);
+                System.out.println(fis.toString() + " printed on "
+                        + printer.getName());
+                break;
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail();
         }
 
         System.out.println("====== END PrintJpegTest ========");

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/ValueTests.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/ValueTests.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/ValueTests.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/ValueTests.java Wed Oct 31 01:42:07 2007
@@ -228,7 +228,7 @@
     assertTrue(streamService.isDisposed());
 }
 
-public void testStreamServicePrinting() {
+public void testStreamServicePrinting() throws Exception {
     startTest("StreamPrintServiceFactory class testing...");
     
     byte [] forChecking = {'%', '!', 'P', 'S', '-', 'A', 'd', 'o', 'b', 'e'};
@@ -256,12 +256,9 @@
     streamService = streamFactory.getPrintService(new ByteArrayOutputStream());
     aJob = streamService.createPrintJob();
     doc = new SimpleDoc(aStream, flavor, null);
-    try {
-        aJob.print(doc, null);
-    } catch (Exception e) {
-        e.printStackTrace();
-        fail("Can not print PrintJob!");
-    }    
+
+    aJob.print(doc, null);
+
     arr = ((ByteArrayOutputStream) (streamService.getOutputStream()))
             .toByteArray();
     for (int i = 0; i < 10; i++) {

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/AttributeSetUtilitiesTest.java Wed Oct 31 01:42:07 2007
@@ -48,15 +48,10 @@
      * if arguments are valid.
      */
     public final void testVerifyAttributeCategory() {
-
-        try {
-            assertEquals(ColorSupported.class,
-                AttributeSetUtilities.
-                    verifyAttributeCategory(ColorSupported.class,
-                        PrintServiceAttribute.class));
-        } catch (Exception e) {
-            fail("Unexpected was thrown: " + e.toString());
-        }
+        assertEquals(ColorSupported.class,
+            AttributeSetUtilities.
+                verifyAttributeCategory(ColorSupported.class,
+                    PrintServiceAttribute.class));
     }
 
     /*
@@ -125,19 +120,13 @@
      * exception is thown if arguments are valid.
      */
     public final void testVerifyAttributeValue() {
-
-        try {
-            PrintJobAttribute att = new Copies(10);
-            assertEquals(att,
+        PrintJobAttribute att = new Copies(10);
+        assertEquals(att,
+            AttributeSetUtilities.
+                verifyAttributeValue(att, PrintJobAttribute.class));
+        assertEquals(att,
                 AttributeSetUtilities.
-                    verifyAttributeValue(att, PrintJobAttribute.class));
-            assertEquals(att,
-                    AttributeSetUtilities.
-                        verifyAttributeValue(att, PrintRequestAttribute.class));
-        } catch (Exception e) {
-            fail("Unexpected was thrown: " + e.toString());
-        }
-
+                    verifyAttributeValue(att, PrintRequestAttribute.class));
     }
 
     /*
@@ -177,14 +166,9 @@
      * Tests that method throws no exception if arguments are valid.
      */
     public final void testVerifyCategoryForValue() {
-
-        try {
-            PrintServiceAttribute att = ColorSupported.NOT_SUPPORTED;
-            AttributeSetUtilities.
-                verifyCategoryForValue(ColorSupported.class, att);
-        } catch (Exception e) {
-            fail("Unexpected was thrown: " + e.toString());
-        }
+        PrintServiceAttribute att = ColorSupported.NOT_SUPPORTED;
+        AttributeSetUtilities.
+            verifyCategoryForValue(ColorSupported.class, att);
     }
 
     /*

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/EnumSyntaxTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/EnumSyntaxTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/EnumSyntaxTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/EnumSyntaxTest.java Wed Oct 31 01:42:07 2007
@@ -150,14 +150,10 @@
      * value toString() returns string contains this enumeration value.
      */
     public void testToString() {
-        try {
-            ees = new ExtendEnumSyntax(2);
-            assertEquals("2", ees.toString());
-            es = new enumSyntax(10);
-            assertEquals("10", es.toString());
-        } catch (Exception e) {
-            fail("toString() throws an exception");
-        }
+        ees = new ExtendEnumSyntax(2);
+        assertEquals("2", ees.toString());
+        es = new enumSyntax(10);
+        assertEquals("10", es.toString());
     }
 
     /*

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/HashAttributeTest.java Wed Oct 31 01:42:07 2007
@@ -65,12 +65,8 @@
                     "if attributes is null");
         } catch (NullPointerException e) {}
 
-        try {
-            AttributeSet aset1 = null;
-            AttributeSet aset2 = new HashAttributeSet(aset1);
-        } catch (Exception e) {
-            fail("Unexpected exception occurred: " + e.toString());
-        }
+        AttributeSet aset1 = null;
+        AttributeSet aset2 = new HashAttributeSet(aset1);
     }
 
 

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/SetOfIntegerSyntaxTest.java Wed Oct 31 01:42:07 2007
@@ -45,17 +45,13 @@
      * setOfIntegerSyntax(String str) constructor testing. 
      */
     public final void testSetOfIntegerSyntax() {
-        try {
-            set1 = new setOfIntegerSyntax(
-                    " 16-37, 100:30, 17-50, 1000-1848, 1-2, 2147");
-            set1 = new setOfIntegerSyntax("0");
-            set1 = new setOfIntegerSyntax(
-                    "100       :       30,                  4");
-            set1 = new setOfIntegerSyntax("000-1848");
-            set1 = new setOfIntegerSyntax("");
-        } catch (Exception e) {
-            fail("Unexpected exception occurred: " + e.toString());
-        }
+        set1 = new setOfIntegerSyntax(
+                " 16-37, 100:30, 17-50, 1000-1848, 1-2, 2147");
+        set1 = new setOfIntegerSyntax("0");
+        set1 = new setOfIntegerSyntax(
+                "100       :       30,                  4");
+        set1 = new setOfIntegerSyntax("000-1848");
+        set1 = new setOfIntegerSyntax("");
 
         try {
             set1 = new setOfIntegerSyntax("17-50 1000-160");
@@ -160,15 +156,12 @@
             fail("IllegalArgumentException wasn't trown when expected");
         } catch (IllegalArgumentException e) {
         }
-        try {
-            arr1 = new int[][] {{1,5}, {10}, {7,7}, {5,6}, {8,9}, {15,14}};
-            set1 = new setOfIntegerSyntax(arr1);
-            //System.out.println(set1.toString());
-            assertEquals(1, set1.getMembers()[0][0]);
-            assertEquals(10, set1.getMembers()[0][1]);
-        } catch (Exception e) {
-            fail("Unexpected exception occurred " + e);
-        }
+
+        arr1 = new int[][] {{1,5}, {10}, {7,7}, {5,6}, {8,9}, {15,14}};
+        set1 = new setOfIntegerSyntax(arr1);
+        //System.out.println(set1.toString());
+        assertEquals(1, set1.getMembers()[0][0]);
+        assertEquals(10, set1.getMembers()[0][1]);
 
         arr1 = new int[][] {{15,14}};
         set1 = new setOfIntegerSyntax(arr1);

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/URISyntaxTest.java Wed Oct 31 01:42:07 2007
@@ -43,13 +43,10 @@
     /*
      * URISyntax() constructor testing. 
      */
-    public final void testURISyntax() {
-        try {
-            uri1 = new URI("http://news.ngs.ru/more/14161.shtml");
-            us1 = new uriSyntax(uri1);
-        } catch (Exception e) {
-            fail("Unexpected exception occurred " + e);
-        }
+    public final void testURISyntax() throws Exception {
+        uri1 = new URI("http://news.ngs.ru/more/14161.shtml");
+        us1 = new uriSyntax(uri1);
+
         try {
             uri1 = null;
             us1 = new uriSyntax(uri1);
@@ -62,60 +59,44 @@
     /*
      * hashCode() method testing. 
      */
-    public final void testHashCode() {
-        try {
-            uri1 = new URI("http://www.ietf.org/rfc/rfc2396.txt");
-            us1 = new uriSyntax(uri1);
-            assertTrue(us1.hashCode() == us1.hashCode());
-
-            uri1 = new URI("http://www.ietf.org/rfc/rfc2396.txt");
-            us1 = new uriSyntax(uri1);
-            uri2 = new URI("http://www.ietf.org/rfc/rfc2395.txt");
-            us2 = new uriSyntax(uri2);
-            assertFalse(us1.hashCode() == us2.hashCode());
-
-        } catch (Exception e) {
-            fail("Unexpected exception occurred " + e);
-        }
-
+    public final void testHashCode() throws Exception {
+        uri1 = new URI("http://www.ietf.org/rfc/rfc2396.txt");
+        us1 = new uriSyntax(uri1);
+        assertTrue(us1.hashCode() == us1.hashCode());
+
+        uri1 = new URI("http://www.ietf.org/rfc/rfc2396.txt");
+        us1 = new uriSyntax(uri1);
+        uri2 = new URI("http://www.ietf.org/rfc/rfc2395.txt");
+        us2 = new uriSyntax(uri2);
+        assertFalse(us1.hashCode() == us2.hashCode());
     }
 
     /*
      * equals(Object object) method testing. 
      */
-    public final void testEqualsObject() {
-        try {
-            uri1 = new URI("http://www.melodi.ru/main/index.php#");
-            us1 = new uriSyntax(uri1);
-            assertTrue(us1.equals(us1));
-
-            uri1 = new URI("http://www.ietf.org/rfc/rfc2396.txt");
-            us1 = new uriSyntax(uri1);
-            uri2 = new URI("http://www.ietf.org/rfc/rfc2395.txt");
-            us2 = new uriSyntax(uri2);
-            assertFalse(us1.equals(us2));
-
-        } catch (Exception e) {
-            fail("Unexpected exception occurred " + e);
-        }
+    public final void testEqualsObject() throws Exception {
+        uri1 = new URI("http://www.melodi.ru/main/index.php#");
+        us1 = new uriSyntax(uri1);
+        assertTrue(us1.equals(us1));
+
+        uri1 = new URI("http://www.ietf.org/rfc/rfc2396.txt");
+        us1 = new uriSyntax(uri1);
+        uri2 = new URI("http://www.ietf.org/rfc/rfc2395.txt");
+        us2 = new uriSyntax(uri2);
+        assertFalse(us1.equals(us2));
     }
 
     /*
      * getURI() method testing. 
      */
-    public final void testGetURI() {
-        try {
-            uri1 = new URI("http://www.melodi.ru/main/index.php#");
-            us1 = new uriSyntax(uri1);
-            assertEquals(uri1, us1.getURI());
-
-            uri2 = new URI("http://www.ietf.org/rfc/rfc2395.txt");
-            us2 = new uriSyntax(uri2);
-            assertEquals(uri2, us2.getURI());
-
-        } catch (Exception e) {
-            fail("Unexpected exception occurred " + e);
-        }
+    public final void testGetURI() throws Exception {
+        uri1 = new URI("http://www.melodi.ru/main/index.php#");
+        us1 = new uriSyntax(uri1);
+        assertEquals(uri1, us1.getURI());
+
+        uri2 = new URI("http://www.ietf.org/rfc/rfc2395.txt");
+        us2 = new uriSyntax(uri2);
+        assertEquals(uri2, us2.getURI());
     }
 
 

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/test/api/java/common/javax/print/attribute/standard/MediaTest.java Wed Oct 31 01:42:07 2007
@@ -48,12 +48,8 @@
         Media tray = new mediaTray(1);
         assertFalse(name.equals(tray));
 
-        try {
-            sizename = null;
-            assertFalse(name.equals(sizename));
-        } catch (Exception e) {
-            fail("Unexpected exception ocurred " + e);
-        }
+        sizename = null;
+        assertFalse(name.equals(sizename));
     }
 
     /*

Modified: harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/Matcher2Test.java Wed Oct 31 01:42:07 2007
@@ -225,7 +225,7 @@
         try {
             mat.replaceAll(substitutionString);
             fail("IndexOutOfBoundsException should be thrown");
-        } catch (Exception e) {
+        } catch (IndexOutOfBoundsException e) {
         }
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/PatternErrorTest.java Wed Oct 31 01:42:07 2007
@@ -59,8 +59,9 @@
 		    Pattern.compile("foo",flags);
 		} catch (IllegalArgumentException e) {
 		    // This is the expected exception
-		} catch (Exception e) {
-		    fail();
+                    return;
 		}
+
+                fail("Expected IllegalArgumentException to be thrown");
 	}
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java Wed Oct 31 01:42:07 2007
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
 package org.apache.harmony.tests.java.util.regex;
 
 

Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/MarshalledObjectTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/MarshalledObjectTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/MarshalledObjectTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/src/test/api/java/org/apache/harmony/rmi/MarshalledObjectTest.java Wed Oct 31 01:42:07 2007
@@ -136,33 +136,25 @@
             Object obj = null;
 
             // 1-st get: thread context classloader is equal to system classloader
-            try {
-                obj = mo.get();
+            obj = mo.get();
 
-                if (obj.getClass().getClassLoader() != old_cl) {
-                    fail("1-st get failed: loaded through: "
-                            + obj.getClass().getClassLoader() + ", expected: " + old_cl);
+            if (obj.getClass().getClassLoader() != old_cl) {
+                fail("1-st get failed: loaded through: "
+                        + obj.getClass().getClassLoader() + ", expected: " + old_cl);
             } else {
                 System.out.println("1-st get passed.");
             }
-            } catch (Exception ex) {
-                fail("1-st get failed: " + ex);
-            }
 
             // 2-nd get: thread context classloader is equal to null
             Thread.currentThread().setContextClassLoader(null);
 
-            try {
-                obj = mo.get();
+            obj = mo.get();
 
-                if (obj.getClass().getClassLoader() != old_cl) {
-                    fail("2-nd get failed: loaded through: "
-                            + obj.getClass().getClassLoader() + ", expected: " + old_cl);
-                } else {
-                    System.out.println("2-nd get passed.");
-                }
-            } catch (Exception ex) {
-                fail("2-nd get failed: " + ex);
+            if (obj.getClass().getClassLoader() != old_cl) {
+                fail("2-nd get failed: loaded through: "
+                        + obj.getClass().getClassLoader() + ", expected: " + old_cl);
+            } else {
+                System.out.println("2-nd get passed.");
             }
         } finally {
             // restore thread context classloader

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AlgorithmParametersTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AlgorithmParametersTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AlgorithmParametersTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AlgorithmParametersTest.java Wed Oct 31 01:42:07 2007
@@ -557,7 +557,7 @@
         try {
             params.init(enc, "DOUGLASMAWSON");
             fail("unsupported format should have raised IOException");
-        } catch (Exception e) {
+        } catch (IOException e) {
             // expected
         }
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStreamTest.java Wed Oct 31 01:42:07 2007
@@ -523,32 +523,28 @@
     /**
      * @tests java.security.DigestOutputStream#on(boolean)
      */
-    public void test_onZ() {
+    public void test_onZ() throws Exception {
         // Test for method void java.security.DigestOutputStream.on(boolean)
-        try {
-            DigestOutputStream dos = new DigestOutputStream(
-                    new ByteArrayOutputStream(), MessageDigest
-                            .getInstance("SHA"));
-            dos.on(false);
-            byte digestArray[] = { 23, 43, 44 };
-            dos.write(digestArray, 1, 1);
-            byte digestResult[] = dos.getMessageDigest().digest();
-            byte expected[] = { -38, 57, -93, -18, 94, 107, 75, 13, 50, 85,
-                    -65, -17, -107, 96, 24, -112, -81, -40, 7, 9 };
-            assertTrue("Digest did not return expected result.",
-                    java.util.Arrays.equals(digestResult, expected));
-            // now turn on processing and re-run
-            dos.on(true);
-            dos.write(digestArray, 1, 1);
-            digestResult = dos.getMessageDigest().digest();
-            byte expected1[] = { -87, 121, -17, 16, -52, 111, 106, 54, -33,
-                    107, -118, 50, 51, 7, -18, 59, -78, -30, -37, -100 };
+        DigestOutputStream dos = new DigestOutputStream(
+                new ByteArrayOutputStream(), MessageDigest
+                        .getInstance("SHA"));
+        dos.on(false);
+        byte digestArray[] = { 23, 43, 44 };
+        dos.write(digestArray, 1, 1);
+        byte digestResult[] = dos.getMessageDigest().digest();
+        byte expected[] = { -38, 57, -93, -18, 94, 107, 75, 13, 50, 85,
+                -65, -17, -107, 96, 24, -112, -81, -40, 7, 9 };
+        assertTrue("Digest did not return expected result.",
+                java.util.Arrays.equals(digestResult, expected));
+        // now turn on processing and re-run
+        dos.on(true);
+        dos.write(digestArray, 1, 1);
+        digestResult = dos.getMessageDigest().digest();
+        byte expected1[] = { -87, 121, -17, 16, -52, 111, 106, 54, -33,
+                107, -118, 50, 51, 7, -18, 59, -78, -30, -37, -100 };
 
-            assertTrue("Digest did not return expected result.",
-                    java.util.Arrays.equals(digestResult, expected1));
-        } catch (Exception e) {
-            fail("Caught exception : " + e);
-        }
+        assertTrue("Digest did not return expected result.",
+                java.util.Arrays.equals(digestResult, expected1));
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyFactory2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyFactory2Test.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyFactory2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyFactory2Test.java Wed Oct 31 01:42:07 2007
@@ -203,7 +203,7 @@
 	 * @tests java.security.KeyFactory#getInstance(java.lang.String,
 	 *        java.lang.String)
 	 */
-	public void test_getInstanceLjava_lang_StringLjava_lang_String() {
+	public void test_getInstanceLjava_lang_StringLjava_lang_String() throws Exception {
 
 		// Test1: Test for method java.security.KeyFactory
 		// java.security.KeyFactory.getInstance(java.lang.String,
@@ -229,8 +229,6 @@
             fail("Expected IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 			// Expected
-		} catch (Exception e) {
-			fail("Expected IllegalArgumentException, got " + e);
 		}
 	}
 

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecureRandom2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecureRandom2Test.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecureRandom2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecureRandom2Test.java Wed Oct 31 01:42:07 2007
@@ -38,11 +38,7 @@
 	 */
 	public void test_Constructor() {
 		// Test for method java.security.SecureRandom()
-		try {
-			new SecureRandom();
-		} catch (Exception e) {
-			fail("Constructor threw exception : " + e);
-		}
+		new SecureRandom();
 	}
 
 	/**
@@ -50,11 +46,7 @@
 	 */
 	public void test_Constructor$B() {
 		// Test for method java.security.SecureRandom(byte [])
-		try {
-			new SecureRandom(SEED_BYTES);
-		} catch (Exception e) {
-			fail("Constructor threw exception : " + e);
-		}
+		new SecureRandom(SEED_BYTES);
 	}
 
 	/**
@@ -120,11 +112,7 @@
 	public void test_nextBytes$B() {
 		// Test for method void java.security.SecureRandom.nextBytes(byte [])
 		byte[] bytes = new byte[313];
-		try {
 		new SecureRandom().nextBytes(bytes);
-		} catch (Exception e) {
-			fail("next bytes not ok : " + e);
-		}
 	}
 
 	/**
@@ -132,11 +120,7 @@
 	 */
 	public void test_setSeed$B() {
 		// Test for method void java.security.SecureRandom.setSeed(byte [])
-		try {
-			new SecureRandom().setSeed(SEED_BYTES);
-		} catch (Exception e) {
-			fail("seed generation with bytes failed : " + e);
-		}
+		new SecureRandom().setSeed(SEED_BYTES);
 	}
 
 	/**
@@ -144,11 +128,7 @@
 	 */
 	public void test_setSeedJ() {
 		// Test for method void java.security.SecureRandom.setSeed(long)
-		try {
-			new SecureRandom().setSeed(SEED_VALUE);
-		} catch (Exception e) {
-			fail("seed generation with long failed : " + e);
-		}
+		new SecureRandom().setSeed(SEED_VALUE);
 	}
 
 	/**

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java Wed Oct 31 01:42:07 2007
@@ -145,8 +145,6 @@
             }
             assertEquals("Providers not removed", 0,
                     Security.getProviders().length);
-        } catch (Exception e) {
-            e.printStackTrace();
         } finally {    // restore providers
             for (int i = 0; i < providers.length; i++) {
                 Security.addProvider(providers[i]);

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateEncodingException2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateEncodingException2Test.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateEncodingException2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateEncodingException2Test.java Wed Oct 31 01:42:07 2007
@@ -37,8 +37,6 @@
 			assertEquals("Initializer failed : " + e.toString(),
 					"java.security.cert.CertificateEncodingException",
 					e.toString());
-		} catch (Exception e) {
-			fail("Unexpected exception during test : " + e);
-		}
+		} 
 	}
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateException2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateException2Test.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateException2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateException2Test.java Wed Oct 31 01:42:07 2007
@@ -36,8 +36,6 @@
 		} catch (CertificateException e) {
 			assertEquals("Initializer failed : " + e.toString(),
 					"java.security.cert.CertificateException", e.toString());
-		} catch (Exception e) {
-			fail("Unexpected exception during test : " + e);
 		}
 	}
 
@@ -55,8 +53,6 @@
 		} catch (CertificateException e) {
 			assertEquals("Initializer failed",
 					"Some error message", e.getMessage());
-		} catch (Exception e) {
-			fail("Unexpected exception during test : " + e);
 		}
 	}
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java.injected/java/security/cert/X509CertSelectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java.injected/java/security/cert/X509CertSelectorTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java.injected/java/security/cert/X509CertSelectorTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java.injected/java/security/cert/X509CertSelectorTest.java Wed Oct 31 01:42:07 2007
@@ -2685,7 +2685,7 @@
     /**
      * toString() method testing.
      */
-    public void testToString() throws IOException {
+    public void testToString() throws Exception {
         BigInteger serial = new BigInteger("10000");
         X500Principal issuer = new X500Principal("O=Issuer Org.");
         X500Principal subject = new X500Principal("O=Subject Org.");
@@ -2698,13 +2698,9 @@
         };
         String pkAlgID = "1.2.840.113549.1.1.4"; // MD5 with RSA encryption (source: http://asn1.elibel.tm.fr)
         PublicKey pkey;
-        try {
-            pkey = new TestKeyPair("RSA").getPublic();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Unexpected Exception was thrown: " + e.getMessage());
-            return;
-        }
+
+        pkey = new TestKeyPair("RSA").getPublic();
+
         boolean[] keyUsage = new boolean[]
                     {true, true, true, true, true, true, true, true, false};
         // OID values was taken from rfc 3280
@@ -2754,7 +2750,7 @@
      * and if the certificate conforming to the multiple matching criteria
      * matches or does not..
      */
-    public void testMatch() throws IOException {
+    public void testMatch() throws Exception {
         BigInteger serial = new BigInteger("10000");
         X500Principal issuer = new X500Principal("O=Issuer Org.");
         X500Principal subject = new X500Principal("O=Subject Org.");
@@ -2767,13 +2763,9 @@
         };
         String pkAlgID = "1.2.840.113549.1.1.1"; // RSA encryption (source: http://asn1.elibel.tm.fr)
         PublicKey pkey;
-        try {
-            pkey = new TestKeyPair("RSA").getPublic();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Unexpected Exception was thrown: " + e.getMessage());
-            return;
-        }
+
+        pkey = new TestKeyPair("RSA").getPublic();
+
         boolean[] keyUsage = new boolean[]
                     {true, true, true, true, true, true, true, true, false};
         // OID values was taken from rfc 3280
@@ -2853,7 +2845,7 @@
     /**
      * clone() method testing.
      */
-    public void testClone() throws IOException {
+    public void testClone() throws Exception {
         BigInteger serial = new BigInteger("10000");
         X500Principal issuer = new X500Principal("O=Issuer Org.");
         X500Principal subject = new X500Principal("O=Subject Org.");
@@ -2866,13 +2858,9 @@
         };
         String pkAlgID = "1.2.840.113549.1.1.1"; // RSA encryption (source: http://asn1.elibel.tm.fr)
         PublicKey pkey;
-        try {
-            pkey = new TestKeyPair("RSA").getPublic();
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Unexpected Exception was thrown: " + e.getMessage());
-            return;
-        }
+
+        pkey = new TestKeyPair("RSA").getPublic();
+
         boolean[] keyUsage = new boolean[]
                     {true, true, true, true, true, true, true, true, false};
         // OID values was taken from rfc 3280

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java Wed Oct 31 01:42:07 2007
@@ -342,13 +342,8 @@
 
             while (iter.hasMoreElements()) {
                 aName = (String) iter.nextElement();
-                try {
-                    assertEquals("Incorrect ProtectionParameter", ksB
-                            .getProtectionParameter(aName), pp[i]);
-                } catch (Exception e) {
-                    fail("Unexpected: " + e.toString()
-                            + " was thrown for alias: " + aName);
-                }
+                assertEquals("Incorrect ProtectionParameter", ksB
+                        .getProtectionParameter(aName), pp[i]);
             }
 
             try {

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CRLImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CRLImplTest.java?rev=590591&r1=590590&r2=590591&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CRLImplTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CRLImplTest.java Wed Oct 31 01:42:07 2007
@@ -244,37 +244,32 @@
     
     private static int XXX = 0, counter = 0;
 
-    public void testCreationCRL() {
-        try {
-            byte[] stamp = new byte[10];
-            if ((++counter)%10 != 0) {
-                XXX++;
-            }
-            byte tmp[] = BigInteger.valueOf(XXX).toByteArray();
-            System.arraycopy(tmp, 0, stamp, 0, tmp.length);
-            System.arraycopy(stamp, 0, encoding, 
-                    encoding.length-stamp.length, stamp.length);
+    public void testCreationCRL() throws Exception {
+        byte[] stamp = new byte[10];
+        if ((++counter)%10 != 0) {
+            XXX++;
+        }
+        byte tmp[] = BigInteger.valueOf(XXX).toByteArray();
+        System.arraycopy(tmp, 0, stamp, 0, tmp.length);
+        System.arraycopy(stamp, 0, encoding, 
+                encoding.length-stamp.length, stamp.length);
 
-            stream.reset();
-            java.security.cert.X509CRL c = (java.security.cert.X509CRL)
-                factory.generateCRL(stream);
-            
-            if (counter == 1) {
-                System.out.println("\nUSING: "+ c.getClass());
-            }
-            
-            byte[] enc = c.getEncoded();
-            byte[] stamp_chek = new byte[stamp.length];
-            
-            System.arraycopy(enc, enc.length - stamp.length, 
-                    stamp_chek, 0, stamp.length);
-           
-            if (!Arrays.equals(stamp, stamp_chek)) {
-                fail("Wrong encoding received.");
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            fail("Creation of a crl from a stream failed:"+e.getMessage());
+        stream.reset();
+        java.security.cert.X509CRL c = (java.security.cert.X509CRL)
+            factory.generateCRL(stream);
+        
+        if (counter == 1) {
+            System.out.println("\nUSING: "+ c.getClass());
+        }
+        
+        byte[] enc = c.getEncoded();
+        byte[] stamp_chek = new byte[stamp.length];
+        
+        System.arraycopy(enc, enc.length - stamp.length, 
+                stamp_chek, 0, stamp.length);
+       
+        if (!Arrays.equals(stamp, stamp_chek)) {
+            fail("Wrong encoding received.");
         }
     }
 



Mime
View raw message