Modify

Opened 11 years ago

Closed 10 years ago

Last modified 9 years ago

#8465 closed enhancement (fixed)

Switch to Java 7

Reported by: Don-vip Owned by: team
Priority: major Milestone: 14.05
Component: Core Version:
Keywords: java7 Cc:

Description (last modified by Don-vip)

Oracle has released their final public update of Java 6 (Update 43) and has implemented a "6 to 7" auto-update feature that will concern nearly all Windows and Mac users:

when updating from JRE 6, the update mechanism will not only install the latest version of JRE 7 but will also remove the highest version of JRE 6 on the system. This change will happen when the system is updated via the auto-update mechanism or by checking for updates directly from the Java Control Panel.

In the meanwhile, Linux distributions start to ship OpenJDK7 as their default implementation. Ubuntu ships Java 7 as default since version 12.10 (Quantal Quetzal).

Therefore, we will have soon a majority of users that will run JOSM with Java 7. Maybe it is already the case ? What are the current usage statistics ?

We have a couple of tickets that could benefit from switching to Java 7. I'm thinking at least to #7406, #7896 and #8098.

Java 7 ships also language improvements and some other features JOSM could use, mainly in parallelism, I/O and rendering:

However, there are some incompabilities that we must check carefully:

So, when do you think we could switch ?

Attachments (0)

Change History (91)

comment:1 by Don-vip, 11 years ago

Keywords: java7 added

comment:2 by bastiK, 11 years ago

recent stat:

Java Main Version --> 6 (1812, 44.1%) 7 (2294, 55.8%) 8 (4,  0.1%)

Maybe wait for the Win/Mac auto-update to kick in and see what numbers we have then.

comment:3 by stoecker, 11 years ago

We switched to Java 6 with less than 5% users using Java 5. So it is a long way to go :-)

comment:4 by Don-vip, 11 years ago

Ok thanks for the numbers:) Is there a way to publish them automatically on the website? By the way it's funny to see 4 people using JOSM with Java 8!

comment:5 by Don-vip, 11 years ago

Do we have OS marketshare stats among those running Java 6?

in reply to:  4 comment:6 by stoecker, 11 years ago

Replying to Don-vip:

Is there a way to publish them automatically on the website?

No. We wont do that.

By the way it's funny to see 4 people using JOSM with Java 8!

One time Russian, one time English, the other one German, probably counted twice.

Do we have OS marketshare stats among those running Java 6?

No. The user agent string does not contain that information.

comment:7 by Don-vip, 11 years ago

Description: modified (diff)

comment:8 by Don-vip, 11 years ago

Description: modified (diff)

comment:9 by Don-vip, 11 years ago

Replying to bastiK:

Maybe wait for the Win/Mac auto-update to kick in and see what numbers we have then.

One month later, we've gained 5%:

Java Main Version --> 6 (2771, 39.0%) 7 (4331, 60.9%) 8 (9,  0.1%)

comment:10 by skyper, 11 years ago

Debian 7 (wheezy) will still have openjdk-6 as default. Openjdk-7 is also available but it won't be installed automatically for the next two to three years.

comment:11 by stoecker, 11 years ago

Huh. Giving a daily calculated percentage a 5% accuracy is very dangerous :-) If I try hard enough I probably will find a day, where Java 6 gained 10%!

We should probably add the OS text to the User-Agent string, so we can do OS statistics in future.

in reply to:  11 comment:12 by Don-vip, 11 years ago

Replying to stoecker:

Huh. Giving a daily calculated percentage a 5% accuracy is very dangerous :-) If I try hard enough I probably will find a day, where Java 6 gained 10%!

You're right, Java 6 gained 5% on 20th March :) Daily stats are however quite stable around 40/60:

2013-03-18: Java Main Version --> 6 (659, 37.5%) 7 (1094, 62.3%) 8 (2,  0.1%)
2013-03-19: Java Main Version --> 6 (903, 43.4%) 7 (1174, 56.4%) 8 (4,  0.2%)
2013-03-20: Java Main Version --> 6 (1227, 49.6%) 7 (1245, 50.3%) 8 (2,  0.1%)
2013-03-21: Java Main Version --> 6 (773, 43.2%) 7 (1014, 56.7%) 8 (1,  0.1%)
2013-03-22: Java Main Version --> 6 (747, 39.8%) 7 (1126, 60.0%) 8 (3,  0.2%)
2013-03-23: Java Main Version --> 6 (625, 37.9%) 7 (1022, 62.0%) 8 (1,  0.1%)
2013-03-24: Java Main Version --> 6 (540, 34.7%) 7 (1014, 65.1%) 8 (3,  0.2%)
2013-03-25: Java Main Version --> 6 (779, 40.9%) 7 (1122, 58.9%) 8 (3,  0.2%)
2013-03-26: Java Main Version --> 6 (823, 41.0%) 7 (1181, 58.8%) 8 (3,  0.1%)
2013-03-27: Java Main Version --> 6 (676, 38.1%) 7 (1097, 61.8%) 8 (1,  0.1%)
2013-03-28: Java Main Version --> 6 (767, 40.6%) 7 (1117, 59.2%) 8 (3,  0.2%)

We should probably add the OS text to the User-Agent string, so we can do OS statistics in future.

OK, I will look into it :)

in reply to:  10 ; comment:13 by Don-vip, 11 years ago

Replying to skyper:

Debian 7 (wheezy) will still have openjdk-6 as default. Openjdk-7 is also available but it won't be installed automatically for the next two to three years.

People using Debian usually know how to install another package ;) I won't see this as a problem when more than 95% of our users will use Java 7, even if default Debian Java remains stucked to version 6.

in reply to:  13 comment:14 by skyper, 11 years ago

Replying to Don-vip:

Replying to skyper:

Debian 7 (wheezy) will still have openjdk-6 as default. Openjdk-7 is also available but it won't be installed automatically for the next two to three years.

People using Debian usually know how to install another package ;) I won't see this as a problem when more than 95% of our users will use Java 7, even if default Debian Java remains stucked to version 6.

Don't forget that user does not always have admin rights nor might he/she an admin at all.
The figures above almost level up at 50:50 on active days and power user seem to use java7.

comment:15 by stoecker, 11 years ago

I added a java version check to start page. Maybe that helps to increase Java 7 usage.

The OS-Stats check work now:

4 Linux 
2 Mac OS X 
2 Windows 7 

I knew Linux has more than 50% of the market.

comment:16 by Don-vip, 11 years ago

haha :D

comment:17 by stoecker, 11 years ago

Can someone check if the java test works? I don't find any java 6 system ATM. All updated already.

in reply to:  17 comment:18 by Don-vip, 11 years ago

Replying to stoecker:

Can someone check if the java test works? I don't find any java 6 system ATM. All updated already.

I don't understand why you have removed the User-Agent code ? How is it set then ?

Version 0, edited 11 years ago by Don-vip (next)

comment:19 by stoecker, 11 years ago

I don't understand why you have removed the User-Agent code ? How is it set then ?

In Preferences.java we set http.agent property. Java adds its version and uses this as User-Agent. Directly setting User-Agent strips the Java version.

comment:21 by Don-vip, 11 years ago

As seen in #8488 comments, we have a problem with people living in countries subject to U.S. export regulations (Cuba, Iran, North Korea, Sudan, and Syria).

Oracle has blocked Java updates to Iran, I think we can assume it's the same for other countries. Those people will remain stuck with Java 6 if they have not already updated their version :(

comment:23 by Don-vip, 11 years ago

Nice. In the meanwhile we begin to have more OS marketshare, with some unexpected OS:

O          2 FreeBSD
O        384 Linux
O         30 Mac OS X
O          2 SunOS
O        202 Windows 7
O         32 Windows 8
O          2 Windows Server 2008 R2
O         22 Windows Vista
O         58 Windows XP

Among "latest" users, that makes 52% Linux, 43% Windows, 4% Mac OS, 1% others (did not think to see Solaris or Windows Server users).

We'll see next week if the release of tested version changes these numbers significantly or not.

comment:24 by stoecker, 11 years ago

Either our startup notice or Oracles update policy works, but it seems Java 7 usage increases. We're at about 70% now.

With tested release Windows gained a bit with 55%, Linux about 40%. Pretty interesting :-)

