Problem with file used by external table
Hi all,
following situation:
I am creating my file on unix/solaris and ftp it to oracle server which is running on windows.
I am getting following error when I try to do select on the external table I get:
ORA-29913: error in executing ODCIEXTTABLEFETCH callout
ORA-29400: data cartridge error
KUP-04020: found record longer than buffer size supported, 524288, in D:\corona\flat_files\input\CORE.PROGRESS.TXT
ORA-06512: at "SYS.ORACLE_LOADER", line 52
But it is working when I do following:
File->Conversions->UNIX/MAC to DOS-> Save it and ftp to windows server.
I have already tried to call unix2dos in my shell script, but I keep getting the same error.
Here is the CREATE TABLE:
CREATE TABLE EXT_TRACKING_DATA_PROGRESS
TRACKING_ID VARCHAR2(19 BYTE),
COMPANY_ID VARCHAR2(19 BYTE),
SUPPLIER_ID VARCHAR2(1 BYTE),
TRACKING_ID_TYPE VARCHAR2(2 BYTE),
START_DATE VARCHAR2(10 BYTE),
END_DATE VARCHAR2(10 BYTE),
BLANK VARCHAR2(100 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY DIR_INPUT
ACCESS PARAMETERS
( fields terminated BY '@|@' )
LOCATION (DIR_INPUT:'CORE.PROGRESS.TXT')
REJECT LIMIT 0
NOPARALLEL
NOMONITORING;
Are you FTP-ing the file to the Windows machine in ASCII mode? Or in binary mode? Binary mode won't convert the line breaks from Unix to Windows, which would appear to be the problem.
Justin
Similar Messages
-
Problem with file URI for external DTD
Hi All,
I am getting UnknownHostException when i am trying to parse an XML data as InputSource
to parser.
The exception is thrown while to trying resolve file uri
set for inputsource to locate DTD.
The code works fine in of the Solaris machine but it throws this exception in
one particular machine (solaris again). On both Weblogic6.0 with SP2 is running.
The host "local" it says Unknown is infact a directory.
I am unable to figure what is wrong. Please let me know asap the reason and if
there is any solution.
I am attaching the piece of Code and the Exception stack trace.
thanks
ashok
-------------------code-----------------------
public boolean doParse(InputSource input)
throws IOException
try{
String realPath=FileHelper.getApplicationRoot();
SAXParser sp = new SAXParser();
sp.setContentHandler(this);
sp.setFeature("http://xml.org/sax/features/validation",true);
sp.setErrorHandler(new MyErrorHandler(System.err));
input.setSystemId("file:///"+realPath+"/dtd/");
CmgmtOutput.write("System ID set "+input.getSystemId(),1);
sp.parse(input);
}catch
------------------Exception--------------------
java.net.UnknownHostException: local
at java.net.InetAddress.getAllByName0(InetAddress.java:571)
at java.net.InetAddress.getAllByName0(InetAddress.java:540)
at java.net.InetAddress.getByName(InetAddress.java:449)
at java.net.Socket.<init>(Socket.java:100)
at sun.net.NetworkClient.doConnect(NetworkClient.java:50)
at sun.net.NetworkClient.openServer(NetworkClient.java:38)
at sun.net.ftp.FtpClient.openServer(FtpClient.java:267)
at sun.net.ftp.FtpClient.<init>(FtpClient.java:381)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:77)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:96)
at java.net.URL.openStream(URL.java:798)
at org.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFactory.java:149)
at org.apache.xerces.framework.XMLParser.startReadingFromExternalEntity(XMLParser.java:2652)
at org.apache.xerces.framework.XMLParser.startReadingFromExternalSubset(XMLParser.java:2478)
at org.apache.xerces.validators.dtd.DTDValidator.startReadingFromExternalSubset(DTDValidator.java:1672)
at org.apache.xerces.framework.XMLDTDScanner.scanDoctypeDecl(XMLDTDScanner.java:1111)
at org.apache.xerces.validators.dtd.DTDValidator.scanDoctypeDecl(DTDValidator.java:450)
at org.apache.xerces.framework.XMLParser.scanDoctypeDecl(XMLParser.java:2102)
at org.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.dispatch(XMLDocumentScanner.java:876)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1208)
at com.i2.ui.srm.contracts.cmgmt.CMGMTXMLHandler.doParse(CMGMTXMLHandler.java:156)
at com.i2.ui.srm.contracts.cmgmt.CMGMTXMLHandler.doImport(CMGMTXMLHandler.java:96)
at com.i2.ui.srm.contracts.cmgmt.CMGMTXMLImportHandler.doImport(CMGMTXMLImportHandler.java:178)
at com.i2.ui.srm.contracts.cmgmt.CMGMTXMLImportHandler.handleEvent(CMGMTXMLImportHandler.java:77)
at com.i2.ui.srm.contracts.cmgmt.CMGMTXMLImportHandler.invoke(CMGMTXMLImportHandler.java:42)
at java.lang.reflect.Method.invoke(Native Method)
at com.i2.webdriver.rwadmin.pages.PageController.handlePage(PageController.java:337)
at PageServlet.doPost(PageServlet.java:374)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1631)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)By making BODY mandatory with 1 record, i am getting the below given error message in Adapter monitoring...
Sender Adapter v2722 for Party '', Service 'BS_MRS':
Configured at 2007-08-29 09:40:17 BST
History:
- 2007-08-29 09:46:26 BST: Retry interval started. Length: 2.000 s
- 2007-08-29 09:46:26 BST: Error: Conversion of complete file content to XML format failed around position 0: Exception: ERROR consistency check in recordset structure validation (line no. 3: missing structure(s) before type 'TRL'
- 2007-08-29 09:46:26 BST: Processing started
- 2007-08-29 09:46:24 BST: Error: Conversion of complete file content to XML format failed around position 0: Exception: ERROR consistency check in recordset structure validation (line no. 3: missing structure(s) before type 'TRL'
- 2007-08-29 09:46:24 BST: Processing started
With Regards
Amitesh -
Question about problem with file using clipping mask
I am using Photoshop CS6. I purchased a digital frame with a clipping mask on Etsy. When I go to insert the picture into the frame using the clipping mask the picture continues to show through the edges of the frame (as shown in the picture). I have tried locking the layer but it doesn't work. Any suggestions?
Try this, move layer 2 below 3 don't clip them.
With the ellipse selection tool drag out a circle that encompasses the area that the image should show
Create a mask for the shape (make sure the shape layer is selected {now layer 2 was 3} click on the icon at the bottom of the layers panel that looks like a circle inside a square)
You should now see your image.
If you are stuck, capture your screen to show your progress.
Tips for the selection tool:
You can hold down the shift key to constrain to a circle,
You can hold down the alt key to draw a circle selection from its center,
You can hold down both modifier key for a perfect circle drawn from center.
Finally you can hold down the space bar to move the selection before letting go of the mouse button. -
Problem with file permissions using Snow Lepord
I'm having problems with file Sharing & Permissions using Snow Lepord.
When I save any new file it only has 'Read & Write' privileges for the user, everyone else is 'read only' or 'no access'.
We have a Netgear NAS Server which is accessed by other users over the local network and if I change the Privilege to 'read & write' via Get Info and then copy the file from my desktop to ther server it changes the Privilege of the server version to 'no access' we then have to change it again for it to work.
I also created a new folder on the server and now it says 'no access' and has a no entry icon!
Any ideas???We have issues like this. Have tried running AFP and SMB, now connecting using CIFS. All have the same problem. I can work on one or two files fine, then suddenly, one of the files I just worked on says I don't have permissions. I log off the server and log back on, and then I have permissions to the file. It will work fine for one or two operations, then fails. We just updated to OSX Mavericks and a Windows 2012 server, but have been having this issue for years. My permissions look fine. I can even change permissions, but it won't let me work on the file or move or delete the file or rename the file. Once I log out and log back in, I can do anything I want.
-
We have a new scada and database system being delivered which has a section for Alarm Data. We have been told that without extensive re-writing of the ActiveX components of the scada, then we cannot put this alarm data information into Oracle (10.2). Instead, aswell as the Oracle database (which resides on a RAID5 server alongside the application server, the flash recovery area (which is our database backup mechanism), the domain controller, the forms and reports - getting off track with a rant, but they're taking the mick...), they are giving us SQL Express to store the alarm data, which is ported out as a flat file.
I am not yet too familiar with anything above 7.3.4, but my limited research suggests to me that using the external tables feature of oracle would solve this problem and allow us to use the flat file to import the data into an oracle instance and manage it alongside the rest of the database.
Am I right? Seems too obvious a solution that they wouldn't have thought of it, but this is just one of the many, many problems we're having that I feel we could provide a better solution for. Comments??hi,
u mention the Alarm data.
whether the data is in XML format or CSV format.
if it is CSV format use External Tables.
CSV format means store in a flat file.
i was worked on External Table.
External Tables r u used to store the data into oracle tables..
Regards
SATYA -
Hi
We r facing typical problem with file adapter.
Lets say there are 30 files to be processed by placing an copy in arichive folder by file adapter based on pooling
parameters.
All the 30 files are picked up and we can see the copies in archive folder.
But when we go to RWB and check the audit log,
there we could see only 25 files , the 5 files are missing.
no trace found therre about the 5 files.
This is happening only some times and not to all the files placed in the FTP. Later when the same file is placed back from the Archive folder to the Source folder, the file is being picked and processed succesfully.
unfortunately this is happening on Production server
Any pointers which could trouble shoot this issue.
Regards
shekar chandraHi,
Couple of thing which you can try....
1. Use EOIO QoS and check if you still face the issue.
Is some program or application writing files to the directory? If yes I would recommend the use of a temporary name to write the files and then rename them.
Sometimes when an external application connects via FTP and transfers the files...
The file could be picked up by the adapter poll even before the transfer of data is done.
Which is why you will find that the file is archived but there is no xml message created for the same in the Integration engine.
Try increasing the poll interval. This helps sometimes.
Regards,
Sidharth -
Problem with BAPI_CUSTOMER_CREATEFROMDATA1 using JCo on IDES
sorry, wrong board - i opened a new post
Problem with BAPI_CUSTOMER_CREATEFROMDATA1 using JCo on IDES
Hello everyone,
we are working on a student project and would like to create customers (debtors) in an SAP IDES system.
Using the ref-customer to copy from, and some personal-data below, we get the error message
'Internal error: External no.assignment for reference customer/customer'
We also tried with BAPI_CUSTOMER_GETINTNUMBER, and ACCOUNTGROUP ZINT (New Internet Customer, others won't work?). But CREATEFROMDATA1 takes no CustomerNo created this way, nor it wants to create one 'internal'?
Any suggestions? Thanks a lot for your help,
Greetings,
Tobias Schmidbauer
inParams = function.getImportParameterList().getStructure(
"PI_COPYREFERENCE");
inParams.setValue("0000001000", "REF_CUSTMR");
inParams.setValue("1000", "SALESORG");
inParams.setValue("10", "DISTR_CHAN");
inParams.setValue("00", "DIVISION");
inParams =function.getImportParameterList().getStructure(
"PI_PERSONALDATA");
inParams.setValue("Simpson", "LASTNAME");
inParams.setValue("Homer", "FIRSTNAME");
inParams.setValue("Jay","MIDDLENAME");
inParams.setValue("Springfield", "CITY");
inParams.setValue("DE", "LANGU_P");
inParams.setValue("DE", "LANGUP_ISO");
inParams.setValue("DE", "COUNTRY");
inParams.setValue("EUR", "CURRENCY");
inParams.setValue("12345", "POSTL_COD1");
Message was edited by: Tobias SchmidbauerHello Brian,
Thanks for your pointer. Actually The customer's reference number i was providing in the PI_COPYREFERENCE structure was a sold-to party customer and it uses external customer number assignment. When i used "New Internet Customer" (that doesnt use external assignment by default) as customer's account group, the customer was created successfully and assigned customer number was returned.
I want to ask now how could we give a customer number in the BAPI as i am unable to find any such column in any of the tables. (Customer number is an "out" parameter so it can only return the number of created customer). Secondly, how to chnage the external assignment property of a particular account group (like sold-to party). i.e, how could we change the account group configurations through SAP GUI??
- Umair -
I have a problem with a pdf file which does not open with reader in windows 8 but it opens properly with adobe pdf reader. All other pdf can be opened in reader.But when i open a pdf(see this link for pdf for which i got error http://incometaxsoft.com/temp/Form.pdf)
it gives error as "Can't open this file. There's a problem with file format".
The same file opens properly in adobe pdf reader.You can check the pdf file which i have mentioned in the link above.But the reader which comes with windows 8 can open some other pdf in the same PC.What may be the error causing this??This has turned out to be an enormous issue for me as I sell PDF files as ebooks. I have done a fair amount of investigating this for my system.
My files have to be compatible not just across readers but across operating systems.
To date, I have over 200 PDFs that have functioned flawlessly across Mac, PC (Windows 7 and below), Android, iPhone/iPad, Linux.
I personally test my PDFs using a variety of readers and PDF editors including
PDF XChange (my favorite)
Foxit (runner up for me and I recommend for most people)
Adobe (the bloated monster)
Nitro 9 (great for moving graphical elements around)
ABBYY
And the Nuance PDF Create toolsets
Those are off the top of my head. There are a bunch on Android that I test with too.
I am running the Windows 10 Pro Tech Preview and I have this same problem so I know it isn't fixed yet in any kind of pre-release way (-sigh-)
Here is what I've learned for my situation
The PDFs I created using NUANCE'S PDF CREATE PROFESSIONAL VERSION 8
all fail using the built-in Windows 8/10 PDF reader.
When I look at the PDF properties for these Nuance created files, the underlying engine used to write them is called "ImageToPDF". Using ABBYY it indicates their own engine as does everyone else that I've tried. It is easy for you to check to see
what created your PDF by doing a "Control D" (look at the document properties). Perhaps there's a common engine causing issues.
If I use the exact same source files to create a PDF using any of my other tools I have no issues. I checked the PDF versions made by the tools and they are all set to 1.5.
A customer mentioned being able to convert them in a way they worked by saving them without having to do any kind of extraction, but I have not been able to duplicate that. Perhaps he did a "print" which seems like it could work.
In summary, the workaround everyone is talking about, using an alternate reader, of course works. But not everyone wants to change.
The culprit I have found is my Nuance PDF Creation tools that are using the ImageToPDF engine.
I hope it gets FIXED as I really don't want to have to regenerate all of my PDF files. -
I suddenly encounter this error message from Fire Fox.
Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that this directory has no read/write restrictions and your hard disk is not full or close to full. It is recommended that you exit the application and fix the problem. If you continue to use this session, you might see incorrect application behaviour when accessing security features.
I uninstalled the browser and download a new version but it does not resolve the issue.
I know my hard disc has ample space. I do NOT know where to find the Profile directory to fix the read restriction box.
== This happened ==
Every time Firefox opened
== After something about security add-on of Norton pop up by itself. ==
== User Agent ==
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; MSN Optimized;US)This link shows things to check - https://support.mozilla.com/kb/Could+not+initialize+the+browser+security+component
-
Live Data / Problem with file permissions
Just trying out an old version of Dreamweaver MX 2004. I am
using my webhosting service for remote server/testing server
duties. It is running PHP 4.3.10 and MySQL 3.23.58. I was able to
set up the database connection and test-retrieve a recordset with
no problems. In following the tutorial I found that Livedata
wouldn't work, it just giving me a warning about file permissions
being wrong. It turns out that when Dreamweaver creates a temporary
file of the work-in-progress to upload to the remote server the
file is created on the server with owner=rw, group=rw, world=r
which explains why it won't run - group has to be set to group=r.
The file is created on the fly and then immediately deleted by
Dreamweaver so it is impossible to manually set the permission on
the server and probably fairly pointless too.
I tried just saving the file and previewing in the browser
which again causes it to be uploaded to the remote server. The
first time this resulted in the browser offering a file download
box instead of running the page. The reason is - again - that
Dreamweaver is setting the uploaded file permissions to include
group=rw. If I manually set the permission for group to group=r it
runs fine.
It turns out that Dreamweaver is always setting the file
permissions on file uploads (checked php and html) to the
remote/testing server to include group=rw. Once I set it manually
on the remote/testing server to group=r for a php file everything
is fine and subsequent uploads of the same file do not change it
again.
I checked with the webhosting company and their second-line
have reported back to me that the default file permission they set
on uploaded files includes group=r so it must be DW that is causing
the problem by setting group=rw the first time. I confirmed this by
using WS-FTP to upload the same file (renamed) to the same target
directory and the permissions set were owner=rw, group=r, world=r.
So
Can anyone please tell me how to change the permissions DW
sets on files written to a remote server because I have spent
countless hours on it without success. From looking at other posts
in this forum it could be that other users are hitting the same
kind of problem with DW8Stop using Live Data with a hosting account. Set up PHP and
MySQL locally on
your machine. That is how it's supposed to work. You
shouldn't test files on
the fly on a host as you write them. Change your test account
in DW to use
the local server. Upload your files to your remote server
after they are
fully tested.
Tom Muck
http://www.tom-muck.com/
"nigelssuk" <[email protected]> wrote in
message
news:[email protected]...
> Just trying out an old version of Dreamweaver MX 2004. I
am using my
> webhosting
> service for remote server/testing server duties. It is
running PHP 4.3.10
> and
> MySQL 3.23.58. I was able to set up the database
connection and
> test-retrieve a
> recordset with no problems. In following the tutorial I
found that
> Livedata
> wouldn't work, it just giving me a warning about file
permissions being
> wrong.
> It turns out that when Dreamweaver creates a temporary
file of the
> work-in-progress to upload to the remote server the file
is created on the
> server with owner=rw, group=rw, world=r which explains
why it won't run -
> group
> has to be set to group=r. The file is created on the fly
and then
> immediately
> deleted by Dreamweaver so it is impossible to manually
set the permission
> on
> the server and probably fairly pointless too.
>
> I tried just saving the file and previewing in the
browser which again
> causes
> it to be uploaded to the remote server. The first time
this resulted in
> the
> browser offering a file download box instead of running
the page. The
> reason is
> - again - that Dreamweaver is setting the uploaded file
permissions to
> include
> group=rw. If I manually set the permission for group to
group=r it runs
> fine.
>
> It turns out that Dreamweaver is always setting the file
permissions on
> file
> uploads (checked php and html) to the remote/testing
server to include
> group=rw. Once I set it manually on the remote/testing
server to group=r
> for a
> php file everything is fine and subsequent uploads of
the same file do not
> change it again.
>
> I checked with the webhosting company and their
second-line have reported
> back
> to me that the default file permission they set on
uploaded files includes
> group=r so it must be DW that is causing the problem by
setting group=rw
> the
> first time. I confirmed this by using WS-FTP to upload
the same file
> (renamed)
> to the same target directory and the permissions set
were owner=rw,
> group=r,
> world=r.
>
> So
>
> Can anyone please tell me how to change the permissions
DW sets on files
> written to a remote server because I have spent
countless hours on it
> without
> success. From looking at other posts in this forum it
could be that other
> users
> are hitting the same kind of problem with DW8
> -
Problem with File Based replication in Weblogic Express 10
Hi,
We have Web application (exploded war) file deployed on Weblogic Express 10, to a Cluster of three Managed Servers (all three on different physical machines).
We are using File based session persistance in weblogic.xml
We have a shared location for all the three servers where we will be sharing the Session data.
When we start the application, its works fine and is very fast, but after sometime the application slows down.
Troubleshooting the Issue we found that its a problem with file based replication. By using File based replication every user session is stored in form of directory inside shared directory. So after sometime thousands of directories are created inside the shared directory where the session information is stored. So when we access the application, its waiting for lot of time with Message Session Monitor .... (this is because its browsing through the shared session storage directory for lot of time for session information as it has lot of directories) and finally after a long time like 10 mins we get the Application Home Page.
When we clean up all the saved sessions inside shared directory, the application works fine, But we will see the same sometime later may be after 3 or 4 hours when the shared session directory has lot of session information stored in it.
Is there a way to clean up the saved session information on file system as soon as that user session is closed by using file based replication.
We cannot used Inmemory replication as our Appl doesnt support it.
Please advice as it is a major show stopper in our Production Mirror env.
Weblogic ConsultantIt is possible to reduce number of live session by configuring very low timeout-secs weblogic.xml. Default is 60 minutes.
More details are here..
http://e-docs.bea.com/wls/docs100/webapp/weblogic_xml.html#wp1071982
Jayesh
Yagna Sys -
Hello all,
I am making a simple HttpServlet, which takes input
from html page and saves in to a file, but I'm having a
bit of a problem with file permissions.
I'm getting the following exception
java.security.AccessControlException: access denied (java.io.FilePermission ./data/result read)
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
java.security.AccessController.checkPermission(AccessController.java:427)
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
java.lang.SecurityManager.checkRead(SecurityManager.java:871)
java.io.File.exists(File.java:700)
SyksyHTTPServlet.doPost(SyksyHTTPServlet.java:31)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)The exception seems to occur when I'm trying to check whether the file already
exists or not.
The data directory has all permissions (read, write and execute) set for all users,
and I have made an empty file called result inside the data directory for testing.
This file has read and write permissions enabled for all users.
Here's my code
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.Enumeration;
import java.util.List;
import java.util.ArrayList;
public class SyksyHTTPServlet extends HttpServlet
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
int totalCount = 0;
List list;
String song = request.getParameter("song");
PrintWriter out = response.getWriter();
File file = new File("./data/result");
if(file.exists()) // this is line 31, which seems to cause the exception
list = readFile(file);
else
file.createNewFile();
list = new ArrayList();
list.add(song);
writeFile(file, list);
for(int i = 0 ; i < list.size() ; i++)
out.println(list.get(i));
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost(request, response);
private List readFile(File file)
List list = null;
try
FileInputStream fis = new FileInputStream(file);
ObjectInputStream ois = new ObjectInputStream(fis);
list = (ArrayList)ois.readObject();
ois.close();
catch(Exception e)
e.printStackTrace();
return list;
private void writeFile(File file, List list)
try
FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(list);
oos.flush();
oos.close();
catch(Exception e)
e.printStackTrace();
}I'm using Tomcat 5.5 on Ubuntu Linux, if that has anything to do with this.
I'll appreciate all help.
kari-mattiHello again.
I'm still having problems with this. I made
a simple servlet that reads from and writes
to text file. The reading part work fine on my
computer, but the writing doesn't, not even
an exception is thrown if the file exists that
I'm trying to write to. If I try to create a new
file I'll get an exception about file permissions.
I also asked a friend of mine to try this same
servlet on his windows computer and it works
as it should.
Here's the code
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class ReadServlet extends HttpServlet
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
String s = "";
PrintWriter out = response.getWriter();
String docroot = getServletContext().getRealPath( "/" );
out.println("docroot: "+docroot);
File file = new File(docroot+"test.txt");
if(file.exists())
s = readFile(file);
out.println(s);
else
out.println("file not found");
//file.createNewFile(); // causes exception
//out.println("new file created.");
writeFile(file, "written by servlet");
out.println("Now look in the file "+file.getPath());
out.println("and see if it contains text 'written by servlet'");
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost(request, response);
private String readFile(File file)
FileInputStream fis = null;
BufferedInputStream bis = null;
DataInputStream dis = null;
String s = "";
try
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
s = dis.readLine();
fis.close();
bis.close();
dis.close();
catch(Exception e)
e.printStackTrace();
return s;
private void writeFile(File file, String s)
FileOutputStream fos = null;
BufferedOutputStream bos = null;
DataOutputStream dos = null;
try
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
dos = new DataOutputStream(bos);
dos.writeChars(s);
fos.flush();
bos.flush();
dos.flush();
fos.close();
bos.close();
dos.close();
catch(Exception e)
e.printStackTrace();
}And if someone wants to test this servlet I can
give a war package.
Any advices?
kari-matti -
Problem with file descriptors not released by JMF
Hi,
I have a problem with file descriptors not released by JMF. My application opens a video file, creates a DataSource and a DataProcessor and the video frames generated are transmitted using the RTP protocol. Once video transmission ends up, if we stop and close the DataProcessor associated to the DataSource, the file descriptor identifying the video file is not released (checkable through /proc/pid/fd). If we repeat this processing once and again, the process reaches the maximum number of file descriptors allowed by the operating system.
The same problem has been reproduced with JMF-2.1.1e-Linux in several environments:
- Red Hat 7.3, Fedora Core 4
- jdk1.5.0_04, j2re1.4.2, j2sdk1.4.2, Blackdown Java
This is part of the source code:
// video.avi with tracks audio(PCMU) and video(H263)
String url="video.avi";
if ((ml = new MediaLocator(url)) == null) {
Logger.log(ambito,refTrazas+"Cannot build media locator from: " + url);
try {
// Create a DataSource given the media locator.
Logger.log(ambito,refTrazas+"Creating JMF data source");
try
ds = Manager.createDataSource(ml);
catch (Exception e) {
Logger.log(ambito,refTrazas+"Cannot create DataSource from: " + ml);
return 1;
p = Manager.createProcessor(ds);
} catch (Exception e) {
Logger.log(ambito,refTrazas+"Failed to create a processor from the given url: " + e);
return 1;
} // end try-catch
p.addControllerListener(this);
Logger.log(ambito,refTrazas+"Configure Processor.");
// Put the Processor into configured state.
p.configure();
if (!waitForState(p.Configured))
Logger.log(ambito,refTrazas+"Failed to configure the processor.");
p.close();
p=null;
return 1;
Logger.log(ambito,refTrazas+"Configured Processor OK.");
// So I can use it as a player.
p.setContentDescriptor(new FileTypeDescriptor(FileTypeDescriptor.RAW_RTP));
// videoTrack: track control for the video track
DrawFrame draw= new DrawFrame(this);
// Instantiate and set the frame access codec to the data flow path.
try {
Codec codec[] = {
draw,
new com.sun.media.codec.video.colorspace.JavaRGBToYUV(),
new com.ibm.media.codec.video.h263.NativeEncoder()};
videoTrack.setCodecChain(codec);
} catch (UnsupportedPlugInException e) {
Logger.log(ambito,refTrazas+"The processor does not support effects.");
} // end try-catch CodecChain creation
p.realize();
if (!waitForState(p.Realized))
Logger.log(ambito,refTrazas+"Failed to realize the processor.");
return 1;
Logger.log(ambito,refTrazas+"realized processor OK.");
/* After realize processor: THESE LINES OF SOURCE CODE DOES NOT RELEASE ITS FILE DESCRIPTOR !!!!!
p.stop();
p.deallocate();
p.close();
return 0;
// It continues up to the end of the transmission, properly drawing each video frame and transmit them
Logger.log(ambito,refTrazas+" Create Transmit.");
try {
int result = createTransmitter();
} catch (Exception e) {
Logger.log(ambito,refTrazas+"Error Create Transmitter.");
return 1;
} // end try-catch transmitter
Logger.log(ambito,refTrazas+"Start Procesor.");
// Start the processor.
p.start();
return 0;
} // end of main code
* stop when event "EndOfMediaEvent"
public int stop () {
try {
/* THIS PIECE OF CODE AND VARIATIONS HAVE BEEN TESTED
AND THE FILE DESCRIPTOR IS NEVER RELEASED */
p.stop();
p.deallocate();
p.close();
p= null;
for (int i = 0; i < rtpMgrs.length; i++)
if (rtpMgrs==null) continue;
Logger.log(ambito, refTrazas + "removeTargets;");
rtpMgrs[i].removeTargets( "Session ended.");
rtpMgrs[i].dispose();
rtpMgrs[i]=null;
} catch (Exception e) {
Logger.log(ambito,refTrazas+"Error Stoping:"+e);
return 1;
return 0;
} // end of stop()
* Controller Listener.
public void controllerUpdate(ControllerEvent evt) {
Logger.log(ambito,refTrazas+"\nControllerEvent."+evt.toString());
if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
} else if (evt instanceof EndOfMediaEvent) {
Logger.log(ambito,refTrazas+"\nEvento EndOfMediaEvent.");
this.stop();
else if (evt instanceof ControllerClosedEvent)
Logger.log(ambito,refTrazas+"\nEvent ControllerClosedEvent");
close = true;
waitSync.notifyAll();
else if (evt instanceof StopByRequestEvent)
Logger.log(ambito,refTrazas+"\nEvent StopByRequestEvent");
stop =true;
waitSync.notifyAll();
Many thanks.Its a bug on H263, if you test it without h263 track or with other video codec, the release will be ok.
You can try to use a not-Sun h263 codec like the one from fobs or jffmpeg projects. -
Problem with File Uploading.
Hi,
I have one problem with File Upload component.
JSP
<ui:upload binding="#{NewProblem.fileUpload1}" columns="#{SessionBean1.uploadedFile}" id="fileUpload1" labelLevel="3"
style="left: 24px; top: 24px; position: absolute" validator="#{NewProblem.fileUpload1_validate}"/>
Java
UploadedFile uploadedFile = getSessionBean1().getUploadedFile();
Variable uploadedFile is NULL :(((((((((((
web.xml
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<filter>
<filter-name>UploadFilter</filter-name>
<filter-class>com.sun.web.ui.util.UploadFilter</filter-class>
<init-param>
<param-name>maxSize</param-name>
<param-value>10000000</param-value>
</init-param>
<init-param>
<param-name>sizeThreshold</param-name>
<param-value>10024</param-value>
</init-param>
</filter>
Thanks.check out the fileUpload article
Using the File Upload Component
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/file_upload.html -
NT security problems with file I/O
I have 2 problems with file I/O. When I read from a file I use the getAbsolutePath() method that is part of the File class to find what directory the files are currenlty. The problem is that the returned path says that the file is on the desktop no matter what directory the file really is in. The second problem is that I am unable to save files anywhere but the desktop. I must run the class files from the desktop too to get it to work.
I am using NT 4.0 for development. I'm guessing that these problems might be NT security related. Could someone help me?
Code below:
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.File;
import java.awt.event.*;
//import java.security.*;
//import sun.security.*;
//import java.awt.Window;
//import com.ms.security.*;
public class Edit extends Applet implements ActionListener, ItemListener
String Gselect;
reader readit;
int mhz, khz;
TextField textField1;
String freq = "000.000";
String data;
Choice freqC;
Button ActivateB, SaveB, /*CancelB, HelpB,*/ DeleteB;
Checkbox SetC;
int NotUsedReply[] = new int[200];
int HwListReply[] = new int[200];
public void init()
readit = new reader();
String myFile="satellite.st1";
// myFile = myFile.concat(Gselect);
File satellite = new File(myFile);
textField1 = new TextField();
textField1.setText( "(void) " );
add( textField1 );
SetC = new Checkbox("TRAP-RX");
add(SetC);
SetC.addItemListener(this);
freqC = new Choice();
freqC.setSize(20,50);
freqC.add("000.000");
add(freqC);
freqC.addItemListener(this);
ActivateB = new Button("Activate");
add(ActivateB);
ActivateB.addActionListener(this);
SaveB = new Button("Save");
add(SaveB);
SaveB.addActionListener(this);
DeleteB = new Button("Delete");
add(DeleteB);
DeleteB.addActionListener(this);
/*CancelB = new Button("Cancel");
add(CancelB);
CancelB.addActionListener(this);
HelpB = new Button("Help");
add(HelpB);
HelpB.addActionListener(this);*/
//textField1.setText( data );
for(int a = 1; a < 9; a++)
data = readit.getData(satellite.getAbsolutePath(), a);//("E:\\forte4j\\system\\Projects\\Zebra\\satellite.st1", a);
freqC.addItem(data);
textField1.setText(satellite.getAbsolutePath() );
public void paint(Graphics g)
//g.drawString("Radio Setup Files",20, 20);
//g.drawString(getParameter("wse"),20, 20);
public void actionPerformed(ActionEvent event)
if(event.getSource() == ActivateB)
activator();
if(event.getSource() == SaveB)
/*if(event.getSource() == CancelB)
stop();
if(event.getSource() == HelpB)
if(event.getSource() == DeleteB)
public void itemStateChanged(ItemEvent e)
if(e.getItemSelectable() == SetC)
textField1.setText("Check box 1 clicked!");
if(e.getItemSelectable() == freqC)
freq = ((Choice)e.getItemSelectable()).getSelectedItem();
public void activator()
makeMHZ();
makeKHZ();
if(mhz > 254)
int StartLink[]={0x0c,0x01,0x07,0x00,0x00,0x00,0x00,0x00,0x00}; //New Link Proc Start
int TrapConfig[]={0x25,0x80,0x00,0x00,0x00,0xb7,0x00,0x0c,0x0b, //TRAP Configuration
0x00,0x00,0x00,0xff,0xa0,0xff,0x0d,0xff,0xe8,
0xff,0x0d,0xff,0x00,0xff,0x15,0xff,0xb0,0xff,
0xff,0xff,0x94,0x0a,0x01,0x06,0x1a,0x00,0x0d,
0x2d,0x21};
TrapConfig[11]=(mhz-255);
TrapConfig[12]=(khz/5);
int SetUserOutput[]={0x41,0x42,0x49,0x54,0x52,0x41,0x50,0x20,0x34, //Sets User Output Format
0x35,0x34,0x35,0x30,0x30,0x2e,0x30,0x4e,0x30,
0x38,0x32,0x34,0x35,0x30,0x30,0x2e,0x30,0x57,
0x30,0x31,0x30,0x30,0x2e,0x30,0x30,0x4b,0x4d,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00};
sendget CmdFunc;
CmdFunc=new sendget();
try
//PolicyEngine.assertPermission(PermissionID.SYSTEM);
Socket h = new Socket("192.9.200.155",9000);
Socket s = new Socket("192.9.200.155",9001);
Socket t = new Socket("192.9.200.155",9002);
int j;
CmdFunc.SendCmd(h,0,0x01,null);
CmdFunc.GetCmd(h,HwListReply);
CmdFunc.SendCmd(s,9,0x1e,StartLink); //New Link Proc Start
CmdFunc.GetCmd(s,NotUsedReply);
CmdFunc.SendCmd(s,37,0x00,TrapConfig); //TRAP Configuration
CmdFunc.GetCmd(s,NotUsedReply);
CmdFunc.SendCmd(s,155,0x03,SetUserOutput);//Sets User Output Format
CmdFunc.GetCmd(s,NotUsedReply);
catch(Exception e){}
else
textField1.setText( "000.000 is the null choice. Try another." );
public void receiveText1( String select )
Gselect=select;
public void makeMHZ()
String y = freqC.getSelectedItem();
y = y.substring(0,3);
mhz = Integer.parseInt(y);
//textField1.setText( y );
public void makeKHZ()
String y = freqC.getSelectedItem();
y = y.substring(4,7);
khz = Integer.parseInt(y);
//textField1.setText( y );
import java.awt.*;
import java.applet.*;
import java.io.RandomAccessFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.LineNumberReader;
import java.awt.event.*;
import com.ms.security.*;
import netscape.security.*;
import netscape.util.*;
public class saver extends Applet implements ActionListener
String nameS = "Data.txt";
String dataS = "Default Data";
Button saveB;
public void init()
saveB = new Button("SaveFile");
add(saveB);
saveB.addActionListener(this);
public void actionPerformed(ActionEvent event)
if(event.getSource() == saveB)
RandomAccessFile RAF;
byte array0[] = dataS.getBytes();
try
if (Class.forName("com.ms.security.PolicyEngine") != null)
PolicyEngine.assertPermission(PermissionID.SYSTEM);
if(Class.forName("netscape.security.PrivilegeManager") != null)
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");
catch (Throwable cnfe)
try
RAF = new RandomAccessFile(nameS, "rw");
// RAF.writeUTF(dataS);
RAF.write(dataS.getBytes());
RAF.close();
catch(Exception e)
public void receiveND(String name, String data)
if(name != null)
nameS = name;
dataS=data;
import java.io.RandomAccessFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.LineNumberReader;
//import java.security.*;
import com.ms.security.*;
import netscape.security.*;
import netscape.util.*;
public class reader
//Signature sig;
public String getData(String filename, int pass)
//String nameS = "Data.txt";
String dataS = "Default Data Sucks";
String comma = ",";
int get = pass, count=0, top=0, bottom=0;
char[] work;
try
if (Class.forName("com.ms.security.PolicyEngine") != null)
PolicyEngine.assertPermission(PermissionID.SYSTEM);
if(Class.forName("netscape.security.PrivilegeManager") != null)
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
catch (Throwable cnfe)
try
//sig.sign();
//nameS = filename;
RandomAccessFile RAF = new RandomAccessFile(filename, "r");
// dataS = RAF.readUTF();
dataS = RAF.readLine();
RAF.close();
catch(Exception e)
return e.toString();
work = dataS.toCharArray();
for(int i = 0; i < dataS.length(); i++)
if( work[i] == ',' )
count++;
if(get == count)
bottom = i + 1;
if( (work[i] == ',') && (count > get) && (top == 0) )
top = i;
dataS = dataS.substring(bottom,top);
return dataS;
}import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.File;
import java.awt.event.*;
//import java.security.*;
//import sun.security.*;
//import java.awt.Window;
//import com.ms.security.*;
public class Edit extends Applet implements ActionListener, ItemListener
String Gselect;
reader readit;
int mhz, khz;
TextField textField1;
String freq = "000.000";
String data;
Choice freqC;
Button ActivateB, SaveB, /*CancelB, HelpB,*/ DeleteB;
Checkbox SetC;
int NotUsedReply[] = new int[200];
int HwListReply[] = new int[200];
public void init()
readit = new reader();
String myFile="satellite.st1";
// myFile = myFile.concat(Gselect);
File satellite = new File(myFile);
textField1 = new TextField();
textField1.setText( "(void) " );
add( textField1 );
SetC = new Checkbox("TRAP-RX");
add(SetC);
SetC.addItemListener(this);
freqC = new Choice();
freqC.setSize(20,50);
freqC.add("000.000");
add(freqC);
freqC.addItemListener(this);
ActivateB = new Button("Activate");
add(ActivateB);
ActivateB.addActionListener(this);
SaveB = new Button("Save");
add(SaveB);
SaveB.addActionListener(this);
DeleteB = new Button("Delete");
add(DeleteB);
DeleteB.addActionListener(this);
/*CancelB = new Button("Cancel");
add(CancelB);
CancelB.addActionListener(this);
HelpB = new Button("Help");
add(HelpB);
HelpB.addActionListener(this);*/
//textField1.setText( data );
for(int a = 1; a < 9; a++)
data = readit.getData(satellite.getAbsolutePath(), a);//("E:\\forte4j\\system\\Projects\\Zebra\\satellite.st1", a);
freqC.addItem(data);
textField1.setText(satellite.getAbsolutePath() );
public void paint(Graphics g)
//g.drawString("Radio Setup Files",20, 20);
//g.drawString(getParameter("wse"),20, 20);
public void actionPerformed(ActionEvent event)
if(event.getSource() == ActivateB)
activator();
if(event.getSource() == SaveB)
/*if(event.getSource() == CancelB)
stop();
if(event.getSource() == HelpB)
if(event.getSource() == DeleteB)
public void itemStateChanged(ItemEvent e)
if(e.getItemSelectable() == SetC)
textField1.setText("Check box 1 clicked!");
if(e.getItemSelectable() == freqC)
freq = ((Choice)e.getItemSelectable()).getSelectedItem();
public void activator()
makeMHZ();
makeKHZ();
if(mhz > 254)
int StartLink[]={0x0c,0x01,0x07,0x00,0x00,0x00,0x00,0x00,0x00}; //New Link Proc Start
int TrapConfig[]={0x25,0x80,0x00,0x00,0x00,0xb7,0x00,0x0c,0x0b, //TRAP Configuration
0x00,0x00,0x00,0xff,0xa0,0xff,0x0d,0xff,0xe8,
0xff,0x0d,0xff,0x00,0xff,0x15,0xff,0xb0,0xff,
0xff,0xff,0x94,0x0a,0x01,0x06,0x1a,0x00,0x0d,
0x2d,0x21};
TrapConfig[11]=(mhz-255);
TrapConfig[12]=(khz/5);
int SetUserOutput[]={0x41,0x42,0x49,0x54,0x52,0x41,0x50,0x20,0x34, //Sets User Output Format
0x35,0x34,0x35,0x30,0x30,0x2e,0x30,0x4e,0x30,
0x38,0x32,0x34,0x35,0x30,0x30,0x2e,0x30,0x57,
0x30,0x31,0x30,0x30,0x2e,0x30,0x30,0x4b,0x4d,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00};
sendget CmdFunc;
CmdFunc=new sendget();
try
//PolicyEngine.assertPermission(PermissionID.SYSTEM);
Socket h = new Socket("192.9.200.155",9000);
Socket s = new Socket("192.9.200.155",9001);
Socket t = new Socket("192.9.200.155",9002);
int j;
CmdFunc.SendCmd(h,0,0x01,null);
CmdFunc.GetCmd(h,HwListReply);
CmdFunc.SendCmd(s,9,0x1e,StartLink); //New Link Proc Start
CmdFunc.GetCmd(s,NotUsedReply);
CmdFunc.SendCmd(s,37,0x00,TrapConfig); //TRAP Configuration
CmdFunc.GetCmd(s,NotUsedReply);
CmdFunc.SendCmd(s,155,0x03,SetUserOutput);//Sets User Output Format
CmdFunc.GetCmd(s,NotUsedReply);
catch(Exception e){}
else
textField1.setText( "000.000 is the null choice. Try another." );
public void receiveText1( String select )
Gselect=select;
public void makeMHZ()
String y = freqC.getSelectedItem();
y = y.substring(0,3);
mhz = Integer.parseInt(y);
//textField1.setText( y );
public void makeKHZ()
String y = freqC.getSelectedItem();
y = y.substring(4,7);
khz = Integer.parseInt(y);
//textField1.setText( y );
import java.awt.*;
import java.applet.*;
import java.io.RandomAccessFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.LineNumberReader;
import java.awt.event.*;
import com.ms.security.*;
import netscape.security.*;
import netscape.util.*;
public class saver extends Applet implements ActionListener
String nameS = "Data.txt";
String dataS = "Default Data";
Button saveB;
public void init()
saveB = new Button("SaveFile");
add(saveB);
saveB.addActionListener(this);
public void actionPerformed(ActionEvent event)
if(event.getSource() == saveB)
RandomAccessFile RAF;
byte array0[] = dataS.getBytes();
try
if (Class.forName("com.ms.security.PolicyEngine") != null)
PolicyEngine.assertPermission(PermissionID.SYSTEM);
if(Class.forName("netscape.security.PrivilegeManager") != null)
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");
catch (Throwable cnfe)
try
RAF = new RandomAccessFile(nameS, "rw");
// RAF.writeUTF(dataS);
RAF.write(dataS.getBytes());
RAF.close();
catch(Exception e)
public void receiveND(String name, String data)
if(name != null)
nameS = name;
dataS=data;
import java.io.RandomAccessFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.LineNumberReader;
//import java.security.*;
import com.ms.security.*;
import netscape.security.*;
import netscape.util.*;
public class reader
//Signature sig;
public String getData(String filename, int pass)
//String nameS = "Data.txt";
String dataS = "Default Data Sucks";
String comma = ",";
int get = pass, count=0, top=0, bottom=0;
char[] work;
try
if (Class.forName("com.ms.security.PolicyEngine") != null)
PolicyEngine.assertPermission(PermissionID.SYSTEM);
if(Class.forName("netscape.security.PrivilegeManager") != null)
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");
catch (Throwable cnfe)
try
//sig.sign();
//nameS = filename;
RandomAccessFile RAF = new RandomAccessFile(filename, "r");
// dataS = RAF.readUTF();
dataS = RAF.readLine();
RAF.close();
catch(Exception e)
return e.toString();
work = dataS.toCharArray();
for(int i = 0; i < dataS.length(); i++)
if( work == ',' )
count++;
if(get == count)
bottom = i + 1;
if( (work == ',') && (count > get) && (top == 0) )
top = i;
dataS = dataS.substring(bottom,top);
return dataS;
Maybe you are looking for
-
Item does not match schedule line (program error) in sap
Dear Expert. Greetings! We are currently facing with this error (V1 427 item does not match schedule line (program error) in sap), when we open the sales order(VA02/03). The error is occurring due inconsistency on the database tables, some Item is
-
Mountain lion installation pauses
Tried to reinstall mountain lion and right after installation says complete then reboots, on start up spinning wheel tuns for about 3 minutes then stops spinning and computer never boots fully. Anyone else having this problem? Only work around for me
-
Software for copying phone memory to computer
I have a 2-year-old pearl 8100. I need to copy my address book to my computer. I lost the software that came with the phone. Which software do I need? When I go to the Blackberry website it asks me which software version I need and I have absolutely
-
No Drag'n'Drop in Disk Utility?!
I wanted to reformat my system volume of my MacBook Pro 10.4.6 and then restore a backup I've made before. For this I wanted to use Disk Utility's "restore" function and a system Image I've made with SuperDuper to an external USB drive. But when I st
-
Cannot connect to Host with user name J2EE_ADMIN !!!
Hi all, this exception when deploy from NWDS04s: <i><b>Caught exception while checking the login credentials for SAP J2EE Engine. Cannot connect to Host with user name J2EE_ADMIN</b></i> Complete exception: <i>Result => deployment aborted : file:/D:/