Attempt to read a field tag, returning zero if we have reached EOF.
Protocol message parsers use this to read tags, since a protocol message
may legally end wherever a tag occurs, and zero is not a valid tag
number.
347451
public int readTag() throws IOException
    {
        if (offset == limit)
        {
            lastTag = 0;
            return 0;
        }

        final int tag = readRawVarint32();
        if (tag >>> WireFormat.TAG_TYPE_BITS == 0)
        {
            // If we actually read zero, that's not a valid tag.
            throw ProtobufException.invalidTag();
        }
        lastTag = tag;
        return tag;
    }
169755
def parse_packets(stream):
    
    reader = util.Reader(stream)
    while True:
        try:
            value = reader.readfmt('B')
        except EOFError:
            return

        log.debug('prefix byte: %s', bin(value))
        assert util.bit(value, 7) == 1

        tag = util.low_bits(value, 6)
        if util.bit(value, 6) == 0:
            length_type = util.low_bits(tag, 2)
            tag = tag >> 2
            fmt = {0: '>B', 1: '>H', 2: '>L'}[length_type]
            packet_size = reader.readfmt(fmt)
        else:
            first = reader.readfmt('B')
            if first < 192:
                packet_size = first
            elif first < 224:
                packet_size = ((first - 192) << 8) + reader.readfmt('B') + 192
            elif first == 255:
                packet_size = reader.readfmt('>L')
            else:
                log.error('Partial Body Lengths unsupported')

        log.debug('packet length: %d', packet_size)
        packet_data = reader.read(packet_size)
        packet_type = PACKET_TYPES.get(tag)

        p = {'type': 'unknown', 'tag': tag, 'raw': packet_data}
        if packet_type is not None:
            try:
                p = packet_type(util.Reader(io.BytesIO(packet_data)))
                p['tag'] = tag
            except ValueError:
                log.exception('Skipping packet: %s', util.hexlify(packet_data))

        log.debug('packet "%s": %s', p['type'], p)
        yield p
566557
Number readNumber() throws IOException {
		StringBuilder intPart = null; // ###.xxxExxx
		StringBuilder fraPart = null; // xxx.###Exxx
		StringBuilder expPart = null; // xxx.xxxE###
		boolean hasFraPart = false;
		boolean hasExpPart = false;
		char ch = reader.peek();
		boolean minusSign = ch == '-';
		boolean expMinusSign = false;
		if (minusSign) {
			reader.next();
		}
		int status = READ_NUMBER_INT_PART;
		for (;;) {
			if (reader.hasMore()) {
				ch = reader.peek();
			} else {
				status = READ_NUMBER_END;
			}
			switch (status) {
			case READ_NUMBER_INT_PART:
				if (ch >= '0' && ch <= '9') {
					if (intPart == null) {
						intPart = new StringBuilder(10);
					}
					intPart.append(reader.next());
				} else if (ch == '.') {
					if (intPart == null) {
						throw new JsonParseException("Unexpected char: " + ch,
								reader.readed);
					}
					reader.next();
					hasFraPart = true;
					status = READ_NUMBER_FRA_PART;
				} else if (ch == 'e' || ch == 'E') {
					reader.next();
					hasExpPart = true;
					// try to determin exp part's sign:
					char signChar = reader.peek();
					if (signChar == '-' || signChar == '+') {
						expMinusSign = signChar == '-';
						reader.next();
					}
					status = READ_NUMBER_EXP_PART;
				} else {
					if (intPart == null) {
						throw new JsonParseException("Unexpected char: "
								+ reader.next(), reader.readed);
					}
					// end of number:
					status = READ_NUMBER_END;
				}
				continue;
			case READ_NUMBER_FRA_PART:
				if (ch >= '0' && ch <= '9') {
					if (fraPart == null) {
						fraPart = new StringBuilder(10);
					}
					fraPart.append(reader.next());
				} else if (ch == 'e' || ch == 'E') {
					reader.next();
					hasExpPart = true;
					// try to determin exp part's sign:
					char signChar = reader.peek();
					if (signChar == '-' || signChar == '+') {
						expMinusSign = signChar == '-';
						reader.next();
					}
					status = READ_NUMBER_EXP_PART;
				} else {
					if (fraPart == null) {
						throw new JsonParseException("Unexpected char: "
								+ reader.next(), reader.readed);
					}
					// end of number:
					status = READ_NUMBER_END;
				}
				continue;
			case READ_NUMBER_EXP_PART:
				if (ch >= '0' && ch <= '9') {
					if (expPart == null) {
						expPart = new StringBuilder(10);
					}
					expPart.append(reader.next());
				} else {
					if (expPart == null) {
						throw new JsonParseException("Unexpected char: "
								+ reader.next(), reader.readed);
					}
					// end of number:
					status = READ_NUMBER_END;
				}
				continue;
			case READ_NUMBER_END:
				// build parsed number:
				int readed = reader.readed;
				if (intPart==null) {
				    throw new JsonParseException("Missing integer part of number.", readed);
				}
				long lInt = minusSign ? -string2Long(intPart, readed)
						: string2Long(intPart, readed);
				if (!hasFraPart && !hasExpPart) {
					return new Long(lInt);
				}
				if (hasFraPart && fraPart == null) {
				    throw new JsonParseException("Missing fraction part of number.", readed);
				}
				double dFraPart = hasFraPart ? (minusSign ? -string2Fraction(fraPart, readed)
						: string2Fraction(fraPart, readed))
						: 0.0;
				double number = hasExpPart ? (lInt + dFraPart)
						* Math.pow(10, expMinusSign ? -string2Long(expPart, readed) : string2Long(expPart, readed))
						: (lInt + dFraPart);
				if (number > MAX_SAFE_DOUBLE) {
					throw new NumberFormatException(
							"Exceeded maximum value: 1.7976931348623157e+308");
				}
				return new Double(number);
			}
			continue;
		}
	}
