if ( obj1 == null && pattern == null ) return true;
char c = patternStr.charAt(i); if ( c == '\\' ) {   ++i; if ( i < patternLen ) { c = patternStr.charAt( i ); if ( c == '%' || c == '_' ) buffer.append( c ); else if ( c == '\\' ) buffer.append( "\\\\"); } else { buffer.append( "\\\\" ); } } else if ( c == '%') { buffer.append(".*"); } else if ( c == '_') { buffer.append("."); }
	private static boolean like( Object obj1, Object pattern ) throws DataException	{		if ( obj1 == null || pattern == null )		{			if ( obj1 == null && pattern == null )				return true;			else				return false;		}		boolean result = false;		try		{			String patternString = pattern.toString( );			if ( pattern instanceof String )			{				// support '%' as SQL, replace all "%" with ".*"				if ( patternString.indexOf( "%" ) >= 0 )				{					patternString = patternString.replaceAll( "\\Q%\\E", ".*" );				}				result = obj1.toString( ).matches( patternString );			}			else if ( pattern instanceof NativeRegExp )			{				String testString = patternString.concat( ".test(\""						+ obj1.toString( ) + "\")" );				Context cx = Context.enter( );				try				{					Scriptable scope = cx.initStandardObjects( );					Object rlt = evaluateJSScript( cx, scope, testString, "", 0 );					if ( rlt instanceof Boolean )						result = ( (Boolean) rlt ).booleanValue( );				}				finally				{					Context.exit( );				}			}		}		catch ( RuntimeException e )		{			throw new DataException( ResourceConstants.MATCH_ERROR, e );		}				return result;	}