You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2016/06/12 11:09:05 UTC
svn commit: r1747979 - in
/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message:
databinding/impl/ impl/
Author: veithen
Date: Sun Jun 12 11:09:05 2016
New Revision: 1747979
URL: http://svn.apache.org/viewvc?rev=1747979&view=rev
Log:
Fix compiler warnings.
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/DataSourceBlockImpl.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SOAPEnvelopeBlockImpl.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/DataSourceBlockImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/DataSourceBlockImpl.java?rev=1747979&r1=1747978&r2=1747979&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/DataSourceBlockImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/DataSourceBlockImpl.java Sun Jun 12 11:09:05 2016
@@ -27,7 +27,6 @@ import org.apache.axiom.om.OMSourcedElem
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axis2.builder.DataSourceBuilder;
-import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.message.databinding.DataSourceBlock;
@@ -46,8 +45,6 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.ws.WebServiceException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
/**
* SourceBlock
@@ -69,11 +66,6 @@ public class DataSourceBlockImpl extends
DataSourceBlockImpl(DataSource busObject, QName qName, BlockFactory factory)
throws WebServiceException {
super(busObject, null, qName, factory);
- // Check validity of DataSource
- if (!(busObject instanceof DataSource)) {
- throw ExceptionFactory.makeWebServiceException(
- Messages.getMessage("SourceNotSupported", busObject.getClass().getName()));
- }
}
@@ -144,11 +136,7 @@ public class DataSourceBlockImpl extends
protected XMLStreamReader _getReaderFromBO(DataSource busObj, Void busContext)
throws XMLStreamException, WebServiceException {
try {
- if (busObj instanceof DataSource) {
- return StAXUtils.createXMLStreamReader(((DataSource)busObj).getInputStream());
- }
- throw ExceptionFactory.makeWebServiceException(
- Messages.getMessage("SourceNotSupported", busObject.getClass().getName()));
+ return StAXUtils.createXMLStreamReader(busObj.getInputStream());
} catch (Exception e) {
String className = (busObj == null) ? "none" : busObj.getClass().getName();
throw ExceptionFactory
@@ -187,40 +175,17 @@ public class DataSourceBlockImpl extends
}
}
+ @Override
public boolean isElementData() {
return false; // The source could be a text or element etc.
}
- /**
- * Return the class for this name
- * @return Class
- */
- private static Class forName(final String className) throws ClassNotFoundException {
- // NOTE: This method must remain private because it uses AccessController
- Class cl = null;
- try {
- cl = (Class)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() throws ClassNotFoundException {
- return Class.forName(className);
- }
- }
- );
- } catch (PrivilegedActionException e) {
- if (log.isDebugEnabled()) {
- log.debug("Exception thrown from AccessController: " + e);
- }
- throw (ClassNotFoundException)e.getException();
- }
-
- return cl;
- }
-
-
+ @Override
public void close() {
return; // Nothing to close
}
+ @Override
public Object getObject() {
try {
return getBusinessObject(false);
@@ -229,10 +194,12 @@ public class DataSourceBlockImpl extends
}
}
+ @Override
public boolean isDestructiveRead() {
return true;
}
+ @Override
public boolean isDestructiveWrite() {
return true;
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java?rev=1747979&r1=1747978&r2=1747979&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java Sun Jun 12 11:09:05 2016
@@ -88,15 +88,13 @@ public class JAXBBlockImpl extends Block
protected Object _getBOFromReader(XMLStreamReader reader, JAXBBlockContext busContext)
throws XMLStreamException, WebServiceException {
// Get the JAXBBlockContext. All of the necessry information is recorded on it
- JAXBBlockContext ctx = (JAXBBlockContext) busContext;
-
try {
- busObject = ctx.unmarshal(reader);
+ busObject = busContext.unmarshal(reader);
} catch (JAXBException je) {
if (DEBUG_ENABLED) {
try {
log.debug("JAXBContext for unmarshal failure:" +
- ctx.getJAXBContext(ctx.getClassLoader()));
+ busContext.getJAXBContext(busContext.getClassLoader()));
} catch (Exception e) {
}
}
@@ -169,15 +167,13 @@ public class JAXBBlockImpl extends Block
@Override
protected void _outputFromBO(Object busObject, JAXBBlockContext busContext, XMLStreamWriter writer)
throws XMLStreamException, WebServiceException {
- JAXBBlockContext ctx = (JAXBBlockContext) busContext;
-
try {
- ctx.marshal(busObject, writer);
+ busContext.marshal(busObject, writer);
} catch (JAXBException je) {
if (DEBUG_ENABLED) {
try {
log.debug("JAXBContext for marshal failure:" +
- ctx.getJAXBContext(ctx.getClassLoader()));
+ busContext.getJAXBContext(busContext.getClassLoader()));
} catch (Exception e) {
}
}
@@ -185,14 +181,17 @@ public class JAXBBlockImpl extends Block
}
}
+ @Override
public boolean isElementData() {
return true;
}
+ @Override
public void close() {
return; // Nothing to close
}
+ @Override
public Object getObject() {
try {
return getBusinessObject(false);
@@ -201,14 +200,17 @@ public class JAXBBlockImpl extends Block
}
}
+ @Override
public boolean isDestructiveRead() {
return false;
}
+ @Override
public boolean isDestructiveWrite() {
return false;
}
+ @Override
public OMDataSourceExt copy() throws OMException {
if (DEBUG_ENABLED) {
@@ -218,9 +220,10 @@ public class JAXBBlockImpl extends Block
(JAXBDSContext) this.getBusinessContext());
}
+ @Override
public void setParent(Message message) {
if (busContext != null) {
- ((JAXBBlockContext) busContext).setMessage(message);
+ busContext.setMessage(message);
}
super.setParent(message);
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java?rev=1747979&r1=1747978&r2=1747979&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java Sun Jun 12 11:09:05 2016
@@ -57,8 +57,7 @@ public class OMBlockImpl extends BlockIm
@Override
protected XMLStreamReader _getReaderFromBO(OMElement busObj, Void busContext)
throws XMLStreamException, WebServiceException {
- OMElement om = (OMElement)busObj;
- return om.getXMLStreamReader();
+ return busObj.getXMLStreamReader();
}
@Override
@@ -79,13 +78,17 @@ public class OMBlockImpl extends BlockIm
busObject.serialize(writer);
}
+ @Override
public boolean isElementData() {
return true;
}
+
+ @Override
public void close() {
return; // Nothing to close
}
+ @Override
public Object getObject() {
try {
return getBusinessObject(false);
@@ -94,10 +97,12 @@ public class OMBlockImpl extends BlockIm
}
}
+ @Override
public boolean isDestructiveRead() {
return false;
}
+ @Override
public boolean isDestructiveWrite() {
return false;
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SOAPEnvelopeBlockImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SOAPEnvelopeBlockImpl.java?rev=1747979&r1=1747978&r2=1747979&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SOAPEnvelopeBlockImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SOAPEnvelopeBlockImpl.java Sun Jun 12 11:09:05 2016
@@ -117,14 +117,17 @@ public class SOAPEnvelopeBlockImpl exten
return new QName(env.getNamespaceURI(), env.getLocalName(), env.getPrefix());
}
+ @Override
public boolean isElementData() {
return true;
}
+ @Override
public void close() {
return; // Nothing to close
}
+ @Override
public Object getObject() {
try {
return getBusinessObject(false);
@@ -133,10 +136,12 @@ public class SOAPEnvelopeBlockImpl exten
}
}
+ @Override
public boolean isDestructiveRead() {
return false;
}
+ @Override
public boolean isDestructiveWrite() {
return false;
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java?rev=1747979&r1=1747978&r2=1747979&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java Sun Jun 12 11:09:05 2016
@@ -71,7 +71,7 @@ import java.security.PrivilegedException
public class SourceBlockImpl extends BlockImpl<Source,Void> implements SourceBlock {
private static final Log log = LogFactory.getLog(SourceBlockImpl.class);
- private static Class staxSource = null;
+ private static Class<?> staxSource = null;
static {
try {
@@ -225,7 +225,7 @@ public class SourceBlockImpl extends Blo
if (busObj instanceof StreamSource) {
XMLInputFactory f = StAXUtils.getXMLInputFactory();
- return f.createXMLStreamReader((Source)busObj);
+ return f.createXMLStreamReader(busObj);
}
//TODO: For GM we need to only use this approach when absolutely necessary.
// For example, we don't want to do this if this is a (1.6) StaxSource or if the
@@ -233,7 +233,7 @@ public class SourceBlockImpl extends Blo
//TODO: Uncomment this code if woodstock parser handles
// JAXBSource and SAXSource correctly.
//return inputFactory.createXMLStreamReader((Source) busObj);
- return _slow_getReaderFromSource((Source)busObj);
+ return _slow_getReaderFromSource(busObj);
} catch (Exception e) {
String className = (busObj == null) ? "none" : busObj.getClass().getName();
throw ExceptionFactory
@@ -290,6 +290,7 @@ public class SourceBlockImpl extends Blo
}
+ @Override
public boolean isElementData() {
return false; // The source could be a text or element etc.
}
@@ -298,13 +299,14 @@ public class SourceBlockImpl extends Blo
* Return the class for this name
* @return Class
*/
- private static Class forName(final String className) throws ClassNotFoundException {
+ private static Class<?> forName(final String className) throws ClassNotFoundException {
// NOTE: This method must remain private because it uses AccessController
- Class cl = null;
+ Class<?> cl = null;
try {
- cl = (Class)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() throws ClassNotFoundException {
+ cl = AccessController.doPrivileged(
+ new PrivilegedExceptionAction<Class<?>>() {
+ @Override
+ public Class<?> run() throws ClassNotFoundException {
return Class.forName(className);
}
}
@@ -319,11 +321,12 @@ public class SourceBlockImpl extends Blo
return cl;
}
-
+ @Override
public void close() {
return; // Nothing to close
}
+ @Override
public Object getObject() {
try {
return getBusinessObject(false);
@@ -332,10 +335,12 @@ public class SourceBlockImpl extends Blo
}
}
+ @Override
public boolean isDestructiveRead() {
return true;
}
+ @Override
public boolean isDestructiveWrite() {
return true;
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java?rev=1747979&r1=1747978&r2=1747979&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java Sun Jun 12 11:09:05 2016
@@ -112,15 +112,17 @@ public class XMLStringBlockImpl extends
_outputFromReader(reader, writer);
}
-
+ @Override
public boolean isElementData() {
return false; // The text could be element or text or something else
}
+ @Override
public void close() {
return; // Nothing to close
}
+ @Override
public Object getObject() {
try {
return getBusinessObject(false);
@@ -129,16 +131,19 @@ public class XMLStringBlockImpl extends
}
}
+ @Override
public boolean isDestructiveRead() {
// return false;
// TODO: XMLStringBlock should actually be non destructive, but getReader() throws an exception when it is invoked the second time
return true;
}
+ @Override
public boolean isDestructiveWrite() {
return false;
}
+ @Override
public OMDataSourceExt copy() throws OMException {
return new StringOMDataSource((String) getObject());
}
Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java?rev=1747979&r1=1747978&r2=1747979&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java Sun Jun 12 11:09:05 2016
@@ -114,6 +114,7 @@ public abstract class BlockImpl<T,C> ext
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.message.Block#getBlockFactory()
*/
+ @Override
public final BlockFactory getBlockFactory() {
return factory;
}
@@ -121,14 +122,17 @@ public abstract class BlockImpl<T,C> ext
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.message.Block#getBusinessContext()
*/
+ @Override
public final Object getBusinessContext() {
return busContext;
}
+ @Override
public final Message getParent() {
return parent;
}
+ @Override
public void setParent(Message p) {
parent = p;
}
@@ -136,6 +140,7 @@ public abstract class BlockImpl<T,C> ext
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.message.Block#getBusinessObject(boolean)
*/
+ @Override
public final T getBusinessObject(boolean consume)
throws XMLStreamException, WebServiceException {
if (consumed) {
@@ -161,6 +166,7 @@ public abstract class BlockImpl<T,C> ext
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.message.Block#getQName()
*/
+ @Override
public final QName getQName() throws WebServiceException {
// If the QName is not known, find it
try {
@@ -219,6 +225,7 @@ public abstract class BlockImpl<T,C> ext
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.message.Block#getXMLStreamReader(boolean)
*/
+ @Override
public final XMLStreamReader getXMLStreamReader(boolean consume)
throws XMLStreamException, WebServiceException {
XMLStreamReader newReader = null;
@@ -248,6 +255,7 @@ public abstract class BlockImpl<T,C> ext
/* (non-Javadoc)
* @see org.apache.axiom.om.OMDataSource#getReader()
*/
+ @Override
public final XMLStreamReader getReader() throws XMLStreamException {
return getXMLStreamReader(true);
}
@@ -255,10 +263,12 @@ public abstract class BlockImpl<T,C> ext
/* (non-Javadoc)
* @see org.apache.axiom.om.OMDataSource#serialize(javax.xml.stream.XMLStreamWriter)
*/
+ @Override
public final void serialize(XMLStreamWriter writer) throws XMLStreamException {
outputTo(writer, isDestructiveWrite());
}
+ @Override
public OMElement getOMElement() throws XMLStreamException, WebServiceException {
OMElement newOMElement = null;
boolean consume = true; // get the OM consumes the message
@@ -281,6 +291,7 @@ public abstract class BlockImpl<T,C> ext
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.message.Block#isConsumed()
*/
+ @Override
public final boolean isConsumed() {
return consumed;
}
@@ -307,10 +318,12 @@ public abstract class BlockImpl<T,C> ext
}
}
+ @Override
public final boolean isQNameAvailable() {
return (qName != null);
}
+ @Override
public final void outputTo(XMLStreamWriter writer, boolean consume)
throws XMLStreamException, WebServiceException {
if (log.isDebugEnabled()) {
@@ -390,6 +403,7 @@ public abstract class BlockImpl<T,C> ext
return busObject != null;
}
+ @Override
public final String traceString(String indent) {
// TODO add trace string
return null;
@@ -504,6 +518,7 @@ public abstract class BlockImpl<T,C> ext
/* (non-Javadoc)
* @see org.apache.axiom.om.OMDataSourceExt#copy()
*/
+ @Override
public OMDataSourceExt copy() throws OMException {
// TODO: This is a default implementation. Much
// more refactoring needs to occur to account for attachments.