Author: kentam
Date: Tue Feb 15 13:40:51 2005
New Revision: 153962
URL: http://svn.apache.org/viewcvs?view=rev&rev=153962
Log:
Add additional compile-time validation in the check phase for a control client
so that references to malformed control types are handled safely.
Tweaked some debug output.
DRTs: all
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/threading/DriveComposite2.java
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java?view=diff&r1=153961&r2=153962
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
Tue Feb 15 13:40:51 2005
@@ -660,7 +660,8 @@
}
catch (Exception ex)
{
- ex.printStackTrace();
+ System.err.println( "getExternalClassLoader(): bad cp
entry=" + e );
+ System.err.println( "Exception processing e=" + ex );
}
}
URL [] urls = new URL[a.size()];
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java?view=diff&r1=153961&r2=153962
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java
Tue Feb 15 13:40:51 2005
@@ -256,6 +256,21 @@
printError( f, "control.field.bad.type" );
}
+ // Since our generate() does some detailed grovelling of control
types, make sure that
+ // will not result in an error by doing that grovelling now. Control
types may be
+ // malformed if the source for those types has errors (yet the apt
type map still exist!).
+ try
+ {
+ InterfaceType controlIntfOrExt =
getControlInterfaceOrExtension(fieldType);
+ InterfaceType controlIntf = getMostDerivedControlInterface(
controlIntfOrExt );
+ if ( controlIntf == null )
+ printError( f, "control.field.type.malformed" );
+ }
+ catch ( CodeGenerationException cge )
+ {
+ printError( f, "control.field.type.malformed" );
+ }
+
TypeDeclaration declaringType = f.getDeclaringType();
assert declaringType != null : "Field " + f + " has no declaring
type!";
Modified:
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties?view=diff&r1=153961&r2=153962
==============================================================================
---
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties
(original)
+++
incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties
Tue Feb 15 13:40:51 2005
@@ -14,6 +14,9 @@
A control field must be of a class or interface type. \
Verify the type of the control field declaration is a class or interface.
+control.field.type.malformed=\
+The type of the control field is malformed. Verify that the source of the
type has no errors.
+
control.field.in.inner.class=\
A control field can exist only within the top-level class. \
Move fields marked with the Control annotation to just inside the top-level
class.
@@ -35,4 +38,4 @@
propertyset.illegal.argument.error=\
A value assigned to a control property does not satisfy \
-its constraints. Cause: {0}
\ No newline at end of file
+its constraints. Cause: {0}
Modified:
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/threading/DriveComposite2.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/threading/DriveComposite2.java?view=diff&r1=153961&r2=153962
==============================================================================
---
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/threading/DriveComposite2.java
(original)
+++
incubator/beehive/trunk/controls/test/src/drivers/org/apache/beehive/controls/test/driver/threading/DriveComposite2.java
Tue Feb 15 13:40:51 2005
@@ -62,8 +62,11 @@
long composite_start=records[0][0];
long composite_end=records[LOOPS-1][0];
+ System.out.println( "composite_start=" + composite_start);
+ System.out.println( "composite_end=" + composite_end );
+
for(int i=0;i<LOOPS;i++){
- //System.out.println(">>>>>>>>
"+records[i][0]+"..."+records[i][1]+" <<<<<<<<");
+ System.out.println(">>>>>>>>
"+records[i][0]+"..."+records[i][1]+" <<<<<<<<");
if
((records[i][0]>composite_start)&&(records[i][0]<composite_end)){
report.setStatus(Report.PASS);
report.setMessage("");