{
byte eventKind = bb.get();
byte suspendPolicy = bb.get();
int modifiers = bb.getInt();
EventRequest eventReq = new EventRequest(eventKind, suspendPolicy);
IEventFilter filter = null;
ReferenceTypeId refId;
for (int i = 0; i < modifiers; i++)
{
byte modKind = bb.get();
switch (modKind)
{
case JdwpConstants.ModKind.COUNT:
filter = new CountFilter(bb.getInt());
break;
case JdwpConstants.ModKind.CONDITIONAL:
filter = new ConditionalFilter(idMan.readObjectId(bb));
break;
case JdwpConstants.ModKind.THREAD_ONLY:
filter = new ThreadOnlyFilter((ThreadId) idMan.readObjectId(bb));
break;
case JdwpConstants.ModKind.CLASS_ONLY:
filter = new ClassOnlyFilter(idMan.readReferenceTypeId(bb));
break;
case JdwpConstants.ModKind.CLASS_MATCH:
filter = new ClassMatchFilter(JdwpString.readString(bb));
break;
case JdwpConstants.ModKind.CLASS_EXCLUDE:
filter = new ClassExcludeFilter(JdwpString.readString(bb));
break;
case JdwpConstants.ModKind.LOCATION_ONLY:
filter = new LocationOnlyFilter(new Location(bb));
break;
case JdwpConstants.ModKind.EXCEPTION_ONLY:
long id = bb.getLong();
if (id == 0)
refId = null;
else
refId = idMan.getReferenceType(id);
boolean caught = (bb.get() == 0) ? false : true;
boolean unCaught = (bb.get() == 0) ? false : true;
filter = new ExceptionOnlyFilter(refId, caught, unCaught);
break;
case JdwpConstants.ModKind.FIELD_ONLY:
refId = idMan.readReferenceTypeId(bb);
ReferenceTypeId fieldId = idMan.readReferenceTypeId(bb);
filter = new FieldOnlyFilter(refId, fieldId);
break;
case JdwpConstants.ModKind.STEP:
ThreadId tid = (ThreadId) idMan.readObjectId(bb);
int size = bb.getInt();
int depth = bb.getInt();
filter = new StepFilter(tid, size, depth);
break;
case JdwpConstants.ModKind.INSTANCE_ONLY:
ObjectId oid = idMan.readObjectId(bb);
filter = new InstanceOnlyFilter(oid);
break;
default:
throw new NotImplementedException("modKind " + modKind
+ " is not implemented.");
}
eventReq.addFilter(filter);
}
EventManager.getDefault().requestEvent(eventReq);
os.writeInt(eventReq.getId());
}