Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

Tuesday, November 1, 2011

Eclipse, WTP JavaScript Validator useless

WTP comes with JS Validator which is by default configured to
"Enable JavaScript semantic validation".

Defaults are set somehow but soon
you will have to turn OFF "the whole thing" because:

Optional Semicolon: Ignore
because of Dojo and other framework authors do not care

Local Variable is never read: Ignore
because it does not work, local.member is not considered reading local by WTP

Uninitialized local variables: Ignore
This is just JS style of me and many others

And after turning this all OFF, you will end up with
Type mismatch: cannot convert from any[] to any ItemFileWriteStore.js /dojo/data JavaScript Problem line 581
on simple lines like: var serializableArray = [];

Since this warning cannot be turned off (no UI item for this),
you must modify the plugin
or just turn WHOLE "SEMANTICS VALIDATOR" OFF.

Another piece of code that is useless, thanx for wasting my time again.

see also:
http://stackoverflow.com/questions/5765955/javascript-array-why-is-this-not-valid


Update:
Eclipse IDE for JavaScript Web Developers
eclipse-javascript-indigo-SR1-macosx-cocoa-x86_64.tar.gz
contains quite old version of the plugin:
plugin version org.eclipse.wst.jsdt.core_1.1.101.v201108151912.jar

Monday, August 2, 2010

Eclipse and JSP Validation rtexprvalue

Sometimes the ment for RAD slows you down.
Specially if not implemented by specs:

Tag:
<jsp:directive.attribute name="title"/>

Usage:
<l:holy-grail-no-quirks-mode title="${param.title}">

Result:
"title" does not support runtime expressions holy-grail-no-quirks-mode.jspx

Read the docs (jsp-2_0-fr-spec.pdf, Table JSP.8-3 Details of attribute directive attributes):
rtexprvalue (optional) Whether the attribute’s value may be dynamically
calculated at runtime by a scriptlet expression.Unlike the
corresponding TLD element, this attribute defaults to true.


Fix: you have to type extra chars if you want this warning to disapear:
<jsp:directive.attribute name="title" rtexprvalue="true"/>

Already registered ;-(

https://bugs.eclipse.org/bugs/show_bug.cgi?id=302060

Thursday, July 29, 2010

OEPE, Eclipse helios & NoSuchMethodError at creating new WLS server

Here are some news from my friend:

Some theory first:
In order to have Oracle WebLogic Server 11gR1 PatchSet 2 (latest) runtime environment in Eclipse helios,
you need to have server adapter in your IDE for that.
We still think the best way to do this is through “Oracle Enterprise Pack for Eclipse” where this adapter is included.

From this pack you only need this software:
Oracle WebLogic Server Tools 1.5.0.201003261013
Oracle Common Tools 1.5.0.201003261013 (dependency)

You can do that by adding another update URL in Eclipse:
“Oracle Enterprise Pack for Eclipse - http://download.oracle.com/otn_software/oepe/helios”

Oracle web site (http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/oepe-11115-089873.html )
contains this note:
“Note: Be aware that Eclipse 3.6 Helios is not final and this tech preview is based on the M6 milestone release of Eclipse 3.6.”

True. When you download latest eclipse it’s M7 milestone (from April 30, 2010).
Milestone M6 was API Freeze and latest M7 is Feature Freeze, Focus on Performance and Polish.

IMHO M7 is final 3.6 milestone.
http://www.eclipse.org/eclipse/platform-text/3.6/plan.php


Now to the point: when you try to add awesome WLS in latest Eclipse you will get nice server error

From Error log:

java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1008)
at org.eclipse.wst.server.ui.internal.wizard.TaskWizard.performFinish(TaskWizard.java:221)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.wst.server.ui.internal.actions.LaunchWizardAction.run(LaunchWizardAction.java:57)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Caused by: java.lang.NoSuchMethodError: org.eclipse.wst.server.core.internal.UpdateServerJob.<init>(Lorg/eclipse/wst/server/core/IServer;)V
at oracle.eclipse.tools.weblogic.ui.internal.WlsUiPlugin$1.serverAdded(WlsUiPlugin.java:242)
at org.eclipse.wst.server.core.internal.ResourceManager.fireServerEvent(ResourceManager.java:493)
at org.eclipse.wst.server.core.internal.ResourceManager.registerServer(ResourceManager.java:1114)
at org.eclipse.wst.server.core.internal.ResourceManager.addServer(ResourceManager.java:630)
at org.eclipse.wst.server.core.internal.Server.saveToMetadata(Server.java:459)
at org.eclipse.wst.server.core.internal.Base.doSave(Base.java:264)
at org.eclipse.wst.server.core.internal.Server.doSave(Server.java:448)
at org.eclipse.wst.server.core.internal.ServerWorkingCopy.save(ServerWorkingCopy.java:426)
at org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil.tempSaveServer(WizardTaskUtil.java:149)
at org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil$4.performFinish(WizardTaskUtil.java:65)
at org.eclipse.wst.server.ui.internal.wizard.TaskWizard.executeTask(TaskWizard.java:256)
at org.eclipse.wst.server.ui.internal.wizard.TaskWizard$2.run(TaskWizard.java:213)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
at org.eclipse.wst.server.ui.internal.wizard.page.WorkspaceRunnableAdapter.run(WorkspaceRunnableAdapter.java:35)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)


That is because underlying eclipse implementation had changed.
You see that signature?
UpdateServerJob.<init>(Lorg/eclipse/wst/server/core/IServer;)V

It’s initialize method from UpdateServerJob class that returns void and takes IServer as an argument.

When you decompile latest M7 UpdateServerJob.class there really is no such method. It has only constructor that takes IServer array!

public UpdateServerJob(IServer servers2[])
{
super(Messages.jobUpdatingServers);
servers = servers2;
}

And WlsUiPlugin$1 calls it with

public void serverAdded(IServer server)
{
if(WebLogicServerUtil.isWebLogicServer(server) && server.getServerState() == 0)
{
UpdateServerJob job = new UpdateServerJob(server);
job.schedule();
}
}

Unfortunately that works for M6 version only. At that time UpdateServerJob constructor looked like this:
public UpdateServerJob(IServer server)
{
super(NLS.bind(Messages.jobUpdateServer, server.getName()), server);
}


Conclusion:
Oracle developers, I think it is really a time to update your OEPE plugin because M7 is out there for 3 months now.
You have to change all calls of that constructor:
From
UpdateServerJob job = new UpdateServerJob(server);
To
UpdateServerJob job = new UpdateServerJob(new IServer[]{server});

Simple like that

This construction needs to be changed also in these files:

oracle.eclipse.tools.weblogic.ui_3.0.0.201003261013.jar -> package oracle.eclipse.tools.weblogic.ui.internal -> WlsUiPlugin.java
oracle.eclipse.tools.weblogic.ui_3.0.0.201003261013.jar -> package oracle.eclipse.tools.weblogic.ui.internal -> WlsUiPlugin$1.java
oracle.eclipse.tools.weblogic_3.0.0.201003261013.jar -> package oracle.eclipse.tools.weblogic.server.internal.util -> ServerLaunchUtils.java

Or you can give us OEPE plugin sources and we will change it ourselves 

Versions:

Decompiler info:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)

Bundled M6 (oepe-helios-all-in-one) eclipse plugin jar: org.eclipse.wst.server.core_1.1.202.v20100315.jar
Latest M7 eclipse plugin jar: org.eclipse.wst.server.core_1.1.202.v20100518.jar

Wednesday, July 28, 2010

Fix For WST (Web Standard Toolkit) template

This is just sick ;-)

<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.page language="java"
contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />

<jsp:text>
<![CDATA[ <?xml version="1.0" encoding="UTF-8" ?> ]]>
</jsp:text>

<jsp:text>
<![CDATA[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ]]>
</jsp:text>


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>

</body>
</html>
</jsp:root>


My proposed version is:

<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.page language="java"
contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />
<jsp:output omit-xml-declaration="no" doctype-root-element="html"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>

</body>
</html>
</jsp:root>

Do you think ther is a reason or just ignorance ?
Fist original WST code is buggy, outputed "XHTML" will have whitespaces before ?xml and whitespaces before doctype. (Authors, please read at least JSP.1.3.8 White Space) if not XML and HTML specs ;-))