diff options
author | sb <sb@openoffice.org> | 2009-12-01 13:31:23 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2009-12-01 13:31:23 +0100 |
commit | 6e7eaf1bfba3484670e505b785f5fc74892c96af (patch) | |
tree | b7336829f4525bfb6b5bbe78e5cbd6fcc5df24b5 /jvmfwk | |
parent | 8fd3f31eb907c32d01f16e5d87ed0ed203db8e6e (diff) | |
parent | 2af874edba0be4bb39a9696a8bf5b328c06a5618 (diff) |
sb111: merged in to-the-side QA fixes
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index a823d551af88..61edd8ebcaf4 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -127,7 +127,7 @@ extern VendorSupportMapEntry gVendorMap[]; bool getSDKInfoFromRegistry(vector<OUString> & vecHome); bool getJREInfoFromRegistry(vector<OUString>& vecJavaHome); -rtl::OUString decodeOutput(const rtl::OString& s); +bool decodeOutput(const rtl::OString& s, rtl::OUString* out); @@ -452,7 +452,9 @@ bool getJavaProps(const OUString & exePath, break; JFW_TRACE2(OString("[Java framework] line:\" ") + aLine + OString(" \".\n")); - OUString sLine = decodeOutput(aLine); + OUString sLine; + if (!decodeOutput(aLine, &sLine)) + continue; JFW_TRACE2(OString("[Java framework] line:\" ") + OString( CHAR_POINTER(sLine)) + OString(" \".\n")); sLine = sLine.trim(); @@ -486,8 +488,9 @@ bool getJavaProps(const OUString & exePath, readable strings. The strings are encoded as integer values separated by spaces. */ -rtl::OUString decodeOutput(const rtl::OString& s) +bool decodeOutput(const rtl::OString& s, rtl::OUString* out) { + OSL_ASSERT(out != 0); OUStringBuffer buff(512); sal_Int32 nIndex = 0; do @@ -495,14 +498,19 @@ rtl::OUString decodeOutput(const rtl::OString& s) OString aToken = s.getToken( 0, ' ', nIndex ); if (aToken.getLength()) { + for (sal_Int32 i = 0; i < aToken.getLength(); ++i) + { + if (aToken[i] < '0' || aToken[i] > '9') + return false; + } sal_Unicode value = (sal_Unicode)(aToken.toInt32()); buff.append(value); } } while (nIndex >= 0); - OUString sDecoded(buff.makeStringAndClear()); - JFW_TRACE2(sDecoded); - return sDecoded; + *out = buff.makeStringAndClear(); + JFW_TRACE2(*out); + return true; } |