Changeset 1730 for trunk/docx4j/src/main/java/org/docx4j/jaxb
- Timestamp:
- 12/12/11 11:42:53 (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/jaxb/NamespacePrefixMapperUtils.java
r1729 r1730 57 57 return prefixMapper; 58 58 } catch (java.lang.NoClassDefFoundError notJava6) { 59 // javax.xml.bind.PropertyException 60 log.error(notJava6.getMessage() + " .. trying RI."); 61 try { 62 // Try RI suitable one 63 m.setProperty("com.sun.xml.bind.namespacePrefixMapper", 64 new NamespacePrefixMapper() ); 65 log.info("Using NamespacePrefixMapper, which is suitable for the JAXB RI"); 66 prefixMapper = new NamespacePrefixMapper(); 67 return prefixMapper; 68 } catch (javax.xml.bind.PropertyException notRIEither) { 69 notRIEither.printStackTrace(); 70 log.error("JAXB: neither Reference Implementation nor Java 6 implementation present?", notRIEither); 71 throw new JAXBException("JAXB: neither Reference Implementation nor Java 6 implementation present?"); 72 } 73 59 log.error(notJava6.getMessage() + " .. trying RI."); 60 return tryUsingRI(m); 61 } catch (javax.xml.bind.PropertyException notJava6) { 62 // OpenJDK (1.6.0_23) does this 63 log.error(notJava6.getMessage() + " .. trying RI."); 64 return tryUsingRI(m); 65 } 66 } 67 68 69 private static Object tryUsingRI(Marshaller m) 70 throws JAXBException { 71 try { 72 // Try RI suitable one 73 m.setProperty("com.sun.xml.bind.namespacePrefixMapper", 74 new NamespacePrefixMapper() ); 75 log.info("Using NamespacePrefixMapper, which is suitable for the JAXB RI"); 76 prefixMapper = new NamespacePrefixMapper(); 77 return prefixMapper; 78 } catch (java.lang.NoClassDefFoundError notRIEither) { 79 notRIEither.printStackTrace(); 80 log.error("JAXB: neither Reference Implementation nor Java 6 implementation present?", notRIEither); 81 throw new JAXBException("JAXB: neither Reference Implementation nor Java 6 implementation present?"); 82 } catch (javax.xml.bind.PropertyException notRIEither) { 83 notRIEither.printStackTrace(); 84 log.error("JAXB: neither Reference Implementation nor Java 6 implementation present?", notRIEither); 85 throw new JAXBException("JAXB: neither Reference Implementation nor Java 6 implementation present?"); 74 86 } 75 87 } … … 100 112 // javax.xml.bind.PropertyException 101 113 log.error(notJava6.getMessage() + " .. trying RI."); 102 try { 103 // Try RI suitable one 104 m.setProperty("com.sun.xml.bind.namespacePrefixMapper", 105 new NamespacePrefixMapperRelationshipsPart() ); 106 log.info("Using NamespacePrefixMapperRelationshipsPart, which is suitable for the JAXB RI"); 107 prefixMapperRels = new NamespacePrefixMapperRelationshipsPart(); 108 return prefixMapperRels; 109 } catch (javax.xml.bind.PropertyException notRIEither) { 110 notRIEither.printStackTrace(); 111 log.error("JAXB: neither Reference Implementation nor Java 6 implementation present?", notRIEither); 112 throw new JAXBException("JAXB: neither Reference Implementation nor Java 6 implementation present?"); 113 } 114 115 } 114 return tryRIforRelationshipsPart(m); 115 } catch (javax.xml.bind.PropertyException notJava6) { 116 log.error(notJava6.getMessage() + " .. trying RI."); 117 return tryRIforRelationshipsPart(m); 118 } 119 } 120 121 122 private static Object tryRIforRelationshipsPart(Marshaller m) 123 throws JAXBException { 124 try { 125 // Try RI suitable one 126 m.setProperty("com.sun.xml.bind.namespacePrefixMapper", 127 new NamespacePrefixMapperRelationshipsPart() ); 128 log.info("Using NamespacePrefixMapperRelationshipsPart, which is suitable for the JAXB RI"); 129 prefixMapperRels = new NamespacePrefixMapperRelationshipsPart(); 130 return prefixMapperRels; 131 } catch (java.lang.NoClassDefFoundError notRIEither) { 132 notRIEither.printStackTrace(); 133 log.error("JAXB: neither Reference Implementation nor Java 6 implementation present?", notRIEither); 134 throw new JAXBException("JAXB: neither Reference Implementation nor Java 6 implementation present?"); 135 } catch (javax.xml.bind.PropertyException notRIEither) { 136 notRIEither.printStackTrace(); 137 log.error("JAXB: neither Reference Implementation nor Java 6 implementation present?", notRIEither); 138 throw new JAXBException("JAXB: neither Reference Implementation nor Java 6 implementation present?"); 139 } 116 140 } 117 141
Note: See TracChangeset
for help on using the changeset viewer.
