Skip to content

Commit

Permalink
WINDUPRULE-944 obsolete OracleJDK package (#942)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipCattanach committed May 4, 2023
1 parent 9806de1 commit b31a217
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
21 changes: 21 additions & 0 deletions rules/rules-reviewed/openjdk7/oraclejdk7/oracle2openjdk.rhamt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,26 @@
</hint>
</perform>
</rule>
<rule id="oracle2openjdk-00006">
<when>
<javaclass references="com.sun.image.codec.jpeg.{*}">
<location>CONSTRUCTOR_CALL</location>
<location>IMPORT</location>
<location>INHERITANCE</location>
<location>METHOD_CALL</location>
<location>VARIABLE_DECLARATION</location>
</javaclass>
</when>
<perform>
<hint title="Oracle JDK JPEG image encoder/decoder usage" effort="3" category-id="mandatory">
<message>
Replace the use of classes and methods from the `com.sun.image.codec.jpeg` package with `javax.imageio.ImageIO`
</message>
<link href="https://access.redhat.com/solutions/443673" title="java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/ImageFormatException when using OpenJDK" />
<link href="https://docs.oracle.com/javase/tutorial/2d/images/saveimage.html" title="Java Image I/O tutorial" />
<link href="https://docs.oracle.com/javase/8/docs/technotes/guides/imageio/spec/imageio_guideTOC.fm.html" title="Java Image I/O API Guide" />
</hint>
</perform>
</rule>
</rules>
</ruleset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.acme;

import com.sun.image.codec.jpeg.*;

public class ImageEncoderTest {

public static void main(String[] args) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

JPEGImageEncoder imageEncoder = JPEGCodec.createJPEGEncoder(outputStream);
imageEncoder.encode(bufferedImage);


}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@
<fail message="[oracle2openjdk] elliptic curve hint not found" />
</perform>
</rule>
<rule id="oracle2openjdk-00006-test">
<when>
<not>
<iterable-filter size="1">
<hint-exists message="Replace the use of classes and methods from the `com.sun.image.codec.jpeg`"/>
</iterable-filter>
</not>
</when>
<perform>
<fail message="oracle2openjdk-00006-test failed" />
</perform>
</rule>
</rules>
</ruleset>
</ruletest>

0 comments on commit b31a217

Please sign in to comment.