Merge
authoramurillo
Tue, 20 Jan 2015 10:22:43 -0800
changeset 28506 8c606017b9cf
parent 28462 8327024a9955 (diff)
parent 28505 7574ac3bb6c1 (current diff)
child 28507 354ef83ee258
child 29185 41cf0610fedf
Merge
hotspot/test/runtime/7194254/Test7194254.java
--- a/.hgtags	Thu Jan 15 19:23:48 2015 -0800
+++ b/.hgtags	Tue Jan 20 10:22:43 2015 -0800
@@ -288,3 +288,4 @@
 6494b13f88a867026ee316b444d9a4fa589dd6bd jdk9-b43
 abbfccd659b91a7bb815d5e36fed635dcdd40f31 jdk9-b44
 bfc24ae2b900187585079bb11e66e459d1e525fe jdk9-b45
+722378bc599e38d9a1dd484de30f10dfd7b21438 jdk9-b46
--- a/.hgtags-top-repo	Thu Jan 15 19:23:48 2015 -0800
+++ b/.hgtags-top-repo	Tue Jan 20 10:22:43 2015 -0800
@@ -288,3 +288,4 @@
 02ee8c65622e8bd97496d584e22fc7dcf0edc4ae jdk9-b43
 8994f5d87b3bb5e8d317d4e8ccb326da1a73684a jdk9-b44
 3dd628fde2086218d548841022ee8436b6b88185 jdk9-b45
+12f1e276447bcc81516e85367d53e4f08897049d jdk9-b46
--- a/common/autoconf/configure	Thu Jan 15 19:23:48 2015 -0800
+++ b/common/autoconf/configure	Tue Jan 20 10:22:43 2015 -0800
@@ -36,6 +36,13 @@
   shift
 fi
 
+if test "x$BASH" = x; then
+  echo "Error: This script must be run using bash." 1>&2
+  exit 1
+fi
+# Force autoconf to use bash
+export CONFIG_SHELL=$BASH
+
 conf_script_dir="$TOPDIR/common/autoconf"
 
 if [ "$CUSTOM_CONFIG_DIR" = "" ]; then
--- a/common/bin/compare.sh	Thu Jan 15 19:23:48 2015 -0800
+++ b/common/bin/compare.sh	Tue Jan 20 10:22:43 2015 -0800
@@ -22,7 +22,7 @@
 # questions.
 #
 
-# This script is processed by configure before it's usable. It is run from 
+# This script is processed by configure before it's usable. It is run from
 # the root of the build directory.
 
 
@@ -76,10 +76,13 @@
     TMP=1
 
     if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
+        # Filter out date string, ant version and java version differences.
         TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
             $GREP '^[<>]' | \
             $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
-	         -e '/[<>] Created-By: .* (Oracle Corporation).*/d')
+                 -e '/[<>] Created-By: .* (Oracle [Corpatin)]*/d' \
+                 -e '/[<>]  [Corpatin]*)/d' \
+                 -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
     fi
     if test "x$SUFFIX" = "xjava"; then
         TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
@@ -92,7 +95,7 @@
                  -e '/\/\/ java GenerateCharacter.*/d')
     fi
     # Ignore date strings in class files.
-    # On Macosx the system sources for generated java classes produce different output on 
+    # On Macosx the system sources for generated java classes produce different output on
     # consequtive invocations seemingly randomly.
     # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
     # Anonymous lambda classes get randomly assigned counters in their names.
@@ -100,18 +103,18 @@
         # To improve performance when large diffs are found, do a rough filtering of classes
         # elibeble for these exceptions
         if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' \
-	        -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
-	        -e thePoint -e aPoint -e setItemsPtr \
+                -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
+                -e thePoint -e aPoint -e setItemsPtr \
                 -e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then
             $JAVAP -c -constants -l -p "${OTHER_FILE}" >  ${OTHER_FILE}.javap
             $JAVAP -c -constants -l -p "${THIS_FILE}" > ${THIS_FILE}.javap
             TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
                 $GREP '^[<>]' | \
                 $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
-		     -e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \
- 	             -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
-	             -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
-	             -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d' \
+                     -e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \
+                     -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
+                     -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
+                     -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d' \
                      -e '/[<>].*lambda\$[a-zA-Z0-9]*\$[0-9]*/d')
         fi
     fi
@@ -121,20 +124,19 @@
 # Disable this exception since we aren't changing the properties cleaning method yet.
 #        $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
 #            | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
-#  	    | $SED -e '/^#/d' -e '/^$/d' \
+#            | $SED -e '/^#/d' -e '/^$/d' \
 #            -e :a -e '/\\$/N; s/\\\n//; ta' \
-#  	    -e 's/^[ \t]*//;s/[ \t]*$//' \
-#	    -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
+#            -e 's/^[ \t]*//;s/[ \t]*$//' \
+#            -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
         # Filter out date string differences.
         TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE | \
             $GREP '^[<>]' | \
             $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
     fi
-    if test "x$SUFFIX" = "xMF"; then
-        # Filter out date string differences.
+    if test "x$SUFFIX" = "xhtml"; then
         TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
             $GREP '^[<>]' | \
-            $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
+            $SED -e '/[<>] <!-- Generated by javadoc .* on .* -->/d' )
     fi
     if test -n "$TMP"; then
         echo Files $OTHER_FILE and $THIS_FILE differ
@@ -158,7 +160,7 @@
     (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this)
 
     $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_this > $WORK_DIR/dirs_diff
-    
+
     echo -n Directory structure...
     if [ -s $WORK_DIR/dirs_diff ]; then
         echo Differences found.
@@ -192,7 +194,7 @@
 
     (cd $OTHER_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_other)
     (cd $THIS_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_this)
-    
+
     $DIFF $WORK_DIR/files_other $WORK_DIR/files_this > $WORK_DIR/files_diff
 
     echo -n File names...
@@ -236,11 +238,11 @@
         TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
         if [ "$OP" != "$TP" ]
         then
-	    if [ -z "$found" ]; then echo ; found="yes"; fi
-	    $PRINTF "\told: ${OP} new: ${TP}\t$f\n"
+            if [ -z "$found" ]; then echo ; found="yes"; fi
+            $PRINTF "\tother: ${OP} this: ${TP}\t$f\n"
         fi
     done
-    if [ -z "$found" ]; then 
+    if [ -z "$found" ]; then
         echo "Identical!"
     else
         REGRESSIONS=true
@@ -265,24 +267,22 @@
         if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
         OF=`cd ${OTHER_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'`
         TF=`cd ${THIS_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'`
-        if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]]
-        then
-	    if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ]
-	    then
-	        # the way we produces zip-files make it so that directories are stored in old file
-	        # but not in new (only files with full-path)
-	        # this makes file-5.09 report them as different
-	        continue;
-	    fi
-        fi
-        
         if [ "$OF" != "$TF" ]
         then
-	    if [ -z "$found" ]; then echo ; found="yes"; fi
-	    $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n"
+            if [ "`echo $OF | $GREP -c 'Zip archive data'`" -gt 0 ] \
+                && [ "`echo $TF | $GREP -c 'Zip archive data'`" -gt 0 ]
+            then
+                # the way we produce zip-files make it so that directories are stored in
+                # old file but not in new (only files with full-path) this makes file
+                # report them as different
+                continue
+            else
+                if [ -z "$found" ]; then echo ; found="yes"; fi
+                $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n"
+            fi
         fi
     done
-    if [ -z "$found" ]; then 
+    if [ -z "$found" ]; then
         echo "Identical!"
     else
         REGRESSIONS=true
@@ -296,12 +296,13 @@
     THIS_DIR=$1
     OTHER_DIR=$2
     WORK_DIR=$3
-    
+
     GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
         ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" ! -name "*.jimage" \
-        ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
+        ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" ! -name "*.cpl" \
         ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
         ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
+        ! -name "*.obj" ! -name "*.o" ! -name "JavaControlPanelHelper" ! -name "JavaUpdater" \
         | $GREP -v "./bin/"  | $SORT | $FILTER)
 
     echo General files...
@@ -377,7 +378,7 @@
     THIS_SUFFIX="${THIS_ZIP##*.}"
     OTHER_SUFFIX="${OTHER_ZIP##*.}"
     if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then
-        echo The files do not have the same suffix type!
+        echo "The files do not have the same suffix type! ($THIS_SUFFIX != $OTHER_SUFFIX)"
         return 2
     fi
 
@@ -389,7 +390,7 @@
     fi
     # Not quite identical, the might still contain the same data.
     # Unpack the jar/zip files in temp dirs
-    
+
     THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this
     OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other
     $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
@@ -464,9 +465,9 @@
 
     $RM -f $WORK_DIR/$ZIP_FILE.diffs
     for file in $DIFFING_FILES; do
-	if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
+        if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
             diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
-	fi
+        fi
     done
 
     if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
@@ -573,6 +574,10 @@
 
     $MKDIR -p $FILE_WORK_DIR
 
+    # Make soft links to original files from work dir to facilitate debugging
+    $LN -f -s $THIS_FILE $WORK_FILE_BASE.this
+    $LN -f -s $OTHER_FILE $WORK_FILE_BASE.other
+
     ORIG_THIS_FILE="$THIS_FILE"
     ORIG_OTHER_FILE="$OTHER_FILE"
 
@@ -589,50 +594,51 @@
     fi
 
     if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
-	unset _NT_SYMBOL_PATH
-	# On windows we need to unzip the debug symbols, if present
-	OTHER_FILE_BASE=${OTHER_FILE/.dll/}
-	OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/}
-	DIZ_NAME=$(basename $OTHER_FILE_BASE).diz
+        unset _NT_SYMBOL_PATH
+        # On windows we need to unzip the debug symbols, if present
+        OTHER_FILE_BASE=${OTHER_FILE/.dll/}
+        OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/}
+        OTHER_FILE_BASE=${OTHER_FILE_BASE/.cpl/}
+        DIZ_NAME=$(basename $OTHER_FILE_BASE).diz
         # java.exe and java.dll diz files will have the same name. Have to
-	# make sure java.exe gets the right one. This is only needed for 
-	# OTHER since in the new build, all pdb files are left around.
-	if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then
-	    OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz"
-	elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
-	    OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
-	else
+        # make sure java.exe gets the right one. This is only needed for
+        # OTHER since in the new build, all pdb files are left around.
+        if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then
+            OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz"
+        elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
+            OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
+        else
             # Some files, jli.dll, appears twice in the image but only one of
-	    # thme has a diz file next to it.
-	    OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)"
-	    if [ ! -f "$OTHER_DIZ_FILE" ]; then
-		# As a last resort, look for diz file in the whole build output
-		# dir.
-		OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)"
-	    fi
-	fi
-	if [ -n "$OTHER_DIZ_FILE" ]; then
-	    $MKDIR -p $FILE_WORK_DIR/other
-	    (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE)
-	    export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other"
-	fi
-	THIS_FILE_BASE=${THIS_FILE/.dll/}
-	THIS_FILE_BASE=${THIS_FILE_BASE/.exe/}
-	if [ -f "${THIS_FILE/.dll/}.diz" ]; then
-	    THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
-	else
-	    THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)"
-	    if [ ! -f "$THIS_DIZ_FILE" ]; then
-		# As a last resort, look for diz file in the whole build output
-		# dir.
-		THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)"
-	    fi
-	fi
-	if [ -n "$THIS_DIZ_FILE" ]; then
-	    $MKDIR -p $FILE_WORK_DIR/this
-	    (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE)
-	    export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this"
-	fi
+            # thme has a diz file next to it.
+            OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)"
+            if [ ! -f "$OTHER_DIZ_FILE" ]; then
+                # As a last resort, look for diz file in the whole build output
+                # dir.
+                OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)"
+            fi
+        fi
+        if [ -n "$OTHER_DIZ_FILE" ]; then
+            $MKDIR -p $FILE_WORK_DIR/other
+            (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE)
+            export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other"
+        fi
+        THIS_FILE_BASE=${THIS_FILE/.dll/}
+        THIS_FILE_BASE=${THIS_FILE_BASE/.exe/}
+        if [ -f "${THIS_FILE/.dll/}.diz" ]; then
+            THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
+        else
+            THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)"
+            if [ ! -f "$THIS_DIZ_FILE" ]; then
+                # As a last resort, look for diz file in the whole build output
+                # dir.
+                THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)"
+            fi
+        fi
+        if [ -n "$THIS_DIZ_FILE" ]; then
+            $MKDIR -p $FILE_WORK_DIR/this
+            (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE)
+            export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this"
+        fi
     fi
 
     if [ -z "$SKIP_BIN_DIFF" ]; then
@@ -670,19 +676,19 @@
         DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE)
         SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM)
         if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] \
-	    && [ "$DIFF_SIZE_REL" -lt 102 ]; then
+            && [ "$DIFF_SIZE_REL" -lt 102 ]; then
             SIZE_MSG="($SIZE_MSG)"
             DIFF_SIZE=
         elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
-	    && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
-	    && [ "$DIFF_SIZE_NUM" = 512 ]; then
-	    # On windows, size of binaries increase in 512 increments.
+            && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
+            && [ "$DIFF_SIZE_NUM" = 512 ]; then
+            # On windows, size of binaries increase in 512 increments.
             SIZE_MSG="($SIZE_MSG)"
             DIFF_SIZE=
         elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
-	    && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
-	    && [ "$DIFF_SIZE_NUM" = -512 ]; then
-	    # On windows, size of binaries increase in 512 increments.
+            && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
+            && [ "$DIFF_SIZE_NUM" = -512 ]; then
+            # On windows, size of binaries increase in 512 increments.
             SIZE_MSG="($SIZE_MSG)"
             DIFF_SIZE=
         else
@@ -717,18 +723,18 @@
     if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
         # The output from dumpbin on windows differs depending on if the debug symbol
         # files are still around at the location the binary is pointing too. Need
-	# to filter out that extra information.
-	$DUMPBIN -exports $OTHER_FILE | $GREP  -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
-	$DUMPBIN -exports $THIS_FILE  | $GREP  -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+        # to filter out that extra information.
+        $DUMPBIN -exports $OTHER_FILE | $GREP  -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
+        $DUMPBIN -exports $THIS_FILE  | $GREP  -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
     elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
         # Some symbols get seemingly random 15 character prefixes. Filter them out.
         $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
-	$NM -a $ORIG_THIS_FILE  2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+        $NM -a $ORIG_THIS_FILE  2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
     else
-	$NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
-	$NM -a $ORIG_THIS_FILE  2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
+        $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
+        $NM -a $ORIG_THIS_FILE  2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
     fi
-    
+
     LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
     if [ -s $WORK_FILE_BASE.symbols.diff ]; then
         SYM_MSG=" diff  "
@@ -741,7 +747,7 @@
                 SYM_MSG=" $SYM_MSG "
             fi
         else
-            SYM_MSG="($SYM_MSG)"            
+            SYM_MSG="($SYM_MSG)"
             DIFF_SYM=
         fi
     else
@@ -754,48 +760,48 @@
 
     # Check dependencies
     if [ -n "$LDD_CMD" ]; then
-	(cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
-	(cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2</dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.this | $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
-	(cd $FILE_WORK_DIR && $RM -f $NAME)
-	
-	LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
-	LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
-	
-	if [ -s $WORK_FILE_BASE.deps.diff ]; then
+        (cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
+        (cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2</dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.this | $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
+        (cd $FILE_WORK_DIR && $RM -f $NAME)
+
+        LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
+        LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
+
+        if [ -s $WORK_FILE_BASE.deps.diff ]; then
             if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then
-		DEP_MSG=" diff  "
+                DEP_MSG=" diff  "
             else
-		DEP_MSG=" redun "
+                DEP_MSG=" redun "
             fi
             if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then
-		DIFF_DEP=true
-		if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then
+                DIFF_DEP=true
+                if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then
                     DEP_MSG="*$DEP_MSG*"
                     REGRESSIONS=true
-		else
+                else
                     DEP_MSG=" $DEP_MSG "
-		fi
+                fi
             else
-		DEP_MSG="($DEP_MSG)"
-		DIFF_DEP=
+                DEP_MSG="($DEP_MSG)"
+                DIFF_DEP=
             fi
-	else
-	    DEP_MSG="         "
-	    DIFF_DEP=
+        else
+            DEP_MSG="         "
+            DIFF_DEP=
             if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
                 DEP_MSG="     !      "
             fi
-	fi
+        fi
     else
-	DEP_MSG="    -    "
+        DEP_MSG="    -    "
     fi
-    
+
     # Compare fulldump output
     if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then
         $FULLDUMP_CMD $OTHER_FILE > $WORK_FILE_BASE.fulldump.other 2>&1
         $FULLDUMP_CMD $THIS_FILE > $WORK_FILE_BASE.fulldump.this 2>&1
         LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff
-        
+
         if [ -s $WORK_FILE_BASE.fulldump.diff ]; then
             ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}')
             ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE)
@@ -822,14 +828,17 @@
 
     # Compare disassemble output
     if [ -n "$DIS_CMD" ] && [ -z "$SKIP_DIS_DIFF" ]; then
-	if [ -z "$DIS_DIFF_FILTER" ]; then
-	    DIS_DIFF_FILTER="$CAT"
-	fi
-        $DIS_CMD $OTHER_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.other 2>&1
-        $DIS_CMD $THIS_FILE  | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.this  2>&1
-        
+        # By default we filter out differences that include references to symbols.
+        # To get a raw diff with the complete disassembly, set
+        # DIS_DIFF_FILTER="$CAT"
+        if [ -z "$DIS_DIFF_FILTER" ]; then
+            DIS_DIFF_FILTER="$GREP -v ' # .* <.*>$'"
+        fi
+        $DIS_CMD $OTHER_FILE | $GREP -v $NAME | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.other 2>&1
+        $DIS_CMD $THIS_FILE  | $GREP -v $NAME | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.this  2>&1
+
         LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
-        
+
         if [ -s $WORK_FILE_BASE.dis.diff ]; then
             DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')
             DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE)
@@ -907,7 +916,9 @@
     OTHER_DIR=$2
     WORK_DIR=$3
 
-    LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' -o -name 'JavaControlPanel' \) | $SORT | $FILTER)
+    LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' \
+        -o -name '*.dll' -o -name '*.obj' -o -name '*.o' \
+        -o -name '*.cpl' \) | $SORT | $FILTER)
 
     if [ -n "$LIBS" ]; then
         echo Libraries...
@@ -967,7 +978,7 @@
 $MKDIR -p $COMPARE_ROOT
 if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
     if [ "$(uname -o)" = "Cygwin" ]; then
-	COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
+        COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
     fi
 fi
 
@@ -1091,7 +1102,7 @@
             CMP_JARS=true
             CMP_LIBS=true
             CMP_EXECS=true
-            
+
             if [ -z "$FILTER" ]; then
                 FILTER="$GREP"
             fi
@@ -1177,8 +1188,8 @@
         OTHER_J2RE="$OTHER/images/jre"
         echo "Selecting jdk images for compare"
     else
-	echo "No common images found."
-	exit 1
+        echo "No common images found."
+        exit 1
     fi
 
     if [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
@@ -1189,6 +1200,17 @@
         echo "Also comparing macosx bundles"
     fi
 
+    if [ -d "$THIS/deploy" ] && [ -d "$OTHER/deploy" ]; then
+        THIS_DEPLOY_BUNDLE_DIR="$THIS/deploy/dist/installer/bundles"
+        OTHER_DEPLOY_BUNDLE_DIR="$OTHER/deploy/bundles"
+        echo "Also comparing deploy/bundles"
+        if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
+            THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/JavaAppletPlugin.plugin"
+            OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin"
+            echo "Also comparing JavaAppletPlugin"
+        fi
+    fi
+
     if [ -d "$OTHER/images" ]; then
         OTHER_SEC_DIR="$OTHER/images"
     else
@@ -1212,7 +1234,7 @@
     if [ -d "$THIS/docs" ] && [ -d "$OTHER/docs" ]; then
         THIS_DOCS="$THIS/docs"
         OTHER_DOCS="$OTHER/docs"
-	echo "Also comparing docs"
+        echo "Also comparing docs"
     else
         echo "WARNING! Docs haven't been built and won't be compared."
     fi
@@ -1227,7 +1249,7 @@
         compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
         echo -n "J2RE  "
         compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
-        
+
         echo -n "J2SDK "
         compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
         echo -n "J2RE  "
@@ -1238,7 +1260,7 @@
         compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
         echo -n "J2RE  Bundle "
         compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
-        
+
         echo -n "J2SDK Bundle "
         compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
         echo -n "J2RE  Bundle "
@@ -1254,6 +1276,12 @@
         compare_dirs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
         compare_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
+    if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
+        echo -n "JavaAppletPlugin "
+        compare_dirs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
+        echo -n "JavaAppletPlugin "
+        compare_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
+    fi
 fi
 
 if [ "$CMP_PERMS" = "true" ]; then
@@ -1266,6 +1294,10 @@
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
+    if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
+        echo -n "JavaAppletPlugin "
+        compare_permissions $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
+    fi
 fi
 
 if [ "$CMP_TYPES" = "true" ]; then
@@ -1284,6 +1316,10 @@
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
+    if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
+        echo -n "JavaAppletPlugin "
+        compare_file_types $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
+    fi
 fi
 
 if [ "$CMP_GENERAL" = "true" ]; then
@@ -1306,6 +1342,10 @@
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_general_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
+    if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
+        echo -n "JavaAppletPlugin "
+        compare_general_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
+    fi
 fi
 
 if [ "$CMP_ZIPS" = "true" ]; then
@@ -1333,6 +1373,12 @@
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_all_zip_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
+    if [ -n "$THIS_DEPLOY_BUNDLE_DIR" ] && [ -n "$OTHER_DEPLOY_BUNDLE_DIR" ]; then
+        compare_all_zip_files $THIS_DEPLOY_BUNDLE_DIR $OTHER_DEPLOY_BUNDLE_DIR $COMPARE_ROOT/deploy-bundle
+    fi
+    if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
+        compare_all_zip_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
+    fi
 fi
 
 if [ "$CMP_JARS" = "true" ]; then
@@ -1342,6 +1388,9 @@
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_all_jar_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
+    if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
+        compare_all_jar_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
+    fi
 fi
 
 if [ "$CMP_LIBS" = "true" ]; then
@@ -1356,15 +1405,27 @@
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
+    if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
+        echo -n "JavaAppletPlugin "
+        compare_all_libs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
+    fi
 fi
 
 if [ "$CMP_EXECS" = "true" ]; then
     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
         compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
+        if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
+            echo -n "J2RE  "
+            compare_all_execs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
+        fi
     fi
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
+    if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then
+        echo -n "JavaAppletPlugin "
+        compare_all_execs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin
+    fi
 fi
 
 echo
--- a/corba/.hgtags	Thu Jan 15 19:23:48 2015 -0800
+++ b/corba/.hgtags	Tue Jan 20 10:22:43 2015 -0800
@@ -288,3 +288,4 @@
 9645e35616b60c5c07b4fdf11a132afc8081dfa8 jdk9-b43
 1f57bd728c9e6865ccb9d43ccd80a1c11230a32f jdk9-b44
 9e3f2bed80c0e5a84a256ce41f1d10c5ade48466 jdk9-b45
+326f2068b4a4c05e2fa27d6acf93eba7b54b090d jdk9-b46
--- a/hotspot/.hgtags	Thu Jan 15 19:23:48 2015 -0800
+++ b/hotspot/.hgtags	Tue Jan 20 10:22:43 2015 -0800
@@ -448,3 +448,4 @@
 65a9747147b8090037541040ba67156ec914db6a jdk9-b43
 43a44b56dca61a4d766a20f0528fdd8b5ceff873 jdk9-b44
 5dc8184af1e2bb30b0103113d1f1a58a21a80c37 jdk9-b45
+a184ee1d717297bd35b7c3e35393e137921a3ed2 jdk9-b46
--- a/jaxp/.hgtags	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/.hgtags	Tue Jan 20 10:22:43 2015 -0800
@@ -288,3 +288,4 @@
 40b242363040229a05224fbc5dc203a3f46a8f8f jdk9-b43
 0cb0844b58924d6086d2850c22087d06679d5eef jdk9-b44
 0dab3e848229127c7aca4c58b98e2d90ba70372f jdk9-b45
+74eaf7ad986576c792df4dbff05eed63e5727695 jdk9-b46
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,64 +23,59 @@
 
 package javax.xml.parsers.ptests;
 
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
-
 import java.io.File;
-import java.io.IOException;
-
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
+import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
 import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXResult;
-
+import jaxp.library.JAXPFileBaseTest;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
 
 /**
  * This tests DocumentBuilderFactory for namespace processing and no-namespace
  * processing.
  */
-public class DBFNamespaceTest {
+public class DBFNamespaceTest extends JAXPFileBaseTest {
 
     /**
      * Provide input for the cases that supporting namespace or not.
+     * @return a two-dimensional array contains factory, output file name and
+     *         golden validate file name.
      */
     @DataProvider(name = "input-provider")
     public Object[][] getInput() {
         DocumentBuilderFactory dbf1 = DocumentBuilderFactory.newInstance();
-        String outputfile1 = USER_DIR + FILE_SEP + "dbfnstest01.out";
-        String goldfile1 = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfnstest01GF.out";
+        String outputfile1 = USER_DIR + "dbfnstest01.out";
+        String goldfile1 = GOLDEN_DIR + "dbfnstest01GF.out";
 
         DocumentBuilderFactory dbf2 = DocumentBuilderFactory.newInstance();
         dbf2.setNamespaceAware(true);
-        String outputfile2 = USER_DIR + FILE_SEP + "dbfnstest02.out";
-        String goldfile2 = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfnstest02GF.out";
+        String outputfile2 = USER_DIR + "dbfnstest02.out";
+        String goldfile2 = GOLDEN_DIR + "dbfnstest02GF.out";
         return new Object[][] { { dbf1, outputfile1, goldfile1 }, { dbf2, outputfile2, goldfile2 } };
     }
 
     /**
      * Test to parse and transform a document without supporting namespace and
      * with supporting namespace.
+     * @param dbf a Document Builder factory for creating document object.
+     * @param outputfile output file name.
+     * @param goldfile golden validate file name.
+     * @throws Exception If any errors occur.
      */
     @Test(dataProvider = "input-provider")
-    public void testNamespaceTest(DocumentBuilderFactory dbf, String outputfile, String goldfile) {
-        try {
-            Document doc = dbf.newDocumentBuilder().parse(new File(TestUtils.XML_DIR, "namespace1.xml"));
-            dummyTransform(doc, outputfile);
-            assertTrue(compareWithGold(goldfile, outputfile));
-        } catch (SAXException | IOException | ParserConfigurationException | TransformerFactoryConfigurationError | TransformerException e) {
-            failUnexpected(e);
-        }
+    public void testNamespaceTest(DocumentBuilderFactory dbf, String outputfile,
+            String goldfile) throws Exception {
+        Document doc = dbf.newDocumentBuilder().parse(new File(XML_DIR, "namespace1.xml"));
+        dummyTransform(doc, outputfile);
+        assertTrue(compareWithGold(goldfile, outputfile));
     }
 
     /**
@@ -89,16 +84,14 @@
      * not chosen, namespaceURI in callbacks should be an empty string otherwise
      * it should be namespaceURI.
      *
-     * @throws TransformerFactoryConfigurationError
-     * @throws TransformerException
-     * @throws IOException
+     * @throws Exception If any errors occur.
      */
-    private void dummyTransform(Document document, String fileName) throws TransformerFactoryConfigurationError, TransformerException, IOException {
+    private void dummyTransform(Document document, String fileName)
+            throws Exception {
         DOMSource domSource = new DOMSource(document);
-        Transformer transformer = TransformerFactory.newInstance().newTransformer();
-        File file = new File(fileName);
-        System.out.println("The fileName is " + file.getAbsolutePath());
-        transformer.transform(domSource, new SAXResult(MyCHandler.newInstance(file)));
+        try(MyCHandler chandler = MyCHandler.newInstance(new File(fileName))) {
+            TransformerFactory.newInstance().newTransformer().
+                transform(domSource, new SAXResult(chandler));
+        }
     }
-
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,451 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.parsers.ptests;
-
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * This checks the methods of DocumentBuilderFactoryImpl
- */
-public class DocumentBuilderFactory01 {
-    /**
-     * Testcase to test the default functionality of schema support method.
-     */
-    @Test
-    public void testCheckSchemaSupport1() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            dbf.setNamespaceAware(true);
-            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "test.xml"));
-            assertFalse(eh.errorOccured);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the default functionality of schema support method. In
-     * this case the schema source property is set.
-     */
-    @Test
-    public void testCheckSchemaSupport2() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            dbf.setNamespaceAware(true);
-            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
-            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", new InputSource(new FileInputStream(
-                    new File(TestUtils.XML_DIR, "test.xsd"))));
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "test1.xml"));
-            assertFalse(eh.errorOccured);
-        } catch (IllegalArgumentException | ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase to test the default functionality of schema support method. In
-     * this case the schema source property is set.
-     */
-    @Test
-    public void testCheckSchemaSupport3() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            spf.setValidating(true);
-            spf.setNamespaceAware(true);
-            SAXParser sp = spf.newSAXParser();
-            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
-            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",
-                    new InputSource(new FileInputStream(new File(TestUtils.XML_DIR, "test.xsd"))));
-            DefaultHandler dh = new DefaultHandler();
-            sp.parse(new File(TestUtils.XML_DIR, "test1.xml"), dh);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the default functionality of newInstance method. To test
-     * the isCoalescing method and setCoalescing This checks to see if the CDATA
-     * and text nodes got combined In that case it will print "&lt;xml&gt;This
-     * is not parsed&lt;/xml&gt; yet".
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory02() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setCoalescing(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory01.xml"));
-            Element e = (Element) doc.getElementsByTagName("html").item(0);
-            NodeList nl = e.getChildNodes();
-            assertEquals(nl.item(0).getNodeValue().trim(), "<xml>This is not parsed</xml> yet");
-        } catch (IOException | SAXException | ParserConfigurationException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the isIgnoringComments. By default it is false.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory03() {
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        assertFalse(dbf.isIgnoringComments());
-    }
-
-    /**
-     * Testcase to test the isValidating. By default it is false, set it to true
-     * and then use a document which is not valid. It should throw a warning or
-     * an error at least. The test passes in case retval 0 is set in the error
-     * method .
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory04() {
-        try {
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory05.xml"));
-            assertTrue(eh.errorOccured);
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setValidating. By default it is false, use a
-     * document which is not valid. It should not throw a warning or an error.
-     * The test passes in case the retval equals 1 .
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory16() {
-        try {
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory05.xml"));
-            assertFalse(eh.errorOccured);
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase to test the setValidating. By default it is false, use a
-     * document which is valid. It should not throw a warning or an error. The
-     * test passes in case the retval equals 1.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory17() {
-        try {
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory04.xml"));
-            assertFalse(eh.errorOccured);
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * To test the isExpandEntityReferences. By default it is true.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory05() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
-            Element e = (Element) doc.getElementsByTagName("title").item(0);
-            NodeList nl = e.getChildNodes();
-            assertTrue(dbf.isExpandEntityReferences());
-            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the default functionality of setValidating method. The
-     * xml file has a DTD which has namespaces defined. The parser takes care to
-     * check if the namespaces using elements and defined attributes are there
-     * or not.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory06() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory04.xml"));
-            assertTrue(doc instanceof Document);
-            assertFalse(eh.errorOccured);
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase to test the setExpandEntityReferences.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory07() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setExpandEntityReferences(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
-            Element e = (Element) doc.getElementsByTagName("title").item(0);
-            NodeList nl = e.getChildNodes();
-            assertTrue(dbf.isExpandEntityReferences());
-            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setExpandEntityReferences.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory08() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setExpandEntityReferences(false);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
-            Element e = (Element) doc.getElementsByTagName("title").item(0);
-            NodeList nl = e.getChildNodes();
-            assertNull(nl.item(0).getNodeValue());
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setIgnoringComments. By default it is set to false.
-     * explicitly setting it to false, it recognizes the comment which is in
-     * Element Node Hence the Element's child node is not null.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory09() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setIgnoringComments(false);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")));
-            Element e = (Element) doc.getElementsByTagName("body").item(0);
-            NodeList nl = e.getChildNodes();
-            assertNotNull(nl.item(0).getNodeValue());
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * This tests for the parse(InputSource).
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory10() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new InputSource(new BufferedReader(new FileReader(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")))));
-            assertTrue(doc instanceof Document);
-        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse InputStream with SystemID as a second parameter.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory11() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "dbf10import.xsl")), new File(TestUtils.XML_DIR).toURI()
-                    .toASCIIString());
-            assertTrue(doc instanceof Document);
-        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse InputStream with empty SystemID as a second
-     * parameter.
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory12() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "dbf10import.xsl")), " ");
-            assertTrue(doc instanceof Document);
-        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse(uri).
-     */
-    @Test
-    public void testCheckDocumentBuilderFactory13() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new File(TestUtils.XML_DIR + FILE_SEP + "dbf10import.xsl").toURI().toASCIIString());
-            assertTrue(doc instanceof Document);
-        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse (uri) with empty string as parameter should
-     * throw Sax Exception.
-     *
-     * @throws SAXException
-     *             If any parse errors occur.
-     */
-    @Test(expectedExceptions = SAXException.class)
-    public void testCheckDocumentBuilderFactory14() throws SAXException {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            docBuilder.parse("");
-        } catch (ParserConfigurationException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * This tests for the parse (uri) with null uri as parameter should throw
-     * IllegalArgumentException.
-     *
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckDocumentBuilderFactory15() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            String uri = null;
-            docBuilder.parse(uri);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setIgnoringComments. By default it is set to false,
-     * setting this to true, It does not recognize the comment, Here the
-     * nodelist has a length 0 because the ignoring comments is true.
-     */
-    @Test
-    public void testCheckIgnoringComments() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setIgnoringComments(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory08.xml")));
-            Element e = (Element) doc.getElementsByTagName("body").item(0);
-            NodeList nl = e.getChildNodes();
-            assertEquals(nl.getLength(), 0);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase to test the default behaviour of setIgnoringComments. By default
-     * it is set to false, this is similar to case 9 but not setIgnoringComments
-     * explicitly, it does not recognize the comment.
-     */
-    @Test
-    public void testCheckIgnoringComments1() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")));
-            Element e = (Element) doc.getElementsByTagName("body").item(0);
-            NodeList nl = e.getChildNodes();
-            assertFalse(dbf.isIgnoringComments());
-            assertNotNull(nl.item(0).getNodeValue());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.parsers.ptests;
-
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXResult;
-
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * This tests the setIgnoringElementWhitespace and setIgnoringComments of
- * DocumentBuilderFactory
- */
-public class DocumentBuilderFactory02 {
-
-    /**
-     * This testcase tests for the isIgnoringElementContentWhitespace and the
-     * setIgnoringElementContentWhitespace. The xml file has all kinds of
-     * whitespace,tab and newline characters, it uses the MyNSContentHandler
-     * which does not invoke the characters callback when this
-     * setIgnoringElementContentWhitespace is set to true.
-     */
-    @Test
-    public void testCheckElementContentWhitespace() {
-        try {
-            String goldFile = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfactory02GF.out";
-            String outputFile = USER_DIR + FILE_SEP + "dbfactory02.out";
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            assertFalse(dbf.isIgnoringElementContentWhitespace());
-            dbf.setIgnoringElementContentWhitespace(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory06.xml"));
-            assertFalse(eh.errorOccured);
-            DOMSource domSource = new DOMSource(doc);
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            Transformer transformer = tfactory.newTransformer();
-            SAXResult saxResult = new SAXResult();
-            saxResult.setHandler(MyCHandler.newInstance(new File(outputFile)));
-            transformer.transform(domSource, saxResult);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException | IOException | TransformerException e) {
-            failUnexpected(e);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilePermission;
+import java.io.FileReader;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXResult;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * This checks the methods of DocumentBuilderFactoryImpl.
+ */
+public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
+    /**
+     * Test the default functionality of schema support method.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckSchemaSupport1() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        dbf.setNamespaceAware(true);
+        dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+                W3C_XML_SCHEMA_NS_URI);
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        db.parse(new File(XML_DIR, "test.xml"));
+        assertFalse(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the default functionality of schema support method. In
+     * this case the schema source property is set.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckSchemaSupport2() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "test.xsd"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            dbf.setNamespaceAware(true);
+            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+                    W3C_XML_SCHEMA_NS_URI);
+            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",
+                    new InputSource(fis));
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            db.setErrorHandler(eh);
+            db.parse(new File(XML_DIR, "test1.xml"));
+            assertFalse(eh.isErrorOccured());
+        }
+    }
+
+    /**
+     * Test the default functionality of schema support method. In
+     * this case the schema source property is set.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckSchemaSupport3() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "test.xsd"))) {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setValidating(true);
+            spf.setNamespaceAware(true);
+            SAXParser sp = spf.newSAXParser();
+            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+                    W3C_XML_SCHEMA_NS_URI);
+            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",
+                    new InputSource(fis));
+            DefaultHandler dh = new DefaultHandler();
+            // Not expect any unrecoverable error here.
+            sp.parse(new File(XML_DIR, "test1.xml"), dh);
+        }
+    }
+
+    /**
+     * Test the default functionality of newInstance method. To test
+     * the isCoalescing method and setCoalescing This checks to see if the CDATA
+     * and text nodes got combined In that case it will print "&lt;xml&gt;This
+     * is not parsed&lt;/xml&gt; yet".
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory02() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setCoalescing(true);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        Document doc = docBuilder.parse(new File(XML_DIR, "DocumentBuilderFactory01.xml"));
+        Element e = (Element) doc.getElementsByTagName("html").item(0);
+        NodeList nl = e.getChildNodes();
+        assertEquals(nl.getLength(), 1);
+    }
+
+    /**
+     * Test the isIgnoringComments. By default it is false.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory03() {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        assertFalse(dbf.isIgnoringComments());
+    }
+
+    /**
+     * Test the isValidating. By default it is false, set it to true and then
+     * use a document which is not valid. It should throw a warning or
+     * an error at least. The test passes in case retval 0 is set in the error
+     * method .
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory04() throws Exception {
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        db.parse(new File(XML_DIR, "DocumentBuilderFactory05.xml"));
+        assertTrue(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the setValidating. By default it is false, use a
+     * document which is not valid. It should not throw a warning or an error.
+     * The test passes in case the return value equals 1.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory16() throws Exception {
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        db.parse(new File(XML_DIR, "DocumentBuilderFactory05.xml"));
+        assertFalse(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the setValidating. By default it is false, use a
+     * document which is valid. It should not throw a warning or an error. The
+     * test passes in case the return value equals 1.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory17() throws Exception {
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        db.parse(new File(XML_DIR, "DocumentBuilderFactory04.xml"));
+        assertFalse(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the isExpandEntityReferences. By default it is true.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory05() throws Exception {
+        try(FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory02.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("title").item(0);
+            NodeList nl = e.getChildNodes();
+            assertTrue(dbf.isExpandEntityReferences());
+            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
+        }
+    }
+
+    /**
+     * Test the default functionality of setValidating method. The
+     * XML file has a DTD which has namespaces defined. The parser takes care to
+     * check if the namespaces using elements and defined attributes are there
+     * or not.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory06() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        db.setErrorHandler(eh);
+        Document doc = db.parse(new File(XML_DIR, "DocumentBuilderFactory04.xml"));
+        assertTrue(doc instanceof Document);
+        assertFalse(eh.isErrorOccured());
+    }
+
+    /**
+     * Test the setExpandEntityReferences.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory07() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory02.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setExpandEntityReferences(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("title").item(0);
+            NodeList nl = e.getChildNodes();
+            assertTrue(dbf.isExpandEntityReferences());
+            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
+        }
+    }
+
+    /**
+     * Test the setExpandEntityReferences.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory08() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory02.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setExpandEntityReferences(false);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("title").item(0);
+            NodeList nl = e.getChildNodes();
+            assertNull(nl.item(0).getNodeValue());
+        }
+    }
+
+    /**
+     * Test the setIgnoringComments. By default it is set to false.
+     * explicitly setting it to false, it recognizes the comment which is in
+     * Element Node Hence the Element's child node is not null.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory09() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory07.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setIgnoringComments(false);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("body").item(0);
+            NodeList nl = e.getChildNodes();
+            assertNotNull(nl.item(0).getNodeValue());
+        }
+    }
+
+    /**
+     * This tests for the parse(InputSource).
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory10() throws Exception {
+        try (BufferedReader br = new BufferedReader(new FileReader(new File(
+                XML_DIR, "DocumentBuilderFactory07.xml")))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new InputSource(br));
+            assertNotNull(doc);
+        }
+    }
+
+    /**
+     * This tests for the parse InputStream with SystemID as a second parameter.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory11() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "dbf10import.xsl"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis, new File(XML_DIR).toURI()
+                    .toASCIIString());
+            assertNotNull(doc);
+        }
+    }
+
+    /**
+     * This tests for the parse InputStream with empty SystemID as a second
+     * parameter.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory12() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "dbf10import.xsl"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis, " ");
+            assertNotNull(doc);
+        }
+    }
+
+    /**
+     * This tests for the parse(uri).
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory13() throws Exception {
+        // Accesing default working directory.
+        String workingDir = getSystemProperty("user.dir");
+        setPermissions(new FilePermission(workingDir + "/*", "read"));
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        Document doc = docBuilder.parse(new File(XML_DIR + "dbf10import.xsl")
+                .toURI().toASCIIString());
+        assertNotNull(doc);
+    }
+
+    /**
+     * This tests for the parse(uri) with empty string as parameter should
+     * throw Sax Exception.
+     * @throws Exception If any errors occur.
+     */
+    @Test(expectedExceptions = SAXException.class)
+    public void testCheckDocumentBuilderFactory14() throws Exception {
+        // Accesing default working directory.
+        String workingDir = getSystemProperty("user.dir");
+        setPermissions(new FilePermission(workingDir, "read"));
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        docBuilder.parse("");
+    }
+
+    /**
+     * This tests for the parse (uri) with null uri as parameter should throw
+     * IllegalArgumentException.
+     * @throws Exception If any errors occur.
+     *
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testCheckDocumentBuilderFactory15() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        String uri = null;
+        docBuilder.parse(uri);
+    }
+
+    /**
+     * Test the setIgnoringComments. By default it is set to false,
+     * setting this to true, It does not recognize the comment, Here the
+     * nodelist has a length 0 because the ignoring comments is true.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckIgnoringComments() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory08.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setIgnoringComments(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("body").item(0);
+            NodeList nl = e.getChildNodes();
+            assertEquals(nl.getLength(), 0);
+        }
+    }
+
+    /**
+     * Test the default behaviour of setIgnoringComments. By default
+     * it is set to false, this is similar to case 9 but not setIgnoringComments
+     * explicitly, it does not recognize the comment.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckIgnoringComments1() throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(
+                XML_DIR, "DocumentBuilderFactory07.xml"))) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(fis);
+            Element e = (Element) doc.getElementsByTagName("body").item(0);
+            NodeList nl = e.getChildNodes();
+            assertFalse(dbf.isIgnoringComments());
+            assertNotNull(nl.item(0).getNodeValue());
+        }
+    }
+
+    /**
+     * Test for the isIgnoringElementContentWhitespace and the
+     * setIgnoringElementContentWhitespace. The xml file has all kinds of
+     * whitespace,tab and newline characters, it uses the MyNSContentHandler
+     * which does not invoke the characters callback when this
+     * setIgnoringElementContentWhitespace is set to true.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testCheckElementContentWhitespace() throws Exception {
+        String goldFile = GOLDEN_DIR + "dbfactory02GF.out";
+        String outputFile = USER_DIR + "dbfactory02.out";
+        MyErrorHandler eh = MyErrorHandler.newInstance();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        assertFalse(dbf.isIgnoringElementContentWhitespace());
+        dbf.setIgnoringElementContentWhitespace(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        db.setErrorHandler(eh);
+        Document doc = db.parse(new File(XML_DIR, "DocumentBuilderFactory06.xml"));
+        assertFalse(eh.isErrorOccured());
+        DOMSource domSource = new DOMSource(doc);
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        Transformer transformer = tfactory.newTransformer();
+        SAXResult saxResult = new SAXResult();
+        try(MyCHandler handler = MyCHandler.newInstance(new File(outputFile))) {
+            saxResult.setHandler(handler);
+            transformer.transform(domSource, saxResult);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,33 +24,32 @@
 package javax.xml.parsers.ptests;
 
 import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertFalse;
-
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.IOException;
-
+import java.io.FilePermission;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
-
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
+import static org.testng.Assert.assertNotNull;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
-import org.w3c.dom.Document;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * This checks for the methods of DocumentBuilder
  */
-public class DocumentBuilderImpl01 implements EntityResolver {
-
+public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
+            implements EntityResolver {
     /**
      * Provide DocumentBuilder.
      *
-     * @throws ParserConfigurationException
+     * @return data provider has single DocumentBuilder.
+     * @throws ParserConfigurationException if a DocumentBuilder cannot be
+     *         created which satisfies the configuration requested.
      */
     @DataProvider(name = "builder-provider")
     public Object[][] getBuilder() throws ParserConfigurationException {
@@ -60,17 +59,18 @@
     }
 
     /**
-     * Testcase to test the default functionality of isValidation method. Expect
+     * Test the default functionality of isValidation method. Expect
      * to return false because not setting the validation.
+     * @param docBuilder document builder instance.
      */
     @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl01(DocumentBuilder docBuilder) {
         assertFalse(docBuilder.isValidating());
-
     }
 
     /**
-     * Testcase to test the default functionality of isNamespaceAware method.
+     * Test the default functionality of isNamespaceAware method.
+     * @param docBuilder document builder instance.
      */
     @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl02(DocumentBuilder docBuilder) {
@@ -78,51 +78,71 @@
     }
 
     /**
-     * Testcase to test the parse(InputStream).
+     * Test the parse(InputStream).
+     * @param docBuilder document builder instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "builder-provider")
-    public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder) {
-        try {
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderImpl01.xml")));
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder)
+            throws Exception {
+        try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
+                "DocumentBuilderImpl01.xml"))) {
+            assertNotNull(docBuilder.parse(fis));
         }
     }
 
     /**
-     * Testcase to test the parse(File).
+     * Test the parse(File).
+     *
+     * @param docBuilder document builder instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "builder-provider")
-    public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder) {
-        try {
-            Document doc = docBuilder.parse(new File(TestUtils.XML_DIR, "DocumentBuilderImpl01.xml"));
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder)
+            throws Exception {
+        assertNotNull(docBuilder.parse(new File(XML_DIR,
+                "DocumentBuilderImpl01.xml")));
+    }
+
+    /**
+     * Test the parse(InputStream,systemId).
+     * @param docBuilder document builder instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder)
+            throws Exception {
+        setPermissions(new FilePermission(XML_DIR + "../-",
+                "read"));
+        try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
+                "DocumentBuilderImpl02.xml"))) {
+            assertNotNull(docBuilder.parse(fis, new File(XML_DIR).toURI()
+                    .toASCIIString() + FILE_SEP));
         }
     }
 
     /**
-     * Testcase to test the parse(InputStream,systemId).
-     */
-    @Test(dataProvider = "builder-provider")
-    public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder) {
-        try {
-            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderImpl02.xml")), new File(TestUtils.XML_DIR).toURI()
-                    .toASCIIString() + FILE_SEP);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the setEntityResolver.
+     * Test the setEntityResolver.
+     * @param docBuilder document builder instance.
      */
     @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl07(DocumentBuilder docBuilder) {
         docBuilder.setEntityResolver(this);
-        resolveEntity("publicId", "http://www.myhost.com/today");
+        assertNotNull(resolveEntity("publicId", "http://www.myhost.com/today"));
     }
 
+    /**
+     * Allow the application to resolve external entities.
+     *
+     * @param publicId The public identifier of the external entity
+     *        being referenced, or null if none was supplied.
+     * @param systemId The system identifier of the external entity
+     *        being referenced.
+     * @return An InputSource object describing the new input source,
+     *         or null to request that the parser open a regular
+     *         URI connection to the system identifier.
+     */
+    @Override
     public InputSource resolveEntity(String publicId, String systemId) {
         if (systemId.equals("http://www.myhost.com/today"))
             return new InputSource(systemId);
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPBaseTest;
 
 import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeTest;
@@ -35,7 +36,7 @@
  * Class containing the test cases for SAXParserFactory/DocumentBuilderFactory
  * newInstance methods.
  */
-public class FactoryConfErrorTest {
+public class FactoryConfErrorTest extends JAXPBaseTest {
 
     /**
      * Set properties DocumentBuilderFactory and SAXParserFactory to invalid
@@ -43,8 +44,8 @@
      */
     @BeforeTest
     public void setup() {
-        System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "xx");
-        System.setProperty("javax.xml.parsers.SAXParserFactory", "xx");
+        setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", "xx");
+        setSystemProperty("javax.xml.parsers.SAXParserFactory", "xx");
     }
 
     /**
@@ -53,8 +54,8 @@
      */
     @AfterTest
     public void cleanup() {
-        System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
-        System.clearProperty("javax.xml.parsers.SAXParserFactory");
+        setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", null);
+        setSystemProperty("javax.xml.parsers.SAXParserFactory", null);
     }
 
     /**
@@ -67,7 +68,7 @@
     }
 
     /**
-     * To test exeception thrown if javax.xml.parsers.DocumentBuilderFactory is
+     * To test exception thrown if javax.xml.parsers.DocumentBuilderFactory is
      * invalid.
      */
     @Test(expectedExceptions = FactoryConfigurationError.class)
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,24 +22,16 @@
  */
 
 package javax.xml.parsers.ptests;
-
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-
+import jaxp.library.JAXPBaseTest;
 import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
 
 /**
- * Class containing the test cases for SAXParserFactory API
+ * Class containing the test cases for SAXParserFactory API.
  */
-public class SAXParserFactTest {
+public class SAXParserFactTest extends JAXPBaseTest {
 
     private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
     private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
@@ -49,20 +41,17 @@
     private static final String EXTERNAL_P_ENTITIES = "http://xml.org/sax/features/external-parameter-entities";
 
     /**
-     * Testcase to test if newSAXParser() method returns SAXParser.
+     * Test if newSAXParser() method returns SAXParser.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testParser01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            SAXParser saxparser = spf.newSAXParser();
-        } catch (ParserConfigurationException | SAXException e) {
-            failUnexpected(e);
-        }
+    public void testParser01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.newSAXParser();
     }
 
     /**
-     * Testcase to test the default functionality (No validation) of the parser.
+     * Test the default functionality (No validation) of the parser.
      */
     @Test
     public void testValidate01() {
@@ -71,7 +60,7 @@
     }
 
     /**
-     * Testcase to test the functionality of setValidating and isvalidating
+     * Test the functionality of setValidating and isvalidating
      * methods.
      */
     @Test
@@ -82,7 +71,7 @@
     }
 
     /**
-     * Parser should not be namespaceaware by default.
+     * Parser should not be namespace-aware by default.
      */
     @Test
     public void testNamespace01() {
@@ -91,7 +80,7 @@
     }
 
     /**
-     * Testcase to test the functionality of setNamespaceAware and
+     * Test the functionality of setNamespaceAware and
      * isNamespaceAware methods.
      */
     @Test
@@ -102,167 +91,132 @@
     }
 
     /**
-     * Testcase to test the functionality of setNamespaceAware and getFeature()
+     * Test the functionality of setNamespaceAware and getFeature()
      * methods for namespaces property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertFalse(spf.getFeature(NAMESPACES));
+    public void testFeature01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertFalse(spf.getFeature(NAMESPACES));
 
-            spf.setNamespaceAware(true);
-            assertTrue(spf.getFeature(NAMESPACES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+        spf.setNamespaceAware(true);
+        assertTrue(spf.getFeature(NAMESPACES));
     }
 
     /**
-     * Testcase to test the functionality of setFeature and getFeature methods
+     * Test the functionality of setFeature and getFeature methods
      * for namespaces property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
+    public void testFeature02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
 
-            spf.setFeature(NAMESPACES, true);
-            assertTrue(spf.getFeature(NAMESPACES));
+        spf.setFeature(NAMESPACES, true);
+        assertTrue(spf.getFeature(NAMESPACES));
 
-            spf.setFeature(NAMESPACES, false);
-            assertFalse(spf.getFeature(NAMESPACES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+        spf.setFeature(NAMESPACES, false);
+        assertFalse(spf.getFeature(NAMESPACES));
     }
 
     /**
-     * Testcase to test the functionality of setFeature and getFeature methods
+     * Test the functionality of setFeature and getFeature methods
      * for namespace-prefixes property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature03() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
+    public void testFeature03() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
 
-            spf.setFeature(NAMESPACE_PREFIXES, true);
-            assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+        spf.setFeature(NAMESPACE_PREFIXES, true);
+        assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
 
-            spf.setFeature(NAMESPACE_PREFIXES, false);
-            assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+        spf.setFeature(NAMESPACE_PREFIXES, false);
+        assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
-     * Testcase to test the functionality of getFeature method for
+     * Test the functionality of getFeature method for
      * string-interning property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature04() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertTrue(spf.getFeature(STRING_INTERNING));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+    public void testFeature04() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertTrue(spf.getFeature(STRING_INTERNING));
     }
 
     /**
-     * Testcase to test the functionality of getFeature and setValidating
+     * Test the functionality of getFeature and setValidating
      * methods for validation property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature05() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertFalse(spf.getFeature(VALIDATION));
-            spf.setValidating(true);
-            assertTrue(spf.getFeature(VALIDATION));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
-
+    public void testFeature05() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertFalse(spf.getFeature(VALIDATION));
+        spf.setValidating(true);
+        assertTrue(spf.getFeature(VALIDATION));
     }
 
     /**
-     * Testcase to test the functionality of setFeature and getFeature methods
+     * Test the functionality of setFeature and getFeature methods
      * for validation property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature06() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-
-            spf.setFeature(VALIDATION, true);
-            assertTrue(spf.getFeature(VALIDATION));
-
-            spf.setFeature(VALIDATION, false);
-            assertFalse(spf.getFeature(VALIDATION));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
-
+    public void testFeature06() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setFeature(VALIDATION, true);
+        assertTrue(spf.getFeature(VALIDATION));
+        spf.setFeature(VALIDATION, false);
+        assertFalse(spf.getFeature(VALIDATION));
     }
 
     /**
-     * Testcase to test the functionality of getFeature method for
+     * Test the functionality of getFeature method for
      * external-general-entities property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature07() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertTrue(spf.getFeature(EXTERNAL_G_ENTITIES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+    public void testFeature07() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertTrue(spf.getFeature(EXTERNAL_G_ENTITIES));
+    }
 
+    /**
+     * Test the functionality of setFeature and getFeature methods
+     * for external-general-entities property.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testFeature08() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setFeature(EXTERNAL_G_ENTITIES, false);
+        assertFalse(spf.getFeature(EXTERNAL_G_ENTITIES));
     }
 
     /**
-     * Testcase to test the functionality of setFeature and getFeature methods
-     * for external-general-entities property.
+     * Test the functionality of getFeature method for
+     * external-parameter-entities property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature08() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setFeature(EXTERNAL_G_ENTITIES, false);
-            assertFalse(spf.getFeature(EXTERNAL_G_ENTITIES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
+    public void testFeature09() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertTrue(spf.getFeature(EXTERNAL_P_ENTITIES));
     }
 
     /**
-     * Testcase to test the functionality of getFeature method for
-     * external-parameter-entities property.
+     * Test the functionality of setFeature method for
+     * external-parameter-entitie property.
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testFeature09() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertTrue(spf.getFeature(EXTERNAL_P_ENTITIES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase to test the functionality of setFeature method for
-     * external-parameter-entitie property.
-     */
-    @Test
-    public void testFeature10() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setFeature(EXTERNAL_P_ENTITIES, false);
-        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
-            failUnexpected(e);
-        }
-
+    public void testFeature10() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setFeature(EXTERNAL_P_ENTITIES, false);
+        assertFalse(spf.getFeature(EXTERNAL_P_ENTITIES));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,16 +23,14 @@
 
 package javax.xml.parsers.ptests;
 
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FilePermission;
 import java.io.IOException;
-
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import org.xml.sax.HandlerBase;
@@ -43,16 +41,15 @@
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest {
-
+public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
     /**
      * Provide SAXParser.
      *
-     * @throws SAXException
-     * @throws ParserConfigurationException
+     * @return a data provider contains a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
     @DataProvider(name = "parser-provider")
-    public Object[][] getParser() throws ParserConfigurationException, SAXException {
+    public Object[][] getParser() throws Exception {
         SAXParserFactory spf = SAXParserFactory.newInstance();
         SAXParser saxparser = spf.newSAXParser();
         return new Object[][] { { saxparser } };
@@ -62,498 +59,454 @@
      * Test case with FileInputStream null, parsing should fail and throw
      * IllegalArgumentException.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse01(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            FileInputStream instream = null;
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(instream, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse01(SAXParser saxparser) throws Exception {
+        FileInputStream instream = null;
+        saxparser.parse(instream, new HandlerBase());
     }
 
     /**
-     * Testcase with an error in xml file, parsing should fail and throw
-     * SAXException.
+     * Test with by setting URI as null, parsing should fail and throw
+     * IllegalArgumentException.
      *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse02(SAXParser saxparser) throws SAXException {
-        try {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
-            saxparser.parse(instream, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
-        }
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse02(SAXParser saxparser) throws Exception {
+        String uri = null;
+        saxparser.parse(uri, new HandlerBase());
     }
 
     /**
-     * Testcase with a valid in xml file, parser should parse the xml document.
+     * Test with non-existence URI, parsing should fail and throw IOException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse03(SAXParser saxparser) {
+    @Test(expectedExceptions = { SAXException.class },
+            dataProvider = "parser-provider")
+    public void testParse03(SAXParser saxparser) throws Exception {
+        String workingDir = getSystemProperty("user.dir");
+        setPermissions(new FilePermission(workingDir, "read"));
         try {
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
-        } catch (IOException | SAXException e) {
-            failUnexpected(e);
+            saxparser.parse("", new HandlerBase());
+        } finally {
+            setPermissions();
         }
     }
 
     /**
-     * Testcase with valid input stream, parser should parse the xml document
-     * successfully.
+     * Test with File null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse04(SAXParser saxparser) {
-        try {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
-            saxparser.parse(instream, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse04(SAXParser saxparser) throws Exception {
+        File file = null;
+        saxparser.parse(file, new HandlerBase());
     }
 
     /**
-     * Testcase with valid input source, parser should parse the xml document
-     * successfully.
+     * Test with empty string as File, parsing should fail and throw
+     * SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse05(SAXParser saxparser) {
+    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+    public void testParse05(SAXParser saxparser) throws Exception {
+        String workingDir = getSystemProperty("user.dir");
+        setPermissions(new FilePermission(workingDir, "read"));
         try {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "parsertest.xml"));
-            saxparser.parse(instream, handler, new File(TestUtils.XML_DIR).toURI().toASCIIString());
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with uri null, parsing should fail and throw
-     * IllegalArgumentException.
-     *
-     * @throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse07(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            String uri = null;
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(uri, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+            saxparser.parse(new File(""), new HandlerBase());
+        } finally {
+            setPermissions();
         }
     }
 
     /**
-     * Testcase with non-existant uri, parsing should fail and throw
-     * IOException.
+     * Test with input source null, parsing should fail and throw
+     * IllegalArgumentException.
      *
-     * @throws SAXException
-     * @throws IOException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
-    public void testParse08(SAXParser saxparser) throws SAXException, IOException {
-        String uri = " ";
-
-        HandlerBase handler = new HandlerBase();
-        saxparser.parse(uri, handler);
-
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse06(SAXParser saxparser) throws Exception {
+        InputSource is = null;
+        saxparser.parse(is, new HandlerBase());
     }
 
     /**
-     * Testcase with proper uri, parser should parse successfully.
+     * Test with FileInputStream null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse09(SAXParser saxparser) {
-        try {
-            File file = new File(TestUtils.XML_DIR, "correct.xml");
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(file.toURI().toASCIIString(), handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse07(SAXParser saxparser) throws Exception {
+        FileInputStream instream = null;
+        saxparser.parse(instream, new DefaultHandler());
     }
 
     /**
-     * Testcase with File null, parsing should fail and throw
+     * Test with URI null, parsing should fail and throw
      * IllegalArgumentException.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse10(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            File file = null;
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(file, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse08(SAXParser saxparser) throws Exception {
+        String uri = null;
+        saxparser.parse(uri, new DefaultHandler());
     }
 
     /**
-     * Testcase with empty string as File, parsing should fail and throw
-     * SAXException.
+     * Test with non-existence URI, parsing should fail and throw
+     * SAXException or IOException.
      *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse11(SAXParser saxparser) throws SAXException {
+    @Test(expectedExceptions = { SAXException.class, IOException.class },
+            dataProvider = "parser-provider")
+    public void testParse09(SAXParser saxparser) throws Exception {
+        String workingDir = getSystemProperty("user.dir");
+        setPermissions(new FilePermission(workingDir + "/../-", "read"));
+        String uri = " ";
         try {
-            HandlerBase handler = new HandlerBase();
-            File file = new File("");
-            saxparser.parse(file, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
+            saxparser.parse(uri, new DefaultHandler());
+        } finally {
+            setPermissions();
         }
     }
 
     /**
-     * Testcase with xml file that has errors parsing should fail and throw
+     * Test with empty string as File, parsing should fail and throw
      * SAXException.
      *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse12(SAXParser saxparser) throws SAXException {
+    public void testParse10(SAXParser saxparser) throws Exception {
+        String workingDir = getSystemProperty("user.dir");
+        setPermissions(new FilePermission(workingDir, "read"));
+        File file = new File("");
         try {
-            HandlerBase handler = new HandlerBase();
-            File file = new File(TestUtils.XML_DIR, "valid.xml");
-            saxparser.parse(file, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
+            saxparser.parse(file, new DefaultHandler());
+        } finally {
+            setPermissions();
         }
     }
 
     /**
-     * Testcase with xml file that has no errors Parser should successfully
-     * parse the xml document.
+     * Test with File null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse13(SAXParser saxparser) {
-        try {
-            HandlerBase handler = new HandlerBase();
-            File file = new File(TestUtils.XML_DIR, "correct.xml");
-            saxparser.parse(file, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse11(SAXParser saxparser) throws Exception {
+        saxparser.parse((File) null, new DefaultHandler());
     }
 
     /**
-     * Testcase with input source null, parsing should fail and throw
+     * Test with input source null, parsing should fail and throw
      * IllegalArgumentException.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse14(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            InputSource is = null;
-            HandlerBase handler = new HandlerBase();
-            saxparser.parse(is, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(expectedExceptions = IllegalArgumentException.class,
+            dataProvider = "parser-provider")
+    public void testParse12(SAXParser saxparser) throws Exception {
+        InputSource is = null;
+        saxparser.parse(is, new DefaultHandler());
+    }
+
+    /**
+     * Test with an error in XML file, parsing should fail and throw
+     * SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse13(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(new File(
+                XML_DIR, "invalid.xml"))) {
+            saxparser.parse(instream, new HandlerBase());
         }
     }
 
     /**
-     * Testcase with input source attached an invaild xml, parsing should fail
-     * and throw SAXException.
+     * Test with a valid in XML file, parser should parse the XML document.
      *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse15(SAXParser saxparser) throws SAXException {
-        try {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
-            InputSource is = new InputSource(instream);
-            saxparser.parse(is, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
-        }
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse14(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "parsertest.xml"),
+                new HandlerBase());
     }
 
     /**
-     * Testcase with input source attached an vaild xml, parser should
-     * successfully parse the xml document.
+     * Test with valid input stream, parser should parse the XML document
+     * successfully.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse16(SAXParser saxparser) {
-        try {
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
-            InputSource is = new InputSource(instream);
-            saxparser.parse(is, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse15(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
+                "correct.xml"))) {
+            saxparser.parse(instream, new HandlerBase());
         }
     }
 
     /**
-     * Testcase with FileInputStream null, parsing should fail and throw
-     * IllegalArgumentException.
+     * Test with valid input source, parser should parse the XML document
+     * successfully.
      *
-     * @throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse17(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            FileInputStream instream = null;
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(instream, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with an error in xml file, parsing should fail and throw
-     * SAXException.
-     *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse18(SAXParser saxparser) throws SAXException {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
-            saxparser.parse(instream, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with valid input stream, parser should parse the xml document
-     * successfully.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse19(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
-        } catch (IOException | SAXException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse16(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "parsertest.xml"))) {
+            saxparser.parse(instream, new HandlerBase(),
+                    new File(XML_DIR).toURI().toASCIIString());
         }
     }
 
     /**
-     * Testcase with valid input stream, parser should parse the xml document
-     * successfully.
+     * Test with proper URI, parser should parse successfully.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse17(SAXParser saxparser) throws Exception {
+        File file = new File(XML_DIR, "correct.xml");
+        saxparser.parse(file.toURI().toASCIIString(), new HandlerBase());
+    }
+
+    /**
+     * Test with XML file that has errors parsing should fail and throw
+     * SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse20(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
-            saxparser.parse(instream, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse18(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "valid.xml"), new HandlerBase());
+    }
+
+    /**
+     * Test with XML file that has no errors Parser should successfully
+     * parse the XML document.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse19(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "correct.xml"), new HandlerBase());
+    }
+
+    /**
+     * Test with input source attached an invalid XML, parsing should fail
+     * and throw SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse20(SAXParser saxparser) throws Exception {
+        try(FileInputStream instream = new FileInputStream(new File(XML_DIR,
+                "invalid.xml"))) {
+            saxparser.parse(new InputSource(instream), new HandlerBase());
         }
     }
 
     /**
-     * Testcase with valid input source, parser should parse the xml document
-     * successfully.
+     * Test with input source attached an valid XML, parser should
+     * successfully parse the XML document.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse21(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "parsertest.xml"));
-            saxparser.parse(instream, handler, new File(TestUtils.XML_DIR).toURI().toASCIIString());
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-
-    }
-
-    /**
-     * Testcase with uri null, parsing should fail and throw
-     * IllegalArgumentException.
-     *
-     * @throws IllegalArgumentException
-     */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse23(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            String uri = null;
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(uri, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse21(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
+                "correct.xml"))) {
+            saxparser.parse(new InputSource(instream), new HandlerBase());
         }
     }
 
     /**
-     * Testcase with non-existant uri, parsing should fail and throw
-     * SAXException or IOException.
+     * Test with an error in xml file, parsing should fail and throw
+     * SAXException.
      *
-     * @throws SAXException
-     * @throws IOException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
-    public void testParse24(SAXParser saxparser) throws SAXException, IOException {
-        String uri = " ";
-        DefaultHandler handler = new DefaultHandler();
-        saxparser.parse(uri, handler);
-
-    }
-
-    /**
-     * Testcase with proper uri, parser should parse successfully.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse25(SAXParser saxparser) {
-        try {
-            File file = new File(TestUtils.XML_DIR, "correct.xml");
-
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(file.toURI().toASCIIString(), handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse22(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "invalid.xml"))) {
+            saxparser.parse(instream, new DefaultHandler());
         }
     }
 
     /**
-     * Testcase with File null, parsing should fail and throw
-     * IllegalArgumentException.
+     * Test with valid input stream, parser should parse the XML document
+     * successfully.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse26(SAXParser saxparser) throws IllegalArgumentException {
-        try {
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse23(SAXParser saxparser) throws Exception {
+        DefaultHandler handler = new DefaultHandler();
+        saxparser.parse(new File(XML_DIR, "parsertest.xml"), handler);
+    }
+
+    /**
+     * Test with valid input stream, parser should parse the XML document
+     * successfully.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse24(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
+                "correct.xml"))) {
             DefaultHandler handler = new DefaultHandler();
-            saxparser.parse((File) null, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+            saxparser.parse(instream, handler);
         }
     }
 
     /**
-     * Testcase with empty string as File, parsing should fail and throw
-     * SAXException.
+     * Test with valid input source, parser should parse the XML document
+     * successfully.
      *
-     * @throws SAXException
-     */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse27(SAXParser saxparser) throws SAXException {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            File file = new File("");
-            saxparser.parse(file, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with xml file that has errors, parsing should fail and throw
-     * SAXException.
-     *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse28(SAXParser saxparser) throws SAXException {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            File file = new File(TestUtils.XML_DIR, "valid.xml");
-            saxparser.parse(file, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Testcase with xml file that has no errors, parser should successfully
-     * parse the xml document.
-     */
-    @Test(dataProvider = "parser-provider")
-    public void testParse29(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            File file = new File(TestUtils.XML_DIR, "correct.xml");
-            saxparser.parse(file, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse25(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "parsertest.xml"))) {
+            saxparser.parse(instream, new DefaultHandler(),
+                new File(XML_DIR).toURI().toASCIIString());
         }
     }
 
     /**
-     * Testcase with input source null, parsing should fail and throw
-     * IllegalArgumentException.
+     * Test with proper URI, parser should parse successfully.
      *
-     * @throws IllegalArgumentException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse26(SAXParser saxparser) throws Exception {
+        File file = new File(XML_DIR, "correct.xml");
+        saxparser.parse(file.toURI().toASCIIString(), new DefaultHandler());
+    }
+
+    /**
+     * Test with XML file that has errors, parsing should fail and throw
+     * SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
-    public void testParse30(SAXParser saxparser) throws IllegalArgumentException {
-        try {
-            InputSource is = null;
-            DefaultHandler handler = new DefaultHandler();
-            saxparser.parse(is, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse27(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "valid.xml"), new DefaultHandler());
+    }
+
+    /**
+     * Test with XML file that has no errors, parser should successfully
+     * parse the XML document.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse28(SAXParser saxparser) throws Exception {
+        saxparser.parse(new File(XML_DIR, "correct.xml"), new DefaultHandler());
+    }
+
+    /**
+     * Test with an invalid XML file, parser should throw SAXException.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+            dataProvider = "parser-provider")
+    public void testParse29(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "invalid.xml"))) {
+            saxparser.parse(new InputSource(instream), new DefaultHandler());
         }
     }
 
     /**
-     * Testcase with an invalid xml file, parser should throw SAXException.
+     * Test case to parse an XML file that not use namespaces.
      *
-     * @throws SAXException
+     * @param saxparser a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
-    public void testParse31(SAXParser saxparser) throws SAXException {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
-            InputSource is = new InputSource(instream);
-            saxparser.parse(is, handler);
-        } catch (IOException e) {
-            failUnexpected(e);
+    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    public void testParse30(SAXParser saxparser) throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "correct.xml"))) {
+            saxparser.parse(new InputSource(instream), new DefaultHandler());
         }
     }
 
     /**
-     * Test case to parse an xml file that not use namespaces.
+     * Test case to parse an XML file that uses namespaces.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "parser-provider")
-    public void testParse32(SAXParser saxparser) {
-        try {
-            DefaultHandler handler = new DefaultHandler();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
-            InputSource is = new InputSource(instream);
-            saxparser.parse(is, handler);
-        } catch (SAXException | IOException e) {
-            failUnexpected(e);
-        }
-    }
-
-    /**
-     * Test case to parse an xml file that uses namespaces.
-     */
-    @Test
-    public void testParse33() {
-        try {
+    @Test(groups = {"readLocalFiles"})
+    public void testParse31() throws Exception {
+        try (FileInputStream instream = new FileInputStream(
+                new File(XML_DIR, "ns4.xml"))) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
             spf.setNamespaceAware(true);
-            SAXParser saxparser = spf.newSAXParser();
-            HandlerBase handler = new HandlerBase();
-            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "ns4.xml"));
-            saxparser.parse(instream, handler);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
+            spf.newSAXParser().parse(instream, new HandlerBase());
         }
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,260 +23,239 @@
 
 package javax.xml.parsers.ptests;
 
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-
+import jaxp.library.JAXPBaseTest;
+import static org.testng.Assert.assertNotNull;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
-import org.xml.sax.Parser;
 import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.XMLReader;
 import org.xml.sax.ext.DeclHandler;
 import org.xml.sax.ext.LexicalHandler;
 
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest02 {
-    final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
-    final String XML_STRING = "http://xml.org/sax/properties/xml-string";
-    final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
-    final String LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler";
+public class SAXParserTest02 extends JAXPBaseTest {
+    private static final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
+    private static final String XML_STRING = "http://xml.org/sax/properties/xml-string";
+    private static final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
+    private static final String LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler";
 
     /**
      * Provide SAXParser.
      *
-     * @throws SAXException
-     * @throws ParserConfigurationException
+     * @return a data provider contains a SAXParser instance.
+     * @throws Exception If any errors occur.
      */
     @DataProvider(name = "parser-provider")
-    public Object[][] getParser() throws ParserConfigurationException, SAXException {
+    public Object[][] getParser() throws Exception {
         SAXParserFactory spf = SAXParserFactory.newInstance();
         SAXParser saxparser = spf.newSAXParser();
         return new Object[][] { { saxparser } };
     }
 
     /**
-     * Testcase to test the default functionality (No validation) of the parser.
+     * Test to test the default functionality (No validation) of the parser.
+     *
+     * @param saxparser a SAXParser instance.
      */
     @Test(dataProvider = "parser-provider")
     public void testValidate01(SAXParser saxparser) {
-        try {
-            assertFalse(saxparser.isValidating());
-        } catch (FactoryConfigurationError e) {
-            failUnexpected(e);
-        }
-
+        assertFalse(saxparser.isValidating());
     }
 
     /**
-     * Testcase to test the functionality of setValidating and isvalidating
+     * Test to test the functionality of setValidating and isValidating
      * methods.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testValidate02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setValidating(true);
-            spf.newSAXParser();
-            assertTrue(spf.isValidating());
-        } catch (FactoryConfigurationError | ParserConfigurationException | SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testValidate02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setValidating(true);
+        spf.newSAXParser();
+        assertTrue(spf.isValidating());
     }
 
     /**
-     * Test case to test isNamespaceAware() method. By default, namespaces are
+     * Test isNamespaceAware() method. By default, namespaces are
      * not supported.
+     *
+     * @param saxparser a SAXParser instance.
      */
     @Test(dataProvider = "parser-provider")
     public void testNamespace01(SAXParser saxparser) {
-        try {
-            assertFalse(saxparser.isNamespaceAware());
-        } catch (FactoryConfigurationError e) {
-            failUnexpected(e);
-        }
-
+        assertFalse(saxparser.isNamespaceAware());
     }
 
     /**
      * Test case to test setnamespaceAware() method.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testNamespace02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxparser = spf.newSAXParser();
-            assertTrue(saxparser.isNamespaceAware());
-        } catch (FactoryConfigurationError | ParserConfigurationException | SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testNamespace02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        SAXParser saxparser = spf.newSAXParser();
+        assertTrue(saxparser.isNamespaceAware());
     }
 
     /**
      * Test case to test if the getParser() method returns instance of Parser.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testParser01(SAXParser saxparser) {
-        try {
-            Parser parser = saxparser.getParser();
-        } catch (FactoryConfigurationError | SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testParser01(SAXParser saxparser) throws SAXException {
+        assertNotNull(saxparser.getParser());
     }
 
     /**
      * Test case to test if the getXMLReader() method returns instance of
      * XMLReader.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testXmlReader01(SAXParser saxparser) {
-        try {
-            XMLReader xmlReader = saxparser.getXMLReader();
-        } catch (FactoryConfigurationError | SAXException e) {
-            failUnexpected(e);
-        }
+    public void testXmlReader01(SAXParser saxparser) throws SAXException {
+        assertNotNull(saxparser.getXMLReader());
     }
 
     /**
      * Test whether the xml-string property is not supported.
      *
-     * @throws SAXNotSupportedException
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
-    @Test(expectedExceptions = SAXNotSupportedException.class, dataProvider = "parser-provider")
-    public void testProperty01(SAXParser saxparser) throws SAXNotSupportedException {
-        try {
-            Object object = saxparser.getProperty(XML_STRING);
-        } catch (SAXNotRecognizedException e) {
-            failUnexpected(e);
-        }
+    @Test(expectedExceptions = SAXNotSupportedException.class,
+            dataProvider = "parser-provider")
+    public void testProperty01(SAXParser saxparser) throws SAXException {
+        saxparser.getProperty(XML_STRING);
     }
 
     /**
      * Test whether the dom-node property is not supported.
      *
-     * @throws SAXNotSupportedException
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
-    @Test(expectedExceptions = SAXNotSupportedException.class, dataProvider = "parser-provider")
-    public void testProperty02(SAXParser saxparser) throws SAXNotSupportedException {
-        try {
-            Object object = saxparser.getProperty(DOM_NODE);
-        } catch (SAXNotRecognizedException e) {
-            failUnexpected(e);
-        }
+    @Test(expectedExceptions = SAXNotSupportedException.class,
+            dataProvider = "parser-provider")
+    public void testProperty02(SAXParser saxparser) throws SAXException {
+        saxparser.getProperty(DOM_NODE);
     }
 
     /**
      * Test the default lexical-handler not exists.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testProperty03(SAXParser saxparser) {
-        try {
-            assertNull(saxparser.getProperty(LEXICAL_HANDLER));
-        } catch (SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testProperty03(SAXParser saxparser) throws SAXException {
+        assertNull(saxparser.getProperty(LEXICAL_HANDLER));
     }
 
     /**
      * Test the default declaration-handler not exists.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testProperty04(SAXParser saxparser) {
-
-        try {
-            assertNull(saxparser.getProperty(DECL_HANDLER));
-        } catch (SAXException e) {
-            failUnexpected(e);
-        }
+    public void testProperty04(SAXParser saxparser) throws SAXException {
+        assertNull(saxparser.getProperty(DECL_HANDLER));
     }
 
     /**
      * Test to set and get the lexical-handler.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testProperty05(SAXParser saxparser) {
-        try {
-            MyLexicalHandler myLexicalHandler = new MyLexicalHandler();
-            saxparser.setProperty(LEXICAL_HANDLER, myLexicalHandler);
-            Object object = saxparser.getProperty(LEXICAL_HANDLER);
-            assertTrue(object instanceof LexicalHandler);
-        } catch (SAXException e) {
-            failUnexpected(e);
-        }
+    public void testProperty05(SAXParser saxparser) throws SAXException {
+        MyLexicalHandler myLexicalHandler = new MyLexicalHandler();
+        saxparser.setProperty(LEXICAL_HANDLER, myLexicalHandler);
+        assertTrue(saxparser.getProperty(LEXICAL_HANDLER) instanceof LexicalHandler);
     }
 
     /**
      * Test to set and get the declaration-handler.
+     *
+     * @param saxparser a SAXParser instance.
+     * @throws SAXException If any parse errors occur.
      */
     @Test(dataProvider = "parser-provider")
-    public void testProperty06(SAXParser saxparser) {
-        try {
-            MyDeclHandler myDeclHandler = new MyDeclHandler();
-            saxparser.setProperty(DECL_HANDLER, myDeclHandler);
-            Object object = saxparser.getProperty(DECL_HANDLER);
-            assertTrue(object instanceof DeclHandler);
-        } catch (SAXException e) {
-            failUnexpected(e);
-        }
-
+    public void testProperty06(SAXParser saxparser) throws SAXException {
+        MyDeclHandler myDeclHandler = new MyDeclHandler();
+        saxparser.setProperty(DECL_HANDLER, myDeclHandler);
+        assertTrue(saxparser.getProperty(DECL_HANDLER) instanceof DeclHandler);
     }
 
     /**
-     * Customized LexicalHandler used for test.
+     * Customized LexicalHandler used for test. An empty implementation for
+     * LexicalHandler.
      */
     private class MyLexicalHandler implements LexicalHandler {
 
+        @Override
         public void comment(char[] ch, int start, int length) {
         }
 
+        @Override
         public void endCDATA() {
         }
 
+        @Override
         public void endDTD() {
         }
 
+        @Override
         public void endEntity(String name) {
         }
 
+        @Override
         public void startCDATA() {
         }
 
+        @Override
         public void startDTD(String name, String publicId, String systemId) {
         }
 
+        @Override
         public void startEntity(String name) {
         }
     }
 
     /**
-     * Customized DeclHandler used for test.
+     * Customized DeclHandler used for test. An empty implementation for
+     * DeclHandler.
      */
     private class MyDeclHandler implements DeclHandler {
 
+        @Override
         public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) {
         }
 
+        @Override
         public void elementDecl(String name, String model) {
         }
 
+        @Override
         public void externalEntityDecl(String name, String publicId, String systemId) {
         }
 
+        @Override
         public void internalEntityDecl(String name, String value) {
         }
     }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,17 +23,17 @@
 
 package javax.xml.parsers.ptests;
 
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
-
 import java.io.File;
-import java.io.IOException;
-
-import javax.xml.parsers.ParserConfigurationException;
+import java.io.FilePermission;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
+import static org.testng.Assert.fail;
+import org.testng.annotations.AfterGroups;
+import org.testng.annotations.BeforeGroups;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
@@ -41,68 +41,70 @@
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest03 {
+public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest {
 
     /**
      * Provide SAXParserFactory.
      *
-     * @throws Exception
+     * @return a dimensional contains.
      */
     @DataProvider(name = "input-provider")
     public Object[][] getFactory() {
         SAXParserFactory spf = SAXParserFactory.newInstance();
         spf.setValidating(true);
-        MyErrorHandler handler = MyErrorHandler.newInstance();
-        return new Object[][] { { spf, handler } };
+        return new Object[][] { { spf, MyErrorHandler.newInstance() } };
     }
 
     /**
      * parsertest.xml holds a valid document. This method tests the validating
      * parser.
+     *
+     * @param spf a Parser factory.
+     * @param handler an error handler for capturing events.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "input-provider")
-    public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler) {
-        try {
-            SAXParser saxparser = spf.newSAXParser();
-            saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
-            assertFalse(handler.errorOccured);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler)
+            throws Exception {
+            spf.newSAXParser().parse(new File(XML_DIR, "parsertest.xml"), handler);
+            assertFalse(handler.isErrorOccured());
     }
 
     /**
      * validns.xml holds a valid document with XML namespaces in it. This method
      * tests the Validating parser with namespace processing on.
+     *
+     * @param spf a Parser factory.
+     * @param handler an error handler for capturing events.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "input-provider")
-    public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler) {
-        try {
+    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler)
+            throws Exception {
             spf.setNamespaceAware(true);
-            SAXParser saxparser = spf.newSAXParser();
-            saxparser.parse(new File(TestUtils.XML_DIR, "validns.xml"), handler);
-            assertFalse(handler.errorOccured);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+            spf.newSAXParser().parse(new File(XML_DIR, "validns.xml"), handler);
+            assertFalse(handler.isErrorOccured());
     }
 
     /**
      * invalidns.xml holds an invalid document with XML namespaces in it. This
      * method tests the validating parser with namespace processing on. It
      * should throw validation error.
+     *
+     * @param spf a Parser factory.
+     * @param handler an error handler for capturing events.
+     * @throws Exception If any errors occur.
      */
-    @Test(dataProvider = "input-provider")
-    public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler) {
+    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler)
+            throws Exception {
         try {
             spf.setNamespaceAware(true);
             SAXParser saxparser = spf.newSAXParser();
-            saxparser.parse(new File(TestUtils.XML_DIR, "invalidns.xml"), handler);
-            failUnexpected(new RuntimeException());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            if (e instanceof SAXException) {
-                assertTrue(handler.errorOccured);
-            }
+            saxparser.parse(new File(XML_DIR, "invalidns.xml"), handler);
+            fail("Expecting SAXException here");
+        } catch (SAXException e) {
+            assertTrue(handler.isErrorOccured());
         }
     }
 
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.parsers.ptests;
-
-import static jaxp.library.JAXPTestUtilities.ERROR_MSG_HEADER;
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.StandardCopyOption;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.LocatorImpl;
-
-/**
- * Utility interface which includes final variables of xml, golden file
- * directories.
- */
-interface TestUtils {
-    final String XML_DIR = System.getProperty("test.src", ".") + FILE_SEP + "javax/xml/parsers/xmlfiles";
-    final String GOLDEN_DIR = XML_DIR + FILE_SEP + "out";
-}
-
-/**
- * Customized DefaultHandler which writes output document when methods are
- * called by Transformer. Test may use output document to compare with golden
- * file for verification.
- */
-class MyCHandler extends DefaultHandler {
-
-    private final BufferedWriter bWriter;
-    private final Locator locator = new LocatorImpl();
-
-    private MyCHandler(File file) throws IOException {
-        bWriter = new BufferedWriter(new FileWriter(file));
-    }
-
-    public static MyCHandler newInstance(File file) throws IOException {
-        MyCHandler handler = new MyCHandler(file);
-        return handler;
-    }
-
-    public void characters(char[] ch, int start, int length) {
-        String s = new String(ch, start, length);
-        String str = String.format("characters...length is:%d\n<%s>", s.length(), s);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void endDocument() {
-        String str = "endDocument...";
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-            bWriter.flush();
-            bWriter.close();
-
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void endElement(String namespaceURI, String localName, String qName) {
-        String str = String.format("endElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s>", namespaceURI, localName, qName);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void endPrefixMapping(String prefix) {
-        String str = String.format("endPrefixMapping...\nprefix: <%s>", prefix);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void ignorableWhitespace(char[] ch, int start, int length) {
-        String s = new String(ch, start, length);
-        String str = String.format("ignorableWhitespace...\n%s ignorable white space string length: %d", s, s.length());
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void processingInstruction(String target, String data) {
-        String str = String.format("processingInstruction...target:<%s> data: <%s>", target, data);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void skippedEntity(String name) {
-        String str = String.format("skippedEntity...\nname: <%s>", name);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void startDocument() {
-        String str = "startDocument...";
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
-        String str = String.format("startElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s> Number of Attributes: <%d> Line# <%d>", namespaceURI,
-                localName, qName, atts.getLength(), locator.getLineNumber());
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-
-    public void startPrefixMapping(String prefix, String uri) {
-        String str = String.format("startPrefixMapping...\nprefix: <%s> uri: <%s>", prefix, uri);
-        try {
-            bWriter.write(str, 0, str.length());
-            bWriter.newLine();
-        } catch (IOException e) {
-            throw new RuntimeException(ERROR_MSG_HEADER, e);
-        }
-    }
-}
-
-/**
- * Customized DefaultHandler used for SAXParseException testing.
- */
-class MyErrorHandler extends DefaultHandler {
-    boolean errorOccured = false;
-
-    private MyErrorHandler() {
-    }
-
-    public static MyErrorHandler newInstance() {
-        return new MyErrorHandler();
-    }
-
-    public void error(SAXParseException e) {
-        errorOccured = true;
-    }
-
-    public void warning(SAXParseException e) {
-        errorOccured = true;
-    }
-
-    public void fatalError(SAXParseException e) {
-        errorOccured = true;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.xml.transform.ptests;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * DOM parse on test file to be compared with golden output file. No Exception
+ * is expected.
+ */
+public class DOMResultTest extends JAXPFileBaseTest {
+    /**
+     * Unit test for simple DOM parsing.
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase01() throws Exception {
+        String resultFile = USER_DIR  + "domresult01.out";
+        String goldFile = GOLDEN_DIR  + "domresult01GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        XMLReader reader = XMLReaderFactory.createXMLReader();
+        SAXTransformerFactory saxTFactory
+                = (SAXTransformerFactory) TransformerFactory.newInstance();
+        SAXSource saxSource = new SAXSource(new InputSource(xsltFile));
+        TransformerHandler handler
+                = saxTFactory.newTransformerHandler(saxSource);
+
+        DOMResult result = new DOMResult();
+
+        handler.setResult(result);
+        reader.setContentHandler(handler);
+        reader.parse(xmlFile);
+
+        Node node = result.getNode();
+        try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultFile))) {
+            writeNodes(node, writer);
+        }
+        assertTrue(compareWithGold(goldFile, resultFile));
+    }
+
+    /**
+     * Prints all node names, attributes to file
+     * @param node a node that need to be recursively access.
+     * @param bWriter file writer.
+     * @throws IOException if writing file failed.
+     */
+    private void writeNodes(Node node, BufferedWriter bWriter) throws IOException {
+        String str = "Node: " + node.getNodeName();
+        bWriter.write( str, 0,str.length());
+        bWriter.newLine();
+
+        NamedNodeMap nnm = node.getAttributes();
+        if (nnm != null && nnm.getLength() > 0)
+            for (int i=0; i<nnm.getLength(); i++) {
+                str = "AttributeName:" + ((Attr) nnm.item(i)).getName() +
+                      ", AttributeValue:" +((Attr) nnm.item(i)).getValue();
+                bWriter.write( str, 0,str.length());
+                bWriter.newLine();
+            }
+
+        NodeList kids = node.getChildNodes();
+        if (kids != null)
+            for (int i=0; i<kids.getLength(); i++)
+                writeNodes(kids.item(i), bWriter);
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest01.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.transform.ptests;
-
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * DOM parse on test file to be compared with golden output file. No Exception
- * is expected.
- */
-public class DOMResultTest01 {
-    /**
-     * Unit test for simple DOM parsing.
-     */
-    @Test
-    public void testcase01() {
-        String resultFile = CLASS_DIR  + "domresult01.out";
-        String goldFile = GOLDEN_DIR  + "domresult01GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory) TransformerFactory.newInstance();
-            SAXSource saxSource = new SAXSource(new InputSource(xsltFile));
-            TransformerHandler handler
-                    = saxTFactory.newTransformerHandler(saxSource);
-
-            DOMResult result = new DOMResult();
-
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-
-            Node node = result.getNode();
-            try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultFile))) {
-                writeNodes(node, writer);
-            }
-            assertTrue(compareWithGold(goldFile, resultFile));
-        } catch (SAXException | TransformerConfigurationException
-                | IllegalArgumentException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if(Files.exists(resultPath))
-                    Files.delete(resultPath);
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
-        }
-    }
-
-    /**
-     * Prints all node names, attributes to file
-     * @param node a node that need to be recursively access.
-     * @param bWriter file writer.
-     * @throws IOException if writing file failed.
-     */
-    private void writeNodes(Node node, BufferedWriter bWriter) throws IOException {
-        String str = "Node: " + node.getNodeName();
-        bWriter.write( str, 0,str.length());
-        bWriter.newLine();
-
-        NamedNodeMap nnm = node.getAttributes();
-        if (nnm != null && nnm.getLength() > 0)
-            for (int i=0; i<nnm.getLength(); i++) {
-                str = "AttributeName:" + ((Attr) nnm.item(i)).getName() +
-                      ", AttributeValue:" +((Attr) nnm.item(i)).getValue();
-                bWriter.write( str, 0,str.length());
-                bWriter.newLine();
-            }
-
-        NodeList kids = node.getChildNodes();
-        if (kids != null)
-            for (int i=0; i<kids.getLength(); i++)
-                writeNodes(kids.item(i), bWriter);
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,12 +24,14 @@
 package javax.xml.transform.ptests;
 
 import java.io.File;
+import java.io.FilePermission;
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamSource;
+import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 import org.testng.annotations.Test;
@@ -37,7 +39,7 @@
 /**
  * Class containing the test cases for ErrorListener interface
  */
-public class ErrorListenerTest implements ErrorListener {
+public class ErrorListenerTest extends JAXPBaseTest implements ErrorListener {
     /**
      * Define ErrorListener's status.
      */
@@ -58,9 +60,10 @@
         try {
             TransformerFactory tfactory = TransformerFactory.newInstance();
             tfactory.setErrorListener (listener);
+            setPermissions(new FilePermission(XML_DIR + "invalid.xsl", "read"));
             tfactory.newTransformer(new StreamSource(
                                         new File(XML_DIR + "invalid.xsl")));
-            fail("We expect an Exception here");
+            fail("Expect TransformerConfigurationException here");
         } catch (TransformerConfigurationException ex) {
             assertEquals(listener.status, ListenerStatus.FATAL);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+
+/**
+ * Unit test for SAXSource sourceToInputSource API.
+ */
+public class SAXSourceTest extends JAXPFileReadOnlyBaseTest {
+    /**
+     * Test style-sheet file name
+     */
+    private final String TEST_FILE = XML_DIR + "cities.xsl";
+
+    /**
+     * Test obtaining a SAX InputSource object from a Source object.
+     *
+     * @throws IOException reading file error.
+     */
+    @Test(groups = {"readLocalFiles"})
+    public void source2inputsource01() throws IOException {
+        try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
+            StreamSource streamSource = new StreamSource(fis);
+            assertNotNull(SAXSource.sourceToInputSource(streamSource));
+        }
+    }
+
+    /**
+     * This test case tries to get InputSource from DOMSource using
+     * sourceToInputSource method. It is not possible and hence null is
+     * expected. This is a negative test case,
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test(groups = {"readLocalFiles"})
+    public void source2inputsource02() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.newDocumentBuilder().parse(new File(TEST_FILE));
+        assertNull(SAXSource.sourceToInputSource(new DOMSource(null)));
+    }
+
+    /**
+     * This test case tries to get InputSource from SAXSource using
+     * sourceToInputSource method. This will also check if the systemId
+     * remained the same. This is a positive test case.
+     *
+     * @throws IOException reading file error.
+     */
+    @Test(groups = {"readLocalFiles"})
+    public void source2inputsource03() throws IOException {
+        String SYSTEM_ID = "file:///" + XML_DIR;
+        try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
+            SAXSource saxSource =
+                    new SAXSource(new InputSource(fis));
+            saxSource.setSystemId(SYSTEM_ID);
+            assertEquals(SAXSource.sourceToInputSource(saxSource).getSystemId(),
+                    SYSTEM_ID);
+        }
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest01.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-/**
- * Unit test for SAXSource sourceToInputSource API.
- */
-public class SAXSourceTest01 {
-    /**
-     * Test file name
-     */
-    private final String TEST_FILE = XML_DIR + "cities.xsl";
-
-    /**
-     * Test obtaining a SAX InputSource object from a Source object.
-     */
-    @Test
-    public void source2inputsource01() {
-        try {
-            StreamSource streamSource = new StreamSource (
-                                new FileInputStream (TEST_FILE));
-            assertNotNull(SAXSource.sourceToInputSource(streamSource));
-        } catch (FileNotFoundException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * This test case tries to get InputSource from DOMSource using
-     * sourceToInputSource method. It is not possible and hence null is
-     * expected. This is a negative test case
-     */
-    @Test
-    public void source2inputsource02() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            dbf.newDocumentBuilder().parse(new File(TEST_FILE));
-            assertNull(SAXSource.sourceToInputSource(new DOMSource(null)));
-        } catch (ParserConfigurationException | SAXException | IOException ex) {
-            failUnexpected(ex);
-        }
-
-    }
-
-    /**
-     * This test case tries to get InputSource from SAXSource using
-     * sourceToInputSource method. This will also check if the systemId
-     * remained the same. This is a positive test case.
-     */
-    @Test
-    public void source2inputsource03() {
-        String SYSTEM_ID = "file:///" + XML_DIR;
-        try {
-            SAXSource saxSource =
-                    new SAXSource(new InputSource(new FileInputStream(TEST_FILE)));
-            saxSource.setSystemId(SYSTEM_ID);
-            assertEquals(SAXSource.sourceToInputSource(saxSource).getSystemId(),
-                    SYSTEM_ID);
-        } catch (FileNotFoundException ex) {
-            failUnexpected(ex);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,423 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TemplatesHandler;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLFilter;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test newTransformerhandler() method which takes StreamSource as argument can
+ * be set to XMLReader.
+ */
+public class SAXTFactoryTest extends JAXPFileBaseTest {
+    /**
+     * Test style-sheet file.
+     */
+    private static final String XSLT_FILE = XML_DIR + "cities.xsl";
+
+    /**
+     * Test style-sheet file.
+     */
+    private static final String XSLT_INCL_FILE = XML_DIR + "citiesinclude.xsl";
+
+    /**
+     * Test XML file.
+     */
+    private static final String XML_FILE = XML_DIR + "cities.xml";
+
+    /**
+     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
+     * argument can be set to XMLReader. SAXSource has input XML file as its
+     * input source. XMLReader has a transformer handler which write out the
+     * result to output file. Test verifies output file is same as golden file.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "saxtf001.out";
+        String goldFile = GOLDEN_DIR + "saxtf001GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            TransformerHandler handler = saxTFactory.newTransformerHandler(new StreamSource(XSLT_FILE));
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
+     * argument can be set to XMLReader. SAXSource has input XML file as its
+     * input source. XMLReader has a content handler which write out the result
+     * to output file. Test verifies output file is same as golden file.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase02() throws Exception {
+        String outputFile = USER_DIR + "saxtf002.out";
+        String goldFile = GOLDEN_DIR + "saxtf002GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile);
+                FileInputStream fis = new FileInputStream(XSLT_FILE)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            SAXSource ss = new SAXSource();
+            ss.setInputSource(new InputSource(fis));
+
+            TransformerHandler handler = saxTFactory.newTransformerHandler(ss);
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for newTransformerhandler(Source). DcoumentBuilderFactory is
+     * namespace awareness, DocumentBuilder parse xslt file as DOMSource.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase03() throws Exception {
+        String outputFile = USER_DIR + "saxtf003.out";
+        String goldFile = GOLDEN_DIR + "saxtf003GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(new File(XSLT_FILE));
+            Node node = (Node)document;
+            DOMSource domSource= new DOMSource(node);
+
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+            TransformerHandler handler =
+                        saxTFactory.newTransformerHandler(domSource);
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Negative test for newTransformerHandler when relative URI is in XML file.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test(expectedExceptions = TransformerConfigurationException.class)
+    public void transformerHandlerTest04() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        Document document = docBuilder.parse(new File(XSLT_INCL_FILE));
+        DOMSource domSource= new DOMSource(document);
+        SAXTransformerFactory saxTFactory
+                = (SAXTransformerFactory)TransformerFactory.newInstance();
+        saxTFactory.newTransformerHandler(domSource);
+    }
+
+    /**
+     * Unit test for XMLReader parsing when relative URI is used in xsl file and
+     * SystemId was set.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase05() throws Exception {
+        String outputFile = USER_DIR + "saxtf005.out";
+        String goldFile = GOLDEN_DIR + "saxtf005GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(new File(XSLT_INCL_FILE));
+            Node node = (Node)document;
+            DOMSource domSource= new DOMSource(node);
+
+            domSource.setSystemId("file:///" + XML_DIR);
+
+            TransformerHandler handler =
+                        saxTFactory.newTransformerHandler(domSource);
+            Result result = new StreamResult(fos);
+
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test newTransformerHandler with a DOMSource.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase06() throws Exception {
+        String outputFile = USER_DIR + "saxtf006.out";
+        String goldFile = GOLDEN_DIR + "saxtf006GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Node node = (Node)docBuilder.parse(new File(XSLT_INCL_FILE));
+
+            DOMSource domSource = new DOMSource(node, "file:///" + XML_DIR);
+            TransformerHandler handler =
+                        saxTFactory.newTransformerHandler(domSource);
+
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Test newTransformerHandler with a Template Handler.
+     *
+     * @throws Exception If any errors occur.
+     */
+    public void testcase08() throws Exception {
+        String outputFile = USER_DIR + "saxtf008.out";
+        String goldFile = GOLDEN_DIR + "saxtf008GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+
+            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
+            reader.setContentHandler(thandler);
+            reader.parse(XSLT_FILE);
+            TransformerHandler tfhandler
+                    = saxTFactory.newTransformerHandler(thandler.getTemplates());
+
+            Result result = new StreamResult(fos);
+            tfhandler.setResult(result);
+
+            reader.setContentHandler(tfhandler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Test newTransformerHandler with a Template Handler along with a relative
+     * URI in the style-sheet file.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase09() throws Exception {
+        String outputFile = USER_DIR + "saxtf009.out";
+        String goldFile = GOLDEN_DIR + "saxtf009GF.out";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+
+            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
+            thandler.setSystemId("file:///" + XML_DIR);
+            reader.setContentHandler(thandler);
+            reader.parse(XSLT_INCL_FILE);
+            TransformerHandler tfhandler=
+                saxTFactory.newTransformerHandler(thandler.getTemplates());
+            Result result = new StreamResult(fos);
+            tfhandler.setResult(result);
+            reader.setContentHandler(tfhandler);
+            reader.parse(XML_FILE);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for contentHandler setter/getter along reader as handler's
+     * parent.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase10() throws Exception {
+        String outputFile = USER_DIR + "saxtf010.out";
+        String goldFile = GOLDEN_DIR + "saxtf010GF.out";
+        // The transformer will use a SAX parser as it's reader.
+        XMLReader reader = XMLReaderFactory.createXMLReader();
+        SAXTransformerFactory saxTFactory
+                = (SAXTransformerFactory)TransformerFactory.newInstance();
+        XMLFilter filter =
+            saxTFactory.newXMLFilter(new StreamSource(XSLT_FILE));
+        filter.setParent(reader);
+        filter.setContentHandler(new MyContentHandler(outputFile));
+
+        // Now, when you call transformer.parse, it will set itself as
+        // the content handler for the parser object (it's "parent"), and
+        // will then call the parse method on the parser.
+        filter.parse(new InputSource(XML_FILE));
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for contentHandler setter/getter with parent.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase11() throws Exception {
+        String outputFile = USER_DIR + "saxtf011.out";
+        String goldFile = GOLDEN_DIR + "saxtf011GF.out";
+        // The transformer will use a SAX parser as it's reader.
+        XMLReader reader = XMLReaderFactory.createXMLReader();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        Document document = docBuilder.parse(new File(XSLT_FILE));
+        Node node = (Node)document;
+        DOMSource domSource= new DOMSource(node);
+
+        SAXTransformerFactory saxTFactory
+                = (SAXTransformerFactory)TransformerFactory.newInstance();
+        XMLFilter filter = saxTFactory.newXMLFilter(domSource);
+
+        filter.setParent(reader);
+        filter.setContentHandler(new MyContentHandler(outputFile));
+
+        // Now, when you call transformer.parse, it will set itself as
+        // the content handler for the parser object (it's "parent"), and
+        // will then call the parse method on the parser.
+        filter.parse(new InputSource(XML_FILE));
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for contentHandler setter/getter.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase12() throws Exception {
+        String outputFile = USER_DIR + "saxtf012.out";
+        String goldFile = GOLDEN_DIR + "saxtf012GF.out";
+        // The transformer will use a SAX parser as it's reader.
+        XMLReader reader = XMLReaderFactory.createXMLReader();
+
+        InputSource is = new InputSource(new FileInputStream(XSLT_FILE));
+        SAXSource saxSource = new SAXSource();
+        saxSource.setInputSource(is);
+
+        SAXTransformerFactory saxTFactory = (SAXTransformerFactory)TransformerFactory.newInstance();
+        XMLFilter filter = saxTFactory.newXMLFilter(saxSource);
+
+        filter.setParent(reader);
+        filter.setContentHandler(new MyContentHandler(outputFile));
+
+        // Now, when you call transformer.parse, it will set itself as
+        // the content handler for the parser object (it's "parent"), and
+        // will then call the parse method on the parser.
+        filter.parse(new InputSource(XML_FILE));
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+
+    /**
+     * Unit test for TemplatesHandler setter/getter.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void testcase13() throws Exception {
+        String outputFile = USER_DIR + "saxtf013.out";
+        String goldFile = GOLDEN_DIR + "saxtf013GF.out";
+        try(FileInputStream fis = new FileInputStream(XML_FILE)) {
+            // The transformer will use a SAX parser as it's reader.
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
+            // I have put this as it was complaining about systemid
+            thandler.setSystemId("file:///" + USER_DIR);
+
+            reader.setContentHandler(thandler);
+            reader.parse(XSLT_FILE);
+            XMLFilter filter
+                    = saxTFactory.newXMLFilter(thandler.getTemplates());
+            filter.setParent(reader);
+
+            filter.setContentHandler(new MyContentHandler(outputFile));
+            filter.parse(new InputSource(fis));
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest001.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.xml.transform.ptests;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerhandler() method which takes StreamSource as argument can
- * be set to XMLReader.
- */
-public class SAXTFactoryTest001 {
-    /**
-     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
-     * argument can be set to XMLReader. SAXSource has input XML file as its
-     * input source. XMLReader has a transformer handler which write out the
-     * result to output file. Test verifies output file is same as golden file.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf001.out";
-        String goldFile = GOLDEN_DIR + "saxtf001GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory) TransformerFactory.newInstance();
-            TransformerHandler handler = saxTFactory.newTransformerHandler(
-                    new StreamSource(xsltFile));
-            Result result = new StreamResult(fos);
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | TransformerConfigurationException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest002.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerhandler() method which takes SAXSource as argument can
- * be set to XMLReader.
- */
-public class SAXTFactoryTest002 {
-    /**
-     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
-     * argument can be set to XMLReader. SAXSource has input XML file as its
-     * input source. XMLReader has a content handler which write out the result
-     * to output file. Test verifies output file is same as golden file.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf002.out";
-        String goldFile = GOLDEN_DIR + "saxtf002GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile);
-                FileInputStream fis = new FileInputStream(xsltFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory) TransformerFactory.newInstance();
-            SAXSource ss = new SAXSource();
-            ss.setInputSource(new InputSource(fis));
-
-            TransformerHandler handler = saxTFactory.newTransformerHandler(ss);
-            Result result = new StreamResult(fos);
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest003.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerhandler() method which takes DOMSource as argument can
- * be set to XMLReader.
- */
-public class SAXTFactoryTest003 {
-    /**
-     * Unit test for newTransformerhandler(Source). DcoumentBuilderFactory is
-     * namespace awareness, DocumentBuilder parse xslt file as DOMSource.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf003.out";
-        String goldFile = GOLDEN_DIR + "saxtf003GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(new File(xsltFile));
-            Node node = (Node)document;
-            DOMSource domSource= new DOMSource(node);
-
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            TransformerHandler handler =
-                        saxTFactory.newTransformerHandler(domSource);
-            Result result = new StreamResult(fos);
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (TransformerConfigurationException | ParserConfigurationException
-                | SAXException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest004.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.IOException;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/*
- * TransformerConfigurationException expected when there is relative URI is used
- * in citiesinclude.xsl file
- */
-public class SAXTFactoryTest004 {
-    /**
-     * Negative test for newTransformerHandler when relative URI is in XML file.
-     * @throws TransformerConfigurationException If for some reason the
-     * TransformerHandler can not be created.
-     */
-    @Test(expectedExceptions = TransformerConfigurationException.class)
-    public void transformerHandlerTest01() throws TransformerConfigurationException {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(new File(XML_DIR + "citiesinclude.xsl"));
-            DOMSource domSource= new DOMSource(document);
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            saxTFactory.newTransformerHandler(domSource);
-        } catch (ParserConfigurationException | IOException | SAXException ex) {
-            failUnexpected(ex);
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest005.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test SAXSource API when relative URI is used in xsl file and SystemId was set
- */
-public class SAXTFactoryTest005 {
-    /**
-     * Unit test for XMLReader parsing when relative URI is used in xsl file and
-     * SystemId was set.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf005.out";
-        String goldFile = GOLDEN_DIR + "saxtf005GF.out";
-        String xsltFile = XML_DIR + "citiesinclude.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(new File(xsltFile));
-            Node node = (Node)document;
-            DOMSource domSource= new DOMSource(node);
-
-            domSource.setSystemId("file:///" + XML_DIR);
-
-            TransformerHandler handler =
-                        saxTFactory.newTransformerHandler(domSource);
-            Result result = new StreamResult(fos);
-
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (TransformerConfigurationException | ParserConfigurationException
-                | SAXException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest006.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerHandler with a DOMSource and StreamResult set.
- */
-public class SAXTFactoryTest006 extends TransformerTestConst{
-    /**
-     * Unit test newTransformerHandler with a DOMSource.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf006.out";
-        String goldFile = GOLDEN_DIR + "saxtf006GF.out";
-        String xsltFile = XML_DIR + "citiesinclude.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Node node = (Node)docBuilder.parse(new File(xsltFile));
-
-            DOMSource domSource = new DOMSource(node, "file:///" + XML_DIR);
-            TransformerHandler handler =
-                        saxTFactory.newTransformerHandler(domSource);
-
-            Result result = new StreamResult(fos);
-            handler.setResult(result);
-            reader.setContentHandler(handler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (TransformerConfigurationException | ParserConfigurationException
-                | SAXException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest008.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TemplatesHandler;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerHandler with a Template Handler.
- */
-public class SAXTFactoryTest008 {
-    /**
-     * Test newTransformerHandler with a Template Handler.
-     */
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf008.out";
-        String goldFile = GOLDEN_DIR + "saxtf008GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-
-            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
-            reader.setContentHandler(thandler);
-            reader.parse(xsltFile);
-            TransformerHandler tfhandler
-                    = saxTFactory.newTransformerHandler(thandler.getTemplates());
-
-            Result result = new StreamResult(fos);
-            tfhandler.setResult(result);
-
-            reader.setContentHandler(tfhandler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-  }
-
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest009.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TemplatesHandler;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test newTransformerHandler with a Template Handler along with a relative URI
- * in the xslt file.
- */
-public class SAXTFactoryTest009 {
-    /**
-     * Test newTransformerHandler with a Template Handler along with a relative
-     * URI in the xslt file.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf009.out";
-        String goldFile = GOLDEN_DIR + "saxtf009GF.out";
-        String xsltFile = XML_DIR + "citiesinclude.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-
-            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
-            thandler.setSystemId("file:///" + XML_DIR);
-            reader.setContentHandler(thandler);
-            reader.parse(xsltFile);
-            TransformerHandler tfhandler=
-                saxTFactory.newTransformerHandler(thandler.getTemplates());
-            Result result = new StreamResult(fos);
-            tfhandler.setResult(result);
-            reader.setContentHandler(tfhandler);
-            reader.parse(xmlFile);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-  }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest010.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test XMLFilter parse InputSource along with customized ContentHandler.
- */
-public class SAXTFactoryTest010 {
-    /**
-     * Unit test for contentHandler setter/getter along reader as handler's
-     * parent.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf010.out";
-        String goldFile = GOLDEN_DIR + "saxtf010GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try {
-            // The transformer will use a SAX parser as it's reader.
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            XMLFilter filter =
-                saxTFactory.newXMLFilter(new StreamSource(xsltFile));
-
-            filter.setParent(reader);
-            filter.setContentHandler(new MyContentHandler(outputFile));
-
-            // Now, when you call transformer.parse, it will set itself as
-            // the content handler for the parser object (it's "parent"), and
-            // will then call the parse method on the parser.
-            filter.parse(new InputSource(xmlFile));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest011.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test XMLFilter parse InputSource along with customized ContentHandler by
- * using SAX parser as it's reader.
- */
-public class SAXTFactoryTest011 {
-    /**
-     * Unit test for contentHandler setter/getter with parent.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf011.out";
-        String goldFile = GOLDEN_DIR + "saxtf011GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try {
-            // The transformer will use a SAX parser as it's reader.
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(new File(xsltFile));
-            Node node = (Node)document;
-            DOMSource domSource= new DOMSource(node);
-
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory)TransformerFactory.newInstance();
-            XMLFilter filter = saxTFactory.newXMLFilter(domSource);
-
-            filter.setParent(reader);
-            filter.setContentHandler(new MyContentHandler(outputFile));
-
-            // Now, when you call transformer.parse, it will set itself as
-            // the content handler for the parser object (it's "parent"), and
-            // will then call the parse method on the parser.
-            filter.parse(new InputSource(xmlFile));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException
-                | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest012.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test XMLFilter parse InputSource along with customized ContentHandler by
- * using SAX parser as it's reader.
- */
-public class SAXTFactoryTest012 {
-    /**
-     * Unit test for contentHandler setter/getter.
-     */
-    @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf012.out";
-        String goldFile = GOLDEN_DIR + "saxtf012GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-        try {
-            // The transformer will use a SAX parser as it's reader.
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-
-            InputSource is = new InputSource(new FileInputStream(xsltFile));
-            SAXSource saxSource = new SAXSource();
-            saxSource.setInputSource(is);
-
-            SAXTransformerFactory saxTFactory = (SAXTransformerFactory)TransformerFactory.newInstance();
-            XMLFilter filter = saxTFactory.newXMLFilter(saxSource);
-
-            filter.setParent(reader);
-            filter.setContentHandler(new MyContentHandler(outputFile));
-
-            // Now, when you call transformer.parse, it will set itself as
-            // the content handler for the parser object (it's "parent"), and
-            // will then call the parse method on the parser.
-            filter.parse(new InputSource(xmlFile));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest013.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TemplatesHandler;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Test XMLFilter parse InputSource along with TemplatesHandler.
- */
-public class SAXTFactoryTest013 {
-    /**
-     * Unit test for TemplatesHandler setter/getter.
-     */
-    @Test
-    public  void testcase01() {
-        String outputFile = CLASS_DIR + "saxtf013.out";
-        String goldFile = GOLDEN_DIR + "saxtf013GF.out";
-        String xsltFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        try {
-            // The transformer will use a SAX parser as it's reader.
-            XMLReader reader = XMLReaderFactory.createXMLReader();
-
-            SAXTransformerFactory saxTFactory
-                    = (SAXTransformerFactory) TransformerFactory.newInstance();
-            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
-            // I have put this as it was complaining about systemid
-            thandler.setSystemId("file:///" + CLASS_DIR);
-
-            reader.setContentHandler(thandler);
-            reader.parse(xsltFile);
-            XMLFilter filter
-                    = saxTFactory.newXMLFilter(thandler.getTemplates());
-            filter.setParent(reader);
-
-            filter.setContentHandler(
-                    new MyContentHandler(outputFile));
-            filter.parse(new InputSource(new FileInputStream(xmlFile)));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (SAXException | IOException | TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Properties;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * Test a StreamResult using a file name that contains URL characters that need
+ * to be encoded.
+ */
+public class StreamResultTest extends JAXPFileBaseTest {
+    /**
+     * Unit test for StreamResult.
+     */
+    @Test
+    public void testcase01() {
+        // Set Transformer properties
+        Properties transformProperties = new Properties();
+        transformProperties.put("method", "xml");
+        transformProperties.put("encoding", "UTF-8");
+        transformProperties.put("omit-xml-declaration", "yes");
+        transformProperties.put("{http://xml.apache.org/xslt}indent-amount", "0");
+        transformProperties.put("indent", "no");
+        transformProperties.put("standalone", "no");
+        transformProperties.put("version", "1.0");
+        transformProperties.put("media-type", "text/xml");
+
+        String[] fileNames = {
+            "StreamResult01.out",
+            "StreamResult 02.out",
+            "StreamResult#03.out"
+        };
+
+        String xslFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        Arrays.stream(fileNames).forEach(file -> {
+            try {
+                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                dbf.setNamespaceAware(true);
+                DocumentBuilder db = dbf.newDocumentBuilder();
+                Document document = db.parse(new File(xslFile));
+                DOMSource domSource = new DOMSource(document);
+                StreamSource streamSource = new StreamSource(new FileInputStream(xmlFile));
+
+                File streamResultFile = new File(USER_DIR + file);
+                StreamResult streamResult = new StreamResult(streamResultFile);
+
+                Transformer transformer = TransformerFactory.newInstance().newTransformer(domSource);
+                transformer.setOutputProperties(transformProperties);
+                transformer.transform(streamSource, streamResult);
+            } catch (SAXException | IOException | ParserConfigurationException
+                    | TransformerException ex) {
+                failUnexpected(ex);
+            }
+        });
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest01.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package javax.xml.transform.ptests;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Properties;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * Test a StreamResult using a file name that contains URL characters that need
- * to be encoded.
- */
-public class StreamResultTest01 {
-    /**
-     * Unit test for StreamResult.
-     */
-    @Test
-    public void testcase01() {
-        // Set Transformer properties
-        Properties transformProperties = new Properties();
-        transformProperties.put("method", "xml");
-        transformProperties.put("encoding", "UTF-8");
-        transformProperties.put("omit-xml-declaration", "yes");
-        transformProperties.put("{http://xml.apache.org/xslt}indent-amount", "0");
-        transformProperties.put("indent", "no");
-        transformProperties.put("standalone", "no");
-        transformProperties.put("version", "1.0");
-        transformProperties.put("media-type", "text/xml");
-
-        String[] fileNames = {
-            "StreamResult01.out",
-            "StreamResult 02.out",
-            "StreamResult#03.out"
-        };
-
-        String xslFile = XML_DIR + "cities.xsl";
-        String xmlFile = XML_DIR + "cities.xml";
-
-        Arrays.stream(fileNames).forEach(file -> {
-            try {
-                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-                dbf.setNamespaceAware(true);
-                DocumentBuilder db = dbf.newDocumentBuilder();
-                Document document = db.parse(new File(xslFile));
-                DOMSource domSource = new DOMSource(document);
-                StreamSource streamSource = new StreamSource(new FileInputStream(xmlFile));
-
-                File streamResultFile = new File(CLASS_DIR + file);
-                StreamResult streamResult = new StreamResult(streamResultFile);
-
-                Transformer transformer = TransformerFactory.newInstance().newTransformer(domSource);
-                transformer.setOutputProperties(transformProperties);
-                transformer.transform(streamSource, streamResult);
-            } catch (SAXException | IOException | ParserConfigurationException
-                    | TransformerException ex) {
-                failUnexpected(ex);
-            }
-        });
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,11 +24,8 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerFactory;
@@ -36,21 +33,20 @@
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * Class containing the test cases for SAXParserFactory API
  */
-public class TfClearParamTest {
+public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
     /**
-     * Test xslt file.
+     * Test style-sheet file name.
      */
     private final String XSL_FILE = XML_DIR + "cities.xsl";
 
@@ -72,193 +68,164 @@
     /**
      * Obtains transformer's parameter with the same name that set before. Value
      * should be same as set one.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
     @Test
-    public void clear01() {
-        try {
-            Transformer transformer = TransformerFactory.newInstance().newTransformer();
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            assertEquals(transformer.getParameter(LONG_PARAM_NAME).toString(), PARAM_VALUE);
-        } catch (TransformerConfigurationException ex) {
-            failUnexpected(ex);
-        }
-
+    public void clear01() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        assertEquals(transformer.getParameter(LONG_PARAM_NAME).toString(), PARAM_VALUE);
     }
 
     /**
      * Obtains transformer's parameter with the a name that wasn't set before.
      * Null is expected.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
+     */
+    @Test
+    public void clear02() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        transformer.clearParameters();
+        assertNull(transformer.getParameter(LONG_PARAM_NAME));
+    }
+
+    /**
+     * Obtains transformer's parameter with a short name that set before. Value
+     * should be same as set one.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
     @Test
-    public void clear02() {
-        try {
-            Transformer transformer = TransformerFactory.newInstance().newTransformer();
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            transformer.clearParameters();
-            assertNull(transformer.getParameter(LONG_PARAM_NAME));
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
+    public void clear03() throws TransformerConfigurationException {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        Transformer transformer = tfactory.newTransformer();
+
+        transformer.setParameter(SHORT_PARAM_NAME, PARAM_VALUE);
+        assertEquals(transformer.getParameter(SHORT_PARAM_NAME).toString(), PARAM_VALUE);
+    }
+
+    /**
+     * Obtains transformer's parameter with a short name that set with an integer
+     * object before. Value should be same as the set integer object.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
+     */
+    @Test
+    public void clear04() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+
+        int intObject = 5;
+        transformer.setParameter(SHORT_PARAM_NAME, intObject);
+        assertEquals(transformer.getParameter(SHORT_PARAM_NAME), intObject);
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a stream source with
      * the a name that set before. Value should be same as set one.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
-    @Test
-    public void clear03() {
-        try {
-            Transformer transformer = TransformerFactory.newInstance().
-                    newTransformer(new StreamSource(new File(XSL_FILE)));
+    @Test (groups = {"readLocalFiles"})
+    public void clear05() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().
+                newTransformer(new StreamSource(new File(XSL_FILE)));
 
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a stream source with
      * the a name that wasn't set before. Null is expected.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
-    @Test
-    public void clear04() {
-        try {
-            Transformer transformer = TransformerFactory.newInstance().
-                    newTransformer(new StreamSource(new File(XSL_FILE)));
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            transformer.clearParameters();
-            assertNull(transformer.getParameter(LONG_PARAM_NAME));
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
-
+    @Test (groups = {"readLocalFiles"})
+    public void clear06() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().
+                newTransformer(new StreamSource(new File(XSL_FILE)));
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        transformer.clearParameters();
+        assertNull(transformer.getParameter(LONG_PARAM_NAME));
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a sax source with
      * the a name that set before. Value should be same as set one.
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void clear05() {
-        try {
-            InputSource is = new InputSource(new FileInputStream(XSL_FILE));
+    @Test (groups = {"readLocalFiles"})
+    public void clear07() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
             SAXSource saxSource = new SAXSource();
-            saxSource.setInputSource(is);
+            saxSource.setInputSource(new InputSource(fis));
 
             Transformer transformer = TransformerFactory.newInstance().newTransformer(saxSource);
-
             transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
             assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
         }
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a sax source with
      * the a name that wasn't set before. Null is expected.
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void clear06() {
-        try {
-            InputSource is = new InputSource(new FileInputStream(XSL_FILE));
+    @Test (groups = {"readLocalFiles"})
+    public void clear08() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
             SAXSource saxSource = new SAXSource();
-            saxSource.setInputSource(is);
+            saxSource.setInputSource(new InputSource(fis));
 
             Transformer transformer = TransformerFactory.newInstance().newTransformer(saxSource);
-
             transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
             transformer.clearParameters();
             assertNull(transformer.getParameter(LONG_PARAM_NAME));
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
         }
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a dom source with
      * the a name that set before. Value should be same as set one.
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void clear07() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
+    @Test (groups = {"readLocalFiles"})
+    public void clear09() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
 
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(XSL_FILE));
-            DOMSource domSource = new DOMSource((Node)document);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(XSL_FILE));
+        DOMSource domSource = new DOMSource((Node)document);
 
-            Transformer transformer = tfactory.newTransformer(domSource);
+        Transformer transformer = tfactory.newTransformer(domSource);
 
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
-        } catch (IOException | ParserConfigurationException
-                | TransformerConfigurationException | SAXException ex){
-            failUnexpected(ex);
-        }
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
     }
 
     /**
      * Obtains transformer's parameter whose initiated with a dom source with
      * the a name that wasn't set before. Null is expected.
-     */
-    @Test
-    public void clear08() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(XSL_FILE));
-            DOMSource domSource = new DOMSource((Node)document);
-
-            Transformer transformer = tfactory.newTransformer(domSource);
-            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
-            transformer.clearParameters();
-            assertNull(transformer.getParameter(LONG_PARAM_NAME));
-        } catch (IOException | ParserConfigurationException
-                | TransformerConfigurationException | SAXException ex){
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Obtains transformer's parameter with a short name that set before. Value
-     * should be same as set one.
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void clear09() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            Transformer transformer = tfactory.newTransformer();
-
-            transformer.setParameter(SHORT_PARAM_NAME, PARAM_VALUE);
-            assertEquals(transformer.getParameter(SHORT_PARAM_NAME).toString(), PARAM_VALUE);
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
-    }
+    @Test (groups = {"readLocalFiles"})
+    public void clear10() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
 
-    /**
-     * Obtains transformer's parameter with a short name that set with an integer
-     * object before. Value should be same as the set integer object.
-     */
-    @Test
-    public void clear10() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            Transformer transformer = tfactory.newTransformer();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(XSL_FILE));
+        DOMSource domSource = new DOMSource((Node)document);
 
-            int intObject = 5;
-            transformer.setParameter(SHORT_PARAM_NAME, intObject);
-            assertEquals(transformer.getParameter(SHORT_PARAM_NAME), intObject);
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
+        Transformer transformer = tfactory.newTransformer(domSource);
+        transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+        transformer.clearParameters();
+        assertNull(transformer.getParameter(LONG_PARAM_NAME));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,14 @@
 package javax.xml.transform.ptests;
 
 import java.io.File;
+import java.io.FilePermission;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXResult;
 import javax.xml.transform.stream.StreamSource;
+import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
@@ -38,13 +40,14 @@
 /**
  *  Basic test for TransformerException specification.
  */
-public class TransformerExcpTest {
+public class TransformerExcpTest extends JAXPBaseTest {
     /**
-     * Transform an unformatted xslt file. TransformerException is thrown.
+     * Transform an unformatted style-sheet file. TransformerException is thrown.
      */
     @Test
     public void tfexception() {
         try {
+            setPermissions(new FilePermission(XML_DIR  + "-", "read"));
             // invalid.xsl has well-formedness error. Therefore transform throws
             // TransformerException
             StreamSource streamSource
@@ -60,6 +63,8 @@
             assertNotNull(e.getException());
             assertNull(e.getLocationAsString());
             assertEquals(e.getMessageAndLocation(),e.getMessage());
+        } finally {
+            setPermissions();
         }
     }
 
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,39 +24,35 @@
 
 import java.io.*;
 import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import javax.xml.parsers.*;
 import javax.xml.transform.*;
 import javax.xml.transform.dom.*;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
 import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.*;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
 import org.w3c.dom.*;
-import org.xml.sax.SAXException;
 
 /**
  * Class containing the test cases for TransformerFactory API's
  * getAssociatedStyleSheet method.
  */
-public class TransformerFactoryTest {
+public class TransformerFactoryTest extends JAXPFileBaseTest {
     /**
      * This test case checks for the getAssociatedStylesheet method
      * of TransformerFactory.
      * The style sheet returned is then copied to an tfactory01.out
-     * It will then be verified to see if it matches the golden files
+     * It will then be verified to see if it matches the golden files.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void tfactory01() {
-        String outputFile = CLASS_DIR + "tfactory01.out";
+    public void tfactory01() throws Exception {
+        String outputFile = USER_DIR + "tfactory01.out";
         String goldFile = GOLDEN_DIR + "tfactory01GF.out";
         String xmlFile = XML_DIR + "TransformerFactoryTest.xml";
         String xmlURI = "file:///" + XML_DIR;
@@ -76,10 +72,7 @@
                                            "Modern", null);
             Transformer t = tFactory.newTransformer();
             t.transform(s, streamResult);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException | ParserConfigurationException
-                | TransformerException | SAXException ex) {
-            failUnexpected(ex);
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,12 +24,9 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import java.util.Properties;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
@@ -39,150 +36,132 @@
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * Basic test cases for Transformer API
  */
-public class TransformerTest {
+public class TransformerTest extends JAXPFileReadOnlyBaseTest {
     /**
      * XSLT file serves every test method.
      */
     private final static String TEST_XSL = XML_DIR + "cities.xsl";
 
     /**
-     * This tests if newTransformer(StreamSource) method returns Transformer
+     * This tests if newTransformer(StreamSource) method returns Transformer.
+     * @throws TransformerConfigurationException If for some reason the
+     *         TransformerHandler can not be created.
      */
-    @Test
-    public void transformer01() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            StreamSource streamSource = new StreamSource(
-                                        new File(TEST_XSL));
-            Transformer transformer = tfactory.newTransformer(streamSource);
-            assertNotNull(transformer);
-        } catch (TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
+    @Test (groups = {"readLocalFiles"})
+    public void transformer01() throws TransformerConfigurationException {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        StreamSource streamSource = new StreamSource(
+                                    new File(TEST_XSL));
+        Transformer transformer = tfactory.newTransformer(streamSource);
+        assertNotNull(transformer);
     }
 
     /**
-     * This tests if newTransformer(SAXSource) method returns Transformer
+     * This tests if newTransformer(SAXSource) method returns Transformer.
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void transformer02() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public void transformer02() throws Exception {
+        try (FileInputStream fis = new FileInputStream(TEST_XSL)) {
             TransformerFactory tfactory = TransformerFactory.newInstance();
-            InputSource is = new InputSource(
-                        new FileInputStream(TEST_XSL));
-            SAXSource saxSource = new SAXSource(is);
+            SAXSource saxSource = new SAXSource(new InputSource(fis));
             Transformer transformer = tfactory.newTransformer(saxSource);
             assertNotNull(transformer);
-        } catch (TransformerConfigurationException | FileNotFoundException ex){
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * This tests if newTransformer(DOMSource) method returns Transformer
-     */
-    @Test
-    public void transformer03() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(TEST_XSL));
-            DOMSource domSource = new DOMSource(document);
-
-            Transformer transformer = tfactory.newTransformer(domSource);
-            assertNotNull(transformer);
-        } catch (TransformerConfigurationException | IOException
-                | ParserConfigurationException | SAXException ex){
-            failUnexpected(ex);
         }
     }
 
     /**
-     * This tests set/get ErrorListener methods of Transformer
+     * This tests if newTransformer(DOMSource) method returns Transformer.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void transformer04() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(TEST_XSL));
-            DOMSource domSource = new DOMSource(document);
+    @Test (groups = {"readLocalFiles"})
+    public void transformer03() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(TEST_XSL));
+        DOMSource domSource = new DOMSource(document);
+
+        Transformer transformer = tfactory.newTransformer(domSource);
+        assertNotNull(transformer);
+    }
 
-            Transformer transformer = TransformerFactory.newInstance()
-                    .newTransformer(domSource);
-            transformer.setErrorListener(new MyErrorListener());
-            assertNotNull(transformer.getErrorListener());
-            assertTrue(transformer.getErrorListener() instanceof MyErrorListener);
-        } catch (IOException | IllegalArgumentException | ParserConfigurationException
-                | TransformerConfigurationException | SAXException ex){
-            failUnexpected(ex);
-        }
+    /**
+     * This tests set/get ErrorListener methods of Transformer.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test (groups = {"readLocalFiles"})
+    public void transformer04() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(TEST_XSL));
+        DOMSource domSource = new DOMSource(document);
+
+        Transformer transformer = TransformerFactory.newInstance()
+                .newTransformer(domSource);
+        transformer.setErrorListener(new MyErrorListener());
+        assertNotNull(transformer.getErrorListener());
+        assertTrue(transformer.getErrorListener() instanceof MyErrorListener);
     }
 
     /**
-     * This tests getOutputProperties() method of Transformer
+     * This tests getOutputProperties() method of Transformer.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void transformer05() {
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(TEST_XSL));
-            DOMSource domSource = new DOMSource(document);
+    @Test (groups = {"readLocalFiles"})
+    public void transformer05() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(TEST_XSL));
+        DOMSource domSource = new DOMSource(document);
 
-            Transformer transformer = TransformerFactory.newInstance().
-                    newTransformer(domSource);
-            Properties prop = transformer.getOutputProperties();
+        Transformer transformer = TransformerFactory.newInstance().
+                newTransformer(domSource);
+        Properties prop = transformer.getOutputProperties();
 
-            assertEquals(prop.getProperty("indent"), "yes");
-            assertEquals(prop.getProperty("method"), "xml");
-            assertEquals(prop.getProperty("encoding"), "UTF-8");
-            assertEquals(prop.getProperty("standalone"), "no");
-            assertEquals(prop.getProperty("version"), "1.0");
-            assertEquals(prop.getProperty("omit-xml-declaration"), "no");
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
+        assertEquals(prop.getProperty("indent"), "yes");
+        assertEquals(prop.getProperty("method"), "xml");
+        assertEquals(prop.getProperty("encoding"), "UTF-8");
+        assertEquals(prop.getProperty("standalone"), "no");
+        assertEquals(prop.getProperty("version"), "1.0");
+        assertEquals(prop.getProperty("omit-xml-declaration"), "no");
     }
 
     /**
-     * This tests getOutputProperty() method of Transformer
+     * This tests getOutputProperty() method of Transformer.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void transformer06() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
+    @Test (groups = {"readLocalFiles"})
+    public void transformer06() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
 
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(TEST_XSL));
-            DOMSource domSource = new DOMSource(document);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(TEST_XSL));
+        DOMSource domSource = new DOMSource(document);
 
-            Transformer transformer = tfactory.newTransformer(domSource);
-            assertEquals(transformer.getOutputProperty("method"), "xml");
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerConfigurationException | IllegalArgumentException ex){
-            failUnexpected(ex);
-        }
+        Transformer transformer = tfactory.newTransformer(domSource);
+        assertEquals(transformer.getOutputProperty("method"), "xml");
     }
 }
 
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,42 +25,34 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
 import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
 
 
 /**
  * Here a transformer is created using DOMSource. Some specific output property
  * is set on transformer. Then transform(StreamSource, StreamResult) is tested.
  */
-public class TransformerTest02 {
+public class TransformerTest02 extends JAXPFileBaseTest {
     /**
      * Unit test for transform(StreamSource, StreamResult).
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "transformer02.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "transformer02.out";
         String goldFile = GOLDEN_DIR + "transformer02GF.out";
         String xsltFile = XML_DIR + "cities.xsl";
         String xmlFile = XML_DIR + "cities.xml";
@@ -69,9 +61,8 @@
                 FileOutputStream fos = new FileOutputStream(outputFile)) {
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(xsltFile));
-            DOMSource domSource = new DOMSource(document);
+            DOMSource domSource = new DOMSource(dbf.newDocumentBuilder().
+                    parse(new File(xsltFile)));
 
             Transformer transformer = TransformerFactory.newInstance().
                     newTransformer(domSource);
@@ -79,20 +70,8 @@
             StreamResult streamResult = new StreamResult(fos);
 
             transformer.setOutputProperty("indent", "no");
-            transformer.transform( streamSource, streamResult);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException | IllegalArgumentException
-                | ParserConfigurationException | TransformerException
-                | SAXException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
+            transformer.transform(streamSource, streamResult);
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,30 +25,20 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.Properties;
-import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
 import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
 
 /**
  * Here Properties Object is populated with required properties.A transformer
@@ -56,13 +46,15 @@
  * for transformer. Then transform(StreamSource, StreamResult) is used for
  * transformation. This tests the setOutputProperties() method.
  */
-public class TransformerTest03 {
+public class TransformerTest03 extends JAXPFileBaseTest {
     /**
      * Test for Transformer.setOutputProperties method.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "transformer03.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "transformer03.out";
         String goldFile = GOLDEN_DIR + "transformer03GF.out";
         String xsltFile = XML_DIR + "cities.xsl";
         String xmlFile = XML_DIR + "cities.xml";
@@ -81,29 +73,14 @@
 
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(xsltFile));
-            DOMSource domSource = new DOMSource(document);
+            DOMSource domSource = new DOMSource(dbf.newDocumentBuilder().
+                    parse(new File(xsltFile)));
 
             Transformer transformer = TransformerFactory.newInstance().
                     newTransformer(domSource);
-            StreamSource streamSource = new StreamSource(fis);
-            StreamResult streamResult = new StreamResult(fos);
-
             transformer.setOutputProperties(properties);
-            transformer.transform( streamSource, streamResult);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException
-                | IOException | TransformerException ex){
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
+            transformer.transform(new StreamSource(fis), new StreamResult(fos));
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,15 +24,10 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.URIResolver;
 import javax.xml.transform.dom.DOMSource;
@@ -40,18 +35,17 @@
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileBaseTest;
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * URIResolver should be invoked when transform happens.
  */
-public class URIResolverTest implements URIResolver {
+public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
     /**
      * System ID constant.
      */
@@ -72,9 +66,8 @@
      */
     private final static String XSL_TEMP_FILE = "temp/cities.xsl";
 
-
     /**
-     * expected Href.
+     * expected HREF.
      */
     private final String validateHref;
 
@@ -84,6 +77,14 @@
     private final String validateBase;
 
     /**
+     * Default constructor for testng invocation.
+     */
+    public URIResolverTest(){
+        validateHref = null;
+        validateBase = null;
+    }
+
+    /**
      * Constructor for setting expected Href and expected Base URI.
      * @param validateHref expected Href
      * @param validateBase expected Base URI
@@ -110,166 +111,144 @@
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using StreamSource. xsl file has xsl:include in it
+     * created using StreamSource. style-sheet file has xsl:include in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver01() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver01() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)) {
             TransformerFactory tfactory = TransformerFactory.newInstance();
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
             tfactory.setURIResolver(resolver);
 
-            StreamSource streamSource = new StreamSource(new FileInputStream(XSL_INCLUDE_FILE));
+            StreamSource streamSource = new StreamSource(fis);
             streamSource.setSystemId(SYSTEM_ID);
-
-            Transformer transformer = tfactory.newTransformer(streamSource);
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
+            assertNotNull(tfactory.newTransformer(streamSource));
         }
     }
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using DOMSource. xsl file has xsl:include in it
+     * created using DOMSource. style-sheet file has xsl:include in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver02() {
-        try {
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
-            tfactory.setURIResolver(resolver);
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver02() throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+        tfactory.setURIResolver(resolver);
 
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(XSL_INCLUDE_FILE);
-            DOMSource domSource = new DOMSource(document, SYSTEM_ID);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(XSL_INCLUDE_FILE);
+        DOMSource domSource = new DOMSource(document, SYSTEM_ID);
 
-            Transformer transformer = tfactory.newTransformer(domSource);
-        } catch (IOException | ParserConfigurationException
-                | TransformerConfigurationException | SAXException ex){
-            failUnexpected(ex);
-        }
+        assertNotNull(tfactory.newTransformer(domSource));
     }
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using SAXSource. xsl file has xsl:include in it
+     * created using SAXSource. style-sheet file has xsl:include in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver03() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver03() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)){
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
             TransformerFactory tfactory = TransformerFactory.newInstance();
             tfactory.setURIResolver(resolver);
-            InputSource is = new InputSource(new FileInputStream(XSL_INCLUDE_FILE));
+            InputSource is = new InputSource(fis);
             is.setSystemId(SYSTEM_ID);
             SAXSource saxSource = new SAXSource(is);
-
-            Transformer transformer = tfactory.newTransformer(saxSource);
-        } catch (FileNotFoundException |  TransformerConfigurationException ex){
-            failUnexpected(ex);
+            assertNotNull(tfactory.newTransformer(saxSource));
         }
     }
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using StreamSource. xsl file has xsl:import in it
+     * created using StreamSource. style-sheet file has xsl:import in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver04() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver04() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)) {
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
             TransformerFactory tfactory = TransformerFactory.newInstance();
             tfactory.setURIResolver(resolver);
-
-            StreamSource streamSource = new StreamSource(new FileInputStream(XSL_IMPORT_FILE));
+            StreamSource streamSource = new StreamSource(fis);
             streamSource.setSystemId(SYSTEM_ID);
-
-            Transformer transformer = tfactory.newTransformer(streamSource);
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
+            assertNotNull(tfactory.newTransformer(streamSource));
         }
     }
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using DOMSource. xsl file has xsl:import in it
+     * created using DOMSource. style-sheet file has xsl:import in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver05() {
-        try {
-            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
-            TransformerFactory tfactory = TransformerFactory.newInstance();
-            tfactory.setURIResolver(resolver);
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            Document document = db.parse(new File(XSL_IMPORT_FILE));
-            DOMSource domSource = new DOMSource(document, SYSTEM_ID);
-
-            Transformer transformer = tfactory.newTransformer(domSource);
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerConfigurationException ex){
-            failUnexpected(ex);
-        }
-
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver05() throws Exception {
+        URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        tfactory.setURIResolver(resolver);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        Document document = db.parse(new File(XSL_IMPORT_FILE));
+        DOMSource domSource = new DOMSource(document, SYSTEM_ID);
+        assertNotNull(tfactory.newTransformer(domSource));
     }
 
     /**
      * This is to test the URIResolver.resolve() method when a transformer is
-     * created using SAXSource. xsl file has xsl:import in it
+     * created using SAXSource. style-sheet file has xsl:import in it.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void resolver06() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void resolver06() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)){
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
             TransformerFactory tfactory = TransformerFactory.newInstance();
             tfactory.setURIResolver(resolver);
-
-            InputSource is = new InputSource(new FileInputStream(XSL_IMPORT_FILE));
+            InputSource is = new InputSource(fis);
             is.setSystemId(SYSTEM_ID);
             SAXSource saxSource = new SAXSource(is);
-
-            Transformer transformer = tfactory.newTransformer(saxSource);
-        } catch (FileNotFoundException | TransformerConfigurationException ex){
-            failUnexpected(ex);
+            assertNotNull(tfactory.newTransformer(saxSource));
         }
-
     }
 
     /**
      * This is to test the URIResolver.resolve() method when there is an error
      * in the file.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public static void docResolver01() {
-        try {
+    @Test (groups = {"readLocalFiles"})
+    public static void docResolver01() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XML_DIR + "doctest.xsl")) {
             URIResolverTest resolver = new URIResolverTest("temp/colors.xml", SYSTEM_ID);
-            TransformerFactory tfactory = TransformerFactory.newInstance();
+            StreamSource streamSource = new StreamSource(fis);
+            streamSource.setSystemId(SYSTEM_ID);
 
-            StreamSource streamSource = new StreamSource(
-                    new FileInputStream(XML_DIR + FILE_SEP + "doctest.xsl"));
-            streamSource.setSystemId(SYSTEM_ID);
-            System.err.println(streamSource.getSystemId());
-
-            Transformer transformer = tfactory.newTransformer(streamSource);
+            Transformer transformer = TransformerFactory.newInstance().newTransformer(streamSource);
             transformer.setURIResolver(resolver);
 
-            File f = new File(XML_DIR + FILE_SEP + "myFake.xml");
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            DocumentBuilder builder = factory.newDocumentBuilder();
-            Document document = builder.parse(f);
+            File f = new File(XML_DIR + "myFake.xml");
+            Document document = DocumentBuilderFactory.newInstance().
+                    newDocumentBuilder().parse(f);
 
             // Use a Transformer for output
             DOMSource source = new DOMSource(document);
-            System.err.println("Ignore the following output -- just dumping it here");
             StreamResult result = new StreamResult(System.err);
+            // No exception is expected because resolver resolve wrong URI.
             transformer.transform(source, result);
-        } catch (IOException | ParserConfigurationException | SAXException
-                | TransformerException ex) {
-            failUnexpected(ex);
         }
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,19 +23,22 @@
 package javax.xml.transform.ptests.othervm;
 
 import javax.xml.transform.*;
+import jaxp.library.JAXPBaseTest;
+import static org.testng.Assert.fail;
 import org.testng.annotations.Test;
 
 /**
  * Negative test for set invalid TransformerFactory property.
  */
-public class TFCErrorTest{
+public class TFCErrorTest  extends JAXPBaseTest {
     @Test(expectedExceptions = ClassNotFoundException.class)
     public void tfce01() throws Exception {
         try{
-            System.setProperty("javax.xml.transform.TransformerFactory","xx");
-            TransformerFactory tFactory = TransformerFactory.newInstance();
-        } catch (TransformerFactoryConfigurationError error) {
-            throw error.getException();
+            setSystemProperty("javax.xml.transform.TransformerFactory","xx");
+            TransformerFactory.newInstance();
+            fail("Expect TransformerFactoryConfigurationError here");
+        } catch (TransformerFactoryConfigurationError expected) {
+            throw expected.getException();
         }
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 package javax.xml.xpath.ptests;
 
-import java.io.IOException;
+import java.io.FilePermission;
 import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -31,7 +31,6 @@
 import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPath;
 import static javax.xml.xpath.XPathConstants.BOOLEAN;
 import static javax.xml.xpath.XPathConstants.NODE;
@@ -41,7 +40,7 @@
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertEquals;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
@@ -49,12 +48,11 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * Class containing the test cases for XPathExpression API.
  */
-public class XPathExpressionTest {
+public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
     /**
      * Document object for testing XML file.
      */
@@ -87,13 +85,11 @@
 
     /**
      * Create Document object and XPath object for every time
-     * @throws ParserConfigurationException If the factory class cannot be
-     *                                      loaded, instantiated
-     * @throws SAXException If any parse errors occur.
-     * @throws IOException If operation on xml file failed.
+     * @throws Exception If any errors occur.
      */
     @BeforeTest
-    public void setup() throws ParserConfigurationException, SAXException, IOException {
+    public void setup() throws Exception {
+        setPermissions(new FilePermission(XML_PATH.toFile().toString(), "read"));
         document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
         xpath = XPathFactory.newInstance().newXPath();
     }
@@ -101,230 +97,200 @@
     /**
      * Test for evaluate(java.lang.Object item,QName returnType)throws
      * XPathExpressionException.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression01() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).
-                    evaluate(document, STRING), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression01() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).
+                evaluate(document, STRING), "6");
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) throws NPE if input
      * source is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression02() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression02() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) throws NPE if returnType
      * is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression03() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(document, null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression03() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(document, null);
     }
 
     /**
      * Test for method evaluate(java.lang.Object item,QName returnType).If a
      * request is made to evaluate the expression in the absence of a context
      * item, simple expressions, such as "1+1", can be evaluated.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression04() {
-        try {
-            assertEquals(xpath.compile("1+1").evaluate(document, STRING), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression04() throws XPathExpressionException {
+        assertEquals(xpath.compile("1+1").evaluate(document, STRING), "2");
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) throws IAE If returnType
      * is not one of the types defined in XPathConstants.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckXPathExpression05() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(document, TEST_QNAME);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression05() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(document, TEST_QNAME);
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) return correct boolean
      * value if returnType is Boolean.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression06() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).
+    public void testCheckXPathExpression06() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).
                 evaluate(document, BOOLEAN), true);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) return correct boolean
      * value if returnType is Boolean.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression07() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_B).
-                evaluate(document, BOOLEAN), false);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression07() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_B).
+            evaluate(document, BOOLEAN), false);
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) return correct number
      * value when return type is Double.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression08() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).
-                evaluate(document, NUMBER), 6d);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression08() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).
+            evaluate(document, NUMBER), 6d);
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) evaluate an attribute
      * value which returnType is Node.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression09() {
-        try {
-            Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
-                    evaluate(document, NODE);
-            assertEquals(attr.getValue(), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression09() throws XPathExpressionException {
+        Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
+                evaluate(document, NODE);
+        assertEquals(attr.getValue(), "6");
     }
 
     /**
      * evaluate(java.lang.Object item,QName returnType) evaluate an attribute
      * value which returnType is NodeList.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression10() {
-        try {
-            NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
-                    evaluate(document, NODESET);
-            Attr attr = (Attr) nodeList.item(0);
-            assertEquals(attr.getValue(), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression10() throws XPathExpressionException {
+        NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
+                evaluate(document, NODESET);
+        Attr attr = (Attr) nodeList.item(0);
+        assertEquals(attr.getValue(), "6");
     }
 
     /**
      * Test for evaluate(java.lang.Object item) when returnType is left off of
      * the XPath.evaluate method, all expressions are evaluated to a String
      * value.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression11() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression11() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document), "6");
     }
 
     /**
      * evaluate(java.lang.Object item) throws NPE if expression is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression12() {
-        try {
-            xpath.compile(null).evaluate(document);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression12() throws XPathExpressionException {
+        xpath.compile(null).evaluate(document);
     }
 
     /**
      * evaluate(java.lang.Object item) when a request is made to evaluate the
      * expression in the absence of a context item, simple expressions, such as
      * "1+1", can be evaluated.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathExpression13() {
-        try {
-            assertEquals(xpath.compile("1+1").evaluate(document), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression13() throws XPathExpressionException {
+        assertEquals(xpath.compile("1+1").evaluate(document), "2");
     }
 
     /**
      * evaluate(java.lang.Object item) throws NPE if document is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression14() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression14() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(null);
     }
 
     /**
      * valuate(InputSource source) return a string value if return type is
      * String.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression15() {
+    @Test (groups = {"readLocalFiles"})
+    public void testCheckXPathExpression15() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
                     evaluate(new InputSource(is)), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source) throws NPE if input source is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression16() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression16() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(null);
     }
 
     /**
-     * evaluate(InputSource source) throws NPE if expression is null
+     * evaluate(InputSource source) throws NPE if expression is null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression17() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression17() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(null).evaluate(new InputSource(is));
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -332,14 +298,12 @@
      * evaluate(InputSource source) throws XPathExpressionException if
      * returnType is String junk characters.
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPathExpression18() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression18() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile("-*&").evaluate(new InputSource(is));
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -347,67 +311,63 @@
      * evaluate(InputSource source) throws XPathExpressionException if
      * expression is a blank string " ".
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPathExpression19() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression19() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(" ").evaluate(new InputSource(is));
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * Test for evaluate(InputSource source,QName returnType) returns a string
      * value if returnType is String.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression20() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression20() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), STRING), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) throws NPE if source is
      * null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression21() {
-        try {
-            xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathExpression21() throws XPathExpressionException {
+        xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
     }
 
     /**
      * evaluate(InputSource source,QName returnType) throws NPE if expression is
      * null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression22() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression22() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(null).evaluate(new InputSource(is), STRING);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) throws NPE if returnType is
      * null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathExpression23() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression23() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), null);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -415,14 +375,12 @@
      * evaluate(InputSource source,QName returnType) throws
      * XPathExpressionException if expression is junk characters.
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPathExpression24() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression24() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile("-*&").evaluate(new InputSource(is), STRING);
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -430,14 +388,12 @@
      * evaluate(InputSource source,QName returnType) throws
      * XPathExpressionException if expression is blank " ".
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPathExpression25() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression25() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(" ").evaluate(new InputSource(is), STRING);
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -445,85 +401,85 @@
      * evaluate(InputSource source,QName returnType) throws
      * IllegalArgumentException if returnType is not one of the types defined
      * in XPathConstants.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckXPathExpression26() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class)
+    public void testCheckXPathExpression26() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), TEST_QNAME);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) return a correct boolean
      * value if returnType is Boolean.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression27() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression27() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), BOOLEAN), true);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) return a correct boolean
      * value if returnType is Boolean.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression28() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression28() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_B).
                 evaluate(new InputSource(is), BOOLEAN), false);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * evaluate(InputSource source,QName returnType) return a correct number
      * value if returnType is Number.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression29() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression29() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), NUMBER), 6d);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * Test for evaluate(InputSource source,QName returnType) returns a node if
      * returnType is Node.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression30() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression30() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), NODE);
             assertEquals(attr.getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * Test for evaluate(InputSource source,QName returnType) return a node list
      * if returnType is NodeList.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPathExpression31() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPathExpression31() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
                 evaluate(new InputSource(is), NODESET);
             assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
-        } catch (XPathExpressionException | IOException  ex) {
-            failUnexpected(ex);
         }
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,14 +26,14 @@
 import static javax.xml.xpath.XPathConstants.DOM_OBJECT_MODEL;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathFactoryConfigurationException;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPBaseTest;
 import static org.testng.AssertJUnit.assertNotNull;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for XPathFactory API.
  */
-public class XPathFactoryTest {
+public class XPathFactoryTest extends JAXPBaseTest {
     /**
      * Valid URL for creating a XPath factory.
      */
@@ -54,21 +54,21 @@
 
     /**
      * XPathFactory.newInstance(String uri) throws NPE if uri is null.
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    private void testCheckXPathFactory02() {
-        try {
-            XPathFactory.newInstance(null);
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFactory02() throws XPathFactoryConfigurationException {
+        XPathFactory.newInstance(null);
     }
 
     /**
      * XPathFactory.newInstance(String uri) throws XPFCE if uri is just a blank
      * string.
      *
-     * @throws XPathFactoryConfigurationException
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test(expectedExceptions = XPathFactoryConfigurationException.class)
     public void testCheckXPathFactory03() throws XPathFactoryConfigurationException {
@@ -78,21 +78,21 @@
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with valid
      * url - "http://java.sun.com/jaxp/xpath/dom".
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test
-    public void testCheckXPathFactory04() {
-        try {
-            assertNotNull(XPathFactory.newInstance(VALID_URL));
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFactory04() throws XPathFactoryConfigurationException {
+        assertNotNull(XPathFactory.newInstance(VALID_URL));
     }
 
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with invalid
      * url - "http://java.sun.com/jaxp/xpath/dom1".
      *
-     * @throws XPathFactoryConfigurationException
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test(expectedExceptions = XPathFactoryConfigurationException.class)
     public void testCheckXPathFactory05() throws XPathFactoryConfigurationException {
@@ -112,26 +112,24 @@
      * Test for constructor - XPathFactory.newInstance(String uri) with valid
      * url - "http://java.sun.com/jaxp/xpath/dom" and creating XPath with
      * newXPath().
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test
-    public void testCheckXPathFactory07() {
-        try {
-            assertNotNull(XPathFactory.newInstance(VALID_URL).newXPath());
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFactory07() throws XPathFactoryConfigurationException {
+        assertNotNull(XPathFactory.newInstance(VALID_URL).newXPath());
     }
 
     /**
      * Test for constructor - XPathFactory.newInstance(String uri) with valid
      * uri - DOM_OBJECT_MODEL.toString().
+     *
+     * @throws XPathFactoryConfigurationException If the specified object model
+    *          is unavailable, or if there is a configuration error.
      */
     @Test
-    public void testCheckXPathFactory08() {
-        try {
-            assertNotNull(XPathFactory.newInstance(DOM_OBJECT_MODEL));
-        } catch (XPathFactoryConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFactory08() throws XPathFactoryConfigurationException {
+        assertNotNull(XPathFactory.newInstance(DOM_OBJECT_MODEL));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
@@ -34,7 +34,7 @@
 /**
  * Class containing the test cases for XPathFunctionResolver.
  */
-public class XPathFunctionResolverTest {
+public class XPathFunctionResolverTest extends JAXPBaseTest {
     /**
      * A XPath for evaluation environment and expressions.
      */
@@ -54,26 +54,22 @@
     /**
      * Test for resolveFunction(QName functionName,int arity). evaluate will
      * continue as long as functionName is meaningful.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPathFunctionResolver01() {
-        try {
-            assertEquals(xpath.evaluate("round(1.7)", (Object)null), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFunctionResolver01() throws XPathExpressionException {
+        assertEquals(xpath.evaluate("round(1.7)", (Object)null), "2");
     }
 
     /**
      * Test for resolveFunction(QName functionName,int arity); evaluate throws
      * NPE if functionName  is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPathFunctionResolver02() {
-        try {
-            assertEquals(xpath.evaluate(null, "5"), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPathFunctionResolver02() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(null, "5"), "2");
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 package javax.xml.xpath.ptests;
 
-import java.io.IOException;
+import java.io.FilePermission;
 import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -33,7 +33,6 @@
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.xpath.XPath;
 import static javax.xml.xpath.XPathConstants.BOOLEAN;
 import static javax.xml.xpath.XPathConstants.NODE;
@@ -43,7 +42,7 @@
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertNotNull;
 import static org.testng.AssertJUnit.assertNull;
@@ -53,12 +52,11 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 /**
  * Class containing the test cases for XPath API.
  */
-public class XPathTest {
+public class XPathTest extends JAXPFileReadOnlyBaseTest {
     /**
      * Document object for testing XML file.
      */
@@ -91,13 +89,11 @@
 
     /**
      * Create Document object and XPath object for every time
-     * @throws ParserConfigurationException If the factory class cannot be
-     *                                      loaded, instantiated
-     * @throws SAXException If any parse errors occur.
-     * @throws IOException If operation on xml file failed.
+     * @throws Exception If any errors occur.
      */
     @BeforeTest
-    public void setup() throws ParserConfigurationException, SAXException, IOException {
+    public void setup() throws Exception {
+        setPermissions(new FilePermission(XML_DIR + "-", "read"));
         document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
         xpath = XPathFactory.newInstance().newXPath();
     }
@@ -105,62 +101,54 @@
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item, QName returnType) which return type is String.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath01() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, STRING), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath01() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, STRING), "6");
     }
 
 
     /**
      * Test for XPath.compile(java.lang.String expression) and then
      * evaluate(java.lang.Object item, QName returnType).
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath02() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document, STRING), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath02() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document, STRING), "6");
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item) when the third argument is left off of the XPath.evaluate method,
      * all expressions are evaluated to a String value.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath03() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath03() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document), "6");
     }
 
     /**
      * Test for XPath.compile(java.lang.String expression). If expression is
      * null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath04() {
-        try {
-            xpath.compile(null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath04() throws XPathExpressionException {
+        xpath.compile(null);
     }
 
     /**
      * Test for XPath.compile(java.lang.String expression). If expression cannot
      * be compiled junk characters, should throw XPathExpressionException.
      *
-     * @throws XPathExpressionException
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath05() throws XPathExpressionException {
@@ -171,7 +159,7 @@
      * Test for XPath.compile(java.lang.String expression). If expression is
      * blank, should throw XPathExpressionException
      *
-     * @throws XPathExpressionException
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath06() throws XPathExpressionException {
@@ -181,55 +169,46 @@
     /**
      * Test for XPath.compile(java.lang.String expression). The expression
      * cannot be evaluated as this does not exist.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath07() {
-        try {
-            assertEquals(xpath.compile(EXPRESSION_NAME_B).evaluate(document, STRING), "");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
-
+    public void testCheckXPath07() throws XPathExpressionException {
+        assertEquals(xpath.compile(EXPRESSION_NAME_B).evaluate(document, STRING), "");
     }
 
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
-     * item, QName returnType). If String expression is null, should throw NPE
+     * item, QName returnType). If String expression is null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath08() {
-        try {
-            xpath.evaluate(null, document, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath08() throws XPathExpressionException {
+        xpath.evaluate(null, document, STRING);
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item, QName returnType). If item is null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath09() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath09() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item, QName returnType). If returnType is null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath10() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, document, null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath10() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, document, null);
     }
 
     /**
@@ -237,23 +216,20 @@
      * item, QName returnType). If a request is made to evaluate the expression
      * in the absence of a context item, simple expressions, such as "1+1", can
      * be evaluated.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath11() {
-        try {
-            assertEquals(xpath.evaluate("1+1", document, STRING), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath11() throws XPathExpressionException {
+        assertEquals(xpath.evaluate("1+1", document, STRING), "2");
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) throws XPathExpressionException if expression is a empty
      * string "".
-     * .
      *
-     * @throws XPathExpressionException
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath12() throws XPathExpressionException {
@@ -264,161 +240,141 @@
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) throws IllegalArgumentException if returnType is not one of
      * the types defined in XPathConstants.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckXPath13() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, document, TEST_QNAME);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath13() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, document, TEST_QNAME);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) returns correct boolean value if returnType is Boolean.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath14() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, BOOLEAN), true);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath14() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, BOOLEAN), true);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) returns false as  expression is not successful in evaluating
      * to any result if returnType is Boolean.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath15() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_B, document, BOOLEAN), false);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath15() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_B, document, BOOLEAN), false);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) returns correct number value if return type is Number.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath16() {
-        try {
-            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, NUMBER), 6d);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath16() throws XPathExpressionException {
+        assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, NUMBER), 6d);
     }
 
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
      * returnType) returns correct string value if return type is Node.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath17() {
-        try {
-            assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A, document, NODE)).getValue(), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath17() throws XPathExpressionException {
+        assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A, document, NODE)).getValue(), "6");
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item, QName returnType). If return type is NodeList,the evaluated value
      * equals to "6" as expected.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath18() {
-        try {
-            NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A, document, NODESET);
-            assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath18() throws XPathExpressionException {
+        NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A, document, NODESET);
+        assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item). If expression is null, should throw NPE.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath19() {
-        try {
-            xpath.evaluate(null, document);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath19() throws XPathExpressionException {
+        xpath.evaluate(null, document);
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
      * item). If a request is made to evaluate the expression in the absence of
      * a context item, simple expressions, such as "1+1", can be evaluated.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test
-    public void testCheckXPath20() {
-        try {
-            assertEquals(xpath.evaluate("1+1", document), "2");
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath20() throws XPathExpressionException {
+        assertEquals(xpath.evaluate("1+1", document), "2");
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, java.lang.Object item) throws
      * NPE if InputSource is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath21() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath21() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, null);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source) return
      * correct value by looking for Node.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath22() {
+    @Test (groups = {"readLocalFiles"})
+    public void testCheckXPath22() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is)), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source) throws
      * NPE if InputSource is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath23() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, null);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath23() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, null);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source) throws
      * NPE if String expression is null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath24() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPath24() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(null, new InputSource(is));
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -427,14 +383,12 @@
      * If expression is junk characters, expression cannot be evaluated, should
      * throw XPathExpressionException.
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPath25() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath25() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate("-*&", new InputSource(is));
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -442,66 +396,62 @@
      * XPath.evaluate(java.lang.String expression, InputSource source) throws
      * XPathExpressionException if expression is blank " ".
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPath26() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath26() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(" ", new InputSource(is));
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) returns correct string value which return type is String.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath27() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath27() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), STRING), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) throws NPE if source is null.
+     *
+     * @throws XPathExpressionException If the expression cannot be evaluated.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath28() {
-        try {
-            xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
-        } catch (XPathExpressionException ex) {
-            failUnexpected(ex);
-        }
+    public void testCheckXPath28() throws XPathExpressionException {
+        xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) throws NPE if expression is null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath29() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPath29() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(null, new InputSource(is), STRING);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
-     * QName returnType) throws NPE if returnType is null .
+     * QName returnType) throws NPE if returnType is null.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void testCheckXPath30() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void testCheckXPath30() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), null);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -509,14 +459,12 @@
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) throws XPathExpressionException if expression is junk characters.
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPath31() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath31() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate("-*&", new InputSource(is), STRING);
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -524,14 +472,12 @@
      * XPath.evaluate(java.lang.String expression, InputSource source, QName
      * returnType) throws XPathExpressionException if expression is blank " ".
      *
-     * @throws XPathExpressionException
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = XPathExpressionException.class)
-    public void testCheckXPath32() throws XPathExpressionException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath32() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(" ", new InputSource(is), STRING);
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -539,84 +485,84 @@
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) throws IllegalArgumentException if returnType is not
      * one of the types defined in XPathConstants.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testCheckXPath33() {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class)
+    public void testCheckXPath33() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), TEST_QNAME);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) return correct boolean value if return type is Boolean.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath34() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath34() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
                 BOOLEAN), true);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) return correct boolean value if return type is Boolean.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath35() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath35() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
                 BOOLEAN), false);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) return correct number value if return type is Number.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath36() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath36() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
                 NUMBER), 6d);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) return correct string value if return type is Node.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath37() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath37() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
                 new InputSource(is), NODE)).getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * Test for XPath.evaluate(java.lang.String expression, InputSource source,
      * QName returnType) which return type is NodeList.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath38() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath38() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
                 new InputSource(is), NODESET);
             assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
@@ -624,57 +570,57 @@
      * Test for XPath.evaluate(java.lang.String expression, InputSource iSource,
      * QName returnType). If return type is Boolean, should return false as
      * expression is not successful in evaluating to any result.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath52() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath52() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
                 BOOLEAN), false);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource iSource, QName
      * returnType) returns correct number value which return type is Number.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath53() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath53() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
                 NUMBER), 6d);
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource iSource, QName
      * returnType) returns a node value if returnType is Node.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath54() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath54() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
                 new InputSource(is), NODE)).getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * XPath.evaluate(java.lang.String expression, InputSource iSource, QName
      * returnType) returns a node list if returnType is NodeList.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckXPath55() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckXPath55() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
                 new InputSource(is), NODESET);
             assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
-        } catch (XPathExpressionException | IOException ex) {
-            failUnexpected(ex);
         }
     }
 
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  */
 package org.xml.sax.ptests;
 
+import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 import org.testng.annotations.Test;
@@ -30,7 +31,7 @@
 /**
  * Class containing the test cases for AttributesImpl API.
  */
-public class AttrImplTest {
+public class AttrImplTest extends JAXPBaseTest {
     private static final String CAR_URI = "http://www.cars.com/xml";
 
     private static final String CAR_LOCALNAME = "part";
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,20 +23,13 @@
 package org.xml.sax.ptests;
 
 import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -45,39 +38,29 @@
  * ContentHandler has Attributes as one of its arguments. Attributes
  * pertaining to an element are taken into this argument and various methods
  * of Attributes interfaces are tested. This program uses Namespace processing
- * with namespaces in xml file. This program does not use Validation
+ * with namespaces in XML file. This program does not use Validation
  */
-public class AttributesNSTest {
+public class AttributesNSTest extends JAXPFileBaseTest {
     /**
      * Test for Attribute Interface's setter/getter.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "AttributesNS.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "AttributesNS.out";
         String goldFile = GOLDEN_DIR + "AttributesNSGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            // http://www.saxproject.com/?selected=namespaces namespace-prefixes
-            //set to false to supress xmlns attributes
-            spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
-                                        false);
-            SAXParser saxParser = spf.newSAXParser();
-            MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
-            saxParser.parse(new File(xmlFile), myAttrCHandler);
-            myAttrCHandler.flushAndClose();
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException | ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        // http://www.saxproject.com/?selected=namespaces namespace-prefixes
+        //set to false to supress xmlns attributes
+        spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
+                                    false);
+        SAXParser saxParser = spf.newSAXParser();
+        MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
+        saxParser.parse(new File(xmlFile), myAttrCHandler);
+        myAttrCHandler.flushAndClose();
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,20 +23,13 @@
 package org.xml.sax.ptests;
 
 import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -48,37 +41,28 @@
  * This program uses Namespace processing without any namepsaces in xml file.
  * This program uses Validation
  */
-public class AttributesTest {
+public class AttributesTest extends JAXPFileBaseTest {
     /**
      * Unit test for Attributes interface. Prints all attributes into output
      * file. Check it with golden file.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "Attributes.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "Attributes.out";
         String goldFile = GOLDEN_DIR + "AttributesGF.out";
         String xmlFile = XML_DIR + "family.xml";
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
-                                        true);
-            spf.setValidating(true);
-            SAXParser saxParser = spf.newSAXParser();
-            MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
-            saxParser.parse(new File(xmlFile), myAttrCHandler);
-            myAttrCHandler.flushAndClose();
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException | ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
+                                    true);
+        spf.setValidating(true);
+        SAXParser saxParser = spf.newSAXParser();
+        MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
+        saxParser.parse(new File(xmlFile), myAttrCHandler);
+        myAttrCHandler.flushAndClose();
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,24 +26,18 @@
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -52,43 +46,34 @@
  * transverses XML and print all visited node  when XMLreader parses XML. Test
  * verifies output is same as the golden file.
  */
-public class ContentHandlerTest {
+public class ContentHandlerTest extends JAXPFileBaseTest {
     /**
      * Content event handler visit all nodes to print to output file.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testcase01() {
-        String outputFile = CLASS_DIR + "Content.out";
+    public void testcase01() throws Exception {
+        String outputFile = USER_DIR + "Content.out";
         String goldFile = GOLDEN_DIR + "ContentGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
 
-        try(FileInputStream instream = new FileInputStream(xmlFile)) {
+        try(FileInputStream instream = new FileInputStream(xmlFile);
+                MyContentHandler cHandler = new MyContentHandler(outputFile)) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
             spf.setNamespaceAware(true);
             XMLReader xmlReader = spf.newSAXParser().getXMLReader();
-            ContentHandler cHandler = new MyContentHandler(outputFile);
             xmlReader.setContentHandler(cHandler);
-            InputSource is = new InputSource(instream);
-            xmlReader.parse(is);
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch( IOException | SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
+            xmlReader.parse(new InputSource(instream));
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
 
 /**
  * A content write out handler.
  */
-class MyContentHandler extends XMLFilterImpl {
+class MyContentHandler extends XMLFilterImpl implements AutoCloseable {
     /**
      * Prefix to every exception.
      */
@@ -258,4 +243,14 @@
             throw new SAXException(WRITE_ERROR, ex);
         }
     }
+
+    /**
+     * Close the writer if it's initiated.
+     * @throws IOException if any IO error when close buffered writer.
+     */
+    @Override
+    public void close() throws IOException {
+        if (bWriter != null)
+            bWriter.close();
+    }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,11 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
@@ -42,7 +38,6 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -50,46 +45,32 @@
  * XMLReader parse XML with default handler that transverses XML and
  * print all visited node. Test verifies output is same as the golden file.
  */
-public class DefaultHandlerTest {
+public class DefaultHandlerTest extends JAXPFileBaseTest {
     /**
      * Test default handler that transverses XML and  print all visited node.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testDefaultHandler() {
-        String outputFile = CLASS_DIR + "DefaultHandler.out";
+    public void testDefaultHandler() throws Exception {
+        String outputFile = USER_DIR + "DefaultHandler.out";
         String goldFile = GOLDEN_DIR + "DefaultHandlerGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
 
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxparser = spf.newSAXParser();
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        SAXParser saxparser = spf.newSAXParser();
 
-            MyDefaultHandler handler = new MyDefaultHandler(outputFile);
-            File file = new File(xmlFile);
-            String Absolutepath = file.getAbsolutePath();
-            String newAbsolutePath = Absolutepath;
-            if (File.separatorChar == '\\')
-                    newAbsolutePath = Absolutepath.replace('\\', '/');
-            String uri = "file:///" + newAbsolutePath;
-            saxparser.parse(uri, handler);
-        } catch (IOException | ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-        // Need close the output file before we compare it with golden file.
-        try {
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+        MyDefaultHandler handler = new MyDefaultHandler(outputFile);
+        File file = new File(xmlFile);
+        String Absolutepath = file.getAbsolutePath();
+        String newAbsolutePath = Absolutepath;
+        if (File.separatorChar == '\\')
+                newAbsolutePath = Absolutepath.replace('\\', '/');
+        saxparser.parse("file:///" + newAbsolutePath, handler);
+
+        assertTrue(compareWithGold(goldFile, outputFile));
+
     }
 }
 
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,23 +26,19 @@
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -50,14 +46,16 @@
  * ErrorHandler unit test. Set a ErrorHandle to XMLReader. Capture fatal error
  * events in ErrorHandler.
  */
-public class EHFatalTest {
+public class EHFatalTest extends JAXPFileBaseTest {
     /**
      * Error Handler to capture all error events to output file. Verifies the
      * output file is same as golden file.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testEHFatal() {
-        String outputFile = CLASS_DIR + "EHFatal.out";
+    public void testEHFatal() throws Exception {
+        String outputFile = USER_DIR + "EHFatal.out";
         String goldFile = GOLDEN_DIR + "EHFatalGF.out";
         String xmlFile = XML_DIR + "invalid.xml";
 
@@ -68,25 +66,12 @@
             xmlReader.setErrorHandler(eHandler);
             InputSource is = new InputSource(instream);
             xmlReader.parse(is);
-        } catch (IOException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        } catch (SAXException ex) {
-            System.out.println("This is expected:" + ex);
+            fail("Parse should throw SAXException");
+        } catch (SAXException expected) {
+            // This is expected.
         }
         // Need close the output file before we compare it with golden file.
-        try {
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
 
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyAttrCHandler.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.xml.sax.ptests;
-
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Simple attributes handler.
- */
-public class MyAttrCHandler extends DefaultHandler {
-    /**
-     * FileWriter to write string to output file.
-     */
-    private final BufferedWriter bWriter;
-
-    /**
-     * Initiate FileWriter
-     * @param fileName output file name.
-     * @throws IOException
-     */
-    public MyAttrCHandler(String fileName) throws IOException {
-        bWriter = new BufferedWriter(new FileWriter(fileName));
-    }
-
-    /**
-     * Write element content before start access every element.
-     * @throws org.xml.sax.SAXException
-     */
-    @Override
-    public void startElement(String uri, String localName,
-                String qName, Attributes attributes) throws SAXException {
-        try {
-            String string = "uri <" + uri + "> localName <" + localName +
-                        "> qName <" + qName + ">";
-
-            bWriter.write( string, 0, string.length());
-            bWriter.newLine();
-
-            int length = attributes.getLength();
-            string = "length: " + length;
-
-            bWriter.write( string, 0, string.length());
-            bWriter.newLine();
-
-            for (int ind=0; ind < length ; ind++) {
-                string = "For index = " + ind + "\n";
-                string += "getLocalName <" + attributes.getLocalName(ind)
-                                +">" + "\n";
-                string += "getQName <" + attributes.getQName(ind) +">" + "\n";
-                string += "getType <" + attributes.getType(ind) +">" + "\n";
-                string += "getURI <" + attributes.getURI(ind) +">" + "\n";
-                string += "getValue <" + attributes.getValue(ind) +">" + "\n";
-
-                bWriter.write( string, 0, string.length());
-                bWriter.newLine();
-
-                String gotLocalName = attributes.getLocalName(ind);
-                String gotQName = attributes.getQName(ind);
-                String gotURI = attributes.getURI(ind);
-
-                string ="Using localName, qname and uri pertaining to index = "
-                                + ind;
-                bWriter.write( string, 0, string.length());
-                bWriter.newLine();
-
-                string = "getIndex(qName) <" + attributes.getIndex(gotQName)
-                                +">" + "\n";
-                string += "getIndex(uri, localName) <" +
-                        attributes.getIndex(gotURI, gotLocalName) +">" + "\n";
-
-                string += "getType(qName) <" +
-                        attributes.getType(gotQName) +">" + "\n";
-                string += "getType(uri, localName) <" +
-                        attributes.getType(gotURI, gotLocalName) +">" + "\n";
-
-                string += "getValue(qName) <" +
-                        attributes.getValue(gotQName) +">" + "\n";
-                string += "getValue(uri, localName) <" +
-                        attributes.getValue(gotURI, gotLocalName) +">" + "\n";
-
-                bWriter.write( string, 0, string.length());
-                bWriter.newLine();
-            }
-            bWriter.newLine();
-        } catch(IOException ex){
-            throw new SAXException(ex);
-        }
-    }
-
-    /**
-     * Flush the stream and close the file.
-     * @throws IOException when writing or closing file failed.
-     */
-    public void flushAndClose() throws IOException {
-        bWriter.flush();
-        bWriter.close();
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyNSContentHandler.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.xml.sax.ptests;
-
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.LocatorImpl;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.FileWriter;
-import org.xml.sax.SAXException;
-
-class MyNSContentHandler extends DefaultHandler {
-    /**
-     * Prefix for written string.
-     */
-    private final static String WRITE_ERROR = "bWrite error";
-    /**
-     * FileWriter to write output file.
-     */
-    private final BufferedWriter bWriter;
-
-    /**
-     * Default locator.
-     */
-    Locator locator = new LocatorImpl();
-
-    /**
-     * Initiate FileWrite.
-     * @param outputFileName file name of output file.
-     * @throws SAXException when open output file failed.
-     */
-    public MyNSContentHandler(String outputFileName) throws SAXException {
-        try {
-            bWriter = new BufferedWriter(new FileWriter(outputFileName));
-        } catch (IOException ex) {
-            throw new SAXException(ex);
-        }
-    }
-
-    /**
-     * Write characters tag along with content of characters when meet
-     * characters event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void characters(char[] ch, int start, int length)
-            throws SAXException {
-        String s = new String(ch, start, length);
-        println("characters...length is:" + s.length() + "\n"
-                + "<" + s + ">");
-    }
-
-    /**
-     * Write endDocument tag then flush the content and close the file when meet
-     * endDocument event.
-     * @throws IOException error happen when writing file or closing file.
-     */
-    @Override
-    public void endDocument() throws SAXException {
-        try {
-            println("endDocument...");
-            bWriter.flush();
-            bWriter.close();
-        } catch (IOException ex) {
-            throw new SAXException(WRITE_ERROR, ex);
-        }
-    }
-
-    /**
-     * Write endElement tag with namespaceURI, localName, qName to the file when
-     * meet endElement event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void endElement(String namespaceURI, String localName, String qName)
-            throws SAXException {
-        println("endElement...\n" + "namespaceURI: <" + namespaceURI
-                + "> localName: <" + localName + "> qName: <" + qName + ">");
-    }
-
-    /**
-     * Write endPrefixMapping tag along with prefix to the file when meet
-     * endPrefixMapping event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void endPrefixMapping(String prefix) throws SAXException {
-        println("endPrefixMapping...\n" + "prefix: <" + prefix + ">");
-    }
-
-    /**
-     * Write ignorableWhitespace tag along with white spaces when meet
-     * ignorableWhitespace event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void ignorableWhitespace(char[] ch, int start, int length)
-            throws SAXException {
-        String s = new String(ch, start, length);
-        println("ignorableWhitespace...\n" + s
-                + " ignorable white space string length: " + s.length());
-    }
-
-    /**
-     * Write processingInstruction tag along with target name and target data
-     * when meet processingInstruction event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void processingInstruction(String target, String data)
-            throws SAXException {
-        println("processingInstruction...target:<" + target
-                + "> data: <" + data + ">");
-    }
-
-    /**
-     * Write setDocumentLocator tag when meet setDocumentLocator event.
-     */
-    @Override
-    public void setDocumentLocator(Locator locator) {
-        try {
-            this.locator = locator;
-            println("setDocumentLocator...");
-        } catch (SAXException ex) {
-            System.err.println(WRITE_ERROR + ex);
-        }
-    }
-
-    /**
-     * Write skippedEntity tag along with entity name when meet skippedEntity
-     * event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void skippedEntity(String name) throws SAXException {
-        println("skippedEntity...\n" + "name: <" + name + ">");
-    }
-
-    /**
-     * Write startDocument tag when meet startDocument event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void startDocument() throws SAXException {
-        println("startDocument...");
-    }
-
-    /**
-     * Write startElement tag along with namespaceURI, localName, qName, number
-     * of attributes and line number when meet startElement event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void startElement(String namespaceURI, String localName,
-            String qName, Attributes atts) throws SAXException {
-        println("startElement...\n" + "namespaceURI: <" + namespaceURI
-                + "> localName: <" + localName + "> qName: <" + qName
-                + "> Number of Attributes: <" + atts.getLength()
-                + "> Line# <" + locator.getLineNumber() + ">");
-    }
-
-    /**
-     * Write startPrefixMapping tag along with prefix and uri when meet
-     * startPrefixMapping event.
-     * @throws IOException error happen when writing file.
-     */
-    @Override
-    public void startPrefixMapping(String prefix, String uri)
-            throws SAXException {
-        println("startPrefixMapping...\n" + "prefix: <" + prefix
-                + "> uri: <" + uri + ">");
-    }
-    /**
-     * Write outString to output file.
-     * @param outString string to be written.
-     * @throws SAXException
-     */
-    private void println(String outString) throws SAXException {
-        try {
-            bWriter.write( outString, 0, outString.length());
-            bWriter.newLine();
-        } catch (IOException ex) {
-            throw new SAXException(WRITE_ERROR, ex);
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 package org.xml.sax.ptests;
 
 import java.util.Enumeration;
+import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 import org.testng.annotations.Test;
@@ -31,7 +32,7 @@
 /**
  * Unit test cases for NamespaceSupport API
  */
-public class NSSupportTest {
+public class NSSupportTest extends JAXPBaseTest {
     /**
      * Empty prefix name.
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.xml.sax.ptests;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPBaseTest;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.XMLReader;
+
+/**
+ * Class containing the test cases for Namespace Table defined at
+ * http://www.megginson.com/SAX/Java/namespaces.html
+ */
+public class NSTableTest extends JAXPBaseTest {
+    private static final String NAMESPACES =
+                        "http://xml.org/sax/features/namespaces";
+    private static final String NAMESPACE_PREFIXES =
+                        "http://xml.org/sax/features/namespace-prefixes";
+
+    /**
+     * Here namespace processing and namespace-prefixes are enabled.
+     * The testcase tests XMLReader for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void xrNSTable01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        SAXParser saxParser = spf.newSAXParser();
+
+        XMLReader xmlReader = saxParser.getXMLReader();
+        xmlReader.setFeature(NAMESPACE_PREFIXES, true);
+
+        assertTrue(xmlReader.getFeature(NAMESPACES));
+        assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is enabled. This will make namespace-prefixes
+     * disabled. The testcase tests XMLReader for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void xrNSTable02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertTrue(xmlReader.getFeature(NAMESPACES));
+        assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is disabled. This will make namespace-prefixes
+     * enabled. The testcase tests XMLReader for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void xrNSTable03() throws Exception {
+        XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+        assertFalse(xmlReader.getFeature(NAMESPACES));
+        assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is disabled, and namespace-prefixes is
+     * disabled. This will make namespace processing on.The testcase tests
+     * XMLReader for this.  This behavior only apply to crimson, not
+     * XERCES.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void xrNSTable04() throws Exception {
+        XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+        xmlReader.setFeature(NAMESPACE_PREFIXES, false);
+        assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing and namespace-prefixes are enabled.
+     * The testcase tests SAXParserFactory for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void spNSTable01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setFeature(NAMESPACE_PREFIXES,true);
+        assertTrue(spf.getFeature(NAMESPACES));
+        assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is enabled. This will make namespace-prefixes
+     * disabled. The testcase tests SAXParserFactory for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void spNSTable02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        assertTrue(spf.getFeature(NAMESPACES));
+        assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
+    }
+
+    /**
+     * Here namespace processing is disabled. This will make namespace-prefixes
+     * enabled. The testcase tests SAXParserFactory for this.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void spNSTable03() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertFalse(spf.getFeature(NAMESPACES));
+        assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+    }
+    /**
+     * Here namespace processing is disabled, and namespace-prefixes is
+     * disabled. This will make namespace processing on.The testcase tests
+     * SAXParserFactory for this.  This behavior only apply to crimson,
+     * not xerces.
+     *
+     * @throws Exception If any errors occur.
+     */
+    @Test
+    public void spNSTable04() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setFeature(NAMESPACE_PREFIXES, false);
+        assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest01.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.xml.sax.ptests;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.XMLReader;
-
-/**
- * Class containing the test cases for Namespace Table defined at
- * http://www.megginson.com/SAX/Java/namespaces.html
- */
-public class NSTableTest01 {
-    private static final String NAMESPACES =
-                        "http://xml.org/sax/features/namespaces";
-    private static final String NAMESPACE_PREFIXES =
-                        "http://xml.org/sax/features/namespace-prefixes";
-
-    /**
-     * Here namespace processing and namespace-prefixes are enabled.
-     * The testcase tests XMLReader for this.
-     */
-    @Test
-    public void xrNSTable01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxParser = spf.newSAXParser();
-
-            XMLReader xmlReader = saxParser.getXMLReader();
-            xmlReader.setFeature(NAMESPACE_PREFIXES, true);
-
-            assertTrue(xmlReader.getFeature(NAMESPACES));
-            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing is enabled. This will make namespace-prefixes
-     * disabled. The testcase tests XMLReader for this.
-     */
-    @Test
-    public void xrNSTable02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxParser = spf.newSAXParser();
-
-            XMLReader xmlReader = saxParser.getXMLReader();
-            assertTrue(xmlReader.getFeature(NAMESPACES));
-            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-
-    }
-
-    /**
-     * Here namespace processing is disabled. This will make namespace-prefixes
-     * enabled. The testcase tests XMLReader for this.
-     */
-    @Test
-    public void xrNSTable03() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            SAXParser saxParser = spf.newSAXParser();
-            XMLReader xmlReader = saxParser.getXMLReader();
-            assertFalse(xmlReader.getFeature(NAMESPACES));
-            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing is disabled, and namespace-prefixes is
-     * disabled. This will make namespace processing on.The testcase tests
-     * XMLReader for this.  This behavior only apply to crimson, not
-     * xerces
-     */
-    @Test
-    public void xrNSTable04() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            SAXParser saxParser = spf.newSAXParser();
-            XMLReader xmlReader = saxParser.getXMLReader();
-            xmlReader.setFeature(NAMESPACE_PREFIXES, false);
-
-            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing and namespace-prefixes are enabled.
-     * The testcase tests SAXParserFactory for this.
-     */
-    @Test
-    public void spNSTable01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            spf.setFeature(NAMESPACE_PREFIXES,true);
-            assertTrue(spf.getFeature(NAMESPACES));
-            assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException
-                | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing is enabled. This will make namespace-prefixes
-     * disabled. The testcase tests SAXParserFactory for this.
-     */
-    @Test
-    public void spNSTable02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            assertTrue(spf.getFeature(NAMESPACES));
-            assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException
-                | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
-    }
-
-    /**
-     * Here namespace processing is disabled. This will make namespace-prefixes
-     * enabled. The testcase tests SAXParserFactory for this.
-     */
-    @Test
-    public void spNSTable03() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertFalse(spf.getFeature(NAMESPACES));
-            assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException
-                | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
-    }
-    /**
-     * Here namespace processing is disabled, and namespace-prefixes is
-     * disabled. This will make namespace processing on.The testcase tests
-     * SAXParserFactory for this.  This behavior only apply to crimson,
-     * not xerces.
-     */
-    @Test
-    public void spNSTable04() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setFeature(NAMESPACE_PREFIXES, false);
-
-            assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXNotRecognizedException
-                | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,8 @@
 package org.xml.sax.ptests;
 
 import java.io.FileInputStream;
-import java.io.IOException;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
@@ -35,7 +33,6 @@
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.ParserAdapter;
 import org.xml.sax.helpers.XMLFilterImpl;
@@ -47,7 +44,7 @@
  * Unit test cases for ParserAdapter API. By default the only features recognized
  * are namespaces and namespace-prefixes.
  */
-public class ParserAdapterTest {
+public class ParserAdapterTest extends JAXPFileReadOnlyBaseTest {
     /**
      * namespaces feature name.
      */
@@ -67,10 +64,9 @@
 
     /**
      * Initiate ParserAdapter.
-     * @throws ParserConfigurationException
-     * @throws SAXException
+     * @throws Exception If any errors occur.
      */
-    ParserAdapterTest() throws ParserConfigurationException, SAXException {
+    ParserAdapterTest() throws Exception {
         SAXParserFactory spf = SAXParserFactory.newInstance();
         XMLReader xmlReader = spf.newSAXParser().getXMLReader();
         XMLReaderAdapter xmlReaderAdapter = new XMLReaderAdapter(xmlReader);
@@ -151,129 +147,111 @@
 
     /**
      * parserAdapter.getFeature(NAMESPACES) returns true be default.
+     *
+     * @exception Exception If any errors occur.
      */
     @Test
-    public void getFeature01() {
-        try {
-           assertTrue(parserAdapter.getFeature(NAMESPACES));
-        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
+    public void getFeature01() throws Exception {
+        assertTrue(parserAdapter.getFeature(NAMESPACES));
     }
 
     /**
      * parserAdapter.getFeature(NAMESPACE_PREFIXES) returns true be default.
+     *
+     * @exception Exception If any errors occur.
      */
     @Test
-    public void getFeature02() {
-        try {
-           assertFalse(parserAdapter.getFeature(NAMESPACE_PREFIXES));
-        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
+    public void getFeature02() throws Exception {
+        assertFalse(parserAdapter.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
      * SAXNotRecognizedException thrown when feature name is not known one.
-     * @throws org.xml.sax.SAXNotRecognizedException expected Exception
+     *
+     * @exception Exception If any errors occur.
      */
     @Test(expectedExceptions = SAXNotRecognizedException.class)
-    public void getFeature03() throws SAXNotRecognizedException {
-        try {
-            parserAdapter.getFeature("no-meaning-feature");
-        } catch (SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
+    public void getFeature03() throws Exception {
+        parserAdapter.getFeature("no-meaning-feature");
     }
 
     /**
      * Obtain getFeature after it's set returns set value.
+     *
+     * @exception Exception If any errors occur.
      */
     @Test
-    public void setFeature01() {
-        try {
-           parserAdapter.setFeature(NAMESPACES, false);
-           assertFalse(parserAdapter.getFeature(NAMESPACES));
-        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
+    public void setFeature01() throws Exception {
+        parserAdapter.setFeature(NAMESPACES, false);
+        assertFalse(parserAdapter.getFeature(NAMESPACES));
     }
 
     /**
      * Obtain getFeature after it's set returns set value.
+     *
+     * @exception Exception If any errors occur.
      */
     @Test
-    public void setFeature02() {
-        try {
-           parserAdapter.setFeature(NAMESPACE_PREFIXES, false);
-           assertFalse(parserAdapter.getFeature(NAMESPACE_PREFIXES));
-        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
+    public void setFeature02() throws Exception {
+        parserAdapter.setFeature(NAMESPACE_PREFIXES, false);
+        assertFalse(parserAdapter.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
      * Obtain getFeature after it's set returns set value.
+     *
+     * @exception Exception If any errors occur.
      */
     @Test
-    public void setFeature03() {
-        try {
-           parserAdapter.setFeature(NAMESPACES, true);
-           assertTrue(parserAdapter.getFeature(NAMESPACES));
-        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
+    public void setFeature03() throws Exception {
+        parserAdapter.setFeature(NAMESPACES, true);
+        assertTrue(parserAdapter.getFeature(NAMESPACES));
     }
 
     /**
      * Obtain getFeature after it's set returns set value.
+     *
+     * @exception Exception If any errors occur.
      */
     @Test
-    public void setFeature04() {
-        try {
-           parserAdapter.setFeature(NAMESPACE_PREFIXES, true);
-           assertTrue(parserAdapter.getFeature(NAMESPACE_PREFIXES));
-        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
-            failUnexpected(ex);
-        }
+    public void setFeature04() throws Exception {
+        parserAdapter.setFeature(NAMESPACE_PREFIXES, true);
+        assertTrue(parserAdapter.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
      * NPE expected when parsing a null object by ParserAdapter.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void parse01() {
-        try {
-            parserAdapter.parse((InputSource)null);
-        } catch (IOException | SAXException ex) {
-            failUnexpected(ex);
-        }
+    public void parse01() throws Exception {
+        parserAdapter.parse((InputSource)null);
     }
 
     /**
      * SAXException expected when parsing a wrong-formatter XML with ParserAdapter.
-     * @throws org.xml.sax.SAXException
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class)
-    public void parse02() throws SAXException {
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class)
+    public void parse02() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
             InputSource is = new InputSource(fis);
             parserAdapter.parse(is);
-        } catch (IOException ex) {
-            failUnexpected(ex);
         }
     }
 
     /**
      * Parse a well-formatter XML with ParserAdapter.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void parse03() {
+    @Test(groups = {"readLocalFiles"})
+    public void parse03() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "correct.xml")) {
             InputSource is = new InputSource(fis);
             parserAdapter.parse(is);
-        } catch (IOException | SAXException ex) {
-            failUnexpected(ex);
         }
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,21 +26,16 @@
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -48,12 +43,14 @@
  * Entity resolver should be invoked in XML parse. This test verifies parsing
  * process by checking the output with golden file.
  */
-public class ResolverTest {
+public class ResolverTest extends JAXPFileBaseTest {
     /**
      * Unit test for entityResolver setter.
+     *
+     * @throws Exception If any errors occur.
      */
-    public void testResolver() {
-        String outputFile = CLASS_DIR + "EntityResolver.out";
+    public void testResolver() throws Exception {
+        String outputFile = USER_DIR + "EntityResolver.out";
         String goldFile = GOLDEN_DIR + "EntityResolverGF.out";
         String xmlFile = XML_DIR + "publish.xml";
 
@@ -64,23 +61,8 @@
             xmlReader.setEntityResolver(eResolver);
             InputSource is = new InputSource(instream);
             xmlReader.parse(is);
-        } catch(IOException | SAXException | ParserConfigurationException ex ) {
-            failUnexpected(ex);
         }
-        // Need close the output file before we compare it with golden file.
-        try {
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
 
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,20 +23,12 @@
 package org.xml.sax.ptests;
 
 import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
-import org.xml.sax.SAXException;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -44,91 +36,64 @@
  * This class contains the testcases to test SAXParser with regard to
  * Namespace Table defined at http://www.megginson.com/SAX/Java/namespaces.html
  */
-public class SAXParserNSTableTest {
+public class SAXParserNSTableTest extends JAXPFileBaseTest {
     /**
      * namespace processing is enabled. namespace-prefix is also is enabled.
      * So it is a True-True combination.
-     * The test is to test SAXParser with these conditions
+     * The test is to test SAXParser with these conditions.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testWithTrueTrue() {
-        String outputFile = CLASS_DIR + "SPNSTableTT.out";
+    public void testWithTrueTrue() throws Exception {
+        String outputFile = USER_DIR + "SPNSTableTT.out";
         String goldFile = GOLDEN_DIR + "NSTableTTGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
-                                        true);
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
+                                    true);
+        try (MyNSContentHandler handler = new MyNSContentHandler(outputFile)) {
+            spf.newSAXParser().parse(new File(xmlFile), handler);
+        }
+        assertTrue(compareWithGold(goldFile, outputFile));
 
-            SAXParser saxParser = spf.newSAXParser();
-            saxParser.parse(new File(xmlFile), new MyNSContentHandler(outputFile));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
     }
     /**
      * namespace processing is enabled. Hence namespace-prefix is
-     * expected to be automaically off. So it is a True-False combination.
-     * The test is to test SAXParser with these conditions
+     * expected to be automatically off. So it is a True-False combination.
+     * The test is to test SAXParser with these conditions.
+     *
+     * @throws Exception If any errors occur.
      */
-    public void testWithTrueFalse() {
-        String outputFile = CLASS_DIR + "SPNSTableTF.out";
+    public void testWithTrueFalse() throws Exception {
+        String outputFile = USER_DIR + "SPNSTableTF.out";
         String goldFile = GOLDEN_DIR + "NSTableTFGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxParser = spf.newSAXParser();
-            saxParser.parse(new File(xmlFile), new MyNSContentHandler(outputFile));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        try (MyNSContentHandler handler = new MyNSContentHandler(outputFile)) {
+            spf.newSAXParser().parse(new File(xmlFile), handler);
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 
     /**
      * namespace processing is not enabled. Hence namespace-prefix is
-     * expected to be automaically on. So it is a False-True combination.
-     * The test is to test SAXParser with these conditions
+     * expected to be automatically on. So it is a False-True combination.
+     * The test is to test SAXParser with these conditions.
+     *
+     * @throws Exception If any errors occur.
      */
-    public void testWithFalseTrue() {
-        String outputFile = CLASS_DIR + "SPNSTableFT.out";
+    public void testWithFalseTrue() throws Exception {
+        String outputFile = USER_DIR + "SPNSTableFT.out";
         String goldFile = GOLDEN_DIR + "NSTableFTGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxParser = spf.newSAXParser();
-            saxParser.parse(new File(xmlFile), new MyNSContentHandler(outputFile));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException | IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        try (MyNSContentHandler handler = new MyNSContentHandler(outputFile)) {
+            spf.newSAXParser().parse(new File(xmlFile), handler);
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,14 +26,10 @@
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -42,7 +38,6 @@
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -50,45 +45,34 @@
  * Set parent of XMLFilter to XMLReader. Parsing on XML file will invoke XMLFilter
  * to write to output file. Test verifies output is same as the golden file.
  */
-public class XMLFilterCBTest {
-    public void testXMLFilterCB() {
-        String outputFile = CLASS_DIR + "XMLFilter.out";
+public class XMLFilterCBTest extends JAXPFileBaseTest {
+    /**
+     * Test XMLFilter working with XML reader.
+     *
+     * @throws Exception If any errors occur.
+     */
+    public void testXMLFilterCB() throws Exception {
+        String outputFile = USER_DIR + "XMLFilter.out";
         String goldFile = GOLDEN_DIR + "XMLFilterGF.out";
         String xmlFile = XML_DIR + "namespace1.xml";
 
-        try (FileInputStream fis = new FileInputStream(xmlFile)){
+        try (FileInputStream fis = new FileInputStream(xmlFile);
+                MyXMLFilter myXmlFilter = new MyXMLFilter(outputFile)){
             SAXParserFactory spf = SAXParserFactory.newInstance();
             spf.setNamespaceAware(true);
             XMLReader xmlReader = spf.newSAXParser().getXMLReader();
-
-            MyXMLFilter myXmlFilter = new MyXMLFilter(outputFile);
             myXmlFilter.setParent(xmlReader);
-            InputSource is = new InputSource(fis);
-            myXmlFilter.parse(is);
-        } catch( SAXException | IOException | ParserConfigurationException ex) {
-            failUnexpected(ex);
+            myXmlFilter.parse(new InputSource(fis));
         }
         // Need close the output file before we compare it with golden file.
-        try {
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (IOException ex) {
-            failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
-        }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
 
 /**
  * Writer XMLFiler which write all tags to output file when event happens.
  */
-class MyXMLFilter extends XMLFilterImpl{
+class MyXMLFilter extends XMLFilterImpl implements AutoCloseable {
     /**
      * FileWriter to write string to output file.
      */
@@ -278,4 +262,14 @@
             throw new SAXException(ex);
         }
     }
+
+    /**
+     * Close writer handler.
+     * @throws IOException if any I/O error when close writer handler.
+     */
+    @Override
+    public void close() throws IOException {
+        if (bWriter != null)
+            bWriter.close();
+    }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,18 +23,14 @@
 package org.xml.sax.ptests;
 
 import java.io.FileInputStream;
-import java.io.IOException;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
@@ -42,7 +38,7 @@
 /**
  * Unit test for XMLFilter.
  */
-public class XMLFilterTest {
+public class XMLFilterTest extends JAXPFileReadOnlyBaseTest {
     /**
      * name spaces constant.
      */
@@ -129,139 +125,114 @@
 
     /**
      * By default true is expected get namespaces feature.
-     * @throws SAXException
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void getFeature01() throws SAXException {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+    public void getFeature01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
 
-            XMLFilterImpl xmlFilter = new XMLFilterImpl();
-            xmlFilter.setParent(xmlReader);
-            assertTrue(xmlFilter.getFeature(NAMESPACES));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlFilter.setParent(xmlReader);
+        assertTrue(xmlFilter.getFeature(NAMESPACES));
     }
 
     /**
      * By default false is expected get namespaces-prefix feature.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void getFeature02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
-
-            XMLFilterImpl xmlFilter = new XMLFilterImpl();
-            xmlFilter.setParent(xmlReader);
-            assertFalse(xmlFilter.getFeature(NAMESPACE_PREFIXES));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void getFeature02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlFilter.setParent(spf.newSAXParser().getXMLReader());
+        assertFalse(xmlFilter.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
      * SAXNotRecognizedException is expected when get a feature by an invalid
      * feature name.
-     * @throws org.xml.sax.SAXNotRecognizedException If the feature
-     *            value can't be assigned or retrieved from the parent.
-     * @throws org.xml.sax.SAXNotSupportedException When the
-     *            parent recognizes the feature name but
-     *            cannot determine its value at this time.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = SAXNotRecognizedException.class)
-    public void getFeature03() throws SAXNotRecognizedException,
-           SAXNotSupportedException {
+    public void getFeature03() throws Exception {
         new XMLFilterImpl().getFeature("no-meaning-feature");
     }
 
     /**
      * Set namespaces feature to a value to XMLFilter. it's expected same when
      * obtain it again.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void setFeature01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+    public void setFeature01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
 
-            XMLFilterImpl xmlFilter = new XMLFilterImpl();
-            xmlFilter.setParent(xmlReader);
-            xmlFilter.setFeature(NAMESPACES, false);
-            assertFalse(xmlFilter.getFeature(NAMESPACES));
-            xmlFilter.setFeature(NAMESPACES, true);
-            assertTrue(xmlFilter.getFeature(NAMESPACES));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlFilter.setParent(spf.newSAXParser().getXMLReader());
+        xmlFilter.setFeature(NAMESPACES, false);
+        assertFalse(xmlFilter.getFeature(NAMESPACES));
+        xmlFilter.setFeature(NAMESPACES, true);
+        assertTrue(xmlFilter.getFeature(NAMESPACES));
     }
 
     /**
      * Set namespaces-prefix feature to a value to XMLFilter. it's expected same
      * when obtain it again.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void setFeature02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+    public void setFeature02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
 
-            XMLFilterImpl xmlFilter = new XMLFilterImpl();
-            xmlFilter.setParent(xmlReader);
-            xmlFilter.setFeature(NAMESPACE_PREFIXES, false);
-            assertFalse(xmlFilter.getFeature(NAMESPACE_PREFIXES));
-            xmlFilter.setFeature(NAMESPACE_PREFIXES, true);
-            assertTrue(xmlFilter.getFeature(NAMESPACE_PREFIXES));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlFilter.setParent(spf.newSAXParser().getXMLReader());
+        xmlFilter.setFeature(NAMESPACE_PREFIXES, false);
+        assertFalse(xmlFilter.getFeature(NAMESPACE_PREFIXES));
+        xmlFilter.setFeature(NAMESPACE_PREFIXES, true);
+        assertTrue(xmlFilter.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
      * NullPointerException is expected when parse a null InputSource.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void parse01() {
-        try {
-            new XMLFilterImpl().parse((InputSource)null);
-        } catch (IOException | SAXException ex) {
-            failUnexpected(ex);
-        }
+    public void parse01() throws Exception {
+        new XMLFilterImpl().parse((InputSource)null);
     }
 
     /**
      * SAXException is expected when parsing a invalid formatted XML file.
-     * @throws org.xml.sax.SAXException when parse a incorrect formatted XML
-     * file.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void parse02() throws SAXException {
-        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void parse02() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
-            InputSource is = new InputSource(fis);
-            xmlFilter.parse(is);
-        } catch (IOException ex) {
-            failUnexpected(ex);
+            new XMLFilterImpl().parse(new InputSource(fis));
         }
     }
 
     /**
      * No exception when parse a normal XML file.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = NullPointerException.class)
-    public void parse03() {
-        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    public void parse03() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
-            InputSource is = new InputSource(fis);
-            xmlFilter.parse(is);
-        } catch (IOException | SAXException ex) {
-            failUnexpected(ex);
+            new XMLFilterImpl().parse(new InputSource(fis));
         }
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,9 @@
 package org.xml.sax.ptests;
 
 import java.io.FileInputStream;
-import java.io.IOException;
-import javax.xml.parsers.ParserConfigurationException;
+import java.io.FilePermission;
 import javax.xml.parsers.SAXParserFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 import org.testng.annotations.Test;
@@ -40,7 +39,7 @@
 /**
  * Class containing the test cases for XMLReaderAdapter API
  */
-public class XMLReaderAdapterTest {
+public class XMLReaderAdapterTest extends JAXPBaseTest {
     /**
      * http://xml.org/sax/features/namespace-prefixes property name.
      */
@@ -58,60 +57,51 @@
     }
 
     /**
-     * To test the constructor that uses XMLReader
+     * To test the constructor that uses XMLReader.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void constructor02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
-
-            assertNotNull(new XMLReaderAdapter(xmlReader));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
+    public void constructor02() throws Exception {
+        XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+        assertNotNull(new XMLReaderAdapter(xmlReader));
     }
 
     /**
      * To test the parse method. The specification says that this method
      * will throw an exception if the embedded XMLReader does not support
      * the http://xml.org/sax/features/namespace-prefixes property.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void nsfeature01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
-            if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) {
-                xmlReader.setFeature(NM_PREFIXES_PROPERTY, true);
-            }
-
-            assertTrue(xmlReader.getFeature(NM_PREFIXES_PROPERTY));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
+    public void nsfeature01() throws Exception {
+        XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+        if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) {
+            xmlReader.setFeature(NM_PREFIXES_PROPERTY, true);
         }
+        assertTrue(xmlReader.getFeature(NM_PREFIXES_PROPERTY));
     }
 
     /**
      * To test the parse method. The specification says that this method
      * will throw an exception if the embedded XMLReader does not support
      * the http://xml.org/sax/features/namespace-prefixes property.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void parse01() {
+    public void parse01() throws Exception {
+        setPermissions(new FilePermission(XML_DIR + "/-", "read"));
         try (FileInputStream fis = new FileInputStream(XML_DIR + "namespace1.xml")) {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+            XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
             if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) {
                 xmlReader.setFeature(NM_PREFIXES_PROPERTY, true);
             }
             XMLReaderAdapter xmlRA = new XMLReaderAdapter(xmlReader);
-
-            InputSource is = new InputSource(fis);
             xmlRA.setDocumentHandler(new HandlerBase());
-            xmlRA.parse(is);
-        } catch (IOException | SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
+            xmlRA.parse(new InputSource(fis));
         }
+        setPermissions();
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  */
 package org.xml.sax.ptests;
 
+import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertNotNull;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
@@ -30,7 +31,7 @@
 /**
  * Unit test for XMLReaderFactory.createXMLReader API.
  */
-public class XMLReaderFactoryTest {
+public class XMLReaderFactoryTest extends JAXPBaseTest {
     /**
      * No exception expected when create XMLReader by default.
      * @throws org.xml.sax.SAXException when xml reader creation failed.
@@ -48,12 +49,7 @@
      */
     @Test
     public void createReader02() throws SAXException {
-        //Disable this test because this is only work for apache implementation.
-        /*System.setProperty("org.xml.sax.driver",
-            "org.apache.xerces.parsers.SAXParser");
-        assertNotNull(XMLReaderFactory.
-            createXMLReader("org.apache.xerces.parsers.SAXParser"));*/
-        System.setProperty("org.xml.sax.driver",
+        setSystemProperty("org.xml.sax.driver",
             "com.sun.org.apache.xerces.internal.parsers.SAXParser");
         assertNotNull(XMLReaderFactory.
             createXMLReader("com.sun.org.apache.xerces.internal.parsers.SAXParser"));
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,17 +23,14 @@
 package org.xml.sax.ptests;
 
 import java.io.FileInputStream;
-import java.io.IOException;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertTrue;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
-import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
@@ -41,7 +38,7 @@
   * Namespace Table defined at
   * http://www.megginson.com/SAX/Java/namespaces.html
   */
-public class XMLReaderNSTableTest {
+public class XMLReaderNSTableTest extends JAXPFileBaseTest {
     /**
      * XML file that used to be parsed.
      */
@@ -55,71 +52,70 @@
     /**
      * namespace processing is enabled. namespace-prefix is also is enabled.
      * So it is a True-True combination.
-     * The test is to test XMLReader with these conditions
+     * The test is to test XMLReader with these conditions.
+     *
+     * @throws Exception If any errors occur.
      */
-    public void testWithTrueTrue() {
-        String outputFile = CLASS_DIR + "XRNSTableTT.out";
+    public void testWithTrueTrue() throws Exception {
+        String outputFile = USER_DIR + "XRNSTableTT.out";
         String goldFile = GOLDEN_DIR + "NSTableTTGF.out";
 
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxParser = spf.newSAXParser();
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        xmlReader.setFeature(NAMESPACE_PREFIXES, true);
 
-            XMLReader xmlReader = saxParser.getXMLReader();
-            xmlReader.setFeature(NAMESPACE_PREFIXES, true);
-
-            xmlReader.setContentHandler(new MyNSContentHandler(outputFile));
-            xmlReader.parse(new InputSource(new FileInputStream(xmlFile)));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException | IOException ex) {
-            failUnexpected(ex);
+        try (FileInputStream fis = new FileInputStream(xmlFile);
+            MyNSContentHandler handler = new MyNSContentHandler(outputFile);) {
+            xmlReader.setContentHandler(handler);
+            xmlReader.parse(new InputSource(fis));
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 
     /**
      * Namespace processing is enabled. Hence namespace-prefix is
-     * expected to be automaically off. So it is a True-False combination.
-     * The test is to test XMLReader with these conditions
+     * expected to be automatically off. So it is a True-False combination.
+     * The test is to test XMLReader with these conditions.
+     *
+     * @throws Exception If any errors occur.
      */
-    public void testWithTrueFalse() {
-        String outputFile = CLASS_DIR + "XRNSTableTF.out";
+    public void testWithTrueFalse() throws Exception {
+        String outputFile = USER_DIR + "XRNSTableTF.out";
         String goldFile = GOLDEN_DIR + "NSTableTFGF.out";
 
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxParser = spf.newSAXParser();
-            XMLReader xmlReader = saxParser.getXMLReader();
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        SAXParser saxParser = spf.newSAXParser();
+        XMLReader xmlReader = saxParser.getXMLReader();
 
-            xmlReader.setContentHandler(new MyNSContentHandler(outputFile));
-            xmlReader.parse(new InputSource(new FileInputStream(xmlFile)));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException | IOException ex) {
-            failUnexpected(ex);
+        try (FileInputStream fis = new FileInputStream(xmlFile);
+            MyNSContentHandler handler = new MyNSContentHandler(outputFile)) {
+            xmlReader.setContentHandler(handler);
+            xmlReader.parse(new InputSource(fis));
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 
     /**
      * namespace processing is not enabled. Hence namespace-prefix is
      * expected to be automaically on. So it is a False-True combination.
-     * The test is to test XMLReader with these conditions
+     * The test is to test XMLReader with these conditions.
+     *
+     * @throws Exception If any errors occur.
      */
-    public void testWithFalseTrue() {
-        String outputFile = CLASS_DIR + "XRNSTableFT.out";
+    public void testWithFalseTrue()throws Exception {
+        String outputFile = USER_DIR + "XRNSTableFT.out";
         String goldFile = GOLDEN_DIR + "NSTableFTGF.out";
 
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            SAXParser saxParser = spf.newSAXParser();
-            XMLReader xmlReader = saxParser.getXMLReader();
-
-            xmlReader.setContentHandler(new MyNSContentHandler(outputFile));
-            xmlReader.parse(new InputSource(new FileInputStream(xmlFile)));
-            assertTrue(compareWithGold(goldFile, outputFile));
-        } catch (ParserConfigurationException | SAXException | IOException ex) {
-            failUnexpected(ex);
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        try (FileInputStream fis = new FileInputStream(xmlFile);
+            MyNSContentHandler handler = new MyNSContentHandler(outputFile)) {
+            xmlReader.setContentHandler(handler);
+            xmlReader.parse(new InputSource(fis));
         }
+        assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,9 @@
 package org.xml.sax.ptests;
 
 import java.io.FileInputStream;
-import java.io.IOException;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
+import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
@@ -45,42 +44,43 @@
 /**
  * Class containing the test cases for SAXParser API
  */
-public class XMLReaderTest {
+public class XMLReaderTest extends JAXPFileReadOnlyBaseTest {
+
     /**
      * XML namespaces.
      */
-    private static final String NAMESPACES =
-                "http://xml.org/sax/features/namespaces";
+    private static final String NAMESPACES
+            = "http://xml.org/sax/features/namespaces";
 
     /**
      * XML namespaces prefixes.
      */
-    private static final String NAMESPACE_PREFIXES =
-                "http://xml.org/sax/features/namespace-prefixes";
+    private static final String NAMESPACE_PREFIXES
+            = "http://xml.org/sax/features/namespace-prefixes";
 
     /**
      * A string intern name.
      */
-    private static final String STRING_INTERNING =
-                "http://xml.org/sax/features/string-interning";
+    private static final String STRING_INTERNING
+            = "http://xml.org/sax/features/string-interning";
 
     /**
      * Validation name.
      */
-    private static final String VALIDATION =
-                "http://xml.org/sax/features/validation";
+    private static final String VALIDATION
+            = "http://xml.org/sax/features/validation";
 
     /**
      * A general external entities name
      */
-    private static final String EXTERNAL_G_ENTITIES =
-                "http://xml.org/sax/features/external-general-entities";
+    private static final String EXTERNAL_G_ENTITIES
+            = "http://xml.org/sax/features/external-general-entities";
 
     /**
      * A external parameter entities name
      */
-    private static final String EXTERNAL_P_ENTITIES =
-                "http://xml.org/sax/features/external-parameter-entities";
+    private static final String EXTERNAL_P_ENTITIES
+            = "http://xml.org/sax/features/external-parameter-entities";
 
     /**
      * XML DOM node name.
@@ -95,526 +95,444 @@
     /**
      * Declare handler name
      */
-    private static final String DECL_HANDLER =
-                        "http://xml.org/sax/properties/declaration-handler";
+    private static final String DECL_HANDLER
+            = "http://xml.org/sax/properties/declaration-handler";
 
     /**
      * Lexical handler name
      */
-    private static final String LEXICAL_HANDLER =
-                        "http://xml.org/sax/properties/lexical-handler";
+    private static final String LEXICAL_HANDLER
+            = "http://xml.org/sax/properties/lexical-handler";
 
     /**
      * According to the SAX2 specs, All XMLReaders are required to recognize the
-     * http://xml.org/sax/features/namespaces feature names.
-     * This test case is to test this.
+     * http://xml.org/sax/features/namespaces feature names. This test case is
+     * to test this.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureNS01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertFalse(xmlReader.getFeature(NAMESPACES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
+    public void featureNS01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertFalse(xmlReader.getFeature(NAMESPACES));
     }
 
     /**
      * According to the SAX2 specs, All XMLReaders are required to recognize the
-     * http://xml.org/sax/features/namespaces feature names.
-     * This test case is to test this.
+     * http://xml.org/sax/features/namespaces feature names. This test case is
+     * to test this.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureNS02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertTrue(xmlReader.getFeature(NAMESPACES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
+    public void featureNS02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertTrue(xmlReader.getFeature(NAMESPACES));
     }
 
     /**
      * Obtain http://xml.org/sax/features/namespaces feature name after it's
      * just set. Expect it's same as set value.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureNS03() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.setFeature(NAMESPACES, true);
-            assertTrue(xmlReader.getFeature(NAMESPACES));
-            xmlReader.setFeature(NAMESPACES, false);
-            assertFalse(xmlReader.getFeature(NAMESPACES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
+    public void featureNS03() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        xmlReader.setFeature(NAMESPACES, true);
+        assertTrue(xmlReader.getFeature(NAMESPACES));
+        xmlReader.setFeature(NAMESPACES, false);
+        assertFalse(xmlReader.getFeature(NAMESPACES));
     }
 
     /**
      * According to the SAX2 specs, All XMLReaders are required to recognize the
-     * http://xml.org/sax/features/namespace-prefixes feature names.
-     * This test case is to test this.
+     * http://xml.org/sax/features/namespace-prefixes feature names. This test
+     * case is to test this.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureNSP01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
-
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
+    public void featureNSP01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
      * According to the SAX2 specs, All XMLReaders are required to recognize the
-     * http://xml.org/sax/features/namespace-prefixes feature names.
-     * This test case is to test this.
+     * http://xml.org/sax/features/namespace-prefixes feature names. This test
+     * case is to test this.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureNSP02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
+    public void featureNSP02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
      * Obtain http://xml.org/sax/features/namespaces-prefixes feature name after
      * it's just set. Expect it's same as set value.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureNSP03() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.setFeature(NAMESPACE_PREFIXES, true);
-            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
-            xmlReader.setFeature(NAMESPACE_PREFIXES, false);
-            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
-        } catch (ParserConfigurationException | SAXException ex) {
-            failUnexpected(ex);
-        }
+    public void featureNSP03() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        xmlReader.setFeature(NAMESPACE_PREFIXES, true);
+        assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
+        xmlReader.setFeature(NAMESPACE_PREFIXES, false);
+        assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
     }
 
     /**
      * getFeature returns true if a feature has not been preset when namespace
      * awareness is set.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureSI01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertTrue(xmlReader.getFeature(STRING_INTERNING));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void featureSI01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertTrue(xmlReader.getFeature(STRING_INTERNING));
     }
 
     /**
      * getFeature with validation feature name returns the value that
      * setValidation set.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureV01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            assertFalse(spf.newSAXParser().getXMLReader().getFeature(VALIDATION));
-            spf.setValidating(true);
-            assertTrue(spf.newSAXParser().getXMLReader().getFeature(VALIDATION));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void featureV01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertFalse(spf.newSAXParser().getXMLReader().getFeature(VALIDATION));
+        spf.setValidating(true);
+        assertTrue(spf.newSAXParser().getXMLReader().getFeature(VALIDATION));
     }
 
     /**
-     * getFeature returns the value that a feature has been preset as  when
+     * getFeature returns the value that a feature has been preset as when
      * namespace awareness is set.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureV02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+    public void featureV02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
 
-            xmlReader.setFeature(VALIDATION, true);
-            assertTrue(xmlReader.getFeature(VALIDATION));
-
-            xmlReader.setFeature(VALIDATION, false);
-            assertFalse(xmlReader.getFeature(VALIDATION));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+        xmlReader.setFeature(VALIDATION, true);
+        assertTrue(xmlReader.getFeature(VALIDATION));
+        xmlReader.setFeature(VALIDATION, false);
+        assertFalse(xmlReader.getFeature(VALIDATION));
     }
 
     /**
      * getFeature returns true if a feature has not been preset when namespace
      * awareness is set.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureEGE01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertTrue(xmlReader.getFeature(EXTERNAL_G_ENTITIES));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void featureEGE01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertTrue(xmlReader.getFeature(EXTERNAL_G_ENTITIES));
     }
 
     /**
-     * getFeature returns false if a feature has been preset as false  when
+     * getFeature returns false if a feature has been preset as false when
      * namespace awareness is set.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureEGE02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.setFeature(EXTERNAL_G_ENTITIES, false);
-            assertFalse(xmlReader.getFeature(EXTERNAL_G_ENTITIES));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void featureEGE02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        xmlReader.setFeature(EXTERNAL_G_ENTITIES, false);
+        assertFalse(xmlReader.getFeature(EXTERNAL_G_ENTITIES));
     }
 
     /**
      * getFeature returns true if a feature has not been preset when namespace
      * awareness is set.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureEPE01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertTrue(xmlReader.getFeature(EXTERNAL_P_ENTITIES));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void featureEPE01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertTrue(xmlReader.getFeature(EXTERNAL_P_ENTITIES));
     }
 
     /**
-     * getFeature returns false if a feature has been preset as false  when
+     * getFeature returns false if a feature has been preset as false when
      * namespace awareness is set.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void featureEPE02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
-            xmlReader.setFeature(EXTERNAL_P_ENTITIES, false);
-            assertFalse(xmlReader.getFeature(EXTERNAL_P_ENTITIES));
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void featureEPE02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        xmlReader.setFeature(EXTERNAL_P_ENTITIES, false);
+        assertFalse(xmlReader.getFeature(EXTERNAL_P_ENTITIES));
     }
 
     /**
      * getFeature with a unknown feature name throws SAXNotRecognizedException.
-     * @throws SAXNotRecognizedException If the feature value can't be assigned
-     *                                   or retrieved.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = SAXNotRecognizedException.class)
-    public void featureNE01() throws SAXNotRecognizedException  {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            boolean noMeaningFeature = xmlReader.getFeature("no-meaning-feature");
-        } catch(SAXNotRecognizedException ex) {
-            throw ex;
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void featureNE01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.newSAXParser().getXMLReader().getFeature("no-meaning-feature");
     }
 
     /**
      * No exception expected when set entity resolver as simple entity resolver.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void entity01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            XMLFilterImpl xmlFilter = new XMLFilterImpl();
-            xmlReader.setEntityResolver(xmlFilter);
-            assertNotNull(xmlReader.getEntityResolver());
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void entity01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlReader.setEntityResolver(xmlFilter);
+        assertEquals(xmlReader.getEntityResolver(), xmlFilter);
     }
 
     /**
      * No NPE expected when set entity resolver as null.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void entity02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.setEntityResolver(null);
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void entity02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.newSAXParser().getXMLReader().setEntityResolver(null);
     }
 
     /**
      * No exception expected when set DTD handler as simple DTD handler.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void dtdhandler01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            XMLFilterImpl xmlFilter = new XMLFilterImpl();
-            xmlReader.setDTDHandler(xmlFilter);
-            assertNotNull(xmlReader.getDTDHandler());
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void dtdhandler01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlReader.setDTDHandler(xmlFilter);
+        assertEquals(xmlReader.getDTDHandler(), xmlFilter);
     }
 
     /**
      * No NPE expected when set DTD handler as null.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void dtdhandler02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.setDTDHandler(null);
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void dtdhandler02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.newSAXParser().getXMLReader().setDTDHandler(null);
     }
 
     /**
      * No exception expected when set content handler as simple content handler.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void contenthandler01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            XMLFilterImpl xmlFilter = new XMLFilterImpl();
-            xmlReader.setContentHandler(xmlFilter);
-            assertNotNull(xmlReader.getContentHandler());
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void contenthandler01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlReader.setContentHandler(xmlFilter);
+        assertEquals(xmlReader.getContentHandler(), xmlFilter);
     }
 
     /**
      * No NPE expected when set content handler as null.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void contenthandler02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.setContentHandler(null);
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void contenthandler02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.newSAXParser().getXMLReader().setContentHandler(null);
     }
 
     /**
      * No exception expected when set content handler as simple error handler.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void errorhandler01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.setErrorHandler(new XMLFilterImpl());
-            assertNotNull(xmlReader.getErrorHandler());
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void errorhandler01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        xmlReader.setErrorHandler(new XMLFilterImpl());
+        assertNotNull(xmlReader.getErrorHandler());
     }
 
     /**
      * No NPE expected when set error handler as null.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void errorhandler02() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.setErrorHandler(null);
-        } catch (SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
-        }
+    public void errorhandler02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        xmlReader.setErrorHandler(null);
     }
 
     /**
      * Parse a null input source throw NPE.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = NullPointerException.class)
-    public void parse01() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.parse((InputSource)null);
-        } catch (SAXException | ParserConfigurationException | IOException ex) {
-            failUnexpected(ex);
-        }
+    public void parse01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.newSAXParser().getXMLReader().parse((InputSource) null);
     }
 
     /**
      * Unit test for parse a error-formatted file. SAXException is expected.
-     * @throws org.xml.sax.SAXException parsing failed.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test(expectedExceptions = SAXException.class)
-    public void parse02() throws SAXException {
-        try (FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")){
+    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class)
+    public void parse02() throws Exception {
+        try (FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
             spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            InputSource is = new InputSource(fis);
-            xmlReader.parse(is);
-        } catch (ParserConfigurationException | IOException ex) {
-            failUnexpected(ex);
+            spf.newSAXParser().getXMLReader().parse(new InputSource(fis));
         }
     }
 
     /**
      * Unit test for parse a well-formatted file. No exception is expected.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void parse03(){
+    @Test(groups = {"readLocalFiles"})
+    public void parse03() throws Exception {
         try (FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
             spf.setNamespaceAware(true);
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            InputSource is = new InputSource(fis);
-            xmlReader.parse(is);
-        } catch (IOException | SAXException | ParserConfigurationException ex) {
-            failUnexpected(ex);
+            spf.newSAXParser().getXMLReader().parse(new InputSource(fis));
         }
     }
 
     /**
-     * Modified by IBM
-     * Xerces does not support this feature and it is not mandatory
-     * @throws org.xml.sax.SAXNotSupportedException
+     * Modified by IBM Xerces does not support this feature and it is not
+     * mandatory.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = SAXNotSupportedException.class)
-    public void xrProperty01() throws SAXNotSupportedException  {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            xmlReader.getProperty(XML_STRING);
-        } catch(SAXNotSupportedException ex) {
-            throw ex;
-        } catch (SAXException | ParserConfigurationException ex){
-            failUnexpected(ex);
-        }
+    public void xrProperty01() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        xmlReader.getProperty(XML_STRING);
     }
 
     /**
      * SAXNotSupportedException thrown if property name is known but no value
      * assigned to this property.
-     * @throws org.xml.sax.SAXNotSupportedException when XMLReader recognizes
-     * the property name but cannot determine its value at this time.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = SAXNotSupportedException.class)
-    public void xrProperty02() throws SAXNotSupportedException {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertNull(xmlReader.getProperty(DOM_NODE));
-        } catch (SAXNotSupportedException ex) {
-            throw ex;
-        } catch (SAXException | ParserConfigurationException ex){
-            failUnexpected(ex);
-        }
+    public void xrProperty02() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertNull(xmlReader.getProperty(DOM_NODE));
     }
 
-
     /**
      * XMLReader.getProperty returns null if LEXICAL_HANDLER wasn't set.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void xrProperty03() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertNull(xmlReader.getProperty(LEXICAL_HANDLER));
-        } catch (SAXException | ParserConfigurationException ex){
-            failUnexpected(ex);
-        }
+    public void xrProperty03() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertNull(xmlReader.getProperty(LEXICAL_HANDLER));
     }
 
     /**
      * XMLReader.getProperty returns null if DECL_HANDLER wasn't set.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void xrProperty04() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            assertNull(xmlReader.getProperty(DECL_HANDLER));
-        } catch (SAXException | ParserConfigurationException ex){
-            failUnexpected(ex);
-        }
+    public void xrProperty04() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        assertNull(xmlReader.getProperty(DECL_HANDLER));
     }
 
     /**
      * XMLReader.setProperty/getProperty for LEXICAL_HANDLER unit test.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void xrProperty05() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            MyLexicalHandler myLexicalHandler = new MyLexicalHandler();
-            xmlReader.setProperty(LEXICAL_HANDLER, myLexicalHandler);
-            assertNotNull(xmlReader.getProperty(LEXICAL_HANDLER));
-        } catch (SAXException | ParserConfigurationException ex){
-            failUnexpected(ex);
-        }
+    public void xrProperty05() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        MyLexicalHandler myLexicalHandler = new MyLexicalHandler();
+        xmlReader.setProperty(LEXICAL_HANDLER, myLexicalHandler);
+        assertNotNull(xmlReader.getProperty(LEXICAL_HANDLER));
     }
 
     /**
      * XMLReader.setProperty/getProperty for DECL_HANDLER unit test.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void xrProperty06() {
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
-            MyDeclHandler myDeclHandler = new MyDeclHandler();
-            xmlReader.setProperty(DECL_HANDLER, myDeclHandler);
-            assertNotNull(xmlReader.getProperty(DECL_HANDLER));
-        } catch (ParserConfigurationException | SAXException ex){
-            failUnexpected(ex);
-        }
+    public void xrProperty06() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        MyDeclHandler myDeclHandler = new MyDeclHandler();
+        xmlReader.setProperty(DECL_HANDLER, myDeclHandler);
+        assertNotNull(xmlReader.getProperty(DECL_HANDLER));
     }
 }
 
@@ -622,6 +540,7 @@
  * Simple LexicalHandler that skips every lexical event.
  */
 class MyLexicalHandler implements LexicalHandler {
+
     /**
      * Report an XML comment anywhere in the document.
      *
@@ -667,8 +586,10 @@
      * Report the start of DTD declarations, if any.
      *
      * @param name The document type name.
-     * @param publicId The declared public identifier for the external DTD subset.
-     * @param systemId The declared system identifier for the external DTD subset.
+     * @param publicId The declared public identifier for the external DTD
+     * subset.
+     * @param systemId The declared system identifier for the external DTD
+     * subset.
      */
     @Override
     public void startDTD(String name, String publicId, String systemId) {
@@ -688,16 +609,17 @@
  * Simple DeclHandler that skips every DTD declaration event.
  */
 class MyDeclHandler implements DeclHandler {
+
     /**
      * Report an attribute type declaration.
+     *
      * @param eName The name of the associated element.
      * @param aName The name of the attribute.
      * @param type A string representing the attribute type.
      * @param mode A string representing the attribute defaulting mode
-     *        ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
-     *        none of these applies.
-     * @param value A string representing the attribute's default value,
-     *        or null if there is none.
+     * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
+     * @param value A string representing the attribute's default value, or null
+     * if there is none.
      */
     @Override
     public void attributeDecl(String eName, String aName, String type,
@@ -706,6 +628,7 @@
 
     /**
      * Report an element type declaration.
+     *
      * @param name The element type name.
      * @param model The content model as a normalized string.
      */
@@ -715,10 +638,11 @@
 
     /**
      * Report a parsed external entity declaration.
-     * @param name The name of the entity.  If it is a parameter
-     *        entity, the name will begin with '%'.
-     * @param publicId The entity's public identifier, or null if none
-     *        was given.
+     *
+     * @param name The name of the entity. If it is a parameter entity, the name
+     * will begin with '%'.
+     * @param publicId The entity's public identifier, or null if none was
+     * given.
      * @param systemId The entity's system identifier.
      */
     @Override
@@ -728,8 +652,9 @@
 
     /**
      * Report an internal entity declaration.
-     * @param name The name of the entity.  If it is a parameter
-     *        entity, the name will begin with '%'.
+     *
+     * @param name The name of the entity. If it is a parameter entity, the name
+     * will begin with '%'.
      * @param value The replacement text of the entity.
      */
     @Override
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,23 +27,18 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
-
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.IOException;
 import java.io.InputStream;
 import java.math.BigInteger;
 import java.nio.file.Paths;
 import java.util.GregorianCalendar;
 import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
-
-import javax.xml.datatype.DatatypeConfigurationException;
 import javax.xml.datatype.DatatypeConstants;
 import javax.xml.datatype.DatatypeFactory;
 import javax.xml.datatype.Duration;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.dom.DOMResult;
@@ -51,8 +46,8 @@
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
+import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static jaxp.library.JAXPTestUtilities.bomStream;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMConfiguration;
@@ -63,173 +58,160 @@
 import org.w3c.dom.bootstrap.DOMImplementationRegistry;
 import org.w3c.dom.ls.DOMImplementationLS;
 import org.w3c.dom.ls.LSSerializer;
-import org.xml.sax.SAXException;
 import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
 import static test.auctionportal.HiBidConstants.XML_DIR;
 
 /**
  * This is the user controller  class for the Auction portal HiBid.com.
  */
-public class AuctionController {
+public class AuctionController extends JAXPFileReadOnlyBaseTest {
     /**
      * Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927
      * DOMConfiguration.setParameter("well-formed",true) throws an exception.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCreateNewItem2Sell() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCreateNewItem2Sell() throws Exception {
         String xmlFile = XML_DIR + "novelsInvalid.xml";
 
-        try {
-            Document document = DocumentBuilderFactory.newInstance()
-                    .newDocumentBuilder().parse(xmlFile);
+        Document document = DocumentBuilderFactory.newInstance()
+                .newDocumentBuilder().parse(xmlFile);
 
-            document.getDomConfig().setParameter("well-formed", true);
+        document.getDomConfig().setParameter("well-formed", true);
 
-            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
-            DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
-            MyDOMOutput domOutput = new MyDOMOutput();
-            domOutput.setByteStream(System.out);
-            LSSerializer writer = impl.createLSSerializer();
-            writer.write(document, domOutput);
-        } catch (ParserConfigurationException | SAXException | IOException
-                | ClassNotFoundException | InstantiationException
-                | IllegalAccessException | ClassCastException e) {
-            failUnexpected(e);
-        }
+        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+        DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
+        MyDOMOutput domOutput = new MyDOMOutput();
+        domOutput.setByteStream(System.out);
+        LSSerializer writer = impl.createLSSerializer();
+        writer.write(document, domOutput);
     }
 
     /**
      * Check for DOMErrorHandler handling DOMError. Before fix of bug 4896132
      * test throws DOM Level 1 node error.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCreateNewItem2SellRetry() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCreateNewItem2SellRetry() throws Exception  {
         String xmlFile = XML_DIR + "accountInfo.xml";
 
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            Document document = dbf.newDocumentBuilder().parse(xmlFile);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        Document document = dbf.newDocumentBuilder().parse(xmlFile);
 
-            DOMConfiguration domConfig = document.getDomConfig();
-            MyDOMErrorHandler errHandler = new MyDOMErrorHandler();
-            domConfig.setParameter("error-handler", errHandler);
+        DOMConfiguration domConfig = document.getDomConfig();
+        MyDOMErrorHandler errHandler = new MyDOMErrorHandler();
+        domConfig.setParameter("error-handler", errHandler);
 
-            DOMImplementationLS impl =
-                 (DOMImplementationLS) DOMImplementationRegistry.newInstance()
-                         .getDOMImplementation("LS");
-            LSSerializer writer = impl.createLSSerializer();
-            MyDOMOutput domoutput = new MyDOMOutput();
-
-            domoutput.setByteStream(System.out);
-            writer.write(document, domoutput);
+        DOMImplementationLS impl =
+             (DOMImplementationLS) DOMImplementationRegistry.newInstance()
+                     .getDOMImplementation("LS");
+        LSSerializer writer = impl.createLSSerializer();
+        MyDOMOutput domoutput = new MyDOMOutput();
 
-            document.normalizeDocument();
-            writer.write(document, domoutput);
-            assertFalse(errHandler.isError());
-        } catch (ParserConfigurationException | SAXException | IOException
-                | ClassNotFoundException | InstantiationException
-                | IllegalAccessException | ClassCastException e) {
-            failUnexpected(e);
-        }
+        domoutput.setByteStream(System.out);
+        writer.write(document, domoutput);
+
+        document.normalizeDocument();
+        writer.write(document, domoutput);
+        assertFalse(errHandler.isError());
     }
 
     /**
      * Check if setting the attribute to be of type ID works. This will affect
      * the Attr.isID method according to the spec.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCreateID() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCreateID() throws Exception {
         String xmlFile = XML_DIR + "accountInfo.xml";
 
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
 
-            Document document = dbf.newDocumentBuilder().parse(xmlFile);
-            Element account = (Element)document
-                .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);
+        Document document = dbf.newDocumentBuilder().parse(xmlFile);
+        Element account = (Element)document
+            .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);
 
-            account.setIdAttributeNS(PORTAL_ACCOUNT_NS, "accountID", true);
-            Attr aID = account.getAttributeNodeNS(PORTAL_ACCOUNT_NS, "accountID");
-            assertTrue(aID.isId());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+        account.setIdAttributeNS(PORTAL_ACCOUNT_NS, "accountID", true);
+        Attr aID = account.getAttributeNodeNS(PORTAL_ACCOUNT_NS, "accountID");
+        assertTrue(aID.isId());
     }
 
     /**
      * Check the user data on the node.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckingUserData() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckingUserData() throws Exception {
         String xmlFile = XML_DIR + "accountInfo.xml";
 
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
 
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(xmlFile);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        Document document = docBuilder.parse(xmlFile);
 
-            Element account = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);
-            assertEquals(account.getNodeName(), "acc:Account");
-            Element firstName = (Element) document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "FirstName").item(0);
-            assertEquals(firstName.getNodeName(), "FirstName");
+        Element account = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);
+        assertEquals(account.getNodeName(), "acc:Account");
+        Element firstName = (Element) document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "FirstName").item(0);
+        assertEquals(firstName.getNodeName(), "FirstName");
 
-            Document doc1 = docBuilder.newDocument();
-            Element someName = doc1.createElement("newelem");
+        Document doc1 = docBuilder.newDocument();
+        Element someName = doc1.createElement("newelem");
 
-            someName.setUserData("mykey", "dd",
-                (operation, key,  data, src,  dst) ->  {
-                    System.err.println("In UserDataHandler" + key);
-                    System.out.println("In UserDataHandler");
-                });
-            Element impAccount = (Element)document.importNode(someName, true);
-            assertEquals(impAccount.getNodeName(), "newelem");
-            document.normalizeDocument();
-            String data = (someName.getUserData("mykey")).toString();
-            assertEquals(data, "dd");
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+        someName.setUserData("mykey", "dd",
+            (operation, key,  data, src,  dst) ->  {
+                System.err.println("In UserDataHandler" + key);
+                System.out.println("In UserDataHandler");
+            });
+        Element impAccount = (Element)document.importNode(someName, true);
+        assertEquals(impAccount.getNodeName(), "newelem");
+        document.normalizeDocument();
+        String data = (someName.getUserData("mykey")).toString();
+        assertEquals(data, "dd");
     }
 
 
     /**
      * Check the UTF-16 XMLEncoding xml file.
+     *
+     * @throws Exception If any errors occur.
      * @see <a href="content/movies.xml">movies.xml</a>
      */
-    @Test
-    public void testCheckingEncoding() {
+    @Test(groups = {"readLocalFiles"})
+    public void testCheckingEncoding() throws Exception {
         // Note since movies.xml is UTF-16 encoding. We're not using stanard XML
         // file suffix.
         String xmlFile = XML_DIR + "movies.xml.data";
 
-        //try (FileInputStream is = new FileInputStream(xmlFile)) {
-        try {
+        try (InputStream source = bomStream("UTF-16", xmlFile)) {
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
-            InputStream source = bomStream("UTF-16", xmlFile);
             Document document = dbf.newDocumentBuilder().parse(source);
             assertEquals(document.getXmlEncoding(), "UTF-16");
             assertEquals(document.getXmlStandalone(), true);
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
         }
     }
 
     /**
      * Check validation API features. A schema which is including in Bug 4909119
      * used to be testing for the functionalities.
+     *
+     * @throws Exception If any errors occur.
      * @see <a href="content/userDetails.xsd">userDetails.xsd</a>
      */
-    @Test
-    public void testGetOwnerInfo() {
+    @Test(groups = {"readLocalFiles"})
+    public void testGetOwnerInfo() throws Exception {
         String schemaFile = XML_DIR + "userDetails.xsd";
         String xmlFile = XML_DIR + "userDetails.xml";
 
-        try {
+        try(FileInputStream fis = new FileInputStream(xmlFile)) {
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
             dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
@@ -244,27 +226,27 @@
             DocumentBuilder docBuilder = dbf.newDocumentBuilder();
             docBuilder.setErrorHandler(eh);
 
-            Document document = docBuilder.parse(new FileInputStream(xmlFile));
+            Document document = docBuilder.parse(fis);
             DOMResult dResult = new DOMResult();
             DOMSource domSource = new DOMSource(document);
             validator.validate(domSource, dResult);
             assertFalse(eh.isAnyError());
-        } catch (SAXException | ParserConfigurationException | IOException e) {
-            failUnexpected(e);
         }
     }
 
     /**
      * Check grammar caching with imported schemas.
+     *
+     * @throws Exception If any errors occur.
      * @see <a href="content/coins.xsd">coins.xsd</a>
      * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a>
      */
-    @Test
-    public void testGetOwnerItemList() {
+    @Test(groups = {"readLocalFiles"})
+    public void testGetOwnerItemList() throws Exception {
         String xsdFile = XML_DIR + "coins.xsd";
         String xmlFile = XML_DIR + "coins.xml";
 
-        try {
+        try(FileInputStream fis = new FileInputStream(xmlFile)) {
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
             dbf.setNamespaceAware(true);
             dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
@@ -278,11 +260,9 @@
             validator.setErrorHandler(eh);
 
             DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            Document document = docBuilder.parse(new FileInputStream(xmlFile));
+            Document document = docBuilder.parse(fis);
             validator.validate(new DOMSource(document), new DOMResult());
             assertFalse(eh.isAnyError());
-        } catch (SAXException | ParserConfigurationException | IOException e) {
-            failUnexpected(e);
         }
     }
 
@@ -291,96 +271,88 @@
      * Check for the same imported schemas but will use SAXParserFactory and try
      * parsing using the SAXParser. SCHEMA_SOURCE attribute is using for this
      * test.
+     *
+     * @throws Exception If any errors occur.
      * @see <a href="content/coins.xsd">coins.xsd</a>
      * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a>
      */
 
-    @Test
-    public void testGetOwnerItemList1() {
+    @Test(groups = {"readLocalFiles"})
+    public void testGetOwnerItemList1() throws Exception {
         String xsdFile = XML_DIR + "coins.xsd";
         String xmlFile = XML_DIR + "coins.xml";
-
-        try {
-            SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
-            spf.setValidating(true);
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setValidating(true);
 
-            SAXParser sp = spf.newSAXParser();
-            sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
-            sp.setProperty(JAXP_SCHEMA_SOURCE, xsdFile);
+        SAXParser sp = spf.newSAXParser();
+        sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        sp.setProperty(JAXP_SCHEMA_SOURCE, xsdFile);
 
-            MyErrorHandler eh = new MyErrorHandler();
-            sp.parse(new File(xmlFile), eh);
-            assertFalse(eh.isAnyError());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+        MyErrorHandler eh = new MyErrorHandler();
+        sp.parse(new File(xmlFile), eh);
+        assertFalse(eh.isAnyError());
     }
 
     /**
      * Check usage of javax.xml.datatype.Duration class.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testGetItemDuration() {
+    @Test(groups = {"readLocalFiles"})
+    public void testGetItemDuration() throws Exception {
         String xmlFile = XML_DIR + "itemsDuration.xml";
 
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            Document document = dbf.newDocumentBuilder().parse(xmlFile);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        Document document = dbf.newDocumentBuilder().parse(xmlFile);
 
-            Element durationElement = (Element) document.getElementsByTagName("sellDuration").item(0);
-
-            NodeList childList = durationElement.getChildNodes();
+        Element durationElement = (Element) document.getElementsByTagName("sellDuration").item(0);
 
-            for (int i = 0; i < childList.getLength(); i++) {
-                System.out.println("child " + i + childList.item(i));
-            }
+        NodeList childList = durationElement.getChildNodes();
 
-            Duration duration = DatatypeFactory.newInstance().newDuration("P365D");
-            Duration sellDuration = DatatypeFactory.newInstance().newDuration(childList.item(0).getNodeValue());
-            assertFalse(sellDuration.isShorterThan(duration));
-            assertFalse(sellDuration.isLongerThan(duration));
-            assertEquals(sellDuration.getField(DatatypeConstants.DAYS), BigInteger.valueOf(365));
-            assertEquals(sellDuration.normalizeWith(new GregorianCalendar(1999, 2, 22)), duration);
+        for (int i = 0; i < childList.getLength(); i++) {
+            System.out.println("child " + i + childList.item(i));
+        }
 
-            Duration myDuration = sellDuration.add(duration);
-            assertEquals(myDuration.normalizeWith(new GregorianCalendar(2003, 2, 22)),
-                    DatatypeFactory.newInstance().newDuration("P730D"));
-        } catch (ParserConfigurationException | DatatypeConfigurationException
-                | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+        Duration duration = DatatypeFactory.newInstance().newDuration("P365D");
+        Duration sellDuration = DatatypeFactory.newInstance().newDuration(childList.item(0).getNodeValue());
+        assertFalse(sellDuration.isShorterThan(duration));
+        assertFalse(sellDuration.isLongerThan(duration));
+        assertEquals(sellDuration.getField(DatatypeConstants.DAYS), BigInteger.valueOf(365));
+        assertEquals(sellDuration.normalizeWith(new GregorianCalendar(1999, 2, 22)), duration);
+
+        Duration myDuration = sellDuration.add(duration);
+        assertEquals(myDuration.normalizeWith(new GregorianCalendar(2003, 2, 22)),
+                DatatypeFactory.newInstance().newDuration("P730D"));
     }
 
     /**
      * Check usage of TypeInfo interface introduced in DOM L3.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testGetTypeInfo() {
+    @Test(groups = {"readLocalFiles"})
+    public void testGetTypeInfo() throws Exception {
         String xmlFile = XML_DIR + "accountInfo.xml";
 
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            dbf.setValidating(true);
-            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
+        dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
 
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            docBuilder.setErrorHandler(new MyErrorHandler());
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        docBuilder.setErrorHandler(new MyErrorHandler());
 
-            Document document = docBuilder.parse(xmlFile);
-            Element userId = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "UserID").item(0);
-            TypeInfo typeInfo = userId.getSchemaTypeInfo();
-            assertTrue(typeInfo.getTypeName().equals("nonNegativeInteger"));
-            assertTrue(typeInfo.getTypeNamespace().equals(W3C_XML_SCHEMA_NS_URI));
+        Document document = docBuilder.parse(xmlFile);
+        Element userId = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "UserID").item(0);
+        TypeInfo typeInfo = userId.getSchemaTypeInfo();
+        assertTrue(typeInfo.getTypeName().equals("nonNegativeInteger"));
+        assertTrue(typeInfo.getTypeNamespace().equals(W3C_XML_SCHEMA_NS_URI));
 
-            Element role = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Role").item(0);
-            TypeInfo roletypeInfo = role.getSchemaTypeInfo();
-            assertTrue(roletypeInfo.getTypeName().equals("BuyOrSell"));
-            assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS));
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+        Element role = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Role").item(0);
+        TypeInfo roletypeInfo = role.getSchemaTypeInfo();
+        assertTrue(roletypeInfo.getTypeName().equals("BuyOrSell"));
+        assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,39 +30,31 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.IOException;
+import java.io.FilePermission;
 import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING;
 import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertFalse;
-
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
-import static test.auctionportal.HiBidConstants.CLASS_DIR;
 import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
 import static test.auctionportal.HiBidConstants.XML_DIR;
 
 /**
  * This is a test class for the Auction portal HiBid.com.
  */
-public class AuctionItemRepository {
+public class AuctionItemRepository extends JAXPFileBaseTest {
     /**
      * XML file for parsing.
      */
@@ -78,94 +70,92 @@
      * document that has more than two levels of entity expansion is parsed or
      * not. Previous system property was changed to jdk.xml.entityExpansionLimit
      * see http://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testEntityExpansionSAXPos() {
-        try {
-            SAXParserFactory factory = SAXParserFactory.newInstance();
-            // Secure processing will limit XML processing to conform to
-            // implementation limits.
-            factory.setFeature(FEATURE_SECURE_PROCESSING, true);
-            // Set entityExpansionLimit as 2 should expect fatalError
-            System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(128000));
-            SAXParser parser = factory.newSAXParser();
+    public void testEntityExpansionSAXPos() throws Exception {
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        // Secure processing will limit XML processing to conform to
+        // implementation limits.
+        factory.setFeature(FEATURE_SECURE_PROCESSING, true);
+        // Set entityExpansionLimit as 2 should expect fatalError
+        setSystemProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(128000));
+        SAXParser parser = factory.newSAXParser();
 
-            MyErrorHandler fatalHandler = new MyErrorHandler();
-            parser.parse(new File(ENTITY_XML), fatalHandler);
-            assertFalse(fatalHandler.isAnyError());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+        MyErrorHandler fatalHandler = new MyErrorHandler();
+        setPermissions(new FilePermission(ENTITY_XML, "read"));
+        parser.parse(new File(ENTITY_XML), fatalHandler);
+        assertFalse(fatalHandler.isAnyError());
     }
     /**
      * Setting the EntityExpansion Limit to 2 and checks if the XML
      * document that has more than two levels of entity expansion is parsed or
      * not. Previous system property was changed to jdk.xml.entityExpansionLimit
      * see http://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = SAXParseException.class)
-    public void testEntityExpansionSAXNeg() throws SAXParseException {
-        //
-        try {
-            SAXParserFactory factory = SAXParserFactory.newInstance();
-            // Secure processing will limit XML processing to conform to
-            // implementation limits.
-            factory.setFeature(FEATURE_SECURE_PROCESSING, true);
-            // Set entityExpansionLimit as 2 should expect SAXParseException
-            System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2));
-            SAXParser parser = factory.newSAXParser();
+    public void testEntityExpansionSAXNeg() throws Exception {
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        // Secure processing will limit XML processing to conform to
+        // implementation limits.
+        factory.setFeature(FEATURE_SECURE_PROCESSING, true);
+        // Set entityExpansionLimit as 2 should expect SAXParseException.
+        setSystemProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2));
 
-            MyErrorHandler fatalHandler = new MyErrorHandler();
-            parser.parse(new File(ENTITY_XML), fatalHandler);
-        } catch (SAXParseException e) {
-            throw e;
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+        SAXParser parser = factory.newSAXParser();
+        MyErrorHandler fatalHandler = new MyErrorHandler();
+        setPermissions(new FilePermission(ENTITY_XML, "read"));
+        parser.parse(new File(ENTITY_XML), fatalHandler);
     }
 
     /**
      * Testing set MaxOccursLimit to 10000 in the secure processing enabled for
      * SAXParserFactory.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testMaxOccurLimitPos() {
+    public void testMaxOccurLimitPos() throws Exception {
         String schema_file = XML_DIR + "toys.xsd";
         String xml_file = XML_DIR + "toys.xml";
-
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        factory.setValidating(true);
+        factory.setFeature(FEATURE_SECURE_PROCESSING, true);
+        setSystemProperty(SP_MAX_OCCUR_LIMIT, String.valueOf(10000));
+        SAXParser parser = factory.newSAXParser();
+        parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        setPermissions(new FilePermission(XML_DIR + "-", "read"));
+        parser.setProperty(JAXP_SCHEMA_SOURCE, new File(schema_file));
         try (InputStream is = new FileInputStream(xml_file)) {
-            SAXParserFactory factory = SAXParserFactory.newInstance();
-            factory.setValidating(true);
-            factory.setFeature(FEATURE_SECURE_PROCESSING, true);
-            System.setProperty(SP_MAX_OCCUR_LIMIT, String.valueOf(10000));
-            SAXParser parser = factory.newSAXParser();
-            parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
-            parser.setProperty(JAXP_SCHEMA_SOURCE, new File(schema_file));
             MyErrorHandler eh = new MyErrorHandler();
             parser.parse(is, eh);
             assertFalse(eh.isAnyError());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
         }
     }
 
     /**
      * Use a DocumentBuilder to create a DOM object and see if Secure Processing
      * feature affects the entity expansion.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testEntityExpansionDOMPos()  {
+    public void testEntityExpansionDOMPos() throws Exception  {
+        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+        dfactory.setFeature(FEATURE_SECURE_PROCESSING, true);
+        setSystemProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(10000));
+        DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
+        MyErrorHandler eh = new MyErrorHandler();
+        dBuilder.setErrorHandler(eh);
         try {
-            DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
-            dfactory.setFeature(FEATURE_SECURE_PROCESSING, true);
-            System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(10000));
-            DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
-            MyErrorHandler eh = new MyErrorHandler();
-            dBuilder.setErrorHandler(eh);
+            setPermissions(new FilePermission(ENTITY_XML, "read"));
             dBuilder.parse(ENTITY_XML);
             assertFalse(eh.isAnyError());
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
+        } finally {
+            setPermissions();
         }
     }
 
@@ -173,310 +163,209 @@
      * Use a DocumentBuilder to create a DOM object and see how does the Secure
      * Processing feature and entityExpansionLimit value affects output.
      * Negative test that when entityExpansionLimit is too small.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = SAXParseException.class)
-    public void testEntityExpansionDOMNeg() throws SAXParseException {
-        try {
-            DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
-            dfactory.setFeature(FEATURE_SECURE_PROCESSING, true);
-            System.setProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2));
-            DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
-            MyErrorHandler eh = new MyErrorHandler();
-            dBuilder.setErrorHandler(eh);
-            dBuilder.parse(ENTITY_XML);
-        } catch (SAXParseException e) {
-            throw e;
-        } catch (ParserConfigurationException | IOException | SAXException e) {
-            failUnexpected(e);
-        }
+    public void testEntityExpansionDOMNeg() throws Exception {
+        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+        dfactory.setFeature(FEATURE_SECURE_PROCESSING, true);
+        setSystemProperty(SP_ENTITY_EXPANSION_LIMIT, String.valueOf(2));
+        DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
+        MyErrorHandler eh = new MyErrorHandler();
+        dBuilder.setErrorHandler(eh);
+        setPermissions(new FilePermission(ENTITY_XML, "read"));
+        dBuilder.parse(ENTITY_XML);
     }
 
     /**
      * Test xi:include with a SAXParserFactory.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testXIncludeSAXPos() {
-        String resultFile = CLASS_DIR + "doc_xinclude.out";
+    @Test(groups = {"readWriteLocalFiles"})
+    public void testXIncludeSAXPos() throws Exception {
+        String resultFile = USER_DIR + "doc_xinclude.out";
         String goldFile = GOLDEN_DIR + "doc_xincludeGold.xml";
         String xmlFile = XML_DIR + "doc_xinclude.xml";
 
-        try {
-            try(FileOutputStream fos = new FileOutputStream(resultFile)) {
-                XInclHandler xh = new XInclHandler(fos, null);
-                SAXParserFactory spf = SAXParserFactory.newInstance();
-                spf.setNamespaceAware(true);
-                spf.setXIncludeAware(true);
-                spf.setFeature(FEATURE_NAME, true);
-                spf.newSAXParser().parse(new File(xmlFile), xh);
-            }
-            assertTrue(compareDocumentWithGold(goldFile, resultFile));
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if (Files.exists(resultPath)) {
-                    Files.delete(resultPath);
-                }
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
+        try(FileOutputStream fos = new FileOutputStream(resultFile)) {
+            XInclHandler xh = new XInclHandler(fos, null);
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setXIncludeAware(true);
+            spf.setFeature(FEATURE_NAME, true);
+            spf.newSAXParser().parse(new File(xmlFile), xh);
         }
+        assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 
     /**
      * Test the simple case of including a document using xi:include using a
      * DocumentBuilder.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testXIncludeDOMPos() {
-        String resultFile = CLASS_DIR + "doc_xincludeDOM.out";
+    @Test(groups = {"readWriteLocalFiles"})
+    public void testXIncludeDOMPos() throws Exception {
+        String resultFile = USER_DIR + "doc_xincludeDOM.out";
         String goldFile = GOLDEN_DIR + "doc_xincludeGold.xml";
         String xmlFile = XML_DIR + "doc_xinclude.xml";
-        try {
-            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
-                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-                dbf.setXIncludeAware(true);
-                dbf.setNamespaceAware(true);
-
-                Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
-                doc.setXmlStandalone(true);
-
-                TransformerFactory.newInstance().newTransformer().
-                        transform(new DOMSource(doc), new StreamResult(fos));
-            }
-            assertTrue(compareDocumentWithGold(goldFile, resultFile));
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerException e) {
-            failUnexpected(e);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if (Files.exists(resultPath)) {
-                    Files.delete(resultPath);
-                }
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
+        try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setXIncludeAware(true);
+            dbf.setNamespaceAware(true);
+            Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
+            doc.setXmlStandalone(true);
+            TransformerFactory.newInstance().newTransformer().
+                    transform(new DOMSource(doc), new StreamResult(fos));
         }
+        assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 
     /**
      * Test the simple case of including a document using xi:include within a
      * xi:fallback using a DocumentBuilder.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testXIncludeFallbackDOMPos() {
-        String resultFile = CLASS_DIR + "doc_fallbackDOM.out";
+    @Test(groups = {"readWriteLocalFiles"})
+    public void testXIncludeFallbackDOMPos() throws Exception {
+        String resultFile = USER_DIR + "doc_fallbackDOM.out";
         String goldFile = GOLDEN_DIR + "doc_fallbackGold.xml";
         String xmlFile = XML_DIR + "doc_fallback.xml";
-        try{
-            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
-                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-                dbf.setXIncludeAware(true);
-                dbf.setNamespaceAware(true);
+        try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setXIncludeAware(true);
+            dbf.setNamespaceAware(true);
 
-                Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
-                doc.setXmlStandalone(true);
-                TransformerFactory.newInstance().newTransformer()
-                        .transform(new DOMSource(doc), new StreamResult(fos));
-            }
-            assertTrue(compareDocumentWithGold(goldFile, resultFile));
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerException e) {
-            failUnexpected(e);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if (Files.exists(resultPath)) {
-                    Files.delete(resultPath);
-                }
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
+            Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
+            doc.setXmlStandalone(true);
+            TransformerFactory.newInstance().newTransformer()
+                    .transform(new DOMSource(doc), new StreamResult(fos));
         }
+        assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 
     /**
      * Test for xi:fallback where the fall back text is parsed as text. This
      * test uses a nested xi:include for the fallback test.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testXIncludeFallbackTextPos() {
-        String resultFile = CLASS_DIR + "doc_fallback_text.out";
+    @Test(groups = {"readWriteLocalFiles"})
+    public void testXIncludeFallbackTextPos() throws Exception {
+        String resultFile = USER_DIR + "doc_fallback_text.out";
         String goldFile = GOLDEN_DIR + "doc_fallback_textGold.xml";
         String xmlFile = XML_DIR + "doc_fallback_text.xml";
-
-        try{
-            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
-                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-                dbf.setXIncludeAware(true);
-                dbf.setNamespaceAware(true);
+        try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setXIncludeAware(true);
+            dbf.setNamespaceAware(true);
 
-                Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
-                doc.setXmlStandalone(true);
-                TransformerFactory.newInstance().newTransformer()
-                        .transform(new DOMSource(doc), new StreamResult(fos));
-            }
-            assertTrue(compareDocumentWithGold(goldFile, resultFile));
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerException e) {
-            failUnexpected(e);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if (Files.exists(resultPath)) {
-                    Files.delete(resultPath);
-                }
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
+            Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
+            doc.setXmlStandalone(true);
+            TransformerFactory.newInstance().newTransformer()
+                    .transform(new DOMSource(doc), new StreamResult(fos));
         }
+        assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 
     /**
      * Test the XPointer element() framework with XInclude.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testXpointerElementPos() {
-        String resultFile = CLASS_DIR + "doc_xpointer_element.out";
+    @Test(groups = {"readWriteLocalFiles"})
+    public void testXpointerElementPos() throws Exception {
+        String resultFile = USER_DIR + "doc_xpointer_element.out";
         String goldFile = GOLDEN_DIR + "doc_xpointerGold.xml";
         String xmlFile = XML_DIR + "doc_xpointer_element.xml";
-
-        try{
-            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
-                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-                dbf.setXIncludeAware(true);
-                dbf.setNamespaceAware(true);
-
-                DocumentBuilder db = dbf.newDocumentBuilder();
+        try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setXIncludeAware(true);
+            dbf.setNamespaceAware(true);
 
-                TransformerFactory.newInstance().newTransformer()
-                        .transform(new DOMSource(db.parse(new File(xmlFile))),
-                                new StreamResult(fos));
-            }
-            assertTrue(compareDocumentWithGold(goldFile, resultFile));
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerException e) {
-            failUnexpected(e);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if (Files.exists(resultPath)) {
-                    Files.delete(resultPath);
-                }
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
+            DocumentBuilder db = dbf.newDocumentBuilder();
+
+            TransformerFactory.newInstance().newTransformer()
+                    .transform(new DOMSource(db.parse(new File(xmlFile))),
+                            new StreamResult(fos));
         }
+        assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 
     /**
      * Test the XPointer framework with a SAX object.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testXPointerPos() {
-        String resultFile = CLASS_DIR + "doc_xpointer.out";
+    @Test(groups = {"readWriteLocalFiles"})
+    public void testXPointerPos() throws Exception {
+        String resultFile = USER_DIR + "doc_xpointer.out";
         String goldFile = GOLDEN_DIR + "doc_xpointerGold.xml";
         String xmlFile = XML_DIR + "doc_xpointer.xml";
 
-        try{
-            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
-                SAXParserFactory spf = SAXParserFactory.newInstance();
-                spf.setNamespaceAware(true);
-                spf.setXIncludeAware(true);
-                spf.setFeature(FEATURE_NAME, true);
-                // parse the file
-                spf.newSAXParser().parse(new File(xmlFile), new XInclHandler(fos, null));
-            }
-            assertTrue(compareDocumentWithGold(goldFile, resultFile));
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if (Files.exists(resultPath)) {
-                    Files.delete(resultPath);
-                }
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
+        try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setXIncludeAware(true);
+            spf.setFeature(FEATURE_NAME, true);
+            // parse the file
+            spf.newSAXParser().parse(new File(xmlFile), new XInclHandler(fos, null));
         }
+        assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 
     /**
      * Test if xi:include may reference the doc containing the include if the
      * parse type is text.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testXIncludeLoopPos() {
-        String resultFile = CLASS_DIR + "doc_xinc_loops.out";
+    @Test(groups = {"readWriteLocalFiles"})
+    public void testXIncludeLoopPos() throws Exception {
+        String resultFile = USER_DIR + "doc_xinc_loops.out";
         String goldFile = GOLDEN_DIR + "doc_xinc_loopGold.xml";
         String xmlFile = XML_DIR + "doc_xinc_loops.xml";
 
-        try{
-            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
-                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-                dbf.setXIncludeAware(true);
-                dbf.setNamespaceAware(true);
-                DocumentBuilder db = dbf.newDocumentBuilder();
-                Document doc = db.parse(new File(xmlFile));
-                doc.normalizeDocument();
-                doc.setXmlStandalone(true);
+        try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setXIncludeAware(true);
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document doc = db.parse(new File(xmlFile));
+            doc.normalizeDocument();
+            doc.setXmlStandalone(true);
 
-                TransformerFactory.newInstance().newTransformer()
-                        .transform(new DOMSource(doc), new StreamResult(fos));
-            }
-            assertTrue(compareDocumentWithGold(goldFile, resultFile));
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerException e) {
-            failUnexpected(e);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if (Files.exists(resultPath)) {
-                    Files.delete(resultPath);
-                }
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
+            TransformerFactory.newInstance().newTransformer()
+                    .transform(new DOMSource(doc), new StreamResult(fos));
         }
+        assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 
     /**
      * Test if two non nested xi:include elements can include the same document
      * with an xi:include statement.
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testXIncludeNestedPos() {
-        String resultFile = CLASS_DIR + "schedule.out";
+    @Test(groups = {"readWriteLocalFiles"})
+    public void testXIncludeNestedPos() throws Exception {
+        String resultFile = USER_DIR + "schedule.out";
         String goldFile = GOLDEN_DIR + "scheduleGold.xml";
         String xmlFile = XML_DIR + "schedule.xml";
 
-        try{
-            try (FileOutputStream fos = new FileOutputStream(resultFile)) {
-                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-                dbf.setXIncludeAware(true);
-                dbf.setNamespaceAware(true);
+        try (FileOutputStream fos = new FileOutputStream(resultFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setXIncludeAware(true);
+            dbf.setNamespaceAware(true);
 
-                Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
-                doc.setXmlStandalone(true);
-                TransformerFactory.newInstance().newTransformer()
-                        .transform(new DOMSource(doc), new StreamResult(fos));
-            }
-            assertTrue(compareDocumentWithGold(goldFile, resultFile));
-        } catch (ParserConfigurationException | SAXException | IOException
-                | TransformerException e) {
-            failUnexpected(e);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if (Files.exists(resultPath)) {
-                    Files.delete(resultPath);
-                }
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
+            Document doc = dbf.newDocumentBuilder().parse(new File(xmlFile));
+            doc.setXmlStandalone(true);
+            TransformerFactory.newInstance().newTransformer()
+                    .transform(new DOMSource(doc), new StreamResult(fos));
         }
+        assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/MyDOMErrorHandler.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package test.auctionportal;
-
-import org.w3c.dom.DOMErrorHandler;
-import org.w3c.dom.DOMError;
-
-/**
- * Error handler for recording DOM processing error.
- */
-public class MyDOMErrorHandler implements DOMErrorHandler {
-    /**
-     * flag shows if there is any error.
-     */
-    private volatile boolean errorOccured = false;
-
-    /**
-     * Set errorOcurred to true when an error occurs.
-     * @param error The error object that describes the error. This object
-     * may be reused by the DOM implementation across multiple calls to
-     * the handleError method.
-     * @return true that processing may continue depending on.
-     */
-    @Override
-    public boolean handleError (DOMError error) {
-        System.err.println( "ERROR" + error.getMessage());
-        System.err.println( "ERROR" + error.getRelatedData());
-        errorOccured = true;
-        return true;
-    }
-
-    /**
-     * Showing if any error was handled.
-     * @return true if there is one or more error.
-     *         false no error occurs.
-     */
-    public boolean isError() {
-        return errorOccured;
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/MyDOMOutput.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package test.auctionportal;
-
-import org.w3c.dom.ls.LSOutput;
-import java.io.OutputStream;
-import java.io.Writer;
-
-/**
- * A Thread-safe LS output destination for DOM processing. LSOutput objects
- * belong to the application. The DOM implementation will never modify them
- * (though it may make copies and modify the copies, if necessary).
- */
-public class MyDOMOutput implements LSOutput {
-    /**
-     * An attribute of a language and binding dependent type that represents a
-     * writable stream of bytes.
-     */
-    private OutputStream bytestream;
-
-    /**
-     * character encoding to use for the output.
-     */
-    private String encoding;
-
-    /**
-     * The system identifier.
-     */
-    private String sysId;
-
-    /**
-     * Writable stream to which 16-bit units can be output.
-     */
-    private Writer writer;
-
-    /**
-     * An attribute of a language and binding dependent type that represents a
-     * writable stream of bytes.
-     *
-     * @return a writable stream.
-     */
-    @Override
-    public OutputStream getByteStream() {
-        return bytestream;
-    }
-
-    /**
-     * An attribute of a language and binding dependent type that represents a
-     * writable stream to which 16-bit units can be output.
-     *
-     * @return writable stream instance.
-     */
-    @Override
-    public Writer getCharacterStream() {
-        return writer;
-    }
-
-    /**
-     * The character encoding to use for the output.
-     *
-     * @return the character encoding.
-     */
-    @Override
-    public String getEncoding() {
-        return encoding;
-    }
-
-    /**
-     * The system identifier for this output destination.
-     *
-     * @return system identifier.
-     */
-    @Override
-    public String getSystemId() {
-        return sysId;
-    }
-
-    /**
-     * Set writable stream of bytes.
-     *
-     * @param bs OutputStream instance
-     */
-    @Override
-    public void setByteStream(OutputStream bs) {
-        bytestream = bs;
-    }
-
-    /**
-     * Set 16 bits unit writable stream.
-     *
-     * @param bs a Writer instance
-     */
-    @Override
-    public void setCharacterStream(Writer cs) {
-        writer = cs;
-    }
-
-    /**
-     * Set character encoding to use for the output.
-     *
-     * @param encoding encoding set to the output
-     */
-    @Override
-    public void setEncoding(String encoding) {
-        this.encoding = encoding;
-    }
-
-    /**
-     * Set the system identifier for the output.
-     *
-     * @param sysId system identifier string.
-     */
-    @Override
-    public void setSystemId(String sysId) {
-        this.sysId = sysId;
-    }
-}
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/MyErrorHandler.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package test.auctionportal;
-
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * ErrorHandler for error handling. Set state if any method in error, warning
- * or fatalError was called.
- */
-public final class MyErrorHandler extends DefaultHandler {
-    /**
-     * Enumeration for ErrorHandler's state.
-     */
-    private enum STATE { ERROR, FATAL, WARNING, NORMAL};
-
-    /**
-     * Set state as normal by default.
-     */
-    private volatile STATE state = STATE.NORMAL;
-
-    /**
-     * Keep exception for further investigation.
-     */
-    private volatile SAXParseException exception;
-
-    /**
-     * Save exception and set state to ERROR.
-     * @param e exception wrap error.
-     */
-    @Override
-    public void error (SAXParseException e) {
-        state = STATE.ERROR;
-        exception = e;
-    }
-
-    /**
-     * Save exception and set state to FATAL.
-     * @param e exception wrap error.
-     */
-    @Override
-    public void fatalError (SAXParseException e) {
-        state = STATE.FATAL;
-        exception = e;
-    }
-
-    /**
-     * Save exception and set state to WARNING.
-     * @param e exception wrap error.
-     */
-    @Override
-    public void warning (SAXParseException e) {
-        state = STATE.WARNING;
-        exception = e;
-    }
-
-    /**
-     * return ErrorHandle's state .
-     * @return true No error, fatalError and warning.
-     *         false there is any error, fatalError or warning in processing.
-     */
-    public boolean isAnyError() {
-        if (state != STATE.NORMAL)
-            System.out.println(exception);
-        return state != STATE.NORMAL;
-    }
-
-    /**
-     * return whether fatalError is the only error.
-     * @return true fatalError is the only error.
-     *         false there is no error, or other error besides fatalError.
-     */
-    public boolean isFatalError() {
-        if (state == STATE.FATAL)
-            System.out.println(exception);
-        return state == STATE.FATAL;
-    }
-
-}
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,17 @@
 import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_LANGUAGE;
 import static org.testng.Assert.assertFalse;
 import java.io.FileOutputStream;
-import java.io.IOException;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
 import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
+import jaxp.library.JAXPFileBaseTest;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
-import static jaxp.library.JAXPTestUtilities.failCleanup;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
-
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -50,8 +46,6 @@
 import org.w3c.dom.ls.DOMImplementationLS;
 import org.w3c.dom.ls.LSParser;
 import org.w3c.dom.ls.LSSerializer;
-import org.xml.sax.SAXException;
-import static test.auctionportal.HiBidConstants.CLASS_DIR;
 import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
 import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
 import static test.auctionportal.HiBidConstants.XML_DIR;
@@ -59,141 +53,127 @@
 /**
  * This is the user controller class for the Auction portal HiBid.com.
  */
-public class UserController {
+public class UserController extends JAXPFileBaseTest {
     /**
      * Checking when creating an XML document using DOM Level 2 validating
      * it without having a schema source or a schema location It must throw a
      * sax parse exception.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testCreateNewUser() {
-        String resultFile = CLASS_DIR + "accountInfoOut.xml";
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            dbf.setValidating(true);
+    public void testCreateNewUser() throws Exception {
+        String resultFile = USER_DIR + "accountInfoOut.xml";
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
 
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            MyErrorHandler eh = new MyErrorHandler();
-            docBuilder.setErrorHandler(eh);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        MyErrorHandler eh = new MyErrorHandler();
+        docBuilder.setErrorHandler(eh);
 
-            Document document = docBuilder.newDocument();
+        Document document = docBuilder.newDocument();
 
-            Element account = document.createElementNS(PORTAL_ACCOUNT_NS, "acc:Account");
-            Attr accountID = document.createAttributeNS(PORTAL_ACCOUNT_NS, "acc:accountID");
-            account.setAttributeNode(accountID);
+        Element account = document.createElementNS(PORTAL_ACCOUNT_NS, "acc:Account");
+        Attr accountID = document.createAttributeNS(PORTAL_ACCOUNT_NS, "acc:accountID");
+        account.setAttributeNode(accountID);
 
-            account.appendChild(document.createElement("FirstName"));
-            account.appendChild(document.createElementNS(PORTAL_ACCOUNT_NS, "acc:LastName"));
-            account.appendChild(document.createElement("UserID"));
+        account.appendChild(document.createElement("FirstName"));
+        account.appendChild(document.createElementNS(PORTAL_ACCOUNT_NS, "acc:LastName"));
+        account.appendChild(document.createElement("UserID"));
 
-            DOMImplementationLS impl
-                    = (DOMImplementationLS) DOMImplementationRegistry
-                            .newInstance().getDOMImplementation("LS");
-            LSSerializer writer = impl.createLSSerializer();
-            LSParser builder = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
-            FileOutputStream output = new FileOutputStream(resultFile);
+        DOMImplementationLS impl
+                = (DOMImplementationLS) DOMImplementationRegistry
+                        .newInstance().getDOMImplementation("LS");
+        LSSerializer writer = impl.createLSSerializer();
+        LSParser builder = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
+        try(FileOutputStream output = new FileOutputStream(resultFile)) {
             MyDOMOutput domOutput = new MyDOMOutput();
-
             domOutput.setByteStream(output);
             writer.write(account, domOutput);
             docBuilder.parse(resultFile);
-
-            assertTrue(eh.isAnyError());
-        } catch (ParserConfigurationException | ClassNotFoundException |
-                InstantiationException | IllegalAccessException
-                | ClassCastException | SAXException | IOException e) {
-            failUnexpected(e);
         }
+        assertTrue(eh.isAnyError());
     }
 
     /**
      * Checking conflicting namespaces and use renameNode and normalizeDocument.
      * @see <a href="content/accountInfo.xml">accountInfo.xml</a>
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testAddUser() {
-        String resultFile = CLASS_DIR + "accountRole.out";
+    public void testAddUser() throws Exception {
+        String resultFile = USER_DIR + "accountRole.out";
         String xmlFile = XML_DIR + "accountInfo.xml";
 
-        try {
-            // Copy schema for outputfile
-            Files.copy(Paths.get(XML_DIR, "accountInfo.xsd"),
-                    Paths.get(CLASS_DIR, "accountInfo.xsd"),
-                    StandardCopyOption.REPLACE_EXISTING);
-            MyErrorHandler eh = new MyErrorHandler();
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        // Copy schema for outputfile
+        Files.copy(Paths.get(XML_DIR, "accountInfo.xsd"),
+                Paths.get(USER_DIR, "accountInfo.xsd"),
+                StandardCopyOption.REPLACE_EXISTING);
+        MyErrorHandler eh = new MyErrorHandler();
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 
-            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
-            dbf.setNamespaceAware(true);
-            dbf.setValidating(true);
+        dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
 
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            docBuilder.setErrorHandler(eh);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        docBuilder.setErrorHandler(eh);
 
-            Document document = docBuilder.parse(xmlFile);
-            Element sell = (Element) document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Sell").item(0);
-            Element role = (Element) sell.getParentNode();
+        Document document = docBuilder.parse(xmlFile);
+        Element sell = (Element) document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Sell").item(0);
+        Element role = (Element) sell.getParentNode();
 
-            Element buy = (Element) document.renameNode(sell, PORTAL_ACCOUNT_NS, "acc:Buy");
-            role.appendChild(buy);
+        Element buy = (Element) document.renameNode(sell, PORTAL_ACCOUNT_NS, "acc:Buy");
+        role.appendChild(buy);
 
-            DOMImplementationLS impl
-                    = (DOMImplementationLS) DOMImplementationRegistry
-                            .newInstance().getDOMImplementation("LS");
-            LSSerializer writer = impl.createLSSerializer();
+        DOMImplementationLS impl
+                = (DOMImplementationLS) DOMImplementationRegistry
+                        .newInstance().getDOMImplementation("LS");
+        LSSerializer writer = impl.createLSSerializer();
 
 
-            try(FileOutputStream output = new FileOutputStream(resultFile)) {
-                MyDOMOutput mydomoutput = new MyDOMOutput();
-                mydomoutput.setByteStream(output);
-                writer.write(document, mydomoutput);
-            }
+        try(FileOutputStream output = new FileOutputStream(resultFile)) {
+            MyDOMOutput mydomoutput = new MyDOMOutput();
+            mydomoutput.setByteStream(output);
+            writer.write(document, mydomoutput);
+        }
 
-            docBuilder.parse(resultFile);
-            assertFalse(eh.isAnyError());
-        } catch (ParserConfigurationException | SAXException | IOException
-                | ClassNotFoundException | InstantiationException
-                | IllegalAccessException | ClassCastException e) {
-            failUnexpected(e);
-        }
+        docBuilder.parse(resultFile);
+        assertFalse(eh.isAnyError());
     }
 
     /**
      * Checking Text content in XML file.
      * @see <a href="content/accountInfo.xml">accountInfo.xml</a>
+     *
+     * @throws Exception If any errors occur.
      */
-    @Test
-    public void testMoreUserInfo() {
+    @Test(groups = {"readLocalFiles"})
+    public void testMoreUserInfo() throws Exception {
         String xmlFile = XML_DIR + "accountInfo.xml";
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 
-        try {
-            System.out.println("Checking additional user info");
-
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-
-            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
-            dbf.setNamespaceAware(true);
-            dbf.setValidating(true);
+        dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
 
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            MyErrorHandler eh = new MyErrorHandler();
-            docBuilder.setErrorHandler(eh);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        MyErrorHandler eh = new MyErrorHandler();
+        docBuilder.setErrorHandler(eh);
 
-            Document document = docBuilder.parse(xmlFile);
-            Element account = (Element)document
-                    .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);
-            String textContent = account.getTextContent();
-            assertTrue(textContent.trim().regionMatches(0, "Rachel", 0, 6));
-            assertEquals(textContent, "RachelGreen744");
+        Document document = docBuilder.parse(xmlFile);
+        Element account = (Element)document
+                .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0);
+        String textContent = account.getTextContent();
+        assertTrue(textContent.trim().regionMatches(0, "Rachel", 0, 6));
+        assertEquals(textContent, "RachelGreen744");
 
-            Attr accountID = account.getAttributeNodeNS(PORTAL_ACCOUNT_NS, "accountID");
-            assertTrue(accountID.getTextContent().trim().equals("1"));
+        Attr accountID = account.getAttributeNodeNS(PORTAL_ACCOUNT_NS, "accountID");
+        assertTrue(accountID.getTextContent().trim().equals("1"));
 
-            assertFalse(eh.isAnyError());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+        assertFalse(eh.isAnyError());
     }
 
     /**
@@ -204,83 +184,73 @@
      * into an XML file which is validated by the schema This covers Row 5
      * for the table
      * http://javaweb.sfbay/~jsuttor/JSR206/jsr-206-html/ch03s05.html. Filed
-     * bug 4893745 because there was a difference in behavior
+     * bug 4893745 because there was a difference in behavior.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testCreateUserAccount() {
-        System.out.println("Creating user account");
+    public void testCreateUserAccount() throws Exception {
         String userXmlFile = XML_DIR + "userInfo.xml";
         String accountXmlFile = XML_DIR + "accountInfo.xml";
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
 
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            dbf.setValidating(true);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        MyErrorHandler eh = new MyErrorHandler();
+        docBuilder.setErrorHandler(eh);
 
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            MyErrorHandler eh = new MyErrorHandler();
-            docBuilder.setErrorHandler(eh);
-
-            Document document = docBuilder.parse(userXmlFile);
-            Element user = (Element) document.getElementsByTagName("FirstName").item(0);
-            // Set schema after parsing userInfo.xml. Otherwise it will conflict
-            // with DTD validation.
-            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
-            DocumentBuilder docBuilder1 = dbf.newDocumentBuilder();
-            docBuilder1.setErrorHandler(eh);
-            Document accDocument = docBuilder1.parse(accountXmlFile);
+        Document document = docBuilder.parse(userXmlFile);
+        Element user = (Element) document.getElementsByTagName("FirstName").item(0);
+        // Set schema after parsing userInfo.xml. Otherwise it will conflict
+        // with DTD validation.
+        dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        DocumentBuilder docBuilder1 = dbf.newDocumentBuilder();
+        docBuilder1.setErrorHandler(eh);
+        Document accDocument = docBuilder1.parse(accountXmlFile);
 
-            Element firstName = (Element) accDocument
-                    .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "FirstName").item(0);
-            Element adoptedAccount = (Element) accDocument.adoptNode(user);
+        Element firstName = (Element) accDocument
+                .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "FirstName").item(0);
+        Element adoptedAccount = (Element) accDocument.adoptNode(user);
 
-            Element parent = (Element) firstName.getParentNode();
-            parent.replaceChild(adoptedAccount, firstName);
-
-            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
-            DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
-            LSSerializer writer = impl.createLSSerializer();
+        Element parent = (Element) firstName.getParentNode();
+        parent.replaceChild(adoptedAccount, firstName);
 
-            MyDOMOutput mydomoutput = new MyDOMOutput();
-            mydomoutput.setByteStream(System.out);
-
-            writer.write(document, mydomoutput);
-            writer.write(accDocument, mydomoutput);
+        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+        DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS");
+        LSSerializer writer = impl.createLSSerializer();
 
-            assertFalse(eh.isAnyError());
-        } catch (ParserConfigurationException | SAXException | IOException
-                | ClassNotFoundException | InstantiationException
-                | IllegalAccessException | ClassCastException e) {
-            failUnexpected(e);
-        }
+        MyDOMOutput mydomoutput = new MyDOMOutput();
+        mydomoutput.setByteStream(System.out);
+
+        writer.write(document, mydomoutput);
+        writer.write(accDocument, mydomoutput);
+
+        assertFalse(eh.isAnyError());
     }
 
     /**
      * Checking for Row 8 from the schema table when setting the schemaSource
      * without the schemaLanguage must report an error.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test(expectedExceptions = IllegalArgumentException.class)
-    public void testUserError() throws IllegalArgumentException {
-        System.out.println("Creating an error in user account");
-
+    public void testUserError() throws Exception {
         String xmlFile = XML_DIR + "userInfo.xml";
         String schema = "http://java.sun.com/xml/jaxp/properties/schemaSource";
         String schemaValue = "http://dummy.com/dummy.xsd";
 
-        try {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setNamespaceAware(true);
-            dbf.setValidating(true);
-            dbf.setAttribute(schema, schemaValue);
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
+        dbf.setAttribute(schema, schemaValue);
 
-            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-            MyErrorHandler eh = new MyErrorHandler();
-            docBuilder.setErrorHandler(eh);
-            Document document = docBuilder.parse(xmlFile);
-            assertFalse(eh.isAnyError());
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            failUnexpected(e);
-        }
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        MyErrorHandler eh = new MyErrorHandler();
+        docBuilder.setErrorHandler(eh);
+        docBuilder.parse(xmlFile);
+        assertFalse(eh.isAnyError());
     }
 
     /**
@@ -288,10 +258,12 @@
      * @see <a href="content/screenName.xml">screenName.xml</a> has prefix of
      * userName is bound to "http://hibid.com/user" namespace normalization
      * will create a namespace of prefix us and attach userEmail.
+     *
+     * @throws Exception If any errors occur.
      */
     @Test
-    public void testCheckScreenNameExists() {
-        String resultFile = CLASS_DIR + "screenName.out";
+    public void testCheckScreenNameExists() throws Exception {
+        String resultFile = USER_DIR + "screenName.out";
         String xmlFile = XML_DIR + "screenName.xml";
         String goldFile = GOLDEN_DIR + "screenNameGold.xml";
 
@@ -318,21 +290,7 @@
             MyDOMOutput domoutput = new MyDOMOutput();
             domoutput.setByteStream(output);
             writer.write(document, domoutput);
-
-            assertTrue(compareDocumentWithGold(goldFile, resultFile));
-        } catch (ClassNotFoundException | InstantiationException
-                | IllegalAccessException | ClassCastException | IOException
-                | ParserConfigurationException | SAXException e) {
-            failUnexpected(e);
-        } finally {
-            try {
-                Path resultPath = Paths.get(resultFile);
-                if (Files.exists(resultPath)) {
-                    Files.delete(resultPath);
-                }
-            } catch (IOException ex) {
-                failCleanup(ex, resultFile);
-            }
         }
+        assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 }
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/XInclHandler.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,382 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package test.auctionportal;
-
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.stream.Collectors;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.ext.LexicalHandler;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * A SAX2 event handlers.
- * This SAX2 ContentHandler receives callback event then print whole document
- * that is parsed.
- */
-public class XInclHandler extends DefaultHandler implements LexicalHandler {
-    /**
-     * Print writer.
-     */
-    private final PrintWriter fOut;
-
-    /**
-     * Canonical output.
-     */
-    private volatile boolean fCanonical;
-
-    /**
-     * Element depth.
-     */
-    private volatile int fElementDepth;
-
-    /**
-     * Sets whether output is canonical.
-     */
-    public void setCanonical(boolean canonical) {
-        fCanonical = canonical;
-    }
-
-    /**
-     * Sets the output stream for printing.
-     * @param stream OutputStream for message output.
-     * @param encoding File encoding for message output.
-     */
-    public XInclHandler(OutputStream stream, String encoding)
-            throws UnsupportedEncodingException {
-        // At least set one encoding.
-        if (encoding == null) {
-            encoding = "UTF8";
-        }
-
-        fOut = new PrintWriter(new OutputStreamWriter(stream, encoding), false);
-    }
-
-    /**
-     * Receive notification of the beginning of the document. Write the start
-     * document tag if it's not canonical mode.
-     * @exception org.xml.sax.SAXException Any SAX exception, possibly
-     *            wrapping another exception.
-     */
-    @Override
-    public void startDocument() throws SAXException {
-        fElementDepth = 0;
-
-        if (!fCanonical) {
-            writeFlush("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
-        }
-    }
-
-    /**
-     * Receive notification of a processing instruction.
-     * @param target The processing instruction target.
-     * @param data The processing instruction data, or null if
-     *             none is supplied.
-     * @exception org.xml.sax.SAXException Any SAX exception, possibly
-     *            wrapping another exception.
-     */
-    @Override
-    public void processingInstruction (String target, String data)
-        throws SAXException {
-        if (fElementDepth > 0) {
-            StringBuilder instruction = new StringBuilder("<?").append(target);
-            if (data != null && data.length() > 0) {
-                instruction.append(' ').append(data);
-            }
-            instruction.append("?>");
-            writeFlush(instruction.toString());
-        }
-    }
-
-    /**
-     * Receive notification of the start of an element then write the normalized
-     * output to the file.
-     * @param uri The Namespace URI, or the empty string if the
-     *        element has no Namespace URI or if Namespace
-     *        processing is not being performed.
-     * @param localName The local name (without prefix), or the
-     *        empty string if Namespace processing is not being
-     *        performed.
-     * @param qName The qualified name (with prefix), or the
-     *        empty string if qualified names are not available.
-     * @param attributes The attributes attached to the element.  If
-     *        there are no attributes, it shall be an empty
-     *        Attributes object.
-     */
-    @Override
-    public void startElement(String uri, String local, String raw,
-            Attributes attrs) throws SAXException {
-        fElementDepth++;
-        StringBuilder start = new StringBuilder().append('<').append(raw);
-        if (attrs != null) {
-            for (int i = 0; i < attrs.getLength(); i++) {
-                start.append(' ').append(attrs.getQName(i)).append("=\"").
-                    append(normalizeAndPrint(attrs.getValue(i))).append('"');
-            }
-        }
-        start.append('>');
-        writeFlush(start.toString());
-    }
-
-    /**
-     * Receive notification of character data inside an element and write
-     * normalized characters to file.
-     * @param ch The characters.
-     * @param start The start position in the character array.
-     * @param length The number of characters to use from the
-     *               character array.
-     * @exception org.xml.sax.SAXException Any SAX exception, possibly
-     *            wrapping another exception.
-     */
-    @Override
-    public void characters(char ch[], int start, int length)
-            throws SAXException {
-        writeFlush(normalizeAndPrint(ch, start, length));
-    }
-
-    /**
-     * Receiving notification of ignorable whitespace in element content and
-     * writing normalized ignorable characters to file.
-     * @param ch The characters.
-     * @param start The start position in the character array.
-     * @param length The number of characters to use from the
-     *               character array.
-     * @exception org.xml.sax.SAXException Any SAX exception, possibly
-     *            wrapping another exception.
-     */
-    @Override
-    public void ignorableWhitespace(char ch[], int start, int length)
-            throws SAXException {
-        characters(ch, start, length);
-    }
-
-    /**
-     * Receive notification of the end of an element and print end element.
-     *
-     * @param uri The Namespace URI, or the empty string if the
-     *        element has no Namespace URI or if Namespace
-     *        processing is not being performed.
-     * @param localName The local name (without prefix), or the
-     *        empty string if Namespace processing is not being
-     *        performed.
-     * @param qName The qualified name (with prefix), or the
-     *        empty string if qualified names are not available.
-     */
-    @Override
-    public void endElement(String uri, String local, String raw)
-            throws SAXException {
-        fElementDepth--;
-        writeFlush("</" + raw + ">");
-    }
-
-    /**
-     * Receive notification of a parser warning and print it out.
-     * @param e The warning information encoded as an exception.
-     * @exception org.xml.sax.SAXException Any SAX exception, possibly
-     *            wrapping another exception.
-     */
-    @Override
-    public void warning(SAXParseException ex) throws SAXException {
-        printError("Warning", ex);
-    }
-
-    /**
-     * Receive notification of a parser error and print it out.
-     * @param e The error information encoded as an exception.
-     * @exception org.xml.sax.SAXException Any SAX exception, possibly
-     *            wrapping another exception.
-
-     */
-    @Override
-    public void error(SAXParseException ex) throws SAXException {
-        printError("Error", ex);
-    }
-
-    /**
-     * Receive notification of a parser fatal error. Throw out fatal error
-     * following print fatal error message.
-     * @param e The fatal error information encoded as an exception.
-     * @exception org.xml.sax.SAXException Any SAX exception, possibly
-     *            wrapping another exception.
-
-     */
-    @Override
-    public void fatalError(SAXParseException ex) throws SAXException {
-        printError("Fatal Error", ex);
-        throw ex;
-    }
-
-    /**
-     * Do nothing on start DTD.
-     * @param name The document type name.
-     * @param publicId The declared public identifier for the
-     *        external DTD subset, or null if none was declared.
-     * @param systemId The declared system identifier for the
-     *        external DTD subset, or null if none was declared.
-     *        (Note that this is not resolved against the document
-     *        base URI.)
-     * @exception SAXException The application may raise an
-     *            exception.
-     */
-    @Override
-    public void startDTD(String name, String publicId, String systemId)
-        throws SAXException {
-    }
-
-    /**
-     * Do nothing on end DTD.
-     * @exception SAXException The application may raise an exception.
-     */
-    @Override
-    public void endDTD() throws SAXException {
-    }
-
-    /**
-     * Do nothing on start entity.
-     * @param name The name of the entity.  If it is a parameter
-     *        entity, the name will begin with '%', and if it is the
-     *        external DTD subset, it will be "[dtd]".
-     * @exception SAXException The application may raise an exception.
-     */
-    @Override
-    public void startEntity(String name) throws SAXException {
-    }
-
-    /**
-     * Do nothing on end entity.
-     * @param name The name of the entity.  If it is a parameter
-     *        entity, the name will begin with '%', and if it is the
-     *        external DTD subset, it will be "[dtd]".
-     * @exception SAXException The application may raise an exception.
-     */
-    @Override
-    public void endEntity(String name) throws SAXException {
-    }
-
-    /**
-     * Do nothing on start CDATA section.
-     * @exception SAXException The application may raise an exception.
-     */
-    @Override
-    public void startCDATA() throws SAXException {
-    }
-
-    /**
-     * Do nothing on end CDATA section.
-     * @exception SAXException The application may raise an exception.
-     */
-    @Override
-    public void endCDATA() throws SAXException {
-    }
-
-    /**
-     * Report an normalized XML comment when receive a comment in the document.
-     *
-     * @param ch An array holding the characters in the comment.
-     * @param start The starting position in the array.
-     * @param length The number of characters to use from the array.
-     * @exception SAXException The application may raise an exception.
-     */
-    @Override
-    public void comment(char ch[], int start, int length) throws SAXException {
-        if (!fCanonical && fElementDepth > 0) {
-            writeFlush("<!--" + normalizeAndPrint(ch, start, length) + "-->");
-        }
-    }
-
-    /**
-     * Normalizes and prints the given string.
-     * @param s String to be normalized
-     */
-    private String normalizeAndPrint(String s) {
-        return s.chars().mapToObj(c -> normalizeAndPrint((char)c)).
-                collect(Collectors.joining());
-    }
-
-    /**
-     * Normalizes and prints the given array of characters.
-     * @param ch The characters to be normalized.
-     * @param start The start position in the character array.
-     * @param length The number of characters to use from the
-     *               character array.
-     */
-    private String normalizeAndPrint(char[] ch, int offset, int length) {
-        return normalizeAndPrint(new String(ch, offset, length));
-    }
-
-    /**
-     * Normalizes given character.
-     * @param c char to be normalized.
-     */
-    private String normalizeAndPrint(char c) {
-        switch (c) {
-            case '<':
-                return "&lt;";
-            case '>':
-                return "&gt;";
-            case '&':
-                return "&amp;";
-            case '"':
-                return "&quot;";
-            case '\r':
-            case '\n':
-                return fCanonical ? "&#" + Integer.toString(c) + ";" : String.valueOf(c);
-            default:
-                return String.valueOf(c);
-        }
-    }
-
-    /**
-     * Prints the error message.
-     * @param type error type
-     * @param ex exception that need to be printed
-     */
-    private void printError(String type, SAXParseException ex) {
-        System.err.print("[" + type + "] ");
-        String systemId = ex.getSystemId();
-        if (systemId != null) {
-            int index = systemId.lastIndexOf('/');
-            if (index != -1)
-                systemId = systemId.substring(index + 1);
-            System.err.print(systemId);
-        }
-        System.err.print(':' + ex.getLineNumber());
-        System.err.print(':' + ex.getColumnNumber());
-        System.err.println(": " + ex.getMessage());
-        System.err.flush();
-    }
-
-    /**
-     * Write out and flush.
-     * @param out string to be written.
-     */
-    private void writeFlush(String out) {
-        fOut.print(out);
-        fOut.flush();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/javax/xml/parsers/ptests/MyCHandler.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package javax.xml.parsers.ptests;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import static jaxp.library.JAXPTestUtilities.ERROR_MSG_HEADER;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.LocatorImpl;
+
+/**
+ * Customized DefaultHandler which writes output document when methods are
+ * called by Transformer. Test may use output document to compare with golden
+ * file for verification.
+ */
+class MyCHandler extends DefaultHandler implements AutoCloseable {
+
+    private final BufferedWriter bWriter;
+    private final Locator locator = new LocatorImpl();
+
+    private MyCHandler(File file) throws IOException {
+        bWriter = new BufferedWriter(new FileWriter(file));
+    }
+
+    public static MyCHandler newInstance(File file) throws IOException {
+        MyCHandler handler = new MyCHandler(file);
+        return handler;
+    }
+
+    @Override
+    public void characters(char[] ch, int start, int length) {
+        String s = new String(ch, start, length);
+        String str = String.format("characters...length is:%d\n<%s>", s.length(), s);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void endDocument() {
+        String str = "endDocument...";
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+            bWriter.flush();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void endElement(String namespaceURI, String localName, String qName) {
+        String str = String.format("endElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s>", namespaceURI, localName, qName);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void endPrefixMapping(String prefix) {
+        String str = String.format("endPrefixMapping...\nprefix: <%s>", prefix);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void ignorableWhitespace(char[] ch, int start, int length) {
+        String s = new String(ch, start, length);
+        String str = String.format("ignorableWhitespace...\n%s ignorable white space string length: %d", s, s.length());
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void processingInstruction(String target, String data) {
+        String str = String.format("processingInstruction...target:<%s> data: <%s>", target, data);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void skippedEntity(String name) {
+        String str = String.format("skippedEntity...\nname: <%s>", name);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void startDocument() {
+        String str = "startDocument...";
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
+        String str = String.format("startElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s> Number of Attributes: <%d> Line# <%d>", namespaceURI,
+                localName, qName, atts.getLength(), locator.getLineNumber());
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void startPrefixMapping(String prefix, String uri) {
+        String str = String.format("startPrefixMapping...\nprefix: <%s> uri: <%s>", prefix, uri);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    @Override
+    public void close() throws IOException {
+        if (bWriter != null)
+            bWriter.close();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/javax/xml/parsers/ptests/MyErrorHandler.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package javax.xml.parsers.ptests;
+
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Customized DefaultHandler used for SAXParseException testing.
+ */
+class MyErrorHandler extends DefaultHandler {
+    /**
+     * Flag whether any event was received.
+     */
+    private volatile boolean errorOccured;
+
+    /**
+     * Set no event received on constructor.
+     */
+    private MyErrorHandler() {
+        errorOccured = false;
+    }
+
+    /**
+     * Factory method to create a MyErrorHandler instance.
+     * @return a MyErrorHandler instance.
+     */
+    public static MyErrorHandler newInstance() {
+        return new MyErrorHandler();
+    }
+
+    /**
+     * Receive notification of a recoverable error.
+     * @param e a recoverable parser exception error.
+     */
+    @Override
+    public void error(SAXParseException e) {
+        errorOccured = true;
+    }
+
+    /**
+     * Receive notification of a parser warning.
+     * @param e a parser warning  event.
+     */
+    @Override
+    public void warning(SAXParseException e) {
+        errorOccured = true;
+    }
+
+    /**
+     * Report a fatal XML parsing error.
+     * @param e The error information encoded as an exception.
+     */
+    @Override
+    public void fatalError(SAXParseException e) {
+        errorOccured = true;
+    }
+
+    /**
+     * Has any event been received.
+     *
+     * @return true if any event has been received.
+     *         false if no event has been received.
+     */
+    public boolean isErrorOccured() {
+        return errorOccured;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/javax/xml/parsers/ptests/ParserTestConst.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.getPathByClassName;
+
+
+/**
+ * Utility interface which includes final variables of XML, golden file
+ * directories.
+ */
+public class ParserTestConst {
+    /**
+     * XML source file directory.
+     */
+    public static final String XML_DIR = getPathByClassName(ParserTestConst.class,
+            ".." + FILE_SEP + "xmlfiles");
+
+
+    /**
+     * Golden validation files directory.
+     */
+    public static final String GOLDEN_DIR = getPathByClassName(ParserTestConst.class,
+            ".." + FILE_SEP + "xmlfiles" + FILE_SEP + "out");
+}
--- a/jaxp/test/javax/xml/jaxp/libs/javax/xml/transform/ptests/MyContentHandler.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/libs/javax/xml/transform/ptests/MyContentHandler.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jaxp/test/javax/xml/jaxp/libs/javax/xml/transform/ptests/TransformerTestConst.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/libs/javax/xml/transform/ptests/TransformerTestConst.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,40 +23,22 @@
 package javax.xml.transform.ptests;
 
 import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.getPathByClassName;
 
 /**
  * This is the Base test class provide basic support for JAXP functional test
  */
 public class TransformerTestConst {
     /**
-     * Current test directory.
+     * XML source file directory.
      */
-    public static final String CLASS_DIR
-            = System.getProperty("test.classes", ".") + FILE_SEP;
+    public static final String XML_DIR = getPathByClassName(TransformerTestConst.class,
+            ".." + FILE_SEP + "xmlfiles");
 
-    /**
-     * Package name that separates by slash.
-     */
-    public static final String PACKAGE_NAME = FILE_SEP +
-            TransformerTestConst.class.getPackage().getName().replaceAll("[.]", FILE_SEP);
 
     /**
-     * Test base directory. Every package has its own test package directory.
-     */
-    public static final String BASE_DIR
-            = System.getProperty("test.src", USER_DIR).replaceAll("\\" + System.getProperty("file.separator"), "/")
-                + PACKAGE_NAME + FILE_SEP + "..";
-
-    /**
-     * Source XML file directory.
+     * Golden validation files directory.
      */
-    public static final String XML_DIR = BASE_DIR + FILE_SEP + "xmlfiles" + FILE_SEP;
-
-    /**
-     * Golden output file directory. We pre-define all expected output in golden
-     * output file. Test verifies whether the standard output is same as content
-     * of golden file.
-     */
-    public static final String GOLDEN_DIR = XML_DIR + FILE_SEP + "out" + FILE_SEP;
+    public static final String GOLDEN_DIR = getPathByClassName(TransformerTestConst.class,
+            ".." + FILE_SEP + "xmlfiles" + FILE_SEP + "out");
 }
--- a/jaxp/test/javax/xml/jaxp/libs/javax/xml/xpath/ptests/XPathTestConst.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/libs/javax/xml/xpath/ptests/XPathTestConst.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,27 +23,15 @@
 package javax.xml.xpath.ptests;
 
 import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.getPathByClassName;
 
 /**
  * This is the Base test class provide basic support for XPath functional test
  */
 public class XPathTestConst {
     /**
-     * Package name that separates by slash.
-     */
-    public static final String PACKAGE_NAME = FILE_SEP +
-            XPathTestConst.class.getPackage().getName().replaceAll("[.]", FILE_SEP);
-
-    /**
-     * Test base directory. Every package has its own test package directory.
+     * XML source file directory.
      */
-    public static final String BASE_DIR
-            = System.getProperty("test.src", USER_DIR).replaceAll("\\" + System.getProperty("file.separator"), "/")
-                + PACKAGE_NAME + FILE_SEP + "..";
-
-    /**
-     * Source XML file directory.
-     */
-    public static final String XML_DIR = BASE_DIR + FILE_SEP + "xmlfiles" + FILE_SEP;
+    public static final String XML_DIR = getPathByClassName(XPathTestConst.class,
+            ".." + FILE_SEP + "xmlfiles");
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jaxp.library;
+
+import java.security.Permission;
+import java.security.Permissions;
+import java.security.Policy;
+import java.util.PropertyPermission;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+
+/**
+ * This is a base class that every test class must extend if it needs to be run
+ * with security mode.
+ */
+public class JAXPBaseTest {
+    /**
+     * Backing up policy.
+     */
+    protected static Policy policy;
+
+    /**
+     * Backing up security manager.
+     */
+    private static SecurityManager sm;
+
+    /*
+     * Install a SecurityManager along with a base Policy to allow testNG to
+     * run when there is a security manager.
+     */
+    @BeforeClass
+    public void setUpClass() throws Exception {
+        setPolicy(new TestPolicy());
+        System.setSecurityManager(new SecurityManager());
+    }
+
+    /*
+     * Install the original Policy and SecurityManager when there is a security
+     * manager.
+     */
+    @AfterClass
+    public void tearDownClass() throws Exception {
+        System.setSecurityManager(sm);
+        setPolicy(policy);
+    }
+
+    /*
+     * Utility Method used to set the current Policy.
+     */
+    protected static void setPolicy(Policy p) {
+        Policy.setPolicy(p);
+    }
+
+    /*
+     * Add the specified permission(s) to the test policy.
+     * Note there is no way to add permissions to current permissions. Reset
+     * test policy by setting minimal permmisons in addition to specified
+     * permissions when calling this method.
+     */
+    protected static void setPermissions(Permission... ps) {
+        Policy.setPolicy(new TestPolicy(ps));
+    }
+
+    /*
+     * Add the specified permission(s) to the test policy.
+     * Note there is no way to add permissions to current permissions. Reset
+     * test policy by setting minimal permmisons in addition to specified
+     * permissions when calling this method.
+     */
+    protected static void setPermissions(Permissions ps) {
+        Policy.setPolicy(new TestPolicy(ps));
+    }
+
+    /**
+     * Backing up policy and security manager for restore when there is a
+     * security manager.
+     */
+    public JAXPBaseTest() {
+        policy = Policy.getPolicy();
+        sm = System.getSecurityManager();
+    }
+
+    /**
+     * Safety acquire a system property.
+     * Note invocation of this method will restore permission to limited
+     * minimal permission of tests. If there is additional permission set
+     * already, you need restore permission by yourself.
+     * @param propName System property name to be acquired.
+     * @return property value
+     */
+    protected String getSystemProperty(final String propName) {
+        setPermissions(new PropertyPermission(propName, "read"));
+        try {
+            return System.getProperty(propName);
+        } finally {
+            setPermissions();
+        }
+    }
+
+    /**
+     * Safety set a system property by given system value.
+     *
+     * @param propName System property name to be set.
+     * @param propValue System property value to be set.
+     */
+    protected void setSystemProperty(final String propName, final String propValue) {
+        setPermissions(new PropertyPermission(propName, "write"));
+        try {
+            if (propValue == null) {
+                System.clearProperty(propName);
+            } else {
+                System.setProperty(propName, propValue);
+            }
+        } finally {
+            setPermissions();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jaxp.library;
+
+import java.io.FilePermission;
+import java.security.Permission;
+import java.security.Permissions;
+import java.security.Policy;
+import static jaxp.library.JAXPBaseTest.setPolicy;
+import org.testng.annotations.BeforeClass;
+
+/**
+ * This is a base class that every test class that need to access local XML
+ * files must extend if it needs to be run with security mode.
+ */
+public class JAXPFileBaseTest extends JAXPBaseTest {
+    /*
+     * Install a SecurityManager along with a base Policy to allow testNG to
+     * run when there is a security manager.
+     */
+    @BeforeClass
+    @Override
+    public void setUpClass() throws Exception {
+        setPolicy(new FileTestPolicy());
+        System.setSecurityManager(new SecurityManager());
+    }
+
+    /*
+     * Add the specified permission(s) to the test policy.
+     * Note there is no way to add permissions to current permissions. Reset
+     * test policy by setting minimal permmisons in addition to specified
+     * permissions when calling this method.
+     */
+    protected static void setPermissions(Permission... ps) {
+        Policy.setPolicy(new FileTestPolicy(ps));
+    }
+
+    /*
+     * Add the specified permission(s) to the test policy.
+     * Note there is no way to add permissions to current permissions. Reset
+     * test policy by setting minimal permmisons in addition to specified
+     * permissions when calling this method.
+     */
+    protected static void setPermissions(Permissions ps) {
+        Policy.setPolicy(new FileTestPolicy(ps));
+    }
+}
+
+/**
+ * This policy is only given to tests that need access local files. Additional
+ * permissions for accessing local files have been granted by default.
+ * @author HaiboYan
+ */
+class FileTestPolicy extends TestPolicy {
+    /**
+     * Constructor which sets the minimum permissions by default allowing testNG
+     * to work with a SecurityManager.
+     * @param ps permissions to be added.
+     */
+    public FileTestPolicy(Permissions ps) {
+        super(ps);
+    }
+
+    /**
+     * Constructor which sets the minimum permissions by default allowing testNG
+     * to work with a SecurityManager.
+     * @param ps permission array to be added.
+     */
+    public FileTestPolicy(Permission... ps) {
+        super(ps);
+    }
+
+    /**
+     * Defines the minimal permissions required by testNG when running these
+     * tests
+     */
+    @Override
+    protected void setMinimalPermissions() {
+        super.setMinimalPermissions();
+        permissions.add(new FilePermission(System.getProperty("user.dir") + "/-",
+                "read, write"));
+        permissions.add(new FilePermission(System.getProperty("test.src") + "/-",
+                "read"));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileReadOnlyBaseTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jaxp.library;
+
+import java.io.FilePermission;
+import static jaxp.library.JAXPBaseTest.setPermissions;
+import org.testng.annotations.AfterGroups;
+import org.testng.annotations.BeforeGroups;
+
+/**
+ * This is a base class that every test class that need to reading local XML
+ * files must extend if it needs to be run with security mode.
+ */
+public class JAXPFileReadOnlyBaseTest extends JAXPBaseTest {
+    /**
+     * Source files/XML files directory.
+     */
+    private final String SRC_DIR = getSystemProperty("test.src");
+
+    /**
+     * Allowing access local file system for this group.
+     */
+    @BeforeGroups (groups = {"readLocalFiles"})
+    public void setFilePermissions() {
+        setPermissions(new FilePermission(SRC_DIR + "/-", "read"));
+    }
+
+    /**
+     * Restore the system property.
+     */
+    @AfterGroups (groups = {"readLocalFiles"})
+    public void restoreFilePermissions() {
+        setPermissions();
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,21 +23,34 @@
 package jaxp.library;
 
 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.StringWriter;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.nio.charset.UnsupportedCharsetException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
 import static org.testng.Assert.fail;
 import org.w3c.dom.Document;
+import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
 
 /**
@@ -61,14 +74,17 @@
     public static final String FILE_SEP = "/";
 
     /**
-     * User home.
+     * Current test directory.
      */
-    public static final String USER_DIR = System.getProperty("user.dir", ".");
+    public static final String USER_DIR =
+            System.getProperty("user.dir", ".") + FILE_SEP;;
 
     /**
-     * TEMP file directory.
+     * A map storing every test's current test file pointer. File number should
+     * be incremental and it's a thread-safe reading on this file number.
      */
-    public static final String TEMP_DIR = System.getProperty("java.io.tmpdir", ".");
+    private static final ConcurrentHashMap<Class, Integer> currentFileNumber
+                = new ConcurrentHashMap<>();
 
     /**
      * BOM table for storing BOM header.
@@ -94,12 +110,60 @@
      * @return true if two files are identical.
      *         false if two files are not identical.
      * @throws IOException if an I/O error occurs reading from the file or a
-     *         malformed or unmappable byte sequence is read
+     *         malformed or unmappable byte sequence is read.
      */
     public static boolean compareWithGold(String goldfile, String outputfile)
             throws IOException {
+        return compareWithGold(goldfile, outputfile, StandardCharsets.UTF_8);
+    }
+
+    /**
+     * Compare contents of golden file with test output file line by line.
+     * return true if they're identical.
+     * @param goldfile Golden output file name.
+     * @param outputfile Test output file name.
+     * @param cs the charset to use for decoding.
+     * @return true if two files are identical.
+     *         false if two files are not identical.
+     * @throws IOException if an I/O error occurs reading from the file or a
+     *         malformed or unmappable byte sequence is read.
+     */
+    public static boolean compareWithGold(String goldfile, String outputfile,
+             Charset cs) throws IOException {
         return Files.readAllLines(Paths.get(goldfile)).
-                equals(Files.readAllLines(Paths.get(outputfile)));
+                equals(Files.readAllLines(Paths.get(outputfile), cs));
+    }
+
+    /**
+     * Compare contents of golden file with test output list line by line.
+     * return true if they're identical.
+     * @param goldfile Golden output file name.
+     * @param lines test output list.
+     * @return true if file's content is identical to given list.
+     *         false if file's content is not identical to given list.
+     * @throws IOException if an I/O error occurs reading from the file or a
+     *         malformed or unmappable byte sequence is read
+     */
+    public static boolean compareLinesWithGold(String goldfile, List<String> lines)
+            throws IOException {
+        return Files.readAllLines(Paths.get(goldfile)).equals(lines);
+    }
+
+    /**
+     * Compare contents of golden file with a test output string.
+     * return true if they're identical.
+     * @param goldfile Golden output file name.
+     * @param string test string.
+     * @return true if file's content is identical to given string.
+     *         false if file's content is not identical to given string.
+     * @throws IOException if an I/O error occurs reading from the file or a
+     *         malformed or unmappable byte sequence is read
+     */
+    public static boolean compareStringWithGold(String goldfile, String string)
+            throws IOException {
+        return Files.readAllLines(Paths.get(goldfile)).stream().collect(
+                Collectors.joining(System.getProperty("line.separator")))
+                .equals(string);
     }
 
     /**
@@ -132,6 +196,35 @@
         resultD.normalizeDocument();
         return goldD.isEqualNode(resultD);
     }
+
+    /**
+     * Compare contents of golden file with the serialization represent by given
+     * DOM node.
+     * Here we ignore the white space and comments. return true if they're
+     * lexical identical.
+     * @param goldfile Golden output file name.
+     * @param node A DOM node instance.
+     * @return true if file's content is identical to given node's serialization
+     *         represent.
+     *         false if file's content is not identical to given node's
+     *         serialization represent.
+     * @throws TransformerException If an unrecoverable error occurs during the
+     *         course of the transformation..
+     * @throws IOException if an I/O error occurs reading from the file or a
+     *         malformed or unmappable byte sequence is read .
+     */
+    public static boolean compareSerializeDOMWithGold(String goldfile, Node node)
+            throws TransformerException, IOException {
+        TransformerFactory factory = TransformerFactory.newInstance();
+        // Use identity transformer to serialize
+        Transformer identityTransformer = factory.newTransformer();
+        StringWriter sw = new StringWriter();
+        StreamResult streamResult = new StreamResult(sw);
+        DOMSource nodeSource = new DOMSource(node);
+        identityTransformer.transform(nodeSource, streamResult);
+        return compareStringWithGold(goldfile, sw.toString());
+    }
+
     /**
      * Convert stream to ByteArrayInputStream by given character set.
      * @param charset target character set.
@@ -159,6 +252,36 @@
         return new ByteArrayInputStream(bb.array());
     }
 
+   /**
+     * Worker method to detect common absolute URLs.
+     *
+     * @param s String path\filename or URL (or any, really)
+     * @return true if s starts with a common URI scheme (namely
+     * the ones found in the examples of RFC2396); false otherwise
+     */
+    protected static boolean isCommonURL(String s) {
+        if (null == s)
+            return false;
+        return Pattern.compile("^(file:|http:|ftp:|gopher:|mailto:|news:|telnet:)")
+                .matcher(s).matches();
+    }
+
+    /**
+     * Utility method to translate a String filename to URL.
+     *
+     * If the name starts with a common URI scheme (namely the ones
+     * found in the examples of RFC2396), then simply return the
+     * name as-is (the assumption is that it's already a URL).
+     * Otherwise we attempt (cheaply) to convert to a file:/ URL.
+     *
+     * @param filename local path/filename of a file.
+     * @return a file:/ URL if filename represent a file, the same string if
+     *         it appears to already be a URL.
+     */
+    public static String filenameToURL(String filename) {
+        return Paths.get(filename).toUri().toASCIIString();
+    }
+
     /**
      * Prints error message if an exception is thrown
      * @param ex The exception is thrown by test.
@@ -175,4 +298,38 @@
     public static void failCleanup(IOException ex, String name) {
         fail(String.format(ERROR_MSG_CLEANUP, name), ex);
     }
+
+    /**
+     * Retrieve next test output file name. This method is a thread-safe method.
+     * @param clazz test class.
+     * @return next test output file name.
+     */
+    public static String getNextFile(Class clazz) {
+        int nextNumber = currentFileNumber.contains(clazz)
+                ? currentFileNumber.get(clazz) + 1 : 1;
+        Integer i = currentFileNumber.putIfAbsent(clazz, nextNumber);
+        if (i != null && i != nextNumber) {
+            do {
+                nextNumber = currentFileNumber.get(clazz) + 1;
+            } while (currentFileNumber.replace(clazz, nextNumber -1, nextNumber));
+        }
+        return USER_DIR + clazz.getName() + nextNumber + ".out";
+    }
+
+    /**
+     * Acquire a full path string by given class name and relative path string.
+     * @param clazz Class name for the test.
+     * @param relativeDir relative path between java source file and expected
+     *        path.
+     * @return a string represents the full path of accessing path.
+     */
+    public static String getPathByClassName(Class clazz, String relativeDir) {
+        String packageName = FILE_SEP +
+                clazz.getPackage().getName().replaceAll("[.]", FILE_SEP);
+        String javaSourcePath = System.getProperty("test.src").replaceAll("\\" + File.separator, FILE_SEP)
+                + packageName + FILE_SEP;
+        String normalizedPath = Paths.get(javaSourcePath, relativeDir).normalize().
+                toAbsolutePath().toString();
+        return normalizedPath.replace("\\", FILE_SEP) + FILE_SEP;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jaxp.library;
+
+import java.security.AllPermission;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.security.SecurityPermission;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.PropertyPermission;
+import java.util.StringJoiner;
+
+/*
+ * Simple Policy class that supports the required Permissions to validate the
+ * JAXP concrete classes.
+ * Note: permission can only be added. You may want to create a new TestPolicy
+ *       instance if you need remove permissions.
+ */
+public class TestPolicy extends Policy {
+    protected final PermissionCollection permissions = new Permissions();
+
+    /**
+     * Constructor which sets the minimum permissions by default allowing testNG
+     * to work with a SecurityManager.
+     */
+    public TestPolicy() {
+        setMinimalPermissions();
+    }
+
+    /**
+     * Construct an instance with the minimal permissions required by the test
+     * environment and additional permission(s) as specified.
+     * @param ps permissions to be added.
+     */
+    public TestPolicy(Permissions ps) {
+        setMinimalPermissions();
+        TestPolicy.this.addPermissions(ps);
+    }
+
+    /**
+     * Construct an instance with the minimal permissions required by the test
+     * environment and additional permission(s) as specified.
+     * @param ps permission array to be added.
+     */
+    public TestPolicy(Permission... ps) {
+        setMinimalPermissions();
+        addPermissions(ps);
+    }
+
+    /**
+     * Defines the minimal permissions required by testNG when running these
+     * tests
+     */
+    protected void setMinimalPermissions() {
+        permissions.add(new SecurityPermission("getPolicy"));
+        permissions.add(new SecurityPermission("setPolicy"));
+        permissions.add(new RuntimePermission("getClassLoader"));
+        permissions.add(new RuntimePermission("setSecurityManager"));
+        permissions.add(new RuntimePermission("createSecurityManager"));
+        permissions.add(new PropertyPermission("testng.show.stack.frames",
+                "read"));
+        permissions.add(new PropertyPermission("user.dir", "read"));
+        permissions.add(new PropertyPermission("test.src", "read"));
+        permissions.add(new PropertyPermission("file.separator", "read"));
+        permissions.add(new PropertyPermission("line.separator", "read"));
+        permissions.add(new PropertyPermission("fileStringBuffer", "read"));
+        permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
+    }
+
+    /*
+     * Add permissions for your tests.
+     * @param permissions to be added.
+     */
+    private void addPermissions(Permissions ps) {
+        Collections.list(ps.elements()).forEach(p -> permissions.add(p));
+    }
+
+
+    /*
+     * Add permissions for your tests.
+     * @param permissions to be added.
+     */
+    private void addPermissions(Permission[] ps) {
+        Arrays.stream(ps).forEach(p -> permissions.add(p));
+    }
+
+    /**
+     * Set all permissions. Caution: this should not called carefully unless
+     * it's really needed.
+     */
+    private void setAllPermissions() {
+        permissions.add(new AllPermission());
+    }
+
+    /*
+     * Overloaded methods from the Policy class.
+     */
+    @Override
+    public String toString() {
+        StringJoiner sj = new StringJoiner("\n", "policy: ", "");
+        Enumeration<Permission> perms = permissions.elements();
+        while (perms.hasMoreElements()) {
+            sj.add(perms.nextElement().toString());
+        }
+        return sj.toString();
+
+    }
+
+    @Override
+    public PermissionCollection getPermissions(ProtectionDomain domain) {
+        return permissions;
+    }
+
+    @Override
+    public PermissionCollection getPermissions(CodeSource codesource) {
+        return permissions;
+    }
+
+    @Override
+    public boolean implies(ProtectionDomain domain, Permission perm) {
+        return permissions.implies(perm);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/org/xml/sax/ptests/MyAttrCHandler.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.xml.sax.ptests;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Simple attributes handler.
+ */
+public class MyAttrCHandler extends DefaultHandler {
+    /**
+     * FileWriter to write string to output file.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Initiate FileWriter
+     * @param fileName output file name.
+     * @throws IOException
+     */
+    public MyAttrCHandler(String fileName) throws IOException {
+        bWriter = new BufferedWriter(new FileWriter(fileName));
+    }
+
+    /**
+     * Write element content before start access every element.
+     * @throws org.xml.sax.SAXException
+     */
+    @Override
+    public void startElement(String uri, String localName,
+                String qName, Attributes attributes) throws SAXException {
+        try {
+            String string = "uri <" + uri + "> localName <" + localName +
+                        "> qName <" + qName + ">";
+
+            bWriter.write( string, 0, string.length());
+            bWriter.newLine();
+
+            int length = attributes.getLength();
+            string = "length: " + length;
+
+            bWriter.write( string, 0, string.length());
+            bWriter.newLine();
+
+            for (int ind=0; ind < length ; ind++) {
+                string = "For index = " + ind + "\n";
+                string += "getLocalName <" + attributes.getLocalName(ind)
+                                +">" + "\n";
+                string += "getQName <" + attributes.getQName(ind) +">" + "\n";
+                string += "getType <" + attributes.getType(ind) +">" + "\n";
+                string += "getURI <" + attributes.getURI(ind) +">" + "\n";
+                string += "getValue <" + attributes.getValue(ind) +">" + "\n";
+
+                bWriter.write( string, 0, string.length());
+                bWriter.newLine();
+
+                String gotLocalName = attributes.getLocalName(ind);
+                String gotQName = attributes.getQName(ind);
+                String gotURI = attributes.getURI(ind);
+
+                string ="Using localName, qname and uri pertaining to index = "
+                                + ind;
+                bWriter.write( string, 0, string.length());
+                bWriter.newLine();
+
+                string = "getIndex(qName) <" + attributes.getIndex(gotQName)
+                                +">" + "\n";
+                string += "getIndex(uri, localName) <" +
+                        attributes.getIndex(gotURI, gotLocalName) +">" + "\n";
+
+                string += "getType(qName) <" +
+                        attributes.getType(gotQName) +">" + "\n";
+                string += "getType(uri, localName) <" +
+                        attributes.getType(gotURI, gotLocalName) +">" + "\n";
+
+                string += "getValue(qName) <" +
+                        attributes.getValue(gotQName) +">" + "\n";
+                string += "getValue(uri, localName) <" +
+                        attributes.getValue(gotURI, gotLocalName) +">" + "\n";
+
+                bWriter.write( string, 0, string.length());
+                bWriter.newLine();
+            }
+            bWriter.newLine();
+        } catch(IOException ex){
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Flush the stream and close the file.
+     * @throws IOException when writing or closing file failed.
+     */
+    public void flushAndClose() throws IOException {
+        bWriter.flush();
+        bWriter.close();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/org/xml/sax/ptests/MyNSContentHandler.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.xml.sax.ptests;
+
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.LocatorImpl;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.FileWriter;
+import org.xml.sax.SAXException;
+
+class MyNSContentHandler extends DefaultHandler implements AutoCloseable{
+    /**
+     * Prefix for written string.
+     */
+    private final static String WRITE_ERROR = "bWrite error";
+
+    /**
+     * FileWriter to write output file.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Default locator.
+     */
+    Locator locator = new LocatorImpl();
+
+    /**
+     * Initiate FileWrite.
+     * @param outputFileName file name of output file.
+     * @throws SAXException when open output file failed.
+     */
+    public MyNSContentHandler(String outputFileName) throws SAXException {
+        try {
+            bWriter = new BufferedWriter(new FileWriter(outputFileName));
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Write characters tag along with content of characters when meet
+     * characters event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void characters(char[] ch, int start, int length)
+            throws SAXException {
+        String s = new String(ch, start, length);
+        println("characters...length is:" + s.length() + "\n"
+                + "<" + s + ">");
+    }
+
+    /**
+     * Write endDocument tag then flush the content and close the file when meet
+     * endDocument event.
+     * @throws IOException error happen when writing file or closing file.
+     */
+    @Override
+    public void endDocument() throws SAXException {
+        try {
+            println("endDocument...");
+            bWriter.flush();
+            bWriter.close();
+        } catch (IOException ex) {
+            throw new SAXException(WRITE_ERROR, ex);
+        }
+    }
+
+    /**
+     * Write endElement tag with namespaceURI, localName, qName to the file when
+     * meet endElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endElement(String namespaceURI, String localName, String qName)
+            throws SAXException {
+        println("endElement...\n" + "namespaceURI: <" + namespaceURI
+                + "> localName: <" + localName + "> qName: <" + qName + ">");
+    }
+
+    /**
+     * Write endPrefixMapping tag along with prefix to the file when meet
+     * endPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endPrefixMapping(String prefix) throws SAXException {
+        println("endPrefixMapping...\n" + "prefix: <" + prefix + ">");
+    }
+
+    /**
+     * Write ignorableWhitespace tag along with white spaces when meet
+     * ignorableWhitespace event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void ignorableWhitespace(char[] ch, int start, int length)
+            throws SAXException {
+        String s = new String(ch, start, length);
+        println("ignorableWhitespace...\n" + s
+                + " ignorable white space string length: " + s.length());
+    }
+
+    /**
+     * Write processingInstruction tag along with target name and target data
+     * when meet processingInstruction event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void processingInstruction(String target, String data)
+            throws SAXException {
+        println("processingInstruction...target:<" + target
+                + "> data: <" + data + ">");
+    }
+
+    /**
+     * Write setDocumentLocator tag when meet setDocumentLocator event.
+     */
+    @Override
+    public void setDocumentLocator(Locator locator) {
+        try {
+            this.locator = locator;
+            println("setDocumentLocator...");
+        } catch (SAXException ex) {
+            System.err.println(WRITE_ERROR + ex);
+        }
+    }
+
+    /**
+     * Write skippedEntity tag along with entity name when meet skippedEntity
+     * event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void skippedEntity(String name) throws SAXException {
+        println("skippedEntity...\n" + "name: <" + name + ">");
+    }
+
+    /**
+     * Write startDocument tag when meet startDocument event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startDocument() throws SAXException {
+        println("startDocument...");
+    }
+
+    /**
+     * Write startElement tag along with namespaceURI, localName, qName, number
+     * of attributes and line number when meet startElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startElement(String namespaceURI, String localName,
+            String qName, Attributes atts) throws SAXException {
+        println("startElement...\n" + "namespaceURI: <" + namespaceURI
+                + "> localName: <" + localName + "> qName: <" + qName
+                + "> Number of Attributes: <" + atts.getLength()
+                + "> Line# <" + locator.getLineNumber() + ">");
+    }
+
+    /**
+     * Write startPrefixMapping tag along with prefix and uri when meet
+     * startPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startPrefixMapping(String prefix, String uri)
+            throws SAXException {
+        println("startPrefixMapping...\n" + "prefix: <" + prefix
+                + "> uri: <" + uri + ">");
+    }
+    /**
+     * Write outString to output file.
+     * @param outString string to be written.
+     * @throws SAXException
+     */
+    private void println(String outString) throws SAXException {
+        try {
+            bWriter.write( outString, 0, outString.length());
+            bWriter.newLine();
+        } catch (IOException ex) {
+            throw new SAXException(WRITE_ERROR, ex);
+        }
+    }
+
+    /**
+     * Close writer if it's initiated.
+     * @throws IOException if any I/O error when close writer.
+     */
+    @Override
+    public void close() throws IOException {
+        if (bWriter != null)
+            bWriter.close();
+    }
+}
--- a/jaxp/test/javax/xml/jaxp/libs/org/xml/sax/ptests/SAXTestConst.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/libs/org/xml/sax/ptests/SAXTestConst.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 package org.xml.sax.ptests;
 
 import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.getPathByClassName;
 
 /**
  * This is the Base test class provide basic support for JAXP SAX functional
@@ -32,33 +32,15 @@
  */
 public class SAXTestConst {
     /**
-     * Current test directory.
+     * XML source file directory.
      */
-    public static final String CLASS_DIR
-            = System.getProperty("test.classes", ".") + FILE_SEP;
+    public static final String XML_DIR = getPathByClassName(SAXTestConst.class,
+            ".." + FILE_SEP + "xmlfiles");
 
-    /**
-     * Package name that separates by slash.
-     */
-    public static final String PACKAGE_NAME = FILE_SEP +
-            SAXTestConst.class.getPackage().getName().replaceAll("[.]", FILE_SEP);
 
     /**
-     * Test base directory. Every package has its own test package directory.
-     */
-    public static final String BASE_DIR
-            = System.getProperty("test.src", USER_DIR).replaceAll("\\" + System.getProperty("file.separator"), "/")
-                + PACKAGE_NAME + FILE_SEP + "..";
-
-    /**
-     * Source XML file directory.
+     * Golden validation files directory.
      */
-    public static final String XML_DIR = BASE_DIR + FILE_SEP + "xmlfiles" + FILE_SEP;
-
-    /**
-     * Golden output file directory. We pre-define all expected output in golden
-     * output file. Test verifies whether the standard output is same as content
-     * of golden file.
-     */
-    public static final String GOLDEN_DIR = XML_DIR + FILE_SEP + "out" + FILE_SEP;
+    public static final String GOLDEN_DIR = getPathByClassName(SAXTestConst.class,
+            ".." + FILE_SEP + "xmlfiles" + FILE_SEP + "out");
 }
--- a/jaxp/test/javax/xml/jaxp/libs/test/auctionportal/HiBidConstants.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxp/test/javax/xml/jaxp/libs/test/auctionportal/HiBidConstants.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,44 +22,21 @@
  */
 package test.auctionportal;
 
-import static jaxp.library.JAXPTestUtilities.FILE_SEP;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.getPathByClassName;
 
 /**
  * This is the Base test class provide basic support for Auction portal test.
  */
 public class HiBidConstants {
     /**
-     * Current test directory.
+     * XML source file directory.
      */
-    public static final String CLASS_DIR
-            = System.getProperty("test.classes", ".") + FILE_SEP;
-
-    /**
-     * Package name that separates by slash.
-     */
-    public static final String PACKAGE_NAME = FILE_SEP +
-            HiBidConstants.class.getPackage().getName().replaceAll("[.]", FILE_SEP);
-
+    public static final String XML_DIR = getPathByClassName(HiBidConstants.class, "content");
 
     /**
-     * Java source directory.
-     */
-    public static final String SRC_DIR = System.getProperty("test.src", USER_DIR)
-            .replaceAll("\\" + System.getProperty("file.separator"), "/")
-                + PACKAGE_NAME + FILE_SEP;
-
-    /**
-     * Source XML file directory.
+     * Golden validation files directory.
      */
-    public static final String XML_DIR = SRC_DIR + "content" + FILE_SEP;
-
-    /**
-     * Golden output file directory.
-     * We pre-define all expected output in golden output file.  Test verifies
-     * whether the standard output is same as content of golden file.
-     */
-    public static final String GOLDEN_DIR = SRC_DIR + "golden" + FILE_SEP;
+    public static final String GOLDEN_DIR = getPathByClassName(HiBidConstants.class, "golden");
 
     /**
      * Name space for account operation.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/auctionportal/MyDOMErrorHandler.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.auctionportal;
+
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.DOMError;
+
+/**
+ * Error handler for recording DOM processing error.
+ */
+public class MyDOMErrorHandler implements DOMErrorHandler {
+    /**
+     * flag shows if there is any error.
+     */
+    private volatile boolean errorOccured = false;
+
+    /**
+     * Set errorOcurred to true when an error occurs.
+     * @param error The error object that describes the error. This object
+     * may be reused by the DOM implementation across multiple calls to
+     * the handleError method.
+     * @return true that processing may continue depending on.
+     */
+    @Override
+    public boolean handleError (DOMError error) {
+        System.err.println( "ERROR" + error.getMessage());
+        System.err.println( "ERROR" + error.getRelatedData());
+        errorOccured = true;
+        return true;
+    }
+
+    /**
+     * Showing if any error was handled.
+     * @return true if there is one or more error.
+     *         false no error occurs.
+     */
+    public boolean isError() {
+        return errorOccured;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/auctionportal/MyDOMOutput.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.auctionportal;
+
+import org.w3c.dom.ls.LSOutput;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * A Thread-safe LS output destination for DOM processing. LSOutput objects
+ * belong to the application. The DOM implementation will never modify them
+ * (though it may make copies and modify the copies, if necessary).
+ */
+public class MyDOMOutput implements LSOutput {
+    /**
+     * An attribute of a language and binding dependent type that represents a
+     * writable stream of bytes.
+     */
+    private OutputStream bytestream;
+
+    /**
+     * character encoding to use for the output.
+     */
+    private String encoding;
+
+    /**
+     * The system identifier.
+     */
+    private String sysId;
+
+    /**
+     * Writable stream to which 16-bit units can be output.
+     */
+    private Writer writer;
+
+    /**
+     * An attribute of a language and binding dependent type that represents a
+     * writable stream of bytes.
+     *
+     * @return a writable stream.
+     */
+    @Override
+    public OutputStream getByteStream() {
+        return bytestream;
+    }
+
+    /**
+     * An attribute of a language and binding dependent type that represents a
+     * writable stream to which 16-bit units can be output.
+     *
+     * @return writable stream instance.
+     */
+    @Override
+    public Writer getCharacterStream() {
+        return writer;
+    }
+
+    /**
+     * The character encoding to use for the output.
+     *
+     * @return the character encoding.
+     */
+    @Override
+    public String getEncoding() {
+        return encoding;
+    }
+
+    /**
+     * The system identifier for this output destination.
+     *
+     * @return system identifier.
+     */
+    @Override
+    public String getSystemId() {
+        return sysId;
+    }
+
+    /**
+     * Set writable stream of bytes.
+     *
+     * @param bs OutputStream instance
+     */
+    @Override
+    public void setByteStream(OutputStream bs) {
+        bytestream = bs;
+    }
+
+    /**
+     * Set 16 bits unit writable stream.
+     *
+     * @param cs a Writer instance
+     */
+    @Override
+    public void setCharacterStream(Writer cs) {
+        writer = cs;
+    }
+
+    /**
+     * Set character encoding to use for the output.
+     *
+     * @param encoding encoding set to the output
+     */
+    @Override
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
+    /**
+     * Set the system identifier for the output.
+     *
+     * @param sysId system identifier string.
+     */
+    @Override
+    public void setSystemId(String sysId) {
+        this.sysId = sysId;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/auctionportal/MyErrorHandler.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.auctionportal;
+
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * ErrorHandler for error handling. Set state if any method in error, warning
+ * or fatalError was called.
+ */
+public final class MyErrorHandler extends DefaultHandler {
+    /**
+     * Enumeration for ErrorHandler's state.
+     */
+    private enum STATE { ERROR, FATAL, WARNING, NORMAL};
+
+    /**
+     * Set state as normal by default.
+     */
+    private volatile STATE state = STATE.NORMAL;
+
+    /**
+     * Keep exception for further investigation.
+     */
+    private volatile SAXParseException exception;
+
+    /**
+     * Save exception and set state to ERROR.
+     * @param e exception wrap error.
+     */
+    @Override
+    public void error (SAXParseException e) {
+        state = STATE.ERROR;
+        exception = e;
+    }
+
+    /**
+     * Save exception and set state to FATAL.
+     * @param e exception wrap error.
+     */
+    @Override
+    public void fatalError (SAXParseException e) {
+        state = STATE.FATAL;
+        exception = e;
+    }
+
+    /**
+     * Save exception and set state to WARNING.
+     * @param e exception wrap error.
+     */
+    @Override
+    public void warning (SAXParseException e) {
+        state = STATE.WARNING;
+        exception = e;
+    }
+
+    /**
+     * return ErrorHandle's state .
+     * @return true No error, fatalError and warning.
+     *         false there is any error, fatalError or warning in processing.
+     */
+    public boolean isAnyError() {
+        if (state != STATE.NORMAL)
+            System.out.println(exception);
+        return state != STATE.NORMAL;
+    }
+
+    /**
+     * return whether fatalError is the only error.
+     * @return true fatalError is the only error.
+     *         false there is no error, or other error besides fatalError.
+     */
+    public boolean isFatalError() {
+        if (state == STATE.FATAL)
+            System.out.println(exception);
+        return state == STATE.FATAL;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/auctionportal/XInclHandler.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.auctionportal;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.stream.Collectors;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * A SAX2 event handlers.
+ * This SAX2 ContentHandler receives callback event then print whole document
+ * that is parsed.
+ */
+public class XInclHandler extends DefaultHandler implements LexicalHandler {
+    /**
+     * Print writer.
+     */
+    private final PrintWriter fOut;
+
+    /**
+     * Canonical output.
+     */
+    private volatile boolean fCanonical;
+
+    /**
+     * Element depth.
+     */
+    private volatile int fElementDepth;
+
+    /**
+     * Sets whether output is canonical.
+     *
+     * @param canonical if the output is canonical format.
+     */
+    public void setCanonical(boolean canonical) {
+        fCanonical = canonical;
+    }
+
+    /**
+     * Sets the output stream for printing.
+     * @param stream OutputStream for message output.
+     * @param encoding File encoding for message output.
+     * @throws UnsupportedEncodingException if given encoding is an unsupported
+     *         encoding name or invalid encoding name.
+     */
+    public XInclHandler(OutputStream stream, String encoding)
+            throws UnsupportedEncodingException {
+        // At least set one encoding.
+        if (encoding == null) {
+            encoding = "UTF8";
+        }
+
+        fOut = new PrintWriter(new OutputStreamWriter(stream, encoding), false);
+    }
+
+    /**
+     * Receive notification of the beginning of the document. Write the start
+     * document tag if it's not canonical mode.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void startDocument() throws SAXException {
+        fElementDepth = 0;
+
+        if (!fCanonical) {
+            writeFlush("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+        }
+    }
+
+    /**
+     * Receive notification of a processing instruction.
+     * @param target The processing instruction target.
+     * @param data The processing instruction data, or null if
+     *             none is supplied.
+     * @exception SAXException Any SAX exception, possibly wrapping another
+     *            exception.
+     */
+    @Override
+    public void processingInstruction (String target, String data)
+        throws SAXException {
+        if (fElementDepth > 0) {
+            StringBuilder instruction = new StringBuilder("<?").append(target);
+            if (data != null && data.length() > 0) {
+                instruction.append(' ').append(data);
+            }
+            instruction.append("?>");
+            writeFlush(instruction.toString());
+        }
+    }
+
+    /**
+     * Receive notification of the start of an element then write the normalized
+     * output to the file.
+     * @param uri The Namespace URI, or the empty string if the
+     *        element has no Namespace URI or if Namespace
+     *        processing is not being performed.
+     * @param local The local name (without prefix), or the
+     *        empty string if Namespace processing is not being
+     *        performed.
+     * @param raw The qualified name (with prefix), or the
+     *        empty string if qualified names are not available.
+     * @param attrs The attributes attached to the element.  If
+     *        there are no attributes, it shall be an empty
+     *        Attributes object.
+     * @throws SAXException Any SAX exception, possibly wrapping another
+     *         exception.
+     */
+    @Override
+    public void startElement(String uri, String local, String raw,
+            Attributes attrs) throws SAXException {
+        fElementDepth++;
+        StringBuilder start = new StringBuilder().append('<').append(raw);
+        if (attrs != null) {
+            for (int i = 0; i < attrs.getLength(); i++) {
+                start.append(' ').append(attrs.getQName(i)).append("=\"").
+                    append(normalizeAndPrint(attrs.getValue(i))).append('"');
+            }
+        }
+        start.append('>');
+        writeFlush(start.toString());
+    }
+
+    /**
+     * Receive notification of character data inside an element and write
+     * normalized characters to file.
+     * @param ch The characters.
+     * @param start The start position in the character array.
+     * @param length The number of characters to use from the
+     *               character array.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void characters(char ch[], int start, int length)
+            throws SAXException {
+        writeFlush(normalizeAndPrint(ch, start, length));
+    }
+
+    /**
+     * Receiving notification of ignorable whitespace in element content and
+     * writing normalized ignorable characters to file.
+     * @param ch The characters.
+     * @param start The start position in the character array.
+     * @param length The number of characters to use from the
+     *               character array.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void ignorableWhitespace(char ch[], int start, int length)
+            throws SAXException {
+        characters(ch, start, length);
+    }
+
+    /**
+     * Receive notification of the end of an element and print end element.
+     *
+     * @param uri The Namespace URI, or the empty string if the
+     *        element has no Namespace URI or if Namespace
+     *        processing is not being performed.
+     * @param local The local name (without prefix), or the
+     *        empty string if Namespace processing is not being
+     *        performed.
+     * @param raw The qualified name (with prefix), or the
+     *        empty string if qualified names are not available.
+     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void endElement(String uri, String local, String raw)
+            throws SAXException {
+        fElementDepth--;
+        writeFlush("</" + raw + ">");
+    }
+
+    /**
+     * Receive notification of a parser warning and print it out.
+     * @param ex The warning information encoded as an exception.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void warning(SAXParseException ex) throws SAXException {
+        printError("Warning", ex);
+    }
+
+    /**
+     * Receive notification of a parser error and print it out.
+     * @param ex The error information encoded as an exception.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+     */
+    @Override
+    public void error(SAXParseException ex) throws SAXException {
+        printError("Error", ex);
+    }
+
+    /**
+     * Receive notification of a parser fatal error. Throw out fatal error
+     * following print fatal error message.
+     * @param ex The fatal error information encoded as an exception.
+     * @exception org.xml.sax.SAXException Any SAX exception, possibly
+     *            wrapping another exception.
+
+     */
+    @Override
+    public void fatalError(SAXParseException ex) throws SAXException {
+        printError("Fatal Error", ex);
+        throw ex;
+    }
+
+    /**
+     * Do nothing on start DTD.
+     * @param name The document type name.
+     * @param publicId The declared public identifier for the
+     *        external DTD subset, or null if none was declared.
+     * @param systemId The declared system identifier for the
+     *        external DTD subset, or null if none was declared.
+     *        (Note that this is not resolved against the document
+     *        base URI.)
+     * @exception SAXException The application may raise an
+     *            exception.
+     */
+    @Override
+    public void startDTD(String name, String publicId, String systemId)
+        throws SAXException {
+    }
+
+    /**
+     * Do nothing on end DTD.
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void endDTD() throws SAXException {
+    }
+
+    /**
+     * Do nothing on start entity.
+     * @param name The name of the entity.  If it is a parameter
+     *        entity, the name will begin with '%', and if it is the
+     *        external DTD subset, it will be "[dtd]".
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void startEntity(String name) throws SAXException {
+    }
+
+    /**
+     * Do nothing on end entity.
+     * @param name The name of the entity.  If it is a parameter
+     *        entity, the name will begin with '%', and if it is the
+     *        external DTD subset, it will be "[dtd]".
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void endEntity(String name) throws SAXException {
+    }
+
+    /**
+     * Do nothing on start CDATA section.
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void startCDATA() throws SAXException {
+    }
+
+    /**
+     * Do nothing on end CDATA section.
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void endCDATA() throws SAXException {
+    }
+
+    /**
+     * Report an normalized XML comment when receive a comment in the document.
+     *
+     * @param ch An array holding the characters in the comment.
+     * @param start The starting position in the array.
+     * @param length The number of characters to use from the array.
+     * @exception SAXException The application may raise an exception.
+     */
+    @Override
+    public void comment(char ch[], int start, int length) throws SAXException {
+        if (!fCanonical && fElementDepth > 0) {
+            writeFlush("<!--" + normalizeAndPrint(ch, start, length) + "-->");
+        }
+    }
+
+    /**
+     * Normalizes and prints the given string.
+     * @param s String to be normalized
+     */
+    private String normalizeAndPrint(String s) {
+        return s.chars().mapToObj(c -> normalizeAndPrint((char)c)).
+                collect(Collectors.joining());
+    }
+
+    /**
+     * Normalizes and prints the given array of characters.
+     * @param ch The characters to be normalized.
+     * @param start The start position in the character array.
+     * @param length The number of characters to use from the
+     *               character array.
+     */
+    private String normalizeAndPrint(char[] ch, int offset, int length) {
+        return normalizeAndPrint(new String(ch, offset, length));
+    }
+
+    /**
+     * Normalizes given character.
+     * @param c char to be normalized.
+     */
+    private String normalizeAndPrint(char c) {
+        switch (c) {
+            case '<':
+                return "&lt;";
+            case '>':
+                return "&gt;";
+            case '&':
+                return "&amp;";
+            case '"':
+                return "&quot;";
+            case '\r':
+            case '\n':
+                return fCanonical ? "&#" + Integer.toString(c) + ";" : String.valueOf(c);
+            default:
+                return String.valueOf(c);
+        }
+    }
+
+    /**
+     * Prints the error message.
+     * @param type error type
+     * @param ex exception that need to be printed
+     */
+    private void printError(String type, SAXParseException ex) {
+        System.err.print("[" + type + "] ");
+        String systemId = ex.getSystemId();
+        if (systemId != null) {
+            int index = systemId.lastIndexOf('/');
+            if (index != -1)
+                systemId = systemId.substring(index + 1);
+            System.err.print(systemId);
+        }
+        System.err.print(':' + ex.getLineNumber());
+        System.err.print(':' + ex.getColumnNumber());
+        System.err.println(": " + ex.getMessage());
+        System.err.flush();
+    }
+
+    /**
+     * Write out and flush.
+     * @param out string to be written.
+     */
+    private void writeFlush(String out) {
+        fOut.print(out);
+        fOut.flush();
+    }
+}
--- a/jaxws/.hgtags	Thu Jan 15 19:23:48 2015 -0800
+++ b/jaxws/.hgtags	Tue Jan 20 10:22:43 2015 -0800
@@ -291,3 +291,4 @@
 edc13d27dc871be57d7ca77eef77e6d04972fee2 jdk9-b43
 2a03baa4d849818ff6d635f110c2813b12fc2326 jdk9-b44
 e529374fbe526dbd668e5e98fc047b42b3bc6d33 jdk9-b45
+64ca52b0bda8028636e4ccafbe1107befcdda47d jdk9-b46
--- a/jdk/.hgtags	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/.hgtags	Tue Jan 20 10:22:43 2015 -0800
@@ -288,3 +288,4 @@
 8c6ad41974f9ab6c33d544b088648314963f2a50 jdk9-b43
 8cc4dc300041eb70a7a40e4b2431a8f4d4965ea4 jdk9-b44
 9acaa4f57b0b9e3757a7b4576ca9418a75ea8287 jdk9-b45
+efedac7f44ed41cea2b1038138047271f55aacba jdk9-b46
--- a/jdk/src/java.base/share/classes/java/io/BufferedWriter.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/io/BufferedWriter.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,12 +73,6 @@
     private static int defaultCharBufferSize = 8192;
 
     /**
-     * Line separator string.  This is the value of the line.separator
-     * property at the moment that the stream was created.
-     */
-    private String lineSeparator;
-
-    /**
      * Creates a buffered character-output stream that uses a default-sized
      * output buffer.
      *
@@ -105,9 +99,6 @@
         cb = new char[sz];
         nChars = sz;
         nextChar = 0;
-
-        lineSeparator = java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("line.separator"));
     }
 
     /** Checks to make sure that the stream has not been closed */
@@ -240,7 +231,7 @@
      * @exception  IOException  If an I/O error occurs
      */
     public void newLine() throws IOException {
-        write(lineSeparator);
+        write(System.lineSeparator());
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/io/PrintWriter.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/io/PrintWriter.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,12 +69,6 @@
     private PrintStream psOut = null;
 
     /**
-     * Line separator string.  This is the value of the line.separator
-     * property at the moment that the stream was created.
-     */
-    private final String lineSeparator;
-
-    /**
      * Returns a charset object for the given charset name.
      * @throws NullPointerException          is csn is null
      * @throws UnsupportedEncodingException  if the charset is not supported
@@ -113,8 +107,6 @@
         super(out);
         this.out = out;
         this.autoFlush = autoFlush;
-        lineSeparator = java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("line.separator"));
     }
 
     /**
@@ -477,7 +469,7 @@
         try {
             synchronized (lock) {
                 ensureOpen();
-                out.write(lineSeparator);
+                out.write(System.lineSeparator());
                 if (autoFlush)
                     out.flush();
             }
--- a/jdk/src/java.base/share/classes/java/lang/String.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/String.java	Tue Jan 20 10:22:43 2015 -0800
@@ -135,7 +135,7 @@
      * unnecessary since Strings are immutable.
      */
     public String() {
-        this.value = new char[0];
+        this.value = "".value;
     }
 
     /**
@@ -175,7 +175,7 @@
      * not affect the newly created string.
      *
      * @param  value
-     *         Array that is the source of characters
+         *         Array that is the source of characters
      *
      * @param  offset
      *         The initial offset
@@ -191,8 +191,14 @@
         if (offset < 0) {
             throw new StringIndexOutOfBoundsException(offset);
         }
-        if (count < 0) {
-            throw new StringIndexOutOfBoundsException(count);
+        if (count <= 0) {
+            if (count < 0) {
+                throw new StringIndexOutOfBoundsException(count);
+            }
+            if (offset <= value.length) {
+                this.value = "".value;
+                return;
+            }
         }
         // Note: offset or count might be near -1>>>1.
         if (offset > value.length - count) {
@@ -233,8 +239,14 @@
         if (offset < 0) {
             throw new StringIndexOutOfBoundsException(offset);
         }
-        if (count < 0) {
-            throw new StringIndexOutOfBoundsException(count);
+        if (count <= 0) {
+            if (count < 0) {
+                throw new StringIndexOutOfBoundsException(count);
+            }
+            if (offset <= codePoints.length) {
+                this.value = "".value;
+                return;
+            }
         }
         // Note: offset or count might be near -1>>>1.
         if (offset > codePoints.length - count) {
@@ -246,11 +258,11 @@
         // Pass 1: Compute precise size of char[]
         int n = count;
         for (int i = offset; i < end; i++) {
-            int c = codePoints[i];
-            if (Character.isBmpCodePoint(c))
-                continue;
-            else if (Character.isValidCodePoint(c))
-                n++;
+        int c = codePoints[i];
+        if (Character.isBmpCodePoint(c))
+            continue;
+        else if (Character.isValidCodePoint(c))
+            n++;
             else throw new IllegalArgumentException(Integer.toString(c));
         }
 
@@ -783,7 +795,7 @@
      * subarray of {@code dst} starting at index {@code dstBegin}
      * and ending at index:
      * <blockquote><pre>
-     *     dstbegin + (srcEnd-srcBegin) - 1
+     *     dstBegin + (srcEnd-srcBegin) - 1
      * </pre></blockquote>
      *
      * @param      srcBegin   index of the first character in the string
@@ -828,7 +840,7 @@
      * dst} starting at index {@code dstBegin} and ending at index:
      *
      * <blockquote><pre>
-     *     dstbegin + (srcEnd-srcBegin) - 1
+     *     dstBegin + (srcEnd-srcBegin) - 1
      * </pre></blockquote>
      *
      * @deprecated  This method does not properly convert characters into
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Executable.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Executable.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -588,22 +588,29 @@
         return AnnotationParser.toArray(declaredAnnotations());
     }
 
-    private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
+    private transient volatile Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
 
-    private synchronized  Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
-        if (declaredAnnotations == null) {
-            Executable root = getRoot();
-            if (root != null) {
-                declaredAnnotations = root.declaredAnnotations();
-            } else {
-                declaredAnnotations = AnnotationParser.parseAnnotations(
-                    getAnnotationBytes(),
-                    sun.misc.SharedSecrets.getJavaLangAccess().
-                    getConstantPool(getDeclaringClass()),
-                    getDeclaringClass());
+    private Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
+        Map<Class<? extends Annotation>, Annotation> declAnnos;
+        if ((declAnnos = declaredAnnotations) == null) {
+            synchronized (this) {
+                if ((declAnnos = declaredAnnotations) == null) {
+                    Executable root = getRoot();
+                    if (root != null) {
+                        declAnnos = root.declaredAnnotations();
+                    } else {
+                        declAnnos = AnnotationParser.parseAnnotations(
+                                getAnnotationBytes(),
+                                sun.misc.SharedSecrets.getJavaLangAccess().
+                                        getConstantPool(getDeclaringClass()),
+                                getDeclaringClass()
+                        );
+                    }
+                    declaredAnnotations = declAnnos;
+                }
             }
         }
-        return declaredAnnotations;
+        return declAnnos;
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Field.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Field.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1139,21 +1139,28 @@
         return AnnotationParser.toArray(declaredAnnotations());
     }
 
-    private transient Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
+    private transient volatile Map<Class<? extends Annotation>, Annotation> declaredAnnotations;
 
-    private synchronized  Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
-        if (declaredAnnotations == null) {
-            Field root = this.root;
-            if (root != null) {
-                declaredAnnotations = root.declaredAnnotations();
-            } else {
-                declaredAnnotations = AnnotationParser.parseAnnotations(
-                        annotations,
-                        sun.misc.SharedSecrets.getJavaLangAccess().getConstantPool(getDeclaringClass()),
-                        getDeclaringClass());
+    private Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
+        Map<Class<? extends Annotation>, Annotation> declAnnos;
+        if ((declAnnos = declaredAnnotations) == null) {
+            synchronized (this) {
+                if ((declAnnos = declaredAnnotations) == null) {
+                    Field root = this.root;
+                    if (root != null) {
+                        declAnnos = root.declaredAnnotations();
+                    } else {
+                        declAnnos = AnnotationParser.parseAnnotations(
+                                annotations,
+                                sun.misc.SharedSecrets.getJavaLangAccess()
+                                        .getConstantPool(getDeclaringClass()),
+                                getDeclaringClass());
+                    }
+                    declaredAnnotations = declAnnos;
+                }
             }
         }
-        return declaredAnnotations;
+        return declAnnos;
     }
 
     private native byte[] getTypeAnnotationBytes0();
--- a/jdk/src/java.base/share/classes/java/util/stream/Collectors.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/share/classes/java/util/stream/Collectors.java	Tue Jan 20 10:22:43 2015 -0800
@@ -990,7 +990,7 @@
      * function.
      *
      * <p>There are no guarantees on the type, mutability, or serializability
-     * of the {@code Map} or {@code List} objects returned, or of the
+     * of the {@code ConcurrentMap} or {@code List} objects returned, or of the
      * thread-safety of the {@code List} objects returned.
      * @implSpec
      * This produces a result similar to:
@@ -1028,6 +1028,9 @@
      * produces a result of type {@code D}. The resulting collector produces a
      * {@code Map<K, D>}.
      *
+     * <p>There are no guarantees on the type, mutability, or serializability
+     * of the {@code ConcurrentMap} returned.
+     *
      * <p>For example, to compute the set of last names of people in each city,
      * where the city names are sorted:
      * <pre>{@code
@@ -1143,7 +1146,8 @@
      * {@code Map<Boolean, List<T>>}.
      *
      * There are no guarantees on the type, mutability,
-     * serializability, or thread-safety of the {@code Map} returned.
+     * serializability, or thread-safety of the {@code Map} or {@code List}
+     * returned.
      *
      * @param <T> the type of the input elements
      * @param predicate a predicate used for classifying input elements
@@ -1212,6 +1216,9 @@
      * may have duplicates, use {@link #toMap(Function, Function, BinaryOperator)}
      * instead.
      *
+     * <p>There are no guarantees on the type, mutability, serializability,
+     * or thread-safety of the {@code Map} returned.
+     *
      * @apiNote
      * It is common for either the key or the value to be the input elements.
      * In this case, the utility method
@@ -1271,6 +1278,9 @@
      * the value mapping function is applied to each equal element, and the
      * results are merged using the provided merging function.
      *
+     * <p>There are no guarantees on the type, mutability, serializability,
+     * or thread-safety of the {@code Map} returned.
+     *
      * @apiNote
      * There are multiple ways to deal with collisions between multiple elements
      * mapping to the same key.  The other forms of {@code toMap} simply use
@@ -1382,6 +1392,9 @@
      * may have duplicates, use
      * {@link #toConcurrentMap(Function, Function, BinaryOperator)} instead.
      *
+     * <p>There are no guarantees on the type, mutability, or serializability
+     * of the {@code ConcurrentMap} returned.
+     *
      * @apiNote
      * It is common for either the key or the value to be the input elements.
      * In this case, the utility method
@@ -1436,6 +1449,9 @@
      * the value mapping function is applied to each equal element, and the
      * results are merged using the provided merging function.
      *
+     * <p>There are no guarantees on the type, mutability, or serializability
+     * of the {@code ConcurrentMap} returned.
+     *
      * @apiNote
      * There are multiple ways to deal with collisions between multiple elements
      * mapping to the same key.  The other forms of {@code toConcurrentMap} simply use
--- a/jdk/src/java.base/share/classes/sun/security/x509/PolicyConstraintsExtension.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/PolicyConstraintsExtension.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,9 +27,7 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.security.cert.CertificateException;
 import java.util.Enumeration;
-import java.util.Vector;
 
 import sun.security.util.*;
 
@@ -111,7 +109,7 @@
      */
     public PolicyConstraintsExtension(int require, int inhibit)
     throws IOException {
-        this(Boolean.FALSE, require, inhibit);
+        this(Boolean.TRUE, require, inhibit);
     }
 
     /**
@@ -202,7 +200,7 @@
         DerOutputStream tmp = new DerOutputStream();
         if (extensionValue == null) {
           extensionId = PKIXExtensions.PolicyConstraints_Id;
-          critical = false;
+          critical = true;
           encodeThis();
         }
         super.encode(tmp);
--- a/jdk/src/java.base/share/classes/sun/security/x509/PolicyMappingsExtension.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/PolicyMappingsExtension.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,7 +92,7 @@
             throws IOException {
         this.maps = map;
         this.extensionId = PKIXExtensions.PolicyMappings_Id;
-        this.critical = false;
+        this.critical = true;
         encodeThis();
     }
 
@@ -100,8 +100,8 @@
      * Create a default PolicyMappingsExtension.
      */
     public PolicyMappingsExtension() {
-        extensionId = PKIXExtensions.KeyUsage_Id;
-        critical = false;
+        extensionId = PKIXExtensions.PolicyMappings_Id;
+        critical = true;
         maps = new ArrayList<CertificatePolicyMap>();
     }
 
@@ -153,7 +153,7 @@
         DerOutputStream tmp = new DerOutputStream();
         if (extensionValue == null) {
             extensionId = PKIXExtensions.PolicyMappings_Id;
-            critical = false;
+            critical = true;
             encodeThis();
         }
         super.encode(tmp);
--- a/jdk/src/java.base/unix/classes/java/io/FileDescriptor.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/unix/classes/java/io/FileDescriptor.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -214,7 +214,7 @@
         if (!closed) {
             closed = true;
             IOException ioe = null;
-            try (Closeable c = releaser) {
+            try (releaser) {
                 if (otherParents != null) {
                     for (Closeable referent : otherParents) {
                         try {
--- a/jdk/src/java.base/windows/classes/java/io/FileDescriptor.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.base/windows/classes/java/io/FileDescriptor.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -212,7 +212,7 @@
         if (!closed) {
             closed = true;
             IOException ioe = null;
-            try (Closeable c = releaser) {
+            try (releaser) {
                 if (otherParents != null) {
                     for (Closeable referent : otherParents) {
                         try {
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -224,6 +224,7 @@
     String hostname = null;             // host name of server (no brackets
                                         //   for IPv6 literals)
     LdapClient clnt = null;             // connection handle
+    private boolean reconnect = false;  // indicates that re-connect requested
     Hashtable<String, java.lang.Object> envprops = null; // environment properties of context
     int handleReferrals = DEFAULT_REFERRAL_MODE; // how referral is handled
     boolean hasLdapsScheme = false;     // true if the context was created
@@ -2663,6 +2664,7 @@
         }
 
         sharable = false;  // can't share with existing contexts
+        reconnect = true;
         ensureOpen();      // open or reauthenticated
     }
 
@@ -2739,7 +2741,7 @@
         try {
             boolean initial = (clnt == null);
 
-            if (initial) {
+            if (initial || reconnect) {
                 ldapVersion = (ver != null) ? Integer.parseInt(ver) :
                     DEFAULT_LDAP_VERSION;
 
@@ -2767,6 +2769,7 @@
                     // Required for SASL client identity
                     envprops);
 
+                reconnect = false;
 
                 /**
                  * Pooled connections are preauthenticated;
--- a/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStore.java	Tue Jan 20 10:22:43 2015 -0800
@@ -37,12 +37,13 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
 
 import java.security.*;
 import java.security.cert.Certificate;
 import java.security.cert.*;
+import javax.naming.CommunicationException;
+import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
 import javax.security.auth.x500.X500Principal;
 
 import sun.misc.HexDumpEncoder;
@@ -160,7 +161,12 @@
     /**
      * The JNDI directory context.
      */
-    private DirContext ctx;
+    private LdapContext ctx;
+
+    /**
+     * Flag indicating that communication error occurred.
+     */
+    private boolean communicationError = false;
 
     /**
      * Flag indicating whether we should prefetch CRLs.
@@ -218,6 +224,11 @@
         certStoreCache = Cache.newSoftMemoryCache(185);
     static synchronized CertStore getInstance(LDAPCertStoreParameters params)
         throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
+        // if necessary, convert params to SunLDAPCertStoreParameters because
+        // LDAPCertStoreParameters does not override equals() and hashCode()
+        if (! (params instanceof SunLDAPCertStoreParameters)) {
+            params = new SunLDAPCertStoreParameters(params.getServerName(), params.getPort());
+        }
         CertStore lcs = certStoreCache.get(params);
         if (lcs == null) {
             lcs = CertStore.getInstance("LDAP", params);
@@ -256,7 +267,7 @@
         }
 
         try {
-            ctx = new InitialDirContext(env);
+            ctx = new InitialLdapContext(env, null);
             /*
              * By default, follow referrals unless application has
              * overridden property in an application resource file.
@@ -369,8 +380,17 @@
             valueMap = new HashMap<>(8);
             String[] attrIds = requestedAttributes.toArray(STRING0);
             Attributes attrs;
+
+            if (communicationError) {
+                ctx.reconnect(null);
+                communicationError = false;
+            }
+
             try {
                 attrs = ctx.getAttributes(name, attrIds);
+            } catch (CommunicationException ce) {
+                communicationError = true;
+                throw ce;
             } catch (NameNotFoundException e) {
                 // name does not exist on this LDAP server
                 // treat same as not attributes found
@@ -884,7 +904,12 @@
         SunLDAPCertStoreParameters() {
             super();
         }
+        @Override
         public boolean equals(Object obj) {
+            if (obj == null) {
+                return false;
+            }
+
             if (!(obj instanceof LDAPCertStoreParameters)) {
                 return false;
             }
@@ -892,6 +917,7 @@
             return (getPort() == params.getPort() &&
                     getServerName().equalsIgnoreCase(params.getServerName()));
         }
+        @Override
         public int hashCode() {
             if (hashCode == 0) {
                 int result = 17;
--- a/jdk/src/jdk.deploy.osx/macosx/classes/apple/security/KeychainStore.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/src/jdk.deploy.osx/macosx/classes/apple/security/KeychainStore.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -911,6 +911,7 @@
         return true;
     }
 
+    @SuppressWarnings("deprecation")
     private byte[] fetchPrivateKeyFromBag(byte[] privateKeyInfo) throws IOException, NoSuchAlgorithmException, CertificateException
     {
         byte[] returnValue = null;
@@ -971,6 +972,7 @@
         return returnValue;
     }
 
+    @SuppressWarnings("deprecation")
     private byte[] extractKeyData(DerInputStream stream)
         throws IOException, NoSuchAlgorithmException, CertificateException
     {
--- a/jdk/test/ProblemList.txt	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/ProblemList.txt	Tue Jan 20 10:22:43 2015 -0800
@@ -142,9 +142,6 @@
 # 8058492
 java/lang/management/ThreadMXBean/FindDeadlocks.java                                      generic-all
 
-# 8058506
-java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java                              generic-all
-
 ############################################################################
 
 # jdk_jmx
--- a/jdk/test/TEST.groups	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/TEST.groups	Tue Jan 20 10:22:43 2015 -0800
@@ -421,8 +421,7 @@
   java/util/Collections/EmptyIterator.java \
   java/util/concurrent/locks/Lock/TimedAcquireLeak.java \
   java/util/jar/JarInputStream/ExtraFileInMetaInf.java \
-  java/util/logging/AnonLoggerWeakRefLeak.sh \
-  java/util/logging/LoggerWeakRefLeak.sh \
+  java/util/logging/TestLoggerWeakRefLeak.java \
   java/util/zip/3GBZipFiles.sh \
   jdk/lambda/FDTest.java \
   jdk/lambda/separate/Compiler.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Mac/EmptyByteBufferTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.ByteBuffer;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+
+/**
+ * @test
+ * @bug 8048603
+ * @summary Checks if MAC algorithms work fine with empty buffer
+ * @author Alexander Fomin
+ * @build Utils
+ * @run main EmptyByteBufferTest
+ */
+public class EmptyByteBufferTest implements MacTest {
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        Utils.runTests(new EmptyByteBufferTest());
+    }
+
+    @Override
+    public void doTest(String alg) throws NoSuchAlgorithmException,
+            InvalidKeyException, NoSuchProviderException {
+        SecretKey key = Utils.getSecretKeySpec();
+
+        // instantiate Mac object and init it with a SecretKey
+        Mac mac = Mac.getInstance(alg, "SunJCE");
+        mac.init(key);
+
+        // prepare buffer
+        byte[] data = new byte[0];
+        ByteBuffer buf = ByteBuffer.wrap(data);
+
+        mac.update(buf);
+        mac.doFinal();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Mac/LargeByteBufferTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.ByteBuffer;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+
+/**
+ * @test
+ * @bug 8048603
+ * @summary Checks if PBE algorithms work fine with large buffer
+ * @author Alexander Fomin
+ * @build Utils
+ * @run main LargeByteBufferTest
+ */
+public class LargeByteBufferTest implements MacTest {
+
+    private static final int BUFFER_SIZE = 65535;
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        Utils.runTests(new LargeByteBufferTest());
+    }
+
+    @Override
+    public void doTest(String alg) throws NoSuchAlgorithmException,
+            InvalidKeyException, NoSuchProviderException {
+        SecretKey key = Utils.getSecretKeySpec();
+
+        // instantiate Mac object and init it with a SecretKey
+        Mac mac = Mac.getInstance(alg, "SunJCE");
+        mac.init(key);
+
+        // prepare buffer
+        byte[] data = new byte[BUFFER_SIZE];
+        for (int i = 0; i < BUFFER_SIZE; i++) {
+            data[i] = (byte) (i % 256);
+        }
+
+        ByteBuffer buf = ByteBuffer.wrap(data);
+        int limitBefore = buf.limit();
+
+        mac.update(buf);
+        mac.doFinal();
+
+        int limitAfter = buf.limit();
+        int positonAfter = buf.position();
+
+        if (limitAfter != limitBefore) {
+            System.out.println("limit after = " + limitAfter);
+            System.out.println("limit before = " + limitBefore);
+            throw new RuntimeException("Test failed: "
+                    + "limit of buffer has been chenged.");
+        }
+
+        if (positonAfter != limitAfter) {
+            System.out.println("position after = " + positonAfter);
+            System.out.println("limit after = " + limitAfter);
+            throw new RuntimeException("Test failed: "
+                    + "position of buffer isn't equal to its limit");
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Mac/MacSameTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.SecureRandom;
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * @test
+ * @bug 8048603
+ * @summary Check if doFinal and update operation result in same Mac
+ * @author Yu-Ching Valerie Peng, Bill Situ, Alexander Fomin
+ * @build Utils
+ * @run main MacSameTest
+ */
+public class MacSameTest implements MacTest {
+
+    private static final int MESSAGE_SIZE = 25;
+    private static final int OFFSET = 5;
+    private static final int KEY_SIZE = 70;
+
+    /**
+     * Initialize a message, instantiate a Mac object,
+     * initialize the object with a SecretKey,
+     * feed the message into the Mac object
+     * all at once and get the output MAC as result1.
+     * Reset the Mac object, chop the message into three pieces,
+     * feed into the Mac object sequentially, and get the output MAC as result2.
+     * Finally, compare result1 and result2 and see if they are the same.
+     *
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        Utils.runTests(new MacSameTest());
+    }
+
+    @Override
+    public void doTest(String algo) throws NoSuchAlgorithmException,
+            NoSuchProviderException, InvalidKeyException {
+        Mac mac;
+        try {
+            mac = Mac.getInstance(algo, "SunJCE");
+        } catch (NoSuchAlgorithmException nsae) {
+            // depending on Solaris configuration,
+            // it can support HMAC or not with Mac
+            System.out.println("Expected NoSuchAlgorithmException thrown: "
+                    + nsae);
+            return;
+        }
+
+        byte[] plain = new byte[MESSAGE_SIZE];
+        for (int i = 0; i < MESSAGE_SIZE; i++) {
+            plain[i] = (byte) (i % 256);
+        }
+
+        byte[] tail = new byte[plain.length - OFFSET];
+        System.arraycopy(plain, OFFSET, tail, 0, tail.length);
+
+        SecureRandom srdm = new SecureRandom();
+        byte[] keyVal = new byte[KEY_SIZE];
+        srdm.nextBytes(keyVal);
+        SecretKeySpec keySpec = new SecretKeySpec(keyVal, "HMAC");
+
+        mac.init(keySpec);
+        byte[] result1 = mac.doFinal(plain);
+
+        mac.reset();
+        mac.update(plain[0]);
+        mac.update(plain, 1, OFFSET - 1);
+        byte[] result2 = mac.doFinal(tail);
+
+        if (!java.util.Arrays.equals(result1, result2)) {
+            throw new RuntimeException("result1 and result2 are not the same");
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Mac/NullByteBufferTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.ByteBuffer;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+
+/**
+ * @test
+ * @bug 8048603
+ * @summary Checks if PBE algorithms work fine with null buffer
+ * @author Alexander Fomin
+ * @build Utils
+ * @run main NullByteBufferTest
+ */
+public class NullByteBufferTest implements MacTest {
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        Utils.runTests(new NullByteBufferTest());
+    }
+
+    @Override
+    public void doTest(String alg) throws NoSuchAlgorithmException,
+            InvalidKeyException, NoSuchProviderException {
+        SecretKey key = Utils.getSecretKeySpec();
+
+        // instantiate Mac object and init it with a SecretKey
+        Mac mac = Mac.getInstance(alg, "SunJCE");
+        mac.init(key);
+
+        try {
+            ByteBuffer buf = null;
+            mac.update(buf);
+            mac.doFinal();
+            throw new RuntimeException(
+                    "Expected IllegalArgumentException not thrown");
+        } catch (IllegalArgumentException e) {
+            System.out.println("Expected IllegalArgumentException thrown: "
+                    + e);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Mac/Utils.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.SecureRandom;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * Helper class.
+ */
+class Utils {
+
+    static final int KEY_SIZE = 70;
+
+    static final String[] MAC_ALGOS = {"HmacMD5", "HmacSHA1", "HmacSHA224",
+        "HmacSHA256", "HmacSHA384", "HmacSHA512"};
+
+    /**
+     * Get SecretKeySpec.
+     */
+    static SecretKeySpec getSecretKeySpec() {
+        SecureRandom srdm = new SecureRandom();
+        byte[] keyVal = new byte[KEY_SIZE];
+        srdm.nextBytes(keyVal);
+        return new SecretKeySpec(keyVal, "HMAC");
+    }
+
+    static void runTests(MacTest... tests) {
+        boolean success = true;
+        for (MacTest test : tests) {
+            success &= runTest(test);
+        }
+
+        if (success) {
+            System.out.println("Test passed");
+        } else {
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    private static boolean runTest(MacTest test) {
+        boolean success = true;
+        for (String alg : MAC_ALGOS) {
+            try {
+                System.out.println("Test " + alg);
+                test.doTest(alg);
+            } catch (Exception e) {
+                System.out.println("Unexpected exception:");
+                e.printStackTrace();
+                success = false;
+            }
+        }
+
+        return success;
+    }
+}
+
+interface MacTest {
+    void doTest(String alg) throws Exception;
+}
\ No newline at end of file
--- a/jdk/test/java/lang/instrument/IsModifiableClassAgent.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/java/lang/instrument/IsModifiableClassAgent.java	Tue Jan 20 10:22:43 2015 -0800
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @ignore JDK-8068162
  * @bug 6331574
  * @summary test isModifiableClass
  * @author Robert Field, Sun Microsystems
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -30,11 +30,13 @@
  * @build TestMethods
  * @build LambdaFormTestCase
  * @build LFGarbageCollectedTest
- * @run main/othervm LFGarbageCollectedTest
+ * @run main/othervm -Xmx64m -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+HeapDumpOnOutOfMemoryError -DHEAP_DUMP=false LFGarbageCollectedTest
  */
 
 import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodType;
 import java.lang.ref.PhantomReference;
+import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
 import java.lang.reflect.InvocationTargetException;
 import java.util.EnumSet;
@@ -44,6 +46,7 @@
  * Lambda forms garbage collection test class.
  */
 public final class LFGarbageCollectedTest extends LambdaFormTestCase {
+    private static boolean HEAP_DUMP = Boolean.getBoolean("HEAP_DUMP");
 
     /**
      * Constructor for a lambda forms garbage collection test case.
@@ -55,37 +58,86 @@
         super(testMethod);
     }
 
+    PhantomReference ph;
+    ReferenceQueue rq = new ReferenceQueue();
+    MethodType mtype;
+    Map<String, Object> data;
+
     @Override
     public void doTest() {
         try {
-            Map<String, Object> data = getTestMethod().getTestCaseData();
+            TestMethods testCase = getTestMethod();
+            data = testCase.getTestCaseData();
             MethodHandle adapter;
             try {
-                adapter = getTestMethod().getTestCaseMH(data, TestMethods.Kind.ONE);
+                adapter = testCase.getTestCaseMH(data, TestMethods.Kind.ONE);
             } catch (NoSuchMethodException ex) {
                 throw new Error("Unexpected exception: ", ex);
             }
-            Object lambdaForm = LambdaFormTestCase.INTERNAL_FORM.invoke(adapter);
+            mtype = adapter.type();
+            Object lambdaForm = INTERNAL_FORM.invoke(adapter);
             if (lambdaForm == null) {
                 throw new Error("Unexpected error: Lambda form of the method handle is null");
             }
-            ReferenceQueue rq = new ReferenceQueue();
-            PhantomReference ph = new PhantomReference(lambdaForm, rq);
+
+            String debugName = (String)DEBUG_NAME.get(lambdaForm);
+            if (debugName != null && debugName.startsWith("identity_")) {
+                // Ignore identity_* LambdaForms.
+                return;
+            }
+
+            ph = new PhantomReference(lambdaForm, rq);
             lambdaForm = null;
-            data = null;
             adapter = null;
-            for (int i = 0; i < 1000 && !ph.isEnqueued(); i++) {
-                System.gc();
-            }
-            if (!ph.isEnqueued()) {
-                throw new AssertionError("Error: Lambda form is not garbage collected");
-            }
+
+            collectLambdaForm();
         } catch (IllegalAccessException | IllegalArgumentException |
                 InvocationTargetException ex) {
             throw new Error("Unexpected exception: ", ex);
         }
     }
 
+
+    private void collectLambdaForm() throws IllegalAccessException {
+        // Usually, 2 System.GCs are necessary to enqueue a SoftReference.
+        System.gc();
+        System.gc();
+
+        Reference ref = null;
+        for (int i = 0; i < 10; i++) {
+            try {
+                ref = rq.remove(1000);
+            } catch (InterruptedException e) {
+                /* ignore */
+            }
+            if (ref != null) {
+                break;
+            }
+            System.gc(); // If the reference hasn't been queued yet, trigger one more GC.
+        }
+
+        if (ref == null) {
+            dumpTestData();
+            System.err.println("Method type: " + mtype);
+            System.err.println("LambdaForm:  " + REF_FIELD.get(ph));
+
+            if (HEAP_DUMP) {
+                // Trigger OOM to force heap dump for post-mortem analysis.
+                val = new long[1_000_000_000];
+            }
+            throw new AssertionError("Error: LambdaForm is not garbage collected");
+        };
+    }
+
+    private void dumpTestData() {
+        System.err.println("Test case: " + getTestMethod());
+        for (String s : data.keySet()) {
+            System.err.printf("\t%20s => %s\n", s, data.get(s));
+        }
+    }
+
+    private static long[] val;
+
     /**
      * Main routine for lambda forms garbage collection test.
      *
@@ -101,7 +153,9 @@
                 TestMethods.IDENTITY,
                 TestMethods.CONSTANT,
                 TestMethods.ARRAY_ELEMENT_GETTER,
-                TestMethods.ARRAY_ELEMENT_SETTER));
+                TestMethods.ARRAY_ELEMENT_SETTER,
+                TestMethods.EXACT_INVOKER,
+                TestMethods.INVOKER));
         LambdaFormTestCase.runTests(LFGarbageCollectedTest::new, testMethods);
     }
 }
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java	Tue Jan 20 10:22:43 2015 -0800
@@ -23,9 +23,11 @@
 
 import com.oracle.testlibrary.jsr292.Helper;
 import com.sun.management.HotSpotDiagnosticMXBean;
-
+import java.lang.invoke.MethodHandle;
 import java.lang.management.GarbageCollectorMXBean;
 import java.lang.management.ManagementFactory;
+import java.lang.ref.Reference;
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.List;
@@ -42,8 +44,6 @@
  */
 public abstract class LambdaFormTestCase {
 
-    private final static String METHOD_HANDLE_CLASS_NAME = "java.lang.invoke.MethodHandle";
-    private final static String INTERNAL_FORM_METHOD_NAME = "internalForm";
     private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO
             = 45 / (128.0 * 1024 * 1024);
     private static final long TIMEOUT = Helper.IS_THOROUGH ? 0L : (long) (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) * 0.9);
@@ -53,6 +53,8 @@
      * used to get a lambda form from a method handle.
      */
     protected final static Method INTERNAL_FORM;
+    protected final static Field DEBUG_NAME;
+    protected final static Field REF_FIELD;
     private static final List<GarbageCollectorMXBean> gcInfo;
 
     private static long gcCount() {
@@ -61,9 +63,14 @@
 
     static {
         try {
-            Class mhClass = Class.forName(METHOD_HANDLE_CLASS_NAME);
-            INTERNAL_FORM = mhClass.getDeclaredMethod(INTERNAL_FORM_METHOD_NAME);
+            INTERNAL_FORM = MethodHandle.class.getDeclaredMethod("internalForm");
             INTERNAL_FORM.setAccessible(true);
+
+            DEBUG_NAME = Class.forName("java.lang.invoke.LambdaForm").getDeclaredField("debugName");
+            DEBUG_NAME.setAccessible(true);
+
+            REF_FIELD = Reference.class.getDeclaredField("referent");
+            REF_FIELD.setAccessible(true);
         } catch (Exception ex) {
             throw new Error("Unexpected exception: ", ex);
         }
@@ -138,6 +145,10 @@
                             testCase.getTestMethod().name);
                     testCase.doTest();
                     System.err.println("PASSED");
+                } catch (OutOfMemoryError e) {
+                    // Don't swallow OOME so a heap dump can be created.
+                    System.err.println("FAILED");
+                    throw e;
                 } catch (Throwable t) {
                     t.printStackTrace();
                     System.err.printf("FAILED. Caused by %s%n", t.getMessage());
--- a/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
  *
  * @library /lib/testlibrary/
  * @build jdk.testlibrary.* CollectionUsageThreshold MemoryUtil RunUtil
+ * @requires vm.opt.ExplicitGCInvokesConcurrent == "false" | vm.opt.ExplicitGCInvokesConcurrent == "null"
  * @run main/timeout=300 CollectionUsageThreshold
  */
 
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -32,6 +32,7 @@
  *
  * @library /lib/testlibrary/
  * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil
+ * @requires vm.opt.ExplicitGCInvokesConcurrent == "false" | vm.opt.ExplicitGCInvokesConcurrent == "null"
  * @run main/timeout=600 LowMemoryTest
  */
 
--- a/jdk/test/java/net/DatagramSocket/InheritHandle.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/java/net/DatagramSocket/InheritHandle.java	Tue Jan 20 10:22:43 2015 -0800
@@ -22,27 +22,51 @@
  */
 
 /* @test
- * @bug 4945514
+ * @bug 4945514 8042581
  * @summary DatagramSocket should make handle not inherited
  */
 
-import java.net.*;
+import java.net.BindException;
+import java.net.DatagramSocket;
+import java.net.InetSocketAddress;
 
 public class InheritHandle {
+    private static final long SLEEPTIME_MS = 1000L;
+
     public static void main(String[] args) throws Exception {
-        DatagramSocket sock = new DatagramSocket (0);
-        sock.setReuseAddress(true);
-        int port = sock.getLocalPort();
+        int port;
+        try (DatagramSocket sock = new DatagramSocket(0);) {
+            sock.setReuseAddress(true);
+            port = sock.getLocalPort();
+
+            /**
+             * spawn a child to check whether handle passed to it or not; it
+             * shouldn't
+             */
+            Runtime.getRuntime().exec("sleep 10");
+        }
 
-        /**
-         * spawn a child to check whether handle passed to it or not;
-         * it shouldn't
-         */
-        Runtime.getRuntime().exec ("sleep 10");
+        try (DatagramSocket sock = new DatagramSocket(null);) {
+            sock.setReuseAddress(true);
+            int retries = 0;
+            boolean isWindows = System.getProperty("os.name").startsWith("Windows");
+            InetSocketAddress addr = new InetSocketAddress(port);
+            while (true) {
+                try {
+                    sock.bind(addr);
+                    break;
+                } catch (BindException e) {
+                    if (isWindows && retries++ < 5) {
+                        Thread.sleep(SLEEPTIME_MS);
+                        System.out.println("BindException \"" + e.getMessage() + "\", retrying...");
+                        continue;
+                    } else {
+                        throw e;
+                    }
+                }
+            }
 
-        sock.close();
-        sock = new DatagramSocket (null);
-        sock.setReuseAddress(true);
-        sock.bind(new InetSocketAddress(port));
+        }
     }
 }
+
--- a/jdk/test/java/util/logging/AnonLoggerWeakRefLeak.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.util.logging.*;
-
-public class AnonLoggerWeakRefLeak extends SimpleApplication {
-    // The test driver script will allow this program to run until we
-    // reach DEFAULT_LOOP_TIME or a decrease in instance counts is
-    // observed. For this particular WeakReference leak, the count
-    // was always observed to be increasing so if we get a decreasing
-    // count, then the leak is fixed in the bits being tested.
-    // Two minutes has been enough time to observe a decrease in
-    // fixed bits on overloaded systems, but the test will likely
-    // finish more quickly.
-    public static int DEFAULT_LOOP_TIME = 120;  // time is in seconds
-
-    // execute the AnonLoggerWeakRefLeak app work
-    public void doMyAppWork(String[] args) throws Exception {
-        int loop_time = 0;
-        int max_loop_time = DEFAULT_LOOP_TIME;
-
-        // args[0] is the port-file
-        if (args.length < 2) {
-            System.out.println("INFO: using default time of "
-                + max_loop_time + " seconds.");
-        } else {
-            try {
-                max_loop_time = Integer.parseInt(args[1]);
-            } catch (NumberFormatException nfe) {
-                throw new RuntimeException("Error: '" + args[1]
-                    + "': is not a valid seconds value.");
-            }
-        }
-
-        long count = 0;
-        long now = 0;
-        long startTime = System.currentTimeMillis();
-
-        while (now < (startTime + (max_loop_time * 1000))) {
-            if ((count % 1000) == 0) {
-                // Print initial call count to let caller know that
-                // we're up and running and then periodically
-                System.out.println("INFO: call count = " + count);
-            }
-
-            for (int i = 0; i < 100; i++) {
-                // this Logger call is leaking a WeakReference in Logger.kids
-                java.util.logging.Logger.getAnonymousLogger();
-                count++;
-            }
-
-            try {
-                // delay for 1/10 of a second to avoid CPU saturation
-                Thread.sleep(100);
-            } catch (InterruptedException ie) {
-                // ignore any exceptions
-            }
-
-            now = System.currentTimeMillis();
-        }
-
-        System.out.println("INFO: final loop count = " + count);
-    }
-
-    public static void main(String[] args) throws Exception {
-        AnonLoggerWeakRefLeak myApp = new AnonLoggerWeakRefLeak();
-
-        SimpleApplication.setMyApp(myApp);
-
-        SimpleApplication.main(args);
-    }
-}
--- a/jdk/test/java/util/logging/AnonLoggerWeakRefLeak.sh	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,254 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 6942989
-# @summary Check for WeakReference leak in anonymous Logger objects
-# @author Daniel D. Daugherty
-#
-# @library ../../../sun/tools/common
-# @build SimpleApplication ShutdownSimpleApplication
-# @build AnonLoggerWeakRefLeak
-# @run shell/timeout=240 AnonLoggerWeakRefLeak.sh
-
-# The timeout is: 2 minutes for infrastructure and 2 minutes for the test
-#
-
-. ${TESTSRC}/../../../sun/tools/common/CommonSetup.sh
-. ${TESTSRC}/../../../sun/tools/common/ApplicationSetup.sh
-
-
-TEST_NAME="AnonLoggerWeakRefLeak"
-TARGET_CLASS="java\.lang\.ref\.WeakReference"
-
-
-# MAIN begins here
-#
-
-seconds=
-if [ "$#" -gt 0 ]; then
-    seconds="$1"
-fi
-
-# see if this version of jmap supports the '-histo:live' option
-jmap_option="-histo:live"
-set +e
-"${JMAP}" 2>&1 | grep ':live' > /dev/null 2>&1
-status="$?"
-set -e
-if [ "$status" != 0 ]; then
-    # usage message doesn't show ':live' option
-
-    if $isWindows; then
-        # If SA isn't present, then jmap gives a different usage message
-        # that doesn't show the ':live' option. However, that's a bug that
-        # is covered by 6971851 so we try using the option just to be sure.
-        # For some reason, this problem has only been seen on OpenJDK6 on
-        # Windows. Not sure why.
-        set +e
-        # Note: Don't copy this code to try probing process 0 on Linux; it
-        # will kill the process group in strange ways.
-        "${JMAP}" "$jmap_option" 0 2>&1 | grep 'Usage' > /dev/null 2>&1
-        status="$?"
-        set -e
-        if [ "$status" = 0 ]; then
-            # Usage message generated so flag the problem.
-            status=1
-        else
-            # No usage message so clear the flag.
-            status=0
-        fi
-    fi
-
-    if [ "$status" != 0 ]; then
-        echo "WARNING: 'jmap $jmap_option' is not supported on this platform"
-        echo "WARNING: so this test cannot work reliably. Aborting!"
-        exit 0
-    fi
-fi
-
-# Start application and use TEST_NAME.port for coordination
-startApplication "$TEST_NAME" "$TEST_NAME.port" $seconds
-
-finished_early=false
-
-decreasing_cnt=0
-increasing_cnt=0
-loop_cnt=0
-prev_instance_cnt=0
-
-MAX_JMAP_TRY_CNT=10
-jmap_retry_cnt=0
-loop_cnt_on_retry=0
-
-while true; do
-    # see if the target process has finished its run and bail if it has
-    set +e
-    grep "^INFO: final loop count = " "$appOutput" > /dev/null 2>&1
-    status="$?"
-    set -e
-    if [ "$status" = 0 ]; then
-        break
-    fi
-
-    # Output format for 'jmap -histo' in JDK1.5.0:
-    #
-    #     <#bytes> <#instances> <class_name>
-    #
-    # Output format for 'jmap -histo:live':
-    #
-    #     <num>: <#instances> <#bytes> <class_name>
-    #
-    set +e
-    "${JMAP}" "$jmap_option" "$appJavaPid" > "$TEST_NAME.jmap" 2>&1
-    status="$?"
-    set -e
-
-    if [ "$status" != 0 ]; then
-        echo "INFO: jmap exited with exit code = $status"
-
-        # There are intermittent jmap failures; see 6498448.
-        #
-        # So far the following have been observed in a jmap call
-        # that was not in a race with target process termination:
-        #
-        # (Solaris specific, 2nd sample)
-        # <pid>: Unable to open door: target process not responding or HotSpot VM not loaded
-        # The -F option can be used when the target process is not responding
-        #
-        # (on Solaris so far)
-        # java.io.IOException
-        #
-        # (on Solaris so far, 1st sample)
-        # <pid>: Permission denied
-        #
-        sed 's/^/INFO: /' "$TEST_NAME.jmap"
-
-        if [ "$loop_cnt" = "$loop_cnt_on_retry" ]; then
-            # loop count hasn't changed
-            jmap_retry_cnt=`expr $jmap_retry_cnt + 1`
-        else
-            # loop count has changed so remember it
-            jmap_retry_cnt=1
-            loop_cnt_on_retry="$loop_cnt"
-        fi
-
-        # This is '-ge' because we have the original attempt plus
-        # MAX_JMAP_TRY_CNT - 1 retries.
-        if [ "$jmap_retry_cnt" -ge "$MAX_JMAP_TRY_CNT" ]; then
-            echo "INFO: jmap failed $MAX_JMAP_TRY_CNT times in a row" \
-                "without making any progress."
-            echo "FAIL: jmap is unable to take any samples." >&2
-            killApplication
-            exit 2
-        fi
-
-        # short delay and try again
-        # Note: sleep 1 didn't help with "<pid>: Permission denied"
-        sleep 2
-        echo "INFO: retrying jmap (retry=$jmap_retry_cnt, loop=$loop_cnt)."
-        continue
-    fi
-
-    set +e
-    instance_cnt=`grep "${PATTERN_WS}${TARGET_CLASS}${PATTERN_EOL}" \
-        "$TEST_NAME.jmap" \
-        | sed '
-            # strip leading whitespace; does nothing in JDK1.5.0
-            s/^'"${PATTERN_WS}${PATTERN_WS}"'*//
-            # strip <#bytes> in JDK1.5.0; does nothing otherwise
-            s/^[1-9][0-9]*'"${PATTERN_WS}${PATTERN_WS}"'*//
-            # strip <num>: field; does nothing in JDK1.5.0
-            s/^[1-9][0-9]*:'"${PATTERN_WS}${PATTERN_WS}"'*//
-            # strip <class_name> field
-            s/'"${PATTERN_WS}"'.*//
-            '`
-    set -e
-    if [ -z "$instance_cnt" ]; then
-        echo "INFO: instance count is unexpectedly empty"
-        if [ "$loop_cnt" = 0 ]; then
-            echo "INFO: on the first iteration so no sample was found."
-            echo "INFO: There is likely a problem with the sed filter."
-            echo "INFO: start of jmap output:"
-            cat "$TEST_NAME.jmap"
-            echo "INFO: end of jmap output."
-            echo "FAIL: cannot find the instance count value." >&2
-            killApplication
-            exit 2
-        fi
-    else
-        echo "INFO: instance_cnt = $instance_cnt"
-
-        if [ "$instance_cnt" -gt "$prev_instance_cnt" ]; then
-            increasing_cnt=`expr $increasing_cnt + 1`
-        else
-            # actually decreasing or the same
-            decreasing_cnt=`expr $decreasing_cnt + 1`
-
-            # For this particular WeakReference leak, the count was
-            # always observed to be increasing so if we get a decreasing
-            # or the same count, then the leak is fixed in the bits
-            # being tested.
-            echo "INFO: finishing early due to non-increasing instance count."
-            finished_early=true
-            killApplication
-            break
-        fi
-        prev_instance_cnt="$instance_cnt"
-    fi
-
-    # delay between samples
-    sleep 5
-
-    loop_cnt=`expr $loop_cnt + 1`
-done
-
-if [ $finished_early = false ]; then
-    stopApplication "$TEST_NAME.port"
-    waitForApplication
-fi
-
-echo "INFO: $TEST_NAME has finished running."
-echo "INFO: increasing_cnt = $increasing_cnt"
-echo "INFO: decreasing_cnt = $decreasing_cnt"
-if [ "$jmap_retry_cnt" -gt 0 ]; then
-    echo "INFO: jmap_retry_cnt = $jmap_retry_cnt (in $loop_cnt iterations)"
-fi
-
-if [ "$loop_cnt" = 0 ]; then
-    echo "FAIL: jmap is unable to take any samples." >&2
-    exit 2
-fi
-
-echo "INFO: The instance count of" `eval echo $TARGET_CLASS` "objects"
-if [ "$decreasing_cnt" = 0 ]; then
-    echo "INFO: is always increasing."
-    echo "FAIL: This indicates that there is a memory leak." >&2
-    exit 2
-fi
-
-echo "INFO: is not always increasing."
-echo "PASS: This indicates that there is not a memory leak."
-exit 0
--- a/jdk/test/java/util/logging/LoggerWeakRefLeak.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.util.logging.*;
-
-public class LoggerWeakRefLeak extends SimpleApplication {
-    // The test driver script will allow this program to run until we
-    // reach DEFAULT_LOOP_TIME or a decrease in instance counts is
-    // observed. For these particular WeakReference leaks, the count
-    // was always observed to be increasing so if we get a decreasing
-    // count, then the leaks are fixed in the bits being tested.
-    // Two minutes has been enough time to observe a decrease in
-    // fixed bits on overloaded systems, but the test will likely
-    // finish more quickly.
-    public static int DEFAULT_LOOP_TIME = 120;  // time is in seconds
-
-    // execute the LoggerWeakRefLeak app work
-    public void doMyAppWork(String[] args) throws Exception {
-        int loop_time = 0;
-        int max_loop_time = DEFAULT_LOOP_TIME;
-
-        // args[0] is the port-file
-        if (args.length < 2) {
-            System.out.println("INFO: using default time of "
-                + max_loop_time + " seconds.");
-        } else {
-            try {
-                max_loop_time = Integer.parseInt(args[1]);
-            } catch (NumberFormatException nfe) {
-                throw new RuntimeException("Error: '" + args[1]
-                    + "': is not a valid seconds value.");
-            }
-        }
-
-        long count = 0;
-        int  loggerCount = 0;
-        long now = 0;
-        long startTime = System.currentTimeMillis();
-
-        while (now < (startTime + (max_loop_time * 1000))) {
-            if ((count % 1000) == 0) {
-                // Print initial call count to let caller know that
-                // we're up and running and then periodically
-                System.out.println("INFO: call count = " + count);
-            }
-
-            for (int i = 0; i < 100; i++) {
-                // This Logger call is leaking two different WeakReferences:
-                // - one in LogManager.LogNode
-                // - one in Logger.kids
-                java.util.logging.Logger.getLogger("logger-" + loggerCount);
-                count++;
-                if (++loggerCount >= 25000) {
-                    // Limit the Logger namespace used by the test so
-                    // the weak refs in LogManager.loggers that are
-                    // being properly managed don't skew the counts
-                    // by too much.
-                    loggerCount = 0;
-                }
-            }
-
-            try {
-                // delay for 1/10 of a second to avoid CPU saturation
-                Thread.sleep(100);
-            } catch (InterruptedException ie) {
-                // ignore any exceptions
-            }
-
-            now = System.currentTimeMillis();
-        }
-
-        System.out.println("INFO: final loop count = " + count);
-    }
-
-    public static void main(String[] args) throws Exception {
-        AnonLoggerWeakRefLeak myApp = new AnonLoggerWeakRefLeak();
-
-        SimpleApplication.setMyApp(myApp);
-
-        SimpleApplication.main(args);
-    }
-}
--- a/jdk/test/java/util/logging/LoggerWeakRefLeak.sh	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,254 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @bug 6942989
-# @summary Check for WeakReference leak in Logger objects
-# @author Daniel D. Daugherty
-#
-# @library ../../../sun/tools/common
-# @build SimpleApplication ShutdownSimpleApplication
-# @build LoggerWeakRefLeak
-# @run shell/timeout=240 LoggerWeakRefLeak.sh
-
-# The timeout is: 2 minutes for infrastructure and 2 minutes for the test
-#
-
-. ${TESTSRC}/../../../sun/tools/common/CommonSetup.sh
-. ${TESTSRC}/../../../sun/tools/common/ApplicationSetup.sh
-
-
-TEST_NAME="LoggerWeakRefLeak"
-TARGET_CLASS="java\.lang\.ref\.WeakReference"
-
-
-# MAIN begins here
-#
-
-seconds=
-if [ "$#" -gt 0 ]; then
-    seconds="$1"
-fi
-
-# see if this version of jmap supports the '-histo:live' option
-jmap_option="-histo:live"
-set +e
-"${JMAP}" 2>&1 | grep ':live' > /dev/null 2>&1
-status="$?"
-set -e
-if [ "$status" != 0 ]; then
-    # usage message doesn't show ':live' option
-
-    if $isWindows; then
-        # If SA isn't present, then jmap gives a different usage message
-        # that doesn't show the ':live' option. However, that's a bug that
-        # is covered by 6971851 so we try using the option just to be sure.
-        # For some reason, this problem has only been seen on OpenJDK6 on
-        # Windows. Not sure why.
-        set +e
-        # Note: Don't copy this code to try probing process 0 on Linux; it
-        # will kill the process group in strange ways.
-        "${JMAP}" "$jmap_option" 0 2>&1 | grep 'Usage' > /dev/null 2>&1
-        status="$?"
-        set -e
-        if [ "$status" = 0 ]; then
-            # Usage message generated so flag the problem.
-            status=1
-        else
-            # No usage message so clear the flag.
-            status=0
-        fi
-    fi
-
-    if [ "$status" != 0 ]; then
-        echo "WARNING: 'jmap $jmap_option' is not supported on this platform"
-        echo "WARNING: so this test cannot work reliably. Aborting!"
-        exit 0
-    fi
-fi
-
-# Start application and use TEST_NAME.port for coordination
-startApplication "$TEST_NAME" "$TEST_NAME.port" $seconds
-
-finished_early=false
-
-decreasing_cnt=0
-increasing_cnt=0
-loop_cnt=0
-prev_instance_cnt=0
-
-MAX_JMAP_TRY_CNT=10
-jmap_retry_cnt=0
-loop_cnt_on_retry=0
-
-while true; do
-    # see if the target process has finished its run and bail if it has
-    set +e
-    grep "^INFO: final loop count = " "$appOutput" > /dev/null 2>&1
-    status="$?"
-    set -e
-    if [ "$status" = 0 ]; then
-        break
-    fi
-
-    # Output format for 'jmap -histo' in JDK1.5.0:
-    #
-    #     <#bytes> <#instances> <class_name>
-    #
-    # Output format for 'jmap -histo:live':
-    #
-    #     <num>: <#instances> <#bytes> <class_name>
-    #
-    set +e
-    "${JMAP}" "$jmap_option" "$appJavaPid" > "$TEST_NAME.jmap" 2>&1
-    status="$?"
-    set -e
-
-    if [ "$status" != 0 ]; then
-        echo "INFO: jmap exited with exit code = $status"
-
-        # There are intermittent jmap failures; see 6498448.
-        #
-        # So far the following have been observed in a jmap call
-        # that was not in a race with target process termination:
-        #
-        # (Solaris specific, 2nd sample)
-        # <pid>: Unable to open door: target process not responding or HotSpot VM not loaded
-        # The -F option can be used when the target process is not responding
-        #
-        # (on Solaris so far)
-        # java.io.IOException
-        #
-        # (on Solaris so far, 1st sample)
-        # <pid>: Permission denied
-        #
-        sed 's/^/INFO: /' "$TEST_NAME.jmap"
-
-        if [ "$loop_cnt" = "$loop_cnt_on_retry" ]; then
-            # loop count hasn't changed
-            jmap_retry_cnt=`expr $jmap_retry_cnt + 1`
-        else
-            # loop count has changed so remember it
-            jmap_retry_cnt=1
-            loop_cnt_on_retry="$loop_cnt"
-        fi
-
-        # This is '-ge' because we have the original attempt plus
-        # MAX_JMAP_TRY_CNT - 1 retries.
-        if [ "$jmap_retry_cnt" -ge "$MAX_JMAP_TRY_CNT" ]; then
-            echo "INFO: jmap failed $MAX_JMAP_TRY_CNT times in a row" \
-                "without making any progress."
-            echo "FAIL: jmap is unable to take any samples." >&2
-            killApplication
-            exit 2
-        fi
-
-        # short delay and try again
-        # Note: sleep 1 didn't help with "<pid>: Permission denied"
-        sleep 2
-        echo "INFO: retrying jmap (retry=$jmap_retry_cnt, loop=$loop_cnt)."
-        continue
-    fi
-
-    set +e
-    instance_cnt=`grep "${PATTERN_WS}${TARGET_CLASS}${PATTERN_EOL}" \
-        "$TEST_NAME.jmap" \
-        | sed '
-            # strip leading whitespace; does nothing in JDK1.5.0
-            s/^'"${PATTERN_WS}${PATTERN_WS}"'*//
-            # strip <#bytes> in JDK1.5.0; does nothing otherwise
-            s/^[1-9][0-9]*'"${PATTERN_WS}${PATTERN_WS}"'*//
-            # strip <num>: field; does nothing in JDK1.5.0
-            s/^[1-9][0-9]*:'"${PATTERN_WS}${PATTERN_WS}"'*//
-            # strip <class_name> field
-            s/'"${PATTERN_WS}"'.*//
-            '`
-    set -e
-    if [ -z "$instance_cnt" ]; then
-        echo "INFO: instance count is unexpectedly empty"
-        if [ "$loop_cnt" = 0 ]; then
-            echo "INFO: on the first iteration so no sample was found."
-            echo "INFO: There is likely a problem with the sed filter."
-            echo "INFO: start of jmap output:"
-            cat "$TEST_NAME.jmap"
-            echo "INFO: end of jmap output."
-            echo "FAIL: cannot find the instance count value." >&2
-            killApplication
-            exit 2
-        fi
-    else
-        echo "INFO: instance_cnt = $instance_cnt"
-
-        if [ "$instance_cnt" -gt "$prev_instance_cnt" ]; then
-            increasing_cnt=`expr $increasing_cnt + 1`
-        else
-            # actually decreasing or the same
-            decreasing_cnt=`expr $decreasing_cnt + 1`
-
-            # For these particular WeakReference leaks, the count was
-            # always observed to be increasing so if we get a decreasing
-            # or the same count, then the leaks are fixed in the bits
-            # being tested.
-            echo "INFO: finishing early due to non-increasing instance count."
-            finished_early=true
-            killApplication
-            break
-        fi
-        prev_instance_cnt="$instance_cnt"
-    fi
-
-    # delay between samples
-    sleep 5
-
-    loop_cnt=`expr $loop_cnt + 1`
-done
-
-if [ $finished_early = false ]; then
-    stopApplication "$TEST_NAME.port"
-    waitForApplication
-fi
-
-echo "INFO: $TEST_NAME has finished running."
-echo "INFO: increasing_cnt = $increasing_cnt"
-echo "INFO: decreasing_cnt = $decreasing_cnt"
-if [ "$jmap_retry_cnt" -gt 0 ]; then
-    echo "INFO: jmap_retry_cnt = $jmap_retry_cnt (in $loop_cnt iterations)"
-fi
-
-if [ "$loop_cnt" = 0 ]; then
-    echo "FAIL: jmap is unable to take any samples." >&2
-    exit 2
-fi
-
-echo "INFO: The instance count of" `eval echo $TARGET_CLASS` "objects"
-if [ "$decreasing_cnt" = 0 ]; then
-    echo "INFO: is always increasing."
-    echo "FAIL: This indicates that there is a memory leak." >&2
-    exit 2
-fi
-
-echo "INFO: is not always increasing."
-echo "PASS: This indicates that there is not a memory leak."
-exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/TestLoggerWeakRefLeak.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import static jdk.testlibrary.Asserts.assertGreaterThan;
+import jdk.testlibrary.ProcessTools;
+
+import com.sun.tools.attach.AttachNotSupportedException;
+import com.sun.tools.attach.VirtualMachine;
+
+import sun.tools.attach.HotSpotVirtualMachine;
+
+/*
+ * @test
+ * @bug 6942989
+ * @summary Check for WeakReference leak in Logger and anonymous Logger objects
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @run main/othervm TestLoggerWeakRefLeak Logger
+ * @run main/othervm TestLoggerWeakRefLeak AnonymousLogger
+ */
+public class TestLoggerWeakRefLeak {
+
+    private static final String TARGET_CLASS = "java.lang.ref.WeakReference";
+    private static final int INSTANCE_COUNT = 100;
+    private static int loggerCount = 0;
+
+    public static void main(String[] args) throws Exception {
+        if (args[0].equals("AnonymousLogger")) {
+            System.out.println("Test for WeakReference leak in AnonymousLogger object");
+            testIfLeaking(TestLoggerWeakRefLeak::callAnonymousLogger);
+        } else {
+            System.out.println("Test for WeakReference leak in Logger object");
+            testIfLeaking(TestLoggerWeakRefLeak::callLogger);
+        }
+    }
+
+    /**
+     * For these particular WeakReference leaks, the count was always observed
+     * to be increasing so if decreasing or the same count is observed,
+     * then there is no leak.
+     */
+    private static void testIfLeaking(Runnable callLogger) throws Exception {
+        long count = 0;
+        int instanceCount = 0;
+        int previousInstanceCount = 0;
+        int increasingCount = 0;
+        int decreasingCount = 0;
+
+        while (true) {
+            callLogger.run();
+            count += INSTANCE_COUNT;
+
+            if ((count % 1000) == 0) {
+                System.out.println("call count = " + count);
+
+                instanceCount = getInstanceCountFromHeapHisto();
+                if (instanceCount > previousInstanceCount) {
+                    increasingCount++;
+                } else {
+                    decreasingCount++;
+                    System.out.println("increasing count: " + increasingCount);
+                    System.out.println("decreasing or the same count: " + decreasingCount);
+                    System.out.println("Test passed: decreasing or the same instance count is observed");
+                    break;
+                }
+                previousInstanceCount = instanceCount;
+            }
+
+            delayExecution();
+        }
+    }
+
+    /**
+     * This Logger call is leaking two different WeakReferences:
+     * - one in LogManager.LogNode
+     * - one in Logger.kids
+     */
+    private static void callLogger() {
+        for (int i = 0; i < INSTANCE_COUNT; i++) {
+            java.util.logging.Logger.getLogger("logger-" + loggerCount);
+            if (++loggerCount >= 25000) {
+                // Limit the Logger namespace used by the test so the weak refs
+                // in LogManager.loggers that are being properly managed
+                // don't skew the counts by too much.
+                loggerCount = 0;
+            }
+        }
+    }
+
+    /**
+     * This Logger call is leaking a WeakReference in Logger.kids
+     */
+    private static void callAnonymousLogger() {
+        for (int i = 0; i < INSTANCE_COUNT; i++) {
+            java.util.logging.Logger.getAnonymousLogger();
+        }
+    }
+
+    /**
+     * 'vm.heapHisto("-live")' will request a full GC
+     */
+    private static int getInstanceCountFromHeapHisto() throws AttachNotSupportedException, Exception {
+        int instanceCount = 0;
+
+        HotSpotVirtualMachine vm = (HotSpotVirtualMachine) VirtualMachine
+                .attach(Integer.toString(ProcessTools.getProcessId()));
+        try {
+            try (InputStream heapHistoStream = vm.heapHisto("-live");
+                    BufferedReader in = new BufferedReader(new InputStreamReader(heapHistoStream))) {
+                String inputLine;
+                while ((inputLine = in.readLine()) != null) {
+                    if (inputLine.contains(TARGET_CLASS)) {
+                        instanceCount = Integer.parseInt(inputLine
+                                .split("[ ]+")[2]);
+                        System.out.println("instance count: " + instanceCount);
+                        break;
+                    }
+                }
+            }
+        } finally {
+            vm.detach();
+        }
+
+        assertGreaterThan(instanceCount, 0, "No instances of " + TARGET_CLASS + " are found");
+
+        return instanceCount;
+    }
+
+    /**
+     * Delay for 1/10 of a second to avoid CPU saturation
+     */
+    private static void delayExecution() {
+        try {
+            Thread.sleep(100);
+        } catch (InterruptedException ie) {
+            // Ignore any exceptions
+        }
+    }
+
+}
--- a/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
 
 import java.lang.management.ManagementFactory;
 import java.util.concurrent.atomic.AtomicInteger;
-import javax.management.Attribute;
 import javax.management.JMX;
 import javax.management.MBeanServer;
 import javax.management.Notification;
@@ -95,18 +94,16 @@
             monitorProxy.setInitThreshold(100);
             monitorProxy.setGranularityPeriod(10L); // 10 ms
             monitorProxy.setNotify(true);
+
+            final int initGetCount = observedProxy.getGetCount();
             monitorProxy.start();
 
-            final int initGetCount = observedProxy.getGetCount();
-            int getCount;
             System.out.println("Checking GetCount, possible deadlock if timeout.");
             do { // 8038322. Until timeout of testing harness
                 Thread.sleep(200);
-            } while ((getCount=observedProxy.getGetCount()) == initGetCount);
+            } while ((observedProxy.getGetCount()) == initGetCount);
             System.out.println("Done!");
 
-            if (getCount <= initGetCount)
-                throw new Exception("Test failed: presumable deadlock");
             // This won't show up as a deadlock in CTRL-\ or in
             // ThreadMXBean.findDeadlockedThreads(), because they don't
             // see that thread A is waiting for thread B (B.join()), and
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/FilterClassLoader.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.testlibrary;
+
+import java.util.function.Predicate;
+/**
+ * A classloader, which using target classloader in case provided condition
+ * for class name is met, and using parent otherwise
+ */
+public class FilterClassLoader extends ClassLoader {
+
+    private final ClassLoader target;
+    private final Predicate<String> condition;
+
+    public FilterClassLoader(ClassLoader target, ClassLoader parent,
+            Predicate<String> condition) {
+        super(parent);
+        this.condition = condition;
+        this.target = target;
+    }
+
+    @Override
+    public Class<?> loadClass(String name) throws ClassNotFoundException {
+        if (condition.test(name)) {
+            return target.loadClass(name);
+        }
+        return super.loadClass(name);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ParentLastURLClassLoader.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.testlibrary;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+/**
+ * An url classloader, which trying to load class from provided URL[] first,
+ * and using parent classloader in case it failed
+ */
+public class ParentLastURLClassLoader extends URLClassLoader {
+
+    public ParentLastURLClassLoader(URL urls[], ClassLoader parent) {
+        super(urls, parent);
+    }
+
+    @Override
+    public Class<?> loadClass(String name) throws ClassNotFoundException {
+        try {
+            Class c = findClass(name);
+            if (c != null) {
+                return c;
+            }
+        } catch (ClassNotFoundException e) {
+            // ignore
+        }
+        return super.loadClass(name);
+    }
+}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java	Tue Jan 20 10:22:43 2015 -0800
@@ -28,6 +28,15 @@
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
     private static final String vmVersion   = System.getProperty("java.vm.version");
     private static final String osArch      = System.getProperty("os.arch");
+    private static final String vmName      = System.getProperty("java.vm.name");
+
+    public static boolean isClient() {
+        return vmName.endsWith(" Client VM");
+    }
+
+    public static boolean isServer() {
+        return vmName.endsWith(" Server VM");
+    }
 
     public static boolean is32bit() {
         return dataModel.equals("32");
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java	Tue Jan 20 10:22:43 2015 -0800
@@ -39,6 +39,7 @@
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 import java.util.concurrent.TimeUnit;
+import java.util.function.BooleanSupplier;
 
 /**
  * Common library for various test helper functions.
@@ -271,25 +272,6 @@
     }
 
     /**
-     * Returns file content as a list of strings
-     *
-     * @param file File to operate on
-     * @return List of strings
-     * @throws IOException
-     */
-    public static List<String> fileAsList(File file) throws IOException {
-        assertTrue(file.exists() && file.isFile(),
-                file.getAbsolutePath() + " does not exist or not a file");
-        List<String> output = new ArrayList<>();
-        try (BufferedReader reader = new BufferedReader(new FileReader(file.getAbsolutePath()))) {
-            while (reader.ready()) {
-                output.add(reader.readLine().replace(NEW_LINE, ""));
-            }
-        }
-        return output;
-    }
-
-    /**
      * Adjusts the provided timeout value for the TIMEOUT_FACTOR
      * @param tOut the timeout value to be adjusted
      * @return The timeout value adjusted for the value of "test.timeout.factor"
@@ -298,4 +280,50 @@
     public static long adjustTimeout(long tOut) {
         return Math.round(tOut * Utils.TIMEOUT_FACTOR);
     }
+
+    /**
+     * Wait for condition to be true
+     *
+     * @param condition, a condition to wait for
+     */
+    public static final void waitForCondition(BooleanSupplier condition) {
+        waitForCondition(condition, -1L, 100L);
+    }
+
+    /**
+     * Wait until timeout for condition to be true
+     *
+     * @param condition, a condition to wait for
+     * @param timeout a time in milliseconds to wait for condition to be true
+     * specifying -1 will wait forever
+     * @return condition value, to determine if wait was successfull
+     */
+    public static final boolean waitForCondition(BooleanSupplier condition,
+            long timeout) {
+        return waitForCondition(condition, timeout, 100L);
+    }
+
+    /**
+     * Wait until timeout for condition to be true for specified time
+     *
+     * @param condition, a condition to wait for
+     * @param timeout a time in milliseconds to wait for condition to be true,
+     * specifying -1 will wait forever
+     * @param sleepTime a time to sleep value in milliseconds
+     * @return condition value, to determine if wait was successfull
+     */
+    public static final boolean waitForCondition(BooleanSupplier condition,
+            long timeout, long sleepTime) {
+        long startTime = System.currentTimeMillis();
+        while (!(condition.getAsBoolean() || (timeout != -1L
+                && ((System.currentTimeMillis() - startTime) > timeout)))) {
+            try {
+                Thread.sleep(sleepTime);
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                throw new Error(e);
+            }
+        }
+        return condition.getAsBoolean();
+    }
 }
--- a/jdk/test/sun/awt/datatransfer/DataFlavorComparatorTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/sun/awt/datatransfer/DataFlavorComparatorTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -29,13 +29,14 @@
 */
 
 import sun.awt.datatransfer.DataTransferer;
-
+import java.util.Comparator;
+import sun.datatransfer.DataFlavorUtil;
 import java.awt.datatransfer.DataFlavor;
 
 public class DataFlavorComparatorTest {
 
     public static void main(String[] args) {
-        DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator();
+        Comparator<DataFlavor> comparator = DataFlavorUtil.getDataFlavorComparator();
         DataFlavor flavor1 = DataFlavor.imageFlavor;
         DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor;
         if (comparator.compare(flavor1, flavor2) == 0) {
--- a/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java	Tue Jan 20 10:22:43 2015 -0800
@@ -26,20 +26,22 @@
 import static com.sun.tools.classfile.ConstantPool.*;
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.FileVisitResult;
+import java.io.UncheckedIOException;
+import java.net.URI;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
-import java.util.Set;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.FutureTask;
+import java.util.stream.Stream;
 
 /*
  * @test
@@ -52,8 +54,10 @@
 public class CallerSensitiveFinder {
     private static int numThreads = 3;
     private static boolean verbose = false;
+    private final ExecutorService pool;
+
     public static void main(String[] args) throws Exception {
-        List<Path> classes = new ArrayList<>();
+        Stream<Path> classes = null;
         String testclasses = System.getProperty("test.classes", ".");
         int i = 0;
         while (i < args.length) {
@@ -65,25 +69,30 @@
                 if (!p.toFile().exists()) {
                     throw new IllegalArgumentException(arg + " does not exist");
                 }
-                classes.add(p);
+                classes = Stream.of(p);
             }
         }
-        if (classes.isEmpty()) {
-            classes.addAll(PlatformClassPath.getJREClasses());
+
+        if (classes == null) {
+            classes = getPlatformClasses();
         }
-        CallerSensitiveFinder csfinder = new CallerSensitiveFinder();
 
+        CallerSensitiveFinder csfinder = new CallerSensitiveFinder();
         List<String> errors = csfinder.run(classes);
+
         if (!errors.isEmpty()) {
             throw new RuntimeException(errors.size() +
                     " caller-sensitive methods are missing @CallerSensitive annotation");
         }
     }
 
-    private final List<String> csMethodsMissingAnnotation = new ArrayList<>();
+    private final List<String> csMethodsMissingAnnotation =
+            Collections.synchronizedList(new ArrayList<>());
     private final ReferenceFinder finder;
     public CallerSensitiveFinder() {
         this.finder = new ReferenceFinder(getFilter(), getVisitor());
+        pool = Executors.newFixedThreadPool(numThreads);
+
     }
 
     private ReferenceFinder.Filter getFilter() {
@@ -123,11 +132,17 @@
         };
     }
 
-    public List<String> run(List<Path> classes) throws IOException, InterruptedException,
+    public List<String> run(Stream<Path> classes)throws IOException, InterruptedException,
             ExecutionException, ConstantPoolException
     {
-        ExecutorService pool = Executors.newFixedThreadPool(numThreads);
-        for (Path path : classes) {
+        classes.forEach(this::processPath);
+        waitForCompletion();
+        pool.shutdown();
+        return csMethodsMissingAnnotation;
+    }
+
+    void processPath(Path path) {
+        try {
             ClassFileReader reader = ClassFileReader.newInstance(path);
             for (ClassFile cf : reader.getClassFiles()) {
                 String classFileName = cf.getName();
@@ -137,10 +152,11 @@
                 //      - visit and find method references matching the given method name
                 pool.submit(getTask(cf));
             }
+        } catch (IOException x) {
+            throw new UncheckedIOException(x);
+        } catch (ConstantPoolException x) {
+            throw new RuntimeException(x);
         }
-        waitForCompletion();
-        pool.shutdown();
-        return csMethodsMissingAnnotation;
     }
 
     private static final String CALLER_SENSITIVE_ANNOTATION = "Lsun/reflect/CallerSensitive;";
@@ -178,61 +194,34 @@
         for (FutureTask<Void> t : tasks) {
             t.get();
         }
+        if (tasks.isEmpty()) {
+            throw new RuntimeException("No classes found, or specified.");
+        }
         System.out.println("Parsed " + tasks.size() + " classfiles");
     }
 
-    static class PlatformClassPath {
-        static List<Path> getJREClasses() throws IOException {
-            List<Path> result = new ArrayList<Path>();
-            Path home = Paths.get(System.getProperty("java.home"));
-
-            if (home.endsWith("jre")) {
-                // jar files in <javahome>/jre/lib
-                // skip <javahome>/lib
-                result.addAll(addJarFiles(home.resolve("lib")));
-            } else if (home.resolve("lib").toFile().exists()) {
-                // either a JRE or a jdk build image
-                File classes = home.resolve("classes").toFile();
-                if (classes.exists() && classes.isDirectory()) {
-                    // jdk build outputdir
-                    result.add(classes.toPath());
-                }
-                // add other JAR files
-                result.addAll(addJarFiles(home.resolve("lib")));
-            } else {
-                throw new RuntimeException("\"" + home + "\" not a JDK home");
-            }
-            return result;
-        }
+    static Stream<Path> getPlatformClasses() throws IOException {
+        Path home = Paths.get(System.getProperty("java.home"));
 
-        static List<Path> addJarFiles(final Path root) throws IOException {
-            final List<Path> result = new ArrayList<Path>();
-            final Path ext = root.resolve("ext");
-            Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
-                @Override
-                public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
-                        throws IOException {
-                    if (dir.equals(root) || dir.equals(ext)) {
-                        return FileVisitResult.CONTINUE;
-                    } else {
-                        // skip other cobundled JAR files
-                        return FileVisitResult.SKIP_SUBTREE;
-                    }
-                }
+        // Either an exploded build or an image.
+        File classes = home.resolve("modules").toFile();
+        if (classes.isDirectory()) {
+            return Stream.of(classes.toPath());
+        } else {
+            return jrtPaths();
+        }
+    }
 
-                @Override
-                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
-                        throws IOException {
-                    File f = file.toFile();
-                    String fn = f.getName();
-                    // parse alt-rt.jar as well
-                    if (fn.endsWith(".jar") && !fn.equals("jfxrt.jar")) {
-                        result.add(file);
-                    }
-                    return FileVisitResult.CONTINUE;
-                }
-            });
-            return result;
+    static Stream<Path> jrtPaths() {
+        FileSystem jrt = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Path root = jrt.getPath("/");
+
+        try {
+            return Files.walk(root)
+                    .filter(p -> p.getNameCount() > 1)
+                    .filter(p -> p.toString().endsWith(".class"));
+        } catch (IOException x) {
+            throw new UncheckedIOException(x);
         }
     }
 }
--- a/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java	Tue Jan 20 10:22:43 2015 -0800
@@ -34,11 +34,13 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.*;
+import java.util.stream.Stream;
+
 public class MissingCallerSensitive {
     public static void main(String[] args) throws Exception {
         String testclasses = System.getProperty("test.classes", ".");
-        List<Path> classes = new ArrayList<>();
-        classes.add(Paths.get(testclasses, "MissingCallerSensitive.class"));
+
+        Stream<Path> classes = Stream.of(Paths.get(testclasses, "MissingCallerSensitive.class"));
 
         CallerSensitiveFinder csfinder = new CallerSensitiveFinder();
         List<String> errors = csfinder.run(classes);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Mac/MacKAT.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.UnsupportedEncodingException;
+import java.security.Provider;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * @test
+ * @bug 4846410 6313661 4963723
+ * @summary Basic known-answer-test for Hmac algorithms
+ * @author Andreas Sterbenz
+ * @library ..
+ * @run main MacKAT
+ */
+public class MacKAT extends PKCS11Test {
+
+    private final static byte[] ALONG, BLONG, BKEY, BKEY_20, DDDATA_50,
+            AAKEY_20, CDDATA_50, AAKEY_131;
+
+    static {
+        ALONG = new byte[1024 * 128];
+        Arrays.fill(ALONG, (byte)'a');
+        BLONG = new byte[1024 * 128];
+        Random random = new Random(12345678);
+        random.nextBytes(BLONG);
+        BKEY = new byte[128];
+        random.nextBytes(BKEY);
+        BKEY_20 = new byte[20];
+        Arrays.fill(BKEY_20, (byte) 0x0b);
+        DDDATA_50 = new byte[50];
+        Arrays.fill(DDDATA_50, (byte) 0xdd);
+        AAKEY_20 = new byte[20];
+        Arrays.fill(AAKEY_20, (byte) 0xaa);
+        CDDATA_50 = new byte[50];
+        Arrays.fill(CDDATA_50, (byte) 0xcd);
+        AAKEY_131 = new byte[131];
+        Arrays.fill(AAKEY_131, (byte) 0xaa);
+    }
+
+    private final static Test[] tests = {
+        newMacTest("SslMacMD5",
+                ALONG,
+                "f4:ad:01:71:51:f6:89:56:72:a3:32:bf:d9:2a:f2:a5",
+                "1b:34:61:29:05:0d:73:db:25:d0:dd:64:06:29:f6:8a"),
+        newMacTest("SslMacMD5",
+                BLONG,
+                "34:1c:ad:a0:95:57:32:f8:8e:80:8f:ee:b2:d8:23:e5",
+                "76:00:4a:72:98:9b:65:ec:2e:f1:43:c4:65:4a:13:71"),
+        newMacTest("SslMacSHA1",
+                ALONG,
+                "11:c1:71:2e:61:be:4b:cf:bc:6d:e2:4c:58:ae:27:30:0b:24:a4:87",
+                "23:ae:dd:61:87:6c:7a:45:47:2f:2c:8f:ea:64:99:3e:27:5f:97:a5"),
+        newMacTest("SslMacSHA1",
+                BLONG,
+                "84:af:57:0a:af:ef:16:93:90:50:da:88:f8:ad:1a:c5:66:6c:94:d0",
+                "9b:bb:e2:aa:9b:28:1c:95:0e:ea:30:21:98:a5:7e:31:9e:bf:5f:51"),
+        newMacTest("HmacMD5",
+                ALONG,
+                "76:00:4a:72:98:9b:65:ec:2e:f1:43:c4:65:4a:13:71",
+                "1b:34:61:29:05:0d:73:db:25:d0:dd:64:06:29:f6:8a"),
+        newMacTest("HmacMD5",
+                BLONG,
+                "6c:22:79:bb:34:9e:da:f4:f5:cf:df:0c:62:3d:59:e0",
+                "76:00:4a:72:98:9b:65:ec:2e:f1:43:c4:65:4a:13:71"),
+        newMacTest("HmacMD5",
+                BLONG,
+                "e6:ad:00:c9:49:6b:98:fe:53:a2:b9:2d:7d:41:a2:03",
+                BKEY),
+        newMacTest("HmacSHA1",
+                ALONG,
+                "9e:b3:6e:35:fa:fb:17:2e:2b:f3:b0:4a:9d:38:83:c4:5f:6d:d9:00",
+                "1b:34:61:29:05:0d:73:db:25:d0:dd:64:06:29:f6:8a"),
+        newMacTest("HmacSHA1",
+                BLONG,
+                "80:2d:5b:ea:08:df:a4:1f:e5:3e:1c:fa:fc:ad:dd:31:da:15:60:2c",
+                "76:00:4a:72:98:9b:65:ec:2e:f1:43:c4:65:4a:13:71"),
+        newMacTest("HmacSHA1",
+                BLONG,
+                "a2:fa:2a:85:18:0e:94:b2:a5:e2:17:8b:2a:29:7a:95:cd:e8:aa:82",
+                BKEY),
+        newMacTest("HmacSHA256",
+                ALONG,
+                "3f:6d:08:df:0c:90:b0:e9:ed:13:4a:2e:c3:48:1d:3d:3e:61:2e:f1:"
+                        + "30:c2:63:c4:58:57:03:c2:cb:87:15:07",
+                "1b:34:61:29:05:0d:73:db:25:d0:dd:64:06:29:f6:8a"),
+        newMacTest("HmacSHA256",
+                BLONG,
+                "e2:4e:a3:b9:0b:b8:99:e4:71:cf:ca:9f:f8:4e:f0:34:8b:19:9f:33:"
+                        + "4b:1a:b7:13:f7:c8:57:92:e3:03:74:78",
+                BKEY),
+        newMacTest("HmacSHA384",
+                ALONG,
+                "d0:f0:d4:54:1c:0a:6d:81:ed:15:20:d7:0c:96:06:61:a0:ff:c9:ff:"
+                        + "91:e9:a0:cd:e2:45:64:9d:93:4c:a9:fa:89:ae:c0:90:e6:"
+                        + "0b:a1:a0:56:80:57:3b:ed:4b:b0:71",
+                "1b:34:61:29:05:0d:73:db:25:d0:dd:64:06:29:f6:8a"),
+        newMacTest("HmacSHA384",
+                BLONG,
+                "75:c4:ca:c7:f7:58:9d:d3:23:b1:1b:5c:93:2d:ec:7a:03:dc:8c:eb:"
+                        + "8d:fe:79:46:4f:30:e7:99:62:de:44:e2:38:95:0e:79:91:"
+                        + "78:2f:a4:05:0a:f0:17:10:38:a1:8e",
+                BKEY),
+        newMacTest("HmacSHA512",
+                ALONG,
+                "41:ea:4c:e5:31:3f:7c:18:0e:5e:95:a9:25:0a:10:58:e6:40:53:88:"
+                        + "82:4f:5a:da:6f:29:de:04:7b:8e:d7:ed:7c:4d:b8:2a:48:"
+                        + "2d:17:2a:2d:59:bb:81:9c:bf:33:40:04:77:44:fb:45:25:"
+                        + "1f:fd:b9:29:f4:a6:69:a3:43:6f",
+                "1b:34:61:29:05:0d:73:db:25:d0:dd:64:06:29:f6:8a"),
+        newMacTest("HmacSHA512",
+                BLONG,
+                "fb:cf:4b:c6:d5:49:5a:5b:0b:d9:2a:32:f5:fa:68:d2:68:a4:0f:ae:"
+                        + "53:fc:49:12:e6:1d:53:cf:b2:cb:c5:c5:f2:2d:86:bd:14:"
+                        + "61:30:c3:a6:6f:44:1f:77:9b:aa:a1:22:48:a9:dd:d0:45:"
+                        + "86:d1:a1:82:53:13:c4:03:06:a3",
+                BKEY),
+
+        // Test vectors From RFC 4231
+        newMacTest("HmacSHA224",
+                bytes("Hi There"),
+                "89:6f:b1:12:8a:bb:df:19:68:32:10:7c:d4:9d:f3:3f:47:b4:b1:16:"
+                        + "99:12:ba:4f:53:68:4b:22",
+                BKEY_20),
+        newMacTest("HmacSHA224",
+                bytes("what do ya want for nothing?"),
+                "a3:0e:01:09:8b:c6:db:bf:45:69:0f:3a:7e:9e:6d:0f:8b:be:a2:a3:"
+                        + "9e:61:48:00:8f:d0:5e:44",
+                bytes("Jefe")),
+        newMacTest("HmacSHA224",
+                DDDATA_50,
+                "7f:b3:cb:35:88:c6:c1:f6:ff:a9:69:4d:7d:6a:d2:64:93:65:b0:c1:"
+                        + "f6:5d:69:d1:ec:83:33:ea",
+                AAKEY_20),
+        newMacTest("HmacSHA224",
+                CDDATA_50,
+                "6c:11:50:68:74:01:3c:ac:6a:2a:bc:1b:b3:82:62:7c:ec:6a:90:d8:"
+                        + "6e:fc:01:2d:e7:af:ec:5a",
+                "01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f:10:11:12:13:14:"
+                        + "15:16:17:18:19"),
+        newMacTest("HmacSHA224",
+                bytes("Test Using Larger Than Block-Size Key - Hash Key First"),
+                "95:e9:a0:db:96:20:95:ad:ae:be:9b:2d:6f:0d:bc:e2:d4:99:f1:12:"
+                        + "f2:d2:b7:27:3f:a6:87:0e",
+                AAKEY_131),
+        newMacTest("HmacSHA224",
+                bytes("This is a test using a larger than block-size key and "
+                        + "a larger than block-size data. The key needs to be "
+                        + "hashed before being used by the HMAC algorithm."),
+                "3a:85:41:66:ac:5d:9f:02:3f:54:d5:17:d0:b3:9d:bd:94:67:70:db:"
+                        + "9c:2b:95:c9:f6:f5:65:d1",
+                AAKEY_131),
+    };
+
+    public static void main(String[] args) throws Exception {
+        main(new MacKAT());
+    }
+
+    @Override
+    public void main(Provider p) throws Exception {
+        long start = System.currentTimeMillis();
+
+        List<String> algorithms = getSupportedAlgorithms("Mac", "", p);
+        for (Test test : tests) {
+            if(!algorithms.contains(test.getAlg())) {
+                continue;
+            }
+            test.run(p);
+        }
+
+        System.out.println("All tests passed");
+        long stop = System.currentTimeMillis();
+        System.out.println("Done (" + (stop - start) + " ms).");
+    }
+
+    private static byte[] bytes(String s) {
+        try {
+            return s.getBytes("UTF8");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static Test newMacTest(String alg, byte[] input, String macvalue,
+            String key) {
+        return new MacTest(alg, input, parse(macvalue), parse(key));
+    }
+
+    private static Test newMacTest(String alg, byte[] input, String macvalue,
+            byte[] key) {
+        return new MacTest(alg, input, parse(macvalue), key);
+    }
+
+    interface Test {
+        void run(Provider p) throws Exception;
+        String getAlg();
+    }
+
+    static class MacTest implements Test {
+        private final String alg;
+        private final byte[] input;
+        private final byte[] macvalue;
+        private final byte[] key;
+
+        MacTest(String alg, byte[] input, byte[] macvalue, byte[] key) {
+            this.alg = alg;
+            this.input = input;
+            this.macvalue = macvalue;
+            this.key = key;
+        }
+
+        @Override
+        public String getAlg() {
+            return alg;
+        }
+
+        @Override
+        public void run(Provider p) throws Exception {
+            Mac mac = Mac.getInstance(alg, p);
+            SecretKey keySpec = new SecretKeySpec(key, alg);
+            mac.init(keySpec);
+            mac.update(input);
+            byte[] macv = mac.doFinal();
+            if (Arrays.equals(macvalue, macv) == false) {
+                System.out.println("Mac test for " + alg + " failed:");
+                if (input.length < 256) {
+                    System.out.println("input:       "
+                            + PKCS11Test.toString(input));
+                }
+                System.out.println("key:        " + PKCS11Test.toString(key));
+                System.out.println("macvalue:   "
+                        + PKCS11Test.toString(macvalue));
+                System.out.println("calculated: " + PKCS11Test.toString(macv));
+                throw new Exception("Mac test for " + alg + " failed");
+            }
+            System.out.println("passed: " + alg);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Mac/MacSameTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.util.List;
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * @test
+ * @bug 8048603
+ * @summary Check if doFinal and update operation result in same Mac
+ * @author Yu-Ching Valerie Peng, Bill Situ, Alexander Fomin
+ * @library ..
+ * @run main MacSameTest
+ */
+public class MacSameTest extends PKCS11Test {
+
+    private static final int MESSAGE_SIZE = 25;
+    private static final int OFFSET = 5;
+    private static final int KEY_SIZE = 70;
+
+    /**
+     * Initialize a message, instantiate a Mac object,
+     * initialize the object with a SecretKey,
+     * feed the message into the Mac object
+     * all at once and get the output MAC as result1.
+     * Reset the Mac object, chop the message into three pieces,
+     * feed into the Mac object sequentially, and get the output MAC as result2.
+     * Finally, compare result1 and result2 and see if they are the same.
+     *
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) throws Exception {
+        main(new MacSameTest());
+    }
+
+    @Override
+    public void main(Provider p) {
+        List<String> algorithms = getSupportedAlgorithms("Mac", "Hmac", p);
+        boolean success = true;
+        for (String alg : algorithms) {
+            try {
+                doTest(alg, p);
+            } catch (Exception e) {
+                System.out.println("Unexpected exception: " + e);
+                e.printStackTrace();
+                success = false;
+            }
+        }
+
+        if (!success) {
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    private void doTest(String algo, Provider provider)
+            throws NoSuchAlgorithmException, NoSuchProviderException,
+            InvalidKeyException {
+        System.out.println("Test " + algo);
+        Mac mac;
+        try {
+            mac = Mac.getInstance(algo, provider);
+        } catch (NoSuchAlgorithmException nsae) {
+            if ("SunPKCS11-Solaris".equals(provider.getName())) {
+                // depending on Solaris configuration,
+                // it can support HMAC or not with Mac
+                System.out.println("Expected NoSuchAlgorithmException thrown: "
+                        + nsae);
+                return;
+            }
+            throw nsae;
+        }
+
+        byte[] plain = new byte[MESSAGE_SIZE];
+        for (int i = 0; i < MESSAGE_SIZE; i++) {
+            plain[i] = (byte) (i % 256);
+        }
+
+        byte[] tail = new byte[plain.length - OFFSET];
+        System.arraycopy(plain, OFFSET, tail, 0, tail.length);
+
+        SecureRandom srdm = new SecureRandom();
+        byte[] keyVal = new byte[KEY_SIZE];
+        srdm.nextBytes(keyVal);
+        SecretKeySpec keySpec = new SecretKeySpec(keyVal, "HMAC");
+
+        mac.init(keySpec);
+        byte[] result1 = mac.doFinal(plain);
+
+        mac.reset();
+        mac.update(plain[0]);
+        mac.update(plain, 1, OFFSET - 1);
+        byte[] result2 = mac.doFinal(tail);
+
+        if (!java.util.Arrays.equals(result1, result2)) {
+            throw new RuntimeException("result1 and result2 are not the same");
+        }
+    }
+
+}
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java	Tue Jan 20 10:22:43 2015 -0800
@@ -582,4 +582,21 @@
         return r;
     }
 
+    /**
+     * Returns supported algorithms of specified type.
+     */
+    static List<String> getSupportedAlgorithms(String type, String alg,
+            Provider p) {
+        // prepare a list of supported algorithms
+        List<String> algorithms = new ArrayList<>();
+        Set<Provider.Service> services = p.getServices();
+        for (Provider.Service service : services) {
+            if (service.getType().equals(type)
+                    && service.getAlgorithm().startsWith(alg)) {
+                algorithms.add(service.getAlgorithm());
+            }
+        }
+        return algorithms;
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/x509/Extensions/DefaultCriticality.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Change default criticality of policy mappings and policy constraints
+            certificate extensions
+ * @bug 8059916
+ */
+
+import sun.security.x509.PolicyConstraintsExtension;
+import sun.security.x509.PolicyMappingsExtension;
+
+public class DefaultCriticality {
+    public static void main(String [] args) throws Exception {
+        PolicyConstraintsExtension pce = new PolicyConstraintsExtension(-1,-1);
+        if (!pce.isCritical()) {
+            throw new Exception("PolicyConstraintsExtension should be " +
+                                "critical by default");
+        }
+
+        PolicyMappingsExtension pme = new PolicyMappingsExtension();
+        if (!pme.isCritical()) {
+            throw new Exception("PolicyMappingsExtension should be " +
+                                "critical by default");
+        }
+
+        System.out.println("Test passed.");
+    }
+}
--- a/jdk/test/sun/tools/common/CommonTests.sh	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-
-# @test
-# @bug 6964018
-# @summary Unit test for common tools infrastructure.
-#
-# @build SimpleApplication SleeperApplication ShutdownSimpleApplication
-# @run shell CommonTests.sh
-
-. ${TESTSRC}/CommonSetup.sh
-. ${TESTSRC}/ApplicationSetup.sh
-
-# hope for the best:
-status=0
-
-
-# Test program path constants from CommonSetup.sh:
-#
-for name in JAVA JHAT JINFO JMAP JPS JSTACK; do
-    eval value=$`echo $name`
-
-    echo "INFO: $name=$value"
-    if [ -x "$value" ]; then
-        echo "INFO: '$value' is executable."
-    else
-        echo "ERROR: '$value' is not executable." >&2
-        status=1
-    fi
-done
-
-
-# Display flag values from CommonSetup.sh:
-#
-for name in isCygwin isMKS isLinux isSolaris isUnknownOS isWindows; do
-    eval value=$`echo $name`
-    echo "INFO: flag $name=$value"
-done
-
-
-# Test OS constant from CommonSetup.sh:
-#
-if [ -z "$OS" ]; then
-    echo "ERROR: OS constant cannot be empty." >&2
-    status=1
-fi
-
-
-# Display the PATTERN_EOL value:
-#
-echo "INFO: PATTERN_EOL="`echo "$PATTERN_EOL" | od -c`
-
-
-# Test PATTERN_EOL with 'grep' for a regular line.
-#
-TESTOUT="${TESTCLASSES}/testout.grep_reg_line_eol"
-set +e
-echo 'regular line' | grep "line${PATTERN_EOL}" > "$TESTOUT"
-set -e
-if [ -s "$TESTOUT" ]; then
-    echo "INFO: PATTERN_EOL works for regular line with grep."
-else
-    echo "ERROR: PATTERN_EOL does not work for regular line with grep." >&2
-    status=1
-fi
-
-
-if $isWindows; then
-    # Test PATTERN_EOL with 'grep' for a CR line.
-    #
-    TESTOUT="${TESTCLASSES}/testout.grep_cr_line_eol"
-    set +e
-    echo 'CR line
' | grep "line${PATTERN_EOL}" > "$TESTOUT"
-    set -e
-    if [ -s "$TESTOUT" ]; then
-        echo "INFO: PATTERN_EOL works for CR line with grep."
-    else
-        echo "ERROR: PATTERN_EOL does not work for CR line with grep." >&2
-        status=1
-    fi
-fi
-
-
-# Test PATTERN_EOL with 'sed' for a regular line.
-#
-TESTOUT="${TESTCLASSES}/testout.sed_reg_line_eol"
-echo 'regular line' | sed -n "/line${PATTERN_EOL}/p" > "$TESTOUT"
-if [ -s "$TESTOUT" ]; then
-    echo "INFO: PATTERN_EOL works for regular line with sed."
-else
-    echo "ERROR: PATTERN_EOL does not work for regular line with sed." >&2
-    status=1
-fi
-
-
-if $isWindows; then
-    # Test PATTERN_EOL with 'sed' for a CR line.
-    #
-    TESTOUT="${TESTCLASSES}/testout.sed_cr_line_eol"
-    echo 'CR line
' | sed -n "/line${PATTERN_EOL}/p" > "$TESTOUT"
-    if [ -s "$TESTOUT" ]; then
-        echo "INFO: PATTERN_EOL works for CR line with sed."
-    else
-        echo "ERROR: PATTERN_EOL does not work for CR line with sed." >&2
-        status=1
-    fi
-fi
-
-
-# Display the PATTERN_WS value:
-#
-echo "INFO: PATTERN_WS="`echo "$PATTERN_WS" | od -c`
-
-
-# Test PATTERN_WS with 'grep' for a blank.
-#
-TESTOUT="${TESTCLASSES}/testout.grep_blank"
-set +e
-echo 'blank: ' | grep "$PATTERN_WS" > "$TESTOUT"
-set -e
-if [ -s "$TESTOUT" ]; then
-    echo "INFO: PATTERN_WS works for blanks with grep."
-else
-    echo "ERROR: PATTERN_WS does not work for blanks with grep." >&2
-    status=1
-fi
-
-
-# Test PATTERN_WS with 'grep' for a tab.
-#
-TESTOUT="${TESTCLASSES}/testout.grep_tab"
-set +e
-echo 'tab:	' | grep "$PATTERN_WS" > "$TESTOUT"
-set -e
-if [ -s "$TESTOUT" ]; then
-    echo "INFO: PATTERN_WS works for tabs with grep."
-else
-    echo "ERROR: PATTERN_WS does not work for tabs with grep." >&2
-    status=1
-fi
-
-
-# Test PATTERN_WS with 'sed' for a blank.
-#
-TESTOUT="${TESTCLASSES}/testout.sed_blank"
-echo 'blank: ' | sed -n "/$PATTERN_WS/p" > "$TESTOUT"
-if [ -s "$TESTOUT" ]; then
-    echo "INFO: PATTERN_WS works for blanks with sed."
-else
-    echo "ERROR: PATTERN_WS does not work for blanks with sed." >&2
-    status=1
-fi
-
-
-# Test PATTERN_WS with 'sed' for a tab.
-#
-TESTOUT="${TESTCLASSES}/testout.sed_tab"
-echo 'tab:	' | sed -n "/$PATTERN_WS/p" > "$TESTOUT"
-if [ -s "$TESTOUT" ]; then
-    echo "INFO: PATTERN_WS works for tabs with sed."
-else
-    echo "ERROR: PATTERN_WS does not work for tabs with sed." >&2
-    status=1
-fi
-
-
-# Test startApplication and use PORTFILE for coordination
-# The app sleeps for 30 seconds.
-#
-PORTFILE="${TESTCLASSES}"/shutdown.port
-startApplication SleeperApplication "${PORTFILE}" 30
-
-
-# Test appJavaPid in "ps" cmd output.
-#
-TESTOUT="${TESTCLASSES}/testout.ps_app"
-set +e
-if $isCygwin; then
-    # On Cygwin, appJavaPid is the Windows pid for the Java process
-    # and appOtherPid is the Cygwin pid for the Java process.
-    ps -p "$appOtherPid" \
-        | grep "${PATTERN_WS}${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
-else
-    # output only pid and comm columns to avoid mismatches
-    ps -eo pid,comm \
-        | grep "^${PATTERN_WS}*${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
-fi
-set -e
-if [ -s "$TESTOUT" ]; then
-    echo "INFO: begin appJavaPid=$appJavaPid in 'ps' cmd output:"
-    cat "$TESTOUT"
-    echo "INFO: end appJavaPid=$appJavaPid in 'ps' cmd output."
-else
-    echo "ERROR: 'ps' cmd should show appJavaPid=$appJavaPid." >&2
-    status=1
-fi
-
-if [ -n "$appOtherPid" ]; then
-    # Test appOtherPid in "ps" cmd output, if we have one.
-    #
-    TESTOUT="${TESTCLASSES}/testout.ps_other"
-    set +e
-    if $isCygwin; then
-        ps -p "$appOtherPid" \
-            | grep "${PATTERN_WS}${appOtherPid}${PATTERN_WS}" > "$TESTOUT"
-    else
-        # output only pid and comm columns to avoid mismatches
-        ps -eo pid,comm \
-            | grep "^${PATTERN_WS}*${appOtherPid}${PATTERN_WS}" > "$TESTOUT"
-    fi
-    set -e
-    if [ -s "$TESTOUT" ]; then
-        echo "INFO: begin appOtherPid=$appOtherPid in 'ps' cmd output:"
-        cat "$TESTOUT"
-        echo "INFO: end appOtherPid=$appOtherPid in 'ps' cmd output."
-    else
-        echo "ERROR: 'ps' cmd should show appOtherPid=$appOtherPid." >&2
-        status=1
-    fi
-fi
-
-
-# Test stopApplication and PORTFILE for coordination
-#
-stopApplication "${PORTFILE}"
-
-
-# Test application still running after stopApplication.
-#
-# stopApplication just lets the app know that it can stop, but the
-# app might still be doing work. This test just demonstrates that
-# fact and doesn't fail if the app is already done.
-#
-TESTOUT="${TESTCLASSES}/testout.after_stop"
-set +e
-if $isCygwin; then
-    # On Cygwin, appJavaPid is the Windows pid for the Java process
-    # and appOtherPid is the Cygwin pid for the Java process.
-    ps -p "$appOtherPid" \
-        | grep "${PATTERN_WS}${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
-else
-    # output only pid and comm columns to avoid mismatches
-    ps -eo pid,comm \
-        | grep "^${PATTERN_WS}*${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
-fi
-set -e
-if [ -s "$TESTOUT" ]; then
-    echo "INFO: it is okay for appJavaPid=$appJavaPid to still be running" \
-        "after stopApplication() is called."
-    echo "INFO: begin 'after_stop' output:"
-    cat "$TESTOUT"
-    echo "INFO: end 'after_stop' output."
-fi
-
-
-# Test waitForApplication
-#
-# The app might already be gone so this function shouldn't generate
-# a fatal error in either call.
-#
-waitForApplication
-
-if [ $isWindows = false ]; then
-    # Windows can recycle pids quickly so we can't use this test there
-    TESTOUT="${TESTCLASSES}/testout.after_kill"
-    set +e
-    # output only pid and comm columns to avoid mismatches
-    ps -eo pid,comm \
-        | grep "^${PATTERN_WS}*${appJavaPid}${PATTERN_WS}" > "$TESTOUT"
-    set -e
-    if [ -s "$TESTOUT" ]; then
-        echo "ERROR: 'ps' cmd should not show appJavaPid." >&2
-        echo "ERROR: begin 'after_kill' output:" >&2
-        cat "$TESTOUT" >&2
-        echo "ERROR: end 'after_kill' output." >&2
-        status=1
-    else
-        echo "INFO: 'ps' cmd does not show appJavaPid after" \
-            "waitForApplication() is called."
-    fi
-fi
-
-
-# Test killApplication
-#
-# The app is already be gone so this function shouldn't generate
-# a fatal error.
-#
-killApplication
-
-exit $status
--- a/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/sun/tools/jcmd/TestJcmdDefaults.java	Tue Jan 20 10:22:43 2015 -0800
@@ -25,6 +25,9 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.List;
 
 import jdk.testlibrary.JcmdBase;
@@ -95,11 +98,11 @@
     }
 
     private static void verifyOutputAgainstFile(OutputAnalyzer output) throws IOException {
-        File file = new File(TEST_SRC, "usage.out");
-        List<String> fileOutput = Utils.fileAsList(file);
+        Path path = Paths.get(TEST_SRC, "usage.out");
+        List<String> fileOutput = Files.readAllLines(path);
         List<String> outputAsLines = output.asLines();
         assertTrue(outputAsLines.containsAll(fileOutput),
-                "The ouput should contain all content of " + file.getAbsolutePath());
+                "The ouput should contain all content of " + path.toAbsolutePath());
     }
 
 }
--- a/jdk/test/sun/tools/jcmd/TestJcmdSanity.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/sun/tools/jcmd/TestJcmdSanity.java	Tue Jan 20 10:22:43 2015 -0800
@@ -25,6 +25,9 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.List;
 
 import jdk.testlibrary.JcmdBase;
@@ -160,11 +163,11 @@
     }
 
     private static void verifyOutputAgainstFile(OutputAnalyzer output) throws IOException {
-        File file = new File(TEST_SRC, "help_help.out");
-        List<String> fileOutput = Utils.fileAsList(file);
+        Path path = Paths.get(TEST_SRC, "help_help.out");
+        List<String> fileOutput = Files.readAllLines(path);
         List<String> outputAsLines = output.asLines();
         assertTrue(outputAsLines.containsAll(fileOutput),
-                "The ouput should contain all content of " + file.getAbsolutePath());
+                "The ouput should contain all content of " + path.toAbsolutePath());
     }
 
 }
--- a/jdk/test/sun/tools/jps/JpsHelper.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/sun/tools/jps/JpsHelper.java	Tue Jan 20 10:22:43 2015 -0800
@@ -28,6 +28,9 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -189,11 +192,11 @@
      */
     public static void verifyOutputAgainstFile(OutputAnalyzer output) throws IOException {
         String testSrc = System.getProperty("test.src", "?");
-        File file = new File(testSrc, "usage.out");
-        List<String> fileOutput = Utils.fileAsList(file);
+        Path path = Paths.get(testSrc, "usage.out");
+        List<String> fileOutput = Files.readAllLines(path);
         List<String> outputAsLines = output.asLines();
         assertTrue(outputAsLines.containsAll(fileOutput),
-                "The ouput should contain all content of " + file.getAbsolutePath());
+                "The ouput should contain all content of " + path.toAbsolutePath());
     }
 
     private static File getManifest(String className) throws IOException {
--- a/jdk/test/tools/launcher/Arrrghs.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/tools/launcher/Arrrghs.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,12 +30,10 @@
  * @run main/othervm Arrrghs
  */
 
-import java.io.BufferedReader;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -48,9 +46,6 @@
     private Arrrghs(){}
     /**
      * This class provides various tests for arguments processing.
-     * A group of tests to ensure that arguments are passed correctly to
-     * a child java process upon a re-exec, this typically happens when
-     * a version other than the one being executed is requested by the user.
      *
      * History: these set of tests  were part of Arrrghs.sh. The MKS shell
      * implementations were notoriously buggy. Implementing these tests purely
@@ -58,12 +53,6 @@
      *
      */
 
-    // The version string to force a re-exec
-    final static String VersionStr = "-version:1.1+";
-
-    // The Cookie or the pattern we match in the debug output.
-    final static String Cookie = "ReExec Args: ";
-
     /*
      * SIGH, On Windows all strings are quoted, we need to unwrap it
      */
@@ -78,122 +67,6 @@
         return in;
     }
 
-    /*
-     * This method detects the cookie in the output stream of the process.
-     */
-    private boolean detectCookie(InputStream istream,
-            String expectedArguments) throws IOException {
-        BufferedReader rd = new BufferedReader(new InputStreamReader(istream));
-        boolean retval = false;
-
-        String in = rd.readLine();
-        while (in != null) {
-            if (debug) System.out.println(in);
-            if (in.startsWith(Cookie)) {
-                String detectedArgument = removeExtraQuotes(in.substring(Cookie.length()));
-                if (expectedArguments.equals(detectedArgument)) {
-                    retval = true;
-                } else {
-                    System.out.println("Error: Expected Arguments\t:'" +
-                            expectedArguments + "'");
-                    System.out.println(" Detected Arguments\t:'" +
-                            detectedArgument + "'");
-                }
-                // Return the value asap if not in debug mode.
-                if (!debug) {
-                    rd.close();
-                    istream.close();
-                    return retval;
-                }
-            }
-            in = rd.readLine();
-        }
-        return retval;
-    }
-
-    private boolean doReExecTest0(ProcessBuilder pb, String expectedArguments) {
-        boolean retval = false;
-        try {
-            pb.redirectErrorStream(true);
-            Process p = pb.start();
-            retval = detectCookie(p.getInputStream(), expectedArguments);
-            p.waitFor();
-            p.destroy();
-        } catch (Exception ex) {
-            ex.printStackTrace();
-            throw new RuntimeException(ex.getMessage());
-        }
-        return retval;
-    }
-
-    /**
-     * This method returns true  if the expected and detected arguments are the same.
-     * Quoting could cause dissimilar testArguments and expected arguments.
-     */
-    int doReExecTest(String testArguments, String expectedPattern) {
-        ProcessBuilder pb = new ProcessBuilder(javaCmd,
-                VersionStr, testArguments);
-
-        Map<String, String> env = pb.environment();
-        env.put(JLDEBUG_KEY, "true");
-        return doReExecTest0(pb, testArguments) ? 0 : 1;
-    }
-
-    /**
-     * A convenience method for identical test pattern and expected arguments
-     */
-    int doReExecTest(String testPattern) {
-        return doReExecTest(testPattern, testPattern);
-    }
-
-    @Test
-    void testQuoteParsingThroughReExec() {
-        /*
-         * Tests for 6214916
-         * These tests require that a JVM (any JVM) be installed in the system registry.
-         * If none is installed, skip this test.
-         */
-        TestResult tr = doExec(javaCmd, VersionStr, "-version");
-        if (!tr.isOK()) {
-            System.err.println("Warning:Argument Passing Tests were skipped, " +
-                    "no java found in system registry.");
-            return;
-        }
-
-        // Basic test
-        testExitValue += doReExecTest("-a -b -c -d");
-
-        // Basic test with many spaces
-        testExitValue += doReExecTest("-a    -b      -c       -d");
-
-        // Quoted whitespace does matter ?
-        testExitValue += doReExecTest("-a \"\"-b      -c\"\" -d");
-
-
-        // Escaped quotes outside of quotes as literals
-        testExitValue += doReExecTest("-a \\\"-b -c\\\" -d");
-
-        // Check for escaped quotes inside of quotes as literal
-        testExitValue += doReExecTest("-a \"-b \\\"stuff\\\"\" -c -d");
-
-        // A quote preceeded by an odd number of slashes is a literal quote
-        testExitValue += doReExecTest("-a -b\\\\\\\" -c -d");
-
-        // A quote preceeded by an even number of slashes is a literal quote
-        // see 6214916.
-        testExitValue += doReExecTest("-a -b\\\\\\\\\" -c -d");
-
-        // Make sure that whitespace doesn't interfere with the removal of the
-        // appropriate tokens. (space-tab-space preceeds -jre-restict-search).
-        testExitValue += doReExecTest("-a -b  \t -jre-restrict-search -c -d", "-a -b -c -d");
-
-        // Make sure that the mJRE tokens being stripped, aren't stripped if
-        // they happen to appear as arguments to the main class.
-        testExitValue += doReExecTest("foo -version:1.1+");
-
-        System.out.println("Completed arguments quoting tests with "
-                + testExitValue + " errors");
-    }
     // the pattern we hope to see in the output
     static final Pattern ArgPattern = Pattern.compile("\\s*argv\\[[0-9]*\\].*=.*");
 
--- a/jdk/test/tools/launcher/MultipleJRE.sh	Thu Jan 15 19:23:48 2015 -0800
+++ b/jdk/test/tools/launcher/MultipleJRE.sh	Tue Jan 20 10:22:43 2015 -0800
@@ -90,36 +90,6 @@
 }
 
 #
-# Shell routine to ensure help page does not include mjre options
-#
-TestHelp() {
-    mess="`$JAVA -help 2>&1`"
-    # make sure it worked
-    if [ $? -ne 0 ]; then
-        echo "java -help failed ????"
-        exit 1
-    fi
-
-    echo $mess | grep '\-version:<value>' > /dev/null 2>&1
-    if [ $? -eq 0 ]; then
-       echo "help message contains obsolete option version:<value>"
-       exit 1
-    fi
-
-    echo $mess | grep '\-jre-restrict-search' > /dev/null 2>&1
-    if [ $? -eq 0 ]; then
-       echo "help message contains obsolete option jre-restrict-search"
-       exit 1
-    fi
-
-    echo $mess | grep '\-no-jre-restrict-search' > /dev/null 2>&1
-    if [ $? -eq 0 ]; then
-       echo "help message contains obsolete option no-jre-restrict-search"
-       exit 1
-    fi
-}
-
-#
 # Just as the name says.  We sprinkle these in the appropriate location
 # in the test file system and they just say who they are pretending to be.
 #
@@ -461,33 +431,4 @@
 	LaunchVM "" "${RELEASE}"
 fi
 
-#
-# Now test specification of mJRE
-#
-#   In some cases this should result in failure of the command,
-#   in some cases, a warning messages, with the command succeeding.
-#
-
-	# Commandline use of "-version:" should fail
-	#   with a message containing "no longer supported"
-	LaunchVM "-version:1.10+" "Error: Specifying an alternate JDK/JRE"
-	LaunchVM "-version:prettymuchanything" "Error: Specifying an alternate JDK/JRE"
-
-	# Commandline use of "-jre-restrict-search" should now fail
-	LaunchVM "-jre-restrict-search" "\-jre\-no\-restrict\-search are also no longer valid"
-	# Commandline use of "-jre-no-restrict-search" should now fail
-	LaunchVM "-jre-no-restrict-search" "\-jre\-no\-restrict\-search are also no longer valid"
-
-
-	# mJRE directives to use a specific version should be flagged
-	#   with a warning, but the jar should be executed with the
-	#   current jre
-	CreateFullJar "junk request" ""
-	LaunchVM "" "${RELEASE}"
-        # Going to silently ignore JRE-Version setting in jar file manifest
-	#LaunchVM "" "warning: The jarfile JRE-Version"
-
-	# Verify help does not contain obsolete options
-	TestHelp
-
 exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/MultipleJRERemoved.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8067437
+ * @summary Verify Multiple JRE version support has been removed.
+ * @build TestHelper
+ * @run main MultipleJRERemoved
+ */
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.*;
+import java.util.jar.Attributes;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.zip.ZipEntry;
+
+public class MultipleJRERemoved extends TestHelper {
+
+    public static final String VERSION_JAR = "version.jar";
+    public static final String PRINT_VERSION_CLASS = "PrintVersion";
+    private final File javaFile = new File(PRINT_VERSION_CLASS + ".java");
+    private final File clsFile = new File(PRINT_VERSION_CLASS + ".class");
+
+    private MultipleJRERemoved() {
+    }
+
+    /**
+     * @param args the command line arguments
+     * @throws java.io.FileNotFoundException
+     */
+    public static void main(String[] args) throws Exception {
+        MultipleJRERemoved a = new MultipleJRERemoved();
+        a.run(args);
+    }
+
+    /**
+     * Check all combinations of flags: "-version:", "-jre-restrict-search", "-jre-no-restrict-search". Test expects to see errors.
+     */
+    @Test
+    public void allFlagCombinations() throws IOException {
+        final Pattern newLine = Pattern.compile("\n");
+        createJar(Collections.emptyMap());
+
+        for (Flag flag1 : Flag.values()) {
+            for (Flag flag2 : Flag.values()) {
+                for (Flag flag3 : Flag.values()) {
+                    List<Flag> flags = Stream.of(flag1, flag2, flag3)
+                            .filter(f -> !Flag.EMPTY.equals(f))
+                            .collect(Collectors.toList());
+
+                    if (flags.size() == 0) continue;
+
+                    List<String> flagValues = flags.stream()
+                            .map(Flag::value)
+                            .collect(Collectors.toList());
+
+                    List<String> errorMessages = flags.stream()
+                            .map(Flag::errorMessage)
+                            .flatMap(newLine::splitAsStream)
+                            .collect(Collectors.toList());
+
+                    List<String> jarCmd = new ArrayList<>();
+                    jarCmd.add(javaCmd);
+                    jarCmd.addAll(flagValues);
+                    jarCmd.add("-jar");
+                    jarCmd.add("version.jar");
+
+                    check(jarCmd, errorMessages);
+
+                    List<String> cmd = new ArrayList<>();
+                    cmd.add(javaCmd);
+                    cmd.addAll(flagValues);
+                    cmd.add(PRINT_VERSION_CLASS);
+
+                    check(cmd, errorMessages);
+                }
+            }
+        }
+    }
+
+    private void check(List<String> cmd, List<String> errorMessages) {
+        TestResult tr = doExec(cmd.toArray(new String[cmd.size()]));
+        tr.checkNegative();
+        tr.isNotZeroOutput();
+        errorMessages.forEach(tr::contains);
+
+        if (!tr.testStatus) {
+            System.out.println(tr);
+            throw new RuntimeException("test case: failed\n" + cmd);
+        }
+    }
+
+    /**
+     * Verifies that java -help output doesn't contain information about "mJRE" flags.
+     */
+    @Test
+    public void javaHelp() {
+        TestResult tr = doExec(javaCmd, "-help");
+        tr.checkPositive();
+        tr.isNotZeroOutput();
+        tr.notContains("-version:<value>");
+        tr.notContains("-jre-restrict-search");
+        tr.notContains("-jre-no-restrict-search");
+        tr.notContains("-no-jre-restrict-search");  //it's not a typo in flag name.
+        if (!tr.testStatus) {
+            System.out.println(tr);
+            throw new RuntimeException("Failed. java -help output contains obsolete flags.\n");
+        }
+    }
+
+    /**
+     * Verifies that java -jar version.jar output ignores "mJRE" manifest directives.
+     */
+    @Test
+    public void manifestDirectives() throws IOException {
+        Map<String, String> manifest = new TreeMap<>();
+        manifest.put("JRE-Version", "1.8");
+        manifest.put("JRE-Restrict-Search", "1.8");
+        createJar(manifest);
+
+        TestResult tr = doExec(javaCmd, "-jar", VERSION_JAR);
+        tr.checkPositive();
+        tr.contains(System.getProperty("java.version"));
+        if (!tr.testStatus) {
+            System.out.println(tr);
+            throw new RuntimeException("Failed.\n");
+        }
+    }
+
+    private void emitFile() throws IOException {
+        List<String> scr = new ArrayList<>();
+        scr.add("public class PrintVersion {");
+        scr.add("    public static void main(String... args) {");
+        scr.add("       System.out.println(System.getProperty(\"java.version\"));");
+        scr.add("    }");
+        scr.add("}");
+        createFile(javaFile, scr);
+        compile(javaFile.getName());
+    }
+
+    private void createJar(Map<String, String> manifestAttributes) throws IOException {
+        emitFile();
+
+        Manifest manifest = new Manifest();
+        final Attributes mainAttributes = manifest.getMainAttributes();
+        mainAttributes.putValue("Manifest-Version", "1.0");
+        mainAttributes.putValue("Main-Class", PRINT_VERSION_CLASS);
+        manifestAttributes.forEach(mainAttributes::putValue);
+
+        try (JarOutputStream jar = new JarOutputStream(new FileOutputStream(VERSION_JAR), manifest)) {
+            jar.putNextEntry(new ZipEntry(PRINT_VERSION_CLASS + ".class"));
+            jar.write(Files.readAllBytes(clsFile.toPath()));
+            jar.closeEntry();
+        } finally {
+            javaFile.delete();
+        }
+    }
+
+    private enum Flag {
+        EMPTY("", ""),
+        VERSION("-version:1.9", "Error: Specifying an alternate JDK/JRE version is no longer supported.\n" +
+                "The use of the flag '-version:' is no longer valid.\n" +
+                "Please download and execute the appropriate version."),
+        JRE_RESTRICT_SEARCH("-jre-restrict-search", "Error: Specifying an alternate JDK/JRE is no longer supported.\n" +
+                "The related flags -jre-restrict-search | -jre-no-restrict-search are also no longer valid."),
+        JRE_NO_RESTRICT_SEARCH("-jre-no-restrict-search", "Error: Specifying an alternate JDK/JRE is no longer supported.\n" +
+                "The related flags -jre-restrict-search | -jre-no-restrict-search are also no longer valid.");
+        private final String flag;
+        private final String errorMessage;
+
+        Flag(String flag, String errorMessage) {
+            this.flag = flag;
+            this.errorMessage = errorMessage;
+        }
+
+        String value() {
+            return flag;
+        }
+
+        String errorMessage() {
+            return errorMessage;
+        }
+    }
+}
--- a/langtools/.hgtags	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/.hgtags	Tue Jan 20 10:22:43 2015 -0800
@@ -288,3 +288,4 @@
 6a06008aec10d32898ca665685f531c681b28f5f jdk9-b43
 de2ce70d907c9f227b802cea29285bece5194cd5 jdk9-b44
 73bbdcf236b297a0c1b8875f2eeba65eaf7ade60 jdk9-b45
+e272d9be5f90edb6bb6b40f7816ec85eec0f5dc2 jdk9-b46
--- a/langtools/make/Tools.gmk	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/make/Tools.gmk	Tue Jan 20 10:22:43 2015 -0800
@@ -40,6 +40,7 @@
     ADD_JAVAC_FLAGS := -Xprefer:source, \
     SRC := $(LANGTOOLS_TOPDIR)/make/tools, \
     INCLUDES := compileproperties propertiesparser, \
+    COPY := .properties, \
     BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes))
 
 all: $(BUILD_TOOLS_LANGTOOLS)
--- a/langtools/make/gensrc/Gensrc-jdk.compiler.gmk	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/make/gensrc/Gensrc-jdk.compiler.gmk	Tue Jan 20 10:22:43 2015 -0800
@@ -25,19 +25,19 @@
 
 include GensrcCommon.gmk
 
-$(eval $(call SetupVersionProperties,JAVAC_VERSION,\
+$(eval $(call SetupVersionProperties,JAVAC_VERSION, \
     com/sun/tools/javac/resources/version.properties))
 
-$(eval $(call SetupVersionProperties,JAVAH_VERSION,\
+$(eval $(call SetupVersionProperties,JAVAH_VERSION, \
     com/sun/tools/javah/resources/version.properties))
 
-$(eval $(call SetupVersionProperties,JAVAP_VERSION,\
+$(eval $(call SetupVersionProperties,JAVAP_VERSION, \
     com/sun/tools/javap/resources/version.properties))
 
-$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES,\
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
     $(JAVAC_VERSION) $(JAVAH_VERSION) $(JAVAP_VERSION)))
 
-$(eval $(call SetupParseProperties,PARSE_PROPERTIES,\
+$(eval $(call SetupParseProperties,PARSE_PROPERTIES, \
 	com/sun/tools/javac/resources/compiler.properties))
 
 all: $(COMPILE_PROPERTIES) $(PARSE_PROPERTIES)
--- a/langtools/make/gensrc/GensrcCommon.gmk	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/make/gensrc/GensrcCommon.gmk	Tue Jan 20 10:22:43 2015 -0800
@@ -63,7 +63,8 @@
 # Param 2 - Extra properties files to process
 define SetupCompileProperties
   # Lookup the properties that need to be compiled into resource bundles.
-  PROPSOURCES := $2 $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties")
+  PROPSOURCES := $2 \
+      $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties")
 
   # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
   # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
@@ -74,7 +75,7 @@
       $$(patsubst %.properties, %.java, \
       $$(subst /share/classes,, $$(PROPSOURCES))))
 
-  # Generate the package dirs for the tobe generated java files. Sort to remove
+  # Generate the package dirs for the to be generated java files. Sort to remove
   # duplicates.
   PROPDIRS := $$(sort $$(dir $$(PROPJAVAS)))
 
@@ -88,8 +89,8 @@
 
   # Now setup the rule for the generation of the resource bundles.
   $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES)
-	$(FIND) $$(@D) -name "*.java" $(FIND_DELETE)
 	$(MKDIR) -p $$(@D) $$(PROPDIRS)
+	$(FIND) $$(@D) -name "*.java" -a ! -name "*Properties.java" $(FIND_DELETE)
 	$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE)
 	$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)
 	$(TOUCH) $$@
@@ -102,11 +103,11 @@
 # Param 1 - Variable to add targets to
 # Param 2 - Extra properties files to process
 define SetupParseProperties
-  #property file to generate
-  PARSEPROPSOURCES := $$(foreach var,$2,$$(addsuffix $$(var),$(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/))  
+  # property files to process
+  PARSEPROPSOURCES := $$(addprefix $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/, $2)
 
-  PARSEPROPALLDIRS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/%, \
-      $(SUPPORT_OUTPUTDIR)/gensrc/%, \
+  PARSEPROPALLDIRS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes/%, \
+      $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \
       $$(dir $$(PARSEPROPSOURCES)))
 
   PARSEPROPDIRS := $$(sort $$(PARSEPROPALLDIRS))
@@ -114,11 +115,11 @@
   PARSEPROPCMDLINE := $$(subst _SPACE_, $$(SPACE), \
     $$(join $$(foreach var,$$(PARSEPROPSOURCES),$$(addprefix -compile_SPACE_,$$(var))), \
     $$(addprefix _SPACE_, $$(PARSEPROPALLDIRS))))
-  
+
   # Now setup the rule for the generation of the resource bundles.
   $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_parsed_props: $(PARSEPROPSOURCES)
-	$(CP) -r $(LANGTOOLS_TOPDIR)/make/tools/propertiesparser/resources $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes/propertiesparser/resources
 	$(MKDIR) -p $$(@D) $$(PARSEPROPDIRS)
+	$(FIND) $$(@D) -name "*Properties.java" $(FIND_DELETE)
 	$(ECHO) Parsing $$(words $$(PARSEPROPSOURCES)) properties into enum-like class for $(MODULE)
 	$(TOOL_PARSEPROPS_CMD) $$(PARSEPROPCMDLINE)
 	$(TOUCH) $$@
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 # questions.
 #
 
-dc.anchor.already.defined = anchor already defined: {0}
+dc.anchor.already.defined = anchor already defined: "{0}"
 dc.anchor.value.missing = no value given for anchor
 dc.attr.lacks.value = attribute lacks value
 dc.attr.not.number = attribute value is not a number
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
@@ -924,12 +925,7 @@
         try {
             switch (kind) {
             case ERROR:
-                boolean prev = log.multipleErrors;
-                try {
-                    log.error(pos, "proc.messager", msg.toString());
-                } finally {
-                    log.multipleErrors = prev;
-                }
+                log.error(DiagnosticFlag.MULTIPLE, pos, "proc.messager", msg.toString());
                 break;
 
             case WARNING:
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java	Tue Jan 20 10:22:43 2015 -0800
@@ -74,8 +74,7 @@
         WRONG_MTHS(Category.OVERLOAD, KindName.METHOD),
         WRONG_MTH(Category.OVERLOAD, KindName.METHOD),
         ABSENT_MTH(Category.OVERLOAD, KindName.METHOD),
-        ABSENT_TYP(Category.OVERLOAD, KindName.CLASS),
-        WRONG_STATICNESS(Category.OVERLOAD, KindName.METHOD);
+        ABSENT_TYP(Category.OVERLOAD, KindName.CLASS);
 
         // There are essentially two "levels" to the Kind datatype.
         // The first is a totally-ordered set of categories of
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1175,6 +1175,16 @@
             return v.visitClassSymbol(this, p);
         }
 
+        public void markAbstractIfNeeded(Types types) {
+            if (types.enter.getEnv(this) != null &&
+                (flags() & ENUM) != 0 && types.supertype(type).tsym == types.syms.enumSym &&
+                (flags() & (FINAL | ABSTRACT)) == 0) {
+                if (types.firstUnimplementedAbstract(this) != null)
+                    // add the ABSTRACT flag to an enum
+                    flags_field |= ABSTRACT;
+            }
+        }
+
         /**Resets the Symbol into the state good for next round of annotation processing.*/
         public void reset() {
             kind = TYP;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Tue Jan 20 10:22:43 2015 -0800
@@ -48,6 +48,7 @@
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.Scope.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.Symbol.*;
 import static com.sun.tools.javac.code.Type.*;
 import static com.sun.tools.javac.code.TypeTag.*;
@@ -82,6 +83,7 @@
     final JavacMessages messages;
     final Names names;
     final boolean allowObjectToPrimitiveCast;
+    final boolean allowDefaultMethods;
     final Check chk;
     final Enter enter;
     JCDiagnostic.Factory diags;
@@ -105,6 +107,7 @@
         names = Names.instance(context);
         Source source = Source.instance(context);
         allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
+        allowDefaultMethods = source.allowDefaultMethods();
         chk = Check.instance(context);
         enter = Enter.instance(context);
         capturedName = names.fromString("<captured wildcard>");
@@ -805,13 +808,13 @@
             return true;
         }
 
-        // Generally, if 's' is a type variable, recur on lower bound; but
+        // Generally, if 's' is a lower-bounded type variable, recur on lower bound; but
         // for inference variables and intersections, we need to keep 's'
         // (see JLS 4.10.2 for intersections and 18.2.3 for inference vars)
         if (!t.hasTag(UNDETVAR) && !t.isCompound()) {
             // TODO: JDK-8039198, bounds checking sometimes passes in a wildcard as s
             Type lower = cvarLowerBound(wildLowerBound(s));
-            if (s != lower)
+            if (s != lower && !lower.hasTag(BOT))
                 return isSubtype(capture ? capture(t) : t, lower, false);
         }
 
@@ -2775,6 +2778,58 @@
     // </editor-fold>
 
 
+    /** Return first abstract member of class `sym'.
+     */
+    public MethodSymbol firstUnimplementedAbstract(ClassSymbol sym) {
+        try {
+            return firstUnimplementedAbstractImpl(sym, sym);
+        } catch (CompletionFailure ex) {
+            chk.completionError(enter.getEnv(sym).tree.pos(), ex);
+            return null;
+        }
+    }
+        //where:
+        private MethodSymbol firstUnimplementedAbstractImpl(ClassSymbol impl, ClassSymbol c) {
+            MethodSymbol undef = null;
+            // Do not bother to search in classes that are not abstract,
+            // since they cannot have abstract members.
+            if (c == impl || (c.flags() & (ABSTRACT | INTERFACE)) != 0) {
+                Scope s = c.members();
+                for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
+                    if (sym.kind == MTH &&
+                        (sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
+                        MethodSymbol absmeth = (MethodSymbol)sym;
+                        MethodSymbol implmeth = absmeth.implementation(impl, this, true);
+                        if (implmeth == null || implmeth == absmeth) {
+                            //look for default implementations
+                            if (allowDefaultMethods) {
+                                MethodSymbol prov = interfaceCandidates(impl.type, absmeth).head;
+                                if (prov != null && prov.overrides(absmeth, impl, this, true)) {
+                                    implmeth = prov;
+                                }
+                            }
+                        }
+                        if (implmeth == null || implmeth == absmeth) {
+                            undef = absmeth;
+                            break;
+                        }
+                    }
+                }
+                if (undef == null) {
+                    Type st = supertype(c.type);
+                    if (st.hasTag(CLASS))
+                        undef = firstUnimplementedAbstractImpl(impl, (ClassSymbol)st.tsym);
+                }
+                for (List<Type> l = interfaces(c.type);
+                     undef == null && l.nonEmpty();
+                     l = l.tail) {
+                    undef = firstUnimplementedAbstractImpl(impl, (ClassSymbol)l.head.tsym);
+                }
+            }
+            return undef;
+        }
+
+
     //where
     public List<MethodSymbol> interfaceCandidates(Type site, MethodSymbol ms) {
         Filter<Symbol> filter = new MethodFilter(ms, site);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Jan 20 10:22:43 2015 -0800
@@ -2640,8 +2640,7 @@
             try {
                 refResult = rs.resolveMemberReference(localEnv, that, that.expr.type,
                         that.name, argtypes, typeargtypes, referenceCheck,
-                        resultInfo.checkContext.inferenceContext(),
-                        resultInfo.checkContext.deferredAttrContext().mode);
+                        resultInfo.checkContext.inferenceContext(), rs.basicReferenceChooser);
             } finally {
                 resultInfo.checkContext.inferenceContext().rollback(saved_undet);
             }
@@ -2659,9 +2658,8 @@
                     case WRONG_MTHS:
                     case AMBIGUOUS:
                     case HIDDEN:
+                    case MISSING_ENCL:
                     case STATICERR:
-                    case MISSING_ENCL:
-                    case WRONG_STATICNESS:
                         targetError = true;
                         break;
                     default:
@@ -2722,15 +2720,6 @@
                     return;
                 }
 
-                if (that.sym.isStatic() && !TreeInfo.isStaticSelector(that.expr, names) &&
-                        !that.kind.isUnbound()) {
-                    //no static bound mrefs
-                    log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
-                            diags.fragment("static.bound.mref"));
-                    result = that.type = types.createErrorType(currentTarget);
-                    return;
-                }
-
                 if (!refSym.isStatic() && that.kind == JCMemberReference.ReferenceKind.SUPER) {
                     // Check that super-qualified symbols are not abstract (JLS)
                     rs.checkNonAbstract(that.pos(), that.sym);
@@ -4199,6 +4188,8 @@
             chk.validate(tree.implementing, env);
         }
 
+        c.markAbstractIfNeeded(types);
+
         // If this is a non-abstract class, check that it has no abstract
         // methods or unimplemented methods of an implemented interface.
         if ((c.flags() & (ABSTRACT | INTERFACE)) == 0) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Tue Jan 20 10:22:43 2015 -0800
@@ -2019,69 +2019,15 @@
      *  @param c            The class.
      */
     void checkAllDefined(DiagnosticPosition pos, ClassSymbol c) {
-        try {
-            MethodSymbol undef = firstUndef(c, c);
-            if (undef != null) {
-                if ((c.flags() & ENUM) != 0 &&
-                    types.supertype(c.type).tsym == syms.enumSym &&
-                    (c.flags() & FINAL) == 0) {
-                    // add the ABSTRACT flag to an enum
-                    c.flags_field |= ABSTRACT;
-                } else {
-                    MethodSymbol undef1 =
-                        new MethodSymbol(undef.flags(), undef.name,
-                                         types.memberType(c.type, undef), undef.owner);
-                    log.error(pos, "does.not.override.abstract",
-                              c, undef1, undef1.location());
-                }
-            }
-        } catch (CompletionFailure ex) {
-            completionError(pos, ex);
+        MethodSymbol undef = types.firstUnimplementedAbstract(c);
+        if (undef != null) {
+            MethodSymbol undef1 =
+                new MethodSymbol(undef.flags(), undef.name,
+                                 types.memberType(c.type, undef), undef.owner);
+            log.error(pos, "does.not.override.abstract",
+                      c, undef1, undef1.location());
         }
     }
-//where
-        /** Return first abstract member of class `c' that is not defined
-         *  in `impl', null if there is none.
-         */
-        private MethodSymbol firstUndef(ClassSymbol impl, ClassSymbol c) {
-            MethodSymbol undef = null;
-            // Do not bother to search in classes that are not abstract,
-            // since they cannot have abstract members.
-            if (c == impl || (c.flags() & (ABSTRACT | INTERFACE)) != 0) {
-                Scope s = c.members();
-                for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
-                    if (sym.kind == MTH &&
-                        (sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
-                        MethodSymbol absmeth = (MethodSymbol)sym;
-                        MethodSymbol implmeth = absmeth.implementation(impl, types, true);
-                        if (implmeth == null || implmeth == absmeth) {
-                            //look for default implementations
-                            if (allowDefaultMethods) {
-                                MethodSymbol prov = types.interfaceCandidates(impl.type, absmeth).head;
-                                if (prov != null && prov.overrides(absmeth, impl, types, true)) {
-                                    implmeth = prov;
-                                }
-                            }
-                        }
-                        if (implmeth == null || implmeth == absmeth) {
-                            undef = absmeth;
-                            break;
-                        }
-                    }
-                }
-                if (undef == null) {
-                    Type st = types.supertype(c.type);
-                    if (st.hasTag(CLASS))
-                        undef = firstUndef(impl, (ClassSymbol)st.tsym);
-                }
-                for (List<Type> l = types.interfaces(c.type);
-                     undef == null && l.nonEmpty();
-                     l = l.tail) {
-                    undef = firstUndef(impl, (ClassSymbol)l.head.tsym);
-                }
-            }
-            return undef;
-        }
 
     void checkNonCyclicDecl(JCClassDecl tree) {
         CycleChecker cc = new CycleChecker();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Tue Jan 20 10:22:43 2015 -0800
@@ -27,6 +27,9 @@
 
 import com.sun.source.tree.LambdaExpressionTree.BodyKind;
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.comp.Resolve.ResolveError;
+import com.sun.tools.javac.resources.CompilerProperties;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
@@ -37,6 +40,7 @@
 import com.sun.tools.javac.comp.Infer.InferenceContext;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionPhase;
 import com.sun.tools.javac.tree.JCTree.*;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
 import com.sun.tools.javac.util.Log.DeferredDiagnosticHandler;
 
 import java.util.ArrayList;
@@ -786,16 +790,22 @@
                     JCMemberReference mref2 = new TreeCopier<Void>(make).copy(tree);
                     mref2.expr = exprTree;
                     Symbol lookupSym =
-                            rs.resolveMemberReferenceByArity(localEnv, mref2, exprTree.type,
-                                tree.name, argtypes.toList(), inferenceContext);
+                            rs.resolveMemberReference(localEnv, mref2, exprTree.type,
+                                    tree.name, argtypes.toList(), List.nil(), rs.arityMethodCheck,
+                                    inferenceContext, rs.structuralReferenceChooser).fst;
                     switch (lookupSym.kind) {
-                        //note: as argtypes are erroneous types, type-errors must
-                        //have been caused by arity mismatch
-                        case ABSENT_MTH:
                         case WRONG_MTH:
                         case WRONG_MTHS:
-                        case WRONG_STATICNESS:
-                           checkContext.report(tree, diags.fragment("incompatible.arg.types.in.mref"));
+                            //note: as argtypes are erroneous types, type-errors must
+                            //have been caused by arity mismatch
+                            checkContext.report(tree, diags.fragment(Fragments.IncompatibleArgTypesInMref));
+                            break;
+                        case ABSENT_MTH:
+                        case STATICERR:
+                            //if no method found, or method found with wrong staticness, report better message
+                            checkContext.report(tree, ((ResolveError)lookupSym).getDiagnostic(DiagnosticType.FRAGMENT,
+                                    tree, exprTree.type.tsym, exprTree.type, tree.name, argtypes.toList(), List.nil()));
+                            break;
                     }
                 }
             }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Tue Jan 20 10:22:43 2015 -0800
@@ -263,7 +263,7 @@
     @Override
     public void visitLambda(JCLambda tree) {
         LambdaTranslationContext localContext = (LambdaTranslationContext)context;
-        MethodSymbol sym = (MethodSymbol)localContext.translatedSym;
+        MethodSymbol sym = localContext.translatedSym;
         MethodType lambdaType = (MethodType) sym.type;
 
         {
@@ -875,11 +875,9 @@
          */
         private JCExpression expressionInvoke(VarSymbol rcvr) {
             JCExpression qualifier =
-                    tree.sym.isStatic() ?
-                        make.Type(tree.sym.owner.type) :
-                        (rcvr != null) ?
-                            makeReceiver(rcvr) :
-                            tree.getQualifierExpression();
+                    (rcvr != null) ?
+                        makeReceiver(rcvr) :
+                        tree.getQualifierExpression();
 
             //create the qualifier expression
             JCFieldAccess select = make.Select(qualifier, tree.sym.name);
@@ -1755,7 +1753,7 @@
             Map<LambdaSymbolKind, Map<Symbol, Symbol>> translatedSymbols;
 
             /** the synthetic symbol for the method hoisting the translated lambda */
-            Symbol translatedSym;
+            MethodSymbol translatedSym;
 
             List<JCVariableDecl> syntheticParams;
 
@@ -1997,6 +1995,7 @@
 
                 //compute synthetic params
                 ListBuffer<JCVariableDecl> params = new ListBuffer<>();
+                ListBuffer<VarSymbol> parameterSymbols = new ListBuffer<>();
 
                 // The signature of the method is augmented with the following
                 // synthetic parameters:
@@ -2005,19 +2004,16 @@
                 // 2) enclosing locals captured by the lambda expression
                 for (Symbol thisSym : getSymbolMap(CAPTURED_VAR).values()) {
                     params.append(make.VarDef((VarSymbol) thisSym, null));
-                }
-                if (methodReferenceReceiver != null) {
-                    params.append(make.VarDef(
-                            make.Modifiers(PARAMETER|FINAL),
-                            names.fromString("$rcvr$"),
-                            make.Type(methodReferenceReceiver.type),
-                            null));
+                    parameterSymbols.append((VarSymbol) thisSym);
                 }
                 for (Symbol thisSym : getSymbolMap(PARAM).values()) {
                     params.append(make.VarDef((VarSymbol) thisSym, null));
+                    parameterSymbols.append((VarSymbol) thisSym);
                 }
                 syntheticParams = params.toList();
 
+                translatedSym.params = parameterSymbols.toList();
+
                 // Compute and set the lambda name
                 translatedSym.name = isSerializable()
                         ? serializedLambdaName()
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Jan 20 10:22:43 2015 -0800
@@ -25,7 +25,6 @@
 
 package com.sun.tools.javac.comp;
 
-import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
 import com.sun.tools.javac.api.Formattable.LocalizedString;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Scope.WriteableScope;
@@ -40,6 +39,7 @@
 import com.sun.tools.javac.comp.Infer.FreeTypeListener;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionContext.Candidate;
 import com.sun.tools.javac.comp.Resolve.MethodResolutionDiagHelper.Template;
+import com.sun.tools.javac.comp.Resolve.ReferenceLookupResult.StaticKind;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.tree.*;
@@ -65,6 +65,7 @@
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Flags.BLOCK;
+import static com.sun.tools.javac.code.Flags.STATIC;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.TypeTag.*;
@@ -105,15 +106,10 @@
         context.put(resolveKey, this);
         syms = Symtab.instance(context);
 
-        varNotFound = new
-            SymbolNotFoundError(ABSENT_VAR);
-        methodNotFound = new
-            SymbolNotFoundError(ABSENT_MTH);
-        methodWithCorrectStaticnessNotFound = new
-            SymbolNotFoundError(WRONG_STATICNESS,
-                "method found has incorrect staticness");
-        typeNotFound = new
-            SymbolNotFoundError(ABSENT_TYP);
+        varNotFound = new SymbolNotFoundError(ABSENT_VAR);
+        methodNotFound = new SymbolNotFoundError(ABSENT_MTH);
+        typeNotFound = new SymbolNotFoundError(ABSENT_TYP);
+        referenceNotFound = new ReferenceLookupResult(methodNotFound, null);
 
         names = Names.instance(context);
         log = Log.instance(context);
@@ -145,9 +141,11 @@
      */
     private final SymbolNotFoundError varNotFound;
     private final SymbolNotFoundError methodNotFound;
-    private final SymbolNotFoundError methodWithCorrectStaticnessNotFound;
     private final SymbolNotFoundError typeNotFound;
 
+    /** empty reference lookup result */
+    private final ReferenceLookupResult referenceNotFound;
+
     public static Resolve instance(Context context) {
         Resolve instance = context.get(resolveKey);
         if (instance == null)
@@ -2680,69 +2678,16 @@
                                   List<Type> argtypes,
                                   List<Type> typeargtypes,
                                   MethodResolutionPhase maxPhase) {
-        ReferenceLookupHelper result;
         if (!name.equals(names.init)) {
             //method reference
-            result =
-                    new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
+            return new MethodReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase);
+        } else if (site.hasTag(ARRAY)) {
+            //array constructor reference
+            return new ArrayConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
         } else {
-            if (site.hasTag(ARRAY)) {
-                //array constructor reference
-                result =
-                        new ArrayConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
-            } else {
-                //class constructor reference
-                result =
-                        new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
-            }
+            //class constructor reference
+            return new ConstructorReferenceLookupHelper(referenceTree, site, argtypes, typeargtypes, maxPhase);
         }
-        return result;
-    }
-
-    Symbol resolveMemberReferenceByArity(Env<AttrContext> env,
-                                  JCMemberReference referenceTree,
-                                  Type site,
-                                  Name name,
-                                  List<Type> argtypes,
-                                  InferenceContext inferenceContext) {
-
-        boolean isStaticSelector = TreeInfo.isStaticSelector(referenceTree.expr, names);
-        site = types.capture(site);
-
-        ReferenceLookupHelper boundLookupHelper = makeReferenceLookupHelper(
-                referenceTree, site, name, argtypes, null, VARARITY);
-        //step 1 - bound lookup
-        Env<AttrContext> boundEnv = env.dup(env.tree, env.info.dup());
-        Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(), site.tsym,
-                arityMethodCheck, boundLookupHelper);
-        if (isStaticSelector &&
-            !name.equals(names.init) &&
-            !boundSym.isStatic() &&
-            !boundSym.kind.isOverloadError()) {
-            boundSym = methodNotFound;
-        }
-
-        //step 2 - unbound lookup
-        Symbol unboundSym = methodNotFound;
-        ReferenceLookupHelper unboundLookupHelper = null;
-        Env<AttrContext> unboundEnv = env.dup(env.tree, env.info.dup());
-        if (isStaticSelector) {
-            unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
-            unboundSym = lookupMethod(unboundEnv, env.tree.pos(), site.tsym,
-                    arityMethodCheck, unboundLookupHelper);
-            if (unboundSym.isStatic() &&
-                !unboundSym.kind.isOverloadError()) {
-                unboundSym = methodNotFound;
-            }
-        }
-
-        //merge results
-        Symbol bestSym = choose(boundSym, unboundSym);
-        env.info.pendingResolutionPhase = bestSym == unboundSym ?
-                unboundEnv.info.pendingResolutionPhase :
-                boundEnv.info.pendingResolutionPhase;
-
-        return bestSym;
     }
 
     /**
@@ -2763,8 +2708,8 @@
      * the receiver argument type is used to infer an instantiation for the raw
      * qualifier type.
      *
-     * When a multi-step resolution process is exploited, it is an error
-     * if two candidates are found (ambiguity).
+     * When a multi-step resolution process is exploited, the process of picking
+     * the resulting symbol is delegated to an helper class {@link com.sun.tools.javac.comp.Resolve.ReferenceChooser}.
      *
      * This routine returns a pair (T,S), where S is the member reference symbol,
      * and T is the type of the class in which S is defined. This is necessary as
@@ -2779,7 +2724,7 @@
                                   List<Type> typeargtypes,
                                   MethodCheck methodCheck,
                                   InferenceContext inferenceContext,
-                                  AttrMode mode) {
+                                  ReferenceChooser referenceChooser) {
 
         site = types.capture(site);
         ReferenceLookupHelper boundLookupHelper = makeReferenceLookupHelper(
@@ -2787,102 +2732,29 @@
 
         //step 1 - bound lookup
         Env<AttrContext> boundEnv = env.dup(env.tree, env.info.dup());
-        Symbol origBoundSym;
-        boolean staticErrorForBound = false;
         MethodResolutionContext boundSearchResolveContext = new MethodResolutionContext();
         boundSearchResolveContext.methodCheck = methodCheck;
-        Symbol boundSym = origBoundSym = lookupMethod(boundEnv, env.tree.pos(),
+        Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(),
                 site.tsym, boundSearchResolveContext, boundLookupHelper);
-        SearchResultKind boundSearchResultKind = SearchResultKind.NOT_APPLICABLE_MATCH;
-        boolean isStaticSelector = TreeInfo.isStaticSelector(referenceTree.expr, names);
-        boolean shouldCheckForStaticness = isStaticSelector &&
-                referenceTree.getMode() == ReferenceMode.INVOKE;
-        if (boundSym.kind != WRONG_MTHS && boundSym.kind != WRONG_MTH) {
-            if (shouldCheckForStaticness) {
-                if (!boundSym.isStatic()) {
-                    staticErrorForBound = true;
-                    if (hasAnotherApplicableMethod(
-                            boundSearchResolveContext, boundSym, true)) {
-                        boundSearchResultKind = SearchResultKind.BAD_MATCH_MORE_SPECIFIC;
-                    } else {
-                        boundSearchResultKind = SearchResultKind.BAD_MATCH;
-                        if (!boundSym.kind.isOverloadError()) {
-                            boundSym = methodWithCorrectStaticnessNotFound;
-                        }
-                    }
-                } else if (!boundSym.kind.isOverloadError()) {
-                    boundSearchResultKind = SearchResultKind.GOOD_MATCH;
-                }
-            }
-        }
+        ReferenceLookupResult boundRes = new ReferenceLookupResult(boundSym, boundSearchResolveContext);
 
         //step 2 - unbound lookup
-        Symbol origUnboundSym = null;
         Symbol unboundSym = methodNotFound;
-        ReferenceLookupHelper unboundLookupHelper = null;
         Env<AttrContext> unboundEnv = env.dup(env.tree, env.info.dup());
-        SearchResultKind unboundSearchResultKind = SearchResultKind.NOT_APPLICABLE_MATCH;
-        boolean staticErrorForUnbound = false;
-        if (isStaticSelector) {
-            unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
+        ReferenceLookupHelper unboundLookupHelper = boundLookupHelper.unboundLookup(inferenceContext);
+        ReferenceLookupResult unboundRes = referenceNotFound;
+        if (unboundLookupHelper != null) {
             MethodResolutionContext unboundSearchResolveContext =
                     new MethodResolutionContext();
             unboundSearchResolveContext.methodCheck = methodCheck;
-            unboundSym = origUnboundSym = lookupMethod(unboundEnv, env.tree.pos(),
+            unboundSym = lookupMethod(unboundEnv, env.tree.pos(),
                     site.tsym, unboundSearchResolveContext, unboundLookupHelper);
-
-            if (unboundSym.kind != WRONG_MTH && unboundSym.kind != WRONG_MTHS) {
-                if (shouldCheckForStaticness) {
-                    if (unboundSym.isStatic()) {
-                        staticErrorForUnbound = true;
-                        if (hasAnotherApplicableMethod(
-                                unboundSearchResolveContext, unboundSym, false)) {
-                            unboundSearchResultKind = SearchResultKind.BAD_MATCH_MORE_SPECIFIC;
-                        } else {
-                            unboundSearchResultKind = SearchResultKind.BAD_MATCH;
-                            if (!unboundSym.kind.isOverloadError()) {
-                                unboundSym = methodWithCorrectStaticnessNotFound;
-                            }
-                        }
-                    } else if (!unboundSym.kind.isOverloadError()) {
-                        unboundSearchResultKind = SearchResultKind.GOOD_MATCH;
-                    }
-                }
-            }
+            unboundRes = new ReferenceLookupResult(unboundSym, unboundSearchResolveContext);
         }
 
         //merge results
         Pair<Symbol, ReferenceLookupHelper> res;
-        Symbol bestSym = choose(boundSym, unboundSym);
-        if (!bestSym.kind.isOverloadError() &&
-            (staticErrorForBound || staticErrorForUnbound)) {
-            if (staticErrorForBound) {
-                boundSym = methodWithCorrectStaticnessNotFound;
-            }
-            if (staticErrorForUnbound) {
-                unboundSym = methodWithCorrectStaticnessNotFound;
-            }
-            bestSym = choose(boundSym, unboundSym);
-        }
-        if (bestSym == methodWithCorrectStaticnessNotFound && mode == AttrMode.CHECK) {
-            Symbol symToPrint = origBoundSym;
-            String errorFragmentToPrint = "non-static.cant.be.ref";
-            if (staticErrorForBound && staticErrorForUnbound) {
-                if (unboundSearchResultKind == SearchResultKind.BAD_MATCH_MORE_SPECIFIC) {
-                    symToPrint = origUnboundSym;
-                    errorFragmentToPrint = "static.method.in.unbound.lookup";
-                }
-            } else {
-                if (!staticErrorForBound) {
-                    symToPrint = origUnboundSym;
-                    errorFragmentToPrint = "static.method.in.unbound.lookup";
-                }
-            }
-            log.error(referenceTree.expr.pos(), "invalid.mref",
-                Kinds.kindName(referenceTree.getMode()),
-                diags.fragment(errorFragmentToPrint,
-                Kinds.kindName(symToPrint), symToPrint));
-        }
+        Symbol bestSym = referenceChooser.result(boundRes, unboundRes);
         res = new Pair<>(bestSym,
                 bestSym == unboundSym ? unboundLookupHelper : boundLookupHelper);
         env.info.pendingResolutionPhase = bestSym == unboundSym ?
@@ -2892,67 +2764,213 @@
         return res;
     }
 
-    enum SearchResultKind {
-        GOOD_MATCH,                 //type I
-        BAD_MATCH_MORE_SPECIFIC,    //type II
-        BAD_MATCH,                  //type III
-        NOT_APPLICABLE_MATCH        //type IV
-    }
-
-    boolean hasAnotherApplicableMethod(MethodResolutionContext resolutionContext,
-            Symbol bestSoFar, boolean staticMth) {
-        for (Candidate c : resolutionContext.candidates) {
-            if (resolutionContext.step != c.step ||
-                !c.isApplicable() ||
-                c.sym == bestSoFar) {
-                continue;
-            } else {
-                if (c.sym.isStatic() == staticMth) {
-                    return true;
+    /**
+     * This class is used to represent a method reference lookup result. It keeps track of two
+     * things: (i) the symbol found during a method reference lookup and (ii) the static kind
+     * of the lookup (see {@link com.sun.tools.javac.comp.Resolve.ReferenceLookupResult.StaticKind}).
+     */
+    static class ReferenceLookupResult {
+
+        /**
+         * Static kind associated with a method reference lookup. Erroneous lookups end up with
+         * the UNDEFINED kind; successful lookups will end up with either STATIC, NON_STATIC,
+         * depending on whether all applicable candidates are static or non-static methods,
+         * respectively. If a successful lookup has both static and non-static applicable methods,
+         * its kind is set to BOTH.
+         */
+        enum StaticKind {
+            STATIC,
+            NON_STATIC,
+            BOTH,
+            UNDEFINED;
+
+            /**
+             * Retrieve the static kind associated with a given (method) symbol.
+             */
+            static StaticKind from(Symbol s) {
+                return s.isStatic() ?
+                        STATIC : NON_STATIC;
+            }
+
+            /**
+             * Merge two static kinds together.
+             */
+            static StaticKind reduce(StaticKind sk1, StaticKind sk2) {
+                if (sk1 == UNDEFINED) {
+                    return sk2;
+                } else if (sk2 == UNDEFINED) {
+                    return sk1;
+                } else {
+                    return sk1 == sk2 ? sk1 : BOTH;
                 }
             }
         }
-        return false;
-    }
-
-    //where
-        private Symbol choose(Symbol boundSym, Symbol unboundSym) {
-            if (lookupSuccess(boundSym) && lookupSuccess(unboundSym)) {
-                return ambiguityError(boundSym, unboundSym);
-            } else if (lookupSuccess(boundSym) ||
-                    (canIgnore(unboundSym) && !canIgnore(boundSym))) {
-                return boundSym;
-            } else if (lookupSuccess(unboundSym) ||
-                    (canIgnore(boundSym) && !canIgnore(unboundSym))) {
-                return unboundSym;
-            } else {
-                return boundSym;
+
+        /** The static kind. */
+        StaticKind staticKind;
+
+        /** The lookup result. */
+        Symbol sym;
+
+        ReferenceLookupResult(Symbol sym, MethodResolutionContext resolutionContext) {
+            this.staticKind = staticKind(sym, resolutionContext);
+            this.sym = sym;
+        }
+
+        private StaticKind staticKind(Symbol sym, MethodResolutionContext resolutionContext) {
+            switch (sym.kind) {
+                case MTH:
+                case AMBIGUOUS:
+                    return resolutionContext.candidates.stream()
+                            .filter(c -> c.isApplicable() && c.step == resolutionContext.step)
+                            .map(c -> StaticKind.from(c.sym))
+                            .reduce(StaticKind::reduce)
+                            .orElse(StaticKind.UNDEFINED);
+                case HIDDEN:
+                    return StaticKind.from(((AccessError)sym).sym);
+                default:
+                    return StaticKind.UNDEFINED;
             }
         }
 
-        private boolean lookupSuccess(Symbol s) {
-            return s.kind == MTH || s.kind == AMBIGUOUS;
+        /**
+         * Does this result corresponds to a successful lookup (i.e. one where a method has been found?)
+         */
+        boolean isSuccess() {
+            return staticKind != StaticKind.UNDEFINED;
         }
 
-        private boolean canIgnore(Symbol s) {
-            switch (s.kind) {
+        /**
+         * Does this result have given static kind?
+         */
+        boolean hasKind(StaticKind sk) {
+            return this.staticKind == sk;
+        }
+
+        /**
+         * Error recovery helper: can this lookup result be ignored (for the purpose of returning
+         * some 'better' result) ?
+         */
+        boolean canIgnore() {
+            switch (sym.kind) {
                 case ABSENT_MTH:
                     return true;
                 case WRONG_MTH:
                     InapplicableSymbolError errSym =
-                            (InapplicableSymbolError)s.baseSymbol();
+                            (InapplicableSymbolError)sym.baseSymbol();
                     return new Template(MethodCheckDiag.ARITY_MISMATCH.regex())
                             .matches(errSym.errCandidate().snd);
                 case WRONG_MTHS:
                     InapplicableSymbolsError errSyms =
-                            (InapplicableSymbolsError)s.baseSymbol();
+                            (InapplicableSymbolsError)sym.baseSymbol();
                     return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty();
-                case WRONG_STATICNESS:
-                    return false;
                 default:
                     return false;
             }
         }
+    }
+
+    /**
+     * This abstract class embodies the logic that converts one (bound lookup) or two (unbound lookup)
+     * {@code ReferenceLookupResult} objects into a (@code Symbol), which is then regarded as the
+     * result of method reference resolution.
+     */
+    abstract class ReferenceChooser {
+        /**
+         * Generate a result from a pair of lookup result objects. This method delegates to the
+         * appropriate result generation routine.
+         */
+        Symbol result(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+            return unboundRes != referenceNotFound ?
+                    unboundResult(boundRes, unboundRes) :
+                    boundResult(boundRes);
+        }
+
+        /**
+         * Generate a symbol from a given bound lookup result.
+         */
+        abstract Symbol boundResult(ReferenceLookupResult boundRes);
+
+        /**
+         * Generate a symbol from a pair of bound/unbound lookup results.
+         */
+        abstract Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes);
+    }
+
+    /**
+     * This chooser implements the selection strategy used during a full lookup; this logic
+     * is described in JLS SE 8 (15.3.2).
+     */
+    ReferenceChooser basicReferenceChooser = new ReferenceChooser() {
+
+        @Override
+        Symbol boundResult(ReferenceLookupResult boundRes) {
+            return !boundRes.isSuccess() || boundRes.hasKind(StaticKind.NON_STATIC) ?
+                    boundRes.sym : //the search produces a non-static method
+                    new BadMethodReferenceError(boundRes.sym, false);
+        }
+
+        @Override
+        Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+            if (boundRes.hasKind(StaticKind.STATIC) &&
+                    (!unboundRes.isSuccess() || unboundRes.hasKind(StaticKind.STATIC))) {
+                //the first search produces a static method and no non-static method is applicable
+                //during the second search
+                return boundRes.sym;
+            } else if (unboundRes.hasKind(StaticKind.NON_STATIC) &&
+                    (!boundRes.isSuccess() || boundRes.hasKind(StaticKind.NON_STATIC))) {
+                //the second search produces a non-static method and no static method is applicable
+                //during the first search
+                return unboundRes.sym;
+            } else if (boundRes.isSuccess() && unboundRes.isSuccess()) {
+                //both searches produce some result; ambiguity (error recovery)
+                return ambiguityError(boundRes.sym, unboundRes.sym);
+            } else if (boundRes.isSuccess() || unboundRes.isSuccess()) {
+                //Both searches failed to produce a result with correct staticness (i.e. first search
+                //produces an non-static method). Alternatively, a given search produced a result
+                //with the right staticness, but the other search has applicable methods with wrong
+                //staticness (error recovery)
+                return new BadMethodReferenceError(boundRes.isSuccess() ? boundRes.sym : unboundRes.sym, true);
+            } else {
+                //both searches fail to produce a result - pick 'better' error using heuristics (error recovery)
+                return (boundRes.canIgnore() && !unboundRes.canIgnore()) ?
+                        unboundRes.sym : boundRes.sym;
+            }
+        }
+    };
+
+    /**
+     * This chooser implements the selection strategy used during an arity-based lookup; this logic
+     * is described in JLS SE 8 (15.12.2.1).
+     */
+    ReferenceChooser structuralReferenceChooser = new ReferenceChooser() {
+
+        @Override
+        Symbol boundResult(ReferenceLookupResult boundRes) {
+            return (!boundRes.isSuccess() || !boundRes.hasKind(StaticKind.STATIC)) ?
+                    boundRes.sym : //the search has at least one applicable non-static method
+                    new BadMethodReferenceError(boundRes.sym, false);
+        }
+
+        @Override
+        Symbol unboundResult(ReferenceLookupResult boundRes, ReferenceLookupResult unboundRes) {
+            if (boundRes.isSuccess() && !boundRes.hasKind(StaticKind.NON_STATIC)) {
+                //the first serach has at least one applicable static method
+                return boundRes.sym;
+            } else if (unboundRes.isSuccess() && !unboundRes.hasKind(StaticKind.STATIC)) {
+                //the second search has at least one applicable non-static method
+                return unboundRes.sym;
+            } else if (boundRes.isSuccess() || unboundRes.isSuccess()) {
+                //either the first search produces a non-static method, or second search produces
+                //a non-static method (error recovery)
+                return new BadMethodReferenceError(boundRes.isSuccess() ? boundRes.sym : unboundRes.sym, true);
+            } else {
+                //both searches fail to produce a result - pick 'better' error using heuristics (error recovery)
+                return (boundRes.canIgnore() && !unboundRes.canIgnore()) ?
+                        unboundRes.sym : boundRes.sym;
+            }
+        }
+    };
 
     /**
      * Helper for defining custom method-like lookup logic; a lookup helper
@@ -3070,22 +3088,7 @@
          * method returns an dummy lookup helper.
          */
         ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
-            //dummy loopkup helper that always return 'methodNotFound'
-            return new ReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase) {
-                @Override
-                ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
-                    return this;
-                }
-                @Override
-                Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
-                    return methodNotFound;
-                }
-                @Override
-                ReferenceKind referenceKind(Symbol sym) {
-                    Assert.error();
-                    return null;
-                }
-            };
+            return null;
         }
 
         /**
@@ -3124,12 +3127,31 @@
 
         @Override
         ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
-            if (TreeInfo.isStaticSelector(referenceTree.expr, names) &&
-                    argtypes.nonEmpty() &&
-                    (argtypes.head.hasTag(NONE) ||
-                    types.isSubtypeUnchecked(inferenceContext.asUndetVar(argtypes.head), site))) {
-                return new UnboundMethodReferenceLookupHelper(referenceTree, name,
-                        site, argtypes, typeargtypes, maxPhase);
+            if (TreeInfo.isStaticSelector(referenceTree.expr, names)) {
+                if (argtypes.nonEmpty() &&
+                        (argtypes.head.hasTag(NONE) ||
+                        types.isSubtypeUnchecked(inferenceContext.asUndetVar(argtypes.head), site))) {
+                    return new UnboundMethodReferenceLookupHelper(referenceTree, name,
+                            site, argtypes, typeargtypes, maxPhase);
+                } else {
+                    return new ReferenceLookupHelper(referenceTree, name, site, argtypes, typeargtypes, maxPhase) {
+                        @Override
+                        ReferenceLookupHelper unboundLookup(InferenceContext inferenceContext) {
+                            return this;
+                        }
+
+                        @Override
+                        Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
+                            return methodNotFound;
+                        }
+
+                        @Override
+                        ReferenceKind referenceKind(Symbol sym) {
+                            Assert.error();
+                            return null;
+                        }
+                    };
+                }
             } else {
                 return super.unboundLookup(inferenceContext);
             }
@@ -3231,16 +3253,10 @@
                 findDiamond(env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()) :
                 findMethod(env, site, name, argtypes, typeargtypes,
                         phase.isBoxingRequired(), phase.isVarargsRequired(), syms.operatorNames.contains(name));
-            return sym.kind != MTH ||
-                          site.getEnclosingType().hasTag(NONE) ||
-                          hasEnclosingInstance(env, site) ?
-                          sym : new InvalidSymbolError(MISSING_ENCL, sym, null) {
-                    @Override
-                    JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
-                       return diags.create(dkind, log.currentSource(), pos,
-                            "cant.access.inner.cls.constr", site.tsym.name, argtypes, site.getEnclosingType());
-                    }
-                };
+            return (sym.kind != MTH ||
+                    site.getEnclosingType().hasTag(NONE) ||
+                    hasEnclosingInstance(env, site)) ?
+                    sym : new BadConstructorReferenceError(sym);
         }
 
         @Override
@@ -3613,8 +3629,7 @@
                 hasLocation = !location.name.equals(names._this) &&
                         !location.name.equals(names._super);
             }
-            boolean isConstructor = (kind == ABSENT_MTH || kind == WRONG_STATICNESS) &&
-                    name == names.init;
+            boolean isConstructor = name == names.init;
             KindName kindname = isConstructor ? KindName.CONSTRUCTOR : kind.absentKind();
             Name idname = isConstructor ? site.tsym.name : name;
             String errKey = getErrorKey(kindname, typeargtypes.nonEmpty(), hasLocation);
@@ -4019,13 +4034,13 @@
             Name sname = s1.name;
             if (sname == names.init) sname = s1.owner.name;
             return diags.create(dkind, log.currentSource(),
-                      pos, "ref.ambiguous", sname,
-                      kindName(s1),
-                      s1,
-                      s1.location(site, types),
-                      kindName(s2),
-                      s2,
-                      s2.location(site, types));
+                    pos, "ref.ambiguous", sname,
+                    kindName(s1),
+                    s1,
+                    s1.location(site, types),
+                    kindName(s2),
+                    s2,
+                    s2.location(site, types));
         }
 
         /**
@@ -4108,6 +4123,52 @@
     }
 
     /**
+     * BadMethodReferenceError error class indicating that a method reference symbol has been found,
+     * but with the wrong staticness.
+     */
+    class BadMethodReferenceError extends StaticError {
+
+        boolean unboundLookup;
+
+        public BadMethodReferenceError(Symbol sym, boolean unboundLookup) {
+            super(sym);
+            this.unboundLookup = unboundLookup;
+        }
+
+        @Override
+        JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+            final String key;
+            if (!unboundLookup) {
+                key = "bad.static.method.in.bound.lookup";
+            } else if (sym.isStatic()) {
+                key = "bad.static.method.in.unbound.lookup";
+            } else {
+                key = "bad.instance.method.in.unbound.lookup";
+            }
+            return sym.kind.isOverloadError() ?
+                    ((ResolveError)sym).getDiagnostic(dkind, pos, location, site, name, argtypes, typeargtypes) :
+                    diags.create(dkind, log.currentSource(), pos, key, Kinds.kindName(sym), sym);
+        }
+    }
+
+    /**
+     * BadConstructorReferenceError error class indicating that a constructor reference symbol has been found,
+     * but pointing to a class for which an enclosing instance is not available.
+     */
+    class BadConstructorReferenceError extends InvalidSymbolError {
+
+        public BadConstructorReferenceError(Symbol sym) {
+            super(MISSING_ENCL, sym, "BadConstructorReferenceError");
+        }
+
+        @Override
+        JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+           return diags.create(dkind, log.currentSource(), pos,
+                "cant.access.inner.cls.constr", site.tsym.name, argtypes, site.getEnclosingType());
+        }
+    }
+
+    /**
      * Helper class for method resolution diagnostic simplification.
      * Certain resolution diagnostic are rewritten as simpler diagnostic
      * where the enclosing resolution diagnostic (i.e. 'inapplicable method')
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1000,6 +1000,7 @@
              l.nonEmpty();
              l = l.tail) {
             ClassSymbol inner = l.head;
+            inner.markAbstractIfNeeded(types);
             char flags = (char) adjustFlags(inner.flags_field);
             if ((flags & INTERFACE) != 0) flags |= ABSTRACT; // Interfaces are always ABSTRACT
             if (inner.name.isEmpty()) flags &= ~FINAL; // Anonymous class: unset FINAL flag
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1209,15 +1209,7 @@
                             if (annos.nonEmpty()) {
                                 t = toP(F.at(pos).AnnotatedType(annos, t));
                             }
-                            // .class is only allowed if there were no annotations
-                            JCExpression nt = bracketsSuffix(t);
-                            if (nt != t && (annos.nonEmpty() || TreeInfo.containsTypeAnnotation(t))) {
-                                // t and nt are different if bracketsSuffix parsed a .class.
-                                // The check for nonEmpty covers the case when the whole array is annotated.
-                                // Helper method isAnnotated looks for annos deeply within t.
-                                syntaxError("no.annotations.on.dot.class");
-                            }
-                            t = nt;
+                            t = bracketsSuffix(t);
                         } else {
                             if ((mode & EXPR) != 0) {
                                 mode = EXPR;
@@ -1956,6 +1948,12 @@
                 }
                 t = F.at(pos).Erroneous(List.<JCTree>of(toP(F.at(pos).Select(t, name))));
             } else {
+                Tag tag = t.getTag();
+                // Type annotations are illegal on class literals. Annotated non array class literals
+                // are complained about directly in term3(), Here check for type annotations on dimensions
+                // taking care to handle some interior dimension(s) being annotated.
+                if ((tag == TYPEARRAY && TreeInfo.containsTypeAnnotation(t)) || tag == ANNOTATED_TYPE)
+                    syntaxError("no.annotations.on.dot.class");
                 t = toP(F.at(pos).Select(t, names._class));
             }
         } else if ((mode & TYPE) != 0) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacMessager.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 import com.sun.tools.javac.model.JavacElements;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.*;
 import javax.lang.model.element.*;
@@ -113,13 +114,7 @@
             switch (kind) {
             case ERROR:
                 errorCount++;
-                boolean prev = log.multipleErrors;
-                log.multipleErrors = true;
-                try {
-                    log.error(pos, "proc.messager", msg.toString());
-                } finally {
-                    log.multipleErrors = prev;
-                }
+                log.error(DiagnosticFlag.MULTIPLE, pos, "proc.messager", msg.toString());
                 break;
 
             case WARNING:
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Jan 20 10:22:43 2015 -0800
@@ -262,9 +262,6 @@
 compiler.misc.static.mref.with.targs=\
     parameterized qualifier on static method reference
 
-compiler.misc.static.bound.mref=\
-    static bound method reference
-
 # 0: symbol
 compiler.err.cant.assign.val.to.final.var=\
     cannot assign a value to final variable {0}
@@ -2050,12 +2047,16 @@
     non-static {0} {1} cannot be referenced from a static context
 
 # 0: symbol kind, 1: symbol
-compiler.misc.non-static.cant.be.ref=\
-    non-static {0} {1} cannot be referenced from a static context
+compiler.misc.bad.static.method.in.unbound.lookup=\
+    unexpected static {0} {1} found in unbound lookup
 
 # 0: symbol kind, 1: symbol
-compiler.misc.static.method.in.unbound.lookup=\
-    static {0} {1} found in unbound lookup
+compiler.misc.bad.instance.method.in.unbound.lookup=\
+    unexpected instance {0} {1} found in unbound lookup
+
+# 0: symbol kind, 1: symbol
+compiler.misc.bad.static.method.in.bound.lookup=\
+    unexpected static {0} {1} found in bound lookup
 
 ## Both arguments ({0}, {1}) are "kindname"s.  {0} is a comma-separated list
 ## of kindnames (the list should be identical to that provided in source.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
          */
         public JCDiagnostic error(
                 DiagnosticFlag flag, DiagnosticSource source, DiagnosticPosition pos, Error errorKey) {
-            JCDiagnostic diag = create(null, defaultErrorFlags, source, pos, errorKey);
+            JCDiagnostic diag = create(null, EnumSet.copyOf(defaultErrorFlags), source, pos, errorKey);
             if (flag != null) {
                 diag.setFlag(flag);
             }
@@ -432,7 +432,10 @@
         SYNTAX,
         RECOVERABLE,
         NON_DEFERRABLE,
-        COMPRESSED
+        COMPRESSED,
+        /** Print multiple errors for same source locations.
+         */
+        MULTIPLE;
     }
 
     private final DiagnosticSource source;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java	Tue Jan 20 10:22:43 2015 -0800
@@ -33,6 +33,7 @@
 import java.util.AbstractCollection;
 import java.util.ListIterator;
 import java.util.NoSuchElementException;
+import java.util.stream.Collector;
 
 /** A class for generic linked lists. Links are supposed to be
  *  immutable, the only exception being the incremental construction of
@@ -537,4 +538,14 @@
 
         return Collections.unmodifiableList(a);
     }
+
+    /**
+     * Collect elements into a new list (using a @code{ListBuffer})
+     */
+    public static <Z> Collector<Z, ListBuffer<Z>, List<Z>> collector() {
+        return Collector.of(ListBuffer::new,
+                (buf, el)->buf.add(el),
+                (buf1, buf2)-> { buf1.addAll(buf2); return buf1; },
+                buf->buf.toList());
+    }
 }
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
 import com.sun.tools.javac.main.Main;
 import com.sun.tools.javac.main.Option;
 import com.sun.tools.javac.tree.EndPosTable;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
 
@@ -191,10 +192,6 @@
      */
     public boolean dumpOnError;
 
-    /** Print multiple errors for same source locations.
-     */
-    public boolean multipleErrors;
-
     /**
      * Diagnostic listener, if provided through programmatic
      * interface to javac (JSR 199).
@@ -417,7 +414,7 @@
      * source name and pos.
      */
     protected boolean shouldReport(JavaFileObject file, int pos) {
-        if (multipleErrors || file == null)
+        if (file == null)
             return true;
 
         Pair<JavaFileObject,Integer> coords = new Pair<>(file, pos);
@@ -580,8 +577,9 @@
                 break;
 
             case ERROR:
-                if (nerrors < MaxErrors
-                    && shouldReport(diagnostic.getSource(), diagnostic.getIntPosition())) {
+                if (nerrors < MaxErrors &&
+                    (diagnostic.isFlagSet(DiagnosticFlag.MULTIPLE) ||
+                     shouldReport(diagnostic.getSource(), diagnostic.getIntPosition()))) {
                     writeDiagnostic(diagnostic);
                     nerrors++;
                 }
--- a/langtools/test/tools/doclint/AnchorTest.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/doclint/AnchorTest.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,4 +1,4 @@
-AnchorTest.java:19: error: anchor already defined: foo
+AnchorTest.java:19: error: anchor already defined: "foo"
      * <a name=foo></a>
           ^
 AnchorTest.java:24: error: invalid name for anchor: ""
@@ -10,28 +10,40 @@
 AnchorTest.java:34: error: no value given for anchor
      * <a name ></a>
           ^
-AnchorTest.java:46: error: anchor already defined: foo
+AnchorTest.java:46: error: anchor already defined: "foo"
      * <a id=foo></a>
           ^
 AnchorTest.java:51: error: invalid name for anchor: ""
      * <a id=></a>
           ^
+AnchorTest.java:51: error: anchor already defined: ""
+     * <a id=></a>
+          ^
 AnchorTest.java:56: error: invalid name for anchor: "123"
      * <a id=123 ></a>
           ^
+AnchorTest.java:56: error: anchor already defined: "123"
+     * <a id=123 ></a>
+          ^
 AnchorTest.java:61: error: no value given for anchor
      * <a id ></a>
           ^
-AnchorTest.java:73: error: anchor already defined: foo
+AnchorTest.java:73: error: anchor already defined: "foo"
      * <p id=foo>text</p>
           ^
 AnchorTest.java:78: error: invalid name for anchor: ""
      * <p id=>text</p>
           ^
+AnchorTest.java:78: error: anchor already defined: ""
+     * <p id=>text</p>
+          ^
 AnchorTest.java:83: error: invalid name for anchor: "123"
      * <p id=123 >text</p>
           ^
+AnchorTest.java:83: error: anchor already defined: "123"
+     * <p id=123 >text</p>
+          ^
 AnchorTest.java:88: error: no value given for anchor
      * <p id >text</p>
           ^
-12 errors
+16 errors
--- a/langtools/test/tools/doclint/AnchorTest2.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/doclint/AnchorTest2.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,4 +1,4 @@
-AnchorTest2.java:15: error: anchor already defined: AnchorTest2
+AnchorTest2.java:15: error: anchor already defined: "AnchorTest2"
     /** <a name="AnchorTest2"> </a> */
            ^
 1 error
--- a/langtools/test/tools/doclint/HtmlTagsTest.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/doclint/HtmlTagsTest.out	Tue Jan 20 10:22:43 2015 -0800
@@ -13,6 +13,9 @@
 HtmlTagsTest.java:28: error: element not allowed in documentation comments: <html>
      * <html>
        ^
+HtmlTagsTest.java:28: error: element not closed: html
+     * <html>
+       ^
 HtmlTagsTest.java:33: error: block element not allowed within inline element <span>: p
      * <span> <p> </span>
               ^
@@ -40,5 +43,5 @@
 HtmlTagsTest.java:64: error: tag not allowed here: <b>
      * <ul> <b>text</b> <li> ... </li> </ul>
             ^
-13 errors
-1 warning
+14 errors
+1 warning
\ No newline at end of file
--- a/langtools/test/tools/doclint/anchorTests/p/Test.javac.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/doclint/anchorTests/p/Test.javac.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,7 +1,7 @@
-Test.java:14:7: compiler.err.proc.messager: anchor already defined: dupTest
-Test.java:24:12: compiler.err.proc.messager: anchor already defined: dupTestField
-Test.java:27:12: compiler.err.proc.messager: anchor already defined: dupTestMethod
-Test.java:32:11: compiler.err.proc.messager: anchor already defined: dupNested
-Test.java:40:15: compiler.err.proc.messager: anchor already defined: dupNestedField
-Test.java:47:15: compiler.err.proc.messager: anchor already defined: dupNestedMethod
+Test.java:14:7: compiler.err.proc.messager: anchor already defined: "dupTest"
+Test.java:24:12: compiler.err.proc.messager: anchor already defined: "dupTestField"
+Test.java:27:12: compiler.err.proc.messager: anchor already defined: "dupTestMethod"
+Test.java:32:11: compiler.err.proc.messager: anchor already defined: "dupNested"
+Test.java:40:15: compiler.err.proc.messager: anchor already defined: "dupNestedField"
+Test.java:47:15: compiler.err.proc.messager: anchor already defined: "dupNestedMethod"
 6 errors
--- a/langtools/test/tools/doclint/anchorTests/p/Test.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/doclint/anchorTests/p/Test.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,19 +1,19 @@
-Test.java:14: error: anchor already defined: dupTest
+Test.java:14: error: anchor already defined: "dupTest"
  * <a name="dupTest">dupTest again</a>
       ^
-Test.java:24: error: anchor already defined: dupTestField
+Test.java:24: error: anchor already defined: "dupTestField"
     /** <a name="dupTestField">dupTestField again</a> */
            ^
-Test.java:27: error: anchor already defined: dupTestMethod
+Test.java:27: error: anchor already defined: "dupTestMethod"
     /** <a name="dupTestMethod">dupTestMethod again</a> */
            ^
-Test.java:32: error: anchor already defined: dupNested
+Test.java:32: error: anchor already defined: "dupNested"
      * <a name="dupNested">dupNested again</a>
           ^
-Test.java:40: error: anchor already defined: dupNestedField
+Test.java:40: error: anchor already defined: "dupNestedField"
          * <a name="dupNestedField">dupNestedField</a>
               ^
-Test.java:47: error: anchor already defined: dupNestedMethod
+Test.java:47: error: anchor already defined: "dupNestedMethod"
          * <a name="dupNestedMethod">dupNestedMethod</a>
               ^
 6 errors
--- a/langtools/test/tools/doclint/anchorTests/p/package-info.javac.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/doclint/anchorTests/p/package-info.javac.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,2 +1,2 @@
-package-info.java:12:7: compiler.err.proc.messager: anchor already defined: here
+package-info.java:12:7: compiler.err.proc.messager: anchor already defined: "here"
 1 error
--- a/langtools/test/tools/doclint/anchorTests/p/package-info.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/doclint/anchorTests/p/package-info.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,4 +1,4 @@
-package-info.java:12: error: anchor already defined: here
+package-info.java:12: error: anchor already defined: "here"
  * <a name=here>here again</a>
       ^
 1 error
--- a/langtools/test/tools/doclint/tidy/AnchorAlreadyDefined.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/doclint/tidy/AnchorAlreadyDefined.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,7 +1,7 @@
-AnchorAlreadyDefined.java:14: error: anchor already defined: here
+AnchorAlreadyDefined.java:14: error: anchor already defined: "here"
  * <a name="here">duplicate</a>
       ^
-AnchorAlreadyDefined.java:15: error: anchor already defined: here
+AnchorAlreadyDefined.java:15: error: anchor already defined: "here"
  * <h1 id="here">duplicate</h1>
        ^
 2 errors
--- a/langtools/test/tools/javac/6304921/TestLog.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/6304921/TestLog.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,10 +26,11 @@
  * @bug 6304912
  * @summary unit test for Log
  */
+import java.lang.reflect.Field;
 import java.io.InputStream;
-import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URI;
+import java.util.Set;
 import javax.tools.JavaFileObject;
 import javax.tools.SimpleJavaFileObject;
 import com.sun.tools.javac.file.JavacFileManager;
@@ -41,23 +42,34 @@
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
+import com.sun.tools.javac.util.JCDiagnostic.Factory;
 import com.sun.tools.javac.util.Options;
 
 public class TestLog
 {
-    public static void main(String... args) throws IOException {
+    public static void main(String... args) throws Exception {
         test(false);
         test(true);
     }
 
-    static void test(boolean genEndPos) throws IOException {
+    static void test(boolean genEndPos) throws Exception {
         Context context = new Context();
 
         Options options = Options.instance(context);
         options.put("diags", "%b:%s/%o/%e:%_%t%m|%p%m");
 
         Log log = Log.instance(context);
-        log.multipleErrors = true;
+        Factory diagnosticFactory = JCDiagnostic.Factory.instance(context);
+        Field defaultErrorFlagsField =
+                JCDiagnostic.Factory.class.getDeclaredField("defaultErrorFlags");
+
+        defaultErrorFlagsField.setAccessible(true);
+
+        Set<DiagnosticFlag> defaultErrorFlags =
+                (Set<DiagnosticFlag>) defaultErrorFlagsField.get(diagnosticFactory);
+
+        defaultErrorFlags.add(DiagnosticFlag.MULTIPLE);
 
         JavacFileManager.preRegister(context);
         ParserFactory pfac = ParserFactory.instance(context);
--- a/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java	Tue Jan 20 10:22:43 2015 -0800
@@ -147,6 +147,7 @@
         public int mAttrs;
         public int mNumParams;
         public boolean mSynthetic;
+        public boolean mIsLambda;
         public boolean mIsConstructor;
         public boolean mIsClinit;
         public boolean mIsBridge;
@@ -165,6 +166,7 @@
             mIsClinit = mName.equals("<clinit>");
             prefix = cname + "." + mName + "() - ";
             mIsBridge = method.access_flags.is(AccessFlags.ACC_BRIDGE);
+            mIsLambda = mSynthetic && mName.startsWith("lambda$");
 
             if (mIsClinit) {
                 sb = new StringBuilder(); // Discard output
@@ -225,7 +227,7 @@
 
             // IMPL: Whether MethodParameters attributes will be generated
             // for some synthetics is unresolved. For now, assume no.
-            if (mSynthetic) {
+            if (mSynthetic && !mIsLambda) {
                 warn(prefix + "synthetic has MethodParameter attribute");
             }
 
@@ -349,10 +351,12 @@
             } else if (isEnum && mNumParams == 1 && index == 0 && mName.equals("valueOf")) {
                 expect = "name";
                 allowMandated = true;
-            } else if (mIsBridge) {
+            } else if (mIsBridge || mIsLambda) {
                 allowSynthetic = true;
                 /*  you can't expect an special name for bridges' parameters.
-                 *  The name of the original parameters are now copied.
+                 *  The name of the original parameters are now copied. Likewise
+                 *  for a method encoding the lambda expression, names are derived
+                 *  from source lambda's parameters and captured enclosing locals.
                  */
                 expect = null;
             }
--- a/langtools/test/tools/javac/MethodParameters/LambdaTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8006582
+ * @bug 8006582 8037546
  * @summary javac should generate method parameters correctly.
  * @build Tester
  * @compile -parameters LambdaTest.java
@@ -31,8 +31,8 @@
  */
 
 /**
- * Parameter names are not recorded for lambdas. This test verifies
- * that there are no MethodParameters attribute for lambdas.
+ * Post https://bugs.openjdk.java.net/browse/JDK-8037546, this test verifies
+ * that MethodParameters attribute for lambdas are emitted properly.
  */
 class LambdaTest {
 
--- a/langtools/test/tools/javac/MethodParameters/LambdaTest.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,7 +1,7 @@
 class LambdaTest -- 
 LambdaTest.<init>()
 LambdaTest.foo(i)
-LambdaTest.lambda$static$1(arg0)/*synthetic*/
-LambdaTest.lambda$null$0(arg0, arg1)/*synthetic*/
+LambdaTest.lambda$static$1(x1/*synthetic*/)/*synthetic*/
+LambdaTest.lambda$null$0(final cap$0/*synthetic*/, x2/*synthetic*/)/*synthetic*/
 static interface LambdaTest$I -- inner
 LambdaTest$I.m(x)
--- a/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java	Tue Jan 20 10:22:43 2015 -0800
@@ -277,7 +277,7 @@
                     param = "final " + param;
                 }
                 sb.append(sep).append(param);
-                if (!m.isBridge() && !expect.equals(param)) {
+                if (!m.isBridge() && !m.getName().startsWith("lambda$") && !expect.equals(param)) {
                     error(prefix + "param[" + i + "]='"
                           + param + "' expected '" + expect + "'");
                     break;
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedClassExpr.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedClassExpr.java	Tue Jan 20 10:22:43 2015 -0800
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8027262
+ * @bug 8027262 8027888
  * @summary A class expression cannot be annotated.
  * @compile/fail/ref=AnnotatedClassExpr.out -XDrawDiagnostics AnnotatedClassExpr.java
  */
@@ -10,6 +10,12 @@
 class AnnotatedClassExpr {
   static void main() {
     Object o1 = @A int.class;
+    o1 = @A int [] . class;
+    o1 = int @A [] . class;
+    o1 = int [] @A [] . class;
+    o1 = AnnotatedClassExpr @A [] .class;
+    o1 = @A AnnotatedClassExpr @A [] .class;
+    o1 = @A AnnotatedClassExpr.class;
   }
 }
 
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedClassExpr.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedClassExpr.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,2 +1,8 @@
 AnnotatedClassExpr.java:12:29: compiler.err.no.annotations.on.dot.class
-1 error
+AnnotatedClassExpr.java:13:27: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:14:27: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:15:30: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:16:41: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:17:44: compiler.err.no.annotations.on.dot.class
+AnnotatedClassExpr.java:18:37: compiler.err.no.annotations.on.dot.class
+7 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/InnerClasses/T8068517.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/** @test
+ *  @bug 8034854
+ *  @summary Verify that nested enums have correct abstract flag in the InnerClasses attribute.
+ *  @library /tools/lib
+ *  @build ToolBox T8068517
+ *  @run main T8068517
+ */
+
+import com.sun.tools.javac.util.Assert;
+import java.util.Arrays;
+import javax.tools.JavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+
+public class T8068517 {
+
+    public static void main(String[] args) throws Exception {
+        new T8068517().run();
+    }
+
+    void run() throws Exception {
+        runTest("class A {\n" +
+                "    enum AInner implements Runnable {\n" +
+                "        A {\n" +
+                "            public void run() {}\n" +
+                "        };\n" +
+                "    }\n" +
+                "}\n",
+                "class B {\n" +
+                "    A.AInner a;\n" +
+                "}");
+        runTest("class A {\n" +
+                "    enum AInner implements Runnable {\n" +
+                "        A {\n" +
+                "            public void run() {}\n" +
+                "        };\n" +
+                "    }\n" +
+                "    AInner aInner;\n" +
+                "}\n",
+                "class B {\n" +
+                "    void test(A a) {;\n" +
+                "        switch (a.aInner) {\n" +
+                "            case A: break;\n" +
+                "        }\n" +
+                "    };\n" +
+                "}");
+        runTest("class A {\n" +
+                "    enum AInner implements Runnable {\n" +
+                "        A {\n" +
+                "            public void run() {}\n" +
+                "        };\n" +
+                "    }\n" +
+                "    AInner aInner;\n" +
+                "}\n",
+                "class B {\n" +
+                "    void test(A a) {;\n" +
+                "        System.err.println(a.aInner.toString());\n" +
+                "    };\n" +
+                "}");
+        runTest("class A {\n" +
+                "    enum AInner implements Runnable {\n" +
+                "        A {\n" +
+                "            public void run() {}\n" +
+                "        };\n" +
+                "    }\n" +
+                "    AInner aInner() {\n" +
+                "        return null;\n" +
+                "    }\n" +
+                "}\n",
+                "class B {\n" +
+                "    void test(A a) {;\n" +
+                "        System.err.println(a.aInner().toString());\n" +
+                "    };\n" +
+                "}");
+    }
+
+    void runTest(String aJava, String bJava) throws Exception {
+        try (JavaFileManager fm = ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
+            ToolBox tb = new ToolBox();
+            ToolBox.MemoryFileManager memoryFM1 = new ToolBox.MemoryFileManager(fm);
+            tb.new JavacTask().fileManager(memoryFM1)
+                              .sources(aJava, bJava)
+                              .run();
+            ToolBox.MemoryFileManager memoryFM2 = new ToolBox.MemoryFileManager(fm);
+            tb.new JavacTask().fileManager(memoryFM2)
+                              .sources(bJava, aJava)
+                              .run();
+
+            Assert.check(Arrays.equals(memoryFM1.getFileBytes(StandardLocation.CLASS_OUTPUT, "B"),
+                                       memoryFM2.getFileBytes(StandardLocation.CLASS_OUTPUT, "B")));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/BadInstanceMethodInUnboundLookup.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.bad.instance.method.in.unbound.lookup
+// key: compiler.misc.invalid.mref
+// key: compiler.err.prob.found.req
+
+class BadInstanceMethodInUnboundLookup {
+
+    interface SAM {
+        void m(Integer u);
+    }
+
+    void f(Integer i) { }
+
+    static void test() {
+        SAM s = BadInstanceMethodInUnboundLookup::f;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/BadStaticMethodInBoundLookup.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.invalid.mref
+// key: compiler.misc.bad.static.method.in.bound.lookup
+// key: compiler.err.prob.found.req
+
+class BadStaticMethodInBoundLookup {
+
+    Runnable r = new BadStaticMethodInBoundLookup()::m;
+
+    static void m() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/BadStaticMethodInUnboundLookup.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.invalid.mref
+// key: compiler.misc.bad.static.method.in.unbound.lookup
+// key: compiler.err.prob.found.req
+
+class BadStaticMethodInUnboundLookup {
+
+    interface SAM {
+        void m(BadStaticMethodInUnboundLookup m);
+    }
+
+    SAM s = BadStaticMethodInUnboundLookup::m;
+
+    static void m() { }
+}
--- a/langtools/test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.misc.non-static.cant.be.ref
-// key: compiler.err.invalid.mref
-
-class NonStaticCantBeRefFragment {
-
-    interface SAM {
-        void m(Integer u);
-    }
-
-    void f(Integer i) { }
-
-    static void test() {
-        SAM s = NonStaticCantBeRefFragment::f;
-    }
-}
--- a/langtools/test/tools/javac/diags/examples/StaticBoundMref.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.invalid.mref
-// key: compiler.misc.static.bound.mref
-
-class StaticBoundMref {
-
-    Runnable r = new StaticBoundMref()::m;
-
-    static void m() { }
-}
--- a/langtools/test/tools/javac/diags/examples/StaticMethodInUnboundLookup.java	Thu Jan 15 19:23:48 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.invalid.mref
-// key: compiler.misc.static.method.in.unbound.lookup
-
-class StaticBoundMref {
-
-    interface SAM {
-        void m(StaticBoundMref m);
-    }
-
-    SAM s = StaticBoundMref::m;
-
-    static void m() { }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/LowerBoundBottomTypeTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8062358
+ * @summary ClassCastException in TransTypes.visitApply
+ * @compile LowerBoundBottomTypeTest.java
+*/
+
+public class LowerBoundBottomTypeTest {
+    void g() {
+        f().getInIntf3().getInIntf2().getInIntf1().getA();
+    }
+    interface IntfA {
+        int getA();
+    }
+
+    interface Intf1<A extends IntfA> {
+        A getInIntf1();
+    }
+
+    interface Intf2<B> {
+        Intf1<? extends B> getInIntf2();
+    }
+
+    interface Intf3<C> {
+        Intf2<? extends C> getInIntf3();
+    }
+
+    Intf3<?> f() {
+        return null;
+    }
+}
--- a/langtools/test/tools/javac/lambda/MethodReference22.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/lambda/MethodReference22.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,9 +1,9 @@
-MethodReference22.java:40:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))
-MethodReference22.java:41:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @999, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.mref))
-MethodReference22.java:46:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
-MethodReference22.java:47:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @1270, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.mref))
-MethodReference22.java:55:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m3(MethodReference22,java.lang.String))
-MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1574, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.mref))
+MethodReference22.java:40:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m1(java.lang.String)))
+MethodReference22.java:41:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @999, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m1(java.lang.String)))
+MethodReference22.java:46:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m4(java.lang.String)))
+MethodReference22.java:47:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @1270, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m4(java.lang.String)))
+MethodReference22.java:55:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22))
+MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1574, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m3(MethodReference22,java.lang.String)))
 MethodReference22.java:57:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22))
 MethodReference22.java:58:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1667, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
 MethodReference22.java:63:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
--- a/langtools/test/tools/javac/lambda/MethodReference28.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/lambda/MethodReference28.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,7 +1,7 @@
 MethodReference28.java:31:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m2, java.lang.Integer,java.lang.Integer, int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch)))
 MethodReference28.java:32:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference28.java:33:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String))))
-MethodReference28.java:37:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.Integer))
+MethodReference28.java:37:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m1(java.lang.Integer)))
 MethodReference28.java:38:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.Integer,java.lang.Integer, int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch)))
 MethodReference28.java:39:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference28.java:40:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String))))
--- a/langtools/test/tools/javac/lambda/MethodReference51.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/lambda/MethodReference51.out	Tue Jan 20 10:22:43 2015 -0800
@@ -2,6 +2,6 @@
 MethodReference51.java:40:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, f, java.lang.String, int, kindname.class, MethodReference51, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference51.java:41:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, g, int,{(compiler.misc.inapplicable.method: kindname.method, MethodReference51, g(java.lang.Integer,java.lang.Number), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, MethodReference51, g(java.lang.Number,java.lang.Integer), (compiler.misc.arg.length.mismatch))}))
 MethodReference51.java:42:32: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: g, kindname.method, g(java.lang.Integer,java.lang.Number), MethodReference51, kindname.method, g(java.lang.Number,java.lang.Integer), MethodReference51))
-MethodReference51.java:43:21: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, h(int))
+MethodReference51.java:43:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, h(int)))
 MethodReference51.java:44:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.not.def.access.class.intf.cant.access: j(int), MethodReference51.Foo))
 6 errors
--- a/langtools/test/tools/javac/lambda/MethodReference55.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/lambda/MethodReference55.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,3 +1,3 @@
-MethodReference55.java:36:11: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.bound.mref)
-MethodReference55.java:39:11: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.bound.mref)
+MethodReference55.java:36:11: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object)))
+MethodReference55.java:39:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference55.V, @1384, kindname.class, MethodReference55<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object))))
 2 errors
--- a/langtools/test/tools/javac/lambda/MethodReference68.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/lambda/MethodReference68.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,3 +1,2 @@
 MethodReference68.java:21:10: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference68.F<Z>,Z[], @493,int, kindname.class, MethodReference68, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, MethodReference68.Foo,java.lang.Object)
-MethodReference68.java:21:12: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, getName())
-2 errors
+1 error
--- a/langtools/test/tools/javac/lambda/MethodReference73.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/lambda/MethodReference73.out	Tue Jan 20 10:22:43 2015 -0800
@@ -2,12 +2,12 @@
 MethodReference73.java:90:18: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference73,java.lang.String), MethodReference73, kindname.method, m2(java.lang.String), MethodReference73))
 MethodReference73.java:91:18: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference73,java.lang.String), MethodReference73, kindname.method, m3(java.lang.String), MethodReference73))
 MethodReference73.java:92:18: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference73,java.lang.String), MethodReference73, kindname.method, m4(java.lang.String), MethodReference73))
-MethodReference73.java:100:18: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m9(MethodReference73,java.lang.String))
-MethodReference73.java:101:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m10(MethodReference73,java.lang.String))
-MethodReference73.java:102:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.method.in.unbound.lookup: kindname.method, m11(java.lang.String))
-MethodReference73.java:103:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.method.in.unbound.lookup: kindname.method, m12(java.lang.String))
-MethodReference73.java:104:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m13(MethodReference73,java.lang.String))
-MethodReference73.java:105:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.static.method.in.unbound.lookup: kindname.method, m14(java.lang.String))
-MethodReference73.java:106:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m15(MethodReference73,java.lang.String))
+MethodReference73.java:100:18: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m9, kindname.method, m9(MethodReference73,java.lang.String), MethodReference73, kindname.method, m9(java.lang.String), MethodReference73))
+MethodReference73.java:101:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m10(MethodReference73,java.lang.String)))
+MethodReference73.java:102:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m11, kindname.method, m11(MethodReference73,java.lang.String), MethodReference73, kindname.method, m11(java.lang.String), MethodReference73))
+MethodReference73.java:103:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.unbound.lookup: kindname.method, m12(java.lang.String)))
+MethodReference73.java:104:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, m13(MethodReference73,java.lang.String)))
+MethodReference73.java:105:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.unbound.lookup: kindname.method, m14(java.lang.String)))
+MethodReference73.java:106:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m15, kindname.method, m15(MethodReference73,java.lang.String), MethodReference73, kindname.method, m15(java.lang.String), MethodReference73))
 MethodReference73.java:108:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, m16, MethodReference73,java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, MethodReference73, m16(MethodReference73,java.lang.String,int), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, MethodReference73, m16(java.lang.String,int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: MethodReference73, java.lang.String)))}))
 12 errors
--- a/langtools/test/tools/javac/lambda/TargetType60.out	Thu Jan 15 19:23:48 2015 -0800
+++ b/langtools/test/tools/javac/lambda/TargetType60.out	Tue Jan 20 10:22:43 2015 -0800
@@ -1,6 +1,6 @@
 TargetType60.java:54:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60
 TargetType60.java:55:21: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60
-TargetType60.java:61:27: compiler.err.cant.apply.symbols: kindname.method, u, @1639,{(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam1<U>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, n2, TargetType60,java.lang.String, U, kindname.class, TargetType60, (compiler.misc.arg.length.mismatch))))),(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam2<U,java.lang.String>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.resolve.location.args: kindname.method, n2, , U,java.lang.String, (compiler.misc.location: kindname.class, TargetType60, null)))))}
+TargetType60.java:61:27: compiler.err.cant.apply.symbols: kindname.method, u, @1639,{(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam1<U>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, n2, TargetType60,java.lang.String, U, kindname.class, TargetType60, (compiler.misc.arg.length.mismatch))))),(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>u(TargetType60.Sam2<U,java.lang.String>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.instance.method.in.unbound.lookup: kindname.method, n2(TargetType60,java.lang.String)))))}
 TargetType60.java:62:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
 TargetType60.java:63:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60
 5 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferencePackagePrivateQualifier.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8068254
+ * @summary Method reference uses wrong qualifying type
+ * @author srikanth
+ * @run main MethodReferencePackagePrivateQualifier
+ */
+import pkg.B;
+public class MethodReferencePackagePrivateQualifier {
+    public static void main(String... args) {
+        pkg.B.m();
+        Runnable r = pkg.B::m;
+        r.run();
+        r = B::m;
+        r.run();
+        if (!pkg.B.result.equals("A.m()A.m()A.m()"))
+            throw new AssertionError("Incorrect result");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/pkg/B.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package pkg;
+class A {
+    public static void m() {
+        B.result += "A.m()";
+    }
+}
+
+public class B extends A {
+    public static String result = "";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/TestMultipleErrors.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8066843
+ * @summary Annotation processors should be able to print multiple errors at the same location.
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor TestMultipleErrors
+ * @compile/fail/ref=TestMultipleErrors.out -XDrawDiagnostics -processor TestMultipleErrors TestMultipleErrors.java
+ */
+
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.tools.Diagnostic.Kind;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.Trees;
+
+public class TestMultipleErrors extends JavacTestingAbstractProcessor {
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        for (Element root : roundEnv.getRootElements()) {
+            processingEnv.getMessager().printMessage(Kind.ERROR, "error1", root);
+            processingEnv.getMessager().printMessage(Kind.ERROR, "error2", root);
+
+            Trees trees = Trees.instance(processingEnv);
+            TreePath path = trees.getPath(root);
+
+            trees.printMessage(Kind.ERROR, "error3", path.getLeaf(), path.getCompilationUnit());
+            trees.printMessage(Kind.ERROR, "error4", path.getLeaf(), path.getCompilationUnit());
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/TestMultipleErrors.out	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,5 @@
+TestMultipleErrors.java:41:8: compiler.err.proc.messager: error1
+TestMultipleErrors.java:41:8: compiler.err.proc.messager: error2
+TestMultipleErrors.java:41:8: compiler.err.proc.messager: error3
+TestMultipleErrors.java:41:8: compiler.err.proc.messager: error4
+4 errors
--- a/make/Images.gmk	Thu Jan 15 19:23:48 2015 -0800
+++ b/make/Images.gmk	Tue Jan 20 10:22:43 2015 -0800
@@ -29,7 +29,7 @@
 include MakeBase.gmk
 
 TOOL_TARGETS :=
-JDK_TARGETS := 
+JDK_TARGETS :=
 JRE_TARGETS :=
 
 # Hook to include the corresponding custom file, if present.
@@ -69,7 +69,7 @@
                        jdk.naming.rmi jdk.sctp jdk.security.auth
 
 # Replacing double-comma with a single comma is to workaround the issue
-# with some version of make on windows that doesn't substitute spaces 
+# with some version of make on windows that doesn't substitute spaces
 # with one comma properly as with make 4.0
 define SubstComma
   $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(strip $1)))
--- a/make/MakeHelpers.gmk	Thu Jan 15 19:23:48 2015 -0800
+++ b/make/MakeHelpers.gmk	Tue Jan 20 10:22:43 2015 -0800
@@ -353,7 +353,7 @@
 # Helper macro for DeclareRecipesForPhase
 # Declare a recipe for calling the module and phase specific makefile.
 # If there are multiple makefiles to call, create a rule for each topdir
-# that contains a makefile with the target $module-$suffix-$repodir, 
+# that contains a makefile with the target $module-$suffix-$repodir,
 # (i.e: java.base-gensrc-jdk)
 # Normally there is only one makefile, and the target will just be
 # $module-$suffix
--- a/make/ModuleWrapper.gmk	Thu Jan 15 19:23:48 2015 -0800
+++ b/make/ModuleWrapper.gmk	Tue Jan 20 10:22:43 2015 -0800
@@ -26,7 +26,7 @@
 ################################################################################
 # This makefile is called from Main.gmk, through a macro in MakeHelpers.gmk
 # and wraps calls to makefiles for specific modules and build phases. Having
-# this wrapper reduces the need for boilerplate code. It also provides 
+# this wrapper reduces the need for boilerplate code. It also provides
 # opportunity for automatic copying of files to an interim exploded runnable
 # image.
 
--- a/make/common/JavaCompilation.gmk	Thu Jan 15 19:23:48 2015 -0800
+++ b/make/common/JavaCompilation.gmk	Tue Jan 20 10:22:43 2015 -0800
@@ -538,7 +538,7 @@
     $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
 
     $$($1_BIN)/_the.$1_batch: $$($1_SRCS) $$($1_DEPENDS)
-	$(MKDIR) -p $$(@D)
+	$(MKDIR) -p $$(@D) $$(dir $$($1_SJAVAC_PORTFILE))
         # As a workaround for sjavac not tracking api changed from the classpath, force full
         # recompile if an external dependency, which is something other than a source
         # change, triggered this compilation.
--- a/make/common/NativeCompilation.gmk	Thu Jan 15 19:23:48 2015 -0800
+++ b/make/common/NativeCompilation.gmk	Tue Jan 20 10:22:43 2015 -0800
@@ -439,8 +439,10 @@
   # Now call add_native_source for each source file we are going to compile.
   $$(foreach p,$$($1_SRCS), \
       $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \
-          $(SYSROOT_CFLAGS) $$($1_CFLAGS) $$($1_EXTRA_CFLAGS),$$($1_CC), \
-          $(SYSROOT_CFLAGS) $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS),$$($1_CXX),$$($1_OBJC),$$($1_ASFLAGS))))
+          $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $(SYSROOT_CFLAGS), \
+          $$($1_CC), \
+          $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $(SYSROOT_CFLAGS), \
+          $$($1_CXX),$$($1_OBJC),$$($1_ASFLAGS))))
 
   # On windows we need to create a resource file
   ifeq ($(OPENJDK_TARGET_OS), windows)
@@ -575,10 +577,11 @@
 
     $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \
         $$($1_DEBUGINFO_EXTRA_DEPS)
-		$$(call LINKING_MSG,$$($1_BASENAME))
-		$$($1_LD) $(SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
-		    $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
-		    $$($1_EXTRA_LDFLAGS_SUFFIX)
+		$(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)"
+		$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(SYSROOT_LDFLAGS) \
+		    $(LD_OUT_OPTION)$$@ \
+		    $$($1_EXPECTED_OBJS) $$($1_RES) \
+		    $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
 		$$($1_CREATE_DEBUGINFO_CMDS)
                 # Touch target to make sure it has a later time stamp than the debug
                 # symbol files to avoid unnecessary relinking on rebuild.
@@ -602,10 +605,11 @@
 
     $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST) \
         $$($1_DEBUGINFO_EXTRA_DEPS)
-		$$(call LINKING_EXE_MSG,$$($1_BASENAME))
-		$$($1_LDEXE) $(SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
-		    $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
-		    $$($1_EXTRA_LDFLAGS_SUFFIX)
+		$(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)"
+		$$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(SYSROOT_LDFLAGS) \
+		    $(EXE_OUT_OPTION)$$($1_TARGET) \
+		    $$($1_EXPECTED_OBJS) $$($1_RES) \
+		    $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
                 ifneq (,$$($1_GEN_MANIFEST))
 		  $(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
                 endif
--- a/make/common/SetupJavaCompilers.gmk	Thu Jan 15 19:23:48 2015 -0800
+++ b/make/common/SetupJavaCompilers.gmk	Tue Jan 20 10:22:43 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -30,9 +30,9 @@
 
 DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally
 
-# To build with all warnings enabled, do the following:
+# If warnings needs to be non-fatal for testing purposes use a command like:
 # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
-JAVAC_WARNINGS := -Xlint:all,-deprecation -Werror
+JAVAC_WARNINGS := -Xlint:all -Werror
 
 # The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools
 # and the interim javac, to be run by the boot jdk.
--- a/make/jprt.properties	Thu Jan 15 19:23:48 2015 -0800
+++ b/make/jprt.properties	Tue Jan 20 10:22:43 2015 -0800
@@ -269,11 +269,6 @@
     solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_CMS,		\
     solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_G1,		\
     solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_ParOldGC,	\
-    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_SerialGC,		\
-    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_ParallelGC,	\
-    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_CMS,		\
-    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_G1,		\
-    solaris_sparcv9_5.11-{product|fastdebug}-c2-GCOld_ParOldGC,		\
     solaris_sparcv9_5.11-{product|fastdebug}-c2-jbb_default_nontiered,	\
     solaris_sparcv9_5.11-{product|fastdebug}-c2-jbb_SerialGC,		\
     solaris_sparcv9_5.11-{product|fastdebug}-c2-jbb_ParallelGC,		\
@@ -293,17 +288,9 @@
     solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_CMS,		\
     solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_G1,		\
     solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_ParOldGC,		\
-    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_SerialGC,		\
-    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_ParallelGC,		\
-    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_CMS,			\
-    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_G1,			\
-    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_ParOldGC,		\
     solaris_x64_5.11-{product|fastdebug}-c2-jbb_default_nontiered,	\
     solaris_x64_5.11-{product|fastdebug}-c2-jbb_SerialGC,		\
-    solaris_x64_5.11-{product|fastdebug}-c2-jbb_ParallelGC,		\
-    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_CMS,			\
-    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_G1,			\
-    solaris_x64_5.11-{product|fastdebug}-c2-GCOld_ParOldGC
+    solaris_x64_5.11-{product|fastdebug}-c2-jbb_ParallelGC,
 
 my.test.targets.hotspot.linux.i586=					\
     linux_i586_2.6-{product|fastdebug}-{c1|c2}-jvm98,			\
@@ -319,11 +306,6 @@
     linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_CMS,		\
     linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_G1,		\
     linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_ParOldGC,	\
-    linux_i586_2.6-product-{c1|c2}-GCOld_SerialGC,			\
-    linux_i586_2.6-product-{c1|c2}-GCOld_ParallelGC,			\
-    linux_i586_2.6-product-{c1|c2}-GCOld_CMS,				\
-    linux_i586_2.6-product-{c1|c2}-GCOld_G1,				\
-    linux_i586_2.6-product-{c1|c2}-GCOld_ParOldGC,			\
     linux_i586_2.6-{product|fastdebug}-c1-jbb_SerialGC,			\
     linux_i586_2.6-{product|fastdebug}-c2-jbb_default_nontiered,	\
     linux_i586_2.6-{product|fastdebug}-c1-jbb_ParallelGC,		\
@@ -340,11 +322,6 @@
     linux_x64_2.6-{product|fastdebug}-c2-GCBasher_CMS,			\
     linux_x64_2.6-{product|fastdebug}-c2-GCBasher_G1,			\
     linux_x64_2.6-{product|fastdebug}-c2-GCBasher_ParOldGC,		\
-    linux_x64_2.6-{product|fastdebug}-c2-GCOld_SerialGC,		\
-    linux_x64_2.6-{product|fastdebug}-c2-GCOld_ParallelGC,		\
-    linux_x64_2.6-{product|fastdebug}-c2-GCOld_CMS,			\
-    linux_x64_2.6-{product|fastdebug}-c2-GCOld_G1,			\
-    linux_x64_2.6-{product|fastdebug}-c2-GCOld_ParOldGC,		\
     linux_x64_2.6-{product|fastdebug}-c2-jbb_default_nontiered,		\
     linux_x64_2.6-{product|fastdebug}-c2-jbb_ParallelGC,		\
     linux_x64_2.6-{product|fastdebug}-c2-jbb_G1,			\
@@ -359,11 +336,6 @@
     macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_CMS,		\
     macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_G1,			\
     macosx_x64_10.7-{product|fastdebug}-c2-GCBasher_ParOldGC,		\
-    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_SerialGC,		\
-    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_ParallelGC,		\
-    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_CMS,			\
-    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_G1,			\
-    macosx_x64_10.7-{product|fastdebug}-c2-GCOld_ParOldGC,		\
     macosx_x64_10.7-{product|fastdebug}-c2-jbb_default_nontiered,	\
     macosx_x64_10.7-{product|fastdebug}-c2-jbb_ParallelGC,		\
     macosx_x64_10.7-{product|fastdebug}-c2-jbb_G1,			\
@@ -382,11 +354,6 @@
     windows_i586_6.1-{product|fastdebug}-{c1|c2}-GCBasher_CMS,		\
     windows_i586_6.1-{product|fastdebug}-{c1|c2}-GCBasher_G1,		\
     windows_i586_6.1-{product|fastdebug}-{c1|c2}-GCBasher_ParOldGC,	\
-    windows_i586_6.1-product-{c1|c2}-GCOld_SerialGC,			\
-    windows_i586_6.1-product-{c1|c2}-GCOld_ParallelGC,			\
-    windows_i586_6.1-product-{c1|c2}-GCOld_CMS,				\
-    windows_i586_6.1-product-{c1|c2}-GCOld_G1,				\
-    windows_i586_6.1-product-{c1|c2}-GCOld_ParOldGC,			\
     windows_i586_6.1-{product|fastdebug}-{c1|c2}-jbb_default,		\
     windows_i586_6.1-{product|fastdebug}-c2-jbb_default_nontiered,	\
     windows_i586_6.1-product-{c1|c2}-jbb_ParallelGC,			\
@@ -406,11 +373,6 @@
     windows_x64_6.1-{product|fastdebug}-c2-GCBasher_CMS,		\
     windows_x64_6.1-{product|fastdebug}-c2-GCBasher_G1,			\
     windows_x64_6.1-{product|fastdebug}-c2-GCBasher_ParOldGC,		\
-    windows_x64_6.1-{product|fastdebug}-c2-GCOld_SerialGC,		\
-    windows_x64_6.1-{product|fastdebug}-c2-GCOld_ParallelGC,		\
-    windows_x64_6.1-{product|fastdebug}-c2-GCOld_CMS,			\
-    windows_x64_6.1-{product|fastdebug}-c2-GCOld_G1,			\
-    windows_x64_6.1-{product|fastdebug}-c2-GCOld_ParOldGC,		\
     windows_x64_6.1-{product|fastdebug}-c2-jbb_default,			\
     windows_x64_6.1-{product|fastdebug}-c2-jbb_default_nontiered,	\
     windows_x64_6.1-product-c2-jbb_CMS,					\
@@ -486,6 +448,8 @@
   ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_compiler_3},	\
   ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_compiler_closed},	\
   ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_gc},		\
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_gc_closed},       \
+  ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_gc_gcold},        \
   ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_runtime},		\
   ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_runtime_closed},	\
   ${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_serviceability},	\
--- a/nashorn/.hgtags	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/.hgtags	Tue Jan 20 10:22:43 2015 -0800
@@ -279,3 +279,4 @@
 8ae8dff2a28f3b8831cce97ae0c7a957c5dc650a jdk9-b43
 50ee576062726e536d1bb9a5eadd8fd4470128fc jdk9-b44
 3c2bbeda038aef7061455fec604db7d8a342fac5 jdk9-b45
+2ecf0a617f0f9af1ffd278a0c70e76f1946ce773 jdk9-b46
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Tue Jan 20 10:22:43 2015 -0800
@@ -491,8 +491,9 @@
 
                 // We want setters that conform to "Object(O, V)". Note, we aren't doing "R(O, V)" as it might not be
                 // valid for us to convert return values proactively. Also, since we don't know what setters will be
-                // invoked, we'll conservatively presume Object return type.
-                final MethodType type = callSiteDescriptor.getMethodType().changeReturnType(Object.class);
+                // invoked, we'll conservatively presume Object return type. The one exception is void return.
+                final MethodType origType = callSiteDescriptor.getMethodType();
+                final MethodType type = origType.returnType() == void.class ? origType : origType.changeReturnType(Object.class);
 
                 // What's below is basically:
                 //   foldArguments(guardWithTest(isNotNull, invoke, null|nextComponent.invocation),
@@ -508,7 +509,7 @@
                 // Bind property setter handle to the expected setter type and linker services. Type is
                 // MethodHandle(Object, String, Object)
                 final MethodHandle boundGetter = MethodHandles.insertArguments(getPropertySetterHandle, 0,
-                        CallSiteDescriptorFactory.dropParameterTypes(callSiteDescriptor, 1, 2), linkerServices);
+                        callSiteDescriptor.changeMethodType(setterType), linkerServices);
 
                 // Cast getter to MethodHandle(O, N, V)
                 final MethodHandle typedGetter = linkerServices.asType(boundGetter, type.changeReturnType(
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/OverloadedMethod.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/OverloadedMethod.java	Tue Jan 20 10:22:43 2015 -0800
@@ -123,7 +123,6 @@
         varArgMethods = new ArrayList<>(methodHandles.size());
         final int argNum = callSiteType.parameterCount();
         for(MethodHandle mh: methodHandles) {
-            mh = mh.asType(mh.type().changeReturnType(commonRetType));
             if(mh.isVarargsCollector()) {
                 final MethodHandle asFixed = mh.asFixedArity();
                 if(argNum == asFixed.type().parameterCount()) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeUtilities.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeUtilities.java	Tue Jan 20 10:22:43 2015 -0800
@@ -118,17 +118,13 @@
     public static Class<?> getCommonLosslessConversionType(final Class<?> c1, final Class<?> c2) {
         if(c1 == c2) {
             return c1;
+        } else if (c1 == void.class || c2 == void.class) {
+            return Object.class;
         } else if(isConvertibleWithoutLoss(c2, c1)) {
             return c1;
         } else if(isConvertibleWithoutLoss(c1, c2)) {
             return c2;
-        }
-        if(c1 == void.class) {
-            return c2;
-        } else if(c2 == void.class) {
-            return c1;
-        }
-        if(c1.isPrimitive() && c2.isPrimitive()) {
+        } else if(c1.isPrimitive() && c2.isPrimitive()) {
             if((c1 == byte.class && c2 == char.class) || (c1 == char.class && c2 == byte.class)) {
                 // byte + char = int
                 return int.class;
@@ -268,20 +264,24 @@
     }
 
     /**
-     * Determines whether a type can be converted to another without losing any
-     * precision.
+     * Determines whether a type can be converted to another without losing any precision. As a special case,
+     * void is considered convertible only to Object and void, while anything can be converted to void. This
+     * is because a target type of void means we don't care about the value, so the conversion is always
+     * permissible.
      *
      * @param sourceType the source type
      * @param targetType the target type
      * @return true if lossless conversion is possible
      */
     public static boolean isConvertibleWithoutLoss(final Class<?> sourceType, final Class<?> targetType) {
-        if(targetType.isAssignableFrom(sourceType)) {
+        if(targetType.isAssignableFrom(sourceType) || targetType == void.class) {
             return true;
         }
         if(sourceType.isPrimitive()) {
             if(sourceType == void.class) {
-                return false; // Void can't be losslessly represented by any type
+                // Void should be losslessly representable by Object, either as null or as a custom value that
+                // can be set with DynamicLinkerFactory.setAutoConversionStrategy.
+                return targetType == Object.class;
             }
             if(targetType.isPrimitive()) {
                 return isProperPrimitiveLosslessSubtype(sourceType, targetType);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Tue Jan 20 10:22:43 2015 -0800
@@ -703,7 +703,7 @@
         final ScriptFunction func = getProgramFunction(clazz, scope);
         Object evalThis;
         if (directEval) {
-            evalThis = callThis instanceof ScriptObject || strictFlag ? callThis : global;
+            evalThis = (callThis != UNDEFINED && callThis != null) || strictFlag ? callThis : global;
         } else {
             evalThis = global;
         }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Tue Jan 20 10:22:43 2015 -0800
@@ -68,6 +68,8 @@
 
     private static final MethodHandleFunctionality MH = MethodHandleFactory.getFunctionality();
 
+    private static final MethodHandle VOID_TO_OBJECT = MH.constant(Object.class, ScriptRuntime.UNDEFINED);
+
     /**
      * The default dynalink relink threshold for megamorphisism is 8. In the case
      * of object fields only, it is fine. However, with dual fields, in order to get
@@ -189,7 +191,7 @@
      * @return true if the obj is an instance of @FunctionalInterface interface
      */
     public static boolean isFunctionalInterfaceObject(final Object obj) {
-        return !JSType.isPrimitive(obj) && (NashornBottomLinker.getFunctionalInterfaceMethod(obj.getClass()) != null);
+        return !JSType.isPrimitive(obj) && (NashornBeansLinker.getFunctionalInterfaceMethod(obj.getClass()) != null);
     }
 
     /**
@@ -481,14 +483,16 @@
     private static MethodHandle unboxReturnType(final MethodHandle target, final MethodType newType) {
         final MethodType targetType = target.type();
         final Class<?> oldReturnType = targetType.returnType();
+        final Class<?> newReturnType = newType.returnType();
         if (TypeUtilities.isWrapperType(oldReturnType)) {
-            final Class<?> newReturnType = newType.returnType();
             if (newReturnType.isPrimitive()) {
                 // The contract of setAutoConversionStrategy is such that the difference between newType and targetType
                 // can only be JLS method invocation conversions.
                 assert TypeUtilities.isMethodInvocationConvertible(oldReturnType, newReturnType);
                 return MethodHandles.explicitCastArguments(target, targetType.changeReturnType(newReturnType));
             }
+        } else if (oldReturnType == void.class && newReturnType == Object.class) {
+            return MethodHandles.filterReturnValue(target, VOID_TO_OBJECT);
         }
         return target;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java	Tue Jan 20 10:22:43 2015 -0800
@@ -25,20 +25,29 @@
 
 package jdk.nashorn.internal.runtime.linker;
 
+import static jdk.nashorn.internal.lookup.Lookup.MH;
+import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.beans.BeansLinker;
 import jdk.internal.dynalink.linker.ConversionComparator.Comparison;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.GuardingDynamicLinker;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.support.Guards;
 import jdk.internal.dynalink.support.Lookup;
 import jdk.nashorn.api.scripting.ScriptUtils;
 import jdk.nashorn.internal.objects.NativeArray;
 import jdk.nashorn.internal.runtime.ConsString;
+import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ScriptObject;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.options.Options;
 
 /**
@@ -68,19 +77,49 @@
         FILTER_CONSSTRING    = lookup.findOwnStatic("consStringFilter", Object.class, Object.class);
     }
 
+    // cache of @FunctionalInterface method of implementor classes
+    private static final ClassValue<Method> FUNCTIONAL_IFACE_METHOD = new ClassValue<Method>() {
+        @Override
+        protected Method computeValue(final Class<?> type) {
+            return findFunctionalInterfaceMethod(type);
+        }
+    };
+
     private final BeansLinker beansLinker = new BeansLinker();
 
     @Override
     public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
-        if (linkRequest.getReceiver() instanceof ConsString) {
+        final Object self = linkRequest.getReceiver();
+        final CallSiteDescriptor desc = linkRequest.getCallSiteDescriptor();
+        if (self instanceof ConsString) {
             // In order to treat ConsString like a java.lang.String we need a link request with a string receiver.
             final Object[] arguments = linkRequest.getArguments();
             arguments[0] = "";
-            final LinkRequest forgedLinkRequest = linkRequest.replaceArguments(linkRequest.getCallSiteDescriptor(), arguments);
+            final LinkRequest forgedLinkRequest = linkRequest.replaceArguments(desc, arguments);
             final GuardedInvocation invocation = getGuardedInvocation(beansLinker, forgedLinkRequest, linkerServices);
             // If an invocation is found we add a filter that makes it work for both Strings and ConsStrings.
             return invocation == null ? null : invocation.filterArguments(0, FILTER_CONSSTRING);
         }
+
+        if (self != null && "call".equals(desc.getNameToken(CallSiteDescriptor.OPERATOR))) {
+            // Support dyn:call on any object that supports some @FunctionalInterface
+            // annotated interface. This way Java method, constructor references or
+            // implementations of java.util.function.* interfaces can be called as though
+            // those are script functions.
+            final Method m = getFunctionalInterfaceMethod(self.getClass());
+            if (m != null) {
+                final MethodType callType = desc.getMethodType();
+                // 'callee' and 'thiz' passed from script + actual arguments
+                if (callType.parameterCount() != m.getParameterCount() + 2) {
+                    throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self));
+                }
+                return new GuardedInvocation(
+                        // drop 'thiz' passed from the script.
+                        MH.dropArguments(desc.getLookup().unreflect(m), 1, callType.parameterType(1)),
+                        Guards.getInstanceOfGuard(m.getDeclaringClass())).asTypeSafeReturn(
+                                new NashornBeansLinkerServices(linkerServices), callType);
+            }
+        }
         return getGuardedInvocation(beansLinker, linkRequest, linkerServices);
     }
 
@@ -137,6 +176,38 @@
         return arg instanceof ConsString ? arg.toString() : arg;
     }
 
+    private static Method findFunctionalInterfaceMethod(final Class<?> clazz) {
+        if (clazz == null) {
+            return null;
+        }
+
+        for (final Class<?> iface : clazz.getInterfaces()) {
+            // check accessiblity up-front
+            if (! Context.isAccessibleClass(iface)) {
+                continue;
+            }
+
+            // check for @FunctionalInterface
+            if (iface.isAnnotationPresent(FunctionalInterface.class)) {
+                // return the first abstract method
+                for (final Method m : iface.getMethods()) {
+                    if (Modifier.isAbstract(m.getModifiers())) {
+                        return m;
+                    }
+                }
+            }
+        }
+
+        // did not find here, try super class
+        return findFunctionalInterfaceMethod(clazz.getSuperclass());
+    }
+
+    // Returns @FunctionalInterface annotated interface's single abstract
+    // method. If not found, returns null.
+    static Method getFunctionalInterfaceMethod(final Class<?> clazz) {
+        return FUNCTIONAL_IFACE_METHOD.get(clazz);
+    }
+
     private static class NashornBeansLinkerServices implements LinkerServices {
         private final LinkerServices linkerServices;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Tue Jan 20 10:22:43 2015 -0800
@@ -30,9 +30,6 @@
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 
 import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodType;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.util.HashMap;
 import java.util.Map;
 import jdk.internal.dynalink.CallSiteDescriptor;
@@ -45,7 +42,6 @@
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.support.Guards;
 import jdk.nashorn.internal.codegen.types.Type;
-import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.UnwarrantedOptimismException;
@@ -95,22 +91,6 @@
             }
             throw typeError("not.a.function", ScriptRuntime.safeToString(self));
         case "call":
-            // Support dyn:call on any object that supports some @FunctionalInterface
-            // annotated interface. This way Java method, constructor references or
-            // implementations of java.util.function.* interfaces can be called as though
-            // those are script functions.
-            final Method m = getFunctionalInterfaceMethod(self.getClass());
-            if (m != null) {
-                final MethodType callType = desc.getMethodType();
-                // 'callee' and 'thiz' passed from script + actual arguments
-                if (callType.parameterCount() != m.getParameterCount() + 2) {
-                    throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self));
-                }
-                return Bootstrap.asTypeSafeReturn(new GuardedInvocation(
-                        // drop 'thiz' passed from the script.
-                        MH.dropArguments(desc.getLookup().unreflect(m), 1, callType.parameterType(1)),
-                        Guards.getInstanceOfGuard(m.getDeclaringClass())), linkerServices, desc);
-            }
             if(BeansLinker.isDynamicConstructor(self)) {
                 throw typeError("constructor.requires.new", ScriptRuntime.safeToString(self));
             }
@@ -218,44 +198,4 @@
         }
         return ScriptRuntime.safeToString(linkRequest.getArguments()[1]);
     }
-
-    // cache of @FunctionalInterface method of implementor classes
-    private static final ClassValue<Method> FUNCTIONAL_IFACE_METHOD = new ClassValue<Method>() {
-        @Override
-        protected Method computeValue(final Class<?> type) {
-            return findFunctionalInterfaceMethod(type);
-        }
-
-        private Method findFunctionalInterfaceMethod(final Class<?> clazz) {
-            if (clazz == null) {
-                return null;
-            }
-
-            for (final Class<?> iface : clazz.getInterfaces()) {
-                // check accessiblity up-front
-                if (! Context.isAccessibleClass(iface)) {
-                    continue;
-                }
-
-                // check for @FunctionalInterface
-                if (iface.isAnnotationPresent(FunctionalInterface.class)) {
-                    // return the first abstract method
-                    for (final Method m : iface.getMethods()) {
-                        if (Modifier.isAbstract(m.getModifiers())) {
-                            return m;
-                        }
-                    }
-                }
-            }
-
-            // did not find here, try super class
-            return findFunctionalInterfaceMethod(clazz.getSuperclass());
-        }
-    };
-
-    // Returns @FunctionalInterface annotated interface's single abstract
-    // method. If not found, returns null.
-    static Method getFunctionalInterfaceMethod(final Class<?> clazz) {
-        return FUNCTIONAL_IFACE_METHOD.get(clazz);
-    }
 }
--- a/nashorn/test/script/basic/JDK-8020324.js.EXPECTED	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/test/script/basic/JDK-8020324.js.EXPECTED	Tue Jan 20 10:22:43 2015 -0800
@@ -17,7 +17,7 @@
 bean.readWrite = 18: 18
 obj1.readWrite: 18
 obj1.getReadWrite(): 18
-obj1.setReadWrite(19): null
+obj1.setReadWrite(19): undefined
 obj1.readWrite: 19
 bean.readWrite: 19
 
@@ -52,7 +52,7 @@
 PropertyBind.staticReadWrite = 26: 26
 obj2.staticReadWrite: 26
 obj2.getStaticReadWrite(): 26
-obj2.setStaticReadWrite(27): null
+obj2.setStaticReadWrite(27): undefined
 obj2.staticReadWrite: 27
 PropertyBind.staticReadWrite: 27
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8068573.js	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8068573: POJO setter using [] syntax throws an exception
+ *
+ * @test
+ * @run
+ */
+
+// Invoke a setter using []. It's important that the setter returns void.
+var pb = new (Java.type("jdk.nashorn.test.models.PropertyBind"))
+var n = "writeOnly";
+pb[n] = 2;
+Assert.assertEquals(pb.peekWriteOnly(), 2);
+
+// Invoke an overloaded setter using []. It's important that one of the 
+// overloads returns void.
+var os = new (Java.type("jdk.nashorn.test.models.OverloadedSetter"))
+var n2 = "color";
+os[n2] = 3; // exercise int overload
+Assert.assertEquals(os.peekColor(), "3");
+os[n2] = "blue";  // exercise string overload
+Assert.assertEquals(os.peekColor(), "blue");
+for each(var x in [42, "42"]) {
+  os[n2] = x; // exercise both overloads in the same call site
+  Assert.assertEquals(os.peekColor(), "42");
+}
+
+// Invoke an overloaded method using [], repeatedly in the same call 
+// site. It's important that one of the overloads returns void.
+var n3="foo";
+var param=["xyz", 1, "zyx", 2];
+var expected=["boo", void 0, "boo", void 0];
+for(var i in param) {
+  Assert.assertEquals(os[n3](param[i]), expected[i]);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8068985.js	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8068985: Wrong 'this' bound to eval call within a function when caller's 'this' is a Java object
+ *
+ * @test
+ * @run
+ */
+
+function func(arg) {
+  (function() { print(eval('this')); }).call(arg);
+}
+
+// primitives
+func(undefined);
+func(null);
+func(34.23);
+func("hello");
+func(false);
+
+// script objects
+func(this);
+func({});
+func({ toString: function() { return "foo" } });
+
+// java objects
+func(new java.util.Vector());
+var m = new java.util.HashMap();
+m.put("foo", "bar");
+func(m);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8068985.js.EXPECTED	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,10 @@
+[object global]
+[object global]
+34.23
+hello
+false
+[object global]
+[object Object]
+foo
+[]
+{foo=bar}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8069002.js	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8069002: NPE on invoking null (8068889 regression)
+ *
+ * @test
+ * @run
+ */
+
+try {
+    null();
+} catch (e) {
+    Assert.assertTrue(e instanceof TypeError);
+}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Tue Jan 20 10:22:43 2015 -0800
@@ -30,12 +30,16 @@
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
+
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Consumer;
+import java.util.function.Function;
 import javax.script.Compilable;
 import javax.script.CompiledScript;
 import javax.script.Invocable;
@@ -680,6 +684,41 @@
         assertNull(value);
     }
 
+    // @bug JDK-8068889: ConsString arguments to a functional interface wasn't converted to string.
+    @Test
+    public void functionalInterfaceStringTest() throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine e = manager.getEngineByName("nashorn");
+        final AtomicBoolean invoked = new AtomicBoolean(false);
+        e.put("f", new Function<String, String>() {
+            @Override
+            public String apply(String t) {
+                invoked.set(true);
+                return t;
+            }
+        });
+        assertEquals(e.eval("var x = 'a'; x += 'b'; f(x)"), "ab");
+        assertTrue(invoked.get());
+    }
+
+    // @bug JDK-8068889: ScriptObject arguments to a functional interface wasn't converted to a mirror.
+    @Test
+    public void functionalInterfaceObjectTest() throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine e = manager.getEngineByName("nashorn");
+        final AtomicBoolean invoked = new AtomicBoolean(false);
+        e.put("c", new Consumer<Object>() {
+            @Override
+            public void accept(Object t) {
+                assertTrue(t instanceof ScriptObjectMirror);
+                assertEquals(((ScriptObjectMirror)t).get("a"), "xyz");
+                invoked.set(true);
+            }
+        });
+        e.eval("var x = 'xy'; x += 'z';c({a:x})");
+        assertTrue(invoked.get());
+    }
+
     private static void checkProperty(final ScriptEngine e, final String name)
         throws ScriptException {
         final String value = System.getProperty(name);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/OverloadedSetter.java	Tue Jan 20 10:22:43 2015 -0800
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.test.models;
+
+public class OverloadedSetter {
+    private String color;
+
+    public void setColor(final int x) {
+        this.color = Integer.toString(x);
+    }
+
+    public void setColor(final String x) {
+        this.color = x;
+    }
+
+    public String peekColor() {
+        return color;
+    }
+
+    public void foo(final int x) {
+    }
+
+    public String foo(final String x) {
+        return "boo";
+    }
+}
--- a/test/lib/sun/hotspot/WhiteBox.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/test/lib/sun/hotspot/WhiteBox.java	Tue Jan 20 10:22:43 2015 -0800
@@ -84,6 +84,8 @@
     return isClassAlive0(name.replace('.', '/'));
   }
   private native boolean isClassAlive0(String name);
+  public native boolean isMonitorInflated(Object obj);
+  public native void forceSafepoint();
 
   // JVMTI
   public native void addToBootstrapClassLoaderSearch(String segment);
--- a/test/lib/sun/hotspot/code/BlobType.java	Thu Jan 15 19:23:48 2015 -0800
+++ b/test/lib/sun/hotspot/code/BlobType.java	Tue Jan 20 10:22:43 2015 -0800
@@ -32,11 +32,11 @@
 
 public enum BlobType {
     // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
-    MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'"),
+    MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'", "NonProfiledCodeHeapSize"),
     // Execution level 2 and 3 (profiled) nmethods
-    MethodProfiled(1, "CodeHeap 'profiled nmethods'"),
+    MethodProfiled(1, "CodeHeap 'profiled nmethods'", "ProfiledCodeHeapSize"),
     // Non-nmethods like Buffers, Adapters and Runtime Stubs
-    NonNMethod(2, "CodeHeap 'non-nmethods'") {
+    NonNMethod(2, "CodeHeap 'non-nmethods'", "NonNMethodCodeHeapSize") {
         @Override
         public boolean allowTypeWhenOverflow(BlobType type) {
             return super.allowTypeWhenOverflow(type)
@@ -44,14 +44,16 @@
         }
     },
     // All types (No code cache segmentation)
-    All(3, "CodeCache");
+    All(3, "CodeCache", "ReservedCodeCacheSize");
 
     public final int id;
-    private final String beanName;
+    public final String sizeOptionName;
+    public final String beanName;
 
-    private BlobType(int id, String beanName) {
+    private BlobType(int id, String beanName, String sizeOptionName) {
         this.id = id;
         this.beanName = beanName;
+        this.sizeOptionName = sizeOptionName;
     }
 
     public MemoryPoolMXBean getMemoryPool() {
@@ -87,4 +89,8 @@
         }
         return result;
     }
+
+    public long getSize() {
+        return WhiteBox.getWhiteBox().getUintxVMFlag(sizeOptionName);
+    }
 }