The problem to compile Java stored function in Oracle
Could you please help to resolve the following problem ?
Text of Java Source:
create or replace and compile java source named "Hex2" as
import java.io.*;
import java.lang.*;
public class Hex2
{
public static int hexcase = 0; /* hex output format. 0 - lowercase; 1
- uppercase */
public static int chrsz = 8; /* bits per input character. 8 - ASCII;
16 - Unicode */
public static String hex_md5 (String s)
{
String rc = "z"+s;
try
{
rc = "z"+s;
}
catch (Exception e)
{
e.printStackTrace();
rc = "z"+s;
}
finally
{
return rc;
}
}
/*
* Convert a string to an array of little-endian words
* If chrsz is ASCII, characters >255 have their hi-byte silently
ignored.
*/
private static Object[] str2binl(String str)
{
Object[] bin;
int i = 0;
try
{
int mask = (1 << chrsz) - 1;
for(i = 0; i < str.length() * chrsz; i += chrsz)
bin[i>>5] |= (str.charAt(i / chrsz) & mask) << (i%32);
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
return bin;
}
}
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations
internally
* to work around bugs in some JS interpreters.
*/
private static int safe_add(byte x, byte y)
{
int rc0 = -1;
try
{
int lsw;
int msw;
lsw = (x & 0xFFFF) + (y & 0xFFFF);
msw = (x >> 16) + (y >> 16) + (lsw >> 16);
rc0 = (msw << 16) | (lsw & 0xFFFF);
}
catch (Exception e)
{
e.printStackTrace();
rc0 = -1;
}
finally
{
return rc0;
}
}
}
The result of compilation in SQL*Plus:
SQL> @D:\app\Profiles\JAVA\Security\Hex2.jsp
77 /
Warning: Java created with compilation errors.
SQL> sho errors
Errors for JAVA SOURCE Hex2:
LINE/COL ERROR
--------------------------------------------------------------------------------
-----------------------------------------------------------------
0/0 Hex2:37: operator | cannot be applied to java.lang.Object,int
0/0 1 error
0/0 ^
0/0 bin[i>>5] |= (str.charAt(i / chrsz) & mask) << (i%32);
SQL>
Oracle version:
Personal Oracle Database 10g Release 10.2.0.3.0 - Production
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
What is the problem ?