WWDC2004 Session 639
Transcript
Kind: captions
Language: en
happy Wednesday thanks for coming i'm
not actually speaking in this session i
just wanted to give a quick introduction
my name is Matt rants I work in DTS and
I'll be coming back at the end of the
sauce to talk a little bit about DTS
what DTS does in case some you don't
know about it but I just wanted to
introduce you because I think that this
is probably the most useful java talk
this week that as far as you guys are
just turned aside from mine tomorrow but
when you guys are out of here in an hour
and a half you're not going to go read
any documentation or download anything
at the end of the day you're going to
know everything we know about debugging
analyzing unerring java applications on
the mac and i think that's something
that a lot of people been waiting to
hear about so without further ado I
would like to introduce Tom O'Brien from
the product engineering team Thanks
you're in the right talk if you're a
Java developer who wants to deploy or
Java on Mac OS 10 but you want to find
ways to avoid cross-platform platform
compatibility issues that you might run
into or if you want to know ways to
isolate problems that you find running
java on 10 or report problems back to
Apple when you think it's apples blog so
how are we going to approach this the
talk is going to be in three parts today
first we're going to show you coding
techniques and tips for getting the best
cross-platform behavior out of Java
second we're going to show you testing
and bug isolation techniques that help
you find problems using the tools
available to you on Mac OS 10 and third
we're going to tell you how to write an
effective bug report so let's get
started with the first section
Java is positioned as a cross-platform
development and deployment environment
and that's true and its catchphrase is
write once run anywhere everyone has
heard that but in the finer levels of
detail the platform independence isn't
an automatic thing that you get for free
your application may run great on one
java implementation on one platform but
the same code running on another
platform may run well but not in the
exact same way at the finest level of
detail you may not even be aware of all
the areas that have subtle differences
in Java implementations we're going to
highlight some of those today how we're
going to approach this well first we
want to have you thinking about in a
slightly different way we want to show
you the tips to get the best
cross-platform behavior out of your code
and the things we show you today are
applicable to all Java implementations
even though we're going to be focusing
on Mac OS 10 we're not trying to do it
in a platform specific way we're trying
to show you general techniques that
allow you to run equally well everywhere
without doing something platform
specific if you can help it will help
you be aware of the areas where
different platform implementations can
differ so that you can adapt to those
differences or again design and apply
form neutral way so that you don't have
to adapt so let's move on to an example
the anti-aliasing settings for text and
graphics vary from platform
implementation to a platform
implementation and in fact on Mac OS 10
for applets in the browser users can set
whether anti-aliasing is on or off as a
preference so it varies from run to run
so you can't guarantee that it's on or
off in any particular situation here
just to remind you here's here's the
same code drawing alias and with
anti-aliasing on you notice that line
rendering gets much smoother in the in
the image on the right but it also
changes the appearance and this may
matter to your application so what
should you do if it matters to your
application you should set and check the
anti-aliasing settings explicitly rather
than assuming that they're on or off
here's how to deal with it for text only
and this is using standard sun java 2d
api's to deal with the rendering hits
here's how to do it for both text and
graphics and these are just again
standards on api's in java 2d moving on
to a more specific example for
anti-aliasing for text the in the swing
aqua look and feel on Mac os10 text
anti-aliasing is on by default and this
is in order to fit in better with the
other mac OS 10 applications and match
the mac OS 10 aqua guidelines it
improves readability of text at small
point sizes but text metrics likely to
be different between alias and
anti-alias text me see here this is the
same code running with anti-aliasing on
and then off you notice that not only
does the appearance of the text change
but the length of the text changes and
so metrics that you gather with the
setting in one in one position aren't
valid when you switch to the other
position so how do you do with this once
again check and calculate things rather
than a hard coding or assuming here
again is a standard Sun API for dealing
with in this case calculating the string
length of a particular string rendered
in the current rendering context with a
particular font and this tells you how
long that string is going to be right
now it's referred to as width of course
because its graphical but we think of it
as string length so you can find out how
many pixels wide that that string is
going to be right now when it's rendered
on screen and deal with that
appropriately if it matters to you
moving on to other metric tissues
control sizes for java implementation
widgets vary across platforms the same
controls rendered on Mac os10 using the
same code running on other platforms
don't have the same appearance the same
font the same size and this is a this is
a standard platform this is that this is
a standard change that happens from one
platform to another that is intended to
fit in with the platform look on that
particular native platform but it makes
it fragile to hard-code widget and font
sizes that you where you've gathered
information based on the behavior and
metrics on one platform so how do you
deal with this once again there are
api's that let you check rather than
hard coding based on what you've
measured on one platform for widget
sizes the Sun API to get the preferred
size of a component is relevant here for
fonts you can find out
you got back for a particular default
font and you can find out the metrics
for that font in the current again in
the current situation in the current
rendering context and deal with it and
we already showed you how to calculate
the string length in the particular
rendering context Etrian right now with
the particular font you're running with
right now a more general approach for
dealing with the fact that you I metrics
vary among different implementations of
Java is to use a layout manager the
layout manager will arrange the UI for
you based on the situation that's
happening on your platform right now
it's as an additional benefit if you're
even on just one platform of handling
what happens when you localize strings
to other languages they tend to change
length look like an English into other
languages often tends to make for longer
strings that may not fit into six bounds
that you've already picked and the
layout manager will deal with that
gracefully for you in order to discover
there you have whether you have
successfully made your code metrics
independent and possibly deal with
different platforms you should try your
code out on multiple platforms if you
are using this if you're using this
example here this is something that's
running in the Java implementation on
Windows and if used the same cup and and
hard set the window size based on what
we measured that it fit into on Windows
you notice that the button and and even
more the label at the bottom are clipped
because those don't fit in the look on
Mac os10 however if you use a manager
and unpack it all fits in nicely and
looks great for more details on the
layout manager you can go to the Sun
website and and pick up more information
about this and other topics another you
I thing that varies between Java
implementations and is especially
important on Mac OS 10 is that the
window resize user interface is in a
different location again in order to sit
in with what fits on that particular
platform Mac os10 the resize box
actually takes up space in the window
content region in the extreme lower
right-hand corner and that's intended
tile in with the scroll bars that are
normally on the lower and right end edge
of the window for Java code that's
coming from other platforms that may end
up covering up content that's an extreme
right hand corner of the window you
notice in the sample application the
extreme right hand button
root of x by the resized box so how do
you do with this well there's several
different approaches general approach
would be if you didn't crowd your life
there was so that the extreme lower
right-hand corner of the window is
important you may open up your UI and
make it look cool anyway that may fit in
with what you plan for your application
if you're using a layout managers we
suggested earlier you may have to use an
empty place holder component pulled out
space underneath the Grove in order to
make this work another alternative on
Mac os10 is to use this Mac os10 just
hide and show the grow box for it to
make sure that the grow box is showing
or not showing it doesn't change the
resize behavior of the window but it
does it does determine whether the grow
box is actually drawn on screen and
here's the same code which earlier with
this property set to true the default
and fall the window is still resizable
but now you can see that this may end up
in one of the cases where you actually
have to hard code something for a
particular platform there any situations
where there's no way you can design your
code entry platform neutral bay if you
really have to do something special for
mac OS 10 1 emphasized that you want to
do that if you really have to it's it's
kind of a last resort thing you really
want to I defining the platform neutral
way if you can but if you have to this
is the way to deal with it on excess 10
the right way you want to get the OS
name system property lowercase it and
then find out whether it starts with Max
is OS based set Technic 2110 has more
details about about this approach again
I want to say that if there are AP is to
get at specific metrics you want to deal
with those AP is you're interested in
specific behaviors or metric on that
flat for those specifically rather than
trying to infer them from being on Mac
OS test things may change from one
implementation to another or in some
cases it may even take to another as we
saw earlier so what do we dealt with the
ways to design code and from neutral way
and the way you can firmly designed in
the platform neutral way is to describe
your coat on multiple platforms with
your topic this top you discover
inadvertent some dependencies in
addition to the metrics issues we were
talking earlier there's that you may be
inadvertently depending on that you
don't know up to trot for example if on
a petition there are special
implementation that certain things to be
accelerated for rendering modes for
graphics primitives your application
ntage of that special character rip and
run great platform but I'm turistic
isn't it or applicator and the way to
find that out prog it out specific to
recap the move up you want to get and
text anti-aliasing settings rep or off
matters to your application you want to
check in the current situation hard
coding them big platform or on a
previous rough if all same platform
specific we should & Co is ten there
right I'm them lasane who's going to
show you punjab khatam good afternoon
welcome talk about two things it's Spock
first I'm going to top of Jay yet how
you can integrate about the u.p price
problems it's Java start with oh all
right forget this
problem day unit how many people out
here know what dig in it is aa recorders
with guardian that's great we know what
day it is it's an open frame
incorporating unit to make some a
natural to the developed in documents
and their their low over by which I mean
they don't get it away so let me sleep
devil of unit into Xcode here i have
this is an aunt and an expo template
recently made available and it's
available on both tiger and Panther you
do that is to me prop so the father
hears is just my application about it
for Jane it next but I have a test
message in a test and it things about it
one is here you can see I import in it
framework and getting my classic did I
look me even open today in a test
however you you know integrated as you
packed it and that's where the real
holiday in it from dana dragon install
it in a glass hat be important so in my
bill Tupou add a new target a tete in i
can go into detail up this is all paper
and then backed up a little in my dark
or gate make it depicting the test
target
I thought I had I can put it bring it up
higher sure I have a house it responds
to for that for that code quick onion
the output in Xcode currently the out
from aunt Tabitha over pain so the
filter window and if you notice the
lower paint has a slider and let me just
met up so you can see you click compile
target bunting I've already suspect and
then chick font size on this at least I
don't know where the set you have to
look so as to what you can see sues the
output from the test it might be nice
out in my building xml tells you what
test suite is running and then there's
summary here from in it it does it ran
three tests and one of them failed
there's a list of tests following that
the last one table then the output from
the failure of which you can read netten
a step crawl from the point of failure
so let me move over to my test code
which is in my test file the name of the
failing method was test for small
failure and i used a its method cert
true to a skirt too and for purposes of
the demo i said that to fall so that we
would get a failure i'm going to change
that to true and then I round again and
you'll see a little bit different figure
again this time you can see in the
compile in the compiled project it
actually does compile because I changed
my my test case and here trying to run
in the test in the Test section you can
all of the tests you man and always have
to pass and because the test pass it was
able to connect to the jar section and
then execute the code and here's
location running where we show the alias
person completely effects which you saw
on a previous slide
so that j unit running inside xcode on
Mac OS 10 select slice
so the things you need to do one you
need to write tests you've got to write
tests in order for them to run number
two you need to get a copy of j unit and
put it in your classpath in your machine
on the demo machine I put mine in
library Java extension so it's lots of
different ways to add to your class path
and then third you need to modify your
build XML file to execute day unit and
this screen you see a very simple yeah
minimal way of executing j unit tests
and then here I've added one more
argument to the j unit command the halt
on failure argument and it's all fun
failure is set to yes then when you
build with your aunt project if there
are any test failures then it will stop
at that point you will get a failure and
it will not go a lot you know your bill
will be considered to a fail you said
that to know it'll run the test that
will go on and build and run oh and
again it's your choice the way you
design project whether you want to set
that true or false I'd recommend true
down at the bottom you can see just the
beginning of my jar target and it you
the the default template for aunt for
aunt based project to the Pens clause
set to compile as a lot effectively
depending them on test so that it would
execute the test as part of building the
pipe so that's in it pests are
integrated into your development process
you write your tests it's it's a really
nice way of integrating kept seeing into
your development process see it works
really great with code I've been using
it for a while now other IDE a cliff I
also support J unit it's a platform with
a large active community most of you
raised your hand so you already know a
lot of this and for more information go
to j unit org and read the documentation
there so the other part when things go
wrong sometimes problem in your code
sometimes it's underneath you sometimes
it's out of your control and I'm going
to cover both of those there is
so I'm going to cover sub things i will
show you some mac OS 10 tools for
isolating problems these many of the
tool well some of the tools are specific
to Mac os10 many of the tools are
cross-platform tools you may already be
familiar with I will mention when when
i'm using a tool that's crop platform
just so that it's clear and the goal is
to give you the knowledge you need to
fix the problem or if the problem is
outside the scope of your code in order
to isolate it and to report an effective
bug so let's go to a demo again now i'm
going to do a little bit of role playing
here i am a developer fairly new to mac
OS 10 and i'm starting to bring up my
projects on on the mac and top here tom
is the expert and I'm going to be calm
let me get this stuff out of the way
okay um I've written a little simple
program it does some painting it has two
types of threads and both red paint to
the screen and it's supposed to be in
between the two threads but but it
doesn't animate it's just sitting there
so you know Mac os10 what should I do
here why don't you try activity monitor
ok let's try activity monitor
a thread painter there's my thread
painter so what am I looking at this is
showing you the state of all the
processes that are running for you in
excess and there's thread painter and it
looks pretty quiet it's using no cpu or
essentially no cpu so your application
is basically stopped okay so i can tell
my application doesn't seem to be doing
a whole lot down here there's not
happening so let's find out more about
what's going on inside inside java right
now if you send a kill minus quit signal
to that other process the vm will dump
the state of all the threads of the run
ok so i guess i need terminal stefan big
enough can you guys read so tip- quick
this is standard on unix platform if i
kill a quit signal it's obvious the
process ID which i can see here is 629
it should dump a stack trace out to
stand it out but Tom I don't see
anything well how'd you watch hmm how
did you launch I double-click the jar
and the finder ah it's going to end up
in the system console so go look on the
system console ok let's take a look at
15 console here wow this looks kind of
like a stack thread dumped here ok look
I see this is some old debugging output
from my application the computer and oh
yeah kicked my drawing thread here's my
even drawing thread ok it's possible you
have a deadlock the vm will catch simple
bit locks aren't you look down at the
bottom and see if it has anything to say
down at the bottom ah
found one Java little deadlock sure
enough it looks onto good luck in my
code let's take a look at my code thread
p nerd Bob a line 70 I'm going to open
up thread painter next click here go to
line 70 and there's my odd thread and
there's my even thread and I've
synchronized this even thread it's an
outer lock and lock and mm-hmm I have an
inner pocket now blocks on the odds red
looks like you set up a classic good
luck hey did you do this deliberately Oh
what do you think actually you know
usually it's not quite this
straightforward but you get the idea the
school how to use the tool to end this
type of problem go back to slides so the
tools of yes you you thought kil- quit
useful activity monitor and kill minus
quit kil- quit works cross-platform if
you're running in terminal if you're if
you're executing from the command line
you can also do control backsplash and
get the same information going to
machine you can do control break and
also get to the same information so up
on the screen the little sample you see
I use top to get the process ID and kill
minus quit for that process ID to dumps
with the spectra and it pointed out one
of the slight Smith's of confusion
especially for people new to the mac OS
10 where does the output go running in
terminal as you would expect the output
goes to the terminal where you right
where you are but if you're
double-clicking a jar or if you have a
dot a passed app application in the
finder the outputs we go to system the
system console console that app and
similarly if you're running in Safari
you have an athlete in Safari the
outlets going to go to console as well
unless you have turned on the Java
console using the Java setting plugin or
the Java settings application in which
case the output goes to the Java console
which also has some other debugging
tools that you can take a look at
there's a help screen that shows up when
you first invoke that console useful for
debugging assets
lastly if you're running if you're
executing your coat from from Xcode
you'll see the output right in the run
log okay so let's go to another time
same role I'm a developer still getting
getting my sea legs here on Mac OS can
hide some of the stuff so it's not
distracting and I have another little
application I called drawing loop and it
does some animation this time it does do
animation see it's working and I can
turn on not the box numbers we teach
square has it has a number associated
with this slider the J slider down here
at the bottom but Tom I have a problem
here when I drag it all the way to the
right it just kind of stopped responding
and then if I resize it gets even worse
and there's that there's that rainbow
cursor so I just thought activity
monitor what's the last one and I can
remember these things i'm going to i'm
going to look at activity monitor again
and see what it tells me so here look at
this it's very helpful actually drawing
loop is hung its activity monitor at
least thinks my application is hot and
i'm using a lot of cpu so so now what
should i do should i use kil- quit again
get a sec don't we find out what state
the java threads room but we haven't
even cooler tools with this its new this
week it's shark for java that's right so
the launch shark I was acid the vm
performance talk yesterday afternoon
when christie demonstrated shark so I do
know a little bit about shark now
because I just a demo so let me try it
with my application so there is one
piece of setup you have to do in order
to use shark and you might have seen it
in some of the output in fact I think in
the console it'll still say it right
here picked up Java options I have set
dash X run shark in order to give shark
the data that it needs from the Java
Runtime to for it to do its magic so
chalk is a profiling tool you can use it
to isolate bugs I'm just going to do a
time trace here
and i'm going to start it and it's
sampling what's going on in my
applications there in the background the
one with the spinning rainbow cursor and
now let me stop and it will produce this
nice report so this tells me where where
I was when shark was sampling my
application who we're on spending time
and it's a very top you see surface data
finished lazy drawing no it's not
probably not very readable this one one
at the top is is the one where the most
time is being spent where shark sampled
the most the most time so I'm just going
to open it up and see what I can learn
from here this is a stat crawl the leaf
is at the top and as I drill down you
can see I spend a lot of time in a WT
which was called by Java 2d and then I
get down to these blank ones here but
you know I recognize these drawbacks
silk screen or X paint as my code that's
my code executing their shark knows
about Java the other tools that you may
be used to using such as sampler or
sample on the command line they don't
have this kind of intimate knowledge of
Java now paint silkscreen with Rex Rex I
want to go take a look at my picker team
and Tom maybe you can help me because
you're an expert see if there's anything
here I'm doing that might be causing
that rainbow cursor there's my paint
method right here down at the bottom
Barry you want to tell me what extreme
count military oh yeah extreme count
mode yeah you know i just recently added
that when I drag it to the right it
spoke to fill the screen with rectangles
and that's actually likes your full
screen it's wrecked and maybe I set the
bar a little bit too high this is a dual
processor t5 it can handle 10,000 runs
of 10,000 rectangles campus eventually
eventually yeah actually this is not
hung even Activity Monitor said it was
on it would eventually return but it
would take a while and I said it such
that it would take a while usually not
that straightforward so back to slides
here you saw again activity monitor the
CPU what level was really high that time
so you did get some interesting
information from Activity Monitor you
could have used top in that same
situation and seen similar similar data
and top is cross-platform at least four
other UNIX machines and i showed you
shark a great tool recently enhance to
to tell you a lot more about java and
there's a shark talk this friday i'd
like to tell you about and you should go
christie is giving the talk and that's
at three-thirty and i don't know the
room name but accession number three up
70 sanjay and nathan are giving the talk
okay and in bed the talk is not specific
to java but the techniques that you
learn there should be useful for java as
well so did I did I go back to demo okay
this is my last demo you just hide some
stuff here oh and so here's a little
tiny tool little tiny technique if you
hold down the mouse on the icon is force
quick comes up as an option if you don't
see force quit you can all down the
option key to force force quit nice way
of getting rid of here frozen out okay
my last appt here tom J&I rapper jar
this is a little piece of java that
calls a little piece of native code so i
can bring it up here and when i click on
this button at this point it will call
my native library that i've written and
it crashes so what should i do should i
should i click submit report here and
slim the bug to apple hold on hold that
thought locate we'll come back to that
just put that aside alright remember
that out of the way here so what should
i do with this application well you said
who was it was needed code that you're
calling yeah well we probably if you
don't have source available to you your
your best debugging tool that you have
available would be GD be so once you try
attaching to it in gdb before the crash
that actually brings up a very important
point sometimes you do have source have
xcode is the way to go single step and
xcode tracy's but there are lots of
different situations where you might not
have source you might have a third-party
native library you might be on a
customer's computer trying to do
debugging with with what's there you
might be on a test machine in your lab
lots of different times you won't have
source and so you want to use other
tools that are available to and you said
gdb I know GDP so let me launch the app
here I'm not going to press the button
yet i'm going to use top this time see
what process it is it looks like process
654 copy that and i will do a GD be
attached not going to teach ugtb i'm
just going to show you a tiny bit of gdb
being aware that it's there and that
it's useful is is the main point here gb
is now attached to my process i'm going
to tell it to continue so that my
application has control again and now
i'm going to press this button and you
can see gdb immediately catches the
crash so here i can do a thread apply
all back-trace yes there are shortcuts
for this and now i have a dump of all of
the native threads that are running
associated with my application many of
these are java threads like the event
thread but at least one of them should
be my code and go back up to the top
here it looks like could not access
memory on thread Oh xf6 03 and that's
right here so it's planning to line 29
of my of my code so plan on doing on
source code this time we do so we're
just going to take a quick peek at my
little Jay and I lied and we will go to
lunch 29 Xcode and here tom well it may
be fairly clear to you but here I have a
pointer and I'm be referencing it but oh
look just above here the pointer got set
to 0 how could that have happened yeah
that could be a problem and if you've
ever debugged z-code you probably know
that it's not that straightforward
usually
sometimes it is some time to do so why
do you want me to set this window aside
here well the submit report button has
hiding behind it a something very
similar what you just got in gdb which
is a native fresh report showing all the
native threads that were running at the
point of the crash including a little
bit more helpful stuff telling pointing
you to the exact thread numbers that
crash so it's containing bit yes the
same information you got and you
sometimes get this if your application
has a user interface that's the basic
rule that you'll get this crash report
window and you can copy and paste this
information into a bug report or you can
use it for further isolation on your
machine so now i can send them to Apple
sure go ahead well you know I just
reported to Apple my own bug so you
probably shouldn't do that hip is if
it's in your own code let me point out
sometimes you'll you'll get a report
somebody has my application crash and
you said well did you grab it the stat
column they say no those fat calls are
actually saved on your machine and in
this case it's in my home directory in
library logs and inside crash reporter
you see a java dot crash log file this
contains the log that you just saw on
the screen for all of the clashes that
have ever happened for this user on the
system and you may have noticed as I was
navigating here I went past a folder
full of a bunch of Java native crash
logs and they have a PID associated with
them if I look back here at my gdb
output process 654 was the one that had
crashed and so that would be this one
here at the top and let's just take a
quick peek at that if you're reporting
bugs this this file can come in handy in
isolating where the problem is in this
case you see here this is a java stat
crawl from the point where it crashed
and up near the top we were in java and
it at the very top it called a native
method so that's the point at which it
kind of jumped out and left Java and
that's both the limit of the information
in java the java vm can give you about
the crash there's also a little helpful
reminder here at the bottom and this is
this is helped reduce some of the bug
reports we get it says the exception
above was detected in native code
outside the vm so and usually accurate
maybe not always but what
usually means is it wasn't Java crashing
it was something else crashing it may
have been a native library that you had
written it might be an OS beggin may
still be something that you'd want to
report I just wanted to point out that
little little detail ok back to slide
guess the font could be a little so what
tools did we use their GD be attached
gdv cross-platform handy tool we use the
class reporter to window as a as a bug
isolation tool and you saw where I had
found some of the crash logs in my
library logs folder so what have we
learned here this is a summary first in
the first crash demo or in the first
hang demo I was spinning the CPU is low
i found that out by looking an activity
monitor could have used top PF similar
techniques for finding that out i did a
kill minus quit to get the information
control backslash also works in the
second in the second example i had high
cpu usage which i saw from activity
monitor and in this situation we use
sharp you don't have shark you should
download it you want to get the latest
version of shark both for tiger and 4p
answer the download is available on
developer apple com tools / performance
don't have it right okay and you could
use kil- put in this situation you would
get some information that may help
isolate it the date detail that you get
from shark is a lot there's a lot finer
grained a lot more detail a lot more
useful and then the last example the
crashes in native code we use gdb we
offload the crash reporter and the java
logs as you just saw but there's one
more thing relative to that last one
what if it crashed and you didn't have a
native library what if there was no
native code on your side so it was pure
java well pure java shouldn't crash
right not supposed to crash so sometimes
you find a bug in Java or perhaps in the
OS below that so what you do in that
situation well you probably want to get
working right away so the first thing
you would want to do is find a
workaround or maybe see if you can get
by without that specific piece of
functionality
a very active developer community out
there of the java dev mailing list is
the best way to get in touch with that
how many people here are already on java
dev little less than half highly
recommend java dev you should sign up
lists of apple com it's a free mailing
list and very active community they can
often help you find work around Apple
engineers are on there don't consider
writing to Java Doug of being the same
as logging bug report and if you do get
a crash we do want you to file a bug
report we don't want you to just file
like any bug report part of the reason
we're giving you all these tools and
techniques is so you can file a great
bug report which leads me to the last
part of the talk where tom is going to
tell you how to do such a thing click
thank you so when you find a problem
that you want to report to Apple the
best way to get that information to
Apple is to log a bug report Apple's
radar databases the way we track
hardware and software issues that that
come up and and the best way we track at
software issues that hardware and
software issues that come up as Apple
developers your way into the radar
database is through the bug reporter web
page that Barry just mentioned he also
talked about sending email to java dev
so you can find a workaround or discuss
your problem with with other folks Apple
engineers are often present there but
their presence isn't the same as filing
the bug so you you need to use the
official mechanisms to get your bug
report back to Apple the crash report
window that we just saw is intended
mostly for end-users so we saw how we
could use it to find out more about
isolating the problem but just clicking
send reports Apple is intended as an end
user technique you guys have more
powerful technique some of which we
showed you in order to isolate the
problem further in better ways so what's
in a good bug report there's three major
areas that characterize a great bug
report a good problem description clear
steps to reproduce and technical
information that gives the context for
the problem that you found
we're going to go through each of these
in turn first the description of the bug
the bug that you found is a summary of
what happened first what you expected to
happen and then what actually happened
and if you have to explain why you
expected what what you expected to
happen you can you can spell that out to
which you want to contrast those two
things so that we know what you're
really expecting this is a modified
excerpt from a real bug report you
notice the developer has summarized the
problem by by setting forth what they
were doing and what they ran it what
problem they ran into and you also
notice that they referred to a
screenshot which is an invaluable piece
of information in bugs that end up being
graphical because it really does tell
the story great in a great way the
second component of a great bug report
is clear steps to reproduce you want
specific step-by-step instructions that
a naive user could could could use to
reproduce the same situation you ran
into with little or no knowledge of your
product or your particular problem
domain if those steps don't always end
up having the problem that you ran into
you should indicate approximately how
often it takes to run through those
steps and hit the problem again another
excerpt from a bug you notice the
developer has spelled out numbered steps
of what you should do in pretty clear
language and has also contrasted with
that with what the computer was
responding with and a common way to do
that is to use an ascii art arrow but
there's plenty of other ways to make
that clear the third area for context of
the problem that you ran into is the
technical details and this breaks down
into some further three further sub
areas that will go through first more
detail about the failure we saw how to
capture crash logs and in most cases
both the Java and the native stack
crawls are important here for crashes
that you run into in Java in the cases
of bugs that do or don't involve a crash
any exceptions or messages that end up
in the console leading up to that
problem are also useful in isolating the
problem further and show you should
include those
and we saw that for graphical issues the
screenshot is an invaluable piece of
information in spelling out the story of
what's going wrong the next sub
component of technical details is the
software configuration that you're
running on the mac OS 10 version you
found it on the Java version you were
running with both of those in detail and
if it only happens on some Java can some
Java versions or some Mac os10 versions
spelling those out and saying where it
doesn't doesn't happen is useful in
isolating the problem further
additionally if you have access to Java
implementations on other platforms
contrasting the behavior of the same
steps or the same test case on those
other platforms is is also useful in
tracking down the problem further in the
special case of Swing bugs saying
whether the problem you see happens with
the Aqua look and feel or with the metal
look and feel or both of them is useful
information because those are two
different implementation paths and
another excerpt from a bug report
summarizing the software config you
notice to develop a detail of the Mac
os10 and java versions they've regressed
with a previous version of Java to to
say whether it did or didn't happen and
they've even compared with Java on
another platform the final subpart of
the technical details is the hardware
configuration and this is kind of the
answer to the question when somebody
says what kind of machine you have and
so it's the summary of you know I have a
g3 g4 g5 the clock rate whether it's a
single or dual processor machine the
next most most Java bugs are not
hardware dependent but after CPU
dependencies the next most likely place
to run into hardware dependent bugs in
Java is in the graphics configuration
and so we're interested in knowing what
graphics card you have how much vrm
there is what resolution you're running
in and whether you have multiple
monitors configured if you have any
really unusual devices attached any odd
serial devices that your application
depends on or you think might be
relevant to the problem you should spell
those out too especially if you have J&I
code
happens to be talking to them that might
be a clue here's the hardware
configuration from an example bug you
notice that they've compared it with a
platform where it doesn't occur and you
develop notice they've also referred to
the apple system profiler information
that they captured the apple system
profiler can do kind of a brain dump of
the entire configuration of your machine
down to really fine levels of detail
most of which aren't usually relevant in
Java bugs but you never know so it
doesn't hurt to throw it in but it's
also useful just to have this brief
summary of your configuration that I
described with a cpu type and monitor
configuration and and other basic things
like that now we're into the fourth part
of the three that I originally promised
the fourth part is great bug reports
have a test case a test cases
self-contained steps to reproduce your
problem if we have a test case it means
that Apple knows that they're trying to
reproduce the exact same problem that
you originally found because they're
running the same test case that you ran
to show your but ideally your test case
shouldn't require user intervention
that's not always the case but if your
test case can discover whether the bug
is present or not all by itself that's
really great a test case that can be run
from the command line that's been
whittled down to a simple public static
void main test or is in the form of a J
unit test is is a great way to present
that and if you have a J unit test that
can determine pass or fail all by itself
it may end up being put into our
regression harness internally so that we
run it periodically on upcoming builds
of Java and your test case will live on
in immortality here's a reference from a
real bug you notice that the person who
originally filed a triangle bug referred
to a test case so let's recap what
what's in a great bug report first a
clear description that contrasts the
actual and expected behavior second
simple steps to reproduce that a naive
user could could go through to get to
the same situation that you originally
ran into finally technical details the
crash logs that we showed you how to
gather earlier any messages to the
terminal or console any exceptions are
useful to include and the configuration
information that we broke down hardware
and software configuration comparisons
if you have them with other versions of
Java Mac OS 10 or even on other
platforms and the single most important
part could be the test case the
self-contained steps to reproduce your
problem the guarantees that we're
talking about the same bug that you are
getting back to the triangle bug the
triangles Drudge is fine now in case
you're worried so where we been today we
showed you techniques for doing platform
neutral java coding when it's possible
using the api's that are available to
you in from some java that allow you to
have your code work flexibly with java
implementations on multiple platforms
and and work great we show showed you
some bug isolation techniques for
finding and isolating problems further
when you run into them running java on
mac OS 10 and we showed you how to a
file an effective bug report to get
information back to Apple when you think
you found something that Apple should be
aware of now I'd like to bring back Matt
grants who have some additional points
well thank you very much Tom so there
have been a couple questions floating
around this weekend in weeks past about
DTS and what DTS does and what DTS
stands for how many of you have actually
logged and into it with DTS in the past
okay that's pretty good crap so DTS is
developer technical support and I'm
going to just reiterate what Barry and
Tom said is that you know the java dev
mailing list is a priceless resource
there are both apple and non apple
experts on the list that replied very
frequently and very very rapidly
sometimes too much frequently I think in
most of the incident and most of the
sessions this week we've been telling
people if you join java dev set up a
filter because there's quite a bit of
volume in it but a lot of the
information is very very useful and if
just community conversation doesn't help
you out you can talk to DTS and send an
email to DTS an apple
and what DTS does is basically we give
people code level assistance on a per
incident basis or a per problem basis
and that could be something as simple as
hey I read about this new API or this
new feature I don't know how to
implement it can you guys help me
understand how this works or it could be
i have this bug and i don't know how to
work around it and it's critical to my
application we do anything in between or
including those two things now the
reason I'm emphasizing this is because
DTS is not actually fix bugs in the JVM
or in the OS anywhere else engineering
works on the bugs and DTS works around
them and I wanted to emphasize that
because sometimes we get people writing
in and saying okay I bought an incident
will you fix my bug now please and
that's not really how we work we'd like
to think that we fix your bugs even if
you don't pay us but some people out
there may be more skeptical that's
really the only message i wanted to send
DTS is out there there are people for
java there people for printing core
graphics sound quicktime every
technology area i think that's about it
so of all the things we've been
referencing this afternoon there's
obviously the disk image that's been
showing up for every talk this this week
there's the java reference library off
of the reference library home there's a
great document on general java 14
development for mac OS 10 which talks
about cross-platform issues as well as
things you can do to enhance your Mac
look and feel and there's the tech note
that was cited earlier number 21 10 for
identifying Java if you need to do
something Mac specific the best way to
identify Java on Mac OS 10 as well as
identifying a specific job of release on
necklace 10 that has version strings and
everything