674432
def read_tag
      tag = @stream.decode_tag
      if tag
        # When we shift from group 0002 to another group we need to update our endian/explicitness variables:
        if tag.group != META_GROUP and @switched == false
          switch_syntax_on_read
          # We may need to read our tag again if endian has switched (in which case it has been misread):
          if @switched_endian
            @stream.skip(-4)
            tag = @stream.decode_tag
          end
        end
      end
      return tag
    end
909997
public int readTag() throws IOException
    {
        if (!buffer.hasRemaining())
        {
            lastTag = 0;
            return 0;
        }

        final int tag = readRawVarint32();
        if (tag >>> TAG_TYPE_BITS == 0)
        {
            // If we actually read zero, that's not a valid tag.
            throw ProtobufException.invalidTag();
        }
        lastTag = tag;
        return tag;
    }
694381
private static <MessageType extends MessageLite>
      boolean parseUnknownField(
          FieldSet<ExtensionDescriptor> extensions,
          MessageType defaultInstance,
          CodedInputStream input,
          ExtensionRegistryLite extensionRegistry,
          int tag) throws IOException {
    int wireType = WireFormat.getTagWireType(tag);
    int fieldNumber = WireFormat.getTagFieldNumber(tag);

    GeneratedExtension<MessageType, ?> extension =
      extensionRegistry.findLiteExtensionByNumber(
          defaultInstance, fieldNumber);

    boolean unknown = false;
    boolean packed = false;
    if (extension == null) {
      unknown = true;  // Unknown field.
    } else if (wireType == FieldSet.getWireFormatForFieldType(
                 extension.descriptor.getLiteType(),
                 false  /* isPacked */)) {
      packed = false;  // Normal, unpacked value.
    } else if (extension.descriptor.isRepeated &&
               extension.descriptor.type.isPackable() &&
               wireType == FieldSet.getWireFormatForFieldType(
                 extension.descriptor.getLiteType(),
                 true  /* isPacked */)) {
      packed = true;  // Packed value.
    } else {
      unknown = true;  // Wrong wire type.
    }

    if (unknown) {  // Unknown field or wrong wire type.  Skip.
      return input.skipField(tag);
    }

    if (packed) {
      int length = input.readRawVarint32();
      int limit = input.pushLimit(length);
      if (extension.descriptor.getLiteType() == WireFormat.FieldType.ENUM) {
        while (input.getBytesUntilLimit() > 0) {
          int rawValue = input.readEnum();
          Object value =
              extension.descriptor.getEnumType().findValueByNumber(rawValue);
          if (value == null) {
            // If the number isn't recognized as a valid value for this
            // enum, drop it (don't even add it to unknownFields).
            return true;
          }
          extensions.addRepeatedField(extension.descriptor, value);
        }
      } else {
        while (input.getBytesUntilLimit() > 0) {
          Object value =
            FieldSet.readPrimitiveField(input,
                                        extension.descriptor.getLiteType());
          extensions.addRepeatedField(extension.descriptor, value);
        }
      }
      input.popLimit(limit);
    } else {
      Object value;
      switch (extension.descriptor.getLiteJavaType()) {
        case MESSAGE: {
          MessageLite.Builder subBuilder = null;
          if (!extension.descriptor.isRepeated()) {
            MessageLite existingValue =
                (MessageLite) extensions.getField(extension.descriptor);
            if (existingValue != null) {
              subBuilder = existingValue.toBuilder();
            }
          }
          if (subBuilder == null) {
            subBuilder = extension.messageDefaultInstance.newBuilderForType();
          }
          if (extension.descriptor.getLiteType() ==
              WireFormat.FieldType.GROUP) {
            input.readGroup(extension.getNumber(),
                            subBuilder, extensionRegistry);
          } else {
            input.readMessage(subBuilder, extensionRegistry);
          }
          value = subBuilder.build();
          break;
        }
        case ENUM:
          int rawValue = input.readEnum();
          value = extension.descriptor.getEnumType()
                           .findValueByNumber(rawValue);
          // If the number isn't recognized as a valid value for this enum,
          // drop it.
          if (value == null) {
            return true;
          }
          break;
        default:
          value = FieldSet.readPrimitiveField(input,
              extension.descriptor.getLiteType());
          break;
      }

      if (extension.descriptor.isRepeated()) {
        extensions.addRepeatedField(extension.descriptor, value);
      } else {
        extensions.setField(extension.descriptor, value);
      }
    }

    return true;
  }
