http://argouml.tigris.org/issues/show_bug.cgi?id=6442
Issue #|6442
Summary|ProfileLoader builds an incorrect URL for paths inside
| JAR files
Component|argouml
Version|0.34
Platform|All
URL|
OS/Version|Windows Vista
Status|NEW
Status whiteboard|
Keywords|
Resolution|
Issue type|DEFECT
Priority|P3
Subcomponent|Profiles
Assigned to|issues@argouml
Reported by|miklin
------- Additional comments from [email protected] Wed Oct 10 14:39:41 -0700 2012 -------
A user defined profile stored as an XMI file inside a JAR file in the ext dir
(with MANIFEST.MF referencing the XMI file) cannot be loaded (at least on
Windows 7), because the ProfileLoader class constructs an incorrect URL to the
JAR entry.
For example - my ext directory is located at: "C:\Program Files (x86)\ArgoUML\ext"
I have created a JAR file called "php5.jar", containing:
* An XMI file called "php5.xmi" directly in the root of the JAR file
* A META-INF/MANIFEST.MF file containing the following:
---
Manifest-Version: 1.0
Name: PHP 5
Profile: true
Model: /php5.xmi
---
When I start ArgoUML, no error is reported by the GUI, but the ArgoUML log file
will contain the following messages:
2012-10-10 22:34:38,900 WARN: Bad URI syntax for base URI from XMI document
jar:file:C:\Program Files (x86)\ArgoUML\ext\php5.jar!/php5.xmi
(XmiReferenceResolverImpl.java:237)
java.net.URISyntaxException: Illegal character in opaque part at index 11:
jar:file:C:\Program Files (x86)\ArgoUML\ext\php5.jar!/
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.checkChars(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at
org.argouml.model.mdr.XmiReferenceResolverImpl.register(XmiReferenceResolverImpl.java:234)
at org.netbeans.lib.jmi.xmi.XmiContext.putReference(XmiContext.java:801)
at org.netbeans.lib.jmi.xmi.XmiElement$Instance.createInstance(XmiElement.java:591)
at org.netbeans.lib.jmi.xmi.XmiElement$Instance.endElement(XmiElement.java:626)
at org.netbeans.lib.jmi.xmi.XmiSAXReader.endElement(XmiSAXReader.java:258)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown
Source)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.netbeans.lib.jmi.xmi.XmiSAXReader.read(XmiSAXReader.java:136)
at org.netbeans.lib.jmi.xmi.XmiSAXReader.read(XmiSAXReader.java:98)
at org.netbeans.lib.jmi.xmi.SAXReader.read(SAXReader.java:56)
at org.argouml.model.mdr.XmiReaderImpl.parse(XmiReaderImpl.java:267)
at org.argouml.profile.URLModelLoader.loadModel(URLModelLoader.java:99)
at org.argouml.profile.URLModelLoader.loadModel(URLModelLoader.java:119)
at org.argouml.profile.UserDefinedProfile.loadModel(UserDefinedProfile.java:325)
at
org.argouml.profile.UserDefinedProfile.getProfilePackages(UserDefinedProfile.java:745)
at
org.argouml.profile.UserDefinedProfile.getAllCritiquesInModel(UserDefinedProfile.java:664)
at org.argouml.profile.UserDefinedProfile.getCritics(UserDefinedProfile.java:449)
at
org.argouml.profile.internal.ProfileManagerImpl.registerProfileInternal(ProfileManagerImpl.java:290)
at
org.argouml.profile.internal.ProfileManagerImpl.registerProfile(ProfileManagerImpl.java:267)
at
org.argouml.profile.init.ProfileLoader.loadProfilesFromJarFile(ProfileLoader.java:165)
at
org.argouml.profile.init.ProfileLoader.huntForProfilesInDir(ProfileLoader.java:114)
at org.argouml.profile.init.ProfileLoader.doLoad(ProfileLoader.java:94)
at org.argouml.profile.init.InitProfileSubsystem.init(InitProfileSubsystem.java:72)
at org.argouml.application.Main.initializeSubsystems(Main.java:425)
at org.argouml.application.Main.main(Main.java:189)
As you can see, the URL is incorrect. It SHOULD be:
jar:file:C:/Program%20Files%20(x86)/ArgoUML/ext/php5.jar!/php5.xmi
not, as in the error message above:
jar:file:C:\Program Files (x86)\ArgoUML\ext\php5.jar!/php5.xmi
This is done in the loadProfilesFromJarFile method of the
org.argouml.profile.init.ProfileLoader class, which does the following at line
#156 (in revision #17940):
modelURL = new URL(JAR_PREFIX + FILE_PREFIX
+ file.getCanonicalPath() + "!" + modelPath);
This should be easy to fix. In fact, I made a quick'n'dirty fix just to test my
theory, and the user defined profile would load without any issue when I changed
the code above to the following:
modelURL = new URL(JAR_PREFIX + FILE_PREFIX
+ "/" + file.getCanonicalPath().replace('\\', '/').replace(" ", "%20") +
"!" + modelPath);
This is, however, not a good approach - I just wanted to verify the issue.
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=448&dsMessageId=3019603
To unsubscribe from this list, e-mail: [[email protected]].
Please do not reply to this mail. Instead, add your comments in the issue.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.