mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-06 15:55:47 +02:00
[351993] [dstore] not able to connect to server if .eclipse folder not available
This commit is contained in:
parent
c1a759e556
commit
10942be646
2 changed files with 65 additions and 29 deletions
|
@ -37,6 +37,7 @@
|
||||||
* David McKnight (IBM) - [336257] [dstore] leading file.searator in DSTORE_LOG_DIRECTORY not handled
|
* David McKnight (IBM) - [336257] [dstore] leading file.searator in DSTORE_LOG_DIRECTORY not handled
|
||||||
* David McKnight (IBM) - [283613] [dstore] Create a Constants File for all System Properties we support
|
* David McKnight (IBM) - [283613] [dstore] Create a Constants File for all System Properties we support
|
||||||
* David McKnight (IBM) - [340080] [dstore] empty string should not be allowed as a DataElement ID
|
* David McKnight (IBM) - [340080] [dstore] empty string should not be allowed as a DataElement ID
|
||||||
|
* David McKnight (IBM) - [351993] [dstore] not able to connect to server if .eclipse folder not available
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.dstore.core.model;
|
package org.eclipse.dstore.core.model;
|
||||||
|
@ -3692,14 +3693,20 @@ public final class DataStore
|
||||||
if (SystemServiceManager.getInstance().getSystemService() == null){
|
if (SystemServiceManager.getInstance().getSystemService() == null){
|
||||||
String logDir = getUserPreferencesDirectory();
|
String logDir = getUserPreferencesDirectory();
|
||||||
_traceFileHandle = new File(logDir, ".dstoreTrace"); //$NON-NLS-1$
|
_traceFileHandle = new File(logDir, ".dstoreTrace"); //$NON-NLS-1$
|
||||||
|
if (_traceFileHandle.canWrite()){
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_traceFile = new RandomAccessFile(_traceFileHandle, "rw"); //$NON-NLS-1$
|
_traceFile = new RandomAccessFile(_traceFileHandle, "rw"); //$NON-NLS-1$
|
||||||
startTracing();
|
startTracing();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// turn tracing off if there's a problem
|
||||||
|
_tracingOn = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
else {
|
||||||
{
|
_tracingOn = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3733,14 +3740,20 @@ public final class DataStore
|
||||||
{
|
{
|
||||||
String logDir = getUserPreferencesDirectory();
|
String logDir = getUserPreferencesDirectory();
|
||||||
_memLoggingFileHandle = new File(logDir, ".dstoreMemLogging"); //$NON-NLS-1$
|
_memLoggingFileHandle = new File(logDir, ".dstoreMemLogging"); //$NON-NLS-1$
|
||||||
|
if (_memLoggingFileHandle.canWrite()){
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_memLogFile = new RandomAccessFile(_memLoggingFileHandle, "rw"); //$NON-NLS-1$
|
_memLogFile = new RandomAccessFile(_memLoggingFileHandle, "rw"); //$NON-NLS-1$
|
||||||
startMemLogging();
|
startMemLogging();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// turn mem logging off if there's a problem
|
||||||
|
_memLoggingOn = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
else {
|
||||||
{
|
_memLoggingOn = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_deRemover = new DataElementRemover(this);
|
_deRemover = new DataElementRemover(this);
|
||||||
|
@ -4370,12 +4383,13 @@ public final class DataStore
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assignCacheJar()
|
protected void assignCacheJar()
|
||||||
{
|
{
|
||||||
String cacheDirectory = getCacheDirectory();
|
String cacheDirectory = getCacheDirectory();
|
||||||
File cacheJar = new File(cacheDirectory + REMOTE_CLASS_CACHE_JARFILE_NAME + JARFILE_EXTENSION);
|
File cacheJar = new File(cacheDirectory + REMOTE_CLASS_CACHE_JARFILE_NAME + JARFILE_EXTENSION);
|
||||||
File nextCacheJar = new File(cacheDirectory + REMOTE_CLASS_CACHE_JARFILE_NAME + "_next" + JARFILE_EXTENSION); //$NON-NLS-1$
|
File nextCacheJar = new File(cacheDirectory + REMOTE_CLASS_CACHE_JARFILE_NAME + "_next" + JARFILE_EXTENSION); //$NON-NLS-1$
|
||||||
if (nextCacheJar.exists()) nextCacheJar.renameTo(cacheJar);
|
if (nextCacheJar.exists())
|
||||||
if (!cacheJar.exists())
|
nextCacheJar.renameTo(cacheJar);
|
||||||
|
if (!cacheJar.exists() && cacheJar.canWrite())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -4383,6 +4397,8 @@ public final class DataStore
|
||||||
cacheOut.putNextEntry(new JarEntry("/")); //$NON-NLS-1$
|
cacheOut.putNextEntry(new JarEntry("/")); //$NON-NLS-1$
|
||||||
cacheOut.closeEntry();
|
cacheOut.closeEntry();
|
||||||
cacheOut.close();
|
cacheOut.close();
|
||||||
|
|
||||||
|
_cacheJar = cacheJar;
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
@ -4391,11 +4407,11 @@ public final class DataStore
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_cacheJar = null;
|
||||||
|
}
|
||||||
|
|
||||||
_cacheJar = cacheJar;
|
|
||||||
if (!_cacheJar.canWrite()){ // can't write this..don't bother with cache
|
|
||||||
_cacheJar = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getCacheDirectory()
|
protected String getCacheDirectory()
|
||||||
|
@ -4529,13 +4545,20 @@ public final class DataStore
|
||||||
{
|
{
|
||||||
if (_tracingOn) {
|
if (_tracingOn) {
|
||||||
_traceFileHandle = new File(logDir, ".dstoreTrace"); //$NON-NLS-1$
|
_traceFileHandle = new File(logDir, ".dstoreTrace"); //$NON-NLS-1$
|
||||||
try
|
if (_traceFileHandle.canWrite()){
|
||||||
{
|
try
|
||||||
_traceFile = new RandomAccessFile(_traceFileHandle, "rw"); //$NON-NLS-1$
|
{
|
||||||
startTracing();
|
_traceFile = new RandomAccessFile(_traceFileHandle, "rw"); //$NON-NLS-1$
|
||||||
|
startTracing();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// turn tracing off if there's a problem
|
||||||
|
_tracingOn = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
else {
|
||||||
{
|
_tracingOn = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
* David McKnight (IBM) - [305272] [dstore][multithread] log close in ServerLogger
|
* David McKnight (IBM) - [305272] [dstore][multithread] log close in ServerLogger
|
||||||
* David McKnight (IBM) - [283613] [dstore] Create a Constants File for all System Properties we support
|
* David McKnight (IBM) - [283613] [dstore] Create a Constants File for all System Properties we support
|
||||||
* Noriaki Takatsu (IBM) - [341578] [dstore] ServerLogger is looped when IOError happens
|
* Noriaki Takatsu (IBM) - [341578] [dstore] ServerLogger is looped when IOError happens
|
||||||
|
* David McKnight (IBM) - [351993] [dstore] not able to connect to server if .eclipse folder not available
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.dstore.core.server;
|
package org.eclipse.dstore.core.server;
|
||||||
|
@ -90,7 +91,9 @@ public class ServerLogger implements IServerLogger
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Just use logging defaults: log_level = 0, log to file
|
// Just use logging defaults: log_level = 0, log to file
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
|
logToFile = false;
|
||||||
|
_logFileStream = new PrintWriter(System.out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,10 +104,20 @@ public class ServerLogger implements IServerLogger
|
||||||
if (logToFile) {
|
if (logToFile) {
|
||||||
try {
|
try {
|
||||||
File _logFile = getLogFile("rsecomm"); //$NON-NLS-1$
|
File _logFile = getLogFile("rsecomm"); //$NON-NLS-1$
|
||||||
_logFileStream = new PrintWriter(new FileOutputStream(_logFile));
|
if (_logFile != null && _logFile.canWrite()){
|
||||||
|
_logFileStream = new PrintWriter(new FileOutputStream(_logFile));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log_level = 0;
|
||||||
|
logToFile = false;
|
||||||
|
_logFileStream = new PrintWriter(System.out);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("Error opening log file " + logPathName + "rsecomm.log"); //$NON-NLS-1$ //$NON-NLS-2$
|
System.out.println("Error opening log file " + logPathName + "rsecomm.log"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
log_level = 0;
|
||||||
|
logToFile = false;
|
||||||
|
_logFileStream = new PrintWriter(System.out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue