Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting sometimes NPE when starting a jnlp

2749078Mar 4 2015 — edited Mar 12 2015

Unfortunately I can not reproduce the issue 100%

We have a signed rcp-webapp and we are using a jnlp template according to javas security restrictions.

But sometimes I get a NullPointerException when starting the jnlp

java.lang.NullPointerException

at com.sun.javaws.JnlpxArgs.execProgram(Unknown Source)

at com.sun.javaws.Launcher.relaunch(Unknown Source)

at com.sun.javaws.Launcher.prepareResources(Unknown Source)

at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)

at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)

at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)

at com.sun.javaws.Launcher.launch(Unknown Source)

at com.sun.javaws.Main.launchApp(Unknown Source)

at com.sun.javaws.Main.continueInSecureThread(Unknown Source)

at com.sun.javaws.Main.access$000(Unknown Source)

at com.sun.javaws.Main$1.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

The error says something like cannot start main-class xyz

where xyz is a random substring from the jnlp content (tags, attributes, values etc.).

Everytime I start the jnlp the "main-class" is xyz

Renaming the already downloaded jnlp results in a starting application or a new NPE with another wrong main class.

In some cases clearing the javaws cache helps so I think this is a cache issue...


Problem occurs in latest java 7 and 8.


Does anybody know the problem?

Or does anybody know how to avoid the NPE?


This is an already closed bug with my problem (closed because not reproducable)

https://bugs.openjdk.java.net/browse/JDK-8074174

Changig the security level does not help this seems to an issue how the main class is determined from a cached application.


Here is a same/similar bug

Bug ID: JDK-8064358 JnlpxArgs NullPointerException

According to this entry the bug is fixed in java 8 and 9 but not in 7.

Unfortunately I did not found a checkin to see what was changed.

Comments

John Stegeman

Do you have the ability to change the table? Varchar2 is not an appropriate datatype for a duration (which is what I assume you mean by "hours")

Frank Kulash

Hi,

You can't add VARCHAR2s.  You can add NUMBERs, so convert the VARCHAR2s to NUMBERs, add those numbers, and then, if necessary, convert back to VARCHAR2s.

If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could show you exactly.

As John said, it might make more sense for you to permanently store these times as NUMBERs, or as INTERVAL DAY TO SECONDs.

odie_63
Answer

As others have said, use NUMBER to store durations, or the proper INTERVAL datatype, though the latter cannot be aggregated (using SUM).

In the meantime, this will give you the required output in minutes (it's trivial to convert it back to HH:MM format if you like) :

SQL> with sample_data (id, hours1, hours2, hours3) as (

  2    select 1, '02:45', '00:18', '01:25' from dual union all

  3    select 2, '00:38', '01:45', '00:00' from dual union all

  4    select 3, '02:15', '02:00', '00:15' from dual

  5  )

  6  select id

  7       , sum(h1) h1

  8       , sum(h2) h2

  9       , sum(h3) h3

10       , sum(h1+h2+h3) as total

11  from (

12  select id

13       , to_number(substr(hours1, 1, 2))*60 + to_number(substr(hours1, 4, 2)) as h1

14       , to_number(substr(hours2, 1, 2))*60 + to_number(substr(hours2, 4, 2)) as h2

15       , to_number(substr(hours3, 1, 2))*60 + to_number(substr(hours3, 4, 2)) as h3

16  from sample_data

17  )

18  group by rollup(id) ;

        ID         H1         H2         H3      TOTAL

---------- ---------- ---------- ---------- ----------

         1        165         18         85        268

         2         38        105          0        143

         3        135        120         15        270

                  338        243        100        681

Marked as Answer by Kam__apex · Sep 27 2020
00125

Hi,

            I think this may help u.

SELECT to_char ( to_date (to_number(substr(hours1, 1, instr(hours1, ':', 1) - 1)) * 60 +

        to_number(substr(hours1,

                         instr(hours1, ':', 1) + 1,

                         length(hours1)))

+

to_number(substr(hours2, 1, instr(hours2, ':', 1) - 1)) * 60 +

        to_number(substr(hours2,

                         instr(hours2, ':', 1) + 1,

                         length(hours2)))

+

to_number(substr(hours3, 1, instr(hours3, ':', 1) - 1)) * 60 +

        to_number(substr(hours3,

                         instr(hours3, ':', 1) + 1,

                         length(hours3))) total, 'HH24MI'), 'HH:MI')

  FROM dual;

Thanks

RogerT

as the others said....change your data model, it would be much easier, than doing something like this:

with data (hours1, hours2, hours3) as (select '02:45','00:18','01:25' from dual

                                       union all

                                       select '00:38','01:45','00:00' from dual

                                       union all

                                       select '02:15','02:00','00:15' from dual)

    ,minutes as (select regexp_replace(hours1,'^(\d+):\d+$','\1') * 60 + regexp_replace(hours1,'^\d+:(\d+)$','\1') as minutes1

                       ,regexp_replace(hours2,'^(\d+):\d+$','\1') * 60 + regexp_replace(hours2,'^\d+:(\d+)$','\1') as minutes2

                       ,regexp_replace(hours3,'^(\d+):\d+$','\1') * 60 + regexp_replace(hours3,'^\d+:(\d+)$','\1') as minutes3                      

                   from data)

select minutes1 + minutes2 + minutes3

      ,TO_CHAR(floor((minutes1 + minutes2 + minutes3) / 60 ),'FM99900') || ':' ||

       to_char(mod((minutes1 + minutes2 + minutes3),60 ),'FM00') as hours

  from minutes

/

hth

Kam__apex

Thanks Odie. Solved. Very specific and easy. once again thanks.

1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 9 2015
Added on Mar 4 2015
2 comments
2,740 views