Multiple method signatures in an MBean

The text formatting seems to be broken on this site. Sorry for the mass of text!
I have an MBean containing some utility functions used within a custom authenticator. At the moment, there all use a single data source, but I need to extend them to use multiple datasources. I also need to maintain backwards compatability with the original system.
I have therefore modififed the xml bean descriptor file and Impl java class by duplicating all the methods, adding a dataSource ID param, as follows:
I started with this method descriptor:
<pre>
<MBeanOperation
Name = "getMaintenanceMode"
ReturnType = "boolean"
Description = "Whatever"
>
<MBeanException>javax.management.MBeanException</MBeanException>
<MBeanException>weblogic.management.utils.NotFoundException</MBeanException>
</MBeanOperation>
</pre>
and impl:
<pre>
public boolean getMaintenanceMode() throws MBeanException , javax.management.MBeanException, weblogic.management.utils.NotFoundException
</pre>
and have now added this :
<pre>
<MBeanOperation
Name = "getMaintenanceMode"
ReturnType = "boolean"
Description = "Whatever"
>
<MBeanOperationArg Name = "dataSourceId" Type = "int"
Description = "Data Source ID"
/>
<MBeanException>javax.management.MBeanException</MBeanException>
<MBeanException>weblogic.management.utils.NotFoundException</MBeanException>
</MBeanOperation>
</pre>
and
<pre>
public boolean getMaintenanceMode(int dataSourceId) throws MBeanException , javax.management.MBeanException, weblogic.management.utils.NotFoundException
</pre>
With these code changes in place, the MBean builds correctly, using the MBeanMaker, however WLS(814) falls over on startup with the exception:
<pre>
javax.management.JMRuntimeException: Two operations with the same name, "getMaintenanceMode", in MBean type: com.aol.universal.security.tools.DashboardUserTools
at weblogic.management.commo.ModelMBeanTypeMBean.getExpandedMBeanInstanceInfo(ModelMBeanTypeMBean.java:1092)
at weblogic.management.commo.ModelMBeanTypeMBean.<init>(ModelMBeanTypeMBean.java:250)
at sun.reflect.GeneratedConstructorAccessor3.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.sun.management.jmx.MBeanServerImpl.internal_instantiate(MBeanServerImpl.java:2232)
at com.sun.management.jmx.MBeanServerImpl.createMBean(MBeanServerImpl.java:763)
at weblogic.management.internal.RemoteMBeanServerImpl.createMBean(RemoteMBeanServerImpl.java:897)
at javax.management.loading.MLet.getMBeansFromURL(MLet.java:542)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1633)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1528)
at weblogic.management.internal.RemoteMBeanServerImpl.private_invoke(RemoteMBeanServerImpl.java:988)
at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:946)
at weblogic.management.commo.Commo.initTypesAtLocation(Commo.java:1409)
at weblogic.management.commo.Commo.initTypes(Commo.java:552)
at weblogic.management.commo.Commo.initTypes(Commo.java:534)
at weblogic.management.AdminServerAdmin.initializeCommo(AdminServerAdmin.java:656)
at weblogic.management.AdminServerAdmin.initializeRepository(AdminServerAdmin.java:874)
at weblogic.management.AdminServerAdmin.initialize(AdminServerAdmin.java:267)
at weblogic.t3.srvr.T3Srvr.initializeHere(T3Srvr.java:771)
at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:670)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:344)
at weblogic.Server.main(Server.java:32)
</pre>
Granted there <i>are</i> two methods with the same name, but they have different signatures, so they are <i>different</i> methods! Its just simple OO method overloading, after all!
Has anyone run into this in, too? Is there a solution?
cheers
Paul

Hi,
I doubt that the addition of a second signature actually invalidates (the red X icon) the first signature, but rather it shows the signature as Valid with Changes (the pen & yellow triangle icon). Technically, that is the correct signature status, but because it caused so much confusion, beginning with version 9, we've changed the user interface and stopped indicating changes to the PDF if the only change is a subsequent signature.
If on the other hand you are getting the red X for the first signature please let me know as I'd be curious to see the file.
Steve

