author | tzezula |
Sat, 08 Dec 2012 10:32:04 +0100 | |
branch | exceptions |
changeset 287 | 6f696a0ef12f |
parent 285 | c8be2d837788 |
child 400 | 5452b9fbd253 |
permissions | -rw-r--r-- |
tzezula@287 | 1 |
/** |
tzezula@287 | 2 |
* Back 2 Browser Bytecode Translator |
tzezula@287 | 3 |
* Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
tzezula@287 | 4 |
* |
tzezula@287 | 5 |
* This program is free software: you can redistribute it and/or modify |
tzezula@287 | 6 |
* it under the terms of the GNU General Public License as published by |
tzezula@287 | 7 |
* the Free Software Foundation, version 2 of the License. |
tzezula@287 | 8 |
* |
tzezula@287 | 9 |
* This program is distributed in the hope that it will be useful, |
tzezula@287 | 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
tzezula@287 | 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
tzezula@287 | 12 |
* GNU General Public License for more details. |
tzezula@287 | 13 |
* |
tzezula@287 | 14 |
* You should have received a copy of the GNU General Public License |
tzezula@287 | 15 |
* along with this program. Look for COPYING file in the top folder. |
tzezula@287 | 16 |
* If not, see http://opensource.org/licenses/GPL-2.0. |
tzezula@285 | 17 |
*/ |
tzezula@285 | 18 |
package org.apidesign.vm4brwsr; |
tzezula@285 | 19 |
|
tzezula@285 | 20 |
/** |
tzezula@285 | 21 |
* |
tzezula@285 | 22 |
* @author tom |
tzezula@285 | 23 |
*/ |
tzezula@285 | 24 |
public class Exceptions { |
tzezula@285 | 25 |
|
tzezula@285 | 26 |
public static int methodWithTryCatchNoThrow() { |
tzezula@285 | 27 |
int res = 0; |
tzezula@285 | 28 |
try { |
tzezula@285 | 29 |
res = 1; |
tzezula@285 | 30 |
} catch (IllegalArgumentException e) { |
tzezula@285 | 31 |
res = 2; |
tzezula@285 | 32 |
} |
tzezula@285 | 33 |
//join point |
tzezula@285 | 34 |
return res; |
tzezula@285 | 35 |
} |
tzezula@285 | 36 |
|
tzezula@285 | 37 |
public static int methodWithTryCatchThrow() { |
tzezula@285 | 38 |
int res = 0; |
tzezula@285 | 39 |
try { |
tzezula@285 | 40 |
res = 1; |
tzezula@285 | 41 |
throw new IllegalArgumentException(); |
tzezula@285 | 42 |
} catch (IllegalArgumentException e) { |
tzezula@285 | 43 |
res = 2; |
tzezula@285 | 44 |
} |
tzezula@285 | 45 |
//join point |
tzezula@285 | 46 |
return res; |
tzezula@285 | 47 |
} |
tzezula@285 | 48 |
|
tzezula@285 | 49 |
} |