Changes served location of UiBinder's xhtml.ent from svn to downloads

Also makes match more stringent, and fixes vaccuous test case

Review: jgw, jlabanca

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6219 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/uibinder/rebind/GwtResourceEntityResolver.java b/user/src/com/google/gwt/uibinder/rebind/GwtResourceEntityResolver.java
index c93dbd3..8dad0ec 100644
--- a/user/src/com/google/gwt/uibinder/rebind/GwtResourceEntityResolver.java
+++ b/user/src/com/google/gwt/uibinder/rebind/GwtResourceEntityResolver.java
@@ -1,12 +1,12 @@
 /*
  * Copyright 2009 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
@@ -25,13 +25,13 @@
 /**
  * Does special handling of external entities encountered by sax xml parser,
  * e.g. the uri in
- * 
+ *
  * <pre>
- * &lt;!DOCTYPE gwt:UiBinder 
-  SYSTEM "http://google-web-toolkit.googlecode.com/svn/resources/xhtml.ent"></pre>
+ * &lt;!DOCTYPE gwt:UiBinder
+  SYSTEM "http://google-web-toolkit.googlecode.com/files/xhtml.ent"></pre>
  * <p>
  * Specifically, if the requested uri starts with
- * <code>http://google-web-toolkit.googlecode.com/svn/resources</code>, provide
+ * <code>http://google-web-toolkit.googlecode.com/files</code>, provide
  * the contents from a built in resource rather than allowing sax to make a
  * network request.
  */
@@ -40,9 +40,9 @@
     InputStream fetch(String name);
   }
 
-  private static final String EXTERNAL_ENTITY_PREFIX = "http://google-web-toolkit.googlecode.com/svn/resources";
+  private static final String EXTERNAL_ENTITY_PREFIX = "http://google-web-toolkit.googlecode.com/files/";
 
-  private static final String RESOURCES = "com/google/gwt/uibinder/resources";
+  private static final String RESOURCES = "com/google/gwt/uibinder/resources/";
 
   private final ResourceLoader resourceLoader;
 
@@ -87,4 +87,4 @@
     inputSource.setSystemId(systemId);
     return inputSource;
   }
-}
\ No newline at end of file
+}
diff --git a/user/src/com/google/gwt/uibinder/resources/xhtml.ent b/user/src/com/google/gwt/uibinder/resources/xhtml.ent
index aa80147..1c5183f 100644
--- a/user/src/com/google/gwt/uibinder/resources/xhtml.ent
+++ b/user/src/com/google/gwt/uibinder/resources/xhtml.ent
@@ -6,12 +6,22 @@
 -->
 
 <!--
-  This is the complete set of named character entites defined in XHTML1.0. It's
-  essentially a union of:
+  This is the complete set of named character entites defined in
+  XHTML1.0.  Though this file was created for the convenience of users
+  of the Google Web Toolkit, it should be useful for any XML
+  document. It's essentially a union of:
 
     http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent
     http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent
     http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent
+
+  Sample usage:
+  <!DOCTYPE ui:UiBinder
+    SYSTEM "http://google-web-toolkit.googlecode.com/files/xhtml.ent">
+
+  This file is maintained at
+  <http://google-web-toolkit.googlecode.com/svn/trunk/user/src/com/google/gwt/uibinder/resources/xhtml.ent>. Changes
+  made to it must be propagated to the URL in the sample above.
 -->
 
 <!-- Latin-1 characters -->
@@ -208,7 +218,7 @@
        existing ISO 8879 entity names. ISO 10646 character numbers
        are given for each character, in hex. values are decimal
        conversions of the ISO 10646 values and refer to the document
-       character set. Names are Unicode names. 
+       character set. Names are Unicode names.
   -->
 
   <!-- C0 Controls and Basic Latin -->
@@ -394,7 +404,7 @@
   <!ENTITY uArr     "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
   <!ENTITY rArr     "&#8658;"> <!-- rightwards double arrow,
                                        U+21D2 ISOtech -->
-  <!-- Unicode does not say this is the 'implies' character but does not have 
+  <!-- Unicode does not say this is the 'implies' character but does not have
        another character with this function so rArr can be used for 'implies'
        as ISOtech suggests -->
   <!ENTITY dArr     "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
@@ -467,11 +477,11 @@
   <!ENTITY rfloor   "&#8971;"> <!-- right floor, U+230B ISOamsc  -->
   <!ENTITY lang     "&#9001;"> <!-- left-pointing angle bracket = bra,
                                        U+2329 ISOtech -->