Similar Messages

  • Multiple Digital Signatures on single profile.

    Hello,
    I have a question. Can I create multiple digital signatures on a single system.
    If Yes, I can create digital signature of any "Signature required person"  and I can sign for him, If I have his email id and Organization name, correct?
    It means we can easily sign for any other person in the world. If so, how does this system mean to be safe ?
    Thanks

    Please repost this issue in Acrobat forum.This is reader forum.

  • How to do Multiple digital signatures?

    I have created a form in Acrobat 9 Pro with multiple digital signatures. This is an approval form that is emailed "up the chain of command".  I have enabled extended features in Adobe Reader so that users without Acrobat 9 can digitally sign the form.  I created the form and did a certified signature.  I then emailed it to a typical user who filled in the form and emailed it to her boss for a digital signature.  Her boss digitally signed it and emailed it to the CFO.  The CFO does not have Acrobat 9.  When she gets it, she gets the error message "This document enabled extended features in Adobe Reader.  The document has been changed since it was created and use of extended features is no longer available.  Please contact the author for the original version of this document."  How do I correct this?

    Steve,
    I wanted to test how cumbersome it would be to have the 2 staff members open with Adobe Reader instead of Creative Suite; however, I have not been able to find any option like "open with" in my outlook email.  Every time I try to open it defaults to my Acrobat 9 Pro to open the document.  Would the 2 staff members have to save the email and then use "open with" in order to by pass Creative Suite?
    Also I am not sure if you answered my question last time - Is it possible to just upgrade the Acrobat portion of Creative Suite or do you have to upgrade the entire Creative Suite just to get the newer Acrobat?  I will also be checking the upgrade link you sent.  Thanks.

  • Call Webservice URL with multiple methods in PI 7.0

    Dear Gurus,
    I have the following requirement:
    I need to make multiple calls to a same webservice (URL) which have multiple methods on its WSDL. I know it is possible in PI 7.1. But is it possible in PI 7.0?
    I have already designed and configured the scenarios and generated ABAP Proxy. When I call the endpoint without specifyng the method I got the following message:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Inbound Message
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIAdapterFramework</SAP:Category>
      <SAP:Code area="MESSAGE">GENERAL</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Endpoint {http://mywebserviceurl.com} does not contain operation meta data for: {http://mynamespace}MyMessageInterface</SAP:AdditionalText>
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack />
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Please somebody could help me to solve this issue?
    Thank you in advance.
    Fabio Purcino

    >>. But is it possible in PI 7.0?
    Just few cents..
    Test using SOAPUI or  XMLSPY and use that same WSDL URL in the target URL of Communication channel. Just to make sure you use the right endpoint.
    or
    You can specify the method name as  soap action dynamically using udf in mapping and see how it behaves.

  • Multiple Electronic Signatures using Signature PAD

    Hello Experts,
    We have a requirement where we need to capture the electronic signature on thee PDF form at different time. This means I fill the PDF form get the 1st electronic signature using signature PAD and then saved the form. I open the same form and then take the 2nd signature. When we are taking the 2nd signature on the saved form it's making the form and signature invalid.
    Please let me know if there's a restriction by Adobe PDF such that you can't accept the signature once it's signed and saved.
    Thanks, Ritesh

    Yes, that's an e-signature. An option if you need to set up multiple e-signatures is to use stamps. They can be flattened individually, which converts them to regular page contents. The Acrobat help has more information on using stamps and you can use the following free JavaScript-based utility to flatten them after they're applied if you want: http://www.uvsar.com/projects/acrobat/flattener/

  • Creating multiple digital signatures

    When I create multiple freehand signatures in an adobe acrobat document there is an issue.
    Can I create multiple signatures and place them on the document without having the original signature be listed as part of an older revision? It marks a new signature as a change to the document and creates a second revision.

    >As a business process when would people be approving the other's signatures?
    As a normal business process maybe not. But consider: a signature can
    have a visual aspect. This visual aspect might be large and not just
    an written name: so someone could be tricked into signing something
    different than the original document, maybe.
    Anyway, this is moot. The signature becomes a part of the PDF. Each
    signature certifies the entire PDF, not what a document looks like,
    but byte for byte everything in the PDF, whether you can see it or
    not. Hence, each signature encapsulates the previous signatures.
    Aandi Inston

  • Pdf fillable form - multiple digital signatures

    I have a fillable pdf form that requires multiple digital signatures. Is there a way to send the form to multiple parties and merge it back to one form upon receipt of the signature from each party? Does that be accomplished with a javascript or do I need to use a different software? Thank you.

    That's not how digital signatures work, so the answer is "no". When multiple people need to sign a document, they need to sign the same document in sequence.

  • Excel 2010 - Multiple Digital Signatures?

    How would you add multiple digital signatures to an Excel 2010 workbook?

    Hi,
    To add multiple digital signatures, we need to  create the signatures first.
    Then please refer to the following steps:
    Click the File tab.
    Click Info.
    Under Permissions, click Protect Document,
    Protect Workbook or Protect Presentation.
    Click Add a Digital Signature.
    Read the Word, Excel, or PowerPoint message, and then click OK.
    In the Sign dialog box, in the Purpose for signing this document box, type the purpose.
    Click Sign.
     Check the following MS link for additional information.
    http://office.microsoft.com/en-us/excel-help/add-or-remove-a-digital-signature-in-office-files-HA010354308.aspx
    Regards,
    George Zhao
    TechNet Community Support

  • Form Size issue with multiple Digital Signatures

    I have created a form (liveCycle 8) with multiple digital signatures required.  When each user signs the form, that section of the form is locked using collections.  The form is workflow through email after each user signs it.  Each time the user signs and forwards the form, the form's size becomes too large.
    How can the form be optimized to compress each time an users signs the form?
    Thank you,
    Lori

    Steve,
       After your request to post the form, I wanted to removal some company items like the Logo.  Once I removed the Logo, I found the biggest issue was a Logo image size that was making the file so large.  Once I reduced the image size, the signatures only added 46kb at each signature level.
    Thank you for your help,
    Lori

  • No Method Signature - initQuery error after VO Substitution

    Hi All,
    I have done a VO Substitution for "NewBankAccountVOImpl". Below is the exact Requirement,
    iReceivables -> Query for a given Customer -> Go to accounts Tab -> Try to Pay off an invoice -> You get an option choose Payment Method as "New Bank Account" ->
    Now there are three field Routing Number, Account Number and Account Holder
    I need to restrict Account Number to minimum three characters. In 11.5.10 Oracle do not have this validation.
    So I checked out the place where the Routing Number and Account Number Validation happen i.e "NewBankAccountVOImpl" and extended the same to custom VOImpl and copied all the standard code to my custom code as below,
    package mercury.oracle.apps.ar.irec.accountDetails.pay.server;
    import oracle.apps.ar.irec.accountDetails.pay.server.NewBankAccountVOImpl;
    import oracle.apps.ar.irec.accountDetails.pay.server.NewBankAccountVORowImpl;
    import java.sql.Types;
    import java.lang.String;
    import oracle.apps.ar.irec.accountDetails.pay.utilities.PaymentUtilities;
    import oracle.apps.ar.irec.framework.IROAViewObjectImpl;
    import oracle.apps.fnd.common.VersionInfo;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.server.*;
    import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
    import oracle.jbo.RowIterator;
    import oracle.jbo.RowSetIterator;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.DBTransaction;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OraclePreparedStatement;
    // --- File generated by Oracle Business Components for Java.
    // --------------- Modification History --------------------------
    // Date Created By Description
    // 04/01/2011 Veerendra K Account Number Validation to raise
    // error if Account Number entered is
    // less than 3 Digits
    public class MMARNewBankAccountVOImpl extends NewBankAccountVOImpl
    * This is the default constructor (do not remove)
    public MMARNewBankAccountVOImpl()
    public void initQuery()
    if(!isExecuted())
    executeQuery();
    reset();
    // Wrapper Method to validate Routing Number and Account Number
    public void validateNewBankAccount()
    OAApplicationModuleImpl oaapplicationmoduleimpl = (OAApplicationModuleImpl)getApplicationModule();
    RowSetIterator rowsetiterator = createRowSetIterator("iter");
    rowsetiterator.reset();
    NewBankAccountVORowImpl newbankaccountvorowimpl = (NewBankAccountVORowImpl)rowsetiterator.next();
    rowsetiterator.closeRowSetIterator();
    OAException oaexception = null;
    //object obj = null;
    int i = validateRoutingNumber(newbankaccountvorowimpl.getStrippedRoutingNumber());
    if(i == 0)
    OAException oaexception1 = new OAException("AR", "ARI_INVALID_ROUTING_NUMBER");
    if(oaexception == null)
    oaexception = oaexception1;
    else
    oaexception.setNextException(oaexception1);
    } else
    if(i == 2)
    OAException oaexception2 = new OAException("AR", "ARI_CREATE_BANK_ACCOUNT");
    if(oaexception == null)
    oaexception = oaexception2;
    else
    oaexception.setNextException(oaexception2);
    // Added by VEERENDRA KODALLI to limit addition of New Bank Account with Minimum 3 Digits
    if(validateBankAccountNumber(newbankaccountvorowimpl.getStrippedBankAccountNumber()))
    // Define Exception with FND Message MMARI_INVALID_BA_NUMBER
    OAException oaexception4 = new OAException("AR", "MMARI_INVALID_BA_NUMBER");
    if(oaexception == null)
    oaexception = oaexception4;
    else
    oaexception.setNextException(oaexception4);
    // Method to Validate if Entered Account Number and Routing Number Combination already exist
    if(validateDuplicateBankAccountNumber(newbankaccountvorowimpl.getStrippedBankAccountNumber(), newbankaccountvorowimpl.getStrippedRoutingNumber(), newbankaccountvorowimpl.getAccountHolderName()))
    OAException oaexception3 = new OAException("AR", "ARI_DUPLICATE_BA_NUMBER");
    if(oaexception == null)
    oaexception = oaexception3;
    else
    oaexception.setNextException(oaexception3);
    if(oaexception != null)
    oaexception.setApplicationModule(oaapplicationmoduleimpl);
    throw oaexception;
    } else
    return;
    // Method to Validate Routing Number
    public int validateRoutingNumber(String s)
    boolean flag = PaymentUtilities.checkDigits(s);
    if(!flag)
    return 0;
    OAApplicationModuleImpl oaapplicationmoduleimpl = (OAApplicationModuleImpl)getApplicationModule();
    OADBTransaction oadbtransaction = (OADBTransaction)oaapplicationmoduleimpl.getDBTransaction();
    if(oadbtransaction.isLoggingEnabled(2))
    oadbtransaction.writeDiagnostics(this, "Start validateRoutingNumber", 2);
    String s1 = "BEGIN :1 := ARP_BANK_DIRECTORY.is_routing_number_valid(:2,:3); END;";
    OracleCallableStatement oraclecallablestatement = (OracleCallableStatement)oadbtransaction.createCallableStatement(s1, 1);
    int i = 0;
    try
    oraclecallablestatement.registerOutParameter(1, -5, 38, 38);
    oraclecallablestatement.setString(2, s);
    oraclecallablestatement.setString(3, "ABA");
    oraclecallablestatement.execute();
    i = oraclecallablestatement.getInt(1);
    catch(Exception exception1)
    exception1.printStackTrace();
    throw OAException.wrapperException(exception1);
    finally
    try
    oraclecallablestatement.close();
    catch(Exception exception2)
    throw OAException.wrapperException(exception2);
    // Debug Message
    if(oadbtransaction.isLoggingEnabled(2))
    oadbtransaction.writeDiagnostics(this, "End validateRoutingNumber", 2);
    return i;
    // Method to Validate Duplicate Account Number
    public boolean validateDuplicateBankAccountNumber(String s, String s1, String s2)
    OAApplicationModuleImpl oaapplicationmoduleimpl = (OAApplicationModuleImpl)getApplicationModule();
    OADBTransaction oadbtransaction = (OADBTransaction)oaapplicationmoduleimpl.getDBTransaction();
    if(oadbtransaction.isLoggingEnabled(2))
    // Debug Message
    oadbtransaction.writeDiagnostics(this, "Start validateDuplicateBankAccountNumber", 2);
    String s3 = "BEGIN :1 := AR_IREC_PAYMENTS.is_bank_account_duplicate(:2,:3,:4); END;";
    OracleCallableStatement oraclecallablestatement = (OracleCallableStatement)oadbtransaction.createCallableStatement(s3, 1);
    boolean flag = true;
    try
    oraclecallablestatement.registerOutParameter(1, -5, 38, 38);
    oraclecallablestatement.setString(2, s);
    oraclecallablestatement.setString(3, s1);
    oraclecallablestatement.setString(4, s2);
    oraclecallablestatement.execute();
    Number number = new Number(oraclecallablestatement.getLong(1));
    if(number.equals(new Number("0")))
    flag = false;
    else
    flag = true;
    catch(Exception exception1)
    exception1.printStackTrace();
    throw OAException.wrapperException(exception1);
    finally
    try
    oraclecallablestatement.close();
    catch(Exception exception2)
    throw OAException.wrapperException(exception2);
    // Debug Message
    if(oadbtransaction.isLoggingEnabled(2))
    oadbtransaction.writeDiagnostics(this, "End validateDuplicateBankAccountNumber", 2);
    return flag;
    public boolean validateBankAccountNumber(String s)
    OAApplicationModuleImpl oaapplicationmoduleimpl = (OAApplicationModuleImpl)getApplicationModule();
    OADBTransaction oadbtransaction = (OADBTransaction)oaapplicationmoduleimpl.getDBTransaction();
    // Debug Message
    if(oadbtransaction.isLoggingEnabled(2))
    oadbtransaction.writeDiagnostics(this, "Start validateBankAccountNumber", 2);
    boolean flag = true;
    try
    // Check if the Account Number Length is less than 3 Digits
    if(s.length() < 3)
    flag = true;
    // Debug Message
    if(oadbtransaction.isLoggingEnabled(2))
    oadbtransaction.writeDiagnostics(this, "Account Number Less than 3 Digits!", 2);
    else
    // Debug Message
    if(oadbtransaction.isLoggingEnabled(2))
    oadbtransaction.writeDiagnostics(this, "Account Number greater than 3 Digits!", 2);
    flag = false;
    //return PaymentUtilities.checkDigits(s);
    catch (Exception exception4)
    //if(oadbtransaction.isLoggingEnabled(2))
    //oadbtransaction.writeDiagnostics(this, "Entered Catch", 2);
    throw OAException.wrapperException(exception4);
    if(oadbtransaction.isLoggingEnabled(2))
    // Debug Message
    oadbtransaction.writeDiagnostics(this, "End validateBankAccountNumber", 2);
    return flag;
    public static final String RCS_ID = "$Header: NewBankAccountVOImpl.java 115.8 2008/07/21 13:49:37 nkanchan noship $";
    public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion("$Header: NewBankAccountVOImpl.java 115.8 2008/07/21 13:49:37 nkanchan noship $", "oracle.apps.ar.irec.accountDetails.pay.server");
    I did compile the Java File and also the JPX import. It was all successful. I tested the code and it worked as expected. Now I see an exception on the page when I click the Pay button stating "No Method Signature No Method Signature - initQuery".
    The error do not come when I take out my substitution. Any one know what might be the reason for above issue. I have no idea why all of a sudden it stopped working and checked all standard filles but none got changed.
    Any pointers towards to resolve the same would be appreciable.
    Thanks in Advance,
    Veerendra

    Uma,
    try to delete all class files, recompile and run! Also, check if any CO is not extended other than from OAControllerImpl, although it would not be generally.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Multiple Electronic Signatures

    I have just upgraded from Adobe 9 Professional to Adobe 11 Professional.  Although I have saved several signature appearances, I am unable to chose which one to insert when signing documents.  Is there a way to do this without having to "change" or "clear" my saved signature?  Please help!  Thanks!
    -Patty

    Yes, that's an e-signature. An option if you need to set up multiple e-signatures is to use stamps. They can be flattened individually, which converts them to regular page contents. The Acrobat help has more information on using stamps and you can use the following free JavaScript-based utility to flatten them after they're applied if you want: http://www.uvsar.com/projects/acrobat/flattener/

  • Problems deploying application with updated method signatures on WLS8.1

    Hi,
    I have an jar file under applications which I have deployed fine on WLS 8.1 in the past. I changed the method signature on one of the EJB classes in the jar. One of the parameters now takes a different Java class type. I have recompiled everyone and repackaged the jar but when I try to deploy the jar it gives me an error because the the local interface of the EJB does not have the old Java class parameter type.
    I have checked the jar, classes in the jar, and the ejb-jar.xml and weblogic-ejb-jar.xml in the jar and it is looks fine. I have cleaned out my server deployment directories and verified the classpath in case the older jar was in there and everything looks OK. It seems for some reason 8.1 is caching the old ejb-jar.xml or somehow is remembering the old method signature and will not process the updated jar. Has anyone seen anything like this?
    Thanks for any help or recommendations

    Can you show me the error you receive?
    Another simple test would be to deploy your application to a new, empty
    server.
    You can create a new domain as easy as this:
    mkdir testDomain;
    cd testDomain;
    java weblogic.Server
    Type in the username/password that you want and answer 'Yes' when it
    asks if you want to create a new domain.
    Try deploying your jar to this new domain, and let me know if it still
    fails.
    -- Rob
    Jeff Dooley wrote:
    Hi,
    I have an jar file under applications which I have deployed fine on WLS 8.1 in the past. I changed the method signature on one of the EJB classes in the jar. One of the parameters now takes a different Java class type. I have recompiled everyone and repackaged the jar but when I try to deploy the jar it gives me an error because the the local interface of the EJB does not have the old Java class parameter type.
    I have checked the jar, classes in the jar, and the ejb-jar.xml and weblogic-ejb-jar.xml in the jar and it is looks fine. I have cleaned out my server deployment directories and verified the classpath in case the older jar was in there and everything looks OK. It seems for some reason 8.1 is caching the old ejb-jar.xml or somehow is remembering the old method signature and will not process the updated jar. Has anyone seen anything like this?
    Thanks for any help or recommendations

  • Multiple Email Signatures

    I use my iPhone for both work and personal email. It would be helpful to support multiple email signatures so you can associate the appropriate signature with the appropriate email account. This is functionality that the BlackBerry supports! Currently it looks like you can only have one signature and it applies to all email accounts. I'd even be happy if you could have one signature but it only gets applied to one email account.

    You can submit feedback to Apple: http://www.apple.com/feedback/iphone.html

  • Deciding when to use "final" in method signatures

    Please consider this source code:
    public void foo(final Set<String> set) { ... }People who use this class don't need to know that the "set" reference is "final", right?
    Edited by: dpxqb on Apr 30, 2010 3:28 AM

    Kayaman wrote:
    They should be implicitly final so there would be no need for questions like this.I don't understand what that means.
    Or does someone here admit to having a habit of reassigning the parameters?I don't understand. I do it when it needs doing. Here is an example where I re-assigned the reference in the method signature:
    void foo(Writer w) {
      int i = 0;
      boolean hit = false;
      BufferedWriter bw = new BufferedWriter(w);
      Set<String> set = new HashSet<String>();
      bw.write(c);
      w.write(c); // no exception thrown. the object on the other end of the Writer will act weird
                  // which further masks the bug.
    }There are two working Writers going to the same location. There is no reason for this, it makes no sense, and it is a bug waiting to happen.
    This is how I got my BufferedWriter. Reassign the initial reference:
    void foo(Writer w) {
      if(! (w instanceof BufferedWriter)) {
        w = new BufferedWriter(w);
    }The only way to write is via a single object. It just prevents me from doing something stupid. I feel safer by eliminating unused references.

  • Changing exception clause in method signature when overwriting a method

    Hi,
    I stumbled upon a situation by accident and am not really clear on the details surrounding it. A short description:
    Say there is some API with interfaces Foo and Bar as follows:
    public interface Foo {
       void test() throws Exception;
    public interface Bar extends Foo {
       void test();
    }Now, I find it strange that method test() for interface Bar does not need to define Exception in its throws clause. When I first started with Java I was using Java 1.4.2; I now use Java 1.6. I cannot remember ever reading about this before and I have been unable to find an explanation or tutorial on how (or why) this works.
    Consider a more practical example:
    Say there is an API that uses RMI and defines interfaces as follwows:
    public interface RemoteHelper extends Remote {
       public Object select(int uid) throws RemoteException;
    public interface LocalHelper extends RemoteHelper {
       public Object select(int uid);
    }As per the RMI spec every method defined in a Remote interface must define RemoteException in its throws clause. The LocalHelper cannot be exported remotely (this will fail at runtime due to select() in LocalHelper not having RemoteException in its clause if I remember correctly).
    However, an implementing class for LocalHelper could represent a wrapper class for RemoteHelper, like this:
    public class Helper implements LocalHelper {
       private final RemoteHelper helper;
       public Helper(RemoteHelper helper) {
          this.helper = helper;
       public Object select(int id) {
          try {
             return (this.helper.select(id));
          } catch(RemoteException e) {
             // invoke app failure mechanism
    }This can uncouple an app from RMI dependancy. In more practical words: consider a webapp that contains two Servlets: a "startup" servlet and an "invocation" servlet. The startup servlet does nothing (always returns Method Not Allowed, default behaviour of HttpServlet), except locate an RMI Registry upon startup and look up some object bound to it. It can then make this object accessible to other classes through whatever means (i.e. a singleton Engine class).
    The invocation servlet does nothing upon startup, but simply calls some method on the previously acquired remote object. However, the invocation servlet does not need to know that the object is remote. Therefore, if the startup servlet wraps the remote object in another object (using the idea described before) then the invocation servlet is effectively removed from the RMI dependancy. The wrapper class can invoke some sort of failure mechanism upon the singleton engine (i.e. removing the remote object from memory) and optionally throw some other (optionally checked) exception (i.e. IllegalStateException) to the invocation servlet.
    In this way, the invocation servlet is not bound to RMI, there can be a single point where RemoteExceptions are handled and an unchecked exception (i.e. IllegalStateException) can be handled by the Servlet API through an exception error page, displaying a "Service Unavailable" message.
    Sorry for all this extensive text; I just typed out some thoughts. In short, my question is how and why can the throws clause change when overwriting a method? It's nothing I need though, except for the clarity (e.g. is this a bad practice to do?) and was more of an observation than a question.
    PS: Unless I'm mistaken, this is basically called the "Adapter" or "Bridge" (not sure which one it is) pattern (or a close adaptation to it) right (where one class is written to provide access to another class where the method signature is different)?
    Thanks for reading,
    Yuthura

    Yuthura wrote:
    I know it may throw any checked exception, but I'm pretty certain that an interface that extends java.rmi.Remote must include at least java.rmi.RemoteException in its throws clause (unless the spec has changed in Java 1.5/1.6).No.
    A method can always throw fewer exceptions than the one it's overriding. RMI has nothing to do with it.
    See Deitel & Deilte Advanced Java 2 Platform How To Program, 1st Ed. (ISBN 0-13-089650-1), page 793 (sorry, I couldn't find the RMI spec quick enough). Quote: "Each method in a Remote interface must have a throws clause that indicates that the method can throw RemoteException".Which means that there's always a possibility of RemoteException being thrown. That's a different issue. It's not becusae the parent class can throw RE. Rather, it's because some step that will always be followed is declared to throw RE.
    I later also noticed I could not add other checked exceptions, which made sense indeed. Your explanation made perfect sense now that I heard (read) it. But just to humour my curousity, has this always been possible? Yes, Java has always worked that way.
    PS: The overwriting/-riding was a grammatical typo (English is not my native language), but I meant to say what you said.No problem. Minor detail. It's a common mistake, but I always try to encourage proper terminology.

Maybe you are looking for

  • Error OSR 11g when tring to open in browser

    Hi for All I installed OSR 11g, got this error when tring to open in browser: Http://localhost:7777/registry/uddi/web In browser: Error 500--Internal Server Error From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1: 10.5.1 500 Internal Server Error

  • J_security_check internal server error.

    Did somebody experienced this error? and what is the solution? Thanks. I using WL 6 sp1 on NT server 4. 1- I created a user 'xena' in WL console; note: 'xena' does not belong to the WL Administrators group 2- I created an application with the followi

  • I can't get a new folder to open when I hit the new folder button in adobe reader 11

    Recently my Adobe Reader won't let me open a new folder when I hit the New folder button - help

  • Oracle error 1950 encountered

    hi everybody,good evening... while taking import of a backup dump in another new schema, the oracle error 1950 encountered. Those particular tables for which the error was encountered were not created in the new schema and in the log file there is a

  • I have 2 laptops both in my house, how can I use S...

    I was able to Skype from one laptop to another during one trip.  I tried to use it again on later trips and couldn't connect.  I normally use the 2 from my home (mine and my husbands).  Why does it no longer work on his? He has a tablet sized Dell, I