645960
private void parseSeeString() {
        int len = text.length();
        if (len == 0) {
            return;
        }
        switch (text.charAt(0)) {
            case '<':
                if (text.charAt(len-1) != '>') {
                    docenv().warning(holder,
                                     "tag.see.no_close_bracket_on_url",
                                     name, text);
                }
                return;
            case '"':
                if (len == 1 || text.charAt(len-1) != '"') {
                    docenv().warning(holder,
                                     "tag.see.no_close_quote",
                                     name, text);
                } else {
//                    text = text.substring(1,len-1); // strip quotes
                }
                return;
        }

        // check that the text is one word, with possible parentheses
        // this part of code doesn't allow
        // @see <a href=.....>asfd</a>
        // comment it.

        // the code assumes that there is no initial white space.
        int parens = 0;
        int commentstart = 0;
        int start = 0;
        int cp;
        for (int i = start; i < len ; i += Character.charCount(cp)) {
            cp = text.codePointAt(i);
            switch (cp) {
                case '(': parens++; break;
                case ')': parens--; break;
                case '[': case ']': case '.': case '#': break;
                case ',':
                    if (parens <= 0) {
                        docenv().warning(holder,
                                         "tag.see.malformed_see_tag",
                                         name, text);
                        return;
                    }
                    break;
                case ' ': case '\t': case '\n': case CR:
                    if (parens == 0) { //here onwards the comment starts.
                        commentstart = i;
                        i = len;
                    }
                    break;
                default:
                    if (!Character.isJavaIdentifierPart(cp)) {
                        docenv().warning(holder,
                                         "tag.see.illegal_character",
                                         name, ""+cp, text);
                    }
                    break;
            }
        }
        if (parens != 0) {
            docenv().warning(holder,
                             "tag.see.malformed_see_tag",
                             name, text);
            return;
        }

        String seetext = "";
        String labeltext = "";

        if (commentstart > 0) {
            seetext = text.substring(start, commentstart);
            labeltext = text.substring(commentstart + 1);
            // strip off the white space which can be between seetext and the
            // actual label.
            for (int i = 0; i < labeltext.length(); i++) {
                char ch2 = labeltext.charAt(i);
                if (!(ch2 == ' ' || ch2 == '\t' || ch2 == '\n')) {
                    label = labeltext.substring(i);
                    break;
                }
            }
        } else {
            seetext = text;
            label = "";
        }

        int sharp = seetext.indexOf('#');
        if (sharp >= 0) {
            // class#member
            where = seetext.substring(0, sharp);
            what = seetext.substring(sharp + 1);
        } else {
            if (seetext.indexOf('(') >= 0) {
                docenv().warning(holder,
                                 "tag.see.missing_sharp",
                                 name, text);
                where = "";
                what = seetext;
            }
            else {
                // no member specified, text names class
                where = seetext;
                what = null;
            }
        }
    }
