java.lang.ClassCastException: java.lang.Integer

Atlassian JIRA | Matthew Jensen [Atlassian] | 9 years ago
  1. 0

    If use use the confluence XMLRPC interface with perl and try and set a {{parentId}} you get a {{ClassCastException}}: Perl script: {code} #!/opt/local/bin/perl use strict; use XMLRPC::Lite; my $username="admin"; my $password="admin"; my $baseurl="http://localhost:8080"; my $spaceKey="ds"; my $pageTitle="Confluence Overview"; my $confluence = XMLRPC::Lite->proxy("$baseurl/rpc/xmlrpc"); my $token = $confluence->call("confluence1.login", $username, $password)->result(); my $parentPage = $confluence->call("confluence1.getPage", $token, $spaceKey, $pageTitle)->result(); my $newpage = { space => $spaceKey, title => "New Child Page", content => "Content", parentId => $parentPage->{id}, }; my $createdpage = $confluence->call("confluence1.storePage", $token, $newpage)->result(); die "could not create child page" unless $createdpage; {code} The problem is because perl sees the {{parentId}} is an integer and actually passes it to confluence rpc as an integer. Confluence RPC is expecting a string and responds with this error: {noformat} java.lang.ClassCastException: java.lang.Integer at com.atlassian.confluence.rpc.xmlrpc.ConfluenceXmlRpcHandlerImpl.storePage(ConfluenceXmlRpcHandlerImpl.java:352) ... 50 more {noformat} Because the {{ConfluenceXmlRpcHandlerImpl}} expects a string in the {{storePage}} method: {code} public Hashtable storePage(String token, Hashtable pageStruct) throws RemoteException { // ... if (pageStruct.containsKey("parentId")) pageStruct.put("parentId", new Long((String) pageStruct.get("parentId"))); // ... } {code} Fix this by changing the {{storePage}} to handle both {{String}} and {{Integer}} input.

    Atlassian JIRA | 9 years ago | Matthew Jensen [Atlassian]
    java.lang.ClassCastException: java.lang.Integer
  2. 0

    If use use the confluence XMLRPC interface with perl and try and set a {{parentId}} you get a {{ClassCastException}}: Perl script: {code} #!/opt/local/bin/perl use strict; use XMLRPC::Lite; my $username="admin"; my $password="admin"; my $baseurl="http://localhost:8080"; my $spaceKey="ds"; my $pageTitle="Confluence Overview"; my $confluence = XMLRPC::Lite->proxy("$baseurl/rpc/xmlrpc"); my $token = $confluence->call("confluence1.login", $username, $password)->result(); my $parentPage = $confluence->call("confluence1.getPage", $token, $spaceKey, $pageTitle)->result(); my $newpage = { space => $spaceKey, title => "New Child Page", content => "Content", parentId => $parentPage->{id}, }; my $createdpage = $confluence->call("confluence1.storePage", $token, $newpage)->result(); die "could not create child page" unless $createdpage; {code} The problem is because perl sees the {{parentId}} is an integer and actually passes it to confluence rpc as an integer. Confluence RPC is expecting a string and responds with this error: {noformat} java.lang.ClassCastException: java.lang.Integer at com.atlassian.confluence.rpc.xmlrpc.ConfluenceXmlRpcHandlerImpl.storePage(ConfluenceXmlRpcHandlerImpl.java:352) ... 50 more {noformat} Because the {{ConfluenceXmlRpcHandlerImpl}} expects a string in the {{storePage}} method: {code} public Hashtable storePage(String token, Hashtable pageStruct) throws RemoteException { // ... if (pageStruct.containsKey("parentId")) pageStruct.put("parentId", new Long((String) pageStruct.get("parentId"))); // ... } {code} Fix this by changing the {{storePage}} to handle both {{String}} and {{Integer}} input.

    Atlassian JIRA | 9 years ago | Matthew Jensen [Atlassian]
    java.lang.ClassCastException: java.lang.Integer
  3. 0

    Inserting Long value into HSQLDB numeric column

    Google Groups | 6 years ago | Shannon
    java.lang.ClassCastException: java.lang.Integer
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GridView error "ClassCastException: java.lang.Integer"

    Stack Overflow | 4 years ago | Akyl
    java.lang.ClassCastException: java.lang.Integer
  6. 0

    Problem Running Chapter 6 Earthquake - Page 2

    wrox.com | 12 months ago
    java.lang.RuntimeException: Unable to start activity ComponentInfo{net.iamcorbin.earthquake/net.iamcorbin.earthquake.UserPreferences}: java.lang.ClassCastException: java.lang.Integer

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.Integer

      at com.atlassian.confluence.rpc.xmlrpc.ConfluenceXmlRpcHandlerImpl.storePage()
    2. com.atlassian.confluence
      ConfluenceXmlRpcHandlerImpl.storePage
      1. com.atlassian.confluence.rpc.xmlrpc.ConfluenceXmlRpcHandlerImpl.storePage(ConfluenceXmlRpcHandlerImpl.java:352)
      1 frame