1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/processor/generator/JwsImplGenerator.java Tue Mar 06 16:09:35 2012 -0800 1.3 @@ -0,0 +1,574 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.tools.internal.ws.processor.generator; 1.30 + 1.31 +import com.sun.codemodel.internal.*; 1.32 +import com.sun.tools.internal.ws.processor.model.*; 1.33 +import com.sun.tools.internal.ws.processor.model.java.JavaInterface; 1.34 +import com.sun.tools.internal.ws.processor.model.java.JavaMethod; 1.35 +import com.sun.tools.internal.ws.processor.model.java.JavaParameter; 1.36 +import com.sun.tools.internal.ws.processor.model.jaxb.JAXBTypeAndAnnotation; 1.37 +import com.sun.tools.internal.ws.wsdl.document.Definitions; 1.38 +import com.sun.tools.internal.ws.wsdl.document.Binding; 1.39 +import com.sun.tools.internal.ws.wsdl.document.soap.SOAP12Binding; 1.40 +import com.sun.tools.internal.ws.wsdl.document.soap.SOAPBinding; 1.41 +import com.sun.tools.internal.ws.wsdl.document.soap.SOAPConstants; 1.42 +import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; 1.43 +import com.sun.tools.internal.ws.wscompile.ErrorReceiver; 1.44 +import com.sun.tools.internal.ws.processor.model.ModelProperties; 1.45 +import com.sun.tools.internal.ws.wscompile.WsimportOptions; 1.46 +import com.sun.codemodel.internal.JClassAlreadyExistsException; 1.47 +import com.sun.xml.internal.ws.api.SOAPVersion; 1.48 + 1.49 +import com.sun.xml.internal.ws.util.ServiceFinder; 1.50 + 1.51 +import javax.jws.WebService; 1.52 +import javax.xml.ws.BindingType; 1.53 +import javax.xml.namespace.QName; 1.54 +import javax.xml.ws.Holder; 1.55 +import java.io.File; 1.56 +import java.util.ArrayList; 1.57 +import java.util.HashMap; 1.58 +import java.util.List; 1.59 +import java.util.Iterator; 1.60 +import java.util.Map; 1.61 + 1.62 +/** 1.63 + * Generator for placeholder JWS implementations 1.64 + * 1.65 + * @since 2.2.6 1.66 + */ 1.67 +public final class JwsImplGenerator extends GeneratorBase { 1.68 + private static final Map<String, String> TRANSLATION_MAP = new HashMap<String, String>( 1.69 + 1); 1.70 + static 1.71 + { 1.72 + TRANSLATION_MAP.put(SOAPConstants.URI_SOAP_TRANSPORT_HTTP, 1.73 + javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING); 1.74 + } 1.75 + // save the generated impl files' info 1.76 + private final List<String> implFiles = new ArrayList<String>(); 1.77 + 1.78 + public static List<String> generate(Model model, WsimportOptions options, 1.79 + ErrorReceiver receiver) { 1.80 + // options check 1.81 + 1.82 + // Generate it according the implDestDir option 1.83 + if (options.implDestDir == null) 1.84 + return null; 1.85 + 1.86 + JwsImplGenerator jwsImplGenerator = new JwsImplGenerator(); 1.87 + jwsImplGenerator.init(model, options, receiver); 1.88 + jwsImplGenerator.doGeneration(); 1.89 + // print a warning message while implFiles.size() is zero 1.90 + if (jwsImplGenerator.implFiles.size() == 0) { 1.91 + StringBuffer msg = new StringBuffer(); 1.92 + if (options.implServiceName != null) 1.93 + msg.append("serviceName=[" + options.implServiceName + "] "); 1.94 + if (options.implPortName != null) 1.95 + msg.append("portName=[" + options.implPortName + "] "); 1.96 + 1.97 + if (msg.length() > 0) 1.98 + msg.append(", Not found in wsdl file.\n"); 1.99 + 1.100 + msg.append("No impl files generated!"); 1.101 + receiver.warning(null, msg.toString()); 1.102 + } 1.103 + 1.104 + return jwsImplGenerator.implFiles; 1.105 + } 1.106 + 1.107 + /** 1.108 + * Move impl files to implDestDir 1.109 + */ 1.110 + public static boolean moveToImplDestDir(List<String> gImplFiles, 1.111 + WsimportOptions options, ErrorReceiver receiver) { 1.112 + if (options.implDestDir == null || gImplFiles == null 1.113 + || gImplFiles.size() == 0) 1.114 + return true; 1.115 + 1.116 + List<ImplFile> generatedImplFiles = ImplFile.toImplFiles(gImplFiles); 1.117 + 1.118 + try { 1.119 + File implDestDir = makePackageDir(options); 1.120 + 1.121 + File movedF; 1.122 + File f; 1.123 + for (ImplFile implF : generatedImplFiles) { 1.124 + movedF = findFile(options, implF.qualifiedName); 1.125 + if (movedF == null) { 1.126 + // should never happen 1.127 + receiver.warning(null, "Class " + implF.qualifiedName 1.128 + + " is not generated. Not moving."); 1.129 + return false; 1.130 + } 1.131 + 1.132 + f = new File(implDestDir, implF.name); 1.133 + if (!movedF.equals(f)) { //bug 10102169 1.134 + 1.135 + if (f.exists()) 1.136 + { 1.137 + if (!f.delete()){ 1.138 + receiver.error("Class " + implF.qualifiedName 1.139 + + " has existed in destImplDir, and it " 1.140 + + "can not be written!", null); 1.141 + } 1.142 + } 1.143 + if(!movedF.renameTo(f)) 1.144 + { 1.145 + throw new Exception(); 1.146 + } 1.147 + } 1.148 + } 1.149 + } catch (Exception e) { 1.150 + receiver.error("Moving WebService Impl files failed!", e); 1.151 + return false; 1.152 + } 1.153 + return true; 1.154 + } 1.155 + 1.156 + private JwsImplGenerator() { 1.157 + donotOverride = true; 1.158 + } 1.159 + 1.160 + @Override 1.161 + public void visit(Service service) { 1.162 + QName serviceName = service.getName(); 1.163 + // process the ordered service only if it is defined 1.164 + if (options.implServiceName != null 1.165 + && !equalsNSOptional(options.implServiceName, serviceName)) 1.166 + return; 1.167 + 1.168 + for (Port port : service.getPorts()) { 1.169 + if (port.isProvider()) { 1.170 + continue; // Not generating for Provider based endpoint 1.171 + } 1.172 + 1.173 + // Generate the impl class name according to 1.174 + // Xpath(/definitions/service/port[@name]); 1.175 + QName portName = port.getName(); 1.176 + 1.177 + // process the ordered port only if it is defined 1.178 + if (options.implPortName != null 1.179 + && !equalsNSOptional(options.implPortName, portName)) 1.180 + continue; 1.181 + 1.182 + String simpleClassName = serviceName.getLocalPart() + "_" 1.183 + + portName.getLocalPart() + "Impl"; 1.184 + String className = makePackageQualified(simpleClassName); 1.185 + implFiles.add(className); 1.186 + 1.187 + if (donotOverride && GeneratorUtil.classExists(options, className)) { 1.188 + log("Class " + className + " exists. Not overriding."); 1.189 + return; 1.190 + } 1.191 + 1.192 + JDefinedClass cls = null; 1.193 + try { 1.194 + cls = getClass(className, ClassType.CLASS); 1.195 + } catch (JClassAlreadyExistsException e) { 1.196 + log("Class " + className 1.197 + + " generates failed. JClassAlreadyExistsException[" + className 1.198 + + "]."); 1.199 + return; 1.200 + } 1.201 + 1.202 + // Each serviceImpl will implements one port interface 1.203 + JavaInterface portIntf = port.getJavaInterface(); 1.204 + String portClassName = Names.customJavaTypeClassName(portIntf); 1.205 + JDefinedClass portCls = null; 1.206 + try { 1.207 + portCls = getClass(portClassName, ClassType.INTERFACE); 1.208 + } catch (JClassAlreadyExistsException e) { 1.209 + log("Class " + className 1.210 + + " generates failed. JClassAlreadyExistsException[" 1.211 + + portClassName + "]."); 1.212 + return; 1.213 + } 1.214 + cls._implements(portCls); 1.215 + 1.216 + // create a default constructor 1.217 + cls.constructor(JMod.PUBLIC); 1.218 + 1.219 + // write class comment - JAXWS warning 1.220 + JDocComment comment = cls.javadoc(); 1.221 + 1.222 + if (service.getJavaDoc() != null) { 1.223 + comment.add(service.getJavaDoc()); 1.224 + comment.add("\n\n"); 1.225 + } 1.226 + 1.227 + for (String doc : getJAXWSClassComment()) { 1.228 + comment.add(doc); 1.229 + } 1.230 + 1.231 + // @WebService 1.232 + JAnnotationUse webServiceAnn = cls.annotate(cm.ref(WebService.class)); 1.233 + writeWebServiceAnnotation(service, port, webServiceAnn); 1.234 + 1.235 + // @BindingType 1.236 + JAnnotationUse bindingTypeAnn = cls.annotate(cm.ref(BindingType.class)); 1.237 + writeBindingTypeAnnotation(port, bindingTypeAnn); 1.238 + 1.239 + // extra annotation 1.240 + for( GeneratorExtension f : ServiceFinder.find(GeneratorExtension.class) ) { 1.241 + f.writeWebServiceAnnotation(model, cm, cls, port); 1.242 + } 1.243 + 1.244 + // WebMethods 1.245 + for (Operation operation : port.getOperations()) { 1.246 + JavaMethod method = operation.getJavaMethod(); 1.247 + 1.248 + // @WebMethod 1.249 + JMethod m; 1.250 + JDocComment methodDoc; 1.251 + String methodJavaDoc = operation.getJavaDoc(); 1.252 + if (method.getReturnType().getName().equals("void")) { 1.253 + m = cls.method(JMod.PUBLIC, void.class, method.getName()); 1.254 + methodDoc = m.javadoc(); 1.255 + } else { 1.256 + JAXBTypeAndAnnotation retType = method.getReturnType().getType(); 1.257 + m = cls.method(JMod.PUBLIC, retType.getType(), method.getName()); 1.258 + retType.annotate(m); 1.259 + methodDoc = m.javadoc(); 1.260 + JCommentPart ret = methodDoc.addReturn(); 1.261 + ret.add("returns " + retType.getName()); 1.262 + } 1.263 + 1.264 + if (methodJavaDoc != null) 1.265 + methodDoc.add(methodJavaDoc); 1.266 + 1.267 + JClass holder = cm.ref(Holder.class); 1.268 + for (JavaParameter parameter : method.getParametersList()) { 1.269 + JVar var; 1.270 + JAXBTypeAndAnnotation paramType = parameter.getType().getType(); 1.271 + if (parameter.isHolder()) { 1.272 + var = m.param(holder.narrow(paramType.getType().boxify()), 1.273 + parameter.getName()); 1.274 + } else { 1.275 + var = m.param(paramType.getType(), parameter.getName()); 1.276 + } 1.277 + methodDoc.addParam(var); 1.278 + } 1.279 + 1.280 + com.sun.tools.internal.ws.wsdl.document.Operation wsdlOp = operation 1.281 + .getWSDLPortTypeOperation(); 1.282 + for (Fault fault : operation.getFaultsSet()) { 1.283 + m._throws(fault.getExceptionClass()); 1.284 + methodDoc.addThrows(fault.getExceptionClass()); 1.285 + wsdlOp.putFault(fault.getWsdlFaultName(), fault.getExceptionClass()); 1.286 + } 1.287 + m.body().block().directStatement("//replace with your impl here"); 1.288 + m.body().block().directStatement( 1.289 + getReturnString(method.getReturnType().getName())); 1.290 + } 1.291 + } 1.292 + } 1.293 + 1.294 + /** 1.295 + * Generate return statement according to return type. 1.296 + * 1.297 + * @param type 1.298 + * The method's return type 1.299 + * @return The whole return statement 1.300 + */ 1.301 + private String getReturnString(String type) { 1.302 + final String nullReturnStr = "return null;"; 1.303 + // complex type or array 1.304 + if (type.indexOf('.') > -1 || type.indexOf('[') > -1) { 1.305 + return nullReturnStr; 1.306 + } 1.307 + 1.308 + // primitive type 1.309 + if (type.equals("void")) { 1.310 + return "return;"; 1.311 + } 1.312 + if (type.equals("boolean")) { 1.313 + return "return false;"; 1.314 + } 1.315 + if (type.equals("int") || type.equals("byte") || type.equals("short") 1.316 + || type.equals("long") || type.equals("double") || type.equals("float")) { 1.317 + return "return 0;"; 1.318 + } 1.319 + if (type.equals("char")) { 1.320 + return "return '0';"; 1.321 + } 1.322 + 1.323 + return nullReturnStr; 1.324 + } 1.325 + 1.326 + /** 1.327 + * 1.328 + * @param service 1.329 + * @param port 1.330 + * @param webServiceAnn 1.331 + * @param options 1.332 + */ 1.333 + private void writeWebServiceAnnotation(Service service, Port port, 1.334 + JAnnotationUse webServiceAnn) { 1.335 + webServiceAnn.param("portName", port.getName().getLocalPart()); 1.336 + webServiceAnn.param("serviceName", service.getName().getLocalPart()); 1.337 + webServiceAnn.param("targetNamespace", service.getName().getNamespaceURI()); 1.338 + webServiceAnn.param("wsdlLocation", wsdlLocation); 1.339 + webServiceAnn.param("endpointInterface", port.getJavaInterface().getName()); 1.340 + } 1.341 + //CR373098 To transform the java class name as validate. 1.342 + private String transToValidJavaIdentifier(String s) { 1.343 + if (s == null) return null; 1.344 + final int len = s.length(); 1.345 + StringBuffer retSB = new StringBuffer(); 1.346 + if (len == 0 || !Character.isJavaIdentifierStart(s.charAt(0))) 1.347 + retSB.append("J"); //update to a default start char 1.348 + else 1.349 + retSB.append(s.charAt(0)); 1.350 + 1.351 + for (int i = 1; i < len; i++) { 1.352 + if (!Character.isJavaIdentifierPart(s.charAt(i))) 1.353 + ; //delete it if it is illegal //TODO: It might conflict "a-b" vs. "ab" 1.354 + else 1.355 + retSB.append(s.charAt(i)); 1.356 + } 1.357 + return retSB.toString(); 1.358 + } 1.359 + 1.360 + private String makePackageQualified(String s) { 1.361 + s = transToValidJavaIdentifier(s); 1.362 + if (options.defaultPackage != null && !options.defaultPackage.equals("")) { 1.363 + return options.defaultPackage + "." + s; 1.364 + } else { 1.365 + return s; 1.366 + } 1.367 + } 1.368 + 1.369 + 1.370 + /** 1.371 + * TODO 1.372 + * 1.373 + * @param port 1.374 + * @param bindingTypeAnn 1.375 + */ 1.376 + private void writeBindingTypeAnnotation(Port port, 1.377 + JAnnotationUse bindingTypeAnn) { 1.378 + QName bName = (QName) port 1.379 + .getProperty(ModelProperties.PROPERTY_WSDL_BINDING_NAME); 1.380 + if (bName == null) 1.381 + return; 1.382 + 1.383 + String v = getBindingType(bName); 1.384 + 1.385 + // TODO: How to decide if it is a mtom? 1.386 + if (v != null) { 1.387 + // transport = translate(transport); 1.388 + bindingTypeAnn.param("value", v); 1.389 + } 1.390 + 1.391 + } 1.392 + 1.393 + private String resolveBindingValue(TWSDLExtension wsdlext) { 1.394 + if (wsdlext.getClass().equals(SOAPBinding.class)) { 1.395 + SOAPBinding sb = (SOAPBinding) wsdlext; 1.396 + if(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(sb.getTransport())) 1.397 + return javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING; 1.398 + else { 1.399 + for(GeneratorExtension f : ServiceFinder.find(GeneratorExtension.class) ) { 1.400 + String bindingValue = f.getBindingValue(sb.getTransport(), SOAPVersion.SOAP_11); 1.401 + if(bindingValue!=null) { 1.402 + return bindingValue; 1.403 + } 1.404 + } 1.405 + return javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING; 1.406 + } 1.407 + } 1.408 + if (wsdlext.getClass().equals(SOAP12Binding.class)) { 1.409 + SOAP12Binding sb = (SOAP12Binding) wsdlext; 1.410 + if(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(sb.getTransport())) 1.411 + return javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING; 1.412 + else { 1.413 + for(GeneratorExtension f : ServiceFinder.find(GeneratorExtension.class) ) { 1.414 + String bindingValue = f.getBindingValue(sb.getTransport(), SOAPVersion.SOAP_12); 1.415 + if(bindingValue!=null) { 1.416 + return bindingValue; 1.417 + } 1.418 + } 1.419 + return javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING; 1.420 + } 1.421 + } 1.422 + return null; 1.423 + } 1.424 + 1.425 + private String getBindingType(QName bName) { 1.426 + 1.427 + String value = null; 1.428 + // process the bindings in definitions of model.entity 1.429 + if (model.getEntity() instanceof Definitions) { 1.430 + Definitions definitions = (Definitions) model.getEntity(); 1.431 + if (definitions != null) { 1.432 + Iterator bindings = definitions.bindings(); 1.433 + if (bindings != null) { 1.434 + while (bindings.hasNext()) { 1.435 + Binding binding = (Binding) bindings.next(); 1.436 + if (bName.getLocalPart().equals(binding.getName()) 1.437 + && bName.getNamespaceURI().equals(binding.getNamespaceURI())) { 1.438 + List<TWSDLExtension> bindextends = (List<TWSDLExtension>) binding 1.439 + .extensions(); 1.440 + for (TWSDLExtension wsdlext : bindextends) { 1.441 + value = resolveBindingValue(wsdlext); 1.442 + if (value != null) 1.443 + break; 1.444 + } 1.445 + break; 1.446 + } 1.447 + } 1.448 + } 1.449 + } 1.450 + } 1.451 + 1.452 + // process the bindings in backup list of model 1.453 + if (value == null) { 1.454 + // TODO: The property "BAKEUP_BINDINGS" is set in WsdlModeler when init 1.455 + // the model 1.456 + // make this as a const if needed. 1.457 + HashMap hm = (HashMap) model.getProperty("BAKEUP_BINDINGS"); 1.458 + Binding b = (Binding) hm.get(bName); 1.459 + if (b != null) { 1.460 + List<TWSDLExtension> bindextends = (List<TWSDLExtension>) b 1.461 + .extensions(); 1.462 + for (TWSDLExtension wsdlext : bindextends) { 1.463 + value = resolveBindingValue(wsdlext); 1.464 + if (value != null) 1.465 + break; 1.466 + } 1.467 + } 1.468 + } 1.469 + 1.470 + return value; 1.471 + } 1.472 + 1.473 + /** 1.474 + * Since the SOAP 1.1 binding transport URI defined in WSDL 1.1 specification 1.475 + * is different with the SOAPBinding URI defined by JAX-WS 2.0 specification. 1.476 + * We must translate the wsdl version into JAX-WS version. If the given 1.477 + * transport URI is NOT one of the predefined transport URIs, it is returned 1.478 + * as is. 1.479 + * 1.480 + * @param transportURI 1.481 + * retrieved from WSDL 1.482 + * @return Standard BindingType URI defined by JAX-WS 2.0 specification. 1.483 + */ 1.484 + private String translate(String transportURI) 1.485 + { 1.486 + String translatedBindingId = TRANSLATION_MAP.get(transportURI); 1.487 + if (translatedBindingId == null) 1.488 + translatedBindingId = transportURI; 1.489 + 1.490 + return translatedBindingId; 1.491 + } 1.492 + 1.493 + /***************************************************************************** 1.494 + * Inner classes definition 1.495 + */ 1.496 + static final class ImplFile { 1.497 + public String qualifiedName; // package+"."+simpleClassName + ".java" 1.498 + 1.499 + public String name; // simpleClassName + ".java" 1.500 + 1.501 + private ImplFile(String qualifiedClassName) { 1.502 + this.qualifiedName = qualifiedClassName + ".java"; 1.503 + 1.504 + String simpleClassName = qualifiedClassName; 1.505 + int i = qualifiedClassName.lastIndexOf("."); 1.506 + if (i != -1) 1.507 + simpleClassName = qualifiedClassName.substring(i + 1); 1.508 + 1.509 + this.name = simpleClassName + ".java"; 1.510 + } 1.511 + 1.512 + public static List<ImplFile> toImplFiles(List<String> qualifiedClassNames) { 1.513 + List<ImplFile> ret = new ArrayList<ImplFile>(); 1.514 + 1.515 + for (String qualifiedClassName : qualifiedClassNames) 1.516 + ret.add(new ImplFile(qualifiedClassName)); 1.517 + 1.518 + return ret; 1.519 + } 1.520 + } 1.521 + 1.522 + /***************************************************************************** 1.523 + * Other utility methods 1.524 + */ 1.525 + 1.526 + private static File makePackageDir(WsimportOptions options) { 1.527 + File ret = null; 1.528 + if (options.defaultPackage != null && !options.defaultPackage.equals("")) { 1.529 + String subDir = options.defaultPackage.replace('.', '/'); 1.530 + ret = new File(options.implDestDir, subDir); 1.531 + } else { 1.532 + ret = options.implDestDir; 1.533 + } 1.534 + 1.535 + ret.mkdirs(); 1.536 + return ret; 1.537 + } 1.538 + 1.539 + private static String getQualifiedFileName(String canonicalBaseDir, File f) 1.540 + throws java.io.IOException { 1.541 + String fp = f.getCanonicalPath(); 1.542 + if (fp == null) 1.543 + return null; 1.544 + fp = fp.replace(canonicalBaseDir, ""); 1.545 + fp = fp.replace('\\', '.'); 1.546 + fp = fp.replace('/', '.'); 1.547 + if (fp.startsWith(".")) 1.548 + fp = fp.substring(1); 1.549 + 1.550 + return fp; 1.551 + } 1.552 + 1.553 + private static File findFile(WsimportOptions options, String qualifiedFileName) 1.554 + throws java.io.IOException { 1.555 + String baseDir = options.destDir.getCanonicalPath(); 1.556 + String fp = null; 1.557 + for (File f : options.getGeneratedFiles()) { 1.558 + fp = getQualifiedFileName(baseDir, f); 1.559 + if (qualifiedFileName.equals(fp)) 1.560 + return f; 1.561 + } 1.562 + 1.563 + return null; 1.564 + } 1.565 + 1.566 + private static boolean equalsNSOptional(String strQName, QName checkQN) { 1.567 + if (strQName == null) 1.568 + return false; 1.569 + strQName = strQName.trim(); 1.570 + QName reqQN = QName.valueOf(strQName); 1.571 + 1.572 + if (reqQN.getNamespaceURI() == null || reqQN.getNamespaceURI().equals("")) 1.573 + return reqQN.getLocalPart().equals(checkQN.getLocalPart()); 1.574 + 1.575 + return reqQN.equals(checkQN); 1.576 + } 1.577 +}