Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37527 > unrolled thread

Java 9 issues

Started byEric Douglas <e.d.programmer@gmail.com>
First post2017-10-03 08:12 -0700
Last post2017-10-03 19:23 -0400
Articles 20 on this page of 30 — 7 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-03 08:12 -0700
    Re: Java 9 issues Arne Vajhøj <arne@vajhoej.dk> - 2017-10-03 11:33 -0400
    Re: Java 9 issues Patrick Roemer <sangamon@netcologne.de> - 2017-10-03 17:43 +0200
      Re: Java 9 issues Arne Vajhøj <arne@vajhoej.dk> - 2017-10-03 12:07 -0400
        Re: Java 9 issues Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2017-10-03 11:20 -0500
        Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-03 10:19 -0700
          Re: Java 9 issues Arne Vajhøj <arne@vajhoej.dk> - 2017-10-03 14:10 -0400
            Re: Java 9 issues Patrick Roemer <sangamon@netcologne.de> - 2017-10-03 20:20 +0200
              Re: Java 9 issues Arne Vajhøj <arne@vajhoej.dk> - 2017-10-03 15:37 -0400
                Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-03 12:52 -0700
                  Re: Java 9 issues Patrick Roemer <sangamon@netcologne.de> - 2017-10-03 22:27 +0200
                    Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-03 13:38 -0700
                      Re: Java 9 issues Patrick Roemer <sangamon@netcologne.de> - 2017-10-03 22:55 +0200
                      Re: Java 9 issues Arne Vajhøj <arne@vajhoej.dk> - 2017-10-03 19:45 -0400
                        Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-04 05:18 -0700
                          Re: Java 9 issues Arne Vajhøj <arne@vajhoej.dk> - 2017-10-04 20:04 -0400
                            Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-05 06:10 -0700
                          Re: Java 9 issues Martin Gregorie <martin@address-in-sig.invalid> - 2017-10-05 11:06 +0000
                            Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-05 06:09 -0700
                              Re: Java 9 issues Martin Gregorie <martin@address-in-sig.invalid> - 2017-10-05 18:23 +0000
            Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-03 12:03 -0700
    Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-03 13:34 -0700
      Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-03 13:49 -0700
        Re: Java 9 issues Arne Vajhøj <arne@vajhoej.dk> - 2017-10-03 19:39 -0400
      Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-03 14:01 -0700
      Re: Java 9 issues Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-10-03 17:36 -0400
        Re: Java 9 issues Eric Douglas <e.d.programmer@gmail.com> - 2017-10-04 07:51 -0700
          Re: Java 9 issues Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-10-04 11:20 -0400
            Re: Java 9 issues v_borchert@despammed.com (Volker Borchert) - 2017-10-04 20:14 +0000
      Re: Java 9 issues Arne Vajhøj <arne@vajhoej.dk> - 2017-10-03 19:23 -0400

Page 1 of 2  [1] 2  Next page →


#37527 — Java 9 issues

FromEric Douglas <e.d.programmer@gmail.com>
Date2017-10-03 08:12 -0700
SubjectJava 9 issues
Message-ID<3932fb50-27ec-475c-9e74-45387ba59ac1@googlegroups.com>
So I tested my application which works perfectly in Java 8, some issues in 9.

My first issue I looked up, was trivial.  I referenced some javax.activation classes so I had to add "--add-modules java.se.ee" to my VM arguments in the Eclipse JRE setup.

Then there's the next trivial issue of all the now deprecated methods I'm referencing.
JTextComponent.viewToModel(Point)
JTextComponent.modelToView(Point)
InputEvent.CTRL_MASK
Class.newInstance()
InputEvent.getModifiers()
new Float(float)
new Integer(int)
new Double(double)
new Long(long)
new Boolean(String)
Object.finalize()
BigDecimal.ROUND_HALF_UP
BigDecimal.setScale(int,int)

Now, I found a reference in a blog (https://blog.codefx.org/java/java-9-migration-guide/) but I'm not clear if this describes something I need to do or what exactly is the issue here.  I load images from a jar using MyClass.class.getResourceAsStream() on one and MyClass.class.getClassLoader().getResourceAsStream() on another (which is in a separate jar).
I pass these streams into a new MemoryCacheImageInputStream, then I pass that into ImageIO.read().  The images both display fine, but my console log is full of these stack traces.

Caught and handled this exception :
java.lang.NumberFormatException: For input string: ""
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.base/java.lang.Integer.parseInt(Integer.java:662)
	at java.base/java.lang.Integer.parseInt(Integer.java:770)
	at com.sun.media.imageioimpl.common.ImageUtil.processOnRegistration(ImageUtil.java:1406)
	at com.sun.media.imageioimpl.plugins.wbmp.WBMPImageReaderSpi.onRegistration(WBMPImageReaderSpi.java:95)
	at java.desktop/javax.imageio.spi.SubRegistry.registerServiceProvider(ServiceRegistry.java:788)
	at java.desktop/javax.imageio.spi.ServiceRegistry.registerServiceProvider(ServiceRegistry.java:330)
	at java.desktop/javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:212)
	at java.desktop/javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:136)
	at java.desktop/javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:157)
	at java.desktop/javax.imageio.ImageIO.<clinit>(ImageIO.java:66)

[toc] | [next] | [standalone]


#37529

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-10-03 11:33 -0400
Message-ID<or0akh$dv1$1@gioia.aioe.org>
In reply to#37527
On 10/3/2017 11:12 AM, Eric Douglas wrote:
> So I tested my application which works perfectly in Java 8, some issues in 9.

> Then there's the next trivial issue of all the now deprecated methods I'm referencing.

You should plan to get those changed.

> I load images from a jar using MyClass.class.getResourceAsStream() on
> one and MyClass.class.getClassLoader().getResourceAsStream() on
> another (which is in a separate jar). I pass these streams into a new
> MemoryCacheImageInputStream, then I pass that into ImageIO.read().
> The images both display fine, but my console log is full of these
> stack traces.
> Caught and handled this exception :
> java.lang.NumberFormatException: For input string: ""
> 	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> 	at java.base/java.lang.Integer.parseInt(Integer.java:662)
> 	at java.base/java.lang.Integer.parseInt(Integer.java:770)
> 	at com.sun.media.imageioimpl.common.ImageUtil.processOnRegistration(ImageUtil.java:1406)
> 	at com.sun.media.imageioimpl.plugins.wbmp.WBMPImageReaderSpi.onRegistration(WBMPImageReaderSpi.java:95)
> 	at java.desktop/javax.imageio.spi.SubRegistry.registerServiceProvider(ServiceRegistry.java:788)
> 	at java.desktop/javax.imageio.spi.ServiceRegistry.registerServiceProvider(ServiceRegistry.java:330)
> 	at java.desktop/javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry.java:212)
> 	at java.desktop/javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:136)
> 	at java.desktop/javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:157)
> 	at java.desktop/javax.imageio.ImageIO.<clinit>(ImageIO.java:66)

Some code is calling Integer.parseInt on an empty string "" in ImageIO.

Can you read the images from a disk file?

Arne

[toc] | [prev] | [next] | [standalone]


#37530

FromPatrick Roemer <sangamon@netcologne.de>
Date2017-10-03 17:43 +0200
Message-ID<or0b6o$82v$1@newsreader4.netcologne.de>
In reply to#37527
Responding to Eric Douglas:
> java.lang.NumberFormatException: For input string: ""
> 	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> 	at java.base/java.lang.Integer.parseInt(Integer.java:662)
> 	at java.base/java.lang.Integer.parseInt(Integer.java:770)
> 	at com.sun.media.imageioimpl.common.ImageUtil.processOnRegistration(ImageUtil.java:1406)

