I remember I had discussion with Chris about that piece of code already. I don't remember exactly what he said, but there were OO reasons, why he deliberately did not move it into a common base class.
Juergen On Tue, 01 Feb 2005 01:03:44 +0100, Martijn Dashorst <[EMAIL PROTECTED]> wrote: > I used CPD (a tool downloadable from http://pmd.sourceforge.net) to > check Wicket for duplicate code, and I found the following 2 items > (using a setting of 'minimum tile size': 75). > > Perhaps something to look into? > > Martijn > > ===================================================================== > > Found a 49 line (122 tokens) duplication in the following files: > > Starting at line 131 of > C:\workspace\wicket\wicket\src\java\wicket\resource\ApplicationStringResourceLoader.java > > Starting at line 187 of > C:\workspace\wicket\wicket\src\java\wicket\resource\ComponentStringResourceLoader.java > > .getSourcePath(), component.getClass(), style, locale, > "properties"); > > if (resource != null) > > { > > try > > { > > try > > { > > properties.load(new > BufferedInputStream(resource.getInputStream())); > > strings = new ValueMap(properties); > > } > > finally > > { > > resource.close(); > > } > > } > > catch (ResourceNotFoundException e) > > { > > log.warn("Unable to find resource " + resource, e); > > strings = ValueMap.EMPTY_MAP; > > } > > catch (IOException e) > > { > > log.warn("Unable to access resource " + resource, e); > > strings = ValueMap.EMPTY_MAP; > > } > > } > > else > > { > > // Unable to load resources > > strings = ValueMap.EMPTY_MAP; > > } > > resourceCache.put(id, strings); > > return strings; > > } > > /** > > * Helper method to create a unique id for caching previously loaded > > * resources. > > * > > * @param component > > * The component that the resources are being loaded for > > * @param style > > * The style of the resources > > * @param locale > > * The locale of the resources > > * @return The unique cache id > > */ > > private String createCacheId(final Component component, final String > style, final Locale locale) > > ===================================================================== > > Found a 19 line (82 tokens) duplication in the following files: > > Starting at line 335 of > C:\workspace\wicket\wicket\src\java\wicket\util\profile\ObjectProfiler.java > > Starting at line 448 of > C:\workspace\wicket\wicket\src\java\wicket\util\profile\ObjectProfiler.java > > for (int f = 0, fLimit = fields.length; f < fLimit; ++f) > > { > > final Field field = fields[f]; > > final Object ref; > > try > > // to get the field value: > > { > > ref = field.get(obj); > > } > > catch (Exception e) > > { > > throw new WicketRuntimeException("cannot get > field [" > > + field.getName() + "] of class [" > > + field.getDeclaringClass().getName() + > "]: " + e.toString()); > > } > > if (ref != null) > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Wicket-develop mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wicket-develop > ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
