Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Fieldtype discovery wrong for strings starting with zero #250

Closed
3 tasks done
elektro-wolle opened this issue Sep 22, 2020 · 2 comments
Closed
3 tasks done

Fieldtype discovery wrong for strings starting with zero #250

elektro-wolle opened this issue Sep 22, 2020 · 2 comments
Labels
type: enhancement A general enhancement
Milestone

Comments

@elektro-wolle
Copy link
Contributor

elektro-wolle commented Sep 22, 2020

Make sure that:

  • You have read the contribution guidelines.
  • You specify the logstash-gelf version and environment so it's obvious which version is affected
  • You provide a reproducible test case (either descriptive of as JUnit test) if it's a bug or the expected behavior differs from the actual behavior.

The following test-cases will fail against logstash-gelf-1.14.1

    @Test
    void testString() {
        assertThat(ValueDiscovery.discover("deadbeef")).isEqualTo(ValueDiscovery.Result.STRING);
    }

    @Test
    void testStringWithLeadingZeroAndHex() {
        assertThat(ValueDiscovery.discover("0deadbeef")).isEqualTo(ValueDiscovery.Result.STRING);
    }

    @Test
    void testStringZeroAndP() {
        assertThat(ValueDiscovery.discover("0p")).isEqualTo(ValueDiscovery.Result.STRING);
    }

    @Test
    void testStringZeroAndX() {
        assertThat(ValueDiscovery.discover("0x")).isEqualTo(ValueDiscovery.Result.STRING);
    }

    @Test
    void testStringZeroXP() {
        assertThat(ValueDiscovery.discover("0xp")).isEqualTo(ValueDiscovery.Result.STRING);
    }

@mp911de
Copy link
Owner

mp911de commented Sep 22, 2020

Value type discovery was implemented on a best-effort basis without reimplementing a full parser. Type discovery allows for hex values and scientific notation inputs but may lead to wrong discovery results. Do you want to submit a pull request to address that issue?

@elektro-wolle
Copy link
Contributor Author

I'm currently working on the PR.

elektro-wolle added a commit to elektro-wolle/logstash-gelf that referenced this issue Sep 22, 2020
mp911de pushed a commit that referenced this issue Nov 15, 2020
Co-authored-by: Wolfgang Jung <w.jung@polyas.de>

Original pull request: #251.
@mp911de mp911de added this to the 1.15.0 milestone Nov 15, 2020
@mp911de mp911de added the type: enhancement A general enhancement label Nov 15, 2020
mp911de added a commit that referenced this issue Nov 15, 2020
Original pull request: #251.
@mp911de mp911de closed this as completed Nov 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants