[openrtm-commit:00908] r369 - trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/src/jp/go/aist/rtm/rtcbuilder/java/manager
openrtm @ openrtm.org
openrtm @ openrtm.org
2012年 11月 17日 (土) 12:57:41 JST
Author:
Date: 2012-11-17 12:57:41 +0900 (Sat, 17 Nov 2012)
New Revision: 369
Modified:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/src/jp/go/aist/rtm/rtcbuilder/java/manager/JavaGenerateManager.java
Log:
Modified algorithm to acquire OpenRTM Jar file version
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/src/jp/go/aist/rtm/rtcbuilder/java/manager/JavaGenerateManager.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/src/jp/go/aist/rtm/rtcbuilder/java/manager/JavaGenerateManager.java 2012-11-12 16:22:08 UTC (rev 368)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/src/jp/go/aist/rtm/rtcbuilder/java/manager/JavaGenerateManager.java 2012-11-17 03:57:41 UTC (rev 369)
@@ -32,6 +32,8 @@
static final String TEMPLATE_PATH = "jp/go/aist/rtm/rtcbuilder/java/template";
static final String MSG_ERROR_GENERATE_FILE = IRTCBMessageConstants.ERROR_CODE_GENERATION;
+
+ private final String DEFAULT_VERSION = "1.1.0";
@Override
public String getTargetVersion() {
@@ -70,23 +72,33 @@
if (!rtcParam.isLanguageExist(LANG_JAVA) || rtcParam.getName() == null) {
return result;
}
- String rootPath = System.getenv("RTM_JAVA_ROOT") + File.separator + "jar";
- File targetDir = new File(rootPath);
- File[] targetFiles = targetDir.listFiles();
- long lastDate = 0;
- File targetJar = null;
- for(File target : targetFiles) {
- if( target.getName().startsWith("OpenRTM-aist") ) {
- if( lastDate<target.lastModified() ) {
- targetJar = target;
+ try {
+ String rootPath = System.getenv("RTM_JAVA_ROOT") + File.separator + "jar";
+ File targetDir = new File(rootPath);
+ File[] targetFiles = targetDir.listFiles();
+ long lastDate = 0;
+ File targetJar = null;
+ if( targetFiles==null) {
+ rtcParam.setRtmJavaVersion(DEFAULT_VERSION);
+ } else {
+ for(File target : targetFiles) {
+ if( target.getName().startsWith("OpenRTM-aist") ) {
+ if( lastDate<target.lastModified() ) {
+ targetJar = target;
+ }
+ }
}
+ //
+ if( targetJar!=null ) {
+ String javaVersion = targetJar.getName().substring(13,18);
+ rtcParam.setRtmJavaVersion(javaVersion);
+ } else {
+ rtcParam.setRtmJavaVersion(DEFAULT_VERSION);
+ }
}
+ } catch (NullPointerException ex) {
+ rtcParam.setRtmJavaVersion(DEFAULT_VERSION);
}
- //
- if( targetJar!=null ) {
- String javaVersion = targetJar.getName().substring(13,18);
- rtcParam.setRtmJavaVersion(javaVersion);
- }
Map<String, Object> contextMap = new HashMap<String, Object>();
contextMap.put("template", TEMPLATE_PATH);
More information about the openrtm-commit
mailing list