예제 #1
0
 /*     */ static
 /*     */ {
   /*     */ try
   /*     */ {
     /* 150 */ XmlSchema s = null;
     /* 151 */ s.location();
     /*     */ }
   /*     */ catch (NullPointerException e)
   /*     */ {
     /*     */ }
   /*     */ catch (NoSuchMethodError e)
   /*     */ {
     /*     */ Messages res;
     /*     */ Messages res;
     /* 157 */ if (XmlSchema.class.getClassLoader() == null)
       /* 158 */ res = Messages.INCOMPATIBLE_API_VERSION_MUSTANG;
     /*     */ else {
       /* 160 */ res = Messages.INCOMPATIBLE_API_VERSION;
       /*     */ }
     /* 162 */ throw new LinkageError(
         res.format(new Object[] {Which.which(XmlSchema.class), Which.which(ModelBuilder.class)}));
     /*     */ }
   /*     */
   /*     */ try
   /*     */ {
     /* 175 */ WhiteSpaceProcessor.isWhiteSpace("xyz");
     /*     */ }
   /*     */ catch (NoSuchMethodError e) {
     /* 178 */ throw new LinkageError(
         Messages.RUNNING_WITH_1_0_RUNTIME.format(
             new Object[] {
               Which.which(WhiteSpaceProcessor.class), Which.which(ModelBuilder.class)
             }));
     /*     */ }
   /*     */ }
  /**
   * Computes the file system path of <tt>jaxb-api.jar</tt> so that Annotation Processing will see
   * them in the <tt>-cp</tt> option.
   *
   * <p>In Java, you can't do this reliably (for that matter there's no guarantee that such a jar
   * file exists, such as in Glassfish), so we do the best we can.
   *
   * @return null if failed to locate it.
   */
  private static String findJaxbApiJar() {
    String url = Which.which(JAXBContext.class);
    if (url == null) return null; // impossible, but hey, let's be defensive

    if (!url.startsWith("jar:") || url.lastIndexOf('!') == -1)
      // no jar file
      return null;

    String jarFileUrl = url.substring(4, url.lastIndexOf('!'));
    if (!jarFileUrl.startsWith("file:")) return null; // not from file system

    try {
      File f = new File(new URL(jarFileUrl).toURI());
      if (f.exists() && f.getName().endsWith(".jar")) { // see 6510966
        return f.getPath();
      }
      f = new File(new URL(jarFileUrl).getFile());
      if (f.exists()
          && f.getName()
              .endsWith(".jar")) { // this is here for potential backw. compatibility issues
        return f.getPath();
      }
    } catch (URISyntaxException ex) {
      Logger.getLogger(SchemaGenerator.class.getName()).log(Level.SEVERE, null, ex);
    } catch (MalformedURLException ex) {
      Logger.getLogger(SchemaGenerator.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
  }
예제 #3
0
 private SOAPVersion(
     String httpBindingId,
     String nsUri,
     String contentType,
     String implicitRole,
     String roleAttributeName,
     String saajFactoryString,
     QName faultCodeMustUnderstand,
     String faultCodeClientLocalName,
     String faultCodeServerLocalName,
     Set<String> requiredRoles) {
   this.httpBindingId = httpBindingId;
   this.nsUri = nsUri;
   this.contentType = contentType;
   this.implicitRole = implicitRole;
   this.implicitRoleSet = Collections.singleton(implicitRole);
   this.roleAttributeName = roleAttributeName;
   try {
     saajMessageFactory = MessageFactory.newInstance(saajFactoryString);
     saajSoapFactory = SOAPFactory.newInstance(saajFactoryString);
   } catch (SOAPException e) {
     throw new Error(e);
   } catch (NoSuchMethodError e) {
     // SAAJ 1.3 is not in the classpath
     LinkageError x =
         new LinkageError("You are loading old SAAJ from " + Which.which(MessageFactory.class));
     x.initCause(e);
     throw x;
   }
   this.faultCodeMustUnderstand = faultCodeMustUnderstand;
   this.requiredRoles = requiredRoles;
   this.faultCodeClient = new QName(nsUri, faultCodeClientLocalName);
   this.faultCodeServer = new QName(nsUri, faultCodeServerLocalName);
 }