Solved UUID

Discussion in 'Plugin Development' started by Funergy, Nov 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Funergy

    Hello.
    I'm storing a String with and thats a UUID but I want to convert it to a UUID from java.
    I use UUID.fromString(<myUUID>);
    but it gives
    UnexpectedNumberException or something like that
    Why does this happen.
    oh yeah and there are '-''s in the UUID

    regards Funergy
     
  2. Offline

    mine-care

    Hmm i never had this problem before thankfully but what is the message of the exception?
     
  3. Offline

    BetaNyan

    Try replacing the dashes with ""
     
  4. Offline

    Skionz

    EDIT: Read the question wrong sorry.
     
  5. Offline

    Funergy

    Skionz I already have that. thats the the line thats causing the error
     
  6. Offline

    Skionz

    Funergy Can we see the Exception?
     
  7. Offline

    Funergy

    BetaNyan Ill try in a sec

    Skionz You guys were to late with answering I tried something else. I'll try to get it back how it was

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 29, 2016
  8. Offline

    teej107

    Funergy How do you convert the UUID to a String? Are you sure it is throwing an UnexpectedNumberException? Are you sure that line of code is the problem?
     
  9. Offline

    Shaggy67

    Make sure you're using UUID.toString when you store it. You probably are, but worth checking.

    The "-" in the string should be fine, but all of the other characters should be hex values, 0 - F. It sounds like there's something in your string which isn't one of those. Maybe post the string itself, so that we can see it?
     
  10. Offline

    Funergy

    Shaggy67 teej107 Skionz BetaNyan mine-care I'm trying to get the error back. but when I'm trying this I'm getting also this
    java.io.IOException: Server returned HTTP response code: 429 for URL: https://sessionserver.mojang.com/session/minecraft/profile/"ed25e78b9c634f67b278519f99d0d24b"
    The code 429 is "Too many requests"

    Shaggy67 teej107 Skionz BetaNyan mine-care Here is the error
    Code:
    26.11 18:04:46 [Server] INFO at com.thehype.thc.Command.Friend.execute(Friend.java:56)
    26.11 18:04:46 [Server] INFO at com.thehype.thc.MongoDB.DataSelector.parseToListUUID(DataSelector.java:268)
    26.11 18:04:46 [Server] INFO at java.util.UUID.fromString(Unknown Source)
    26.11 18:04:46 [Server] INFO at java.lang.Long.decode(Unknown Source)
    26.11 18:04:46 [Server] INFO at java.lang.Long.valueOf(Unknown Source)
    26.11 18:04:46 [Server] INFO at java.lang.Long.parseLong(Unknown Source)
    26.11 18:04:46 [Server] INFO at java.lang.NumberFormatException.forInputString(Unknown Source)
    26.11 18:04:46 [Server] INFO java.lang.NumberFormatException: For input string: ""ed25e78b"
    BetaNyan I did that and it gave Invalid UUID exception
     
  11. Offline

    teej107

    Funergy Show your code where you save the UUID to a String.
     
  12. Offline

    Funergy

    teej107 <player>.getUniqueId().toString()
    or something like that
     
  13. Offline

    teej107

    Funergy Ok. Now I'm confused. Post the exact code where the exception is happening?
    I never had a NumberFormatException with using UUID#fromString().
     
  14. Offline

    Skionz

    I believe the NumberFormatException is thrown when the fromString() method tries to parse it to a long.
     
  15. Offline

    Funergy

    teej107 Skionz I think I found the problem. if I broadcast the UUID it says it in quotes but normally it isn't doing that. How to I replace the "" in a string. it underlines red if I do it
     
  16. Offline

    Skionz

    Funergy Post your entire class
     
  17. Offline

    Funergy

    Skionz No the problem is in where I get the UUID.
    if I would analyse the String it would be ""Hello"" It has an extra quote.
    How would I remove the extra quotes?
     
  18. Offline

    JordyPwner

    just remove it?
     
  19. Offline

    Funergy

  20. Offline

    JordyPwner

    Please mark the thread as solved
     
Thread Status:
Not open for further replies.

Share This Page