935700
def eof():
    ''''''
    @Parser
    def eof_parser(text, index=0):
        if index >= len(text):
            return Value.success(index, None)
        else:
            return Value.failure(index, 'EOF')
    return eof_parser
919611
protected String getReadElfTag(String tag) {
        String tagValue = null;
        try {
            String result[] = ExecUtil.execute("/usr/bin/readelf -A /proc/self/exe");
            if(result != null){
                for(String line : result) {
                    line = line.trim();
                    if (line.startsWith(tag) && line.contains(":")) {
                        String lineParts[] = line.split(":", 2);
                        if(lineParts.length > 1)
                            tagValue = lineParts[1].trim();
                        break;
                    }
                }
            }
        }
        catch (IOException|InterruptedException ioe) { ioe.printStackTrace(); }
        return tagValue;
    }
168496
private void readDescription(TagValue tv) throws NumberFormatException, IOException {
    int index = 128;
    int tagCount = tv.getBytesBigEndian(index, 4);
    index += 4;
    for (int i = 0; i < tagCount; i++) {
      int signature = tv.getBytesBigEndian(index, 4);
      int tagOffset = tv.getBytesBigEndian(index + 4, 4);
      if (Integer.toHexString(signature).equals("64657363")) {
        String typedesc = Integer.toHexString(tv.getBytesBigEndian(tagOffset, 4));
        if (typedesc.equals("64657363")) {
          int size = tv.getBytesBigEndian(tagOffset + 8, 4) - 1;
          String s = "";
          int j = 0;
          int begin = tagOffset + 12;
          while (begin + j < begin + size) {
            int unicode_char = tv.getBytesBigEndian(begin + j, 1);
            s += Character.toString((char) unicode_char);
            j++;
          }
          description = s;
        } else {
          description = "";
        }
      }
      index += 12;
    }
  }
554378
@Override
    protected void parse() throws ProtocolException {
        cursor = offset;
        optimalEncodingMessageSize = 4;

        // version
        version = readUint32();
        // peek at marker
        byte marker = payload[cursor];
        boolean useSegwit = marker == 0;
        // marker, flag
        if (useSegwit) {
            readBytes(2);
            optimalEncodingMessageSize += 2;
        }
        // txin_count, txins
        parseInputs();
        // txout_count, txouts
        parseOutputs();
        // script_witnesses
        if (useSegwit)
            parseWitnesses();
        // lock_time
        lockTime = readUint32();
        optimalEncodingMessageSize += 4;

        length = cursor - offset;
    }
211538
long readTag(long bucketIndex, int posInBucket) {
		long tagStartIdx = getTagOffset(bucketIndex, posInBucket);
		long tag = 0;
		long tagEndIdx = tagStartIdx + bitsPerTag;
		// looping over true bits per nextBitSet javadocs
		for (long i = memBlock.nextSetBit(tagStartIdx); i >= 0 && i < tagEndIdx; i = memBlock.nextSetBit(i + 1L)) {
			// set corresponding bit in tag
			tag |= 1 << (i - tagStartIdx);
		}
		return tag;
	}
996209
private void writeTagValue(TagValue tag) throws IOException {
    int id = tag.getId();

    // Write tag value
    for (abstractTiffType tt : tag.getValue()) {
      if (id == 700) {
        // XMP
        XMP xmp = (XMP)tt;
        try {
          xmp.write(data);
        }catch (Exception ex) {
          XmlType xml = (XmlType)tt;
          try {
            xml.writeXml(data);
          } catch (Exception exx) {
            exx.printStackTrace();
            throw new IOException();
          }
        }
      } else if (id == 33723) {
        // IPTC
        abstractTiffType att = tag.getValue().get(0);
        if (att instanceof IPTC) {
          IPTC iptc = (IPTC) att;
          iptc.write(data);
          //for (int i = 0; i < iptc.getOriginal().size(); i++) data.put(iptc.getOriginal().get(i).toByte());
          //data.put((byte) 0);
        } else {
          for (int i = 0; i < tag.getValue().size(); i++) {
            data.put(tag.getValue().get(i).toByte());
          }
          data.put((byte) 0);
        }
      } else if (id == 330) {
        // SubIFD
        IFD subifd = ((IFD) tag.getValue().get(0));
        writeIFD(subifd);
      } else if (id == 34665) {
        // EXIF
        IFD exif = (IFD) tag.getValue().get(0);
        writeIFD(exif);
      } else if (id == 34675) {
        // ICC
        for (int off = tag.getReadOffset(); off < tag.getReadOffset() + tag.getReadlength(); off++) {
          data.put(input.readByte(off).toByte());
        }
        data.put((byte) 0);
      } else {
        switch (tag.getType()) {
          case 3:
            data.putShort((short) tt.toInt());
            break;
          case 8:
            data.putSShort((SShort) tt);
            break;
          case 4:
            data.putLong((Long) tt);
            break;
          case 9:
            data.putSLong((SLong) tt);
            break;
          case 11:
            data.putFloat((Float) tt);
            break;
          case 13:
            data.putInt(tt.toInt());
            break;
          case 5:
            data.putRational((Rational) tt);
            break;
          case 10:
            data.putSRational((SRational) tt);
            break;
          case 12:
            data.putDouble((Double) tt);
            break;
          case 2:
            data.put(tt.toByte());
            break;
          default:
            data.put(tt.toByte());
            break;
        }
      }
    }
  }
131226
def read_tags(fh, byteorder, offsetsize, tagnames, customtags=None,
              maxifds=None):
    
    if offsetsize == 4:
        offsetformat = byteorder+'I'
        tagnosize = 2
        tagnoformat = byteorder+'H'
        tagsize = 12
        tagformat1 = byteorder+'HH'
        tagformat2 = byteorder+'I4s'
    elif offsetsize == 8:
        offsetformat = byteorder+'Q'
        tagnosize = 8
        tagnoformat = byteorder+'Q'
        tagsize = 20
        tagformat1 = byteorder+'HH'
        tagformat2 = byteorder+'Q8s'
    else:
        raise ValueError('invalid offset size')

    if customtags is None:
        customtags = {}
    if maxifds is None:
        maxifds = 2**32

    result = []
    unpack = struct.unpack
    offset = fh.tell()
    while len(result) < maxifds:
        # loop over IFDs
        try:
            tagno = unpack(tagnoformat, fh.read(tagnosize))[0]
            if tagno > 4096:
                raise TiffFileError('suspicious number of tags')
        except Exception:
            log.warning('read_tags: corrupted tag list at offset %i', offset)
            break

        tags = {}
        data = fh.read(tagsize * tagno)
        pos = fh.tell()
        index = 0
        for _ in range(tagno):
            code, type_ = unpack(tagformat1, data[index:index+4])
            count, value = unpack(tagformat2, data[index+4:index+tagsize])
            index += tagsize
            name = tagnames.get(code, str(code))
            try:
                dtype = TIFF.DATA_FORMATS[type_]
            except KeyError:
                raise TiffFileError('unknown tag data type %i' % type_)

            fmt = '%s%i%s' % (byteorder, count * int(dtype[0]), dtype[1])
            size = struct.calcsize(fmt)
            if size > offsetsize or code in customtags:
                offset = unpack(offsetformat, value)[0]
                if offset < 8 or offset > fh.size - size:
                    raise TiffFileError('invalid tag value offset %i' % offset)
                fh.seek(offset)
                if code in customtags:
                    readfunc = customtags[code][1]
                    value = readfunc(fh, byteorder, dtype, count, offsetsize)
                elif type_ == 7 or (count > 1 and dtype[-1] == 'B'):
                    value = read_bytes(fh, byteorder, dtype, count, offsetsize)
                elif code in tagnames or dtype[-1] == 's':
                    value = unpack(fmt, fh.read(size))
                else:
                    value = read_numpy(fh, byteorder, dtype, count, offsetsize)
            elif dtype[-1] == 'B' or type_ == 7:
                value = value[:size]
            else:
                value = unpack(fmt, value[:size])

            if code not in customtags and code not in TIFF.TAG_TUPLE:
                if len(value) == 1:
                    value = value[0]
            if type_ != 7 and dtype[-1] == 's' and isinstance(value, bytes):
                # TIFF ASCII fields can contain multiple strings,
                #   each terminated with a NUL
                try:
                    value = bytes2str(stripascii(value).strip())
                except UnicodeDecodeError:
                    log.warning(
                        'read_tags: coercing invalid ASCII to bytes (tag %i)',
                        code)

            tags[name] = value

        result.append(tags)
        # read offset to next page
        fh.seek(pos)
        offset = unpack(offsetformat, fh.read(offsetsize))[0]
        if offset == 0:
            break
        if offset >= fh.size:
            log.warning('read_tags: invalid page offset (%i)', offset)
            break
        fh.seek(offset)

    if result and maxifds == 1:
        result = result[0]
    return result
