Changeset 30616


Ignore:
Timestamp:
07/22/16 15:16:54 (5 years ago)
Author:
ak19
Message:

Useful debug statement when we get an InvocationTargetException (Reflection related issue). The method may be called and may encounter an exception there, yet we still see the InvocationTargetException.

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java

    r30516 r30616  
    973973        }
    974974       
    975         // Open database for reading
     975        // Open database for reading. It may not exist if collection is pre-built without archives (such as demo collections)
    976976        String coll_db_file = GSFile.archivesDatabaseFile(this.site_home, collection, dbtype);
    977977        if (!coll_db.openDatabase(coll_db_file, SimpleCollectionDatabase.READ))
    978978        {
    979             logger.error("Could not open collection archives database. Somebody already using this database!");
    980         }
     979            logger.error("Could not open collection archives database. Database doesn't exist or else somebody is already using it?");
     980            return;
     981        }
     982        // now we know we have an archives folder
    981983        String old_value = coll_db.getValue(oid);
    982984        String new_value = old_value.replace("<index-status>B", "<index-status>" + mark);
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/ServiceRack.java

    r30475 r30616  
    3636import org.w3c.dom.Node;
    3737import org.w3c.dom.NodeList;
     38
     39import java.io.StringWriter;
     40import java.io.PrintWriter;
    3841
    3942/**
     
    294297                        {
    295298                            logger.error("Trying to call a processService type method (process" + to + ") on a subclass(" + this.getClass().getName() + "), but an exception happened:" + e.toString(), e);
    296 
    297                             error_string.append("Trying to call a processService type method (process" + to + ") on a subclass(" + this.getClass().getName() + "), but an exception happened:" + e.toString());
     299                            // for debugging, it's useful to see what's really causing this supposed "invocationTargetException"
     300                            // When the error message is displayed in the "Net" tab in the browser's web inspector, scroll down to "Caused by"
     301                            StringWriter errors = new StringWriter();
     302                            e.printStackTrace(new PrintWriter(errors));
     303                            String errStr = errors.toString();
     304                            errStr += XMLConverter.getString(request);
     305
     306
     307                            error_string.append("Trying to call a processService type method (process" + to + ") on a subclass(" + this.getClass().getName() + "), but an exception happened:" + e.toString() + "\n" + errStr );
    298308                        }
    299309                    }
Note: See TracChangeset for help on using the changeset viewer.