GithubHelp home page GithubHelp logo

zkoss / zk Goto Github PK

View Code? Open in Web Editor NEW
427.0 427.0 202.0 983.52 MB

ZK is a highly productive Java framework for building amazing enterprise web and mobile applications

Home Page: http://www.zkoss.org

Shell 0.21% Awk 0.01% Java 78.57% HTML 0.45% JavaScript 3.41% XSLT 0.01% CSS 0.03% sed 0.01% ZenScript 0.02% TypeScript 14.38% Faust 0.39% Dockerfile 0.01% Less 2.51%

zk's People

Contributors

b952426 avatar benbai avatar bob31231 avatar chunfuchang avatar danchen0720 avatar dennischen avatar dependabot[bot] avatar devchu avatar hawkchen avatar henrichen avatar huangnoah avatar jamsonchan avatar jerrywell avatar jimmyshiau avatar jumperchen avatar klyvechen avatar pao0111 avatar peterkuo avatar plijyfes avatar rebecca0201 avatar ryanhanwu avatar samchuang avatar scribetw avatar shenliow avatar t-c-chiu avatar tomyeh avatar tony1223 avatar wenninghsu avatar zanyking avatar zkadmin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zk's Issues

Bug with ZK-3769: Specify a default time for Datebox #1700

Hello first time reporting a bug here. Unable to report this using the ZK Tracker so write it here instead.

In 2019 a feature was added to ZK to allow the user to set a default datetime value for the . This works fine for the drop down menu when clicked and the user chooses a date and time. However this does not help if the user instead uses tab to enter the datebox field and instead types the date they want. In this case the time is instead set to the current time.

See here that the dropdown does indeed show the time as 00:00.
image

But if i just write the date, in my case 2024-01-22 and hit tab this happens:
image

It would be great if the defaultDateTime also helped set the correct time and date if the user fills in a date, or even part of a date and then if a defaultDateTime is set use that to fill in the rest that the user left out.

The PR that added the defaultDateTime functionality: #1700

org.zkoss.lang.SystemException:java.io.NotSerializableException:com.kawa.sys.pub.DataAccessObjectat

The file path is org.zkoss.lang.Object.

source code:

public static final object clone(Object o){
      if (o =null)
      return o;

      try{
            final Class<?>kls = o.getclass();
            if (kls.isArray())
                  return Arraysx.duplicate(o);

            if (o instanceof Cloneable){
                  try{
                        return kls.getMethod("clone").invoke (o);
                  }catch (NoSuchMethodException ex)(
                        if (log.isDebugEnabled())log.debug("No clone()for "+kls);
                  }
            }
      //TODO:Marshalledobject is said with very bad performance,change it
      //if exists other good deep clone method.
      return new Marshalledobject<object>(o).get ();
      }catch (Exception ex){
            throw SystemException.Aide.wrap(ex);
      }
}

test code:

@Test
public void test_clone_2_52()throws NoSuchFieldException,IllegalAccessException{

        java.lang.Object object0=new         com.kawa.familytree.main.bs.PersonalDAO();
        org.zkoss.lang.Objects.clone(object0);
}

test results:

