DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
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

Sort Order: Ascending order - Click to sort in descending order
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

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