View | Details | Raw Unified | Return to bug 48616
Collapse All | Expand All

(-)java/org/apache/jasper/compiler/Generator.java (+33 lines)
Lines 333-338 Link Here
333
            }
333
            }
334
334
335
            public void visit(Node.CustomTag n) throws JasperException {
335
            public void visit(Node.CustomTag n) throws JasperException {
336
                // XXX - Actually there is no need to declare those
337
                // "_jspx_" + varName + "_" + nestingLevel variables when we are
338
                // inside a JspFragment.
336
339
337
                if (n.getCustomNestingLevel() > 0) {
340
                if (n.getCustomNestingLevel() > 0) {
338
                    TagVariableInfo[] tagVarInfos = n.getTagVariableInfos();
341
                    TagVariableInfo[] tagVarInfos = n.getTagVariableInfos();
Lines 2484-2489 Link Here
2484
        }
2487
        }
2485
2488
2486
        private void declareScriptingVars(Node.CustomTag n, int scope) {
2489
        private void declareScriptingVars(Node.CustomTag n, int scope) {
2490
            if (isFragment) {
2491
                // No need to declare Java variables, if we inside a
2492
                // JspFragment, because a fragment is always scriptless.
2493
                return;
2494
            }
2487
2495
2488
            Vector vec = n.getScriptingVars(scope);
2496
            Vector vec = n.getScriptingVars(scope);
2489
            if (vec != null) {
2497
            if (vec != null) {
Lines 2531-2536 Link Here
2531
            if (n.getCustomNestingLevel() == 0) {
2539
            if (n.getCustomNestingLevel() == 0) {
2532
                return;
2540
                return;
2533
            }
2541
            }
2542
            if (isFragment) {
2543
                // No need to declare Java variables, if we inside a
2544
                // JspFragment, because a fragment is always scriptless.
2545
                // Thus, there is no need to save/ restore/ sync them.
2546
                // Note, that JspContextWrapper.syncFoo() methods will take
2547
                // care of saving/ restoring/ sync'ing of JspContext attributes.
2548
                return;
2549
            }
2534
2550
2535
            TagVariableInfo[] tagVarInfos = n.getTagVariableInfos();
2551
            TagVariableInfo[] tagVarInfos = n.getTagVariableInfos();
2536
            VariableInfo[] varInfos = n.getVariableInfos();
2552
            VariableInfo[] varInfos = n.getVariableInfos();
Lines 2591-2596 Link Here
2591
            if (n.getCustomNestingLevel() == 0) {
2607
            if (n.getCustomNestingLevel() == 0) {
2592
                return;
2608
                return;
2593
            }
2609
            }
2610
            if (isFragment) {
2611
                // No need to declare Java variables, if we inside a
2612
                // JspFragment, because a fragment is always scriptless.
2613
                // Thus, there is no need to save/ restore/ sync them.
2614
                // Note, that JspContextWrapper.syncFoo() methods will take
2615
                // care of saving/ restoring/ sync'ing of JspContext attributes.
2616
                return;
2617
            }
2594
2618
2595
            TagVariableInfo[] tagVarInfos = n.getTagVariableInfos();
2619
            TagVariableInfo[] tagVarInfos = n.getTagVariableInfos();
2596
            VariableInfo[] varInfos = n.getVariableInfos();
2620
            VariableInfo[] varInfos = n.getVariableInfos();
Lines 2645-2650 Link Here
2645
         * given scope.
2669
         * given scope.
2646
         */
2670
         */
2647
        private void syncScriptingVars(Node.CustomTag n, int scope) {
2671
        private void syncScriptingVars(Node.CustomTag n, int scope) {
2672
            if (isFragment) {
2673
                // No need to declare Java variables, if we inside a
2674
                // JspFragment, because a fragment is always scriptless.
2675
                // Thus, there is no need to save/ restore/ sync them.
2676
                // Note, that JspContextWrapper.syncFoo() methods will take
2677
                // care of saving/ restoring/ sync'ing of JspContext attributes.
2678
                return;
2679
            }
2680
2648
            TagVariableInfo[] tagVarInfos = n.getTagVariableInfos();
2681
            TagVariableInfo[] tagVarInfos = n.getTagVariableInfos();
2649
            VariableInfo[] varInfos = n.getVariableInfos();
2682
            VariableInfo[] varInfos = n.getVariableInfos();
2650
2683
(-)java/org/apache/jasper/compiler/ScriptingVariabler.java (-5 / +5 lines)
Lines 58-74 Link Here
58
    static class ScriptingVariableVisitor extends Node.Visitor {
58
    static class ScriptingVariableVisitor extends Node.Visitor {
59
59
60
	private ErrorDispatcher err;
60
	private ErrorDispatcher err;
61
	private Hashtable scriptVars;
61
	private Map<String, Integer> scriptVars;
62
	
62
	
63
	public ScriptingVariableVisitor(ErrorDispatcher err) {
63
	public ScriptingVariableVisitor(ErrorDispatcher err) {
64
	    this.err = err;
64
	    this.err = err;
65
	    scriptVars = new Hashtable();
65
	    scriptVars = new HashMap<String, Integer>();
66
	}
66
	}
67
67
68
	public void visit(Node.CustomTag n) throws JasperException {
68
	public void visit(Node.CustomTag n) throws JasperException {
69
	    setScriptingVars(n, VariableInfo.AT_BEGIN);
69
	    setScriptingVars(n, VariableInfo.AT_BEGIN);
70
	    setScriptingVars(n, VariableInfo.NESTED);
70
	    setScriptingVars(n, VariableInfo.NESTED);
71
	    new ScriptingVariableVisitor(err).visitBody(n);
71
	    visitBody(n);
72
	    setScriptingVars(n, VariableInfo.AT_END);
72
	    setScriptingVars(n, VariableInfo.AT_END);
73
	}
73
	}
74
74
Lines 104-110 Link Here
104
		    }
104
		    }
105
		    String varName = varInfos[i].getVarName();
105
		    String varName = varInfos[i].getVarName();
106
		    
106
		    
107
		    Integer currentRange = (Integer) scriptVars.get(varName);
107
		    Integer currentRange = scriptVars.get(varName);
108
		    if (currentRange == null
108
		    if (currentRange == null
109
			    || ownRange.compareTo(currentRange) > 0) {
109
			    || ownRange.compareTo(currentRange) > 0) {
110
			scriptVars.put(varName, ownRange);
110
			scriptVars.put(varName, ownRange);
Lines 127-133 Link Here
127
			}
127
			}
128
		    }
128
		    }
129
129
130
		    Integer currentRange = (Integer) scriptVars.get(varName);
130
		    Integer currentRange = scriptVars.get(varName);
131
		    if (currentRange == null
131
		    if (currentRange == null
132
			    || ownRange.compareTo(currentRange) > 0) {
132
			    || ownRange.compareTo(currentRange) > 0) {
133
			scriptVars.put(varName, ownRange);
133
			scriptVars.put(varName, ownRange);

Return to bug 48616