db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lily...@apache.org
Subject svn commit: r1074227 - in /db/derby/code/trunk/java: drda/org/apache/derby/drda/ engine/org/apache/derby/iapi/services/i18n/ engine/org/apache/derby/impl/jdbc/ engine/org/apache/derby/impl/services/bytecode/ engine/org/apache/derby/impl/sql/compile/
Date Thu, 24 Feb 2011 17:28:17 GMT
Author: lilywei
Date: Thu Feb 24 17:28:16 2011
New Revision: 1074227

URL: http://svn.apache.org/viewvc?rev=1074227&view=rev
Log:
DERBY-5062 push code assignments down to where they are used

Patch contributed by Dave Brosius <dbrosius@apache.org>

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/drda/NetServlet.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedParameterSetMetaData.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/GClass.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropSchemaNode.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/drda/NetServlet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/drda/NetServlet.java?rev=1074227&r1=1074226&r2=1074227&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/drda/NetServlet.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/drda/NetServlet.java Thu Feb 24 17:28:16
2011
@@ -85,8 +85,6 @@ public class NetServlet extends HttpServ
 		throws ServletException
 	{
 		
-		LocalizedResource langUtil = new LocalizedResource(null,null,SERVLET_PROP_MESSAGES);
-				
 		String port = config.getInitParameter("portNumber");
 		if (port != null) {
 			int p = Integer.parseInt(port);
@@ -124,6 +122,7 @@ public class NetServlet extends HttpServ
 			boolean start = Boolean.valueOf(startup).booleanValue();
 			if (start)
 			{
+                LocalizedResource langUtil = new LocalizedResource(null,null,SERVLET_PROP_MESSAGES);
 				runServer(langUtil, null, null);
 				return;
 			}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java?rev=1074227&r1=1074226&r2=1074227&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java
Thu Feb 24 17:28:16 2011
@@ -128,11 +128,11 @@ public final class MessageService {
 		//figure out client locale from input locale string
 
 		int _pos1 = localeStr.indexOf("_");		// "_" position
-		int _pos2 = localeStr.lastIndexOf("_");
 
 		Locale locale = EN;		//default locale
 		if (_pos1 != -1)
 		{
+		    int _pos2 = localeStr.lastIndexOf("_");
 			String language = localeStr.substring(0, _pos1);
 			if (_pos2 == _pos1)
 			{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedParameterSetMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedParameterSetMetaData.java?rev=1074227&r1=1074226&r2=1074227&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedParameterSetMetaData.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedParameterSetMetaData.java
Thu Feb 24 17:28:16 2011
@@ -119,15 +119,18 @@ public class EmbedParameterSetMetaData i
    		checkPosition(param);
 
 		int outparamPrecision = -1;
-		int precision = DataTypeUtilities.getPrecision(types[param - 1]);
 	   
    		if (((param == 1) && pvs.hasReturnOutputParameter()))
 		{
 			outparamPrecision = pvs.getPrecision(param);
 		}
 
-		return (outparamPrecision == -1) ? precision : outparamPrecision;
+        if (outparamPrecision == -1)
+        {
+            return DataTypeUtilities.getPrecision(types[param - 1]);
+        }
 
+		return outparamPrecision;
     }
 		
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java?rev=1074227&r1=1074226&r2=1074227&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java Thu Feb
24 17:28:16 2011
@@ -552,8 +552,8 @@ class LOBStreamControl {
     synchronized long replaceBytes (byte [] buf, long stPos, long endPos)
             throws IOException, StandardException {
         long length = getLength();
-        long finalLength = length - endPos + stPos + buf.length;
         if (isBytes) {
+            long finalLength = length - endPos + stPos + buf.length;
             if (finalLength > bufferSize) {
                 byte [] tmpBytes = dataBytes;
                 init (tmpBytes, stPos);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/GClass.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/GClass.java?rev=1074227&r1=1074226&r2=1074227&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/GClass.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/bytecode/GClass.java Thu
Feb 24 17:28:16 2011
@@ -78,8 +78,6 @@ public abstract class GClass implements 
 
 		final File classFile = new File(dir,filename);
 
-		// find the error stream
-		HeaderPrintWriter errorStream = Monitor.getStream();
 		FileOutputStream fos = null;
 		try {
 			try {
@@ -97,6 +95,8 @@ public abstract class GClass implements 
 				bytecode.getOffset(), bytecode.getLength());
 			fos.flush();
 			if (logMessage) {
+		        // find the error stream
+		        HeaderPrintWriter errorStream = Monitor.getStream();
 				errorStream.printlnWithHeader("Wrote class "+getFullName()+" to file "+classFile.toString()+".
Please provide support with the file and the following exception message: "+t);
 			}
 			fos.close();

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropSchemaNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropSchemaNode.java?rev=1074227&r1=1074226&r2=1074227&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropSchemaNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/DropSchemaNode.java
Thu Feb 24 17:28:16 2011
@@ -60,9 +60,6 @@ public class DropSchemaNode extends DDLS
 
 	public void bindStatement() throws StandardException
 	{
-		
-        LanguageConnectionContext lcc = getLanguageConnectionContext();
-        StatementContext stx = lcc.getStatementContext();
 		/* 
 		** Users are not permitted to drop
 		** the SYS or APP schemas.
@@ -80,6 +77,9 @@ public class DropSchemaNode extends DDLS
         */
         if (isPrivilegeCollectionRequired())
         {
+            LanguageConnectionContext lcc = getLanguageConnectionContext();
+            StatementContext stx = lcc.getStatementContext();
+            
             String currentUser = stx.getSQLSessionContext().getCurrentUser();
             getCompilerContext().addRequiredSchemaPriv(schemaName, 
                 currentUser,



Mime
View raw message