[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Mon Jan 7 22:07:45 UTC 2008
gordonp
Mon Jan 7 17:07:45 EST 2008
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services
In directory dev.open-bio.org:/tmp/cvs-serv15373/src/main/ca/ucalgary/seahawk/services
Modified Files:
MobyClient.java
Log Message:
Added more try blocks for pattern matching
moby-live/Java/src/main/ca/ucalgary/seahawk/services MobyClient.java,1.18,1.19
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java 2007/12/17 18:37:55 1.18
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java 2008/01/07 22:07:45 1.19
@@ -613,19 +613,23 @@
MobyComplexBuilder rule = regexMap.get(pattern);
if(targetDataType == null ||
rule.getDataType().inheritsFrom(targetDataType)){
- Matcher matcher = pattern.matcher(textData);
-
- while(matcher.find()){
- try{
- MobyDataObject mobyObj = rule.apply(matcher);
- if(mobyObj != null){
- objectVector.add(mobyObj);
+ try{
+ Matcher matcher = pattern.matcher(textData);
+
+ while(matcher.find()){
+ try{
+ MobyDataObject mobyObj = rule.apply(matcher);
+ if(mobyObj != null){
+ objectVector.add(mobyObj);
+ }
+ }
+ catch(MobyException me){
+ System.err.println("Could not build Moby object from match:" + me);
+ me.printStackTrace();
}
}
- catch(MobyException me){
- System.err.println("Could not build Moby object from match:" + me);
- me.printStackTrace();
- }
+ } catch(Throwable t){ // Principally stack overflows
+ System.err.println("Exception/Error ("+t+") while applying regex '"+pattern.pattern()+"' to text");
}
}
}
@@ -770,20 +774,24 @@
rawDataAsString = bytesToString(rawData);
//System.err.println("Start of data is " + rawDataAsString.substring(0, 4));
}
- Matcher matcher = pattern.matcher(rawDataAsString);
-
- while(matcher.find()){
- //System.err.println("Found match for binary data");
- try{
- MobyDataObject mobyObj = rule.apply(matcher, rawData);
- if(mobyObj != null){
- objectVector.add(mobyObj);
+ try{
+ Matcher matcher = pattern.matcher(rawDataAsString);
+
+ while(matcher.find()){
+ //System.err.println("Found match for binary data");
+ try{
+ MobyDataObject mobyObj = rule.apply(matcher, rawData);
+ if(mobyObj != null){
+ objectVector.add(mobyObj);
+ }
+ }
+ catch(MobyException me){
+ System.err.println("Could not build Moby object from match:" + me);
+ me.printStackTrace();
}
}
- catch(MobyException me){
- System.err.println("Could not build Moby object from match:" + me);
- me.printStackTrace();
- }
+ } catch(Throwable t){ // Principally stack overflows
+ System.err.println("Exception/Error ("+t+") while applying regex '"+pattern.pattern()+"' to binary data");
}
}
}
@@ -834,21 +842,25 @@
Iterator regex_keys = regexMap.keySet().iterator();
while(regex_keys.hasNext()){ //map still has untraversed regex entry to test
Pattern pattern = (Pattern) regex_keys.next();
- Matcher matcher = pattern.matcher(textData);
-
- while(matcher.find()){
- MobyComplexBuilder rule = (MobyComplexBuilder) regexMap.get(pattern);
-
- try{
- MobyDataObject mobyObj = rule.apply(matcher, bytes);
- if(mobyObj != null){
- objectVector.add(mobyObj);
+ try{
+ Matcher matcher = pattern.matcher(textData);
+
+ while(matcher.find()){
+ MobyComplexBuilder rule = (MobyComplexBuilder) regexMap.get(pattern);
+
+ try{
+ MobyDataObject mobyObj = rule.apply(matcher, bytes);
+ if(mobyObj != null){
+ objectVector.add(mobyObj);
+ }
+ }
+ catch(MobyException me){
+ System.err.println("Could not build Moby object from match:" + me);
+ me.printStackTrace();
}
}
- catch(MobyException me){
- System.err.println("Could not build Moby object from match:" + me);
- me.printStackTrace();
- }
+ }catch(Throwable t){ // Principally stack overflows
+ System.err.println("Exception/Error ("+t+") while applying regex '"+pattern.pattern()+"' to text/binary");
}
}
More information about the MOBY-guts
mailing list