Skip to content

Deserialization on attachment id as Integer out of range #1468

@jbenallen

Description

@jbenallen

Slack has generated attachments with id values that cannot be parsed into Java Integers. As a result, the Bolt SDK fails when reading those messages.

Team: T34263EUF / E7T5PNK3P
Channel: C08KGS622HL
Message TS: 1746210816.491199

  "attachments": [
    {
      ...
      "id": 8861161648288
    }
  ]

Reproducible in:

The Slack SDK version

1.45.2

Java Runtime version

17

OS info

n/a

Steps to reproduce:

Deserializing a message with an attachment that has an id that is too large for a Java Integer fails.

Expected result:

Parsing succeeds

Actual result:

An exception is thrown:

java.lang.NumberFormatException: Expected an int but was 8861161648288 at line 157 column 26 path $.attachments[0].id
com.google.gson.JsonSyntaxException: 
	at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:229)
	at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:219)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
	at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
	at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
	at com.google.gson.Gson.fromJson(Gson.java:963)
	at com.google.gson.Gson.fromJson(Gson.java:928)
	at com.google.gson.Gson.fromJson(Gson.java:877)
	at com.google.gson.Gson.fromJson(Gson.java:848)

Requirements

Please make sure if this topic is specific to this SDK. For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugM-T: confirmed bug report. Issues are confirmed when the reproduction steps are documentedjavaThis is a label that @dependabot automatically creates. We don't use it.server-side-issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions