]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed sampler source resolving issue where the Feature was not in the same package...
authorArtur Signell <artur.signell@itmill.com>
Fri, 6 Feb 2009 21:08:25 +0000 (21:08 +0000)
committerArtur Signell <artur.signell@itmill.com>
Fri, 6 Feb 2009 21:08:25 +0000 (21:08 +0000)
svn changeset:6762/svn branch:trunk

src/com/itmill/toolkit/demo/sampler/Feature.java

index 6061fac0947f2c495ec332cabeab964a496b3f1b..8fb488000849d0324e698b8bd99666c43ecb05bc 100644 (file)
@@ -57,8 +57,8 @@ abstract public class Feature {
      * May return null, if the example has no related resources.
      * </p>
      * <p>
-     * The name of the NamedExternalResource will be shown in the UI. <br/> Note
-     * that Javadoc should be referenced via {@link #getRelatedAPI()}.
+     * The name of the NamedExternalResource will be shown in the UI. <br/>
+     * Note that Javadoc should be referenced via {@link #getRelatedAPI()}.
      * </p>
      * 
      * @see #getThemeBase()
@@ -132,8 +132,15 @@ abstract public class Feature {
             if (javaSource == null) {
                 StringBuffer src = new StringBuffer();
                 try {
+                    /*
+                     * Use package name + class name so the class loader won't
+                     * have to guess the package name.
+                     */
+                    String resourceName = "/"
+                            + getExample().getClass().getName().replace('.',
+                                    '/') + ".java";
                     InputStream is = getClass().getResourceAsStream(
-                            getExample().getClass().getSimpleName() + ".java");
+                            resourceName);
                     BufferedReader bis = new BufferedReader(
                             new InputStreamReader(is));
                     for (String line = bis.readLine(); null != line; line = bis