Skip to content
Permalink
Browse files
8283799: Collapse identical catch branches in jdk.hotspot.agent
Reviewed-by: lmesnik, amenkov
  • Loading branch information
Andrey Turbanov committed Mar 31, 2022
1 parent 1ca0ede commit 3e643f459937a48b8df71666d137b90f349c7b41
Showing 8 changed files with 15 additions and 47 deletions.
@@ -477,12 +477,8 @@ private void setupDebuggerAlternate(String alternateName) {
throw new DebuggerException("Cannot find alternate SA Debugger: '" + alternateName + "'");
} catch (NoSuchMethodException nsme) {
throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' has missing constructor.");
} catch (InstantiationException ie) {
throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", ie);
} catch (IllegalAccessException iae) {
throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", iae);
} catch (InvocationTargetException iae) {
throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", iae);
} catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", e);
}

System.err.println("Loaded alternate HotSpot SA Debugger: " + alternateName);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2022, 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
@@ -76,8 +76,6 @@ public COFFFile parse(String filename) throws COFFException {
// a bug if there is one. (FIXME)
// buf.order(ByteOrder.nativeOrder());
return parse(new MappedByteBufferDataSource(buf));
} catch (FileNotFoundException e) {
throw new COFFException(e);
} catch (IOException e) {
throw new COFFException(e);
}
@@ -31,12 +31,10 @@
import java.io.IOException;
import java.io.PrintStream;
import java.math.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.ui.*;
import sun.jvm.hotspot.utilities.PointerFinder;
import sun.jvm.hotspot.utilities.PointerLocation;

@@ -219,8 +217,7 @@ public boolean importData(JComponent c, Transferable t) {
String str = (String)t.getTransferData(DataFlavor.stringFlavor);
handleImport(c, str);
return true;
} catch (UnsupportedFlavorException ufe) {
} catch (IOException ioe) {
} catch (UnsupportedFlavorException | IOException e) {
}
}

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2022, 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
@@ -132,11 +132,7 @@ public SimpleTreeNode getChild(int index) {
try {
Oop oop = VM.getVM().getObjectHeap().newOop(handle);
return new OopTreeNodeAdapter(oop, cf, getTreeTableMode());
} catch (AddressException e) {
return new BadAddressTreeNodeAdapter(handle,
new CTypeFieldIdentifier(type, f),
getTreeTableMode());
} catch (UnknownOopException e) {
} catch (AddressException | UnknownOopException e) {
return new BadAddressTreeNodeAdapter(handle,
new CTypeFieldIdentifier(type, f),
getTreeTableMode());
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, 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
@@ -153,9 +153,7 @@ public void doMetadata(MetadataField field, boolean isVMField) {
if (curField == index) {
try {
child = new MetadataTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
} catch (AddressException e) {
child = new BadAddressTreeNodeAdapter(getObj().getAddress().getAddressAt(field.getOffset()), field, getTreeTableMode());
} catch (UnknownOopException e) {
} catch (AddressException | UnknownOopException e) {
child = new BadAddressTreeNodeAdapter(getObj().getAddress().getAddressAt(field.getOffset()), field, getTreeTableMode());
}
}
@@ -166,9 +164,7 @@ public void doOop(OopField field, boolean isVMField) {
if (curField == index) {
try {
child = new OopTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
} catch (AddressException e) {
child = new BadAddressTreeNodeAdapter(field.getValueAsOopHandle(getObj()), field, getTreeTableMode());
} catch (UnknownOopException e) {
} catch (AddressException | UnknownOopException e) {
child = new BadAddressTreeNodeAdapter(field.getValueAsOopHandle(getObj()), field, getTreeTableMode());
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2022, 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
@@ -160,9 +160,7 @@ public void doMetadata(MetadataField field, boolean isVMField) {
if (curField == index) {
try {
child = new MetadataTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
} catch (AddressException e) {
child = new BadAddressTreeNodeAdapter(getObj().getHandle().getAddressAt(field.getOffset()), field, getTreeTableMode());
} catch (UnknownOopException e) {
} catch (AddressException | UnknownOopException e) {
child = new BadAddressTreeNodeAdapter(getObj().getHandle().getAddressAt(field.getOffset()), field, getTreeTableMode());
}
}
@@ -173,9 +171,7 @@ public void doOop(OopField field, boolean isVMField) {
if (curField == index) {
try {
child = new OopTreeNodeAdapter(field.getValue(getObj()), field.getID(), getTreeTableMode());
} catch (AddressException e) {
child = new BadAddressTreeNodeAdapter(field.getValueAsOopHandle(getObj()), field, getTreeTableMode());
} catch (UnknownOopException e) {
} catch (AddressException | UnknownOopException e) {
child = new BadAddressTreeNodeAdapter(field.getValueAsOopHandle(getObj()), field, getTreeTableMode());
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2022, 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
@@ -32,7 +32,6 @@
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.utilities.*;

/** For a set of known roots, descends recursively into the object
graph, for each object recording those objects (and their fields)
@@ -259,9 +258,6 @@ public void doOop(OopField field, boolean isVMField) {
}
} catch (EmptyStackException e) {
// Done
} catch (NullPointerException e) {
System.err.println("ReversePtrs: WARNING: " + e +
" during traversal");
} catch (Exception e) {
System.err.println("ReversePtrs: WARNING: " + e +
" during traversal");
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2022, 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
@@ -24,15 +24,10 @@

package sun.jvm.hotspot.utilities;

import java.util.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.Metadata;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.types.*;
import sun.jvm.hotspot.utilities.Observable;
import sun.jvm.hotspot.utilities.Observer;

/** This class determines to the best of its ability, and in a
reasonably robust fashion, whether a given pointer is an intact
@@ -77,9 +72,7 @@ public static boolean oopLooksValid(OopHandle oop) {
Metadata.instantiateWrapperFor(klassField.getValue(oop));
}
return true;
} catch (AddressException e) {
return false;
} catch (WrongTypeException e) {
} catch (AddressException | WrongTypeException e) {
return false;
}
}

1 comment on commit 3e643f4

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 3e643f4 Mar 31, 2022

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.