-  <!-- lang is NOT the same character as U+003C 'less than sign' 
+  <!-- lang is NOT the same character as U+003C 'less than sign'
        or U+2039 'single left-pointing angle quotation mark' -->
   <!ENTITY rang     "&#9002;"> <!-- right-pointing angle bracket = ket,
                                        U+232A ISOtech -->
-  <!-- rang is NOT the same character as U+003E 'greater than sign' 
+  <!-- rang is NOT the same character as U+003E 'greater than sign'
        or U+203A 'single right-pointing angle quotation mark' -->
 
   <!-- Geometric Shapes -->
diff --git a/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml b/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml
index d16bb54..7f40dfd 100644
--- a/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml
+++ b/user/src/com/google/gwt/uibinder/sample/client/WidgetBasedUi.ui.xml
@@ -14,7 +14,7 @@
 -->
 
 <!DOCTYPE ui:UiBinder 
-  SYSTEM "http://google-web-toolkit.googlecode.com/svn/resources/xhtml.ent"
+  SYSTEM "http://google-web-toolkit.googlecode.com/files/xhtml.ent"
   [
     <!ENTITY % MyEntities SYSTEM "MyEntities.ent">
     %MyEntities;
@@ -26,13 +26,15 @@
   
   First, this bit:
   
-    SYSTEM "http://google-web-toolkit.googlecode.com/svn/trunk/resources/xhtml.ent"
+    SYSTEM "http://google-web-toolkit.googlecode.com/files/xhtml.ent"
  
   allows you to use familiar HTML entities like %nbsp; and &bull;, 
   which are not part of XML.
     
-  Next, the bit in square brackets pulls in additional definitions for
-  &point-left; and &point-right; from local file MyEntities.ent.
+  Next, the bit in square brackets is even more optional. It shows how
+  to add your own entities, in this case pulling in additional
+  definitions for &point-left; and &point-right; from local file
+  MyEntities.ent.
 
   You don't have to be so verbose to include a local file! For
   example, you might instead grab your own copy of xhtml.ent
diff --git a/user/test/com/google/gwt/uibinder/rebind/GwtResourceEntityResolverTest.java b/user/test/com/google/gwt/uibinder/rebind/GwtResourceEntityResolverTest.java
index da630e7..5cf1b55 100644
--- a/user/test/com/google/gwt/uibinder/rebind/GwtResourceEntityResolverTest.java
+++ b/user/test/com/google/gwt/uibinder/rebind/GwtResourceEntityResolverTest.java
@@ -27,7 +27,8 @@
  * Text of GwtResourceEntityResolver.
  */
 public class GwtResourceEntityResolverTest extends TestCase {
-  
+  private static final String SYSTEM_ID = "http://google-web-toolkit.googlecode.com/files/xhtml.ent";
+
   private static class MockResourceLoader implements
       GwtResourceEntityResolver.ResourceLoader {
     String fetched;
@@ -37,7 +38,7 @@
       return stream;
     }
   }
-  
+
   private GwtResourceEntityResolver resolver;
   private MockResourceLoader loader;
 
@@ -46,27 +47,31 @@
     super.setUp();
     loader = new MockResourceLoader();
     resolver = new GwtResourceEntityResolver(loader);
+
+    loader.stream = new InputStream() {
+      @Override
+      public int read() throws IOException {
+        throw new UnsupportedOperationException();
+      }
+    };
   }
 
   public void testNotOurProblem() throws SAXException, IOException {
     assertNull(resolver.resolveEntity(null, "http://arbitrary"));
     assertNull(resolver.resolveEntity("meaningless", "http://arbitrary"));
     assertNull(resolver.resolveEntity(null, "arbitrary/relative"));
+
+    String almostCorrectAndOnceWorked = SYSTEM_ID.replace("files", "filesss");
+    assertNull(resolver.resolveEntity("meaningless", almostCorrectAndOnceWorked));
+    assertNull(resolver.resolveEntity(null, almostCorrectAndOnceWorked));
   }
 
   public void testOursGood() throws SAXException, IOException {
     String publicId = "some old public thing";
-    String systemId = "http://google-web-toolkit.googlecode.com/svn/resources/xhtml.ent";
-    loader.stream = new InputStream() {
-      @Override
-      public int read() throws IOException {
-        throw new UnsupportedOperationException();
-      }      
-    };
-    
-    InputSource s = resolver.resolveEntity(publicId, systemId);
+
+    InputSource s = resolver.resolveEntity(publicId, SYSTEM_ID);
     assertEquals(publicId, s.getPublicId());
-    assertEquals(systemId, s.getSystemId());
+    assertEquals(SYSTEM_ID, s.getSystemId());
     assertEquals(loader.stream, s.getByteStream());
   }
 }