Looks like this issue:

https://github.com/jai-imageio/jai-imageio-core/issues/24

Best regards,
Patrick

[toc] | [prev] | [next] | [standalone]


#37531

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-10-03 12:07 -0400
Message-ID<or0ckk$hmn$1@gioia.aioe.org>
In reply to#37530
On 10/3/2017 11:43 AM, Patrick Roemer wrote:
> Responding to Eric Douglas:
>> java.lang.NumberFormatException: For input string: ""
>> 	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
>> 	at java.base/java.lang.Integer.parseInt(Integer.java:662)
>> 	at java.base/java.lang.Integer.parseInt(Integer.java:770)
>> 	at com.sun.media.imageioimpl.common.ImageUtil.processOnRegistration(ImageUtil.java:1406)
> 
> Looks like this issue:
> 
> https://github.com/jai-imageio/jai-imageio-core/issues/24

Interesting.

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

says "Resolved In Build: b124".

But when looking at:

http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/25066225d892

the fix seems to have been to change:

           rs.onRegistration(registry, category);

to:

            try {
                rs.onRegistration(registry, category);
            } catch (Throwable t) {
                System.err.println("Caught and handled this exception");
                t.printStackTrace();
            }

WTF????

Arne



[toc] | [prev] | [next] | [standalone]


#37532

FromKnute Johnson <nospam@rabbitbrush.frazmtn.com>
Date2017-10-03 11:20 -0500
Message-ID<or0dbv$jfc$1@dont-email.me>
In reply to#37531
On 10/3/2017 11:07, Arne Vajhøj wrote:
>             try {
>                 rs.onRegistration(registry, category);
>             } catch (Throwable t) {
>                 System.err.println("Caught and handled this exception");
>                 t.printStackTrace();
>             }
> 
> WTF????
> 
> Arne

Arne, thanks for the help this morning on that other thing and thanks so 
much for the laugh on this.  You have made my day :-)

-- 

Knute Johnson

[toc] | [prev] | [next] | [standalone]


#37533

FromEric Douglas <e.d.programmer@gmail.com>
Date2017-10-03 10:19 -0700
Message-ID<3648a011-9931-4696-ab90-25a3009095bb@googlegroups.com>
In reply to#37531
On Tuesday, October 3, 2017 at 12:08:08 PM UTC-4, Arne Vajhøj wrote:
> On 10/3/2017 11:43 AM, Patrick Roemer wrote:
> > Responding to Eric Douglas:
> >> java.lang.NumberFormatException: For input string: ""
> >> 	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> >> 	at java.base/java.lang.Integer.parseInt(Integer.java:662)
> >> 	at java.base/java.lang.Integer.parseInt(Integer.java:770)
> >> 	at com.sun.media.imageioimpl.common.ImageUtil.processOnRegistration(ImageUtil.java:1406)
> > 
> > Looks like this issue:
> > 
> > https://github.com/jai-imageio/jai-imageio-core/issues/24
> 
> Interesting.
> 
> https://bugs.openjdk.java.net/browse/JDK-8154860
> 
> says "Resolved In Build: b124".
> 
> But when looking at:
> 
> http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/25066225d892
> 
> the fix seems to have been to change:
> 
>            rs.onRegistration(registry, category);
> 
> to:
> 
>             try {
>                 rs.onRegistration(registry, category);
>             } catch (Throwable t) {
>                 System.err.println("Caught and handled this exception");
>                 t.printStackTrace();
>             }
> 
> WTF????
> 
> Arne

Exactly.  All I saw in Patrick's link was this 'fix' that prints stack traces.  Can I get a jar that gets rid of the error and the messages?

[toc] | [prev] | [next] | [standalone]


#37534

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-10-03 14:10 -0400
Message-ID<or0jqc$un1$1@gioia.aioe.org>
In reply to#37533
On 10/3/2017 1:19 PM, Eric Douglas wrote:
> On Tuesday, October 3, 2017 at 12:08:08 PM UTC-4, Arne Vajhøj wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8154860
>>
>> says "Resolved In Build: b124".
>>
>> But when looking at:
>>
>> http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/25066225d892
>>
>> the fix seems to have been to change:
>>
>>             rs.onRegistration(registry, category);
>>
>> to:
>>
>>              try {
>>                  rs.onRegistration(registry, category);
>>              } catch (Throwable t) {
>>                  System.err.println("Caught and handled this exception");
>>                  t.printStackTrace();
>>              }
>>
>> WTF????
> 
> Exactly.  All I saw in Patrick's link was this 'fix' that prints
> stack traces.  Can I get a jar that gets rid of the error and the
> messages?

OpenJDK : edit, compiler, update jar

Oracle JDK : submit a new bug report (you could get in license problems
              by modifying rt.jar I believe)

Arne

[toc] | [prev] | [next] | [standalone]


#37535

FromPatrick Roemer <sangamon@netcologne.de>
Date2017-10-03 20:20 +0200
Message-ID<or0kck$dr2$1@newsreader4.netcologne.de>
In reply to#37534
Responding to Arne Vajhøj:
>>> http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/25066225d892
>>>
>>> the fix seems to have been to change:
>>>
>>>             rs.onRegistration(registry, category);
>>>
>>> to:
>>>
>>>              try {
>>>                  rs.onRegistration(registry, category);
>>>              } catch (Throwable t) {
>>>                  System.err.println("Caught and handled this exception");
>>>                  t.printStackTrace();
>>>              }
>>>
>>> WTF????
>> 
>> Exactly.  All I saw in Patrick's link was this 'fix' that prints
>> stack traces.  Can I get a jar that gets rid of the error and the
>> messages?
> 
> OpenJDK : edit, compiler, update jar
> 
> Oracle JDK : submit a new bug report (you could get in license problems
>               by modifying rt.jar I believe)

The actual bug is in the jai-imageio version parsing. The "fix" on the
JDK side is just a generic, rather makeshift and somewhat risky measure
of self-defence against buggy plugins.

Best regards,
Patrick

[toc] | [prev] | [next] | [standalone]


#37537

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-10-03 15:37 -0400
Message-ID<or0otg$17g9$1@gioia.aioe.org>
In reply to#37535
On 10/3/2017 2:20 PM, Patrick Roemer wrote:
> Responding to Arne Vajhøj:
>>>> http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/25066225d892
>>>>
>>>> the fix seems to have been to change:
>>>>
>>>>              rs.onRegistration(registry, category);
>>>>
>>>> to:
>>>>
>>>>               try {
>>>>                   rs.onRegistration(registry, category);
>>>>               } catch (Throwable t) {
>>>>                   System.err.println("Caught and handled this exception");
>>>>                   t.printStackTrace();
>>>>               }
>>>>
>>>> WTF????
>>>
>>> Exactly.  All I saw in Patrick's link was this 'fix' that prints
>>> stack traces.  Can I get a jar that gets rid of the error and the
>>> messages?
>>
>> OpenJDK : edit, compiler, update jar
>>
>> Oracle JDK : submit a new bug report (you could get in license problems
>>                by modifying rt.jar I believe)
> 
> The actual bug is in the jai-imageio version parsing. The "fix" on the
> JDK side is just a generic, rather makeshift and somewhat risky measure
> of self-defence against buggy plugins.

Ah.

So the offending code is not in the JDK?

In that case it must be the plugin that need to be fixed.

Arne

[toc] | [prev] | [next] | [standalone]


#37538

