Mercurial > hg > openjdk > jdk6 > jaxws
changeset 23:541f26c646e7 jdk6-b12
6755917: Changes for openjdk6 build 12
Summary: Final b12 state (as defined by the source bundle)
Reviewed-by: darcy
author | ohair |
---|---|
date | Fri, 30 Jan 2009 17:10:45 -0800 |
parents | edda4e091e4e |
children | f035ef214ed4 |
files | test/Makefile test/TEST.ROOT test/com/sun/activation/registries/MailcapTokenizer/66990894/bug6699084.java test/javax/activation/6538484/bug6538484.java test/javax/activation/ActivationDataFlavor/6699090/bug6699090.java test/javax/activation/DataHandler/6456395/bug6456395.java test/jprt.config test/req.flg |
diffstat | 8 files changed, 0 insertions(+), 832 deletions(-) [+] |
line wrap: on
line diff
--- a/test/Makefile Fri Jan 30 17:10:34 2009 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -# -# Makefile to run jtreg -# - -# Get OS/ARCH specifics -OSNAME = $(shell uname -s) -ifeq ($(OSNAME), SunOS) - PLATFORM = solaris - JCT_PLATFORM = solaris - ARCH = $(shell uname -p) - ifeq ($(ARCH), i386) - ARCH=i586 - endif -endif -ifeq ($(OSNAME), Linux) - PLATFORM = linux - JCT_PLATFORM = linux - ARCH = $(shell uname -m) - ifeq ($(ARCH), i386) - ARCH=i586 - endif -endif -ifeq ($(OSNAME), Windows_NT) - PLATFORM = windows - JCT_PLATFORM = win32 - ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64) - ARCH=ia64 - else - ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64) - ARCH=x64 - else - ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T) - ARCH=x64 - else - ARCH=i586 - endif - endif - endif -endif - -# Root of this test area (important to use full paths in some places) -TEST_ROOT := $(shell pwd) - -# Default bundle of all test results (passed or not) -JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip - -# Default home for JTREG -ifeq ($(PLATFORM), windows) - JT_HOME = J:/svc/jct-tools3.2.2_02 - JTREG_KEY_OPTION=-k:!ignore -else - JT_HOME = /java/svc/jct-tools3.2.2_02 - JTREG_KEY_OPTION=-k:\!ignore -endif - -# Default JTREG to run -JTREG = $(JT_HOME)/$(JCT_PLATFORM)/bin/jtreg - -# Default JDK to test -JAVA_HOME = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH) - -# The test directories to run -DEFAULT_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof -TESTDIRS = $(DEFAULT_TESTDIRS) - -# Root of all test results -JTREG_OUTPUT_DIR = $(TEST_ROOT)/o_$(PLATFORM)-$(ARCH) - -# Export this setting and pass it in. -#JAVA_TOOL_OPTIONS = -Djava.awt.headless=true -#export JAVA_TOOL_OPTIONS - -# Default make rule -all: clean check tests $(JPRT_ARCHIVE_BUNDLE) - @echo "Testing completed successfully" - -# Chaeck to make sure these directories exist -check: $(JT_HOME) $(JAVA_HOME) $(JTREG) - -# Run the tests -tests: FRC - @echo "Using export JAVA_TOOL_OPTIONS=$(JAVA_TOOL_OPTIONS)" - @rm -f -r $(JTREG_OUTPUT_DIR) - @mkdir -p $(JTREG_OUTPUT_DIR) - $(JTREG) -a -v:fail,error \ - $(JTREG_KEY_OPTION) \ - -r:$(JTREG_OUTPUT_DIR)/JTreport \ - -w:$(JTREG_OUTPUT_DIR)/JTwork \ - -jdk:$(JAVA_HOME) \ - $(JAVA_TOOL_OPTIONS:%=-vmoption:%) \ - $(JAVA_ARGS:%=-vmoption:%) \ - $(TESTDIRS) - -# Bundle up the results -$(JPRT_ARCHIVE_BUNDLE): FRC - @rm -f $@ - @mkdir -p $(@D) - ( cd $(JTREG_OUTPUT_DIR) && zip -q -r $@ . ) - -# Cleanup -clean: - rm -f -r $(JTREG_OUTPUT_DIR) - rm -f $(JPRT_ARCHIVE_BUNDLE) - -# Used to force a target rules to run -FRC: - -# Phony targets (e.g. these are not filenames) -.PHONY: all tests clean check -
--- a/test/TEST.ROOT Fri Jan 30 17:10:34 2009 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -# This file identifies the root of the test-suite hierarchy. -# It also contains test-suite configuration information. -# DO NOT EDIT without first contacting jdk-regtest@sun.com. - -# The list of keywords supported in the entire test suite -keys=2d dnd i18n
--- a/test/com/sun/activation/registries/MailcapTokenizer/66990894/bug6699084.java Fri Jan 30 17:10:34 2009 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * @test - * @bug 6699084 - * @summary Ensure changes to nextToken() implementation are invariant. - * @author Peter Williams - * @compile -XDignore.symbol.file bug6699084.java - * @run main bug6699084 - */ - -import com.sun.activation.registries.MailcapTokenizer; - -public class bug6699084 { - - public static void main(String[] args) { - testMailcapTokenizerNextToken(); - System.out.println("Test completed."); - } - - private static void testMailcapTokenizerNextToken() { - String tokenString = " audio/mpeg; mpg321 -d esd %s >/dev/null 2>&1 </dev/null & ; description=\"MP3 Audio File\""; - int [] expectedTokens = { - MailcapTokenizer.STRING_TOKEN, - MailcapTokenizer.SLASH_TOKEN, - MailcapTokenizer.STRING_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, - MailcapTokenizer.STRING_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, - MailcapTokenizer.STRING_TOKEN, - MailcapTokenizer.EQUALS_TOKEN, - MailcapTokenizer.STRING_TOKEN, - MailcapTokenizer.EOI_TOKEN, - }; - - MailcapTokenizer tokenizer = new MailcapTokenizer(tokenString); - boolean autoquote = false; - - for(int i = 0; i < expectedTokens.length; i++) { - int token = tokenizer.nextToken(); - if(token != expectedTokens[i]) { - throw new RuntimeException("'" + tokenizer.getCurrentTokenValue() + "' parsed as token " + token + - " (" + MailcapTokenizer.nameForToken(token) + ")" + - ", expected " + expectedTokens[i] + - " (" + MailcapTokenizer.nameForToken(expectedTokens[i]) + ")" + - " at index " + i); - } - - if(token == MailcapTokenizer.SEMICOLON_TOKEN) { - if(autoquote) { - autoquote = false; - } else { - autoquote = true; - tokenizer.setIsAutoquoting(true); - } - } else if(token == MailcapTokenizer.EQUALS_TOKEN) { - autoquote = true; - tokenizer.setIsAutoquoting(true); - } else { - tokenizer.setIsAutoquoting(false); - } - } - } - -}
--- a/test/javax/activation/6538484/bug6538484.java Fri Jan 30 17:10:34 2009 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,331 +0,0 @@ -/* - * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * @test - * @bug 6538484 - * @summary Check for proper handling of String.toLowerCase in TURKISH locale - * @author Peter Williams - * @run main bug6538484 - */ - -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.io.IOException; -import java.io.OutputStream; -import java.io.StringBufferInputStream; -import java.util.Locale; -import javax.activation.CommandInfo; -import javax.activation.DataContentHandler; -import javax.activation.DataSource; -import javax.activation.MailcapCommandMap; -import javax.activation.MimeType; -import javax.activation.MimeTypeParameterList; -import javax.activation.MimeTypeParseException; - -import static java.util.Locale.ENGLISH; - -public class bug6538484 { - - private static final Locale TURKISH = new Locale("tr"); - - /** - * @param args the command line arguments - */ - public static void main(String[] args) throws MimeTypeParseException { - testMailcapCommandMap(ENGLISH); - testMailcapCommandMap(TURKISH); - testMimeType(ENGLISH); - testMimeType(TURKISH); - testMimeTypeParameterList(ENGLISH); - testMimeTypeParameterList(TURKISH); - System.out.println("Test completed."); - } - - private static void testMailcapCommandMap(Locale locale) { - String cmdMapString = "# Java Web Start\n" - + "application/x-java-jnlp-file; /jre/bin/javaws %s\n" - + "# Image command\n" - + "image/gif; /usr/sfw/bin/gimp %s;\\\n" - + " x-java-view=com.foo.FancyFooViewer;\\\n" - + " x-java-content-handler=" + - DummyContentHandler.class.getName() + "\n" - + "# Text command\n" - + "text/plain; /usr/bin/less %s;\\\n" - + " x-java-fallback-entry=true;\\\n" - + " x-java-view=com.sun.TextViewer\n" - ; - - String preferredMt1 = "image/gif"; - String preferredMt2 = "IMAGE/GIF"; - String fallbackMt1 = "text/plain"; - String fallbackMt2 = "TEXT/PLAIN"; - String nativeMt1 = "application/x-java-jnlp-file"; - String nativeMt2 = "APPLICATION/X-JAVA-JNLP-FILE"; - - MailcapCommandMap cmdMap = new MailcapCommandMap(new StringBufferInputStream(cmdMapString)); - - testMailcapCommandMapGetPreferredCommands(locale, cmdMap, preferredMt1, 2); - testMailcapCommandMapGetPreferredCommands(locale, cmdMap, preferredMt2, 2); - - testMailcapCommandMapGetAllCommands(locale, cmdMap, fallbackMt1, 3); - testMailcapCommandMapGetAllCommands(locale, cmdMap, fallbackMt2, 3); - - testMailcapCommandMapGetCommand(locale, cmdMap, preferredMt1, "view"); - testMailcapCommandMapGetCommand(locale, cmdMap, preferredMt2, "view"); - - testMailcapCommandMapCreateDataContentHandler(locale, cmdMap, preferredMt1); - testMailcapCommandMapCreateDataContentHandler(locale, cmdMap, preferredMt2); - - testMailcapCommandMapGetNativeCommands(locale, cmdMap, nativeMt1, 1); - testMailcapCommandMapGetNativeCommands(locale, cmdMap, nativeMt2, 1); - } - - private static void testMailcapCommandMapGetPreferredCommands(Locale locale, - MailcapCommandMap cmdMap, String mimetype, int expectedCount) { - Locale.setDefault(locale); - - CommandInfo [] result = cmdMap.getPreferredCommands(mimetype); - - if(result == null || result.length != expectedCount) { - throw new RuntimeException("MailcapCommandMap.getPreferredCommands() failed for " + mimetype); - } - } - - private static void testMailcapCommandMapGetAllCommands(Locale locale, - MailcapCommandMap cmdMap, String mimetype, int expectedCount) { - Locale.setDefault(locale); - - CommandInfo [] result = cmdMap.getAllCommands(mimetype); - - if(result == null || result.length != expectedCount) { - throw new RuntimeException("MailcapCommandMap.getAllCommands() failed for " + mimetype); - } - } - - private static void testMailcapCommandMapGetCommand(Locale locale, - MailcapCommandMap cmdMap, String mimetype, String command) { - Locale.setDefault(locale); - - CommandInfo result = cmdMap.getCommand(mimetype, command); - - if(result == null) { - throw new RuntimeException("MailcapCommandMap.getCommand() failed for " + mimetype); - } - } - - private static void testMailcapCommandMapCreateDataContentHandler(Locale locale, - MailcapCommandMap cmdMap, String mimetype) { - Locale.setDefault(locale); - - DataContentHandler handler = cmdMap.createDataContentHandler(mimetype); - - if(handler == null) { - throw new RuntimeException("MailcapCommandMap.createDataContentHandler() failed for " + mimetype); - } - } - - private static void testMailcapCommandMapGetNativeCommands(Locale locale, - MailcapCommandMap cmdMap, String mimetype, int expectedCount) { - Locale.setDefault(locale); - - String [] result = cmdMap.getNativeCommands(mimetype); - - if(result == null || result.length != expectedCount) { - throw new RuntimeException("MailcapCommandMap.getNativeCommands() failed for " + mimetype); - } - } - - public static class DummyContentHandler implements DataContentHandler { - - public DataFlavor[] getTransferDataFlavors() { - throw new UnsupportedOperationException("Not supported yet."); - } - - public Object getTransferData(DataFlavor arg0, DataSource arg1) throws UnsupportedFlavorException, IOException { - throw new UnsupportedOperationException("Not supported yet."); - } - - public Object getContent(DataSource arg0) throws IOException { - throw new UnsupportedOperationException("Not supported yet."); - } - - public void writeTo(Object arg0, String arg1, OutputStream arg2) throws IOException { - throw new UnsupportedOperationException("Not supported yet."); - } - - } - - private static void testMimeType(Locale locale) throws MimeTypeParseException { - String t1 = "image"; - String t2 = "IMAGE"; - String s1 = "plain"; - String s2 = "PLAIN"; - - String expectedPrimaryType = t1; - String expectedSubType = s1; - String expectedBaseType = expectedPrimaryType + "/" + expectedSubType; - - // MimeType(expr) - testMimeTypeCtor(locale, t1 + "/" + s1, expectedBaseType); - testMimeTypeCtor(locale, t1 + "/" + s2, expectedBaseType); - testMimeTypeCtor(locale, t2 + "/" + s1, expectedBaseType); - testMimeTypeCtor(locale, t2 + "/" + s2, expectedBaseType); - - // MimeType(type, subtype) - testMimeTypeCtor(locale, t1, s1, expectedBaseType); - testMimeTypeCtor(locale, t1, s2, expectedBaseType); - testMimeTypeCtor(locale, t2, s1, expectedBaseType); - testMimeTypeCtor(locale, t2, s2, expectedBaseType); - - // MimeType.setPrimaryType() - MimeType mt = new MimeType(expectedBaseType); - testMimeTypeSetPrimaryType(locale, mt, t1, expectedPrimaryType); - testMimeTypeSetPrimaryType(locale, mt, t2, expectedPrimaryType); - - // MimeType.setSubType() - mt = new MimeType(expectedBaseType); - testMimeTypeSetSubType(locale, mt, s1, expectedSubType); - testMimeTypeSetSubType(locale, mt, s2, expectedSubType); - } - - private static void testMimeTypeCtor(Locale locale, String parse, String expectedBaseType) throws MimeTypeParseException { - Locale.setDefault(locale); - MimeType mt = new MimeType(parse); - - if(!mt.getBaseType().equals(expectedBaseType)) { - throw new RuntimeException("Mimetype case conversion failed for " + mt.getBaseType()); - } - } - - private static void testMimeTypeCtor(Locale locale, String type, String subtype, String expectedBaseType) throws MimeTypeParseException { - Locale.setDefault(locale); - MimeType mt = new MimeType(type, subtype); - - if(!mt.getBaseType().equals(expectedBaseType)) { - throw new RuntimeException("Mimetype case conversion failed for " + mt.getBaseType()); - } - } - - private static void testMimeTypeSetPrimaryType(Locale locale, MimeType mt, String type, String expectedType) throws MimeTypeParseException { - Locale.setDefault(locale); - - mt.setPrimaryType(type); - - if(!mt.getPrimaryType().equals(expectedType)) { - throw new RuntimeException("MimeType.setPrimaryType() failed for " + mt.getPrimaryType()); - } - } - - private static void testMimeTypeSetSubType(Locale locale, MimeType mt, String subtype, String expectedSubType) throws MimeTypeParseException { - Locale.setDefault(locale); - - mt.setSubType(subtype); - - if(!mt.getSubType().equals(expectedSubType)) { - throw new RuntimeException("MimeType.getSubType() failed for " + mt.getSubType()); - } - } - - private static void testMimeTypeParameterList(Locale locale) throws MimeTypeParseException { - String expectedValue = "foo"; - String n1 = "field"; - String n2 = "FIELD"; - String p1 = ";" + n1 + "=" + expectedValue; - String p2 = ";" + n2 + "=" + expectedValue; - - String expectedName = n1; - String expectedParams = ";" + expectedName + "=" + expectedValue; - - // MimeTypeParameterList(expr); - testMimeTypeParameterListCtor(locale, p1, expectedName); - testMimeTypeParameterListCtor(locale, p2, expectedName); - - // MimeTypeParameterList.get(name) - testMimeTypeParameterListGet(locale, n1, expectedName, expectedParams); - testMimeTypeParameterListGet(locale, n2, expectedName, expectedParams); - - // MimeTypeParameterList.set(name) - testMimeTypeParameterListSet(locale, n1, expectedName, expectedParams); - testMimeTypeParameterListSet(locale, n2, expectedName, expectedParams); - - // MimeTypeParameterList.remove(name) - testMimeTypeParameterListRemove(locale, n1, expectedName, expectedParams); - testMimeTypeParameterListRemove(locale, n2, expectedName, expectedParams); - } - - private static void testMimeTypeParameterListCtor(Locale locale, String params, String expectedName) throws MimeTypeParseException { - Locale.setDefault(locale); - - MimeTypeParameterList mtpl = new MimeTypeParameterList(params); - - if(mtpl.get(expectedName) == null) { - throw new RuntimeException("MimeTypeParameterList case conversion failed for " + mtpl.toString()); - } - } - - private static void testMimeTypeParameterListGet(Locale locale, String name, String properName, String properParams) throws MimeTypeParseException { - Locale.setDefault(locale); - - MimeTypeParameterList mtpl = new MimeTypeParameterList(properParams); - String v1 = mtpl.get(name); - String v2 = mtpl.get(properName); - - if(v1 == null) { - if(v2 != null) { - throw new RuntimeException("MimeTypeParameterList.get() failed for " + name); - } - } else if(!v1.equals(v2)) { - throw new RuntimeException("MimeTypeParameterList.get() failed for " + mtpl.toString()); - } - } - - private static void testMimeTypeParameterListSet(Locale locale, String name, String properName, String properParams) throws MimeTypeParseException { - Locale.setDefault(locale); - - MimeTypeParameterList mtpl = new MimeTypeParameterList(properParams); - String expectedValue = "bar"; - mtpl.set(name, expectedValue); - String newValue = mtpl.get(properName); - - if(!expectedValue.equals(newValue)) { - throw new RuntimeException("MimeTypeParameterList.set() failed to change " + name + " in " + mtpl.toString()); - } - } - - private static void testMimeTypeParameterListRemove(Locale locale, String name, String properName, String properParams) throws MimeTypeParseException { - Locale.setDefault(locale); - - MimeTypeParameterList mtpl = new MimeTypeParameterList(properParams); - String oldvalue = mtpl.get(properName); - mtpl.remove(name); - String newvalue = mtpl.get(properName); - - if(oldvalue == null) { - throw new NullPointerException("Broken test for MimeTypeParameterList.remove()" + mtpl.toString()); - } else if(oldvalue.equals(newvalue)) { - throw new RuntimeException("MimeTypeParameterList.remove() failed for " + name + " in " + mtpl); - } - } - -}
--- a/test/javax/activation/ActivationDataFlavor/6699090/bug6699090.java Fri Jan 30 17:10:34 2009 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - - -/* - * @test - * @bug 6699090 - * @summary Fixed NPE in isMimeTypeEqual if parsing of mimetype failed. - * @author Peter Williams - * @run main bug6699090 - */ - -import javax.activation.ActivationDataFlavor; - -public class bug6699090 { - - /** - * @param args the command line arguments - */ - public static void main(String[] args) { - testIsMimeTypeEqual(); - System.out.println("Test completed."); - } - - private static void testIsMimeTypeEqual() { - // this one will parse - String goodMimeType = "text/plain"; - ActivationDataFlavor adf = new ActivationDataFlavor(goodMimeType, "Plain Text"); - adf.isMimeTypeEqual(goodMimeType); - - // this one will not - String badMimeType = "text"; - adf.isMimeTypeEqual(badMimeType); - } - -}
--- a/test/javax/activation/DataHandler/6456395/bug6456395.java Fri Jan 30 17:10:34 2009 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - */ - -/* - * @test - * @bug 6456395 - * @summary Special case byte[] and String in writeTo - * @author Peter Williams - * @run main bug6456395 - */ - -import java.awt.datatransfer.UnsupportedFlavorException; -import java.io.IOException; -import javax.activation.CommandInfo; -import javax.activation.CommandMap; -import javax.activation.DataContentHandler; -import javax.activation.DataHandler; - -public class bug6456395 { - - /** - * @param args the command line arguments - */ - public static void main(String[] args) throws ClassNotFoundException, UnsupportedFlavorException, IOException { - testDataHandlerWriteTo(); - System.out.println("Test completed."); - } - - private static void testDataHandlerWriteTo() throws ClassNotFoundException, UnsupportedFlavorException, IOException { - // test String data - String textMimeType = "text/plain"; - String stringData = "The quick brown fox jumped over the lazy dogs.\n"; - DataHandler dh = new DataHandler(stringData, textMimeType); - dh.setCommandMap(createDummyCommandMap()); - dh.writeTo(System.out); - - // test byte [] data - String byteMimeType = "text/ascii"; - byte [] byteData = stringData.getBytes(); - dh = new DataHandler(byteData, byteMimeType); - dh.setCommandMap(createDummyCommandMap()); - dh.writeTo(System.out); - } - - // Use empty command map to avoid reading .mailcap if it exists on test system. - private static CommandMap createDummyCommandMap() { - return new CommandMap() { - public CommandInfo[] getPreferredCommands(String mimeType) { - return new CommandInfo [0]; - } - public CommandInfo[] getAllCommands(String mimeType) { - return new CommandInfo [0]; - } - public CommandInfo getCommand(String mimeType, String cmdName) { - return null; - } - public DataContentHandler createDataContentHandler(String mimeType) { - return null; - } - }; - } - -}
--- a/test/jprt.config Fri Jan 30 17:10:34 2009 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -#!echo "This is not a shell script" -############################################################################# -# Copyright 2006-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, -# CA 95054 USA or visit www.sun.com if you need additional information or -# have any questions. -############################################################################# -# -# JPRT shell configuration for testing. -# -# Input environment variables: -# Windows Only: -# PATH -# ROOTDIR -# -# Output variable settings: -# make Full path to GNU make -# -# Output environment variables: -# PATH -# -############################################################################# - -############################################################################# -# Error -error() # message -{ - echo "ERROR: $1" - exit 6 -} -# Directory must exist -dirMustExist() # dir name -{ - if [ ! -d "$1" ] ; then - error "Directory for $2 does not exist: $1" - fi -} -# File must exist -fileMustExist() # dir name -{ - if [ ! -f "$1" ] ; then - error "File for $2 does not exist: $1" - fi -} -############################################################################# - -# Should be set by JPRT as the 3 basic inputs -slashjava="${ALT_SLASH_JAVA}" -if [ "${slashjava}" = "" ] ; then - slashjava=/java -fi - -# Check input -dirMustExist "${slashjava}" ALT_SLASH_JAVA - -# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise. -osname=`uname -s` -if [ "${osname}" = SunOS ] ; then - - # SOLARIS: Sparc or X86 - osarch=`uname -p` - if [ "${osarch}" = sparc ] ; then - solaris_arch=sparc - else - solaris_arch=i386 - fi - - # Add basic solaris system paths - path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin - - # Find GNU make - make=/usr/sfw/bin/gmake - if [ ! -f ${make} ] ; then - make=/opt/sfw/bin/gmake - if [ ! -f ${make} ] ; then - make=${slashjava}/devtools/${solaris_arch}/bin/gnumake - fi - fi - fileMustExist "${make}" make - - # File creation mask - umask 002 - -elif [ "${osname}" = Linux ] ; then - - # Add basic paths - path4sdk=/usr/bin:/bin:/usr/sbin:/sbin - - # Find GNU make - make=/usr/bin/make - fileMustExist "${make}" make - - umask 002 - -else - - # Windows: Differs on CYGWIN vs. MKS. - - # We need to determine if we are running a CYGWIN shell or an MKS shell - # (if uname isn't available, then it will be unix_toolset=unknown) - unix_toolset=unknown - if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then - # We kind of assume ROOTDIR is where MKS is and it's ok - unix_toolset=MKS - mkshome=`dosname -s "${ROOTDIR}"` - # Most unix utilities are in the mksnt directory of ROOTDIR - unixcommand_path="${mkshome}/mksnt" - path4sdk="${unixcommand_path}" - devtools_path="${slashjava}/devtools/win32/bin" - path4sdk="${devtools_path};${path4sdk}" - # Find GNU make - make="${devtools_path}/gnumake.exe" - fileMustExist "${make}" make - elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then - # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist - unix_toolset=CYGWIN - # Most unix utilities are in the /usr/bin - unixcommand_path="/usr/bin" - path4sdk="${unixcommand_path}" - # Find GNU make - make="${unixcommand_path}/make.exe" - fileMustExist "${make}" make - else - echo "WARNING: Cannot figure out if this is MKS or CYGWIN" - fi - - - # For windows, it's hard to know where the system is, so we just add this - # to PATH. - slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`" - path4sdk="${slash_path};${PATH}" - - # Convert path4sdk to cygwin style - if [ "${unix_toolset}" = CYGWIN ] ; then - path4sdk="`/usr/bin/cygpath -p ${path4sdk}`" - fi - -fi - -# Export PATH setting -PATH="${path4sdk}" -export PATH -