You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jon Stevens <jo...@latchkey.com> on 2001/04/11 03:50:15 UTC

Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm GenericPrincipal.java JDBCRealm.java LocalStrings.properties MemoryRealm.java RealmBase.java

on 4/10/01 6:46 PM, "craigmcc@apache.org" <cr...@apache.org> wrote:

> +
>      /**
> +     * Close any database connection that is currently open.
> +     */
> +    protected void close() {
> +
> +        // Do nothing if the database connection is already closed
> +        if (dbConnection == null)
> +            return;
> +
> +        // Close our prepared statements (if any)
> +        try {
> +            preparedCredentials.close();
> +        } catch (Throwable f) {
> +            ;
> +        }
> +        try {
> +            preparedRoles.close();
> +        } catch (Throwable f) {
> +            ;
> +        }
> +
> +        // Close this database connection, and log any errors
> +        try {
> +            dbConnection.close();
> +        } catch (SQLException e) {
> +            log(sm.getString("jdbcRealm.close"), e); // Just log it here
> +        }
> +
> +        // Release resources associated with the closed connection
> +        dbConnection = null;
> +        preparedCredentials = null;
> +        preparedRoles = null;
> +
> +    }

Craig, does this mean you (finally) aren't using tabs anymore? :-)

-jon


Re: cvs commit:

Posted by Nick Bauman <ni...@cortexity.com>.
Yeah, I don't see what the big wup is about formatting. We run a beautifier 
against all commits to CVS. Works great and no more "format" wars.

> on 4/10/01 6:46 PM, "craigmcc@apache.org" <cr...@apache.org> wrote:
>> +
>>      /**
>> +     * Close any database connection that is currently open.
>> +     */
>> +    protected void close() {
>> +
>> +        // Do nothing if the database connection is already closed + 
>>       if (dbConnection == null)
>> +            return;
>> +
>> +        // Close our prepared statements (if any)
>> +        try {
>> +            preparedCredentials.close();
>> +        } catch (Throwable f) {
>> +            ;
>> +        }
>> +        try {
>> +            preparedRoles.close();
>> +        } catch (Throwable f) {
>> +            ;
>> +        }
>> +
>> +        // Close this database connection, and log any errors
>> +        try {
>> +            dbConnection.close();
>> +        } catch (SQLException e) {
>> +            log(sm.getString("jdbcRealm.close"), e); // Just log it
>> here +        }
>> +
>> +        // Release resources associated with the closed connection + 
>>       dbConnection = null;
>> +        preparedCredentials = null;
>> +        preparedRoles = null;
>> +
>> +    }
> 
> Craig, does this mean you (finally) aren't using tabs anymore? :-)
> Craig, does this mean you (finally) aren't using tabs anymore? :-)
> -jon


-- 
Nick Bauman
Software Developer
3023 Lynn #22
Minneapolis, MN
55416
Mobile Phone: (612) 810-7406


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm GenericPrincipal.java JDBCRealm.java LocalStrings.properties MemoryRealm.java RealmBase.java

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 10 Apr 2001, Jon Stevens wrote:

> on 4/10/01 6:46 PM, "craigmcc@apache.org" <cr...@apache.org> wrote:
> 
> > +
> >      /**
> > +     * Close any database connection that is currently open.
> > +     */
> > +    protected void close() {
> > +
> > +        // Do nothing if the database connection is already closed
> > +        if (dbConnection == null)
> > +            return;
> > +
> > +        // Close our prepared statements (if any)
> > +        try {
> > +            preparedCredentials.close();
> > +        } catch (Throwable f) {
> > +            ;
> > +        }
> > +        try {
> > +            preparedRoles.close();
> > +        } catch (Throwable f) {
> > +            ;
> > +        }
> > +
> > +        // Close this database connection, and log any errors
> > +        try {
> > +            dbConnection.close();
> > +        } catch (SQLException e) {
> > +            log(sm.getString("jdbcRealm.close"), e); // Just log it here
> > +        }
> > +
> > +        // Release resources associated with the closed connection
> > +        dbConnection = null;
> > +        preparedCredentials = null;
> > +        preparedRoles = null;
> > +
> > +    }
> 
> Craig, does this mean you (finally) aren't using tabs anymore? :-)
> 

I haven't been using tabs for quite a long while :-), although when
temporarily borrowing someone else's computer to do edits they might sneak
in.

