[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 4 commits - binaryurp/source framework/source jurt/com sal/osl
Michael Meeks
michael.meeks at collabora.com
Mon Mar 28 21:10:53 UTC 2016
binaryurp/source/bridge.cxx | 2
binaryurp/source/writer.cxx | 32 +++++
framework/source/services/substitutepathvars.cxx | 8 -
jurt/com/sun/star/lib/uno/environments/remote/Job.java | 4
jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java | 72 +++++++++---
jurt/com/sun/star/lib/uno/environments/remote/Message.java | 37 ++++++
sal/osl/all/log.cxx | 3
sal/osl/unx/file_url.cxx | 7 -
8 files changed, 143 insertions(+), 22 deletions(-)
New commits:
commit 24f351bda04a0a6198336981c54c5438c6dad723
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Mar 28 22:08:25 2016 +0100
handle failure to expand ~ in path elements.
This can occur in some online corner-cases.
Change-Id: Id8b419179d775a21110d682ba76d8a02f45eb828
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index acead68..190ef3a 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -841,9 +841,8 @@ OUString SubstitutePathVariables::GetHomeVariableValue() const
OUString SubstitutePathVariables::GetPathVariableValue() const
{
-
OUString aRetStr;
- const char* pEnv = getenv( "PATH" );
+ const char* pEnv = getenv( "PATH" );
if ( pEnv )
{
@@ -857,9 +856,10 @@ OUString SubstitutePathVariables::GetPathVariableValue() const
do
{
OUString sToken = aPathList.getToken(0, SAL_PATHSEPARATOR, nToken);
- if (!sToken.isEmpty())
+ if (!sToken.isEmpty() &&
+ osl::FileBase::getFileURLFromSystemPath( sToken, aTmp ) ==
+ osl::FileBase::RC::E_None )
{
- osl::FileBase::getFileURLFromSystemPath( sToken, aTmp );
if ( bAppendSep )
aPathStrBuffer.appendAscii( ";" ); // Office uses ';' as path separator
aPathStrBuffer.append( aTmp );
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 742b3f5..af9abbe 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -255,20 +255,23 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
if( '~' == ustrSystemPath->buffer[0] )
{
/* check if another user is specified */
- if( ( 1 == ustrSystemPath->length ) || ( '/' == ustrSystemPath->buffer[1] ) )
+ if( ( 1 == ustrSystemPath->length ) ||
+ ( '/' == ustrSystemPath->buffer[1] ) )
{
/* osl_getHomeDir returns file URL */
oslSecurity pSecurity = osl_getCurrentSecurity();
osl_getHomeDir( pSecurity , &pTmp );
osl_freeSecurityHandle( pSecurity );
+ if (!pTmp)
+ return osl_File_E_INVAL;
+
/* remove "file://" prefix */
rtl_uString_newFromStr_WithLength( &pTmp, pTmp->buffer + 7, pTmp->length - 7 );
/* replace '~' in original string */
rtl_uString_newReplaceStrAt( &pTmp, ustrSystemPath, 0, 1, pTmp );
}
-
else
{
/* FIXME: replace ~user with users home directory */
commit ec60e33dd83b1bdec01b2c4a1dbaa15e92c9f6b5
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Jan 27 23:49:51 2016 +0100
Cleanup previous commit etc.
diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx
index 54214c3..0f0cbb2 100644
--- a/binaryurp/source/bridge.cxx
+++ b/binaryurp/source/bridge.cxx
@@ -286,7 +286,7 @@ void Bridge::terminate(bool final) {
}
w = writer_;
joinW = !isThread(writer_.get());
- assert(!final || joinW);
+ assert(!final || joinW); // horror crash here ? ....
if (joinW) {
writer_.clear();
}
diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx
index a2e2d38..80366b6 100644
--- a/binaryurp/source/writer.cxx
+++ b/binaryurp/source/writer.cxx
@@ -118,7 +118,7 @@ void Writer::queueRequest(
items_.set();
SAL_DEBUG("writer::queueRequest tid " << getAsString(tid) <<
- " type " << OUString(type.get()->pTypeName) <<
+// " type " << OUString(type.get()->pTypeName) <<
" member " << OUString(member.get()->pTypeName));
}
@@ -215,10 +215,10 @@ void Writer::sendRequest(
css::uno::UnoInterfaceReference const & currentContext)
{
SAL_DEBUG("writer::sendRequest tid " << getAsString(tid) <<
- " type " << OUString(type.get()->pTypeName) <<
+// " type " << OUString(type.get()->pTypeName) <<
" member " << OUString(member.get()->pTypeName) <<
- " cctx mode? " << currentContextMode <<
- " cur ctx " << currentContext.get());
+ " cctx mode? " << currentContextMode);
+// " cur ctx " << currentContext.get()); - currentContext ref -> null
OSL_ASSERT(tid.getLength() != 0 && !oid.isEmpty() && member.is());
css::uno::TypeDescription t(type);
commit 436745ea87a642789b5960eae7efd8d1e09eb512
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue Jan 26 17:09:53 2016 +0000
Write-queue timestamped debugging.
diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx
index 84edbd4..a2e2d38 100644
--- a/binaryurp/source/writer.cxx
+++ b/binaryurp/source/writer.cxx
@@ -35,6 +35,17 @@
#include "currentcontext.hxx"
#include "specialfunctionids.hxx"
#include "writer.hxx"
+#include <rtl/ustrbuf.hxx>
+
+namespace {
+ OUString getAsString(const rtl::ByteSequence &tid)
+ {
+ OUStringBuffer aStr;
+ for (sal_Int32 i = 0; i < tid.getLength(); ++i)
+ aStr.append((sal_Int32)tid[i], 16);
+ return aStr.makeStringAndClear();
+ }
+}
namespace binaryurp {
@@ -105,6 +116,10 @@ void Writer::queueRequest(
osl::MutexGuard g(mutex_);
queue_.push_back(Item(tid, oid, type, member, inArguments, cc));
items_.set();
+
+ SAL_DEBUG("writer::queueRequest tid " << getAsString(tid) <<
+ " type " << OUString(type.get()->pTypeName) <<
+ " member " << OUString(member.get()->pTypeName));
}
void Writer::queueReply(
@@ -119,6 +134,12 @@ void Writer::queueReply(
tid, member, setter, exception, returnValue, outArguments,
setCurrentContextMode));
items_.set();
+
+ SAL_DEBUG("writer::queueReply tid " << getAsString(tid) <<
+ " member " << OUString(member.get()->pTypeName) <<
+ " exception? " << exception <<
+ " setter " << setter <<
+ " setCurrentContextMode " << setCurrentContextMode);
}
void Writer::unblock() {
@@ -193,6 +214,12 @@ void Writer::sendRequest(
std::vector< BinaryAny > const & inArguments, bool currentContextMode,
css::uno::UnoInterfaceReference const & currentContext)
{
+ SAL_DEBUG("writer::sendRequest tid " << getAsString(tid) <<
+ " type " << OUString(type.get()->pTypeName) <<
+ " member " << OUString(member.get()->pTypeName) <<
+ " cctx mode? " << currentContextMode <<
+ " cur ctx " << currentContext.get());
+
OSL_ASSERT(tid.getLength() != 0 && !oid.isEmpty() && member.is());
css::uno::TypeDescription t(type);
sal_Int32 functionId = 0;
@@ -341,6 +368,11 @@ void Writer::sendReply(
bool exception, BinaryAny const & returnValue,
std::vector< BinaryAny > const & outArguments)
{
+ SAL_DEBUG("writer::sendReply tid " << getAsString(tid) <<
+ " member " << OUString(member.get()->pTypeName) <<
+ " exception? " << exception <<
+ " setter " << setter);
+
OSL_ASSERT(tid.getLength() != 0 && member.is() && member.get()->bComplete);
std::vector< unsigned char > buf;
bool newTid = tid != lastTid_;
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index 67e384c..c62b1e0 100644
--- a/sal/osl/all/log.cxx
+++ b/sal/osl/all/log.cxx
@@ -240,6 +240,9 @@ void log(
syslog(prio, "%s", s.str().c_str());
#endif
} else {
+ TimeValue pTime = { 0, 0 };
+ osl_getSystemTime(&pTime);
+ std::fprintf(stderr, "T%ld.%.9ld - ", (long)pTime.Seconds, (long)pTime.Nanosec);
std::fputs(s.str().c_str(), stderr);
std::fflush(stderr);
}
commit 1d875b385f125542c12b3935561f5b3fef72c956
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Fri Jan 22 11:13:57 2016 +0000
Implement jurt message and job printing ...
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Job.java b/jurt/com/sun/star/lib/uno/environments/remote/Job.java
index a9cd28d..f2043f3 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/Job.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/Job.java
@@ -139,6 +139,10 @@ public class Job {
return _iMessage.isSynchronous();
}
+ public String toString() {
+ return _iMessage.toString();
+ }
+
public void dispose() {
// _oId = null;
// _iReceiver = null;
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
index 9d96476..2572c5c 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
@@ -18,6 +18,7 @@
package com.sun.star.lib.uno.environments.remote;
+import java.text.*;
import com.sun.star.lang.DisposedException;
/**
@@ -40,7 +41,7 @@ public class JobQueue {
/**
* When set to true, enables various debugging output.
*/
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = true;
protected Job _head; // the head of the job list
protected Job _tail; // the tail of the job list
@@ -62,6 +63,28 @@ public class JobQueue {
protected JavaThreadPoolFactory _javaThreadPoolFactory;
+ public static String getTime()
+ {
+ try {
+ DecimalFormat df = new DecimalFormat("000000.000000000");
+ return "T" + df.format((double)System.currentTimeMillis()/1000) + " ";
+ } catch (Exception e) {
+ return "Texcept " + e;
+ }
+ }
+
+ public static void printDebug(String str)
+ {
+ if (DEBUG)
+ {
+
+ String print = getTime() + " [" +
+ Thread.currentThread().getId() + "] " + str;
+ System.err.println(print);
+ System.err.flush();
+ }
+ }
+
/**
* A thread for dispatching jobs.
*/
@@ -71,7 +94,7 @@ public class JobQueue {
JobDispatcher(Object disposeId) {
super("JobDispatcher");
- if(DEBUG) System.err.println("JobQueue$JobDispatcher.<init>:" + _threadId);
+ if(DEBUG) printDebug("JobQueue$JobDispatcher.<init>:" + _threadId);
_disposeId = disposeId;
}
@@ -82,13 +105,13 @@ public class JobQueue {
@Override
public void run() {
- if(DEBUG) System.err.println("ThreadPool$JobDispatcher.run: " + Thread.currentThread());
+ if(DEBUG) printDebug("ThreadPool$JobDispatcher.run");
try {
enter(2000, _disposeId);
} catch(Throwable throwable) {
if(_head != null || _active) { // there was a job in progress, so give a stack
- System.err.println(getClass().getName() + " - exception occurred:" + throwable);
+ printDebug(getClass().getName() + " - exception occurred:" + throwable);
throwable.printStackTrace(System.err);
}
}
@@ -96,7 +119,7 @@ public class JobQueue {
release();
}
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".run - exit:" + _threadId);
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".run - exit:" + _threadId);
}
}
@@ -125,7 +148,7 @@ public class JobQueue {
acquire();
- if(DEBUG) System.err.println("##### " + getClass().getName() + " - init:" + _threadId);
+ if(DEBUG) printDebug("##### " + getClass().getName() + " - init:" + _threadId);
}
/**
@@ -141,7 +164,7 @@ public class JobQueue {
_createThread = createThread;
_createThread_now = createThread;
- if(DEBUG) System.err.println("##### " + getClass().getName() + " - init:" + _threadId + " " + createThread);
+ if(DEBUG) printDebug("##### " + getClass().getName() + " - init:" + _threadId + " " + createThread);
}
/**
@@ -185,7 +208,7 @@ public class JobQueue {
* @return a job or null if timed out.
*/
private Job removeJob(int waitTime) {
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId);
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId);
Job job = null;
synchronized (this) {
@@ -230,7 +253,7 @@ public class JobQueue {
synchronized(_async_jobQueue) {
// wait for async queue to be empty and last job to be done
while(_async_jobQueue._active || _async_jobQueue._head != null) {
- if(DEBUG) System.err.println("waiting for async:" + _async_jobQueue._head + " " + _async_jobQueue._worker_thread);
+ if(DEBUG) printDebug("waiting for async:" + _async_jobQueue._head + " " + _async_jobQueue._worker_thread);
if(_doDispose == _disposeId) {
_doDispose = null;
@@ -247,6 +270,9 @@ public class JobQueue {
}
}
+ if(DEBUG)
+ printDebug("##### " + getClass().getName() + ".removeJob: - returns job: " + job);
+
return job;
}
@@ -257,7 +283,23 @@ public class JobQueue {
* @param disposeId a dispose id.
*/
synchronized void putJob(Job job, Object disposeId) {
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".putJob todoes: " + " job:" + job);
+
+ boolean multipleReturns = false;
+ int count = 0;
+ for (Job i = _head; i != null; i = i._next)
+ {
+ if (i.isRequest())
+ multipleReturns = true;
+ count++;
+ }
+
+ if (multipleReturns)
+ printDebug("ERROR: MULTIPLE RETURNS");
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".putJob to queue of " + count);
+ printDebug("new job : " + job.toString());
+ for (Job i = _head; i != null; i = i._next)
+ printDebug("queued : " + i.toString());
+ printDebug("");
if(_tail != null)
_tail._next = job;
@@ -296,7 +338,7 @@ public class JobQueue {
* @return the result of the final job (reply).
*/
Object enter(int waitTime, Object disposeId) throws Throwable {
- if(DEBUG) System.err.println("#####" + getClass().getName() + ".enter: " + _threadId);
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".enter: " + _threadId);
boolean quit = false;
@@ -332,11 +374,9 @@ public class JobQueue {
}
else
quit = true;
-
-
}
finally { // ensure that this queue becomes disposed, if necessary
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".enter leaving: " + _threadId + " " + _worker_thread + " " + hold_worker_thread + " " + result);
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".enter leaving: " + _threadId + " " + _worker_thread + " " + hold_worker_thread + " " + result);
synchronized(this) {
if(job != null || (quit && _head == null)) {
@@ -356,6 +396,8 @@ public class JobQueue {
}
}
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".enter: returns " + result + " on thread: " + _threadId);
+
return result;
}
@@ -370,7 +412,7 @@ public class JobQueue {
_throwable = throwable;
// get thread out of wait and let it throw the throwable
- if(DEBUG) System.err.println(getClass().getName() + ".dispose - notifying thread");
+ if(DEBUG) printDebug(getClass().getName() + ".dispose - notifying thread");
notifyAll();
}
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Message.java b/jurt/com/sun/star/lib/uno/environments/remote/Message.java
index cfdd1f3..67803ed 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/Message.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/Message.java
@@ -173,6 +173,43 @@ public class Message {
return arguments;
}
+ public final String toString()
+ {
+ String aResult;
+ aResult = request ? "request: " : "reply: ";
+ aResult = aResult + (synchronous ? "sync " : "async ");
+ if (abnormalTermination)
+ aResult = aResult + "!abnormal! ";
+ aResult = aResult + "tid: " + threadId + " ";
+ aResult = aResult + "oid: " + objectId + " ";
+
+ if (type != null)
+ aResult = aResult + type.getTypeName() + " ";
+ else
+ aResult = aResult + "<null type> ";
+
+ if (method != null)
+ aResult = aResult + method.getName() + " ";
+ else
+ aResult = aResult + "<null method> ";
+
+ if (arguments != null)
+ {
+ aResult = aResult + "( ";
+ for (int i = 0; i < arguments.length; ++i)
+ aResult = aResult + arguments[i] + ", ";
+ aResult = aResult + ") ";
+ }
+ else
+ aResult = aResult + "<nullargs> ";
+
+ if (result != null)
+ aResult = aResult + "result " + result;
+ else
+ aResult = aResult + "<noresult> ";
+ return aResult;
+ }
+
private final ThreadId threadId;
private final boolean request;
private final String objectId;
More information about the Libreoffice-commits
mailing list