You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/10/07 00:51:54 UTC

svn commit: r453798 - in /incubator/tuscany/java/sca/kernel: core/src/main/java/org/apache/tuscany/core/databinding/impl/ core/src/main/java/org/apache/tuscany/core/databinding/xml/ core/src/main/java/org/apache/tuscany/core/implementation/composite/ c...

Author: jmarino
Date: Fri Oct  6 15:51:51 2006
New Revision: 453798

URL: http://svn.apache.org/viewvc?view=rev&rev=453798
Log:
checkstyle cleanup

Modified:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java?view=diff&rev=453798&r1=453797&r2=453798
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingJavaInterfaceProcessor.java Fri Oct  6 15:51:51 2006
@@ -47,8 +47,8 @@
     private static final String SIMPLE_JAVA_OBJECTS = "java.lang.Object";
 
     private static final Class[] SIMPLE_JAVA_TYPES =
-            {Byte.class, Character.class, Short.class, Integer.class, Long.class, Float.class, Double.class,
-            Date.class, Calendar.class, GregorianCalendar.class, Duration.class, XMLGregorianCalendar.class};
+    {Byte.class, Character.class, Short.class, Integer.class, Long.class, Float.class, Double.class,
+        Date.class, Calendar.class, GregorianCalendar.class, Duration.class, XMLGregorianCalendar.class};
 
     private static final Set<Class> SIMPLE_TYPE_SET = new HashSet<Class>(Arrays.asList(SIMPLE_JAVA_TYPES));
 

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java?view=diff&rev=453798&r1=453797&r2=453798
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/xml/DOMXMLStreamReader.java Fri Oct  6 15:51:51 2006
@@ -22,14 +22,12 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-
 import javax.xml.XMLConstants;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
 import javax.xml.stream.Location;
 import javax.xml.stream.XMLStreamException;
 
-import org.apache.tuscany.core.databinding.xml.StAXHelper.XMLFragmentStreamReader;
 import org.w3c.dom.Attr;
 import org.w3c.dom.CharacterData;
 import org.w3c.dom.Document;
