Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,9 @@ private void readClassDump(long segmentStartPos) throws IOException
statics[si++] = new Field("<signers>", Type.OBJECT, signersId == 0 ? null : new ObjectReference(null, signersId)); //$NON-NLS-1$
statics[si++] = new Field("<protectionDomain>", Type.OBJECT, protectionDomainId == 0 ? null : new ObjectReference(null, protectionDomainId)); //$NON-NLS-1$
if (reserved1Id != 0)
statics[si++] = new Field("<reserved1>", Type.OBJECT, reserved1Id == 0 ? null : new ObjectReference(null, reserved1Id)); //$NON-NLS-1$
statics[si++] = new Field("<reserved1>", Type.OBJECT, new ObjectReference(null, reserved1Id)); //$NON-NLS-1$
if (reserved2Id != 0)
statics[si++] = new Field("<reserved2>", Type.OBJECT, reserved2Id == 0 ? null : new ObjectReference(null, reserved2Id)); //$NON-NLS-1$
statics[si++] = new Field("<reserved2>", Type.OBJECT, new ObjectReference(null, reserved2Id)); //$NON-NLS-1$
Field all[] = new Field[statics.length + constantPool.length];
System.arraycopy(statics, 0, all, 0, statics.length);
System.arraycopy(constantPool, 0, all, statics.length, constantPool.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public long markMultiThreadedInner(int threads) throws InterruptedException

ForkJoinPool pool = new ForkJoinPool(threads);
try {
ObjectMarkerRootCC root = new ObjectMarkerRootCC(null, claimedRoots, bitField, LEVELS_RUN_INLINE, count);
ObjectMarkerRootCC root = new ObjectMarkerRootCC(claimedRoots, bitField, LEVELS_RUN_INLINE, count);
// blocks until all work is done
pool.invoke(root);
}
Expand All @@ -141,8 +141,8 @@ final class ObjectMarkerRootCC extends CountedCompleter<Void> {
final int levelsInline;
final LongAdder count;

ObjectMarkerRootCC(CountedCompleter<?> parent, int[] roots, ConcurrentBitField visited, int levelsInline, LongAdder count) {
super(parent);
ObjectMarkerRootCC(int[] roots, ConcurrentBitField visited, int levelsInline, LongAdder count) {
super();
this.roots = roots;
this.visited = visited;
this.levelsInline = levelsInline;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ private static final Spec read(InputStream input, Bundle bundle, Object source)
parserFactory.setNamespaceAware(true);
// Add schema validation
URL url = ReportPlugin.getDefault().getBundle().getResource("schema/report.xsd"); //$NON-NLS-1$
if (url == null) {
throw new IOException("Schema resource not found in bundle: schema/report.xsd"); //$NON-NLS-1$
}
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(url);
parserFactory.setSchema(schema);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,9 @@ public static void main(String[] args) throws Exception
System.out.println("Acquire Heap Dump NOW (then press any key to terminate program)");
int c = System.in.read();
// Control-break causes read to return early, so try again for another
// key to wait
// for the dump to complete
// key to wait for the dump to complete
if (c == -1)
c = System.in.read();
System.in.read();

cd.print();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void fillAdders()

doubleAdderValues = new DoubleAdder[2];
doubleAdderValues[0] = new DoubleAdder();
doubleAdderValues[0].add(3.14159);
doubleAdderValues[0].add(Math.PI);
doubleAdderValues[1] = new DoubleAdder();
}

Expand Down Expand Up @@ -551,15 +551,15 @@ void checkDoubleAdderResolver(ISnapshot snapshot) throws SnapshotException
IResult result = query.execute(new VoidProgressListener());
assertNotNull(result);
IResultTable table = (IResultTable) result;
boolean found3_14159 = false;
boolean found_pi = false;
for (int i = 0; i < table.getRowCount(); ++i)
{
Object row = table.getRow(i);
String val = (String) table.getColumnValue(row, 0);
if (Double.toString(3.14159).equals(val))
found3_14159 = true;
if (Double.toString(Math.PI).equals(val))
found_pi = true;
}
assertTrue("DoubleAdder with sum 3.14159 should be resolved", found3_14159); //$NON-NLS-1$
assertTrue("DoubleAdder with sum 3.14159 should be resolved", found_pi); //$NON-NLS-1$
}

BigDecimal values[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.eclipse.mat.collect.ArrayInt;
import org.eclipse.mat.collect.IteratorInt;
Expand All @@ -47,7 +48,7 @@ public class ArrayIntTest
*/
@Test
public void testArrayInt0() {
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
for (int i = 0; i < COUNT; ++i) {
int t = 0;
ArrayInt ss = new ArrayInt(r.nextInt(INITIAL_SIZE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.eclipse.mat.collect.ArrayLong;
import org.eclipse.mat.collect.IteratorLong;
Expand All @@ -48,7 +49,7 @@ public class ArrayLongTest
*/
@Test
public void testArrayLong0() {
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
for (int i = 0; i < COUNT; ++i) {
int t = 0;
ArrayLong ss = new ArrayLong(r.nextInt(INITIAL_SIZE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.junit.Assert.assertEquals;

import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.eclipse.mat.collect.ArrayIntCompressed;
import org.eclipse.mat.collect.ArrayLongCompressed;
Expand All @@ -28,7 +29,7 @@ public class CompressedArraysTest
@Test
public void testIntArrayCompressed()
{
Random rand = new Random(SEED);
Random rand = ThreadLocalRandom.current();
int INTS = 1024;
int TESTS = 10;
for (int i = 1; i <= INTS; i++)
Expand All @@ -55,7 +56,7 @@ public void testIntArrayCompressed()
@Test
public void testLongArrayCompressed()
{
Random rand = new Random(SEED);
Random rand = ThreadLocalRandom.current();
int LONGS = 1024;
int TESTS = 10;
for (int i = 1; i <= LONGS; i++)
Expand Down Expand Up @@ -85,7 +86,7 @@ public void testLongArrayCompressed()
@Test
public void testIntAndLongArrayCompressed()
{
Random rand = new Random(SEED);
Random rand = ThreadLocalRandom.current();
int INTS = 1024;
int TESTS = 10;
for (int i = 1; i <= INTS; i++)
Expand Down Expand Up @@ -116,7 +117,7 @@ public void testIntAndLongArrayCompressed()
@Test
public void testLongAndIntArrayCompressed()
{
Random rand = new Random(SEED);
Random rand = ThreadLocalRandom.current();
int INTS = 1024;
int TESTS = 10;
for (int i = 1; i <= INTS; i++)
Expand Down Expand Up @@ -147,7 +148,7 @@ public void testLongAndIntArrayCompressed()
@Test
public void testIntArrayCompressedOverwrite()
{
Random rand = new Random(SEED);
Random rand = ThreadLocalRandom.current();
int INTS = 100;
for (int i = 1; i <= INTS; i++)
{
Expand Down Expand Up @@ -218,7 +219,7 @@ public void testIntArrayCompressedOverwrite()
@Test
public void testLongArrayCompressedOverwrite()
{
Random rand = new Random(SEED);
Random rand = ThreadLocalRandom.current();
int LONGS = 100;
for (int i = 1; i <= LONGS; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.eclipse.mat.collect.QueueInt;
import org.eclipse.mat.collect.IteratorInt;
Expand All @@ -47,7 +48,7 @@ public class QueueIntTest
*/
@Test
public void testQueueInt0() {
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
for (int i = 0; i < COUNT; ++i) {
int t = 0;
QueueInt ss = new QueueInt(r.nextInt(INITIAL_SIZE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.eclipse.mat.collect.IteratorInt;
import org.eclipse.mat.collect.SetInt;
Expand All @@ -47,7 +48,7 @@ public class SetIntTest
*/
@Test
public void testSetInt0() {
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
for (int i = 0; i < COUNT; ++i) {
int t = 0;
SetInt ss = new SetInt(r.nextInt(INITIAL_SIZE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.eclipse.mat.collect.IteratorLong;
import org.eclipse.mat.collect.SetLong;
Expand All @@ -47,7 +48,7 @@ public class SetLongTest
*/
@Test
public void testSetLong0() {
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
for (int i = 0; i < COUNT; ++i) {
int t = 0;
SetLong ss = new SetLong(r.nextInt(INITIAL_SIZE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.eclipse.mat.collect.ArrayUtils;
import org.junit.Test;
Expand Down Expand Up @@ -55,7 +56,7 @@ public void testSort()
{
// Generate random data
int n = longTest ? 29792349 : SHORTTEST;
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
int[] key0 = new int[n];
int[] key = new int[n];
int[] value = new int[n];
Expand Down Expand Up @@ -198,7 +199,7 @@ public void testSort5()
{
// Generate random data
int n = longTest ? 29792349 : SHORTTEST;
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
int k = n;
int[] key0 = new int[n];
int[] key = new int[n];
Expand All @@ -223,7 +224,7 @@ public void testSort5()
public void testSortDesc()
{
int n = longTest ? 29792349 : SHORTTEST;
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
long[] key0 = new long[n];
long[] key = new long[n];
int[] value = new int[n];
Expand Down Expand Up @@ -363,7 +364,7 @@ public void testSortDesc4()
public void testSortDesc5()
{
int n = longTest ? 29792349 : SHORTTEST;
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
long[] key0 = new long[n];
long[] key = new long[n];
int[] value = new int[n];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import java.util.function.Supplier;
import java.util.zip.Deflater;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.eclipse.mat.hprof.ChunkedGZIPRandomAccessFile;
import org.eclipse.mat.hprof.GZIPInputStream2;
import org.eclipse.mat.hprof.SeekableStream;
Expand Down Expand Up @@ -70,6 +72,7 @@ public GzipTests(int comp)
this.comp = comp;
}

@SuppressFBWarnings(value = "DMI_RANDOM_USED_ONLY_ONCE", justification = "Random is used with fixed seeds to assert test data consistency")
static byte[] randomText(int size)
{
Random rn = new Random(1);
Expand Down Expand Up @@ -197,7 +200,7 @@ public void test1() throws IOException
try (ByteArrayInputStream bis = new ByteArrayInputStream(bo, 0, bol))
{
try (InflaterInputStream inf = new InflaterInputStream(bis, false)) {
Random r = new Random(1);
Random r = ThreadLocalRandom.current();
byte bo2[] = new byte[inputLen];
int MAXMARK = 32211;
int mark = -1;
Expand Down Expand Up @@ -293,6 +296,7 @@ public InputStream get()
checkSeekableStream(b, ss);
}

@SuppressFBWarnings(value = "DMI_RANDOM_USED_ONLY_ONCE", justification = "Random is used with fixed seeds to assert test data consistency")
private void checkSeekableStream(byte[] b, SeekableStream ss) throws IOException
{
int inputLen = b.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import org.eclipse.mat.parser.index.IIndexReader.IOne2ManyIndex;
import org.eclipse.mat.parser.index.IIndexReader.IOne2ManyObjectsIndex;
Expand Down Expand Up @@ -212,7 +213,7 @@ public void storeKey(int index, Serializable key)
public void testLong() throws IOException
{
assumeTrue((long) M * N < MAXELEMENTS);
Random r = new Random();
Random r = ThreadLocalRandom.current();
long ii[][] = new long[P + 1][];
for (int p = 0; p < P + 1; p++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Collection;
import java.util.Random;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.eclipse.mat.collect.IteratorInt;
import org.eclipse.mat.collect.IteratorLong;
import org.eclipse.mat.parser.index.IIndexReader;
Expand All @@ -38,7 +39,7 @@
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;


@SuppressFBWarnings(value = "DMI_RANDOM_USED_ONLY_ONCE", justification = "Random is used with fixed seeds to assert test data consistency")
@RunWith(value = Parameterized.class)
public class TestIndex1to1
{
Expand Down
Loading