Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » OSGi: Registering AbstractURLStreamHandlerService
OSGi: Registering AbstractURLStreamHandlerService [message #272276] Tue, 21 September 2004 16:09 Go to next message
Eclipse UserFriend
I'm having some trouble with a class that derives from
AbstractURLStreamHandlerService and am trying to understand what else might
need to be registered.

1) So far, I perform the following in my plugin and run a JUnit PDE test:

public void start(BundleContext context) throws Exception {
super.start(context);
Hashtable properties = new Hashtable(1);
properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[] {"epfs"});
context.registerService(
URLStreamHandlerService.class.getName(),
new OSGiFileServerURLStreamHandler(),
properties
);
}

This appears to work fine until the point where I need to parse the
InputStream associated with the URL response:

ListAllAction get = new ListAllAction(connection);
get.exec(null);
InputStream stream = get.getContents();

// Just a test to ensure that the plugin and class is being loaded
FileServerFile dummy = new FileServerFile( );

ExceptionListener listener = new ExceptionListener() {
public void exceptionThrown(Exception e) {
e.printStackTrace(); // Extract printed below
}
}
// Throws an exception (see below)
// The target class cannot be found which is my FileServerFile class
XMLDecoder decoder = new XMLDecoder(stream, null, listener);
Object o = decoder.readObject();
try {
stream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
connection.close();
...

2) Now if I run the same code but within a simple JUnit test without
invoking the platform while also registering my URLStreamHandler as follows:

URL.setURLStreamHandlerFactory( MyOwnURLStreamHandlerFactory);
...

Everything works fine and I'm able to parse the response from the URL
request.

Hope this is enough info to start with.

thx

Paul


I get the following exception from the XMLDecoder constructor call above:

java.lang.NullPointerException
at java.beans.Statement.invoke(Statement.java:454)

at java.beans.Expression.getValue(Expression.java:101)

at java.beans.ObjectHandler.getValue(XMLDecoder.java:241)

at java.beans.ObjectHandler.endElement(XMLDecoder.java:453)

at
org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAda pter.java:353)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1536)

at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)

at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)

at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)

at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)

at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java :500)

at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)

at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl. java:442)

at org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter. java:223)

at javax.xml.parsers.SAXParser.parse(SAXParser.java:314)

at javax.xml.parsers.SAXParser.parse(SAXParser.java:89)

