Can't compile the trigger
DB version: 10gR2
The following trigger contains and UPDATE statment which updates two columns. But when i try to compile it i get the following error
create or replace trigger trg_test
before insert or update on central_dtls.emp_config
for each row
declare
v_schema varchar2(100);
v_sql varchar2(32767);
begin
select schema_name into v_schema from central_dtls.master_config where company_id= :new.id;
v_sql := 'update ' ||v_schema||'.emp_config_local set empname = '||:new.empname||',' join_date = '||:new.join_date|| ;
execute immediate v_sql;
exception
when others then null;
end;
/When i try to compile i get the error
LINE/COL ERROR
6/102 PLS-00103: Encountered the symbol "JOIN_DATE" when
expecting one of the following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || member submultiset
A much nicer way to code this would be:
v_sql := 'update ' ||v_schema||'.emp_config_local set empname = :b0 , join_date = :b1';
execute immediate v_sql using :new.empname, :new.joindate;Which uses bind variables, instead of literals which your example code does. By the way you would still have to change it into something like this to make it always work:
v_sql := 'update ' ||v_schema||'.emp_config_local set empname = '''||:new.empname||''',' join_date = to_date('''||to_char(:new.join_date,'DD-MON-YYYY')||''',''DD-MON-YYYY'')' ;And please, remove this:
when others then null;Edited by: Toon Koppelaars on Dec 13, 2010 9:03 AM
Similar Messages
-
How can i write the trigger for Global Temporary Table
Hi Grus,
How can i write the trigger for Global Temporary Table.
I was created the GTT with trigger using the below script .
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
trigger was create successfully, but the wouldn't insert into to EMPNAME Table..
Please guide whether am correct or not? if not kindly give a correct syntax with example
Thanks in Advance,
Arun M MBEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
you are referencing old value in insert stmt.
BEGIN
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
END;then run ur application it works fine...
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
dbms_output.put_line(:OLD.EMP_C_NAME||'yahoo');
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
dbms_output.put_line(:OLD.EMP_C_NAME);
END;
create table EMPNAME as select * from GLOBAL_TEMP where 1=2
insert into GLOBAL_TEMP values('fgfdgd');
commit;
select * from GLOBAL_TEMP;
select * from EMPNAME;
output:
1 rows inserted
commit succeeded.
EMP_C_NAME
fgfdgd
1 rows selected
EMP_C_NAME
fgfdgd
1 rows selectedgot it Arun
Edited by: OraclePLSQL on Dec 28, 2010 6:07 PM -
How can i compile the program?
hi,everybody:
I have a program which include the next statments:
public void println(boolean flag)
throws IOException
Object obj = lock;
obj;
JVM INSTR monitorenter ;
print(flag);
newLine();
obj;
JVM INSTR monitorexit ;
break MISSING_BLOCK_LABEL_26;
Exception exception;
exception;
obj;
JVM INSTR monitorexit ;
throw exception;
how can i compile the program?
thanksHi,
I'm trying to figure out how to use this decompiler, I have downloaded it to windows 2000 platform and it unzips to 1 file with extension "1-bin" - OS doesn.'t know what to do with and neither do I ;) - I'm starting out on something here and this tool would be useful.
Thanks for any install instructions you might have.
mufc1999
Hi,
I've had a similiar problem with decompiling certain
classes. Try the following decompiler,
http://jrevpro.sourceforge.net, after using this one,
the code decompiled fine, this tool is also a
disassembler and quite a nifty one i might add. :)
Hope this helps!
Have Fun! -
Can't compile the HTML-Java Wizard generated file.
I have created a java file using HTML-Java Wizard.
when compiling the java file it gives an error
method getDeclaredMethod(java.lang.String,null) not found in
class in java.lang.class
can anyone tell me how can I remove the error ?
waiting for your early reply in this regard.
Thanks
nullThanks, My problem has been solved.Now it is working.
Initially I was using wrong classes.zip file in myclasspath.The
Correct one is in %JDEVELOPER_HOME%\java\lib. The size of that
file is 9.48 MB.
Regards
-- Sujit
JDeveloper Team (guest) wrote:
: Sujit,
: I assume that you have access to the OAS jars needed to compile
: this file (refer to the "Building Java Applications for OAS"
: guide in the helpsystem for details).
: Also, try deleting the dependecy files in your
: myclasses/your_package directory .
: Regards,
: Sujit Hazra (guest) wrote:
: : Hi,
: : The error is still there.
: : I have tried as you suggested.That brought me the code of
: : java.lang.Class and also found that method as you
: mentioned.This
: : means my libraries are properly installed.
: : The following code is taken from the HTML-Java Wizard
generated
: : file:
: : private HtmlPage makePage() {
: : HtmlPage hp = new HtmlPage(new java.io.File(filepath +
: : java.io.File.separator +
filename));
: : for(int i=0;i<WRB_tags.length;i++) {
: : try {
: : hp.setItemAt(WRB_tags[0], new SimpleItem(
: : this.getClass().getDeclaredMethod(
: : "get"+WRB_tags[i][2],null).invoke(this,null)));
: : catch (java.lang.Exception ex) {
: : hp.setItemAt(WRB_tags[i][0],
: new(SimpleItem(WRB_tags[i][1]));
: : return hp;
: : I didn't change anything on that.What else should I do?
: : waiting for your early reply in this regard.
: : Thanks
: : - Sujit
: : JDeveloper Team (guest) wrote:
: : : Sujit,
: : : Test this:
: : : Bring up JDeveloper
: : : Press Ctrl / - Control key and the Slash key
: : : Type in java.lang.Class
: : : This brings up the code for java.lang.Class
: : : If it does not, then somehow your libraries
: : : are not properly installed for JDeveloper to find
: : : (see IDEClassPath ).
: : : Otherwise, there you should see many methods including:
: : : public Method getDeclaredMethod(String p0, Class[] p1)
: : : throws NoSuchMethodException, SecurityException {
: : : // implementation not available
: : : Also note: Your spelling for Class should be
: : : java.lang.Class
: : : - JDeveloper Team
: : : You can browse the class
: : : Sujit Hazra (guest) wrote:
: : : : I have created a java file using HTML-Java Wizard.
: : : : when compiling the java file it gives an error
: : : : method getDeclaredMethod(java.lang.String,null) not found
: in
: : : : class in java.lang.class
: : : : can anyone tell me how can I remove the error ?
: : : : waiting for your early reply in this regard.
: : : : Thanks
null -
Can't compile the Forms,please help me.
when I compile the form in Linux, I got the following error:
======================================================
error while loading shared libraries: libig.so.0: cannot open shared object file: No such file or directory
==========================
and I can find this file under
/ora11510/oracle/visora/8.0.6/lib/
Can you help me to resolve it? Thanks.Hi...
How are you compiling the form in linux? are you using frmcmp (or f90genm for Forms 9i) executable? If so, try using frmcmp.sh script (its also available in $ORACLE_HOME/bin).
If it does not work either, try setting LD_LIBRARY_PATH to $ORACLE_HOME/lib:$ORACLE_HOME/lib32
HTH.
Regards,
Arun -
Can't compile the medrec tutorial
I can't build the medrec tutorial. Following the Tutorial 10: Exposing a Stateless
Session EJB as a Web Service, I execute the command "ant prepare build.split.dir".
But the medrecEar
can't be compiled correctly.
There are primarily two kinds of errors/warnings:
1)some classes, such as AdminSession can't be resolved;
2)EJB Local Reference doesn't have a JNDI name.
Who could help me. Thank you.When you compile through J2EE it should give no apache type errors. You must of included apache xml cocoon jar files in the CLASSPATH as well later put the j2ee.jar. However j2ee.jar has XML libraries, no need to include other thrid party xml libaries.
Other words its picking your thrid party xml jar files first and using that instead of your j2ee.jar xml libaries.
Cheers
Abraham Khalil -
I can't compile the converter tutorial example in J2EE
Hi,
I was wondering if someone could help me out with this.
I followed the instructions from the tutorial, but still can't use ant to compile the convert.
The following is the error output.
Many thanks.
C:\temp\j2ee_examples\j2eetutorial\examples\src>ant converter
Searching for build.xml ...
Buildfile: C:\temp\j2ee_examples\j2eetutorial\examples\src\build.xml
init:
BUILD FAILED
C:\temp\j2ee_examples\j2eetutorial\examples\src\build.xml:18: Class org.apache.t
ools.ant.taskdefs.Property doesn't support the "environment" attribute
Total time: 0 secondsWhen you compile through J2EE it should give no apache type errors. You must of included apache xml cocoon jar files in the CLASSPATH as well later put the j2ee.jar. However j2ee.jar has XML libraries, no need to include other thrid party xml libaries.
Other words its picking your thrid party xml jar files first and using that instead of your j2ee.jar xml libaries.
Cheers
Abraham Khalil -
Help: OJSPC can not compile the JSP with struts tag
Hi,
I am trying to precompile the JSP page with EAR package but OJSPC can not parse the Struts tags.
I always get oracle.jsp.parse.JspParseException:
Error: org.apache.struts.taglib.html.MessgesTei while reading TLD /WEB-INF/tld/struts-html.tld
My OC4J version is 10.1.3.2 and I did tried putting the struts-taglib.jar to /opt/oracle/product/app10g/j2ee/home/jsp/lib or /lib/taglib
but still do not work.
Can anyone tell me how to configure the OJSPC and let it support customerized taglibs?
Thanks a lot!This is a new problem with jdk1.4 when compiling with tomcat.
The solution is to ensure that any classes in WEB-INF/classes are in a package structure and the relevant jsp calls the same using the package name.
best
kev -
How can I update the trigger table?
I need a insert trigger on a table and also wants to insert the result value in one of its field.
it gives mutating error........
so wots the way of updating it? how can i update the same table.For example like this (inside the BEGIN/END section of the trigger):
:NEW.Col2 := :NEW.Col1;
C. -
Can's compile the gdbm program ?(SOLVED)
Here is an example comes from Beginning Linux Programming 3rd ,and I can't compile it on my machine. I don't know why?? And the gdbm package is always in the base. Please help me.
try compile 1:
$gcc dbm1.c -o gdbm1 -lgdbm
错误信息:
/tmp/cc2vMknU.o: In function `main':
dbm1.c: (.text+0x2d): undefined reference to `dbm_open'
dbm1.c: (.text+0x244): undefined reference to `dbm_store'
dbm1.c: (.text+0x2ee): undefined reference to `dbm_fetch'
dbm1.c: (.text+0x379): undefined reference to `dbm_close'
collect2: ld returned 1 exit status
try compile 2:
$ gcc dbm1.c -o gdbm1 -lndbm -L/usr/lib
错误信息:
/usr/bin/ld: cannot find -lndbm
collect2: ld returned 1 exit status
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <ndbm.h>
#include <string.h>
#define TEST_DB_FILE "/tmp/dbm1_test"
#define ITEMS_USED 3
/* A struct to use to test dbm */
struct test_data {
char misc_chars[15];
int any_integer;
char more_chars[21];
int main() {
struct test_data items_to_store[ITEMS_USED];
struct test_data item_retrieved;
char key_to_use[20];
int i, result;
datum key_datum;
datum data_datum;
DBM *dbm_ptr;
dbm_ptr = dbm_open(TEST_DB_FILE, O_RDWR | O_CREAT, 0666);
if (!dbm_ptr) {
fprintf(stderr, "Failed to open database\n");
exit(EXIT_FAILURE);
/* put some data in the structures */
memset(items_to_store, '\0', sizeof(items_to_store));
strcpy(items_to_store[0].misc_chars, "First!");
items_to_store[0].any_integer = 47;
strcpy(items_to_store[0].more_chars, "foo");
strcpy(items_to_store[1].misc_chars, "bar");
items_to_store[1].any_integer = 13;
strcpy(items_to_store[1].more_chars, "unlucky?");
strcpy(items_to_store[2].misc_chars, "Third");
items_to_store[2].any_integer = 3;
strcpy(items_to_store[2].more_chars, "baz");
for (i = 0; i < ITEMS_USED; i++) {
/* build a key to use */
sprintf(key_to_use, "%c%c%d",
items_to_store[i].misc_chars[0],
items_to_store[i].more_chars[0],
items_to_store[i].any_integer);
/* build the key datum strcture */
key_datum.dptr = (void *)key_to_use;
key_datum.dsize = strlen(key_to_use);
data_datum.dptr = (void *)&items_to_store[i];
data_datum.dsize = sizeof(struct test_data);
result = dbm_store(dbm_ptr, key_datum, data_datum, DBM_REPLACE);
if (result != 0) {
fprintf(stderr, "dbm_store failed on key %s\n", key_to_use);
exit(2);
} /* for */
/* now try and retrieve some data */
sprintf(key_to_use, "bu%d", 13); /* this is the key for the second item */
key_datum.dptr = key_to_use;
key_datum.dsize = strlen(key_to_use);
data_datum = dbm_fetch(dbm_ptr, key_datum);
if (data_datum.dptr) {
printf("Data retrieved\n");
memcpy(&item_retrieved, data_datum.dptr, data_datum.dsize);
printf("Retrieved item - %s %d %s\n",
item_retrieved.misc_chars,
item_retrieved.any_integer,
item_retrieved.more_chars);
else {
printf("No data found for key %s\n", key_to_use);
dbm_close(dbm_ptr);
exit(EXIT_SUCCESS);
Last edited by 009lin (2007-08-19 02:29:54)GDBM includes dbm and ndbm compatability.
I found the solution from the man page, it said:
If you wish to use the dbm or ndbm compatibility routines, you must
link in the gdbm_compat library as well. For example:
gcc -o prog proc.c -lgdbm -lgdbm_compat
Last edited by 009lin (2007-08-19 02:29:27) -
Can't compile the pngencoder.swc form the sample/libpng
Hi,
I tried without success to compile the png lib port form the Alchemy's sample. Is it possible to find this file pngencoder.swc already compiled?
Thanks
Julien FélixI found it, thank you fT!
-
Can not compile the jsp in Tomcat 4
Hello anyone
Now I use jdk1.4 and Tomcat 4.0.4, and put in the directory d:\j2sdk and d:\tomcat. Even I set the classpath as follow, I still compile jsp.
SET CLASSPATH=.;D:\j2sdk\lib\tools.jar;D:\tomcat\common\lib\servlet.jar
but at before, i can run it at Tomcat 3.2.
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
D:\tomcat\work\Standalone\localhost\_\userCounter$jsp.java:4: Class or interface declaration expected.
import javax.servlet.*;
^
D:\tomcat\work\Standalone\localhost\_\userCounter$jsp.java:10: Superclass org.apache.jsp.HttpJspBase of class org.apache.jsp.userCounter$jsp not found.
public class userCounter$jsp extends HttpJspBase {
^
2 errors, 1 warning
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
pls help, thank you very much!This is a new problem with jdk1.4 when compiling with tomcat.
The solution is to ensure that any classes in WEB-INF/classes are in a package structure and the relevant jsp calls the same using the package name.
best
kev -
I can't compile the JavaMail demo
Can somebody please help me out. I am trying to compile one of the demos in JavaMail. It compiles successfully but it won't execute. It keeps giving me the normal exception when there is no 'main()' in a code. The code is below:
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.event.*;
import javax.mail.internet.*;
import javax.activation.*;
* Demo app that exercises the Message interfaces.
* Show information about and contents of messages.
* @author John Mani
* @author Bill Shannon
public class msgshow {
static String protocol;
static String host = null;
static String user = null;
static String password = null;
static String mbox = null;
static String url = null;
static int port = -1;
static boolean verbose = false;
static boolean debug = false;
static boolean showStructure = false;
static boolean showMessage = false;
static boolean showAlert = false;
static boolean saveAttachments = false;
static int attnum = 1;
public static void main(String argv[]) {
int msgnum = -1;
int optind;
InputStream msgStream = System.in;
for (optind = 0; optind < argv.length; optind++) {
if (argv[optind].equals("-T")) {
protocol = argv[++optind];
} else if (argv[optind].equals("-H")) {
host = argv[++optind];
} else if (argv[optind].equals("-U")) {
user = argv[++optind];
} else if (argv[optind].equals("-P")) {
password = argv[++optind];
} else if (argv[optind].equals("-v")) {
verbose = true;
} else if (argv[optind].equals("-D")) {
debug = true;
} else if (argv[optind].equals("-f")) {
mbox = argv[++optind];
} else if (argv[optind].equals("-L")) {
url = argv[++optind];
} else if (argv[optind].equals("-p")) {
port = Integer.parseInt(argv[++optind]);
} else if (argv[optind].equals("-s")) {
showStructure = true;
} else if (argv[optind].equals("-S")) {
saveAttachments = true;
} else if (argv[optind].equals("-m")) {
showMessage = true;
} else if (argv[optind].equals("-a")) {
showAlert = true;
} else if (argv[optind].equals("--")) {
optind++;
break;
} else if (argv[optind].startsWith("-")) {
System.out.println(
"Usage: msgshow [-L url] [-T protocol] [-H host] [-p port] [-U user]");
System.out.println(
"\t[-P password] [-f mailbox] [msgnum] [-v] [-D] [-s] [-S] [-a]");
System.out.println(
"or msgshow -m [-v] [-D] [-s] [-S] [-f msg-file]");
System.exit(1);
} else {
break;
try {
if (optind < argv.length)
msgnum = Integer.parseInt(argv[optind]);
// Get a Properties object
Properties props = System.getProperties();
// Get a Session object
Session session = Session.getInstance(props, null);
session.setDebug(debug);
if (showMessage) {
MimeMessage msg;
if (mbox != null)
msg = new MimeMessage(session,
new BufferedInputStream(new FileInputStream(mbox)));
else
msg = new MimeMessage(session, msgStream);
dumpPart(msg);
System.exit(0);
// Get a Store object
Store store = null;
if (url != null) {
URLName urln = new URLName(url);
store = session.getStore(urln);
if (showAlert) {
store.addStoreListener(new StoreListener() {
public void notification(StoreEvent e) {
String s;
if (e.getMessageType() == StoreEvent.ALERT)
s = "ALERT: ";
else
s = "NOTICE: ";
System.out.println(s + e.getMessage());
store.connect();
} else {
if (protocol != null)
store = session.getStore(protocol);
else
store = session.getStore();
// Connect
if (host != null || user != null || password != null)
store.connect(host, port, user, password);
else
store.connect();
// Open the Folder
Folder folder = store.getDefaultFolder();
if (folder == null) {
System.out.println("No default folder");
System.exit(1);
if (mbox == null)
mbox = "INBOX";
folder = folder.getFolder(mbox);
if (folder == null) {
System.out.println("Invalid folder");
System.exit(1);
// try to open read/write and if that fails try read-only
try {
folder.open(Folder.READ_WRITE);
} catch (MessagingException ex) {
folder.open(Folder.READ_ONLY);
int totalMessages = folder.getMessageCount();
if (totalMessages == 0) {
System.out.println("Empty folder");
folder.close(false);
store.close();
System.exit(1);
if (verbose) {
int newMessages = folder.getNewMessageCount();
System.out.println("Total messages = " + totalMessages);
System.out.println("New messages = " + newMessages);
System.out.println("-------------------------------");
if (msgnum == -1) {
// Attributes & Flags for all messages ..
Message[] msgs = folder.getMessages();
// Use a suitable FetchProfile
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
fp.add(FetchProfile.Item.FLAGS);
fp.add("X-Mailer");
folder.fetch(msgs, fp);
for (int i = 0; i < msgs.length; i++) {
System.out.println("--------------------------");
System.out.println("MESSAGE #" + (i + 1) + ":");
dumpEnvelope(msgs);
// dumpPart(msgs[i]);
} else {
System.out.println("Getting message number: " + msgnum);
Message m = null;
try {
m = folder.getMessage(msgnum);
dumpPart(m);
} catch (IndexOutOfBoundsException iex) {
System.out.println("Message number out of range");
folder.close(false);
store.close();
} catch (Exception ex) {
System.out.println("Oops, got exception! " + ex.getMessage());
ex.printStackTrace();
System.exit(1);
System.exit(0);
public static void dumpPart(Part p) throws Exception {
if (p instanceof Message)
dumpEnvelope((Message)p);
/** Dump input stream ..
InputStream is = p.getInputStream();
// If "is" is not already buffered, wrap a BufferedInputStream
// around it.
if (!(is instanceof BufferedInputStream))
is = new BufferedInputStream(is);
int c;
while ((c = is.read()) != -1)
System.out.write(c);
String ct = p.getContentType();
try {
pr("CONTENT-TYPE: " + (new ContentType(ct)).toString());
} catch (ParseException pex) {
pr("BAD CONTENT-TYPE: " + ct);
String filename = p.getFileName();
if (filename != null)
pr("FILENAME: " + filename);
* Using isMimeType to determine the content type avoids
* fetching the actual content data until we need it.
if (p.isMimeType("text/plain")) {
pr("This is plain text");
pr("---------------------------");
if (!showStructure && !saveAttachments)
System.out.println((String)p.getContent());
} else if (p.isMimeType("multipart/*")) {
pr("This is a Multipart");
pr("---------------------------");
Multipart mp = (Multipart)p.getContent();
level++;
int count = mp.getCount();
for (int i = 0; i < count; i++)
dumpPart(mp.getBodyPart(i));
level--;
} else if (p.isMimeType("message/rfc822")) {
pr("This is a Nested Message");
pr("---------------------------");
level++;
dumpPart((Part)p.getContent());
level--;
} else {
if (!showStructure && !saveAttachments) {
* If we actually want to see the data, and it's not a
* MIME type we know, fetch it and check its Java type.
Object o = p.getContent();
if (o instanceof String) {
pr("This is a string");
pr("---------------------------");
System.out.println((String)o);
} else if (o instanceof InputStream) {
pr("This is just an input stream");
pr("---------------------------");
InputStream is = (InputStream)o;
int c;
while ((c = is.read()) != -1)
System.out.write(c);
} else {
pr("This is an unknown type");
pr("---------------------------");
pr(o.toString());
} else {
// just a separator
pr("---------------------------");
* If we're saving attachments, write out anything that
* looks like an attachment into an appropriately named
* file. Don't overwrite existing files to prevent
* mistakes.
if (saveAttachments && level != 0 && !p.isMimeType("multipart/*")) {
String disp = p.getDisposition();
// many mailers don't include a Content-Disposition
if (disp == null || disp.equalsIgnoreCase(Part.ATTACHMENT)) {
if (filename == null)
filename = "Attachment" + attnum++;
pr("Saving attachment to file " + filename);
try {
File f = new File(filename);
if (f.exists())
// XXX - could try a series of names
throw new IOException("file exists");
((MimeBodyPart)p).saveFile(f);
} catch (IOException ex) {
pr("Failed to save attachment: " + ex);
pr("---------------------------");
public static void dumpEnvelope(Message m) throws Exception {
pr("This is the message envelope");
pr("---------------------------");
Address[] a;
// FROM
if ((a = m.getFrom()) != null) {
for (int j = 0; j < a.length; j++)
pr("FROM: " + a[j].toString());
// TO
if ((a = m.getRecipients(Message.RecipientType.TO)) != null) {
for (int j = 0; j < a.length; j++) {
pr("TO: " + a[j].toString());
InternetAddress ia = (InternetAddress)a[j];
if (ia.isGroup()) {
InternetAddress[] aa = ia.getGroup(false);
for (int k = 0; k < aa.length; k++)
pr(" GROUP: " + aa[k].toString());
// SUBJECT
pr("SUBJECT: " + m.getSubject());
// DATE
Date d = m.getSentDate();
pr("SendDate: " +
(d != null ? d.toString() : "UNKNOWN"));
// FLAGS
Flags flags = m.getFlags();
StringBuffer sb = new StringBuffer();
Flags.Flag[] sf = flags.getSystemFlags(); // get the system flags
boolean first = true;
for (int i = 0; i < sf.length; i++) {
String s;
Flags.Flag f = sf[i];
if (f == Flags.Flag.ANSWERED)
s = "\\Answered";
else if (f == Flags.Flag.DELETED)
s = "\\Deleted";
else if (f == Flags.Flag.DRAFT)
s = "\\Draft";
else if (f == Flags.Flag.FLAGGED)
s = "\\Flagged";
else if (f == Flags.Flag.RECENT)
s = "\\Recent";
else if (f == Flags.Flag.SEEN)
s = "\\Seen";
else
continue; // skip it
if (first)
first = false;
else
sb.append(' ');
sb.append(s);
String[] uf = flags.getUserFlags(); // get the user flag strings
for (int i = 0; i < uf.length; i++) {
if (first)
first = false;
else
sb.append(' ');
sb.append(uf[i]);
pr("FLAGS: " + sb.toString());
// X-MAILER
String[] hdrs = m.getHeader("X-Mailer");
if (hdrs != null)
pr("X-Mailer: " + hdrs[0]);
else
pr("X-Mailer NOT available");
static String indentStr = " ";
static int level = 0;
* Print a, possibly indented, string.
public static void pr(String s) {
if (showStructure)
System.out.print(indentStr.substring(0, level * 2));
System.out.println(s);Oh, I didn't specify any command line argument. I don't really get what arguments I should specify. Could please explain it to me. My main objective is to learn and be able to apply this to my personal project.
One more thing if you don't mind. I was very good at java (then I used Jdk 1.2) but I have lost touch due to not using Java for a very long time. I am also learning to Servlets at the moment but I just can't deploy it. In the past we used deploytool and I could get that to work but I just don't get how to deploy the servlet I wrote.
Thanks ever so much! -
The CompileSPL.exe in the Lync Server 2013 SDK can't compile the application manifest file
My windows server version is 2012 standard, I deployed the lync server 2013 to my environment, and ran the lync server 2013 SDK on the front end pool. Today, I wanted to compile a application manifest file, but I got the warning that this app can't run on
your pc, to find a version for your pc, check with the software publisher.Hi,
The issue is related to Lync Server 2013, I suggest you ask for help from Lync Server 2013 SDK forum for better and accurate answer to the question.:
http://social.msdn.microsoft.com/Forums/lync/en-US/home?forum=communicationsserversdk&filter=alltypes&sort=lastpostdesc
Regards,
Mandy
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
I followed the instructions here: http://labs.adobe.com/wiki/index.php/Proscenium
Trying to run it throws the following error:
http://grab.by/b06b
Compiler settings are also good, fp version is 11, swf version 13.I believe setup FP 11 correctly following this link: http://priyeshsheth.wordpress.com/2011/10/05/how-to-use-flash-player-11-air-3-with-flash-p rofessional-cs5-5/
Is there anything missing? Is there a more official how to setup proscenium and FP11/Air 3.0 guide from Adobe?
Maybe you are looking for
-
HT201303 How do I delete my apple account?
I don't want my Apple ID anymore because I have two and I want to delete one? Please help!!!
-
Have an Ipad Mini. Downloaded IOS 7. To setup it is asking for a four digit passcode. Have not used a passcode on this device. Any suggestions?
-
IPhone 4s won't turn on! Help ASAP Please!
My iPhone 4S will not turn on with or without the charger. I've tried plugging it into my computer it still won't come on. I've tried everything possible rebooting it didn't help. Can someone please tell me what's wrong asap?
-
Account hacked and credit card charged!!!
I received today 3 emails from Skype. one about Skype Manager, one about Auto-Recharge and a last one about an order for 10 euro that has been made with my credit card. In my account info I fount a strange primary email address @ 163.com [hyperlink r
-
JTable with JComboBox/JSpinner problem
The following code has a JTable with 2 columns.The lst column has JComboBoxes, the 2nd column has JSpinners.I want to set the spinner range of values based on the selection of JComboBox. The JComboBox selections are "small" and "large". For "small" t