(final String line)
| 3052 | } |
| 3053 | |
| 3054 | private void parseMasterLine(final String line) |
| 3055 | { |
| 3056 | final PCGTokenizer tokens; |
| 3057 | |
| 3058 | try |
| 3059 | { |
| 3060 | tokens = new PCGTokenizer(line); |
| 3061 | } |
| 3062 | catch (PCGParseException pcgpex) |
| 3063 | { |
| 3064 | final String msg = LanguageBundle.getFormattedString("Warnings.PCGenParser.IllegalMaster", //$NON-NLS-1$ |
| 3065 | line, pcgpex.getMessage()); |
| 3066 | warnings.add(msg); |
| 3067 | |
| 3068 | return; |
| 3069 | } |
| 3070 | |
| 3071 | final Follower aMaster = new Follower(Constants.EMPTY_STRING, Constants.EMPTY_STRING, null); |
| 3072 | |
| 3073 | for (PCGElement element : tokens.getElements()) |
| 3074 | { |
| 3075 | final String tag = element.getName(); |
| 3076 | |
| 3077 | if (IOConstants.TAG_MASTER.equals(tag)) |
| 3078 | { |
| 3079 | aMaster.setName(EntityEncoder.decode(element.getText())); |
| 3080 | } |
| 3081 | else if (IOConstants.TAG_TYPE.equals(tag)) |
| 3082 | { |
| 3083 | String cType = EntityEncoder.decode(element.getText()); |
| 3084 | CompanionList cList = Globals.getContext().getReferenceContext() |
| 3085 | .silentlyGetConstructedCDOMObject(CompanionList.class, cType); |
| 3086 | if (cList == null) |
| 3087 | { |
| 3088 | Logging.errorPrint("Cannot find CompanionList: " + cType); |
| 3089 | } |
| 3090 | else |
| 3091 | { |
| 3092 | aMaster.setType(cList); |
| 3093 | } |
| 3094 | } |
| 3095 | else if (IOConstants.TAG_HITDICE.equals(tag)) |
| 3096 | { |
| 3097 | try |
| 3098 | { |
| 3099 | aMaster.setUsedHD(Integer.parseInt(element.getText())); |
| 3100 | } |
| 3101 | catch (NumberFormatException nfe) |
| 3102 | { |
| 3103 | // nothing we can do about it |
| 3104 | } |
| 3105 | } |
| 3106 | else if (IOConstants.TAG_FILE.equals(tag)) |
| 3107 | { |
| 3108 | String inputFileName = EntityEncoder.decode(element.getText()); |
| 3109 | String masterFileName = makeFilenameAbsolute(inputFileName); |
| 3110 | if (masterFileName == null) |
| 3111 | { |
no test coverage detected