SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-22-2009, 08:48 PM
Ikarius's Avatar
Ikarius Ikarius is offline
Sage Advanced User
 
Join Date: Aug 2008
Posts: 84
Exceptions from calling Java

Okay, I've got more exceptions than this, but I figured I'd start with this one, and see what falls out of this. I'm currently doing a bunch of work altering some STVi's, and some of what I'm doing is calling straight java from the Studio interface. It appears that this is throwing some exceptions, even though the routines appear to be doing what I expect. Here's the debug output of an exception:

Code:
Sun 2/22 17:30:30.467 EXCEPTION in getValueAsObject:sage.a.e: Error in method reflection of java_util_ArrayList_add of java.lang.NullPointerException for:java_util_ArrayList_add( Categories, "NewReleases" )
Sun 2/22 17:30:30.468 sage.a.e: Error in method reflection of java_util_ArrayList_add of java.lang.NullPointerException
Sun 2/22 17:30:30.468 	at sage.e$d.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.a.m$b.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.a.m.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.a8.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.a8.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.a8.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.b1.M(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.UIManager.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.UIManager.a(Unknown Source)
Sun 2/22 17:30:30.468 	at sage.f$23.run(Unknown Source)
Sun 2/22 17:30:30.468 Caused by: java.lang.NullPointerException
Sun 2/22 17:30:30.468 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Sun 2/22 17:30:30.468 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
Sun 2/22 17:30:30.469 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
Sun 2/22 17:30:30.469 	at java.lang.reflect.Method.invoke(Unknown Source)
Sun 2/22 17:30:30.469 	... 14 more
Sun 2/22 17:30:30.469 java.lang.reflect.InvocationTargetException
Sun 2/22 17:30:30.469 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Sun 2/22 17:30:30.469 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
Sun 2/22 17:30:30.469 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
Sun 2/22 17:30:30.469 	at java.lang.reflect.Method.invoke(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.e$d.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.a.m$b.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.a.m.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.a8.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.a8.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.a8.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.469 	at sage.b1.M(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.UIManager.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.UIManager.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.f$23.run(Unknown Source)
Sun 2/22 17:30:30.470 Caused by: java.lang.NullPointerException
Sun 2/22 17:30:30.470 	at java.util.Collections.sort(Unknown Source)
Sun 2/22 17:30:30.470 	... 18 more
Sun 2/22 17:30:30.470 java.lang.NullPointerException
Sun 2/22 17:30:30.470 	at java.util.Collections.sort(Unknown Source)
Sun 2/22 17:30:30.470 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Sun 2/22 17:30:30.470 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
Sun 2/22 17:30:30.470 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
Sun 2/22 17:30:30.470 	at java.lang.reflect.Method.invoke(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.e$d.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.a.m$b.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.a.m.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.a8.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.a8.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.a8.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.470 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.471 	at sage.e.a(Unknown Source)
Sun 2/22 17:30:30.471 	at sage.b1.M(Unknown Source)
Sun 2/22 17:30:30.471 	at sage.UIManager.a(Unknown Source)
Sun 2/22 17:30:30.471 	at sage.UIManager.a(Unknown Source)
Sun 2/22 17:30:30.471 	at sage.f$23.run(Unknown Source)
This is coming out of the following Studio code:
Code:
Categories = new_java_ArrayList( java_utils_Arrays_asList( GetAllCategories() ) )
java_util_ArrayList_add( Categories, "NewReleases" )
So, am I doing something wrong, is this a bug, or is it expected behavior of the funky auto-typecasting of the Sage API?

Ikarius
__________________

SageTV 6.6.2, SageMC+CenterSage Theme
Server: Intel Core2 Q6600, 8gb memory, 3x 1tb WD EACS drives, software RAID5 2tb capacity, 4gb Flash boot drive, Ubuntu 8.0.4 Server edition
Capture: 1x HD-PVR -> Motorola DTC6200
Clients: 1x STX-HD100 1x STX-HD200, Windows & OSX Clients
Reply With Quote
  #2  
Old 02-22-2009, 09:20 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
You should not normally get exceptions when calling Java from Studio code. Turn on Tools > Notify On Errors in Studio to get a popup dialog when an exception occurs.

According to your stack trace, you're getting a NullPointerException in java_util_ArrayList_add, probably because you're passing in a null argument. Sure enough, your Categories variable is not getting initialized properly because you called new_java_ArrayList instead of new_java_util_ArrayList. So presumably there's an "unknown method" error being logged just before the snippet of log you showed us.

If you haven't already done so, I highly recommend enabling SageTV's console window during Studio development. That way you can see the errors as they occur instead of having to dig them out of the log after the fact. If your code goes wrong and throws a bunch of exceptions, it's pretty obvious with the console window open and visible. But wait, you're developing on a Mac, right? In that case I'm afraid I have no idea how to enable the console window (in Windows it's a registry setting) or even if one exists in the Mac version.
__________________
-- Greg
Reply With Quote
  #3  
Old 02-22-2009, 11:54 PM
Ikarius's Avatar
Ikarius Ikarius is offline
Sage Advanced User
 
Join Date: Aug 2008
Posts: 84
/sigh.
Lesson learned. When copying code from one workstation to another, you're subject to typos. Also don't call the default sage sort routine on an arraylist, as you're not likely to get an arraylist back, thus later attempts to call "add" will cause exceptions.

God for the ability to use diff, patch, and vi.
__________________

SageTV 6.6.2, SageMC+CenterSage Theme
Server: Intel Core2 Q6600, 8gb memory, 3x 1tb WD EACS drives, software RAID5 2tb capacity, 4gb Flash boot drive, Ubuntu 8.0.4 Server edition
Capture: 1x HD-PVR -> Motorola DTC6200
Clients: 1x STX-HD100 1x STX-HD200, Windows & OSX Clients
Reply With Quote
  #4  
Old 02-23-2009, 02:26 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by Ikarius View Post
God for the ability to use diff, patch, and vi.
Well, there is the built-in UID File Difference and STVI generator command, which can be used to encode differences between two STVs in a form that can be imported into a third STV.

And come to that, STV files are just XML, which is just text. So using text-based diff and patch tools isn't totally out of the question.
__________________
-- Greg
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help calling Java from Studio Tiki SageTV Studio 3 12-31-2008 12:51 PM
Calling SetRecordingTimes() Slugger SageTV Studio 6 03-26-2007 07:10 PM
Calling custom java classes from studio davin SageTV Studio 9 11-09-2005 11:50 AM
Calling all images! mlbdude SageTV Beta Test Software 7 02-24-2004 06:40 AM


All times are GMT -6. The time now is 07:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.