[552870] Avoid prolific EcoreEnvironment::findPackage reports
diff --git a/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/EcoreEnvironment.java b/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/EcoreEnvironment.java
index 79a40de..9bf6284 100644
--- a/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/EcoreEnvironment.java
+++ b/plugins/org.eclipse.ocl.ecore/src/org/eclipse/ocl/ecore/EcoreEnvironment.java
@@ -93,6 +93,7 @@
private static final Map<List<String>, EPackage> OCL_PACKAGES =
new java.util.HashMap<List<String>, EPackage>();
+ private static boolean findPackageHasReportedProblems = false;
static {
List<String> names = new java.util.ArrayList<String>();
@@ -697,7 +698,7 @@
if (OCL_PACKAGES.containsKey(packageNames)) {
return OCL_PACKAGES.get(packageNames);
}
-
+ boolean reportProblems = !findPackageHasReportedProblems;
String name = packageNames.get(0);
try {
for (Object next : registry.values()) {
@@ -723,7 +724,10 @@
}
}
catch (Throwable t) { // See bug 552870
- System.err.println("OCL: erroneous global EPackage registry entry.\n" + t.toString()); //$NON-NLS-1$
+ if (reportProblems) {
+ findPackageHasReportedProblems = true;
+ System.err.println("OCL: erroneous global EPackage registry entry.\n" + t.toString()); //$NON-NLS-1$
+ }
}
}
}
@@ -752,7 +756,10 @@
}
}
catch (Throwable t) {
- System.err.println("OCL: erroneous global EPackage registry entry.\n" + t.toString()); //$NON-NLS-1$
+ if (reportProblems) {
+ findPackageHasReportedProblems = true;
+ System.err.println("OCL: erroneous global EPackage registry entry.\n" + t.toString()); //$NON-NLS-1$
+ }
}
}
}