1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to you under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# For those expressions that start with "new <something>Exception", pre-append
# a try block
/new[[:space:]]*[a-zA-Z]*Exception/i\
try {
# For those expressions that start with "new ClientMessageId", pre-append
# a try block and create a SqlException to complete the expression
/^[[:space:]]*new ClientMessageId.*/i\
try { \
testException = new SqlException(null,
# At the end of each statement, check and print out an error
# if there is a problem
/;/a\
} catch ( Throwable t ) { \
// We can get this on an assertion failure \
t.printStackTrace(); \
} \
if ( testException.getMessage().startsWith("UNKNOWN") ) {\
testException.printStackTrace(); \
System.err.println("FAILURE: message id was not found"); \
}
#
# Calling super is the same as new SqlException for subclasses...
#
/super(/i\
try { \
testException = new SqlException(
s/super(//
#
# Add substitution for various message parameters where you replace
# the variable with a string containing the variable. This prevents
# compile errors saying "symbol not found"
#
s/[([:space:]]logWriter,/null,/g
s/[([:space:]]logWriter_,/null,/g
s/fileName/"fileName"/g
s/[[:space:]]e.getMessage()/"e.getMessage"/g
s/Configuration.packageNameForDNC/"Configuration.packageNameForDNC"/g
s/Configuration.dncDriverName/"Configuration.dncDriverName"/g
s/[^\.]packageNameForDNC/"packageNameForDNC"/g
s/source,/"source",/g
s/Types.getTypeString([^)]*)/"targetType"/g
s/encoding/"encoding"/g
s/source.getClass().getName()/"source"/g
s/e.getException()/new Exception("foo")/g
s/[[:space:]]e);/ testException);/g
s/[[:space:]]ae/ testException/g
s/{ae/{testException/g
s/[[:space:]]e.getClass().getName()/ "exceptionClassName"/g
s/{e.getClass().getName()/{"exceptionClassName"/g
s/[[:space:]]sourceType/ "sourceType"/g
s/[[:space:]]targetType/ "targetType"/g
s/[[:space:]]columnName)/ "columnName")/g
s/[[:space:]]charsetName/ "charsetName"/g
s/[[:space:]]cursorName/ "cursorName"/g
s/[[:space:]]cursorName/ "cursorName"/g
s/[[:space:]]methodName/ "methodName"/g
s/[[:space:]]interfaces/ "interfaces"/g
s/[[:space:]]method/ "method"/g
s/[[:space:]]instance/ "instance"/g
s/[[:space:]]method)/ "method")/g
s/[[:space:]]b.toString()/ "bytes"/g
s/[[:space:]]jdbcInterfaceName/ "jdbcInterfaceName"/g
s/[[:space:]]jdbcStatementInterfaceName/ "jdbcInterfaceName"/g
s/[[:space:]]name)/ "name")/g
s/[[:space:]]sql)/ "sql")/g
s/cause.getMessage()/testException.getMessage()/g
s/cause));/testException);/g
s/netConnection.databaseName_));/"netcondbname");/g
s/value));/"value");/g
s/GGRP"));/GGRP");/g
s/[[:space:]]e));/ testException);/g
s/[[:space:]]server/ "server"/
s/codpnt/"codpnt"/g
s/[[:space:]]codePoint/ "codePoint"/g
s/conversationProtocolErrorCode/"conerr"/g
s/[[:space:]]rdbnam/ "rdbnam"/g
s/[[:space:]]manager/ "manager"/g
s/[[:space:]]level));/ "level");/g
s/[[:space:]]operation/ "operation"/g
s/[[:space:]]attributeString/ "attributeString"/g
s/[[:space:]]attribute/ "attributeString"/g
s/[[:space:]]value/ "string"/g
s/[[:space:]]choicesStr/ "string"/g
s/[[:space:]]url/ "string"/g
s/[[:space:]]fp\.getFirstKey()/ "string"/g
s/[[:space:]]fp\.getFirstValue()/ "string"/g
s/,uee/,testException/g
s/[[:space:]]platform/ "string"/g
s/parsePKGNAMCT"))/parsePKGNAMCT")/
s/[[:space:]]identifier/ "string"/g
s/[[:space:]]arg2))/ "arg2")/g
s/[[:space:]]arg1/ "string"/g
s/[[:space:]]exceptionsOnXA/ testException/g
s/[[:space:]]getXAFuncStr(.*)/ "string"/g
s/[[:space:]]getXAExceptionText(.*)/ "string"/g
s/agent_.logWriter_,/ null,/g
s/NO_CURRENT_CONNECTION)),/NO_CURRENT_CONNECTION),/g
s/parseSQLDIAGSTT"))/parseSQLDIAGSTT")/g
s/parseSQLDIAGCN"))/parseSQLDIAGCN")/g
s/parseSQLDCTOKS"))/parseSQLDCTOKS")/g
s/parseSQLDCXGRP"))/parseSQLDCXGRP")/g
s/Integer.toString(port)/"port"/g
#
# Deal with extra updateCounts argument to BatchUpdateExceptoins.
# This is a bit of a hack, but turn them into a Throwable. Otherwise
# the SqlException code thinks its another Object argument to the
# message and we get a runtime assertion error
s/updateCounts/(Throwable)null/g
#
# Subsitute Long and Integer params with 0 as a default
#
s/new Long[[:space:]]*([^)]*/new Long(0/g
s/new Integer[[:space:]]*([^)]*/new Integer(0/g
s/Integer.toHexString[[:space:]]*([^)]*/Integer.toHexString(0/g
# Get rid of logWriter
#s/new SqlException[[:space:]]*(.*,/new SqlException(null,/g
# Don't throw, just assign
s/throw new/testException = new/g
# There are some odd situations where there is one too many parens
s/)))/))/g
|