Skip to content

Commit

Permalink
Merge pull request #376 from OndraZizka/fixErrorMsg-WINDUP-419
Browse files Browse the repository at this point in the history
    WINDUP-419 Fix error msg in JavaClassHandler
  • Loading branch information
lincolnthree committed Dec 9, 2014
2 parents ea66d95 + 17b160b commit 4855788
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,39 @@
import org.w3c.dom.Element;

/**
*
*
* Represents a {@link JavaClass} {@link Condition}.
*
*
* Example:
*
*
* <pre>
* &lt;javaclass type="javax.servlet.http.HttpServletRequest"&gt;
* &lt;location&gt;METHOD_PARAMETER&lt;/location&gt;
* &lt;/javaclass&gt;
* </pre>
*
*
* @author jsightler <jesse.sightler@gmail.com>
*
*/
@NamespaceElementHandler(elementName = "javaclass", namespace = "http://windup.jboss.org/v1/xml")
@NamespaceElementHandler(elementName = JavaClassHandler.ELEM_NAME, namespace = "http://windup.jboss.org/v1/xml")
public class JavaClassHandler implements ElementHandler<JavaClassBuilderAt>
{
public static final String ELEM_NAME = "javaclass";
private static final String ATTR_REFERENCES = "references";


@Override
public JavaClassBuilderAt processElement(ParserContext handlerManager, Element element)
throws ConfigurationException
{
String type = $(element).attr("references");
String type = $(element).attr(ATTR_REFERENCES);
String as = $(element).attr("as");
if(as == null) {
as = Iteration.DEFAULT_VARIABLE_LIST_STRING;
}
if (StringUtils.isBlank(type))
{
throw new WindupException("Error, 'javaclass' element must have a non-empty 'type' attribute");
throw new WindupException("The '" + ELEM_NAME + "' element must have a non-empty '" + ATTR_REFERENCES + "' attribute");
}

List<TypeReferenceLocation> locations = new ArrayList<TypeReferenceLocation>();
Expand All @@ -65,7 +68,7 @@ public JavaClassBuilderAt processElement(ParserContext handlerManager, Element e
{
javaClassReferences.inType(namePattern);
}

JavaClassBuilderAt javaClass = javaClassReferences.at(
locations.toArray(new TypeReferenceLocation[locations.size()]));
javaClass.as(as);
Expand Down

0 comments on commit 4855788

Please sign in to comment.