FromEric Douglas <e.d.programmer@gmail.com>
Date2017-10-03 12:52 -0700
Message-ID<8ec36671-ecc3-48f0-908e-3fd4884761eb@googlegroups.com>
In reply to#37537
On Tuesday, October 3, 2017 at 3:37:41 PM UTC-4, Arne Vajhøj wrote:
> On 10/3/2017 2:20 PM, Patrick Roemer wrote:
> > Responding to Arne Vajhøj:
> >>>> http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/25066225d892
> >>>>
> >>>> the fix seems to have been to change:
> >>>>
> >>>>              rs.onRegistration(registry, category);
> >>>>
> >>>> to:
> >>>>
> >>>>               try {
> >>>>                   rs.onRegistration(registry, category);
> >>>>               } catch (Throwable t) {
> >>>>                   System.err.println("Caught and handled this exception");
> >>>>                   t.printStackTrace();
> >>>>               }
> >>>>
> >>>> WTF????
> >>>
> >>> Exactly.  All I saw in Patrick's link was this 'fix' that prints
> >>> stack traces.  Can I get a jar that gets rid of the error and the
> >>> messages?
> >>
> >> OpenJDK : edit, compiler, update jar
> >>
> >> Oracle JDK : submit a new bug report (you could get in license problems
> >>                by modifying rt.jar I believe)
> > 
> > The actual bug is in the jai-imageio version parsing. The "fix" on the
> > JDK side is just a generic, rather makeshift and somewhat risky measure
> > of self-defence against buggy plugins.
> 
> Ah.
> 
> So the offending code is not in the JDK?
> 
> In that case it must be the plugin that need to be fixed.
> 
> Arne

Yeah apparently, I don't know what's going on here.  Is this one of those projects that used to be a seaparate jar to include that later got merged into the JDK?  I know I had to include a separate jar to process something, not sure if it was a specific image format, or maybe it was before it got into the JDK (Java 7?).

[toc] | [prev] | [next] | [standalone]


#37539

FromPatrick Roemer <sangamon@netcologne.de>
Date2017-10-03 22:27 +0200
Message-ID<or0rs6$jel$1@newsreader4.netcologne.de>
In reply to#37538
Responding to Eric Douglas:
> On Tuesday, October 3, 2017 at 3:37:41 PM UTC-4, Arne Vajhøj wrote:
>> On 10/3/2017 2:20 PM, Patrick Roemer wrote:
>> > Responding to Arne Vajhøj:
>> >>>> http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/25066225d892
>> >>>>
>> >>>> the fix seems to have been to change:
>> >>>>
>> >>>>              rs.onRegistration(registry, category);
>> >>>>
>> >>>> to:
>> >>>>
>> >>>>               try {
>> >>>>                   rs.onRegistration(registry, category);
>> >>>>               } catch (Throwable t) {
>> >>>>                   System.err.println("Caught and handled this exception");
>> >>>>                   t.printStackTrace();
>> >>>>               }
>> >>>>
>> >>>> WTF????
>> >>>
>> >>> Exactly.  All I saw in Patrick's link was this 'fix' that prints
>> >>> stack traces.  Can I get a jar that gets rid of the error and the
>> >>> messages?
>> >>
>> >> OpenJDK : edit, compiler, update jar
>> >>
>> >> Oracle JDK : submit a new bug report (you could get in license problems
>> >>                by modifying rt.jar I believe)
>> > 
>> > The actual bug is in the jai-imageio version parsing. The "fix" on the
>> > JDK side is just a generic, rather makeshift and somewhat risky measure
>> > of self-defence against buggy plugins.
>> 
>> Ah.
>> 
>> So the offending code is not in the JDK?
>> 
>> In that case it must be the plugin that need to be fixed.
>> 
>> Arne
> 
> Yeah apparently, I don't know what's going on here.  Is this one of those
> projects that used to be a seaparate jar to include that later got merged
> into the JDK?  I know I had to include a separate jar to process something,
> not sure if it was a specific image format, or maybe it was before it got
> into the JDK (Java 7?).

