Few fixes in natives.
--- a/src/JavaVM.st Mon Nov 14 23:01:13 2011 +0000
+++ b/src/JavaVM.st Tue Nov 15 00:11:34 2011 +0000
@@ -6238,11 +6238,38 @@
_java_lang_SecurityManager_getClassContext: nativeContext
<javanative: 'java/lang/SecurityManager' name: 'getClassContext'>
-
- ^ nil "UnimplementedNativeMethodSignal raise"
+ "
+ /**
+ * Returns the current execution stack as an array of classes.
+ * <p>
+ * The length of the array is the number of methods on the execution
+ * stack. The element at index <code>0</code> is the class of the
+ * currently executing method, the element at index <code>1</code> is
+ * the class of that method's caller, and so on.
+ *
+ * @return the execution stack.
+ */
+
+ "
+
+ | classes ctx jclasses |
+ classes := OrderedCollection new.
+ ctx := thisContext.
+ [ ctx notNil ] whileTrue: [
+ ctx isJavaContext ifTrue:[
+ classes add: ctx method javaClass.
+ ].
+ ctx := ctx sender.
+ ].
+
+ jclasses := (self classForName:'java.lang.Class') javaArrayClass new: classes size.
+ 1 to: classes size do:[:i|
+ jclasses at: i put: (self reflection javaClassObjectForClass: (classes at: i)).
+ ].
+ ^jclasses
"Created: / 12-11-1998 / 18:56:06 / cg"
- "Modified: / 13-09-2011 / 19:44:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 15-11-2011 / 00:27:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_java_lang_Shutdown_halt0: nativeContext
@@ -7337,7 +7364,7 @@
<javanative: 'java/net/PlainSocketImpl' name: 'socketBind(Ljava/net/InetAddress;I)V'>
- |jsock jaddr port sock hostName ok err|
+ |jsock jaddr port sock hostName ok err|
jsock := nativeContext receiver.
jaddr := nativeContext argAt:1.
@@ -7345,27 +7372,30 @@
hostName := jaddr instVarNamed:'hostName'.
hostName isNil ifTrue:[
- self halt.
+ self halt.
] ifFalse:[
- hostName := Java as_ST_String:hostName
+ hostName := Java as_ST_String:hostName
].
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
- ].
-
- ok := sock bindTo:port address:nil "hostName".
- ok ifFalse:[
- err := OperatingSystem lastErrorString.
- Transcript showCR:'sock err: ' , err printString.
- self throwIOExceptionWithMessage:'bind failed'.
- ]
- ].
-
- "Created: / 4.2.1998 / 15:06:20 / cg"
- "Modified: / 30.12.1998 / 20:10:16 / cg"
+ FileIOTrace ifTrue:[
+ ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
+ ].
+
+ ok := sock bindTo:port address:nil "hostName".
+ ok ifFalse:[
+ err := OperatingSystem lastErrorString.
+ Transcript showCR:'sock err: ' , err printString.
+ self throwIOExceptionWithMessage:'bind failed'.
+ ].
+ jsock instVarNamed: #localport put: sock port.
+ jsock instVarNamed: #address put: jaddr.
+ ].
+
+ "Created: / 04-02-1998 / 15:06:20 / cg"
+ "Modified: / 30-12-1998 / 20:10:16 / cg"
+ "Modified: / 15-11-2011 / 00:44:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_java_net_PlainSocketImpl_socketClose0: nativeContext
@@ -7710,14 +7740,14 @@
].
[
- nread := sock readInto: data startingAt: off + 1 count: len.
+ nread := sock readInto: data startingAt: off count: len.
] on: Error do:[:ex|
self throwSocketException: 'Error when reading: ', ex description.
].
^nread
- "Modified: / 14-11-2011 / 23:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-11-2011 / 23:49:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_java_net_SocketOutputStream_init: nativeContext
@@ -7748,12 +7778,12 @@
sock := self validateFile: fdObj.
[
- sock nextPutBytes: len from: data startingAt: off + 1.
+ sock nextPutBytes: len from: data startingAt: off.
] on: Error do:[:ex|
self throwIOExceptionWithMessage: 'Error when writing: ', ex description.
].
- "Modified: / 14-11-2011 / 23:08:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 13-11-2011 / 23:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaVM class methodsFor:'native - java.security'!
@@ -11278,6 +11308,24 @@
"Modified: / 30.12.1998 / 20:10:16 / cg"
!
+_PlainSocketImpl_socketAvailable:nativeContext
+ |jSock sock n|
+
+ jSock := nativeContext receiver.
+
+ sock := self validateFile:jSock.
+ sock isNil ifTrue:[
+ self throwIOExceptionWithMessage:'socketAvailable on closed socket'.
+ ^ self.
+ ].
+
+ n := sock numAvailable.
+ ^ n
+
+ "Created: / 4.2.1998 / 16:58:49 / cg"
+ "Modified: / 30.12.1998 / 20:10:08 / cg"
+!
+
_PlainSocketImpl_socketClose:nativeContext
|jsock sock|
@@ -15108,26 +15156,6 @@
^ self _WGraphics_pSetForeground:nativeContext
! !
-!JavaVM class methodsFor:'native - old-style (converted)'!
-
-_PlainSocketImpl_socketAvailable:nativeContext
- |jSock sock n|
-
- jSock := nativeContext receiver.
-
- sock := self validateFile:jSock.
- sock isNil ifTrue:[
- self throwIOExceptionWithMessage:'socketAvailable on closed socket'.
- ^ self.
- ].
-
- n := sock numAvailable.
- ^ n
-
- "Created: / 4.2.1998 / 16:58:49 / cg"
- "Modified: / 30.12.1998 / 20:10:08 / cg"
-! !
-
!JavaVM class methodsFor:'native - stx.libjava.tests'!
_stx_libjava_tests_MonitorTests_abort: nativeContext