diff -Nru openjdk-boot.orig/jdk/make/tools/src/build/tools/spp/Spp.java openjdk-boot/jdk/make/tools/src/build/tools/spp/Spp.java
--- openjdk-boot.orig/jdk/make/tools/src/build/tools/spp/Spp.java	2008-09-11 08:44:09.000000000 +0100
+++ openjdk-boot/jdk/make/tools/src/build/tools/spp/Spp.java	2008-09-12 21:34:38.000000000 +0100
@@ -25,6 +25,10 @@
 
 package build.tools.spp;
 
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
 import java.util.*;
 import java.util.regex.*;
 
@@ -83,7 +87,7 @@
         }
 
         StringBuffer out = new StringBuffer();
-        new Spp().spp(new Scanner(System.in),
+        new Spp().spp(new BufferedReader(new InputStreamReader(System.in)),
                       out, "",
                       keys, vars, be,
                       false);
@@ -104,12 +108,12 @@
     Matcher ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
     Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
     Matcher endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
-    Matcher  vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
+    Pattern  pvardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$");
     Matcher  vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
 
     void append(StringBuffer buf, String ln,
                 Set<String> keys, Map<String, String> vars) {
-        vardef.reset(ln);
+        Matcher vardef = pvardef.matcher(ln);
         while (vardef.find()) {
             String repl = "";
             if (vardef.group(GN_VAR) != null)
@@ -133,19 +137,20 @@
     }
 
     // return true if #end[key], #end or EOF reached
-    boolean spp(Scanner in, StringBuffer buf, String key,
+    boolean spp(BufferedReader in, StringBuffer buf, String key,
                 Set<String> keys, Map<String, String> vars,
-                boolean be, boolean skip) {
-        while (in.hasNextLine()) {
-            String ln = in.nextLine();
+                boolean be, boolean skip) throws IOException {
+        while (true) {
+	    String ln = in.readLine();
+	    if (ln == null)
+	      break;
             if (be) {
                 if (ln.startsWith("#begin")) {
                     buf.setLength(0);      //clean up to this line
                     continue;
                 }
                 if (ln.equals("#end")) {
-                    while (in.hasNextLine())
-                        in.nextLine();
+		    do { } while (in.readLine() != null);
                     return true;           //discard the rest to EOF
                 }
             }
