Produced by Araxis Merge on 6/5/2018 10:24:09 AM 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 | patch_205_build_9.zip\Java\ImagingCommon\main\src\java\gov\va\med\configuration | LocalFileSerializationStorage.java | Wed May 30 14:35:20 2018 UTC |
2 | patch_205_build_9.zip\Java\ImagingCommon\main\src\java\gov\va\med\configuration | LocalFileSerializationStorage.java | Fri Jun 1 20:43:23 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 262 |
Changed | 2 | 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 | * Package : MAG - Vi stA Imagin g | |
3 | * WARNING : Per VHA Directive 2004-038, this routi ne should not be mod ified. | |
4 | * @date A ug 4, 2010 | |
5 | * Site Na me: Washi ngton OI F ield Offic e, Silver Spring, MD | |
6 | * @author PII | |
7 | * @versio n 1.0 | |
8 | * | |
9 | * ------- ---------- ---------- ---------- ---------- ---------- ------- | |
10 | * Propert y of the U S Governme nt. | |
11 | * No perm ission to copy or re distribute this soft ware is gi ven. | |
12 | * Use of unreleased versions of this so ftware req uires the user | |
13 | * to exec ute a writ ten test a greement w ith the Vi stA Imagin g | |
14 | * Develop ment Offic e of the D epartment of Veteran s Affairs, | |
15 | * telepho ne (301) 7 34-0100. | |
16 | * | |
17 | * The Foo d and Drug Administr ation clas sifies thi s software as | |
18 | * a Class II medica l device. As such, it may not be change d | |
19 | * in any way. Modi fications to this so ftware may result in an | |
20 | * adulter ated medic al device under 21CF R820, the use of whi ch | |
21 | * is cons idered to be a viola tion of US Federal S tatutes. | |
22 | * ------- ---------- ---------- ---------- ---------- ---------- ------- | |
23 | */ | |
24 | ||
25 | package go v.va.med.c onfigurati on; | |
26 | ||
27 | import jav a.io.*; | |
28 | import jav a.net.URL; | |
29 | import jav a.net.URLD ecoder; | |
30 | import jav ax.naming. Communicat ionExcepti on; | |
31 | import jav ax.naming. NamingExce ption; | |
32 | ||
33 | /** | |
34 | * @author PII | |
35 | * | |
36 | */ | |
37 | public cla ss LocalFi leSerializ ationStora ge | |
38 | implements Configura tionStorag e | |
39 | { | |
40 | ||
41 | /* * | |
42 | * | |
43 | * @see gov. va.med.con figuration .Configura tionStorag e#load(jav a.net.URL) | |
44 | * / | |
45 | @S uppressWar nings("nul l") | |
46 | @O verride | |
47 | pu blic Confi gurationCo ntext load (URL locat ion) | |
48 | th rows Namin gException | |
49 | { | |
50 | if(l ocation == null) | |
51 | throw new Commun icationExc eption("Un able to lo ad from a null locat ion."); | |
52 | ||
53 | Obje ct readObj ect = null ; | |
54 | Obje ctInputStr eam object InStream = null; | |
55 | //St ring filen ame = file nameFromUR L(location ); | |
56 | try | |
57 | { | |
58 | InputS tream inSt ream = loc ation.open Stream(); | |
59 | object InStream = new Objec tInputStre am( inStre am ); | |
60 | ||
61 | readOb ject = obj ectInStrea m.readObje ct(); | |
62 | ||
63 | return (Configur ationConte xt)readObj ect; | |
64 | } | |
65 | catc h (IOExcep tion x) | |
66 | { | |
67 | throw new Commun icationExc eption("Un able to re ad configu ration fro m '" + loc ation.toSt ring() + " '."); | |
68 | } | |
69 | catc h (ClassNo tFoundExce ption x) | |
70 | { | |
71 | throw new Commun icationExc eption( | |
72 | "Read fr om '" + lo cation.toS tring() + | |
73 | "' but u nable to l oad class '" + (read Object == null ? "<u nknown>" : readObjec t.getClass ().getName ()) + | |
74 | "'found there, was expecting '" + Conf igurationC ontext.cla ss.getName () + "'.") ; | |
75 | } | |
76 | catc h (ClassCa stExceptio n x) | |
77 | { | |
78 | throw new Commun icationExc eption( | |
79 | "Read fr om '" + lo cation.toS tring() + | |
80 | "' but c lass '" + (readObjec t == null ? "<unknow n>" : read Object.get Class().ge tName()) + | |
81 | "'found there, was expecting '" + Conf igurationC ontext.cla ss.getName () + "'.") ; | |
82 | } | |
83 | fina lly | |
84 | { | |
85 | try{ob jectInStre am.close() ;}catch(Th rowable t) {} | |
86 | } | |
87 | } | |
88 | ||
89 | /* (non-Java doc) | |
90 | * @see gov. va.med.con figuration .Configura tionStorag e#store(ja va.net.URL , gov.va.m ed.configu ration.Con figuration Context) | |
91 | * / | |
92 | @S uppressWar nings("nul l") | |
93 | @O verride | |
94 | pu blic void store(URL location, Configurat ionContext context) | |
95 | th rows Namin gException | |
96 | { | |
97 | if(c ontext == null) | |
98 | throw new Commun icationExc eption("Un able to st ore a null Configura tionContex t."); | |
99 | if(l ocation == null) | |
100 | throw new Commun icationExc eption("Un able to st ore a null location. "); | |
101 | ||
102 | Stri ng filenam e = filena meFromURL( location); | |
103 | Obje ctOutputSt ream objec tOutStream = null; | |
104 | try | |
105 | { | |
106 | File c onfigFile = new File (filename) ; | |
107 | Output Stream out Stream; | |
108 | config File.creat eNewFile() ; // cre ate the fi le if it d oes not ex ist | |
109 | outStr eam = new FileOutput Stream(con figFile); | |
110 | object OutStream = new Obje ctOutputSt ream( outS tream ); | |
111 | ||
112 | object OutStream. writeObjec t(context) ; | |
113 | } | |
114 | catc h (IOExcep tion x) | |
115 | { | |
116 | throw new Commun icationExc eption("Un able to wr ite config uration to '" + file name + "'. "); | |
117 | } | |
118 | fina lly | |
119 | { | |
120 | try{ob jectOutStr eam.close( );}catch(T hrowable t ){} | |
121 | } | |
122 | } | |
123 | ||
124 | pr ivate stat ic final S tring FILE _PROTOCOL = "file:"; | |
125 | pr ivate Stri ng filenam eFromURL(U RL locatio n) | |
126 | { | |
127 | Stri ng filenam e = URLDec oder.decod e( locatio n.toExtern alForm() ) ; | |
128 | if(f ilename.st artsWith(F ILE_PROTOC OL)) | |
129 | filena me = filen ame.substr ing(FILE_P ROTOCOL.le ngth()); | |
130 | ||
131 | retu rn filenam e; | |
132 | } | |
133 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.