You'll note that all the modified code above is nicely lined up, courtesy
of emacs being set to change tabs to spaces.

> -jon
> 
> 


Re: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by Kief Morris <ki...@bitbull.com>.
cmanolache@yahoo.com typed the following on 09:11 AM 4/12/2001 -0700
>Changing a file from 09 ( TAB ) to spaces ( or reverse ) is _bad_, it is
>(IMHO)  lack of respect for the people who wrote the original code.  

I take your point about respect for the people who wrote the original code,
(and the other developers working on it) which is why I brought it up  - not 
because I wanted to resurrect an old holy war on an extremely dull topic. 

The only files I'm changing are the ones I'm doing a lot of work on, the 
session classes in Catalina 4. The original author, Craig has said he doesn't 
mind. I have no interest in mucking with any other files, I can deal with whatever
spacing they already have.

Anyway, I don't want to carry this thread on, but figured I ought to justify
the changes I made, and reassure that I'm not going to go nuts mangling
other files.

Kief


RE: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by T J Morgan <tm...@cinci.rr.com>.
I believe this topic has been hashed out enough.  Can we move on.

Todd


-----Original Message-----
From: cmanolache@yahoo.com [mailto:cmanolache@yahoo.com]
Sent: Thursday, April 12, 2001 12:11 PM
To: tomcat-dev@jakarta.apache.org
Subject: Re: Tabs vs. spaces (was: cvs commit: blah blah blah)



Please, don't start this ( again ). You can read the archives ( every six
months some smart people ask this question ), or check other mailing lists
for the same question.

Use whatever other people are using in that project. In tomcat you'll
notice the 4 space indentation, and 09 ( TAB ) is  used in many
(most) files.

Changing a file from 09 ( TAB ) to spaces ( or reverse ) is _bad_, it is
(IMHO)  lack of respect for the people who wrote the original code.

It may be better to use only spaces for new code you write - but at least
in tomcat this is not required ( I do use 09 in most code I write for
example, and so far nobody -1 a commit I made for this reason ).

Costin





On Thu, 12 Apr 2001, Kief Morris wrote:

> Jon Stevens typed the following on 06:50 PM 4/10/2001 -0700
> >
> >Craig, does this mean you (finally) aren't using tabs anymore? :-)
> >
>
> So, are spaces kosher? The Sun coding standards document (which is the
> official Jakarta guideline?) says either is OK, but the mixed tabs and
spaces
> format I've found in the Catalina code I've mucked with is a PITA. Can I
just
> set my editor to use 4 spaces for tabs and reformat files I work with
> accordingly, without spawning a jihad?
>
> Kief
>


Re: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by cm...@yahoo.com.
Please, don't start this ( again ). You can read the archives ( every six
months some smart people ask this question ), or check other mailing lists
for the same question.

Use whatever other people are using in that project. In tomcat you'll
notice the 4 space indentation, and 09 ( TAB ) is  used in many
(most) files.

Changing a file from 09 ( TAB ) to spaces ( or reverse ) is _bad_, it is
(IMHO)  lack of respect for the people who wrote the original code.  

It may be better to use only spaces for new code you write - but at least
in tomcat this is not required ( I do use 09 in most code I write for
example, and so far nobody -1 a commit I made for this reason ). 

Costin





On Thu, 12 Apr 2001, Kief Morris wrote:

> Jon Stevens typed the following on 06:50 PM 4/10/2001 -0700
> >
> >Craig, does this mean you (finally) aren't using tabs anymore? :-)
> >
> 
> So, are spaces kosher? The Sun coding standards document (which is the
> official Jakarta guideline?) says either is OK, but the mixed tabs and spaces
> format I've found in the Catalina code I've mucked with is a PITA. Can I just
> set my editor to use 4 spaces for tabs and reformat files I work with
> accordingly, without spawning a jihad?
> 
> Kief
> 


Re: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/12/01 8:43 AM, "Kief Morris" <ki...@bitbull.com> wrote:

> So, are spaces kosher? The Sun coding standards document (which is the
> official Jakarta guideline?) says either is OK, but the mixed tabs and spaces
> format I've found in the Catalina code I've mucked with is a PITA. Can I just
> set my editor to use 4 spaces for tabs and reformat files I work with
> accordingly, without spawning a jihad?
> 
> Kief

