71 changed files with 1476 additions and 2570 deletions
@ -1,89 +0,0 @@
@@ -1,89 +0,0 @@
|
||||
/* |
||||
* Copyright 2002-2009 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.util.xml; |
||||
|
||||
import org.springframework.util.ClassUtils; |
||||
|
||||
/** |
||||
* Helper class used to find the current version of JAXP. We cannot depend on the Java version, since JAXP can be |
||||
* upgraded independently of the Java version. <p/> Only distinguishes between JAXP 1.0, 1.1, 1.3, and 1.4, since JAXP |
||||
* 1.2 was a maintenance release with no new classes. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0.0 |
||||
*/ |
||||
abstract class JaxpVersion { |
||||
|
||||
public static final int JAXP_10 = 0; |
||||
|
||||
public static final int JAXP_11 = 1; |
||||
|
||||
public static final int JAXP_13 = 3; |
||||
|
||||
public static final int JAXP_14 = 4; |
||||
|
||||
private static final String JAXP_14_CLASS_NAME = "javax.xml.transform.stax.StAXSource"; |
||||
|
||||
private static int jaxpVersion; |
||||
|
||||
static { |
||||
try { |
||||
ClassUtils.forName(JAXP_14_CLASS_NAME); |
||||
jaxpVersion = JAXP_14; |
||||
} |
||||
catch (ClassNotFoundException ignored) { |
||||
// default to JAXP 1.3, since Spring 3 requires JDK 1.5
|
||||
jaxpVersion = JAXP_13; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Gets the JAXP version. This means we can do things like if <code>(getJaxpVersion() < JAXP_13)</code>. |
||||
* |
||||
* @return a code comparable to the JAXP_XX codes in this class
|
||||
* @see #JAXP_10 |
||||
* @see #JAXP_11 |
||||
* @see #JAXP_13 |
||||
* @see #JAXP_14 |
||||
*/ |
||||
public static int getJaxpVersion() { |
||||
return jaxpVersion; |
||||
} |
||||
|
||||
/** |
||||
* Convenience method to determine if the current JAXP version is at least 1.3 (packaged with JDK 1.5). |
||||
* |
||||
* @return <code>true</code> if the current JAXP version is at least JAXP 1.3 |
||||
* @see #getJaxpVersion() |
||||
* @see #JAXP_13 |
||||
*/ |
||||
public static boolean isAtLeastJaxp13() { |
||||
return getJaxpVersion() >= JAXP_13; |
||||
} |
||||
|
||||
/** |
||||
* Convenience method to determine if the current JAXP version is at least 1.4 (packaged with JDK 1.6). |
||||
* |
||||
* @return <code>true</code> if the current JAXP version is at least JAXP 1.4 |
||||
* @see #getJaxpVersion() |
||||
* @see #JAXP_14 |
||||
*/ |
||||
public static boolean isAtLeastJaxp14() { |
||||
return getJaxpVersion() >= JAXP_14; |
||||
} |
||||
|
||||
} |
||||
@ -1,32 +1,32 @@
@@ -1,32 +1,32 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.castor; |
||||
|
||||
import org.springframework.oxm.UncategorizedXmlMappingException; |
||||
|
||||
/** |
||||
* Castor-specific subclass of <code>UncategorizedXmlMappingException</code>, for Castor exceptions that cannot be |
||||
* distinguished further. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public class CastorSystemException extends UncategorizedXmlMappingException { |
||||
|
||||
public CastorSystemException(String msg, Throwable ex) { |
||||
super(msg, ex); |
||||
} |
||||
} |
||||
/* |
||||
* Copyright 2002-2009 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.jms.support.converter; |
||||
|
||||
/** |
||||
* Constants that indicate a target message type to convert to: a |
||||
* {@link javax.jms.TextMessage}, a {@link javax.jms.BytesMessage}, |
||||
* a {@link javax.jms.MapMessage} or an {@link ObjectMessage}. |
||||
* |
||||
* @author Juergen Hoeller |
||||
* @since 3.0 |
||||
* @see MarshallingMessageConverter#setTargetType |
||||
*/ |
||||
public enum MessageType { |
||||
|
||||
TEXT, BYTES, MAP, OBJECT |
||||
|
||||
} |
||||
@ -1,35 +1,39 @@
@@ -1,35 +1,39 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.castor; |
||||
|
||||
import org.exolab.castor.xml.MarshalException; |
||||
|
||||
import org.springframework.oxm.MarshallingFailureException; |
||||
|
||||
/** |
||||
* Castor-specific subclass of <code>MarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see CastorUtils#convertXmlException |
||||
* @since 3.0 |
||||
*/ |
||||
public class CastorMarshallingFailureException extends MarshallingFailureException { |
||||
|
||||
public CastorMarshallingFailureException(MarshalException ex) { |
||||
super("Castor marshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
} |
||||
/* |
||||
* Copyright 2002-2009 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.castor; |
||||
|
||||
import org.springframework.oxm.XmlMappingException; |
||||
|
||||
/** |
||||
* Exception thrown by {@link CastorMarshaller} whenever it encounters a mapping problem. |
||||
* |
||||
* @author Juergen Hoeller |
||||
* @since 3.0 |
||||
*/ |
||||
public class CastorMappingException extends XmlMappingException { |
||||
|
||||
/** |
||||
* Construct a <code>CastorMappingException</code> with the specified detail message |
||||
* and nested exception. |
||||
* @param msg the detail message |
||||
* @param cause the nested exception |
||||
*/ |
||||
public CastorMappingException(String msg, Throwable cause) { |
||||
super(msg, cause); |
||||
} |
||||
|
||||
} |
||||
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.castor; |
||||
|
||||
import org.exolab.castor.xml.MarshalException; |
||||
import org.xml.sax.SAXException; |
||||
|
||||
import org.springframework.oxm.UnmarshallingFailureException; |
||||
|
||||
/** |
||||
* Castor-specific subclass of <code>UnmarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see CastorUtils#convertXmlException |
||||
* @since 3.0 |
||||
*/ |
||||
public class CastorUnmarshallingFailureException extends UnmarshallingFailureException { |
||||
|
||||
public CastorUnmarshallingFailureException(MarshalException ex) { |
||||
super("Castor unmarshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
public CastorUnmarshallingFailureException(SAXException ex) { |
||||
super("Castor unmarshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
} |
||||
@ -1,60 +0,0 @@
@@ -1,60 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.castor; |
||||
|
||||
import org.exolab.castor.xml.MarshalException; |
||||
import org.exolab.castor.xml.ValidationException; |
||||
import org.exolab.castor.xml.XMLException; |
||||
|
||||
import org.springframework.oxm.XmlMappingException; |
||||
|
||||
/** |
||||
* Generic utility methods for working with Castor. Mainly for internal use within the framework. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public class CastorUtils { |
||||
|
||||
/** |
||||
* Converts the given <code>XMLException</code> to an appropriate exception from the |
||||
* <code>org.springframework.oxm</code> hierarchy. <p/> A boolean flag is used to indicate whether this exception |
||||
* occurs during marshalling or unmarshalling, since Castor itself does not make this distinction in its exception |
||||
* hierarchy. |
||||
* |
||||
* @param ex Castor <code>XMLException</code> that occured |
||||
* @param marshalling indicates whether the exception occurs during marshalling (<code>true</code>), or unmarshalling |
||||
* (<code>false</code>) |
||||
* @return the corresponding <code>XmlMappingException</code> |
||||
*/ |
||||
public static XmlMappingException convertXmlException(XMLException ex, boolean marshalling) { |
||||
if (ex instanceof MarshalException) { |
||||
MarshalException marshalException = (MarshalException) ex; |
||||
if (marshalling) { |
||||
return new CastorMarshallingFailureException(marshalException); |
||||
} |
||||
else { |
||||
return new CastorUnmarshallingFailureException(marshalException); |
||||
} |
||||
} |
||||
else if (ex instanceof ValidationException) { |
||||
return new CastorValidationFailureException((ValidationException) ex); |
||||
} |
||||
// fallback
|
||||
return new CastorSystemException("Unknown Castor exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.castor; |
||||
|
||||
import org.exolab.castor.xml.ValidationException; |
||||
|
||||
import org.springframework.oxm.ValidationFailureException; |
||||
|
||||
/** |
||||
* Castor-specific subclass of <code>MarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see CastorUtils#convertXmlException |
||||
* @since 3.0 |
||||
*/ |
||||
public class CastorValidationFailureException extends ValidationFailureException { |
||||
|
||||
public CastorValidationFailureException(ValidationException ex) { |
||||
super("Castor validation exception: " + ex.getMessage(), ex); |
||||
} |
||||
} |
||||
@ -1,35 +0,0 @@
@@ -1,35 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.jaxb; |
||||
|
||||
import javax.xml.bind.MarshalException; |
||||
|
||||
import org.springframework.oxm.MarshallingFailureException; |
||||
|
||||
/** |
||||
* JAXB-specific subclass of <code>MarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see JaxbUtils#convertJaxbException |
||||
* @since 3.0 |
||||
*/ |
||||
public class JaxbMarshallingFailureException extends MarshallingFailureException { |
||||
|
||||
public JaxbMarshallingFailureException(MarshalException ex) { |
||||
super("JAXB marshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,35 +0,0 @@
@@ -1,35 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.jaxb; |
||||
|
||||
import javax.xml.bind.JAXBException; |
||||
|
||||
import org.springframework.oxm.UncategorizedXmlMappingException; |
||||
|
||||
/** |
||||
* JAXB-specific subclass of <code>UncategorizedXmlMappingException</code>, for <code>JAXBException</code>s that cannot |
||||
* be distinguished further. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see JaxbUtils#convertJaxbException(javax.xml.bind.JAXBException) |
||||
* @since 3.0 |
||||
*/ |
||||
public class JaxbSystemException extends UncategorizedXmlMappingException { |
||||
|
||||
public JaxbSystemException(JAXBException ex) { |
||||
super(ex.getMessage(), ex); |
||||
} |
||||
} |
||||
@ -1,38 +0,0 @@
@@ -1,38 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.jaxb; |
||||
|
||||
import java.io.IOException; |
||||
import javax.xml.bind.UnmarshalException; |
||||
|
||||
import org.springframework.oxm.UnmarshallingFailureException; |
||||
|
||||
/** |
||||
* JAXB-specific subclass of <code>UnmarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public class JaxbUnmarshallingFailureException extends UnmarshallingFailureException { |
||||
|
||||
public JaxbUnmarshallingFailureException(UnmarshalException ex) { |
||||
super("JAXB unmarshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
public JaxbUnmarshallingFailureException(IOException ex) { |
||||
super("JAXB unmarshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
} |
||||
@ -1,54 +0,0 @@
@@ -1,54 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.jaxb; |
||||
|
||||
import javax.xml.bind.JAXBException; |
||||
import javax.xml.bind.MarshalException; |
||||
import javax.xml.bind.UnmarshalException; |
||||
import javax.xml.bind.ValidationException; |
||||
|
||||
import org.springframework.oxm.XmlMappingException; |
||||
|
||||
/** |
||||
* Generic utility methods for working with JAXB. Mainly for internal use within the framework. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public abstract class JaxbUtils { |
||||
|
||||
/** |
||||
* Converts the given <code>JAXBException</code> to an appropriate exception from the |
||||
* <code>org.springframework.oxm</code> hierarchy. |
||||
* |
||||
* @param ex <code>JAXBException</code> that occured |
||||
* @return the corresponding <code>XmlMappingException</code> |
||||
*/ |
||||
public static XmlMappingException convertJaxbException(JAXBException ex) { |
||||
if (ex instanceof MarshalException) { |
||||
return new JaxbMarshallingFailureException((MarshalException) ex); |
||||
} |
||||
else if (ex instanceof UnmarshalException) { |
||||
return new JaxbUnmarshallingFailureException((UnmarshalException) ex); |
||||
} |
||||
else if (ex instanceof ValidationException) { |
||||
return new JaxbValidationFailureException((ValidationException) ex); |
||||
} |
||||
// fallback
|
||||
return new JaxbSystemException(ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,35 +0,0 @@
@@ -1,35 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.jaxb; |
||||
|
||||
import javax.xml.bind.ValidationException; |
||||
|
||||
import org.springframework.oxm.ValidationFailureException; |
||||
|
||||
/** |
||||
* JAXB-specific subclass of <code>ValidationFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see JaxbUtils#convertJaxbException |
||||
* @since 3.0 |
||||
*/ |
||||
public class JaxbValidationFailureException extends ValidationFailureException { |
||||
|
||||
public JaxbValidationFailureException(ValidationException ex) { |
||||
super("JAXB validation exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,35 +0,0 @@
@@ -1,35 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.jibx; |
||||
|
||||
import org.jibx.runtime.JiBXException; |
||||
|
||||
import org.springframework.oxm.MarshallingFailureException; |
||||
|
||||
/** |
||||
* JiXB-specific subclass of <code>MarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see JibxUtils#convertJibxException(org.jibx.runtime.JiBXException,boolean) |
||||
* @since 3.0 |
||||
*/ |
||||
public class JibxMarshallingFailureException extends MarshallingFailureException { |
||||
|
||||
public JibxMarshallingFailureException(JiBXException ex) { |
||||
super("JiBX marshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
} |
||||
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.jibx; |
||||
|
||||
import org.springframework.oxm.UncategorizedXmlMappingException; |
||||
|
||||
/** |
||||
* JiBX-specific subclass of <code>UncategorizedXmlMappingException</code>, for <code>JiBXBException</code>s that cannot |
||||
* be distinguished further. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see JibxUtils#convertJibxException(org.jibx.runtime.JiBXException,boolean) |
||||
* @since 3.0 |
||||
*/ |
||||
public class JibxSystemException extends UncategorizedXmlMappingException { |
||||
|
||||
public JibxSystemException(Exception ex) { |
||||
super(ex.getMessage(), ex); |
||||
} |
||||
} |
||||
@ -1,36 +0,0 @@
@@ -1,36 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.jibx; |
||||
|
||||
import org.jibx.runtime.JiBXException; |
||||
|
||||
import org.springframework.oxm.UnmarshallingFailureException; |
||||
|
||||
/** |
||||
* JiXB-specific subclass of <code>UnmarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see JibxUtils#convertJibxException(org.jibx.runtime.JiBXException,boolean) |
||||
* @since 3.0 |
||||
*/ |
||||
public class JibxUnmarshallingFailureException extends UnmarshallingFailureException { |
||||
|
||||
public JibxUnmarshallingFailureException(JiBXException ex) { |
||||
super("JiBX unmarshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,56 +0,0 @@
@@ -1,56 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.jibx; |
||||
|
||||
import org.jibx.runtime.JiBXException; |
||||
import org.jibx.runtime.ValidationException; |
||||
|
||||
import org.springframework.oxm.XmlMappingException; |
||||
|
||||
/** |
||||
* Generic utility methods for working with JiBX. Mainly for internal use within the framework. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public abstract class JibxUtils { |
||||
|
||||
/** |
||||
* Converts the given <code>JiBXException</code> to an appropriate exception from the |
||||
* <code>org.springframework.oxm</code> hierarchy. <p/> A boolean flag is used to indicate whether this exception |
||||
* occurs during marshalling or unmarshalling, since JiBX itself does not make this distinction in its exception |
||||
* hierarchy. |
||||
* |
||||
* @param ex <code>JiBXException</code> that occured |
||||
* @param marshalling indicates whether the exception occurs during marshalling (<code>true</code>), or unmarshalling |
||||
* (<code>false</code>) |
||||
* @return the corresponding <code>XmlMappingException</code> |
||||
*/ |
||||
public static XmlMappingException convertJibxException(JiBXException ex, boolean marshalling) { |
||||
if (ex instanceof ValidationException) { |
||||
return new JibxValidationFailureException((ValidationException) ex); |
||||
} |
||||
else { |
||||
if (marshalling) { |
||||
return new JibxMarshallingFailureException(ex); |
||||
} |
||||
else { |
||||
return new JibxUnmarshallingFailureException(ex); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,36 +0,0 @@
@@ -1,36 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.jibx; |
||||
|
||||
import org.jibx.runtime.ValidationException; |
||||
|
||||
import org.springframework.oxm.ValidationFailureException; |
||||
|
||||
/** |
||||
* JAXB-specific subclass of <code>ValidationFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see JibxUtils#convertJibxException(org.jibx.runtime.JiBXException,boolean) |
||||
* @since 3.0 |
||||
*/ |
||||
public class JibxValidationFailureException extends ValidationFailureException { |
||||
|
||||
public JibxValidationFailureException(ValidationException ex) { |
||||
super("JiBX validation exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.xmlbeans; |
||||
|
||||
import org.apache.xmlbeans.XmlException; |
||||
import org.xml.sax.SAXException; |
||||
|
||||
import org.springframework.oxm.MarshallingFailureException; |
||||
|
||||
/** |
||||
* XMLBeans-specific subclass of <code>MarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see XmlBeansUtils#convertXmlBeansException(Exception,boolean) |
||||
* @since 3.0 |
||||
*/ |
||||
public class XmlBeansMarshallingFailureException extends MarshallingFailureException { |
||||
|
||||
public XmlBeansMarshallingFailureException(XmlException ex) { |
||||
super("XMLBeans marshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
public XmlBeansMarshallingFailureException(SAXException ex) { |
||||
super("XMLBeans marshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,33 +0,0 @@
@@ -1,33 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.xmlbeans; |
||||
|
||||
import org.springframework.oxm.UncategorizedXmlMappingException; |
||||
|
||||
/** |
||||
* XMLBeans-specific subclass of <code>UncategorizedXmlMappingException</code>, for XMLBeans exceptions that cannot be |
||||
* distinguished further. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public class XmlBeansSystemException extends UncategorizedXmlMappingException { |
||||
|
||||
public XmlBeansSystemException(Exception e) { |
||||
super(e.getMessage(), e); |
||||
} |
||||
|
||||
} |
||||
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.xmlbeans; |
||||
|
||||
import org.apache.xmlbeans.XmlException; |
||||
import org.xml.sax.SAXException; |
||||
|
||||
import org.springframework.oxm.UnmarshallingFailureException; |
||||
|
||||
/** |
||||
* XMLBeans-specific subclass of <code>UnmarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see XmlBeansUtils#convertXmlBeansException(Exception,boolean) |
||||
* @since 3.0 |
||||
*/ |
||||
public class XmlBeansUnmarshallingFailureException extends UnmarshallingFailureException { |
||||
|
||||
public XmlBeansUnmarshallingFailureException(XmlException ex) { |
||||
super("XMLBeans unmarshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
public XmlBeansUnmarshallingFailureException(SAXException ex) { |
||||
super("XMLBeans unmarshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,68 +0,0 @@
@@ -1,68 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.xmlbeans; |
||||
|
||||
import org.apache.xmlbeans.XMLStreamValidationException; |
||||
import org.apache.xmlbeans.XmlException; |
||||
import org.xml.sax.SAXException; |
||||
|
||||
import org.springframework.oxm.XmlMappingException; |
||||
|
||||
/** |
||||
* Generic utility methods for working with XMLBeans. Mainly for internal use within the framework. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public class XmlBeansUtils { |
||||
|
||||
/** |
||||
* Converts the given XMLBeans exception to an appropriate exception from the <code>org.springframework.oxm</code> |
||||
* hierarchy. <p/> A boolean flag is used to indicate whether this exception occurs during marshalling or |
||||
* unmarshalling, since XMLBeans itself does not make this distinction in its exception hierarchy. |
||||
* |
||||
* @param ex XMLBeans Exception that occured |
||||
* @param marshalling indicates whether the exception occurs during marshalling (<code>true</code>), or unmarshalling |
||||
* (<code>false</code>) |
||||
* @return the corresponding <code>XmlMappingException</code> |
||||
*/ |
||||
public static XmlMappingException convertXmlBeansException(Exception ex, boolean marshalling) { |
||||
if (ex instanceof XMLStreamValidationException) { |
||||
return new XmlBeansValidationFailureException((XMLStreamValidationException) ex); |
||||
} |
||||
else if (ex instanceof XmlException) { |
||||
XmlException xmlException = (XmlException) ex; |
||||
if (marshalling) { |
||||
return new XmlBeansMarshallingFailureException(xmlException); |
||||
} |
||||
else { |
||||
return new XmlBeansUnmarshallingFailureException(xmlException); |
||||
} |
||||
} |
||||
else if (ex instanceof SAXException) { |
||||
SAXException saxException = (SAXException) ex; |
||||
if (marshalling) { |
||||
return new XmlBeansMarshallingFailureException(saxException); |
||||
} |
||||
else { |
||||
return new XmlBeansUnmarshallingFailureException(saxException); |
||||
} |
||||
} |
||||
// fallback
|
||||
return new XmlBeansSystemException(ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.xmlbeans; |
||||
|
||||
import org.apache.xmlbeans.XMLStreamValidationException; |
||||
import org.apache.xmlbeans.XmlException; |
||||
|
||||
import org.springframework.oxm.ValidationFailureException; |
||||
|
||||
/** |
||||
* XMLBeans-specific subclass of <code>ValidationFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @see org.springframework.oxm.xmlbeans.XmlBeansUtils#convertXmlBeansException |
||||
* @since 3.0 |
||||
*/ |
||||
public class XmlBeansValidationFailureException extends ValidationFailureException { |
||||
|
||||
public XmlBeansValidationFailureException(XMLStreamValidationException ex) { |
||||
super("XmlBeans validation exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
public XmlBeansValidationFailureException(XmlException ex) { |
||||
super("XmlBeans validation exception: " + ex.getMessage(), ex); |
||||
} |
||||
} |
||||
@ -1,50 +0,0 @@
@@ -1,50 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.xstream; |
||||
|
||||
import com.thoughtworks.xstream.alias.CannotResolveClassException; |
||||
import com.thoughtworks.xstream.converters.ConversionException; |
||||
import com.thoughtworks.xstream.io.StreamException; |
||||
|
||||
import org.springframework.oxm.MarshallingFailureException; |
||||
|
||||
/** |
||||
* XStream-specific subclass of <code>MarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public class XStreamMarshallingFailureException extends MarshallingFailureException { |
||||
|
||||
public XStreamMarshallingFailureException(String msg) { |
||||
super(msg); |
||||
} |
||||
|
||||
public XStreamMarshallingFailureException(StreamException ex) { |
||||
super("XStream marshalling exception: " + ex.getMessage(), ex); |
||||
|
||||
} |
||||
|
||||
public XStreamMarshallingFailureException(CannotResolveClassException ex) { |
||||
super("XStream resolving exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
public XStreamMarshallingFailureException(ConversionException ex) { |
||||
super("XStream conversion exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.xstream; |
||||
|
||||
import org.springframework.oxm.UncategorizedXmlMappingException; |
||||
|
||||
/** |
||||
* XStream-specific subclass of <code>UncategorizedXmlMappingException</code>, for XStream exceptions that cannot be |
||||
* distinguished further. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public class XStreamSystemException extends UncategorizedXmlMappingException { |
||||
|
||||
public XStreamSystemException(String msg, Throwable ex) { |
||||
super(msg, ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,55 +0,0 @@
@@ -1,55 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.xstream; |
||||
|
||||
import javax.xml.stream.XMLStreamException; |
||||
|
||||
import com.thoughtworks.xstream.alias.CannotResolveClassException; |
||||
import com.thoughtworks.xstream.converters.ConversionException; |
||||
import com.thoughtworks.xstream.io.StreamException; |
||||
|
||||
import org.springframework.oxm.UnmarshallingFailureException; |
||||
|
||||
/** |
||||
* XStream-specific subclass of <code>UnmarshallingFailureException</code>. |
||||
* |
||||
* @author Arjen Poutsma |
||||
* @since 3.0 |
||||
*/ |
||||
public class XStreamUnmarshallingFailureException extends UnmarshallingFailureException { |
||||
|
||||
public XStreamUnmarshallingFailureException(StreamException ex) { |
||||
super("XStream unmarshalling exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
public XStreamUnmarshallingFailureException(CannotResolveClassException ex) { |
||||
super("XStream resolving exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
public XStreamUnmarshallingFailureException(ConversionException ex) { |
||||
super("XStream conversion exception: " + ex.getMessage(), ex); |
||||
} |
||||
|
||||
public XStreamUnmarshallingFailureException(String msg) { |
||||
super(msg); |
||||
} |
||||
|
||||
public XStreamUnmarshallingFailureException(String msg, XMLStreamException ex) { |
||||
super(msg, ex); |
||||
} |
||||
|
||||
} |
||||
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.castor; |
||||
|
||||
import junit.framework.TestCase; |
||||
import org.exolab.castor.xml.MarshalException; |
||||
import org.exolab.castor.xml.ValidationException; |
||||
import org.exolab.castor.xml.XMLException; |
||||
|
||||
public class CastorUtilsTest extends TestCase { |
||||
|
||||
public void testConvertMarshalException() { |
||||
assertTrue("Invalid exception conversion", CastorUtils |
||||
.convertXmlException(new MarshalException(""), true) instanceof CastorMarshallingFailureException); |
||||
assertTrue("Invalid exception conversion", CastorUtils |
||||
.convertXmlException(new MarshalException(""), false) instanceof CastorUnmarshallingFailureException); |
||||
} |
||||
|
||||
public void testConvertValidationException() { |
||||
assertTrue("Invalid exception conversion", CastorUtils |
||||
.convertXmlException(new ValidationException(""), false) instanceof CastorValidationFailureException); |
||||
} |
||||
|
||||
public void testConvertXMLException() { |
||||
assertTrue("Invalid exception conversion", |
||||
CastorUtils.convertXmlException(new XMLException(""), false) instanceof CastorSystemException); |
||||
} |
||||
|
||||
} |
||||
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.jibx; |
||||
|
||||
import junit.framework.TestCase; |
||||
import org.jibx.runtime.JiBXException; |
||||
import org.jibx.runtime.ValidationException; |
||||
|
||||
public class JibxUtilsTest extends TestCase { |
||||
|
||||
public void testConvertMarshallingException() throws Exception { |
||||
assertTrue("Invalid exception conversion", |
||||
JibxUtils.convertJibxException(new JiBXException(""), true) instanceof JibxMarshallingFailureException); |
||||
} |
||||
|
||||
public void testConvertUnmarshallingException() throws Exception { |
||||
assertTrue("Invalid exception conversion", JibxUtils |
||||
.convertJibxException(new JiBXException(""), false) instanceof JibxUnmarshallingFailureException); |
||||
} |
||||
|
||||
public void testConvertValidationException() throws Exception { |
||||
assertTrue("Invalid exception conversion", JibxUtils |
||||
.convertJibxException(new ValidationException(""), true) instanceof JibxValidationFailureException); |
||||
} |
||||
} |
||||
@ -1,53 +0,0 @@
@@ -1,53 +0,0 @@
|
||||
/* |
||||
* Copyright 2005 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.oxm.xmlbeans; |
||||
|
||||
import junit.framework.TestCase; |
||||
import org.apache.xmlbeans.XMLStreamValidationException; |
||||
import org.apache.xmlbeans.XmlError; |
||||
import org.apache.xmlbeans.XmlException; |
||||
import org.xml.sax.SAXException; |
||||
|
||||
public class XmlBeansUtilsTest extends TestCase { |
||||
|
||||
public void testConvertXMLStreamValidationException() { |
||||
assertTrue("Invalid exception conversion", XmlBeansUtils.convertXmlBeansException( |
||||
new XMLStreamValidationException(XmlError.forMessage("")), |
||||
true) instanceof XmlBeansValidationFailureException); |
||||
|
||||
} |
||||
|
||||
public void testConvertXmlException() { |
||||
assertTrue("Invalid exception conversion", XmlBeansUtils |
||||
.convertXmlBeansException(new XmlException(""), true) instanceof XmlBeansMarshallingFailureException); |
||||
assertTrue("Invalid exception conversion", XmlBeansUtils.convertXmlBeansException(new XmlException(""), |
||||
false) instanceof XmlBeansUnmarshallingFailureException); |
||||
} |
||||
|
||||
public void testConvertSAXException() { |
||||
assertTrue("Invalid exception conversion", XmlBeansUtils |
||||
.convertXmlBeansException(new SAXException(""), true) instanceof XmlBeansMarshallingFailureException); |
||||
assertTrue("Invalid exception conversion", XmlBeansUtils.convertXmlBeansException(new SAXException(""), |
||||
false) instanceof XmlBeansUnmarshallingFailureException); |
||||
} |
||||
|
||||
public void testFallbackException() { |
||||
assertTrue("Invalid exception conversion", |
||||
XmlBeansUtils.convertXmlBeansException(new Exception(""), false) instanceof XmlBeansSystemException); |
||||
|
||||
} |
||||
|
||||
} |
||||
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
/* |
||||
* Copyright 2006 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.springframework.oxm.xstream; |
||||
|
||||
import com.thoughtworks.xstream.io.StreamException; |
||||
import com.thoughtworks.xstream.mapper.CannotResolveClassException; |
||||
|
||||
import junit.framework.TestCase; |
||||
|
||||
public class XStreamUtilsTest extends TestCase { |
||||
|
||||
public void testConvertStreamException() { |
||||
assertTrue("Invalid exception conversion", XStreamUtils.convertXStreamException( |
||||
new StreamException(new Exception()), true) instanceof XStreamMarshallingFailureException); |
||||
assertTrue("Invalid exception conversion", XStreamUtils.convertXStreamException( |
||||
new StreamException(new Exception()), false) instanceof XStreamUnmarshallingFailureException); |
||||
} |
||||
|
||||
public void testConvertCannotResolveClassException() { |
||||
assertTrue("Invalid exception conversion", XStreamUtils.convertXStreamException( |
||||
new CannotResolveClassException(""), true) instanceof XStreamMarshallingFailureException); |
||||
assertTrue("Invalid exception conversion", XStreamUtils.convertXStreamException( |
||||
new CannotResolveClassException(""), false) instanceof XStreamUnmarshallingFailureException); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue