Coverage Report - org.apache.johnzon.core.CommentsJsonStreamParserImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
CommentsJsonStreamParserImpl
75%
15/20
75%
9/12
2,75
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements. See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership. The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License. You may obtain a copy of the License at
 9  
  *
 10  
  * http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied. See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.johnzon.core;
 20  
 
 21  
 import java.io.InputStream;
 22  
 import java.io.Reader;
 23  
 import java.nio.charset.Charset;
 24  
 
 25  
 public class CommentsJsonStreamParserImpl extends JsonStreamParserImpl {
 26  
     public CommentsJsonStreamParserImpl(final InputStream inputStream,
 27  
                                         final int maxStringLength,
 28  
                                         final BufferStrategy.BufferProvider<char[]> bufferProvider,
 29  
                                         final BufferStrategy.BufferProvider<char[]> valueBuffer) {
 30  1
         super(inputStream, maxStringLength, bufferProvider, valueBuffer);
 31  1
     }
 32  
 
 33  
     public CommentsJsonStreamParserImpl(final InputStream inputStream,
 34  
                                         final Charset encoding,
 35  
                                         final int maxStringLength,
 36  
                                         final BufferStrategy.BufferProvider<char[]> bufferProvider,
 37  
                                         final BufferStrategy.BufferProvider<char[]> valueBuffer) {
 38  0
         super(inputStream, encoding, maxStringLength, bufferProvider, valueBuffer);
 39  0
     }
 40  
 
 41  
     public CommentsJsonStreamParserImpl(final Reader reader,
 42  
                                         final int maxStringLength,
 43  
                                         final BufferStrategy.BufferProvider<char[]> bufferProvider,
 44  
                                         final BufferStrategy.BufferProvider<char[]> valueBuffer) {
 45  0
         super(reader, maxStringLength, bufferProvider, valueBuffer);
 46  0
     }
 47  
 
 48  
     @Override
 49  
     protected Event defaultHandling(final char c) {
 50  7
         if (c == '/') {
 51  7
             char next = readNextChar();
 52  7
             if (next == '/') { // fail
 53  
                 do {
 54  84
                     next = readNextChar();
 55  84
                 } while (next != '\n');
 56  3
             } else if (next == '*') {
 57  3
                 next = 0;
 58  
                 char previous;
 59  
                 do {
 60  130
                     previous = next;
 61  130
                     next = readNextChar();
 62  130
                 } while (next != '/' && previous != '*');
 63  3
                 readNextNonWhitespaceChar(next);
 64  3
             } else {
 65  0
                 return super.defaultHandling(c);
 66  
             }
 67  
         }
 68  7
         return next();
 69  
     }
 70  
 }