Skip to main content

getSupportedConfigurations on VideoOutputSettings returns NullPointerException

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
snmukkala
Offline
Joined: 2010-06-02

Hi,
getSupportedConfigurations() is throwing NullPointerException. The code to get the supported configuration on each port is retrieved as follows:
Host host = Host.getInstance();
Enumeration ports = host.getVideoOutputPorts();
while (ports.hasMoreElements()) {

VideoOutputPort outputPort = (VideoOutputPort) ports.nextElement();
Integer portType = new Integer(outputPort.getType());
print("vPort ## " + portType);
VideoOutputConfiguration[] supportedConfigs = ((VideoOutputSettings) outputPort).getSupportedConfigurations();
for (int i = 0; i < supportedConfigs.length - 1; i++) {
if (supportedConfigs[i] instanceof FixedVideoOutputConfiguration) {
dumpResolution(supportedConfigs[i]);
}
}

After debugging in the stack, in DeviceSettingsVideoOutputPortImp.java:
public VideoOutputConfiguration[] getSupportedConfigurations()
{
return proxy.getSupportedConfigurations();
}
Here, the proxy is null and the so the NullPointerException is thrown.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sentosatech
Offline
Joined: 2008-08-01

Hello,
I investigated this on behalf of Chris. I created and ran an Xlet with the code above, but did not hit NPE. I also stepped into the code where the proxy is created to double check that is is being properly created, and it was. I also added some simple message statements to make sure that the supportedConfigs array was being populated, and it was ... so in short, I could not reproduce.
Are you still seeing this problem? If so, I would suggest creating an Issue Tracker issue, along with log files etc that demonstrate the problem.
cheers --- Steve
----- proxy creation --------------------------------------------------------------------------------
DeviceSettingsVideoOutputPortImpl implements VideoOutputSettings
{
private volatile VideoOutputSettingsProxy proxy = null;
DeviceSettingsVideoOutputPortImpl()
{
if (DeviceSettingsHostManagerImpl.isDeviceSettingsUsed() == true)
{
...
proxy = new VideoOutputSettingsProxy(this); <---- proxy created here w/o problem on my side.
...
}
}
}
----- Xlet that I ran --------------------------------------------------------------------------------
while (ports.hasMoreElements()) {
VideoOutputPort outputPort = (VideoOutputPort) ports.nextElement();
Integer portType = new Integer(outputPort.getType());
message("vPort ## " + portType);
VideoOutputConfiguration[] supportedConfigs =
((VideoOutputSettings) outputPort).getSupportedConfigurations();
for (int i = 0; i < supportedConfigs.length - 1; i++) {
if (supportedConfigs[i] instanceof FixedVideoOutputConfiguration) {
// dumpResolution(supportedConfigs[i]);
message("got a fixed video output config");
}
}
}
----- Xlet Output --------------------------------------------------------------------------------
20101215 12:34:37.154 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:34:37.154 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:34:37.164 INFO RI.Stack.StdOut- vPort ## 7
20101215 12:35:09.403 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:35:09.413 INFO RI.Stack.StdOut- vPort ## 6
20101215 12:35:17.129 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:35:17.129 INFO RI.Stack.StdOut- vPort ## 1
20101215 12:35:18.171 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:35:18.171 INFO RI.Stack.StdOut- vPort ## 5
20101215 12:35:18.813 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:35:18.813 INFO RI.Stack.StdOut- vPort ## 3
20101215 12:35:19.943 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:35:19.943 INFO RI.Stack.StdOut- vPort ## 4
20101215 12:35:20.655 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:35:20.655 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:35:20.655 INFO RI.Stack.StdOut- vPort ## 0
20101215 12:35:21.285 INFO RI.Stack.StdOut- got a fixed video output config
20101215 12:35:21.285 INFO RI.Stack.StdOut- got a fixed video output config

csweeney
Offline
Joined: 2009-04-11

I'll try to look into this in the next few days...