directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1296014 - in /directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log: DefaultLog.java LogManager.java
Date Fri, 02 Mar 2012 00:49:32 GMT
Author: elecharny
Date: Fri Mar  2 00:49:32 2012
New Revision: 1296014

URL: http://svn.apache.org/viewvc?rev=1296014&view=rev
Log:
Fixed an issue in the server when we start it twice.

Modified:
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogManager.java

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java?rev=1296014&r1=1296013&r2=1296014&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/DefaultLog.java
Fri Mar  2 00:49:32 2012
@@ -20,13 +20,15 @@
 package org.apache.directory.server.core.shared.log;
 
 
+import java.io.File;
 import java.io.IOException;
+
+import org.apache.directory.server.core.api.log.InvalidLogException;
 import org.apache.directory.server.core.api.log.Log;
-import org.apache.directory.server.core.api.log.LogScanner;
 import org.apache.directory.server.core.api.log.LogAnchor;
-
+import org.apache.directory.server.core.api.log.LogScanner;
 import org.apache.directory.server.core.api.log.UserLogRecord;
-import org.apache.directory.server.core.api.log.InvalidLogException;
+import org.apache.directory.server.i18n.I18n;
 
 
 /**
@@ -52,6 +54,18 @@ public class DefaultLog implements Log
     public void init( String logFilepath, String suffix, int logBufferSize, long logFileSize
) throws IOException,
         InvalidLogException
     {
+        File logFileDir = new File( logFilepath );
+
+        if ( !logFileDir.exists() )
+        {
+            //LOG.info( "partition directory doesn't exist, creating {}", partitionsDir.getAbsolutePath()
);
+
+            if ( !logFileDir.mkdirs() )
+            {
+                throw new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
logFileDir ) );
+            }
+        }
+
         logFileManager = new DefaultLogFileManager( logFilepath, suffix );
 
         logManager = new LogManager( logFileManager );

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogManager.java?rev=1296014&r1=1296013&r2=1296014&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogManager.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/log/LogManager.java
Fri Mar  2 00:49:32 2012
@@ -20,23 +20,20 @@
 package org.apache.directory.server.core.shared.log;
 
 
+import java.io.EOFException;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.nio.ByteBuffer;
-
-import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 import java.util.zip.Adler32;
 import java.util.zip.Checksum;
 
-import java.io.IOException;
-import java.io.FileNotFoundException;
-import java.io.EOFException;
-
-import org.apache.directory.server.core.api.log.LogAnchor;
-import org.apache.directory.server.core.api.log.UserLogRecord;
 import org.apache.directory.server.core.api.log.InvalidLogException;
+import org.apache.directory.server.core.api.log.LogAnchor;
 import org.apache.directory.server.core.api.log.LogAnchorComparator;
 import org.apache.directory.server.core.api.log.LogScanner;
-
+import org.apache.directory.server.core.api.log.UserLogRecord;
 import org.apache.directory.server.i18n.I18n;
 
 
@@ -244,12 +241,6 @@ import org.apache.directory.server.i18n.
         try
         {
             reader = logFileManager.getReaderForLogFile( LogAnchor.MIN_LOG_NUMBER );
-
-            if ( reader.getLength() > LogFileRecords.LOG_FILE_HEADER_SIZE )
-            {
-                throw new InvalidLogException( I18n.err( I18n.ERR_750 ) );
-            }
-
             fileExists = true;
             currentLogFileNumber++;
         }



Mime
View raw message