--- old/src/share/jaxws_classes/com/sun/tools/internal/ws/processor/generator/SeiGenerator.java 2013-04-04 15:26:06.452611822 +0200 +++ new/src/share/jaxws_classes/com/sun/tools/internal/ws/processor/generator/SeiGenerator.java 2013-04-04 15:26:06.400611821 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,10 +36,8 @@ import com.sun.tools.internal.ws.wscompile.ErrorReceiver; import com.sun.tools.internal.ws.wscompile.Options; import com.sun.tools.internal.ws.wscompile.WsimportOptions; -import com.sun.tools.internal.ws.wscompile.AbortException; import com.sun.tools.internal.ws.wsdl.document.soap.SOAPStyle; import com.sun.tools.internal.ws.wsdl.document.PortType; -import com.sun.tools.internal.ws.wsdl.document.Kinds; import com.sun.tools.internal.ws.resources.GeneratorMessages; import javax.jws.WebMethod; @@ -55,7 +53,6 @@ import org.xml.sax.Locator; public class SeiGenerator extends GeneratorBase { - private String serviceNS; private TJavaGeneratorExtension extension; private List extensionHandlers; @@ -76,10 +73,11 @@ register(new W3CAddressingJavaGeneratorExtension()); } - for (TJavaGeneratorExtension j : extensions) + for (TJavaGeneratorExtension j : extensions) { register(j); + } - this.extension = new JavaGeneratorExtensionFacade(extensionHandlers.toArray(new TJavaGeneratorExtension[0])); + this.extension = new JavaGeneratorExtensionFacade(extensionHandlers.toArray(new TJavaGeneratorExtension[extensionHandlers.size()])); } private void write(Port port) { @@ -92,7 +90,7 @@ } - JDefinedClass cls = null; + JDefinedClass cls; try { cls = getClass(className, ClassType.INTERFACE); } catch (JClassAlreadyExistsException e) { @@ -102,16 +100,18 @@ Locator loc = null; if(portTypeName != null){ PortType pt = port.portTypes.get(portTypeName); - if(pt!=null) + if (pt!=null) { loc = pt.getLocator(); + } } receiver.error(loc, GeneratorMessages.GENERATOR_SEI_CLASS_ALREADY_EXIST(intf.getName(), portTypeName)); return; } // If the class has methods it has already been defined // so skip it. - if (!cls.methods().isEmpty()) + if (!cls.methods().isEmpty()) { return; + } //write class comment - JAXWS warning JDocComment comment = cls.javadoc(); @@ -138,8 +138,9 @@ writeSOAPBinding(port, cls); //@XmlSeeAlso - if(options.target.isLaterThan(Options.Target.V2_1)) + if (options.target.isLaterThan(Options.Target.V2_1)) { writeXmlSeeAlso(cls); + } for (Operation operation: port.getOperations()) { JavaMethod method = operation.getJavaMethod(); @@ -159,8 +160,9 @@ JCommentPart ret = methodDoc.addReturn(); ret.add("returns "+retType.getName()); } - if(methodJavaDoc != null) + if (methodJavaDoc != null) { methodDoc.add(methodJavaDoc); + } writeWebMethod(operation, m); JClass holder = cm.ref(Holder.class); @@ -196,8 +198,9 @@ List objectFactories = model.getJAXBModel().getS2JJAXBModel().getAllObjectFactories(); //if there are no object facotires, dont generate @XmlSeeAlso - if(objectFactories.size() == 0) + if (objectFactories.isEmpty()) { return; + } JAnnotationUse xmlSeeAlso = cls.annotate(cm.ref(XmlSeeAlso.class)); JAnnotationArrayMember paramArray = xmlSeeAlso.paramArray("value"); @@ -261,21 +264,24 @@ wr = m.annotate(javax.jws.WebResult.class); wr.param("name", resultName); } - if((nsURI != null) && (!nsURI.equals(serviceNS) || (isDocStyle && operation.isWrapped()))){ - if(wr == null) + if (nsURI != null || (isDocStyle && operation.isWrapped())) { + if(wr == null) { wr = m.annotate(javax.jws.WebResult.class); + } wr.param("targetNamespace", nsURI); } //doclit wrapped could have additional headers if(!(isDocStyle && operation.isWrapped()) || (parameter.getBlock().getLocation() == Block.HEADER)){ - if(wr == null) + if (wr == null) { wr = m.annotate(javax.jws.WebResult.class); + } wr.param("partName", parameter.getName()); } if(parameter.getBlock().getLocation() == Block.HEADER){ - if(wr == null) + if (wr == null) { wr = m.annotate(javax.jws.WebResult.class); + } wr.param("header",true); } } @@ -318,34 +324,43 @@ } private boolean isHeaderParam(Parameter param, Message message) { - if (message.getHeaderBlockCount() == 0) + if (message.getHeaderBlockCount() == 0) { return false; + } - for (Block headerBlock : message.getHeaderBlocksMap().values()) - if (param.getBlock().equals(headerBlock)) + for (Block headerBlock : message.getHeaderBlocksMap().values()) { + if (param.getBlock().equals(headerBlock)) { return true; + } + } return false; } private boolean isAttachmentParam(Parameter param, Message message){ - if (message.getAttachmentBlockCount() == 0) + if (message.getAttachmentBlockCount() == 0) { return false; + } - for (Block attBlock : message.getAttachmentBlocksMap().values()) - if (param.getBlock().equals(attBlock)) + for (Block attBlock : message.getAttachmentBlocksMap().values()) { + if (param.getBlock().equals(attBlock)) { return true; + } + } return false; } private boolean isUnboundParam(Parameter param, Message message){ - if (message.getUnboundBlocksCount() == 0) + if (message.getUnboundBlocksCount() == 0) { return false; + } - for (Block unboundBlock : message.getUnboundBlocksMap().values()) - if (param.getBlock().equals(unboundBlock)) + for (Block unboundBlock : message.getUnboundBlocksMap().values()) { + if (param.getBlock().equals(unboundBlock)) { return true; + } + } return false; } @@ -361,10 +376,11 @@ String name; boolean isWrapped = operation.isWrapped(); - if((param.getBlock().getLocation() == Block.HEADER) || (isDocStyle && !isWrapped)) + if ((param.getBlock().getLocation() == Block.HEADER) || (isDocStyle && !isWrapped)) { name = param.getBlock().getName().getLocalPart(); - else + } else { name = param.getName(); + } paramAnno.param("name", name); @@ -379,8 +395,9 @@ ns = param.getBlock().getName().getNamespaceURI(); } - if((ns != null) && (!ns.equals(serviceNS) || (isDocStyle && isWrapped))) + if (ns != null || (isDocStyle && isWrapped)) { paramAnno.param("targetNamespace", ns); + } if (header) { paramAnno.param("header", true); @@ -394,8 +411,9 @@ } //doclit wrapped could have additional headers - if(!(isDocStyle && isWrapped) || header) + if (!(isDocStyle && isWrapped) || header) { paramAnno.param("partName", javaParameter.getParameter().getName()); + } } private boolean isDocStyle = true; @@ -418,15 +436,18 @@ continue; } sameParamStyle = (isWrapper == operation.isWrapped()); - if(!sameParamStyle) + if (!sameParamStyle) { break; + } } - if(sameParamStyle) + if (sameParamStyle) { port.setWrapped(isWrapper); + } } if(sameParamStyle && !port.isWrapped()){ - if(soapBindingAnn == null) + if (soapBindingAnn == null) { soapBindingAnn = cls.annotate(SOAPBinding.class); + } soapBindingAnn.param("parameterStyle", SOAPBinding.ParameterStyle.BARE); } } @@ -437,15 +458,14 @@ wsa.param("targetNamespace", name.getNamespaceURI()); } - - - + @Override public void visit(Model model) throws Exception { for(Service s:model.getServices()){ s.accept(this); } } + @Override public void visit(Service service) throws Exception { String jd = model.getJavaDoc(); if(jd != null){