Hi Murphy,

jYMSG has got the following structure

ymsg
 |
 --network
   some java files (both ChallengeResponseV10.java and challenger.bin
are placed at this level)
   |
   --event
     some java files

In ChallengeResponseV10.java file he is doing the following to load
challenge.bin file,

.......
.......
// -----Buffer for binary data, and resource filename
    private static byte[] data;
    private final static String BIN_FILE="challenge.bin";


        // -----------------------------------------------------------------
        // Load binary data tables as a resource from /ysmg/network/BIN_FILE
        // -----------------------------------------------------------------
        static
        {       try
                {       // -----Open stream to resource located next to this 
class
                        Class v10 = 
Class.forName("ymsg.network.ChallengeResponseV10");
                        DataInputStream dis = new 
DataInputStream(v10.getResourceAsStream
(BIN_FILE));
                        data = new byte[dis.available()];
                        // -----Extra entry at end of offset table has entire 
file size
                        if(data.length<TABLE_OFFSETS[TABLE_OFFSETS.length-1])
                                throw new Exception("Data too short?");
                        // -----Read binary data into array
                        dis.readFully(data);
                        dis.close();
                }
                catch(Exception e)
                {       System.err.println("Error loading resource file: 
"+BIN_FILE);
                        e.printStackTrace();
                }
        }

I don't understand why getResourceAsStream() failed to load the file
which is being present at the same directory level!

Then I tried removing challenge.bin in this location and moved to res/
raw folder of my Android project, even then no luck!

Please let me know if I have to change something to above code
correctly pick the file.

Thanks

On Feb 6, 1:06 pm, Mark Murphy <[email protected]> wrote:
> Maddy wrote:
> > Hi,
>
> > I have managed to give internet permission in my manifest file (thanks
> > for the point)
> > and looks like now it could find the host but I am getting the
> > following error,
>
> > -----------------
> > Error loading resource file: challenge.bin
> > java.lang.NullPointerException
> >    at java.io.FilterInputStream.available(FilterInputStream.java:63)
> >    at ymsg.network.ChallengeResponseV10.<clinit>
> > (ChallengeResponseV10.java:71)
> >    at ymsg.network.Session.receiveAuth(Session.java:1109)
> >    at ymsg.network.Session$InputThread.process(Session.java:2314)
> >    at ymsg.netwrok.Session$InputThread.run(Session.java:2285)
> > Input Exception Thrown.
> > ------------------------
>
> > But I have put the challenge.bin at the right place for picking up (it
> > is part of jYMSG library).
>
> What do you think "the right place for picking up" is? I cannot find
> anything on challenge.bin with respect to jYMSG, though I have not spent
> much time searching.
>
> Please bear in mind that there are very few places for Android
> applications to put files, and that these places are unlikely to be the
> default spots expected by existing JavaSE JARs.
>
> > Then to try I have placed the chanllenge.bin in res/raw folder of my
> > android project, even then it could not pick this resource file.
>
> If jYMSG has not been ported to Android, it would have no knowledge of
> the APIs necessary to work with res/raw/ resources.
>
> > I think I am very close to get successfully login but the above
> > problem should be solved though.
>
> > Please help me or give some clue on how to solve this problem.
>
> If jYMSG is to remain platform-independent, most likely you will need to
> pass an InputStream into jYMSG, opened on challenge.bin in a spot where
> you can store it (e.g., raw resource). That way, jYMSG does not need to
> know or care where the challenge.bin file is actually stored.
>
> If jYMSG does not support this, you may need to work with the jYMSG team
> to add this support to their library.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 2.0 Published!- Hide 
> quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/android-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to