comment:25 by Don-vip, 11 years ago

Oracle just released a brand "new final" release of Java 6: 6 update 45, alongside the last update of Java 7: 7 update 21

in reply to:  25 comment:26 by Don-vip, 11 years ago

FYI, Oracle switched to a weird renumbering scheme:

The next Limited Update for JDK 7 will be numbered 7u40, and the next 3 CPUs after that will be numbered 7u45, 7u51, and 7u55. The next release will be a Limited Update 7u60, followed by CPUs 7u65, 7u71, and 7u75.

7u40 is expected in August 2013 and might bring a bunch of new features:

  • Java Flight Recorder in JDK
  • Native memory tracking
  • Java Discovery Protocol
  • App Store Packaging Tools
  • JAXP 1.5
Last edited 11 years ago by Don-vip (previous) (diff)

comment:27 by Don-vip, 11 years ago

Description: modified (diff)

comment:28 by ToeBee, 11 years ago

Are we there yet? I just hit an incompatibility in the notes plugin (reported in #8890). To fix it I would have to undo pretty much all of the generics :(

I'm guessing the answer is "no, we're not there yet" and I should probably make the plugin compatible but it's been 2 months since an update here. Thought I would poke it again :)

comment:29 by Don-vip, 11 years ago

According to latest numbers, the answer is no, sadly:

Java Main Version --> 5 (2,  0.0%) 6 (4380, 26.6%) 7 (12046, 73.2%) 8 (29,  0.2%)
OS:  FreeBSD (12,  0.1%) Linux (2933, 23.1%) Mac (764,  6.0%) NetBSD (2,  0.0%) OpenBSD (3,  0.0%) SunOS (4,  0.0%) Windows (8969, 70.7%)

Another interesting statistics. If we only look at people running JOSM >= 5836 with Java 6, we have the following distribution:

Total number	2376	
		
Windows	827	34,8%
Linux	956	40,2%
Mac	584	24,6%

Some details about Linux and Mac users among all current Java 6 users:

Ubuntu (LTS)	448	18,9%
Mac OS X 10.8	325	13,7%
Debian (all)	210	8,8%
Mac OS X 10.7	110	4,6%
Mac OS X 10.6	106	4,5%
Last edited 10 years ago by Don-vip (previous) (diff)

comment:32 by Don-vip, 11 years ago

So I think the sooner we could migrate to Java 7 is not before May 2014, after Ubuntu 14.04 LTS is released and used. At this time I hope all other numbers will have dropped to a near-zero level.

comment:34 by Don-vip, 11 years ago

The majority of people running Java 6 are using "supported" versions.
I mean:

  • There's a large base of users running OpenJDK6 because of it still being default version on Debian and current Ubuntu LTS. These versions are based on IcedTea 6, which is still under active development, and if facts currently brings packports of OpenJDK7, see the last release for an example. Look also at infamous OpenJDK6 bug #8921 which will force impacted users to switch to OpenJDK7 anyway.
  • There's also all users of Mac OS X package. They have currently no other choice of running Apple Java 6 (see #8654 to understand why). But Apple Java 6 is still supported, the current version is 1.6.0_51 whereas the last public Oracle version is 1.6.0_45.
  • Finally, there are Windows users. Well, there is an automated update mechanism which should make them switch without even noticing.

The most urgent matter is make a Java 7 compatible Mac OS X package. I have tried but we have no mean to test it. Few people complain about regressions we need to fix before making it official.

comment:35 by Don-vip, 11 years ago

7u40 has been released.

Changes that could impact us:

  • Retina Display support on Mac OS X (see #8764)
  • New Security Warnings for Unsigned and Self-Signed Applications
  • JAXP 1.5

comment:36 by Don-vip, 10 years ago

In 6443/josm:

see #8465 - Ask Windows users to update their Sun/Oracle Java 6 version to Oracle Java 7

comment:37 by Don-vip, 10 years ago

In 6444/josm:

see #8465 - forgot icon

comment:38 by Don-vip, 10 years ago

Milestone: 14.05
Priority: normalmajor

Global stats did not move much yet, but I think we will be able to make an almost-transparent switch in May.

comment:39 by stoecker, 10 years ago

I agree that the May release probably should be first Java 7. No need to wait any longer.

comment:40 by stoecker, 10 years ago

A short note. The next release at the end of April will be the last "Java 6" release. We should try no to add any major breaks for it - it should be a bit of "extra stable".

comment:41 by Don-vip, 10 years ago

In 6943/josm:

see #8465 - Ask Mac/Debian/Ubuntu users to update their Java 6 version to Java 7

comment:42 by Don-vip, 10 years ago

In 6953/josm:

see #8465 - Ask Linux Mint users to update their Java 6 version to Java 7

comment:43 by aceman, 10 years ago

Do we need to list every Linux distro in the code? :) Is there an universal way?

comment:44 by Don-vip, 10 years ago

I only add significant used versions, that was the only one left.

comment:45 by Don-vip, 10 years ago

FYI, our current usage stats.

Global stats:

Java Main Version --> 6 (1224, 15.2%) 7 (6661, 82.8%) 8 (155,  1.9%)
OS:  FreeBSD (10,  0.1%) Linux (1753, 24.1%) Mac (470,  6.5%) OpenBSD (1,  0.0%) Windows (5041, 69.3%)

Java 6 stats:

OS:  FreeBSD (1,  0.1%) Linux (354, 42.7%) Mac (235, 28.3%) OpenBSD (1,  0.1%) Windows (239, 28.8%)

Main systems used with Java 6:

O          2 ( 0.2%) Linux Debian GNU/Linux 4.0 (etch)
O          8 ( 1.0%) Linux Debian GNU/Linux 6.0.9 (squeeze)
O          1 ( 0.1%) Linux Debian GNU/Linux 7.0 (wheezy)
O          3 ( 0.4%) Linux Debian GNU/Linux 7.1 (wheezy)
O          3 ( 0.4%) Linux Debian GNU/Linux 7.2 (wheezy)
O          3 ( 0.4%) Linux Debian GNU/Linux 7.3 (wheezy)
O         36 ( 4.3%) Linux Debian GNU/Linux 7.4 (wheezy)
O          1 ( 0.1%) Linux Debian GNU/Linux Kali Linux 1.0.6
O          1 ( 0.1%) Linux Debian GNU/Linux jessie/sid
O          3 ( 0.4%) Linux Debian GNU/Linux testing (jessie)
O          3 ( 0.4%) Linux Debian GNU/Linux unstable (sid)
O         14 ( 1.7%) Linux Mint 13 Maya
O          3 ( 0.4%) Linux Mint 16 Petra
O         23 ( 2.8%) Linux Ubuntu 10.04.4 LTS
O          1 ( 0.1%) Linux Ubuntu 11.04
O         10 ( 1.2%) Linux Ubuntu 11.10
O          2 ( 0.2%) Linux Ubuntu 12.04.2 LTS
O          5 ( 0.6%) Linux Ubuntu 12.04.3 LTS
O        160 (19.3%) Linux Ubuntu 12.04.4 LTS
O          2 ( 0.2%) Linux Ubuntu 12.10
O          4 ( 0.5%) Linux Ubuntu 13.04
O         29 ( 3.5%) Linux Ubuntu 13.10
O          2 ( 0.2%) Linux Ubuntu Trusty Tahr (development branch)
O          1 ( 0.1%) Mac OS X 10.5.8
O         35 ( 4.2%) Mac OS X 10.6.8
O         13 ( 1.6%) Mac OS X 10.7.5
O          1 ( 0.1%) Mac OS X 10.8
O          1 ( 0.1%) Mac OS X 10.8.2
O          1 ( 0.1%) Mac OS X 10.8.3
O         19 ( 2.3%) Mac OS X 10.8.5
O        161 (19.4%) Mac OS X 10.9.2
O          2 ( 0.2%) Mac OS X 10.9.3
O         60 ( 7.2%) Windows 7 32-Bit
O         98 (11.8%) Windows 7 64-Bit
O          2 ( 0.2%) Windows 8 64-Bit
O          2 ( 0.2%) Windows NT (unknown) 32-Bit
O          8 ( 1.0%) Windows NT (unknown) 64-Bit
O         11 ( 1.3%) Windows Vista 32-Bit
O          2 ( 0.2%) Windows Vista 64-Bit
O         52 ( 6.3%) Windows XP 32-Bit
O          4 ( 0.5%) Windows XP 64-Bit

Java 6 numbers should drop quickly next week.

in reply to:  41 ; comment:46 by skyper, 10 years ago

Replying to Don-vip:

In 6943/josm:

see #8465 - Ask Mac/Debian/Ubuntu users to update their Java 6 version to Java 7

The Update button on Debian simply does nothing. I do not get any information that the update did not work. Only the message does reappear on next session.
Note: On plain Debian you do not have sudo configure but a separate admin user root. You could try to use gksu instead if it is installed.

in reply to:  46 comment:47 by Don-vip, 10 years ago

Replying to skyper:

The Update button on Debian simply does nothing. I do not get any information that the update did not work. Only the message does reappear on next session.

What happens if you try to open apt://openjdk-7-jre ?

comment:49 by Don-vip, 10 years ago

Does it work when aptlinex is installed?

in reply to:  49 ; comment:50 by skyper, 10 years ago

Replying to Don-vip:

Does it work when aptlinex is installed?

This packages is not available either. It was only packaged for Debian 5 (lenny) and its homepage is dead.

If you really need some interface you could try gdebi which is installed by default on the standard Debian installation (Gnome3) but I do not understand why you do not use apt-get directly.

Actually, on my test machine, openjdk-7 was already installed but it was not set as default runtime environment. I had to run update-alternatives --config java as root to change it.

Still think that we have to solve several tasks here:

  1. check if openjdk-7 is installed:
    • if not, install it:
      • needs to be run as root
  2. start JOSM with java 7.
    • I would prefer a solution within the start script as there is no need to change the default runtime environment through alternatives.

in reply to:  50 ; comment:51 by Don-vip, 10 years ago

Replying to skyper:

I do not understand why you do not use apt-get directly.

Because it requires root privileges and I don't want to code something that makes JOSM requires it. On Ubuntu, apturl should trigger a graphical prompt to enter root credentials and install required software.

It's too complicated, I'll simply drop this stuff for Debian and link to the package on Debian's site. Debian users know how to install it.

  1. check if openjdk-7 is installed:
    • if not, install it:
      • needs to be run as root

I won't do that.

  1. start JOSM with java 7.
    • I would prefer a solution within the start script as there is no need to change the default runtime environment through alternatives.

The start script already does it.

comment:52 by Don-vip, 10 years ago

In 6962/josm:

see #8465 - rework apturl stuff

in reply to:  51 comment:53 by skyper, 10 years ago

Replying to Don-vip:

Replying to skyper:

I do not understand why you do not use apt-get directly.

Because it requires root privileges and I don't want to code something that makes JOSM requires it. On Ubuntu, apturl should trigger a graphical prompt to enter root credentials and install required software.

You can simply use gksu to become root (It is really buggy on Ubuntu but stable in Debian and one of the reasons I won`t use Ubuntu as I did not find any clean solution to run a GUI under different non-root user without completly switching the user).

E.g. gksu 'apt-get -y install openjdk-7-jre' should do the trick.
No need to check if it is installed as apt-get has no problem with already installed packages and does exit without error.

It's too complicated, I'll simply drop this stuff for Debian and link to the package on Debian's site. Debian users know how to install it.

  1. check if openjdk-7 is installed:
    • if not, install it:
      • needs to be run as root

I won't do that.

Sorry, check is not needed. Rest is mentioned above.

  1. start JOSM with java 7.
    • I would prefer a solution within the start script as there is no need to change the default runtime environment through alternatives.

The start script already does it.

Have to recheck but as far as I know, it only has a list of supported JREs but it will not use openjdk-7 if openjdk-6 is default.

comment:54 by Don-vip, 10 years ago

Update on stats.

Market share of users running a recent version of JOSM (>= 6502):

Java Main Version --> 6 (434,  6.9%) 7 (5600, 89.3%) 8 (238,  3.8%)
OS:  FreeBSD (9,  0.1%) Linux (1625, 26.0%) Mac (422,  6.7%) NetBSD (1,  0.0%) OpenBSD (3,  0.0%) Windows (4197, 67.1%)

==> Less than 7% of Java 6 users. Those users run JOSM mainly with:

O         55 (13.1%) Linux Ubuntu 12.04.4 LTS
O         21 ( 5.0%) Mac OS X 10.6.8
O         79 (18.8%) Mac OS X 10.9.2
O         59 (14.0%) Windows 7 64-Bit
O         34 ( 8.1%) Windows XP 32-Bit

==> The release of Ubuntu 14.04 LTS, as expected, gave a good shot to Java 6 stats. The remaining users running Ubuntu 12.04 should upgrade very soon.

So only few people among Mac and Windows users should notice the move. Well, they have been warned for months, so we can migrate to Java 7 right after the upcoming release.

It could be fun to have a r6999 tested release and migrate with r7000 :)

comment:55 by stoecker, 10 years ago

The last tested Java 6 should not have any requests asking for Update anymore (except the startup-page one)!

in reply to:  55 ; comment:56 by Don-vip, 10 years ago

Replying to stoecker:

The last tested Java 6 should not have any requests asking for Update anymore (except the startup-page one)!

It could still be useful for some users until the first Java 7 release. What about an hardcoded expiration date (2014-05-25) after which the feature turns off? That's easy to do and easy to test.

in reply to:  56 ; comment:57 by stoecker, 10 years ago

It could still be useful for some users until the first Java 7 release. What about an hardcoded expiration date (2014-05-25) after which the feature turns off? That's easy to do and easy to test.

Would also work. But I'd simply drop it (you still have the Startup screen). You anyway need to do so in the Java 7 release :-)

in reply to:  57 comment:58 by Don-vip, 10 years ago

Replying to stoecker:

You anyway need to do so in the Java 7 release :-)

Yep, of course :)

comment:59 by Don-vip, 10 years ago

In 6997/josm:

see #8465 - expiration date of java update feature

comment:60 by Don-vip, 10 years ago

In 7001/josm:

see #8465 - switch core to Java 7

comment:61 by stoecker, 10 years ago

Resolution: fixed
Status: newclosed

comment:62 by Don-vip, 10 years ago

In 7002/josm:

see #8465 - sun.awt.exception.handler hack removed in Java 7

comment:63 by Don-vip, 10 years ago

In 7003/josm:

see #8465 - use Files.copy()

comment:64 by Don-vip, 10 years ago

In 7004/josm:

see #8465 - use multi-catch where applicable

comment:65 by anonymous, 10 years ago

Just for documentation, is JOSM working on Java 8 if anybody attempts it?

comment:66 by Don-vip, 10 years ago

of course. There are already more Java 8 users than Java 6 ones.

comment:67 by Don-vip, 10 years ago

In 7005/josm:

see #8465 - use diamond operator where applicable

comment:68 by Don-vip, 10 years ago

In 7006/josm:

see #8465 - drop detection of openjdk-6-jre package version

comment:69 by akks, 10 years ago

In 7008/josm:

see #8465 - update Netbeans project to Java 7

comment:70 by mdk, 10 years ago

A nice Java 7 feature is try-with-resource. This will save several lines of boilerplate code.
I took a brief look on the code and I found also some potential resource leaks like:

// OpenFileAction.java:294
try {
    BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(urlFile), Utils.UTF_8));
    [...]
    Utils.close(reader);
} catch (Exception e) {
    [...]
}
// NTV2GridShiftFileWrapper.java:50
try {
    InputStream is = new MirroredInputStream(gridFileName);
    instance = new NTV2GridShiftFile();
    instance.loadGridShiftFile(is, false);
} catch (Exception e) {
    throw new RuntimeException(e);
}

// NTV2GridShiftFile.java:99
public void loadGridShiftFile(InputStream in, boolean loadAccuracy ) throws IOException {
    [...]
    Utils.close(in);
}

// Instad of closing the stream in loadGridShiftFile() I would use this code:
// NTV2GridShiftFileWrapper.java:50
try (InputStream is = new MirroredInputStream(gridFileName)) {
    instance = new NTV2GridShiftFile();
    instance.loadGridShiftFile(is, false);
} catch (Exception e) {
    throw new RuntimeException(e);
}

Some other places looks a little bit strange:

// ImageLayerInfo.java:76 stream is never set to something different then null
MirroredInputStream stream = null;
try {
    ImageryReader reader = new ImageryReader(source);
    Collection<ImageryInfo> result = reader.parse();
    defaultLayers.addAll(result);
} catch (IOException ex) {
    Utils.close(stream);
    Main.error(ex, false);
    continue;
} catch (SAXException ex) {
    Utils.close(stream);
    Main.error(ex);
    continue;
}

// ImageryReader has no close() method and ImagerieReader.parse() even don't try to close in or is:
public List<ImageryInfo> parse() throws SAXException, IOException {
    Parser parser = new Parser();
    try {
        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(true);
        InputStream in = new MirroredInputStream(source);
        InputSource is = new InputSource(UTFInputStreamReader.create(in));
        factory.newSAXParser().parse(is, parser);
        return parser.entries;
    } catch (SAXException e) {
        throw e;
    } catch (ParserConfigurationException e) {
        Main.error(e); // broken SAXException chaining
        throw new SAXException(e);
    }
}

comment:71 by Don-vip, 10 years ago

Yep, this is planned, there's quite some work on this subject and the try-with-resource will greatly improve this :)

comment:72 by Don-vip, 10 years ago

In 7012/josm:

see #8465 - use String switch/case where applicable

comment:73 by Don-vip, 10 years ago

In 7015/josm:

see #8465 - fix generics for JComboBox/JList

comment:74 by stoecker, 10 years ago

39 warnings left. Huh would that be fine when it is 0.

comment:75 by Don-vip, 10 years ago

In 7017/josm:

see #8465 - fix easy compilation warnings

comment:77 by stoecker, 10 years ago

Wow. Only 10 left.

comment:78 by Don-vip, 10 years ago

In 7020/josm:

see #8465 - fix remaining compilation warnings

comment:79 by Don-vip, 10 years ago

In 7021/josm:

see #8465 - enable -Xlint:cast and fix associated warnings

comment:80 by Don-vip, 10 years ago

In 7022/josm:

see #8465 - enable and fix more warnings

comment:81 by stoecker, 10 years ago

Fine - Major code cleanup... Also found a "remove in spring 2011" during applet removal :-)

comment:82 by Don-vip, 10 years ago

Never too late :)

comment:83 by Don-vip, 10 years ago

In 7030/josm:

see #8465 - use of try-with-resource

comment:85 by Don-vip, 10 years ago

In 7034/josm:

fix #9967, see #8465 - RemoteControl broken by changes in r7033

comment:86 by Don-vip, 10 years ago

In 7037/josm:

see #8465 - last batch of try-with-resources

comment:87 by Don-vip, 10 years ago

In 7082/josm:

see #8465 - replace Utils.UTF_8 by StandardCharsets.UTF_8, new in Java 7

comment:88 by Don-vip, 10 years ago

In 7083/josm:

see #8465 - replace Utils.equal by Objects.equals, new in Java 7

comment:89 by Don-vip, 10 years ago

In 7084/josm:

see #8465 - use AssertionError constructor accepting a cause, new in Java 7

comment:90 by Don-vip, 10 years ago

A very good article on Java 7 changes, listing nearly all classes for which Javadoc contains something related to Java "1.7". An even better list found in comments.

Last edited 10 years ago by Don-vip (previous) (diff)

comment:91 by simon04, 10 years ago

In 7086/josm:

see #8465 - see r7082 - fix unit test related to the UTF_8 constant

comment:92 by Don-vip, 10 years ago

In 7089/josm:

see #8465 - Use of new Java 7 zip constructors allowing to specify a charset for entries names

comment:93 by stoecker, 10 years ago

Java 7 changes are really a lot. Didn't think that could have such an impact.

With all these changes I wonder that we don't get major bug reports :-)

comment:94 by bastiK, 10 years ago

This transition went very smoothly, good timing for the warnings and the final switch!

The changes have a bigger impact than I expected, e.g. in #10045 a very nasty bug just vanished after switching to the new File IO.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.