You can read what it says on the website...

<http://jakarta.apache.org/site/source.html>

-jon


Re: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 12 Apr 2001, Kief Morris wrote:

> Jon Stevens typed the following on 06:50 PM 4/10/2001 -0700
> >
> >Craig, does this mean you (finally) aren't using tabs anymore? :-)
> >
> 
> So, are spaces kosher? The Sun coding standards document (which is the
> official Jakarta guideline?) says either is OK, but the mixed tabs and spaces
> format I've found in the Catalina code I've mucked with is a PITA. Can I just
> set my editor to use 4 spaces for tabs and reformat files I work with
> accordingly, without spawning a jihad?
> 
> Kief
> 
> 

One more note on this, even if you are using spaces for indentation, the
indentation interval for Tomcat code should be four spaces.

Craig



Re: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 12 Apr 2001, Kief Morris wrote:

> Jon Stevens typed the following on 06:50 PM 4/10/2001 -0700
> >
> >Craig, does this mean you (finally) aren't using tabs anymore? :-)
> >
> 
> So, are spaces kosher? The Sun coding standards document (which is the
> official Jakarta guideline?) says either is OK, but the mixed tabs and spaces
> format I've found in the Catalina code I've mucked with is a PITA. Can I just
> set my editor to use 4 spaces for tabs and reformat files I work with
> accordingly, without spawning a jihad?
> 
> Kief
> 
> 

Spaces are definitely kosher for Tomcat code.

The coding standards document does say either is OK, and prior to about
nine months ago I didn't care (Emacs took care of the details for me when
I pressed the TAB key once).  At that point, I switched to space-fill --
but of course lots of the Catalina code preceeded that change.

