Issue Details (XML | Word | Printable)

Key: NUCCORE-798
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Andy Jefferson
Reporter: Andy Jefferson
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Improvement to NUCCORE-695

Created: 15/Jan/12 09:23 AM   Updated: 18/Feb/14 09:22 AM   Resolved: 15/Jan/12 09:24 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.6


 Description  « Hide
See the comment by Ales Justin on NUCCORE-695 and proposed patch

Andy Jefferson added a comment - 15/Jan/12 09:24 AM
SVN trunk has this patch; left as exercise for users to try it on JBoss6/7

Andy Jefferson made changes - 15/Jan/12 09:24 AM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Assignee Andy Jefferson [ andy ]
Resolution Fixed [ 1 ]
Ales Justin added a comment - 15/Jan/12 03:16 PM
That alone is not enough -- I didn't see "vfs" was also added to actual Manifest reading.

Andy, with the change you made, you can simply drop this code:
(VFS's URL handling will know how to provide access to Manifest's InputStream, hence last code will kick in and do the job)

            else if (manifest.getProtocol().equals("vfsfile") || manifest.getProtocol().equals("vfsjar") ||
426 manifest.getProtocol().equals("vfszip") || manifest.getProtocol().equals("vfs") )
427 {
428 // protocol formats:
429 // vfsfile:<path>!<manifest-file>, vfsjar:<path>!<manifest-file>, vfszip:<path>!<manifest-file>
430 String path = StringUtils.getDecodedStringFromURLString(manifest.toExternalForm());
431 int index = path.indexOf(JAR_SEPARATOR);
432 if (index < 0)
433 {
434 NucleusLogger.PLUGIN.warn("Unable to find jar bundle for " + path + " so ignoring");
435 return null;
436 }
437 else
438 {
439 String jarPath = path.substring(0, index);
440 URL jarUrl = new URL(jarPath);
441
442 JarInputStream jis = null;
443 InputStream inputStream = jarUrl.openConnection().getInputStream();
444
445 // JBoss 6 returns a JarInputStream instead of FileInputStream as previous versions
446 // which won't return the manifest below if we use it to construct a new JarInputStream,
447 // so we just use it.
448 if ( inputStream instanceof JarInputStream )
449 {
450 jis = (JarInputStream) inputStream;
451 }
452 else
453 {
454 jis = new JarInputStream(inputStream);
455 }
456
457 try
458 {
459 mf = jis.getManifest();
460 if (mf == null)
461 {
462 return null;
463 }
464 }
465 finally
466 {
467 jis.close();
468 }
469 return registerBundle(mf, jarUrl);
470 }
471 }

Simple remove this and this code will handle it

                is = manifest.openStream();
475 mf = new Manifest(is);
476 return registerBundle(mf,manifest);

Andy Jefferson added a comment - 15/Jan/12 03:40 PM
Fine, but please provide "patch" format in future - removes all debate about whether something is exactly as intended

Andy Jefferson made changes - 06/Feb/12 10:13 AM
Status Resolved [ 5 ] Closed [ 6 ]
Andy Jefferson made changes - 18/Feb/14 09:22 AM
Component/s Plugins [ 10153 ]