Merged V4.0-BUG-FIX to HEAD

35224: ALF-12038: Remove trailing JSON comma causing IE7 script error
   35226: ALF-13401 - Saving PowerPoint (mac 2011) via CIFS fails in Mac OS X Lion
   35239: ALF-13409: Further fix to deal with concurrent deletion of a user's site invitations in background
   35245: ALF-13281: Enabled use of autocomplete in IE for forms runtime. This change also allows multiple events to be attached per validation handler
   35253: ALF-13640: Fixed issues with updating task associations + added new test + fixed existing activiti-component-tests
   35271: Translation updates (fixes: ALF-13434) - based on EN r35212. (Dutch still to follow)
   35281: ALF-13227: Fix CSS for Wiki layout of nested lists
   35284: SPANISH: Update from Gloria
   35290: More debug + unit test for mac powerpoint shuffle.
   35291: Added isTemporary method
   35295: ALF-13453	: Remote Code Execution (can create reverse shell).
   - Added ability for XMLUtil parse callers to provide an  optional array of XMLFilterImpl to be used while parsing. 
   -Added secureParseXSL methods that automatically install an XMLFilterImpl that causes a parse failure if any insecure namespaces are encountered.
   35303: Fix for ALF-12444 Node Browser improvement: Index single node and remove single node from indexes
   Part of ALF-13723 SOLR does not include the same query unit tests as lucene
   35305: ALF-13723 SOLR does not include the same query unit tests as lucene
   - test template
   35306: ALF-13723 SOLR does not include the same query unit tests as lucene
   - template for creating test cores
   35323: ALF-13420: Natural sort on form option labels and improvement for CSS - specifically to address transform action in document details.
   35328: ALF-13409: Avoid concurrency issues in unit test tear downs by deleting users before sites. User deletion deletes invitations synchronously. Site deletion deletes invitations concurrently to avoid UI timeouts. The potential to access invitations that are being concurrently deleted still exists, but always did!
   35331: ALF-12126: Ensure that DND upload is disabled for users with only consumer access
   35335: ALF-13708: Merged V3.4-BUG-FIX (3.4.10) to V4.0-BUG-FIX (4.0.2)
      35235: ALF-13673: Amp-loaded duplicated mimetypes should be handled
         - Modified code to allow duplicates to replace parts of the existing mimetype definitions.
         - A warning is logged each time. 
   35336: Spanish and Dutch updates from Gloria, based on EN r35212
   35355: Merged V3.4-BUG-FIX to V4.0-BUG-FIX
      35213: ALF-13686: Merged PATCHES/V3.4.8 to V3.4-BUG-FIX
         34943: ALF-13121: Option to create users either as user1 or user1@domain.com after kerberos authentication
         - New Kerberos subsystem parameter kerberos.authentication.stripUsernameSuffix introduced
         - When true (the default) the @domain sufix will be stripped from Kerberos authenticated usernames in CIFS, SPP, WebDAV and the Web Client
         - When false, should enable a multi-domain customer to use Alfresco (says Mr Gninot)
         35096: ALF-13121: Added missing stripKerberosUsernameSuffix property to sharepointAuthenticationHandler
      35215: ALF-13065: Ensure Wiki new page save button is available on HTML edit action
      35219: ALF-11898: Fixed TinyMCE create HTML content problem for Explorer client
      35261: Translation updates based on EN r35144
      35339: AD 2008 R2, user import via LDAP fails with over 1000 users
      - Problem discovered by Community user with simple workaround
      https://forums.alfresco.com/en/viewtopic.php?f=57&t=43960&sid=5569e5cfbccb3776e11ef4a8e9d50378&p=129664#p129664
      35353: Merged V3.4 to V3.4-BUG-FIX
         35279: ALF-13713: Merged PATCHES/V3.4.8 to V3.4
            35146: Merged DEV to PATCHES/V3.4.8
               35130: ALF-13472: Webdav Does not allow a user to access spaces without read permission on parent spaces
                  Receiving of indirect lock is wrapped into AuthenticationUtil.runAs() invocation to provide a possibility of getting indirect lock for users with appropriate access rights for requested resource
         35280: ALF-10353: Internet Explorer hangs when using the object picker with a larger number of documents
         - reviewed by DD
         35318: ALF-13715: Merged HEAD to V3.4
            31743: Fixed ALF-10157: Web Form Details page for the "Selected Web Content Forms": script error appears on help button click: container.jsp (line 382)
         35341: ALF-13552: Merged V4.0 to V3.4
            35296: ALF-13453: Remote Code Execution (can create reverse shell) - Fix by Shane
            35304: ALF-13453: Extra fix to ensure xalan namespace isn't declared with global scope and can't be hijacked by an input stylesheet
            35307: ALF-13453: Duplicated extra fix to duplicate code in XSLTRenderingEngine!
      35354: Merged V3.4 to V3.4-BUG-FIX (RECORD ONLY)
         35266: Merged V3.4-BUG-FIX to V3.4
            35261: Translation updates based on EN r35144
         35334: Merged V3.4-BUG-FIX to V3.4
            35235: ALF-13673: Amp-loaded duplicated mimetypes should be handled
               - Modified code to allow duplicates to replace parts of the existing mimetype definitions.
               - A warning is logged each time. 
   35356: Merged V4.0 to V4.0-BUG-FIX
      35292: ALF-13721: Merged PATCHES/V4.0.0 to V4.0
         35240: Fix for ALF-13685 The SOLr textContent webscript is not protected by authentication and permission checks.
         35242: Fix for ALF-13685 The SOLr textContent webscript is not protected by authentication and permission checks.
         - /wcs/api/solr and /wcservice/api/solr
      35304: ALF-13453: Extra fix to ensure xalan namespace isn't declared with global scope and can't be hijacked by an input stylesheet
      35307: ALF-13453: Duplicated extra fix to duplicate code in XSLTRenderingEngine!
   35357: Merged V4.0 to V4.0-BUG-FIX (RECORD ONLY)
      35048: Merged V4.0-BUG-FIX to V4.0
         35031: Fix for ALF-12309: Script errors on site pages
      35293: Merged V4.0-BUG-FIX to V4.0
         35172: ALF-13626: category.put.json.ftl has wrong bracket
      35296: Merged V4.0-BUG-FIX to V4.0
         35295: ALF-13453: Remote Code Execution (can create reverse shell)
           - Fix by Shane


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@35359 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-04-18 09:42:39 +00:00
parent 21b5d8a41f
commit e31ea91e51
20 changed files with 789 additions and 49 deletions

