opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java
@@ -56,7 +56,6 @@ import java.util.HashSet; import java.util.Set; import java.util.EnumSet; import java.util.Hashtable; import java.util.regex.Matcher; import java.util.regex.Pattern; opends/src/build-tools/org/opends/build/tools/MessagePropertyKey.java
@@ -213,7 +213,7 @@ * @return name of message descriptor */ public String getMessageDescriptorName() { return new StringBuffer() return new StringBuilder() .append(this.severity.messageDesciptorName()) .append("_") .append(this.description).toString(); opends/src/guitools/org/opends/guitools/statuspanel/StatusLog.java
@@ -77,7 +77,7 @@ } static private String getInitialLogRecord() { StringBuffer sb = new StringBuffer() StringBuilder sb = new StringBuilder() .append("Status application launched " + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG). opends/src/quicksetup/org/opends/quicksetup/QuickSetupLog.java
@@ -113,7 +113,7 @@ static private String getInitialLogRecord() { // Note; currently the logs are not internationalized. StringBuffer sb = new StringBuffer() StringBuilder sb = new StringBuilder() .append("QuickSetup application launched " + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG). opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -855,7 +855,7 @@ String[] args = new String[argList.size()]; argList.toArray(args); StringBuffer cmd = new StringBuffer(); StringBuilder cmd = new StringBuilder(); for (String s : argList) { if (cmd.length() > 0) opends/src/quicksetup/org/opends/quicksetup/upgrader/RemoteBuildManager.java
@@ -325,7 +325,7 @@ Build build = parseBuildLine(line); builds.add(build); } catch (IllegalArgumentException iae) { StringBuffer msg = new StringBuffer() StringBuilder msg = new StringBuilder() .append("Error parsing line '") .append(line) .append("': ") @@ -367,7 +367,7 @@ if (displayName == null || downloadUrlString == null || categoryString == null) { StringBuffer msg = new StringBuffer() StringBuilder msg = new StringBuilder() .append("Line '") .append(line) .append("' is incomplete or is not correctly delimited") @@ -378,7 +378,7 @@ try { downloadUrl = new URL(downloadUrlString); } catch (MalformedURLException e) { StringBuffer msg = new StringBuffer() StringBuilder msg = new StringBuilder() .append("URL '") .append(downloadUrlString) .append("' is invalid"); @@ -386,7 +386,7 @@ } category = Build.Category.fromString(categoryString); if (category == null) { StringBuffer msg = new StringBuffer() StringBuilder msg = new StringBuilder() .append("Category '") .append(categoryString) .append("' is invalid; must be one of "); opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -517,7 +517,7 @@ public static String getStringFromCollection(Collection<String> col, String separator) { StringBuffer msg = new StringBuffer(); StringBuilder msg = new StringBuilder(); for (String m : col) { @@ -1139,7 +1139,7 @@ */ static public String listToString(List<?> list, String separator, String prefix, String suffix) { StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.size(); i++) { if (prefix != null) { sb.append(prefix); @@ -1163,7 +1163,7 @@ * @return String representing the list */ static public String stringArrayToString(String[] array, String separator) { StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < array.length; i++) { sb.append(array[i]); if (i < array.length - 1) { opends/src/server/org/opends/server/admin/client/cli/DsFrameworkCliServerGroup.java
@@ -549,7 +549,7 @@ Set<Map<ServerGroupProperty, Object>> result = adsCtx .readServerGroupRegistry(); StringBuffer buffer = new StringBuffer(); StringBuilder buffer = new StringBuilder(); // if not verbose mode, print group name (1 per line) if (! verboseArg.isPresent()) @@ -797,7 +797,7 @@ { returnCode = SUCCESSFUL; } StringBuffer buffer = new StringBuffer(); StringBuilder buffer = new StringBuilder(); for (String member : memberList) { // We shouldn't print out the "cn=" @@ -831,7 +831,7 @@ .readServerGroupRegistry(); String MemberId = listMembershipMemberNameArg.getValue(); StringBuffer buffer = new StringBuffer(); StringBuilder buffer = new StringBuilder(); for (Map<ServerGroupProperty, Object> groupProps : result) { // Get the group name; opends/src/server/org/opends/server/backends/jeb/DN2URI.java
@@ -25,17 +25,20 @@ * Portions Copyright 2006-2007 Sun Microsystems, Inc. */ package org.opends.server.backends.jeb; import org.opends.messages.Message; import com.sleepycat.je.*; import org.opends.messages.Message; import org.opends.server.core.DirectoryServer; import org.opends.server.core.SearchOperation; import org.opends.server.loggers.debug.DebugTracer; import org.opends.server.protocols.asn1.ASN1OctetString; import org.opends.server.types.Attribute; import org.opends.server.types.AttributeType; import org.opends.server.types.AttributeValue; import org.opends.server.types.ConditionResult; import org.opends.server.types.DebugLogLevel; import org.opends.server.types.DirectoryException; import org.opends.server.types.DN; import org.opends.server.types.Entry; @@ -55,8 +58,6 @@ import static org.opends.server.util.ServerConstants.ATTR_REFERRAL_URL; import static org.opends.server.loggers.debug.DebugLogger.*; import org.opends.server.loggers.debug.DebugTracer; import org.opends.server.types.DebugLogLevel; import static org.opends.messages.JebMessages. INFO_JEB_REFERRAL_RESULT_MESSAGE; /** @@ -84,10 +85,19 @@ * The standard attribute type that is used to specify the set of referral * URLs in a referral entry. */ public AttributeType referralType = private final AttributeType referralType = DirectoryServer.getAttributeType(ATTR_REFERRAL_URL); /** * A flag that indicates whether there are any referrals contained in this * database. It should only be set to {@code false} when it is known that * there are no referrals. */ private volatile ConditionResult containsReferrals = ConditionResult.UNDEFINED; /** * Create a new object representing a referral database in a given * entryContainer. * @@ -155,6 +165,7 @@ { return false; } containsReferrals = ConditionResult.TRUE; return true; } @@ -180,6 +191,7 @@ { return false; } containsReferrals = containsReferrals(txn); return true; } @@ -220,10 +232,55 @@ { return false; } containsReferrals = containsReferrals(txn); return true; } /** * Indicates whether the underlying database contains any referrals. * * @param txn The transaction to use when making the determination. * * @return {@code true} if it is believed that the underlying database may * contain at least one referral, or {@code false} if it is certain * that it doesn't. */ private ConditionResult containsReferrals(Transaction txn) { try { Cursor cursor = openCursor(txn, null); DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry(); OperationStatus status = cursor.getFirst(key, data, null); cursor.close(); if (status == OperationStatus.SUCCESS) { return ConditionResult.TRUE; } else if (status == OperationStatus.NOTFOUND) { return ConditionResult.FALSE; } else { return ConditionResult.UNDEFINED; } } catch (Exception e) { if (debugEnabled()) { TRACER.debugCaught(DebugLogLevel.ERROR, e); } return ConditionResult.UNDEFINED; } } /** * Update the referral database for an entry that has been modified. Does * not do anything unless the entry before the modification or the entry after * the modification is a referral entry. @@ -478,6 +535,16 @@ public void targetEntryReferrals(DN targetDN, SearchScope searchScope) throws DirectoryException { if (containsReferrals == ConditionResult.UNDEFINED) { containsReferrals = containsReferrals(null); } if (containsReferrals == ConditionResult.FALSE) { return; } Transaction txn = null; CursorConfig cursorConfig = null; @@ -549,6 +616,16 @@ public boolean returnSearchReferences(SearchOperation searchOp) throws DirectoryException { if (containsReferrals == ConditionResult.UNDEFINED) { containsReferrals = containsReferrals(null); } if (containsReferrals == ConditionResult.FALSE) { return true; } Transaction txn = null; CursorConfig cursorConfig = null; opends/src/server/org/opends/server/backends/jeb/ImportJob.java
@@ -98,6 +98,17 @@ new HashMap<DN, ImportContext>(); /** * The maximum number of parent ID values that we will remember. */ private static final int PARENT_ID_MAP_SIZE = 50; /** * Map of likely parent entry DNs to their entry IDs. */ private HashMap<DN,EntryID> parentIDMap = new HashMap<DN,EntryID>(PARENT_ID_MAP_SIZE); /** * The number of entries imported. */ private int importedCount; @@ -867,7 +878,7 @@ getParentWithinBase(entryDN); if (parentDN != null) { parentID = dn2id.get(txn, parentDN); parentID = getParentID(parentDN, dn2id, txn); if (parentID == null) { // Reject the entry. @@ -952,6 +963,46 @@ } /** * Retrieves the entry ID for the entry with the given DN. This will use an * in-memory hash if possible, or will go to the database if it's not in * cache. This should only be used for cacheable operations (like getting the * entry ID for the parent entry) where the same parent ID is likely to be * used multiple times. * * @param parentDN The DN of the parent entry for which to retrieve the * corresponding entry ID. * @param dn2id The handle to the dn2id database to use if the parent DN * isn't found in the local cache. * @param txn The transaction to use when interacting with the dn2id * database. * * @return The entry ID for the entry with the given DN, or {@code null} if * no such entry exists. */ private EntryID getParentID(DN parentDN, DN2ID dn2id, Transaction txn) throws DatabaseException { EntryID parentID = parentIDMap.get(parentDN); if (parentID != null) { return parentID; } parentID = dn2id.get(txn, parentDN); if (parentID != null) { if (parentIDMap.size() >= PARENT_ID_MAP_SIZE) { parentIDMap.keySet().iterator().remove(); } parentIDMap.put(parentDN, parentID); } return parentID; } /** * Get a statistic of the number of keys that reached the entry limit. * @return The number of keys that reached the entry limit. */ opends/src/server/org/opends/server/core/NetworkGroup.java
@@ -553,9 +553,9 @@ * @param leftMargin white spaces used to indent traces * @return a string buffer that contains trace information */ public StringBuffer toString(String leftMargin) public StringBuilder toString(String leftMargin) { StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder(); String newMargin = leftMargin + " "; sb.append (leftMargin + "Networkgroup (" + networkGroupID+ "\n"); opends/src/server/org/opends/server/core/NetworkGroupNamingContexts.java
@@ -128,9 +128,9 @@ * @param leftMargin white spaces used to indent traces * @return a string buffer that contains trace information */ public StringBuffer toString (String leftMargin) public StringBuilder toString (String leftMargin) { StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder(); String newMargin = leftMargin + " "; sb.append (leftMargin + "List of naming contexts:\n"); opends/src/server/org/opends/server/core/RootDseWorkflowTopology.java
@@ -162,9 +162,9 @@ * @param leftMargin white spaces used to indent the traces * @return a string buffer that contains trace information */ public StringBuffer toString(String leftMargin) public StringBuilder toString(String leftMargin) { StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder(); // display the baseDN sb.append(leftMargin + "Workflow baseDN:[ \"\" ]\n"); opends/src/server/org/opends/server/core/WorkflowTopologyNode.java
@@ -494,9 +494,9 @@ * @param leftMargin white spaces used to indent the traces * @return a string buffer that contains trace information */ public StringBuffer toString(String leftMargin) public StringBuilder toString(String leftMargin) { StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder(); // display the baseDN DN baseDN = getBaseDN(); opends/src/server/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java
@@ -29,8 +29,8 @@ import java.security.MessageDigest; import java.security.SecureRandom; import java.util.Arrays; import java.util.Random; import java.util.concurrent.locks.ReentrantLock; import org.opends.messages.Message; @@ -97,7 +97,7 @@ private ReentrantLock digestLock; // The secure random number generator to use to generate the salt values. private SecureRandom random; private Random random; @@ -140,7 +140,7 @@ digestLock = new ReentrantLock(); random = new SecureRandom(); random = new Random(); } opends/src/server/org/opends/server/extensions/SaltedSHA1PasswordStorageScheme.java
@@ -29,8 +29,8 @@ import java.security.MessageDigest; import java.security.SecureRandom; import java.util.Arrays; import java.util.Random; import java.util.concurrent.locks.ReentrantLock; import org.opends.messages.Message; @@ -97,7 +97,7 @@ private ReentrantLock digestLock; // The secure random number generator to use to generate the salt values. private SecureRandom random; private Random random; @@ -138,7 +138,7 @@ } digestLock = new ReentrantLock(); random = new SecureRandom(); random = new Random(); } @@ -536,7 +536,7 @@ throws DirectoryException { byte[] saltBytes = new byte[NUM_SALT_BYTES]; new SecureRandom().nextBytes(saltBytes); new Random().nextBytes(saltBytes); byte[] passwordPlusSalt = new byte[passwordBytes.length + NUM_SALT_BYTES]; System.arraycopy(passwordBytes, 0, passwordPlusSalt, 0, opends/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageScheme.java
@@ -29,8 +29,8 @@ import java.security.MessageDigest; import java.security.SecureRandom; import java.util.Arrays; import java.util.Random; import java.util.concurrent.locks.ReentrantLock; import org.opends.messages.Message; @@ -98,7 +98,7 @@ private ReentrantLock digestLock; // The secure random number generator to use to generate the salt values. private SecureRandom random; private Random random; @@ -141,7 +141,7 @@ digestLock = new ReentrantLock(); random = new SecureRandom(); random = new Random(); } opends/src/server/org/opends/server/extensions/SaltedSHA384PasswordStorageScheme.java
@@ -29,8 +29,8 @@ import java.security.MessageDigest; import java.security.SecureRandom; import java.util.Arrays; import java.util.Random; import java.util.concurrent.locks.ReentrantLock; import org.opends.messages.Message; @@ -98,7 +98,7 @@ private ReentrantLock digestLock; // The secure random number generator to use to generate the salt values. private SecureRandom random; private Random random; @@ -141,7 +141,7 @@ digestLock = new ReentrantLock(); random = new SecureRandom(); random = new Random(); } opends/src/server/org/opends/server/extensions/SaltedSHA512PasswordStorageScheme.java
@@ -29,8 +29,8 @@ import java.security.MessageDigest; import java.security.SecureRandom; import java.util.Arrays; import java.util.Random; import java.util.concurrent.locks.ReentrantLock; import org.opends.messages.Message; @@ -98,7 +98,7 @@ private ReentrantLock digestLock; // The secure random number generator to use to generate the salt values. private SecureRandom random; private Random random; @@ -140,7 +140,7 @@ } digestLock = new ReentrantLock(); random = new SecureRandom(); random = new Random(); } @@ -538,7 +538,7 @@ throws DirectoryException { byte[] saltBytes = new byte[NUM_SALT_BYTES]; new SecureRandom().nextBytes(saltBytes); new Random().nextBytes(saltBytes); byte[] passwordPlusSalt = new byte[passwordBytes.length + NUM_SALT_BYTES]; System.arraycopy(passwordBytes, 0, passwordPlusSalt, 0, opends/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
@@ -138,7 +138,7 @@ public static String formatStackTrace(Throwable t, int maxDepth, boolean includeCause) { StringBuffer buffer= new StringBuffer(); StringBuilder buffer= new StringBuilder(); while(t != null) { @@ -191,7 +191,7 @@ public static String formatStackTrace(StackTraceElement[] stackTrace, int maxDepth) { StringBuffer buffer= new StringBuffer(); StringBuilder buffer= new StringBuilder(); if (stackTrace != null) { int frameLimit= Math.min(maxDepth, stackTrace.length); opends/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java
@@ -921,7 +921,7 @@ private String buildDefaultEntryMessage(Object[] args) { StringBuffer format = new StringBuffer(); StringBuilder format = new StringBuilder(); for (int i = 0; i < args.length; i++) { if (i != 0) format.append(", "); opends/src/server/org/opends/server/types/DN.java
@@ -29,17 +29,17 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import org.opends.messages.Message; import org.opends.server.core.DirectoryServer; import org.opends.server.loggers.debug.DebugTracer; import org.opends.server.protocols.asn1.ASN1OctetString; import static org.opends.messages.SchemaMessages.*; import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.loggers.debug.DebugLogger.*; import org.opends.server.loggers.debug.DebugTracer; import static org.opends.messages.SchemaMessages.*; import org.opends.messages.Message; import static org.opends.server.util.StaticUtils.*; @@ -148,7 +148,7 @@ * @param rdnComponents The set of RDN components that make up * this DN. */ public DN(ArrayList<RDN> rdnComponents) public DN(List<RDN> rdnComponents) { if ((rdnComponents == null) || rdnComponents.isEmpty()) { @@ -491,14 +491,14 @@ // A null or empty DN is acceptable. if (dnString == null) { return new DN(new ArrayList<RDN>(0)); return NULL_DN; } byte[] dnBytes = dnString.value(); int length = dnBytes.length; if (length == 0) { return new DN(new ArrayList<RDN>(0)); return NULL_DN; } @@ -527,7 +527,7 @@ // This means that the DN was completely comprised of spaces // and therefore should be considered the same as a null or // empty DN. return new DN(new ArrayList<RDN>(0)); return NULL_DN; } else { @@ -541,7 +541,7 @@ // components. boolean allowExceptions = DirectoryServer.allowAttributeNameExceptions(); ArrayList<RDN> rdnComponents = new ArrayList<RDN>(); LinkedList<RDN> rdnComponents = new LinkedList<RDN>(); while (true) { StringBuilder attributeName = new StringBuilder(); @@ -885,13 +885,13 @@ // A null or empty DN is acceptable. if (dnString == null) { return new DN(new ArrayList<RDN>(0)); return NULL_DN; } int length = dnString.length(); if (length == 0) { return new DN(new ArrayList<RDN>(0)); return NULL_DN; } @@ -907,7 +907,7 @@ // This means that the DN was completely comprised of spaces // and therefore should be considered the same as a null or // empty DN. return new DN(new ArrayList<RDN>(0)); return NULL_DN; } else { @@ -921,7 +921,7 @@ // components. boolean allowExceptions = DirectoryServer.allowAttributeNameExceptions(); ArrayList<RDN> rdnComponents = new ArrayList<RDN>(); LinkedList<RDN> rdnComponents = new LinkedList<RDN>(); while (true) { StringBuilder attributeName = new StringBuilder(); @@ -2675,6 +2675,11 @@ StringBuilder hexChars) throws DirectoryException { if (hexChars.length() == 0) { return; } try { byte[] hexBytes = hexStringToByteArray(hexChars.toString()); opends/src/server/org/opends/server/types/Entry.java
@@ -5447,9 +5447,10 @@ // Next, the set of objectclasses. final boolean typesOnly = exportConfig.typesOnly(); if (exportConfig.includeObjectClasses()) { if (exportConfig.typesOnly()) if (typesOnly) { StringBuilder ocLine = new StringBuilder("objectClass:"); writeLDIFLine(ocLine, writer, wrapLines, wrapColumn); @@ -5490,7 +5491,7 @@ continue; } if (exportConfig.typesOnly()) if (typesOnly) { StringBuilder attrName = new StringBuilder(a.getName()); for (String o : a.getOptions()) @@ -5552,7 +5553,7 @@ continue; } if (exportConfig.typesOnly()) if (typesOnly) { StringBuilder attrName = new StringBuilder(a.getName()); for (String o : a.getOptions()) @@ -5620,7 +5621,7 @@ { for (Attribute a : suppressedAttributes.get(t)) { if (exportConfig.typesOnly()) if (typesOnly) { StringBuilder attrName = new StringBuilder(a.getName()); for (String o : a.getOptions()) opends/src/server/org/opends/server/types/FilePermission.java
@@ -539,6 +539,17 @@ } // If we're running Java 6, then we'll use the methods that Java // provides. Even though it's potentially less fine-grained on a // UNIX-based system, it is more efficient and doesn't require an // external process. if ((setReadableMethod != null) && (setWritableMethod != null) && (setExecutableMethod != null)) { return setUsingJava(f, p); } // If it's a UNIX-based system, then try using the chmod command // to set the permissions. Otherwise (or if that fails), then try // to use the Java 6 API. @@ -550,12 +561,6 @@ // FIXME -- Consider using cacls on Windows. if ((setReadableMethod != null) && (setWritableMethod != null) && (setExecutableMethod != null)) { return setUsingJava(f, p); } // We have no way to set file permissions on this system. return false; opends/src/server/org/opends/server/util/StaticUtils.java
@@ -3262,7 +3262,7 @@ */ static public String listToString(List<?> list, String separator) { StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.size(); i++) { sb.append(list.get(i)); if (i < list.size() - 1) { opends/tests/unit-tests-testng/src/server/org/opends/server/core/NetworkGroupTest.java
@@ -591,7 +591,7 @@ if (doDump) { StringBuffer sb = networkGroup.toString(prompt); StringBuilder sb = networkGroup.toString(prompt); writeln(sb.toString()); } } opends/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java
@@ -914,7 +914,7 @@ } // dump the topology StringBuffer sb = w1.toString (""); StringBuilder sb = w1.toString (""); System.out.println (sb); } // createWorkflow_complexTopology1