@@ -38,9 +36,11 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import org.apache.tuscany.core.databinding.xml.StAXHelper.XMLFragmentStreamReader;
+
 public class DOMXMLStreamReader implements XMLFragmentStreamReader {
     protected static class DelegatingNamespaceContext implements NamespaceContext {
-        private int counter = 0;
+        private int counter;
 
         private NamespaceContext parent;
 
@@ -56,7 +56,7 @@
         }
 
         public synchronized QName createQName(String nsURI, String name) {
-            String prefix = nsURI != null ? (String)getPrefix(nsURI) : null;
+            String prefix = nsURI != null ? (String) getPrefix(nsURI) : null;
             if (prefix == null && nsURI != null && !nsURI.equals("")) {
                 prefix = "p" + (counter++);
             }
@@ -74,7 +74,7 @@
                 throw new IllegalArgumentException("Prefix is null");
             }
 
-            String ns = (String)prefixToNamespaceMapping.get(prefix);
+            String ns = (String) prefixToNamespaceMapping.get(prefix);
             if (ns != null) {
                 return ns;
             } else if (parent != null) {
@@ -87,11 +87,11 @@
         public String getPrefix(String nsURI) {
             if (nsURI == null) {
                 throw new IllegalArgumentException("Namespace is null");
-            }    
+            }
             for (Map.Entry<String, String> entry1 : prefixToNamespaceMapping.entrySet()) {
                 Map.Entry entry = entry1;
                 if (entry.getValue().equals(nsURI)) {
-                    return (String)entry.getKey();
+                    return (String) entry.getKey();
                 }
             }
             if (parent != null) {
@@ -110,7 +110,7 @@
             }
             if (parent != null) {
                 for (Iterator i = parent.getPrefixes(nsURI); i.hasNext();) {
-                    prefixList.add((String)i.next());
+                    prefixList.add((String) i.next());
                 }
             }
             return prefixList.iterator();
@@ -498,7 +498,7 @@
 
         /**
          * Test whether the xsi namespace is present
-         * 
+         *
          * @return
          */
         private boolean isXsiNamespacePresent() {
@@ -570,8 +570,7 @@
     private XMLFragmentStreamReader childReader;
 
     // current property index
-    // initialized at zero
-    private int currentPropertyIndex = 0;
+    private int currentPropertyIndex;
 
     private Map<String, String> declaredNamespaceMap = new HashMap<String, String>();
 
@@ -595,10 +594,10 @@
     public DOMXMLStreamReader(Node node) {
         switch (node.getNodeType()) {
             case Node.DOCUMENT_NODE:
-                this.rootElement = ((Document)node).getDocumentElement();
+                this.rootElement = ((Document) node).getDocumentElement();
                 break;
             case Node.ELEMENT_NODE:
-                this.rootElement = (Element)node;
+                this.rootElement = (Element) node;
                 break;
             default:
                 throw new IllegalArgumentException("Illegal Node");
@@ -609,7 +608,7 @@
         declaredNamespaceMap.put("xml", "http://www.w3.org/XML/1998/namespace");
         declaredNamespaceMap.put("xmlns", "http://www.w3.org/2000/xmlns/");
         declaredNamespaceMap.put("xsi", "http://www.w3.org/2001/XMLSchema-instance");
-        
+
         populateProperties();
     }
 
@@ -669,9 +668,9 @@
                     // case one - attrib name is null
                     // this should be the pointer to the OMAttribute then
                     if (attribPointer instanceof String) {
-                        return new QName((String)attribPointer);
+                        return new QName((String) attribPointer);
                     } else if (attribPointer instanceof QName) {
-                        return (QName)attribPointer;
+                        return (QName) attribPointer;
                     } else {
                         return null;
                     }
@@ -733,9 +732,9 @@
                     // case one - attrib name is null
                     // this should be the pointer to the OMAttribute then
                     if (attribPointer instanceof String) {
-                        return (String)omAttribObj;
+                        return (String) omAttribObj;
                     } else if (attribPointer instanceof QName) {
-                        return (String)omAttribObj;
+                        return (String) omAttribObj;
                     } else {
                         return null;
                     }
@@ -778,7 +777,7 @@
 
     /**
      * todo implement the right contract for this
-     * 
+     *
      * @return
      * @throws XMLStreamException
      */
@@ -921,7 +920,7 @@
             return childReader.getNamespaceURI(i);
         } else if (state != TEXT_STATE) {
             String namespacePrefix = getNamespacePrefix(i);
-            return namespacePrefix == null ? null : (String)declaredNamespaceMap.get(namespacePrefix);
+            return namespacePrefix == null ? null : (String) declaredNamespaceMap.get(namespacePrefix);
         } else {
             throw new IllegalStateException();
         }
@@ -984,7 +983,7 @@
         if (state == DELEGATED_STATE) {
             return childReader.getText();
         } else if (state == TEXT_STATE) {
-            return (String)properties[currentPropertyIndex - 1].getValue();
+            return (String) properties[currentPropertyIndex - 1].getValue();
         } else {
             throw new IllegalStateException();
         }
@@ -995,7 +994,7 @@
             return childReader.getTextCharacters();
         } else if (state == TEXT_STATE) {
             return properties[currentPropertyIndex - 1].getValue() == null ? new char[0]
-                : ((String)properties[currentPropertyIndex - 1].getValue()).toCharArray();
+                : ((String) properties[currentPropertyIndex - 1].getValue()).toCharArray();
         } else {
             throw new IllegalStateException();
         }
@@ -1068,7 +1067,7 @@
 
     /**
      * check the validity of this implementation
-     * 
+     *
      * @return
      */
     public boolean hasText() {
@@ -1080,9 +1079,8 @@
     }
 
     /**
-     * we need to split out the calling to the populate namespaces seperately
-     * since this needs to be done *after* setting the parent namespace context.
-     * We cannot assume it will happen at construction!
+     * we need to split out the calling to the populate namespaces seperately since this needs to be done *after*
+     * setting the parent namespace context. We cannot assume it will happen at construction!
      */
     public void init() {
         // here we have an extra issue to attend to. we need to look at the
@@ -1115,7 +1113,7 @@
 
     /**
      * are we done ?
-     * 
+     *
      * @return
      */
     public boolean isEndOfFragment() {
@@ -1144,12 +1142,12 @@
 
     /**
      * Get the prefix list from the hastable and take that into an array
-     * 
+     *
      * @return
      */
     private String[] makePrefixArray() {
         String[] prefixes =
-            (String[])declaredNamespaceMap.keySet().toArray(new String[declaredNamespaceMap.size()]);
+            (String[]) declaredNamespaceMap.keySet().toArray(new String[declaredNamespaceMap.size()]);
         Arrays.sort(prefixes);
         return prefixes;
     }
@@ -1160,7 +1158,7 @@
 
     /**
      * todo implement this
-     * 
+     *
      * @return
      * @throws XMLStreamException
      */
@@ -1194,7 +1192,7 @@
                 if (attribName instanceof String) {
                     // ignore this case - Nothing to do
                 } else if (attribName instanceof QName) {
-                    QName attribQName = ((QName)attribName);
+                    QName attribQName = (QName) attribName;
                     registerNamespace(attribQName.getPrefix(), attribQName.getNamespaceURI());
 
                 }
@@ -1218,7 +1216,7 @@
         List<Object> attributeList = new ArrayList<Object>();
         NamedNodeMap nodeMap = rootElement.getAttributes();
         for (int i = 0; i < nodeMap.getLength(); i++) {
-            Attr attr = (Attr)nodeMap.item(i);
+            Attr attr = (Attr) nodeMap.item(i);
             if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(attr.getNamespaceURI())) {
                 // Skip xmlns:xxx
                 registerNamespace(attr.getLocalName(), attr.getValue());
@@ -1234,12 +1232,12 @@
             switch (node.getNodeType()) {
                 case Node.TEXT_NODE:
                 case Node.CDATA_SECTION_NODE:
-                    NameValuePair pair = new NameValuePair(ELEMENT_TEXT, ((CharacterData)node).getData());
+                    NameValuePair pair = new NameValuePair(ELEMENT_TEXT, ((CharacterData) node).getData());
                     elementList.add(pair);
                     break;
 
                 case Node.ELEMENT_NODE:
-                    Element element = (Element)node;
+                    Element element = (Element) node;
                     QName elementName = new QName(element.getNamespaceURI(), element.getLocalName());
                     pair = new NameValuePair(elementName, new DOMXMLStreamReader(element));
                     elementList.add(pair);
@@ -1252,7 +1250,7 @@
 
     /**
      * A convenient method to reuse the properties
-     * 
+     *
      * @return event to be thrown
      * @throws XMLStreamException
      */
@@ -1271,10 +1269,10 @@
             if (ELEMENT_TEXT.equals(propPointer)) {
                 textFound = true;
             } else {
-                propertyQName = new QName((String)propPointer);
+                propertyQName = new QName((String) propPointer);
             }
         } else if (propPointer instanceof QName) {
-            propertyQName = (QName)propPointer;
+            propertyQName = (QName) propPointer;
         } else {
             // oops - we've no idea what kind of key this is
             throw new XMLStreamException("unidentified property key!!!" + propPointer);
@@ -1292,12 +1290,12 @@
             return CHARACTERS;
         } else if (propertyValue == null || propertyValue instanceof String) {
             // strings are handled by the NameValuePairStreamReader
-            childReader = new SimpleElementStreamReader(propertyQName, (String)propertyValue);
+            childReader = new SimpleElementStreamReader(propertyQName, (String) propertyValue);
             childReader.setParentNamespaceContext(this.namespaceContext);
             childReader.init();
         } else if (propertyValue instanceof DOMXMLStreamReader) {
             // ADBbean has it's own method to get a reader
-            XMLFragmentStreamReader reader = (DOMXMLStreamReader)propertyValue;
+            XMLFragmentStreamReader reader = (DOMXMLStreamReader) propertyValue;
             // we know for sure that this is an ADB XMLStreamreader.
             // However we need to make sure that it is compatible
             childReader = reader;
@@ -1351,8 +1349,8 @@
     }
 
     /**
-     * By far this should be the most important method in this class this method
-     * changes the state of the parser according to the change in the
+     * By far this should be the most important method in this class this method changes the state of the parser
+     * according to the change in the
      */
     private int updateStatus() throws XMLStreamException {
         int returnEvent = -1; // invalid state is the default state

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java?view=diff&rev=453798&r1=453797&r2=453798
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java Fri Oct  6 15:51:51 2006
@@ -132,7 +132,7 @@
     }
 
     public void publish(Event event) {
-        if (lifecycleState == STOPPED){
+        if (lifecycleState == STOPPED) {
             return;
         }
         checkInit();

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java?view=diff&rev=453798&r1=453797&r2=453798
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/processor/ConstructorAutowireTestCase.java Fri Oct  6 15:51:51 2006
@@ -63,7 +63,7 @@
             new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         Constructor<Foo2> ctor = Foo2.class.getConstructor(Bar.class);
         processor.visitConstructor(null, ctor, type, null);
-        assertNotNull(type.getReferences().get(Bar.class.getName()+"0"));
+        assertNotNull(type.getReferences().get(Bar.class.getName() + "0"));
     }
 
     public void testInvalidNumberOfNames() throws Exception {

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.java?view=diff&rev=453798&r1=453797&r2=453798
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/property/PropertyHelperTestCase.java Fri Oct  6 15:51:51 2006
@@ -20,17 +20,16 @@
 package org.apache.tuscany.core.property;
 
 import java.net.URL;
-
 import javax.xml.namespace.NamespaceContext;
 
-import org.apache.tuscany.core.databinding.xml.String2Node;
-import org.apache.tuscany.core.property.PropertyHelper;
-import org.apache.tuscany.spi.deployer.DeploymentContext;
-import org.easymock.EasyMock;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
 import junit.framework.TestCase;
+import org.apache.tuscany.core.databinding.xml.String2Node;
+import org.easymock.EasyMock;
 
 /**
  *
@@ -76,10 +75,10 @@
     public void testXPath() throws Exception {
         String2Node t = new String2Node();
         Node node = t.transform(IPO_XML, null);
-        
+
         Document doc = PropertyHelper.evaluate(null, node, "/ipo:purchaseOrder/billTo");
         assertNotNull(doc);
-        
+
         NamespaceContext context = EasyMock.createMock(NamespaceContext.class);
         EasyMock.expect(context.getNamespaceURI("ipo")).andReturn("http://www.example.com/IPO").anyTimes();
         EasyMock.replay(context);

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java?view=diff&rev=453798&r1=453797&r2=453798
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/databinding/extension/XSDDataTypeConverter.java Fri Oct  6 15:51:51 2006
@@ -29,7 +29,6 @@
 import java.text.ParsePosition;
 import java.util.Calendar;
 import java.util.TimeZone;
-
 import javax.xml.XMLConstants;
 import javax.xml.datatype.DatatypeConfigurationException;
 import javax.xml.datatype.DatatypeFactory;
@@ -44,9 +43,9 @@
     public static final class Base64Binary {
         private static final char[] S_BASE64CHAR =
             {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
-             'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
-             'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4',
-             '5', '6', '7', '8', '9', '+', '/'};
+                'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
+                'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4',
+                '5', '6', '7', '8', '9', '+', '/'};
 
         private static final char S_BASE64PAD = '=';
 
@@ -58,7 +57,7 @@
             }
             for (int i = 0; i < S_BASE64CHAR.length; i++) {
                 // 0 to 63
-                S_DECODETABLE[S_BASE64CHAR[i]] = (byte)i;
+                S_DECODETABLE[S_BASE64CHAR[i]] = (byte) i;
             }
         }
 
@@ -172,16 +171,16 @@
             int b3 = S_DECODETABLE[ibuf[3]];
             switch (outlen) {
                 case 1:
-                    obuf[wp] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3);
+                    obuf[wp] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
                     return 1;
                 case 2:
-                    obuf[wp++] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3);
-                    obuf[wp] = (byte)(b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
+                    obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
+                    obuf[wp] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
                     return 2;
                 case 3:
-                    obuf[wp++] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3);
-                    obuf[wp++] = (byte)(b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
-                    obuf[wp] = (byte)(b2 << 6 & 0xc0 | b3 & 0x3f);
+                    obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
+                    obuf[wp++] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
+                    obuf[wp] = (byte) (b2 << 6 & 0xc0 | b3 & 0x3f);
                     return 3;
                 default:
                     throw new IllegalArgumentException("The character sequence is not base64 encoded.");
@@ -234,8 +233,7 @@
         }
 
         /**
-         * Outputs base64 representation of the specified byte array to a byte
-         * stream.
+         * Outputs base64 representation of the specified byte array to a byte stream.
          */
         public static void encode(byte[] data, int off, int len, OutputStream ostream) throws IOException {
             if (len <= 0) {
@@ -248,34 +246,33 @@
                 int i =
                     ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
                         + (data[rindex + 2] & 0xff);
-                out[0] = (byte)S_BASE64CHAR[i >> 18];
-                out[1] = (byte)S_BASE64CHAR[(i >> 12) & 0x3f];
-                out[2] = (byte)S_BASE64CHAR[(i >> 6) & 0x3f];
-                out[3] = (byte)S_BASE64CHAR[i & 0x3f];
+                out[0] = (byte) S_BASE64CHAR[i >> 18];
+                out[1] = (byte) S_BASE64CHAR[(i >> 12) & 0x3f];
+                out[2] = (byte) S_BASE64CHAR[(i >> 6) & 0x3f];
+                out[3] = (byte) S_BASE64CHAR[i & 0x3f];
                 ostream.write(out, 0, 4);
                 rindex += 3;
                 rest -= 3;
             }
             if (rest == 1) {
                 int i = data[rindex] & 0xff;
-                out[0] = (byte)S_BASE64CHAR[i >> 2];
-                out[1] = (byte)S_BASE64CHAR[(i << 4) & 0x3f];
-                out[2] = (byte)S_BASE64PAD;
-                out[3] = (byte)S_BASE64PAD;
+                out[0] = (byte) S_BASE64CHAR[i >> 2];
+                out[1] = (byte) S_BASE64CHAR[(i << 4) & 0x3f];
+                out[2] = (byte) S_BASE64PAD;
+                out[3] = (byte) S_BASE64PAD;
                 ostream.write(out, 0, 4);
             } else if (rest == 2) {
                 int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
-                out[0] = (byte)S_BASE64CHAR[i >> 10];
-                out[1] = (byte)S_BASE64CHAR[(i >> 4) & 0x3f];
-                out[2] = (byte)S_BASE64CHAR[(i << 2) & 0x3f];
-                out[3] = (byte)S_BASE64PAD;
+                out[0] = (byte) S_BASE64CHAR[i >> 10];
+                out[1] = (byte) S_BASE64CHAR[(i >> 4) & 0x3f];
+                out[2] = (byte) S_BASE64CHAR[(i << 2) & 0x3f];
+                out[3] = (byte) S_BASE64PAD;
                 ostream.write(out, 0, 4);
             }
         }
 
         /**
-         * Outputs base64 representation of the specified byte array to a
-         * character stream.
+         * Outputs base64 representation of the specified byte array to a character stream.
          */
         public static void encode(byte[] data, int off, int len, Writer writer) throws IOException {
             if (len <= 0) {
@@ -320,9 +317,8 @@
     }
 
     /**
-     * <p>
-     * Utility class for xs:hexbinary.
-     * </p>
+     * <p/>
+     * Utility class for xs:hexbinary. </p>
      */
     public static final class HexBinary {
         private HexBinary() {
@@ -343,20 +339,20 @@
                 char c = pValue.charAt(i++);
                 char d = pValue.charAt(i++);
                 if (c >= '0' && c <= '9') {
-                    b = (byte)((c - '0') << 4);
+                    b = (byte) ((c - '0') << 4);
                 } else if (c >= 'A' && c <= 'F') {
-                    b = (byte)((c - 'A' + 10) << 4);
+                    b = (byte) ((c - 'A' + 10) << 4);
                 } else if (c >= 'a' && c <= 'f') {
-                    b = (byte)((c - 'a' + 10) << 4);
+                    b = (byte) ((c - 'a' + 10) << 4);
                 } else {
                     throw new IllegalArgumentException("Invalid hex digit: " + c);
                 }
                 if (d >= '0' && d <= '9') {
-                    b += (byte)(d - '0');
+                    b += (byte) (d - '0');
                 } else if (d >= 'A' && d <= 'F') {
-                    b += (byte)(d - 'A' + 10);
+                    b += (byte) (d - 'A' + 10);
                 } else if (d >= 'a' && d <= 'f') {
-                    b += (byte)(d - 'a' + 10);
+                    b += (byte) (d - 'a' + 10);
                 } else {
                     throw new IllegalArgumentException("Invalid hex digit: " + d);
                 }
@@ -372,17 +368,17 @@
             StringBuffer result = new StringBuffer();
             for (int i = 0; i < pHexBinary.length; i++) {
                 byte b = pHexBinary[i];
-                byte c = (byte)((b & 0xf0) >> 4);
+                byte c = (byte) ((b & 0xf0) >> 4);
                 if (c <= 9) {
-                    result.append((char)('0' + c));
+                    result.append((char) ('0' + c));
                 } else {
-                    result.append((char)('A' + c - 10));
+                    result.append((char) ('A' + c - 10));
                 }
-                c = (byte)(b & 0x0f);
+                c = (byte) (b & 0x0f);
                 if (c <= 9) {
-                    result.append((char)('0' + c));
+                    result.append((char) ('0' + c));
                 } else {
-                    result.append((char)('A' + c - 10));
+                    result.append((char) ('A' + c - 10));
                 }
             }
             return result.toString();
@@ -410,9 +406,8 @@
     }
 
     /**
-     * <p>
-     * An instance of {@link java.text.Format}, which may be used to parse and
-     * format <code>xs:dateTime</code> values.
+     * <p/>
+     * An instance of {@link java.text.Format}, which may be used to parse and format <code>xs:dateTime</code> values.
      * </p>
      */
     public static class XSDDateTimeFormat extends Format {
@@ -447,7 +442,7 @@
             assert pBuffer != null : "The StringBuffer argument must not be null.";
             assert pPos != null : "The FieldPosition argument must not be null.";
 
-            Calendar cal = (Calendar)pCalendar;
+            Calendar cal = (Calendar) pCalendar;
             if (parseDate) {
                 int year = cal.get(Calendar.YEAR);
                 if (year < 0) {
@@ -687,7 +682,7 @@
         }
     }
 
-    private static final long MAX_UNSIGNED_INT = (((long)Integer.MAX_VALUE) * 2) + 1;
+    private static final long MAX_UNSIGNED_INT = (((long) Integer.MAX_VALUE) * 2) + 1;
 
     private static final int MAX_UNSIGNED_SHORT = Short.MAX_VALUE * 2 + 1;
 
@@ -710,10 +705,10 @@
     public Calendar parseDate(String value) {
         XSDDateFormat format = new XSDDateFormat();
         ParsePosition pos = new ParsePosition(0);
-        Calendar cal = (Calendar)format.parseObject(value, pos);
+        Calendar cal = (Calendar) format.parseObject(value, pos);
         if (cal == null) {
             throw new IllegalArgumentException("Failed to parse date " + value + " at:"
-                                               + value.substring(pos.getErrorIndex()));
+                + value.substring(pos.getErrorIndex()));
         }
         return cal;
     }
@@ -721,10 +716,10 @@
     public Calendar parseDateTime(String value) {
         XSDDateTimeFormat format = new XSDDateTimeFormat();
         ParsePosition pos = new ParsePosition(0);
-        Calendar cal = (Calendar)format.parseObject(value, pos);
+        Calendar cal = (Calendar) format.parseObject(value, pos);
         if (cal == null) {
             throw new IllegalArgumentException("Failed to parse dateTime " + value + " at:"
-                                               + value.substring(pos.getErrorIndex()));
+                + value.substring(pos.getErrorIndex()));
         }
         return cal;
     }
@@ -798,7 +793,7 @@
                 break;
             case 0:
                 throw new IllegalArgumentException("Default prefix must be indicated by not using a colon: "
-                                                   + value);
+                    + value);
             default:
                 String prefix = value.substring(0, offset);
                 localName = value.substring(offset + 1);
@@ -821,10 +816,10 @@
     public Calendar parseTime(String value) {
         XSDTimeFormat format = new XSDTimeFormat();
         ParsePosition pos = new ParsePosition(0);
-        Calendar cal = (Calendar)format.parseObject(value, pos);
+        Calendar cal = (Calendar) format.parseObject(value, pos);
         if (cal == null) {
             throw new IllegalArgumentException("Failed to parse time " + value + " at:"
-                                               + value.substring(pos.getErrorIndex()));
+                + value.substring(pos.getErrorIndex()));
         }
         return cal;
     }
@@ -833,11 +828,11 @@
         long l = Long.parseLong(value);
         if (l < 0) {
             throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
-                                               + ": result is negative");
+                + ": result is negative");
         }
         if (l > MAX_UNSIGNED_INT) {
             throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
-                                               + ": result exceeds maximum value " + MAX_UNSIGNED_INT);
+                + ": result exceeds maximum value " + MAX_UNSIGNED_INT);
         }
         return l;
     }
@@ -846,11 +841,11 @@
         int i = Integer.parseInt(value);
         if (i < 0) {
             throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
-                                               + ": result is negative");
+                + ": result is negative");
         }
         if (i > MAX_UNSIGNED_SHORT) {
             throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
-                                               + ": result exceeds maximum value " + MAX_UNSIGNED_SHORT);
+                + ": result exceeds maximum value " + MAX_UNSIGNED_SHORT);
         }
         return i;
     }
@@ -915,7 +910,7 @@
         String prefix = context.getPrefix(value.getNamespaceURI());
         if (prefix == null) {
             throw new IllegalArgumentException("The namespace URI " + value.getNamespaceURI()
-                                               + " is not bound.");
+                + " is not bound.");
         } else if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
             return value.getLocalPart();
         } else {



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org