• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Collections ???

 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok I am using the quartz api for job schedualing and I have
a JobDataMap that I put key/value pairs as (String, long)

when I do a
try{
data.getLongValueFromString( f[0].getName() ) ;
}
catch( Exception e)
{
System.out.println( "not geting long value!!!") ;
e.printStackTrace() ;
}

I get a class casting exeception saying
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
at org.quartz.JobDataMap.getLongValueFromString(JobDataMap.java:699)
at com.eztakes.quartz.jobs.JobDirectoryScanJob.execute(JobDirectoryScanJ
ob.java:112)
at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.j
ava:520)

Uh, I thought this method returns a long value assosiated to the String key.

I looked and I say that this method returns long not Long.
But maybe the api has a typeO. Anyway if I cann't get the long value in this way. Is their another way to get it. I just want to avoid creating a wrapper class Long every time I need to store/retrieve a long.
So the put method lets me put the values in the JobDataMap as long.
So I am assuming you can retrive the long as well with out using a wrapper.

I am looking at this api methods web page
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of Java are you using? In 1.5 you should be able to use the auto boxing feature which handles the wrapper/primitive cases for you, in most situations.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way, you might consider editing your thread title. Collections??? doesn't really tell us anything and this isn't really a Collections issue.
 
Replace the word "snake" with "danger noodle" in all tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic