/ by zero exception
Hi all,
Double infi = new Double(1/0.);
Can somebody tell me why doesnt the above statement throw a '/ by zero' exception?
for your information, doubles cant actually store values up to infinity. they just store really high numbers and if you dont know this already, 1 or any other number/0 is infinity hence an exception
Similar Messages
-
App quits unexpectedly -- Divide by zero exception
Hi,
I've been using a particular application for months without any issues. Suddenly, though, as of yesterday, the app "quits unexpectedly" whenever I try to launch it. I've attached the complete crash log below, but these lines seem particularly relevant:
Exception Type: EXC_ARITHMETIC (SIGFPE)
Exception Codes: EXCI386DIV (divide by zero)
I don't think I've changed anything on the system. Does anyone have any idea what the problem is or how to solve it?
Sorry to be so vague. (The application in question is an esoteric program, a "max patch" for creating eletronic music. It can be downloaded from this site, by following the "information on the electronics" link: http://www.chesternovello.com/Default.aspx?TabId=2432&State3041=2&workId3041=7852)
Many thanks,
D.
Crash log
Process: Lonh-v2.7 [290]
Path: /Users/davebenson/Documents/electroacoustic_music/lonh/Lonh-v2.7.app/Contents/M acOS/Lonh-v2.7
Identifier: com.cycling74.com.Max.Lonh-v2.7.appRuntime
Version: 5.1.1 (41439) (5.1.1)
Code Type: X86 (Native)
Parent Process: launchd [142]
Date/Time: 2010-09-16 12:16:39.548 -0400
OS Version: Mac OS X 10.6.4 (10F569)
Report Version: 6
Interval Since Last Report: 3528115 sec
Crashes Since Last Report: 128
Per-App Interval Since Last Report: 25408 sec
Per-App Crashes Since Last Report: 18
Anonymous UUID: A9062AB7-EDFE-4339-8743-5C1F70E3C567
Exception Type: EXC_ARITHMETIC (SIGFPE)
Exception Codes: EXCI386DIV (divide by zero)
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 org.ircam.8c-cluster_ext~ 0x194d1daf c8clusternew + 481
1 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
2 ...om.Max.Lonh-v2.7.appRuntime 0x000b513f objectnew_typedflags + 637
3 ...om.Max.Lonh-v2.7.appRuntime 0x000b517e objectnewtyped + 46
4 ...om.Max.Lonh-v2.7.appRuntime 0x000118e7 newload_internal + 165
5 ...om.Max.Lonh-v2.7.appRuntime 0x00011bec newload + 40
6 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
7 ...om.Max.Lonh-v2.7.appRuntime 0x0001c713 typedmess + 83
8 ...om.Max.Lonh-v2.7.appRuntime 0x0001cd7f aeval + 893
9 ...om.Max.Lonh-v2.7.appRuntime 0x00008aaa atombuf_eval + 152
10 ...om.Max.Lonh-v2.7.appRuntime 0x00148eed jnewobj_new + 2283
11 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
12 ...om.Max.Lonh-v2.7.appRuntime 0x000b5104 objectnew_typedflags + 578
13 ...om.Max.Lonh-v2.7.appRuntime 0x001527d4 jpatcher_newinstance + 492
14 ...om.Max.Lonh-v2.7.appRuntime 0x000b1196 objectmethodtypedfun + 134
15 ...om.Max.Lonh-v2.7.appRuntime 0x000b124f objectmethodtyped + 127
16 ...om.Max.Lonh-v2.7.appRuntime 0x00153fda jpatcher_hidden + 112
17 ...om.Max.Lonh-v2.7.appRuntime 0x0001c1e2 typedmess_fun + 782
18 ...om.Max.Lonh-v2.7.appRuntime 0x0001c713 typedmess + 83
19 ...om.Max.Lonh-v2.7.appRuntime 0x0001d14f eval_internal + 799
20 ...om.Max.Lonh-v2.7.appRuntime 0x0001d2cb eval + 67
21 ...om.Max.Lonh-v2.7.appRuntime 0x00009b59 binbuf_loadeval + 115
22 ...om.Max.Lonh-v2.7.appRuntime 0x000116b1 lowload_type + 1137
23 ...om.Max.Lonh-v2.7.appRuntime 0x00011833 intload_type(char*, short, long, symbol*, short, atom*, short) + 119
24 ...om.Max.Lonh-v2.7.appRuntime 0x00011b21 newload_internal + 735
25 ...om.Max.Lonh-v2.7.appRuntime 0x00011bec newload + 40
26 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
27 ...om.Max.Lonh-v2.7.appRuntime 0x0001c713 typedmess + 83
28 ...om.Max.Lonh-v2.7.appRuntime 0x0001cd7f aeval + 893
29 ...om.Max.Lonh-v2.7.appRuntime 0x00008aaa atombuf_eval + 152
30 ...om.Max.Lonh-v2.7.appRuntime 0x00148eed jnewobj_new + 2283
31 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
32 ...om.Max.Lonh-v2.7.appRuntime 0x000b5104 objectnew_typedflags + 578
33 ...om.Max.Lonh-v2.7.appRuntime 0x001527d4 jpatcher_newinstance + 492
34 ...om.Max.Lonh-v2.7.appRuntime 0x0001c1e2 typedmess_fun + 782
35 ...om.Max.Lonh-v2.7.appRuntime 0x0001c713 typedmess + 83
36 ...om.Max.Lonh-v2.7.appRuntime 0x0001d14f eval_internal + 799
37 ...om.Max.Lonh-v2.7.appRuntime 0x0001d2cb eval + 67
38 ...om.Max.Lonh-v2.7.appRuntime 0x00009b59 binbuf_loadeval + 115
39 ...om.Max.Lonh-v2.7.appRuntime 0x000116b1 lowload_type + 1137
40 ...om.Max.Lonh-v2.7.appRuntime 0x00011833 intload_type(char*, short, long, symbol*, short, atom*, short) + 119
41 ...om.Max.Lonh-v2.7.appRuntime 0x00011b21 newload_internal + 735
42 ...om.Max.Lonh-v2.7.appRuntime 0x00011bec newload + 40
43 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
44 ...om.Max.Lonh-v2.7.appRuntime 0x0001c713 typedmess + 83
45 ...om.Max.Lonh-v2.7.appRuntime 0x0001cd7f aeval + 893
46 ...om.Max.Lonh-v2.7.appRuntime 0x00008aaa atombuf_eval + 152
47 ...om.Max.Lonh-v2.7.appRuntime 0x00148eed jnewobj_new + 2283
48 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
49 ...om.Max.Lonh-v2.7.appRuntime 0x000b5104 objectnew_typedflags + 578
50 ...om.Max.Lonh-v2.7.appRuntime 0x001527d4 jpatcher_newinstance + 492
51 ...om.Max.Lonh-v2.7.appRuntime 0x0001c1e2 typedmess_fun + 782
52 ...om.Max.Lonh-v2.7.appRuntime 0x0001c713 typedmess + 83
53 ...om.Max.Lonh-v2.7.appRuntime 0x0001d14f eval_internal + 799
54 ...om.Max.Lonh-v2.7.appRuntime 0x0001d2cb eval + 67
55 ...om.Max.Lonh-v2.7.appRuntime 0x00009b59 binbuf_loadeval + 115
56 ...om.Max.Lonh-v2.7.appRuntime 0x000116b1 lowload_type + 1137
57 ...om.Max.Lonh-v2.7.appRuntime 0x00011833 intload_type(char*, short, long, symbol*, short, atom*, short) + 119
58 ...om.Max.Lonh-v2.7.appRuntime 0x00011b21 newload_internal + 735
59 ...om.Max.Lonh-v2.7.appRuntime 0x00011bec newload + 40
60 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
61 ...om.Max.Lonh-v2.7.appRuntime 0x0001c713 typedmess + 83
62 ...om.Max.Lonh-v2.7.appRuntime 0x0001cd7f aeval + 893
63 ...om.Max.Lonh-v2.7.appRuntime 0x00008aaa atombuf_eval + 152
64 ...om.Max.Lonh-v2.7.appRuntime 0x00148eed jnewobj_new + 2283
65 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
66 ...om.Max.Lonh-v2.7.appRuntime 0x000b5104 objectnew_typedflags + 578
67 ...om.Max.Lonh-v2.7.appRuntime 0x000b517e objectnewtyped + 46
68 ...om.Max.Lonh-v2.7.appRuntime 0x00151fb2 jpatcher_newobject + 380
69 ...om.Max.Lonh-v2.7.appRuntime 0x001524c9 jpatcher_pastefromdictionary + 403
70 ...om.Max.Lonh-v2.7.appRuntime 0x00160c96 jpatcher_fromdictionary + 1692
71 ...om.Max.Lonh-v2.7.appRuntime 0x0016102d jpatcher_new + 901
72 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
73 ...om.Max.Lonh-v2.7.appRuntime 0x000b513f objectnew_typedflags + 637
74 ...om.Max.Lonh-v2.7.appRuntime 0x000b517e objectnewtyped + 46
75 ...om.Max.Lonh-v2.7.appRuntime 0x00148d7b jnewobj_new + 1913
76 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
77 ...om.Max.Lonh-v2.7.appRuntime 0x000b5104 objectnew_typedflags + 578
78 ...om.Max.Lonh-v2.7.appRuntime 0x000b517e objectnewtyped + 46
79 ...om.Max.Lonh-v2.7.appRuntime 0x00151fb2 jpatcher_newobject + 380
80 ...om.Max.Lonh-v2.7.appRuntime 0x001524c9 jpatcher_pastefromdictionary + 403
81 ...om.Max.Lonh-v2.7.appRuntime 0x00160c96 jpatcher_fromdictionary + 1692
82 ...om.Max.Lonh-v2.7.appRuntime 0x0016102d jpatcher_new + 901
83 ...om.Max.Lonh-v2.7.appRuntime 0x0001c689 typedmess_fun + 1973
84 ...om.Max.Lonh-v2.7.appRuntime 0x000b513f objectnew_typedflags + 637
85 ...om.Max.Lonh-v2.7.appRuntime 0x000b517e objectnewtyped + 46
86 ...om.Max.Lonh-v2.7.appRuntime 0x00010e19 jpatcherloadfromdictionary(char*, short, object*, short, atom*) + 437
87 ...om.Max.Lonh-v2.7.appRuntime 0x00010f98 jpatcherloadfrombuffer(char*, short, char const*, long, short, atom*) + 310
88 ...om.Max.Lonh-v2.7.appRuntime 0x00011207 jpatcher_load(char*, short, short, atom*) + 373
89 ...om.Max.Lonh-v2.7.appRuntime 0x00011495 lowload_type + 597
90 ...om.Max.Lonh-v2.7.appRuntime 0x00011d8b fileload_extended + 169
91 ...om.Max.Lonh-v2.7.appRuntime 0x000122f7 fileload_unique + 99
92 ...om.Max.Lonh-v2.7.appRuntime 0x0001232a fileload_type + 40
93 ...om.Max.Lonh-v2.7.appRuntime 0x000639c4 xpcoll_loadentry + 42
94 ...om.Max.Lonh-v2.7.appRuntime 0x00058250 linklist_funall + 68
95 ...om.Max.Lonh-v2.7.appRuntime 0x000637a5 xpcoll_loadpatchers + 75
96 ...om.Max.Lonh-v2.7.appRuntime 0x00063807 xpcoll_load + 57
97 ...om.Max.Lonh-v2.7.appRuntime 0x0002a219 single_checkappforfiles + 49
98 ...om.Max.Lonh-v2.7.appRuntime 0x000133f5 max_startup + 475
99 ...om.Max.Lonh-v2.7.appRuntime 0x00188840 MaxApplication::initialise(juce::String const&) + 132
100 ...om.Max.Lonh-v2.7.appRuntime 0x002179e1 juce::JUCEApplication::main(juce::String&, juce::JUCEApplication*) + 533
101 ...om.Max.Lonh-v2.7.appRuntime 0x00217b03 juce::JUCEApplication::main(int, char**, juce::JUCEApplication*) + 125
102 ...om.Max.Lonh-v2.7.appRuntime 0x001888ea main + 76
103 ...om.Max.Lonh-v2.7.appRuntime 0x000061aa _start + 216
104 ...om.Max.Lonh-v2.7.appRuntime 0x000060d1 start + 41
Thread 1: Dispatch queue: com.apple.libdispatch-manager
0 libSystem.B.dylib 0x9481a942 kevent + 10
1 libSystem.B.dylib 0x9481b05c dispatch_mgrinvoke + 215
2 libSystem.B.dylib 0x9481a519 dispatch_queueinvoke + 163
3 libSystem.B.dylib 0x9481a2be dispatch_workerthread2 + 240
4 libSystem.B.dylib 0x94819d41 pthreadwqthread + 390
5 libSystem.B.dylib 0x94819b86 start_wqthread + 30
Thread 2:
0 libSystem.B.dylib 0x948199d2 _workqkernreturn + 10
1 libSystem.B.dylib 0x94819f68 pthreadwqthread + 941
2 libSystem.B.dylib 0x94819b86 start_wqthread + 30
Thread 3:
0 libSystem.B.dylib 0x947f40fa machmsgtrap + 10
1 libSystem.B.dylib 0x947f4867 mach_msg + 68
2 com.apple.audio.midi.CoreMIDI 0x120f7f31 XServerMachPort::ReceiveMessage(int&, void*, int&) + 155
3 com.apple.audio.midi.CoreMIDI 0x121168fe MIDIProcess::RunMIDIInThread() + 150
4 com.apple.audio.midi.CoreMIDI 0x120f9149 XThread::RunHelper(void*) + 17
5 com.apple.audio.midi.CoreMIDI 0x120f8b16 CAPThread::Entry(CAPThread*) + 96
6 libSystem.B.dylib 0x9482181d pthreadstart + 345
7 libSystem.B.dylib 0x948216a2 thread_start + 34
Thread 4:
0 libSystem.B.dylib 0x947f415a semaphoretimedwait_signaltrap + 10
1 libSystem.B.dylib 0x94821ca5 pthread_condwait + 1066
2 libSystem.B.dylib 0x94850848 pthreadcond_timedwait_relativenp + 47
3 ...ple.CoreServices.CarbonCore 0x945093b5 TSWaitOnConditionTimedRelative + 242
4 ...ple.CoreServices.CarbonCore 0x945090f3 TSWaitOnSemaphoreCommon + 511
5 ...ple.CoreServices.CarbonCore 0x9452d34b TimerThread + 97
6 libSystem.B.dylib 0x9482181d pthreadstart + 345
7 libSystem.B.dylib 0x948216a2 thread_start + 34
Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00000000 ebx: 0x194d1bdc ecx: 0x19462c20 edx: 0x00000000
edi: 0x003d7400 esi: 0x00000000 ebp: 0xbffdef58 esp: 0xbffdef10
ss: 0x0000001f efl: 0x00010282 eip: 0x194d1daf cs: 0x00000017
ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
cr2: 0x19463000
Binary Images:
0x1000 - 0x375ff7 +com.cycling74.com.Max.Lonh-v2.7.appRuntime 5.1.1 (41439) (5.1.1) <52639ED7-5CCF-CA76-C421-66CEECFD0CB4> /Users/davebenson/Documents/electroacoustic_music/lonh/Lonh-v2.7.app/Contents/M acOS/Lonh-v2.7
0x1478000 - 0x149dff7 +com.cycling74.MaxAPI 1.0 (1.0) <48CC1A64-4CB9-ACEF-6E41-9154793BD363> /Users/davebenson/Documents/electroacoustic_music/lonh/Lonh-v2.7.app/Contents/F rameworks/MaxAPI.framework/MaxAPI
0x17f1000 - 0x17f2ff7 +com.cycling74.augraph 5.1.1 (41439) (41439) <09850A49-1921-D778-3BED-6ED443DE9BDA> /Users/davebenson/Documents/electroacoustic_music/lonh/Lonh-v2.7.app/Contents/s upport/mididrivers/augraph.mxo/Contents/MacOS/augraph
0x17f6000 - 0x17f8ff7 +com.cycling74.coremidi 5.1.1 (41439) (41439) <EC030D8C-2C7F-63C0-21ED-B356E0199ABD> /Users/davebenson/Documents/electroacoustic_music/lonh/Lonh-v2.7.app/Contents/s upport/mididrivers/coremidi.mxo/Contents/MacOS/coremidi
0x120e8000 - 0x12134fff com.apple.audio.midi.CoreMIDI 1.7 (42) <670CB7F9-AA00-86F3-6623-E1335F7AEA83> /System/Library/Frameworks/CoreMIDI.framework/Versions/A/CoreMIDI
0x12161000 - 0x12161ff7 +com.cycling74.midi_adrewire 5.1.1 (41439) (41439) <D743F439-699E-2ABA-0032-E1BB7EAC8F45> /Users/davebenson/Documents/electroacousticmusic/lonh/Lonh-v2.7.app/Contents/support/mididrivers/midi_adrewire.mxo/Contents /MacOS/midiadrewire
0x12165000 - 0x1217dff7 +com.cycling74.MaxAudioAPI ??? (1.0) <E38941A8-5166-32A6-DA74-E403C622BF08> /Users/davebenson/Documents/electroacoustic_music/lonh/Lonh-v2.7.app/Contents/F rameworks/MaxAudioAPI.framework/Versions/A/MaxAudioAPI
0x17659000 - 0x1765dff7 com.apple.CommonCocoaPanels 4.0 (16) <30D57C5A-2C5E-3A3E-A9D8-F5E968322AD6> /System/Library/CoreServices/CommonCocoaPanels.bundle/Contents/MacOS/CommonCoco aPanels
0x177df000 - 0x177ecff7 +com.cycling74.umenu 5.1.1 (41439) (41439) <1BA48ADF-0A64-FD29-B236-B96CA0F76408> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/umenu.mxo/Contents/MacOS/umenu
0x177f6000 - 0x177f8ff7 +com.cycling74.adstatus 5.1.1 (41439) (41439) <6E33D20A-2CB8-228B-7B05-9FC5F98CCE87> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/adstatus.mxo/Contents/MacOS/adstatus
0x17ccf000 - 0x17cd6ff7 +com.cycling74.ad_coreaudio 5.1.1 (41439) (41439) <48DF265F-F37B-D0AA-9A33-3AE7A30E21E8> /Users/davebenson/Documents/electroacousticmusic/lonh/Lonh-v2.7.app/Contents/support/ad/ad_coreaudio.mxo/Contents/MacOS/adcoreaudio
0x17cdc000 - 0x17ce0ff3 com.apple.audio.AudioIPCPlugIn 1.1.2 (1.1.2) <5570694E-039D-7970-6083-1C8A7B7C937B> /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugI n.bundle/Contents/MacOS/AudioIPCPlugIn
0x17ce5000 - 0x17cebffb com.apple.audio.AppleHDAHALPlugIn 1.8.7 (1.8.7f1) <0FE8B697-6D19-69C6-FA94-E18064ACFAEC> /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bun dle/Contents/MacOS/AppleHDAHALPlugIn
0x17cf0000 - 0x17cf1ffb +com.cycling74.ad_nonreal 5.1.1 (41439) (41439) <B610E918-3F6E-A231-4EB1-8264AF345FA7> /Users/davebenson/Documents/electroacousticmusic/lonh/Lonh-v2.7.app/Contents/support/ad/ad_nonreal.mxo/Contents/MacOS/adnonreal
0x17cf5000 - 0x17cf8ff7 +com.cycling74.comment 5.1.1 (41439) (41439) <CE22EA19-D8DF-5BC7-AF2C-10B2F1779755> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/comment.mxo/Contents/MacOS/comment
0x1808a000 - 0x18092ffb +com.cycling74.ad_rewire 5.1.1 (41439) (41439) <F9D5D938-382B-D322-9F22-EBFA95A2D6E2> /Users/davebenson/Documents/electroacousticmusic/lonh/Lonh-v2.7.app/Contents/support/ad/ad_rewire.mxo/Contents/MacOS/adrewire
0x180db000 - 0x180dfff7 +com.cycling74.message 5.1.1 (41439) (41439) <E5638F96-0FB0-82D8-67F3-833D3C135A26> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/message.mxo/Contents/MacOS/message
0x18128000 - 0x1812cff7 +com.cycling74.ubutton 5.1.1 (41439) (41439) <1B372BED-0B46-D4F1-3AB1-0AC043591039> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/ubutton.mxo/Contents/MacOS/ubutton
0x18134000 - 0x18138ff7 +com.cycling74.panel 5.1.1 (41439) (41439) <3D6668DC-5DFE-BBCF-BA1E-1C48F388837E> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/panel.mxo/Contents/MacOS/panel
0x18180000 - 0x18181ff7 +com.cycling74.metro 5.1.1 (41439) (41439) <99782817-FB4C-D4F5-DE4F-E689F9F68FD3> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/metro.mxo/Contents/MacOS/metro
0x18186000 - 0x1818bff7 +com.cycling74.radiogroup 5.1.1 (41439) (41439) <18E0C924-B301-ED69-A3AF-05AE02984DEA> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/radiogroup.mxo/Contents/MacOS/radiogroup
0x181d4000 - 0x181d7ff7 +com.cycling74.button 5.1.1 (41439) (41439) <11C9812A-CD29-8E0D-424E-ADFBC421C8B2> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/button.mxo/Contents/MacOS/button
0x18260000 - 0x1826aff7 +com.cycling74.number 5.1.1 (41439) (41439) <0BEE2A73-DA69-63A5-F79A-A658D393F8E0> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/number.mxo/Contents/MacOS/number
0x182b4000 - 0x182b4ff7 +com.cycling74.uzi 5.1.1 (41439) (41439) <976665FE-2842-7456-30B5-0CB9CD649EF6> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/Uzi.mxo/Contents/MacOS/uzi
0x182b8000 - 0x182b8ff7 +com.cycling74.spray 5.1.1 (41439) (41439) <039B9309-BC01-D145-7292-88CD6DCCC54B> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/spray.mxo/Contents/MacOS/spray
0x185c7000 - 0x185caff7 +com.cycling74.toggle 5.1.1 (41439) (41439) <52B87A3D-229F-39C2-92F8-E225CAC29EA9> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/toggle.mxo/Contents/MacOS/toggle
0x185d1000 - 0x185d1ff7 +com.cycling74.bgcolor 5.1.1 (41439) (41439) <F97BB47C-5520-0FA5-3317-E73A2F6EB149> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/bgcolor.mxo/Contents/MacOS/bgcolor
0x185d5000 - 0x185d5ff7 +com.cycling74.clip~ 5.1.1 (41439) (41439) <B50853DE-EC92-B398-1AA4-CC2A82466114> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/clip~.mxo/Contents/MacOS/clip~
0x185d9000 - 0x185d9ff7 +com.cycling74.send~ 5.1.1 (41439) (41439) <34EB389A-59F4-2378-6870-50FCDB9895E6> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/send~.mxo/Contents/MacOS/send~
0x185dd000 - 0x185e2ff7 +com.cycling74.meter~ 5.1.1 (41439) (41439) <DED74D1A-104D-59AC-0510-B7E48387D7C7> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/meter~.mxo/Contents/MacOS/meter~
0x185e9000 - 0x185e9ff7 +com.cycling74.prepend 5.1.1 (41439) (41439) <4D54141F-3581-6570-2BFE-5C9FB8BDBAE6> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/prepend.mxo/Contents/MacOS/prepend
0x185ed000 - 0x185f1ff7 +com.cycling74.fpic 5.1.1 (41439) (41439) <44CBF652-B880-F541-2978-70D719E0F394> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/fpic.mxo/Contents/MacOS/fpic
0x185f9000 - 0x185f9ff7 +com.cycling74.delay 5.1.1 (41439) (41439) <72F21204-E1A5-1592-3D71-3FF44FABC759> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/delay.mxo/Contents/MacOS/delay
0x18dd1000 - 0x18dd1ff7 +com.cycling74.line 5.1.1 (41439) (41439) <934EAD9E-61F1-EEAB-18D9-88AF8881405A> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/line.mxo/Contents/MacOS/line
0x18e57000 - 0x18e5cff7 +com.cycling74.coll 5.1.1 (41439) (41439) <F3ADAAD5-FE41-D365-CC79-9A356C84F1A6> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/coll.mxo/Contents/MacOS/coll
0x18e63000 - 0x18e63ff7 +com.cycling74.dialog 5.1.1 (41439) (41439) <30FCC8D2-3A21-023C-6A5F-4971F85619A7> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/dialog.mxo/Contents/MacOS/dialog
0x18e67000 - 0x18e68ff7 +com.cycling74.sprintf 5.1.1 (41439) (41439) <9F3FE79E-9DF3-8E4E-E7DE-39A4EFA7CCC0> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/sprintf.mxo/Contents/MacOS/sprintf
0x18eee000 - 0x18eeeff7 +com.cycling74.clip 5.1.1 (41439) (41439) <5B138AB2-C3E2-C78B-AD6C-5DC24D9C30C2> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/clip.mxo/Contents/MacOS/clip
0x18ef2000 - 0x18ef7ff7 +com.cycling74.slider 5.1.1 (41439) (41439) <3A86569D-099C-735A-209D-60BE00101373> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/slider.mxo/Contents/MacOS/slider
0x19105000 - 0x19105ff7 +com.cycling74.split 5.1.1 (41439) (41439) <8B5A9543-202E-A834-D619-9D5ACFC40878> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/split.mxo/Contents/MacOS/split
0x192d0000 - 0x192d0ff7 +com.cycling74.receive~ 5.1.1 (41439) (41439) <418A4B59-5E73-A3B3-416F-5973B92727F3> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/receive~.mxo/Contents/MacOS/receive~
0x192d4000 - 0x192d4ff7 +com.cycling74.dspstate~ 5.1.1 (41439) (41439) <CD723161-E654-6D4E-BBC9-566488324BD8> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/dspstate~.mxo/Contents/MacOS/dspstate~
0x19319000 - 0x1931efff +org.ircam.biquadv_ext~ ??? (1.0) /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/biquadvext~.mxo/Contents/MacOS/biquadvext~
0x19363000 - 0x19363ff7 +com.cycling74.tapin~ 5.1.1 (41439) (41439) <5741073C-9D9F-61DA-D034-0D7B8F6A36D1> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/tapin~.mxo/Contents/MacOS/tapin~
0x193a8000 - 0x193abff7 +com.cycling74.biquad~ 5.1.1 (41439) (41439) <E4634F26-F84E-B051-0643-B9C5395C7B5F> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/biquad~.mxo/Contents/MacOS/biquad~
0x193af000 - 0x193b0ff7 +com.cycling74.line~ 5.1.1 (41439) (41439) <EA255A54-F761-EBB7-9DEE-0013C57EF515> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/line~.mxo/Contents/MacOS/line~
0x193b4000 - 0x193b4ff7 +com.cycling74.plus~ 5.1.1 (41439) (41439) <FE715CD5-D347-CB57-2B9F-ECBD16E6E487> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/plus~.mxo/Contents/MacOS/plus~
0x193b8000 - 0x193b9ff7 +com.cycling74.tapout~ 5.1.1 (41439) (41439) <DBC8044A-6E6C-3647-4BC4-BFF4FB589206> /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/tapout~.mxo/Contents/MacOS/tapout~
0x193bd000 - 0x193c1fff +org.ircam.amp_4~ ??? (1.0) /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/amp4~.mxo/Contents/MacOS/amp4~
0x193c5000 - 0x193c9fff +org.ircam.amp_2~ ??? (1.0) /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/amp2~.mxo/Contents/MacOS/amp2~
0x194d1000 - 0x194d8fff +org.ircam.8c-cluster_ext~ ??? (1.0) /var/folders/8J/8J6E5N95F4KUovJ5iYMusU+TI/TemporaryItems/appRuntime-mxt/8c-clusterext~.mxo/Contents/MacOS/8c-clusterext~
0x8fe00000 - 0x8fe4162b dyld 132.1 (???) <A4F6ADCC-6448-37B4-ED6C-ABB2CD06F448> /usr/lib/dyld
0x90003000 - 0x90005ff7 libRadiance.dylib ??? (???) <AB06F616-E3EA-5966-029A-8AA44BBE5B28> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ImageIO.framework/Versions/A/Resources/libRadiance.dylib
0x90006000 - 0x9000aff7 libGIF.dylib ??? (???) <3ECD4D2C-40FE-E9A0-A2D2-E36D1C00D3A8> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ImageIO.framework/Versions/A/Resources/libGIF.dylib
0x9000b000 - 0x9000cff7 com.apple.audio.units.AudioUnit 1.6.3 (1.6.3) <959DFFAE-A06B-7FF6-B713-B2076893EBBD> /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit
0x9000d000 - 0x9009ffe3 com.apple.print.framework.PrintCore 6.2 (312.5) <7729B4D7-D661-D669-FA7E-510F93F685A6> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ PrintCore.framework/Versions/A/PrintCore
0x900e2000 - 0x90113ff3 libTrueTypeScaler.dylib ??? (???) <7601D717-236D-8F4E-91F5-E69BB2920478> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ATS.framework/Versions/A/Resources/libTrueTypeScaler.dylib
0x90272000 - 0x90688ff7 libBLAS.dylib 219.0.0 (compatibility 1.0.0) <C4FB303A-DB4D-F9E8-181C-129585E59603> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.fr amework/Versions/A/libBLAS.dylib
0x907f4000 - 0x90837ff7 com.apple.NavigationServices 3.5.4 (182) <753B8906-06C0-3AE0-3D6A-8FF5AC18ED12> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/NavigationSer vices.framework/Versions/A/NavigationServices
0x90838000 - 0x909f2fe3 com.apple.ImageIO.framework 3.0.3 (3.0.3) <A93A514B-C1BF-21D0-FB03-CB775DE4FFAA> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ImageIO.framework/Versions/A/ImageIO
0x909f3000 - 0x90d17fef com.apple.HIToolbox 1.6.3 (???) <0A5F56E2-9AF3-728D-70AE-429522AEAD8A> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.fra mework/Versions/A/HIToolbox
0x90d20000 - 0x90d20ff7 com.apple.Accelerate.vecLib 3.6 (vecLib 3.6) <1DEC639C-173D-F808-DE0D-4070CC6F5BC7> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.fr amework/Versions/A/vecLib
0x90d9a000 - 0x90e4aff3 com.apple.ColorSync 4.6.3 (4.6.3) <AA1076EA-7665-3005-A837-B661260DBE54> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ColorSync.framework/Versions/A/ColorSync
0x91028000 - 0x91321fef com.apple.QuickTime 7.6.6 (1742) <89720F2A-F33B-FF09-3D81-F9F25A99F3EB> /System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime
0x913a1000 - 0x914b0fe7 com.apple.WebKit 6533.17 (6533.17.8) <7489BF63-4075-335A-93DE-878547A7A4B2> /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit
0x914b1000 - 0x914b1ff7 com.apple.Cocoa 6.6 (???) <EA27B428-5904-B00B-397A-185588698BCC> /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
0x914b2000 - 0x914c6ffb com.apple.speech.synthesis.framework 3.10.35 (3.10.35) <57DD5458-4F24-DA7D-0927-C3321A65D743> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ SpeechSynthesis.framework/Versions/A/SpeechSynthesis
0x914c7000 - 0x914ceff7 com.apple.agl 3.0.12 (AGL-3.0.12) <6877F0D8-0DCF-CB98-5304-913667FF50FA> /System/Library/Frameworks/AGL.framework/Versions/A/AGL
0x914cf000 - 0x914dfff7 libsasl2.2.dylib 3.15.0 (compatibility 3.0.0) <C8744EA3-0AB7-CD03-E639-C4F2B910BE5D> /usr/lib/libsasl2.2.dylib
0x915ba000 - 0x915d9fe3 libexpat.1.dylib 7.2.0 (compatibility 7.0.0) <82E6F83F-9667-2E39-1D9D-4A49C642527D> /usr/lib/libexpat.1.dylib
0x915da000 - 0x91615feb libFontRegistry.dylib ??? (???) <A102F61F-25D5-001A-20C3-56304C585072> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ATS.framework/Versions/A/Resources/libFontRegistry.dylib
0x917ab000 - 0x917f4fe7 libTIFF.dylib ??? (???) <9CFF48CC-4852-4D06-17AC-3C947C824159> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ImageIO.framework/Versions/A/Resources/libTIFF.dylib
0x91abf000 - 0x91b68ff7 com.apple.CFNetwork 454.9.7 (454.9.7) <B740E1BD-01B7-34C2-2A9A-6DBC68B1EA5B> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwo rk.framework/Versions/A/CFNetwork
0x91b69000 - 0x91bafff7 libauto.dylib ??? (???) <85670A64-3B67-8162-D441-D8E0BE15CA94> /usr/lib/libauto.dylib
0x91bb0000 - 0x91c5eff3 com.apple.ink.framework 1.3.3 (107) <57B54F6F-CE35-D546-C7EC-DBC5FDC79938> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Ink.framework /Versions/A/Ink
0x930cd000 - 0x9312efe7 com.apple.CoreText 3.1.0 (???) <1372DABE-F183-DD03-03C2-64B2464A4FD5> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ CoreText.framework/Versions/A/CoreText
0x934f1000 - 0x934f1ff7 com.apple.CoreServices 44 (44) <AC35D112-5FB9-9C8C-6189-5F5945072375> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
0x934f2000 - 0x93503ff7 com.apple.LangAnalysis 1.6.6 (1.6.6) <97511CC7-FE23-5AC3-2EE2-B5479FAEB316> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ LangAnalysis.framework/Versions/A/LangAnalysis
0x93800000 - 0x9385bff7 com.apple.framework.IOKit 2.0 (???) <A013B850-6ECB-594A-CBD6-DB156B11871B> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x93888000 - 0x9388bff7 libCoreVMClient.dylib ??? (???) <CA0BA8DC-0159-A808-A300-750358A6970C> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libCoreVMClien t.dylib
0x9388c000 - 0x938c4ff7 libcups.2.dylib 2.8.0 (compatibility 2.0.0) <76C02F5C-98FD-BD64-B5FB-C698FB76EA25> /usr/lib/libcups.2.dylib
0x938c5000 - 0x939a0fe7 com.apple.DesktopServices 1.5.7 (1.5.7) <A69072AD-C47E-A00D-4A69-6E46A7FB2119> /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/Desk topServicesPriv
0x939a1000 - 0x939acff7 libCSync.A.dylib 543.50.0 (compatibility 64.0.0) <4FA0CE4A-BDE5-0E3D-37F0-03B41F0C2637> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ CoreGraphics.framework/Versions/A/Resources/libCSync.A.dylib
0x939ad000 - 0x93a45fe7 edu.mit.Kerberos 6.5.10 (6.5.10) <8B83AFF3-C074-E47C-4BD0-4546EED0D1BC> /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos
0x93bca000 - 0x93bcaff7 com.apple.Carbon 150 (152) <9252D5F2-462D-2C15-80F3-109644D6F704> /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
0x93bcb000 - 0x93c35fe7 libstdc++.6.dylib 7.9.0 (compatibility 7.0.0) <411D87F4-B7E1-44EB-F201-F8B4F9227213> /usr/lib/libstdc++.6.dylib
0x93c36000 - 0x93c57fe7 com.apple.opencl 12.1 (12.1) <DA2AC3FA-ED11-2D10-21E9-7BDF4778B228> /System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL
0x93c58000 - 0x93cbcffb com.apple.htmlrendering 72 (1.1.4) <4D451A35-FAB6-1288-71F6-F24A4B6E2371> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HTMLRendering .framework/Versions/A/HTMLRendering
0x93d75000 - 0x93d78fe7 libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <1622A54F-1A98-2CBE-B6A4-2122981A500E> /usr/lib/system/libmathCommon.A.dylib
0x93d79000 - 0x93de8ff7 libvMisc.dylib 268.0.1 (compatibility 1.0.0) <2FC2178F-FEF9-6E3F-3289-A6307B1A154C> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.fr amework/Versions/A/libvMisc.dylib
0x93e63000 - 0x93e6aff3 com.apple.print.framework.Print 6.1 (237.1) <97AB70B6-C653-212F-CFD3-E3816D0F5C22> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framewo rk/Versions/A/Print
0x93ec0000 - 0x93fb2ff7 libcrypto.0.9.8.dylib 0.9.8 (compatibility 0.9.8) <D2C86308-F998-C83D-F49B-CD484D4EFE6A> /usr/lib/libcrypto.0.9.8.dylib
0x93fb3000 - 0x93fc7fe7 libbsm.0.dylib ??? (???) <14CB053A-7C47-96DA-E415-0906BA1B78C9> /usr/lib/libbsm.0.dylib
0x93fc8000 - 0x9414afe7 libicucore.A.dylib 40.0.0 (compatibility 1.0.0) <2314BD12-0821-75BB-F3BC-98D324CFD30A> /usr/lib/libicucore.A.dylib
0x9414b000 - 0x94204fe7 libsqlite3.dylib 9.6.0 (compatibility 9.0.0) <16CEF8E8-8C9A-94CD-EF5D-05477844C005> /usr/lib/libsqlite3.dylib
0x94205000 - 0x94256ff7 com.apple.HIServices 1.8.0 (???) <10C85B88-C6AF-91DB-2546-34661BA35AC5> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ HIServices.framework/Versions/A/HIServices
0x9425e000 - 0x94260ff7 com.apple.securityhi 4.0 (36638) <38D36D4D-C798-6ACE-5FA8-5C001993AD6B> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SecurityHI.fr amework/Versions/A/SecurityHI
0x94468000 - 0x94475ff7 com.apple.NetFS 3.2.1 (3.2.1) <5E61A00B-FA16-9D99-A064-47BDC5BC9A2B> /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS
0x944a9000 - 0x944c1ff7 com.apple.CFOpenDirectory 10.6 (10.6) <1537FB4F-C112-5D12-1E5D-3B1002A4038F> /System/Library/Frameworks/OpenDirectory.framework/Versions/A/Frameworks/CFOpen Directory.framework/Versions/A/CFOpenDirectory
0x944c2000 - 0x947e2feb com.apple.CoreServices.CarbonCore 861.13 (861.13) <52803668-3669-36BD-57DD-078FBA835081> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonC ore.framework/Versions/A/CarbonCore
0x947e3000 - 0x947edfe7 com.apple.audio.SoundManager 3.9.3 (3.9.3) <5F494955-7290-2D91-DA94-44B590191771> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CarbonSound.f ramework/Versions/A/CarbonSound
0x947ee000 - 0x947f2ff7 libGFXShared.dylib ??? (???) <2D32BDBF-C941-93FD-E233-F03D28DB9E94> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGFXShared.d ylib
0x947f3000 - 0x94999feb libSystem.B.dylib 125.2.0 (compatibility 1.0.0) <3441F338-2218-6D36-3F95-3A16FBF6713D> /usr/lib/libSystem.B.dylib
0x9499a000 - 0x9499fff7 com.apple.OpenDirectory 10.6 (10.6) <92582807-E8F3-3DD9-EB42-4195CFB754A1> /System/Library/Frameworks/OpenDirectory.framework/Versions/A/OpenDirectory
0x949a0000 - 0x94a71fe3 ColorSyncDeprecated.dylib 4.6.0 (compatibility 1.0.0) <8FDB4C40-D453-DA53-2A66-9A53998AB23C> /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ColorSync.f ramework/Versions/A/Resources/ColorSyncDeprecated.dylib
0x94acb000 - 0x94d2efef com.apple.security 6.1.1 (37594) <8AE73F5F-936C-80F6-B05B-A50C3082569C> /System/Library/Frameworks/Security.framework/Versions/A/Security
0x94d2f000 - 0x94d33ff7 IOSurface ??? (???) <66E11D8E-CF4B-EFD0-37F9-20177C647021> /System/Library/Frameworks/IOSurface.framework/Versions/A/IOSurface
0x94d34000 - 0x94d77ff7 libGLU.dylib ??? (???) <2093A1FB-67BD-39E0-CDE5-A97A77BDDBCE> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib
0x94d78000 - 0x94ea4fff com.apple.audio.toolbox.AudioToolbox 1.6.3 (1.6.3) <F0D7256E-0914-8E77-E37B-9720430422AB> /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
0x94eb2000 - 0x94eefff7 com.apple.SystemConfiguration 1.10.2 (1.10.2) <398BB007-41FD-1A30-26D8-CB86ED5E467E> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfi guration
0x94f0d000 - 0x94f31ff7 libJPEG.dylib ??? (???) <5CE96981-6B2A-D15B-4A17-E7BD329095B6> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ImageIO.framework/Versions/A/Resources/libJPEG.dylib
0x94f32000 - 0x94f54fef com.apple.DirectoryService.Framework 3.6 (621.3) <05FFDBDB-F16B-8AC0-DB42-986965FCBD95> /System/Library/Frameworks/DirectoryService.framework/Versions/A/DirectoryServi ce
0x94f58000 - 0x94ff5fe3 com.apple.LaunchServices 362.1 (362.1) <885D8567-9E40-0105-20BC-42C7FF657583> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchS ervices.framework/Versions/A/LaunchServices
0x94ff6000 - 0x950f7fe7 libxml2.2.dylib 10.3.0 (compatibility 10.0.0) <B4C5CD68-405D-0F1B-59CA-5193D463D0EF> /usr/lib/libxml2.2.dylib
0x952d4000 - 0x9536fff7 com.apple.ApplicationServices.ATS 4.3 (???) <7ECA252B-5F67-2816-A4F0-73E1DC833728> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ATS.framework/Versions/A/ATS
0x95370000 - 0x95567feb com.apple.JavaScriptCore 6533.17 (6533.17.6) <A88FBEE4-D53E-E865-B70E-7C01E75330E4> /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore
0x95568000 - 0x955aaff7 libvDSP.dylib 268.0.1 (compatibility 1.0.0) <3F0ED200-741B-4E27-B89F-634B131F5E9E> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.fr amework/Versions/A/libvDSP.dylib
0x9570c000 - 0x95787fe7 com.apple.audio.CoreAudio 3.2.2 (3.2.2) <51D0E2DC-B15F-AF6C-70D8-026DDAD4E2A5> /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio
0x95788000 - 0x9579dfff com.apple.ImageCapture 6.0 (6.0) <3F31833A-38A9-444E-02B7-17619CA6F2A0> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/ImageCapture. framework/Versions/A/ImageCapture
0x9579e000 - 0x957c6ff7 libxslt.1.dylib 3.24.0 (compatibility 3.0.0) <769EF4B2-C1AD-73D5-AAAD-1564DAEA77AF> /usr/lib/libxslt.1.dylib
0x959f0000 - 0x95b6afe3 com.apple.CoreFoundation 6.6.3 (550.29) <00373783-3744-F47D-2191-BEEA658F0C3D> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x95ba0000 - 0x95be4fe7 com.apple.Metadata 10.6.3 (507.10) <630494FA-3BB3-EDD3-E10B-8DAAF4831E26> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadat a.framework/Versions/A/Metadata
0x95bea000 - 0x95bf5ff7 libGL.dylib ??? (???) <B87E0676-F5EF-8DA3-6DEE-13C43B3832A7> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
0x95bf6000 - 0x95c16fe7 libresolv.9.dylib 41.0.0 (compatibility 1.0.0) <751955F3-21FB-A03A-4E92-1F3D4EFB8C5B> /usr/lib/libresolv.9.dylib
0x95c17000 - 0x95c33fe3 com.apple.openscripting 1.3.1 (???) <DA16DE48-59F4-C94B-EBE3-7FAF772211A2> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting .framework/Versions/A/OpenScripting
0x95c34000 - 0x95c5afff com.apple.DictionaryServices 1.1.1 (1.1.1) <02709230-9B37-C743-6E27-3FCFD18211F8> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Diction aryServices.framework/Versions/A/DictionaryServices
0x95c5b000 - 0x95c5bff7 com.apple.ApplicationServices 38 (38) <8012B504-3D83-BFBB-DA65-065E061CFE03> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Application Services
0x95d94000 - 0x95e5efef com.apple.CoreServices.OSServices 357 (357) <CF9530AD-F581-B831-09B6-16D9F9283BFA> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServi ces.framework/Versions/A/OSServices
0x95ea1000 - 0x95f7eff7 com.apple.vImage 4.0 (4.0) <64597E4B-F144-DBB3-F428-0EC3D9A1219E> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.fr amework/Versions/A/vImage
0x96009000 - 0x9600cffb com.apple.help 1.3.1 (41) <67F1F424-3983-7A2A-EC21-867BE838E90B> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Help.framewor k/Versions/A/Help
0x96014000 - 0x96a5fff7 com.apple.WebCore 6533.17 (6533.17.8) <CB22435A-3FAC-EAE2-3CF1-FB9D79635637> /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.frame work/Versions/A/WebCore
0x96a60000 - 0x96dc8ff7 com.apple.QuartzCore 1.6.2 (227.22) <4288F0D2-0C87-F054-C372-8764B44DE024> /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore
0x96dc9000 - 0x971feff7 libLAPACK.dylib 219.0.0 (compatibility 1.0.0) <5E2D2283-57DE-9A49-1DB0-CD027FEFA6C2> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.fr amework/Versions/A/libLAPACK.dylib
0x97318000 - 0x97424ff7 libGLProgrammability.dylib ??? (???) <1B315838-F477-5416-7504-67EC3433AD4A> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLProgramma bility.dylib
0x975a7000 - 0x975c2ff7 libPng.dylib ??? (???) <36A3D75E-5178-4358-7F02-444E276D61AD> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ImageIO.framework/Versions/A/Resources/libPng.dylib
0x977ef000 - 0x97a5fffb com.apple.Foundation 6.6.3 (751.29) <E77D3906-99F4-FEF4-FBB0-86FB3C94073E> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
0x97a60000 - 0x97a72ff7 com.apple.MultitouchSupport.framework 205.34 (205.34) <813475E3-B323-9405-F758-DDA1F5D63B20> /System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/Multit ouchSupport
0x97bb7000 - 0x97c37feb com.apple.SearchKit 1.3.0 (1.3.0) <9E18AEA5-F4B4-8BE5-EEA9-818FC4F46FD9> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchK it.framework/Versions/A/SearchKit
0x97c38000 - 0x97d66fe7 com.apple.CoreData 102.1 (251) <E6A457F0-A0A3-32CD-6C69-6286E7C0F063> /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
0x97d67000 - 0x97d67ff7 com.apple.Accelerate 1.6 (Accelerate 1.6) <BC501C9F-7C20-961A-B135-0A457667D03C> /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
0x97d92000 - 0x98672ff7 com.apple.AppKit 6.6.6 (1038.29) <6F28C335-6DC2-AE0E-B79A-F256DBD0BB45> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
0x98673000 - 0x98e62557 com.apple.CoreGraphics 1.543.50 (???) <74533178-5C90-0F54-1B06-2E1C5251ED5D> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ CoreGraphics.framework/Versions/A/CoreGraphics
0x98e63000 - 0x98e6fff7 libkxld.dylib ??? (???) <322A4B52-8305-3081-6B74-813C3A87A56D> /usr/lib/system/libkxld.dylib
0x98e70000 - 0x98e70ff7 liblangid.dylib ??? (???) <B99607FC-5646-32C8-2C16-AFB5EA9097C2> /usr/lib/liblangid.dylib
0x98f36000 - 0x98f77ff7 libRIP.A.dylib 543.50.0 (compatibility 64.0.0) <8BAE1FC1-A478-F151-17C7-2D5DE470AC4F> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ CoreGraphics.framework/Versions/A/Resources/libRIP.A.dylib
0x98f78000 - 0x98ffaffb SecurityFoundation ??? (???) <3670AE8B-06DA-C447-EB14-79423DB9C474> /System/Library/Frameworks/SecurityFoundation.framework/Versions/A/SecurityFoun dation
0x98ffb000 - 0x99009ff7 com.apple.opengl 1.6.9 (1.6.9) <4F06C166-00CF-5ACF-77E3-5A960A5E8AD3> /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
0x990e7000 - 0x99134feb com.apple.DirectoryService.PasswordServerFramework 6.0 (6.0) <BF66BA5D-BBC8-78A5-DBE2-F9DE3DD1D775> /System/Library/PrivateFrameworks/PasswordServer.framework/Versions/A/PasswordS erver
0x99143000 - 0x991f0fe7 libobjc.A.dylib 227.0.0 (compatibility 1.0.0) <DF8E4CFA-3719-3415-0BF1-E8C5E561C3B1> /usr/lib/libobjc.A.dylib
0x9926b000 - 0x992afff3 com.apple.coreui 2 (114) <29F8F1A4-1C96-6A0F-4CC2-9B85CF83209F> /System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/CoreUI
0x992b0000 - 0x992e3ff7 com.apple.AE 496.4 (496.4) <7F34EC47-8429-3077-8158-54F5EA908C66> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.fram ework/Versions/A/AE
0x99365000 - 0x993b5ff7 com.apple.framework.familycontrols 2.0.1 (2010) <B9762E20-543D-13B9-F6BF-E8585F04CA01> /System/Library/PrivateFrameworks/FamilyControls.framework/Versions/A/FamilyCon trols
0x993b6000 - 0x993d4ff7 com.apple.CoreVideo 1.6.1 (45.4) <E0DF044D-BF31-42CE-B690-FD1FCE07E64A> /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo
0x995b8000 - 0x995c6fe7 libz.1.dylib 1.2.3 (compatibility 1.0.0) <3CE8AA79-F077-F1B0-A039-9103A4A02E92> /usr/lib/libz.1.dylib
0x995c7000 - 0x9966fffb com.apple.QD 3.35 (???) <B80B64BC-958B-DA9E-50F9-D7E8333CC5A2> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ QD.framework/Versions/A/QD
0x996b8000 - 0x996b9ff7 com.apple.TrustEvaluationAgent 1.1 (1) <6C04C4C5-667E-2EBE-EB96-5B67BD4B2185> /System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Versions/A/Tru stEvaluationAgent
0x996fc000 - 0x99702fff com.apple.CommonPanels 1.2.4 (91) <2438AF5D-067B-B9FD-1248-2C9987F360BA> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CommonPanels. framework/Versions/A/CommonPanels
0x997b4000 - 0x997e5ff7 libGLImage.dylib ??? (???) <9340012D-595A-6243-9C97-7D30D76D9D9E> /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dyl ib
0x997e6000 - 0x997f0ffb com.apple.speech.recognition.framework 3.11.1 (3.11.1) <EC0E69C8-A121-70E8-43CF-E6FC4C7779EC> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecogni tion.framework/Versions/A/SpeechRecognition
0x997f1000 - 0x997f4ff7 libCGXType.A.dylib 543.50.0 (compatibility 64.0.0) <3B49AED9-0DBA-9D21-F9AC-8784363AD762> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ CoreGraphics.framework/Versions/A/Resources/libCGXType.A.dylib
0x997f5000 - 0x998e9ff7 libiconv.2.dylib 7.0.0 (compatibility 7.0.0) <9EC28185-D26F-533F-90C4-FBAA13A15947> /usr/lib/libiconv.2.dylib
0x998ea000 - 0x998eaff7 com.apple.vecLib 3.6 (vecLib 3.6) <7362077A-890F-3AEF-A8AB-22247B10E106> /System/Library/Frameworks/vecLib.framework/Versions/A/vecLib
0x998eb000 - 0x999a1ffb libFontParser.dylib ??? (???) <067DC1A2-764B-41EA-B07E-4205472749B7> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ ATS.framework/Versions/A/Resources/libFontParser.dylib
0x999a2000 - 0x999abff7 com.apple.DiskArbitration 2.3 (2.3) <E9C40767-DA6A-6CCB-8B00-2D5706753000> /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
0xffff0000 - 0xffff1fff libSystem.B.dylib ??? (???) <3441F338-2218-6D36-3F95-3A16FBF6713D> /usr/lib/libSystem.B.dylib
Model: MacBookPro5,5, BootROM MBP55.00AC.B03, 2 processors, Intel Core 2 Duo, 2.26 GHz, 4 GB, SMC 1.47f2
Graphics: NVIDIA GeForce 9400M, NVIDIA GeForce 9400M, PCI, 256 MB
Memory Module: global_name
AirPort: spairportwireless_card_type_airportextreme (0x14E4, 0x8D), Broadcom BCM43xx 1.0 (5.10.91.27)
Bluetooth: Version 2.3.7f1, 2 service, 19 devices, 1 incoming serial ports
Network Service: AirPort, AirPort, en1
Network Service: iPhone USB, Ethernet, en2
Serial ATA Device: Hitachi HTS545032B9SA02, 298.09 GB
Serial ATA Device: HL-DT-ST DVDRW GS23N
USB Device: iPhone, 0x05ac (Apple Inc.), 0x1292, 0x24100000
USB Device: Built-in iSight, 0x05ac (Apple Inc.), 0x8507, 0x24400000
USB Device: Internal Memory Card Reader, 0x05ac (Apple Inc.), 0x8403, 0x26500000
USB Device: Apple Internal Keyboard / Trackpad, 0x05ac (Apple Inc.), 0x0236, 0x04600000
USB Device: IR Receiver, 0x05ac (Apple Inc.), 0x8242, 0x04500000
USB Device: BRCM2046 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0x06100000
USB Device: Bluetooth USB Host Controller, 0x05ac (Apple Inc.), 0x8213, 0x06110000Division by zero is logic error which is with high probability caused by poor coding of the application therefore unlikely to have something to do with your macbook pro
-
Blank page on backing bean exception
When there is exception in the backing bean, a blank page is displayed. I was expecting response with status code 500. When I debug the http response the status code is 200. I have configured the webapp to display error page on status code 500. Since it is not returning status code 500, this page is not displayed.
In web.xml
<error-page>
<error-code> 500 </error-code>
<location>/500.jsf</location>
</error-page>
I am using Sun RI Implementation of JSF on weblogic 10.3
Please some one help me.
Here's a stack trace.
Note :I purposely introduced devide by zero exception in my backing bean action.
####<Mar 11, 2009 10:57:16 AM PDT> <Error> <HTTP> <KOLCHK1-D1> <AdminServer> <[ACTIVE] ExecuteThread: '21' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1236794236482> <BEA-101107> <[weblogic.servlet.internal.WebAppServletContext@1943319 - appName: 'sam', name: 'hcp', context-path: '/hcp', spec-version: '2.5'] Problem occurred while serving the error page.
javax.servlet.ServletException: / by zero
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:502)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:251)
at weblogic.servlet.internal.ForwardAction.run(ForwardAction.java:22)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.ErrorManager.handleException(ErrorManager.java:144)
at weblogic.servlet.internal.WebAppServletContext.handleThrowableFromInvocation(WebAppServletContext.java:2244)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2093)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)Then the problem lies somewhere else. I can't determine it based on the as far given information.
-
Dimming Display Brightness to Zero
Hello All,
I have been having a problem with the display brightness adjustment for a long time. Basically, the display of my 17" 1GHz G4 cannot be dimmed to black. From the System Preferences the display brightness can be lowered with the slider. In the final third however dragging the slider further to the left not only does not reduce the brightness it actually slightly increase it, and the display start to flicker.
Any ideas what could be the cause?That model doesn't support dimming the display brightness to zero, except through Energy Saver (which may not work with all third party USB devices), or a screen saver that has a picture that shows nothing but black. Some third party hacks dim the display, but they are not necessarily that reliable.
Only Apple's notebook displays dim to full black. -
RSA decryption Error: Data must start with zero
Because of some reasons, I tried to use RSA as a block cipher to encrypt/decrypt a large file. When I debug my program, there some errors are shown as below:
javax.crypto.BadPaddingException: Data must start with zero
at sun.security.rsa.RSAPadding.unpadV15(Unknown Source)
at sun.security.rsa.RSAPadding.unpad(Unknown Source)
at com.sun.crypto.provider.RSACipher.doFinal(RSACipher.java:356)
at com.sun.crypto.provider.RSACipher.engineDoFinal(RSACipher.java:394)
at javax.crypto.Cipher.doFinal(Cipher.java:2299)
at RSA.RRSSA.main(RRSSA.java:114)
From breakpoint, I think the problem is the decrypt operation, and Cipher.doFinal() can not be operated correctly.
I searched this problem from google, many people met the same problem with me, but most of them didn't got an answer.
The source code is :
Key generation:
package RSA;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.logging.Level;
import java.util.logging.Logger;
public class GenKey {
* @param args
* @author tang
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
KeyPairGenerator KPG = KeyPairGenerator.getInstance("RSA");
KPG.initialize(1024);
KeyPair KP=KPG.genKeyPair();
PublicKey pbKey=KP.getPublic();
PrivateKey prKey=KP.getPrivate();
//byte[] publickey = decryptBASE64(pbKey);
//save public key
FileOutputStream out=new FileOutputStream("RSAPublic.dat");
ObjectOutputStream fileOut=new ObjectOutputStream(out);
fileOut.writeObject(pbKey);
//save private key
FileOutputStream outPrivate=new FileOutputStream("RSAPrivate.dat");
ObjectOutputStream privateOut=new ObjectOutputStream(outPrivate);
privateOut.writeObject(prKey)
}Encrypte / Decrypt
package RSA;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.security.Key;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.crypto.Cipher;
//import sun.misc.BASE64Decoder;
//import sun.misc.BASE64Encoder;
public class RRSSA {
* @param args
public static void main(String[] argv) {
// TODO Auto-generated method stub
//File used to encrypt/decrypt
String dataFileName = argv[0];
//encrypt/decrypt: operation mode
String opMode = argv[1];
String keyFileName = null;
//Key file
if (opMode.equalsIgnoreCase("encrypt")) {
keyFileName = "RSAPublic.dat";
} else {
keyFileName = "RSAPrivate.dat";
try {
FileInputStream keyFIS = new FileInputStream(keyFileName);
ObjectInputStream OIS = new ObjectInputStream(keyFIS);
Key key = (Key) OIS.readObject();
Cipher cp = Cipher.getInstance("RSA/ECB/PKCS1Padding");//
if (opMode.equalsIgnoreCase("encrypt")) {
cp.init(Cipher.ENCRYPT_MODE, key);
} else if (opMode.equalsIgnoreCase("decrypt")) {
cp.init(Cipher.DECRYPT_MODE, key);
} else {
return;
FileInputStream dataFIS = new FileInputStream(dataFileName);
int size = dataFIS.available();
byte[] encryptByte = new byte[size];
dataFIS.read(encryptByte);
if (opMode.equalsIgnoreCase("encrypt")) {
FileOutputStream FOS = new FileOutputStream("cipher.txt");
//RSA Block size
//int blockSize = cp.getBlockSize();
int blockSize = 64 ;
int outputBlockSize = cp.getOutputSize(encryptByte.length);
/*if (blockSize == 0)
System.out.println("BLOCK SIZE ERROR!");
}else
int leavedSize = encryptByte.length % blockSize;
int blocksNum = leavedSize == 0 ? encryptByte.length / blockSize
: encryptByte.length / blockSize + 1;
byte[] cipherData = new byte[outputBlockSize*blocksNum];
//encrypt each block
for (int i = 0; i < blocksNum; i++) {
if ((encryptByte.length - i * blockSize) > blockSize) {
cp.doFinal(encryptByte, i * blockSize, blockSize, cipherData, i * outputBlockSize);
} else {
cp.doFinal(encryptByte, i * blockSize, encryptByte.length - i * blockSize, cipherData, i * outputBlockSize);
//byte[] cipherData = cp.doFinal(encryptByte);
//BASE64Encoder encoder = new BASE64Encoder();
//String encryptedData = encoder.encode(cipherData);
//cipherData = encryptedData.getBytes();
FOS.write(cipherData);
FOS.close();
} else {
FileOutputStream FOS = new FileOutputStream("plaintext.txt");
//int blockSize = cp.getBlockSize();
int blockSize = 64;
//int j = 0;
//BASE64Decoder decoder = new BASE64Decoder();
//String encryptedData = convert(encryptByte);
//encryptByte = decoder.decodeBuffer(encryptedData);
int outputBlockSize = cp.getOutputSize(encryptByte.length);
int leavedSize = encryptByte.length % blockSize;
int blocksNum = leavedSize == 0 ? encryptByte.length / blockSize
: encryptByte.length / blockSize + 1;
byte[] plaintextData = new byte[outputBlockSize*blocksNum];
for (int j = 0; j < blocksNum; j++) {
if ((encryptByte.length - j * blockSize) > blockSize) {
cp.doFinal(encryptByte, j * blockSize, blockSize, plaintextData, j * outputBlockSize);
} else {
cp.doFinal(encryptByte, j * blockSize, encryptByte.length - j * blockSize, plaintextData, j * outputBlockSize);
FOS.write(plaintextData);
//FOS.write(cp.doFinal(encryptByte));
FOS.close();
}Edited by: sabre150 on Aug 3, 2012 6:43 AM
Moderator action : added [ code] tags so as to make the code readable. Please do this yourself in the future.
Edited by: 949003 on 2012-8-3 上午5:311) Why are you not closing the streams when writing the keys to the file?
2) Each block of RSA encrypted data has size equal to the key modulus (in bytes). This means that for a key size of 1024 bits you need to read 128 bytes and not 64 bytes at a time when decrypting ( this is probably the cause of your 'Data must start with zero exception'). Since the input block size depends on the key modulus you cannot hard code this. Note - PKCS1 padding has at least 11 bytes of padding so on encrypting one can process a maximum of the key modulus in bytes less 11. Currently you have hard coded the encryption block at 64 bytes which is OK for your 1024 bits keys but will fail for keys of modulus less than about 936 bits.
3) int size = dataFIS.available(); is not a reliable way to get the size of an input stream. If you check the Javadoc for InputStream.available() you will see that it returns the number of bytes that can be read without blocking and not the stream size.
4) InputStream.read(byte[]) does not guarantee to read all the bytes and returns the number of bytes actually read. This means that your code to read the content of the file into an array may fail. Again check the Javadoc. To be safe you should used DataInputStream.readFully() to read a block of bytes.
5) Reading the whole of the cleartext or ciphertext file into memory does not scale and with very large files you will run out of memory. There is no need to do this since you can use a "read a block, write the transformed block" approach.
RSA is a very very very slow algorithm and it is not normal to encrypt the whole of a file using it. The standard approach is to perform the encryption of the file content using a symmetric algorithm such as AES using a random session key and use RSA to encrypt the session key. One then writes to the ciphertext file the RSA encrypted session key followed by the symmetric encrypted data. To make it more secure one should actually follow the extended procedure outlined in section 13.6 of Practical Cryptography by Ferguson and Schneier. -
Problem accessing exception object in jsp error page - Apache Tomcat 5.0.25
Hi all,
I'm thoroughly confused and need some help. I've deployed a very simple web application in Apache Tomcat 5.0.25 to test exception handling - errortest.jsp and error.jsp. errortest.jsp throws a divide by zero exception if executed with default values in text fields.
When I put the directive IsErrorPage="true" in error.jsp i get a HTTP 500 error when error.jsp is accessed. If I remove it error.jsp is displayed but I cant access the exception object - if I try to I get an exception below:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 5 in the jsp file: /error.jsp
Generated servlet error:
[javac] Compiling 1 source file
E:\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mywebapp\org\apache\jsp\error_jsp.java:46: cannot resolve symbol
symbol : variable exception
location: class org.apache.jsp.error_jsp
out.print(exception.getMessage());
^
1 error
Below is the code for the two jsp pages:
errortest.jsp:
<%@ page errorPage="error.jsp" %>
<html>
<head><title>Error test</title></head>
<body>
<form action="errortest.jsp" method="post">
Enter first number:<input type="text" name="first" value="5"/><br>
Enter second number:<input type="text" name="second" value="0"/><br>
<input type="submit"/>
</form>
<%
if (request.getMethod().equals("POST")) {
int first = Integer.parseInt( request.getParameter( "first" ) );
int second = Integer.parseInt( request.getParameter( "second" ) );
int answer = first/second;
%>
</body>
</html>
NB: I am able to catch and display the exception if I use a try/catch block around the division as shown below.
try {
int answer = first/second;
} catch( Exception e) {
e.printStackTrace( new PrintWriter(out) );
error.jsp (first draft)
NB: HTTP 500 error occurs when directive "isErrorPage" is added:
<%@ page isErrorPage="true" %>
<html>
<head><title>Error Page</title></head>
<body>
</body>
</html>
error.jsp (second draft)
NB: directive is removed but exception thrown when implicit exception object is accessed. error.jsp displays if exception object is not accessed:
<%@ page %>
<html>
<head><title>Error Page</title></head>
<body>
<%=exception.getMessage()%>
</body>
</html>
Web server specs:
Apache Tomcat 5.0.25
Machine specs:
Windows XP Pro
Java environments:
j2sdk1.4.2_03
J2EE 1.4This works for me:
throwError.jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page language="java" errorPage="/error.jsp"
contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>Throw Exception</title>
</head>
<body>
Throwing exception....
<%
// throw ArithmeticException
int badInt = 12/0;
%>
</body>
</html>
error.jsp
<%@ page language="java" isErrorPage="true" %>
<head><title>Doh!</title></head>
An Error has occurred in this application.
<% if (exception != null) { %>
<pre><% exception.printStackTrace(new java.io.PrintWriter(out)); %></pre>
<% } else { %>
Please check your log files for further information.
<% } %> -
I received an error message: "excpetion 10h in module lvrt.dll" while trying to print to a hp 1220c printer on a windows95 enviroment. the problem is that this is a printing fuction written 10 years ago, that I cannot touch, on labview 5.0. is there a way to go around this problem???
thanks rani.Rani,
The 10h (divide by zero) exception error was pretty common with HP printers/printer drivers 7-9 years ago. I ran into it with several programs, including LabVIEW. As I recall, one workaround was to configure the printer settings to disable the bi-directionality. You will not be able to get diagnostics from the printer, but that allowed printing in many of the cases. Alternatively, you can use a different (non-HP) printer. I think there may have been one or two other things to try, but I no longer remember what they are. You may want to try the HP website and search for the 10h error there for ideas/workarounds.
Regards,
Aaron -
Finally cause Exception be forgotten
In trying out that finally cause previous return value be forgotten, as described on page 206 of "The Java Programming Language, 3rd edition", I wrote the following code, and tested it with jdk1.3.1. To my supprise, not only the return value was forgotten, the exception was appeared forgotten as well:
class PException extends Exception {
class Final {
void f1(int i) {
int result;
System.out.println("f1("+i+")");
try {
result = f2(i);
System.out.println("result = " + result);
} catch(Exception e) {
System.out.println("caught an Exception: " + e);
try {
result = f3(i);
System.out.println("result = " + result);
} catch(Exception e) {
System.out.println("caught an Exception: " + e);
int f2(int i) throws PException {
try {
if (i == 1) {
System.out.println("generate exception");
throw new PException();
return 1;
} finally {
return 2;
int f3(int i) throws PException {
if (i == 1) {
System.out.println("generate exception");
throw new PException();
return 1;
public static void main(String[] args) {
Final f = new Final();
f.f1(1);
f.f1(2);
f.f1(1);
}Here is the result:
f1(1)
generate exception
result = 2
generate exception
caught an Exception: PException
f1(2)
result = 2
result = 1
f1(1)
generate exception
result = 2
generate exception
caught an Exception: PExceptionThe concern here is that when the
try {
finally {
}pattern is used, without the catch block, purelly for flow control purpose, a return statement in the finally block could be problematic. If a finally block ends with a return statement, any exception that might be thrown in the try block would be ignored. The unhandled exception will not propergate, it simply lost in the midst. Because any code could throw unchecked exception, if the exception cannot afford to be lost, then one should be careful not to use return in the finally block. See the following test code:
class Finally {
void test() {
int result;
System.out.println("test()");
try {
result = f1();
System.out.println("result = " + result);
} catch(Exception e) {
System.out.println("Caught an Exception: " + e);
try {
result = f2();
System.out.println("result = " + result);
} catch(Exception e) {
System.out.println("Caught an Exception: " + e);
try {
f3();
} catch(Exception e) {
System.out.println("Caught an Exception: " + e);
try {
f4();
} catch(Exception e) {
System.out.println("Caught an Exception: " + e);
int f1() {
System.out.println("f1()");
int a = 0;
int b = 0;
try {
a = 1/0; // this generate an unchecked exception
b = 1;
} finally {
return b; // this return clobber the unchecked exception
int f2() {
System.out.println("f2()");
int a = 0;
int b = 0;
a = 1/0; // this generate an unchecked exception
b = 1;
return b;
void f3() {
System.out.println("f3()");
int a = 0;
int b = 0;
try {
a = 1/0; // this generate an unchecked exception
b = 1;
} finally {
return; // this return clobber the unchecked exception
void f4() {
System.out.println("f4()");
int a = 0;
int b = 0;
try {
a = 1/0; // this generate an unchecked exception
b = 1;
} finally {
public static void main(String[] args) {
Finally f = new Finally();
f.test();
/code]
Here are the results:test()
f1()
result = 0
f2()
Caught an Exception: java.lang.ArithmeticException: / by zero
f3()
f4()
Caught an Exception: java.lang.ArithmeticException: / by zero
We see that the devide by zero exception throw by f1() simply vanished, the unintended result 0, instead of the intended result 1, is returned. The test() method did not detect any abnormality in f1(), which is scary. To drive the point home, we try f3() and f4(), which has void return type. A simple return statement in f3() causes exception be lost. The stack frame seems intact, for otherwise, the test() method would exit abruptly before f2() even get a chance to be called. -
Hi,
I have a multi-threaded EWS app that is pushing email, appointments, and contacts to Exchange2010SP3. Each thread is using a separate instance ExchangeService and is working with a different mailbox on each thread. We are seeing that
when 4 or more threads are running we are starting to see ArgumentOutOfRange [Count cannot be less then zero] exceptions in the EWS library. These errors appear to be happening sporadically.
Here is an example of one of stack traces:
Stack Trace --
at System.String.CopyTo(Int32 sourceIndex, Char[] destination, Int32 destinationIndex, Int32 count)
at System.IO.StreamWriter.Write(String value)
at System.IO.TextWriter.SyncTextWriter.Write(String value)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.BuildEwsHttpWebRequest()
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalBindToItems(IEnumerable`1 itemIds, PropertySet propertySet, ServiceErrorHandling errorHandling) at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToItem[TItem](ItemId itemId, PropertySet
propertySet) at Quest.Apollo.MigrationProviders.Interfaces.GenericRetryAction.InternalRetry[T](RetryMethod`1 retryMethod) in c:\Builds\272\Apollo\1.6.0 Nightly\Sources\Apollo.MigrationProviders.Interfaces\GenericRetryAction.cs:line 111 at Quest.Apollo.MigrationProviders.Interfaces.GenericRetryAction.Retry[T](RetryMethod`1
retryMethod, Boolean disableRetry) in c:\Builds\272\Apollo\1.6.0 Nightly\Sources\Apollo.MigrationProviders.Interfaces\GenericRetryAction.cs:line 135
These exceptions are occurring on various EWS operations, but mostly on FindItems and Bind operations. They only seem to occur against Exchange 2010 servers at least that's what I've seen so far. These issues appear to resemble some kind of race condition.
I did some searches on EWS, Race Condition, SyncTextWriter and I came across an interesting issue while searching on SyncTextWriter and Race Condition. I'm curious if this is what is causing this error to occur in the EWS library:
http://connect.microsoft.com/VisualStudio/feedback/details/249253/synchronized-textwriter-not-synchronizing-properly
The post indicates that SyncTextWriter was only designed to synchronize multiple threads against the same instance and that it was not designed to synchronize multiple threads against multiple instances SyncTextWriter. I've noticed that in all instances
of this error I've seen the stack traces always end up inside of SyncTextWriter. Is this a bug in the EWS libraries use of SyncTextWriter? Note: the above article does post workarounds for this issue. Can't tell if the EWS library is using any of these workarounds
or is avoiding this issue in some other way.
I know Microsoft doesn't claim that the EWS library is thread safe. However, I've seen many posts that seem to indicate that if a separate instances of the exchange service are used for each thread it works fine. Futhermore, we've run this app many times against
Office 365 and haven't seen this issue. It appears to only happen against Exchange 2010, but that maybe due to better throughput to the Exchange 2010 server compared to the Office 365 servers. Any help or insight would be greatly appreciated.
Thanks,
Steve
Hi,
Found a note explaining the significance of these errors.
It says:
"NZE-28862: SSL connection failed
Cause: This error occurred because the peer closed the connection.
Action: Enable Oracle Net tracing on both sides and examine the trace output. Contact Oracle Customer support with the trace output."
For further details you may refer the Note: 244527.1 - Explanation of "SSL call to NZ function nzos_Handshake failed" error codes
Thanks & Regards,
Sindhiya V. -
Secess zero and other duties ZERO during J1iex Post
Hi Gurus
In Import procurement process , during posting of J1iex, Secess is showing zero.
All duties are showing zero except BED.
same is the case during Migo.
Please help.
i have maintained excise defaults as
CVD - jcv1
ECS- jecv
ADC - jadc
In pricing:
excise accounts per excise transaction
am i missing something in tax procedure?
Please help,
Regards
BLUEHi,
It would be grateful if you share your Tax procedure whether it is TAXINN or TAXINJ.
Kindly check the condition record is available for Cess and Scess if it is TAXINN procedure.
Regards,
Karna J -
My BIOS Screen shows zeroes. What is wrong?
Instead of starting up, I get a screen that says "System Board (OOA)-Product name, Product Configuration, Product serial Number, Product Number". Then it says I should go to hp.com./go/techcenter/startup. If I go to the BIOS screen I have all zeroes except for the first line that is 1234567. I don't thinnk a virus could do this. Seems to me that I have a hardware problem, but if so, is it meaningful? I took it to Staples where I was told I had a virus. Sounds like bull to me.
This is not a virus issue and this could have happened because of a BIOS update or in case if your motherboard was replaced recently by HP or anyone else.
Kindly check more info here
http://h10025.www1.hp.com/ewfrf/wc/document?docname=c01443496&cc=us&dlc=en&lc=en&jumpid=reg_R1002_US...
This is a peer to peer forum and members over here help each other voluntarily . Please refer below link in order to Contact HP
http://www8.hp.com/us/en/hp-information/summary/ww-contact-us.html
//Click on Kudos and Accept as Solution if my reply was helpful and answered your question//
I am an HP employee!! -
How do Standard class based exceptions understand an exception?
Dear All,
Can any one explain how does the standard class based exceptions understand and identify the specific exception. For example CX_SY_ZERODIVIDE is an exception class we use to catch the divide by zero exception. How does the class understand it. To clear my point please refer the code below
data: v1 type i,
v2 type i.
try.
v2 = v1 / 0.
catch CX_SY_ZERODIVIDE.
The above code will work and an exception will be handled properly. But how??
suppose if i write..
try.
v1 = Apple
catch CX_SY_ZERODIVIDE.
it obviously doesnt work.
so my point is how does an exception class understand the exception?
I have very poor knowledge about it, i have checked the class CX_SY_ZERODIVIDE and its methods. There is no code in it. .
Any help would be greatly appreciated.
Thanks and Regards,
Abdullah.1) You can write your own log class. Call the log method from your catch
2) Upgrade to JDK1.4.0 and you can use the Logger function
3) Check jakarta for log4j -
Why no exception happened?
hallo, everyone here.
I've a question about 0 divident exception.
I wrote the following code, where c, d, and e should have triggered 0 divident exceptions, but in fact no exception happend. Why?
==========my code begins=================
class Mainp305 {
public static void main(String[] args) {
int a = 10;
int b = 0;
try{
System.out.println("get into try block");
b++;
int c = a / b;
System.out.println("value of c" + c);
int d = a/b;
System.out.println("value of d" + d);
int e=(a/b);
System.out.println("value of e" + e);
System.out.println("get out of try block");
} catch (Exception e) {
System.out.println("get into catch");
a++;
System.out.println("get out of catch");
} finally {
System.out.println("get into finally");
a++;
System.out.println("get out of finally");
System.out.println("a before print:" + a);
System.out.println(a++);
System.out.println("a after print:" + a);
============my code ends============
by the way, after I change my code as following, when I executed it, the 0 divident exception did happened. I don't knowd why.
Please do help me. Thank you.
======my changed code, begins==========
class Mainp305_2 {
public static void main(String[] args) {
int a = 10;
int b = 0;
int c = a / b;
System.out.println("value of c" + c);
======my changed code, ends============>
I've a question about 0 divident exception.
I wrote the following code, where c, d, and e should have triggered 0 divident exceptions, but in fact no exception happend. Why?
>
Because a 'divide by zero' exception only occurs when you attempt to 'divide by zero'.
This line of code sets 'b' to zero
nt b = 0;And this line of code increments 'b' to 1
b++;So these lines of code are dividing by 1
int c = a / b;
int d = a/b;
int e=(a/b);Dividing by 1 does not cause a 'divide by zero' exception.
>
after I change my code as following, when I executed it, the 0 divident exception did happened. I don't knowd why.
>
Because this line of code sets 'b' to 0
int b = 0;Anid this line of code tries to divide by 0
int c = a / b;Because a 'divide by zero' exception occurs when you attempt to 'divide by zero'.
For the Java spec for the postfix operator (++) see the Java Language Specification
http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.14.2
>
15.14.2. Postfix Increment Operator ++
the value 1 is added to the value of the variable and the sum is stored back into the variable. -
How do I convert an applet to a standalone application.
Hi Everyone,
I am currently working on this Applet, I have tried putting the main in and building a frame to hold the applet but everytime I try something I just get new errors, What I conclusively want to do is put the applet in a frame and add menus to the frame. I have listed the code below, its quite a lot, I hope someone can help though, am pulling hair out.
Many Thanks. Chris
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class SciCalc extends Applet implements ActionListener
// Entered a UID due to String conversion
private static final long serialVersionUID = 1;
int Counter; //Counts the number of digits entered
double Result; //The answer displayed, as well as the second
//operator taken for an operation
double Operand; //The first number entered for an operation
double Mem; //The variable which holds whatever value the user
//wants kept in "memory"
boolean DecimalFlag; //The 'flag' that will signify whether or not the
//decimal button has been pressed
boolean SignFlag; //The 'flag' that will signify whether or not the
//plus/minus button has been pressed
boolean OperatorKey; //The 'flag' that will signify whether or not any
//operator button has been pressed
boolean FunctionKey; //The 'flag' that will signify whether or not any
//function button has been pressed
boolean Rad,Grad,Deg; //The 'flags' that will signify that Rad, Grad or
//deg has been pressed
int Operator; //an integer value to indicate which operator
//button was pressed
char currchar; //a character to hold the value of the key most
//recently pressed
String GrStatus; //String to hold the status of various graphic
//operations of the program
String Status; //String to hold the status of various parts
//of the program
// LABEL DECLARATIONS
//This label will display all error messages
Label DisplError = new Label(" ",Label.CENTER);
//This label is just to the left of the Display Label lcdDisplay, and will
//indicate whether or not a value is being held in the calculator's "memory"
Label LabelMem = new Label(" ",Label.LEFT);
Label LabelRad = new Label(" ",Label.CENTER);
Label LabelDeg = new Label(" ",Label.CENTER);
Label LabelGrad = new Label(" ",Label.CENTER);
//This is the Display Label, which is declared as a label so the user will not
//be able to enter any text into it to possibly crash the calculator
Label lcdDisplay = new Label("0",Label.RIGHT);
Label SciCalc = new Label ("Sci Calc V1.0",Label.CENTER);
// END OF LABEL DECLARATIONS
public void surround (Graphics g){
g.setColor(new Color(0,0,0));
g.drawRect(0,0,350,400);
// DELCLARATION OF NUMERIC BUTTONS
Button button1 = new Button("1");
Button button2 = new Button("2");
Button button3 = new Button("3");
Button button4 = new Button("4");
Button button5 = new Button("5");
Button button6 = new Button("6");
Button button7 = new Button("7");
Button button8 = new Button("8");
Button button9 = new Button("9");
Button button0 = new Button("0");
// END OF NUMERIC BUTTON DECLARATION
// DECLARATION OF OPERATOR BUTTONS
Button buttonMinus = new Button("-");
Button buttonMultiply = new Button("x");
Button buttonPlus = new Button("+");
Button buttonEquals = new Button("=");
Button buttonDivide = new Button("�");
Button buttonClear = new Button("C");
Button buttonDecimal = new Button(".");
Button buttonMPlus = new Button("M+");
Button buttonMClear = new Button("MC");
Button buttonMRecall = new Button("MR");
// END OF OPERATOR BUTTON DECLARATION
// SCIENTIFIC BUTTON DECLARATION
Button buttonPi = new Button("Pi");
Button buttonSqrt = new Button("Sqrt");
Button buttonCbrt = new Button("Cbrt");
Button buttonx2 = new Button("x2");
Button buttonyX = new Button("yX");
Button buttonPlusMinus = new Button("+-");
Button buttonRad = new Button("RAD");
Button buttonGrad = new Button("GRAD");
Button buttonDeg = new Button("DEG");
Button buttonSin = new Button("SIN");
Button buttonCos = new Button("COS");
Button buttonTan = new Button("TAN");
Button buttonExp = new Button("EXP");
Button buttonLogn = new Button("Ln");
Button buttonOpenBracket = new Button("(");
Button buttonLog = new Button("log");
// END OF SCIENTIFIC BUTTON DECLARATION
// START OF INIT METHOD
//This the only method that is called explicitly -- every other method is
//called depending on the user's actions.
public void init()
//Allows for configuring a layout with the restraints of a grid or
//something similar
setLayout(null);
//APPLET DEFAULTS
//This will resize the applet to the width and height provided
resize(350,400);
//This sets the default font to Helvetica, plain, size 12
setFont(new Font("Helvetica", Font.PLAIN, 12));
//This sets the applet background colour
setBackground(new Color(219,240,219));
//END OF APPLET DEFAULTS
//LABEL INITIALISATION
//Display Panel, which appears at the top of the screen. The label is
//placed and sized with the setBounds(x,y,width,height) method, and the
//font, foreground color and background color are all set. Then the
//label is added to the layout of the applet.
lcdDisplay.setBounds(42,15,253,30);
lcdDisplay.setFont(new Font("Helvetica", Font.PLAIN, 14));
lcdDisplay.setForeground(new Color(0,0,0));
lcdDisplay.setBackground(new Color(107,128,128));
add(lcdDisplay);
//Memory Panel, which appears just to the right of the Display Panel.
//The label is placed and sized with the setBounds(x,y,width,height)
//method, and the font, foreground color and background color are all
//set. Then the label is added to the layout of the applet.
LabelMem.setBounds(20,15,20,30);
LabelMem.setFont(new Font("Helvetica", Font.BOLD, 16));
LabelMem.setForeground(new Color(193,0,0));
LabelMem.setBackground(new Color(0,0,0));
add(LabelMem);
//Rad,Grad and Deg panels,which appear below the memory panel.
LabelRad.setBounds(20,50,20,15);
LabelRad.setFont(new Font("Helvetica", Font.BOLD, 8));
LabelRad.setForeground(new Color(193,0,0));
LabelRad.setBackground(new Color(0,0,0));
add(LabelRad);
LabelDeg.setBounds(20,70,20,15);
LabelDeg.setFont(new Font("Helvetica", Font.BOLD, 8));
LabelDeg.setForeground(new Color(193,0,0));
LabelDeg.setBackground(new Color(0,0,0));
add(LabelDeg);
LabelGrad.setBounds(20,90,20,15);
LabelGrad.setFont(new Font("Helvetica", Font.BOLD, 8));
LabelGrad.setForeground(new Color(193,0,0));
LabelGrad.setBackground(new Color(0,0,0));
add(LabelGrad);
//SciCalc v1.0 Label, this merely indicates the name.
SciCalc.setBounds(60,350,200,50);
SciCalc.setFont(new Font("papyrus", Font.BOLD, 25));
SciCalc.setForeground(new Color(0,50,191));
SciCalc.setBackground(new Color(219,219,219));
add(SciCalc);
//END OF LABEL INITIALISATION
//NUMERIC BUTTON INITIALISATION
button1.addActionListener(this);
button1.setBounds(42,105,60,34);
button1.setForeground(new Color(0,0,0));
button1.setBackground(new Color(128,128,128));
button1.setFont(new Font("Dialog", Font.BOLD, 18));
add(button1);
button2.addActionListener(this);
button2.setBounds(106,105,60,34);
button2.setForeground(new Color(0,0,0));
button2.setBackground(new Color(128,128,128));
button2.setFont(new Font("Dialog", Font.BOLD, 18));
add(button2);
button3.addActionListener(this);
button3.setBounds(170,105,60,34);
button3.setForeground(new Color(0,0,0));
button3.setBackground(new Color(128,128,128));
button3.setFont(new Font("Dialog", Font.BOLD, 18));
add(button3);
button4.addActionListener(this);
button4.setBounds(42,145,60,34);
button4.setForeground(new Color(0,0,0));
button4.setBackground(new Color(128,128,128));
button4.setFont(new Font("Dialog", Font.BOLD, 18));
add(button4);
button5.addActionListener(this);
button5.setBounds(106,145,60,34);
button5.setForeground(new Color(0,0,0));
button5.setBackground(new Color(128,128,128));
button5.setFont(new Font("Dialog", Font.BOLD, 18));
add(button5);
button6.addActionListener(this);
button6.setBounds(170,145,60,34);
button6.setForeground(new Color(0,0,0));
button6.setBackground(new Color(128,128,128));
button6.setFont(new Font("Dialog", Font.BOLD, 18));
add(button6);
button7.addActionListener(this);
button7.setBounds(42,185,60,34);
button7.setForeground(new Color(0,0,0));
button7.setBackground(new Color(128,128,128));
button7.setFont(new Font("Dialog", Font.BOLD, 18));
add(button7);
button8.addActionListener(this);
button8.setBounds(106,185,60,34);
button8.setForeground(new Color(0,0,0));
button8.setBackground(new Color(128,128,128));
button8.setFont(new Font("Dialog", Font.BOLD, 18));
add(button8);
button9.addActionListener(this);
button9.setBounds(170,185,60,34);
button9.setForeground(new Color(0,0,0));
button9.setBackground(new Color(128,128,128));
button9.setFont(new Font("Dialog", Font.BOLD, 18));
add(button9);
button0.addActionListener(this);
button0.setBounds(106,225,60,34);
button0.setForeground(new Color(0,0,0));
button0.setBackground(new Color(128,128,128));
button0.setFont(new Font("Dialog", Font.BOLD, 18));
add(button0);
//END OF NUMERIC BUTTON INITIALISATION
//OPERATOR BUTTON INITIALISATION
buttonDecimal.addActionListener(this);
buttonDecimal.setBounds(42,225,60,34);
buttonDecimal.setForeground(new Color(0,0,0));
buttonDecimal.setBackground(new Color(254,204,82));
buttonDecimal.setFont(new Font("Dialog", Font.BOLD, 18));
add(buttonDecimal);
buttonPlusMinus.addActionListener(this);
buttonPlusMinus.setBounds(106,325,60,17);
buttonPlusMinus.setForeground(new Color(0,0,0));
buttonPlusMinus.setBackground(new Color(0,118,191));
buttonPlusMinus.setFont(new Font("Dialog", Font.BOLD, 16));
add(buttonPlusMinus);
buttonMinus.addActionListener(this);
buttonMinus.setBounds(234,145,60,34);
buttonMinus.setForeground(new Color(0,0,0));
buttonMinus.setBackground(new Color(254,204,82));
buttonMinus.setFont(new Font("Dialog", Font.BOLD, 18));
add(buttonMinus);
buttonMultiply.addActionListener(this);
buttonMultiply.setBounds(234,225,60,34);
buttonMultiply.setForeground(new Color(0,0,0));
buttonMultiply.setBackground(new Color(254,204,82));
buttonMultiply.setFont(new Font("Dialog", Font.BOLD, 18));
add(buttonMultiply);
buttonPlus.addActionListener(this);
buttonPlus.setBounds(234,105,60,34);
buttonPlus.setForeground(new Color(0,0,0));
buttonPlus.setBackground(new Color(254,204,82));
buttonPlus.setFont(new Font("Dialog", Font.BOLD, 18));
add(buttonPlus);
buttonEquals.addActionListener(this);
buttonEquals.setBounds(170,225,60,34);
buttonEquals.setForeground(new Color(0,0,0));
buttonEquals.setBackground(new Color(254,204,82));
buttonEquals.setFont(new Font("Dialog", Font.BOLD, 18));
add(buttonEquals);
buttonDivide.addActionListener(this);
buttonDivide.setBounds(234,185,60,34);
buttonDivide.setForeground(new Color(0,0,0));
buttonDivide.setBackground(new Color(254,204,82));
buttonDivide.setFont(new Font("Dialog", Font.BOLD, 18));
add(buttonDivide);
buttonClear.addActionListener(this);
buttonClear.setBounds(234,65,60,34);
buttonClear.setFont(new Font("Dialog", Font.BOLD, 18));
buttonClear.setForeground(new Color(0,0,0));
buttonClear.setBackground(new Color(193,0,0));
add(buttonClear);
buttonMPlus.addActionListener(this);
buttonMPlus.setBounds(170,65,60,34);
buttonMPlus.setFont(new Font("Dialog", Font.BOLD, 18));
buttonMPlus.setForeground(new Color(0,0,0));
buttonMPlus.setBackground(new Color(254,204,82));
add(buttonMPlus);
buttonMClear.addActionListener(this);
buttonMClear.setBounds(42,65,60,34);
buttonMClear.setForeground(new Color(193,0,0));
buttonMClear.setBackground(new Color(254,204,82));
buttonMClear.setFont(new Font("Dialog", Font.BOLD, 18));
add(buttonMClear);
buttonMRecall.addActionListener(this);
buttonMRecall.setBounds(106,65,60,34);
buttonMRecall.setForeground(new Color(0,0,0));
buttonMRecall.setBackground(new Color(254,204,82));
buttonMRecall.setFont(new Font("Dialog", Font.BOLD, 18));
add(buttonMRecall);
//END OF OPERATOR BUTTON INITIALISATION
// SCIENTIFIC BUTTONS INITIALISATION
buttonPi.addActionListener(this);
buttonPi.setBounds(42,265,60,17);
buttonPi.setForeground(new Color(0,0,0));
buttonPi.setBackground(new Color(0,118,191));
buttonPi.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonPi);
buttonSqrt.addActionListener(this);
buttonSqrt.setBounds(106,265,60,17);
buttonSqrt.setForeground(new Color(0,0,0));
buttonSqrt.setBackground(new Color(0,118,191));
buttonSqrt.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonSqrt);
buttonCbrt.addActionListener(this);
buttonCbrt.setBounds(170,265,60,17);
buttonCbrt.setForeground(new Color(0,0,0));
buttonCbrt.setBackground(new Color(0,118,191));
buttonCbrt.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonCbrt);
buttonyX.addActionListener(this);
buttonyX.setBounds(42,285,60,17);
buttonyX.setForeground(new Color(0,0,0));
buttonyX.setBackground(new Color(0,118,191));
buttonyX.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonyX);
buttonx2.addActionListener(this);
buttonx2.setBounds(234,265,60,17);
buttonx2.setForeground(new Color(0,0,0));
buttonx2.setBackground(new Color(0,118,191));
buttonx2.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonx2);
buttonRad.addActionListener(this);
buttonRad.setBounds(170,285,60,17);
buttonRad.setForeground(new Color(0,0,0));
buttonRad.setBackground(new Color(0,118,191));
buttonRad.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonRad);
buttonGrad.addActionListener(this);
buttonGrad.setBounds(234,285,60,17);
buttonGrad.setForeground(new Color(0,0,0));
buttonGrad.setBackground(new Color(0,118,191));
buttonGrad.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonGrad);
buttonDeg.addActionListener(this);
buttonDeg.setBounds(106,285,60,17);
buttonDeg.setForeground(new Color(0,0,0));
buttonDeg.setBackground(new Color(0,118,191));
buttonDeg.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonDeg);
buttonSin.addActionListener(this);
buttonSin.setBounds(42,305,60,17);
buttonSin.setForeground(new Color(0,0,0));
buttonSin.setBackground(new Color(0,118,191));
buttonSin.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonSin);
buttonCos.addActionListener(this);
buttonCos.setBounds(106,305,60,17);
buttonCos.setForeground(new Color(0,0,0));
buttonCos.setBackground(new Color(0,118,191));
buttonCos.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonCos);
buttonTan.addActionListener(this);
buttonTan.setBounds(170,305,60,17);
buttonTan.setForeground(new Color(0,0,0));
buttonTan.setBackground(new Color(0,118,191));
buttonTan.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonTan);
buttonExp.addActionListener(this);
buttonExp.setBounds(234,305,60,17);
buttonExp.setForeground(new Color(193,0,0));
buttonExp.setBackground(new Color(0,118,191));
buttonExp.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonExp);
buttonLogn.addActionListener(this);
buttonLogn.setBounds(234,325,60,17);
buttonLogn.setForeground(new Color(0,0,0));
buttonLogn.setBackground(new Color(0,118,191));
buttonLogn.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonLogn);
buttonOpenBracket.addActionListener(this);
buttonOpenBracket.setBounds(42,325,60,17);
buttonOpenBracket.setForeground(new Color(0,0,0));
buttonOpenBracket.setBackground(new Color(0,118,191));
buttonOpenBracket.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonOpenBracket);
buttonLog.addActionListener(this);
buttonLog.setBounds(170,325,60,17);
buttonLog.setForeground(new Color(0,0,0));
buttonLog.setBackground(new Color(0,118,191));
buttonLog.setFont(new Font("Dialog", Font.BOLD, 10));
add(buttonLog);
//END OF SCIENTIFIC BUTTON INITIALISATION
//DISPLERROR INITIALISATION
DisplError.setBounds(42,45,253,15);
DisplError.setFont(new Font("Dialog", Font.BOLD, 8));
DisplError.setForeground(new Color(16711680));
DisplError.setBackground(new Color(0));
add(DisplError);
//END OF DISPLERROR INITIALISATION
Clicked_Clear(); //calls the Clicked_Clear method (C button)
} //END OF INIT METHOD
//The following integers are declared as final as they will
//be used for determining which button has been pushed
public final static int OpMinus=11,
OpMultiply=12,
OpPlus=13,
OpDivide=15,
OpMPlus=19,
OpMClear=20,
OpMR=21,
OpyX=22,
OpExp=23;
//This method is called whenever anything needs to be displayed
//in the error message field at the bottom of the calculator,
//accepting a String as an argument
void DisplayError(String err_msg)
//Calls the setText method of the Label DisplError, sending
//whatever string it received initially
DisplError.setText(err_msg);
//This method is called whenever a numeric button (0-9) is pushed.
public void NumericButton(int i)
DisplayError(" "); //Clears the error message field
//Declares a String called Display that will initialize to whatever
//is currently displayed in the lcdDisplay of the calculator
String Display = lcdDisplay.getText();
//Checks if an operator key has just been pressed, and if it has,
//then the limit of 20 digits will be reset for the user so that
//they can enter in up to 20 new numbers
if (OperatorKey == true)
Counter = 0;
Counter = Counter + 1; //increments the counter
//This is a condition to see if the number currently displayed is zero OR
//an operator key other than +, -, *, or / has been pressed.
if ((Display == "0") || (Status == "FIRST"))
Display= ""; //Do not display any new info
if (Counter < 21) //if more than 20 numbers are entered
//The number just entered is appended to the string currently displayed
Display = Display + String.valueOf(i);
else
//call the DisplayError method and send it an error message string
DisplayError("Digit Limit of 20 Digits Reached");
lcdDisplay.setText(Display); //sets the text of the lcdDisplay
//Label
Status = "VALID"; //sets the Status string to valid
OperatorKey = false; //no operator key was pressed
FunctionKey = false; //no function key was pressed
//This method is called whenever an operator button is pressed, and is
//sent an integer value representing the button pressed.
public void OperatorButton(int i)
DisplayError(" "); //Clears the error message field
//Creates a new Double object with the specific purpose of retaining
//the string currently on the lcdDisplay label, and then immediately
//converts that string into a double-precision real number and then
//gives that number to the variable Result.
Result = (new Double(lcdDisplay.getText())).doubleValue();
//If no operator key has been pressed OR a function has been pressed
if ((OperatorKey == false) || (FunctionKey = true))
switch (Operator) //depending on the operation performed
//if the user pressed the addition button, add the two numbers
//and put them in double Result
case OpPlus : Result = Operand + Result;
break;
//if the user pressed the subtraction button, subtract the two
//numbers and put them in double Result
case OpMinus : Result = Operand - Result;
break;
//if the user pressed the multiplication button, multiply
//the two numbers and put them in double Result
case OpMultiply : Result = Result * Operand;
break;
//if the user pressed the yX button, take first number
//and multiply it to the power of the second number
case OpyX : double temp1=Operand;
for (int loop=0; loop<Result-1; loop++){
temp1= temp1*Operand;
Result=temp1;
break;
//if the user pressed the Exp button -----------------Find out what this does-------------
case OpExp : temp1=10;
for(int loop=0; loop<Result-1; loop++)
temp1=temp1*10;
Result=Result*temp1;
break;
//if the user pressed the division button, check to see if
//the second number entered is zero to avoid a divide-by-zero
//exception
case OpDivide : if (Result == 0)
//set the Status string to indicate an
//an error
Status = "ERROR";
//display the word "ERROR" on the
//lcdDisplay label
lcdDisplay.setText("ERROR");
//call the DisplayError method and
//send it a string indicating an error
//has occured and of what type
DisplayError("ERROR: Division by Zero");
else
//divide the two numbers and put the
//answer in double Result
Result = Operand / Result;
//if after breaking from the switch the Status string is not set
//to "ERROR"
if (Status != "ERROR")
Status = "FIRST"; //set the Status string to "FIRST" to
//indicate that a simple operation was
//not performed
Operand = Result; //Operand holds the value of Result
Operator = i; //the integer value representing the
//operation being performed is stored
//in the integer Operator
//The lcdDisplay label has the value of double Result
//displayed
lcdDisplay.setText(String.valueOf(Result));
//The boolean decimal flag is set false, indicating that the
//decimal button has not been pressed
DecimalFlag = false;
//The boolean sign flag is set false, indicating that the sign
//button has not been pressed
SignFlag = false;
//The boolean OperatorKey is set true, indicating that a simple
//operation has been performed
OperatorKey = true;
//The boolean FunctionKey is set false, indicating that a
//function key has not been pressed
FunctionKey = false;
DisplayError(" "); //Clears the error message field
} //end of OperatorButton method
//This is a method that is called whenever the decimal button is
//pressed.
public void DecimalButton()
DisplayError(" "); //Clears the error message field
//Declares a String called Display that will initialize to whatever
//is currently displayed in the lcdDisplay of the calculator
String Display = lcdDisplay.getText();
//if a simple operation was performed successfully
if (Status == "FIRST")
Display = "0"; //set Display string to character 0
//If the decimal button has not already been pressed
if (!DecimalFlag)
//appends a decimal to the string Display
Display = Display + ".";
else
//calls the DisplayError method, sending a string
//indicating that the number already has a decimal
DisplayError("Number already has a Decimal Point");
//calls the setText method of the Label lcdDisplay and
//sends it the string Display
lcdDisplay.setText(Display);
DecimalFlag = true; //the decimal key has been pressed
Status = "VALID"; //Status string indicates a valid
//operation has been performed
OperatorKey = false; //no operator key has been pressed
} //end of the DecimalButton method
/* This method is called whenever the percent button is pressed
void Open_Bracket(){
String Display = "(";
lcdDisplay.setText(Display);//-----------Change this--------------
//This method is called first when the calculator is initialized
//with the init() method, and is called every time the "C" button
//is pressed
void Clicked_Clear()
Counter = 0; //sets the counter to zero
Status = "FIRST"; //sets Status to FIRST
Operand = 0; //sets Operand to zero
Result = 0; //sets Result to zero
Operator = 0; //sets Operator integer to zero
DecimalFlag = false; //decimal button has not been
//pressed
SignFlag = false; //sign button has not been pressed
OperatorKey = false; //no operator button has been
//pressed
FunctionKey = false; //no function button has been
//pressed
//calls the setText method of Label lcdDisplay and sends
//it the character "0"
lcdDisplay.setText("0");
DisplayError(" "); //clears the error message field
//This method is called whenever the sign button is pressed
void PlusMinusButton()
DisplayError(" "); //clears the error message field
//Declares a String called Display that will initialize to whatever
//is currently displayed in the lcdDisplay of the calculator
String Display = lcdDisplay.getText();
//if Status is not set to FIRST and the Display string does not
//hold the value "0"
if ((Status != "FIRST") || (Display != "0"))
//Creates a new Double object with the specific purpose of retaining
//the string currently on the lcdDisplay label, and then immediately
//converts that string into a double-precision real number and then
//gives that number to the variable Result.
Result = (new Double(lcdDisplay.getText())).doubleValue();
//sets the double Result to it's negative value
Result = -Result;
//call the setText method of Label lcdDisplay and send it the string
//that represents the value in Result
lcdDisplay.setText(String.valueOf(Result));
Status = "VALID"; //sets Status string to VALID
SignFlag = true; //the sign button has been pressed
DecimalFlag = true; //a decimal has appeared
} //end of the PlusMinusButton method
//This method is called whenever the square button is pressed */
void SqrButton()
DisplayError(" "); //clears the error message field
//Declares a String called Display that will initialize to whatever
//is currently displayed in the lcdDisplay of the calculator
String Display = lcdDisplay.getText();
//if Status is not set to FIRST and the Display string does not
//hold the value "0"
if ((Status != "FIRST") || (Display != "0"))
//Creates a new Double object with the specific purpose of retaining
//the string currently on the lcdDisplay label, and then immediately
//converts that string into a double-precision real number and then
//gives that number to the variable Result.
Result = (new Double(lcdDisplay.getText())).doubleValue();
//multiply the double Result by itself, effectively squaring
//the number
Result = Result * Result;
//call the setText method of Label lcdDisplay and send it the string
//that represents the value in Result
lcdDisplay.setText( &Chris,
Two issues:
1) Applet has init(), start(), etc. Application has main().
2) Applet is a container and you can add stuff to it. With application, you need to create your own container.
What you want to do is code so that you can run either way. In the applet, create a Panel or JPanel and add everything to the panel. Then add the panel to the applet. Get that working as an applet.
Now add a main(). All it has to do is create a Frame or JFrame, add the panel to the frame and then call init().
On another subject, your code looks very good, except for the method length getting out of hand. Try breaking init() into pieces in a bunch of methods:
public void init() {
doThis();
doThat();
doTheOther();
private void doThis() {
// maybe a couple dozen lines here
// etc. -
If you need to FTP with PL/SQL...
If you need to perform FTP from within PL/SQL and your database version has the UTL_TCP package, here is a free package you can use. The source code is hopefully documented well enough for you to tell what's going on and how to use the functions. Suggestions on improving the code are welcome, and I can provide limited support via email for what I've written, but I would encourage anyone who uses the code to modify/fix it according to their needs. If you modify the code, I respectfully request that you leave intact the authorship and note comments at the beginning of the package.
Please note that I have not rigorously tested this code, but it has successfully transferred files in both directions in the limited tests that I have performed.
-- Copy the code below and run it in your favorite SQL editor --
CREATE OR REPLACE PACKAGE FTP IS
Simplified FTP client API using UTL_TCP package
Author: Alan Wessman, Brigham Young University
Note: This FTP client attempts to adhere to the protocol and advice found at:
http://cr.yp.to/ftp.html
No warranties are made regarding the correctness of this code.
Notes:
1. Most of these functions will raise UTL_TCP.NETWORK_ERROR if the connection
is not open or is reset during the network transaction. They will also
raise VALUE_ERROR if the server response is ill-formed or a buffer is
too small to hold data. (Most buffers in this package are defined as
VARCHAR2(32767) to avoid size limitations; reduce this if memory overhead
is a concern.)
2. "Verbose mode" can be enabled/disabled by changing the default value of
the vDebug variable in the package body. Setting vDebug to TRUE will
cause a session transcript to be output to DBMS_OUTPUT.
3. The following is an example of how this package might be used:
declare
c utl_tcp.connection;
vresp varchar2(32767);
vbuf varchar2(32767);
vresp_code number;
vremote_host varchar2(32) := 'some.hostname.com';
vusername varchar2(8) := 'username';
vpassword varchar2(8) := 'password';
begin
dbms_output.put_line( 'Opening session...' );
vresp_code := ftp.open_session( c,
vremote_host,
vusername,
vpassword,
vresp,
5 );
vresp_code := ftp.put( c,
'/home/somebody',
'local.test',
'remote.test',
vresp );
vresp_code := ftp.remote_command( c, 'CHMOD 660 remote.test' );
vresp_code := ftp.chdir( c, '/home/somebody/subdir' );
vresp_code := ftp.pwd( c );
vresp_code := ftp.get( c,
'/home/somebody',
'new_file.test',
'another_remote_file.test',
vresp );
vresp_code := ftp.close_session( c );
dbms_output.put_line( 'Closed session.' );
exception
when others then dbms_output.put_line( sqlcode || ':' || sqlerrm );
end;
Function: Open_Session
Description: Begins an FTP session with the remote server.
Parameters:
conn OUT parameter that contains the connection info; to be passed
in to subsequent commands to maintain session state.
host Name or IP address of remote server
username User ID to use for login
password Password to use for login
response OUT parameter; buffer for server replies
timeout_secs Number of seconds for TCP timeout. Pass in NULL to disable
timeout (wait forever for responses). Pass in 0 (zero) for
no wait.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if host parameter is incorrect or if
some other networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Open_Session( conn OUT NOCOPY UTL_TCP.Connection,
host IN VARCHAR2,
username IN VARCHAR2,
password IN VARCHAR2,
response OUT VARCHAR2,
timeout_secs IN NUMBER DEFAULT 60 ) RETURN NUMBER;
Function: Get
Description: Retrieves a file on the remote server and stores its contents in
a VARCHAR2 buffer.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
buf OUT parameter; buffer for retrieved file contents
remote_path Pathname (including file name) indicating location of remote
file to be retrieved
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed or buf is
too small for file contents.
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
buf OUT VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Get
Description: Retrieves a file on the remote server and stores its contents in
a local file. Assumes an open file handle and does not close it.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
local_file IN OUT parameter; UTL_FILE file handle for input file. File
is assumed to be open for writing.
remote_path Pathname (including file name) indicating location of remote
file to be retrieved
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed or buf is
too small for file contents.
May raise any of the UTL_FILE exceptions if file write operations
fail. See UTL_FILE documentation for additional details.
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
local_file IN OUT UTL_FILE.File_Type,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Get
Description: Retrieves a file on the remote server and stores its contents in
a local file. Opens and closes local file automatically.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
local_path Pathname of local directory in which to store the retrieved
file's contents
local_filename Name of local file in which to store retrieved file's contents
(creates new file or overwrites existing file)
remote_path Pathname (including file name) indicating location of remote
file to be retrieved
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed or buf is
too small for file contents.
May raise any of the UTL_FILE exceptions if file open, write, or
close operations fail. See UTL_FILE documentation for additional
details.
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
local_path IN VARCHAR2,
local_filename IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Put
Description: Stores data as a file on the remote server
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
buf IN parameter; contains data to upload
remote_path Pathname (including file name) indicating location of remote
file to be created/overwritten
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
buf IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Put
Description: Uploads a local file to the remote server. Assumes an open file
handle and does not close it.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
local_file IN OUT parameter; UTL_FILE file handle for input file. File
is assumed to be open for reading.
remote_path Pathname (including file name) indicating location of remote
file to be created/overwritten.
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
May raise any of the UTL_FILE exceptions if file read operations
fail. See UTL_FILE documentation for additional details.
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
local_file IN OUT UTL_FILE.File_Type,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Put
Description: Uploads a local file to the remote server. Opens and closes local
file automatically.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
local_path Pathname of local directory in which file to upload exists.
local_filename Name of local file to upload.
remote_path Pathname (including file name) indicating location of remote
file to be created/overwritten.
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
May raise any of the UTL_FILE exceptions if file open, read, or
close operations fail. See UTL_FILE documentation for additional
details.
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
local_path IN VARCHAR2,
local_filename IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Remote_Command
Description: Sends an arbitrary command to the server via the SITE command.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
command Command and parameter(s) to send to the server, e.g.
'CHMOD 600 foo.txt'
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Remote_Command( conn IN OUT NOCOPY UTL_TCP.Connection,
command IN VARCHAR2 ) RETURN NUMBER;
Function: Chdir
Description: Changes current working directory on remote server to specified
path.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
remote_path Path on remote server to change to.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Chdir( conn IN OUT NOCOPY UTL_TCP.Connection,
remote_path IN VARCHAR2 ) RETURN NUMBER;
Function: Pwd
Description: Prints current working directory (on remote server) to debugging
output if debugging is turned on.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Pwd( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER;
Function: Close_Session
Description: Closes the TCP connection to the remote server.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
Return value: 0 (zero)
Exceptions: None raised.
FUNCTION Close_Session( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER;
Function: Close_All_Sessions
Description: Closes all currently open TCP connections.
Parameters: None.
Return value: 0 (zero)
Exceptions: None raised.
FUNCTION Close_All_Sessions RETURN NUMBER;
END FTP;
CREATE OR REPLACE PACKAGE BODY FTP IS
vDebug BOOLEAN := TRUE;
FATAL_ERROR EXCEPTION;
PROCEDURE Debug( msg IN VARCHAR2 ) IS
BEGIN
IF vDebug THEN
DBMS_OUTPUT.Put_Line( msg );
END IF;
END Debug;
FUNCTION Get_Response( conn IN OUT NOCOPY UTL_TCP.Connection,
buf IN OUT VARCHAR2 ) RETURN NUMBER IS
vLen NUMBER;
vCode NUMBER;
vResp VARCHAR2(32767);
BEGIN
vLen := UTL_TCP.READ_LINE( conn, vResp );
Debug( vResp );
-- If TO_NUMBER below fails, let the exception propagate to calling proc
vCode := TO_NUMBER( SUBSTR( vResp, 1, 3 ) );
vResp := SUBSTR( vResp, 4 );
buf := buf || SUBSTR( vResp, 2 );
IF SUBSTR( vResp, 1, 1 ) = '-' THEN
LOOP
vLen := UTL_TCP.READ_LINE( conn, vResp );
Debug( vResp );
<<Get_Code>>
BEGIN
vCode := TO_NUMBER( SUBSTR( vResp, 1, 3 ) );
vResp := SUBSTR( vResp, 4 );
IF SUBSTR( vResp, 1, 1 ) = ' ' THEN
buf := buf || SUBSTR( vResp, 2 );
EXIT;
END IF;
EXCEPTION WHEN VALUE_ERROR THEN NULL;
END Get_Code;
buf := buf || vResp;
END LOOP;
END IF;
RETURN vCode;
END Get_Response;
FUNCTION Do_Command( conn IN OUT NOCOPY UTL_TCP.Connection,
cmd IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResult NUMBER := 0;
BEGIN
vResult := UTL_TCP.WRITE_LINE( conn, cmd );
vResult := Get_Response( conn, response );
RETURN vResult;
END Do_Command;
FUNCTION Parse_Port_Number( port_string IN VARCHAR2 ) RETURN NUMBER IS
vResult NUMBER;
vNew_Port_String VARCHAR2(32767);
BEGIN
-- This stuff parses out the port number encoding from the server reply
-- Reply is in the format xyzh1,h2,h3,h4,p1,p2xyz
-- xyz = possible character data (server-dependent, may not exist)
-- h1-h4 = server IP elements; ignore since we know the host already
-- p1,p2 = port number encoding (port number = p1 * 256 + p2 )
vNew_Port_String := TRANSLATE( port_string, '0123456789', '0000000000' );
vNew_Port_String := SUBSTR( port_string,
INSTR( vNew_Port_String, '0' ),
INSTR( vNew_Port_String, '0', -1 ) -
INSTR( vNew_Port_String, '0' ) + 1 );
vNew_Port_String := SUBSTR( vNew_Port_String,
INSTR( vNew_Port_String, ',', 1, 4 ) + 1 );
vResult := 256 * TO_NUMBER( SUBSTR( vNew_Port_String,
1,
INSTR( vNew_Port_String, ',' ) - 1 ) );
vResult := vResult + TO_NUMBER( SUBSTR( vNew_Port_String,
INSTR( vNew_Port_String, ',' ) + 1 ) );
RETURN vResult;
-- Allow VALUE_ERROR to propagate
END Parse_Port_Number;
FUNCTION Open_Session( conn OUT NOCOPY UTL_TCP.Connection,
host IN VARCHAR2,
username IN VARCHAR2,
password IN VARCHAR2,
response OUT VARCHAR2,
timeout_secs IN NUMBER DEFAULT 60 ) RETURN NUMBER IS
vResp_Code NUMBER;
vGarbage NUMBER; -- For calling functions when we don't care about return val
BEGIN
conn := UTL_TCP.OPEN_CONNECTION( host,
21,
tx_timeout => timeout_secs );
vResp_Code := Get_Response( conn, response );
IF vResp_Code = 220 THEN
vResp_Code := Do_Command( conn, 'USER ' || username, response );
IF vResp_Code IN ( 331, 332 ) THEN
vResp_Code := Do_Command( conn, 'PASS ' || password, response );
IF vResp_Code NOT IN ( 202, 230 ) THEN
RAISE FATAL_ERROR;
END IF;
ELSE
RAISE FATAL_ERROR;
END IF;
END IF;
vResp_Code := Do_Command( conn, 'TYPE I', response );
Debug( 'Logged into ' || conn.remote_host || ' at port ' || conn.remote_port );
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error opening session:' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vGarbage := Close_Session( conn );
RETURN vResp_Code;
END Open_Session;
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
buf OUT VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResp VARCHAR2(32767);
vResp_Code NUMBER;
vNew_Conn UTL_TCP.Connection;
vNew_Port NUMBER;
BEGIN
-- do PASV
vResp_Code := Do_Command( conn, 'PASV', response );
IF vResp_Code = 227 THEN
<<Switch_Port>>
BEGIN
vNew_Port := Parse_Port_Number( response );
vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
vNew_Port,
tx_timeout => conn.tx_timeout );
Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
vResp_Code := Do_Command( conn, 'RETR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
IF vResp_Code <> 150 THEN
RAISE FATAL_ERROR;
END IF;
<<Get_Download>>
BEGIN
LOOP
vResp := vResp || UTL_TCP.GET_LINE( vNew_Conn, FALSE );
END LOOP;
EXCEPTION
WHEN UTL_TCP.END_OF_INPUT THEN NULL;
END Get_Download;
vResp_Code := Close_Session( vNew_Conn );
vResp_Code := Get_Response( conn, response );
IF vResp_Code BETWEEN 400 AND 599 THEN
RAISE FATAL_ERROR;
END IF;
EXCEPTION
WHEN OTHERS THEN
Debug( SQLERRM );
RAISE FATAL_ERROR;
END Switch_Port;
ELSE
RAISE FATAL_ERROR;
END IF;
vResp_Code := Close_Session( vNew_Conn );
buf := vResp;
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error getting ' || remote_path || ':' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vResp_Code := Close_Session( vNew_Conn );
RETURN vResp_Code;
WHEN OTHERS THEN
Debug( vResp_Code || ': ' || SQLERRM );
RETURN vResp_Code;
END Get;
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
local_file IN OUT UTL_FILE.File_Type,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResp VARCHAR2(32767);
vResp_Code NUMBER := -1;
vNew_Conn UTL_TCP.Connection;
vNew_Port NUMBER;
BEGIN
-- do PASV
vResp_Code := Do_Command( conn, 'PASV', response );
IF vResp_Code = 227 THEN
<<Switch_Port>>
BEGIN
vNew_Port := Parse_Port_Number( response );
vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
vNew_Port,
tx_timeout => conn.tx_timeout );
Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
vResp_Code := Do_Command( conn, 'RETR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
IF vResp_Code <> 150 THEN
RAISE FATAL_ERROR;
END IF;
<<Get_Download>>
BEGIN
LOOP
vResp := UTL_TCP.GET_LINE( vNew_Conn, FALSE );
UTL_FILE.Put( local_file, vResp );
END LOOP;
EXCEPTION
WHEN UTL_TCP.END_OF_INPUT THEN NULL;
END Get_Download;
vResp_Code := Close_Session( vNew_Conn );
vResp_Code := Get_Response( conn, response );
IF vResp_Code BETWEEN 400 AND 599 THEN
RAISE FATAL_ERROR;
END IF;
EXCEPTION
WHEN OTHERS THEN
Debug( SQLERRM );
RAISE FATAL_ERROR;
END Switch_Port;
ELSE
RAISE FATAL_ERROR;
END IF;
vResp_Code := Close_Session( vNew_Conn );
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error getting ' || remote_path || ':' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vResp_Code := Close_Session( vNew_Conn );
RETURN vResp_Code;
WHEN OTHERS THEN
Debug( vResp_Code || ': ' || SQLERRM );
RETURN vResp_Code;
END Get;
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
local_path IN VARCHAR2,
local_filename IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vFile UTL_FILE.File_Type;
vResult NUMBER := -1;
BEGIN
vFile := UTL_FILE.FOPEN( local_path, local_filename, 'w' );
vResult := Get( conn, vFile, remote_path, response );
UTL_FILE.FCLOSE( vFile );
RETURN vResult;
EXCEPTION WHEN OTHERS THEN
IF UTL_FILE.IS_OPEN( vFile ) THEN
UTL_FILE.FCLOSE( vFile );
END IF;
RAISE;
END Get;
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
buf IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResp VARCHAR2(32767);
vResp_Code NUMBER;
vNew_Conn UTL_TCP.Connection;
vNew_Port NUMBER;
BEGIN
-- do PASV
vResp_Code := Do_Command( conn, 'PASV', response );
IF vResp_Code = 227 THEN
<<Switch_Port>>
BEGIN
vNew_Port := Parse_Port_Number( response );
vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
vNew_Port,
tx_timeout => conn.tx_timeout );
Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
vResp_Code := Do_Command( conn, 'STOR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
IF vResp_Code <> 150 THEN
RAISE FATAL_ERROR;
END IF;
vResp_Code := UTL_TCP.WRITE_TEXT( vNew_Conn, buf );
UTL_TCP.FLUSH( vNew_Conn );
vResp_Code := Close_Session( vNew_Conn );
vResp_Code := Get_Response( conn, response );
IF vResp_Code BETWEEN 400 AND 599 THEN
RAISE FATAL_ERROR;
END IF;
EXCEPTION
WHEN OTHERS THEN
Debug( SQLERRM );
RAISE FATAL_ERROR;
END Switch_Port;
ELSE
RAISE FATAL_ERROR;
END IF;
vResp_Code := Close_Session( vNew_Conn );
response := vResp;
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error putting ' || remote_path || ':' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vResp_Code := Close_Session( vNew_Conn );
RETURN vResp_Code;
WHEN OTHERS THEN
Debug( vResp_Code || ': ' || SQLERRM );
RETURN vResp_Code;
END Put;
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
local_file IN OUT UTL_FILE.File_Type,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResp VARCHAR2(32767);
vResp_Code NUMBER;
vNew_Conn UTL_TCP.Connection;
vNew_Port NUMBER;
vNew_Port_String VARCHAR2(32767);
BEGIN
-- do PASV
vResp_Code := Do_Command( conn, 'PASV', response );
IF vResp_Code = 227 THEN
<<Switch_Port>>
BEGIN
vNew_Port := Parse_Port_Number( response );
vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
vNew_Port,
tx_timeout => conn.tx_timeout );
Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
vResp_Code := Do_Command( conn, 'STOR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
IF vResp_Code <> 150 THEN
RAISE FATAL_ERROR;
END IF;
<<Get_Download>>
BEGIN
LOOP
UTL_FILE.Get_Line( local_file, vResp );
vResp_Code := UTL_TCP.WRITE_LINE( vNew_Conn, vResp );
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END Get_Download;
vResp_Code := Close_Session( vNew_Conn );
vResp_Code := Get_Response( conn, response );
IF vResp_Code BETWEEN 400 AND 599 THEN
RAISE FATAL_ERROR;
END IF;
EXCEPTION
WHEN OTHERS THEN
Debug( SQLERRM );
RAISE FATAL_ERROR;
END Switch_Port;
ELSE
RAISE FATAL_ERROR;
END IF;
vResp_Code := Close_Session( vNew_Conn );
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error putting ' || remote_path || ':' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vResp_Code := Close_Session( vNew_Conn );
RETURN vResp_Code;
WHEN OTHERS THEN
Debug( vResp_Code || ': ' || SQLERRM );
RETURN vResp_Code;
END Put;
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
local_path IN VARCHAR2,
local_filename IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vFile UTL_FILE.File_Type;
vResult NUMBER;
BEGIN
vFile := UTL_FILE.FOPEN( local_path, local_filename, 'r' );
vResult := Put( conn, vFile, remote_path, response );
UTL_FILE.FCLOSE( vFile );
RETURN vResult;
EXCEPTION WHEN OTHERS THEN
IF UTL_FILE.IS_OPEN( vFile ) THEN
UTL_FILE.FCLOSE( vFile );
END IF;
RAISE;
END Put;
FUNCTION Remote_Command( conn IN OUT NOCOPY UTL_TCP.Connection,
command IN VARCHAR2 ) RETURN NUMBER IS
vResp_Code NUMBER;
vResponse VARCHAR2(32767);
BEGIN
vResp_Code := Do_Command( conn, 'SITE ' || command, vResponse );
IF vResp_Code BETWEEN 500 AND 599 THEN
RETURN vResp_Code;
END IF;
RETURN 0;
END Remote_Command;
FUNCTION Chdir( conn IN OUT NOCOPY UTL_TCP.Connection,
remote_path IN VARCHAR2 ) RETURN NUMBER IS
vResp_Code NUMBER;
vResponse VARCHAR2(32767);
BEGIN
vResp_Code := Do_Command( conn, 'CWD ' || REPLACE( remote_path, CHR(12), CHR(0) ), vResponse );
IF vResp_Code BETWEEN 500 AND 599 THEN
RETURN vResp_Code;
END IF;
RETURN 0;
END Chdir;
FUNCTION Pwd( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER IS
vResp_Code NUMBER;
vResponse VARCHAR2(32767);
BEGIN
vResp_Code := Do_Command( conn, 'PWD', vResponse );
IF vResp_Code BETWEEN 500 AND 599 THEN
RETURN vResp_Code;
END IF;
RETURN 0;
END Pwd;
FUNCTION Close_Session( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER IS
BEGIN
IF conn.remote_host IS NULL THEN
RETURN 0;
END IF;
Debug( 'Closing connection on ' || conn.remote_host || ':' || conn.remote_port );
UTL_TCP.Close_Connection( conn );
RETURN 0;
EXCEPTION
WHEN UTL_TCP.NETWORK_ERROR THEN RETURN 0;
END Close_Session;
FUNCTION Close_All_Sessions RETURN NUMBER IS
BEGIN
UTL_TCP.Close_All_Connections;
RETURN 0;
END Close_All_Sessions;
END FTP;Here's another PL/SQL package that will FTP ASCII text files. It assumes that you have proper permissions on the remote host and simply want to transfer one or more text files, not perform any other miscellaneous commands.
Also, from what I have read, in 9i UTL_FILE supports reading and writing of binary data so an FTP client could be written to transfer either ASCII or BINARY files.
Regards,
Russ
CREATE OR REPLACE PACKAGE BRNC_FTP_PKG
AS
* PL/SQL FTP Client
* Created by: Russ Johnson, Braun Consulting
* www.braunconsult.com
* OVERVIEW
* This package uses the standard packages UTL_FILE and UTL_TCP to perform
* client-side FTP functionality (PUT and GET) for text files as defined in
* the World Wide Web Consortium's RFC 959 document - http://www.w3.org/Protocols/rfc959/
* The procedures and functions in this package allow single or multiple file transfer using
* standard TCP/IP connections.
* LIMITATIONS
* Currently the API is limited to transfer of ASCII text files only. This is
* primarily because UTL_FILE only supports text I/O, but also because the original
* design was for creating text files from data in the Oracle database, then transferring the file to a remote host.
* Furthermore, the API does not support SSH/Secure FTP or connection through a proxy server.
* Keep in mind that FTP passes the username/password combo in plain text over TCP/IP.
* DB versions - 8i (8.1.x) and above. 8.0.x may work if it has the SYS.UTL_TCP package.
* Note: Since UTL_FILE is used for the client-side I/O, this package is also limited to
* transfer of files that exist in directories available to UTL_FILE for read/write.
* These directories are defined by the UTL_FILE_DIR parameter in the init.ora file.
* USAGE
* Three functions are available for FTP - PUT, GET, and FTP_MULTIPLE. FTP_MULTIPLE takes
* a table of records that define the files to be transferred (filename, directory, etc.).
* That table can have 1 record or multiple records. The PUT and GET functions are included
* for convenience to FTP one file at a time. PUT and GET return true if the file is transferred
* successfully and false if it fails. FTP_MULTIPLE returns true if no batch-level errors occur
* (such as an invalid host, refused connection, or invalid login information). It also takes the
* table of file records IN and passes it back OUT. Each record contains individual error information.
* EXAMPLE
* Transfer multiple files - 1 GET and 2 PUT from a Windows machine to a host (assuming UNIX here).
* Display any errors that occur.
* DECLARE
* v_username VARCHAR2(40) := 'rjohnson';
* v_password VARCHAR2(40) := 'password';
* v_hostname VARCHAR2(255) := 'ftp.oracle.com';
* v_error_message VARCHAR2(1000);
* b_put BOOLEAN;
* t_files BRNC_FTP_PKG.t_ftp_rec; -- Declare our table of file records
* BEGIN
* t_files(1).localpath := 'd:\oracle\utl_file\outbound';
* t_files(1).filename := 'myfile1.txt';
* t_files(1).remotepath := '/home/oracle/text_files';
* t_files(1).transfer_mode := 'PUT';
* t_files(2).localpath := 'd:\oracle\utl_file\inbound';
* t_files(2).filename := 'incoming_file.xml';
* t_files(2).remotepath := '/home/oracle/xml_files';
* t_files(2).transfer_mode := 'GET';
* t_files(3).localpath := 'd:\oracle\utl_file\outbound';
* t_files(3).filename := 'myfile2.txt';
* t_files(3).remotepath := '/home';
* t_files(3).transfer_mode := 'PUT';
* b_put := BRNC_FTP_PKG.FTP_MULTIPLE(v_error_message,
* t_files,
* v_username,
* v_password,
* v_hostname);
* IF b_put = TRUE
* THEN
* FOR i IN t_files.FIRST..t_files.LAST
* LOOP
* IF t_files.EXISTS(i)
* THEN
* DBMS_OUTPUT.PUT_LINE(t_files(i).status||' | '||
* t_files(i).error_message||' | '||
* to_char(t_files(i).bytes_transmitted)||' | '||
* to_char(t_files(i).trans_start,'YYYY-MM-DD HH:MI:SS')||' | '||
* to_char(t_files(i).trans_end,'YYYY-MM-DD HH:MI:SS'));
* END IF;
* END LOOP;
* ELSE
* DBMS_OUTPUT.PUT_LINE(v_error_message);
* END IF;
* EXCEPTION
* WHEN OTHERS
* THEN
* DBMS_OUTPUT.PUT_LINE(SQLERRM);
* END;
* CREDITS
* The W3C's RFC 959 that describes the FTP process.
* http://www.w3c.org
* Much of the PL/SQL code in this package was based on Java code written by
* Bruce Blackshaw of Enterprise Distributed Technologies Ltd. None of that code
* was copied, but the objects and methods greatly helped my understanding of the
* FTP Client process.
* http://www.enterprisedt.com
* VERSION HISTORY
* 1.0 11/19/2002 Unit-tested single and multiple transfers between disparate hosts.
* Exceptions
ctrl_exception EXCEPTION;
data_exception EXCEPTION;
* Constants - FTP valid response codes
CONNECT_CODE CONSTANT PLS_INTEGER := 220;
USER_CODE CONSTANT PLS_INTEGER := 331;
LOGIN_CODE CONSTANT PLS_INTEGER := 230;
PWD_CODE CONSTANT PLS_INTEGER := 257;
PASV_CODE CONSTANT PLS_INTEGER := 227;
CWD_CODE CONSTANT PLS_INTEGER := 250;
TSFR_START_CODE1 CONSTANT PLS_INTEGER := 125;
TSFR_START_CODE2 CONSTANT PLS_INTEGER := 150;
TSFR_END_CODE CONSTANT PLS_INTEGER := 226;
QUIT_CODE CONSTANT PLS_INTEGER := 221;
SYST_CODE CONSTANT PLS_INTEGER := 215;
TYPE_CODE CONSTANT PLS_INTEGER := 200;
* FTP File record datatype
* Elements:
* localpath - full directory name in which the local file resides or will reside
* Windows: 'd:\oracle\utl_file'
* UNIX: '/home/oracle/utl_file'
* filename - filename and extension for the file to be received or sent
* changing the filename for the PUT or GET is currently not allowed
* Examples: 'myfile.dat' 'myfile20021119.xml'
* remotepath - full directory name in which the local file will be sent or the
* remote file exists. Should be in UNIX format regardless of FTP server - '/one/two/three'
* filetype - reserved for future use, ignored in code
* transfer_mode - 'PUT' or 'GET'
* status - status of the transfer. 'ERROR' or 'SUCCESS'
* error_message - meaningful (hopefully) error message explaining the reason for failure
* bytes_transmitted - how many bytes were sent/received
* trans_start - date/time the transmission started
* trans_end - date/time the transmission ended
TYPE r_ftp_rec IS RECORD(localpath VARCHAR2(255),
filename VARCHAR2(255),
remotepath VARCHAR2(255),
filetype VARCHAR2(20),
transfer_mode VARCHAR2(5),
status VARCHAR2(40),
error_message VARCHAR2(255),
bytes_transmitted NUMBER,
trans_start DATE,
trans_end DATE);
* FTP File Table - used to store many files for transfer
TYPE t_ftp_rec IS TABLE of r_ftp_rec INDEX BY BINARY_INTEGER;
* Internal convenience procedure for creating passive host IP address
* and port number.
PROCEDURE CREATE_PASV(p_pasv_cmd IN VARCHAR2,
p_pasv_host OUT VARCHAR2,
p_pasv_port OUT NUMBER);
* Function used to validate FTP server responses based on the
* code passed in p_code. Reads single or multi-line responses.
FUNCTION VALIDATE_REPLY(p_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_code IN PLS_INTEGER,
p_reply OUT VARCHAR2)
RETURN BOOLEAN;
* Function used to validate FTP server responses based on the
* code passed in p_code. Reads single or multi-line responses.
* Overloaded because some responses can have 2 valid codes.
FUNCTION VALIDATE_REPLY(p_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_code1 IN PLS_INTEGER,
p_code2 IN PLS_INTEGER,
p_reply OUT VARCHAR2)
RETURN BOOLEAN;
* Procedure that handles the actual data transfer. Meant
* for internal package use. Returns information about the
* actual transfer.
PROCEDURE TRANSFER_ASCII(u_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_pasv_host IN VARCHAR2,
p_pasv_port IN PLS_INTEGER,
p_transfer_mode IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE);
* Function to handle FTP of many files.
* Returns TRUE if no batch-level errors occur.
* Returns FALSE if a batch-level error occurs.
* Parameters:
* p_error_msg - error message for batch level errors
* p_files - BRNC_FTP_PKG.t_ftp_rec table type. Accepts
* list of files to be transferred (may be any combination of PUT or GET)
* returns the table updated with transfer status, error message,
* bytes_transmitted, transmission start date/time and transmission end
* date/time
* p_username - username for FTP server
* p_password - password for FTP server
* p_hostname - hostname or IP address of server Ex: 'ftp.oracle.com' or '127.0.0.1'
* p_port - port number to connect on. FTP is usually on 21, but this may be overridden
* if the server is configured differently.
FUNCTION FTP_MULTIPLE(p_error_msg OUT VARCHAR2,
p_files IN OUT t_ftp_rec,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
p_port IN PLS_INTEGER DEFAULT 21)
RETURN BOOLEAN;
* Convenience function for single-file PUT
* Parameters:
* p_localpath - full directory name in which the local file resides or will reside
* Windows: 'd:\oracle\utl_file'
* UNIX: '/home/oracle/utl_file'
* p_filename - filename and extension for the file to be received or sent
* changing the filename for the PUT or GET is currently not allowed
* Examples: 'myfile.dat' 'myfile20021119.xml'
* p_remotepath - full directory name in which the local file will be sent or the
* remote file exists. Should be in UNIX format regardless of FTP server - '/one/two/three'
* p_username - username for FTP server
* p_password - password for FTP server
* p_hostname - FTP server IP address or host name Ex: 'ftp.oracle.com' or '127.0.0.1'
* v_status - status of the transfer. 'ERROR' or 'SUCCESS'
* v_error_message - meaningful (hopefully) error message explaining the reason for failure
* n_bytes_transmitted - how many bytes were sent/received
* d_trans_start - date/time the transmission started
* d_trans_end - date/time the transmission ended
* p_port - port number to connect to, default is 21
* p_filetype - always set to 'ASCII', reserved for future use, ignored in code
FUNCTION PUT(p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_remotepath IN VARCHAR2,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE,
p_port IN PLS_INTEGER DEFAULT 21,
p_filetype IN VARCHAR2 := 'ASCII')
RETURN BOOLEAN;
* Convenience function for single-file GET
* Parameters:
* p_localpath - full directory name in which the local file resides or will reside
* Windows: 'd:\oracle\utl_file'
* UNIX: '/home/oracle/utl_file'
* p_filename - filename and extension for the file to be received or sent
* changing the filename for the PUT or GET is currently not allowed
* Examples: 'myfile.dat' 'myfile20021119.xml'
* p_remotepath - full directory name in which the local file will be sent or the
* remote file exists. Should be in UNIX format regardless of FTP server - '/one/two/three'
* p_username - username for FTP server
* p_password - password for FTP server
* p_hostname - FTP server IP address or host name Ex: 'ftp.oracle.com' or '127.0.0.1'
* v_status - status of the transfer. 'ERROR' or 'SUCCESS'
* v_error_message - meaningful (hopefully) error message explaining the reason for failure
* n_bytes_transmitted - how many bytes were sent/received
* d_trans_start - date/time the transmission started
* d_trans_end - date/time the transmission ended
* p_port - port number to connect to, default is 21
* p_filetype - always set to 'ASCII', reserved for future use, ignored in code
FUNCTION GET(p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_remotepath IN VARCHAR2,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE,
p_port IN PLS_INTEGER DEFAULT 21,
p_filetype IN VARCHAR2 := 'ASCII')
RETURN BOOLEAN;
END BRNC_FTP_PKG;
CREATE OR REPLACE PACKAGE BODY BRNC_FTP_PKG
AS
** Create the passive host IP and port number to connect to
PROCEDURE CREATE_PASV(p_pasv_cmd IN VARCHAR2,
p_pasv_host OUT VARCHAR2,
p_pasv_port OUT NUMBER)
IS
v_pasv_cmd VARCHAR2(30) := p_pasv_cmd; --Host and port to connect to for data transfer
n_port_dec NUMBER;
n_port_add NUMBER;
BEGIN
p_pasv_host := REPLACE(SUBSTR(v_pasv_cmd,1,INSTR(v_pasv_cmd,',',1,4)-1),',','.');
n_port_dec := TO_NUMBER(SUBSTR(v_pasv_cmd,INSTR(v_pasv_cmd,',',1,4)+1,(INSTR(v_pasv_cmd,',',1,5)-(INSTR(v_pasv_cmd,',',1,4)+1))));
n_port_add := TO_NUMBER(SUBSTR(v_pasv_cmd,INSTR(v_pasv_cmd,',',1,5)+1,LENGTH(v_pasv_cmd)-INSTR(v_pasv_cmd,',',1,5)));
p_pasv_port := (n_port_dec*256) + n_port_add;
EXCEPTION
WHEN OTHERS
THEN
--DBMS_OUTPUT.PUT_LINE(SQLERRM);
RAISE;
END CREATE_PASV;
** Read a single or multi-line reply from the FTP server and validate
** it against the code passed in p_code.
** Return TRUE if reply code matches p_code, FALSE if it doesn't or error
** occurs
** Send full server response back to calling procedure
FUNCTION VALIDATE_REPLY(p_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_code IN PLS_INTEGER,
p_reply OUT VARCHAR2)
RETURN BOOLEAN
IS
n_code VARCHAR2(3) := p_code;
n_byte_count PLS_INTEGER;
v_msg VARCHAR2(255);
n_line_count PLS_INTEGER := 0;
BEGIN
LOOP
v_msg := UTL_TCP.GET_LINE(p_ctrl_con);
n_line_count := n_line_count + 1;
IF n_line_count = 1
THEN
p_reply := v_msg;
ELSE
p_reply := p_reply || SUBSTR(v_msg,4);
END IF;
EXIT WHEN INSTR(v_msg,'-',1,1) <> 4;
END LOOP;
IF to_number(SUBSTR(p_reply,1,3)) = n_code
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN OTHERS
THEN
p_reply := SQLERRM;
RETURN FALSE;
END VALIDATE_REPLY;
** Reads a single or multi-line reply from the FTP server
** Return TRUE if reply code matches p_code1 or p_code2,
** FALSE if it doesn't or error occurs
** Send full server response back to calling procedure
FUNCTION VALIDATE_REPLY(p_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_code1 IN PLS_INTEGER,
p_code2 IN PLS_INTEGER,
p_reply OUT VARCHAR2)
RETURN BOOLEAN
IS
v_code1 VARCHAR2(3) := to_char(p_code1);
v_code2 VARCHAR2(3) := to_char(p_code2);
v_msg VARCHAR2(255);
n_line_count PLS_INTEGER := 0;
BEGIN
LOOP
v_msg := UTL_TCP.GET_LINE(p_ctrl_con);
n_line_count := n_line_count + 1;
IF n_line_count = 1
THEN
p_reply := v_msg;
ELSE
p_reply := p_reply || SUBSTR(v_msg,4);
END IF;
EXIT WHEN INSTR(v_msg,'-',1,1) <> 4;
END LOOP;
IF to_number(SUBSTR(p_reply,1,3)) IN(v_code1,v_code2)
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN OTHERS
THEN
p_reply := SQLERRM;
RETURN FALSE;
END VALIDATE_REPLY;
** Handles actual data transfer. Responds with status, error message, and
** transfer statistics.
** Potential errors could be with connection or file i/o
PROCEDURE TRANSFER_ASCII(u_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_pasv_host IN VARCHAR2,
p_pasv_port IN PLS_INTEGER,
p_transfer_mode IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE)
IS
u_data_con UTL_TCP.CONNECTION;
u_filehandle UTL_FILE.FILE_TYPE;
v_tsfr_mode VARCHAR2(3) := p_transfer_mode;
v_mode VARCHAR2(1);
v_tsfr_cmd VARCHAR2(10);
v_buffer VARCHAR2(32767);
v_localpath VARCHAR2(255) := p_localpath;
v_filename VARCHAR2(255) := p_filename;
v_host VARCHAR2(20) := p_pasv_host;
n_port PLS_INTEGER := p_pasv_port;
n_bytes NUMBER;
v_msg VARCHAR2(255);
v_reply VARCHAR2(1000);
v_err_status VARCHAR2(20) := 'ERROR';
BEGIN
/** Initialize some of our OUT variables **/
v_status := 'SUCCESS';
v_error_message := ' ';
n_bytes_transmitted := 0;
IF UPPER(v_tsfr_mode) = 'PUT'
THEN
v_mode := 'r';
v_tsfr_cmd := 'STOR ';
ELSIF UPPER(v_tsfr_mode) = 'GET'
THEN
v_mode := 'w';
v_tsfr_cmd := 'RETR ';
END IF;
/** Open data connection on Passive host and port **/
u_data_con := UTL_TCP.OPEN_CONNECTION(v_host,n_port);
/** Open the local file to read and transfer data **/
u_filehandle := UTL_FILE.FOPEN(v_localpath,v_filename,v_mode);
/** Send the STOR command to tell the server we're going to upload a file **/
n_bytes := UTL_TCP.WRITE_LINE(u_ctrl_con,v_tsfr_cmd||v_filename);
IF VALIDATE_REPLY(u_ctrl_con,TSFR_START_CODE1,TSFR_START_CODE2,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
d_trans_start := SYSDATE;
IF UPPER(v_tsfr_mode) = 'PUT'
THEN
LOOP
BEGIN
UTL_FILE.GET_LINE(u_filehandle,v_buffer);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
EXIT;
END;
n_bytes := UTL_TCP.WRITE_LINE(u_data_con,v_buffer);
n_bytes_transmitted := n_bytes_transmitted + n_bytes;
END LOOP;
ELSIF UPPER(v_tsfr_mode) = 'GET'
THEN
LOOP
BEGIN
v_buffer := UTL_TCP.GET_LINE(u_data_con,TRUE);
/** Sometimes the TCP/IP buffer sends null data **/
/** we only want to receive the actual data **/
IF v_buffer IS NOT NULL
THEN
UTL_FILE.PUT_LINE(u_filehandle,v_buffer);
n_bytes := LENGTH(v_buffer);
n_bytes_transmitted := n_bytes_transmitted + n_bytes;
END IF;
EXCEPTION
WHEN UTL_TCP.END_OF_INPUT
THEN
EXIT;
END;
END LOOP;
END IF;
/** Flush the buffer on the data connection **/
--UTL_TCP.FLUSH(u_data_con);
d_trans_end := SYSDATE;
/** Close the file **/
UTL_FILE.FCLOSE(u_filehandle);
/** Close the Data Connection **/
UTL_TCP.CLOSE_CONNECTION(u_data_con);
/** Verify the transfer succeeded **/
IF VALIDATE_REPLY(u_ctrl_con,TSFR_END_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
EXCEPTION
WHEN ctrl_exception
THEN
v_status := v_err_status;
v_error_message := v_reply;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.invalid_path
THEN
v_status := v_err_status;
v_error_message := 'Directory '||v_localpath||' is not available to UTL_FILE. Check the init.ora file for valid UTL_FILE directories.';
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.invalid_operation
THEN
v_status := v_err_status;
IF UPPER(v_tsfr_mode) = 'PUT'
THEN
v_error_message := 'The file '||V_filename||' in the directory '||v_localpath||' could not be opened for reading.';
ELSIF UPPER(v_tsfr_mode) = 'GET'
THEN
v_error_message := 'The file '||V_filename||' in the directory '||v_localpath||' could not be opened for writing.';
END IF;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.read_error
THEN
v_status := v_err_status;
v_error_message := 'The system encountered an error while trying to read '||v_filename||' in the directory '||v_localpath;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.write_error
THEN
v_status := v_err_status;
v_error_message := 'The system encountered an error while trying to write to '||v_filename||' in the directory '||v_localpath;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.internal_error
THEN
v_status := v_err_status;
v_error_message := 'The UTL_FILE package encountered an unexpected internal system error.';
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN OTHERS
THEN
v_status := v_err_status;
v_error_message := SQLERRM;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
END TRANSFER_ASCII;
** Handles connection to host and FTP of multiple files
** Files can be any combination of PUT and GET
FUNCTION FTP_MULTIPLE(p_error_msg OUT VARCHAR2,
p_files IN OUT t_ftp_rec,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
p_port IN PLS_INTEGER DEFAULT 21)
RETURN BOOLEAN
IS
v_username VARCHAR2(30) := p_username;
v_password VARCHAR2(30) := p_password;
v_hostname VARCHAR2(30) := p_hostname;
n_port PLS_INTEGER := p_port;
u_ctrl_con UTL_TCP.CONNECTION;
n_byte_count PLS_INTEGER;
n_first_index NUMBER;
v_msg VARCHAR2(250);
v_reply VARCHAR2(1000);
v_pasv_host VARCHAR2(20);
n_pasv_port NUMBER;
invalid_transfer EXCEPTION;
BEGIN
p_error_msg := 'FTP Successful'; --Assume the overall transfer will succeed
/** Attempt to connect to the host machine **/
u_ctrl_con := UTL_TCP.OPEN_CONNECTION(v_hostname,n_port);
IF VALIDATE_REPLY(u_ctrl_con,CONNECT_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** Send username **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'USER '||v_username);
IF VALIDATE_REPLY(u_ctrl_con,USER_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** Send password **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'PASS '||v_password);
IF VALIDATE_REPLY(u_ctrl_con,LOGIN_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** We should be logged in, time to transfer all files **/
FOR i IN p_files.FIRST..p_files.LAST
LOOP
IF p_files.EXISTS(i)
THEN
BEGIN
/** Change to the remotepath directory **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'CWD '||p_files(i).remotepath);
IF VALIDATE_REPLY(u_ctrl_con,CWD_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** Switch to IMAGE mode **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'TYPE I');
IF VALIDATE_REPLY(u_ctrl_con,TYPE_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** Get a Passive connection to use for data transfer **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'PASV');
IF VALIDATE_REPLY(u_ctrl_con,PASV_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
CREATE_PASV(SUBSTR(v_reply,INSTR(v_reply,'(',1,1)+1,INSTR(v_reply,')',1,1)-INSTR(v_reply,'(',1,1)-1),v_pasv_host,n_pasv_port);
/** Transfer Data **/
IF UPPER(p_files(i).transfer_mode) = 'PUT'
THEN
TRANSFER_ASCII(u_ctrl_con,
p_files(i).localpath,
p_files(i).filename,
v_pasv_host,
n_pasv_port,
p_files(i).transfer_mode,
p_files(i).status,
p_files(i).error_message,
p_files(i).bytes_transmitted,
p_files(i).trans_start,
p_files(i).trans_end);
ELSIF UPPER(p_files(i).transfer_mode) = 'GET'
THEN
TRANSFER_ASCII(u_ctrl_con,
p_files(i).localpath,
p_files(i).filename,
v_pasv_host,
n_pasv_port,
p_files(i).transfer_mode,
p_files(i).status,
p_files(i).error_message,
p_files(i).bytes_transmitted,
p_files(i).trans_start,
p_files(i).trans_end);
ELSE
RAISE invalid_transfer; -- Raise an exception here
END IF;
EXCEPTION
WHEN ctrl_exception
THEN
p_files(i).status := 'ERROR';
p_files(i).error_message := v_reply;
WHEN invalid_transfer
THEN
p_files(i).status := 'ERROR';
p_files(i).error_message := 'Invalid transfer method. Use PUT or GET.';
END;
END IF;
END LOOP;
/** Send QUIT command **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'QUIT');
/** Don't need to validate QUIT, just close the connection **/
UTL_TCP.CLOSE_CONNECTION(u_ctrl_con);
RETURN TRUE;
EXCEPTION
WHEN ctrl_exception
THEN
p_error_msg := v_reply;
UTL_TCP.CLOSE_ALL_CONNECTIONS;
RETURN FALSE;
WHEN OTHERS
THEN
p_error_msg := SQLERRM;
UTL_TCP.CLOSE_ALL_CONNECTIONS;
RETURN FALSE;
END FTP_MULTIPLE;
** Convenience function for single-file PUT
** Formats file information for FTP_MULTIPLE function and calls it.
FUNCTION PUT(p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_remotepath IN VARCHAR2,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE,
p_port IN PLS_INTEGER DEFAULT 21,
p_filetype IN VARCHAR2 := 'ASCII')
RETURN BOOLEAN
IS
t_files t_ftp_rec;
v_username VARCHAR2(30) := p_username;
v_password VARCHAR2(50) := p_password;
v_hostname VARCHAR2(100) := p_hostname;
n_port PLS_INTEGER := p_port;
v_err_msg VARCHAR2(255);
b_ftp BOOLEAN;
BEGIN
t_files(1).localpath := p_localpath;
t_files(1).filename := p_filename;
t_files(1).remotepath := p_remotepath;
t_files(1).filetype := p_filetype;
t_files(1).transfer_mode := 'PUT';
b_ftp := FTP_MULTIPLE(v_err_msg,
t_files,
v_username,
v_password,
v_hostname,
n_port);
IF b_ftp = FALSE
THEN
v_status := 'ERROR';
v_error_message := v_err_msg;
RETURN FALSE;
ELSIF b_ftp = TRUE
THEN
v_status := t_files(1).status;
v_error_message := t_files(1).error_message;
n_bytes_transmitted := t_files(1).bytes_transmitted;
d_trans_start := t_files(1).trans_start;
d_trans_end := t_files(1).trans_end;
RETURN TRUE;
END IF;
EXCEPTION
WHEN OTHERS
THEN
v_status := 'ERROR';
v_error_message := SQLERRM;
RETURN FALSE;
--DBMS_OUTPUT.PUT_LINE(SQLERRM);
END PUT;
** Convenience function for single-file GET
** Formats file information for FTP_MULTIPLE function and calls it.
FUNCTION GET(p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_remotepath IN VARCHAR2,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE,
p_port IN PLS_INTEGER DEFAULT 21,
p_filetype IN VARCHAR2 := 'ASCII')
RETURN BOOLEAN
IS
t_files t_ftp_rec;
v_username VARCHAR2(30) := p_username;
v_password VARCHAR2(50) := p_password;
v_hostname VARCHAR2(100) := p_hostname;
n_port PLS_INTEGER := p_port;
v_err_msg VARCHAR2(255);
b_ftp BOOLEAN;
BEGIN
t_files(1).localpath := p_localpath;
t_files(1).filename := p_filename;
t_files(1).remotepath := p_remotepath;
t_files(1).filetype := p_filetype;
t_files(1).transfer_mode := 'GET';
b_ftp := FTP_MULTIPLE(v_err_msg,
t_files,
v_username,
v_password,
v_hostname,
n_port);
IF b_ftp = FALSE
THEN
v_status := 'ERROR';
v_error_message := v_err_msg;
RETURN FALSE;
ELSIF b_ftp = TRUE
THEN
v_status := t_files(1).status;
v_error_message := t_files(1).error_message;
n_bytes_transmitted := t_files(1).bytes_transmitted;
d_trans_start := t_files(1).trans_start;
d_trans_end := t_files(1).trans_end;
RETURN TRUE;
END IF;
EXCEPTION
WHEN OTHERS
THEN
v_status := 'ERROR';
v_error_message := SQLERRM;
RETURN FALSE;
--DBMS_OUTPUT.PUT_LINE(SQLERRM);
END GET;
END BRNC_FTP_PKG;
/
Maybe you are looking for
-
File by File picking with Standard File Adapter with NFS Protocal !!
Hi Folks, How to pick file by file with little gap in a file directory by Standard File Adapter. One interface, one communication channle. Ex: XML_XXXXX_XXXX1.xml XML_XXXXX_XXXX2.xml XML_XXXXX_XXXX3.xml First I need to pick one file XM_XX
-
Will a usb game controller work on a HP ENVY with GE FORCE gaming
I have a new Hp Envy with the GE Force gaming installed . I want to use a standard usb game controller similar in design to the Xbox or Playstaion versions. Will a generic controller be compatable with the GE Force games ? This question was sol
-
I paid in advance for a year of photoshop and was able to download lightroom but the photoshop will not download .Any sugessions?
-
Does iPhoto change a RAW file upon import or export?
Hi! New Mac user here. Trying to get my workflows and backups going. I created an iPhoto library from multiple sources: migration from PC, folders from backup HD, new photos from iPhone and camera memory card. So I have one consolidated library that
-
How to create a overall total or sum for structures created?
Dear all expert, I have a BW query as below. Rows: Structures - Product A - Product B - Product C - Product D Diameter Description Columns: Storage Location Key Figures: - Total Quantity - Daily Quantity How can I obtain the total or sum at the rows