use of com.ximpleware.XPathEvalException in project translationstudio8 by heartsome.
the class QAXmlHandler method getTUPureTextOrContent.
/**
* 根据需求获取trans-unit下source或target的纯文本,或者整体内容
* @return 如果返回null,则证明这个节点是个空节点,要么没有这个节点,要么这个节点没有值
*/
public String getTUPureTextOrContent(String xlfPath, String nodeXpath, boolean ignoreTag) {
VTDNav vn = vnMap.get(xlfPath);
AutoPilot ap = apMap.get(xlfPath);
validNull(vn, ap, xlfPath);
try {
VTDUtils vUtils = new VTDUtils(vn);
ap.selectXPath(nodeXpath);
while (ap.evalXPath() != -1) {
String content = vUtils.getElementContent();
if (content == null || "".equals(content)) {
return null;
}
// 如果忽略标记,就返回纯文本,否则返回整体内容
if (ignoreTag) {
return getTUPureText(vn);
}
return content;
}
} catch (NavException e) {
e.printStackTrace();
logger.error("", e);
} catch (XPathParseException e) {
e.printStackTrace();
logger.error("", e);
} catch (XPathEvalException e) {
e.printStackTrace();
logger.error("", e);
}
return null;
}
use of com.ximpleware.XPathEvalException in project translationstudio8 by heartsome.
the class XLFHandler method mergeSegment.
/**
* 合并两个文本段(注意:rowId1 和 rowId2 有可能不相邻,中间可能会间隔几个源文为空的文本段)
* @param rowId1
* 第一个文本段的 rowId
* @param rowId2
* 第二个文本段的 rowId;
*/
public String mergeSegment(String rowId1, String rowId2) {
// if (rowIndex + 1 >= rowIds.size()) {
// return "";
// }
// String rowId1 = getRowId(rowIndex);
// String rowId2 = getRowId(rowIndex + 1);
String fileName1 = RowIdUtil.getFileNameByRowId(rowId1);
String fileName2 = RowIdUtil.getFileNameByRowId(rowId2);
if (fileName1 == null || fileName2 == null || !fileName1.equals(fileName2)) {
return "";
}
VTDNav vn = vnMap.get(fileName1);
// TransUnitBean tuTop = getTransUnit(rowIndex);
// TransUnitBean tuBottom = getTransUnit(rowIndex + 1);
// String srcContent = tuTop.getSrcContent() + "<ph id=\"hs-merge" +
// tuTop.getId() + "~" + tuBottom.getId()
// + "\"/>" + tuBottom.getSrcContent();
// tuTop.setSrcContent(srcContent);
// String tgtContent = tuTop.getTgtContent() + "<ph id=\"hs-merge" +
// tuTop.getId() + "~" + tuBottom.getId()
// + "\"/>" + tuBottom.getTgtContent();
// tuTop.setTgtContent(tgtContent);
// tuTop.setMatches(null);
//
// String tuXPath1 = RowIdUtil.parseRowIdToXPath(rowId1);
// String tuXPath2 = RowIdUtil.parseRowIdToXPath(rowId2);
// AutoPilot ap = new AutoPilot(vn);
//
// XMLModifier xm = new XMLModifier(vn);
// delete(ap, xm, fileName2, tuXPath2, true);
// update(ap, xm, fileName1, tuXPath2, tuTop.toXMLString(), true);
// ap.selectXPath(tuXPath2);
//
// saveAndReparse(xm, fileName1);
String tuXPath1 = RowIdUtil.parseRowIdToXPath(rowId1);
String tuXPath2 = RowIdUtil.parseRowIdToXPath(rowId2);
String tuid1 = RowIdUtil.getTUIdByRowId(rowId1);
String tuid2 = RowIdUtil.getTUIdByRowId(rowId2);
// 不需加数据库
boolean isNotSendToTM = false;
// 是否是疑问行
boolean isNeeds_review = false;
// 是否添加属性“不需添加到数据库”
boolean isAddNotSendToTm = false;
// 是否添加属性“疑问行”
boolean isAddNeeds_review = false;
StringBuffer nodeSB = new StringBuffer();
AutoPilot ap = new AutoPilot(vn);
try {
VTDUtils vu = new VTDUtils(vn);
String oldElementFragment = "";
ap.selectXPath(tuXPath1);
String xmlSpace = null;
if (ap.evalXPath() != -1) {
xmlSpace = vu.getCurrentElementAttribut("xml:space", "preserve");
oldElementFragment += vu.getElementFragment();
// 获取当前tu节点的属性 hs:send-to-tm="no" hs:needs-review="yes"
isNotSendToTM = "no".equals(vu.getCurrentElementAttribut("hs:send-to-tm", ""));
isNeeds_review = "yes".equals(vu.getCurrentElementAttribut("hs:needs-review", ""));
}
ap.selectXPath(tuXPath2);
if (ap.evalXPath() != -1) {
oldElementFragment += vu.getElementFragment();
if (!isNotSendToTM) {
isAddNotSendToTm = "no".equals(vu.getCurrentElementAttribut("hs:send-to-tm", ""));
}
if (!isNeeds_review) {
isAddNeeds_review = "yes".equals(vu.getCurrentElementAttribut("hs:needs-review", ""));
}
// 开始获取批注
ap.selectXPath("./note");
while (ap.evalXPath() != -1) {
nodeSB.append(vu.getElementFragment());
}
}
XMLModifier xm = new XMLModifier(vn);
String sourceContent2 = "";
String targetContent2 = "";
ap.selectXPath(tuXPath2 + "/source");
String srcLang = null;
if (ap.evalXPath() != -1) {
srcLang = vu.getCurrentElementAttribut("xml:lang", null);
sourceContent2 = vu.getElementContent();
sourceContent2 = sourceContent2 == null ? "" : sourceContent2;
}
ap.selectXPath(tuXPath2 + "/target");
if (ap.evalXPath() != -1) {
targetContent2 = vu.getElementContent();
targetContent2 = targetContent2 == null ? "" : targetContent2;
}
String curTime = "" + System.nanoTime();
ap.selectXPath(tuXPath1 + "/source");
if (ap.evalXPath() != -1) {
String sourceContent1 = vu.getElementContent();
sourceContent1 = sourceContent1 == null ? "" : sourceContent1;
String newValue = sourceContent1 + "<ph id=\"hs-merge" + tuid1 + "~" + tuid2 + "\" splitMergeIndex=\"" + curTime + "\"/>" + sourceContent2;
vu.update(ap, xm, tuXPath1 + "/source/text()", newValue);
}
ap.selectXPath(tuXPath1 + "/target");
if (ap.evalXPath() != -1) {
String targetContent1 = vu.getElementContent();
targetContent1 = targetContent1 == null ? "" : targetContent1;
String newValue = targetContent1 + "<ph id=\"hs-merge" + tuid1 + "~" + tuid2 + "\" splitMergeIndex=\"" + curTime + "\"/>" + targetContent2;
vu.update(ap, xm, tuXPath1 + "/target/text()", newValue);
} else {
String newValue = "<ph id=\"hs-merge" + tuid1 + "~" + tuid2 + "\" splitMergeIndex=\"" + curTime + "\"/>" + targetContent2;
vu.insert(ap, xm, tuXPath1 + "/target/text()", newValue);
}
// 移除alt-trans节点
ap.selectXPath(tuXPath1 + "/alt-trans");
while (ap.evalXPath() != -1) {
xm.remove();
}
ap.selectXPath(tuXPath2);
if (ap.evalXPath() != -1) {
// xm.remove();
// Bug #1054:合并文本段时不应丢失第二个文本段的 trans-unit 节点
String transUnit = "<trans-unit id=\"" + tuid2 + "\" xml:space=\"" + xmlSpace + "\"><target/>" + "<source xml:lang=\"" + srcLang + "\"/></trans-unit>";
vu.update(ap, xm, tuXPath2, transUnit);
}
// 整合并集中的属性以及批注
ap.selectXPath(tuXPath1);
if (ap.evalXPath() != -1) {
// 注意添加属性时必须保持应有的空格
String insertAttri = isAddNotSendToTm ? " hs:send-to-tm=\"no\" " : "";
insertAttri += isAddNeeds_review ? " hs:needs-review=\"yes\" " : "";
if (insertAttri.length() > 0) {
xm.insertAttribute(insertAttri);
}
// 开始添加批注
if (nodeSB.length() > 0) {
xm.insertBeforeTail(nodeSB.toString().getBytes("UTF-8"));
}
vn.push();
// 开始处理合并后的状态,保持草稿状态
ap.selectXPath("./target");
if (ap.evalXPath() != -1) {
int index = vn.getAttrVal("state");
if (index != -1) {
xm.updateToken(index, "new");
} else {
xm.insertAttribute(" state=\"new\" ");
}
}
vn.pop();
// 删除批准状态
int index = vn.getAttrVal("approved");
if (index != -1) {
xm.removeAttribute(index - 1);
}
}
saveAndReparse(xm, fileName1);
// 删除下面的行
rowIds.remove(rowId2);
tuSizeMap.put(fileName1, tuSizeMap.get(fileName1) - 1);
return oldElementFragment;
} catch (XPathParseException e) {
LOGGER.error("", e);
e.printStackTrace();
} catch (XPathEvalException e) {
LOGGER.error("", e);
e.printStackTrace();
} catch (NavException e) {
LOGGER.error("", e);
e.printStackTrace();
} catch (ModifyException e) {
LOGGER.error("", e);
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
LOGGER.error("", e);
e.printStackTrace();
}
return "";
}
use of com.ximpleware.XPathEvalException in project translationstudio8 by heartsome.
the class PreMachineTranslation method executeTranslation.
/**
* 根据构建参数执行预翻译 ;
* @throws InterruptedException
*/
public List<PreMachineTranslationCounter> executeTranslation(IProgressMonitor monitor) throws InterruptedException {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
simpleMatchers = getMacthers();
if (null == simpleMatchers || simpleMatchers.isEmpty()) {
return this.transCounters;
}
monitor.beginTask("", this.xlfFiles.size());
monitor.setTaskName(Messages.getString("pretranslation.PreTranslation.task1"));
try {
for (String xlfPath : xlfFiles) {
if (monitor != null && monitor.isCanceled()) {
throw new InterruptedException();
}
currentCounter = new PreMachineTranslationCounter(xlfPath);
this.transCounters.add(currentCounter);
VTDNav vn = xlfHandler.getVnMap().get(xlfPath);
VTDUtils vu = new VTDUtils(vn);
AutoPilot ap = new AutoPilot(vu.getVTDNav());
int tuNumber = xlfHandler.getNodeCount(xlfPath, "/xliff/file//descendant::trans-unit[(source/text()!='' or source/*)]");
currentCounter.setTuNumber(tuNumber);
ap.selectXPath("/xliff/file");
String srcLang = "";
String tgtLang = "";
XMLModifier xm = new XMLModifier(vn);
IProgressMonitor monitor2 = new SubProgressMonitor(monitor, 1);
monitor2.beginTask(Messages.getString("pretranslation.PreTranslation.task2"), tuNumber);
while (ap.evalXPath() != -1) {
// 循环 file 节点
String _srcLang = vu.getCurrentElementAttribut("source-language", "");
String _tgtLang = vu.getCurrentElementAttribut("target-language", "");
if (!_srcLang.equals("")) {
srcLang = _srcLang;
}
if (!_tgtLang.equals("")) {
tgtLang = _tgtLang;
}
if (srcLang.equals("") || tgtLang.equals("")) {
continue;
}
keepCurrentMatchs(vu, _srcLang, _tgtLang, xm, monitor2);
}
monitor2.done();
FileOutputStream fos = new FileOutputStream(xlfPath);
BufferedOutputStream bos = new BufferedOutputStream(fos);
// 写入文件
xm.output(bos);
bos.close();
fos.close();
}
} catch (XPathParseException e) {
logger.error("", e);
e.printStackTrace();
} catch (NavException e) {
logger.error("", e);
e.printStackTrace();
} catch (ModifyException e) {
logger.error("", e);
e.printStackTrace();
} catch (XPathEvalException e) {
logger.error("", e);
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
logger.error("", e);
e.printStackTrace();
} catch (FileNotFoundException e) {
logger.error("", e);
e.printStackTrace();
} catch (TranscodeException e) {
logger.error("", e);
e.printStackTrace();
} catch (IOException e) {
logger.error("", e);
e.printStackTrace();
}
monitor.done();
return this.transCounters;
}
use of com.ximpleware.XPathEvalException in project translationstudio8 by heartsome.
the class WebSearchPreferencStore method getConfig.
/**
* @param vu
* @param isDefault
* getCustomContent===false:返回所有内容 getCustomContent===true :返回非默认的内容
* @return ;
*/
private List<SearchEntry> getConfig(VTDUtils vu, boolean getCustomContent) {
VTDNav vn = vu.getVTDNav();
AutoPilot mainAp = new AutoPilot(vn);
AutoPilot uesedAp = new AutoPilot(vn);
AutoPilot nameAp = new AutoPilot(vn);
AutoPilot urlAp = new AutoPilot(vn);
List<SearchEntry> cache = new ArrayList<SearchEntry>();
try {
mainAp.selectXPath("/WebSearchInfo/Providers/ProviderInfo");
uesedAp.selectXPath("./Used");
nameAp.selectXPath("./Name");
urlAp.selectXPath("./Url");
SearchEntry temp = null;
while (mainAp.evalXPath() != -1) {
int attrVal = vn.getAttrVal("isDefault");
if (getCustomContent) {
if (-1 != attrVal) {
continue;
}
}
temp = new SearchEntry();
if (-1 != attrVal) {
temp.setDefault(true);
}
int idIndex = vn.getAttrVal("id");
if (-1 != idIndex) {
temp.setId(vn.toString(idIndex));
}
vn.push();
uesedAp.resetXPath();
if (uesedAp.evalXPath() != -1) {
int textIndex = vn.getText();
if (-1 != textIndex && null != temp) {
temp.setChecked("true".equalsIgnoreCase(vn.toString(textIndex)) ? true : false);
}
} else {
temp = null;
}
vn.pop();
vn.push();
nameAp.resetXPath();
if (nameAp.evalXPath() != -1) {
int textIndex = vn.getText();
if (-1 != textIndex && null != temp) {
temp.setSearchName(TextUtil.resetSpecialString(vn.toString(textIndex)));
}
} else {
temp = null;
}
vn.pop();
vn.push();
urlAp.resetXPath();
if (urlAp.evalXPath() != -1) {
int textIndex = vn.getText();
if (-1 != textIndex && null != temp) {
temp.setSearchUrl((TextUtil.resetSpecialString(vn.toString(textIndex))));
}
} else {
temp = null;
}
vn.pop();
if (null != temp) {
cache.add(temp);
}
}
} catch (XPathEvalException e) {
e.printStackTrace();
logger.error("", e);
} catch (NavException e) {
e.printStackTrace();
logger.error("", e);
} catch (XPathParseException e) {
e.printStackTrace();
logger.error("", e);
}
return cache;
}
use of com.ximpleware.XPathEvalException in project translationstudio8 by heartsome.
the class PreferenceUtil method initProductEdition.
public static void initProductEdition() {
System.getProperties().put("TSVersion", "89");
Location configArea = Platform.getInstallLocation();
if (configArea == null) {
System.getProperties().put("TSEdition", "");
System.getProperties().put("TSVersion", "");
return;
}
URL location = null;
try {
VTDGen vg = new VTDGen();
AutoPilot ap = new AutoPilot();
location = new URL(configArea.getURL().toExternalForm() + "features");
String featureFolderName = location.getFile();
File featureFolder = new File(featureFolderName);
// 遍历 features 目录
if (featureFolder.isDirectory()) {
boolean isU = false;
boolean isF = false;
boolean isP = false;
boolean isL = false;
String strUVersion = null;
String strFVersion = null;
String strPVersion = null;
String strLVersion = null;
for (File f : featureFolder.listFiles()) {
String name = f.getName();
if (name.startsWith("net.heartsome.cat.ts.edition_")) {
if (vg.parseFile(f.getAbsolutePath() + File.separator + "feature.xml", true)) {
VTDNav vn = vg.getNav();
ap.bind(vn);
ap.selectXPath("/feature");
if (ap.evalXPath() != -1) {
int idIndex = vn.getAttrVal("id");
int versionIndex = vn.getAttrVal("version");
if (idIndex == -1 || versionIndex == -1) {
System.getProperties().put("TSEdition", "");
return;
}
String id = vn.toRawString(idIndex);
String version = vn.toRawString(versionIndex);
if (name.equals(id + "_" + version)) {
// 由于 feature 可以包含,因此要遍历所有以 net.heartsome.cat.ts.edition_ 开头的目录,找到版本最高的
if (id.equals("net.heartsome.cat.ts.edition_ultimate.feature")) {
isU = true;
strUVersion = version;
break;
} else if (id.equals("net.heartsome.cat.ts.edition_professional.feature")) {
isF = true;
strFVersion = version;
continue;
} else if (id.equals("net.heartsome.cat.ts.edition_personal.feature")) {
isP = true;
strPVersion = version;
continue;
} else if (id.equals("net.heartsome.cat.ts.edition_lite.feature")) {
isL = true;
strLVersion = version;
continue;
}
} else {
System.getProperties().put("TSEdition", "");
return;
}
} else {
System.getProperties().put("TSEdition", "");
}
} else {
System.getProperties().put("TSEdition", "");
}
}
}
if (isU) {
System.getProperties().put("TSEdition", "U");
System.getProperties().put("TSVersionDate", strUVersion);
} else if (isF) {
System.getProperties().put("TSEdition", "F");
System.getProperties().put("TSVersionDate", strFVersion);
} else if (isP) {
System.getProperties().put("TSEdition", "P");
System.getProperties().put("TSVersionDate", strPVersion);
} else if (isL) {
System.getProperties().put("TSEdition", "L");
System.getProperties().put("TSVersionDate", strLVersion);
} else {
System.getProperties().put("TSEdition", "");
System.getProperties().put("TSVersionDate", "");
}
} else {
System.getProperties().put("TSEdition", "");
}
location = new URL(configArea.getURL().toExternalForm() + "plugins");
String pluginsFolderName = location.getFile();
File pluginsFolder = new File(pluginsFolderName);
// 遍历 plugins 目录
if (pluginsFolder.isDirectory()) {
List<String> lstPluginName = new ArrayList<String>();
for (File f : pluginsFolder.listFiles()) {
String name = f.getName();
if (name.endsWith(".jar") && (name.startsWith("net.heartsome.cat.ts.ui.plugin_") || name.startsWith("net.heartsome.cat.ts.ui.advanced_") || name.startsWith("net.heartsome.cat.ts.fuzzyTranslation_") || name.startsWith("net.heartsome.cat.converter.ui_") || name.startsWith("net.heartsome.cat.ts.ui.docx_") || name.startsWith("net.heartsome.cat.ts.ui.qa_") || name.startsWith("net.heartsome.cat.database.ui_") || name.startsWith("net.heartsome.cat.database.hsql_") || name.startsWith("net.heartsome.cat.database.oracle_") || name.startsWith("net.heartsome.cat.ts.importproject_") || name.startsWith("net.heartsome.cat.ts.exportproject_") || name.startsWith("net.heartsome.cat.ts.handlexlf_") || name.startsWith("net.heartsome.cat.ts.lockrepeat_") || name.startsWith("net.heartsome.cat.ts.jumpsegment_"))) {
String pluginName = name.substring(0, name.indexOf("_"));
// 更新后原来的插件会保留在 plugins 目录下,应此 lstPluginName 会有重复添加 pluginName 的情况,所以在此处添加判断。
if (!lstPluginName.contains(pluginName)) {
lstPluginName.add(pluginName);
}
}
}
String edition = System.getProperty("TSEdition");
if (lstPluginName.size() == 14 && lstPluginName.indexOf("net.heartsome.cat.ts.ui.plugin") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.ui.advanced") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.fuzzyTranslation") != -1 && lstPluginName.indexOf("net.heartsome.cat.converter.ui") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.ui.docx") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.ui.qa") != -1 && lstPluginName.indexOf("net.heartsome.cat.database.ui") != -1 && lstPluginName.indexOf("net.heartsome.cat.database.hsql") != -1 && lstPluginName.indexOf("net.heartsome.cat.database.oracle") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.importproject") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.exportproject") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.handlexlf") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.lockrepeat") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.jumpsegment") != -1) {
if (!(edition != null && (edition.equals("U") || edition.equals("F")))) {
System.getProperties().put("TSEdition", "");
}
} else if (lstPluginName.size() == 6 && lstPluginName.indexOf("net.heartsome.cat.converter.ui") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.ui.qa") != -1 && lstPluginName.indexOf("net.heartsome.cat.database.ui") != -1 && lstPluginName.indexOf("net.heartsome.cat.database.hsql") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.importproject") != -1 && lstPluginName.indexOf("net.heartsome.cat.ts.jumpsegment") != -1) {
if (!(edition != null && edition.equals("P"))) {
System.getProperties().put("TSEdition", "");
}
} else if (lstPluginName.size() == 0) {
if (!(edition != null && edition.equals("L"))) {
System.getProperties().put("TSEdition", "");
}
} else {
System.getProperties().put("TSEdition", "");
}
} else {
System.getProperties().put("TSEdition", "");
}
// if (System.getProperty("TSEdition").equals("")) {
// return;
// }
// String product = Platform.getProduct().getName();
// if (Util.isMac()) {
// location = new URL(configArea.getURL().toExternalForm() + product + ".app" + File.separator
// + "Contents" + File.separator + "MacOS" + File.separator + product + ".ini");
// } else {
// location = new URL(configArea.getURL().toExternalForm() + product + ".ini");
// }
// String fileName = location.getFile();
// BufferedReader in = new BufferedReader(new FileReader(fileName));
// String line = null;
// String tsVersion = null;
// String tsSerial = null;
// while ((line = in.readLine()) != null) {
// if (line.startsWith("TSProductVersion")) {
// tsVersion = line.substring(line.indexOf("=") + 1);
// }
// if (line.startsWith("TSProductSerialNumber")) {
// tsSerial = line.substring(line.indexOf("=") + 1);
// }
// }
// if (tsVersion != null && tsSerial != null && tsVersion.length() == 16 && tsSerial.length() == 16) {
// String edition = System.getProperty("TSEdition");
// int[] arrValue = new int[16];
// for (int i = 0; i < tsVersion.length(); i++) {
// arrValue[i] = Integer.parseInt(Character.toString(tsVersion.charAt(i)));
// }
// int[] arrSerialNum = new int[16];
// for (int i = 0; i < tsSerial.length(); i++) {
// arrSerialNum[i] = Integer.parseInt(Character.toString(tsSerial.charAt(i)));
// }
// String strFullChar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// boolean isU = ((arrValue[1] + arrValue[8]) * (arrValue[7] - arrValue[14])) == (strFullChar.indexOf("U") +
// 1);// 验证旗舰版的规则
// boolean isF = arrValue[4] != 0
// && (arrValue[2] - arrValue[9] + arrValue[15]) / arrValue[4] == (strFullChar.indexOf("F") + 1);
// boolean isP = arrValue[5] * (arrValue[3] + arrValue[10] + arrValue[12]) == (strFullChar.indexOf("P") +
// 1);
// boolean isL = (arrValue[0] + arrValue[6] + arrValue[11] + arrValue[13]) == (strFullChar.indexOf("L") +
// 1);
//
// boolean isUVersion = arrSerialNum[12] + arrSerialNum[13] == 8 && arrSerialNum[2] + arrSerialNum[3] ==
// 9;// 验证旗舰版是否满足
// boolean isFVersion = arrSerialNum[6] * arrSerialNum[15] == 8 && arrSerialNum[2] * arrSerialNum[5] == 9;//
// 验证专业版是否满足
// boolean isPVersion = arrSerialNum[3] * arrSerialNum[4] == 8 && arrSerialNum[0] * arrSerialNum[13] == 9;//
// 验证个人版是否满足
// boolean isLVersion = arrSerialNum[0] * arrSerialNum[3] == 8 && arrSerialNum[1] == 9;// 验证精简版是否满足
// if (edition.equals("U")) {
// // 验证 TSEdition
// if (!isU) {
// System.getProperties().put("TSEdition", "");
// } else {
// if (isF) {
// System.getProperties().put("TSEdition", "");
// } else if (isP) {
// System.getProperties().put("TSEdition", "");
// } else if (isL) {
// System.getProperties().put("TSEdition", "");
// }
// }
// // 验证序列号
// if (isUVersion) {
// if (!(isFVersion) && !(isPVersion) && !(isLVersion)) {
// System.getProperties().put("TSVersion", "89");
// } else {
// System.getProperties().put("TSVersion", "");
// }
// } else {
// System.getProperties().put("TSVersion", "");
// }
// } else if (edition.equals("F")) {
// if (!isF) {
// System.getProperties().put("TSEdition", "");
// } else {
// if (isU) {
// System.getProperties().put("TSEdition", "");
// } else if (isP) {
// System.getProperties().put("TSEdition", "");
// } else if (isL) {
// System.getProperties().put("TSEdition", "");
// }
// }
// if (isFVersion) {
// if (!(isUVersion) && !(isPVersion) && !(isLVersion)) {
// System.getProperties().put("TSVersion", "89");
// } else {
// System.getProperties().put("TSVersion", "");
// }
// } else {
// System.getProperties().put("TSVersion", "");
// }
// } else if (edition.equals("P")) {
// if (!isP) {
// System.getProperties().put("TSEdition", "");
// } else {
// if (isU) {
// System.getProperties().put("TSEdition", "");
// } else if (isF) {
// System.getProperties().put("TSEdition", "");
// } else if (isL) {
// System.getProperties().put("TSEdition", "");
// }
// }
// if (isPVersion) {
// if (!(isUVersion) && !(isFVersion) && !(isLVersion)) {
// System.getProperties().put("TSVersion", "89");
// } else {
// System.getProperties().put("TSVersion", "");
// }
// } else {
// System.getProperties().put("TSVersion", "");
// }
// } else if (edition.equals("L")) {
// if (!isL) {
// System.getProperties().put("TSEdition", "");
// } else {
// if (isU) {
// System.getProperties().put("TSEdition", "");
// } else if (isF) {
// System.getProperties().put("TSEdition", "");
// } else if (isP) {
// System.getProperties().put("TSEdition", "");
// }
// }
// if (isLVersion) {
// if (!(isUVersion) && !(isFVersion) && !(isPVersion)) {
// System.getProperties().put("TSVersion", "89");
// } else {
// System.getProperties().put("TSVersion", "");
// }
// } else {
// System.getProperties().put("TSVersion", "");
// }
// }
// } else {
// System.getProperties().put("TSEdition", "");
// System.getProperties().put("TSVersion", "");
// }
} catch (MalformedURLException e) {
e.printStackTrace();
LOGGER.error(Messages.getString("preference.PreferenceUtil.logger1"), e);
} catch (XPathEvalException e) {
e.printStackTrace();
LOGGER.error(Messages.getString("preference.PreferenceUtil.logger1"), e);
} catch (NavException e) {
e.printStackTrace();
LOGGER.error(Messages.getString("preference.PreferenceUtil.logger1"), e);
} catch (XPathParseException e) {
e.printStackTrace();
LOGGER.error(Messages.getString("preference.PreferenceUtil.logger1"), e);
}
}
Aggregations