If you want to change a source file that you're currently working on, I
would say go for it.  A suggestion, though, would be to do the untabify
change as a single commit (with a message like "cosmetic change only, no
functional change") so that we can still clearly identify functional
changes in the other commits.

Craig



RE: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by Nick Bauman <ni...@cortexity.com>.
My company is, for a team of about 15+ people. We use JIndent on .java
files. Works great. If it's doing damage, then it misconfigured.

> True; not using a beautifier or CVS (now we're using
> Perforce).  I find that beautifiers do more damage
> than good, but I'm happy to be enlightened; is anyone
> actually doing this in practice?
> 
> -tom
> 
> -----Original Message-----
> From: Nick Bauman [mailto:nick@cortexity.com]
> Sent: Thursday, April 12, 2001 9:34 AM
> To: tomcat-dev@jakarta.apache.org
> Subject: RE: Tabs vs. spaces (was: cvs commit: blah blah blah)
> 
> 
> This issue would be moot if you frontended your CVS checkins with a
> beautifier.
> 
>> Here's an edited version of a comment on tabs and spaces I sent to our
>> development team that might be useful.
>>
>> ---cut---
> 
> --
> Nick Bauman
> Software Developer
> 3023 Lynn #22
> Minneapolis, MN
> 55416
> Mobile Phone: (612) 810-7406


-- 
Nick Bauman
Software Developer
3023 Lynn #22
Minneapolis, MN
55416
Mobile Phone: (612) 810-7406


RE: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by Tomas Rokicki <ro...@instantis.com>.
True; not using a beautifier or CVS (now we're using
Perforce).  I find that beautifiers do more damage
than good, but I'm happy to be enlightened; is anyone
actually doing this in practice?

-tom

-----Original Message-----
From: Nick Bauman [mailto:nick@cortexity.com]
Sent: Thursday, April 12, 2001 9:34 AM
To: tomcat-dev@jakarta.apache.org
Subject: RE: Tabs vs. spaces (was: cvs commit: blah blah blah)


This issue would be moot if you frontended your CVS checkins with a
beautifier.

> Here's an edited version of a comment on tabs and spaces I sent to our
> development team that might be useful.
>
> ---cut---

--
Nick Bauman
Software Developer
3023 Lynn #22
Minneapolis, MN
55416
Mobile Phone: (612) 810-7406



RE: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by Nick Bauman <ni...@cortexity.com>.
This issue would be moot if you frontended your CVS checkins with a beautifier. 

> Here's an edited version of a comment on tabs and spaces I sent to our
> development team that might be useful.
> 
> ---cut---

-- 
Nick Bauman
Software Developer
3023 Lynn #22
Minneapolis, MN
55416
Mobile Phone: (612) 810-7406


RE: Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by Tomas Rokicki <ro...@instantis.com>.
Here's an edited version of a comment on tabs and spaces I sent to
our development team that might be useful.

---cut---

Okay, we've had some discussions this morning, and we've got to
deal with tabs and indentation better than we have been.

Some files are simply unviewable right now in various editors
with various settings, and it is time to clean it all up and do
it right.

First, there is a distinction between *tab stops* and *indentation*.

The tab stops define how the editor interprets a tab character in
the file---how many space-equivalents that tab character gives.

The indentation defines how many spaces a nested level should be
indented compared to the previous level.  Most editors (including
vim and emacs) use the *indentation*, not the tab stops, in
interpreting how much whitespace to introduce when the user hits
the tab key.  That is, when the user hits the tab key, some number
of spaces or tabs will be inserted to match the indentation.

Most modern editors (including emacs and vi) support both concepts.

Unfortunately, most modern programmers (including most of us)
only understand the tab stop concept.  This is broken.

Finally, many programs, printers, and so forth are hard-wired to use
8-character tab stops, and there is often no way to work around
this.

There is a clean solution.  It's simple and it's elegant and it's
easy.

The rules are as follows.

1.  Never ever set your tab stops to something other than 8.  This
    means, never do (setq tab-width 4) in emacs or set tabstop=4
    in vim.  If you do, you will create files that will be unusable
    by others.

2.  Instead, set your indentation to whatever you want, as the
    author of a file.  This is usually done with
    (setq c-basic-indent 4) in emacs, or set softtabstop=4
    in vim.  This is what you want to do, and if you do this, your
    files will work well with everyone.

3.  If you want, in your files, add a line such as

     /* -*- mode: java; c-basic-indent: 4; -*- */

    to force all other emacs users to get *your* desired indentation
    so that if they edit your files, their new lines will match your
    indentation.

4.  I would prefer that none of our source files contain any tab
    characters at all since this is what causes the files to display
    incorrectly in the different editors, but I'm not going to insist
    on this.  To do this, in emacs use (setq indent-tabs-mode nil);
    in vim use set expandtab.  If everyone does as in 1 above, there
    won't be a problem in any case.

If you encounter a file that just doesn't display properly for you,
it's probably got a mixture of tabs and spaces and your tab stop is
set differently than (one of the) authors'.  This is the crux of
the problem.  To fix this, you can set the tab stop of your editor
until it looks most proper, then untabify it (in emacs, untabify;
in vi, set expandtab) and save out the file with no tabs.  Then fix
up any remaining indentation problems by hand and check it in.

Unfortunately, the changes will be massive by perforce standards, but
it's probably best to deal with this as early as possible, set the
standard now, and totally prevent problems in the future.

For further reference, consult

http://www.jwz.org/doc/tabs-vs-spaces.html

If anyone has any questions or further discussion is needed, contact
me.

-tom

-----Original Message-----
From: Kief Morris [mailto:kief@bitbull.com]
Sent: Thursday, April 12, 2001 8:43 AM
To: tomcat-dev@jakarta.apache.org
Subject: Tabs vs. spaces (was: cvs commit: blah blah blah)


Jon Stevens typed the following on 06:50 PM 4/10/2001 -0700
>
>Craig, does this mean you (finally) aren't using tabs anymore? :-)
>

So, are spaces kosher? The Sun coding standards document (which is the
official Jakarta guideline?) says either is OK, but the mixed tabs and
spaces
format I've found in the Catalina code I've mucked with is a PITA. Can I
just
set my editor to use 4 spaces for tabs and reformat files I work with
accordingly, without spawning a jihad?

Kief



Tabs vs. spaces (was: cvs commit: blah blah blah)

Posted by Kief Morris <ki...@bitbull.com>.
Jon Stevens typed the following on 06:50 PM 4/10/2001 -0700
>
>Craig, does this mean you (finally) aren't using tabs anymore? :-)
>

So, are spaces kosher? The Sun coding standards document (which is the
official Jakarta guideline?) says either is OK, but the mixed tabs and spaces
format I've found in the Catalina code I've mucked with is a PITA. Can I just
set my editor to use 4 spaces for tabs and reformat files I work with
accordingly, without spawning a jihad?

Kief