Clover coverage report -
Coverage timestamp: Sun Nov 1 2009 23:08:24 UTC
file stats: LOC: 125   Methods: 10
NCLOC: 70   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ProcessingInstructionImpl.java 66.7% 68.8% 40% 62.5%
coverage coverage
 1    /*
 2    * Licensed to the Apache Software Foundation (ASF) under one or more
 3    * contributor license agreements. See the NOTICE file distributed with
 4    * this work for additional information regarding copyright ownership.
 5    * The ASF licenses this file to You under the Apache License, Version 2.0
 6    * (the "License"); you may not use this file except in compliance with
 7    * the License. You may obtain a copy of the License at
 8    *
 9    * http://www.apache.org/licenses/LICENSE-2.0
 10    *
 11    * Unless required by applicable law or agreed to in writing, software
 12    * distributed under the License is distributed on an "AS IS" BASIS,
 13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14    * See the License for the specific language governing permissions and
 15    * limitations under the License.
 16    *
 17    * $Id: ProcessingInstructionImpl.java 571948 2007-09-02 10:51:37Z vgritsenko $
 18    */
 19   
 20    package org.apache.xindice.xml.dom;
 21   
 22    import org.apache.commons.logging.Log;
 23    import org.apache.commons.logging.LogFactory;
 24    import org.apache.xindice.util.ByteArrayInput;
 25    import org.apache.xindice.xml.SymbolTable;
 26    import org.apache.xindice.xml.XMLCompressedInput;
 27   
 28    import org.w3c.dom.DOMException;
 29    import org.w3c.dom.Node;
 30    import org.w3c.dom.ProcessingInstruction;
 31   
 32    /**
 33    * ProcessingInstructionImpl
 34    *
 35    * @version $Revision: 571948 $, $Date: 2007-09-02 03:51:37 -0700 (Sun, 02 Sep 2007) $
 36    */
 37    public final class ProcessingInstructionImpl extends NodeImpl implements ProcessingInstruction {
 38   
 39    private static final Log log = LogFactory.getLog(ProcessingInstructionImpl.class);
 40   
 41   
 42  0 public ProcessingInstructionImpl() {
 43    }
 44   
 45  2658 public ProcessingInstructionImpl(NodeImpl parent, byte[] data, int pos, int len) {
 46  2658 super(parent, data, pos, len);
 47    }
 48   
 49  0 public ProcessingInstructionImpl(NodeImpl parent, boolean dirty) {
 50  0 super(parent, dirty);
 51    }
 52   
 53  5869 public ProcessingInstructionImpl(NodeImpl parent, String nodeName, String nodeValue) {
 54  5869 super(parent, true);
 55  5869 this.nodeName = nodeName;
 56  5869 this.nodeValue = nodeValue;
 57    }
 58   
 59  17054 protected void checkLoaded() {
 60  17054 if (loaded) {
 61  8527 return;
 62    } else {
 63  8527 loaded = true;
 64    }
 65   
 66  8527 try {
 67  8527 if (data != null) {
 68  2658 DocumentImpl doc = (DocumentImpl) getOwnerDocument();
 69  2658 SymbolTable st = doc.getSymbols();
 70   
 71  2658 ByteArrayInput bis = new ByteArrayInput(data, pos, len);
 72  2658 XMLCompressedInput xci = new XMLCompressedInput(bis, st);
 73   
 74  2658 xci.readSignature(); // Skip The Signature
 75  2658 xci.readInt(); // Skip size
 76   
 77  2658 byte[] buf = new byte[bis.available()];
 78  2658 xci.read(buf);
 79   
 80  2658 String value = new String(buf, "UTF-8");
 81  2658 int i = value.indexOf(' ');
 82  2658 nodeName = value.substring(0, i);
 83  2658 nodeValue = value.substring(i + 1);
 84    }
 85    } catch (Exception e) {
 86  0 if (log.isWarnEnabled()) {
 87  0 log.warn("ignored exception", e);
 88    }
 89    }
 90    }
 91   
 92  37319 public short getNodeType() {
 93  37319 return Node.PROCESSING_INSTRUCTION_NODE;
 94    }
 95   
 96  0 public void setNodeValue(String nodeValue) throws DOMException {
 97  0 checkLoaded();
 98  0 checkReadOnly();
 99  0 this.nodeValue = nodeValue;
 100  0 setDirty();
 101    }
 102   
 103    /**
 104    * The target of this processing instruction. XML defines this as being the
 105    * first token following the markup that begins the processing instruction.
 106    */
 107  0 public String getTarget() {
 108  0 return getNodeName();
 109    }
 110   
 111    /**
 112    * The content of this processing instruction. This is from the first non
 113    * white space character after the target to the character immediately
 114    * preceding the <code>?&gt;</code>.
 115    * @exception DOMException
 116    * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
 117    */
 118  0 public String getData() {
 119  0 return getNodeValue();
 120    }
 121   
 122  0 public void setData(String data) throws DOMException {
 123  0 setNodeValue(data);
 124    }
 125    }