RFR: 8169713: jimage fails with StringIndexOutOfBoundsException when path to the inspected image is an empty string

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8169713: jimage fails with StringIndexOutOfBoundsException when path to the inspected image is an empty string

Claes Redestad
Hi,

please review this fix to make the jimage tool work correctly
for empty string:

diff -r b2661d26e556
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
---
a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
Wed Feb 22 14:12:01 2017 -0800
+++
b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
Thu Feb 23 18:27:48 2017 +0100
@@ -524,7 +524,7 @@
              List<String> rest = collectUnhandled? new ArrayList<>() :
null;
              // process options
              for (int i = 0; i < args.length; i++) {
-                if (args[i].charAt(0) == '-') {
+                if (args[i].startsWith("-")) {
                      String name = args[i];
                      PluginOption pluginOption = null;
                      Option<T> option = getOption(name);

/Claes
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8169713: jimage fails with StringIndexOutOfBoundsException when path to the inspected image is an empty string

Jim Laskey (Oracle)
+1

> On Feb 23, 2017, at 1:34 PM, Claes Redestad <[hidden email]> wrote:
>
> Hi,
>
> please review this fix to make the jimage tool work correctly
> for empty string:
>
> diff -r b2661d26e556 src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
> --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Wed Feb 22 14:12:01 2017 -0800
> +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Thu Feb 23 18:27:48 2017 +0100
> @@ -524,7 +524,7 @@
>             List<String> rest = collectUnhandled? new ArrayList<>() : null;
>             // process options
>             for (int i = 0; i < args.length; i++) {
> -                if (args[i].charAt(0) == '-') {
> +                if (args[i].startsWith("-")) {
>                     String name = args[i];
>                     PluginOption pluginOption = null;
>                     Option<T> option = getOption(name);
>
> /Claes

Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8169713: jimage fails with StringIndexOutOfBoundsException when path to the inspected image is an empty string

Claes Redestad
Thanks - pushed!

/Claes

On 2017-02-23 18:38, Jim Laskey (Oracle) wrote:

> +1
>
>> On Feb 23, 2017, at 1:34 PM, Claes Redestad <[hidden email]> wrote:
>>
>> Hi,
>>
>> please review this fix to make the jimage tool work correctly
>> for empty string:
>>
>> diff -r b2661d26e556 src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
>> --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Wed Feb 22 14:12:01 2017 -0800
>> +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Thu Feb 23 18:27:48 2017 +0100
>> @@ -524,7 +524,7 @@
>>             List<String> rest = collectUnhandled? new ArrayList<>() : null;
>>             // process options
>>             for (int i = 0; i < args.length; i++) {
>> -                if (args[i].charAt(0) == '-') {
>> +                if (args[i].startsWith("-")) {
>>                     String name = args[i];
>>                     PluginOption pluginOption = null;
>>                     Option<T> option = getOption(name);
>>
>> /Claes
>