mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
15.11.2013 3755ebbca2bc019cea1633897c97b08a6bad4e71
OPENDJ-906 Upgrade: unexpected error for some tools when the server has not been upgraded
- make-ldif / encode-password / ldifsearch & ldifmodify are subject to version verification between unpack/upgrade.(They are disabled at this step).
4 files modified
52 ■■■■■ changed files
opends/src/server/org/opends/server/tools/EncodePassword.java 11 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/LDIFModify.java 15 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/LDIFSearch.java 13 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/makeldif/MakeLDIF.java 13 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/EncodePassword.java
@@ -65,6 +65,7 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.WritabilityMode;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
import org.opends.server.util.args.BooleanArgument;
@@ -313,6 +314,16 @@
      return SUCCESS;
    }
    // Checks the version - if upgrade required, the tool is unusable
    try
    {
      BuildVersion.checkVersionMismatch();
    }
    catch (InitializationException e)
    {
      err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
      return 1;
    }
    // Check for conflicting arguments.
    if (clearPassword.isPresent() && clearPasswordFile.isPresent())
opends/src/server/org/opends/server/tools/LDIFModify.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2012 ForgeRock AS
 *      Portions Copyright 2012-2013 ForgeRock AS
 */
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -51,6 +51,7 @@
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.ExistingFileBehavior;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDAPException;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.LDIFImportConfig;
@@ -59,6 +60,7 @@
import org.opends.server.types.ObjectClass;
import org.opends.server.types.RawModification;
import org.opends.server.util.AddChangeRecordEntry;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.ChangeRecordEntry;
import org.opends.server.util.DeleteChangeRecordEntry;
import org.opends.server.util.LDIFException;
@@ -71,6 +73,7 @@
import org.opends.server.util.args.StringArgument;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.tools.ToolConstants.*;
@@ -532,6 +535,16 @@
      return 0;
    }
    // Checks the version - if upgrade required, the tool is unusable
    try
    {
      BuildVersion.checkVersionMismatch();
    }
    catch (InitializationException e)
    {
      err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
      return 1;
    }
    if (! serverInitialized)
    {
opends/src/server/org/opends/server/tools/LDIFSearch.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 */
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -46,12 +47,14 @@
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.ExistingFileBehavior;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.SearchScope;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.LDIFWriter;
@@ -307,6 +310,16 @@
      return 0;
    }
    // Checks the version - if upgrade required, the tool is unusable
    try
    {
      BuildVersion.checkVersionMismatch();
    }
    catch (InitializationException e)
    {
      err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
      return 1;
    }
    // Make sure that at least one filter was provided.  Also get the attribute
    // list at the same time because it may need to be specified in the same
opends/src/server/org/opends/server/tools/makeldif/MakeLDIF.java
@@ -40,8 +40,10 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeType;
import org.opends.server.types.ExistingFileBehavior;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.NullOutputStream;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.LDIFWriter;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
@@ -244,6 +246,17 @@
      return 0;
    }
    // Checks the version - if upgrade required, the tool is unusable
    try
    {
      BuildVersion.checkVersionMismatch();
    }
    catch (InitializationException e)
    {
      err.println(wrapText(e.getMessage(), MAX_LINE_WIDTH));
      return 1;
    }
    if (initializeServer)
    {
      // Initialize the Directory Server configuration handler using the