1 7 8 package com.sun.corba.se.impl.naming.namingutil; 9 10 import java.io.StringWriter ; 11 12 import org.omg.CORBA.DATA_CONVERSION ; 13 import org.omg.CORBA.CompletionStatus ; 14 15 import com.sun.corba.se.impl.logging.NamingSystemException; 16 import com.sun.corba.se.spi.logging.CORBALogDomains; 17 18 23 class Utility { 24 private static NamingSystemException wrapper = 25 NamingSystemException.get( CORBALogDomains.NAMING ) ; 26 27 30 static String cleanEscapes( String stringToDecode ) { 31 StringWriter theStringWithoutEscape = new StringWriter (); 32 for( int i = 0; i < stringToDecode.length(); i++ ) { 33 char c = stringToDecode.charAt( i ) ; 34 if( c != '%' ) { 35 theStringWithoutEscape.write( c ); 36 } else { 37 i++; 39 int Hex1 = hexOf( stringToDecode.charAt(i) ); 40 i++; 41 int Hex2 = hexOf( stringToDecode.charAt(i) ); 42 int value = (Hex1 * 16) + Hex2; 43 theStringWithoutEscape.write( (char) value ); 45 } 46 } 47 return theStringWithoutEscape.toString(); 48 } 49 50 55 static int hexOf( char x ) 56 { 57 int val; 58 59 val = x - '0'; 60 if (val >=0 && val <= 9) 61 return val; 62 63 val = (x - 'a') + 10; 64 if (val >= 10 && val <= 15) 65 return val; 66 67 val = (x - 'A') + 10; 68 if (val >= 10 && val <= 15) 69 return val; 70 71 throw new DATA_CONVERSION ( ); 72 } 73 74 78 static void validateGIOPVersion( IIOPEndpointInfo endpointInfo ) { 79 if ((endpointInfo.getMajor() > NamingConstants.MAJORNUMBER_SUPPORTED) || 80 (endpointInfo.getMinor() > NamingConstants.MINORNUMBERMAX ) ) 81 { 82 throw wrapper.insBadAddress() ; 83 } 84 } 85 } 86 | Popular Tags |