Produced by Araxis Merge on 9/25/2018 2:13:04 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\jndi\cosnaming | IiopUrl.java | Mon Jan 22 14:46:50 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\jndi\cosnaming | IiopUrl.java | Wed Sep 12 16:27:21 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 442 |
Changed | 1 | 4 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /* | |
2 | * Copyrig ht (c) 199 9, 2011, O racle and/ or its aff iliates. A ll rights reserved. | |
3 | * DO NOT ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER. | |
4 | * | |
5 | * This co de is free software; you can r edistribut e it and/o r modify i t | |
6 | * under t he terms o f the GNU General Pu blic Licen se version 2 only, a s | |
7 | * publish ed by the Free Softw are Founda tion. Ora cle design ates this | |
8 | * particu lar file a s subject to the "Cl asspath" e xception a s provided | |
9 | * by Orac le in the LICENSE fi le that ac companied this code. | |
10 | * | |
11 | * This co de is dist ributed in the hope that it wi ll be usef ul, but WI THOUT | |
12 | * ANY WAR RANTY; wit hout even the implie d warranty of MERCHA NTABILITY or | |
13 | * FITNESS FOR A PAR TICULAR PU RPOSE. Se e the GNU General Pu blic Licen se | |
14 | * version 2 for mor e details (a copy is included in the LIC ENSE file that | |
15 | * accompa nied this code). | |
16 | * | |
17 | * You sho uld have r eceived a copy of th e GNU Gene ral Public License v ersion | |
18 | * 2 along with this work; if not, write to the Fr ee Softwar e Foundati on, | |
19 | * Inc., 5 1 Franklin St, Fifth Floor, Bo ston, MA 0 2110-1301 USA. | |
20 | * | |
21 | * Please contact Or acle, 500 Oracle Par kway, Redw ood Shores , CA 94065 USA | |
22 | * or visi t www.orac le.com if you need a dditional informatio n or have any | |
23 | * questio ns. | |
24 | */ | |
25 | ||
26 | package co m.sun.jndi .cosnaming ; | |
27 | ||
28 | import jav ax.naming. Name; | |
29 | import jav ax.naming. NamingExce ption; | |
30 | ||
31 | import jav a.net.Malf ormedURLEx ception; | |
32 | import jav a.util.Vec tor; | |
33 | import jav a.util.Str ingTokeniz er; | |
34 | import com .sun.jndi. toolkit.ur l.UrlUtil; | |
35 | ||
36 | /** | |
37 | * Extract component s of an "i iop" or "i iopname" U RL. | |
38 | * | |
39 | * The for mat of an iiopname U RL is defi ned in INS 98-10-11 as follows : | |
40 | * | |
41 | * iiopnam e url = "i iopname:// " [addr_li st]["/" st ring_name] | |
42 | * addr_li st = [a ddress "," ]* address | |
43 | * address = [v ersion hos t [":" por t]] | |
44 | * host = DN S style ho st name | IP address | |
45 | * version = ma jor "." mi nor "@" | empty_stri ng | |
46 | * port = nu mber | |
47 | * major = nu mber | |
48 | * minor = nu mber | |
49 | * string_ name = str ingified n ame | empt y_string | |
50 | * | |
51 | * The def ault port is 9999. T he default version i s "1.0" | |
52 | * US-ASCI I alphanum eric chara cters are not escape d. Any cha racters ou tside | |
53 | * of this range are escaped e xcept for the follow ing: | |
54 | * ; / : ? : @ & = + $ , - _ . ! ~ * ' ( ) | |
55 | * Escaped character s is escap ed by usin g a % foll owed by it s 2 hexade cimal | |
56 | * numbers represent ing the oc tet. | |
57 | * | |
58 | * For bac kward comp atibility, the "iio p" URL as defined in INS 97-6- 6 | |
59 | * is also supported : | |
60 | * | |
61 | * iiop ur l = "i iop://" [h ost [":" p ort]] ["/" string_na me] | |
62 | * The def ault port is 900. | |
63 | * | |
64 | * @author Rosanna L ee | |
65 | */ | |
66 | ||
67 | public fin al class I iopUrl { | |
68 | static fin al private int DEFAU LT_IIOPNAM E_PORT
|
|
69 | static fin al private int DEFAU LT_IIOP_PO RT
|
|
70 | static final pri vate Strin g DEFAULT_ HOST = "lo calhost"; | |
71 | privat e Vector<A ddress> ad dresses; | |
72 | privat e String s tringName; | |
73 | ||
74 | public static cl ass Addres s { | |
75 | pu blic int p ort = -1; | |
76 | pu blic int m ajor, mino r; | |
77 | pu blic Strin g host; | |
78 | ||
79 | pu blic Addre ss(String hostPortVe rs, boolea n oldForma t) | |
80 | throws M alformedUR LException { | |
81 | // [vers ion host [ ":" port]] | |
82 | int star t; | |
83 | ||
84 | // Parse version | |
85 | int at; | |
86 | if (oldF ormat || ( at = hostP ortVers.in dexOf('@') ) < 0) { | |
87 | majo r = 1; | |
88 | mino r = 0; | |
89 | star t = 0; // start at the beg inning | |
90 | } else { | |
91 | int dot = host PortVers.i ndexOf('.' ); | |
92 | if ( dot < 0) { | |
93 | throw new MalformedU RLExceptio n( | |
94 | "inval id version : " + host PortVers); | |
95 | } | |
96 | try { | |
97 | major = In teger.pars eInt(hostP ortVers.su bstring(0, dot)); | |
98 | minor = In teger.pars eInt(hostP ortVers.su bstring(do t+1, at)); | |
99 | } ca tch (Numbe rFormatExc eption e) { | |
100 | throw new MalformedU RLExceptio n( | |
101 | "Nonnu meric vers ion: " + h ostPortVer s); | |
102 | } | |
103 | star t = at + 1 ; // skip '@' sign | |
104 | } | |
105 | ||
106 | // Parse host and port | |
107 | int slas h = hostPo rtVers.ind exOf('/', start); | |
108 | if (slas h < 0) { | |
109 | slas h = hostPo rtVers.len gth(); | |
110 | } | |
111 | if (host PortVers.s tartsWith( "[", start )) { // a t IPv6 lit eral | |
112 | int brac = hos tPortVers. indexOf('] ', start + 1); | |
113 | if ( brac < 0 | | brac > s lash) { | |
114 | throw new IllegalArg umentExcep tion( | |
115 | "IiopU RL: name i s an Inval id URL: " + hostPort Vers); | |
116 | } | |
117 | ||
118 | // i nclude bra ckets | |
119 | host = hostPor tVers.subs tring(star t, brac + 1); | |
120 | star t = brac + 1; | |
121 | } else { // a t hostname or IPv4 | |
122 | int colon = ho stPortVers .indexOf(' :', start) ; | |
123 | int hostEnd = (colon < 0 || colon > slash) | |
124 | ? slash | |
125 | : colon; | |
126 | if ( start < ho stEnd) { | |
127 | host = hos tPortVers. substring( start, hos tEnd); | |
128 | } | |
129 | star t = hostEn d; // sk ip past ho st | |
130 | } | |
131 | if ((sta rt + 1 < s lash)) { | |
132 | if ( hostPortV ers.starts With(":", start)) { // parse p ort | |
133 | start++; // skip past ":" | |
134 | port = Int eger.parse Int(hostPo rtVers. | |
135 | substr ing(start, slash)); | |
136 | } el se { | |
137 | throw new IllegalArg umentExcep tion( | |
138 | "IiopU RL: name i s an Inval id URL: " + hostPort Vers); | |
139 | } | |
140 | } | |
141 | start = slash; | |
142 | if ("".e quals(host ) || host == null) { | |
143 | host = DEFAULT _HOST ; | |
144 | } | |
145 | if (port == -1) { | |
146 | port = (oldFor mat ? DEFA ULT_IIOP_P ORT : | |
147 | DEFAULT_ IIOPNAME_P ORT); | |
148 | } | |
149 | } | |
150 | } | |
151 | ||
152 | public Vector<Ad dress> get Addresses( ) { | |
153 | re turn addre sses; | |
154 | } | |
155 | ||
156 | /** | |
157 | * Ret urns a pos sibly empt y but non- null strin g that is the "strin g_name" | |
158 | * por tion of th e URL. | |
159 | */ | |
160 | public String ge tStringNam e() { | |
161 | re turn strin gName; | |
162 | } | |
163 | ||
164 | public Name getC osName() t hrows Nami ngExceptio n { | |
165 | re turn CNCtx .parser.pa rse(string Name); | |
166 | } | |
167 | ||
168 | public IiopUrl(S tring url) throws Ma lformedURL Exception { | |
169 | in t addrStar t; | |
170 | bo olean oldF ormat; | |
171 | ||
172 | if (url.star tsWith("ii opname://" )) { | |
173 | oldForma t = false; | |
174 | addrStar t = 11; | |
175 | } else if (u rl.startsW ith("iiop: //")) { | |
176 | oldForma t = true; | |
177 | addrStar t = 7; | |
178 | } else { | |
179 | throw ne w Malforme dURLExcept ion("Inval id iiop/ii opname URL : " + url) ; | |
180 | } | |
181 | in t addrEnd = url.inde xOf('/', a ddrStart); | |
182 | if (addrEnd < 0) { | |
183 | addrEnd = url.leng th(); | |
184 | stringNa me = ""; | |
185 | } else { | |
186 | stringNa me = UrlUt il.decode( url.substr ing(addrEn d+1)); | |
187 | } | |
188 | ad dresses = new Vector <>(3); | |
189 | if (oldForma t) { | |
190 | // Only one host:p ort part, not multip le | |
191 | addresse s.addEleme nt( | |
192 | new Address(ur l.substrin g(addrStar t, addrEnd ), oldForm at)); | |
193 | } else { | |
194 | StringTo kenizer to kens = | |
195 | new StringToke nizer(url. substring( addrStart, addrEnd), ","); | |
196 | while (t okens.hasM oreTokens( )) { | |
197 | addr esses.addE lement(new Address(t okens.next Token(), o ldFormat)) ; | |
198 | } | |
199 | if (addr esses.size () == 0) { | |
200 | addr esses.addE lement(new Address(" ", oldForm at)); | |
201 | } | |
202 | } | |
203 | } | |
204 | ||
205 | // for testing o nly | |
206 | /*publ ic static void main( String[] a rgs) { | |
207 | tr y { | |
208 | IiopUrl url = new IiopUrl(ar gs[0]); | |
209 | Vector a ddrs = url .getAddres ses(); | |
210 | String n ame = url. getStringN ame(); | |
211 | ||
212 | for (int i = 0; i < addrs.si ze(); i++) { | |
213 | Addr ess addr = (Address) addrs.elem entAt(i); | |
214 | Syst em.out.pri ntln("host : " + addr .host); | |
215 | Syst em.out.pri ntln("port : " + addr .port); | |
216 | Syst em.out.pri ntln("vers ion: " + a ddr.major + " " + ad dr.minor); | |
217 | } | |
218 | System.o ut.println ("name: " + name); | |
219 | } catch (Mal formedURLE xception e ) { | |
220 | e.printS tackTrace( ); | |
221 | } | |
222 | } */ | |
223 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.