Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7525619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:36:01+00:00 2026-05-30T03:36:01+00:00

I recently ran into some issues with android.os.Bundle that I hoped to fix by

  • 0

I recently ran into some issues with android.os.Bundle that I hoped to fix by simply extending the class and making it more loosely-typed. The specific problem that I ran into was errors like:

W/Bundle  ( 6782): Key access_token expected byte[] but value was a java.lang.String.  The default value <null> was returned.
W/Bundle  ( 6782): Attempt to cast generated internal exception:
W/Bundle  ( 6782): java.lang.ClassCastException: java.lang.String
W/Bundle  ( 6782):  at android.os.Bundle.getByteArray(Bundle.java:1305)

Of course, conversion from String to byte[] is trivial, so my thought was to just have the Bundle do this conversion automatically if it’s looking for a byte[] but finds a String instead. It’s silly that it doesn’t do this already (and also that it has specific getters and setters for pretty much every primitive type and a few different Object types instead of generic ones that just work in terms of Object, or at worst Number, String, and Parcelable), in my opinion.

But anyways, I quickly discovered that I can’t fix the problem by extending Bundle, because it is declared final. Is there any known/specific reason for this? There are other classes in android.os that are not final, so what makes Bundle worthy of this assignation?

Also, any ideas on how to work around this? A wrapper class is out as there is no common interface for it to implement (the code that actually causes the issue is part of a third-party library, so I can’t just update it to refer directly to a wrapper class).

I guess that leaves the only option hunting down all the places in the code that happen to be setting up String values for things that the third-party code expects to be passed as byte arrays.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:36:02+00:00Added an answer on May 30, 2026 at 3:36 am

    Basically all “primitive” types are final. There are a couple reasons for this. First the bundle is meant to be parceable and you might break some if its semantics by overwriting. Also , Bundle is meant to always act a certain way. If you overwrote it you could change the behavior people are expecting or even throw an exception breaking code that was considered safe before. It could also probably be argued that it would be a security vulnerability to allow it since they could overwrite it with code that could track what happened to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently ran into some issues this week on a web app that I
I've recently ran into some code that checks Page.IsCallBack but I wasn't sure how
G'day, I was using Test::Class perl module for some testing recently and ran into
Recently I've ran into some security issues where a cracker has found an exploit
I recently ran into a problem that I thought boost::lambda or boost::phoenix could help
I recently ran into a problem with a COM object that was using a
A problem I recently ran into was that when trying to update a field
I ran into an issue with some third party software that we use to
I recently wanted to update my gem bundle but ran into installation problems with
I recently was working with some dynamic Search Expressions and ran into a bit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.