Search Results

Search found 243 results on 10 pages for 'illegalargumentexception'.

Page 4/10 | < Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • javascript instanceof get type from string name

    - by dcp
    Let's say I have this (assume the name variable is "receiver"): if (!(receiver instanceof com.HTMLReceiver)) { throw new com.IllegalArgumentException( name + " is not an instance of com.HTMLReceiver."); } I'd like to factor this code out into a common method so I could call it like this: Helper.checkInstance(receiver, "com.HTMLReceiver"); But I don't know of a way to convert the com.HTMLReceiver from a string to its actual type so I can use instanceof on it. Is there a way?

    Read the article

  • Android full Screen flag gives an exception

    - by sukitha
    In my android app I set this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ); Then my touch screen event doesnt’ work any more. Further Explaining, I have a button and onClick it changes the contentView by setContentView(R.layout.choose_player);. It works fine. But if you take the focus to the button by the trackball(making it yellow) and tap on it, it gives the exception. java.lang.IllegalArgumentException: parameter must be a descendant of this view

    Read the article

  • Quering computed fields in GORM

    - by Tihom
    I am trying to query the following HQL using GORM: MailMessage.executeQuery("toId, count(toId) from (SELECT toId, threadId FROM MailMessage as m WHERE receiveStatus = '$u' GROUP BY threadId, toId) as x group by x.toId") The problem is that count(toId) is a computed field doesn't exist in MailMessage and that I am using a subquery. I get the following error: java.lang.IllegalArgumentException: node to traverse cannot be null! Ideally, I would like to use a generic executeQuery which will return data of anytype. Is there such a thing?

    Read the article

  • JBoss 5.1.0 (JSF/Seam) cookies blowing up with accented characters

    - by user283680
    I cannot see this behavior in JBoss 4.2.3. If I try to call addCookie() on HttpServletResponse and my cookie value has accented characters in it (ex. ç) I get this exception: java.lang.IllegalArgumentException: Control character in cookie value, consider BASE64 encoding your value Does anyone know what change in JBoss 5.1.0 could be causing these problems?

    Read the article

  • How do I call a non-public method of a public class in Clojure?

    - by sramsay
    I'm calling the twitter4j library using Clojure like so: (def twitter (. (TwitterFactory.) getInstance)) This works fine when I call it as a script. But when I use gen-class, I get: java.lang.IllegalArgumentException: Can't call public method of non-public class: public java.lang.Object twitter4j.TwitterFactoryBase.getInstance() Is there a workaround for this?

    Read the article

  • Can't import clojure records

    - by Zubair
    I have created a record like this: (defrecord User [user-id email]) :but when I try to access it from another name-space I get the error: (User. "name" "email") java.lang.IllegalArgumentException: Unable to resolve classname: User It works when I do: (oe.model.modelcore.User. "name" "email") : I know I will need to import the Java class, but is there any way for clojure to do this automatically when I do: (use 'oe.model.modelcore :reload)

    Read the article

  • Problem with URI matcher in Android.

    - by Lunchbox
    I have an authority string defined as such: public final static String AUTHORITY = "dsndata.sds2mobile.jobprovider"; Followed by an edition to the UriMatcher: uriMatcher.addURI(JobMetaData.AUTHORITY, "/JobNames/*", JOBNAME_SINGLE_URI); The uri that gets passed to the switch is: content://dsndata.sds2mobile.jobprovider/JobNames/test This falls through the switch and hits the default (which throws an IllegalArgumentException). Am I missing something? I've searched and can't find anything that would account for the mismatch.

    Read the article

  • setting up eclim to support php

    - by tipu
    i have the plugin pdt installed with my eclim using: DISPLAY=:1 ./eclipse/eclipse -nosplash -consolelog -debug \ -application org.eclipse.equinox.p2.director \ -repository http://download.eclipse.org/releases/helios \ -installIU org.eclipse.php.feature.group i compiled the thing using dargs for php: ant -Declipse.home=/home/tipu/downloads/eclipse -Dplugins=php but creating a project gives me: java.lang.IllegalArgumentException: Unable to find nature for alias 'php'. Supported aliases include: javascript=org.eclipse. wst.jsdt.core.jsNature, java=org.eclipse.jdt.core.javanature while executing command (port: 9091): -editor vim -command project_create -f "/home/tipu/phpproj2/" -n php thoughts on how to fix?

    Read the article

  • JAX-WS, webservices (Spring) issue

    - by vinay
    Hi All, I have written web services and configured with spring framework but I am getting exception when invoking services. Exceptions stack trace are given below - com.sun.xml.ws.server.sei.EndpointMethodHandler invoke SEVERE: object is not an instance of declaring class java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jvnet.jax_ws_commons.spring.SpringService$1$1.invoke(SpringServic e.java:185) at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:152) at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethod Handler.java:264) at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTub e.java:93) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:604) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:563) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:548) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:445) at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:27 5) at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdap ter.java:454) at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:250 ) at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAd apter.java:140) at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServl etDelegate.java:129) at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServ letDelegate.java:160) at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.doPost(WSSpring Servlet.java:52) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run (StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri tyHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav a:292) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav a:175) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio n.run(WebAppServletContext.java:3594) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate dSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java: 121) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS ervletContext.java:2202) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC ontext.java:2108) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j ava:1432) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) Mar 31, 2010 3:47:20 PM com.sun.xml.ws.server.sei.EndpointMethodHandler invoke SEVERE: object is not an instance of declaring class java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jvnet.jax_ws_commons.spring.SpringService$1$1.invoke(SpringServic e.java:185) at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:152) at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethod Handler.java:264) at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTub e.java:93) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:604) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:563) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:548) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:445) at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:27 5) at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdap ter.java:454) at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:250 ) at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAd apter.java:140) at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServl etDelegate.java:129) at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServ letDelegate.java:160) at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.doPost(WSSpring Servlet.java:52) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run (StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri tyHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav a:292) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav a:175) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio n.run(WebAppServletContext.java:3594) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate dSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java: 121) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS ervletContext.java:2202) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC ontext.java:2108) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j ava:1432) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201) at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) i am testing our services using SOAP UI and getting above mentioed exception. I think some how the object creation from the xml is not acceptable to webservices I am confused what is happening

    Read the article

  • JavaCV IplImage to LWJGL Texture

    - by rendrag
    As a side project I've been attempting to make a dynamic display (for example a screen within a game) that shows images from my webcam. I've been messing around with JavaCV and LWJGL for the past few months and have a basic understanding of how they both work. I found this after scouring google, but I get an error that the ByteBuffer isn't big enough. IplImage img = cam.getFrame(); ByteBuffer buffer = img.asByteBuffer(); int textureID = glGenTextures(); //Generate texture ID glBindTexture(GL_TEXTURE_2D, textureID); //Bind texture ID //I don't know how much of the following is necessary //Setup wrap mode glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE); //Setup texture scaling filtering glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); //Send texture data to OpenGL - this is the line that actually does stuff and that OpenGL has a problem with glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL12.GL_BGR, GL_UNSIGNED_BYTE, buffer); That last line throws this- Exception in thread "Thread-0" java.lang.IllegalArgumentException: Number of remaining buffer elements is 144, must be at least 921600. Because at most 921600 elements can be returned, a buffer with at least 921600 elements is required, regardless of actual returned element count at org.lwjgl.BufferChecks.throwBufferSizeException(BufferChecks.java:162) at org.lwjgl.BufferChecks.checkBufferSize(BufferChecks.java:189) at org.lwjgl.BufferChecks.checkBuffer(BufferChecks.java:230) at org.lwjgl.opengl.GL11.glTexImage2D(GL11.java:2845) at tests.TextureTest.getTexture(TextureTest.java:78) at tests.TextureTest.update(TextureTest.java:43) at lib.game.AbstractGame$1.run(AbstractGame.java:52) at java.lang.Thread.run(Thread.java:679)

    Read the article

  • Tyrus 1.3

    - by Pavel Bucek
    I’m pleased to announce that new version of Tyrus was released today. It contains some interesting features, like asynchronous handling of connectToServer method call, optimised broadcast support and lots of stability and performance improvements. As previously – I will follow with more blog posts about selected features later. Some of them are already described in updated User guide. Complete list of bugfixes and new featuresTYRUS-262: @OnOpen fails for programmatically deployed annotated endpoint.TYRUS-261: Text decoder disables Binary decoder if both are configured for the same server endpoint; endpoint cannot receive binary messages anymore.TYRUS-248: Consolidate Extension representationTYRUS-258: Tyrus always creates HTTP sessionTYRUS-251: DecodeException is not passed to @OnError methodTYRUS-252: encoder for primitive types cannot be overridden.TYRUS-250: Sec-WebSocket-Protocol header cannot be present when there is no negotiated subprotocolTYRUS-249: WebSocketContainer MaxSessionIdleTimeout is not propagated to Session (server side)TYRUS-257: Async timeout value set on WebSocketContainer is not propagated to RemoteEndpoints (Session#getAsyncRemote())TYRUS-253: DecodeException is not passed to @OnError method from session.getAsyncRemote().sendObjectTYRUS-243: WebSocketContainer.connectToServer can block for secondsTYRUS-227: Build failure : AsyncBinaryTestTYRUS-226: Tyrus build error : OnCloseTestTYRUS-247: Make all samples use TestContainer for testsTYRUS-238: Refactor WebSocketEngine (SPI and Impl)TYRUS-157: Submitting tasks to an injected ManagedExecutorService in a ServerEndpoint does not workTYRUS-137: Improve subprotocols/extensions headers parsingTYRUS-133: Some Broadcast(er) API is needed in order to opmtimize chat-like usecasesTYRUS-245: ServerEndpointConfig#getConfiigurator returns Configurator not used when getNegotiatedExtensions has been called.TYRUS-240: clean up duplicated static fields (strings)TYRUS-230: When Session is invalidated, the close reason is not 1006TYRUS-190: Remove TyrusServetServerContainer (merge with TyrusServerContainer)TYRUS-65: Implement common utilities for testingTYRUS-242: Tyrus does not run on JDK8 compact2 profileTYRUS-237: RemoteEndpoint.Async#sendBinary does not throw IllegalArgumentException when data is nullTYRUS-239: Improve WebSocketEngine ByteBuffer handlingTYRUS-232: Refactor grizzly/servlet container – Tyrus-SPITYRUS-235: Fix findbugs errors in tests/servletTYRUS-234: Remove support for older protocol versionTYRUS-229: Session#setMaxIdleTimeout() will kill the session whether or not the session actually timed outTYRUS-225: Invalidation of (Servlet) HttpSession does not invalidate WebSocket SessionTYRUS-153: Static map in TyrusRemotEndpointTYRUS-201: Wrong ServletInputStream#isReady() usage in TyrusHttpUpgradeHandlerTYRUS-224: Refactor Connection#write and ConnectionImpl to use CompletionHandler only (no Future)TYRUS-221: wss:// doesn’t appear to function correctly via a http proxy.TYRUS-146: Support request from client to secured services (“wss”)TYRUS-223: Message can be writen multiple times when running on Servlet container TYRUS-71: ErroCollector not properly used in AnnotatedEndpoint class. Tyrus 1.3 will be integrated in Glassfish trunk soon – you can download nightly build or upgrade to newer Tyrus manually (replace all Tyrus jars).

    Read the article

  • What packages are neccessary to have sound output from java applets?

    - by MvG
    I've got a very minimalistic setup of ubuntu precise, created using debootstrap. So please don't assume that any packages are installed just because they usually are. On that system, I'd like to play some sounds from a java applet. However, this always fails with the following error message: javax.sound.midi.MidiUnavailableException: Can not open line at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1132) at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1036) ... Caused by: java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian is supported. at javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:476) at javax.sound.sampled.AudioSystem.getSourceDataLine(AudioSystem.java:604) at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1066) ... 35 more As the messages mention a soft synthesizer, and pcm lines, I expect that the lack of some midi daemon is not the issue here. As far as I can tell, the alsa kernel modules are loaded, including snd_hda_intel, snd_pcm, snd_seq_midi among others. I've also included the alsa-base and alsa-utils packages in my installation. alsa-mixer looks good, using “HDA Intel PCH” as its default device. What other packages, configuration settings or daemon startups does java require to make its sound output work?

    Read the article

  • How to Implement Project Type "Copy", "Move", "Rename", and "Delete"

    - by Geertjan
    You've followed the NetBeans Project Type Tutorial and now you'd like to let the user copy, move, rename, and delete the projects conforming to your project type. When they right-click a project, they should see the relevant menu items and those menu items should provide dialogs for user interaction, followed by event handling code to deal with the current operation. Right now, at the end of the tutorial, the "Copy" and "Delete" menu items are present but disabled, while the "Move" and "Rename" menu items are absent: The NetBeans Project API provides a built-in mechanism out of the box that you can leverage for project-level "Copy", "Move", "Rename", and "Delete" actions. All the functionality is there for you to use, while all that you need to do is a bit of enablement and configuration, which is described below. To get started, read the following from the NetBeans Project API: http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-projectapi/org/netbeans/spi/project/ActionProvider.html http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-projectapi/org/netbeans/spi/project/CopyOperationImplementation.html http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-projectapi/org/netbeans/spi/project/MoveOrRenameOperationImplementation.html http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-projectapi/org/netbeans/spi/project/DeleteOperationImplementation.html Now, let's do some work. For each of the menu items we're interested in, we need to do the following: Provide enablement and invocation handling in an ActionProvider implementation. Provide appropriate OperationImplementation classes. Add the new classes to the Project Lookup. Make the Actions visible on the Project Node. Run the application and verify the Actions work as you'd like. Here we go: Create an ActionProvider. Here you specify the Actions that should be supported, the conditions under which they should be enabled, and what should happen when they're invoked, using lots of default code that lets you reuse the functionality provided by the NetBeans Project API: class CustomerActionProvider implements ActionProvider { @Override public String[] getSupportedActions() { return new String[]{ ActionProvider.COMMAND_RENAME, ActionProvider.COMMAND_MOVE, ActionProvider.COMMAND_COPY, ActionProvider.COMMAND_DELETE }; } @Override public void invokeAction(String string, Lookup lkp) throws IllegalArgumentException { if (string.equalsIgnoreCase(ActionProvider.COMMAND_RENAME)) { DefaultProjectOperations.performDefaultRenameOperation( CustomerProject.this, ""); } if (string.equalsIgnoreCase(ActionProvider.COMMAND_MOVE)) { DefaultProjectOperations.performDefaultMoveOperation( CustomerProject.this); } if (string.equalsIgnoreCase(ActionProvider.COMMAND_COPY)) { DefaultProjectOperations.performDefaultCopyOperation( CustomerProject.this); } if (string.equalsIgnoreCase(ActionProvider.COMMAND_DELETE)) { DefaultProjectOperations.performDefaultDeleteOperation( CustomerProject.this); } } @Override public boolean isActionEnabled(String command, Lookup lookup) throws IllegalArgumentException { if ((command.equals(ActionProvider.COMMAND_RENAME))) { return true; } else if ((command.equals(ActionProvider.COMMAND_MOVE))) { return true; } else if ((command.equals(ActionProvider.COMMAND_COPY))) { return true; } else if ((command.equals(ActionProvider.COMMAND_DELETE))) { return true; } return false; } } Importantly, to round off this step, add "new CustomerActionProvider()" to the "getLookup" method of the project. If you were to run the application right now, all the Actions we're interested in would be enabled (if they are visible, as described in step 4 below) but when you invoke any of them you'd get an error message because each of the DefaultProjectOperations above looks in the Lookup of the Project for the presence of an implementation of a class for handling the operation. That's what we're going to do in the next step. Provide Implementations of Project Operations. For each of our operations, the NetBeans Project API lets you implement classes to handle the operation. The dialogs for interacting with the project are provided by the NetBeans project system, but what happens with the folders and files during the operation can be influenced via the operations. Below are the simplest possible implementations, i.e., here we assume we want nothing special to happen. Each of the below needs to be in the Lookup of the Project in order for the operation invocation to succeed. private final class CustomerProjectMoveOrRenameOperation implements MoveOrRenameOperationImplementation { @Override public List<FileObject> getMetadataFiles() { return new ArrayList<FileObject>(); } @Override public List<FileObject> getDataFiles() { return new ArrayList<FileObject>(); } @Override public void notifyRenaming() throws IOException { } @Override public void notifyRenamed(String nueName) throws IOException { } @Override public void notifyMoving() throws IOException { } @Override public void notifyMoved(Project original, File originalPath, String nueName) throws IOException { } } private final class CustomerProjectCopyOperation implements CopyOperationImplementation { @Override public List<FileObject> getMetadataFiles() { return new ArrayList<FileObject>(); } @Override public List<FileObject> getDataFiles() { return new ArrayList<FileObject>(); } @Override public void notifyCopying() throws IOException { } @Override public void notifyCopied(Project prjct, File file, String string) throws IOException { } } private final class CustomerProjectDeleteOperation implements DeleteOperationImplementation { @Override public List<FileObject> getMetadataFiles() { return new ArrayList<FileObject>(); } @Override public List<FileObject> getDataFiles() { return new ArrayList<FileObject>(); } @Override public void notifyDeleting() throws IOException { } @Override public void notifyDeleted() throws IOException { } } Also make sure to put the above methods into the Project Lookup. Check the Lookup of the Project. The "getLookup()" method of the project should now include the classes you created above, as shown in bold below: @Override public Lookup getLookup() { if (lkp == null) { lkp = Lookups.fixed(new Object[]{ this, new Info(), new CustomerProjectLogicalView(this), new CustomerCustomizerProvider(this), new CustomerActionProvider(), new CustomerProjectMoveOrRenameOperation(), new CustomerProjectCopyOperation(), new CustomerProjectDeleteOperation(), new ReportsSubprojectProvider(this), }); } return lkp; } Make Actions Visible on the Project Node. The NetBeans Project API gives you a number of CommonProjectActions, including for the actions we're dealing with. Make sure the items in bold below are in the "getActions" method of the project node: @Override public Action[] getActions(boolean arg0) { return new Action[]{ CommonProjectActions.newFileAction(), CommonProjectActions.copyProjectAction(), CommonProjectActions.moveProjectAction(), CommonProjectActions.renameProjectAction(), CommonProjectActions.deleteProjectAction(), CommonProjectActions.customizeProjectAction(), CommonProjectActions.closeProjectAction() }; } Run the Application. When you run the application, you should see this: Let's now try out the various actions: Copy. When you invoke the Copy action, you'll see the dialog below. Provide a new project name and location and then the copy action is performed when the Copy button is clicked below: The message you see above, in red, might not be relevant to your project type. When you right-click the application and choose Branding, you can find the string in the Resource Bundles tab, as shown below: However, note that the message will be shown in red, no matter what the text is, hence you can really only put something like a warning message there. If you have no text at all, it will also look odd.If the project has subprojects, the copy operation will not automatically copy the subprojects. Take a look here and here for similar more complex scenarios. Move. When you invoke the Move action, the dialog below is shown: Rename. The Rename Project dialog below is shown when you invoke the Rename action: I tried it and both the display name and the folder on disk are changed. Delete. When you invoke the Delete action, you'll see this dialog: The checkbox is not checkable, in the default scenario, and when the dialog above is confirmed, the project is simply closed, i.e., the node hierarchy is removed from the application. However, if you truly want to let the user delete the project on disk, pass the Project to the DeleteOperationImplementation and then add the children of the Project you want to delete to the getDataFiles method: private final class CustomerProjectDeleteOperation implements DeleteOperationImplementation { private final CustomerProject project; private CustomerProjectDeleteOperation(CustomerProject project) { this.project = project; } @Override public List<FileObject> getDataFiles() { List<FileObject> files = new ArrayList<FileObject>(); FileObject[] projectChildren = project.getProjectDirectory().getChildren(); for (FileObject fileObject : projectChildren) { addFile(project.getProjectDirectory(), fileObject.getNameExt(), files); } return files; } private void addFile(FileObject projectDirectory, String fileName, List<FileObject> result) { FileObject file = projectDirectory.getFileObject(fileName); if (file != null) { result.add(file); } } @Override public List<FileObject> getMetadataFiles() { return new ArrayList<FileObject>(); } @Override public void notifyDeleting() throws IOException { } @Override public void notifyDeleted() throws IOException { } } Now the user will be able to check the checkbox, causing the method above to be called in the DeleteOperationImplementation: Hope this answers some questions or at least gets the discussion started. Before asking questions about this topic, please take the steps above and only then attempt to apply them to your own scenario. Useful implementations to look at: http://kickjava.com/src/org/netbeans/modules/j2ee/clientproject/AppClientProjectOperations.java.htm https://kenai.com/projects/nbandroid/sources/mercurial/content/project/src/org/netbeans/modules/android/project/AndroidProjectOperations.java

    Read the article

  • Subscribing message sent from another application

    - by tonga
    I have two Java applications: AppOne and AppTwo. In AppOne, I used a JMS sender to publish a Topic. In both AppOne and AppTwo, I used a JMS MessageListener to subscribe to the message published by AppOne. I used ActiveMQ as my JMS broker and Spring JMS. However, I can only see the echoed message received by AppOne message listener. But I can't see the echoed message received by AppTwo listener. AppOne message listener is in the same application/project as the message publisher. But AppTwo message listener is in a different application/project. The AppOne listener class is: public class CustomerStatusListener implements MessageListener { public void onMessage(Message message) { if (message instanceof TextMessage) { try { System.out.println("Subscriber 1 got you! The message is: " + ((TextMessage) message).getText()); } catch (JMSException ex) { throw new RuntimeException(ex); } } else { throw new IllegalArgumentException("Message must be of type TextMessage"); } } } It is invoked by a test calss JmsTest in AppOne: public class JmsTest { public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("message-bean.xml"); CustomerStatusSender messageSender = (CustomerStatusSender) context.getBean("customerMessageSender"); messageSender.simpleSend(); context.close(); } } The AppTwo listener class is: public class CustomerStatusMessageListener implements MessageListener { public void onMessage(Message message) { if (message instanceof TextMessage) { try { System.out.println("Subscriber 2 got you! The message is: " + ((TextMessage) message).getText()); } catch (JMSException ex) { throw new RuntimeException(ex); } } else { throw new IllegalArgumentException( "Message must be of type TextMessage"); } } } The bean definition file for AppTwo where the Subscriber 2 lives in is: <bean id="connectionFactoryBean" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="tcp://localhost:61616" /> </bean> <!-- this is the Message Driven POJO (MDP) --> <bean id="customerStatusListener" class="com.mydomain.jms.CustomerStatusMessageListener" /> <!-- and this is the message listener container --> <bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="connectionFactoryBean" /> <property name="destination" ref="topicBean" /> <property name="messageListener" ref="customerStatusListener" /> </bean> The bean id topicBean is the bean that is associated with the publisher. If both listener received the message sent from AppOne, I would have seen two echoed messages: Subscriber 1 got you! The message is: hello world Subscriber 2 got you! The message is: hello world But right now I only see the first line which means only the listener in AppOne got the message. So how to let the listener in AppTwo get the message? The first listener is in the same application as the sender, so it is easy to understand that it can get the message. But how about the second listener which is in a different application? What is the correct way to subscribe to a JMS Topic published in another application?

    Read the article

  • How can I use an object pool for optimization in AndEngine?

    - by coder_For_Life22
    I have read up on a tutorial that allows you to reuse sprites that are re-added to the scene such as bullets from a gun or any other objects using an ObjectPool. In my game i have a variation of sprites about 6 all together with different textures. This is how the object pool is set up with its own class extending Java's GenericPool class public class BulletPool extends GenericPool<BulletSprite> { private TextureRegion mTextureRegion; public BulletPool(TextureRegion pTextureRegion) { if (pTextureRegion == null) { // Need to be able to create a Sprite so the Pool needs to have a TextureRegion throw new IllegalArgumentException("The texture region must not be NULL"); } mTextureRegion = pTextureRegion; } /** * Called when a Bullet is required but there isn't one in the pool */ @Override protected BulletSprite onAllocatePoolItem() { return new BulletSprite(mTextureRegion); } /** * Called when a Bullet is sent to the pool */ @Override protected void onHandleRecycleItem(final BulletSprite pBullet) { pBullet.setIgnoreUpdate(true); pBullet.setVisible(false); } /** * Called just before a Bullet is returned to the caller, this is where you write your initialize code * i.e. set location, rotation, etc. */ @Override protected void onHandleObtainItem(final BulletSprite pBullet) { pBullet.reset(); } } As you see here it takes a TextureRegion parameter. The only problem i am facing with this is that i need to have 6 different sprites recycled and reused in the ObjectPool. This ObjectPool is set up to only use one TextureRegion. Any idea's or suggestions on how to do this?

    Read the article

  • Doubly linked lists

    - by user1642677
    I have an assignment that I am terribly lost on involving doubly linked lists (note, we are supposed to create it from scratch, not using built-in API's). The program is supposed to keep track of credit cards basically. My professor wants us to use doubly-linked lists to accomplish this. The problem is, the book does not go into detail on the subject (doesn't even show pseudo code involving doubly linked lists), it merely describes what a doubly linked list is and then talks with pictures and no code in a small paragraph. But anyway, I'm done complaining. I understand perfectly well how to create a node class and how it works. The problem is how do I use the nodes to create the list? Here is what I have so far. public class CardInfo { private String name; private String cardVendor; private String dateOpened; private double lastBalance; private int accountStatus; private final int MAX_NAME_LENGTH = 25; private final int MAX_VENDOR_LENGTH = 15; CardInfo() { } CardInfo(String n, String v, String d, double b, int s) { setName(n); setCardVendor(v); setDateOpened(d); setLastBalance(b); setAccountStatus(s); } public String getName() { return name; } public String getCardVendor() { return cardVendor; } public String getDateOpened() { return dateOpened; } public double getLastBalance() { return lastBalance; } public int getAccountStatus() { return accountStatus; } public void setName(String n) { if (n.length() > MAX_NAME_LENGTH) throw new IllegalArgumentException("Too Many Characters"); else name = n; } public void setCardVendor(String v) { if (v.length() > MAX_VENDOR_LENGTH) throw new IllegalArgumentException("Too Many Characters"); else cardVendor = v; } public void setDateOpened(String d) { dateOpened = d; } public void setLastBalance(double b) { lastBalance = b; } public void setAccountStatus(int s) { accountStatus = s; } public String toString() { return String.format("%-25s %-15s $%-s %-s %-s", name, cardVendor, lastBalance, dateOpened, accountStatus); } } public class CardInfoNode { CardInfo thisCard; CardInfoNode next; CardInfoNode prev; CardInfoNode() { } public void setCardInfo(CardInfo info) { thisCard.setName(info.getName()); thisCard.setCardVendor(info.getCardVendor()); thisCard.setLastBalance(info.getLastBalance()); thisCard.setDateOpened(info.getDateOpened()); thisCard.setAccountStatus(info.getAccountStatus()); } public CardInfo getInfo() { return thisCard; } public void setNext(CardInfoNode node) { next = node; } public void setPrev(CardInfoNode node) { prev = node; } public CardInfoNode getNext() { return next; } public CardInfoNode getPrev() { return prev; } } public class CardList { CardInfoNode head; CardInfoNode current; CardInfoNode tail; CardList() { head = current = tail = null; } public void insertCardInfo(CardInfo info) { if(head == null) { head = new CardInfoNode(); head.setCardInfo(info); head.setNext(tail); tail.setPrev(node) // here lies the problem. tail must be set to something // to make it doubly-linked. but tail is null since it's // and end point of the list. } } } Here is the assignment itself if it helps to clarify what is required and more importantly, the parts I'm not understanding. Thanks https://docs.google.com/open?id=0B3vVwsO0eQRaQlRSZG95eXlPcVE

    Read the article

  • how to parse a Date string to java.Date

    - by hguser
    Hi: I have a date string and I wang to parse it to normal date use the java Date API,the following is my code: public static void main(String[] args) { String date="2010-10-02T12:23:23Z"; String pattern="yyyy-MM-ddThh:mm:ssZ"; SimpleDateFormat sdf=new SimpleDateFormat(pattern); try { Date d=sdf.parse(date); System.out.println(d.getYear()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } However I got a exception:java.lang.IllegalArgumentException: Illegal pattern character 'T' So I wonder if i have to split the string and parse it manually? BTW, I have tried to add a single quote character on either side of the T: String pattern="yyyy-MM-dd'T'hh:mm:ssZ"; It also does not work.

    Read the article

  • How to use Enum as NamedQuery parameters in JPA

    - by n002213f
    I have an Entity with a enum attribute and a couple on NamedQueries. One of these NamedQueries has a the enum attribute as a parameter i.e. SELECT m FROM Message m WHERE status = :status When i try to ru n the query i get the following error; Caused by: java.lang.IllegalArgumentException: You have attempted to set a value of type class my.package.Status for parameter status with expected type of class my.package.Status from query string SELECT m FROM Message m WHERE m.status = :status. I'm using Toplink How is this? How would i make JPA happy?

    Read the article

  • Error: Can't find common super class of ...

    - by PatlaDJ
    I am trying to process with Proguard a MS Windows desktop application (Java 6 SE using the SWT lib provided by Eclipse). And I get the following critical error: Unexpected error while performing partial evaluation: Class = [org/eclipse/swt/widgets/DateTime] Method = [<init>(Lorg/eclipse/swt/widgets/Composite;I)V] Exception = [java.lang.IllegalArgumentException] (Can't find common super class of [java/lang/StringBuffer] and [org/eclipse/swt/internal/win32/TCHAR]) Error: Can't find common super class of [java/lang/StringBuffer] and [org/eclipse/swt/internal/win32/TCHAR] ---------------------------- When I tried to Google the error, it came out only on two spots on the entire web, that astonished me greatly. I am newbie using Proguard and Java code optimization tools at all. Any thoughts and suggestions how to fix this, will be appreciated. Thanks in advance.

    Read the article

  • Joda time : convert string to LocatDate

    - by bsreekanth
    Hello, How to specify the format string to convert the date alone from string. In my case, only the date part is relevant Constructing it as DateTime fails String dateString = "2009-04-17"; DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); DateTime dateTime = formatter.parseDateTime(dateString); with error java.lang.IllegalArgumentException: Invalid format: "2011-04-17" is too short Probably because I should use LocalTime instead. But, I do not see any formatter for LocalTime . What is the best way to convert String dateString = "2009-04-17"; into LocalDate (or something else if that is not the right representation) thanks...

    Read the article

  • Java File URI error ?

    - by Frank
    I need to get a file object online, and I know the file is located at : http://nmjava.com/Dir_App_IDs/Dir_GlassPaneDemo/GlassPaneDemo_2010_04_06_15_00_SNGRGLJAMX If I paste it into my browser's url, I'll be able to download this file, now I'm trying to get it with Java, my code looks like this : String File_Url="http://nmjava.com/Dir_App_IDs/Dir_GlassPaneDemo/GlassPaneDemo_2010_04_06_15_00_SNGRGLJAMX"; Object myObject=Get_Online_File(new URI(File_Url)); Object Get_Online_File(URI File_Uri) throws IOException { return readObject(new ObjectInputStream(new FileInputStream(new File(File_Uri)))); } public static synchronized Object readObject(ObjectInput in) throws IOException { Object o; ...... return o; } But I got the following error message : java.lang.IllegalArgumentException: URI scheme is not "file" at java.io.File.<init>(File.java:366) Why ? How to fix it ? Frank

    Read the article

  • XML Validation

    - by Keya
    Hi, I want to validate an XML file against RELAXNG schema provided. Searching on the net gave me hints to create a Schema instance using SchemaFactory by providing the appropriate Schema Language. So as per my requirement I used: *SchemaFactory.newInstance(XMLConstants.RELAXNG_NS_URI);* But the following exception was thrown at run: Exception in thread "main" java.lang.IllegalArgumentException: No SchemaFactory that implements the schema language specified by: http://relaxng.org/ns/structure/1.0 could be loaded at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:207) I am using Java6 and observed that only 'W3C_XML_SCHEMA_NS_URI' works. Rest all the schema URIs throws the similar exception. I am fairly new to using the XML validation APIs. Can someone please provide me the appropriate usage in case I am not doing it correctly? Thanks & Regards, Keya

    Read the article

  • Exception while running Quartz Schdular program

    - by Sunny Mate
    hi, i am getting he following Exception while running my Quartz Schdular program. Below is the exception Trace Mar 26, 2010 2:54:24 PM org.quartz.core.QuartzScheduler start INFO: Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. Exception in thread "main" java.lang.IllegalArgumentException: Job class must implement the Job interface. at org.quartz.JobDetail.setJobClass(JobDetail.java:291) at org.quartz.JobDetail.(JobDetail.java:138) at com.Quarrtz.RanchSchedule.main(RanchSchedule.java:18) i have included Quartz-1.7.2.jar and Quartz-all-1.7.2.jar in my class path along with commom-logging 1.1.jar and jdk 6 this is an example i have copy and pasted from JAVA RANCH http://www.javaranch.com/journal/200711/combining_spring_and_quartz.html First example in the above page any help pls thanx in advance Sunny Mate

    Read the article

  • Joda time : How to convert String to LocalDate?

    - by bsreekanth
    Hello, How to specify the format string to convert the date alone from string. In my case, only the date part is relevant Constructing it as DateTime fails: String dateString = "2009-04-17"; DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); DateTime dateTime = formatter.parseDateTime(dateString); with error java.lang.IllegalArgumentException: Invalid format: "2011-04-17" is too short Probably because I should use LocalDate instead. But, I do not see any formatter for LocalDate . What is the best way to convert String dateString = "2009-04-17"; into LocalDate (or something else if that is not the right representation) thanks...

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10  | Next Page >