javax.imageio is part of the JDK, supports I/O for some image formats
and exposes a plugin/SPI mechanism for additional format providers.
jai-imageio is such a 3rd party provider supporting additional image
formats. javax.imageio has added core support for some of those formats
since, other formats still require 3rd party plugins like jai-imageio.

The bug is in jai-imageio and occurs during service registration, i.e.
it will be triggered even if you never use these additional formats -
just having the jar on the path suffices. The "fix" in javax.imageio
just assumes that all exceptions (and errors) occurring during this
phase are harmless and can be "handled" by logging.

Best regards,
Patrick

[toc] | [prev] | [next] | [standalone]


#37541

FromEric Douglas <e.d.programmer@gmail.com>
Date2017-10-03 13:38 -0700
Message-ID<4656bf2d-d22d-46d1-bf82-970c1075a1ba@googlegroups.com>
In reply to#37539
On Tuesday, October 3, 2017 at 4:27:58 PM UTC-4, Patrick Roemer wrote:
> javax.imageio is part of the JDK, supports I/O for some image formats
> and exposes a plugin/SPI mechanism for additional format providers.
> jai-imageio is such a 3rd party provider supporting additional image
> formats. javax.imageio has added core support for some of those formats
> since, other formats still require 3rd party plugins like jai-imageio.
> 
> The bug is in jai-imageio and occurs during service registration, i.e.
> it will be triggered even if you never use these additional formats -
> just having the jar on the path suffices. The "fix" in javax.imageio
> just assumes that all exceptions (and errors) occurring during this
> phase are harmless and can be "handled" by logging.
> 
> Best regards,
> Patrick

I tested a jpg and a png no problems without the extra jar, not sure what format we may have initially included the jar for.  So I'll need to find the list of formats supported by javax.imageio and a list that still require jai.  It's annoying if we have to include the jar as is and write logs every time we render an image, and it's slightly less annoying to download the source into a custom project to get rid of the logging.

[toc] | [prev] | [next] | [standalone]


#37544

FromPatrick Roemer <sangamon@netcologne.de>
Date2017-10-03 22:55 +0200
Message-ID<or0tgb$kl1$1@newsreader4.netcologne.de>
In reply to#37541
Responding to Eric Douglas:
> So I'll need to find the list of formats supported by javax.imageio
> and a list that still require jai.

http://docs.oracle.com/javase/9/docs/api/javax/imageio/package-summary.html#package.description

https://github.com/jai-imageio/jai-imageio-core

Best regards,
Patrick

[toc] | [prev] | [next] | [standalone]


#37550

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-10-03 19:45 -0400
Message-ID<or17ec$1vpn$1@gioia.aioe.org>
In reply to#37541
On 10/3/2017 4:38 PM, Eric Douglas wrote:
> On Tuesday, October 3, 2017 at 4:27:58 PM UTC-4, Patrick Roemer wrote:
>> javax.imageio is part of the JDK, supports I/O for some image formats
>> and exposes a plugin/SPI mechanism for additional format providers.
>> jai-imageio is such a 3rd party provider supporting additional image
>> formats. javax.imageio has added core support for some of those formats
>> since, other formats still require 3rd party plugins like jai-imageio.
>>
>> The bug is in jai-imageio and occurs during service registration, i.e.
>> it will be triggered even if you never use these additional formats -
>> just having the jar on the path suffices. The "fix" in javax.imageio
>> just assumes that all exceptions (and errors) occurring during this
>> phase are harmless and can be "handled" by logging.
> 
> I tested a jpg and a png no problems without the extra jar, not sure
> what format we may have initially included the jar for.  So I'll need
> to find the list of formats supported by javax.imageio and a list
> that still require jai.
https://docs.oracle.com/javase/9/docs/api/javax/imageio/ImageIO.html#getReaderFormatNames--

https://docs.oracle.com/javase/9/docs/api/javax/imageio/ImageIO.html#getWriterFormatNames--

may be able to help.

Arne

[toc] | [prev] | [next] | [standalone]