org.zkoss.lang.SystemException:java.io.NotSerializableException:com.kawa.sys.pub.DataAccessObjectat java.base/jdk.internal.reflect.NativeConstructorAccessorlmpl.newlnstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorlmpl.newlnstance(NativeConstructorAccessorlmpl.javaat java.base/jdk.internal.reflect.DelegatingConstructorAccessorlmpl.newlnstance(DelegatingConstructorAccessorat java.base/java.lang.reflect.Constructor.newlnstanceWithCaller(Constructor.java:499)at java.base/java.lang.reflect.Constructor.newlnstance(Constructor.java:480)
Sat org.zkoss.lang.Classes.newlnstance(Classes.java:76)
at org.zkoss.lang.Exceptions.wrap(Exceptions.java:163)
at org.zkoss.lang.SystemException$Aide.wrap(SystemException.java:43)at org.zkoss.lang.Objects.clone(Objects.java:441)

“NullPointerException”The number passed in the api is min() and max() is a null pointer.

The file path is org.zkoss.lang.Comparables.
In our test case, we pass compare0 and compare1 into the functions whose api is max() and min(). Inside these api, an exception occurs when a null pointer is referenced for comparison

source code:

@SuppressWarnings ("unchecked")
public static final Comparable min (Comparable a,Comparable b){
        return (a.compareTo(b)<0)?a b;
}


@SuppressWarnings("unchecked")
public static final Comparable max (Comparable a,Comparable b){
        return (a.compareTo(b)<0)?b : a;
}

test code:

@Test
public void test _min_5_5() throws NoSuchFieldException, IllegalAccessException{

        java.lang.Comparable<java.lang.object>comparable0=null;
        java.lang.Comparable<java.lang.Object>comparable1=null;
        org.zkoss.lang.Comparables.min(comparable0,comparable1);

}

@Test
public void test _max_1_6() throws NoSuchFieldException,IllegalAccessException{
        java.lang.Comparable<java.lang.Object>comparable0=null;
        java.lang.Comparable<java.lang.Object>comparable1=null;
        org.zkoss.lang.Comparables.max (comparable0,comparable1);

test results:

java.lang.NullPointerException:Cannot invoke "java.lang.Comparable.compareTo(Object)"because "a"is null
at org.zkoss.lang.Comparables.min(Comparables.java:33)
at org.zkoss.lang.Comparables_Test.test_min_1_1(Comparables_Test.java:13)

Make pickers compatible with java 8 date types

I have multiple issues related to dates when using new Java 8 API (i.e. LocalDateTime, LocalDate or LocalTime) as ZK date and time pickers return old Date objects. So when a value is selected from a picker it cannot be converted :

Cannot convert 22.01.19 08:31 of type class java.util.Date to class java.time.LocalDateTime

I also cannot use some properties in pickers as it is waiting for a Date (i.e. min and max properties in time picker) :

java.lang.ClassCastException: 12:00(java.time.LocalTime) cannot be converted to class java.util.Date

Same for the built-in formatedDate formatter, which uses Date (I had to build a custom one).

So I always need to do the cast in my viewmodels to make it work.

Is there any workaround ?

Another problem is that even when using Date types in my viewmodels/entities, I cannot use it in a form when it is mapped to a database Time object (using JPA annotation @Temporal(TemporalType.TIME) because it seems the form proxy object does not support it:

Example:

@Entity
@Table(name = "schedule")
public class Schedule {

    @Column
    @Temporal(TemporalType.DATE)
    private Date day;

    @Column
    @Temporal(TemporalType.TIME)
    private Date start;

    @Column
    @Temporal(TemporalType.TIME)
    private Date end;
}
<div form="@id('course') @load(myVm.course) @save(myVm.course, before={'saveCourse'})">
    <forEach items="@load(course.schedules)">
        <hlayout>
            <label value="@load(each.day)"/>
            <label value="@load(each.start)"/>
            <label value="@load(each.end)"/>
        </hlayout>
    </forEach>
</div>

As soon as I try to display start or end, I get:

java.lang.NoClassDefFoundError: org/zkoss/bind/proxy/FormProxyObject

Works fine for the day.

So here are my requirements:

  • Allow pickers to return java 8 date types
  • Update converters to support Java 8 date types (and on the way rename "formated" to "formatted" :))
  • Support Java 8 date types in picker properties (min, max, etc.)
  • Support Date mapped to a Time in form proxy objects

Allow to call JavaScript function in error-reload

This is related to #583 SSO & AU Http StatusCode Handling

Currently, I can only redirect to an URI. This causes a problem in my case:

  1. Session times out
  2. Server sends 401 to client
  3. ZK error handling code tries to load /timeout.zul
  4. Server redirects request for /timeout.zul to SSO server since you don't have a valid login, yet.

This means I can't display a nice message to the user when a SSO timeout happens because I can't load any pages.

I would like to be able to call JavaScript when an error happens. That would allow me to display a message when a timeout happens.

Workaround: If you can split the application URLs into public and secure ones, then you could put the timeout URL into the public area.

Unfortunately, in my case, the root URL has to be secure, and I couldn't figure out how to say "/timeout.zul is public" when "/" is secure.

SSO & AU Http StatusCode Handling

This is related to http://forum.zkoss.org/question/13182/authentication-au-http-statuscode-handling/ which contains a patch.

In a nutshell: I'm using Fediz as an Single-Sign-On (SSO) service. When the SSO token times out, I see this in the log file:

[timestamp] "POST /webapp/zkau HTTP/1.1" 302

The code in au.js doesn't handle this case. Instead of redirecting the to start or timeout page, it tries again.

Instead, the code should either follow the redirection or it should be possible to define a timeout/logout URL in zk.xml.

Undesired transitive dependencies

I was trying the new zk-bom added in https://tracker.zkoss.org/browse/ZK-4458 and I realized that I was excluding some transitive dependencies from zk.

The most important one is the JUL implementation of SLF4J that is defined in the project zcommon as a runtime dependency. It endup leaking into consumer projects (anyone that uses zk) and considering that zcommon is a library it really shouldn't declare a SLF4J implementation.

The other one I explicitly exclude (because of it's weight) is closure-compiler-unshaded that is defined as a compile time dependency of zk project and also leaks to consumer projects. Maybe this dependency should be optional. In fact, in code is treated as optional because is loaded only if it exists in the classpath and it requires that sourceMap configuration is enabled.

Shiro subject logout causes nullpointer exception

Performing a subject logout using Apache Shiro, with SecurityUtils.getSubject().logout(), causes Zk to generate an "[Event onVMsgsChanged null]" event. However the Execution context at that point has been set to null, which makes the postEvent method, in Events.java, throw a nullpointer exception. This is the offending line:

414: Executions.getCurrent().postEvent(priority, realTarget, event);

I cannot catch the nullpointer exception, so the user gets a messagebox displaying the nullpointer message

"Failed to mount: zul.wnd.Messagebox is undefined" when setting new Template to Messagebox

Hi.

In my code i try to have a scrollable messagebox, without implementing a new one.

So i used

Messagebox.setTemplate(TEMPLATE_PATH);

to set it to an almost identical messagebox.zul (copied from this repository) with the following difference:

			<div sclass="z-messagebox"
				style="max-height:225px;overflow-x:hidden;overflow-y:auto">
				<label value="${arg.message}" multiline="true" 
				w:onBind="zul.wnd.Messagebox.onBind(this,350)"/>
			</div>

But whenever a messagebox is popped i get: "Failed to mount: zul.wnd.Messagebox is undefined"

If i don't change the template that error does not happen.
If i leave the w.onBind, i get no buttons.

Combobox item autodropdown on element load

After migrating from ZK version 8.5.0 to 8.6.0.1, we faced the issue with Combobox elements only in IE browser.
By some reason, it can't be re-created in ZK fiddle, so let me just paste my small demo code here to be clear.
Simple ZUL with combobox element:

<zk>
    <div apply="org.zkoss.bind.BindComposer" height="278px" width="443px"
         viewModel="@id('vm') @init('com.swissre.cre.presentation.mvc.TestModel')">
        <combobox id="cmbColor" width="150px"
                  model="@load(vm.names)" selectedItem="@bind(vm.iname)">
        </combobox>
    </div>
</zk>

My test model:

public class TestModel {

    private String iname;
    private List<String> names = Arrays.asList("Iüvanov", "alex", "ivan");

    @Init
    public void init() {
        setIname("Iüvanov");
    }

    public List<String> getNames() {
        return names;
    }

    public void setNames(List<String> names) {
        this.names = names;
    }

    public String getIname() {
        return iname;
    }

    public void setIname(String iname) {
        this.iname = iname;
    }

}

If the selected value contains characters like this "ü" (or any other diaeresis characters), the dropdown will be triggered on page re-load (on F5 for instance). If you remove this char from collection element it will not happen.
I will be highly appreciated for any help with this issue.
Thank you in advance.

“ArrayIndexOutOfBoundsException”The input array size is larger than the array limit

The file path is org.zkoss.json.parser.Yylex.
In our test case, pass int1=2147483647 into the function whose api is yycharat().
Inside this api, an array with a size greater than 2147483647 will be created, and an array out-of-bounds exception will be generated at this time.

source code:

public final char yycharat (int pos){
        return zzBuffer[zzStartRead[pos];
}

test code:

public void test_yycharat_1_36() throws NoSuchFieldException,IllegalAccessException{
        int int1=2147483647;
        java.io.Reader reader2 = null;

        org.zkoss.json.parser.Yylex yylex0 = new org.zkoss.json.parser.Yylex(reader2);
        yylex0.yycharat(int1);
}

test result:

java.lang.ArraylndexOutOfBoundsException:Index 2147483647 out of bounds for length 16384
at org.zkoss.json.parser.Yylex.yycharat(Yylex.java:439)
at org.zkoss.json.parser.Yylex_Test.test_yycharat_1_36(Yylex_Test.java:596)

“NullPointerException”The number passed in the api is zzRefill is a null pointer.

The file path is org.zkoss.json.parser.Yylex.
In our test case, pass reader1=null into the function whose api is JSONParser0.parse(). Inside this api, the zzRefill function in Yylen will be called and a null pointer exception will be generated when it is called.
source code:

private boolean zzRefill() throws java.io.IOException{
        /*first:make room (if you can)*/
        if(zzStartRead>0){
        System.arraycopy(zzBuffer,zzStartRead,
                                      zzBuffer,0,
                                      zzEndRead-zzStartRead);

            /*translate stored positions */
             zzEndRead-=zzStartRead;
             zzCurrentPos-=zzStartRead;
             zzMarkedPos-=zzStartRead;
             zzStartRead = 0;
    }

        /*is the buffer big enough?*/
        if (zzCurrentPos >zzBuffer.length){
             /*if not:blow it up */
             char newBuffer[]=new char[zzCurrentPos*2];
             System.arraycopy(zzBuffer,0,newBuffer,0,zzBuffer.length);
             zzBuffer = newBuffer;
     }
        /*finally:fill the buffer with new input */
        int numRead zzReader.read (zzBuffer,zzEndRead,zzBuffer.length-zzEndRead);

        if (numRead > 0){
             zzEndRead+=numRead;
             return false;
     }
}

test code:

    public void test_parse 3_18()throws java.io.IOException,org.zkoss.json.parser.ParseException,NoSuchField

        java.io.Reader reader1 = null;
        org.zkoss.json.parser.JSONParser JSONParser0 = new org.zkoss.]son.parser.JSONParser();
        JSONParser0.parse(reader1);

Zkoss:how to get user status of login when session timeout.

when session time out,the user login,I hope user can jump to time out page, when the user do not login. I hope the page do not jump to any page.

when session time out,by user status of login, I hope user can jump different page.

Label/Listcell cannot be cast to org.zkoss.zul.Comboitem

When using combobox, I am sometimes getting
java.lang.ClassCastException: org.zkoss.zul.Listcell cannot be cast to org.zkoss.zul.Comboitem
and
java.lang.ClassCastException: org.zkoss.zul.Label cannot be cast to org.zkoss.zul.Comboitem
ZKerror

How am I able to reproduce it in ma application? By clicking on comobox several times, and clicking around (I know, rough description!)

It seems, that problem is in casting component to Comboitem without checking it's type.

   Comboitem prevSeld = (Comboitem) request.getDesktop()
         .getComponentByUuidIfAny((String) request.getData().get("prevSeld"));

and it seems I am not the only facing this issue and that

Filedownload.save does not work with piped streams

The Filedownload.save method does not work when supplying it with a PipedInputStream.

The following example (see also zkfidle) does not work. The download dialog will simply never appear. There is no error logged whatsoever:

<zk>
	<zscript><![CDATA[
	import org.zkoss.zul.Filedownload;
	import java.io.InputStream;
	import org.zkoss.lang.Strings;
	import java.io.PipedInputStream;
	import java.io.PipedOutputStream;	

	void download() throws Exception {

		final PipedOutputStream pipedOutputStream = new PipedOutputStream();
		final PipedInputStream pipedInputStream = new PipedInputStream(pipedOutputStream);
			
		Thread outputThread = new Thread(new Runnable() {
			public void run() {
				pipedOutputStream.write(new byte[] { 0x1, 0x2, 0x3, 0xf } );
   			}
				
		});
		outputThread.start();		
						
		Filedownload.save(pipedInputStream, "application/xml", "test.xml");
		
		outputThread.join();
	}
	]]></zscript>
	<button label="download" onClick="download()">
	</button>
</zk>

Since ZK 9.0.0 There are some rendering problems

Starting from version 9.0.0 we'd experienced problems with rendering issues because sometimes we get an "empty" page until the browser or de window is resized.

Also if you use flex or vflex it doesn't work properly, until one does a $(window).resize() within a zk aftermount in javascript.

This behaviour prevents some events to be attached to buttons or other "call to action" elements within the page.

What can be done in here?

zk timer edge

ZK 8.0.1
I use on my page:

If I use Chrome, I can see that data on my page is updated when my focus on another window.
But if use Microsoft Edge, updates on my page happen only if I have a focus on the Edge browser.

Why does it work in a different way on Microsoft Edge?

java.lang.ArrayIndexOutOfBoundsException:Index -808430919 out of bounds for length 4

The file path is org.zkoss.lang.JavaScriptEscapeUtil
java.lang.ArrayIndexOutOfBoundsException:Index -808430919 out of bounds for length 4
In our test case, pass int1,int2 and int3 into the function.
Inside this api, an array with a size greater than -808430919 will be created, and an array out-of-bounds exception will be generated at this time.
source code:

static int parseIntFromReference(final char[]text,final int start,final int end,final int radix){
      int result 0;
      for (int i=start;i<end;i++){
      final char c=text[i];int n =-1;
      for (int=0;<HEXA CHARS UPPER.length;++){
            if (C =HEXA CHARS UPPER[]C==HEXA CHARS LOWER[]){
                  n=j;
                  break;
            }
      }
}

test code:

public void test_parseIntFromReference_1_21()throws NoSuchFieldException,IllegalAccessException{
        int int2=847934538:
        char[]charArray0={'\'',\'','\'',\''};
        int int1=-808430919;
        int int3=-568520861;  
org.zkoss.lang.JavascriptEscapeutil.parseIntFromReference(charArray0,int1,int2,int3);
}

test results:

java.lang.ArrayIndexOutOfBoundsException:Index -808430919 out of bounds for length 4
at org.zkoss.lang.JavaScriptEscapeUtil.parselntFromReference(JavaScriptEscapeUtil.java:543)
at org.zkoss.lang.JavaScriptEscapeUtil_Test.test_parselntFromReference_1_21(JavaScriptEscapeUtil_Test.java:334)

Problem with CSS word-warp in IE

When we try to apply CSS's tag "word-wrap" to some text it doesn't work when the text inserted in html tag "span" . For fixing it need to change tag on "p" or "div"

java.lang.NullPointerException:Cannot invoke "java.lang.Class.getMethods()"because "intt"is null

The file path is java.lang.reflect.Proxy&ProxyBuilder
java.lang.NullPointerException:Cannot invoke "java.lang.Class.getMethods()"because "intt"is null
source code:

private static Set<class<?>>referencedTypes(ClassLoader loader,List<Class<?>>interfaces){
        var types new HashSet<class<?>>();
        for (var intf : interfaces){
                for (Method m intf.getMethods ()){
                        if (!Modifier.isStatic(m.getModifiers())){
                                addElementType(types,m.getReturnType());
                                addElementTypes(types,m.getsharedParameterTypes ());
                                addElementTypes(types,m.getSharedExceptionTypes ());
                        }
                }
        }
        return types;
}

test code:

public void test_newInstance_I_II()throws 
 NoSuchFleldExceptlon,ILlegalAccessExceptlon{

        bsh.BshClassManager bshclassManager3 new bsh.BshClassManager();
        bsh.classpath.DiscreteFilesclassLoader.ClassSourceMap classSourceMap4 = new bsh.classpath.DiscreteFilesC;
        java.lang.object object5 = new com.kawa.familytree.main.bs.PersonalBO();

        com.kawa.familytree.main.vo.Personalvo personalvo7 = new com.kawa.familytree.main.vo.Personalvo();
        java.lang.Object object6 = new com.kawa.familytree.main.ui.FamilyTreeModel(personalvo7);
        classSourceMap4.put (object5,object6);

        java.lang.Object object9 = new com.kawa.sys.pub.DataAccessobject ();
        java.lang.Object object8 = new com.kawa.familytree.main.ui.Tester();
        classSourceMap4.put (object8,object9);

        java.lang.ClassLoader classLoader2 = new bsh.classpath.DiscreteFilesclassLoader(bshclassManager3,classS);
        java.lang.Class class10 = null;
        java.lang.Class class11 = null;

        java.lang.Class[]classArray1 {class10,class11};

        java.lang.Object object0= new com.kawa.familytree.main.ui.CalenderRowRender();
org.zkoss.lang.reflect.FacadeInvoker.newInstance(object0,classArrayl,classLoader2);
}

test results:

java.lang.NullPointerException:Cannot invoke "java.lang.Class.getMethods()"because "intt"is null
at java.base/java.lang.reflect.Proxy$ProxyBuilder.referencedTypes(Proxy.java:744)
at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:645)
at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$1(Proxy.java:440)
at java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329)
at java.base/jdk.internal.loader.AbstractClassLoaderValue.computelfAbsent(AbstractClassLoaderValue.java:205)
at java.base/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:438)
at java.base/java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1037)
at org.zkoss.lang.reflect.Facadelnvoker.newlnstance(Facadelnvoker.java:61)
at org.zkoss.lang.reflect.Facadelnvoker_Test.test_newlnstance_1_11(Facadelnvoker_Test.java:202)

org.zkoss.zul.Textbox's getText() method throws java.lang.NullPointerException

I am not sure as to why the org.zkoss.zul.Button button's on-click handler throws a NullPointerException.

Development Environment

Java version: 11.0.7
zk-bin-9.0.0.1
Apache Tomcat 9.0.37

login.zul

<?page title="Login Test" contentType="text/html;charset=UTF-8"?>
<zk>
	<style>
		body{ background:url('images/login-pg-bg.png')no-repeat center
		center fixed; }
	</style>
	<window id="window" border="normal" width="320px"
		apply="foo.FooComposer" position="center"
		mode="overlapped" focus="true">
		<!-- Content Division element to display custom messages-->
		<div height="30px" align="center">
			<label
				style="color:#FF0000;font-weight:bold;font-family:Verdana;font-size: 14px;"
				id="msg">
			</label>
		</div>

		<!-- USERNAME -->
		<label value="User Name"
			style="color:#606060;font-weight:bold;font-family:Verdana; font-size: 14px;">
		</label>
		<textbox id="username" value="" constraint="no empty" />

		<!-- PASSWORD -->
		<label value="Password"
			style="color:#606060;font-weight:bold;font-family:Verdana; font-size: 14px;">
		</label>
		<textbox id="password" value="" type="password"
			constraint="no empty" />
		<separator bar="false" />
		<separator bar="false" />

		<!-- LOGIN BUTTON -->
		<box orient="horizontal">
			<button id="register" label="Register"
				style="color:#3333FF;font-weight:bold;font-family:Verdana; font-size: 14px;">
			</button>
			<button id="loginButton" label="Login"
				style="color:#3333FF;font-weight:bold;font-family:Verdana; font-size: 14px;">
			</button>
		</box>
		<separator bar="false" />
		<separator bar="true" />

		<!-- COPYRIGHT INFO -->
		<div align="center">
			<!-- 
				<label
				style="color:#3333FF;font-weight:bold;font-family:Verdana; font-size: 14px;"
				id="copyright" value="Copyright text" />
			-->
		</div>
	</window>
</zk>

FooComposer:

package foo;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Button;
import org.zkoss.zul.Label;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;

public class FooComposer extends GenericForwardComposer<Component> {

	private static final long serialVersionUID = 1218526917089196484L;

	private Window window;
	private static Button loginButton;
	public static Label msg;
	private static Textbox username;
	private static Textbox password;

	public void onCreate$window() {
		System.out.println("INSIDE FOOCOMPOSER'S ONCREATE..");
		window.doOverlapped();
		window.setPosition("center");
		window.setSizable(true);
	}

	public void onClick$loginButton() throws Exception {
		System.out.println("SIGN IN BUTTON CLICKED!");
		System.out.println("==>" + username.getText()); // throws Exception
	}
}

Help sincerely appreciated.

“NullPointerException”The number passed in the api is AImage is a null pointer.

The file path is org.zkoss.image.AImage.
In our test case, pass inputStream=null into the function whose api is AImage. In this api, a null pointer is introduced when the function init() is called for initialization, and a null pointer exception will be generated.
source code:

public AImage(String name,InputStream is)throws IOException{
    try{
          init (name,Files.readAll(is));
     }finally{
          is.close();
     }
}

test code:

java.lang.string string1 ="{\"key\":null}";
java.io.InputStream inputstream2 = null;
org.zkoss.image.AImage aImage0 = new org.zkoss.image.AImage(string1,inputstream2);
aImage0.isContentDisposition ();

test result

java.lang.NullPointerException:Cannot invoke "java.io.InputStream.close()"because "is"is nullat org.zkoss.image.Almage.<init>(Almage.java:86)
at org.zkoss.image.Almage_Test.test_isContentDisposition_4_64(Almage_Test.java:898)
at java.base/jdk.internal.reflect.NativeMethodAccessorlmpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorlmpl.invoke0(NativeMethodAccessorlmpl.java:77)
at java.base/jdk.internal.reflect.DeleqatingMethodAccessorlmplinvoke(DeleqatingMethodAccessorlmpl.java:43)

Paging does not seem to work in Listbox in ZK 8.0.1.1 CE.

Paging doesn't seem to work in the listbox component any more. I'm pretty sure this worked at one time in ZK 6.5.4 CE, but it is not working using ZK 8.0.1.1 CE.

If you click on any of the paging buttons, they flicker like they've been clicked, but nothing happens.

Has something changed, or am I implementing this wrong?


<listbox id="adminStaticPageListbox"
         model="${adminStaticPageWindow$composer.staticPageDataModel}"
         checkmark="false"
         mold="paging" pageSize="15"
         pagingPosition="both"
         width="600px" >
    <listhead>
        <listheader hflex="1"
                    label="PageID" align="left" />
        <listheader hflex="2"
                    label="Title" align="left" />
    </listhead>
    <template name="model">
        <listitem>
            <listcell
                label="${each.staticPageID}" style="text-align: left" />
            <listcell
                label="${each.staticPageTitle}" style="text-align: left" />
        </listitem>
    </template>
</listbox>


Missing break or "fall through" comment in PageImpl.getAttributes()

Why is PageImpl.getAttributes() returning the page's attributes when there is no desktop (line 446)?

public Map<String, Object> getAttributes(int scope) {
switch (scope) {
case DESKTOP_SCOPE:
if (_desktop != null)
return _desktop.getAttributes();
break;
case SESSION_SCOPE:
if (_desktop != null)
return _desktop.getSession().getAttributes();
break;
case APPLICATION_SCOPE:
if (_desktop != null)
return _desktop.getWebApp().getAttributes();
case PAGE_SCOPE:
return _attrs.getAttributes();
case REQUEST_SCOPE:
final Execution exec = getExecution();
if (exec != null)
return exec.getAttributes();
}
return Collections.emptyMap();
}

All other cases return an empty map.

Is that intentional? If so, I suggest to add a // fall through comment.

“ArrayIndexOutOfBoundsException”The input array size is larger than the array limit

The file path is org.zkoss.idom.Verifier.
In this test case we created, pass int0=-2147483648 into the function whose api is isXMLCharacter. In this api, an exception will generated when the array size is established as -2147483648.

test code:

        int int0 = -2147483648;
        org.zkoss.idom.Verifier.isXMLCharacter(int0);

test results:

        java.lang.ArrayIndexOutOfBoundsException: Index -2147483648 out of bounds for length 65536
	at org.zkoss.idom.Verifier.isXMLCharacter(Verifier.java:536)
	at org.zkoss.idom.Verifier_Test.test_isXMLCharacter_2_32(Verifier_Test.java:373)

Jakatra BOM

It looks like Jakatra version is not always present in maven repository. Lets take latest ZK BOM, 9.6.0.1-jakarta.

You can find a dependency org.zkoss.theme » breeze | 9.6.0.1-jakarta which seems to be missing in maven repository.
Is breeze released in 'Jakatra' version?

And it's not the only one not found

java.lang.ArithmeticException:by zero

The file path is org.zkoss.util.Dates
java.lang.ArithmeticException:by zero
source code:

public static final long round(long time,int precision){
        return time - (time precision);
}

test code:

public void test_now_3_33()throws NoSuchFieldException,IllegalAccessException{

        int int0 = 0;
        org.zkoss.util.Dates.now(int0);
}

test results:

java.lang.ArithmeticException:by zero
at org.zkoss.util.Dates.round(Dates.java:62)
at org.zkoss.util.Dates.now(Dates.java:85)
at org.zkoss.util.Dates_Test.test_now_3_33(Dates_Test.java:604)

java.lang.ArraylndexOutOfBoundsException:Index -409181510 out of bounds for length 1at org.zkoss.lang.Strings.join(Strings.java:744)

The file path is org.zkoss.lang.String
java.lang.ArraylndexOutOfBoundsException:Index -409181510 out of bounds for length 1at org.zkoss.lang.Strings.join(Strings.java:744)

source code:

public static final <T>String join(T[]array,char separator,int startIndex,int endIndex{
        if (array =null)
                return null;
        final int items endIndex startIndex;
        if (items <=0)
                return EMPTY;

        final StringBuilder buf new StringBuilder(items 16);
        for (int i startIndex;i<endIndex;i++){
        if (i>startIndex){
                buf.append (separator);
                }
        buf.append (array[i]);
        }
        return buf.tostring();
}

test code:

public void test_join_1_51()throws NoSuchFieldException,IllegalAccessException{

        char char1 ='\'';

        java.lang.Object object4 = new com.kawa.familytree.main.bs.PersonalDAO();
        java.lang.Object[]objectArray0 =  {object4};
        int int2=-409181510;
        int int3=781688062;
        org.zkoss.lang.Strings.join(objectArray0,charl,int2,int3);
}

test results:

java.lang.ArraylndexOutOfBoundsException:Index -409181510 out of bounds for length 1at org.zkoss.lang.Strings.join(Strings.java:744)
at org.zkoss.lang.Strings_Test.test_join_1_51(Strings_Test.java:650)

Chrome with stored login credentials (Manage Passwords ON)

When the following ZUL page is opened and there is a user/password pair for the current domain the menu popup automatically closes right after opening it.

<div hflex="1" vflex="1">

    <menubar>
        <menu label="X">
            <menupopup>
                <menuitem label="A"></menuitem>
                <menuitem label="B"></menuitem>
                <menuitem label="C"></menuitem>
            </menupopup>
        </menu>
    </menubar>

    <textbox id="user"></textbox>
    <textbox id="password" type="password"></textbox>

</div>

movie.zip

Configure repositories to use HTTPS

As you might know public repositories are trying to make dependency loading safer by restricting access only through HTTPS:
https://twitter.com/JLLeitschuh/status/1214938830983311361
https://central.sonatype.org/articles/2019/Apr/30/http-access-to-repo1mavenorg-and-repomavenapacheorg-is-being-deprecated/

It's great that your documentation suggest configuring repos through HTTPS (https://www.zkoss.org/wiki/ZK_Installation_Guide/Setting_up_IDE/Maven/Resolving_ZK_Framework_Artifacts_via_Maven), but scanning your public repo I can see almost all repository definitions keep using unsafe HTTP. Maybe you should consider updating them. I used this query to search all repository definitions:
https://github.com/search?l=Maven+POM&q=org%3Azkoss+repository&type=Code

I can provide some PR's if you want some help, but fixing it should be easy.

java.io.NotSerializableException: org.zkoss.zk.ui.http.SimpleSession

18-Jun-2017 20:21:49.717 ?? [shiro-active%0053ession%0043ache.data] net.sf.ehcache.store.disk.DiskStorageFactory$DiskWriteTask.call Disk Write of cd950837-0783-419c-8633-edfbba3810bf failed:
java.io.NotSerializableException: org.zkoss.zk.ui.http.SimpleSession

When combing shiro and ZK, I've encountered this error.

The web.xml configuration as below:


org.apache.shiro.web.env.EnvironmentLoaderListener


ShiroFilter
org.apache.shiro.web.servlet.ShiroFilter

ignore
^(.+[.])(jsp|png|gif|jpg|js|css|jspx|jpeg|html|mp3|mp4|ico|zul|zhtml)$



ShiroFilter
/*
REQUEST
FORWARD
INCLUDE
ERROR

“NullPointerException”The number passed in the api is formatStackTrace is a null pointer.

The file path is org.zkoss.lang.Exceptions
"java.lang.Throwable.printStackTrace(java.io.PrintWriter)"because "t"is null
source code:

public static final StringBuffer formatstackTrace(StringBuffer sb,Throwable t,String prefix,int maxcnt){
        final stringWriter sw new stringWriter();
        t.printstackTrace(new Printwriter(sw));
        final stringBuffer trace sw.getBuffer();
}

test code:

public void test_formatStackTrace_5_80()throws NoSuchFieldException,IllegalAccessException{
        java.lang.Throwable throwable0 null;
        java.lang.String string1 ="ftp://fhBD.wOJdSb.L.H63.4Hh.UxcBz.oGNV";
        org.zkoss.lang.Exceptions.formatstackTrace(throwable0,string1);
}

test result:

java.lang.NullPointerException:Cannot invoke "java.lang.Throwable.printStackTrace(java.io.PrintWriter)"because "t"is null
at org.zkoss.lang.Exceptions.formatStackTrace(Exceptions.java:418)
at org.zkoss.lang.Exceptions.formatStackTrace(Exceptions.java:400)
at org.zkoss.lang.Exceptions.formatStackTrace(Exceptions.java:390)

build by ant create a binary without folder css

I build zk by travis but output binary miss css folder
example:
on zul binary, normal have two folder /web/js/zul/mesh/less and /web/js/zul/mesh/css
but on my zul binary have only /web/js/zul/mesh/less

build log here

output here

what's step i miss?

Listbox#initRodSize generates too many NumberFormatExceptions

Our project heavily uses Listbox-es. While profiling application we noticed a lot of NumberFormatExceptions generated by zk. This lead us to Listbox#initRodSize and further to org.zkoss.zul.impl.Utils#getIntAttribute where both

Object val = comp.getAttribute(name, recurse);
and
val = Library.getProperty(name);

evaluates to null, allowing for further execution of Integer.parseInt on null value. Null-checking variable val after val = Library.getProperty(name); seems like a good solution

Clones of Radiogroup are rendered with same name as the source.

Description

After a radiogroup is cloned and rendered, the name of the two radiogroups are identical.

  • ZK version: 9.0.0.1
  • OS: Fedora Linux 32

Code sample to reproduce this issue

<zk>
<radiogroup id='rgLineType'>
	<radio label='application'/>
	<radio label='comment'/>
	<radio label='include'/>
	<radio label='#include'/>
</radiogroup>
<separator/>
<label id='info'/>
<separator/>
<button label='Clone radiogroup' onClick='CloneRadiogroup(event)'/>
<separator/>
<zscript>
void CloneRadiogroup (Event event)
{
	Radiogroup rgNew = rgLineType.clone ();
	rgNew.setId (null);
	info.setValue ("name of source radiogroup is [" + rgLineType.name + "], name of clone is [" + rgNew.name + "]. seems different, but it is rendered as same name as the source: Click radio in the one radiogroup will clear selection in another radiogroup");
	event.getTarget().getParent().appendChild (rgNew);
}
</zscript>
</zk>

Zul updating from 8.5.0 to 9.0.0 breaks

When I try to upgrade zul from 8.5.0 to version after 8.6.0.1. The following code breaks.

public class Testzul {
	
    @Test
    public void testRemoveAllChildren()
    {
        Listbox listbox = new Listbox();
        Assert.assertEquals(0, listbox.getChildren().size());

        Listitem listitem = new Listitem();
        listbox.appendChild(listitem);
        Assert.assertEquals(1, listbox.getChildren().size());

        ComponentHelper.removeAllChildren(listbox);
        Assert.assertEquals(0, listbox.getChildren().size());
    }

}
public class ComponentHelper
{
    public static void removeAllChildren(Component component)
    {
        List<Component> removableComponents = new ArrayList<Component>();

        for (Component children : component.getChildren())
        {
            removableComponents.add(children);
        }

        for (Component removableComponent : removableComponents)
        {
            component.removeChild(removableComponent);
        }
    }
}

The code should pass, but it throws an error:

java.lang.NullPointerException
	at org.zkoss.zk.ui.AbstractComponent.beforeParentChanged(AbstractComponent.java:1986)
	at org.zkoss.zul.Listitem.beforeParentChanged(Listitem.java:395)
	at org.zkoss.zk.ui.AbstractComponent.setParent(AbstractComponent.java:1211)
	at org.zkoss.zk.ui.AbstractComponent.removeChild(AbstractComponent.java:1562)
	at org.zkoss.zul.Listbox.removeChild(Listbox.java:1858)
	at ComponentHelper.removeAllChildren(ComponentHelper.java:21)
	at Testzul.testRemoveAllChildren(Testzul.java:21)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.