You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2006/08/30 09:25:35 UTC
Re: svn commit: r438213 - in /lenya/trunk/src: impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java
modules/migration/java/test/org/apache/lenya/cms/migration/MigrateUuidsTest.java
Hi Doug,
chestnut@apache.org wrote:
> Author: chestnut
> Date: Tue Aug 29 14:05:18 2006
> New Revision: 438213
>
> URL: http://svn.apache.org/viewvc?rev=438213&view=rev
> Log:
> fixed some NPEs when migrating a pub with no areas (should skip pub, not give npe)
[...]
> String[] areaNames = pub.getAreaNames();
> - for (int i = 0; i < areaNames.length; i++) {
> - Area area = pub.getArea(areaNames[i]);
> - migrateArea(area);
> + if (areaNames != null) {
IMO it is a bug if a publication returns null instead of an empty array.
When does this occur?
-- Andreas
> + for (int i = 0; i < areaNames.length; i++) {
> + Area area = pub.getArea(areaNames[i]);
> + migrateArea(area);
> + }
> }
> }
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: svn commit: r438213 - in /lenya/trunk/src: impl/java/org/apache/lenya/cms/publication/PublicationConfiguration.java
modules/migration/java/test/org/apache/lenya/cms/migration/MigrateUuidsTest.java
Posted by Doug Chestnut <dh...@virginia.edu>.
Andreas Hartmann wrote:
> Hi Doug,
>
> chestnut@apache.org wrote:
>
>> Author: chestnut
>> Date: Tue Aug 29 14:05:18 2006
>> New Revision: 438213
>>
>> URL: http://svn.apache.org/viewvc?rev=438213&view=rev
>> Log:
>> fixed some NPEs when migrating a pub with no areas (should skip pub,
>> not give npe)
>
>
> [...]
>
>> String[] areaNames = pub.getAreaNames();
>> - for (int i = 0; i < areaNames.length; i++) {
>> - Area area = pub.getArea(areaNames[i]);
>> - migrateArea(area);
>> + if (areaNames != null) {
>
>
> IMO it is a bug if a publication returns null instead of an empty array.
> When does this occur?
When a publication has no area directories in it's content directory.
getAreaNames from the PublicationConfiguration class looks at the
content directory of the pub to get the areas.
This returned a npe when no area directories in the pub yet (newly
created pub):
File[] directories = content.listFiles(new FileFilter() {
public boolean accept(File file) {
String name = file.getName();
return file.isDirectory() && !name.equals("rcml")
&& !name.equals("rcbak");
}
});
this.areas = new String[directories.length];
for (int i = 0; i < directories.length; i++) {
this.areas[i] = directories[i].getName();
}
--Doug
>
> -- Andreas
>
>
>> + for (int i = 0; i < areaNames.length; i++) {
>> + Area area = pub.getArea(areaNames[i]);
>> + migrateArea(area);
>> + }
>> }
>> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org