#37553

FromEric Douglas <e.d.programmer@gmail.com>
Date2017-10-04 05:18 -0700
Message-ID<6748a626-2e2c-4b14-a592-4a9ebecd818e@googlegroups.com>
In reply to#37550
On Tuesday, October 3, 2017 at 7:45:25 PM UTC-4, Arne Vajhøj wrote:
> > I tested a jpg and a png no problems without the extra jar, not sure
> > what format we may have initially included the jar for.  So I'll need
> > to find the list of formats supported by javax.imageio and a list
> > that still require jai.
> https://docs.oracle.com/javase/9/docs/api/javax/imageio/ImageIO.html#getReaderFormatNames--
> 
> https://docs.oracle.com/javase/9/docs/api/javax/imageio/ImageIO.html#getWriterFormatNames--
> 
> may be able to help.
> 
> Arne

Oracle docs for ImageIO claims
bmp, wbmp, gif, jpeg, png, tiff

Github docs for jai claims
bmp, wbmp, gif (write only?), pcx, pnm, raw, tiff

ImageIO.getReaderFormatNames claims
bmp, wbmp, gif, jpg, jpeg, png, tif, tiff, jbig2

ImageIO.getWriterFormatNames claims
bmp, wbmp, gif, jpg, jpeg, png, tif, tiff

So need a separate jai jar for pcx, pnm, raw.  How likely is that these days.
How do we read the other image formats?  We had one customer send us a jfif.

[toc] | [prev] | [next] | [standalone]


#37559

FromArne Vajhøj <arne@vajhoej.dk>
Date2017-10-04 20:04 -0400
Message-ID<or3sur$imj$1@gioia.aioe.org>
In reply to#37553
On 10/4/2017 8:18 AM, Eric Douglas wrote:
> Oracle docs for ImageIO claims
> bmp, wbmp, gif, jpeg, png, tiff
> 
> Github docs for jai claims
> bmp, wbmp, gif (write only?), pcx, pnm, raw, tiff
> 
> ImageIO.getReaderFormatNames claims
> bmp, wbmp, gif, jpg, jpeg, png, tif, tiff, jbig2
> 
> ImageIO.getWriterFormatNames claims
> bmp, wbmp, gif, jpg, jpeg, png, tif, tiff
> 
> So need a separate jai jar for pcx, pnm, raw.  How likely is that these days.
> How do we read the other image formats?  We had one customer send us a jfif.

PCX was a common format on DOS in the late 80's and early 90's.

PNM is a common name for PPM+PGM+PBM and I believe it was common on Unix
in the same timeframe.

I very much doubt that you use those.

RAW is used in cameras.

But unless you are in a camera specific context then I will guess
that any raw images has been converted to JPEG or TIFF before you
get them.

Arne



[toc] | [prev] | [next] | [standalone]


#37562

FromEric Douglas <e.d.programmer@gmail.com>
Date2017-10-05 06:10 -0700
Message-ID<31b09684-93a1-4bd7-9d34-8be81086a6be@googlegroups.com>
In reply to#37559
On Wednesday, October 4, 2017 at 8:04:55 PM UTC-4, Arne Vajhøj wrote:
> PCX was a common format on DOS in the late 80's and early 90's.
> 
> PNM is a common name for PPM+PGM+PBM and I believe it was common on Unix
> in the same timeframe.
> 
> I very much doubt that you use those.
> 
> RAW is used in cameras.
> 
> But unless you are in a camera specific context then I will guess
> that any raw images has been converted to JPEG or TIFF before you
> get them.
> 
> Arne

So yeah it would be nice to have support for them, but unlikely we'll need it.

[toc] | [prev] | [next] | [standalone]


#37560

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2017-10-05 11:06 +0000
Message-ID<or53o9$nli$1@dont-email.me>
In reply to#37553
On Wed, 04 Oct 2017 05:18:16 -0700, Eric Douglas wrote:

> How do we read the other image formats?  We had one customer send us a
> jfif.
>
Use the ImageMagick utilities   http://www.imagemagick.org/
or the GIMP image editor        http://www.gimp.org/ 
to convert images to one of Java the supported formats such as JPG or 
PNG. 

Image Magick and the GIMP are well-regarded tools and are available for 
both Linux and Windows. I'd use the GIMP if just one or two images must 
be converted and Image Magick if a large batch of images needs 
conversion. It is a set of command line utilities and so is well suited 
for command-line scripting. 

Alternatively, ImageMagick is available as libraries that are callable 
from a large number of languages including Java, C, C++ and Python. For 
Java you'd use the JMagick package, which has Javadocs documentation.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#37561

FromEric Douglas <e.d.programmer@gmail.com>
Date2017-10-05 06:09 -0700
Message-ID<2c21e72b-f456-450c-a4bd-06817c054ebb@googlegroups.com>
In reply to#37560
On Thursday, October 5, 2017 at 7:07:00 AM UTC-4, Martin Gregorie wrote:
> Image Magick and the GIMP are well-regarded tools and are available for 
> both Linux and Windows. I'd use the GIMP if just one or two images must 
> be converted and Image Magick if a large batch of images needs 
> conversion. It is a set of command line utilities and so is well suited 
> for command-line scripting. 
> 
> Alternatively, ImageMagick is available as libraries that are callable 
> from a large number of languages including Java, C, C++ and Python. For 
> Java you'd use the JMagick package, which has Javadocs documentation.

From what I can tell, ImageMagick/JMagick doesn't have a standalone Java API.  The Java they've written is only for Linux, and anything they have for Windows is just a convenience, can only be run on a machine that has the ImageMagick application installed.  I would like Java APIs that can go anywhere with my application jars.

As far as I know GIMP is just an application not a standalone Java API.  These are fine if we need to do a one time conversion, but for a business we'd have to trap for the extension(s), have the user contact IT, or install the application for them and teach them how to use it.  It would be best if we could just treat all image formats the same.

[toc] | [prev] | [next] | [standalone]


#37563

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2017-10-05 18:23 +0000
Message-ID<or5tag$oh1$1@dont-email.me>
In reply to#37561
On Thu, 05 Oct 2017 06:09:00 -0700, Eric Douglas wrote:

> On Thursday, October 5, 2017 at 7:07:00 AM UTC-4, Martin Gregorie wrote:
>> Image Magick and the GIMP are well-regarded tools and are available for
>> both Linux and Windows. I'd use the GIMP if just one or two images must
>> be converted and Image Magick if a large batch of images needs
>> conversion. It is a set of command line utilities and so is well suited
>> for command-line scripting.
>> 
>> Alternatively, ImageMagick is available as libraries that are callable
>> from a large number of languages including Java, C, C++ and Python. For
>> Java you'd use the JMagick package, which has Javadocs documentation.
> 
> From what I can tell, ImageMagick/JMagick doesn't have a standalone Java
> API.
> 
The latest version appears to  be here: http://www.jmagick.org/6.4.0/
(linked from the Develop page, http://www.imagemagick.org/script/
develop.php on the ImageMagick website).

You'd want the jmagick-6.4.0-src.tar.gz archive 

IIRC there are Windows archive management programs that can expand a .gz 
file and unpack a .tar archive, or do both in one operation. That archive 
file contains Java sources.

> As far as I know GIMP is just an application not a standalone Java API. 
>
Correct, which is why I suggested using it for converting one or two 
files as opposed to writing a script (BAT) file that could use the Image 
Magick 'convert' utility to deal with a whole directory-full of image 
files. 

I don't know which approach is preferable for you since you didn't say 
how many image files are involved, whether such conversions would be one-
off or a recurring activity, or if you'd prefer add the capability to a 
locally developed Java application.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.java.programmer


csiph-web