Also, using 'simian' (a maven plugin) I found the following duplications: Similarity threshold (lines) 10 Total number of duplicate lines 294 Total number of duplicate blocks 20 Total number of files with duplicates 12 Total number of processed lines 12929 Total number of processed files 322 Scan time 1891ms
Duplications Duplication: 24 lines
* wicket.markup.html.table.PagedTableNavigatorTest ( 204 - 240 ) * wicket.markup.html.table.SortableTableHeadersTest ( 119 - 155 )
Duplication: 17 lines
* wicket.resource.ApplicationStringResourceLoader ( 132 - 164 ) * wicket.resource.ComponentStringResourceLoader ( 188 - 220 )
Duplication: 17 lines
* wicket.markup.html.table.IncrementalTableNavigationTest ( 91 - 109 ) * wicket.markup.html.table.PagedTableTest ( 84 - 102 )
Duplication: 15 lines
* wicket.markup.html.table.IncrementalTableNavigationTest ( 118 - 145 ) * wicket.markup.html.table.PagedTableTest ( 119 - 144 )
Duplication: 15 lines
* wicket.markup.html.table.IncrementalTableNavigationPage ( 42 - 62 ) * wicket.markup.html.table.PagedTableNavigatorPage ( 42 - 62 )
Duplication: 13 lines
* wicket.markup.html.table.PagedTableTest ( 132 - 145 ) * wicket.markup.html.table.IncrementalTableNavigationTest ( 174 - 187 )
Duplication: 13 lines
* wicket.markup.html.table.PagedTableNavigatorTest ( 88 - 104 ) * wicket.markup.html.table.PagedTableNavigatorTest ( 164 - 180 )
Duplication: 12 lines
* wicket.AttributeModifierComponentTest ( 62 - 83 ) * wicket.markup.html.link.AutolinkTest ( 56 - 77 )
Duplication: 11 lines
* wicket.markup.html.table.ListItemTest ( 43 - 70 ) * wicket.markup.html.table.ListViewTest ( 42 - 70 )
Martijn Dashorst 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
