From 806bb96ce17cfb4ae0b1a66b31aa14bc93fe8e5b Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Fri, 2 Nov 2012 00:38:13 -0300 Subject: [PATCH] Fix error when the connections in the pool has been closed. --- .../exporter/FreemindExporter.java | 2 + .../wisemapping/rest/view/TransformView.java | 2 +- .../src/test/resources/data/wisemaps/enc.mmr | 270 ++++++++++++++++++ .../src/test/resources/data/wisemaps/enc.wxml | 188 ++++++++++++ 4 files changed, 461 insertions(+), 1 deletion(-) create mode 100644 wise-webapp/src/test/resources/data/wisemaps/enc.mmr create mode 100644 wise-webapp/src/test/resources/data/wisemaps/enc.wxml diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java index c9f4d5da..d21bb9ae 100755 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java @@ -28,6 +28,7 @@ import com.wisemapping.jaxb.freemind.*; import com.wisemapping.jaxb.wisemap.RelationshipType; import com.wisemapping.jaxb.wisemap.TopicType; import com.wisemapping.jaxb.wisemap.Icon; +import org.apache.commons.lang.StringEscapeUtils; import org.jetbrains.annotations.NotNull; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -202,6 +203,7 @@ public class FreemindExporter final StringBuilder htmlContent = new StringBuilder(""); for (String line : text.split("\n")) { + line = StringEscapeUtils.escapeXml(line); htmlContent.append("

").append(line).append("

"); } htmlContent.append(""); diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java b/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java index d921f565..27f759f3 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/view/TransformView.java @@ -84,7 +84,7 @@ public class TransformView extends AbstractView { // Write the conversion content ... final ServletOutputStream outputStream = response.getOutputStream(); if (exportFormat == ExportFormat.FREEMIND) { - response.setCharacterEncoding("iso-8859-1"); + response.setCharacterEncoding("ASCII"); factory.export(properties, content, outputStream, null); } else if (exportFormat == ExportFormat.WISEMAPPING) { response.setCharacterEncoding("UTF-8"); diff --git a/wise-webapp/src/test/resources/data/wisemaps/enc.mmr b/wise-webapp/src/test/resources/data/wisemaps/enc.mmr new file mode 100644 index 00000000..70ae1b94 --- /dev/null +++ b/wise-webapp/src/test/resources/data/wisemaps/enc.mmr @@ -0,0 +1,270 @@ + + + + + + + + + +

Therecent growth of large functional trait data

+

bases has been fuelled by standardized protocols forthe

+

measurement of individual functional traits and intensive

+

efforts to compile trait data(Cornelissen etal. 2003; Chave etal. 2009). Nonetheless, there remains no consensusfor

+

the most appropriate sampling design so that traits can be

+

scaled from the individuals on whom measurements are

+

made to the community or ecosystem levels at which infer-

+

ences are drawn (Swenson etal. 2006,2007,Reich,Wright

+

& Lusk 2007;Kraft,Valencia & Ackerly 2008).

+ + +
+
+ + + + + +

However, the fast pace of

+

development of plant trait meta-analyses also suggests that

+

trait acquisition in the field is a factor limiting the growth of

+

plant trait data bases.

+ + +
+
+ + + + + +

We measured

+

traits for every individual tree in nine 1-ha plots in tropical

+

lowland rainforest (N = 4709). Each plant was sampled for

+

10 functional traits related to wood and leaf morphology and

+

ecophysiology. Here, we contrast the trait means and variances

+

obtained with a full sampling strategy with those of

+

other sampling designs used in the recent literature, which we

+

obtain by simulation. We assess the differences in community-

+

level estimates of functional trait means and variances

+

among design types and sampling intensities. We then contrast

+

the relative costs of these designs and discuss the appropriateness

+

of different sampling designs and intensities for

+

different questions and systems.

+ + +
+
+ + + + + + + + +

With regard to estimating mean trait values, strategies

+

alternative to BRIDGE were consistently cost-effective. On

+

the other hand, strategies alternative to BRIDGE clearly

+

failed to accurately estimate the variance of trait values. This

+

indicates that in situations where accurate estimation of plotlevel

+

variance is desired, complete censuses are essential.

+ + +
+
+ + + + + +

We suggest that, in these studies,

+

the investment in complete sampling may be worthwhile

+

for at least some traits.

+ + +
+
+
+ + + + + + + +

Here, we develop a new approach that links functional attributes

+

of tree species with studies of forest recovery and regional

+

land-use transitions (Chazdon et al. 2007). Grouping species according

+

to their functional attributes or demographic rates provides

+

insight into both applied and theoretical questions, such as selecting

+

species for reforestation programs, assessing ecosystem services, and

+

understanding community assembly processes in tropical forests

+

(Diaz et al. 2007, Kraft et al. 2008).

+ + +
+
+ + + + + +

Since we have data on leaf

+

and wood functional traits for only a subset of the species in our

+

study sites, we based our functional type classification on information

+

for a large number of tree species obtained through vegetation

+

monitoring studies.

+ + +
+
+ + + + + + +

Our approach avoided preconceived notions of successional

+

behavior or shade tolerance of tree species by developing an objective

+

and independent classification of functional types based on vegetation

+

monitoring data from permanent sample plots in mature and

+

secondary forests of northeastern Costa Rica (Finegan et al. 1999,

+

Chazdon et al. 2007).We apply an independent, prior classification

+

of 293 tree species from our study region into five functional types, based on two species attributes: canopy strata and diameter growth

+

rates for individuals Z10 cm dbh (Finegan et al. 1999, Salgado-

+

Negret 2007).

+ + +
+
+ + + + + +

Our results demonstrate strong linkages between functional

+

types defined by adult height and growth rates of large trees and

+

colonization groups based on the timing of seedling, sapling, and

+

tree recruitment in secondary forests.

+ + +
+
+ + + + + +

These results allow us to move beyond earlier conceptual

+

frameworks of tropical forest secondary succession developed

+

by Finegan (1996) and Chazdon (2008) based on subjective groupings,

+

such as pioneers and shade-tolerant species (Swaine &

+

Whitmore 1988).

+ + +
+
+ + + + + +

Reproductive traits, such as dispersal mode, pollination mode,

+

and sexual system, were ultimately not useful in delimiting tree

+

functional types for the tree species examined here (Salgado-Negret

+

2007). Thus, although reproductive traits do vary quantitatively in

+

abundance between secondary and mature forests in our landscape

+

(Chazdon et al. 2003), they do not seem to be important drivers of

+

successional dynamics of trees Z10 cm dbh. For seedlings, however,

+

dispersal mode and seed size are likely to play an important

+

role in community dynamics during succession (Dalling&Hubbell

+

2002).

+ + +
+
+ + + + + +

Our classification of colonization groups defies the traditional

+

dichotomy between ‘late successional’ shade-tolerant and ‘early successional’

+

pioneer species. Many tree species, classified here as

+

regenerating pioneers on the basis of their population structure in

+

secondary forests, are common in both young secondary forest and

+

mature forests in this region (Guariguata et al. 1997), and many are

+

important timber species (Vilchez et al. 2008). These generalists are

+

by far the most abundant species of seedlings and saplings, conferring

+

a high degree of resilience in the wet tropical forests of NE

+

Costa Rica (Norden et al. 2009, Letcher & Chazdon 2009). The

+

high abundance of regenerating pioneers in seedling and sapling

+

size classes clearly shows that species with shade-tolerant seedlings

+

can also recruit as trees early in succession. For these species, early

+

tree colonization enhances seedling and sapling recruitment during

+

the first 20–30 yr of succession, due to local seed rain. Species

+

abundance and size distribution depend strongly on chance colonization

+

events early in succession (Chazdon 2008). Other studies

+

have shown that mature forest species are able to colonize early in

+

succession (Finegan 1996, van Breugel et al. 2007, Franklin & Rey

+

2007, Ochoa-Gaona et al. 2007), emphasizing the importance of

+

initial floristic composition in the determination of successional

+

pathways and rates of forest regrowth. On the other hand, significant

+

numbers of species in our sites (40% overall and the majority

+

of rare species) colonized only after canopy closure, and these species

+

may not occur as mature individuals until decades after agricultural

+

abandonment.

+ + +
+
+ + + + + +

Classifying functional types

+

based on functional traits with low plasticity, such as wood density

+

and seed size, could potentially serve as robust proxies for demographic

+

variables (Poorter et al. 2008, Zhang et al. 2008).

+ + +
+
+ + + + + +

CONDIT, R., S. P. HUBBELL, AND R. B. FOSTER. 1996. Assessing the response of

+

plant functional types in tropical forests to climatic change. J. Veg. Sci.

+

7: 405–416.

+

DALLING, J. S., AND S. P. HUBBELL. 2002. Seed size, growth rate and gap microsite

+

conditions as determinants of recruitment success for pioneer species.

+

J. Ecol. 90: 557–568.

+

FINEGAN, B. 1996. Pattern and process in neotropical secondary forests: The first

+

100 years of succession. Trends Ecol. Evol. 11: 119–124.

+

POORTER, L., S. J. WRIGHT, H. PAZ, D. D. ACKERLY, R. CONDIT, G.

+

IBARRA-MANRI´QUEZ, K. E. HARMS, J. C. LICONA, M.MARTI´NEZ-RAMOS,

+

S. J. MAZER, H. C. MULLER-LANDAU, M. PEN˜ A-CLAROS, C. O. WEBB,

+

AND I. J. WRIGHT. 2008. Are functional traits good predictors of demographic

+

rates? Evidence from five Neotropical forests. Ecology 89:

+

1908–1920.

+

ZHANG, Z. D., R. G. ZANG, AND Y. D. QI. 2008. Spatiotemporal patterns and

+

dynamics of species richness and abundance of woody plant functional

+

groups in a tropical forest landscape of Hainan Island, South China.

+

J. Integr. Plant Biol. 50: 547–558.

+ + +
+
+
+ + + + + + + +
\ No newline at end of file diff --git a/wise-webapp/src/test/resources/data/wisemaps/enc.wxml b/wise-webapp/src/test/resources/data/wisemaps/enc.wxml new file mode 100644 index 00000000..36358ae4 --- /dev/null +++ b/wise-webapp/src/test/resources/data/wisemaps/enc.wxml @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file