Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / August 2004

Tip: Looking for answers? Try searching our database.

limit on number of exceptions in 'throws' clause?!!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan Schullman - 27 May 2004 05:19 GMT
I've just spent eight hours tracking down what appears to be a limit on the
number of exceptions in a 'throws' clause when the offending method is in a
.NET library. GRRR!!!!

I was getting an error like:
 ThrowLimit1.jsl(11,6): error VJS1161: Cannot find class ''

At a minimum, a much better error message would have helped immensely!
Further, the error wasn't reported for the offending method but rather for
the method that referenced it.

And is this restriction documented anywhere?

--Dan S.

-------------------- ThrowLimit1.jsl --------------------
// Experiment with limit on number of 'throws' exceptions
package ThrowLimit;

public class ThrowLimit1
{
   public static void main(String[] args)
   {
       try
       {
           new ThrowLimit2().nine();
           new ThrowLimit2().ten();
       }
       catch ( System.Exception e )
       {
           System.out.println( "EXCEPTION: " + e );
       }
   }
}
-------------------- ThrowLimit2.jsl --------------------
// Experiment with limit on number of 'throws' exceptions
package ThrowLimit;

public class Ex01 extends System.Exception {public Ex01(String
x){super(x);}}
public class Ex02 extends System.Exception {public Ex02(String
x){super(x);}}
public class Ex03 extends System.Exception {public Ex03(String
x){super(x);}}
public class Ex04 extends System.Exception {public Ex04(String
x){super(x);}}
public class Ex05 extends System.Exception {public Ex05(String
x){super(x);}}
public class Ex06 extends System.Exception {public Ex06(String
x){super(x);}}
public class Ex07 extends System.Exception {public Ex07(String
x){super(x);}}
public class Ex08 extends System.Exception {public Ex08(String
x){super(x);}}
public class Ex09 extends System.Exception {public Ex09(String
x){super(x);}}
public class Ex10 extends System.Exception {public Ex10(String
x){super(x);}}

public class ThrowLimit2
{
   public void nine()
       throws Ex01, Ex02, Ex03, Ex04, Ex05, Ex06, Ex07, Ex08, Ex09 {}

   public void ten()
       throws Ex01, Ex02, Ex03, Ex04, Ex05, Ex06, Ex07, Ex08, Ex09, Ex10 {}
}
-------------------- compile the above with --------------------
$ vjc /t:library ThrowLimit2.jsl
$ vjc ThrowLimit1.jsl /r:ThrowLimit2.dll
Sadagopan Rajaram - 06 Jul 2004 07:55 GMT
Hi,
This is not a valid restriction and is a bug in the compiler when we are
reading in the metadata. We will look at fixing it in the next release. The
error scenario happens when

1) The 'throws' clause has more than 9 exceptions
2) The error causing method is compiled into a dll and then referred.

If you can compile both the sources together, it will work. However, I
understand that this is not possible if the method were in a third party
library.

Can I also please try to understand the scenario where you require more
than 10 exceptions in the 'throws' clause in a referenced dll?

Thanks for your feedback.
Sadagopan Rajaram
Microsoft Visual J# .NET Product Team.

This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

--------------------
>From: "Dan Schullman" <newsuser@westerville.ohmy>
>Subject: limit on number of exceptions in 'throws' clause?!!!
[quoted text clipped - 7 lines]
>Newsgroups: microsoft.public.dotnet.vjsharp
>NNTP-Posting-Host: 209-150-43-227.c3-0.frm-ubr1.sbo-frm.ma.cable.rcn.com
209.150.43.227
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.vjsharp:6089
>X-Tomcat-NG: microsoft.public.dotnet.vjsharp
[quoted text clipped - 69 lines]
>$ vjc /t:library ThrowLimit2.jsl
>$ vjc ThrowLimit1.jsl /r:ThrowLimit2.dll
Dan Schullman - 10 Jul 2004 01:05 GMT
I happened to have more than 9 exceptions because we have a fair amount of
granularity with them. In a calling tree, the lowest-level guys may not
throw many but as their exceptions get rolled up by ever-increasing levels
among them, those upper levels could throw many exceptions (if they don't
attempt to base-class them or rethrow something else).

Don't get me wrong... more than nine (9) is most of the time sufficient.
*HOWEVER*, whatever the limit, I would strongly urge that it be an OBVIOUS
compiler error to throw more than the max. Unfortunately the error message I
got (see below) was NOT in the module that had the problem and referenced an
invalid class name. Hence it was rather difficult to track down.

--Dan S.

> Hi,
> This is not a valid restriction and is a bug in the compiler when we are
[quoted text clipped - 34 lines]
> 209.150.43.227
> >Path:

cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
> phx.gbl
> >Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.vjsharp:6089
[quoted text clipped - 71 lines]
> >$ vjc /t:library ThrowLimit2.jsl
> >$ vjc ThrowLimit1.jsl /r:ThrowLimit2.dll
Sadagopan Rajaram - 20 Aug 2004 06:03 GMT
Hi Dan,
    Thanks for the information on the scenario. We have fixed this bug in the
compiler for the next release.

Sadagopan Rajaram
Microsoft Visual J# .NET Product Team.

This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
>From: "Dan Schullman" <newsuser@westerville.ohmy>
>References: <uguYaH6QEHA.3988@tk2msftngp13.phx.gbl>
<yz8aIZyYEHA.3748@cpmsftngxa06.phx.gbl>
>Subject: Re: limit on number of exceptions in 'throws' clause?!!!
>Date: Fri, 9 Jul 2004 20:05:43 -0400
[quoted text clipped - 7 lines]
>NNTP-Posting-Host: wuzzyms.starbak.net 68.162.199.90
>Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXS01.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP12.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.vjsharp:6183
>X-Tomcat-NG: microsoft.public.dotnet.vjsharp
[quoted text clipped - 132 lines]
>> >$ vjc /t:library ThrowLimit2.jsl
>> >$ vjc ThrowLimit1.jsl /r:ThrowLimit2.dll

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.