Question about SlideIds (and Id generation used)
Posted: Thu Mar 08, 2012 5:25 am
The method of generation of the slideId (and the other Ids) seems to leave the possibility open (if unlikely in general practice) for inserted slides to have the same Id (especially if the pptx is modified on several different occasions). In my particular instance I am looking at how to generated unique Ids for added graphic frame (cNvPr) so I was browsing how it was done for slideIds...
The code seems to be in JaxbPmlPart
Does this not introduce a possible corruption where Ids can clash? (or am i missing something - which is perhaps likely). Admittedly this is unlikely, but does not seem impossible.
The code seems to be in JaxbPmlPart
- Code: Select all
61 protected static Random random = new Random();
62
63 protected long getSlideLayoutOrMasterId() {
64 // See spec 4.8.18 (ST_SlideLayoutId) and 4.8.20 (ST_SlideMasterId)
65 long val = random.nextInt(2147483647) + 2147483648l;
66 return val;
67 }
68 protected long getSlideId() {
69 // See spec 4.8.17 (ST_SlideId)
70 long val = random.nextInt(2147483392) + 256;
71 return val;
72 }
Does this not introduce a possible corruption where Ids can clash? (or am i missing something - which is perhaps likely). Admittedly this is unlikely, but does not seem impossible.