Reviewers: cromwellian,

Description:
Emulate System.getProperty(key, default) by always returning the
default. This method is commonly used by parsers for establishing the
newline character, so including this makes it possible to port such code
to GWT.


Please review this at http://gwt-code-reviews.appspot.com/1654803/

Affected files:
  M user/super/com/google/gwt/emul/java/lang/System.java
  M user/test/com/google/gwt/emultest/java/lang/SystemTest.java


Index: user/super/com/google/gwt/emul/java/lang/System.java
===================================================================
--- user/super/com/google/gwt/emul/java/lang/System.java        (revision 10862)
+++ user/super/com/google/gwt/emul/java/lang/System.java        (working copy)
@@ -1,12 +1,12 @@
 /*
  * Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of
  * the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -95,10 +95,17 @@

   /**
    * Has no effect; just here for source compatibility.
-   *
+   *
    * @skip
    */
   public static void gc() {
+  }
+
+  /**
+   * Always returns default, used for source compatibility
+   */
+  public static String getProperty(String key, String def) {
+    return def;
   }

   public static int identityHashCode(Object o) {
@@ -137,7 +144,7 @@
* Copy an array using native Javascript. The destination array must be a real * Java array (ie, already has the GWT type info on it). No error checking is
    * performed -- the caller is expected to have verified everything first.
-   *
+   *
    * @param src source array for copy
    * @param srcOfs offset into source array
    * @param dest destination array for copy
Index: user/test/com/google/gwt/emultest/java/lang/SystemTest.java
===================================================================
--- user/test/com/google/gwt/emultest/java/lang/SystemTest.java (revision 10862) +++ user/test/com/google/gwt/emultest/java/lang/SystemTest.java (working copy)
@@ -275,4 +275,8 @@
       assertEquals(src[i + 1], dest[i]);
     }
   }
+
+  public void testGetProperty() {
+    assertEquals("default", System.getProperty("key", "default"));
+  }
 }


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to