[526468] java.lang.NumberFormatException when clipboard has information
diff --git a/plugins/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/internal/SnippetTransfer.java b/plugins/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/internal/SnippetTransfer.java
index 068cd7b..0f7f1d4 100644
--- a/plugins/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/internal/SnippetTransfer.java
+++ b/plugins/org.eclipse.wst.common.snippets/src/org/eclipse/wst/common/snippets/internal/SnippetTransfer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -85,9 +85,15 @@
*/
public Object nativeToJava(TransferData transferData) {
byte[] bytes = (byte[]) super.nativeToJava(transferData);
- if (bytes != null) {
- long clipboardTime = Long.valueOf(new String(bytes)).longValue();
- return this.startTime == clipboardTime ? object : null;
+ if (bytes != null && bytes.length > 0) {
+ try {
+ Long value = Long.valueOf(new String(bytes));
+ long clipboardTime = value.longValue();
+ return this.startTime == clipboardTime ? object : null;
+ }
+ catch (NumberFormatException e) {
+ // nothing to be done, we can get here via a clipboard operation
+ }
}
return null;
}