Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 25146 invoked from network); 21 Nov 2007 16:02:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Nov 2007 16:02:52 -0000 Received: (qmail 81144 invoked by uid 500); 21 Nov 2007 16:02:39 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 81074 invoked by uid 500); 21 Nov 2007 16:02:39 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 81063 invoked by uid 99); 21 Nov 2007 16:02:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Nov 2007 08:02:39 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Nov 2007 16:02:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 381561A9832; Wed, 21 Nov 2007 08:02:31 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r597125 - /db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java Date: Wed, 21 Nov 2007 16:02:30 -0000 To: derby-commits@db.apache.org From: rhillegas@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071121160231.381561A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rhillegas Date: Wed Nov 21 08:02:30 2007 New Revision: 597125 URL: http://svn.apache.org/viewvc?rev=597125&view=rev Log: DERBY-3083: To fix regression introduced by DERBY-2196, do not fail server startup if derbynet.jar cannot be found. Modified: db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java Modified: db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java?rev=597125&r1=597124&r2=597125&view=diff ============================================================================== --- db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java (original) +++ db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java Wed Nov 21 08:02:30 2007 @@ -545,6 +545,7 @@ *
  • The command must be "start".
  • *
  • The customer didn't specify the -noSecurityManager flag on the startup command * line.
  • + *
  • Classes live in the jar files which we expect..
  • * */ private static boolean needsSecurityManager( NetworkServerControlImpl server, int command ) @@ -554,10 +555,28 @@ ( (System.getSecurityManager() == null) && (command == NetworkServerControlImpl.COMMAND_START) && - (!server.runningUnsecure()) + (!server.runningUnsecure()) && + (packagingLooksGood()) ); } + /** + * Return true if the server lives in the expected jar file. This + * is meant to address DERBY-3083. We expect that the URL of + * the jar which contains NetworkServerControl will end with the + * string "derbynet.jar". If this is true, then getCodeSourcePrefix() + * will return a prefix which can be substituted into the default + * server policy file and so end up granting permissions to the server jar file. + */ + private static boolean packagingLooksGood() + throws Exception + { + String derbyNetURL = NetworkServerControl.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm(); + + return derbyNetURL.endsWith( DERBYNET_JAR ); + } + + /** * Verify that all prerequisites are met before bringing up a security * manager. See DERBY-2196. If prerequisites aren't met, raise an