Skip to content
Permalink
Browse files
8274945: Cleanup unnecessary calls to Throwable.initCause() in java.d…
…esktop

Reviewed-by: jdv, serb, pbansal
  • Loading branch information
turbanoff authored and Pankaj Bansal committed Oct 11, 2021
1 parent 75f5145 commit 829dea45c9ab90518f03a66aad7e681cd4fda8b3
Showing 4 changed files with 6 additions and 21 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -98,11 +98,8 @@ class MarkerSegment implements Cloneable {
try {
data = (byte []) iioNode.getUserObject();
} catch (Exception e) {
IIOInvalidTreeException newGuy =
new IIOInvalidTreeException
("Can't get User Object", node);
newGuy.initCause(e);
throw newGuy;
throw new IIOInvalidTreeException
("Can't get User Object", e, node);
}
} else {
throw new IIOInvalidTreeException
@@ -407,10 +407,7 @@ public IIOMetadataFormat getMetadataFormat(String formatName) {
Method meth = cls.getMethod("getInstance");
return (IIOMetadataFormat) meth.invoke(null);
} catch (Exception e) {
RuntimeException ex =
new IllegalStateException ("Can't obtain format");
ex.initCause(e);
throw ex;
throw new IllegalStateException("Can't obtain format", e);
}
}

@@ -25,18 +25,12 @@

package javax.imageio.spi;

import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Iterator;
import javax.imageio.ImageReader;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.metadata.IIOMetadataFormat;
import javax.imageio.metadata.IIOMetadataFormatImpl;
import javax.imageio.stream.ImageInputStream;

/**
* A superclass containing instance variables and methods common to
@@ -597,10 +591,7 @@ private IIOMetadataFormat getMetadataFormat(String formatName,
Method meth = cls.getMethod("getInstance");
return (IIOMetadataFormat) meth.invoke(null);
} catch (Exception e) {
RuntimeException ex =
new IllegalStateException ("Can't obtain format");
ex.initCause(e);
throw ex;
throw new IllegalStateException("Can't obtain format", e);
}
}

@@ -91,7 +91,7 @@ public Object getTransferData(DataFlavor df)
oos.getClassLoaderMap());
data = ois.readObject();
} catch (ClassNotFoundException cnfe) {
throw (IOException)new IOException().initCause(cnfe);
throw new IOException(cnfe);
}
}

1 comment on commit 829dea4

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 829dea4 Oct 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.