You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2008/06/02 11:52:54 UTC
svn commit: r662377 - in /db/derby/code/trunk/java/engine/org/apache/derby:
iapi/util/StringUtil.java impl/jdbc/EmbedConnection.java
Author: kristwaa
Date: Mon Jun 2 02:52:53 2008
New Revision: 662377
URL: http://svn.apache.org/viewvc?rev=662377&view=rev
Log:
DERBY-3531: Replaced tabs with spaces.
Patch file: derby-3531-2a-tab_replacement.diff
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java?rev=662377&r1=662376&r2=662377&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/util/StringUtil.java Mon Jun 2 02:52:53 2008
@@ -29,38 +29,38 @@
*/
public class StringUtil
{
- /**
- * Splits a string around matches of the given delimiter character.
- *
- * Where applicable, this method can be used as a substitute for
- * <code>String.split(String regex)</code>, which is not available
- * on a JSR169/Java ME platform.
- *
- * @param str the string to be split
- * @param delim the delimiter
- * @throws NullPointerException if str is null
- */
- static public String[] split(String str, char delim)
- {
- if (str == null) {
- throw new NullPointerException("str can't be null");
- }
+ /**
+ * Splits a string around matches of the given delimiter character.
+ *
+ * Where applicable, this method can be used as a substitute for
+ * <code>String.split(String regex)</code>, which is not available
+ * on a JSR169/Java ME platform.
+ *
+ * @param str the string to be split
+ * @param delim the delimiter
+ * @throws NullPointerException if str is null
+ */
+ static public String[] split(String str, char delim)
+ {
+ if (str == null) {
+ throw new NullPointerException("str can't be null");
+ }
- // Note the javadoc on StringTokenizer:
- // StringTokenizer is a legacy class that is retained for
- // compatibility reasons although its use is discouraged in
- // new code.
+ // Note the javadoc on StringTokenizer:
+ // StringTokenizer is a legacy class that is retained for
+ // compatibility reasons although its use is discouraged in
+ // new code.
// In other words, if StringTokenizer is ever removed from the JDK,
// we need to have a look at String.split() (or java.util.regex)
// if it is supported on a JSR169/Java ME platform by then.
- StringTokenizer st = new StringTokenizer(str, String.valueOf(delim));
- int n = st.countTokens();
- String[] s = new String[n];
- for (int i = 0; i < n; i++) {
- s[i] = st.nextToken();
- }
- return s;
- }
+ StringTokenizer st = new StringTokenizer(str, String.valueOf(delim));
+ int n = st.countTokens();
+ String[] s = new String[n];
+ for (int i = 0; i < n; i++) {
+ s[i] = st.nextToken();
+ }
+ return s;
+ }
/**
* Used to print out a string for error messages,
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=662377&r1=662376&r2=662377&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Mon Jun 2 02:52:53 2008
@@ -2441,67 +2441,67 @@
return (Database) Monitor.findService(Property.DATABASE_MODULE, dbname);
}
- /**
- * Checks that a user has the system privileges to create a database.
- * To perform this check the following policy grants are required
- * <ul>
- * <li> to run the encapsulated test:
- * permission javax.security.auth.AuthPermission "doAsPrivileged";
- * <li> to resolve relative path names:
- * permission java.util.PropertyPermission "user.dir", "read";
- * <li> to canonicalize path names:
- * permission java.io.FilePermission "...", "read";
- * </ul>
- * or a SQLException will be raised detailing the cause.
- * <p>
- * In addition, for the test to succeed
- * <ul>
- * <li> the given user needs to be covered by a grant:
- * principal org.apache.derby.authentication.SystemPrincipal "..." {}
- * <li> that lists a permission covering the database location:
- * permission org.apache.derby.security.DatabasePermission "directory:...", "create";
- * </ul>
- * or it will fail with a SQLException detailing the cause.
- *
- * @param user The user to be checked for database create privileges
- * @param dbname the name of the database to create
- * @throws SQLException if the privileges check fails
- */
- private void checkDatabaseCreatePrivileges(String user,
- String dbname)
- throws SQLException {
- // approve action if not running under a security manager
- if (System.getSecurityManager() == null) {
- return;
- }
- if (dbname == null) {
- throw new NullPointerException("dbname can't be null");
- }
+ /**
+ * Checks that a user has the system privileges to create a database.
+ * To perform this check the following policy grants are required
+ * <ul>
+ * <li> to run the encapsulated test:
+ * permission javax.security.auth.AuthPermission "doAsPrivileged";
+ * <li> to resolve relative path names:
+ * permission java.util.PropertyPermission "user.dir", "read";
+ * <li> to canonicalize path names:
+ * permission java.io.FilePermission "...", "read";
+ * </ul>
+ * or a SQLException will be raised detailing the cause.
+ * <p>
+ * In addition, for the test to succeed
+ * <ul>
+ * <li> the given user needs to be covered by a grant:
+ * principal org.apache.derby.authentication.SystemPrincipal "..." {}
+ * <li> that lists a permission covering the database location:
+ * permission org.apache.derby.security.DatabasePermission "directory:...", "create";
+ * </ul>
+ * or it will fail with a SQLException detailing the cause.
+ *
+ * @param user The user to be checked for database create privileges
+ * @param dbname the name of the database to create
+ * @throws SQLException if the privileges check fails
+ */
+ private void checkDatabaseCreatePrivileges(String user,
+ String dbname)
+ throws SQLException {
+ // approve action if not running under a security manager
+ if (System.getSecurityManager() == null) {
+ return;
+ }
+ if (dbname == null) {
+ throw new NullPointerException("dbname can't be null");
+ }
- // the check
- try {
- // raises IOException if dbname is non-canonicalizable
- final String url
- = (DatabasePermission.URL_PROTOCOL_DIRECTORY
- + stripSubSubProtocolPrefix(dbname));
- final Permission dp
- = new DatabasePermission(url, DatabasePermission.CREATE);
+ // the check
+ try {
+ // raises IOException if dbname is non-canonicalizable
+ final String url
+ = (DatabasePermission.URL_PROTOCOL_DIRECTORY
+ + stripSubSubProtocolPrefix(dbname));
+ final Permission dp
+ = new DatabasePermission(url, DatabasePermission.CREATE);
- factory.checkSystemPrivileges(user, dp);
- } catch (AccessControlException ace) {
- throw Util.generateCsSQLException(
- SQLState.AUTH_DATABASE_CREATE_MISSING_PERMISSION,
- user, dbname, ace);
- } catch (IOException ioe) {
- throw Util.generateCsSQLException(
- SQLState.AUTH_DATABASE_CREATE_EXCEPTION,
- dbname, (Object)ioe); // overloaded method
- } catch (Exception e) {
- throw Util.generateCsSQLException(
- SQLState.AUTH_DATABASE_CREATE_EXCEPTION,
- dbname, (Object)e); // overloaded method
- }
- }
+ factory.checkSystemPrivileges(user, dp);
+ } catch (AccessControlException ace) {
+ throw Util.generateCsSQLException(
+ SQLState.AUTH_DATABASE_CREATE_MISSING_PERMISSION,
+ user, dbname, ace);
+ } catch (IOException ioe) {
+ throw Util.generateCsSQLException(
+ SQLState.AUTH_DATABASE_CREATE_EXCEPTION,
+ dbname, (Object)ioe); // overloaded method
+ } catch (Exception e) {
+ throw Util.generateCsSQLException(
+ SQLState.AUTH_DATABASE_CREATE_EXCEPTION,
+ dbname, (Object)e); // overloaded method
+ }
+ }
/**
* Strips any sub-sub-protocol prefix from a database name.