You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(97) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(127) |
Feb
(34) |
Mar
(16) |
Apr
(26) |
May
(55) |
Jun
(107) |
Jul
(36) |
Aug
(72) |
Sep
(90) |
Oct
(41) |
Nov
(27) |
Dec
(13) |
2008 |
Jan
(37) |
Feb
(39) |
Mar
(98) |
Apr
(115) |
May
(134) |
Jun
(120) |
Jul
(86) |
Aug
(149) |
Sep
(68) |
Oct
(66) |
Nov
(104) |
Dec
(49) |
2009 |
Jan
(131) |
Feb
(132) |
Mar
(125) |
Apr
(172) |
May
(161) |
Jun
(43) |
Jul
(47) |
Aug
(38) |
Sep
(18) |
Oct
(6) |
Nov
(1) |
Dec
(15) |
2010 |
Jan
(21) |
Feb
(8) |
Mar
(10) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(4) |
2011 |
Jan
(23) |
Feb
(10) |
Mar
(13) |
Apr
(3) |
May
|
Jun
(19) |
Jul
(11) |
Aug
(22) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(12) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(30) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
2013 |
Jan
(3) |
Feb
(40) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: <ls...@us...> - 2013-02-17 15:16:57
|
Revision: 5951 http://jnode.svn.sourceforge.net/jnode/?rev=5951&view=rev Author: lsantha Date: 2013-02-17 15:16:51 +0000 (Sun, 17 Feb 2013) Log Message: ----------- OpenJDK integration. Modified Paths: -------------- trunk/core/src/core/org/jnode/vm/classmgr/VmField.java trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmField.java =================================================================== --- trunk/core/src/core/org/jnode/vm/classmgr/VmField.java 2013-02-17 15:16:02 UTC (rev 5950) +++ trunk/core/src/core/org/jnode/vm/classmgr/VmField.java 2013-02-17 15:16:51 UTC (rev 5951) @@ -22,6 +22,7 @@ import java.lang.reflect.Field; import org.jnode.vm.isolate.VmIsolateLocal; +import sun.reflect.ReflectionFactory; public abstract class VmField extends VmMember { @@ -132,8 +133,8 @@ if (slot == -1) { throw new ClassFormatError("Invalid field: " + this.getName()); } - javaField = new Field(d_class.asClass(), getName(), getType().asClass(), getModifiers(), slot, - getSignature(), getRawAnnotations()); + javaField = ReflectionFactory.getReflectionFactory().newField(d_class.asClass(), getName(), + getType().asClass(), getModifiers(), slot,getSignature(), getRawAnnotations()); javaFieldHolder.set(javaField); } return javaField; Modified: trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java =================================================================== --- trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java 2013-02-17 15:16:02 UTC (rev 5950) +++ trunk/core/src/core/org/jnode/vm/classmgr/VmMethod.java 2013-02-17 15:16:51 UTC (rev 5951) @@ -20,9 +20,7 @@ package org.jnode.vm.classmgr; -import java.lang.reflect.Constructor; import java.lang.reflect.Member; -import java.lang.reflect.Method; import org.jnode.annotation.MagicPermission; import org.jnode.vm.InternString; import org.jnode.vm.LoadCompileService; @@ -30,6 +28,7 @@ import org.jnode.vm.facade.VmUtils; import org.jnode.vm.isolate.VmIsolateLocal; import org.vmmagic.unboxed.Address; +import sun.reflect.ReflectionFactory; @MagicPermission public abstract class VmMethod extends VmMember implements VmSharedStaticsEntry { @@ -222,15 +221,15 @@ if (slot == -1) { throw new ClassFormatError("Invalid constructor"); } - javaMember = new Constructor(getDeclaringClass().asClass(), args, ces, getModifiers(), slot, - getSignature(), getRawAnnotations(), getRawParameterAnnotations()); + javaMember = ReflectionFactory.getReflectionFactory().newConstructor(getDeclaringClass().asClass(), + args, ces, getModifiers(), slot, getSignature(), getRawAnnotations(), getRawParameterAnnotations()); } else { if (slot == -1) { throw new ClassFormatError("Invalid method"); } - javaMember = new Method(getDeclaringClass().asClass(), getName(), args, getReturnType().asClass(), ces, - getModifiers(), slot, getSignature(), getRawAnnotations(), getRawParameterAnnotations(), - getRawAnnotationDefault()); + javaMember = ReflectionFactory.getReflectionFactory().newMethod(getDeclaringClass().asClass(), + getName(), args, getReturnType().asClass(), ces, getModifiers(), slot, getSignature(), + getRawAnnotations(), getRawParameterAnnotations(), getRawAnnotationDefault()); } javaMemberHolder.set(javaMember); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2013-02-17 15:16:09
|
Revision: 5950 http://jnode.svn.sourceforge.net/jnode/?rev=5950&view=rev Author: lsantha Date: 2013-02-17 15:16:02 +0000 (Sun, 17 Feb 2013) Log Message: ----------- OpenJDK integration. Modified Paths: -------------- classlib6/core/src/openjdk/java/java/lang/reflect/Constructor.java classlib6/core/src/openjdk/java/java/lang/reflect/Field.java classlib6/core/src/openjdk/java/java/lang/reflect/Method.java Modified: classlib6/core/src/openjdk/java/java/lang/reflect/Constructor.java =================================================================== --- classlib6/core/src/openjdk/java/java/lang/reflect/Constructor.java 2013-02-16 21:24:21 UTC (rev 5949) +++ classlib6/core/src/openjdk/java/java/lang/reflect/Constructor.java 2013-02-17 15:16:02 UTC (rev 5950) @@ -111,13 +111,12 @@ // and potentially many Constructor objects pointing to it.) private Constructor<T> root; - //jnode /** * Package-private constructor used by ReflectAccess to enable * instantiation of these objects in Java code from the java.lang * package via sun.reflect.LangReflectAccess. */ - public Constructor(Class<T> declaringClass, + Constructor(Class<T> declaringClass, Class[] parameterTypes, Class[] checkedExceptions, int modifiers, Modified: classlib6/core/src/openjdk/java/java/lang/reflect/Field.java =================================================================== --- classlib6/core/src/openjdk/java/java/lang/reflect/Field.java 2013-02-16 21:24:21 UTC (rev 5949) +++ classlib6/core/src/openjdk/java/java/lang/reflect/Field.java 2013-02-17 15:16:02 UTC (rev 5950) @@ -106,13 +106,13 @@ return genericInfo; //return cached repository } - //jnode + /** * Package-private constructor used by ReflectAccess to enable * instantiation of these objects in Java code from the java.lang * package via sun.reflect.LangReflectAccess. */ - public Field(Class declaringClass, + Field(Class declaringClass, String name, Class type, int modifiers, Modified: classlib6/core/src/openjdk/java/java/lang/reflect/Method.java =================================================================== --- classlib6/core/src/openjdk/java/java/lang/reflect/Method.java 2013-02-16 21:24:21 UTC (rev 5949) +++ classlib6/core/src/openjdk/java/java/lang/reflect/Method.java 2013-02-17 15:16:02 UTC (rev 5950) @@ -115,13 +115,12 @@ return genericInfo; //return cached repository } - //jnode /** * Package-private constructor used by ReflectAccess to enable * instantiation of these objects in Java code from the java.lang * package via sun.reflect.LangReflectAccess. */ - public Method(Class declaringClass, + Method(Class declaringClass, String name, Class[] parameterTypes, Class returnType, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2013-02-16 21:24:33
|
Revision: 5949 http://jnode.svn.sourceforge.net/jnode/?rev=5949&view=rev Author: lsantha Date: 2013-02-16 21:24:21 +0000 (Sat, 16 Feb 2013) Log Message: ----------- Idea 12 project files. Modified Paths: -------------- classlib6/Classlib6.ipr classlib6/all/all.iml classlib6/builder/builder.iml classlib6/classlib6.iml classlib6/core/core.iml Modified: classlib6/Classlib6.ipr =================================================================== --- classlib6/Classlib6.ipr 2013-02-16 19:08:48 UTC (rev 5948) +++ classlib6/Classlib6.ipr 2013-02-16 21:24:21 UTC (rev 5949) @@ -207,7 +207,11 @@ <entry name="?*.jpeg" /> <entry name="?*.jpg" /> </wildcardResourcePatterns> - <annotationProcessing enabled="false" useClasspath="true" /> + <annotationProcessing> + <profile default="true" name="Default" enabled="false"> + <processorPath useClasspath="true" /> + </profile> + </annotationProcessing> </component> <component name="CopyrightManager" default=""> <module2copyright /> @@ -423,15 +427,29 @@ <XML> <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" /> </XML> - <ADDITIONAL_INDENT_OPTIONS fileType="gsp"> - <option name="INDENT_SIZE" value="2" /> - </ADDITIONAL_INDENT_OPTIONS> - <ADDITIONAL_INDENT_OPTIONS fileType="haml"> - <option name="INDENT_SIZE" value="2" /> - </ADDITIONAL_INDENT_OPTIONS> - <ADDITIONAL_INDENT_OPTIONS fileType="yml"> - <option name="INDENT_SIZE" value="2" /> - </ADDITIONAL_INDENT_OPTIONS> + <codeStyleSettings language="CFML"> + <option name="CALL_PARAMETERS_WRAP" value="1" /> + <option name="METHOD_PARAMETERS_WRAP" value="1" /> + <option name="BINARY_OPERATION_WRAP" value="1" /> + <option name="TERNARY_OPERATION_WRAP" value="1" /> + <option name="ASSIGNMENT_WRAP" value="1" /> + <option name="PARENT_SETTINGS_INSTALLED" value="true" /> + </codeStyleSettings> + <codeStyleSettings language="ECMA Script Level 4"> + <option name="CALL_PARAMETERS_WRAP" value="1" /> + <option name="METHOD_PARAMETERS_WRAP" value="1" /> + <option name="EXTENDS_KEYWORD_WRAP" value="1" /> + <option name="BINARY_OPERATION_WRAP" value="1" /> + <option name="TERNARY_OPERATION_WRAP" value="1" /> + <option name="ARRAY_INITIALIZER_WRAP" value="1" /> + <option name="ASSIGNMENT_WRAP" value="1" /> + <option name="PARENT_SETTINGS_INSTALLED" value="true" /> + </codeStyleSettings> + <codeStyleSettings language="GSP"> + <indentOptions> + <option name="INDENT_SIZE" value="2" /> + </indentOptions> + </codeStyleSettings> <codeStyleSettings language="Groovy"> <option name="CALL_PARAMETERS_WRAP" value="1" /> <option name="METHOD_PARAMETERS_WRAP" value="1" /> Modified: classlib6/all/all.iml =================================================================== --- classlib6/all/all.iml 2013-02-16 19:08:48 UTC (rev 5948) +++ classlib6/all/all.iml 2013-02-16 21:24:21 UTC (rev 5949) @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> <component name="NewModuleRootManager" inherit-compiler-output="false"> + <exclude-exploded /> <output url="file://$MODULE_DIR$/build/classes" /> <exclude-output /> - <exclude-exploded /> <content url="file://$MODULE_DIR$" /> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> Modified: classlib6/builder/builder.iml =================================================================== --- classlib6/builder/builder.iml 2013-02-16 19:08:48 UTC (rev 5948) +++ classlib6/builder/builder.iml 2013-02-16 21:24:21 UTC (rev 5949) @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> <component name="NewModuleRootManager" inherit-compiler-output="false"> + <exclude-exploded /> <output url="file://$MODULE_DIR$/build/classes" /> <exclude-output /> - <exclude-exploded /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/builder" isTestSource="false" /> </content> Modified: classlib6/classlib6.iml =================================================================== --- classlib6/classlib6.iml 2013-02-16 19:08:48 UTC (rev 5948) +++ classlib6/classlib6.iml 2013-02-16 21:24:21 UTC (rev 5949) @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> <component name="NewModuleRootManager" inherit-compiler-output="false"> + <exclude-exploded /> <output url="file://$USER_HOME$/ext/devel/classlib6/build/classes" /> <exclude-output /> - <exclude-exploded /> <content url="file://$USER_HOME$/ext/devel/classlib6"> <excludeFolder url="file://$USER_HOME$/ext/devel/classlib6/all" /> <excludeFolder url="file://$USER_HOME$/ext/devel/classlib6/builder" /> Modified: classlib6/core/core.iml =================================================================== --- classlib6/core/core.iml 2013-02-16 19:08:48 UTC (rev 5948) +++ classlib6/core/core.iml 2013-02-16 21:24:21 UTC (rev 5949) @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> <component name="NewModuleRootManager" inherit-compiler-output="false"> + <exclude-exploded /> <output url="file://$MODULE_DIR$/build/classes" /> <exclude-output /> - <exclude-exploded /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/classlib" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/classpath/gnu" isTestSource="false" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2013-02-16 19:08:59
|
Revision: 5948 http://jnode.svn.sourceforge.net/jnode/?rev=5948&view=rev Author: lsantha Date: 2013-02-16 19:08:48 +0000 (Sat, 16 Feb 2013) Log Message: ----------- Integrating OpenJDK 6 build 27. Modified Paths: -------------- classlib6/core/src/openjdk/java/java/beans/XMLDecoder.java classlib6/core/src/openjdk/java/java/net/URL.java classlib6/core/src/openjdk/java/java/util/ServiceLoader.java classlib6/core/src/openjdk/java/java/util/concurrent/Executors.java classlib6/core/src/openjdk/java/java/util/logging/FileHandler.java classlib6/core/src/openjdk/java/java/util/logging/Handler.java classlib6/core/src/openjdk/java/java/util/logging/LogManager.java classlib6/core/src/openjdk/java/java/util/logging/Logger.java classlib6/core/src/openjdk/java/java/util/logging/MemoryHandler.java classlib6/core/src/openjdk/java/java/util/logging/StreamHandler.java classlib6/core/src/openjdk/javax/javax/management/modelmbean/DescriptorSupport.java classlib6/core/src/openjdk/javax/javax/management/remote/rmi/RMIConnectionImpl.java classlib6/core/src/openjdk/javax/javax/swing/text/DefaultFormatter.java classlib6/core/src/openjdk/sun/sun/misc/Service.java classlib6/core/src/openjdk/sun/sun/rmi/registry/RegistryImpl.java classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Cipher.java classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Key.java classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11RSACipher.java classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Signature.java classlib6/core/src/openjdk/sun/sun/security/provider/SecureRandom.java classlib6/core/src/openjdk/sun/sun/security/ssl/HandshakeInStream.java classlib6/core/src/openjdk/sun/sun/security/ssl/Handshaker.java classlib6/core/src/openjdk/sun/sun/security/ssl/RSAClientKeyExchange.java classlib6/core/src/openjdk/sun/sun/security/ssl/ServerHandshaker.java Added Paths: ----------- classlib6/core/src/openjdk/sun/sun/security/util/KeyLength.java classlib6/core/src/openjdk/sun/sun/security/util/Length.java classlib6/core/src/openjdk/sun/sun/text/resources/CollationData_zh_HK.java classlib6/core/src/openjdk/sun/sun/text/resources/FormatData_zh_HK.java Modified: classlib6/core/src/openjdk/java/java/beans/XMLDecoder.java =================================================================== --- classlib6/core/src/openjdk/java/java/beans/XMLDecoder.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/beans/XMLDecoder.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -32,6 +32,10 @@ import java.lang.ref.Reference; import java.lang.ref.WeakReference; +import java.security.AccessControlContext; +import java.security.AccessController; +import java.security.PrivilegedAction; + import org.xml.sax.SAXException; import javax.xml.parsers.SAXParserFactory; @@ -66,6 +70,7 @@ * @author Philip Milne */ public class XMLDecoder { + private final AccessControlContext acc = AccessController.getContext(); private InputStream in; private Object owner; private ExceptionListener exceptionListener; @@ -248,10 +253,15 @@ */ private ObjectHandler getHandler() { if ( handler == null ) { + if ((this.acc == null) && (null != System.getSecurityManager())) { + throw new SecurityException("AccessControlContext is not set"); + } + handler = AccessController.doPrivileged(new PrivilegedAction<ObjectHandler>() { + public ObjectHandler run() { + ObjectHandler handler = new ObjectHandler(XMLDecoder.this, getClassLoader()); SAXParserFactory factory = SAXParserFactory.newInstance(); try { SAXParser parser = factory.newSAXParser(); - handler = new ObjectHandler( this, getClassLoader() ); parser.parse( in, handler ); } catch ( ParserConfigurationException e ) { @@ -267,6 +277,9 @@ catch ( IOException ioe ) { getExceptionListener().exceptionThrown( ioe ); } + return handler; + } + }, this.acc); } return handler; } Modified: classlib6/core/src/openjdk/java/java/net/URL.java =================================================================== --- classlib6/core/src/openjdk/java/java/net/URL.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/net/URL.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2012, 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 @@ -28,6 +28,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Hashtable; import java.util.StringTokenizer; import sun.security.util.SecurityConstants; @@ -1110,6 +1112,21 @@ static Hashtable handlers = new Hashtable(); private static Object streamHandlerLock = new Object(); + // special case the gopher protocol, disabled by default + private static final String GOPHER = "gopher"; + private static final String ENABLE_GOPHER_PROP = "jdk.net.registerGopherProtocol"; + private static final boolean enableGopher = AccessController.doPrivileged( + new PrivilegedAction<Boolean>() { + public Boolean run() { + String prop = System.getProperty(ENABLE_GOPHER_PROP); + return prop == null ? false : + (prop.equalsIgnoreCase("false") ? false : true); + } + }); + + // package name of the JDK implementation protocol handlers + private static final String JDK_PACKAGE_PREFIX = "sun.net.www.protocol"; + /** * Returns the Stream Handler. * @param protocol the protocol to use @@ -1141,7 +1158,7 @@ // REMIND: decide whether to allow the "null" class prefix // or not. - packagePrefixList += "sun.net.www.protocol"; + packagePrefixList += JDK_PACKAGE_PREFIX; StringTokenizer packagePrefixIter = new StringTokenizer(packagePrefixList, "|"); @@ -1151,6 +1168,15 @@ String packagePrefix = packagePrefixIter.nextToken().trim(); + + // do not try to instantiate the JDK gopher handler + // unless the system property had been explicitly set + if (protocol.equalsIgnoreCase(GOPHER) && + packagePrefix.equals(JDK_PACKAGE_PREFIX) && + !enableGopher) { + continue; + } + try { String clsName = packagePrefix + "." + protocol + ".Handler"; Modified: classlib6/core/src/openjdk/java/java/util/ServiceLoader.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/ServiceLoader.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/util/ServiceLoader.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -358,14 +358,21 @@ } String cn = nextName; nextName = null; + Class<?> c = null; try { - S p = service.cast(Class.forName(cn, true, loader) - .newInstance()); - providers.put(cn, p); - return p; + c = Class.forName(cn, false, loader); } catch (ClassNotFoundException x) { fail(service, "Provider " + cn + " not found"); + } + if (!service.isAssignableFrom(c)) { + fail(service, + "Provider " + cn + " not a subtype"); + } + try { + S p = service.cast(c.newInstance()); + providers.put(cn, p); + return p; } catch (Throwable x) { fail(service, "Provider " + cn + " could not be instantiated: " + x, Modified: classlib6/core/src/openjdk/java/java/util/concurrent/Executors.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/concurrent/Executors.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/util/concurrent/Executors.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -530,18 +530,17 @@ return AccessController.doPrivileged( new PrivilegedExceptionAction<T>() { public T run() throws Exception { - ClassLoader savedcl = null; Thread t = Thread.currentThread(); - try { ClassLoader cl = t.getContextClassLoader(); - if (ccl != cl) { + if (ccl == cl) { + return task.call(); + } else { t.setContextClassLoader(ccl); - savedcl = cl; - } + try { return task.call(); } finally { - if (savedcl != null) - t.setContextClassLoader(savedcl); + t.setContextClassLoader(cl); + } } } }, acc); Modified: classlib6/core/src/openjdk/java/java/util/logging/FileHandler.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/logging/FileHandler.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/util/logging/FileHandler.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -220,7 +220,7 @@ * @exception NullPointerException if pattern property is an empty String. */ public FileHandler() throws IOException, SecurityException { - checkAccess(); + checkPermission(); configure(); openFiles(); } @@ -246,7 +246,7 @@ if (pattern.length() < 1 ) { throw new IllegalArgumentException(); } - checkAccess(); + checkPermission(); configure(); this.pattern = pattern; this.limit = 0; @@ -278,7 +278,7 @@ if (pattern.length() < 1 ) { throw new IllegalArgumentException(); } - checkAccess(); + checkPermission(); configure(); this.pattern = pattern; this.limit = 0; @@ -315,7 +315,7 @@ if (limit < 0 || count < 1 || pattern.length() < 1) { throw new IllegalArgumentException(); } - checkAccess(); + checkPermission(); configure(); this.pattern = pattern; this.limit = limit; @@ -354,7 +354,7 @@ if (limit < 0 || count < 1 || pattern.length() < 1) { throw new IllegalArgumentException(); } - checkAccess(); + checkPermission(); configure(); this.pattern = pattern; this.limit = limit; @@ -367,7 +367,7 @@ // configured instance variables. private void openFiles() throws IOException { LogManager manager = LogManager.getLogManager(); - manager.checkAccess(); + manager.checkPermission(); if (count < 1) { throw new IllegalArgumentException("file count = " + count); } Modified: classlib6/core/src/openjdk/java/java/util/logging/Handler.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/logging/Handler.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/util/logging/Handler.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -111,7 +111,7 @@ * the caller does not have <tt>LoggingPermission("control")</tt>. */ public void setFormatter(Formatter newFormatter) throws SecurityException { - checkAccess(); + checkPermission(); // Check for a null pointer: newFormatter.getClass(); formatter = newFormatter; @@ -140,7 +140,7 @@ */ public void setEncoding(String encoding) throws SecurityException, java.io.UnsupportedEncodingException { - checkAccess(); + checkPermission(); if (encoding != null) { try { if(!java.nio.charset.Charset.isSupported(encoding)) { @@ -175,7 +175,7 @@ * the caller does not have <tt>LoggingPermission("control")</tt>. */ public void setFilter(Filter newFilter) throws SecurityException { - checkAccess(); + checkPermission(); filter = newFilter; } @@ -199,7 +199,7 @@ * the caller does not have <tt>LoggingPermission("control")</tt>. */ public void setErrorManager(ErrorManager em) { - checkAccess(); + checkPermission(); if (em == null) { throw new NullPointerException(); } @@ -213,7 +213,7 @@ * the caller does not have <tt>LoggingPermission("control")</tt>. */ public ErrorManager getErrorManager() { - checkAccess(); + checkPermission(); return errorManager; } @@ -253,7 +253,7 @@ if (newLevel == null) { throw new NullPointerException(); } - checkAccess(); + checkPermission(); logLevel = newLevel; } @@ -296,9 +296,9 @@ // If "sealed" is true, we check that the caller has // appropriate security privileges to update Handler // state and if not throw a SecurityException. - void checkAccess() throws SecurityException { + void checkPermission() throws SecurityException { if (sealed) { - manager.checkAccess(); + manager.checkPermission(); } } } Modified: classlib6/core/src/openjdk/java/java/util/logging/LogManager.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/logging/LogManager.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/util/logging/LogManager.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -303,7 +303,7 @@ if (l == null) { throw new NullPointerException(); } - checkAccess(); + checkPermission(); changes.addPropertyChangeListener(l); } @@ -322,7 +322,7 @@ * the caller does not have LoggingPermission("control"). */ public void removePropertyChangeListener(PropertyChangeListener l) throws SecurityException { - checkAccess(); + checkPermission(); changes.removePropertyChangeListener(l); } @@ -740,7 +740,7 @@ * @exception IOException if there are IO problems reading the configuration. */ public void readConfiguration() throws IOException, SecurityException { - checkAccess(); + checkPermission(); // if a configuration class is specified, load it and use it. String cname = System.getProperty("java.util.logging.config.class"); @@ -798,7 +798,7 @@ */ public void reset() throws SecurityException { - checkAccess(); + checkPermission(); synchronized (this) { props = new Properties(); // Since we are doing a reset we no longer want to initialize @@ -883,7 +883,7 @@ * @exception IOException if there are problems reading from the stream. */ public void readConfiguration(InputStream ins) throws IOException, SecurityException { - checkAccess(); + checkPermission(); reset(); // Load the properties @@ -1045,7 +1045,13 @@ } - private Permission ourPermission = new LoggingPermission("control", null); + private final Permission controlPermission = new LoggingPermission("control", null); + + void checkPermission() { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(controlPermission); + } /** * Check that the current context is trusted to modify the logging @@ -1058,11 +1064,7 @@ * the caller does not have LoggingPermission("control"). */ public void checkAccess() throws SecurityException { - SecurityManager sm = System.getSecurityManager(); - if (sm == null) { - return; - } - sm.checkPermission(ourPermission); + checkPermission(); } // Nested class to represent a node in our tree of named loggers. Modified: classlib6/core/src/openjdk/java/java/util/logging/Logger.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/logging/Logger.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/util/logging/Logger.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -266,13 +266,13 @@ this.manager = manager; } - private void checkAccess() throws SecurityException { + private void checkPermission() throws SecurityException { if (!anonymous) { if (manager == null) { // Complete initialization of the global Logger. manager = LogManager.getLogManager(); } - manager.checkAccess(); + manager.checkPermission(); } } @@ -454,7 +454,7 @@ * the caller does not have LoggingPermission("control"). */ public synchronized void setFilter(Filter newFilter) throws SecurityException { - checkAccess(); + checkPermission(); filter = newFilter; } @@ -1145,7 +1145,7 @@ * the caller does not have LoggingPermission("control"). */ public void setLevel(Level newLevel) throws SecurityException { - checkAccess(); + checkPermission(); synchronized (treeLock) { levelObject = newLevel; updateEffectiveLevel(); @@ -1200,7 +1200,7 @@ public synchronized void addHandler(Handler handler) throws SecurityException { // Check for null handler handler.getClass(); - checkAccess(); + checkPermission(); if (handlers == null) { handlers = new ArrayList<Handler>(); } @@ -1217,7 +1217,7 @@ * the caller does not have LoggingPermission("control"). */ public synchronized void removeHandler(Handler handler) throws SecurityException { - checkAccess(); + checkPermission(); if (handler == null) { return; } @@ -1251,7 +1251,7 @@ * the caller does not have LoggingPermission("control"). */ public synchronized void setUseParentHandlers(boolean useParentHandlers) { - checkAccess(); + checkPermission(); this.useParentHandlers = useParentHandlers; } @@ -1388,7 +1388,7 @@ if (parent == null) { throw new NullPointerException(); } - manager.checkAccess(); + manager.checkPermission(); doSetParent(parent); } Modified: classlib6/core/src/openjdk/java/java/util/logging/MemoryHandler.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/logging/MemoryHandler.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/util/logging/MemoryHandler.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -238,7 +238,7 @@ throw new NullPointerException(); } LogManager manager = LogManager.getLogManager(); - checkAccess(); + checkPermission(); pushLevel = newLevel; } Modified: classlib6/core/src/openjdk/java/java/util/logging/StreamHandler.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/logging/StreamHandler.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/java/java/util/logging/StreamHandler.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -249,7 +249,7 @@ } private synchronized void flushAndClose() throws SecurityException { - checkAccess(); + checkPermission(); if (writer != null) { try { if (!doneHeader) { Modified: classlib6/core/src/openjdk/javax/javax/management/modelmbean/DescriptorSupport.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/management/modelmbean/DescriptorSupport.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/javax/javax/management/modelmbean/DescriptorSupport.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -1239,13 +1239,12 @@ return s.substring(1, s.length() - 1); } final String className = s.substring(1, slash); + final Constructor<?> constr; try { + ReflectUtil.checkPackageAccess(className); final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - if (contextClassLoader == null) { - ReflectUtil.checkPackageAccess(className); - } final Class<?> c = Class.forName(className, false, contextClassLoader); constr = c.getConstructor(new Class[] {String.class}); Modified: classlib6/core/src/openjdk/javax/javax/management/remote/rmi/RMIConnectionImpl.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/management/remote/rmi/RMIConnectionImpl.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/javax/javax/management/remote/rmi/RMIConnectionImpl.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, 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 @@ -39,11 +39,17 @@ import java.rmi.MarshalledObject; import java.rmi.UnmarshalException; import java.rmi.server.Unreferenced; + import java.security.AccessControlContext; import java.security.AccessController; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.security.ProtectionDomain; + import java.util.Arrays; import java.util.Collections; import java.util.Map; @@ -60,6 +66,7 @@ import javax.management.MBeanException; import javax.management.MBeanInfo; import javax.management.MBeanRegistrationException; +import javax.management.MBeanPermission; import javax.management.MBeanServer; import javax.management.NotCompliantMBeanException; import javax.management.NotificationFilter; @@ -144,22 +151,46 @@ this.mbeanServer = rmiServer.getMBeanServer(); final ClassLoader dcl = defaultClassLoader; + this.classLoaderWithRepository = AccessController.doPrivileged( new PrivilegedAction<ClassLoaderWithRepository>() { public ClassLoaderWithRepository run() { return new ClassLoaderWithRepository( - getClassLoaderRepository(), + mbeanServer.getClassLoaderRepository(), dcl); } + }, + + withPermissions( new MBeanPermission("*", "getClassLoaderRepository"), + new RuntimePermission("createClassLoader")) + ); + this.defaultContextClassLoader = + AccessController.doPrivileged( + new PrivilegedAction<ClassLoader>() { + @Override + public ClassLoader run() { + return new CombinedClassLoader(Thread.currentThread().getContextClassLoader(), + dcl); + } }); - serverCommunicatorAdmin = new RMIServerCommunicatorAdmin(EnvHelp.getServerConnectionTimeout(env)); this.env = env; } + private static AccessControlContext withPermissions(Permission ... perms){ + Permissions col = new Permissions(); + + for (Permission thePerm : perms ) { + col.add(thePerm); + } + + final ProtectionDomain pd = new ProtectionDomain(null, col); + return new AccessControlContext( new ProtectionDomain[] { pd }); + } + private synchronized ServerNotifForwarder getServerNotifFwd() { // Lazily created when first use. Mainly when // addNotificationListener is first called. @@ -506,7 +537,7 @@ "connectionId=" + connectionId +" unwrapping query with defaultClassLoader."); - queryValue = unwrap(query, defaultClassLoader, QueryExp.class); + queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class); try { final Object params[] = new Object[] { name, queryValue }; @@ -540,7 +571,7 @@ "connectionId=" + connectionId +" unwrapping query with defaultClassLoader."); - queryValue = unwrap(query, defaultClassLoader, QueryExp.class); + queryValue = unwrap(query, defaultContextClassLoader, QueryExp.class); try { final Object params[] = new Object[] { name, queryValue }; @@ -1314,16 +1345,6 @@ // private methods //------------------------------------------------------------------------ - private ClassLoaderRepository getClassLoaderRepository() { - return - AccessController.doPrivileged( - new PrivilegedAction<ClassLoaderRepository>() { - public ClassLoaderRepository run() { - return mbeanServer.getClassLoaderRepository(); - } - }); - } - private ClassLoader getClassLoader(final ObjectName name) throws InstanceNotFoundException { try { @@ -1333,7 +1354,9 @@ public ClassLoader run() throws InstanceNotFoundException { return mbeanServer.getClassLoader(name); } - }); + }, + withPermissions(new MBeanPermission("*", "getClassLoader")) + ); } catch (PrivilegedActionException pe) { throw (InstanceNotFoundException) extractException(pe); } @@ -1348,7 +1371,9 @@ public Object run() throws InstanceNotFoundException { return mbeanServer.getClassLoaderFor(name); } - }); + }, + withPermissions(new MBeanPermission("*", "getClassLoaderFor")) + ); } catch (PrivilegedActionException pe) { throw (InstanceNotFoundException) extractException(pe); } @@ -1575,7 +1600,8 @@ ClassLoader orderCL = AccessController.doPrivileged( new PrivilegedExceptionAction<ClassLoader>() { public ClassLoader run() throws Exception { - return new OrderClassLoaders(cl1, cl2); + return new CombinedClassLoader(Thread.currentThread().getContextClassLoader(), + new OrderClassLoaders(cl1, cl2)); } } ); @@ -1667,6 +1693,8 @@ private final ClassLoader defaultClassLoader; + private final ClassLoader defaultContextClassLoader; + private final ClassLoaderWithRepository classLoaderWithRepository; private boolean terminated = false; @@ -1751,4 +1779,43 @@ private static final ClassLogger logger = new ClassLogger("javax.management.remote.rmi", "RMIConnectionImpl"); + + private static final class CombinedClassLoader extends ClassLoader { + + private final static class ClassLoaderWrapper extends ClassLoader { + ClassLoaderWrapper(ClassLoader cl) { + super(cl); + } + + @Override + protected Class<?> loadClass(String name, boolean resolve) + throws ClassNotFoundException { + return super.loadClass(name, resolve); + } + }; + + final ClassLoaderWrapper defaultCL; + + private CombinedClassLoader(ClassLoader parent, ClassLoader defaultCL) { + super(parent); + this.defaultCL = new ClassLoaderWrapper(defaultCL); + } + + @Override + protected Class<?> loadClass(String name, boolean resolve) + throws ClassNotFoundException { + try { + super.loadClass(name, resolve); + } catch(Exception e) { + for(Throwable t = e; t != null; t = t.getCause()) { + if(t instanceof SecurityException) { + throw t==e?(SecurityException)t:new SecurityException(t.getMessage(), e); + } + } + } + final Class<?> cl = defaultCL.loadClass(name, resolve); + return cl; + } + + } } Modified: classlib6/core/src/openjdk/javax/javax/swing/text/DefaultFormatter.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/swing/text/DefaultFormatter.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/javax/javax/swing/text/DefaultFormatter.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -24,6 +24,8 @@ */ package javax.swing.text; +import sun.reflect.misc.ConstructorUtil; + import java.io.Serializable; import java.lang.reflect.*; import java.text.ParseException; @@ -245,7 +247,7 @@ Constructor cons; try { - cons = vc.getConstructor(new Class[] { String.class }); + cons = ConstructorUtil.getConstructor(vc, new Class[]{String.class}); } catch (NoSuchMethodException nsme) { cons = null; Modified: classlib6/core/src/openjdk/sun/sun/misc/Service.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/misc/Service.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/misc/Service.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -284,12 +284,20 @@ } String cn = nextName; nextName = null; + Class<?> c = null; try { - return Class.forName(cn, true, loader).newInstance(); + c = Class.forName(cn, false, loader); } catch (ClassNotFoundException x) { fail(service, "Provider " + cn + " not found"); - } catch (Exception x) { + } + if (!service.isAssignableFrom(c)) { + fail(service, + "Provider " + cn + " not a subtype"); + } + try { + return service.cast(c.newInstance()); + } catch (Throwable x) { fail(service, "Provider " + cn + " could not be instantiated: " + x, x); Modified: classlib6/core/src/openjdk/sun/sun/rmi/registry/RegistryImpl.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/rmi/registry/RegistryImpl.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/rmi/registry/RegistryImpl.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2012, 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 @@ -405,7 +405,8 @@ */ perms.add(new SocketPermission("*", "connect,accept")); - perms.add(new RuntimePermission("accessClassInPackage.sun.*")); + perms.add(new RuntimePermission("accessClassInPackage.sun.jvmstat.*")); + perms.add(new RuntimePermission("accessClassInPackage.sun.jvm.hotspot.*")); perms.add(new FilePermission("<<ALL FILES>>", "read")); Modified: classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Cipher.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Cipher.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Cipher.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -650,7 +650,7 @@ // see JCE spec protected int engineGetKeySize(Key key) throws InvalidKeyException { int n = P11SecretKeyFactory.convertKey - (token, key, keyAlgorithm).keyLength(); + (token, key, keyAlgorithm).length(); return n; } } Modified: classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Key.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Key.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Key.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -46,6 +46,7 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*; import sun.security.util.DerValue; +import sun.security.util.Length; /** * Key implementation classes. @@ -61,7 +62,7 @@ * @author Andreas Sterbenz * @since 1.5 */ -abstract class P11Key implements Key { +abstract class P11Key implements Key, Length { private final static String PUBLIC = "public"; private final static String PRIVATE = "private"; @@ -212,7 +213,11 @@ return s1; } - int keyLength() { + /** + * Return bit length of the key. + */ + @Override + public int length() { return keyLength; } Modified: classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11RSACipher.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11RSACipher.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11RSACipher.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -201,7 +201,7 @@ } else { throw new InvalidKeyException("Unknown key type: " + p11Key); } - int n = (p11Key.keyLength() + 7) >> 3; + int n = (p11Key.length() + 7) >> 3; outputSize = n; buffer = new byte[n]; maxInputSize = encrypt ? (n - PKCS1_MIN_PADDING_LENGTH) : n; @@ -458,7 +458,7 @@ // see JCE spec protected int engineGetKeySize(Key key) throws InvalidKeyException { - int n = P11KeyFactory.convertKey(token, key, algorithm).keyLength(); + int n = P11KeyFactory.convertKey(token, key, algorithm).length(); return n; } } Modified: classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Signature.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Signature.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/security/pkcs11/P11Signature.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -274,7 +274,7 @@ if (keyAlgorithm.equals("DSA")) { signature = new byte[40]; } else { - signature = new byte[(p11Key.keyLength() + 7) >> 3]; + signature = new byte[(p11Key.length() + 7) >> 3]; } if (type == T_UPDATE) { token.p11.C_VerifyFinal(session.id(), signature); @@ -359,7 +359,7 @@ if (keyAlgorithm.equals("RSA") && publicKey != p11Key) { int keyLen; if (publicKey instanceof P11Key) { - keyLen = ((P11Key) publicKey).keyLength(); + keyLen = ((P11Key) publicKey).length(); } else { keyLen = ((RSAKey) publicKey).getModulus().bitLength(); } @@ -620,7 +620,7 @@ private byte[] pkcs1Pad(byte[] data) { try { - int len = (p11Key.keyLength() + 7) >> 3; + int len = (p11Key.length() + 7) >> 3; RSAPadding padding = RSAPadding.getInstance (RSAPadding.PAD_BLOCKTYPE_1, len); byte[] padded = padding.pad(data); Modified: classlib6/core/src/openjdk/sun/sun/security/provider/SecureRandom.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/provider/SecureRandom.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/security/provider/SecureRandom.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2012, 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 @@ -56,12 +56,6 @@ private static final long serialVersionUID = 3581829991155417889L; - /** - * This static object will be seeded by SeedGenerator, and used - * to seed future instances of SecureRandom - */ - private static SecureRandom seeder; - private static final int DIGEST_SIZE = 20; private transient MessageDigest digest; private byte[] state; @@ -173,6 +167,28 @@ } /** + * This static object will be seeded by SeedGenerator, and used + * to seed future instances of SHA1PRNG SecureRandoms. + * + * Bloch, Effective Java Second Edition: Item 71 + */ + private static class SeederHolder { + + private static final SecureRandom seeder; + + static { + /* + * Call to SeedGenerator.generateSeed() to add additional + * seed material (likely from the Native implementation). + */ + seeder = new SecureRandom(SeedGenerator.getSystemEntropy()); + byte [] b = new byte[DIGEST_SIZE]; + SeedGenerator.generateSeed(b); + seeder.engineSetSeed(b); + } + } + + /** * Generates a user-specified number of random bytes. * * @param bytes the array to be filled in with random bytes. @@ -183,13 +199,8 @@ byte[] output = remainder; if (state == null) { - if (seeder == null) { - seeder = new SecureRandom(SeedGenerator.getSystemEntropy()); - seeder.engineSetSeed(engineGenerateSeed(DIGEST_SIZE)); - } - byte[] seed = new byte[DIGEST_SIZE]; - seeder.engineNextBytes(seed); + SeederHolder.seeder.engineNextBytes(seed); state = digest.digest(seed); } Modified: classlib6/core/src/openjdk/sun/sun/security/ssl/HandshakeInStream.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/ssl/HandshakeInStream.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/security/ssl/HandshakeInStream.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2012, 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 @@ -190,6 +190,7 @@ byte[] getBytes8() throws IOException { int len = getInt8(); + verifyLength(len); byte b[] = new byte[len]; read(b, 0, len); @@ -198,6 +199,7 @@ byte[] getBytes16() throws IOException { int len = getInt16(); + verifyLength(len); byte b[] = new byte[len]; read(b, 0, len); @@ -206,10 +208,19 @@ byte[] getBytes24() throws IOException { int len = getInt24(); + verifyLength(len); byte b[] = new byte[len]; read(b, 0, len); return b; } + // Is a length greater than available bytes in the record? + private void verifyLength(int len) throws SSLException { + if (len > available()) { + throw new SSLException( + "Not enough data to fill declared vector size"); + } + } + } Modified: classlib6/core/src/openjdk/sun/sun/security/ssl/Handshaker.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/ssl/Handshaker.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/security/ssl/Handshaker.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2012, 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 @@ -776,9 +776,9 @@ if (debug != null && Debug.isOn("handshake")) { System.out.println("RSA master secret generation error:"); e.printStackTrace(System.out); - System.out.println("Generating new random premaster secret"); } - preMasterSecret = RSAClientKeyExchange.generateDummySecret(protocolVersion); + preMasterSecret = + RSAClientKeyExchange.generateDummySecret(protocolVersion); // recursive call with new premaster secret return calculateMasterSecret(preMasterSecret, null); } @@ -821,9 +821,9 @@ System.out.println("RSA PreMasterSecret version error: expected" + protocolVersion + " or " + requestedVersion + ", decrypted: " + premasterVersion); - System.out.println("Generating new random premaster secret"); } - preMasterSecret = RSAClientKeyExchange.generateDummySecret(protocolVersion); + preMasterSecret = + RSAClientKeyExchange.generateDummySecret(protocolVersion); // recursive call with new premaster secret return calculateMasterSecret(preMasterSecret, null); } Modified: classlib6/core/src/openjdk/sun/sun/security/ssl/RSAClientKeyExchange.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/ssl/RSAClientKeyExchange.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/security/ssl/RSAClientKeyExchange.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2012, 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 @@ -36,6 +36,7 @@ import javax.net.ssl.*; import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; +import sun.security.util.KeyLength; /** * This is the client key exchange message (CLIENT --> SERVER) used with @@ -85,7 +86,8 @@ * it, using its RSA private key. Result is the same size as the * server's public key, and uses PKCS #1 block format 02. */ - RSAClientKeyExchange(ProtocolVersion protocolVersion, ProtocolVersion maxVersion, + RSAClientKeyExchange(ProtocolVersion protocolVersion, + ProtocolVersion maxVersion, SecureRandom generator, PublicKey publicKey) throws IOException { if (publicKey.getAlgorithm().equals("RSA") == false) { throw new SSLKeyException("Public key not of type RSA"); @@ -120,7 +122,8 @@ * Server gets the PKCS #1 (block format 02) data, decrypts * it with its private key. */ - RSAClientKeyExchange(ProtocolVersion currentVersion, HandshakeInStream input, + RSAClientKeyExchange(ProtocolVersion currentVersion, + ProtocolVersion maxVersion, HandshakeInStream input, int messageSize, PrivateKey privateKey) throws IOException { if (privateKey.getAlgorithm().equals("RSA") == false) { @@ -143,28 +146,119 @@ cipher.init(Cipher.UNWRAP_MODE, privateKey); preMaster = (SecretKey)cipher.unwrap(encrypted, "TlsRsaPremasterSecret", Cipher.SECRET_KEY); + + // polish the premaster secret + preMaster = polishPreMasterSecretKey( + currentVersion, maxVersion, preMaster, null); } catch (Exception e) { + // polish the premaster secret + preMaster = polishPreMasterSecretKey( + currentVersion, maxVersion, preMaster, e); + } + } + + /** + * To avoid vulnerabilities described by section 7.4.7.1, RFC 5246, + * treating incorrectly formatted message blocks and/or mismatched + * version numbers in a manner indistinguishable from correctly + * formatted RSA blocks. + * + * RFC 5246 describes the approach as : + * + * 1. Generate a string R of 46 random bytes + * + * 2. Decrypt the message to recover the plaintext M + * + * 3. If the PKCS#1 padding is not correct, or the length of message + * M is not exactly 48 bytes: + * pre_master_secret = ClientHello.client_version || R + * else If ClientHello.client_version <= TLS 1.0, and version + * number check is explicitly disabled: + * pre_master_secret = M + * else: + * pre_master_secret = ClientHello.client_version || M[2..47] + * + * Note that although TLS 1.2 is not supported in this release, we still + * want to make use of the above approach to provide better protection. + */ + private SecretKey polishPreMasterSecretKey( + ProtocolVersion currentVersion, ProtocolVersion clientHelloVersion, + SecretKey secretKey, Exception failoverException) { + + if (failoverException == null && secretKey != null) { + // check the length + byte[] encoded = secretKey.getEncoded(); + if (encoded == null) { // unable to get the encoded key + if (debug != null && Debug.isOn("handshake")) { + System.out.println( + "unable to get the plaintext of the premaster secret"); + } + + int keySize = KeyLength.getKeySize(secretKey); + if (keySize > 0 && keySize != 384) { // 384 = 48 * 8 + if (debug != null && Debug.isOn("handshake")) { + System.out.println( + "incorrect length of premaster secret: " + + (keySize/8)); + } + + return generateDummySecret(currentVersion); + } + + // The key size is exactly 48 bytes or not accessible. + // + // Conservatively, pass the checking to master secret + // calculation. + return secretKey; + } else if (encoded.length == 48) { + // check the version + if (clientHelloVersion.major == encoded[0] && + clientHelloVersion.minor == encoded[1]) { + + return secretKey; + } else if (clientHelloVersion.v <= ProtocolVersion.TLS10.v && + currentVersion.major == encoded[0] && + currentVersion.minor == encoded[1]) { /* - * Bogus decrypted ClientKeyExchange? If so, conjure a - * a random preMaster secret that will fail later during - * Finished message processing. This is a countermeasure against - * the "interactive RSA PKCS#1 encryption envelop attack" reported - * in June 1998. Preserving the executation path will - * mitigate timing attacks and force consistent error handling - * that will prevent an attacking client from differentiating - * different kinds of decrypted ClientKeyExchange bogosities. + * For compatibility, we maintain the behavior that the + * version in pre_master_secret can be the negotiated + * version for TLS v1.0 and SSL v3.0. */ + return secretKey; + } + if (debug != null && Debug.isOn("handshake")) { - System.out.println("Error decrypting premaster secret:"); - e.printStackTrace(System.out); - System.out.println("Generating random secret"); + System.out.println("Mismatching Protocol Versions, " + + "ClientHello.client_version is " + clientHelloVersion + + ", while PreMasterSecret.client_version is " + + ProtocolVersion.valueOf(encoded[0], encoded[1])); + } + return generateDummySecret(currentVersion); + } else { + if (debug != null && Debug.isOn("handshake")) { + System.out.println( + "incorrect length of premaster secret: " + + encoded.length); + } + return generateDummySecret(currentVersion); } - preMaster = generateDummySecret(currentVersion); } + + if (debug != null && Debug.isOn("handshake") && + failoverException != null) { + System.out.println("Error decrypting premaster secret:"); + failoverException.printStackTrace(System.out); + } + + return generateDummySecret(currentVersion); } // generate a premaster secret with the specified version number static SecretKey generateDummySecret(ProtocolVersion version) { + if (debug != null && Debug.isOn("handshake")) { + System.out.println("Generating a random fake premaster secret"); + } + try { KeyGenerator kg = JsseJce.getKeyGenerator("SunTlsRsaPremasterSecret"); Modified: classlib6/core/src/openjdk/sun/sun/security/ssl/ServerHandshaker.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/ssl/ServerHandshaker.java 2013-02-13 20:12:29 UTC (rev 5947) +++ classlib6/core/src/openjdk/sun/sun/security/ssl/ServerHandshaker.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2012, 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 @@ -190,8 +190,9 @@ * temporary one used for non-export or signing-only * certificates/keys. */ - RSAClientKeyExchange pms = new RSAClientKeyExchange - (protocolVersion, input, message_len, privateKey); + RSAClientKeyExchange pms = new RSAClientKeyExchange( + protocolVersion, clientRequestedVersion, + input, message_len, privateKey); preMasterSecret = this.clientKeyExchange(pms); break; case K_KRB5: Added: classlib6/core/src/openjdk/sun/sun/security/util/KeyLength.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/util/KeyLength.java (rev 0) +++ classlib6/core/src/openjdk/sun/sun/security/util/KeyLength.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 sun.security.util; + +import java.security.Key; +import java.security.PrivilegedAction; +import java.security.AccessController; +import java.security.interfaces.ECKey; +import java.security.interfaces.RSAKey; +import java.security.interfaces.DSAKey; +import javax.crypto.SecretKey; +import javax.crypto.interfaces.DHKey; + +/** + * A utility class to get key length + */ +public final class KeyLength { + + /** + * Returns the key size of the given key object in bits. + * + * @param key the key object, cannot be null + * @return the key size of the given key object in bits, or -1 if the + * key size is not accessible + */ + final public static int getKeySize(Key key) { + int size = -1; + + if (key instanceof Length) { + try { + Length ruler = (Length)key; + size = ruler.length(); + } catch (UnsupportedOperationException usoe) { + // ignore the exception + } + + if (size >= 0) { + return size; + } + } + + // try to parse the length from key specification + if (key instanceof SecretKey) { + SecretKey sk = (SecretKey)key; + String format = sk.getFormat(); + if ("RAW".equals(format) && sk.getEncoded() != null) { + size = (sk.getEncoded().length * 8); + } // Otherwise, it may be a unextractable key of PKCS#11, or + // a key we are not able to handle. + } else if (key instanceof RSAKey) { + RSAKey pubk = (RSAKey)key; + size = pubk.getModulus().bitLength(); + } else if (key instanceof ECKey) { + ECKey pubk = (ECKey)key; + size = pubk.getParams().getOrder().bitLength(); + } else if (key instanceof DSAKey) { + DSAKey pubk = (DSAKey)key; + size = pubk.getParams().getP().bitLength(); + } else if (key instanceof DHKey) { + DHKey pubk = (DHKey)key; + size = pubk.getParams().getP().bitLength(); + } // Otherwise, it may be a unextractable key of PKCS#11, or + // a key we are not able to handle. + + return size; + } +} + Added: classlib6/core/src/openjdk/sun/sun/security/util/Length.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/security/util/Length.java (rev 0) +++ classlib6/core/src/openjdk/sun/sun/security/util/Length.java 2013-02-16 19:08:48 UTC (rev 5948) @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRA... [truncated message content] |
From: <ls...@us...> - 2013-02-13 20:12:40
|
Revision: 5947 http://jnode.svn.sourceforge.net/jnode/?rev=5947&view=rev Author: lsantha Date: 2013-02-13 20:12:29 +0000 (Wed, 13 Feb 2013) Log Message: ----------- Applied patch by Sebastian Ritter, implementing the uname command. Modified Paths: -------------- trunk/cli/descriptors/org.jnode.command.system.xml Added Paths: ----------- trunk/cli/src/commands/org/jnode/command/system/UnameCommand.java Modified: trunk/cli/descriptors/org.jnode.command.system.xml =================================================================== --- trunk/cli/descriptors/org.jnode.command.system.xml 2013-01-25 11:33:00 UTC (rev 5946) +++ trunk/cli/descriptors/org.jnode.command.system.xml 2013-02-13 20:12:29 UTC (rev 5947) @@ -15,13 +15,13 @@ <import plugin="org.jnode.shell.syntax"/> <import plugin="org.jnode.util"/> </requires> - + <runtime> <library name="jnode-cli.jar"> <export name="org.jnode.command.system.*"/> </library> </runtime> - + <extension point="org.jnode.shell.aliases"> <alias name="alias" class="org.jnode.command.system.AliasCommand"/> <alias name="bindkeys" class="org.jnode.command.system.BindKeysCommand"/> @@ -50,9 +50,10 @@ <alias name="syntax" class="org.jnode.command.system.SyntaxCommand"/> <alias name="terminate" class="org.jnode.command.system.TerminateCommand"/> <alias name="thread" class="org.jnode.command.system.ThreadCommand"/> + <alias name="uname" class="org.jnode.command.system.UnameCommand"/> <alias name="vminfo" class="org.jnode.command.system.VmInfoCommand"/> </extension> - + <extension point="org.jnode.shell.syntaxes"> <syntax alias="alias"> <empty description="List all aliases"/> @@ -222,7 +223,7 @@ <option argLabel="minTotalSize" longName="minTotalSize"/> <option argLabel="className" longName="className"/> </optionSet> - </syntax> + </syntax> <syntax alias="page"> <empty description="Filter standard input a page (screen) at a time"/> <argument argLabel="file" description="Output the file a page (screen) at a time"/> @@ -294,13 +295,25 @@ </optional> <argument argLabel="threadName" description="Display the named Thread"/> </syntax> + <syntax alias="uname" description="Print operating system informations."> + <empty description="Print the hardware type on witch system is running; same like argument -m"/> + <optionSet> + <option argLabel="a" shortName="a"/> + <option argLabel="m" shortName="m"/> + <option argLabel="n" shortName="n"/> + <option argLabel="r" shortName="r"/> + <option argLabel="s" shortName="s"/> + <option argLabel="v" shortName="v"/> + </optionSet> + </syntax> + <syntax alias="vminfo"> <optional description="dump IRQ handler information"> <option argLabel="reset" longName="reset"/> </optional> </syntax> </extension> - + <extension point="org.jnode.security.permissions"> <permission class="java.util.PropertyPermission" name="*" actions="read,write"/> <permission class="java.lang.RuntimePermission" name="getProtectionDomain"/> @@ -317,5 +330,5 @@ <permission class="org.jnode.permission.JNodePermission" name="getVmClass"/> <permission class="java.lang.reflect.ReflectPermission" name="suppressAccessChecks"/> </extension> - + </plugin> Added: trunk/cli/src/commands/org/jnode/command/system/UnameCommand.java =================================================================== --- trunk/cli/src/commands/org/jnode/command/system/UnameCommand.java (rev 0) +++ trunk/cli/src/commands/org/jnode/command/system/UnameCommand.java 2013-02-13 20:12:29 UTC (rev 5947) @@ -0,0 +1,145 @@ +/** + * Copyright (C) 2013 JNode.org + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; If not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +package org.jnode.command.system; + +import gnu.java.security.action.GetPropertiesAction; + +import java.security.AccessController; +import java.util.Properties; + +import org.jnode.shell.AbstractCommand; +import org.jnode.shell.syntax.Argument; +import org.jnode.shell.syntax.FlagArgument; + +/** + * <code>uname</code> command prints informations about the operation system. + * With <code>a</code> argument the return syntax of uname posix is: + * <pre>sysname<SPACE>nodename<SPACE>release<SPACE>version<SPACE>machine<NL></pre> + * For example: + * + * <table border='1'> + * <tr><th rowspan='2'>Argument</th><th colspan='3'>Output</th></tr> + * <tr><th>JNode</th><th>MacOS 10.8.2</th><th>OpenSUSE 12</th></tr> + * <tr><td>m</td><td>${os.arch}</td><td>x86_64</td><td>i686</td></tr> + * <tr><td>n</td><td>${os.name}</td><td>my_mac</td><td>suse12</td></tr> + * <tr><td>r</td><td>${os.version}</td><td>12.2.0</td><td>3.1.0-1.2-default</td></tr> + * <tr><td>s</td><td>${os.name}</td><td>Darwin</td><td>Linux</td></tr> + * <tr><td>v</td><td>${os.name} ${os.version}</td><td>Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64</td><td>#1 SMP Thu Nov 3 14:45:45 UTC 2011 (187dde0)</td></tr> + * </table> + * @author bastie + * + */ +public final class UnameCommand extends AbstractCommand { + + /** + * Command description + */ + private static final String HELP_UNAME = "Print operating system informations."; + /** + * Description of <code>a</code> argument. + */ + private static final String HELP_ALL = "Same as all params [mnrsv] using."; + /** + * Description of <code>m</code> argument. + */ + private static final String HELP_M = "Print the hardware type on witch system is running."; + /** + * Description of <code>n</code> argument. + */ + private static final String HELP_N = "Print the name of network implementation."; + /** + * Description of <code>r</code> argument. + */ + private static final String HELP_R = "Print the current release level of os implementation."; + /** + * Description of <code>s</code> argument. + */ + private static final String HELP_S = "Print the name of implementation."; + /** + * Description of <code>v</code> argument. + */ + private static final String HELP_V = "Print the current version level of release level of os implementation."; + + /** + * Flag for argument 'a'. + */ + private final FlagArgument allArg; + /** + * Flag for argument 'm'. + */ + private final FlagArgument hardwareMaschineArg; + /** + * Flag for argument 'n'. + */ + private final FlagArgument networkImplNameArg; + /** + * Flag for argument 'r'. + */ + private final FlagArgument releaseLevelArg; + /** + * Flag for argument 's'. + */ + private final FlagArgument implNameArg; + /** + * Flag for argument 'v'. + */ + private final FlagArgument versionArg; + + + /** + * Construct new uname command implementation with "amnrsv" arguments. + */ + public UnameCommand() { + super (HELP_UNAME); + allArg = new FlagArgument("a", Argument.OPTIONAL | Argument.SINGLE, HELP_ALL); + hardwareMaschineArg = new FlagArgument("m", Argument.OPTIONAL | Argument.SINGLE, HELP_M); + networkImplNameArg = new FlagArgument("n", Argument.OPTIONAL | Argument.SINGLE, HELP_N); + releaseLevelArg = new FlagArgument("r", Argument.OPTIONAL | Argument.SINGLE, HELP_R); + implNameArg = new FlagArgument("s", Argument.OPTIONAL | Argument.SINGLE, HELP_S); + versionArg = new FlagArgument("v", Argument.OPTIONAL | Argument.SINGLE, HELP_V); + registerArguments(allArg, hardwareMaschineArg, networkImplNameArg,releaseLevelArg, implNameArg, versionArg); + } + + @Override + public void execute() throws Exception { + Properties ps = AccessController.doPrivileged(new GetPropertiesAction()); + + String sysname = allArg.isSet() || hardwareMaschineArg.isSet() ? ps.getProperty("os.arch") : ""; + final String nodename = allArg.isSet() || networkImplNameArg.isSet() ? ps.getProperty("os.name"): ""; + final String release = allArg.isSet() || releaseLevelArg.isSet() ? ps.getProperty("os.version") :""; + final String version = allArg.isSet() || implNameArg.isSet() ? ps.getProperty("os.name") : ""; + final String machine = allArg.isSet() || versionArg.isSet() ? ps.getProperty("os.name") + + " " + + ps.getProperty("os.version"): ""; + // If no argument specific, set the default + if (!allArg.isSet() && + !hardwareMaschineArg.isSet() && + !networkImplNameArg.isSet() && + !releaseLevelArg.isSet() && + !implNameArg.isSet() && + !versionArg.isSet()) { + sysname = ps.getProperty("os.arch");// ps.getProperty("os.arch"); + } + + // Description for more than one arguments contains: + // "separated by one or more <blank>s." + final String result = String.format("%s %s %s %s %s", sysname, nodename, release, version, machine).trim() +'\n'; + + getOutput().getPrintWriter().write(result); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2013-01-25 11:33:10
|
Revision: 5946 http://jnode.svn.sourceforge.net/jnode/?rev=5946&view=rev Author: galatnm Date: 2013-01-25 11:33:00 +0000 (Fri, 25 Jan 2013) Log Message: ----------- Add sonar-runner config for net module Modified Paths: -------------- trunk/sonar-project.properties Added Paths: ----------- trunk/net/sonar-project.properties Added: trunk/net/sonar-project.properties =================================================================== --- trunk/net/sonar-project.properties (rev 0) +++ trunk/net/sonar-project.properties 2013-01-25 11:33:00 UTC (rev 5946) @@ -0,0 +1,3 @@ +sonar.projectName= net +sonar.sources=src/driver, src/net +sonar.binaries= build \ No newline at end of file Modified: trunk/sonar-project.properties =================================================================== --- trunk/sonar-project.properties 2013-01-25 10:08:38 UTC (rev 5945) +++ trunk/sonar-project.properties 2013-01-25 11:33:00 UTC (rev 5946) @@ -1,6 +1,7 @@ sonar.projectKey=org.jnode sonar.projectName= jnode sonar.projectVersion= 2.9 -sonar.modules= fs +sonar.modules= fs, net sonar.sources= src sonar.language=java +sonar.forceAnalysis=true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2013-01-25 10:08:50
|
Revision: 5945 http://jnode.svn.sourceforge.net/jnode/?rev=5945&view=rev Author: galatnm Date: 2013-01-25 10:08:38 +0000 (Fri, 25 Jan 2013) Log Message: ----------- Add configuration for sonar-runner. Added Paths: ----------- trunk/fs/sonar-project.properties trunk/sonar-project.properties Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:ignore - build bak build docs lib .classpath .project .metadata src.jpx *.patch jnode.properties local bin JNode.iws + *.patch .classpath .metadata .project .sonar JNode.iws bak bin build docs jnode.properties lib local src.jpx Added: trunk/fs/sonar-project.properties =================================================================== --- trunk/fs/sonar-project.properties (rev 0) +++ trunk/fs/sonar-project.properties 2013-01-25 10:08:38 UTC (rev 5945) @@ -0,0 +1,3 @@ +sonar.projectName= fs +sonar.sources=src/driver, src/fs +sonar.binaries= build \ No newline at end of file Added: trunk/sonar-project.properties =================================================================== --- trunk/sonar-project.properties (rev 0) +++ trunk/sonar-project.properties 2013-01-25 10:08:38 UTC (rev 5945) @@ -0,0 +1,6 @@ +sonar.projectKey=org.jnode +sonar.projectName= jnode +sonar.projectVersion= 2.9 +sonar.modules= fs +sonar.sources= src +sonar.language=java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2013-01-08 23:19:24
|
Revision: 5944 http://jnode.svn.sourceforge.net/jnode/?rev=5944&view=rev Author: lsantha Date: 2013-01-08 23:19:18 +0000 (Tue, 08 Jan 2013) Log Message: ----------- FIxed broken build. Modified Paths: -------------- trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java trunk/core/src/test/org/jnode/plugin/model/PluginDescriptorModelTest.java Modified: trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java 2012-12-27 15:08:56 UTC (rev 5943) +++ trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java 2013-01-08 23:19:18 UTC (rev 5944) @@ -8,13 +8,13 @@ * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but + * This library 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 Lesser General Public + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., + * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ @@ -41,7 +41,7 @@ /** * Create new instance of configuration element model. - * + * * @param plugin The model for plugin descriptor. * @param element An XML element. * @throws PluginException @@ -76,7 +76,7 @@ /** * Gets the value of an attribute with a given name - * + * * @param name Name of the element. * @return The attribute value, or null if not found. */ @@ -84,7 +84,7 @@ public String getAttribute(String name) { if (attributes != null) { for (AttributeModel attribute : attributes) - if (attribute.equals(name)) { + if (attribute.getName().equals(name)) { return attribute.getValue(); } } @@ -93,7 +93,7 @@ /** * Gets the names of all attributes in this element. - * + * * @return A set of attribute names. This set can be empty if no attributes * found. */ Modified: trunk/core/src/test/org/jnode/plugin/model/PluginDescriptorModelTest.java =================================================================== --- trunk/core/src/test/org/jnode/plugin/model/PluginDescriptorModelTest.java 2012-12-27 15:08:56 UTC (rev 5943) +++ trunk/core/src/test/org/jnode/plugin/model/PluginDescriptorModelTest.java 2013-01-08 23:19:18 UTC (rev 5944) @@ -1,5 +1,6 @@ package org.jnode.plugin.model; - +//TODO FIX THIS TO NOT BREAK THE BUILD +/* import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; @@ -13,6 +14,7 @@ import org.junit.Before; import org.junit.Test; + public class PluginDescriptorModelTest { private PluginDescriptorModel model; @@ -108,3 +110,4 @@ assertEquals("version", reference.getVersion()); } } +*/ \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2012-12-27 15:09:05
|
Revision: 5943 http://jnode.svn.sourceforge.net/jnode/?rev=5943&view=rev Author: galatnm Date: 2012-12-27 15:08:56 +0000 (Thu, 27 Dec 2012) Log Message: ----------- CORE : Add unit tests for PluginDescriptorModel Modified Paths: -------------- trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java trunk/core/src/core/org/jnode/plugin/model/PluginPrerequisiteModel.java Added Paths: ----------- trunk/core/src/test/org/jnode/plugin/ trunk/core/src/test/org/jnode/plugin/model/ trunk/core/src/test/org/jnode/plugin/model/PluginDescriptorModelTest.java Modified: trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java 2012-12-21 15:21:18 UTC (rev 5942) +++ trunk/core/src/core/org/jnode/plugin/model/ConfigurationElementModel.java 2012-12-27 15:08:56 UTC (rev 5943) @@ -17,12 +17,13 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.plugin.model; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; + import org.jnode.nanoxml.XMLElement; import org.jnode.plugin.ConfigurationElement; import org.jnode.plugin.PluginException; @@ -32,72 +33,76 @@ */ final class ConfigurationElementModel extends PluginModelObject implements ConfigurationElement { + /** Name of the current configuration element. */ private final String name; private final AttributeModel[] attributes; + /** Child elements of the current configuration element. */ private final ConfigurationElement[] elements; /** - * Create a new instance - * - * @param e + * Create new instance of configuration element model. + * + * @param plugin The model for plugin descriptor. + * @param element An XML element. + * @throws PluginException */ - public ConfigurationElementModel(PluginDescriptorModel plugin, XMLElement e) - throws PluginException { + public ConfigurationElementModel(PluginDescriptorModel plugin, XMLElement element) + throws PluginException { super(plugin); - name = e.getName(); + name = element.getName(); - final Set<String> aI = e.attributeNames(); - if (!aI.isEmpty()) { + final Set<String> attributeNames = element.attributeNames(); + if (!attributeNames.isEmpty()) { final ArrayList<AttributeModel> list = new ArrayList<AttributeModel>(); - for (String name : aI) { - final String value = e.getStringAttribute(name); + for (String name : attributeNames) { + final String value = element.getStringAttribute(name); list.add(new AttributeModel(name, value)); if (value == null) { throw new PluginException("Cannot find attribute value for attribute " + name); } - //System.out.println("name[" + name + "] value[" + value + "]"); } - attributes = (AttributeModel[]) list.toArray(new AttributeModel[list.size()]); + attributes = list.toArray(new AttributeModel[list.size()]); } else { attributes = null; } - final ArrayList<ConfigurationElementModel> list = new ArrayList<ConfigurationElementModel>(); - for (final XMLElement ce : e.getChildren()) { + final ArrayList<ConfigurationElementModel> list = + new ArrayList<ConfigurationElementModel>(); + for (final XMLElement ce : element.getChildren()) { list.add(new ConfigurationElementModel(plugin, ce)); } - elements = (ConfigurationElement[]) list.toArray(new ConfigurationElement[list.size()]); + elements = list.toArray(new ConfigurationElement[list.size()]); } /** * Gets the value of an attribute with a given name - * - * @param name - * @return The attribute value, or null if not found + * + * @param name Name of the element. + * @return The attribute value, or null if not found. */ + @Override public String getAttribute(String name) { if (attributes != null) { - final int max = attributes.length; - for (int i = 0; i < max; i++) { - if (attributes[i].getName().equals(name)) { - return attributes[i].getValue(); + for (AttributeModel attribute : attributes) + if (attribute.equals(name)) { + return attribute.getValue(); } - } } return null; } - /** * Gets the names of all attributes in this element. - * - * @return + * + * @return A set of attribute names. This set can be empty if no attributes + * found. */ + @Override public Set<String> attributeNames() { final HashSet<String> set = new HashSet<String>(); if (attributes != null) { - for (AttributeModel attr : attributes) { - set.add(attr.getName()); + for (AttributeModel attribute : attributes) { + set.add(attribute.getName()); } } return set; @@ -106,6 +111,7 @@ /** * Gets all child elements */ + @Override public ConfigurationElement[] getElements() { return elements; } @@ -113,14 +119,15 @@ /** * Gets the name of this element */ + @Override public String getName() { return name; } - /** * Resolve all references to (elements of) other plugin descriptors */ + @Override protected void resolve(PluginRegistryModel registry) { // Do nothing } @@ -128,14 +135,17 @@ /** * Remove all references to (elements of) other plugin descriptors */ + @Override protected void unresolve(PluginRegistryModel registry) { // Do nothing } + @Override public String toString() { StringBuilder tmp = new StringBuilder(name); for (AttributeModel attr : attributes) { - tmp.append(' ').append(attr.getName()).append("=\"").append(attr.getValue()).append('\"'); + tmp.append(' ').append(attr.getName()).append("=\"").append(attr.getValue()) + .append('\"'); } return tmp.toString(); } Modified: trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java 2012-12-21 15:21:18 UTC (rev 5942) +++ trunk/core/src/core/org/jnode/plugin/model/PluginDescriptorModel.java 2012-12-27 15:08:56 UTC (rev 5943) @@ -111,25 +111,25 @@ /** * Create a new instance * - * @param e the root XMLElement for the XML plugin descriptor + * @param rootElement the root XMLElement for the XML plugin descriptor * @param jarFile the PluginJar object to associate with the descriptor. */ - PluginDescriptorModel(PluginJar jarFile, XMLElement e) + PluginDescriptorModel(PluginJar jarFile, XMLElement rootElement) throws PluginException { this.jarFile = jarFile; this.fragments = new BootableArrayList<FragmentDescriptorModel>(); - id = getAttribute(e, "id", true); - name = getAttribute(e, "name", true); - providerName = getAttribute(e, "provider-name", false); - providerUrl = getAttribute(e, "provider-url", false); - licenseName = getAttribute(e, "license-name", true); - licenseUrl = getAttribute(e, "license-url", false); - version = getAttribute(e, "version", true); - className = getAttribute(e, "class", false); - system = getBooleanAttribute(e, "system", false); - autoStart = getBooleanAttribute(e, "auto-start", false); + id = getAttribute(rootElement, "id", true); + name = getAttribute(rootElement, "name", true); + providerName = getAttribute(rootElement, "provider-name", false); + providerUrl = getAttribute(rootElement, "provider-url", false); + licenseName = getAttribute(rootElement, "license-name", true); + licenseUrl = getAttribute(rootElement, "license-url", false); + version = getAttribute(rootElement, "version", true); + className = getAttribute(rootElement, "class", false); + system = getBooleanAttribute(rootElement, "system", false); + autoStart = getBooleanAttribute(rootElement, "auto-start", false); priority = Math.min(MAX_PRIORITY, Math.max(MIN_PRIORITY, - getIntAttribute(e, "priority", DEFAULT_PRIORITY))); + getIntAttribute(rootElement, "priority", DEFAULT_PRIORITY))); // if (registry != null) { // registry.registerPlugin(this); @@ -140,9 +140,9 @@ final ArrayList<PluginPrerequisiteModel> reqList = new ArrayList<PluginPrerequisiteModel>(); RuntimeModel runtime = null; - initializeRequiresList(reqList, e); + initializeRequiresList(reqList, rootElement); - for (final XMLElement childE : e.getChildren()) { + for (final XMLElement childE : rootElement.getChildren()) { final String tag = childE.getName(); if (tag.equals("extension-point")) { final ExtensionPointModel ep = new ExtensionPointModel(this, Modified: trunk/core/src/core/org/jnode/plugin/model/PluginPrerequisiteModel.java =================================================================== --- trunk/core/src/core/org/jnode/plugin/model/PluginPrerequisiteModel.java 2012-12-21 15:21:18 UTC (rev 5942) +++ trunk/core/src/core/org/jnode/plugin/model/PluginPrerequisiteModel.java 2012-12-27 15:08:56 UTC (rev 5943) @@ -29,7 +29,7 @@ */ final class PluginPrerequisiteModel extends PluginModelObject implements PluginPrerequisite { - private final String plugin; + private final String pluginIdentifier; private final String version; /** @@ -42,7 +42,7 @@ public PluginPrerequisiteModel(PluginDescriptorModel plugin, XMLElement e) throws PluginException { super(plugin); - this.plugin = getAttribute(e, "plugin", true); + this.pluginIdentifier = getAttribute(e, "plugin", true); final String version = getAttribute(e, "version", false); if (version != null) { this.version = version; @@ -55,19 +55,19 @@ * Initialize this instance. * * @param plugin - * @param pluginId + * @param pluginIdentifier * @param pluginVersion */ public PluginPrerequisiteModel(PluginDescriptorModel plugin, - String pluginId, String pluginVersion) { + String pluginIdentifier, String pluginVersion) { super(plugin); - if (pluginId == null) { + if (pluginIdentifier == null) { throw new IllegalArgumentException("pluginId is null"); } if (pluginVersion == null) { throw new IllegalArgumentException("pluginVersion is null"); } - this.plugin = pluginId; + this.pluginIdentifier = pluginIdentifier; this.version = pluginVersion; } @@ -75,7 +75,7 @@ * Gets the identifier of the plugin that is required */ public String getPluginId() { - return plugin; + return pluginIdentifier; } @@ -97,9 +97,9 @@ */ protected void resolve(PluginRegistryModel registry) throws PluginException { - if (registry.getPluginDescriptor(plugin) == null) { + if (registry.getPluginDescriptor(pluginIdentifier) == null) { throw new PluginException( - "Unknown plugin " + plugin + " in import of " + getDeclaringPluginDescriptor().getId()); + "Unknown plugin " + pluginIdentifier + " in import of " + getDeclaringPluginDescriptor().getId()); } } Added: trunk/core/src/test/org/jnode/plugin/model/PluginDescriptorModelTest.java =================================================================== --- trunk/core/src/test/org/jnode/plugin/model/PluginDescriptorModelTest.java (rev 0) +++ trunk/core/src/test/org/jnode/plugin/model/PluginDescriptorModelTest.java 2012-12-27 15:08:56 UTC (rev 5943) @@ -0,0 +1,110 @@ +package org.jnode.plugin.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.jnode.nanoxml.XMLElement; +import org.jnode.plugin.Extension; +import org.jnode.plugin.PluginException; +import org.jnode.plugin.PluginPrerequisite; +import org.jnode.plugin.PluginReference; +import org.junit.Before; +import org.junit.Test; + +public class PluginDescriptorModelTest { + + private PluginDescriptorModel model; + + @Before + public void setUp() throws PluginException { + XMLElement element = new XMLElement(); + element.parseString("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plugin SYSTEM \"jnode.dtd\"><plugin id=\"model1\" name=\"model1 name\" version=\"version\" provider-name=\"provider\" license-name=\"lgpl\"><requires><import plugin=\"plug1\"/><import plugin=\"plug2\"/></requires><runtime><library name=\"plugin.jar\"><export name=\"content.*\"/></library></runtime><extension point=\"extension\"><alias name=\"alias\" class=\"class\"/></extension></plugin>"); + model = new PluginDescriptorModel(element); + } + + @Test + public void testGetId() { + assertEquals("model1", model.getId()); + } + + @Test + public void testGetName() { + assertEquals("model1 name", model.getName()); + } + + @Test + public void testGetVersion() { + assertEquals("version", model.getVersion()); + } + + @Test + public void testGetProvider() { + assertEquals("provider", model.getProviderName()); + assertNull(model.getProviderUrl()); + } + + @Test + public void testGetLicence() { + assertEquals("lgpl", model.getLicenseName()); + assertNull(model.getLicenseUrl()); + } + + @Test + public void testGetPrerequisites() { + PluginPrerequisite[] prerequisites = model.getPrerequisites(); + assertEquals(2, prerequisites.length); + + } + + @Test + public void testDependencyFound() { + assertTrue(model.depends("plug1")); + } + + @Test + public void testDependencyNotFound() { + assertFalse(model.depends("plug3")); + } + + @Test + public void testGetExtension() { + Extension[] extensions = model.getExtensions(); + assertEquals(1, extensions.length); + } + + @Test + public void testGetRuntime() { + org.jnode.plugin.Runtime runtime = model.getRuntime(); + assertEquals(1, runtime.getLibraries().length); + } + + @Test + public void testHasCustomPluginClass() { + assertFalse(model.hasCustomPluginClass()); + } + + @Test + public void testIsAutoStart() { + assertFalse(model.isAutoStart()); + } + + @Test + public void testNoPriorityDefined() { + assertEquals(5, model.getPriority()); + } + + @Test + public void testToString() { + assertEquals("model1", model.toString()); + model.getPluginReference(); + } + + @Test + public void testGetPluginReference() { + PluginReference reference = model.getPluginReference(); + assertEquals("model1", reference.getId()); + assertEquals("version", reference.getVersion()); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2012-12-21 15:21:25
|
Revision: 5942 http://jnode.svn.sourceforge.net/jnode/?rev=5942&view=rev Author: galatnm Date: 2012-12-21 15:21:18 +0000 (Fri, 21 Dec 2012) Log Message: ----------- NET : fix padding when no statistics. Modified Paths: -------------- trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java Modified: trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java =================================================================== --- trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java 2012-12-21 15:17:21 UTC (rev 5941) +++ trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java 2012-12-21 15:21:18 UTC (rev 5942) @@ -73,6 +73,7 @@ throws NetworkException { final Statistic[] statistics = stat.getStatistics(); if (statistics.length == 0) { + padOutput(out, padSize); out.print(str_none); } else { StringBuffer buffer = new StringBuffer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2012-12-21 15:17:32
|
Revision: 5941 http://jnode.svn.sourceforge.net/jnode/?rev=5941&view=rev Author: galatnm Date: 2012-12-21 15:17:21 +0000 (Fri, 21 Dec 2012) Log Message: ----------- NET : fix padding for netstat command output. Modified Paths: -------------- trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java Modified: trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java =================================================================== --- trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java 2012-12-21 15:07:28 UTC (rev 5940) +++ trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java 2012-12-21 15:17:21 UTC (rev 5941) @@ -60,7 +60,6 @@ private void showStats(PrintWriter out, NetworkLayer nl, int maxWidth) throws NetworkException { out.format(fmt_stat, nl.getName(), nl.getProtocolID()); - padOutput(out, 4); showStats(out, nl.getStatistics(), 4); for (TransportLayer tl : nl.getTransportLayers()) { padOutput(out, 4); @@ -72,20 +71,27 @@ private void showStats(PrintWriter out, Statistics stat, int padSize) throws NetworkException { - padOutput(out, padSize); final Statistic[] statistics = stat.getStatistics(); if (statistics.length == 0) { out.print(str_none); } else { StringBuffer buffer = new StringBuffer(); for(Statistic statistic : statistics){ - buffer.append(statistic.getName()).append(' ').append(statistic.getValue()).append("\n"); + buffer.append(paddedString(padSize)).append(statistic.getName()).append(' ').append(statistic.getValue()).append("\n"); } out.print(buffer.toString()); } out.println(); } + private String paddedString(int padSize) { + String result = ""; + for(int i = 0; i < padSize; i++){ + result += " "; + } + return result; + } + private void padOutput(PrintWriter out, int size) { for(int i = 0; i < size; i++){ out.print(" "); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2012-12-21 15:07:40
|
Revision: 5940 http://jnode.svn.sourceforge.net/jnode/?rev=5940&view=rev Author: galatnm Date: 2012-12-21 15:07:28 +0000 (Fri, 21 Dec 2012) Log Message: ----------- NET : Improve netstat command output. Modified Paths: -------------- trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java Modified: trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java =================================================================== --- trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java 2012-12-21 14:21:00 UTC (rev 5939) +++ trunk/cli/src/commands/org/jnode/command/net/NetstatCommand.java 2012-12-21 15:07:28 UTC (rev 5940) @@ -36,7 +36,7 @@ public class NetstatCommand extends AbstractCommand { private static final String help_super = "Print statistics for all network devices"; - private static final String fmt_stat = "%s: ID %s"; + private static final String fmt_stat = "%s: ID %s\n"; private static final String str_none = "none"; public NetstatCommand() { @@ -60,42 +60,36 @@ private void showStats(PrintWriter out, NetworkLayer nl, int maxWidth) throws NetworkException { out.format(fmt_stat, nl.getName(), nl.getProtocolID()); - final String prefix = " "; - out.print(prefix); - showStats(out, nl.getStatistics(), maxWidth - prefix.length(), prefix); + padOutput(out, 4); + showStats(out, nl.getStatistics(), 4); for (TransportLayer tl : nl.getTransportLayers()) { - out.print(prefix); + padOutput(out, 4); out.format(fmt_stat, tl.getName(), tl.getProtocolID()); - final String prefix2 = prefix + prefix; - out.print(prefix2); - showStats(out, tl.getStatistics(), maxWidth - prefix2.length(), prefix2); + showStats(out, tl.getStatistics(),8); } out.println(); } - private void showStats(PrintWriter out, Statistics stat, int maxWidth, String prefix) + private void showStats(PrintWriter out, Statistics stat, int padSize) throws NetworkException { - final Statistic[] list = stat.getStatistics(); - if (list.length == 0) { + padOutput(out, padSize); + final Statistic[] statistics = stat.getStatistics(); + if (statistics.length == 0) { out.print(str_none); } else { - int width = 0; - for (int i = 0; i < list.length; i++) { - final Statistic st = list[i]; - String msg = st.getName() + ' ' + st.getValue(); - if (i + 1 < list.length) { - msg = msg + ", "; - } - if (width + msg.length() > maxWidth) { - out.println(); - out.print(prefix); - width = 0; - } - out.print(msg); - width += msg.length(); - } + StringBuffer buffer = new StringBuffer(); + for(Statistic statistic : statistics){ + buffer.append(statistic.getName()).append(' ').append(statistic.getValue()).append("\n"); + } + out.print(buffer.toString()); } out.println(); } + + private void padOutput(PrintWriter out, int size) { + for(int i = 0; i < size; i++){ + out.print(" "); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2012-12-21 14:21:09
|
Revision: 5939 http://jnode.svn.sourceforge.net/jnode/?rev=5939&view=rev Author: galatnm Date: 2012-12-21 14:21:00 +0000 (Fri, 21 Dec 2012) Log Message: ----------- NET : Fix ping command. Modified Paths: -------------- trunk/cli/src/commands/org/jnode/command/net/PingCommand.java Modified: trunk/cli/src/commands/org/jnode/command/net/PingCommand.java =================================================================== --- trunk/cli/src/commands/org/jnode/command/net/PingCommand.java 2012-12-21 14:01:09 UTC (rev 5938) +++ trunk/cli/src/commands/org/jnode/command/net/PingCommand.java 2012-12-21 14:21:00 UTC (rev 5939) @@ -110,7 +110,7 @@ SocketBuffer packet = new SocketBuffer(); packet.insert(this.size); - ICMPEchoHeader transportHeader = new ICMPEchoHeader(8, id_count, seq_count); + ICMPEchoHeader transportHeader = new ICMPEchoHeader(id_count, seq_count); transportHeader.prefixTo(packet); Request r = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2012-12-21 14:01:17
|
Revision: 5938 http://jnode.svn.sourceforge.net/jnode/?rev=5938&view=rev Author: galatnm Date: 2012-12-21 14:01:09 +0000 (Fri, 21 Dec 2012) Log Message: ----------- NET : ICMP improvements. Modified Paths: -------------- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPAddressMaskHeader.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPConstants.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPEchoHeader.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPExHeader.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPHeader.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPProtocol.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPTimestampHeader.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPUnreachableHeader.java Added Paths: ----------- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPHeaderFactory.java trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPType.java Modified: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPAddressMaskHeader.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPAddressMaskHeader.java 2012-12-21 13:50:22 UTC (rev 5937) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPAddressMaskHeader.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -33,9 +33,9 @@ /** * @param type */ - public ICMPAddressMaskHeader(int type, int identifier, int seqNumber, IPv4Address subnetMask) { + public ICMPAddressMaskHeader(ICMPType type, int identifier, int seqNumber, IPv4Address subnetMask) { super(type, 0, identifier, seqNumber); - if ((type != ICMP_ADDRESS) && (type != ICMP_ADDRESSREPLY)) { + if ((type != ICMPType.ICMP_ADDRESS) && (type != ICMPType.ICMP_ADDRESSREPLY)) { throw new IllegalArgumentException("Invalid type " + type); } this.subnetMask = subnetMask; @@ -46,8 +46,8 @@ */ public ICMPAddressMaskHeader(SocketBuffer skbuf) { super(skbuf); - final int type = getType(); - if ((type != ICMP_ADDRESS) && (type != ICMP_ADDRESSREPLY)) { + final ICMPType type = getType(); + if ((type != ICMPType.ICMP_ADDRESS) && (type != ICMPType.ICMP_ADDRESSREPLY)) { throw new IllegalArgumentException("Invalid type " + type); } this.subnetMask = new IPv4Address(skbuf, 8); Modified: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPConstants.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPConstants.java 2012-12-21 13:50:22 UTC (rev 5937) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPConstants.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -25,22 +25,6 @@ */ public interface ICMPConstants { - public static final int ICMP_ECHOREPLY = 0; /* Echo Reply */ - public static final int ICMP_DEST_UNREACH = 3; /* Destination Unreachable */ - public static final int ICMP_SOURCE_QUENCH = 4; /* Source Quench */ - public static final int ICMP_REDIRECT = 5; /* Redirect (change route) */ - public static final int ICMP_ECHO = 8; /* Echo Request */ - public static final int ICMP_TIME_EXCEEDED = 11; /* Time Exceeded */ - public static final int ICMP_PARAMETERPROB = 12; /* Parameter Problem */ - public static final int ICMP_TIMESTAMP = 13; /* Timestamp Request */ - public static final int ICMP_TIMESTAMPREPLY = 14; /* Timestamp Reply */ - public static final int ICMP_INFO_REQUEST = 15; /* Information Request */ - public static final int ICMP_INFO_REPLY = 16; /* Information Reply */ - public static final int ICMP_ADDRESS = 17; /* Address Mask Request */ - public static final int ICMP_ADDRESSREPLY = 18; /* Address Mask Reply */ - public static final int NR_ICMP_TYPES = 18; - - /* Codes for UNREACH. */ public static final int ICMP_NET_UNREACH = 0; /* Network Unreachable */ public static final int ICMP_HOST_UNREACH = 1; /* Host Unreachable */ Modified: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPEchoHeader.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPEchoHeader.java 2012-12-21 13:50:22 UTC (rev 5937) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPEchoHeader.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -32,10 +32,15 @@ * @param identifier * @param seqNumber */ - public ICMPEchoHeader(int type, int identifier, int seqNumber) { + public ICMPEchoHeader(ICMPType type, int identifier, int seqNumber) { super(type, 0, identifier, seqNumber); } + public ICMPEchoHeader(int identifier, int seqNumber) { + super(ICMPType.ICMP_ECHO, 0, identifier, seqNumber); + } + + /** * @param skbuf */ @@ -58,9 +63,9 @@ * @return A header that is a suitable reply to this message */ public ICMPEchoHeader createReplyHeader() { - if (getType() != ICMP_ECHO) { + if (getType() != ICMPType.ICMP_ECHO) { throw new IllegalArgumentException("Not an echo request"); } - return new ICMPEchoHeader(ICMP_ECHOREPLY, getIdentifier(), getSeqNumber()); + return new ICMPEchoHeader(ICMPType.ICMP_ECHOREPLY, getIdentifier(), getSeqNumber()); } } Modified: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPExHeader.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPExHeader.java 2012-12-21 13:50:22 UTC (rev 5937) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPExHeader.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -35,7 +35,7 @@ /** * @param type */ - public ICMPExHeader(int type, int code, int identifier, int seqNumber) { + public ICMPExHeader(ICMPType type, int code, int identifier, int seqNumber) { super(type, code); this.identifier = identifier; this.seqNumber = seqNumber; Modified: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPHeader.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPHeader.java 2012-12-21 13:50:22 UTC (rev 5937) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPHeader.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -30,7 +30,7 @@ */ public abstract class ICMPHeader implements TransportLayerHeader, ICMPConstants { - private final int type; + private final ICMPType type; private final int code; private final boolean checksumOk; @@ -40,10 +40,7 @@ * @param type * @param code */ - public ICMPHeader(int type, int code) { - if ((type < 0) || (type > NR_ICMP_TYPES)) { - throw new IllegalArgumentException("Invalid type " + type); - } + public ICMPHeader(ICMPType type, int code) { if (code < 0) { throw new IllegalArgumentException("Invalid code " + code); } @@ -58,7 +55,7 @@ * @param skbuf */ public ICMPHeader(SocketBuffer skbuf) { - this.type = skbuf.get(0); + this.type = ICMPType.getType(skbuf.get(0)); this.code = skbuf.get(1); final int dataLength = ((IPv4Header) skbuf.getNetworkLayerHeader()).getDataLength(); final int ccs = IPv4Utils.calcChecksum(skbuf, 0, dataLength); @@ -70,7 +67,7 @@ */ public void prefixTo(SocketBuffer skbuf) { skbuf.insert(getLength()); - skbuf.set(0, type); + skbuf.set(0, type.getId()); skbuf.set(1, code); skbuf.set16(2, 0); // Checksum, overwritten later doPrefixTo(skbuf); @@ -114,7 +111,7 @@ /** * Gets the type field */ - public int getType() { + public ICMPType getType() { return type; } Added: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPHeaderFactory.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPHeaderFactory.java (rev 0) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPHeaderFactory.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -0,0 +1,46 @@ +package org.jnode.net.ipv4.icmp; + +import java.net.SocketException; + +import org.jnode.net.SocketBuffer; + +public class ICMPHeaderFactory { + + /** + * Create a type specific ICMP header. The type is read from the first first + * in the skbuf. + * + * @param skbuf + * @throws SocketException + */ + public static ICMPHeader createHeader(SocketBuffer skbuf) throws SocketException { + final ICMPType type = ICMPType.getType(skbuf.get(0)); + switch (type) { + case ICMP_DEST_UNREACH: + return new ICMPUnreachableHeader(skbuf); + + case ICMP_TIMESTAMP: + case ICMP_TIMESTAMPREPLY: + return new ICMPTimestampHeader(skbuf); + + case ICMP_ADDRESS: + case ICMP_ADDRESSREPLY: + return new ICMPAddressMaskHeader(skbuf); + + case ICMP_ECHOREPLY: + case ICMP_ECHO: + return new ICMPEchoHeader(skbuf); + + case ICMP_SOURCE_QUENCH: + case ICMP_REDIRECT: + case ICMP_TIME_EXCEEDED: + case ICMP_PARAMETERPROB: + case ICMP_INFO_REQUEST: + case ICMP_INFO_REPLY: + throw new SocketException("Not implemented"); + default: + throw new SocketException("Unknown ICMP type " + type); + } + } + +} Modified: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPProtocol.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPProtocol.java 2012-12-21 13:50:22 UTC (rev 5937) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPProtocol.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -44,7 +44,9 @@ public class ICMPProtocol implements IPv4Protocol, IPv4Constants, ICMPConstants, QueueProcessor<SocketBuffer> { - /** My logger */ + private static final String IPNAME_ICMP = "icmp"; + + /** My logger */ private Logger log = Logger.getLogger(getClass()); /** The IP service we're a part of */ @@ -77,7 +79,7 @@ * @see org.jnode.net.ipv4.IPv4Protocol#getName() */ public String getName() { - return "icmp"; + return IPNAME_ICMP; } /** @@ -96,7 +98,7 @@ stat.ipackets.inc(); try { - final ICMPHeader hdr = createHeader(skbuf); + final ICMPHeader hdr = ICMPHeaderFactory.createHeader(skbuf); skbuf.setTransportLayerHeader(hdr); skbuf.pull(hdr.getLength()); @@ -181,43 +183,8 @@ send(ipReplyHdr, hdr.createReplyHeader(), new SocketBuffer(skbuf)); } - /** - * Create a type specific ICMP header. The type is read from the first first - * in the skbuf. - * - * @param skbuf - * @throws SocketException - */ - private ICMPHeader createHeader(SocketBuffer skbuf) throws SocketException { - final int type = skbuf.get(0); - switch (type) { - case ICMP_DEST_UNREACH: - return new ICMPUnreachableHeader(skbuf); + - case ICMP_TIMESTAMP: - case ICMP_TIMESTAMPREPLY: - return new ICMPTimestampHeader(skbuf); - - case ICMP_ADDRESS: - case ICMP_ADDRESSREPLY: - return new ICMPAddressMaskHeader(skbuf); - - case ICMP_ECHOREPLY: - case ICMP_ECHO: - return new ICMPEchoHeader(skbuf); - - case ICMP_SOURCE_QUENCH: - case ICMP_REDIRECT: - case ICMP_TIME_EXCEEDED: - case ICMP_PARAMETERPROB: - case ICMP_INFO_REQUEST: - case ICMP_INFO_REPLY: - throw new SocketException("Not implemented"); - default: - throw new SocketException("Unknown ICMP type " + type); - } - } - /** * @see org.jnode.net.ipv4.IPv4Protocol#getStatistics() */ @@ -242,13 +209,11 @@ private void processReplyRequest(SocketBuffer skbuf) { final ICMPHeader hdr = (ICMPHeader) skbuf.getTransportLayerHeader(); try { - switch (hdr.getType()) { - case ICMP_ECHO: + if(hdr.getType() == ICMPType.ICMP_ECHO) { sendEchoReply((ICMPEchoHeader) hdr, skbuf); - break; } } catch (SocketException ex) { - log.debug("Error in ICMP reply", ex); + log.error("Error in ICMP reply", ex); } } Modified: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPTimestampHeader.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPTimestampHeader.java 2012-12-21 13:50:22 UTC (rev 5937) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPTimestampHeader.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -39,10 +39,10 @@ * @param receiveTimestamp * @param transmitTimestamp */ - public ICMPTimestampHeader(int type, int identifier, int seqNumber, int originateTimestamp, + public ICMPTimestampHeader(ICMPType type, int identifier, int seqNumber, int originateTimestamp, int receiveTimestamp, int transmitTimestamp) { super(type, 0, identifier, seqNumber); - if ((type != ICMP_TIMESTAMP) && (type != ICMP_TIMESTAMPREPLY)) { + if ((type != ICMPType.ICMP_TIMESTAMP) && (type != ICMPType.ICMP_TIMESTAMPREPLY)) { throw new IllegalArgumentException("Invalid type " + type); } this.originateTimestamp = originateTimestamp; @@ -55,8 +55,8 @@ */ public ICMPTimestampHeader(SocketBuffer skbuf) { super(skbuf); - final int type = getType(); - if ((type != ICMP_TIMESTAMP) && (type != ICMP_TIMESTAMPREPLY)) { + final ICMPType type = getType(); + if ((type != ICMPType.ICMP_TIMESTAMP) && (type != ICMPType.ICMP_TIMESTAMPREPLY)) { throw new IllegalArgumentException("Invalid type " + type); } this.originateTimestamp = skbuf.get32(8); Added: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPType.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPType.java (rev 0) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPType.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -0,0 +1,35 @@ +package org.jnode.net.ipv4.icmp; + +public enum ICMPType { + ICMP_ECHOREPLY(0), /* Echo Reply */ + ICMP_DEST_UNREACH(3), /* Destination Unreachable */ + ICMP_SOURCE_QUENCH(4), /* Source Quench */ + ICMP_REDIRECT(5), /* Redirect (change route) */ + ICMP_ECHO(8), /* Echo Request */ + ICMP_TIME_EXCEEDED(11), /* Time Exceeded */ + ICMP_PARAMETERPROB(12), /* Parameter Problem */ + ICMP_TIMESTAMP(13), /* Timestamp Request */ + ICMP_TIMESTAMPREPLY(14), /* Timestamp Reply */ + ICMP_INFO_REQUEST(15), /* Information Request */ + ICMP_INFO_REPLY(16), /* Information Reply */ + ICMP_ADDRESS(17), /* Address Mask Request */ + ICMP_ADDRESSREPLY(18); /* Address Mask Reply */ + + private int id; + + private ICMPType(int id){ + this.id = id; + } + + public int getId() { + return id; + } + + public static ICMPType getType(int id){ + for(ICMPType t : ICMPType.values()){ + return t; + } + return null; + } + +} Modified: trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPUnreachableHeader.java =================================================================== --- trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPUnreachableHeader.java 2012-12-21 13:50:22 UTC (rev 5937) +++ trunk/net/src/net/org/jnode/net/ipv4/icmp/ICMPUnreachableHeader.java 2012-12-21 14:01:09 UTC (rev 5938) @@ -31,7 +31,7 @@ * @param code */ public ICMPUnreachableHeader(int code) { - super(ICMP_DEST_UNREACH, code); + super(ICMPType.ICMP_DEST_UNREACH, code); } /** @@ -39,8 +39,8 @@ */ public ICMPUnreachableHeader(SocketBuffer skbuf) { super(skbuf); - final int type = getType(); - if (type != ICMP_DEST_UNREACH) { + final ICMPType type = getType(); + if (type != ICMPType.ICMP_DEST_UNREACH) { throw new IllegalArgumentException("Invalid type " + type); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2012-12-21 13:50:32
|
Revision: 5937 http://jnode.svn.sourceforge.net/jnode/?rev=5937&view=rev Author: galatnm Date: 2012-12-21 13:50:22 +0000 (Fri, 21 Dec 2012) Log Message: ----------- NET : ARP improvements + basic tests. Modified Paths: -------------- trunk/net/src/net/org/jnode/net/arp/ARPCache.java trunk/net/src/net/org/jnode/net/arp/ARPCacheEntry.java trunk/net/src/net/org/jnode/net/arp/ARPHeader.java trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java Added Paths: ----------- trunk/net/src/net/org/jnode/net/arp/ARPOperation.java trunk/net/src/test/org/jnode/net/ trunk/net/src/test/org/jnode/net/arp/ trunk/net/src/test/org/jnode/net/arp/ARPHeaderTest.java Removed Paths: ------------- trunk/net/src/net/org/jnode/net/arp/ARPConstants.java Modified: trunk/net/src/net/org/jnode/net/arp/ARPCache.java =================================================================== --- trunk/net/src/net/org/jnode/net/arp/ARPCache.java 2012-12-19 08:38:08 UTC (rev 5936) +++ trunk/net/src/net/org/jnode/net/arp/ARPCache.java 2012-12-21 13:50:22 UTC (rev 5937) @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.Map; import org.apache.log4j.Logger; import org.jnode.net.HardwareAddress; @@ -35,33 +36,33 @@ */ public class ARPCache { - /** My logger */ private static final Logger log = Logger.getLogger(ARPCache.class); - private final HashMap<HardwareAddress, ARPCacheEntry> hw2p = + + private final Map<HardwareAddress, ARPCacheEntry> networkToProtocolAddresses = new HashMap<HardwareAddress, ARPCacheEntry>(); - private final HashMap<ProtocolAddress, ARPCacheEntry> p2hw = + + private final Map<ProtocolAddress, ARPCacheEntry> protocolToNetworkAddresses = new HashMap<ProtocolAddress, ARPCacheEntry>(); /** * Remove all cached entries */ public synchronized void clear() { - hw2p.clear(); - p2hw.clear(); + networkToProtocolAddresses.clear(); + protocolToNetworkAddresses.clear(); } /** - * Update/Add an extry to the cache + * Update/Add an entry to the cache * - * @param hwAddress - * @param pAddress + * @param hardwareAddress Network address + * @param protocolAddress Protocol address */ - public synchronized void set(HardwareAddress hwAddress, ProtocolAddress pAddress, + public synchronized void set(HardwareAddress hardwareAddress, ProtocolAddress protocolAddress, boolean dynamic) { - final ARPCacheEntry entry = new ARPCacheEntry(hwAddress, pAddress, dynamic); - hw2p.put(hwAddress, entry); - p2hw.put(pAddress, entry); - // log.debug("Adding ARP cache " + hwAddress + " - " + pAddress); + final ARPCacheEntry entry = new ARPCacheEntry(hardwareAddress, protocolAddress, dynamic); + networkToProtocolAddresses.put(hardwareAddress, entry); + protocolToNetworkAddresses.put(protocolAddress, entry); notifyAll(); } @@ -69,18 +70,18 @@ * Gets the cached netword address for the given protocol address, or null * if not found. * - * @param pAddress + * @param protocolAddress */ - public synchronized HardwareAddress get(ProtocolAddress pAddress) { - final ARPCacheEntry entry = (ARPCacheEntry) p2hw.get(pAddress); + public synchronized HardwareAddress get(ProtocolAddress protocolAddress) { + final ARPCacheEntry entry = protocolToNetworkAddresses.get(protocolAddress); if (entry == null) { return null; } if (entry.isExpired()) { log.debug("Removing expired ARP entry " + entry); - p2hw.remove(pAddress); - if (hw2p.get(entry.getHwAddress()) == entry) { - hw2p.remove(entry.getHwAddress()); + protocolToNetworkAddresses.remove(protocolAddress); + if (networkToProtocolAddresses.get(entry.getHwAddress()) == entry) { + networkToProtocolAddresses.remove(entry.getHwAddress()); } return null; } @@ -91,17 +92,17 @@ * Gets the cached protocol address for the given netword address, or null * if not found. * - * @param hwAddress + * @param hardwareAddress */ - public synchronized ProtocolAddress get(HardwareAddress hwAddress) { - final ARPCacheEntry entry = (ARPCacheEntry) hw2p.get(hwAddress); + public synchronized ProtocolAddress get(HardwareAddress hardwareAddress) { + final ARPCacheEntry entry = networkToProtocolAddresses.get(hardwareAddress); if (entry == null) { return null; } if (entry.isExpired()) { - hw2p.remove(hwAddress); - if (p2hw.get(entry.getPAddress()) == entry) { - p2hw.remove(entry.getPAddress()); + networkToProtocolAddresses.remove(hardwareAddress); + if (protocolToNetworkAddresses.get(entry.getPAddress()) == entry) { + protocolToNetworkAddresses.remove(entry.getPAddress()); } return null; } @@ -112,7 +113,7 @@ * Return all cache-entries. */ public synchronized Collection<ARPCacheEntry> entries() { - return new ArrayList<ARPCacheEntry>(hw2p.values()); + return new ArrayList<ARPCacheEntry>(networkToProtocolAddresses.values()); } /** Modified: trunk/net/src/net/org/jnode/net/arp/ARPCacheEntry.java =================================================================== --- trunk/net/src/net/org/jnode/net/arp/ARPCacheEntry.java 2012-12-19 08:38:08 UTC (rev 5936) +++ trunk/net/src/net/org/jnode/net/arp/ARPCacheEntry.java 2012-12-21 13:50:22 UTC (rev 5937) @@ -30,22 +30,27 @@ */ public class ARPCacheEntry { - private final long creationTime; - private final HardwareAddress hwAddress; - private final ProtocolAddress pAddress; + private static final long ARP_CACHE_LIFETIME = 10 * 60 * 1000; + + private final long creationTime; + private long lifeTime; + private final HardwareAddress hardwareAddress; + private final ProtocolAddress protocolAddress; private final boolean dynamic; /** * Create a new instance * - * @param hwAddress - * @param pAddress + * @param hardwareAddress + * @param protocolAddress * @param dynamic */ - public ARPCacheEntry(HardwareAddress hwAddress, ProtocolAddress pAddress, boolean dynamic) { - this.hwAddress = hwAddress; - this.pAddress = pAddress; + public ARPCacheEntry(HardwareAddress hardwareAddress, ProtocolAddress protocolAddress, boolean dynamic) { + this.hardwareAddress = hardwareAddress; + this.protocolAddress = protocolAddress; this.creationTime = System.currentTimeMillis(); + // TODO make ARP cache lifetime configurable + this.lifeTime = ARP_CACHE_LIFETIME; this.dynamic = dynamic; } @@ -60,23 +65,21 @@ * Is this entry expired? */ public boolean isExpired() { - final long age = (System.currentTimeMillis() - creationTime); - // TODO make ARP cache lifetime configurable - return (age >= 10 * 60 * 1000); + return ((System.currentTimeMillis() - creationTime) >= lifeTime); } /** * Gets the network address of this entry */ public HardwareAddress getHwAddress() { - return hwAddress; + return hardwareAddress; } /** * Gets the protocol address of this entry */ public ProtocolAddress getPAddress() { - return pAddress; + return protocolAddress; } /** @@ -98,6 +101,6 @@ * @see java.lang.Object#toString() */ public String toString() { - return pAddress + " " + hwAddress + ' ' + ((dynamic) ? "dynamic" : "static"); + return protocolAddress + " " + hardwareAddress + ' ' + ((dynamic) ? "dynamic" : "static"); } } Deleted: trunk/net/src/net/org/jnode/net/arp/ARPConstants.java =================================================================== --- trunk/net/src/net/org/jnode/net/arp/ARPConstants.java 2012-12-19 08:38:08 UTC (rev 5936) +++ trunk/net/src/net/org/jnode/net/arp/ARPConstants.java 2012-12-21 13:50:22 UTC (rev 5937) @@ -1,35 +0,0 @@ -/* - * $Id$ - * - * Copyright (C) 2003-2012 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.jnode.net.arp; - -/** - * @author epr - */ -public interface ARPConstants { - - public static final int ARP_REQUEST = 1; - public static final int ARP_REPLY = 2; - public static final int RARP_REQUEST = 3; - public static final int RARP_REPLY = 4; - - /** Delay between ARP requests */ - public static final int ARP_REQUEST_DELAY = 1500; -} Modified: trunk/net/src/net/org/jnode/net/arp/ARPHeader.java =================================================================== --- trunk/net/src/net/org/jnode/net/arp/ARPHeader.java 2012-12-19 08:38:08 UTC (rev 5936) +++ trunk/net/src/net/org/jnode/net/arp/ARPHeader.java 2012-12-21 13:50:22 UTC (rev 5937) @@ -36,13 +36,15 @@ private final static int ARP_DATA_LENGTH = 28; - private HardwareAddress srcHWAddress; - private ProtocolAddress srcPAddress; - private HardwareAddress targetHWAddress; - private ProtocolAddress targetPAddress; - private int op; - private final int hwtype; - private final int ptype; + private HardwareAddress sourceHardwareAddress; + private ProtocolAddress sourceProtocolAddress; + private HardwareAddress destinationHardwareAddress; + private ProtocolAddress destinationProtocolAddress; + private ARPOperation operation; + private final int hardwareType; + private final int protocolType; + private int hardwareAddressSize; + private int protocolAddressSize; /** * Create a new instance @@ -56,15 +58,17 @@ * @param ptype */ public ARPHeader(HardwareAddress srcHWAddress, ProtocolAddress srcPAddress, - HardwareAddress targetHWAddress, ProtocolAddress targetPAddress, int op, int hwtype, - int ptype) { - this.srcHWAddress = srcHWAddress; - this.srcPAddress = srcPAddress; - this.targetHWAddress = targetHWAddress; - this.targetPAddress = targetPAddress; - this.op = op; - this.hwtype = hwtype; - this.ptype = ptype; + HardwareAddress targetHWAddress, ProtocolAddress targetPAddress, ARPOperation op, int hwtype, + int ptype, int hwSize, int pSize) { + this.sourceHardwareAddress = srcHWAddress; + this.sourceProtocolAddress = srcPAddress; + this.destinationHardwareAddress = targetHWAddress; + this.destinationProtocolAddress = targetPAddress; + this.operation = op; + this.hardwareType = hwtype; + this.protocolType = ptype; + this.hardwareAddressSize = hwSize; + this.protocolAddressSize = pSize; } /** @@ -73,18 +77,18 @@ * @param skbuf */ public ARPHeader(SocketBuffer skbuf) throws SocketException { - hwtype = skbuf.get16(0); - ptype = skbuf.get16(2); - // int hwsize = skbuf.get(4); - // int psize = skbuf.get(5); - op = skbuf.get16(6); - if ((hwtype == 1) && (ptype == EthernetConstants.ETH_P_IP)) { - srcHWAddress = new EthernetAddress(skbuf, 8); - srcPAddress = new IPv4Address(skbuf, 14); - targetHWAddress = new EthernetAddress(skbuf, 18); - targetPAddress = new IPv4Address(skbuf, 24); + hardwareType = skbuf.get16(0); + protocolType = skbuf.get16(2); + hardwareAddressSize = skbuf.get(4); + protocolAddressSize = skbuf.get(5); + operation = ARPOperation.getType(skbuf.get16(6)); + if ((hardwareType == 1) && (protocolType == EthernetConstants.ETH_P_IP)) { + sourceHardwareAddress = new EthernetAddress(skbuf, 8); + sourceProtocolAddress = new IPv4Address(skbuf, 14); + destinationHardwareAddress = new EthernetAddress(skbuf, 18); + destinationProtocolAddress = new IPv4Address(skbuf, 24); } else { - throw new SocketException("Unknown hw,ptype: " + hwtype + ',' + ptype); + throw new SocketException("Unknown hw,ptype: " + hardwareType + ',' + protocolType); } } @@ -92,7 +96,7 @@ * Gets the length of this header in bytes */ public int getLength() { - return (8 + (srcHWAddress.getLength() + srcPAddress.getLength()) * 2); + return (8 + (sourceHardwareAddress.getLength() + sourceProtocolAddress.getLength()) * 2); } /** @@ -101,21 +105,21 @@ * @param skbuf */ public void prefixTo(SocketBuffer skbuf) { - skbuf.insert(8 + (srcHWAddress.getLength() + srcPAddress.getLength()) * 2); + skbuf.insert(8 + (sourceHardwareAddress.getLength() + sourceProtocolAddress.getLength()) * 2); int ofs = 0; - skbuf.set16(ofs + 0, hwtype); - skbuf.set16(ofs + 2, ptype); - skbuf.set(ofs + 4, srcHWAddress.getLength()); - skbuf.set(ofs + 5, srcPAddress.getLength()); - skbuf.set16(ofs + 6, op); + skbuf.set16(ofs + 0, hardwareType); + skbuf.set16(ofs + 2, protocolType); + skbuf.set(ofs + 4, sourceHardwareAddress.getLength()); + skbuf.set(ofs + 5, sourceProtocolAddress.getLength()); + skbuf.set16(ofs + 6, operation.getId()); ofs += 8; - srcHWAddress.writeTo(skbuf, ofs); - ofs += srcHWAddress.getLength(); - srcPAddress.writeTo(skbuf, ofs); - ofs += srcPAddress.getLength(); - targetHWAddress.writeTo(skbuf, ofs); - ofs += targetHWAddress.getLength(); - targetPAddress.writeTo(skbuf, ofs); + sourceHardwareAddress.writeTo(skbuf, ofs); + ofs += sourceHardwareAddress.getLength(); + sourceProtocolAddress.writeTo(skbuf, ofs); + ofs += sourceProtocolAddress.getLength(); + destinationHardwareAddress.writeTo(skbuf, ofs); + ofs += destinationHardwareAddress.getLength(); + destinationProtocolAddress.writeTo(skbuf, ofs); } /** @@ -135,14 +139,14 @@ * Gets the source address of the packet described in this header */ public ProtocolAddress getSourceAddress() { - return srcPAddress; + return sourceProtocolAddress; } /** * Gets the source address of the packet described in this header */ public ProtocolAddress getDestinationAddress() { - return targetPAddress; + return destinationProtocolAddress; } public int getDataLength() { @@ -153,83 +157,93 @@ * Gets the hardware type */ public int getHType() { - return hwtype; + return hardwareType; } /** * Gets the operation */ - public int getOperation() { - return op; + public ARPOperation getOperation() { + return operation; } /** * Gets the protocol type */ public int getPType() { - return ptype; + return protocolType; } /** * Gets the source hardware address */ public HardwareAddress getSrcHWAddress() { - return srcHWAddress; + return sourceHardwareAddress; } /** * Gets the source protocol address */ public ProtocolAddress getSrcPAddress() { - return srcPAddress; + return sourceProtocolAddress; } /** * Gets the target hardware address */ public HardwareAddress getTargetHWAddress() { - return targetHWAddress; + return destinationHardwareAddress; } /** * Gets the target protocol address */ public ProtocolAddress getTargetPAddress() { - return targetPAddress; + return destinationProtocolAddress; } + + public int getHardwareAddressSize() { + return hardwareAddressSize; + } + + public int getProtocolAddressSize() { + return protocolAddressSize; + } /** * Swap the two src and target addresses * */ public void swapAddresses() { - final HardwareAddress hwTmp = targetHWAddress; - final ProtocolAddress pTmp = targetPAddress; - targetHWAddress = srcHWAddress; - targetPAddress = srcPAddress; - srcHWAddress = hwTmp; - srcPAddress = pTmp; + final HardwareAddress hwTmp = destinationHardwareAddress; + final ProtocolAddress pTmp = destinationProtocolAddress; + destinationHardwareAddress = sourceHardwareAddress; + destinationProtocolAddress = sourceProtocolAddress; + sourceHardwareAddress = hwTmp; + sourceProtocolAddress = pTmp; } + /** - * @param i + * + * @param operation */ - public void setOperation(int i) { - op = i; + public void setOperation(ARPOperation operation) { + this.operation = operation; } /** * @param address */ public void setSrcHWAddress(HardwareAddress address) { - srcHWAddress = address; + sourceHardwareAddress = address; } /** * @param address */ public void setSrcPAddress(ProtocolAddress address) { - srcPAddress = address; + sourceProtocolAddress = address; } } Modified: trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java =================================================================== --- trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java 2012-12-19 08:38:08 UTC (rev 5936) +++ trunk/net/src/net/org/jnode/net/arp/ARPNetworkLayer.java 2012-12-21 13:50:22 UTC (rev 5937) @@ -46,14 +46,20 @@ * @author epr */ @SharedStatics -public class ARPNetworkLayer implements NetworkLayer, ARPConstants { - private static final boolean DEBUG = false; +public class ARPNetworkLayer implements NetworkLayer { + + private static final int IPv4_PROTOCOL_SIZE = 4; + /** Delay between ARP requests in millisecond */ + public static final int ARP_REQUEST_DELAY = 1500; + /** * My logger */ private static final Logger log = Logger.getLogger(ARPNetworkLayer.class); + private static final boolean DEBUG = false; + /** * My statistics */ @@ -149,7 +155,7 @@ stat.opackets.inc(); hdr.swapAddresses(); hdr.setSrcHWAddress(deviceAPI.getAddress()); - hdr.setOperation(ARP_REPLY); + hdr.setOperation(ARPOperation.ARP_REPLY); skbuf.clear(); skbuf.setProtocolID(getProtocolID()); hdr.prefixTo(skbuf); @@ -315,11 +321,11 @@ final NetDeviceAPI api = getAPI(device); final HardwareAddress srcHwAddr = api.getAddress(); final HardwareAddress trgHwAddr = srcHwAddr.getDefaultBroadcastAddress(); - final int op = ARP_REQUEST; + final ARPOperation op = ARPOperation.ARP_REQUEST; final int hwtype = srcHwAddr.getType(); final int ptype = address.getType(); - final ARPHeader hdr = new ARPHeader(srcHwAddr, myAddress, trgHwAddr, address, op, hwtype, ptype); + final ARPHeader hdr = new ARPHeader(srcHwAddr, myAddress, trgHwAddr, address, op, hwtype, ptype,EthernetConstants.ETH_ALEN,IPv4_PROTOCOL_SIZE); final SocketBuffer skbuf = new SocketBuffer(); skbuf.setProtocolID(EthernetConstants.ETH_P_ARP); hdr.prefixTo(skbuf); Added: trunk/net/src/net/org/jnode/net/arp/ARPOperation.java =================================================================== --- trunk/net/src/net/org/jnode/net/arp/ARPOperation.java (rev 0) +++ trunk/net/src/net/org/jnode/net/arp/ARPOperation.java 2012-12-21 13:50:22 UTC (rev 5937) @@ -0,0 +1,26 @@ +package org.jnode.net.arp; + + +public enum ARPOperation { + ARP_REQUEST (1), + ARP_REPLY (2), + RARP_REQUEST (3), + RARP_REPLY (4); + + private int id; + + private ARPOperation(int id){ + this.id = id; + } + + public int getId(){ + return this.id; + } + + public static ARPOperation getType(int id){ + for(ARPOperation t : ARPOperation.values()){ + return t; + } + return null; + } +} Added: trunk/net/src/test/org/jnode/net/arp/ARPHeaderTest.java =================================================================== --- trunk/net/src/test/org/jnode/net/arp/ARPHeaderTest.java (rev 0) +++ trunk/net/src/test/org/jnode/net/arp/ARPHeaderTest.java 2012-12-21 13:50:22 UTC (rev 5937) @@ -0,0 +1,40 @@ +package org.jnode.net.arp; + +import static org.junit.Assert.*; + +import java.net.SocketException; + +import org.jnode.net.SocketBuffer; +import org.jnode.net.ethernet.EthernetConstants; +import org.junit.Test; + +public class ARPHeaderTest { + + private static final int ARP_HEADER_LENGTH = 28; + + @Test + public void testHeaderFromSocketBuffer() throws SocketException { + SocketBuffer buffer = getSocketBuffer(); + ARPHeader header = new ARPHeader(buffer); + assertEquals(ARP_HEADER_LENGTH,header.getLength()); + assertEquals(ARPOperation.ARP_REQUEST,header.getOperation()); + assertEquals(1,header.getHType()); + assertEquals(EthernetConstants.ETH_P_IP,header.getPType()); + } + + private SocketBuffer getSocketBuffer() { + SocketBuffer buffer = new SocketBuffer(ARP_HEADER_LENGTH); + buffer.append(ARP_HEADER_LENGTH); + buffer.set16(0, 1); + buffer.set16(2, 0x800); + buffer.set(4, 6); + buffer.set(5, 4); + buffer.set16(6, 1); + buffer.set(8, 0); + buffer.set(14, 0); + buffer.set(18, 0); + buffer.set(24, 0); + return buffer; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2012-12-19 08:38:19
|
Revision: 5936 http://jnode.svn.sourceforge.net/jnode/?rev=5936&view=rev Author: galatnm Date: 2012-12-19 08:38:08 +0000 (Wed, 19 Dec 2012) Log Message: ----------- Various fs patches from Luke Quinane's repository + migrate to intellij 12 Modified Paths: -------------- trunk/JNode.ipr trunk/all/all.iml trunk/builder/builder.iml trunk/core/core.iml trunk/distr/distr.iml trunk/fs/fs.iml trunk/fs/src/fs/org/jnode/fs/FileSystem.java trunk/fs/src/fs/org/jnode/fs/ext2/Ext2File.java trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java trunk/fs/src/fs/org/jnode/fs/fat/FatFileSystem.java trunk/fs/src/fs/org/jnode/fs/ftpfs/FTPFileSystem.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFile.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystem.java trunk/fs/src/fs/org/jnode/fs/hfsplus/HfsPlusFileSystemType.java trunk/fs/src/fs/org/jnode/fs/iso9660/ISO9660FileSystem.java trunk/fs/src/fs/org/jnode/fs/jarfs/JarFileSystem.java trunk/fs/src/fs/org/jnode/fs/jfat/CodePage.java trunk/fs/src/fs/org/jnode/fs/jfat/FatFile.java trunk/fs/src/fs/org/jnode/fs/jfat/FatFileSystem.java trunk/fs/src/fs/org/jnode/fs/jifs/JIFileSystem.java trunk/fs/src/fs/org/jnode/fs/nfs/nfs2/NFS2FileSystem.java trunk/fs/src/fs/org/jnode/fs/ntfs/BootRecord.java trunk/fs/src/fs/org/jnode/fs/ntfs/CompressedDataRun.java trunk/fs/src/fs/org/jnode/fs/ntfs/DataRun.java trunk/fs/src/fs/org/jnode/fs/ntfs/DataRunInterface.java trunk/fs/src/fs/org/jnode/fs/ntfs/FileNameAttribute.java trunk/fs/src/fs/org/jnode/fs/ntfs/FileRecord.java trunk/fs/src/fs/org/jnode/fs/ntfs/IndexEntry.java trunk/fs/src/fs/org/jnode/fs/ntfs/IndexEntryIterator.java trunk/fs/src/fs/org/jnode/fs/ntfs/IndexRootAttribute.java trunk/fs/src/fs/org/jnode/fs/ntfs/MasterFileTable.java trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSEntry.java trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFile.java trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSFileSystem.java trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSNonResidentAttribute.java trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSRecord.java trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSStructure.java trunk/fs/src/fs/org/jnode/fs/ntfs/NTFSVolume.java trunk/fs/src/fs/org/jnode/fs/ramfs/RAMFileSystem.java trunk/fs/src/fs/org/jnode/fs/service/def/VirtualFS.java trunk/fs/src/fs/org/jnode/fs/smbfs/SMBFileSystem.java trunk/gui/gui.iml trunk/jnode.iml trunk/net/net.iml trunk/shell/shell.iml trunk/textui/textui.iml Added Paths: ----------- trunk/fs/src/fs/org/jnode/fs/FSFileSlackSpace.java trunk/fs/src/fs/org/jnode/fs/FSFileStreams.java trunk/fs/src/fs/org/jnode/fs/ntfs/UsnJournalEntry.java Modified: trunk/JNode.ipr =================================================================== --- trunk/JNode.ipr 2012-10-24 07:04:00 UTC (rev 5935) +++ trunk/JNode.ipr 2012-12-19 08:38:08 UTC (rev 5936) @@ -181,7 +181,11 @@ <entry name="?*.jpeg" /> <entry name="?*.jpg" /> </wildcardResourcePatterns> - <annotationProcessing enabled="false" useClasspath="true" /> + <annotationProcessing> + <profile default="true" name="Default" enabled="false"> + <processorPath useClasspath="true" /> + </profile> + </annotationProcessing> </component> <component name="CopyrightManager" default=""> <module2copyright /> @@ -193,6 +197,15 @@ <component name="DependencyValidationManager"> <option name="SKIP_IMPORT_STATEMENTS" value="false" /> </component> + <component name="EclipseCodeFormatter"> + <option name="defaultSettings" value="true" /> + <option name="formatter" value="ECLIPSE" /> + <option name="id" value="1355311468141" /> + <option name="name" value="default" /> + <option name="optimizeImports" value="false" /> + <option name="pathToConfigFileJava" value="$PROJECT_DIR$/../../../../documentation/others/isabel_codingFormat.xml" /> + <option name="selectedJavaProfile" value="isabel" /> + </component> <component name="EclipseCompilerSettings"> <option name="GENERATE_NO_WARNINGS" value="true" /> <option name="DEPRECATION" value="false" /> @@ -224,6 +237,14 @@ <item index="5" class="java.lang.String" itemvalue="ERROR" /> </list> </component> + <component name="IvyIDEA.ProjectSettings"> + <option name="artifactTypeSettings"> + <ArtifactTypeSettings /> + </option> + <option name="propertiesSettings"> + <PropertiesSettings /> + </option> + </component> <component name="JavacSettings"> <option name="MAXIMUM_HEAP_SIZE" value="1024" /> </component> Modified: trunk/all/all.iml =================================================================== --- trunk/all/all.iml 2012-10-24 07:04:00 UTC (rev 5935) +++ trunk/all/all.iml 2012-12-19 08:38:08 UTC (rev 5936) @@ -3,7 +3,6 @@ <component name="NewModuleRootManager" inherit-compiler-output="false"> <output url="file://$MODULE_DIR$/build/classes" /> <exclude-output /> - <exclude-exploded /> <content url="file://$MODULE_DIR$" /> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> Modified: trunk/builder/builder.iml =================================================================== --- trunk/builder/builder.iml 2012-10-24 07:04:00 UTC (rev 5935) +++ trunk/builder/builder.iml 2012-12-19 08:38:08 UTC (rev 5936) @@ -3,7 +3,6 @@ <component name="NewModuleRootManager" inherit-compiler-output="false"> <output url="file://$MODULE_DIR$/build/classes" /> <exclude-output /> - <exclude-exploded /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/builder" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/configure" isTestSource="false" /> Modified: trunk/core/core.iml =================================================================== --- trunk/core/core.iml 2012-10-24 07:04:00 UTC (rev 5935) +++ trunk/core/core.iml 2012-12-19 08:38:08 UTC (rev 5936) @@ -3,7 +3,6 @@ <component name="NewModuleRootManager" inherit-compiler-output="false"> <output url="file://$MODULE_DIR$/build/classes" /> <exclude-output /> - <exclude-exploded /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/classlib" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/classpath/ext" isTestSource="false" /> Modified: trunk/distr/distr.iml =================================================================== --- trunk/distr/distr.iml 2012-10-24 07:04:00 UTC (rev 5935) +++ trunk/distr/distr.iml 2012-12-19 08:38:08 UTC (rev 5936) @@ -3,7 +3,6 @@ <component name="NewModuleRootManager" inherit-compiler-output="false"> <output url="file://$MODULE_DIR$/build/classes" /> <exclude-output /> - <exclude-exploded /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/apps" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/emu" isTestSource="false" /> Modified: trunk/fs/fs.iml =================================================================== --- trunk/fs/fs.iml 2012-10-24 07:04:00 UTC (rev 5935) +++ trunk/fs/fs.iml 2012-12-19 08:38:08 UTC (rev 5936) @@ -6,7 +6,6 @@ <component name="NewModuleRootManager" inherit-compiler-output="false"> <output url="file://$MODULE_DIR$/build/classes" /> <exclude-output /> - <exclude-exploded /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/src/driver" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/fs" isTestSource="false" /> Added: trunk/fs/src/fs/org/jnode/fs/FSFileSlackSpace.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/FSFileSlackSpace.java (rev 0) +++ trunk/fs/src/fs/org/jnode/fs/FSFileSlackSpace.java 2012-12-19 08:38:08 UTC (rev 5936) @@ -0,0 +1,21 @@ +package org.jnode.fs; + +import java.io.IOException; + +/** + * <p> + * Interface for {@link FSFile} implementation that support reading "slack space" at the end of the file data. + * </p> + * <p> + * For example if a filesystem has a block size of 512 bytes and a file is only using 500 bytes then there will be 12 + * bytes of unallocated space at the end of the block that may contain data from a previous file. + * </p> + */ +public interface FSFileSlackSpace { + /** + * Gets the file slack space. + * @return the slack space. + * @throws IOException if an error occurs reading the file. + */ + byte[] getSlackSpace() throws IOException; +} Added: trunk/fs/src/fs/org/jnode/fs/FSFileStreams.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/FSFileStreams.java (rev 0) +++ trunk/fs/src/fs/org/jnode/fs/FSFileStreams.java 2012-12-19 08:38:08 UTC (rev 5936) @@ -0,0 +1,35 @@ +/* + * $Id$ + * + * Copyright (C) 2003-2012 JNode.org + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library 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 Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; If not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.jnode.fs; + +import java.util.Map; + +/** + * A FSFileStreams is a representation of a file system file that can have alternative data streams. + * @author Luke Quinane + */ +public interface FSFileStreams extends FSFile { + /** + * Gets the map of alternate stream names to their file interface. + * @return the mapping. + */ + Map<String, FSFile> getStreams(); +} Modified: trunk/fs/src/fs/org/jnode/fs/FileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/FileSystem.java 2012-10-24 07:04:00 UTC (rev 5935) +++ trunk/fs/src/fs/org/jnode/fs/FileSystem.java 2012-12-19 08:38:08 UTC (rev 5936) @@ -17,95 +17,83 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs; import java.io.IOException; - import org.jnode.driver.Device; /** * The <tt>FileSystem<tt> interface provide methods common to file system implementations. - * * + * * * @param <T> {@link FSEntry} sub-type - * - * @author epr + * @author epr */ public interface FileSystem<T extends FSEntry> { - /** - * Return type of the file system. - * - * @return {@link FileSystemType} corresponding to this file system - */ - public FileSystemType<? extends FileSystem<T>> getType(); + /** + * Return type of the file system. + * @return {@link FileSystemType} corresponding to this file system + */ + public FileSystemType<? extends FileSystem<T>> getType(); - /** - * Gets the device this FS driver operates on. - * - * @return {@link Device} contains this file system. - */ - public Device getDevice(); + /** + * Gets the device this FS driver operates on. + * @return {@link Device} contains this file system. + */ + public Device getDevice(); - /** - * Gets the root entry of this filesystem. This is usually a directory, but - * this is not required. - * - * @return {@link FSEntry} corresponding to root entry. - * - * @throws IOException if an I/O error occurs - */ - public T getRootEntry() throws IOException; + /** + * Gets the root entry of this filesystem. This is usually a directory, but this is not required. + * @return {@link FSEntry} corresponding to root entry. + * @throws IOException if an I/O error occurs + */ + public T getRootEntry() throws IOException; - /** - * Returns <tt>true</tt> if the file system is mounted in read-only mode. - * - * @return <tt>true</tt> if it's a read-only file system. - */ - public boolean isReadOnly(); + /** + * Returns <tt>true</tt> if the file system is mounted in read-only mode. + * @return <tt>true</tt> if it's a read-only file system. + */ + public boolean isReadOnly(); - /** - * Close this file system. After a close, all invocations of method of this - * file system or objects created by this file system will throw an - * IOException. - * - * - * - * @throws IOException if an I/O error occurs - */ - public void close() throws IOException; + /** + * Close this file system. After a close, all invocations of method of this file system or objects created by this + * file system will throw an IOException. + * @throws IOException if an I/O error occurs + */ + public void close() throws IOException; - /** - * Returns <tt>true</tt> if this file system is close. - * - * @return <tt>true</tt> if file system is closed. - */ - public boolean isClosed(); + /** + * Returns <tt>true</tt> if this file system is close. + * @return <tt>true</tt> if file system is closed. + */ + public boolean isClosed(); - /** - * Return The total size in bytes of this file system. - * - * @return total size in bytes or -1 if this feature is unsupported. - * - * @throws IOException if an I/O error occurs - */ - public long getTotalSpace() throws IOException; + /** + * Return The total size in bytes of this file system. + * @return total size in bytes or -1 if this feature is unsupported. + * @throws IOException if an I/O error occurs + */ + public long getTotalSpace() throws IOException; - /** - * The total free space in bytes of this file system. - * - * @return total free space in bytes or -1 if this feature is unsupported - * - * @throws IOException if an I/O error occurs - */ - public long getFreeSpace() throws IOException; + /** + * The total free space in bytes of this file system. + * @return total free space in bytes or -1 if this feature is unsupported + * @throws IOException if an I/O error occurs + */ + public long getFreeSpace() throws IOException; - /** - * The usable space of this file system. - * - * @return usable space in bytes or -1 if this feature is unsupported - * - * @throws IOException if an I/O error occurs - */ - public long getUsableSpace() throws IOException; + /** + * The usable space of this file system. + * @return usable space in bytes or -1 if this feature is unsupported + * @throws IOException if an I/O error occurs + */ + public long getUsableSpace() throws IOException; + + /** + * Gets the volume name for this file system. + * @return the volume name. + * @throws IOException if an error occurs reading the volume name. + */ + public String getVolumeName() throws IOException; } Modified: trunk/fs/src/fs/org/jnode/fs/ext2/Ext2File.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/ext2/Ext2File.java 2012-10-24 07:04:00 UTC (rev 5935) +++ trunk/fs/src/fs/org/jnode/fs/ext2/Ext2File.java 2012-12-19 08:38:08 UTC (rev 5936) @@ -17,13 +17,14 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs.ext2; import java.io.IOException; import java.nio.ByteBuffer; import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.jnode.fs.FSFileSlackSpace; import org.jnode.fs.FileSystemException; import org.jnode.fs.ReadOnlyFileSystemException; import org.jnode.fs.spi.AbstractFSFile; @@ -32,314 +33,330 @@ /** * @author Andras Nagy */ -public class Ext2File extends AbstractFSFile { +public class Ext2File extends AbstractFSFile implements FSFileSlackSpace { - Ext2Entry entry; - INode iNode; + Ext2Entry entry; + INode iNode; - private final Logger log = Logger.getLogger(getClass()); + private final Logger log = Logger.getLogger(getClass()); - public Ext2File(Ext2Entry entry) { - super(entry.getINode().getExt2FileSystem()); - this.iNode = entry.getINode(); - this.entry = entry; - log.setLevel(Level.DEBUG); - } + public Ext2File(Ext2Entry entry) { + super(entry.getINode().getExt2FileSystem()); + this.iNode = entry.getINode(); + this.entry = entry; + log.setLevel(Level.DEBUG); + } - @Override - public long getLength() { - //log.debug("getLength(): "+iNode.getSize()); - return iNode.getSize(); - } + @Override + public long getLength() { + // log.debug("getLength(): "+iNode.getSize()); + return iNode.getSize(); + } - @Override - public void setLength(long length) throws IOException { - if (!canWrite()) - throw new ReadOnlyFileSystemException("FileSystem or File is readonly"); + @Override + public void setLength(long length) throws IOException { + if (!canWrite()) throw new ReadOnlyFileSystemException("FileSystem or File is readonly"); - long blockSize = iNode.getExt2FileSystem().getBlockSize(); + long blockSize = iNode.getExt2FileSystem().getBlockSize(); - //synchronize to the inode cache to make sure that the inode does not - // get - //flushed between reading it and locking it - synchronized (((Ext2FileSystem) getFileSystem()).getInodeCache()) { - //reread the inode before synchronizing to it to make sure - //all threads use the same instance - rereadInode(); + // synchronize to the inode cache to make sure that the inode does not + // get + // flushed between reading it and locking it + synchronized (((Ext2FileSystem) getFileSystem()).getInodeCache()) { + // reread the inode before synchronizing to it to make sure + // all threads use the same instance + rereadInode(); - //lock the inode into the cache so it is not flushed before - // synchronizing to it - //(otherwise a new instance of INode referring to the same inode - // could be put - //in the cache resulting in the possibility of two threads - // manipulating the same - //inode at the same time because they would synchronize to - // different INode instances) - iNode.incLocked(); - } - //a single inode may be represented by more than one Ext2Directory - // instances, - //but each will use the same instance of the underlying inode (see - // Ext2FileSystem.getINode()), - //so synchronize to the inode - synchronized (iNode) { - try { - //if length<getLength(), then the file is truncated - if (length < getLength()) { - long blockNr = length / blockSize; - long blockOffset = length % blockSize; - long nextBlock; - if (blockOffset == 0) - nextBlock = blockNr; - else - nextBlock = blockNr + 1; + // lock the inode into the cache so it is not flushed before + // synchronizing to it + // (otherwise a new instance of INode referring to the same inode + // could be put + // in the cache resulting in the possibility of two threads + // manipulating the same + // inode at the same time because they would synchronize to + // different INode instances) + iNode.incLocked(); + } + // a single inode may be represented by more than one Ext2Directory + // instances, + // but each will use the same instance of the underlying inode (see + // Ext2FileSystem.getINode()), + // so synchronize to the inode + synchronized (iNode) { + try { + // if length<getLength(), then the file is truncated + if (length < getLength()) { + long blockNr = length / blockSize; + long blockOffset = length % blockSize; + long nextBlock; + if (blockOffset == 0) nextBlock = blockNr; + else nextBlock = blockNr + 1; - for (long i = iNode.getAllocatedBlockCount() - 1; i >= nextBlock; i--) { - log.debug("setLength(): freeing up block " + i + " of inode"); - iNode.freeDataBlock(i); - } - iNode.setSize(length); + for(long i = iNode.getAllocatedBlockCount() - 1; i >= nextBlock; i--) { + log.debug("setLength(): freeing up block " + i + " of inode"); + iNode.freeDataBlock(i); + } + iNode.setSize(length); - iNode.setMtime(System.currentTimeMillis() / 1000); + iNode.setMtime(System.currentTimeMillis() / 1000); - return; - } + return; + } - //if length>getLength(), then new blocks are allocated for the - // file - //The content of the new blocks is undefined (see the - // setLength(long i) - //method of java.io.RandomAccessFile - if (length > getLength()) { - long len = length - getLength(); - long blocksAllocated = getLengthInBlocks(); - long bytesAllocated = getLength(); - long bytesCovered = 0; - while (bytesCovered < len) { - long blockIndex = (bytesAllocated + bytesCovered) / blockSize; - long blockOffset = (bytesAllocated + bytesCovered) % blockSize; - long newSection = Math.min(len - bytesCovered, blockSize - blockOffset); + // if length>getLength(), then new blocks are allocated for the + // file + // The content of the new blocks is undefined (see the + // setLength(long i) + // method of java.io.RandomAccessFile + if (length > getLength()) { + long len = length - getLength(); + long blocksAllocated = getLengthInBlocks(); + long bytesAllocated = getLength(); + long bytesCovered = 0; + while (bytesCovered < len) { + long blockIndex = (bytesAllocated + bytesCovered) / blockSize; + long blockOffset = (bytesAllocated + bytesCovered) % blockSize; + long newSection = Math.min(len - bytesCovered, blockSize - blockOffset); - //allocate a new block if needed - if (blockIndex >= blocksAllocated) { - iNode.allocateDataBlock(blockIndex); - blocksAllocated++; - } + // allocate a new block if needed + if (blockIndex >= blocksAllocated) { + iNode.allocateDataBlock(blockIndex); + blocksAllocated++; + } - bytesCovered += newSection; - } - iNode.setSize(length); + bytesCovered += newSection; + } + iNode.setSize(length); - iNode.setMtime(System.currentTimeMillis() / 1000); + iNode.setMtime(System.currentTimeMillis() / 1000); - return; - } - } catch (Throwable ex) { - final IOException ioe = new IOException(); - ioe.initCause(ex); - throw ioe; - } finally { - //setLength done, unlock the inode from the cache - iNode.decLocked(); - } - } // synchronized(inode) - } + return; + } + } catch (Throwable ex) { + final IOException ioe = new IOException(); + ioe.initCause(ex); + throw ioe; + } finally { + // setLength done, unlock the inode from the cache + iNode.decLocked(); + } + } // synchronized(inode) + } + @Override + public void read(long fileOffset, ByteBuffer destBuf) throws IOException { + if (fileOffset + destBuf.remaining() > getLength()) throw new IOException("Can't read past the file!"); + readImpl(fileOffset, destBuf); + } - @Override - public void read(long fileOffset, ByteBuffer destBuf) throws IOException { - final int len = destBuf.remaining(); - final int off = 0; - //TODO optimize it also to use ByteBuffer at lower level - final ByteBufferUtils.ByteArray destBA = ByteBufferUtils.toByteArray(destBuf); - final byte[] dest = destBA.toArray(); + /** + * A read implementation that doesn't check the file length. + * @param fileOffset the offset to read from. + * @param destBuf the destination buffer. + * @throws IOException if an error occurs reading. + */ + public void readImpl(long fileOffset, ByteBuffer destBuf) throws IOException { + final int len = destBuf.remaining(); + final int off = 0; + // TODO optimize it also to use ByteBuffer at lower level + final ByteBufferUtils.ByteArray destBA = ByteBufferUtils.toByteArray(destBuf); + final byte[] dest = destBA.toArray(); - //synchronize to the inode cache to make sure that the inode does not - // get flushed between reading it and locking it - synchronized (((Ext2FileSystem) getFileSystem()).getInodeCache()) { - //reread the inode before synchronizing to it to make sure - //all threads use the same instance - rereadInode(); + // synchronize to the inode cache to make sure that the inode does not + // get flushed between reading it and locking it + synchronized (((Ext2FileSystem) getFileSystem()).getInodeCache()) { + // reread the inode before synchronizing to it to make sure + // all threads use the same instance + rereadInode(); - //lock the inode into the cache so it is not flushed before - // synchronizing to it - //(otherwise a new instance of INode referring to the same inode - // could be put - //in the cache resulting in the possibility of two threads - // manipulating the same - //inode at the same time because they would synchronize to - // different INode instances) - iNode.incLocked(); - } + // lock the inode into the cache so it is not flushed before + // synchronizing to it + // (otherwise a new instance of INode referring to the same inode + // could be put + // in the cache resulting in the possibility of two threads + // manipulating the same + // inode at the same time because they would synchronize to + // different INode instances) + iNode.incLocked(); + } - if (log.isDebugEnabled()) { - log.debug("File:" + entry.getName() + " size:" + getLength() + " read offset: " + fileOffset + " len: " + - dest.length); - } + if (log.isDebugEnabled()) { + log.debug("File:" + entry.getName() + " size:" + getLength() + " read offset: " + fileOffset + " len: " + + dest.length); + } - //a single inode may be represented by more than one Ext2Directory - // instances, - //but each will use the same instance of the underlying inode (see - // Ext2FileSystem.getINode()), - //so synchronize to the inode - synchronized (iNode) { - try { - if (len + off > getLength()) - throw new IOException("Can't read past the file!"); + // a single inode may be represented by more than one Ext2Directory + // instances, + // but each will use the same instance of the underlying inode (see + // Ext2FileSystem.getINode()), + // so synchronize to the inode + synchronized (iNode) { + try { + if ((iNode.getMode() & Ext2Constants.EXT2_S_IFLNK) == Ext2Constants.EXT2_S_IFLNK) { + // Sym-links are a special case: the data seems to be stored inline in the iNode + System.arraycopy(iNode.getINodeBlockData(), 0, dest, 0, Math.min(64, dest.length)); + } else { + long blockSize = iNode.getExt2FileSystem().getBlockSize(); + long bytesRead = 0; + while (bytesRead < len) { + long blockNr = (fileOffset + bytesRead) / blockSize; + long blockOffset = (fileOffset + bytesRead) % blockSize; + long copyLength = Math.min(len - bytesRead, blockSize - blockOffset); - if ((iNode.getMode() & Ext2Constants.EXT2_S_IFLNK) == Ext2Constants.EXT2_S_IFLNK) { - // Sym-links are a special case: the data seems to be stored inline in the iNode - System.arraycopy(iNode.getINodeBlockData(), 0, dest, 0, Math.min(64, dest.length)); - } - else { - long blockSize = iNode.getExt2FileSystem().getBlockSize(); - long bytesRead = 0; - while (bytesRead < len) { - long blockNr = (fileOffset + bytesRead) / blockSize; - long blockOffset = (fileOffset + bytesRead) % blockSize; - long copyLength = Math.min(len - bytesRead, blockSize - blockOffset); + log.debug("blockNr: " + blockNr + ", blockOffset: " + blockOffset + ", copyLength: " + + copyLength + ", bytesRead: " + bytesRead); - log.debug("blockNr: " + blockNr + ", blockOffset: " + blockOffset + ", copyLength: " + copyLength + - ", bytesRead: " + bytesRead); + System.arraycopy(iNode.getDataBlock(blockNr), (int) blockOffset, dest, off + (int) bytesRead, + (int) copyLength); - System.arraycopy(iNode.getDataBlock(blockNr), (int) blockOffset, dest, off + (int) bytesRead, - (int) copyLength); + bytesRead += copyLength; + } + } + } catch (Throwable ex) { + final IOException ioe = new IOException(); + ioe.initCause(ex); + throw ioe; + } finally { + // read done, unlock the inode from the cache + iNode.decLocked(); + } + } - bytesRead += copyLength; - } - } - } catch (Throwable ex) { - final IOException ioe = new IOException(); - ioe.initCause(ex); - throw ioe; - } finally { - //read done, unlock the inode from the cache - iNode.decLocked(); - } - } + destBA.refreshByteBuffer(); + } - destBA.refreshByteBuffer(); - } + @Override + public void write(long fileOffset, ByteBuffer srcBuf) throws IOException { + final int len = srcBuf.remaining(); + final int off = 0; + // TODO optimize it also to use ByteBuffer at lower level + final byte[] src = ByteBufferUtils.toArray(srcBuf); - @Override - public void write(long fileOffset, ByteBuffer srcBuf) throws IOException { - final int len = srcBuf.remaining(); - final int off = 0; - //TODO optimize it also to use ByteBuffer at lower level - final byte[] src = ByteBufferUtils.toArray(srcBuf); + if (getFileSystem().isReadOnly()) { + throw new ReadOnlyFileSystemException("write in readonly filesystem"); + } - if (getFileSystem().isReadOnly()) { - throw new ReadOnlyFileSystemException("write in readonly filesystem"); - } + // synchronize to the inode cache to make sure that the inode does not + // get + // flushed between reading it and locking it + synchronized (((Ext2FileSystem) getFileSystem()).getInodeCache()) { + // reread the inode before synchronizing to it to make sure + // all threads use the same instance + rereadInode(); - //synchronize to the inode cache to make sure that the inode does not - // get - //flushed between reading it and locking it - synchronized (((Ext2FileSystem) getFileSystem()).getInodeCache()) { - //reread the inode before synchronizing to it to make sure - //all threads use the same instance - rereadInode(); + // lock the inode into the cache so it is not flushed before + // synchronizing to it + // (otherwise a new instance of INode referring to the same inode + // could be put + // in the cache resulting in the possibility of two threads + // manipulating the same + // inode at the same time because they would synchronize to + // different INode instances) + iNode.incLocked(); + } + try { + // a single inode may be represented by more than one Ext2File + // instances, + // but each will use the same instance of the underlying inode (see + // Ext2FileSystem.getINode()), + // so synchronize to the inode + synchronized (iNode) { + if (fileOffset > getLength()) throw new IOException( + "Can't write beyond the end of the file! (fileOffset: " + fileOffset + ", getLength()" + + getLength()); + if (off + len > src.length) throw new IOException("src is shorter than what you want to write"); - //lock the inode into the cache so it is not flushed before - // synchronizing to it - //(otherwise a new instance of INode referring to the same inode - // could be put - //in the cache resulting in the possibility of two threads - // manipulating the same - //inode at the same time because they would synchronize to - // different INode instances) - iNode.incLocked(); - } - try { - //a single inode may be represented by more than one Ext2File - // instances, - //but each will use the same instance of the underlying inode (see - // Ext2FileSystem.getINode()), - //so synchronize to the inode - synchronized (iNode) { - if (fileOffset > getLength()) - throw new IOException("Can't write beyond the end of the file! (fileOffset: " + fileOffset + - ", getLength()" + getLength()); - if (off + len > src.length) - throw new IOException("src is shorter than what you want to write"); + log.debug("write(fileOffset=" + fileOffset + ", src, off, len=" + len + ")"); - log.debug("write(fileOffset=" + fileOffset + ", src, off, len=" + len + ")"); + final long blockSize = iNode.getExt2FileSystem().getBlockSize(); + long blocksAllocated = iNode.getAllocatedBlockCount(); + long bytesWritten = 0; + while (bytesWritten < len) { + long blockIndex = (fileOffset + bytesWritten) / blockSize; + long blockOffset = (fileOffset + bytesWritten) % blockSize; + long copyLength = Math.min(len - bytesWritten, blockSize - blockOffset); - final long blockSize = iNode.getExt2FileSystem().getBlockSize(); - long blocksAllocated = iNode.getAllocatedBlockCount(); - long bytesWritten = 0; - while (bytesWritten < len) { - long blockIndex = (fileOffset + bytesWritten) / blockSize; - long blockOffset = (fileOffset + bytesWritten) % blockSize; - long copyLength = Math.min(len - bytesWritten, blockSize - blockOffset); + // If only a part of the block is written, then read the + // block and update its contents with the data in src. If the + // whole block is overwritten, then skip reading it. + byte[] dest; + if (!((blockOffset == 0) && (copyLength == blockSize)) && (blockIndex < blocksAllocated)) dest = iNode.getDataBlock(blockIndex); + else dest = new byte[(int) blockSize]; - //If only a part of the block is written, then read the - //block and update its contents with the data in src. If the - //whole block is overwritten, then skip reading it. - byte[] dest; - if (!((blockOffset == 0) && (copyLength == blockSize)) && (blockIndex < blocksAllocated)) - dest = iNode.getDataBlock(blockIndex); - else - dest = new byte[(int) blockSize]; + System.arraycopy(src, (int) (off + bytesWritten), dest, (int) blockOffset, (int) copyLength); - System.arraycopy(src, (int) (off + bytesWritten), dest, (int) blockOffset, (int) copyLength); + // allocate a new block if needed + if (blockIndex >= blocksAllocated) { + try { + iNode.allocateDataBlock(blockIndex); + } catch (FileSystemException ex) { + final IOException ioe = new IOException("Internal filesystem exception"); + ioe.initCause(ex); + throw ioe; + } + blocksAllocated++; + } - //allocate a new block if needed - if (blockIndex >= blocksAllocated) { - try { - iNode.allocateDataBlock(blockIndex); - } catch (FileSystemException ex) { - final IOException ioe = new IOException("Internal filesystem exception"); - ioe.initCause(ex); - throw ioe; - } - blocksAllocated++; - } + // write the block + iNode.writeDataBlock(blockIndex, dest); - //write the block - iNode.writeDataBlock(blockIndex, dest); + bytesWritten += copyLength; + } + iNode.setSize(fileOffset + len); - bytesWritten += copyLength; - } - iNode.setSize(fileOffset + len); + iNode.setMtime(System.currentTimeMillis() / 1000); + } + } catch (IOException ex) { + // ... this avoids wrapping an IOException inside another one. + throw ex; + } catch (Throwable ex) { + final IOException ioe = new IOException(); + ioe.initCause(ex); + throw ioe; + } finally { + // write done, unlock the inode from the cache + iNode.decLocked(); + } + } - iNode.setMtime(System.currentTimeMillis() / 1000); - } - } catch (IOException ex) { - // ... this avoids wrapping an IOException inside another one. - throw ex; - } catch (Throwable ex) { - final IOException ioe = new IOException(); - ioe.initCause(ex); - throw ioe; - } finally { - //write done, unlock the inode from the cache - iNode.decLocked(); - } - } + @Override + public void flush() throws IOException { + log.debug("Ext2File.flush()"); + iNode.update(); + // update the group descriptors and superblock: needed if blocks have + // been allocated or deallocated + iNode.getExt2FileSystem().updateFS(); + } - @Override - public void flush() throws IOException { - log.debug("Ext2File.flush()"); - iNode.update(); - //update the group descriptors and superblock: needed if blocks have - //been allocated or deallocated - iNode.getExt2FileSystem().updateFS(); - } + private long getLengthInBlocks() { + return iNode.getSizeInBlocks(); + } - private long getLengthInBlocks() { - return iNode.getSizeInBlocks(); - } + private void rereadInode() throws IOException { + int iNodeNr = iNode.getINodeNr(); + try { + iNode = ((Ext2FileSystem) getFileSystem()).getINode(iNodeNr); + } catch (FileSystemException ex) { + final IOException ioe = new IOException(); + ioe.initCause(ex); + throw ioe; + } + } - private void rereadInode() throws IOException { - int iNodeNr = iNode.getINodeNr(); - try { - iNode = ((Ext2FileSystem) getFileSystem()).getINode(iNodeNr); - } catch (FileSystemException ex) { - final IOException ioe = new IOException(); - ioe.initCause(ex); - throw ioe; - } - } + @Override + public byte[] getSlackSpace() throws IOException { + int blockSize = ((Ext2FileSystem) getFileSystem()).getBlockSize(); + + int slackSpaceSize = blockSize - (int) (getLength() % blockSize); + + if (slackSpaceSize == blockSize) { + slackSpaceSize = 0; + } + + byte[] slackSpace = new byte[slackSpaceSize]; + readImpl(getLength(), ByteBuffer.wrap(slackSpace)); + + return slackSpace; + } } Modified: trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java 2012-10-24 07:04:00 UTC (rev 5935) +++ trunk/fs/src/fs/org/jnode/fs/ext2/Ext2FileSystem.java 2012-12-19 08:38:08 UTC (rev 5936) @@ -17,7 +17,7 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs.ext2; import java.io.IOException; @@ -39,940 +39,868 @@ /** * @author Andras Nagy - * */ public class Ext2FileSystem extends AbstractFileSystem<Ext2Entry> { - private Superblock superblock; + private Superblock superblock; - private GroupDescriptor groupDescriptors[]; + private GroupDescriptor groupDescriptors[]; - private INodeTable iNodeTables[]; + private INodeTable iNodeTables[]; - private int groupCount; + private int groupCount; - private BlockCache blockCache; + private BlockCache blockCache; - private INodeCache inodeCache; + private INodeCache inodeCache; - private final Logger log = Logger.getLogger(getClass()); + private final Logger log = Logger.getLogger(getClass()); - // private Object groupDescriptorLock; - // private Object superblockLock; + // private Object groupDescriptorLock; + // private Object superblockLock; - // private final boolean DEBUG=true; + // private final boolean DEBUG=true; - // TODO: SYNC_WRITE should be made a parameter - /** if true, writeBlock() does not return until the block is written to disk */ - private boolean SYNC_WRITE = true; + // TODO: SYNC_WRITE should be made a parameter + /** if true, writeBlock() does not return until the block is written to disk */ + private boolean SYNC_WRITE = true; - /** - * Constructor for Ext2FileSystem in specified readOnly mode - * - * @throws FileSystemException - */ - public Ext2FileSystem(Device device, boolean readOnly, Ext2FileSystemType type) throws FileSystemException { - super(device, readOnly, type); - log.setLevel(Level.DEBUG); + /** + * Constructor for Ext2FileSystem in specified readOnly mode + * @throws FileSystemException + */ + public Ext2FileSystem(Device device, boolean readOnly, Ext2FileSystemType type) throws FileSystemException { + super(device, readOnly, type); + log.setLevel(Level.DEBUG); - blockCache = new BlockCache(50, (float) 0.75); - inodeCache = new INodeCache(50, (float) 0.75); + blockCache = new BlockCache(50, (float) 0.75); + inodeCache = new INodeCache(50, (float) 0.75); - // groupDescriptorLock = new Object(); - // superblockLock = new Object(); - } + // groupDescriptorLock = new Object(); + // superblockLock = new Object(); + } - public void read() throws FileSystemException { - ByteBuffer data; + public void read() throws FileSystemException { + ByteBuffer data; - try { - data = ByteBuffer.allocate(Superblock.SUPERBLOCK_LENGTH); + try { + data = ByteBuffer.allocate(Superblock.SUPERBLOCK_LENGTH); - // skip the first 1024 bytes (bootsector) and read the superblock - // TODO: the superblock should read itself - getApi().read(1024, data); - // superblock = new SuperBlock(data, this); - superblock = new Superblock(); - superblock.read(data.array(), this); + // skip the first 1024 bytes (bootsector) and read the superblock + // TODO: the superblock should read itself + getApi().read(1024, data); + // superblock = new SuperBlock(data, this); + superblock = new Superblock(); + superblock.read(data.array(), this); - // read the group descriptors - groupCount = (int) Ext2Utils.ceilDiv(superblock.getBlocksCount(), superblock.getBlocksPerGroup()); - groupDescriptors = new GroupDescriptor[groupCount]; - iNodeTables = new INodeTable[groupCount]; + // read the group descriptors + groupCount = (int) Ext2Utils.ceilDiv(superblock.getBlocksCount(), superblock.getBlocksPerGroup()); + groupDescriptors = new GroupDescriptor[groupCount]; + iNodeTables = new INodeTable[groupCount]; - for (int i = 0; i < groupCount; i++) { - // groupDescriptors[i]=new GroupDescriptor(i, this); - groupDescriptors[i] = new GroupDescriptor(); - groupDescriptors[i].read(i, this); + for(int i = 0; i < groupCount; i++) { + // groupDescriptors[i]=new GroupDescriptor(i, this); + groupDescriptors[i] = new GroupDescriptor(); + groupDescriptors[i].read(i, this); - iNodeTables[i] = new INodeTable(this, (int) groupDescriptors[i].getInodeTable()); - } + iNodeTables[i] = new INodeTable(this, (int) groupDescriptors[i].getInodeTable()); + } - } catch (FileSystemException e) { - throw e; - } catch (Exception e) { - throw new FileSystemException(e); - } + } catch (FileSystemException e) { + throw e; + } catch (Exception e) { + throw new FileSystemException(e); + } - // check for unsupported filesystem options - // (an unsupported INCOMPAT feature means that the fs may not be mounted - // at all) - if (hasIncompatFeature(Ext2Constants.EXT2_FEATURE_INCOMPAT_COMPRESSION)) - throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (COMPRESSION) disallows mounting"); - if (hasIncompatFeature(Ext2Constants.EXT2_FEATURE_INCOMPAT_META_BG)) - throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (META_BG) disallows mounting"); - if (hasIncompatFeature(Ext2Constants.EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) - throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (JOURNAL_DEV) disallows mounting"); -// if (hasIncompatFeature(Ext2Constants.EXT3_FEATURE_INCOMPAT_RECOVER)) -// throw new FileSystemException(getDevice().getId() + -// " Unsupported filesystem feature (RECOVER) disallows mounting"); -// if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_EXTENTS)) -// throw new FileSystemException(getDevice().getId() + -// " Unsupported filesystem feature (EXTENTS) disallows mounting"); - if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_64BIT)) - throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (64BIT) disallows mounting"); - if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_MMP)) - throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (MMP) disallows mounting"); - if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_FLEX_BG)) - throw new FileSystemException(getDevice().getId() + - " Unsupported filesystem feature (FLEX_BG) disallows mounting"); + // check for unsupported filesystem options + // (an unsupported INCOMPAT feature means that the fs may not be mounted + // at all) + if (hasIncompatFeature(Ext2Constants.EXT2_FEATURE_INCOMPAT_COMPRESSION)) throw new FileSystemException( + getDevice().getId() + " Unsupported filesystem feature (COMPRESSION) disallows mounting"); + if (hasIncompatFeature(Ext2Constants.EXT2_FEATURE_INCOMPAT_META_BG)) throw new FileSystemException( + getDevice().getId() + " Unsupported filesystem feature (META_BG) disallows mounting"); + if (hasIncompatFeature(Ext2Constants.EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) throw new FileSystemException( + getDevice().getId() + " Unsupported filesystem feature (JOURNAL_DEV) disallows mounting"); + // if (hasIncompatFeature(Ext2Constants.EXT3_FEATURE_INCOMPAT_RECOVER)) + // throw new FileSystemException(getDevice().getId() + + // " Unsupported filesystem feature (RECOVER) disallows mounting"); + // if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_EXTENTS)) + // throw new FileSystemException(getDevice().getId() + + // " Unsupported filesystem feature (EXTENTS) disallows mounting"); + if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_64BIT)) throw new FileSystemException( + getDevice().getId() + " Unsupported filesystem feature (64BIT) disallows mounting"); + if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_MMP)) throw new FileSystemException( + getDevice().getId() + " Unsupported filesystem feature (MMP) disallows mounting"); + if (hasIncompatFeature(Ext2Constants.EXT4_FEATURE_INCOMPAT_FLEX_BG)) throw new FileSystemException( + getDevice().getId() + " Unsupported filesystem feature (FLEX_BG) disallows mounting"); - // an unsupported RO_COMPAT feature means that the filesystem can only - // be mounted readonly - if (hasROFeature(Ext2Constants.EXT2_FEATURE_RO_COMPAT_LARGE_FILE)) { - log.info(getDevice().getId() + " Unsupported filesystem feature (LARGE_FILE) forces readonly mode"); - setReadOnly(true); - } - if (hasROFeature(Ext2Constants.EXT2_FEATURE_RO_COMPAT_BTREE_DIR)) { - log.info(getDevice().getId() + " Unsupported filesystem feature (BTREE_DIR) forces readonly mode"); - setReadOnly(true); - } - if (hasROFeature(Ext2Constants.EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) { - log.info(getDevice().getId() + " Unsupported filesystem feature (HUGE_FILE) forces readonly mode"); - setReadOnly(true); - } - if (hasROFeature(Ext2Constants.EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) { - log.info(getDevice().getId() + " Unsupported filesystem feature (GDT_CSUM) forces readonly mode"); - setReadOnly(true); - } - if (hasROFeature(Ext2Constants.EXT4_FEATURE_RO_COMPAT_DIR_NLINK)) { - log.info(getDevice().getId() + " Unsupported filesystem feature (DIR_NLINK) forces readonly mode"); - setReadOnly(true); - } - if (hasROFeature(Ext2Constants.EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)) { - log.info(getDevice().getId() + " Unsupported filesystem feature (EXTRA_ISIZE) forces readonly mode"); - setReadOnly(true); - } + // an unsupported RO_COMPAT feature means that the filesystem can only + // be mounted readonly + if (hasROFeature(Ext2Constants.EXT2_FEATURE_RO_COMPAT_LARGE_FILE)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (LARGE_FILE) forces readonly mode"); + setReadOnly(true); + } + if (hasROFeature(Ext2Constants.EXT2_FEATURE_RO_COMPAT_BTREE_DIR)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (BTREE_DIR) forces readonly mode"); + setReadOnly(true); + } + if (hasROFeature(Ext2Constants.EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (HUGE_FILE) forces readonly mode"); + setReadOnly(true); + } + if (hasROFeature(Ext2Constants.EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (GDT_CSUM) forces readonly mode"); + setReadOnly(true); + } + if (hasROFeature(Ext2Constants.EXT4_FEATURE_RO_COMPAT_DIR_NLINK)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (DIR_NLINK) forces readonly mode"); + setReadOnly(true); + } + if (hasROFeature(Ext2Constants.EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)) { + log.info(getDevice().getId() + " Unsupported filesystem feature (EXTRA_ISIZE) forces readonly mode"); + setReadOnly(true); + } - // if the filesystem has not been cleanly unmounted, mount it readonly - if (superblock.getState() == Ext2Constants.EXT2_ERROR_FS) { - log.info(getDevice().getId() + " Filesystem has not been cleanly unmounted, mounting it readonly"); - setReadOnly(true); - } + // if the filesystem has not been cleanly unmounted, mount it readonly + if (superblock.getState() == Ext2Constants.EXT2_ERROR_FS) { + log.info(getDevice().getId() + " Filesystem has not been cleanly unmounted, mounting it readonly"); + setReadOnly(true); + } - // if the filesystem has been mounted R/W, set it to "unclean" - if (!isReadOnly()) { - log.info(getDevice().getId() + " mounting fs r/w"); - superblock.setState(Ext2Constants.EXT2_ERROR_FS); - } - // Mount successfull, update some superblock informations. - superblock.setMntCount(superblock.getMntCount() + 1); - superblock.setMTime(Ext2Utils.encodeDate(new Date())); - superblock.setWTime(Ext2Utils.encodeDate(new Date())); - SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy"); - log.debug(" superblock: " + "\n" + - " #Mount: " + superblock.getMntCount() + "\n" + - " #MaxMount: " + superblock.getMaxMntCount() + "\n" + " Last mount time: " + - sdf.format(Ext2Utils.decodeDate(superblock.getMTime()).getTime()) + "\n" + - " Last write time: " + - sdf.format(Ext2Utils.decodeDate(superblock.getWTime()).getTime()) + "\n" + - " #blocks: " + superblock.getBlocksCount() + "\n" + - " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + - " #block groups: " + groupCount + "\n" + - " block size: " + superblock.getBlockSize() + "\n" + - " #inodes: " + superblock.getINodesCount() + "\n" + - " #inodes/group: " + superblock.getINodesPerGroup()); - } + // if the filesystem has been mounted R/W, set it to "unclean" + if (!isReadOnly()) { + log.info(getDevice().getId() + " mounting fs r/w"); + superblock.setState(Ext2Constants.EXT2_ERROR_FS); + } + // Mount successfull, update some superblock informations. + superblock.setMntCount(superblock.getMntCount() + 1); + superblock.setMTime(Ext2Utils.encodeDate(new Date())); + superblock.setWTime(Ext2Utils.encodeDate(new Date())); + SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy"); + log.debug(" superblock: " + "\n" + " #Mount: " + superblock.getMntCount() + "\n" + " #MaxMount: " + + superblock.getMaxMntCount() + "\n" + " Last mount time: " + + sdf.format(Ext2Utils.decodeDate(superblock.getMTime()).getTime()) + "\n" + " Last write time: " + + sdf.format(Ext2Utils.decodeDate(superblock.getWTime()).getTime()) + "\n" + " #blocks: " + + superblock.getBlocksCount() + "\n" + " #blocks/group: " + superblock.getBlocksPerGroup() + "\n" + + " #block groups: " + groupCount + "\n" + " block size: " + superblock.getBlockSize() + "\n" + + " #inodes: " + superblock.getINodesCount() + "\n" + " #inodes/group: " + + superblock.getINodesPerGroup()); + } - public void create(BlockSize blockSize) throws FileSystemException { - try { - // create the superblock - superblock = new Superblock(); - superblock.create(blockSize, this); + public void create(BlockSize blockSize) throws FileSystemException { + try { + // create the superblock + superblock = new Superblock(); + superblock.create(blockSize, this); - // create the group descriptors - groupCount = (int) Ext2Utils.ceilDiv(superblock.getBlocksCount(), superblock.getBlocksPerGroup()); - groupDescriptors = new GroupDescriptor[groupCount]; + // create the group descriptors + groupCount = (int) Ext2Utils.ceilDiv(superblock.getBlocksCount(), superblock.getBlocksPerGroup()); + groupDescriptors = new GroupDescriptor[groupCount]; - iNodeTables = new INodeTable[groupCount]; + iNodeTables = new INodeTable[groupCount]; - for (int i = 0; i < groupCount; i++) { - groupDescriptors[i] = new GroupDescriptor(); - groupDescriptors[i].create(i, this); - } + for(int i = 0; i < groupCount; i++) { + groupDescriptors[i] = new GroupDescriptor(); + groupDescriptors[i].create(i, this); + } - // create each block group: - // create the block bitmap - // create the inode bitmap - // fill the inode table with zeroes - for (int i = 0; i < groupCount; i++) { - log.debug("creating group " + i); + // create each block group: + // create the block bitmap + // create the inode bitmap + // fill the inode table with zeroes + for(int i = 0; i < groupCount; i++) { + log.debug("creating group " + i); - byte[] blockBitmap = new byte[blockSize.getSize()]; - byte[] inodeBitmap = new byte[blockSize.getSize()]; + byte[] blockBitmap = new byte[blockSize.getSize()]; + byte[] inodeBitmap = new byte[blockSize.getSize()]; - // update the block bitmap: mark the metadata blocks allocated - long iNodeTableBlock = groupDescriptors[i].getInodeTable(); - long firstNonMetadataBlock = iNodeTableBlock + INodeTable.getSizeInBlocks(this); - int metadataLength = - (int) (firstNonMetadataBlock - (superblock.getFirstDataBlock() + i * - superblock.getBlocksPerGroup())); - for (int j = 0; j < metadataLength; j++) - BlockBitmap.setBit(blockBitmap, j); + // update the block bitmap: mark the metadata blocks allocated + long iNodeTableBlock = groupDescriptors[i].getInodeTable(); + long firstNonMetadataBlock = iNodeTableBlock + INodeTable.getSizeInBlocks(this); + int metadataLength = (int) (firstNonMetadataBlock - (superblock.getFirstDataBlock() + i + * superblock.getBlocksPerGroup())); + for(int j = 0; j < metadataLength; j++) + BlockBitmap.setBit(blockBitmap, j); - // set the padding at the end of the last block group - if (i == groupCount - 1) { - for (long k = superblock.getBlocksCount(); k < groupCount * superblock.getBlocksPerGroup(); k++) - BlockBitmap.setBit(blockBitmap, (int) (k % superblock.getBlocksPerGroup())); - } + // set the padding at the end of the last block group + if (i == groupCount - 1) { + for(long k = superblock.getBlocksCount(); k < groupCount * superblock.getBlocksPerGroup(); k++) + BlockBitmap.setBit(blockBitmap, (int) (k % superblock.getBlocksPerGroup())); + } - // update the inode bitmap: mark the special inodes allocated in - // the first block group - if (i == 0) - for (int j = 0; j < superblock.getFirstInode() - 1; j++) - INodeBitmap.setBit(inodeBitmap, j); + // update the inode bitmap: mark the special inodes allocated in + // the first block group + if (i == 0) for(int j = 0; j < superblock.getFirstInode() - 1; j++) + INodeBitmap.setBit(inodeBitmap, j); - // create an empty inode table - byte[] emptyBlock = new byte[blockSize.getSize()]; - for (long j = iNodeTableBlock; j < firstNonMetadataBlock; j++) - writeBlock(j, emptyBlock, false); + // create an empty inode table + byte[] emptyBlock = new byte[blockSize.getSize()]; + for(long j = iNodeTableBlock; j < firstNonMetadataBlock; j++) + writeBlock(j, emptyBlock, false); - iNodeTables[i] = new INodeTable(this, (int) iNodeTableBlock); + iNodeTables[i] = new INodeTable(this, (int) iNodeTableBlock); - writeBlock(groupDescriptors[i].getBlockBitmap(), blockBitmap, false); - writeBlock(groupDescriptors[i].getInodeBitmap(), inodeBitmap, false); - } + writeBlock(groupDescriptors[i].getBlockBitmap(), blockBitmap, false); + writeBlock(groupDescriptors[i].getInodeBitmap(), inodeBitmap, false); + } - log.info("superblock.getBlockSize(): " + superblock.getBlockSize()); + log.info("superblock.getBlockSize(): " ... [truncated message content] |
From: <ga...@us...> - 2012-10-24 07:04:09
|
Revision: 5935 http://jnode.svn.sourceforge.net/jnode/?rev=5935&view=rev Author: galatnm Date: 2012-10-24 07:04:00 +0000 (Wed, 24 Oct 2012) Log Message: ----------- Add Ext4 classes to Ext2 descriptor. Modified Paths: -------------- trunk/fs/descriptors/org.jnode.fs.ext2.xml Modified: trunk/fs/descriptors/org.jnode.fs.ext2.xml =================================================================== --- trunk/fs/descriptors/org.jnode.fs.ext2.xml 2012-10-24 06:47:54 UTC (rev 5934) +++ trunk/fs/descriptors/org.jnode.fs.ext2.xml 2012-10-24 07:04:00 UTC (rev 5935) @@ -17,6 +17,7 @@ <export name="org.jnode.fs.ext2.*"/> <export name="org.jnode.fs.ext2.cache.*"/> <export name="org.jnode.fs.ext2.exception.*"/> + <export name="org.jnode.fs.ext4.*"/> </library> </runtime> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ga...@us...> - 2012-10-24 06:48:01
|
Revision: 5934 http://jnode.svn.sourceforge.net/jnode/?rev=5934&view=rev Author: galatnm Date: 2012-10-24 06:47:54 +0000 (Wed, 24 Oct 2012) Log Message: ----------- Skip over invalid FAT directory entries. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/jfat/FatDirEntry.java Modified: trunk/fs/src/fs/org/jnode/fs/jfat/FatDirEntry.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/jfat/FatDirEntry.java 2012-09-23 18:01:11 UTC (rev 5933) +++ trunk/fs/src/fs/org/jnode/fs/jfat/FatDirEntry.java 2012-10-24 06:47:54 UTC (rev 5934) @@ -32,6 +32,7 @@ protected static final int EOD = 0x00; protected static final int FREE = 0xE5; + protected static final int INVALID = 0xFF; protected static final int KANJI = 0x05; protected static final int NO_INDEX = -1; @@ -73,7 +74,8 @@ case FREE: case EOD: return new FatDirEntry(fs, entry, index, flag); - + case INVALID: + throw new IOException("Invalid entry for index: " + index); default: if (attr.isLong()) return new FatLongDirEntry(fs, entry, index); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2012-09-23 18:01:21
|
Revision: 5933 http://jnode.svn.sourceforge.net/jnode/?rev=5933&view=rev Author: lsantha Date: 2012-09-23 18:01:11 +0000 (Sun, 23 Sep 2012) Log Message: ----------- Build improvements in classlib6. Modified Paths: -------------- classlib6/all/build.xml classlib6/jnode.properties.dist Modified: classlib6/all/build.xml =================================================================== --- classlib6/all/build.xml 2012-09-23 17:53:55 UTC (rev 5932) +++ classlib6/all/build.xml 2012-09-23 18:01:11 UTC (rev 5933) @@ -211,13 +211,7 @@ <copy file="${root.dir}/all/build/classlib-src.jar" tofile="${main.jnode.dir}/all/lib/classlib-src.jar" overwrite="yes"/> </target> - <target name="ftp-properties"> - <property name="ftp.server" value="codemammoth.com"/> - <property name="ftp.dir" value="classlib"/> - <property name="download.url" value="http://codemammoth.com/jnodeftp"/> - </target> - - <target name="upload" depends="prepare,ftp-properties" description="upload the classlib binaries to the FTP server"> + <target name="upload" depends="prepare" description="upload the classlib binaries to the FTP server"> <fail message="main.jnode.dir not set in jnode.properties"> <condition><not><isset property="main.jnode.dir"/></not></condition> </fail> @@ -225,7 +219,7 @@ <condition><not><isset property="ftp.user"/></not></condition> </fail> <fail message="ftp.pass not set in jnode.properties"> - <condition><not><isset property="ftp.pass"/></not></condition> + <condition><not><isset property="ftp.password"/></not></condition> </fail> <!-- compute checksum for uploadables --> <checksum algorithm="MD5" property="classlib.md5"> @@ -250,13 +244,15 @@ <ftp action="mkdir" server="${ftp.server}" userid="${ftp.user}" - password="${ftp.pass}" + password="${ftp.password}" + passive="${ftp.passive}" remotedir="${ftp.dir}/${current}" verbose="yes"/> <!-- upload files --> <ftp server="${ftp.server}" userid="${ftp.user}" - password="${ftp.pass}" + password="${ftp.password}" + passive="${ftp.passive}" remotedir="${ftp.dir}/${current}" verbose="yes"> <fileset dir="${root.dir}/all/build/" includes="classlib.pack.gz,classlib-src.jar.bz2"/> @@ -264,7 +260,8 @@ <!-- upload ftp.properties --> <ftp server="${ftp.server}" userid="${ftp.user}" - password="${ftp.pass}" + password="${ftp.password}" + passive="${ftp.passive}" remotedir="${ftp.dir}"> <fileset dir="${root.dir}/all/build/" includes="ftp.properties"/> </ftp> @@ -272,7 +269,8 @@ <ftp action="del" server="${ftp.server}" userid="${ftp.user}" - password="${ftp.pass}" + password="${ftp.password}" + passive="${ftp.passive}" remotedir="${ftp.dir}" verbose="yes"> <fileset> @@ -283,7 +281,8 @@ <ftp action="rmdir" server="${ftp.server}" userid="${ftp.user}" - password="${ftp.pass}" + password="${ftp.password}" + passive="${ftp.passive}" remotedir="${ftp.dir}" verbose="yes"> <fileset> @@ -304,12 +303,13 @@ <target name="all" depends="clean,classlib-pack,classlib-src-bz,upload" description="clean build and upload"/> - <target name="ftp-init" depends="prepare,ftp-properties" description="initialize the FTP server"> + <target name="ftp-init" depends="prepare" description="initialize the FTP server"> <!-- create maid directory --> <ftp action="mkdir" server="${ftp.server}" userid="${ftp.user}" - password="${ftp.pass}" + password="${ftp.password}" + passive="${ftp.passive}" remotedir="${ftp.dir}" verbose="yes"/> <!-- create ftp.properties --> @@ -317,7 +317,8 @@ <!-- upload ftp.properties --> <ftp server="${ftp.server}" userid="${ftp.user}" - password="${ftp.pass}" + password="${ftp.password}" + passive="${ftp.passive}" remotedir="${ftp.dir}"> <fileset dir="${root.dir}/all/build/" includes="ftp.properties"/> </ftp> Modified: classlib6/jnode.properties.dist =================================================================== --- classlib6/jnode.properties.dist 2012-09-23 17:53:55 UTC (rev 5932) +++ classlib6/jnode.properties.dist 2012-09-23 18:01:11 UTC (rev 5933) @@ -113,5 +113,9 @@ # Set these properties for uploading classlib binaries # ----------------------------------------------- # main.jnode.dir=${root.dir}/../jnode +# ftp.server= # ftp.user= -# ftp.pass= +# ftp.password= +# ftp.passive= +# ftp.dir= +# download.url= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2012-09-23 17:54:06
|
Revision: 5932 http://jnode.svn.sourceforge.net/jnode/?rev=5932&view=rev Author: lsantha Date: 2012-09-23 17:53:55 +0000 (Sun, 23 Sep 2012) Log Message: ----------- Integrating OpenJDK 6 build 26. Classlib updated. Modified Paths: -------------- trunk/all/lib/ftp.properties trunk/core/src/openjdk/vm/java/io/JNodeFileSystem.java trunk/core/src/openjdk/vm/java/io/NativeUnixFileSystem.java Modified: trunk/all/lib/ftp.properties =================================================================== --- trunk/all/lib/ftp.properties 2012-09-23 09:24:10 UTC (rev 5931) +++ trunk/all/lib/ftp.properties 2012-09-23 17:53:55 UTC (rev 5932) @@ -1,3 +1,3 @@ -classlib.url=http://jnode.ro//classlib/20091228090913 -classlib.md5=ac4c3f52a31d0a1f58e4515c0be7480b -classlib-src.md5=0ba30a72207217ba95cb6c5f0031ad86 \ No newline at end of file +classlib.url=http://jnode.ro//classlib/20120923084426 +classlib.md5=428d062b09531822195a2ae3d486e791 +classlib-src.md5=c9d1cc877354726fafdc463342de7453 \ No newline at end of file Modified: trunk/core/src/openjdk/vm/java/io/JNodeFileSystem.java =================================================================== --- trunk/core/src/openjdk/vm/java/io/JNodeFileSystem.java 2012-09-23 09:24:10 UTC (rev 5931) +++ trunk/core/src/openjdk/vm/java/io/JNodeFileSystem.java 2012-09-23 17:53:55 UTC (rev 5932) @@ -75,8 +75,12 @@ return VMFile.mkdir(f.getPath()); } + /** + * The resulting temporary file may have more restrictive access permission + * on some platforms, if restrictive is true. + */ @Override - public boolean createFileExclusively(String pathname) throws IOException { + public boolean createFileExclusively(String pathname, boolean restrictive) throws IOException { return VMFile.create(pathname); } Modified: trunk/core/src/openjdk/vm/java/io/NativeUnixFileSystem.java =================================================================== --- trunk/core/src/openjdk/vm/java/io/NativeUnixFileSystem.java 2012-09-23 09:24:10 UTC (rev 5931) +++ trunk/core/src/openjdk/vm/java/io/NativeUnixFileSystem.java 2012-09-23 17:53:55 UTC (rev 5932) @@ -80,7 +80,7 @@ return success; } - private static boolean createFileExclusively(UnixFileSystem ufs, String path) { + private static boolean createFileExclusively(UnixFileSystem ufs, String path, boolean restrictive) { try { return VMFile.create(path); } catch(IOException ioe){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2012-09-23 09:24:21
|
Revision: 5931 http://jnode.svn.sourceforge.net/jnode/?rev=5931&view=rev Author: lsantha Date: 2012-09-23 09:24:10 +0000 (Sun, 23 Sep 2012) Log Message: ----------- Integrating OpenJDK 6 build 26. Modified Paths: -------------- classlib6/core/src/openjdk/com/com/sun/beans/finder/ClassFinder.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/oa/toa/TOAFactory.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/orb/ParserTable.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/orbutil/RepositoryId_1_3_1.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/util/RepositoryId.java classlib6/core/src/openjdk/com/com/sun/corba/se/spi/logging/CORBALogDomains.java classlib6/core/src/openjdk/com/com/sun/java/util/jar/pack/Driver.java classlib6/core/src/openjdk/com/com/sun/org/apache/xerces/internal/impl/XMLScanner.java classlib6/core/src/openjdk/corba/sun/rmi/rmic/iiop/IDLNames.java classlib6/core/src/openjdk/corba/sun/rmi/rmic/iiop/StubGenerator.java classlib6/core/src/openjdk/java/java/awt/AWTEvent.java classlib6/core/src/openjdk/java/java/awt/CheckboxMenuItem.java classlib6/core/src/openjdk/java/java/awt/Component.java classlib6/core/src/openjdk/java/java/awt/DefaultKeyboardFocusManager.java classlib6/core/src/openjdk/java/java/awt/EventQueue.java classlib6/core/src/openjdk/java/java/awt/KeyboardFocusManager.java classlib6/core/src/openjdk/java/java/awt/Menu.java classlib6/core/src/openjdk/java/java/awt/MenuBar.java classlib6/core/src/openjdk/java/java/awt/MenuComponent.java classlib6/core/src/openjdk/java/java/awt/MenuItem.java classlib6/core/src/openjdk/java/java/awt/PopupMenu.java classlib6/core/src/openjdk/java/java/awt/ScrollPaneAdjustable.java classlib6/core/src/openjdk/java/java/awt/Window.java classlib6/core/src/openjdk/java/java/beans/Introspector.java classlib6/core/src/openjdk/java/java/beans/PropertyEditorManager.java classlib6/core/src/openjdk/java/java/io/File.java classlib6/core/src/openjdk/java/java/io/FileSystem.java classlib6/core/src/openjdk/java/java/net/NetworkInterface.java classlib6/core/src/openjdk/java/java/util/UUID.java classlib6/core/src/openjdk/javax/javax/crypto/CipherSpi.java classlib6/core/src/openjdk/javax/javax/imageio/stream/FileCacheImageInputStream.java classlib6/core/src/openjdk/javax/javax/imageio/stream/FileCacheImageOutputStream.java classlib6/core/src/openjdk/javax/javax/management/loading/MLet.java classlib6/core/src/openjdk/javax/javax/swing/ClientPropertyKey.java classlib6/core/src/openjdk/javax/javax/swing/plaf/synth/SynthButtonUI.java classlib6/core/src/openjdk/javax/javax/swing/plaf/synth/SynthLabelUI.java classlib6/core/src/openjdk/javax/javax/swing/plaf/synth/SynthLookAndFeel.java classlib6/core/src/openjdk/sun/sun/awt/AWTAccessor.java classlib6/core/src/openjdk/sun/sun/awt/AppContext.java classlib6/core/src/openjdk/sun/sun/awt/KeyboardFocusManagerPeerImpl.java classlib6/core/src/openjdk/sun/sun/awt/SunToolkit.java classlib6/core/src/openjdk/sun/sun/misc/IOUtils.java classlib6/core/src/openjdk/sun/sun/misc/SharedSecrets.java classlib6/core/src/openjdk/sun/sun/net/www/protocol/jar/URLJarFile.java classlib6/core/src/openjdk/sun/sun/print/PSPrinterJob.java classlib6/core/src/openjdk/sun/sun/rmi/server/Activation.java classlib6/core/src/openjdk/sun/sun/security/ssl/AppOutputStream.java classlib6/core/src/openjdk/sun/sun/security/ssl/EngineOutputRecord.java classlib6/core/src/openjdk/sun/sun/security/ssl/OutputRecord.java classlib6/core/src/openjdk/sun/sun/security/ssl/SSLSocketImpl.java classlib6/core/src/openjdk/sun/sun/security/x509/CRLExtensions.java classlib6/core/src/openjdk/sun/sun/security/x509/CertificateExtensions.java classlib6/core/src/openjdk/sun/sun/security/x509/X509CRLEntryImpl.java classlib6/core/src/openjdk/sun/sun/security/x509/X509CRLImpl.java classlib6/core/src/openjdk/sun/sun/security/x509/X509CertImpl.java classlib6/core/src/openjdk/sun/sun/tools/jar/Main.java classlib6/core/src/openjdk/sun/sun/tools/native2ascii/Main.java classlib6/core/src/openjdk/svm/java/io/UnixFileSystem.java Added Paths: ----------- classlib6/core/src/openjdk/com/com/sun/beans/editors/ classlib6/core/src/openjdk/com/com/sun/beans/editors/BooleanEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/ByteEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/ColorEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/DoubleEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/EnumEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/FloatEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/FontEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/IntegerEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/LongEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/NumberEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/ShortEditor.java classlib6/core/src/openjdk/com/com/sun/beans/editors/StringEditor.java classlib6/core/src/openjdk/com/com/sun/beans/infos/ classlib6/core/src/openjdk/com/com/sun/beans/infos/ComponentBeanInfo.java classlib6/core/src/openjdk/sun/sun/misc/JavaIOFileAccess.java Removed Paths: ------------- classlib6/core/src/openjdk/sun/sun/beans/ Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/BooleanEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/BooleanEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/BooleanEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2006, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +/** + * Property editor for a java builtin "boolean" type. + */ + +import java.beans.*; + +public class BooleanEditor extends PropertyEditorSupport { + + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? value.toString() + : "null"; + } + + public String getAsText() { + Object value = getValue(); + return (value instanceof Boolean) + ? getValidName((Boolean) value) + : "null"; + } + + public void setAsText(String text) throws java.lang.IllegalArgumentException { + if (text == null) { + setValue(null); + } else if (isValidName(true, text)) { + setValue(Boolean.TRUE); + } else if (isValidName(false, text)) { + setValue(Boolean.FALSE); + } else { + throw new java.lang.IllegalArgumentException(text); + } + } + + public String[] getTags() { + return new String[] {getValidName(true), getValidName(false)}; + } + + // the following method should be localized (4890258) + + private String getValidName(boolean value) { + return value ? "True" : "False"; + } + + private boolean isValidName(boolean value, String name) { + return getValidName(value).equalsIgnoreCase(name); + } +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/ByteEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/ByteEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/ByteEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +/** + * Property editor for a java builtin "byte" type. + * + */ + +import java.beans.*; + +public class ByteEditor extends NumberEditor { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? "((byte)" + value + ")" + : "null"; + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Byte.decode(text)); + } + +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/ColorEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/ColorEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/ColorEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,212 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +import java.awt.*; +import java.beans.*; + +public class ColorEditor extends Panel implements PropertyEditor { + public ColorEditor() { + setLayout(null); + + ourWidth = hPad; + + // Create a sample color block bordered in black + Panel p = new Panel(); + p.setLayout(null); + p.setBackground(Color.black); + sample = new Canvas(); + p.add(sample); + sample.reshape(2, 2, sampleWidth, sampleHeight); + add(p); + p.reshape(ourWidth, 2, sampleWidth+4, sampleHeight+4); + ourWidth += sampleWidth + 4 + hPad; + + text = new TextField("", 14); + add(text); + text.reshape(ourWidth,0,100,30); + ourWidth += 100 + hPad; + + choser = new Choice(); + int active = 0; + for (int i = 0; i < colorNames.length; i++) { + choser.addItem(colorNames[i]); + } + add(choser); + choser.reshape(ourWidth,0,100,30); + ourWidth += 100 + hPad; + + resize(ourWidth,40); + } + + public void setValue(Object o) { + Color c = (Color)o; + changeColor(c); + } + + public Dimension preferredSize() { + return new Dimension(ourWidth, 40); + } + + public boolean keyUp(Event e, int key) { + if (e.target == text) { + try { + setAsText(text.getText()); + } catch (IllegalArgumentException ex) { + // Quietly ignore. + } + } + return (false); + } + + public void setAsText(String s) throws java.lang.IllegalArgumentException { + if (s == null) { + changeColor(null); + return; + } + int c1 = s.indexOf(','); + int c2 = s.indexOf(',', c1+1); + if (c1 < 0 || c2 < 0) { + // Invalid string. + throw new IllegalArgumentException(s); + } + try { + int r = Integer.parseInt(s.substring(0,c1)); + int g = Integer.parseInt(s.substring(c1+1, c2)); + int b = Integer.parseInt(s.substring(c2+1)); + Color c = new Color(r,g,b); + changeColor(c); + } catch (Exception ex) { + throw new IllegalArgumentException(s); + } + + } + + public boolean action(Event e, Object arg) { + if (e.target == choser) { + changeColor(colors[choser.getSelectedIndex()]); + } + return false; + } + + public String getJavaInitializationString() { + return (this.color != null) + ? "new java.awt.Color(" + this.color.getRGB() + ",true)" + : "null"; + } + + + private void changeColor(Color c) { + + if (c == null) { + this.color = null; + this.text.setText(""); + return; + } + + color = c; + + text.setText("" + c.getRed() + "," + c.getGreen() + "," + c.getBlue()); + + int active = 0; + for (int i = 0; i < colorNames.length; i++) { + if (color.equals(colors[i])) { + active = i; + } + } + choser.select(active); + + sample.setBackground(color); + sample.repaint(); + + support.firePropertyChange("", null, null); + } + + public Object getValue() { + return color; + } + + public boolean isPaintable() { + return true; + } + + public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { + Color oldColor = gfx.getColor(); + gfx.setColor(Color.black); + gfx.drawRect(box.x, box.y, box.width-3, box.height-3); + gfx.setColor(color); + gfx.fillRect(box.x+1, box.y+1, box.width-4, box.height-4); + gfx.setColor(oldColor); + } + + public String getAsText() { + return (this.color != null) + ? this.color.getRed() + "," + this.color.getGreen() + "," + this.color.getBlue() + : "null"; + } + + public String[] getTags() { + return null; + } + + public java.awt.Component getCustomEditor() { + return this; + } + + public boolean supportsCustomEditor() { + return true; + } + + public void addPropertyChangeListener(PropertyChangeListener l) { + support.addPropertyChangeListener(l); + } + + public void removePropertyChangeListener(PropertyChangeListener l) { + support.removePropertyChangeListener(l); + } + + + private String colorNames[] = { " ", "white", "lightGray", "gray", "darkGray", + "black", "red", "pink", "orange", + "yellow", "green", "magenta", "cyan", + "blue"}; + private Color colors[] = { null, Color.white, Color.lightGray, Color.gray, Color.darkGray, + Color.black, Color.red, Color.pink, Color.orange, + Color.yellow, Color.green, Color.magenta, Color.cyan, + Color.blue}; + + private Canvas sample; + private int sampleHeight = 20; + private int sampleWidth = 40; + private int hPad = 5; + private int ourWidth; + + private Color color; + private TextField text; + private Choice choser; + + private PropertyChangeSupport support = new PropertyChangeSupport(this); +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/DoubleEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/DoubleEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/DoubleEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +/** + * Property editor for a java builtin "double" type. + * + */ + +import java.beans.*; + +public class DoubleEditor extends NumberEditor { + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Double.valueOf(text)); + } + +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/EnumEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/EnumEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/EnumEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2006, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyEditor; +import java.util.ArrayList; +import java.util.List; + +/** + * Property editor for java.lang.Enum subclasses. + * + * @see PropertyEditor + * + * @since 1.7 + * + * @author Sergey A. Malenkov + */ +public final class EnumEditor implements PropertyEditor { + private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>(); + + private final Class type; + private final String[] tags; + + private Object value; + + public EnumEditor( Class type ) { + Object[] values = type.getEnumConstants(); + if ( values == null ) { + throw new IllegalArgumentException( "Unsupported " + type ); + } + this.type = type; + this.tags = new String[values.length]; + for ( int i = 0; i < values.length; i++ ) { + this.tags[i] = ( ( Enum )values[i] ).name(); + } + } + + public Object getValue() { + return this.value; + } + + public void setValue( Object value ) { + if ( ( value != null ) && !this.type.isInstance( value ) ) { + throw new IllegalArgumentException( "Unsupported value: " + value ); + } + Object oldValue; + PropertyChangeListener[] listeners; + synchronized ( this.listeners ) { + oldValue = this.value; + this.value = value; + + if ( ( value == null ) ? oldValue == null : value.equals( oldValue ) ) { + return; // do not fire event if value is not changed + } + int size = this.listeners.size(); + if ( size == 0 ) { + return; // do not fire event if there are no any listener + } + listeners = this.listeners.toArray( new PropertyChangeListener[size] ); + } + PropertyChangeEvent event = new PropertyChangeEvent( this, null, oldValue, value ); + for ( PropertyChangeListener listener : listeners ) { + listener.propertyChange( event ); + } + } + + public String getAsText() { + return ( this.value != null ) + ? ( ( Enum )this.value ).name() + : "null"; + } + + public void setAsText( String text ) { + setValue( ( text != null ) + ? Enum.valueOf( this.type, text ) + : null ); + } + + public String[] getTags() { + return this.tags.clone(); + } + + public String getJavaInitializationString() { + return ( this.value != null ) + ? this.type.getName() + '.' + ( ( Enum )this.value ).name() + : "null"; + } + + public boolean isPaintable() { + return false; + } + + public void paintValue( Graphics gfx, Rectangle box ) { + } + + public boolean supportsCustomEditor() { + return false; + } + + public Component getCustomEditor() { + return null; + } + + public void addPropertyChangeListener( PropertyChangeListener listener ) { + synchronized ( this.listeners ) { + this.listeners.add( listener ); + } + } + + public void removePropertyChangeListener( PropertyChangeListener listener ) { + synchronized ( this.listeners ) { + this.listeners.remove( listener ); + } + } +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/FloatEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/FloatEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/FloatEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +/** + * Property editor for a java builtin "float" type. + * + */ + +import java.beans.*; + +public class FloatEditor extends NumberEditor { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? value + "F" + : "null"; + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Float.valueOf(text)); + } + +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/FontEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/FontEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/FontEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,218 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +import java.awt.*; +import java.beans.*; + +public class FontEditor extends Panel implements java.beans.PropertyEditor { + + public FontEditor() { + setLayout(null); + + toolkit = Toolkit.getDefaultToolkit(); + fonts = toolkit.getFontList(); + + familyChoser = new Choice(); + for (int i = 0; i < fonts.length; i++) { + familyChoser.addItem(fonts[i]); + } + add(familyChoser); + familyChoser.reshape(20, 5, 100, 30); + + styleChoser = new Choice(); + for (int i = 0; i < styleNames.length; i++) { + styleChoser.addItem(styleNames[i]); + } + add(styleChoser); + styleChoser.reshape(145, 5, 70, 30); + + sizeChoser = new Choice(); + for (int i = 0; i < pointSizes.length; i++) { + sizeChoser.addItem("" + pointSizes[i]); + } + add(sizeChoser); + sizeChoser.reshape(220, 5, 70, 30); + + resize(300,40); + } + + + public Dimension preferredSize() { + return new Dimension(300, 40); + } + + public void setValue(Object o) { + font = (Font) o; + if (this.font == null) + return; + + changeFont(font); + // Update the current GUI choices. + for (int i = 0; i < fonts.length; i++) { + if (fonts[i].equals(font.getFamily())) { + familyChoser.select(i); + break; + } + } + for (int i = 0; i < styleNames.length; i++) { + if (font.getStyle() == styles[i]) { + styleChoser.select(i); + break; + } + } + for (int i = 0; i < pointSizes.length; i++) { + if (font.getSize() <= pointSizes[i]) { + sizeChoser.select(i); + break; + } + } + } + + private void changeFont(Font f) { + font = f; + if (sample != null) { + remove(sample); + } + sample = new Label(sampleText); + sample.setFont(font); + add(sample); + Component p = getParent(); + if (p != null) { + p.invalidate(); + p.layout(); + } + invalidate(); + layout(); + repaint(); + support.firePropertyChange("", null, null); + } + + public Object getValue() { + return (font); + } + + public String getJavaInitializationString() { + if (this.font == null) + return "null"; + + return "new java.awt.Font(\"" + font.getName() + "\", " + + font.getStyle() + ", " + font.getSize() + ")"; + } + + public boolean action(Event e, Object arg) { + String family = familyChoser.getSelectedItem(); + int style = styles[styleChoser.getSelectedIndex()]; + int size = pointSizes[sizeChoser.getSelectedIndex()]; + try { + Font f = new Font(family, style, size); + changeFont(f); + } catch (Exception ex) { + System.err.println("Couldn't create font " + family + "-" + + styleNames[style] + "-" + size); + } + return (false); + } + + + public boolean isPaintable() { + return true; + } + + public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { + // Silent noop. + Font oldFont = gfx.getFont(); + gfx.setFont(font); + FontMetrics fm = gfx.getFontMetrics(); + int vpad = (box.height - fm.getAscent())/2; + gfx.drawString(sampleText, 0, box.height-vpad); + gfx.setFont(oldFont); + } + + public String getAsText() { + if (this.font == null) { + return "null"; + } + StringBuilder sb = new StringBuilder(); + sb.append(this.font.getName()); + sb.append(' '); + + boolean b = this.font.isBold(); + if (b) { + sb.append("BOLD"); + } + boolean i = this.font.isItalic(); + if (i) { + sb.append("ITALIC"); + } + if (b || i) { + sb.append(' '); + } + sb.append(this.font.getSize()); + return sb.toString(); + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Font.decode(text)); + } + + public String[] getTags() { + return null; + } + + public java.awt.Component getCustomEditor() { + return this; + } + + public boolean supportsCustomEditor() { + return true; + } + + public void addPropertyChangeListener(PropertyChangeListener l) { + support.addPropertyChangeListener(l); + } + + public void removePropertyChangeListener(PropertyChangeListener l) { + support.removePropertyChangeListener(l); + } + + private Font font; + private Toolkit toolkit; + private String sampleText = "Abcde..."; + + private Label sample; + private Choice familyChoser; + private Choice styleChoser; + private Choice sizeChoser; + + private String fonts[]; + private String[] styleNames = { "plain", "bold", "italic" }; + private int[] styles = { Font.PLAIN, Font.BOLD, Font.ITALIC }; + private int[] pointSizes = { 3, 5, 8, 10, 12, 14, 18, 24, 36, 48 }; + + private PropertyChangeSupport support = new PropertyChangeSupport(this); + +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/IntegerEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/IntegerEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/IntegerEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2006, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +/** + * Property editor for a java builtin "int" type. + * + */ + +import java.beans.*; + +public class IntegerEditor extends NumberEditor { + + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Integer.decode(text)); + } + +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/LongEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/LongEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/LongEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +/** + * Property editor for a java builtin "long" type. + * + */ + +import java.beans.*; + +public class LongEditor extends NumberEditor { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? value + "L" + : "null"; + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Long.decode(text)); + } + +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/NumberEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/NumberEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/NumberEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +/** + * Abstract Property editor for a java builtin number types. + * + */ + +import java.beans.*; + +abstract public class NumberEditor extends PropertyEditorSupport { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? value.toString() + : "null"; + } + +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/ShortEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/ShortEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/ShortEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +/** + * Property editor for a java builtin "short" type. + * + */ + +import java.beans.*; + +public class ShortEditor extends NumberEditor { + + public String getJavaInitializationString() { + Object value = getValue(); + return (value != null) + ? "((short)" + value + ")" + : "null"; + } + + public void setAsText(String text) throws IllegalArgumentException { + setValue((text == null) ? null : Short.decode(text)); + } + +} Added: classlib6/core/src/openjdk/com/com/sun/beans/editors/StringEditor.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/editors/StringEditor.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/editors/StringEditor.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,74 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.editors; + +import java.beans.*; + +public class StringEditor extends PropertyEditorSupport { + + public String getJavaInitializationString() { + Object value = getValue(); + if (value == null) + return "null"; + + String str = value.toString(); + int length = str.length(); + StringBuilder sb = new StringBuilder(length + 2); + sb.append('"'); + for (int i = 0; i < length; i++) { + char ch = str.charAt(i); + switch (ch) { + case '\b': sb.append("\\b"); break; + case '\t': sb.append("\\t"); break; + case '\n': sb.append("\\n"); break; + case '\f': sb.append("\\f"); break; + case '\r': sb.append("\\r"); break; + case '\"': sb.append("\\\""); break; + case '\\': sb.append("\\\\"); break; + default: + if ((ch < ' ') || (ch > '~')) { + sb.append("\\u"); + String hex = Integer.toHexString((int) ch); + for (int len = hex.length(); len < 4; len++) { + sb.append('0'); + } + sb.append(hex); + } else { + sb.append(ch); + } + break; + } + } + sb.append('"'); + return sb.toString(); + } + + public void setAsText(String text) { + setValue(text); + } + +} Modified: classlib6/core/src/openjdk/com/com/sun/beans/finder/ClassFinder.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/finder/ClassFinder.java 2012-08-19 14:03:14 UTC (rev 5930) +++ classlib6/core/src/openjdk/com/com/sun/beans/finder/ClassFinder.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2012, 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 @@ -24,6 +24,8 @@ */ package com.sun.beans.finder; +import static sun.reflect.misc.ReflectUtil.checkPackageAccess; + /** * This is utility class that provides <code>static</code> methods * to find a class with the specified name using the specified class loader. @@ -53,6 +55,7 @@ * @see Thread#getContextClassLoader() */ public static Class findClass( String name ) throws ClassNotFoundException { + checkPackageAccess(name); try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if ( loader == null ) { @@ -93,6 +96,7 @@ * @see Class#forName(String,boolean,ClassLoader) */ public static Class findClass( String name, ClassLoader loader ) throws ClassNotFoundException { + checkPackageAccess(name); if ( loader != null ) { try { return Class.forName( name, false, loader ); Added: classlib6/core/src/openjdk/com/com/sun/beans/infos/ComponentBeanInfo.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/beans/infos/ComponentBeanInfo.java (rev 0) +++ classlib6/core/src/openjdk/com/com/sun/beans/infos/ComponentBeanInfo.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -0,0 +1,62 @@ +/* + * Copyright (c) 1996, 2012, 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.beans.infos; + +import java.beans.*; + +/** + * BeanInfo descriptor for a standard AWT component. + */ + +public class ComponentBeanInfo extends SimpleBeanInfo { + private static final Class beanClass = java.awt.Component.class; + + public PropertyDescriptor[] getPropertyDescriptors() { + try { + PropertyDescriptor + name = new PropertyDescriptor("name", beanClass), + background = new PropertyDescriptor("background", beanClass), + foreground = new PropertyDescriptor("foreground", beanClass), + font = new PropertyDescriptor("font", beanClass), + enabled = new PropertyDescriptor("enabled", beanClass), + visible = new PropertyDescriptor("visible", beanClass), + focusable = new PropertyDescriptor("focusable", beanClass); + + enabled.setExpert(true); + visible.setHidden(true); + + background.setBound(true); + foreground.setBound(true); + font.setBound(true); + focusable.setBound(true); + + PropertyDescriptor[] rv = {name, background, foreground, font, enabled, visible, focusable }; + return rv; + } catch (IntrospectionException e) { + throw new Error(e.toString()); + } + } +} Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java 2012-08-19 14:03:14 UTC (rev 5930) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -215,7 +215,7 @@ // ClientRequestInfo validity table (see ptc/00-08-06 table 21-1). // Note: These must be in the same order as specified in contants. - protected static final boolean validCall[][] = { + private static final boolean validCall[][] = { // LEGEND: // s_req = send_request r_rep = receive_reply // s_pol = send_poll r_exc = receive_exception Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java 2012-08-19 14:03:14 UTC (rev 5930) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -195,7 +195,7 @@ // ServerRequestInfo validity table (see ptc/00-08-06 table 21-2). // Note: These must be in the same order as specified in contants. - protected static final boolean validCall[][] = { + private static final boolean validCall[][] = { // LEGEND: // r_rsc = receive_request_service_contexts // r_req = receive_request Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java 2012-08-19 14:03:14 UTC (rev 5930) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, 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 @@ -130,12 +130,25 @@ private UtilSystemException utilWrapper = UtilSystemException.get( CORBALogDomains.RPC_ENCODING); - public static Util instance = null; + private static Util instance = null; public Util() { - instance = this; + setInstance(this); } + private static void setInstance( Util util ) { + assert instance == null : "Instance already defined"; + instance = util; + } + + public static Util getInstance() { + return instance; + } + + public static boolean isInstanceDefined() { + return instance != null; + } + // Used by TOAFactory.shutdown to unexport all targets for this // particular ORB. This happens during ORB shutdown. public void unregisterTargetsForORB(org.omg.CORBA.ORB orb) Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java 2012-08-19 14:03:14 UTC (rev 5930) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, 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 @@ -93,7 +93,7 @@ activeObjectMap.putServant( servant, entry ) ; - if (Util.instance != null) { + if (Util.isInstanceDefined()) { POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ; POAFactory factory = pm.getFactory() ; factory.registerPOAForServant(poa, servant); @@ -133,7 +133,7 @@ activeObjectMap.remove(key); - if (Util.instance != null) { + if (Util.isInstanceDefined()) { POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ; POAFactory factory = pm.getFactory() ; factory.unregisterPOAForServant(poa, s); Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/oa/toa/TOAFactory.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/oa/toa/TOAFactory.java 2012-08-19 14:03:14 UTC (rev 5930) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/oa/toa/TOAFactory.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, 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 @@ -78,8 +78,8 @@ public void shutdown( boolean waitForCompletion ) { - if (Util.instance != null) { - Util.instance.unregisterTargetsForORB(orb); + if (Util.isInstanceDefined()) { + Util.getInstance().unregisterTargetsForORB(orb); } } Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/orb/ParserTable.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/orb/ParserTable.java 2012-08-19 14:03:14 UTC (rev 5930) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/orb/ParserTable.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, 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 @@ -106,7 +106,9 @@ public ParserData[] getParserData() { - return parserData ; + ParserData[] parserArray = new ParserData[parserData.length]; + System.arraycopy(parserData, 0, parserArray, 0, parserData.length); + return parserArray; } private ParserTable() { Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java 2012-08-19 14:03:14 UTC (rev 5930) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/orbutil/RepositoryId_1_3.java 2012-09-23 09:24:10 UTC (rev 5931) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -62,7 +62,7 @@ // legal use of '.' in a Java name. public static final RepositoryIdCache_1_3 cache = new RepositoryIdCache_1_3(); - public static final byte[] IDL_IDENTIFIER_CHARS = { + private static final byte[] IDL_IDENTIFIER_CHARS = { // 0 1 2 3 4 5 6 7 8 9 a b c d e f 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f @@ -180,7 +180,7 @@ public static final String kRemoteTypeStr = ""; public static final String kRemoteValueRepID = ""; - public static final Hashtable kSpecialArrayTypeStrings = new Hashtable(); + private static final Hashtable kSpecialArrayTypeStrings = new Hashtable(); static { kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName())); @@ -189,7 +189,7 @@ } - public static final Hashtable kSpecialCasesRepIDs = new Hashtable(); + private static final Hashtable kSpecialCasesRepIDs = new Hashtable(); static { kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID); @@ -197,7 +197,7 @@ kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID); } - public static final Hashtable kSpecialCasesStubValues = new Hashtable(); + private static final Hashtable kSpecialCasesStubValues = new Hashtable(); static { kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue); @@ -209,7 +209,7 @@ } - public static final Hashtable kSpecialCasesVersions = new Hashtable(); + private static final Hashtable kSpecialCasesVersions = new Hashtable(); static { kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash); @@ -220,7 +220,7 @@ kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash); } - public static final Hashtable kSpecialCasesClasses = new Hashtable(); + private static final Hashtable kSpecialCasesClasses = new Hashtable(); static { kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class); @@ -232,7 +232,7 @@ //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); } - public static final Hashtable kSpecialCasesArrayPrefix = new Hashtable(); + private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable(); static { kSpecialCasesArrayPrefix.p... [truncated message content] |
From: <ls...@us...> - 2012-08-19 14:03:20
|
Revision: 5930 http://jnode.svn.sourceforge.net/jnode/?rev=5930&view=rev Author: lsantha Date: 2012-08-19 14:03:14 +0000 (Sun, 19 Aug 2012) Log Message: ----------- Updated IDEA project. Modified Paths: -------------- classlib6/Classlib6.ipr Modified: classlib6/Classlib6.ipr =================================================================== --- classlib6/Classlib6.ipr 2012-08-19 14:01:57 UTC (rev 5929) +++ classlib6/Classlib6.ipr 2012-08-19 14:03:14 UTC (rev 5930) @@ -15,6 +15,11 @@ <properties /> </buildFile> </component> + <component name="BSFConsole"> + <option name="searchOptions"> + <BSFConsoleSearchOptions /> + </option> + </component> <component name="BuildJarProjectSettings"> <option name="BUILD_JARS_ON_MAKE" value="false" /> </component> @@ -375,6 +380,112 @@ </item> </group> </component> + <component name="ProjectCodeStyleSettingsManager"> + <option name="PER_PROJECT_SETTINGS"> + <value> + <option name="JAVA_INDENT_OPTIONS"> + <value> + <option name="INDENT_SIZE" value="4" /> + <option name="CONTINUATION_INDENT_SIZE" value="4" /> + <option name="TAB_SIZE" value="4" /> + <option name="USE_TAB_CHARACTER" value="false" /> + <option name="SMART_TABS" value="false" /> + <option name="LABEL_INDENT_SIZE" value="-4" /> + <option name="LABEL_INDENT_ABSOLUTE" value="false" /> + <option name="USE_RELATIVE_INDENTS" value="false" /> + </value> + </option> + <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="100" /> + <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="100" /> + <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND"> + <value /> + </option> + <option name="IMPORT_LAYOUT_TABLE"> + <value> + <package name="" withSubpackages="true" static="false" /> + <emptyLine /> + <package name="javax" withSubpackages="false" static="false" /> + <package name="java" withSubpackages="false" static="false" /> + <emptyLine /> + <package name="" withSubpackages="true" static="true" /> + </value> + </option> + <option name="CALL_PARAMETERS_WRAP" value="1" /> + <option name="METHOD_PARAMETERS_WRAP" value="1" /> + <option name="THROWS_LIST_WRAP" value="1" /> + <option name="EXTENDS_KEYWORD_WRAP" value="1" /> + <option name="THROWS_KEYWORD_WRAP" value="1" /> + <option name="METHOD_CALL_CHAIN_WRAP" value="1" /> + <option name="BINARY_OPERATION_WRAP" value="1" /> + <option name="TERNARY_OPERATION_WRAP" value="1" /> + <option name="ARRAY_INITIALIZER_WRAP" value="1" /> + <option name="ASSIGNMENT_WRAP" value="1" /> + <XML> + <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" /> + </XML> + <ADDITIONAL_INDENT_OPTIONS fileType="gsp"> + <option name="INDENT_SIZE" value="2" /> + </ADDITIONAL_INDENT_OPTIONS> + <ADDITIONAL_INDENT_OPTIONS fileType="haml"> + <option name="INDENT_SIZE" value="2" /> + </ADDITIONAL_INDENT_OPTIONS> + <ADDITIONAL_INDENT_OPTIONS fileType="yml"> + <option name="INDENT_SIZE" value="2" /> + </ADDITIONAL_INDENT_OPTIONS> + <codeStyleSettings language="Groovy"> + <option name="CALL_PARAMETERS_WRAP" value="1" /> + <option name="METHOD_PARAMETERS_WRAP" value="1" /> + <option name="THROWS_LIST_WRAP" value="1" /> + <option name="EXTENDS_KEYWORD_WRAP" value="1" /> + <option name="THROWS_KEYWORD_WRAP" value="1" /> + <option name="METHOD_CALL_CHAIN_WRAP" value="1" /> + <option name="BINARY_OPERATION_WRAP" value="1" /> + <option name="TERNARY_OPERATION_WRAP" value="1" /> + <option name="ARRAY_INITIALIZER_WRAP" value="1" /> + <option name="ASSIGNMENT_WRAP" value="1" /> + <option name="PARENT_SETTINGS_INSTALLED" value="true" /> + <indentOptions> + <option name="INDENT_SIZE" value="2" /> + </indentOptions> + </codeStyleSettings> + <codeStyleSettings language="JAVA"> + <option name="CALL_PARAMETERS_WRAP" value="1" /> + <option name="METHOD_PARAMETERS_WRAP" value="1" /> + <option name="THROWS_LIST_WRAP" value="1" /> + <option name="EXTENDS_KEYWORD_WRAP" value="1" /> + <option name="THROWS_KEYWORD_WRAP" value="1" /> + <option name="METHOD_CALL_CHAIN_WRAP" value="1" /> + <option name="BINARY_OPERATION_WRAP" value="1" /> + <option name="TERNARY_OPERATION_WRAP" value="1" /> + <option name="ARRAY_INITIALIZER_WRAP" value="1" /> + <option name="ASSIGNMENT_WRAP" value="1" /> + <option name="PARENT_SETTINGS_INSTALLED" value="true" /> + <indentOptions> + <option name="CONTINUATION_INDENT_SIZE" value="4" /> + <option name="LABEL_INDENT_SIZE" value="-4" /> + </indentOptions> + </codeStyleSettings> + <codeStyleSettings language="JavaScript"> + <option name="CALL_PARAMETERS_WRAP" value="1" /> + <option name="METHOD_PARAMETERS_WRAP" value="1" /> + <option name="BINARY_OPERATION_WRAP" value="1" /> + <option name="TERNARY_OPERATION_WRAP" value="1" /> + <option name="ARRAY_INITIALIZER_WRAP" value="1" /> + <option name="ASSIGNMENT_WRAP" value="1" /> + <option name="PARENT_SETTINGS_INSTALLED" value="true" /> + </codeStyleSettings> + <codeStyleSettings language="Scala"> + <option name="CALL_PARAMETERS_WRAP" value="1" /> + <option name="METHOD_PARAMETERS_WRAP" value="1" /> + <option name="EXTENDS_KEYWORD_WRAP" value="1" /> + <option name="METHOD_CALL_CHAIN_WRAP" value="1" /> + <option name="BINARY_OPERATION_WRAP" value="1" /> + <option name="PARENT_SETTINGS_INSTALLED" value="true" /> + </codeStyleSettings> + </value> + </option> + <option name="USE_PER_PROJECT_SETTINGS" value="true" /> + </component> <component name="ProjectDetails"> <option name="projectName" value="Classlib6" /> </component> @@ -406,20 +517,6 @@ <entry key="$PROJECT_DIR$"> <value> <SvnBranchConfiguration> - <option name="branchMap"> - <map> - <entry key="https://jnode.svn.sourceforge.net/svnroot/jnode/branches"> - <value> - <list /> - </value> - </entry> - <entry key="https://jnode.svn.sourceforge.net/svnroot/jnode/tags"> - <value> - <list /> - </value> - </entry> - </map> - </option> <option name="branchUrls"> <list> <option value="https://jnode.svn.sourceforge.net/svnroot/jnode/branches" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2012-08-19 14:02:04
|
Revision: 5929 http://jnode.svn.sourceforge.net/jnode/?rev=5929&view=rev Author: lsantha Date: 2012-08-19 14:01:57 +0000 (Sun, 19 Aug 2012) Log Message: ----------- Updated Netbeans project files. Modified Paths: -------------- classlib6/netbeans/nbproject/build-impl.xml classlib6/netbeans/nbproject/genfiles.properties Modified: classlib6/netbeans/nbproject/build-impl.xml =================================================================== --- classlib6/netbeans/nbproject/build-impl.xml 2012-08-19 13:34:02 UTC (rev 5928) +++ classlib6/netbeans/nbproject/build-impl.xml 2012-08-19 14:01:57 UTC (rev 5929) @@ -12,18 +12,18 @@ - execution - debugging - javadoc - - junit compilation - - junit execution - - junit debugging + - test compilation + - test execution + - test debugging - applet - cleanup --> <project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="JNode_Classlib6-impl"> - <fail message="Please build using Ant 1.7.1 or higher."> + <fail message="Please build using Ant 1.8.0 or higher."> <condition> <not> - <antversion atleast="1.7.1"/> + <antversion atleast="1.8.0"/> </not> </condition> </fail> @@ -196,6 +196,7 @@ </and> </condition> <property name="run.jvmargs" value=""/> + <property name="run.jvmargs.ide" value=""/> <property name="javac.compilerargs" value=""/> <property name="work.dir" value="${basedir}"/> <condition property="no.deps"> @@ -238,7 +239,29 @@ <property name="javac.fork" value="${jdkBug6558476}"/> <property name="jar.index" value="false"/> <property name="jar.index.metainf" value="${jar.index}"/> + <property name="copylibs.rebase" value="true"/> <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> + <condition property="junit.available"> + <or> + <available classname="org.junit.Test" classpath="${run.test.classpath}"/> + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> + </or> + </condition> + <condition property="testng.available"> + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> + </condition> + <condition property="junit+testng.available"> + <and> + <istrue value="${junit.available}"/> + <istrue value="${testng.available}"/> + </and> + </condition> + <condition else="testng" property="testng.mode" value="mixed"> + <istrue value="${junit+testng.available}"/> + </condition> + <condition else="" property="testng.debug.mode" value="-mixed"> + <istrue value="${junit+testng.available}"/> + </condition> </target> <target name="-post-init"> <!-- Empty placeholder for easier customization. --> @@ -412,41 +435,312 @@ </sequential> </macrodef> </target> - <target name="-init-macrodef-junit"> + <target if="${junit.available}" name="-init-macrodef-junit-init"> + <condition else="false" property="nb.junit.batch" value="true"> + <and> + <istrue value="${junit.available}"/> + <not> + <isset property="test.method"/> + </not> + </and> + </condition> + <condition else="false" property="nb.junit.single" value="true"> + <and> + <istrue value="${junit.available}"/> + <isset property="test.method"/> + </and> + </condition> + </target> + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> <attribute default="${includes}" name="includes"/> <attribute default="${excludes}" name="excludes"/> <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> <sequential> <property name="junit.forkmode" value="perTest"/> <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> <batchtest todir="${build.test.results.dir}"/> - <classpath> - <path path="${run.test.classpath}"/> - </classpath> <syspropertyset> <propertyref prefix="test-sys-prop."/> <mapper from="test-sys-prop.*" to="*" type="glob"/> </syspropertyset> <formatter type="brief" usefile="false"/> <formatter type="xml"/> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> <jvmarg value="-ea"/> - <jvmarg line="${run.jvmargs}"/> + <customize/> </junit> </sequential> </macrodef> </target> - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/> - <target name="-profile-pre-init"> + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> + <target if="${testng.available}" name="-init-macrodef-testng"> + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> + <isset property="test.method"/> + </condition> + <union id="test.set"/> + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> + <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="JNode_Classlib6" testname="TestNG tests" workingDir="${work.dir}"> + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> + <propertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </propertyset> + <customize/> + </testng> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-test-impl"> + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <echo>No tests executed.</echo> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize/> + </j2seproject3:junit> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize/> + </j2seproject3:testng> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <sequential> + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + </customize> + </j2seproject3:test-impl> + </sequential> + </macrodef> + </target> + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <jvmarg line="${debug-args-line}"/> + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element name="customize" optional="true"/> + <sequential> + <property name="junit.forkmode" value="perTest"/> + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> + <batchtest todir="${build.test.results.dir}"/> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg value="-ea"/> + <jvmarg line="${debug-args-line}"/> + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> + <customize/> + </junit> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <element implicit="true" name="customize" optional="true"/> + <sequential> + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize/> + </j2seproject3:junit-debug> + </sequential> + </macrodef> + </target> + <target if="${testng.available}" name="-init-macrodef-testng-debug"> + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <element name="customize2" optional="true"/> + <sequential> + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> + <isset property="test.method"/> + </condition> + <condition else="-suitename JNode_Classlib6 -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> + <matches pattern=".*\.xml" string="@{testClass}"/> + </condition> + <delete dir="${build.test.results.dir}" quiet="true"/> + <mkdir dir="${build.test.results.dir}"/> + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> + <customize> + <customize2/> + <jvmarg value="-ea"/> + <arg line="${testng.debug.mode}"/> + <arg line="-d ${build.test.results.dir}"/> + <arg line="-listener org.testng.reporters.VerboseReporter"/> + <arg line="${testng.cmd.args}"/> + </customize> + </j2seproject3:debug> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <element implicit="true" name="customize2" optional="true"/> + <sequential> + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> + <customize2/> + </j2seproject3:testng-debug> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <sequential> + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> + <customize> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> + <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> + </customize> + </j2seproject3:test-debug-impl> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="**" name="testincludes"/> + <attribute default="" name="testmethods"/> + <attribute default="${main.class}" name="testClass"/> + <attribute default="" name="testMethod"/> + <sequential> + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> + <customize2> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper from="test-sys-prop.*" to="*" type="glob"/> + </syspropertyset> + </customize2> + </j2seproject3:testng-debug-impl> + </sequential> + </macrodef> + </target> + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> + <!-- + pre NB7.2 profiling section; consider it deprecated + --> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target name="-profile-post-init"> + <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target name="-profile-init-macrodef-profile"> + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile"> <macrodef name="resolve"> <attribute name="name"/> <attribute name="value"/> @@ -461,6 +755,7 @@ <property environment="env"/> <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}"> + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> <jvmarg value="${profiler.info.jvmargs.agent}"/> <jvmarg line="${profiler.info.jvmargs}"/> <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> @@ -477,10 +772,13 @@ </sequential> </macrodef> </target> - <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check"> + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check"> <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> </target> + <!-- + end of pre NB7.2 profiling section + --> <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> <attribute default="${main.class}" name="name"/> @@ -538,6 +836,7 @@ <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> <classpath> <path path="@{classpath}"/> </classpath> @@ -554,6 +853,7 @@ <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> <attribute default="${main.class}" name="classname"/> <attribute default="${run.classpath}" name="classpath"/> + <attribute default="jvm" name="jvm"/> <element name="customize" optional="true"/> <sequential> <java classname="@{classname}" dir="${work.dir}" fork="true"> @@ -561,6 +861,7 @@ <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> <jvmarg line="${run.jvmargs}"/> + <jvmarg line="${run.jvmargs.ide}"/> <classpath> <path path="@{classpath}"/> </classpath> @@ -587,11 +888,14 @@ <path path="${run.classpath.without.build.classes.dir}"/> <chainedmapper> <flattenmapper/> + <filtermapper> + <replacestring from=" " to="%20"/> + </filtermapper> <globmapper from="*" to="lib/*"/> </chainedmapper> </pathconvert> <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> + <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> <fileset dir="${build.classes.dir}"/> <manifest> <attribute name="Class-Path" value="${jar.classpath}"/> @@ -632,7 +936,7 @@ <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> <property name="ap.cmd.line.internal" value=""/> </target> - <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> <!-- =================== COMPILATION SECTION @@ -890,7 +1194,11 @@ PROFILING SECTION ================= --> - <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile"> + <!-- + pre NB7.2 profiler integration + --> + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> @@ -898,8 +1206,9 @@ </nbprofiledirect> <profile/> </target> - <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single"> + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72"> <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> @@ -907,12 +1216,8 @@ </nbprofiledirect> <profile classname="${profile.class}"/> </target> - <!-- - ========================= - APPLET PROFILING SECTION - ========================= - --> - <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet"> + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72"> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> <nbprofiledirect> <classpath> <path path="${run.classpath}"/> @@ -924,12 +1229,8 @@ </customize> </profile> </target> - <!-- - ========================= - TESTS PROFILING SECTION - ========================= - --> - <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single"> + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> <nbprofiledirect> <classpath> <path path="${run.test.classpath}"/> @@ -952,148 +1253,194 @@ </junit> </target> <!-- + end of pre NB72 profiling section + --> + <target if="netbeans.home" name="-profile-check"> + <condition property="profiler.configured"> + <or> + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> + </or> + </condition> + </target> + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> + <startprofiler/> + <antcall target="run"/> + </target> + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <startprofiler/> + <antcall target="run-single"/> + </target> + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/> + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs"> + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> + <startprofiler/> + <antcall target="test-single"/> + </target> + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <startprofiler/> + <antcal target="run-test-with-main"/> + </target> + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent"> + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> + <startprofiler/> + <antcall target="run-applet"/> + </target> + <!-- =============== JAVADOC SECTION =============== --> <target depends="init" if="have.sources" name="-javadoc-build"> <mkdir dir="${dist.javadoc.dir}"/> + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}"> + <and> + <isset property="endorsed.classpath.cmd.line.arg"/> + <not> + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/> + </not> + </and> + </condition> <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> <classpath> <path path="${javac.classpath}"/> </classpath> - <fileset dir="${src.core.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.core.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.apps.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.apps.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.emu.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.emu.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.install.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.install.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.test.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.test.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.driver.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.driver.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.fs.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.fs.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.test2.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.test2.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.awt.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.awt.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.desktop.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.desktop.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.driver2.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.driver2.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.font.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.font.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.test3.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.test3.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.thinlet.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.thinlet.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.driver3.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.driver3.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.net.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.net.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.test4.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.test4.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.shell.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.shell.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.test5.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.test5.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.driver4.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.driver4.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.sound.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.sound.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.test6.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.test6.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.textui.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.textui.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.driver5.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.driver5.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.nanoxml.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.nanoxml.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.icedtea.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.icedtea.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.mmtk-vm.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.mmtk-vm.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.com.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.com.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.java.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.java.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.javax.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.javax.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.org.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.org.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.sun.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.sun.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.vm.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.vm.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.test7.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.test7.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.vmmagic.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.vmmagic.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${configure.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${configure.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${ext.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${ext.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${gnu.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${gnu.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${java.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${java.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${javax.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${javax.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${tools.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${tools.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> - <fileset dir="${vm.dir}" excludes="${excludes}" includes="${includes}"> + <fileset dir="${vm.dir}" excludes="*.java,${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> <include name="**/*.java"/> + <exclude name="*.java"/> </fileset> + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/> </javadoc> <copy todir="${dist.javadoc.dir}"> <fileset dir="${src.core.dir}" excludes="${excludes}" includes="${includes}"> @@ -1236,7 +1583,7 @@ <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> <!-- ========================= - JUNIT COMPILATION SECTION + TEST COMPILATION SECTION ========================= --> <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> @@ -1275,14 +1622,14 @@ <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> <!-- ======================= - JUNIT EXECUTION SECTION + TEST EXECUTION SECTION ======================= --> <target depends="init" if="have.tests" name="-pre-test-run"> <mkdir dir="${build.test.results.dir}"/> </target> <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> - <j2seproject3:junit testincludes="**/*Test.java"/> + <j2seproject3:test testincludes="**/*Test.java"/> </target> <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> @@ -1295,39 +1642,40 @@ </target> <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> - <j2seproject3:junit excludes="" includes="${test.includes}"/> + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> </target> <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> </target> <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> + <fail unless="test.class">Must select some files in the IDE or set test.class</fail> + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> + </target> + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> <!-- ======================= - JUNIT DEBUGGING SECTION + TEST DEBUGGING SECTION ======================= --> - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test"> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> <fail unless="test.class">Must select one file in the IDE or set test.class</fail> - <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/> - <delete file="${test.report.file}"/> - <mkdir dir="${build.test.results.dir}"/> - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}"> - <customize> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <arg value="${test.class}"/> - <arg value="showoutput=true"/> - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/> - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/> - </customize> - </j2seproject3:debug> + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> </target> + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> + </target> <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> </target> <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> </target> @@ -1392,9 +1740,12 @@ <target name="-check-call-dep"> <property file="${call.built.properties}" prefix="already.built."/> <condition property="should.call.dep"> - <not> - <isset property="already.built.${call.subproject}"/> - </not> + <and> + <not> + <isset property="already.built.${call.subproject}"/> + </not> + <available file="${call.script}"/> + </and> </condition> </target> <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> Modified: classlib6/netbeans/nbproject/genfiles.properties =================================================================== --- classlib6/netbeans/nbproject/genfiles.properties 2012-08-19 13:34:02 UTC (rev 5928) +++ classlib6/netbeans/nbproject/genfiles.properties 2012-08-19 14:01:57 UTC (rev 5929) @@ -4,5 +4,5 @@ # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=bac8544f -nbproject/build-impl.xml.script.CRC32=0b5a17db -nbproject/build-impl.xml.stylesheet.CRC32=0c01fd8e@1.43.1.45 +nbproject/build-impl.xml.script.CRC32=c95597a5 +nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2012-08-19 13:34:12
|
Revision: 5928 http://jnode.svn.sourceforge.net/jnode/?rev=5928&view=rev Author: lsantha Date: 2012-08-19 13:34:02 +0000 (Sun, 19 Aug 2012) Log Message: ----------- Integrating OpenJDK 6 build 25. Modified Paths: -------------- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java classlib6/core/src/openjdk/com/com/sun/corba/se/impl/io/IIOPInputStream.java classlib6/core/src/openjdk/com/com/sun/media/sound/DirectAudioDevice.java classlib6/core/src/openjdk/com/com/sun/media/sound/SoftMixingSourceDataLine.java classlib6/core/src/openjdk/com/com/sun/net/ssl/HttpsURLConnection.java classlib6/core/src/openjdk/com/com/sun/org/apache/xml/internal/security/utils/Base64.java classlib6/core/src/openjdk/com/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java classlib6/core/src/openjdk/com/com/sun/security/auth/LdapPrincipal.java classlib6/core/src/openjdk/com/com/sun/security/sasl/CramMD5Client.java classlib6/core/src/openjdk/com/com/sun/security/sasl/CramMD5Server.java classlib6/core/src/openjdk/com/com/sun/security/sasl/ExternalClient.java classlib6/core/src/openjdk/com/com/sun/security/sasl/gsskerb/GssKrb5Client.java classlib6/core/src/openjdk/com/com/sun/security/sasl/gsskerb/GssKrb5Server.java classlib6/core/src/openjdk/java/java/awt/AWTKeyStroke.java classlib6/core/src/openjdk/java/java/io/InputStream.java classlib6/core/src/openjdk/java/java/io/ObjectStreamClass.java classlib6/core/src/openjdk/java/java/net/URI.java classlib6/core/src/openjdk/java/java/nio/charset/package.html classlib6/core/src/openjdk/java/java/sql/Timestamp.java classlib6/core/src/openjdk/java/java/util/TimeZone.java classlib6/core/src/openjdk/java/java/util/concurrent/atomic/AtomicReferenceArray.java classlib6/core/src/openjdk/javax/javax/management/remote/JMXServiceURL.java classlib6/core/src/openjdk/javax/javax/naming/ldap/LdapName.java classlib6/core/src/openjdk/javax/javax/naming/ldap/Rdn.java classlib6/core/src/openjdk/javax/javax/net/ssl/HttpsURLConnection.java classlib6/core/src/openjdk/javax/javax/net/ssl/SSLContext.java classlib6/core/src/openjdk/javax/javax/print/DocFlavor.java classlib6/core/src/openjdk/javax/javax/swing/ImageIcon.java classlib6/core/src/openjdk/langtools/com/sun/tools/javadoc/JavadocTool.java classlib6/core/src/openjdk/sun/sun/awt/image/PNGImageDecoder.java classlib6/core/src/openjdk/sun/sun/font/FileFontStrike.java classlib6/core/src/openjdk/sun/sun/java2d/pipe/DrawImage.java classlib6/core/src/openjdk/sun/sun/misc/SharedSecrets.java classlib6/core/src/openjdk/sun/sun/net/ResourceManager.java classlib6/core/src/openjdk/sun/sun/net/httpserver/Request.java classlib6/core/src/openjdk/sun/sun/net/httpserver/ServerConfig.java classlib6/core/src/openjdk/sun/sun/net/www/protocol/http/HttpURLConnection.java classlib6/core/src/openjdk/sun/sun/net/www/protocol/https/HttpsClient.java classlib6/core/src/openjdk/sun/sun/reflect/annotation/AnnotationInvocationHandler.java classlib6/core/src/openjdk/sun/sun/reflect/annotation/AnnotationTypeMismatchExceptionProxy.java classlib6/core/src/openjdk/sun/sun/reflect/annotation/EnumConstantNotPresentExceptionProxy.java classlib6/core/src/openjdk/sun/sun/reflect/annotation/TypeNotPresentExceptionProxy.java classlib6/core/src/openjdk/sun/sun/rmi/registry/RegistryImpl.java classlib6/core/src/openjdk/sun/sun/rmi/server/LoaderHandler.java classlib6/core/src/openjdk/sun/sun/rmi/server/UnicastServerRef.java classlib6/core/src/openjdk/sun/sun/security/jgss/krb5/InitialToken.java classlib6/core/src/openjdk/sun/sun/security/jgss/spnego/NegTokenInit.java classlib6/core/src/openjdk/sun/sun/security/jgss/spnego/SpNegoContext.java classlib6/core/src/openjdk/sun/sun/security/krb5/internal/ccache/CCacheInputStream.java classlib6/core/src/openjdk/sun/sun/security/krb5/internal/ccache/FileCredentialsCache.java classlib6/core/src/openjdk/sun/sun/security/provider/certpath/ForwardBuilder.java classlib6/core/src/openjdk/sun/sun/security/provider/certpath/ForwardState.java classlib6/core/src/openjdk/sun/sun/security/provider/certpath/PKIXCertPathValidator.java classlib6/core/src/openjdk/sun/sun/security/provider/certpath/ReverseBuilder.java classlib6/core/src/openjdk/sun/sun/security/provider/certpath/ReverseState.java classlib6/core/src/openjdk/sun/sun/security/provider/certpath/SunCertPathBuilder.java classlib6/core/src/openjdk/sun/sun/security/ssl/AppOutputStream.java classlib6/core/src/openjdk/sun/sun/security/ssl/CipherBox.java classlib6/core/src/openjdk/sun/sun/security/ssl/CipherSuite.java classlib6/core/src/openjdk/sun/sun/security/ssl/EngineArgs.java classlib6/core/src/openjdk/sun/sun/security/ssl/EngineOutputRecord.java classlib6/core/src/openjdk/sun/sun/security/ssl/Record.java classlib6/core/src/openjdk/sun/sun/security/ssl/SSLEngineImpl.java classlib6/core/src/openjdk/sun/sun/security/ssl/SSLSocketImpl.java classlib6/core/src/openjdk/sun/sun/security/validator/SimpleValidator.java classlib6/core/src/openjdk/sun/sun/security/validator/ValidatorException.java classlib6/core/src/openjdk/sun/sun/tools/jconsole/VMPanel.java Added Paths: ----------- classlib6/core/src/openjdk/sun/sun/misc/JavaAWTAccess.java classlib6/core/src/openjdk/sun/sun/security/provider/certpath/UntrustedChecker.java classlib6/core/src/openjdk/sun/sun/security/util/UntrustedCertificates.java Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, 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 @@ -82,6 +82,6 @@ private String[] __ids = { "IDL:omg.org/DynamicAny/DynAnyFactory:1.0" }; public String[] _ids() { - return __ids; + return (String[])__ids.clone(); } } Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, 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 @@ -195,6 +195,6 @@ private String[] __ids = { "IDL:omg.org/DynamicAny/DynAny:1.0" }; public String[] _ids() { - return __ids; + return (String[])__ids.clone(); } } Modified: classlib6/core/src/openjdk/com/com/sun/corba/se/impl/io/IIOPInputStream.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/corba/se/impl/io/IIOPInputStream.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/corba/se/impl/io/IIOPInputStream.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2011, 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 @@ -2239,6 +2239,10 @@ } try { + Class fieldCl = fields[i].getClazz(); + if (objectValue != null && !fieldCl.isInstance(objectValue)) { + throw new IllegalArgumentException(); + } bridge.putObject( o, fields[i].getFieldID(), objectValue ) ; // reflective code: fields[i].getField().set( o, objectValue ) ; } catch (IllegalArgumentException e) { @@ -2549,6 +2553,10 @@ { try { Field fld = c.getDeclaredField( fieldName ) ; + Class fieldCl = fld.getType(); + if(v != null && !fieldCl.isInstance(v)) { + throw new Exception(); + } long key = bridge.objectFieldOffset( fld ) ; bridge.putObject( o, key, v ) ; } catch (Exception e) { Modified: classlib6/core/src/openjdk/com/com/sun/media/sound/DirectAudioDevice.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/media/sound/DirectAudioDevice.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/media/sound/DirectAudioDevice.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -771,7 +771,7 @@ if (off < 0) { throw new ArrayIndexOutOfBoundsException(off); } - if (off + len > b.length) { + if ((long)off + (long)len > (long)b.length) { throw new ArrayIndexOutOfBoundsException(b.length); } @@ -1000,7 +1000,7 @@ if (off < 0) { throw new ArrayIndexOutOfBoundsException(off); } - if (off + len > b.length) { + if ((long)off + (long)len > (long)b.length) { throw new ArrayIndexOutOfBoundsException(b.length); } if (!isActive() && doIO) { Modified: classlib6/core/src/openjdk/com/com/sun/media/sound/SoftMixingSourceDataLine.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/media/sound/SoftMixingSourceDataLine.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/media/sound/SoftMixingSourceDataLine.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -130,6 +130,12 @@ if (len % framesize != 0) throw new IllegalArgumentException( "Number of bytes does not represent an integral number of sample frames."); + if (off < 0) { + throw new ArrayIndexOutOfBoundsException(off); + } + if ((long)off + (long)len > (long)b.length) { + throw new ArrayIndexOutOfBoundsException(b.length); + } byte[] buff = cycling_buffer; int buff_len = cycling_buffer.length; Modified: classlib6/core/src/openjdk/com/com/sun/net/ssl/HttpsURLConnection.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/net/ssl/HttpsURLConnection.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/net/ssl/HttpsURLConnection.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, 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 @@ -179,6 +179,12 @@ throw new IllegalArgumentException( "no SSLSocketFactory specified"); } + + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkSetFactory(); + } + sslSocketFactory = sf; } Modified: classlib6/core/src/openjdk/com/com/sun/org/apache/xml/internal/security/utils/Base64.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/org/apache/xml/internal/security/utils/Base64.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/org/apache/xml/internal/security/utils/Base64.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -48,7 +48,7 @@ * @author Raul Benito(Of the xerces copy, and little adaptations). * @author Anli Shundi * @author Christian Geuer-Pollmann - * @see <A HREF="ftp://ftp.isi.edu/in-notes/rfc2045.txt">RFC 2045</A> + * @see <A HREF="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</A> * @see com.sun.org.apache.xml.internal.security.transforms.implementations.TransformBase64Decode */ public class Base64 { Modified: classlib6/core/src/openjdk/com/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, 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 @@ -138,7 +138,7 @@ public String[] _ids () { - return __ids; + return (String[])__ids.clone(); } Modified: classlib6/core/src/openjdk/com/com/sun/security/auth/LdapPrincipal.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/security/auth/LdapPrincipal.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/security/auth/LdapPrincipal.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2012, 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 @@ -31,7 +31,7 @@ /** * A principal identified by a distinguished name as specified by - * <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a>. + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. * * <p> * After successful authentication, a user {@link java.security.Principal} @@ -122,7 +122,7 @@ /** * Creates a string representation of this principal's name in the format - * defined by <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>. + * defined by <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. * If the name has zero components an empty string is returned. * * @return The principal's string name. Modified: classlib6/core/src/openjdk/com/com/sun/security/sasl/CramMD5Client.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/security/sasl/CramMD5Client.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/security/sasl/CramMD5Client.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, 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 @@ -33,7 +33,7 @@ /** * Implements the CRAM-MD5 SASL client-side mechanism. - * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2195.txt">RFC 2195</A>). + * (<A HREF="http://www.ietf.org/rfc/rfc2195.txt">RFC 2195</A>). * CRAM-MD5 has no initial response. It receives bytes from * the server as a challenge, which it hashes by using MD5 and the password. * It concatenates the authentication ID with this result and returns it Modified: classlib6/core/src/openjdk/com/com/sun/security/sasl/CramMD5Server.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/security/sasl/CramMD5Server.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/security/sasl/CramMD5Server.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -38,7 +38,7 @@ /** * Implements the CRAM-MD5 SASL server-side mechanism. - * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2195.txt">RFC 2195</A>). + * (<A HREF="http://www.ietf.org/rfc/rfc2195.txt">RFC 2195</A>). * CRAM-MD5 has no initial response. * * client <---- M={random, timestamp, server-fqdn} ------- server Modified: classlib6/core/src/openjdk/com/com/sun/security/sasl/ExternalClient.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/security/sasl/ExternalClient.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/security/sasl/ExternalClient.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, 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 @@ -29,7 +29,7 @@ /** * Implements the EXTERNAL SASL client mechanism. - * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2222.txt">RFC 2222</A>). + * (<A HREF="http://www.ietf.org/rfc/rfc2222.txt">RFC 2222</A>). * The EXTERNAL mechanism returns the optional authorization ID as * the initial response. It processes no challenges. * Modified: classlib6/core/src/openjdk/com/com/sun/security/sasl/gsskerb/GssKrb5Client.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/security/sasl/gsskerb/GssKrb5Client.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/security/sasl/gsskerb/GssKrb5Client.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -39,10 +39,10 @@ /** * Implements the GSSAPI SASL client mechanism for Kerberos V5. - * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2222.txt">RFC 2222</A>, + * (<A HREF="http://www.ietf.org/rfc/rfc2222.txt">RFC 2222</A>, * <a HREF="http://www.ietf.org/internet-drafts/draft-ietf-cat-sasl-gssapi-04.txt">draft-ietf-cat-sasl-gssapi-04.txt</a>). * It uses the Java Bindings for GSSAPI - * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2853.txt">RFC 2853</A>) + * (<A HREF="http://www.ietf.org/rfc/rfc2853.txt">RFC 2853</A>) * for getting GSSAPI/Kerberos V5 support. * * The client/server interactions are: Modified: classlib6/core/src/openjdk/com/com/sun/security/sasl/gsskerb/GssKrb5Server.java =================================================================== --- classlib6/core/src/openjdk/com/com/sun/security/sasl/gsskerb/GssKrb5Server.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/com/com/sun/security/sasl/gsskerb/GssKrb5Server.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -39,7 +39,7 @@ /** * Implements the GSSAPI SASL server mechanism for Kerberos V5. - * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2222.txt">RFC 2222</A>, + * (<A HREF="http://www.ietf.org/rfc/rfc2222.txt">RFC 2222</A>, * <a HREF="http://www.ietf.org/internet-drafts/draft-ietf-cat-sasl-gssapi-00.txt">draft-ietf-cat-sasl-gssapi-00.txt</a>). * * Expects thread's Subject to contain server's Kerberos credentials Modified: classlib6/core/src/openjdk/java/java/awt/AWTKeyStroke.java =================================================================== --- classlib6/core/src/openjdk/java/java/awt/AWTKeyStroke.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/java/java/awt/AWTKeyStroke.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, 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 @@ -25,6 +25,7 @@ package java.awt; import java.awt.event.KeyEvent; +import sun.awt.AppContext; import java.awt.event.InputEvent; import java.util.Collections; import java.util.HashMap; @@ -66,9 +67,6 @@ public class AWTKeyStroke implements Serializable { static final long serialVersionUID = -6430539691155161871L; - private static Map cache; - private static AWTKeyStroke cacheKey; - private static Constructor ctor = getCtor(AWTKeyStroke.class); private static Map modifierKeywords; /** * Associates VK_XXX (as a String) with code (as Integer). This is @@ -77,6 +75,25 @@ */ private static VKCollection vks; + //A key for the collection of AWTKeyStrokes within AppContext. + private static Object APP_CONTEXT_CACHE_KEY = new Object(); + //A key withing the cache + private static AWTKeyStroke APP_CONTEXT_KEYSTROKE_KEY = new AWTKeyStroke(); + + /* + * Reads keystroke class from AppContext and if null, puts there the + * AWTKeyStroke class. + * Must be called under locked AWTKeyStroke.class + */ + private static Class getAWTKeyStrokeClass() { + Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); + if (clazz == null) { + clazz = AWTKeyStroke.class; + AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class); + } + return clazz; + } + private char keyChar = KeyEvent.CHAR_UNDEFINED; private int keyCode = KeyEvent.VK_UNDEFINED; private int modifiers; @@ -164,10 +181,13 @@ if (subclass == null) { throw new IllegalArgumentException("subclass cannot be null"); } - if (AWTKeyStroke.ctor.getDeclaringClass().equals(subclass)) { + synchronized (AWTKeyStroke.class) { + Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); + if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){ // Already registered return; } + } if (!AWTKeyStroke.class.isAssignableFrom(subclass)) { throw new ClassCastException("subclass is not derived from AWTKeyStroke"); } @@ -197,9 +217,9 @@ } synchronized (AWTKeyStroke.class) { - AWTKeyStroke.ctor = ctor; - cache = null; - cacheKey = null; + AppContext.getAppContext().put(AWTKeyStroke.class, subclass); + AppContext.getAppContext().remove(APP_CONTEXT_CACHE_KEY); + AppContext.getAppContext().remove(APP_CONTEXT_KEYSTROKE_KEY); } } @@ -229,13 +249,19 @@ private static synchronized AWTKeyStroke getCachedStroke (char keyChar, int keyCode, int modifiers, boolean onKeyRelease) { + Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY); + AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY); + if (cache == null) { cache = new HashMap(); + AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache); } if (cacheKey == null) { try { - cacheKey = (AWTKeyStroke)ctor.newInstance((Object[]) null); + Class clazz = getAWTKeyStrokeClass(); + cacheKey = (AWTKeyStroke)getCtor(clazz).newInstance((Object[]) null); + AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey); } catch (InstantiationException e) { assert(false); } catch (IllegalAccessException e) { @@ -253,9 +279,8 @@ if (stroke == null) { stroke = cacheKey; cache.put(stroke, stroke); - cacheKey = null; + AppContext.getAppContext().remove(APP_CONTEXT_KEYSTROKE_KEY); } - return stroke; } @@ -775,7 +800,8 @@ protected Object readResolve() throws java.io.ObjectStreamException { synchronized (AWTKeyStroke.class) { Class newClass = getClass(); - if (!newClass.equals(ctor.getDeclaringClass())) { + Class awtKeyStrokeClass = getAWTKeyStrokeClass(); + if (!newClass.equals(awtKeyStrokeClass)) { registerSubclass(newClass); } return getCachedStroke(keyChar, keyCode, modifiers, onKeyRelease); Modified: classlib6/core/src/openjdk/java/java/io/InputStream.java =================================================================== --- classlib6/core/src/openjdk/java/java/io/InputStream.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/java/java/io/InputStream.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2011, 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 @@ -44,10 +44,9 @@ */ public abstract class InputStream implements Closeable { - // SKIP_BUFFER_SIZE is used to determine the size of skipBuffer - private static final int SKIP_BUFFER_SIZE = 2048; - // skipBuffer is initialized in skip(long), if needed. - private static byte[] skipBuffer; + // MAX_SKIP_BUFFER_SIZE is used to determine the maximum buffer skip to + // use when skipping. + private static final int MAX_SKIP_BUFFER_SIZE = 2048; /** * Reads the next byte of data from the input stream. The value byte is @@ -212,18 +211,15 @@ long remaining = n; int nr; - if (skipBuffer == null) - skipBuffer = new byte[SKIP_BUFFER_SIZE]; - - byte[] localSkipBuffer = skipBuffer; if (n <= 0) { return 0; } + int size = (int)Math.min(MAX_SKIP_BUFFER_SIZE, remaining); + byte[] skipBuffer = new byte[size]; while (remaining > 0) { - nr = read(localSkipBuffer, 0, - (int) Math.min(SKIP_BUFFER_SIZE, remaining)); + nr = read(skipBuffer, 0, (int)Math.min(size, remaining)); if (nr < 0) { break; } Modified: classlib6/core/src/openjdk/java/java/io/ObjectStreamClass.java =================================================================== --- classlib6/core/src/openjdk/java/java/io/ObjectStreamClass.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/java/java/io/ObjectStreamClass.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, 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 @@ -730,7 +730,6 @@ InvalidClassException ice = new InvalidClassException(deserializeEx.classname, deserializeEx.getMessage()); - ice.initCause(deserializeEx); throw ice; } } @@ -745,7 +744,6 @@ InvalidClassException ice = new InvalidClassException(serializeEx.classname, serializeEx.getMessage()); - ice.initCause(serializeEx); throw ice; } } @@ -762,7 +760,6 @@ InvalidClassException ice = new InvalidClassException(defaultSerializeEx.classname, defaultSerializeEx.getMessage()); - ice.initCause(defaultSerializeEx); throw ice; } } Modified: classlib6/core/src/openjdk/java/java/net/URI.java =================================================================== --- classlib6/core/src/openjdk/java/java/net/URI.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/java/java/net/URI.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -457,7 +457,7 @@ * @author Mark Reinhold * @since 1.4 * - * @see <a href="http://ietf.org/rfc/rfc2279.txt"><i>RFC 2279: UTF-8, a + * @see <a href="http://www.ietf.org/rfc/rfc2279.txt"><i>RFC 2279: UTF-8, a * transformation format of ISO 10646</i></a>, <br><a * href="http://www.ietf.org/rfc/rfc2373.txt"><i>RFC 2373: IPv6 Addressing * Architecture</i></a>, <br><a Modified: classlib6/core/src/openjdk/java/java/nio/charset/package.html =================================================================== --- classlib6/core/src/openjdk/java/java/nio/charset/package.html 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/java/java/nio/charset/package.html 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ <!-- - Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2001, 2012, 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 @@ -48,7 +48,7 @@ <p> A <i>charset</i> is named mapping between sequences of sixteen-bit Unicode characters and sequences of bytes, in the sense defined in <a -href="http://ietf.org/rfc/rfc2278.txt"><i>RFC 2278</i></a>. A +href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC 2278</i></a>. A <i>decoder</i> is an engine which transforms bytes in a specific charset into characters, and an <i>encoder</i> is an engine which transforms characters into bytes. Encoders and decoders operate on byte and character buffers. They are Modified: classlib6/core/src/openjdk/java/java/sql/Timestamp.java =================================================================== --- classlib6/core/src/openjdk/java/java/sql/Timestamp.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/java/java/sql/Timestamp.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, 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 Modified: classlib6/core/src/openjdk/java/java/util/TimeZone.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/TimeZone.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/java/java/util/TimeZone.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2011, 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 @@ -43,6 +43,8 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.concurrent.ConcurrentHashMap; +import sun.misc.SharedSecrets; +import sun.misc.JavaAWTAccess; import sun.security.action.GetPropertyAction; import sun.util.TimeZoneNameUtility; import sun.util.calendar.ZoneInfo; @@ -542,7 +544,7 @@ * method doesn't create a clone. */ static TimeZone getDefaultRef() { - TimeZone defaultZone = defaultZoneTL.get(); + TimeZone defaultZone = getDefaultInAppContext(); if (defaultZone == null) { defaultZone = defaultTimeZone; if (defaultZone == null) { @@ -633,10 +635,53 @@ if (hasPermission()) { synchronized (TimeZone.class) { defaultTimeZone = zone; - defaultZoneTL.set(null); + setDefaultInAppContext(null); } } else { - defaultZoneTL.set(zone); + setDefaultInAppContext(zone); + } + } + + /** + * Returns the default TimeZone in an AppContext if any AppContext + * has ever used. null is returned if any AppContext hasn't been + * used or if the AppContext doesn't have the default TimeZone. + */ + private synchronized static TimeZone getDefaultInAppContext() { + javaAWTAccess = SharedSecrets.getJavaAWTAccess(); + if (javaAWTAccess == null) { + return mainAppContextDefault; + } else { + if (!javaAWTAccess.isDisposed()) { + TimeZone tz = (TimeZone) + javaAWTAccess.get(TimeZone.class); + if (tz == null && javaAWTAccess.isMainAppContext()) { + return mainAppContextDefault; + } else { + return tz; + } + } + } + return null; + } + + /** + * Sets the default TimeZone in the AppContext to the given + * tz. null is handled special: do nothing if any AppContext + * hasn't been used, remove the default TimeZone in the + * AppContext otherwise. + */ + private synchronized static void setDefaultInAppContext(TimeZone tz) { + javaAWTAccess = SharedSecrets.getJavaAWTAccess(); + if (javaAWTAccess == null) { + mainAppContextDefault = tz; + } else { + if (!javaAWTAccess.isDisposed()) { + javaAWTAccess.put(TimeZone.class, tz); + if (javaAWTAccess.isMainAppContext()) { + mainAppContextDefault = null; + } + } } } @@ -687,12 +732,24 @@ */ private String ID; private static volatile TimeZone defaultTimeZone; - private static final InheritableThreadLocal<TimeZone> defaultZoneTL - = new InheritableThreadLocal<TimeZone>(); static final String GMT_ID = "GMT"; private static final int GMT_ID_LENGTH = 3; + /* + * Provides access implementation-private methods without using reflection + * + * Note that javaAWTAccess may be null if sun.awt.AppContext class hasn't + * been loaded. If so, it implies that AWTSecurityManager is not our + * SecurityManager and we can use a local static variable. + * This works around a build time issue. + */ + private static JavaAWTAccess javaAWTAccess; + + // a static TimeZone we can reference if no AppContext is in place + private static TimeZone mainAppContextDefault; + + /** * Parses a custom time zone identifier and returns a corresponding zone. * This method doesn't support the RFC 822 time zone format. (e.g., +hhmm) Modified: classlib6/core/src/openjdk/java/java/util/concurrent/atomic/AtomicReferenceArray.java =================================================================== --- classlib6/core/src/openjdk/java/java/util/concurrent/atomic/AtomicReferenceArray.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/java/java/util/concurrent/atomic/AtomicReferenceArray.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -34,8 +34,9 @@ */ package java.util.concurrent.atomic; +import java.lang.reflect.Array; +import java.util.Arrays; import sun.misc.Unsafe; -import java.util.*; /** * An array of object references in which elements may be updated @@ -49,26 +50,45 @@ public class AtomicReferenceArray<E> implements java.io.Serializable { private static final long serialVersionUID = -6209656149925076980L; - private static final Unsafe unsafe = Unsafe.getUnsafe(); - private static final int base = unsafe.arrayBaseOffset(Object[].class); - private static final int scale = unsafe.arrayIndexScale(Object[].class); - private final Object[] array; + private static final Unsafe unsafe; + private static final int base; + private static final int shift; + private static final long arrayFieldOffset; + private final Object[] array; // must have exact type Object[] - private long rawIndex(int i) { + static { + int scale; + try { + unsafe = Unsafe.getUnsafe(); + arrayFieldOffset = unsafe.objectFieldOffset + (AtomicReferenceArray.class.getDeclaredField("array")); + base = unsafe.arrayBaseOffset(Object[].class); + scale = unsafe.arrayIndexScale(Object[].class); + } catch (Exception e) { + throw new Error(e); + } + if ((scale & (scale - 1)) != 0) + throw new Error("data type scale not a power of two"); + shift = 31 - Integer.numberOfLeadingZeros(scale); + } + + private long checkedByteOffset(int i) { if (i < 0 || i >= array.length) throw new IndexOutOfBoundsException("index " + i); - return base + (long) i * scale; + + return byteOffset(i); } + private static long byteOffset(int i) { + return ((long) i << shift) + base; + } + /** * Creates a new AtomicReferenceArray of given length. * @param length the length of the array */ public AtomicReferenceArray(int length) { array = new Object[length]; - // must perform at least one volatile write to conform to JMM - if (length > 0) - unsafe.putObjectVolatile(array, rawIndex(0), null); } /** @@ -79,18 +99,8 @@ * @throws NullPointerException if array is null */ public AtomicReferenceArray(E[] array) { - if (array == null) - throw new NullPointerException(); - int length = array.length; - this.array = new Object[length]; - if (length > 0) { - int last = length-1; - for (int i = 0; i < last; ++i) - this.array[i] = array[i]; - // Do the last write as volatile - E e = array[last]; - unsafe.putObjectVolatile(this.array, rawIndex(last), e); - } + // Visibility guaranteed by final field guarantees + this.array = Arrays.copyOf(array, array.length, Object[].class); } /** @@ -109,9 +119,13 @@ * @return the current value */ public final E get(int i) { - return (E) unsafe.getObjectVolatile(array, rawIndex(i)); + return getRaw(checkedByteOffset(i)); } + private E getRaw(long offset) { + return (E) unsafe.getObjectVolatile(array, offset); + } + /** * Sets the element at position {@code i} to the given value. * @@ -119,7 +133,7 @@ * @param newValue the new value */ public final void set(int i, E newValue) { - unsafe.putObjectVolatile(array, rawIndex(i), newValue); + unsafe.putObjectVolatile(array, checkedByteOffset(i), newValue); } /** @@ -130,7 +144,7 @@ * @since 1.6 */ public final void lazySet(int i, E newValue) { - unsafe.putOrderedObject(array, rawIndex(i), newValue); + unsafe.putOrderedObject(array, checkedByteOffset(i), newValue); } @@ -143,9 +157,10 @@ * @return the previous value */ public final E getAndSet(int i, E newValue) { + long offset = checkedByteOffset(i); while (true) { - E current = get(i); - if (compareAndSet(i, current, newValue)) + E current = getRaw(offset); + if (compareAndSetRaw(offset, current, newValue)) return current; } } @@ -153,6 +168,7 @@ /** * Atomically sets the element at position {@code i} to the given * updated value if the current value {@code ==} the expected value. + * * @param i the index * @param expect the expected value * @param update the new value @@ -160,10 +176,13 @@ * the actual value was not equal to the expected value. */ public final boolean compareAndSet(int i, E expect, E update) { - return unsafe.compareAndSwapObject(array, rawIndex(i), - expect, update); + return compareAndSetRaw(checkedByteOffset(i), expect, update); } + private boolean compareAndSetRaw(long offset, E expect, E update) { + return unsafe.compareAndSwapObject(array, offset, expect, update); + } + /** * Atomically sets the element at position {@code i} to the given * updated value if the current value {@code ==} the expected value. @@ -186,9 +205,33 @@ * @return the String representation of the current values of array. */ public String toString() { - if (array.length > 0) // force volatile read - get(0); - return Arrays.toString(array); + int iMax = array.length - 1; + if (iMax == -1) + return "[]"; + + StringBuilder b = new StringBuilder(); + b.append('['); + for (int i = 0; ; i++) { + b.append(getRaw(byteOffset(i))); + if (i == iMax) + return b.append(']').toString(); + b.append(',').append(' '); + } } + /** + * Reconstitutes the instance from a stream (that is, deserializes it). + * @param s the stream + */ + private void readObject(java.io.ObjectInputStream s) + throws java.io.IOException, ClassNotFoundException { + // Note: This must be changed if any additional fields are defined + Object a = s.readFields().get("array", null); + if (a == null || !a.getClass().isArray()) + throw new java.io.InvalidObjectException("Not array type"); + if (a.getClass() != Object[].class) + a = Arrays.copyOf((Object[])a, Array.getLength(a), Object[].class); + unsafe.putObjectVolatile(this, arrayFieldOffset, a); + } + } Modified: classlib6/core/src/openjdk/javax/javax/management/remote/JMXServiceURL.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/management/remote/JMXServiceURL.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/javax/javax/management/remote/JMXServiceURL.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, 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 @@ -107,10 +107,10 @@ * significant in the <code><em>url-path</em></code>.</p> * * @see <a - * href="ftp://ftp.rfc-editor.org/in-notes/rfc2609.txt">RFC 2609, + * href="http://www.ietf.org/rfc/rfc2609.txt">RFC 2609, * "Service Templates and <code>Service:</code> Schemes"</a> * @see <a - * href="ftp://ftp.rfc-editor.org/in-notes/rfc3111.txt">RFC 3111, + * href="http://www.ietf.org/rfc/rfc3111.txt">RFC 3111, * "Service Location Protocol Modifications for IPv6"</a> * * @since 1.5 Modified: classlib6/core/src/openjdk/javax/javax/naming/ldap/LdapName.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/naming/ldap/LdapName.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/javax/javax/naming/ldap/LdapName.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -42,7 +42,7 @@ /** * This class represents a distinguished name as specified by - * <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a>. + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. * A distinguished name, or DN, is composed of an ordered list of * components called <em>relative distinguished name</em>s, or RDNs. * Details of a DN's syntax are described in RFC 2253. @@ -115,7 +115,7 @@ * * @param name This is a non-null distinguished name formatted * according to the rules defined in - * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>. + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. * * @throws InvalidNameException if a syntax violation is detected. * @see Rdn#escapeValue(Object value) @@ -614,7 +614,7 @@ /** * Returns a string representation of this LDAP name in a format - * defined by <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a> + * defined by <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> * and described in the class description. If the name has zero * components an empty string is returned. * Modified: classlib6/core/src/openjdk/javax/javax/naming/ldap/Rdn.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/naming/ldap/Rdn.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/javax/javax/naming/ldap/Rdn.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -45,7 +45,7 @@ /** * This class represents a relative distinguished name, or RDN, which is a * component of a distinguished name as specified by - * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>. + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. * An example of an RDN is "OU=Sales+CN=J.Smith". In this example, * the RDN consist of multiple attribute type/value pairs. The * RDN is parsed as described in the class description for @@ -117,7 +117,7 @@ * {@link javax.naming.directory.Attributes Attributes}. * <p> * The string attribute values are not interpretted as - * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a> + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> * formatted RDN strings. That is, the values are used * literally (not parsed) and assumed to be unescaped. * @@ -152,7 +152,7 @@ /** * Constructs an Rdn from the given string. * This constructor takes a string formatted according to the rules - * defined in <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a> + * defined in <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> * and described in the class description for * {@link javax.naming.ldap.LdapName}. * @@ -180,7 +180,7 @@ * Constructs an Rdn from the given attribute type and * value. * The string attribute values are not interpretted as - * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a> + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> * formatted RDN strings. That is, the values are used * literally (not parsed) and assumed to be unescaped. * @@ -216,7 +216,7 @@ /* * Adds the given attribute type and value to this Rdn. * The string attribute values are not interpretted as - * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a> + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> * formatted RDN strings. That is the values are used * literally (not parsed) and assumed to be unescaped. * @@ -280,7 +280,7 @@ /** * Returns this Rdn as a string represented in a format defined by - * <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a> and described + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> and described * in the class description for {@link javax.naming.ldap.LdapName LdapName}. * * @return The string representation of the Rdn. @@ -503,7 +503,7 @@ /** * Given the value of an attribute, returns a string escaped according * to the rules specified in - * <a href="http://ietf.org/rfc/rfc2253.txt">RFC 2253</a>. + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>. * <p> * For example, if the val is "Sue, Grabbit and Runn", the escaped * value returned by this method is "Sue\, Grabbit and Runn". @@ -582,7 +582,7 @@ /** * Given an attribute value string formated according to the rules * specified in - * <a href="http://ietf.org//rfc/rfc2253.txt">RFC 2253</a>, + * <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a>, * returns the unformated value. Escapes and quotes are * stripped away, and hex-encoded UTF-8 is converted to equivalent * UTF-16 characters. Returns a string value as a String, and a Modified: classlib6/core/src/openjdk/javax/javax/net/ssl/HttpsURLConnection.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/net/ssl/HttpsURLConnection.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/javax/javax/net/ssl/HttpsURLConnection.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, 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 @@ -368,6 +368,10 @@ "no SSLSocketFactory specified"); } + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkSetFactory(); + } sslSocketFactory = sf; } Modified: classlib6/core/src/openjdk/javax/javax/net/ssl/SSLContext.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/net/ssl/SSLContext.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/javax/javax/net/ssl/SSLContext.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, 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 @@ -159,7 +159,7 @@ * * @param protocol the standard name of the requested protocol. * See Appendix A in the <a href= - * "{@docRoot}/../technotes/guides//security/jsse/JSSERefGuide.html#AppA"> + * "{@docRoot}/../technotes/guides/security/jsse/JSSERefGuide.html#AppA"> * Java Secure Socket Extension Reference Guide </a> * for information about standard protocol names. * Modified: classlib6/core/src/openjdk/javax/javax/print/DocFlavor.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/print/DocFlavor.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/javax/javax/print/DocFlavor.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, 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 @@ -451,7 +451,7 @@ /** * A String representing the host operating system encoding. * This will follow the conventions documented in - * <a href="http://ietf.org/rfc/rfc2278.txt"> + * <a href="http://www.ietf.org/rfc/rfc2278.txt"> * <i>RFC 2278: IANA Charset Registration Procedures</i></a> * except where historical names are returned for compatibility with * previous versions of the Java platform. Modified: classlib6/core/src/openjdk/javax/javax/swing/ImageIcon.java =================================================================== --- classlib6/core/src/openjdk/javax/javax/swing/ImageIcon.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/javax/javax/swing/ImageIcon.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, 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 Modified: classlib6/core/src/openjdk/langtools/com/sun/tools/javadoc/JavadocTool.java =================================================================== --- classlib6/core/src/openjdk/langtools/com/sun/tools/javadoc/JavadocTool.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/langtools/com/sun/tools/javadoc/JavadocTool.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, 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 @@ -260,24 +260,15 @@ for (String p: excludedPackages) includedPackages.put(p, false); - if (docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH)) { + StandardLocation path = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) + ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; + searchSubPackages(subPackages, includedPackages, packages, packageFiles, - StandardLocation.SOURCE_PATH, + path, EnumSet.of(JavaFileObject.Kind.SOURCE)); - searchSubPackages(subPackages, - includedPackages, - packages, packageFiles, - StandardLocation.CLASS_PATH, - EnumSet.of(JavaFileObject.Kind.CLASS)); - } else { - searchSubPackages(subPackages, - includedPackages, - packages, packageFiles, - StandardLocation.CLASS_PATH, - EnumSet.of(JavaFileObject.Kind.SOURCE, JavaFileObject.Kind.CLASS)); - } + return packageFiles; } Modified: classlib6/core/src/openjdk/sun/sun/awt/image/PNGImageDecoder.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/awt/image/PNGImageDecoder.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/sun/sun/awt/image/PNGImageDecoder.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2012, 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 @@ -32,7 +32,7 @@ import java.awt.Color; /** PNG - Portable Network Graphics - image file reader. - See <a href=ftp://ds.internic.net/rfc/rfc2083.txt>RFC2083</a> for details. */ + See <a href=http://www.ietf.org/rfc/rfc2083.txt>RFC2083</a> for details. */ /* this is changed public class PNGImageDecoder extends FilterInputStream implements Runnable Modified: classlib6/core/src/openjdk/sun/sun/font/FileFontStrike.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/font/FileFontStrike.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/sun/sun/font/FileFontStrike.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, 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 @@ -56,7 +56,7 @@ private static final int SEGINTARRAY = 3; private static final int SEGLONGARRAY = 4; - private int glyphCacheFormat = UNINITIALISED; + private volatile int glyphCacheFormat = UNINITIALISED; /* segmented arrays are blocks of 256 */ private static final int SEGSHIFT = 8; @@ -426,32 +426,34 @@ } /* Called only from synchronized code or constructor */ - private void initGlyphCache() { + private synchronized void initGlyphCache() { int numGlyphs = mapper.getNumGlyphs(); + int tmpFormat = UNINITIALISED; if (segmentedCache) { int numSegments = (numGlyphs + SEGSIZE-1)/SEGSIZE; if (FontManager.longAddresses) { - glyphCacheFormat = SEGLONGARRAY; + tmpFormat = SEGLONGARRAY; segLongGlyphImages = new long[numSegments][]; this.disposer.segLongGlyphImages = segLongGlyphImages; } else { - glyphCacheFormat = SEGINTARRAY; + tmpFormat = SEGINTARRAY; segIntGlyphImages = new int[numSegments][]; this.disposer.segIntGlyphImages = segIntGlyphImages; } } else { if (FontManager.longAddresses) { - glyphCacheFormat = LONGARRAY; + tmpFormat = LONGARRAY; longGlyphImages = new long[numGlyphs]; this.disposer.longGlyphImages = longGlyphImages; } else { - glyphCacheFormat = INTARRAY; + tmpFormat = INTARRAY; intGlyphImages = new int[numGlyphs]; this.disposer.intGlyphImages = intGlyphImages; } } + glyphCacheFormat = tmpFormat; } /* Metrics info is always retrieved. If the GlyphInfo address is non-zero Modified: classlib6/core/src/openjdk/sun/sun/java2d/pipe/DrawImage.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/java2d/pipe/DrawImage.java 2012-08-19 10:27:29 UTC (rev 5927) +++ classlib6/core/src/openjdk/sun/sun/java2d/pipe/DrawImage.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, 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 Added: classlib6/core/src/openjdk/sun/sun/misc/JavaAWTAccess.java =================================================================== --- classlib6/core/src/openjdk/sun/sun/misc/JavaAWTAccess.java (rev 0) +++ classlib6/core/src/openjdk/sun/sun/misc/JavaAWTAccess.java 2012-08-19 13:34:02 UTC (rev 5928) @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2011, 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 us... [truncated message content] |
From: <ls...@us...> - 2012-08-19 10:27:35
|
Revision: 5927 http://jnode.svn.sourceforge.net/jnode/?rev=5927&view=rev Author: lsantha Date: 2012-08-19 10:27:29 +0000 (Sun, 19 Aug 2012) Log Message: ----------- Undoing broken performance optimisation. Modified Paths: -------------- trunk/net/src/net/org/jnode/net/SocketBuffer.java Modified: trunk/net/src/net/org/jnode/net/SocketBuffer.java =================================================================== --- trunk/net/src/net/org/jnode/net/SocketBuffer.java 2012-08-10 07:28:37 UTC (rev 5926) +++ trunk/net/src/net/org/jnode/net/SocketBuffer.java 2012-08-19 10:27:29 UTC (rev 5927) @@ -171,7 +171,9 @@ size += count; } else { setSize(size + count); - System.arraycopy(data, start + count - count, data, start + count, size - 1 - count); + for (int i = size - 1; i >= count; i--) { + data[start + i] = data[start + i - count]; + } } for (int i = 0; i < count; i++) { data[start + i] = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |