提交 22dcfe2e 编写于 作者: L lana

Merge

......@@ -456,7 +456,7 @@ endif
##################################################################################################
ifndef OPENJDK
DB_DEMO_ZIPFILE := $(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip)
DB_DEMO_ZIPFILE := $(wildcard $(JDK_TOPDIR)/src/closed/share/db/db-derby-*-bin.zip)
$(JDK_OUTPUTDIR)/demo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
$(MKDIR) -p $(@D)
......
......@@ -562,7 +562,7 @@ ifndef OPENJDK
$(CAT) $< | $(SED) "s/XXXX/$(shell cat $(JDK_TOPDIR)/src/closed/share/db/COPYRIGHTYEAR)/" > $@
JDK_DB_TARGETS := $(patsubst $(JDK_TOPDIR)/src/closed/share/db/%, $(IMAGES_OUTPUTDIR)/_unzip/%.unzipped, \
$(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip)) \
$(wildcard $(JDK_TOPDIR)/src/closed/share/db/db-derby-*-bin.zip)) \
$(JDK_IMAGE_DIR)/db/README-JDK.html $(JDK_IMAGE_DIR)/db/3RDPARTY
endif
......
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -1248,11 +1248,13 @@ NewPlatformString(JNIEnv *env, char *s)
(*env)->SetByteArrayRegion(env, ary, 0, len, (jbyte *)s);
if (!(*env)->ExceptionOccurred(env)) {
if (makePlatformStringMID == NULL) {
NULL_CHECK0(makePlatformStringMID = (*env)->GetStaticMethodID(env,
CHECK_JNI_RETURN_0(
makePlatformStringMID = (*env)->GetStaticMethodID(env,
cls, "makePlatformString", "(Z[B)Ljava/lang/String;"));
}
str = (*env)->CallStaticObjectMethod(env, cls,
makePlatformStringMID, USE_STDERR, ary);
CHECK_JNI_RETURN_0(
str = (*env)->CallStaticObjectMethod(env, cls,
makePlatformStringMID, USE_STDERR, ary));
(*env)->DeleteLocalRef(env, ary);
return str;
}
......@@ -1303,7 +1305,9 @@ LoadMainClass(JNIEnv *env, int mode, char *name)
"(ZILjava/lang/String;)Ljava/lang/Class;"));
str = NewPlatformString(env, name);
result = (*env)->CallStaticObjectMethod(env, cls, mid, USE_STDERR, mode, str);
CHECK_JNI_RETURN_0(
result = (*env)->CallStaticObjectMethod(
env, cls, mid, USE_STDERR, mode, str));
if (JLI_IsTraceLauncher()) {
end = CounterGet();
......
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -256,4 +256,47 @@ typedef struct {
#define NULL_CHECK(NC_check_pointer) \
NULL_CHECK_RETURN_VALUE(NC_check_pointer, )
/*
* For JNI calls :
* - check for thrown exceptions
* - check for null return
*
* JNI calls can return null and/or throw an exception. Check for these.
*
* : CHECK_JNI_RETURN_EXCEPTION()
* return the specified RETURNVALUE if exception was generated
* : CHECK_JNI_RETURN_0(JNISTATEMENT) : check if JNISTATEMENT was successful, return 0 if not
* : CHECK_JNI_RETURN_VOID(JNISTATEMENT) : check if JNISTATEMENT was successful, return void if not
* : CHECK_JNI_RETURN_VALUE(JNISTATEMENT,n) : check if JNISTATEMENT was successful, return n if not
*
* These macros need at least one parameter, the JNI statement [ JNISTATEMENT ].
*
* E.G.: check the JNI statement, and specify a value to return if a failure was detected.
*
* CHECK_JNI_RETURN_VALUE(str = (*env)->CallStaticObjectMethod(env, cls,
* makePlatformStringMID, USE_STDERR, ary), -1);
*/
#define RETURNVOID return
#define RETURN0 return 0
#define RETURN(N) return (N)
#define CHECK_JNI_RETURN_EXCEPTION(RETURNVALUE) \
if ((((*env)->ExceptionOccurred(env))!=NULL)) { \
RETURNVALUE; \
}
#define CHECK_JNI_RETURN_0(JNISTATEMENT) \
CHECK_JNI_RETURN_EXCEPTION(RETURN0); \
NULL_CHECK0(JNISTATEMENT);
#define CHECK_JNI_RETURN_VOID(JNISTATEMENT) \
CHECK_JNI_RETURN_EXCEPTION(RETURNVOID); \
NULL_CHECK(JNISTATEMENT);
#define CHECK_JNI_RETURN_VALUE(JNISTATEMENT, NCRV_return_value) \
CHECK_JNI_RETURN_EXCEPTION(RETURN(NCRV_return_value)); \
NULL_CHECK_RETURN_VALUE(JNISTATEMENT, NCRV_return_value);
#endif /* _JAVA_H_ */
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package testjaxbcontext;
import org.w3c.dom.Element;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* Java class for Good complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* &lt;complexType name="Good">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;any processContents='skip' maxOccurs="70"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Good", propOrder = {
"any"
})
public class Good {
@XmlAnyElement
protected List<Element> any;
/**
* Gets the value of the any property.
*
* <p>
* This accessor method returns a reference to the live list, not a
* snapshot. Therefore any modification you make to the returned list will
* be present inside the JAXB object. This is why there is not a
* <CODE>set</CODE> method for the any property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link org.w3c.dom.Element }
*
*
*/
public List<Element> getAny() {
if (any == null) {
any = new ArrayList<Element>();
}
return this.any;
}
}
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package testjaxbcontext;
import javax.xml.bind.annotation.*;
/**
* <p>
* Java class for main complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* &lt;complexType name="main">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="Root" type="{}Root"/>
* &lt;element name="Good" type="{}Good"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "main", propOrder = {
"root",
"good"
})
@XmlRootElement
public class Main {
@XmlElement(name = "Root", required = true)
protected Root root;
@XmlElement(name = "Good", required = true)
protected Good good;
/**
* Gets the value of the root property.
*
* @return possible object is {@link Root }
*
*/
public Root getRoot() {
return root;
}
/**
* Sets the value of the root property.
*
* @param value allowed object is {@link Root }
*
*/
public void setRoot(Root value) {
this.root = value;
}
/**
* Gets the value of the good property.
*
* @return possible object is {@link Good }
*
*/
public Good getGood() {
return good;
}
/**
* Sets the value of the good property.
*
* @param value allowed object is {@link Good }
*
*/
public void setGood(Good value) {
this.good = value;
}
}
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package testjaxbcontext;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each Java content interface and Java
* element interface generated in the generated package.
* <p>
* An ObjectFactory allows you to programatically construct new instances of the
* Java representation for XML content. The Java representation of XML content
* can consist of schema derived interfaces and classes representing the binding
* of schema type definitions, element declarations and model groups. Factory
* methods for each of these are provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of
* schema derived classes for package: generated
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link Root }
*
*/
public Root createRoot() {
return new Root();
}
/**
* Create an instance of {@link Good }
*
*/
public Good createGood() {
return new Good();
}
/**
* Create an instance of {@link Main }
*
*/
public Main createMain() {
return new Main();
}
}
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package testjaxbcontext;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* Java class for Root complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* &lt;complexType name="Root">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;any processContents='skip' maxOccurs="70"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Root", propOrder = {
"content"
})
public class Root {
@XmlMixed
@XmlAnyElement
protected List<Object> content;
/**
* Gets the value of the content property.
*
* <p>
* This accessor method returns a reference to the live list, not a
* snapshot. Therefore any modification you make to the returned list will
* be present inside the JAXB object. This is why there is not a
* <CODE>set</CODE> method for the content property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getContent().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list {@link org.w3c.dom.Element }
* {@link String }
*
*
*/
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
}
return this.content;
}
}
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test Test.java
* @bug 8036981
* @summary JAXB not preserving formatting during unmarshalling/marshalling
* @compile Good.java Main.java ObjectFactory.java Root.java
* @run main/othervm Test
*/
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import java.io.File;
import java.io.StringWriter;
/**
* Test for marshalling and unmarshalling mixed and unmixed content
*/
public class Test {
private static final String EXPECTED = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><main><Root>\n" +
" <SomeTag>\n" +
" <AChildTag>\n" +
" <AnotherChildTag/>\n" +
" <AnotherChildTag/>\n" +
" </AChildTag>\n" +
" </SomeTag>\n" +
" </Root><Good><VeryGood><TheBest><MegaSuper/><MegaSuper/>\n" +
" </TheBest>\n" +
" </VeryGood></Good></main>";
public static void main(String[] args) throws Exception {
JAXBContext jc = JAXBContext.newInstance("testjaxbcontext");
Unmarshaller u = jc.createUnmarshaller();
Object result = u.unmarshal(new File(System.getProperty("test.src", ".") + "/test.xml"));
StringWriter sw = new StringWriter();
Marshaller m = jc.createMarshaller();
m.marshal(result, sw);
System.out.println("Expected:" + EXPECTED);
System.out.println("Observed:" + sw.toString());
if (!EXPECTED.equals(sw.toString())) {
throw new Exception("Unmarshal/Marshal generates different content");
}
}
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<main>
<Root>
<SomeTag>
<AChildTag>
<AnotherChildTag/>
<AnotherChildTag/>
</AChildTag>
</SomeTag>
</Root>
<Good>
<VeryGood>
<TheBest>
<MegaSuper/>
<MegaSuper/>
</TheBest>
</VeryGood>
</Good>
</main>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册