String locStr = locator.toLowerCase();
String validLoc;
if (locStr.equals(validLoc = TONE_DEVICE_LOCATOR)) {
ABBBasicPlayer p;
// separate device & encodings
int encInd = locator.indexOf('?');
String encStr = null;
if (encInd > 0) {
encStr = locator.substring(encInd + 1);
locStr = locStr.substring(0, encInd);
/*
* TBD: check case when '?' is the last Locator symbol:
*Will encStr be == "", or it will be == null ?
*/
} else {
/*
* detect invalid locator case:
* if no '?' found then locStr & validLoc shall be
* equivalent strings, but since they have already passed
* char-to-char comparison, we to check lengths only...
*/
if (locStr.length() != validLoc.length())
throw new MediaException("Malformed locator");
encStr = "";
}
String className = config.getHandler(locStr);
try {
// Try and instance the player ....
Class protoClass = Class.forName(className);
p = (ABBBasicPlayer) protoClass.newInstance();
// Pass encStr to created Player as argument
if (!p.initFromURL(encStr)) {
throw new MediaException("Invalid locator media encodings");
};
//System.out.println("DEBUG: Manager.createPlayer(" + locator + ") returned#1 " + p);
return p;
} catch (Exception e) {