View File

@@ -112,6 +112,10 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticatorBase implement
private boolean m_acceptNTLMv1 = true;
// Should we strip the @domain suffix from the Kerberos username?
private boolean m_stripKerberosUsernameSuffix = true;
// Kerberos settings
//
// Account name and password for server ticket
@@ -213,6 +217,11 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticatorBase implement
{
this.m_acceptNTLMv1 = !disallowNTLMv1;
}
public void setStripKerberosUsernameSuffix(boolean stripKerberosUsernameSuffix)
{
m_stripKerberosUsernameSuffix = stripKerberosUsernameSuffix;
}
/**
* Enable Kerbeors ticket cracking code that is required for Java5
@@ -1585,6 +1594,7 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticatorBase implement
// Check if this is a null logon
String userName = krbDetails.getUserName();
String userId = m_stripKerberosUsernameSuffix ? krbDetails.getUserName() : krbDetails.getSourceName();
if ( userName != null)
{
@@ -1602,7 +1612,7 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticatorBase implement
// Debug
if ( logger.isDebugEnabled())
logger.debug("Machine account logon, " + userName + ", as null logon");
logger.debug("Machine account logon, " + userId + ", as null logon");
}
else
{
@@ -1611,7 +1621,7 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticatorBase implement
try
{
AlfrescoClientInfo alfClient = (AlfrescoClientInfo) client;
getAuthenticationComponent().setCurrentUser( mapUserNameToPerson(krbDetails.getUserName(), true));
getAuthenticationComponent().setCurrentUser( mapUserNameToPerson(userId, true));
alfClient.setAuthenticationTicket(getAuthenticationService().getCurrentTicket() );
}
catch (AuthenticationException e)
@@ -1622,11 +1632,9 @@ public class EnterpriseCifsAuthenticator extends CifsAuthenticatorBase implement
}
// Store the full user name in the client information, indicate that this is not a guest logon
// ALF-4599: CIFS access to alfresco creates wrong users with Realm suffix
// client.setUserName( krbDetails.getSourceName());
client.setUserName( krbDetails.getUserName());
// Store the user name in the client information, indicate that this is not a guest logon
client.setUserName( userId);
client.setGuest( false);
// Indicate that the session is logged on

View File

@@ -1267,6 +1267,10 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
catch (IOException ex)
{
// Allow I/O Exceptions to pass through
if ( logger.isDebugEnabled())
{
logger.debug("Delete file error - pass through IO Exception", ex);
}
throw ex;
}
catch (Exception ex)
@@ -1526,6 +1530,15 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
}
//TODO MER Think we may need to implement, Temporary, Hidden, System, Archive
if(info.isSystem())
{
logger.debug("Set system aspect (not yet implemented)" + name);
}
if(info.isTemporary())
{
logger.debug("Set temporary aspect (not yet implemented)" + name);
}
if(info.isHidden())
{
// yes is hidden
@@ -1561,6 +1574,24 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
}
// Not yet implemented
}
if( info.hasSetFlag(FileInfo.SetFileSize))
{
if ( logger.isDebugEnabled())
{
logger.debug("Set file size" + name + info.getSize());
}
// Not yet implemented
}
if( info.hasSetFlag(FileInfo.SetMode))
{
if ( logger.isDebugEnabled())
{
logger.debug("Set Mode" + name + info.getMode());
}
// Not yet implemented - set the unix mode e.g. 777
}
// Set the creation and modified date/time
Map<QName, Serializable> auditableProps = new HashMap<QName, Serializable>(5);
@@ -2634,7 +2665,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{
if ( logger.isDebugEnabled())
{
logger.debug("Close file:" + path);
logger.debug("Close file:" + path + ", readOnly=" + file.isReadOnly() );
}
if( file instanceof PseudoNetworkFile)
@@ -2650,7 +2681,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{
if(logger.isDebugEnabled())
{
logger.debug("closeFile has delete on close set");
logger.debug("closeFile has delete on close set path:" + path);
}
try
{
@@ -2686,7 +2717,7 @@ public class ContentDiskDriver2 extends AlfrescoDiskDriver implements ExtendedD
{
if(logger.isDebugEnabled())
{
logger.debug("Got a temp network file to close");
logger.debug("Got a temp network file to close path:" + path);
}
// Some content was written to the temp file.

View File

@@ -96,6 +96,8 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.FileFilterMode;
import org.alfresco.util.FileFilterMode.Client;
import org.alfresco.util.Pair;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -2488,7 +2490,7 @@ public class ContentDiskDriverTest extends TestCase
final String FILE_NAME = "ContentDiskDriver.docx";
//final String FILE_OLD_TEMP = "._Word Work File D_1725484373.tmp";
final String FILE_NEW_TEMP = "Word Work File D_1725484373.tmp";
class TestContext
{
NodeRef testDirNodeRef;
@@ -2503,7 +2505,7 @@ public class ContentDiskDriverTest extends TestCase
ServerConfiguration scfg = new ServerConfiguration("testServer");
TestServer testServer = new TestServer("testServer", scfg);
final SrvSession testSession = new TestSrvSession(666, testServer, "test", "remoteName");
final SrvSession testSession = new TestSrvSession(666, testServer, "cifs", "remoteName");
DiskSharedDevice share = getDiskSharedDevice();
final TreeConnection testConnection = testServer.getTreeConnection(share);
final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
@@ -2694,6 +2696,8 @@ public class ContentDiskDriverTest extends TestCase
// Check that the temporary aspect has been applied.
assertTrue("temporary aspect has not been removed", !nodeService.hasAspect(testContext.testNodeRef, ContentModel.ASPECT_TEMPORARY));
assertTrue("hidden aspect has not been removed", !nodeService.hasAspect(testContext.testNodeRef, ContentModel.ASPECT_HIDDEN));
// These metadata values should be extracted.
@@ -3553,6 +3557,144 @@ public class ContentDiskDriverTest extends TestCase
tran.doInTransaction(validateCB, false, true);
} // testOpenCloseFileScenario
/**
* Test Open Close File Scenario II ALF-13401
* Open Read Only of a file already open for read/write.
*
* 1) open(readWrite)
* 2) write some content.
* 3) open(readOnly).
* 4) read some content.
* 5) close - updates the repo
*/
public void testScenarioOpenCloseFileTwo() throws Exception
{
logger.debug("start of testScenarioOpenCloseFileTwo");
ServerConfiguration scfg = new ServerConfiguration("testServer");
TestServer testServer = new TestServer("testServer", scfg);
final SrvSession testSession = new TestSrvSession(666, testServer, "test", "remoteName");
DiskSharedDevice share = getDiskSharedDevice();
final TreeConnection testConnection = testServer.getTreeConnection(share);
final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
class TestContext
{
NodeRef testDirNodeRef;
NodeRef targetNodeRef;
};
final TestContext testContext = new TestContext();
final String FILE_NAME="testScenarioOpenFileTwo.txt";
final String FILE_PATH= TEST_ROOT_DOS_PATH + "\\" + FILE_NAME;
FileOpenParams dirParams = new FileOpenParams(TEST_ROOT_DOS_PATH, 0, AccessMode.ReadOnly, FileAttribute.NTDirectory, 0);
driver.createDirectory(testSession, testConnection, dirParams);
testContext.testDirNodeRef = getNodeForPath(testConnection, TEST_ROOT_DOS_PATH);
/**
* Clean up just in case garbage is left from a previous run
*/
RetryingTransactionCallback<Void> deleteGarbageFileCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
driver.deleteFile(testSession, testConnection, FILE_PATH);
return null;
}
};
try
{
tran.doInTransaction(deleteGarbageFileCB);
}
catch (Exception e)
{
// expect to go here
}
/**
* Step 1: Now create the file through the node service and open it.
*/
logger.debug("Step 1) Create File and Open file created by node service");
RetryingTransactionCallback<Void> createFileCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
logger.debug("create file and close it immediatly");
FileOpenParams createFileParams = new FileOpenParams(FILE_PATH, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
NetworkFile dummy = driver.createFile(testSession, testConnection, createFileParams);
driver.closeFile(testSession, testConnection, dummy);
logger.debug("after create and close");
return null;
}
};
tran.doInTransaction(createFileCB, false, true);
testContext.targetNodeRef = getNodeForPath(testConnection, FILE_PATH);
FileOpenParams openRO = new FileOpenParams(FILE_PATH, FileAction.CreateNotExist, AccessMode.ReadOnly, FileAttribute.NTNormal, 0);
FileOpenParams openRW = new FileOpenParams(FILE_PATH, FileAction.CreateNotExist, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
/**
* First open - read write
*/
logger.debug("open file1 read only");
NetworkFile file1 = driver.openFile(testSession, testConnection, openRW);
assertNotNull(file1);
final String testString = "Yankee doodle went to town, riding on a donkey.";
byte[] stuff = testString.getBytes("UTF-8");
driver.writeFile(testSession, testConnection, file1, stuff, 0, stuff.length, 0);
logger.debug("open file 2 for read only");
NetworkFile file2 = driver.openFile(testSession, testConnection, openRO);
assertNotNull(file2);
assertTrue("file size is 0", file2.getFileSize() > 0);
/**
* Write Some More Content
*/
driver.writeFile(testSession, testConnection, file1, stuff, 0, stuff.length, 0);
logger.debug("first close");
driver.closeFile(testSession, testConnection, file2);
logger.debug("second close");
driver.closeFile(testSession, testConnection, file1);
logger.debug("now validate");
RetryingTransactionCallback<Void> validateCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
Map<QName,Serializable> props = nodeService.getProperties(testContext.targetNodeRef);
ContentData data = (ContentData)props.get(ContentModel.PROP_CONTENT);
assertNotNull("data is null", data);
assertEquals("data wrong length", testString.length(), data.getSize());
ContentReader reader = contentService.getReader(testContext.targetNodeRef, ContentModel.PROP_CONTENT);
String s = reader.getContentString();
assertEquals("content not written", testString, s);
return null;
}
};
tran.doInTransaction(validateCB, false, true);
} // testOpenCloseFileScenarioTwo
@@ -4774,7 +4916,198 @@ public class ContentDiskDriverTest extends TestCase
} // testScenarioLionTextEdit
/**
* Simulates a Save from Powerpoint 2011 Mac
* 0. FileA.pptx already exists.
* 1. Create new document FileA1.pptx
* 2. Delete FileA.pptx
* 3. Rename FileA1.pptx to FileA.pptx
*/
public void testScenarioMSPowerpoint2011MacSaveShuffle() throws Exception
{
logger.debug("testScenarioMSPowerpoint2011MacSaveShuffle(");
final String FILE_NAME = "FileA.pptx";
final String FILE_NEW_TEMP = "FileA1.pptx";
class TestContext
{
NetworkFile firstFileHandle;
};
final TestContext testContext = new TestContext();
final String TEST_DIR = TEST_ROOT_DOS_PATH + "\\testScenarioMSPowerpoint2011MacSaveShuffle";
ServerConfiguration scfg = new ServerConfiguration("testServer");
TestServer testServer = new TestServer("testServer", scfg);
final SrvSession testSession = new TestSrvSession(666, testServer, "cifs", "remoteName");
DiskSharedDevice share = getDiskSharedDevice();
final TreeConnection testConnection = testServer.getTreeConnection(share);
final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
/**
* Clean up just in case garbage is left from a previous run
*/
RetryingTransactionCallback<Void> deleteGarbageFileCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
driver.deleteFile(testSession, testConnection, TEST_DIR + "\\" + FILE_NAME);
return null;
}
};
/**
* Create a file in the test directory
*/
try
{
tran.doInTransaction(deleteGarbageFileCB);
}
catch (Exception e)
{
// expect to go here
}
logger.debug("0) create new file");
RetryingTransactionCallback<Void> createFileCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
/**
* Create the test directory we are going to use
*/
FileOpenParams createRootDirParams = new FileOpenParams(TEST_ROOT_DOS_PATH, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
FileOpenParams createDirParams = new FileOpenParams(TEST_DIR, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
driver.createDirectory(testSession, testConnection, createRootDirParams);
driver.createDirectory(testSession, testConnection, createDirParams);
/**
* Create the file we are going to use (FileA.pptx)
*/
FileOpenParams createFileParams = new FileOpenParams(TEST_DIR + "\\" + FILE_NAME, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
testContext.firstFileHandle = driver.createFile(testSession, testConnection, createFileParams);
assertNotNull(testContext.firstFileHandle);
driver.closeFile(testSession, testConnection, testContext.firstFileHandle);
NodeRef file1NodeRef = getNodeForPath(testConnection, TEST_DIR + "\\" + FILE_NAME);
nodeService.addAspect(file1NodeRef, ContentModel.ASPECT_VERSIONABLE, null);
return null;
}
};
tran.doInTransaction(createFileCB, false, true);
/**
* b) Save the new file
* Write ContentDiskDriverTest3.doc to the test file,
*/
logger.debug("b) write some content");
RetryingTransactionCallback<Void> writeFileCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
FileOpenParams createFileParams = new FileOpenParams(TEST_DIR + "\\" + FILE_NEW_TEMP, 0, AccessMode.ReadWrite, FileAttribute.NTNormal, 0);
testContext.firstFileHandle = driver.createFile(testSession, testConnection, createFileParams);
ClassPathResource fileResource = new ClassPathResource("filesys/ContentDiskDriverTest3.doc");
assertNotNull("unable to find test resource filesys/ContentDiskDriverTest3.doc", fileResource);
byte[] buffer= new byte[1000];
InputStream is = fileResource.getInputStream();
try
{
long offset = 0;
int i = is.read(buffer, 0, buffer.length);
while(i > 0)
{
testContext.firstFileHandle.writeFile(buffer, i, 0, offset);
offset += i;
i = is.read(buffer, 0, buffer.length);
}
}
finally
{
is.close();
}
driver.closeFile(testSession, testConnection, testContext.firstFileHandle);
return null;
}
};
tran.doInTransaction(writeFileCB, false, true);
/**
* c) delete the old file
*/
logger.debug("c) delete old file");
RetryingTransactionCallback<Void> renameOldFileCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
driver.deleteFile(testSession, testConnection, TEST_DIR + "\\" + FILE_NAME);
return null;
}
};
tran.doInTransaction(renameOldFileCB, false, true);
/**
* d) Move the new file into place, stuff should get shuffled
*/
logger.debug("d) rename new file into place");
RetryingTransactionCallback<Void> moveNewFileCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
driver.renameFile(testSession, testConnection, TEST_DIR + "\\" + FILE_NEW_TEMP, TEST_DIR + "\\" + FILE_NAME);
return null;
}
};
tran.doInTransaction(moveNewFileCB, false, true);
logger.debug("e) validate results");
/**
* Now validate everything is correct
*/
RetryingTransactionCallback<Void> validateCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
NodeRef shuffledNodeRef = getNodeForPath(testConnection, TEST_DIR + "\\" + FILE_NAME);
Map<QName, Serializable> props = nodeService.getProperties(shuffledNodeRef);
ContentData data = (ContentData)props.get(ContentModel.PROP_CONTENT);
assertNotNull("data is null", data);
assertEquals("size is wrong", 26112, data.getSize());
assertEquals("mimeType is wrong", "application/msword",data.getMimetype());
assertTrue("versionable aspect missing", nodeService.hasAspect(shuffledNodeRef, ContentModel.ASPECT_VERSIONABLE));
assertTrue("hidden aspect still applied", !nodeService.hasAspect(shuffledNodeRef, ContentModel.ASPECT_HIDDEN));
assertTrue("temporary aspect still applied", !nodeService.hasAspect(shuffledNodeRef, ContentModel.ASPECT_TEMPORARY));
return null;
}
};
tran.doInTransaction(validateCB, true, true);
} // testScenarioMSPowerpoint2011MacSaveShuffle
/**

View File

@@ -66,6 +66,11 @@ import org.apache.commons.logging.LogFactory;
* 4) close(readWrite) - does nothing. Decrements Open Count.
* 5) close(readWrite) - updates the repo.
* 6) close(readOnly) - closes read only
* <p>
* 1) open (readWrite)
* 2) open (readOnly) - file already open for read/write
* 3) close
* 4) close
*
*/
class ScenarioOpenFileInstance implements ScenarioInstance
@@ -307,7 +312,7 @@ class ScenarioOpenFileInstance implements ScenarioInstance
if(name != null && name.equalsIgnoreCase(o.getName()))
{
if(o.getMode() == OpenFileMode.READ_WRITE)
{
{
// This is an open of a read write access
if(openReadWriteCount == 0)
{
@@ -329,6 +334,15 @@ class ScenarioOpenFileInstance implements ScenarioInstance
else
{
// This is an open for read only access
if(openReadWriteCount > 0)
{
//however the file is already open for read/write
openReadWriteCount++;
logger.debug("Return already open read/write file handle from scenario:" + this);
return new ReturnValueCommand(fileHandleReadWrite);
}
if(openReadOnlyCount == 0)
{
logger.debug("Open first read only from scenario:" + this);