GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — DefaultHeaders does not correctly implement interface · Issue #7710 · netty/netty

DefaultHeaders does not correctly implement interface #7710

New issue
Copy link
New issue
Copy link
Closed
Closed
DefaultHeaders does not correctly implement interface#7710
Copy link
Assignees
normanmaurer
Labels
defect
Milestone
4.1.22.Final

Description

@jkinkead
jkinkead
opened on Feb 13, 2018
Issue body actions

Expected behavior

One-argument convert-and-get methods (get{Byte,Double,Float,Int,Long,Short}) should return null when invoked on a header that can't be converted, per the documentation (e.g. for getInt(String)).

Similarly, two-argument convert-and-get methods should return the default value provided when the header can't be converted.

Actual behavior

Conversion getter methods throw NumberFormatException.

Steps to reproduce

Set a header to a non-numeric value, then attempt to read it as a number.

Minimal yet complete reproducer code (or URL to code)

io.netty.handler.codec.http2.DefaultHttp2Headers headers = new io.netty.handler.codec.http2.DefaultHttp2Headers();

headers.set("example", "abc");                                                                  

// Throws NumberFormatException, counter to documentation.    
int value = headers.getInt("example", 123); 

Netty version

4.1

Reacted by Spenser Pothier

Activity

  1. normanmaurer
    self-assigned this
    on Feb 13, 2018
  2. normanmaurer
    added a commit that references this issue on Feb 13, 2018

    Correctly handle the case when converting of value fails and return n…

    af19e1b
  3. normanmaurer commented on Feb 13, 2018

    @normanmaurer
    normanmaurer
    on Feb 13, 2018
    Member
    More actions

    Fixed by #7715

  4. normanmaurer commented on Feb 13, 2018

    @normanmaurer
    normanmaurer
    on Feb 13, 2018
    Member
    More actions

    @jkinkead please check #7715

  5. jkinkead commented on Feb 13, 2018

    @jkinkead
    jkinkead
    on Feb 13, 2018
    Author
    More actions

    Awesome, thanks for the quick fix! It looks good barring other reviewer's comment (should catch RuntimeException).

    It might be worth adding docs to the converter interface for the exceptions.

  6. normanmaurer
    added 2 commits that reference this issue on Feb 13, 2018

    Correctly handle the case when converting of value fails and return n…

    5f4526d

    Correctly handle the case when converting of value fails and return n…

    02b7507
  7. normanmaurer commented on Feb 14, 2018

    @normanmaurer
    normanmaurer
    on Feb 14, 2018
    Member
    More actions

    Fixed by #7715

  8. normanmaurer
    closed this as completedon Feb 14, 2018
  9. normanmaurer commented on Feb 14, 2018

    @normanmaurer
    normanmaurer
    on Feb 14, 2018
    Member
    More actions

    I will also update the interface with some docs.

  10. normanmaurer
    added this to the 4.1.22.Final milestone on Feb 14, 2018
  11. normanmaurer
    added
    defect
    on Feb 14, 2018
  12. kiril-me
    added a commit that references this issue on Feb 28, 2018

    Correctly handle the case when converting of value fails and return n…

    62a6d26
  13. normanmaurer
    added 3 commits that reference this issue on Oct 22, 2026

    Return null or the default from read-only headers for invalid values (#…

    5f89d65

    Auto-port 5.0: Return null or the default from read-only headers for …

    0aa35c0

    Auto-port 4.1: Return null or the default from read-only headers for …

    cd755e0
  14. lltopk
    added a commit that references this issue on Oct 24, 2026

    Auto-port 4.1: Return null or the default from read-only headers for …

    1ad5987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @normanmaurer
    normanmaurer

Labels

defect

Type

No type

Projects

No projects

    Milestone

    • 4.1.22.Final

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.