722567
public boolean readBoolean()
        throws IOException
    {
        int tag = read();

        switch (tag) {
            case 'T':
                return true;
            case 'F':
                return false;
            case 'I':
                return parseInt() == 0;
            case 'L':
                return parseLong() == 0;
            case 'D':
                return parseDouble() == 0.0;
            case 'N':
                return false;

            default:
                throw expect("boolean", tag);
        }
    }
294761
public int readBytes(byte[] buffer, int offset, int length)
        throws IOException
    {
        int readLength = 0;

        if (_chunkLength == END_OF_DATA) {
            _chunkLength = 0;
            return -1;
        }
        else if (_chunkLength == 0) {
            int tag = read();

            switch (tag) {
                case 'N':
                    return -1;

                case 'B':
                case 'b':
                    _isLastChunk = tag == 'B';
                    _chunkLength = (read() << 8) + read();
                    break;

                default:
                    throw new IOException("expected 'B' at " + (char) tag);
            }
        }

        while (length > 0) {
            if (_chunkLength > 0) {
                buffer[offset++] = (byte) read();
                _chunkLength--;
                length--;
                readLength++;
            }
            else if (_isLastChunk) {
                if (readLength == 0)
                    return -1;
                else {
                    _chunkLength = END_OF_DATA;
                    return readLength;
                }
            }
            else {
                int tag = read();

                switch (tag) {
                    case 'B':
                    case 'b':
                        _isLastChunk = tag == 'B';
                        _chunkLength = (read() << 8) + read();
                        break;

                    default:
                        throw new IOException("expected 'B' at " + (char) tag);
                }
            }
        }

        if (readLength == 0)
            return -1;
        else if (_chunkLength > 0 || !_isLastChunk)
            return readLength;
        else {
            _chunkLength = END_OF_DATA;
            return readLength;
        }
    }
460559
private Object readKey(
          FieldDescriptor field,
          JsonParser parser,
          DeserializationContext context
  ) throws IOException {
    if (parser.getCurrentToken() != JsonToken.FIELD_NAME) {
      throw reportWrongToken(JsonToken.FIELD_NAME, context, "Expected FIELD_NAME token");
    }

    String fieldName = parser.getCurrentName();
    switch (field.getJavaType()) {
      case INT:
        // lifted from StdDeserializer since there's no method to call
        try {
          return NumberInput.parseInt(fieldName.trim());
        } catch (IllegalArgumentException iae) {
          Number number = (Number) context.handleWeirdStringValue(
                  _valueClass,
                  fieldName.trim(),
                  "not a valid int value"
          );
          return number == null ? 0 : number.intValue();
        }
      case LONG:
        // lifted from StdDeserializer since there's no method to call
        try {
          return NumberInput.parseLong(fieldName.trim());
        } catch (IllegalArgumentException iae) {
          Number number = (Number) context.handleWeirdStringValue(
                  _valueClass,
                  fieldName.trim(),
                  "not a valid long value"
          );
          return number == null ? 0L : number.longValue();
        }
      case BOOLEAN:
        // lifted from StdDeserializer since there's no method to call
        String text = fieldName.trim();
        if ("true".equals(text) || "True".equals(text)) {
          return true;
        }
        if ("false".equals(text) || "False".equals(text)) {
          return false;
        }
        Boolean b = (Boolean) context.handleWeirdStringValue(
                _valueClass,
                text,
                "only \"true\" or \"false\" recognized"
        );
        return Boolean.TRUE.equals(b);
      case STRING:
        return fieldName;
      case ENUM:
        EnumValueDescriptor enumValueDescriptor = field.getEnumType().findValueByName(parser.getText());

        if (enumValueDescriptor == null && !ignorableEnum(parser.getText().trim(), context)) {
          throw context.weirdStringException(parser.getText(), field.getEnumType().getClass(),
                  "value not one of declared Enum instance names");
        }

        return enumValueDescriptor;
      default:
        throw new IllegalArgumentException("Unexpected map key type: " + field.getJavaType());
    }
  }