at java.beans.XMLDecoder.<init>(XMLDecoder.java:88)
Re: Registering AbstractURLStreamHandlerService [message #272563 is a reply to message #272276] Thu, 23 September 2004 10:51 Go to previous messageGo to next message
Eclipse UserFriend
Anyone get this message yet??


"Paul Wuethrich" <paul.wuethrich@eye-ris.com> wrote in message
news:ciq1gu$1ub$1@eclipse.org...
> I'm having some trouble with a class that derives from
> AbstractURLStreamHandlerService and am trying to understand what else
might
> need to be registered.
>
> 1) So far, I perform the following in my plugin and run a JUnit PDE test:
>
> public void start(BundleContext context) throws Exception {
> super.start(context);
> Hashtable properties = new Hashtable(1);
> properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[]
{"epfs"});
> context.registerService(
> URLStreamHandlerService.class.getName(),
> new OSGiFileServerURLStreamHandler(),
> properties
> );
> }
>
> This appears to work fine until the point where I need to parse the
> InputStream associated with the URL response:
>
> ListAllAction get = new ListAllAction(connection);
> get.exec(null);
> InputStream stream = get.getContents();
>
> // Just a test to ensure that the plugin and class is being loaded
> FileServerFile dummy = new FileServerFile( );
>
> ExceptionListener listener = new ExceptionListener() {
> public void exceptionThrown(Exception e) {
> e.printStackTrace(); // Extract printed below
> }
> }
> // Throws an exception (see below)
> // The target class cannot be found which is my FileServerFile class
> XMLDecoder decoder = new XMLDecoder(stream, null, listener);
> Object o = decoder.readObject();
> try {
> stream.close();
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> connection.close();
> ...
>
> 2) Now if I run the same code but within a simple JUnit test without
> invoking the platform while also registering my URLStreamHandler as
follows:
>
> URL.setURLStreamHandlerFactory( MyOwnURLStreamHandlerFactory);
> ...
>
> Everything works fine and I'm able to parse the response from the URL
> request.
>
> Hope this is enough info to start with.
>
> thx
>
> Paul
>
>
> I get the following exception from the XMLDecoder constructor call above:
>
> java.lang.NullPointerException
> at java.beans.Statement.invoke(Statement.java:454)
>
> at java.beans.Expression.getValue(Expression.java:101)
>
> at java.beans.ObjectHandler.getValue(XMLDecoder.java:241)
>
> at java.beans.ObjectHandler.endElement(XMLDecoder.java:453)
>
> at
> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAda pter.java:353)
>
> at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1536)
>
> at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>
> at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
>
> at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>
> at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
>
> at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>
> at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
>
> at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>
> at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
>
> at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java :500)
>
> at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
>
> at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl. java:442)
>
> at org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter. java:223)
>
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
>
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:89)
>
> at java.beans.XMLDecoder.<init>(XMLDecoder.java:88)
>
>
Re: Registering AbstractURLStreamHandlerService [message #272598 is a reply to message #272563] Thu, 23 September 2004 20:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pascal.ibm.canada

Did you have a look at PlatformURLHandler, and other subclasses of this
being shipped in eclipse?
You might be miising the implementation of a callback?

PaScaL

Paul Wuethrich wrote:

> Anyone get this message yet??
>
>
> "Paul Wuethrich" <paul.wuethrich@eye-ris.com> wrote in message
> news:ciq1gu$1ub$1@eclipse.org...
>
>>I'm having some trouble with a class that derives from
>>AbstractURLStreamHandlerService and am trying to understand what else
>
> might
>
>>need to be registered.
>>
>>1) So far, I perform the following in my plugin and run a JUnit PDE test:
>>
>> public void start(BundleContext context) throws Exception {
>> super.start(context);
>> Hashtable properties = new Hashtable(1);
>> properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[]
>
> {"epfs"});
>
>> context.registerService(
>> URLStreamHandlerService.class.getName(),
>> new OSGiFileServerURLStreamHandler(),
>> properties
>> );
>> }
>>
>>This appears to work fine until the point where I need to parse the
>>InputStream associated with the URL response:
>>
>> ListAllAction get = new ListAllAction(connection);
>> get.exec(null);
>> InputStream stream = get.getContents();
>>
>> // Just a test to ensure that the plugin and class is being loaded
>> FileServerFile dummy = new FileServerFile( );
>>
>> ExceptionListener listener = new ExceptionListener() {
>> public void exceptionThrown(Exception e) {
>> e.printStackTrace(); // Extract printed below
>> }
>> }
>> // Throws an exception (see below)
>> // The target class cannot be found which is my FileServerFile class
>> XMLDecoder decoder = new XMLDecoder(stream, null, listener);
>> Object o = decoder.readObject();
>> try {
>> stream.close();
>> } catch (IOException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> connection.close();
>> ...
>>
>>2) Now if I run the same code but within a simple JUnit test without
>>invoking the platform while also registering my URLStreamHandler as
>
> follows:
>
>> URL.setURLStreamHandlerFactory( MyOwnURLStreamHandlerFactory);
>> ...
>>
>>Everything works fine and I'm able to parse the response from the URL
>>request.
>>
>>Hope this is enough info to start with.
>>
>>thx
>>
>>Paul
>>
>>
>>I get the following exception from the XMLDecoder constructor call above:
>>
>>java.lang.NullPointerException
>>at java.beans.Statement.invoke(Statement.java:454)
>>
>>at java.beans.Expression.getValue(Expression.java:101)
>>
>>at java.beans.ObjectHandler.getValue(XMLDecoder.java:241)
>>
>>at java.beans.ObjectHandler.endElement(XMLDecoder.java:453)
>>
>>at
>> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAda pter.java:353)
>>
>>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1536)
>>
>>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>>
>>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
>>
>>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>>
>>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
>>
>>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>>
>>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
>>
>>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
>>
>>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
>>
>>at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java :500)
>>
>>at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
>>
>>at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl. java:442)
>>
>>at org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter. java:223)
>>
>>at javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
>>
>>at javax.xml.parsers.SAXParser.parse(SAXParser.java:89)
>>
>>at java.beans.XMLDecoder.<init>(XMLDecoder.java:88)
>>
>>
>
>
>
Re: Registering AbstractURLStreamHandlerService [message #272655 is a reply to message #272598] Fri, 24 September 2004 12:02 Go to previous messageGo to next message
Eclipse UserFriend
No, I checked the porting guide at:
http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/org.ecli pse.platform.doc.isv/porting/incompatibilities.html#URL%20st ream%20handler%20extensions

and then I only looked at org.eclipse.osgi.framework.internal.core.Framework
and org.eclipse.osgi.framework.internal.protocl.StreamHandlerFac tory. But
I'll check it out, thanks for the reply and I'll let you know what I find
out.

paul

"Pascal Rapicault" <pascal@ibm.canada> wrote in message
news:civpn0$ata$1@eclipse.org...
> Did you have a look at PlatformURLHandler, and other subclasses of this
> being shipped in eclipse?
> You might be miising the implementation of a callback?
>
> PaScaL
>
> Paul Wuethrich wrote:
>
> > Anyone get this message yet??
> >
> >
> > "Paul Wuethrich" <paul.wuethrich@eye-ris.com> wrote in message
> > news:ciq1gu$1ub$1@eclipse.org...
> >
> >>I'm having some trouble with a class that derives from
> >>AbstractURLStreamHandlerService and am trying to understand what else
> >
> > might
> >
> >>need to be registered.
> >>
> >>1) So far, I perform the following in my plugin and run a JUnit PDE
test:
> >>
> >> public void start(BundleContext context) throws Exception {
> >> super.start(context);
> >> Hashtable properties = new Hashtable(1);
> >> properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[]
> >
> > {"epfs"});
> >
> >> context.registerService(
> >> URLStreamHandlerService.class.getName(),
> >> new OSGiFileServerURLStreamHandler(),
> >> properties
> >> );
> >> }
> >>
> >>This appears to work fine until the point where I need to parse the
> >>InputStream associated with the URL response:
> >>
> >> ListAllAction get = new ListAllAction(connection);
> >> get.exec(null);
> >> InputStream stream = get.getContents();
> >>
> >> // Just a test to ensure that the plugin and class is being loaded
> >> FileServerFile dummy = new FileServerFile( );
> >>
> >> ExceptionListener listener = new ExceptionListener() {
> >> public void exceptionThrown(Exception e) {
> >> e.printStackTrace(); // Extract printed below
> >> }
> >> }
> >> // Throws an exception (see below)
> >> // The target class cannot be found which is my FileServerFile class
> >> XMLDecoder decoder = new XMLDecoder(stream, null, listener);
> >> Object o = decoder.readObject();
> >> try {
> >> stream.close();
> >> } catch (IOException e) {
> >> // TODO Auto-generated catch block
> >> e.printStackTrace();
> >> }
> >> connection.close();
> >> ...
> >>
> >>2) Now if I run the same code but within a simple JUnit test without
> >>invoking the platform while also registering my URLStreamHandler as
> >
> > follows:
> >
> >> URL.setURLStreamHandlerFactory( MyOwnURLStreamHandlerFactory);
> >> ...
> >>
> >>Everything works fine and I'm able to parse the response from the URL
> >>request.
> >>
> >>Hope this is enough info to start with.
> >>
> >>thx
> >>
> >>Paul
> >>
> >>
> >>I get the following exception from the XMLDecoder constructor call
above:
> >>
> >>java.lang.NullPointerException
> >>at java.beans.Statement.invoke(Statement.java:454)
> >>
> >>at java.beans.Expression.getValue(Expression.java:101)
> >>
> >>at java.beans.ObjectHandler.getValue(XMLDecoder.java:241)
> >>
> >>at java.beans.ObjectHandler.endElement(XMLDecoder.java:453)
> >>
> >>at
>
>> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAda pter.java:353)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1536)
> >>
> >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> >>
> >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> >>
> >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> >>
> >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> >>
> >>at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java :500)
> >>
> >>at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
> >>
> >>at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl. java:442)
> >>
> >>at org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter. java:223)
> >>
> >>at javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
> >>
> >>at javax.xml.parsers.SAXParser.parse(SAXParser.java:89)
> >>
> >>at java.beans.XMLDecoder.<init>(XMLDecoder.java:88)
> >>
> >>
> >
> >
> >
Re: Registering AbstractURLStreamHandlerService [message #272799 is a reply to message #272598] Mon, 27 September 2004 16:15 Go to previous messageGo to next message
Eclipse UserFriend
I don't see anything special being done in that class hierarchy. So based
on what I included below is it safe to assume that what I'm doing "should"
work??
thx

Paul

"Pascal Rapicault" <pascal@ibm.canada> wrote in message
news:civpn0$ata$1@eclipse.org...
> Did you have a look at PlatformURLHandler, and other subclasses of this
> being shipped in eclipse?
> You might be miising the implementation of a callback?
>
> PaScaL
>
> Paul Wuethrich wrote:
>
> > Anyone get this message yet??
> >
> >
> > "Paul Wuethrich" <paul.wuethrich@eye-ris.com> wrote in message
> > news:ciq1gu$1ub$1@eclipse.org...
> >
> >>I'm having some trouble with a class that derives from
> >>AbstractURLStreamHandlerService and am trying to understand what else
> >
> > might
> >
> >>need to be registered.
> >>
> >>1) So far, I perform the following in my plugin and run a JUnit PDE
test:
> >>
> >> public void start(BundleContext context) throws Exception {
> >> super.start(context);
> >> Hashtable properties = new Hashtable(1);
> >> properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[]
> >
> > {"epfs"});
> >
> >> context.registerService(
> >> URLStreamHandlerService.class.getName(),
> >> new OSGiFileServerURLStreamHandler(),
> >> properties
> >> );
> >> }
> >>
> >>This appears to work fine until the point where I need to parse the
> >>InputStream associated with the URL response:
> >>
> >> ListAllAction get = new ListAllAction(connection);
> >> get.exec(null);
> >> InputStream stream = get.getContents();
> >>
> >> // Just a test to ensure that the plugin and class is being loaded
> >> FileServerFile dummy = new FileServerFile( );
> >>
> >> ExceptionListener listener = new ExceptionListener() {
> >> public void exceptionThrown(Exception e) {
> >> e.printStackTrace(); // Extract printed below
> >> }
> >> }
> >> // Throws an exception (see below)
> >> // The target class cannot be found which is my FileServerFile class
> >> XMLDecoder decoder = new XMLDecoder(stream, null, listener);
> >> Object o = decoder.readObject();
> >> try {
> >> stream.close();
> >> } catch (IOException e) {
> >> // TODO Auto-generated catch block
> >> e.printStackTrace();
> >> }
> >> connection.close();
> >> ...
> >>
> >>2) Now if I run the same code but within a simple JUnit test without
> >>invoking the platform while also registering my URLStreamHandler as
> >
> > follows:
> >
> >> URL.setURLStreamHandlerFactory( MyOwnURLStreamHandlerFactory);
> >> ...
> >>
> >>Everything works fine and I'm able to parse the response from the URL
> >>request.
> >>
> >>Hope this is enough info to start with.
> >>
> >>thx
> >>
> >>Paul
> >>
> >>
> >>I get the following exception from the XMLDecoder constructor call
above:
> >>
> >>java.lang.NullPointerException
> >>at java.beans.Statement.invoke(Statement.java:454)
> >>
> >>at java.beans.Expression.getValue(Expression.java:101)
> >>
> >>at java.beans.ObjectHandler.getValue(XMLDecoder.java:241)
> >>
> >>at java.beans.ObjectHandler.endElement(XMLDecoder.java:453)
> >>
> >>at
>
>> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAda pter.java:353)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1536)
> >>
> >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> >>
> >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> >>
> >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> >>
> >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> >>
> >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> >>
> >>at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java :500)
> >>
> >>at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
> >>
> >>at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl. java:442)
> >>
> >>at org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter. java:223)
> >>
> >>at javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
> >>
> >>at javax.xml.parsers.SAXParser.parse(SAXParser.java:89)
> >>
> >>at java.beans.XMLDecoder.<init>(XMLDecoder.java:88)
> >>
> >>
> >
> >
> >
Re: Registering AbstractURLStreamHandlerService [message #272982 is a reply to message #272799] Wed, 29 September 2004 12:47 Go to previous message
Eclipse UserFriend
Pascal,
It looks like there's a problem with ourURL client library so the code below
is definitely ok.

thanks again.

Paul

"Paul Wuethrich" <paul.wuethrich@eye-ris.com> wrote in message
news:cj9s4q$4r2$1@eclipse.org...
> I don't see anything special being done in that class hierarchy. So based
> on what I included below is it safe to assume that what I'm doing "should"
> work??
> thx
>
> Paul
>
> "Pascal Rapicault" <pascal@ibm.canada> wrote in message
> news:civpn0$ata$1@eclipse.org...
> > Did you have a look at PlatformURLHandler, and other subclasses of this
> > being shipped in eclipse?
> > You might be miising the implementation of a callback?
> >
> > PaScaL
> >
> > Paul Wuethrich wrote:
> >
> > > Anyone get this message yet??
> > >
> > >
> > > "Paul Wuethrich" <paul.wuethrich@eye-ris.com> wrote in message
> > > news:ciq1gu$1ub$1@eclipse.org...
> > >
> > >>I'm having some trouble with a class that derives from
> > >>AbstractURLStreamHandlerService and am trying to understand what else
> > >
> > > might
> > >
> > >>need to be registered.
> > >>
> > >>1) So far, I perform the following in my plugin and run a JUnit PDE
> test:
> > >>
> > >> public void start(BundleContext context) throws Exception {
> > >> super.start(context);
> > >> Hashtable properties = new Hashtable(1);
> > >> properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[]
> > >
> > > {"epfs"});
> > >
> > >> context.registerService(
> > >> URLStreamHandlerService.class.getName(),
> > >> new OSGiFileServerURLStreamHandler(),
> > >> properties
> > >> );
> > >> }
> > >>
> > >>This appears to work fine until the point where I need to parse the
> > >>InputStream associated with the URL response:
> > >>
> > >> ListAllAction get = new ListAllAction(connection);
> > >> get.exec(null);
> > >> InputStream stream = get.getContents();
> > >>
> > >> // Just a test to ensure that the plugin and class is being loaded
> > >> FileServerFile dummy = new FileServerFile( );
> > >>
> > >> ExceptionListener listener = new ExceptionListener() {
> > >> public void exceptionThrown(Exception e) {
> > >> e.printStackTrace(); // Extract printed below
> > >> }
> > >> }
> > >> // Throws an exception (see below)
> > >> // The target class cannot be found which is my FileServerFile class
> > >> XMLDecoder decoder = new XMLDecoder(stream, null, listener);
> > >> Object o = decoder.readObject();
> > >> try {
> > >> stream.close();
> > >> } catch (IOException e) {
> > >> // TODO Auto-generated catch block
> > >> e.printStackTrace();
> > >> }
> > >> connection.close();
> > >> ...
> > >>
> > >>2) Now if I run the same code but within a simple JUnit test without
> > >>invoking the platform while also registering my URLStreamHandler as
> > >
> > > follows:
> > >
> > >> URL.setURLStreamHandlerFactory( MyOwnURLStreamHandlerFactory);
> > >> ...
> > >>
> > >>Everything works fine and I'm able to parse the response from the URL
> > >>request.
> > >>
> > >>Hope this is enough info to start with.
> > >>
> > >>thx
> > >>
> > >>Paul
> > >>
> > >>
> > >>I get the following exception from the XMLDecoder constructor call
> above:
> > >>
> > >>java.lang.NullPointerException
> > >>at java.beans.Statement.invoke(Statement.java:454)
> > >>
> > >>at java.beans.Expression.getValue(Expression.java:101)
> > >>
> > >>at java.beans.ObjectHandler.getValue(XMLDecoder.java:241)
> > >>
> > >>at java.beans.ObjectHandler.endElement(XMLDecoder.java:453)
> > >>
> > >>at
> >
>
>> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAda pter.java:353)
> > >>
> > >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1536)
> > >>
> > >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> > >>
> > >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> > >>
> > >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> > >>
> > >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> > >>
> > >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> > >>
> > >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> > >>
> > >>at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)
> > >>
> > >>at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java: 1507)
> > >>
> > >>at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java :500)
> > >>
> > >>at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
> > >>
> > >>at
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl. java:442)
> > >>
> > >>at
org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter. java:223)
> > >>
> > >>at javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
> > >>
> > >>at javax.xml.parsers.SAXParser.parse(SAXParser.java:89)
> > >>
> > >>at java.beans.XMLDecoder.<init>(XMLDecoder.java:88)
> > >>
> > >>
> > >
> > >
> > >
>
>
Previous Topic:How to find path of source file and how to search in 1 file
Next Topic:[ECLIPSE.ORG] - JBOSS joins Eclipse / missing information
Goto Forum:
  


Current Time: Mon May 05 06:33:08 EDT 2025

Powered by FUDForum. Page generated in 0.03536 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top