philip depalo

Greenhorn
+ Follow
since Oct 12, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by philip depalo

I can not get the doprivileged to work...I still don't undertand why this isnt' working...here is the entire error message:

java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Philip DePalo\Documents\_TricksTrade\philpass.jpg read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.isFile(Unknown Source)
at org.apache.commons.httpclient.methods.multipart.FilePartSource.<init>(FilePartSource.java:67)
at org.apache.commons.httpclient.methods.multipart.FilePart.<init>(FilePart.java:129)
at ThumbnailHandler$UploadImage.actionPerformed(ThumbnailHandler.java:369)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.Dialog$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at java.awt.Dialog.setVisible(Unknown Source)
at ThumbnailHandler$UploadImage.<init>(ThumbnailHandler.java:353)
at ThumbnailHandler$1.actionPerformed(ThumbnailHandler.java:107)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at SessionClient$MenuItemListener.actionPerformed(SessionClient.java:500)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


Any other suggestions? If I create a simple applet that reads a file and outputs it, it works once its signed...
14 years ago
so i am trying to use the doPrivileged, but I am getting a can not find symbol method doPrivileged. I did add import java.securty.accesscontroll; to the class file...do I need to add something else?
14 years ago
I am just not sure "what code" I should place in the block...if I have code that is specifically reading the file from the user, should I put that in the block?
14 years ago
So I had seen the information on your site before about that "do.privileged" but I don't know what that means or how I am supposed to use it. So here is the code where the file is being uploaded:



So you can see the file upload section, how do I use the "do.privlileged" code?
14 years ago
When you say am I doing the thing that would make that quote relevant, well here is the HTML page that calls the applet:



Am I doing the thing it is quoting, if so how do I do it differently?
14 years ago

Paul Clapham wrote:Then that suggests you don't have a signed applet there. When you connected to the applet from the web site it's hosted at, did you have to click the button which said you accepted the applet which came from whoever you said you were when you signed it?


Yes I clicked that button...what does this page mean? See the NOTE about signed applets at the bottom:
Java Sun
14 years ago

Paul Clapham wrote:So you're saying your applet can read files for some other purpose but it can't read files if you plan to upload them?

If that's the case then it isn't the reading that's the problem, it's something else.


It can't read files at all. The directory browser window opens, but that is a java util thing, not a read thing. The specific error is an io file permission error saying read...when I grant access in the clients java.policy file it works...so it works then...any ideas?
14 years ago
i just read something that said when an applet is launche from html code it acts as an unsigned applet...why? How do you avoid that?
14 years ago
as additional information if I add the
grant
all permissions to the client machines java.policy file everything works fine...but obviously that is not a solution for anyone who is going to use the program...
14 years ago
So when I run the applet from a "client" machine before I signed and trusted the applet I could not even display the "browse directories" window to upload a file. I signed the jar file and now that window comes up and I can read all the directories and files, but when I choose to upload a file the java console shows the :java.io.FilePermission access denied error "filename" read

error...so what can I do?
14 years ago
I am just curious, where do I put jar files that are necessary for the program to run, but that a user wouldn't have on their own system? I am using tomcat to run the server. I have three "java" programs. I have one that runs on the server, "connectmanager", one that loads in the browser window for the user, "sessionclient" and the web page one that authenticates a user through MySQL. I need to make sure the user has access to jndi.jar because it is necessary if they choose to upload a picture from their machine.
14 years ago
So I discovered the issue with displaying the images



So I commented out the line that used File.separator to create the \ in between the directories and physically entered a "/" to denote the directories. This was all that was necessary. It seems that when the URL encodes the actual address it changes the File.separator \ to %5C which is the url code, but not when its supposed to show a directory. This also happened in one other place:



So that was the answer...
14 years ago
So I discovered the issue with displaying the images



So I commented out the line that used File.separator to create the \ in between the directories and physically entered a "/" to denote the directories. This was all that was necessary. It seems that when the URL encodes the actual address it changes the File.separator \ to %5C which is the url code, but not when its supposed to show a directory. This also happened in one other place:



So that was the answer...
14 years ago
I know those links point to my machine, they weren't intended as links, they were intended to show you the actual error message.

Check out this post for some of the code: Its long, its two programs a server side and client side...

https://coderanch.com/t/466208/Applets/java/File-Permission-Error
14 years ago
what does it mean when it says cache entry not found?
14 years ago