2222
2323package org .jboss .as .pojo ;
2424
25+ import java .io .IOException ;
26+ import java .io .InputStream ;
27+ import java .util .ArrayList ;
28+ import java .util .Collection ;
29+ import java .util .Collections ;
30+ import java .util .List ;
31+
32+ import javax .xml .namespace .QName ;
33+ import javax .xml .stream .XMLInputFactory ;
34+ import javax .xml .stream .XMLStreamReader ;
35+
2536import org .jboss .as .pojo .descriptor .KernelDeploymentXmlDescriptor ;
2637import org .jboss .as .pojo .descriptor .KernelDeploymentXmlDescriptorParser ;
2738import org .jboss .as .pojo .descriptor .LegacyKernelDeploymentXmlDescriptorParser ;
3748import org .jboss .vfs .VirtualFileFilter ;
3849import org .jboss .vfs .util .SuffixMatchFilter ;
3950
40- import javax .xml .namespace .QName ;
41- import javax .xml .stream .XMLInputFactory ;
42- import javax .xml .stream .XMLStreamReader ;
43- import java .io .IOException ;
44- import java .io .InputStream ;
45- import java .util .ArrayList ;
46- import java .util .Collection ;
47- import java .util .Collections ;
48- import java .util .List ;
49-
5051/**
5152 * DeploymentUnitProcessor responsible for parsing a jboss-beans.xml
5253 * descriptor and attaching the corresponding KernelDeploymentXmlDescriptor.
@@ -73,6 +74,7 @@ public KernelDeploymentParsingProcessor() {
7374 *
7475 * @param phaseContext the deployment unit context
7576 * @throws DeploymentUnitProcessingException
77+ *
7678 */
7779 @ Override
7880 public void deploy (DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException {
@@ -91,15 +93,16 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
9193 *
9294 * @param unit the deployment unit
9395 * @param root the root
94- * @throws DeploymentUnitProcessingException for any error
96+ * @throws DeploymentUnitProcessingException
97+ * for any error
9598 */
9699 protected void parseDescriptors (DeploymentUnit unit , VirtualFile root ) throws DeploymentUnitProcessingException {
97100 if (root == null || root .exists () == false )
98101 return ;
99102
100103 Collection <VirtualFile > beans ;
101104 final String name = root .getName ();
102- if (name .endsWith ("jboss-beans.xml" )) {
105+ if (name .endsWith ("jboss-beans.xml" )) {
103106 beans = Collections .singleton (root );
104107 } else {
105108 VirtualFileFilter filter = new SuffixMatchFilter ("jboss-beans.xml" );
@@ -131,12 +134,13 @@ protected void parseDescriptors(DeploymentUnit unit, VirtualFile root) throws De
131134 /**
132135 * Parse -jboss-beans.xml file.
133136 *
134- * @param unit the deployment unit
137+ * @param unit the deployment unit
135138 * @param beansXmlFile the beans xml file
136- * @throws DeploymentUnitProcessingException for any error
139+ * @throws DeploymentUnitProcessingException
140+ * for any error
137141 */
138142 protected void parseDescriptor (DeploymentUnit unit , VirtualFile beansXmlFile ) throws DeploymentUnitProcessingException {
139- if (beansXmlFile == null || beansXmlFile .exists () == false )
143+ if (beansXmlFile == null || beansXmlFile .exists () == false )
140144 return ;
141145
142146 InputStream xmlStream = null ;
@@ -146,14 +150,14 @@ protected void parseDescriptor(DeploymentUnit unit, VirtualFile beansXmlFile) th
146150 final ParseResult <KernelDeploymentXmlDescriptor > result = new ParseResult <KernelDeploymentXmlDescriptor >();
147151 xmlMapper .parseDocument (result , reader );
148152 final KernelDeploymentXmlDescriptor xmlDescriptor = result .getResult ();
149- if (xmlDescriptor != null )
153+ if (xmlDescriptor != null )
150154 unit .addToAttachmentList (KernelDeploymentXmlDescriptor .ATTACHMENT_KEY , xmlDescriptor );
151155 else
152156 throw PojoMessages .MESSAGES .failedToParse (beansXmlFile );
153- } catch (DeploymentUnitProcessingException e ) {
157+ } catch (DeploymentUnitProcessingException e ) {
154158 throw e ;
155- } catch (Exception e ) {
156- throw PojoMessages .MESSAGES .failedToParse (beansXmlFile );
159+ } catch (Exception e ) {
160+ throw PojoMessages .MESSAGES .parsingException (beansXmlFile , e );
157161 } finally {
158162 VFSUtils .safeClose (xmlStream );
159163 }
0 commit comments