[YANGTOOLS-404] Can not import yang modul with explicit revision date: 1970-01-01 Created: 28/Jan/15 Updated: 10/Apr/22 Resolved: 20/Aug/15 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Peter Kajsa | Assignee: | Peter Kajsa |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Operating System: All |
||
| External issue ID: | 2649 |
| Priority: | Low |
| Description |
|
The default yang module revision date is initialized as new Date(0); The returned date is dependent on current time zone and so default yang module revision is initialized now in SR as "Thu Jan 01 01:00:00 CET 1970" which is one hour after the imported yang module revision date "1970-01-01" and then imported yang module can not be resolved. Crucial is the line 322 in YangParserBaseListener.java. Parsing of following yang models: module foo { import import-module { prefix imp; revision-date 1970-01-01; }} module import-module { revision 1970-01-01 { description "Initial revision."; }} produce the following exception: Exception in thread "main" org.opendaylight.yangtools.yang.parser.util.YangValidationException: Not existing module imported:import-module:1970-01-01 by:foo:default |
| Comments |
| Comment by Robert Varga [ 09/Jun/15 ] |
|
We need to replace calls to 'new Date' with Calendar.getInstance(TimeZone.UTC) to make sure we talk in the same zone everywhere. |
| Comment by Robert Varga [ 09/Jun/15 ] |
|
Actually, that also needs to include a Locale to fix the format. |
| Comment by Peter Kajsa [ 17/Jun/15 ] |
|
It is solved in implementation of new yang statement parser. |
| Comment by Peter Kajsa [ 17/Jun/15 ] |
|
(In reply to Peter Kajsa from comment #3) |