Bug 33095 - Auto Update cannot handle <l10n> with no module_major_version attr
Auto Update cannot handle <l10n> with no module_major_version attr
Status: VERIFIED FIXED
Product: platform
Classification: Unclassified
Component: Autoupdate
3.x
PC Linux
: P1 (vote)
: 3.x
Assigned To: Petr Hrebejk
issues@platform
: I18N
Depends on:
Blocks: 22948 33098
  Show dependency treegraph
 
Reported: 2003-04-21 15:51 UTC by Jesse Glick
Modified: 2003-04-22 18:32 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Stack trace (919 bytes, text/plain)
2003-04-21 15:52 UTC, Jesse Glick
Details
Patch for the fix proposed by Jesse (1.26 KB, patch)
2003-04-22 16:16 UTC, Petr Hrebejk
Details | Diff
Patch for the fix proposed bu Jesse (1.26 KB, patch)
2003-04-22 16:17 UTC, Petr Hrebejk
Details | Diff
Binary patch for relase35 - for testing (3.76 KB, application/octet-stream)
2003-04-22 16:48 UTC, Petr Hrebejk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2003-04-21 15:51:56 UTC
E.g.

http://www.netbeans.org/updates/alpha/dev_alpha_daily.ent

is full of modules that have no major version
number yet have localizations. E.g.:

<module
codenamebase="org.apache.tools.ant.module.docs"
        license="russian_l10n-nbm-license.txt"
        downloadsize="3905"
>
  <l10n 
        langcode="ru"
        module_spec_version="2.9"
OpenIDE-Module-Name="..."
OpenIDE-Module-Long-Description="..."
  />
</module>

This is permitted according to the DTD
("-//NetBeans//DTD Autoupdate Catalog 2.0//EN")
and makes sense. However when parsing the file, AU
throws an exception (attached).

Fix should be simple. This code in L10NUpdate.java
is wrong:

majorversion = Integer.parseInt( getAttribute( n,
"module_major_version" ) ); // NOI18N

should be:

String mmv = getAttribute(n, "module_major_version");
if (mmv != null) {
    majorversion = Integer.parseInt(mmv);
} else {
    majorversion = -1;
}

Note that the same block of code also assumes that
module_spec_version is defined (or an NPE will be
thrown). The DTD permits it to be absent, however
common sense requires that it be present - note
that OpenIDE-Module-Specification-Version is
required for <manifest>. I consider this a bug in
the DTD and hopefully no actual <l10n> element is
missing this attr.
Comment 1 Jesse Glick 2003-04-21 15:52:30 UTC
Created attachment 10050 [details]
Stack trace
Comment 2 Petr Hrebejk 2003-04-22 10:06:56 UTC
Hmm in this case I would rather suggest to change the DTD. I don't
think that if someone does major update to the module, such that it
will change major version, all bundles will remain untouched. But I
can try to implement your patch. Not sure however whether it will
be allowed to go into 3.5. 
The obvious and easy workaround would of course be to add major
version to all modules on the AU server.
Comment 3 Petr Hrebejk 2003-04-22 15:49:40 UTC
OK the fix seems to be lightwight so let's do it for 3.5
Comment 4 Petr Hrebejk 2003-04-22 16:16:54 UTC
Created attachment 10077 [details]
Patch for the fix proposed by Jesse
Comment 5 Petr Hrebejk 2003-04-22 16:17:06 UTC
Created attachment 10078 [details]
Patch for the fix proposed bu Jesse
Comment 6 Petr Hrebejk 2003-04-22 16:19:17 UTC
Fixed in main trunk.
Comment 7 Petr Hrebejk 2003-04-22 16:48:15 UTC
Created attachment 10084 [details]
Binary patch for relase35 - for testing
Comment 8 Petr Hrebejk 2003-04-22 16:53:47 UTC
Crated an binary patch for release3.5 and adding Lukas Hasik to CC to
test the patch in release35. Please replace the zipped class in AU
module jar and create new AU server with url:
http://www.netbeans.org/updates/alpha/dev_alpha_daily_ent.xml

It should work without thorowing any exceptions.
Comment 9 _ ttran 2003-04-22 17:20:28 UTC
Hrebejku, no verification, no review so far but I trust you :-)

Approved for 3.5
Comment 10 Lukas Hasik 2003-04-22 17:48:47 UTC
patch verified
Comment 11 Petr Hrebejk 2003-04-22 17:54:12 UTC
Surry, should be considered reviewed by Jesse as I'm only implementing
his siggested fix.
Comment 12 Petr Hrebejk 2003-04-22 17:58:18 UTC
Merged into release 53
Comment 13 Jesse Glick 2003-04-22 18:19:11 UTC
"Hmm in this case I would rather suggest to change the DTD. I don't
think that if someone does major update to the module, such that it
will change major version, all bundles will remain untouched." - not
sure what you're saying, or what DTD change you are suggesting. Some
modules have major versions, some do not. All modules on AU must have
spec versions. So, the DTD includes version info in the update,
consisting of a mandatory spec version and an optional major version.
What is wrong with that?

"The obvious and easy workaround would of course be to add major
version to all modules on the AU server." - this doesn't make any
sense IMHO. Modules such as org.openide.execution have no major
version, and they shouldn't have one because they are pure library
modules and we do not plan to make incompatible major releases (we
would use compat bridges instead).
Comment 14 Jesse Glick 2003-04-22 18:22:26 UTC
For the record, I looked at the patch and it looks fine. Does it work?
If so, someone (Lukas?) please mark VERIFIED.
Comment 15 Lukas Hasik 2003-04-22 18:32:46 UTC
yes, patch works fine - no exception after replace of L10NUpdate class.

marking VERIFIED


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo