Odd compiler behavior with annotations

Hi all,
I apologize if this is the wrong forum, but the JDev code editor behavior is a significant part of this. I have an annotation type, TestParameters. If I write the following line:
TestParameters params = (TestParameters) someClass.getAnnotation(TestParameters.class);then the cast is greyed out in the code editor, and code assistance tells me it's unnecessary. Since the signature of getAnnotation is
<A extends Annotation> A getAnnotation(Class<A>)this is what I'd expect; I really shouldn't need that cast.
However, if I take the cast out, although nothing is marked red in the code editor, I get a compiler error:
Error(32,29): incompatible types; found: interface java.lang.annotation.Annotation,
required: annotation annotation.TestParametersWhat's going on here? I'm 95% sure the code should compile without the cast.
Thanks much,
Avrom

Aha! You're right, what it prints out is not what I'd expected:
class $Proxy3I was using ojc, but javac gives the same results (including the compiler error: "incompatible types").
Not entirely sure what's going on here...either the Javadoc for Class.getAnnotation() and the JDev code assistance is both wrong, or something odder is going on.
Message was edited by:
Avrom
ha! Found the issue.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5104826
(This was closed by Sun as not a bug.)
The problem was that someClass was declared as type Class, rather than Class<?>. I guess my understanding of generics wasn't quite up to snuff; I'd been assuming that the declarations
SomeType myObj;and
someType<?> myObj;were identical, since you can't access the wildcard in the class containing myObj, but apparently the compiler doesn't see them that way. My bad.

Similar Messages

  • Odd compiler behavior (re: generics)

    Greetings, I am encountering a rather odd compiler generated error/warning with some code. The issue involves using an "independent" generic method of a raw-typed class. That is, the class has a variable T (call it Test<T> and has an instance method that returns ArrayList<String>. The problem: when a raw typed Test is used, the ArrayList returned is also raw. Here is some code to illustrate:
    import java.util.ArrayList;
    class Test<T>{
      ArrayList<String> getChildren(){
        return null;
      static void test1( Test t ){
        ArrayList<String> children = t.getChildren();
    // WARNING:                      ^^^^^^^^^^^^^^^^
    //Test.java:26: warning: [unchecked] unchecked conversion
    //found   : java.util.ArrayList
    //required: java.util.ArrayList<java.lang.String>
      static void test2( Test<?> t ){
        // OK, since we have the type variable set.
        ArrayList<String> children = t.getChildren();
      }If the type variable is specified as anything but raw, then it works fine.
    Is there some explantation for this behavior? My argument: since the return type of getChildren doesn't use the wildcard, why does the type argument of the implicit instance matter? Is this a compiler bug or just a "sharp edge" in the specification (perhaps even reasonable or necessary).
    I know the solution (or workaround). I am just seeking an explanation.
    Thanks,
    - Tim

    I found a bug evaluation (6358084) that was closed as not a bug where
    the evaluator wrote:
    All members, regardless of their dependence of type parameters, are erased.
    So the compiler is correct, the method call is unchecked.
    Still, I am ignorant of the reasoning for independent or fully described types.

  • Help Needed compile, deploy Web Service with Annotations on Web Logic 9.2

    Hi,
    I am new web logic and need some help in compiling, creating deployment file i.e. war, ear on Web Logic 9.2. I have the following sample web service with annotations code code but need help in compiling, creating deployment file (war,ear), creating proxy for testing etc. How to compile and create deployment files in WebLogic 9.2. Any help is really appreciated.
    package sample_ws;
    import java.rmi.RemoteException;
    import javax.jws.*;
    import javax.jws.soap.SOAPBinding;
    import org.w3c.dom.Document;
    @WebService
    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL,
                 parameterStyle = SOAPBinding.ParameterStyle.BARE)
    public class EchoService {
        public EchoService() {
        @WebMethod(action="echo")
        @WebResult(targetNamespace="http://exa.org", name="echoResult")
        public Document echo(@WebParam(targetNamespace = "http://exa.org",
                                       name = "echoMsg")
            Document doc) throws RemoteException{
            return doc;
    }Thanks

    I am using Oracle Jdeveloper as an IDE and created a war file and deployed on Oracle App. Server it works fine. Now if I deploy the same war on Web Logic it gives me the following error:
    java.lang.IllegalStateException: could not find schema type named {{http}//exa.org}>>echoResult
    Errors were encountered while performing this operation. Here is the code I have:
    package webservice2 ;
    import java.rmi.RemoteException;
    import javax.jws.*;
    import javax.jws.soap.SOAPBinding;
    import org.w3c.dom.Document;
    @WebService
    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
                 use = SOAPBinding.Use.LITERAL,
                 parameterStyle = SOAPBinding.ParameterStyle.BARE)
    public class EchoService {
        public EchoService() {
        @WebMethod(action="echo")
        @WebResult(targetNamespace="http://exa.org", name="echoResult")
        public Document echo(@WebParam(targetNamespace = "http://exa.org",
                                       name = "echoMsg")
            Document doc) throws RemoteException{
            return doc;
    }And here is the wsdl file I have:
    <definitions
         name="EchoServiceService"
         targetNamespace="http://webservice2/"
         xmlns="http://schemas.xmlsoap.org/wsdl/"
         xmlns:tns="http://webservice2/"
         xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
         xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
         xmlns:ns1="http://exa.org"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        >
        <types>
            <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://exa.org" elementFormDefault="qualified"
                 xmlns:tns="http://exa.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/">
                <element name="echoMsg" nillable="true">
                    <complexType>
                        <sequence>
                            <any/>
                        </sequence>
                    </complexType>
                </element>
                <element name="echoResult" nillable="true">
                    <complexType>
                        <sequence>
                            <any/>
                        </sequence>
                    </complexType>
                </element>
            </schema>
        </types>
        <message name="EchoServicePortType_echo">
            <part name="echoMsg" element="ns1:echoMsg"/>
        </message>
        <message name="EchoServicePortType_echoResponse">
            <part name="echoResult" element="ns1:echoResult"/>
        </message>
        <portType name="EchoService">
            <operation name="echo">
                <input message="tns:EchoServicePortType_echo"/>
                <output message="tns:EchoServicePortType_echoResponse"/>
            </operation>
        </portType>
        <binding name="EchoServiceSoapHttp" type="tns:EchoService">
            <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
            <operation name="echo">
                <soap:operation soapAction="echo"/>
                <input>
                    <soap:body use="literal" parts="echoMsg"/>
                </input>
                <output>
                    <soap:body use="literal" parts="echoResult"/>
                </output>
            </operation>
        </binding>
        <service name="EchoServiceService">
            <port name="EchoServiceSoapHttpPort" binding="tns:EchoServiceSoapHttp">
                <soap:address location="http://localhost:8888/EnableSrc-WebService2-context-root/EchoServiceSoapHttpPort"/>
            </port>
        </service>
    </definitions>Any ideas what might be wrong.

  • Compile build.xml with Ant for web service with annotations

    Hi Friends,
    I have a web service with annotations, using javax.annotation.PostConstruct, and javax.annotation.PreDestroy.
    I have a build.xml to create a EAR for this web service.
    When I run the ant task, the build complete successfully but the .war file cannot be deployed on the WLS server. Taking a closer look, I see that the required files such as, webservices.xml, weblogic.xml, weblogic-webservices.xml, Provision.wsdl files are not generated.
    Following is the build.xml file:
    <?xml version="1.0" encoding="windows-1252" ?>
    <project default="jwsc">
    <property file="build.properties"/>
    <property name="weblogic.jar.classpath"
    value="C:/bea_jDev/wlserver_10.3/server/lib"/>
    <property name="oimclient.jar.classpath"
              value="C:/_data/Project_Dc/OIM_jars" />
         <property name="com.jar.classpath" value="C:/JDeveloper/mywork/Service_Test/lib" />
    <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask">
    <classpath>
    <path id="weblogic.classpath">
    <pathelement path="WEBLOGIC_HOME"/>
    <fileset dir="${weblogic.jar.classpath}">
    <include name="**/*.jar"/>
    </fileset>
    </path>
    </classpath>
    </taskdef>
    <target name="all" depends="clean,build-service,deploy"></target>
    <target name="build-service">
         <jwsc srcdir="${src.home}" destdir="ear_directory" >
    <classpath>
    <path id="oim.classpath">
    <pathelement path="OIM_HOME"/>
    <fileset dir="${oimclient.jar.classpath}">
    <include name="**/*.jar"/>
    </fileset>
    <fileset dir="${com.jar.classpath}">
    <include name="**/*.jar"/>
    </fileset>
    </path>
    </classpath>
    <jws file="${jws.home}" type="JAXWS" />
    </jwsc>
    </target>
    <target name="deploy">
    <!--add wldeploy task here -->
    </target>
    <target name="clean">
    <delete dir="output" />
    </target>
    </project>
    Can you please point out what else is to be done and where exactly am I going wrong in writing the build.xml file.
    Let me know if some else information is required.

    This is what I get when I run the ant task:
    Buildfile: C:\JDeveloper\mywork\ProvisioningService_Test2\Provision\resource\build.xml
    build-service:
    [jwsc] JWS: processing module /com/fox/provision/webservice/endpoint/impl/ProvisionEndPointImpl
    [jwsc] Parsing source files
    [jwsc] Parsing source files
    [jwsc] 1 JWS files being processed for module /com/.../provision/webservice/endpoint/impl/ProvisionEndPointImpl
    [jwsc] [JAM] Warning: failed to resolve class org.apache.xmlbeans.XmlObject
    [jwsc] [JAM] Warning: failed to resolve class com.bea.xml.XmlObject
    [jwsc] [JAM] Warning: failed to resolve class javax.xml.rpc.holders.Holder
    [jwsc] JWS: C:\..\...\..\...\code\ProvisioningService\src\com\...\provision\webservice\endpoint\impl\..EndPointImpl.java Validated.
    [jwsc] Processing 1 JAX-WS web services...
    [jwsc] warning: Specified AnnotationProcessorFactory, 'com.sun.istack.ws.AnnotationProcessorFactoryImpl', not found on search path.
    warning: No annotation processors found but annotations present.
    2 warnings
    [jwsc] Compiling 2 source files to C:\DOCUME~1\....\LOCALS~1\Temp\_lsgijm
    [jwsc] Building jar: C:\..\...\..\...\code\ProvisioningService\src\com\...\provision\webservice\deploy\ear_directory\com\fox\provision\webservice\endpoint\impl\...EndPointImpl.war
    [jwsc] Created JWS deployment outputFile: C:\..\...\..\...\code\ProvisioningService\src\com\...\provision\webservice\deploy\ear_directory\....\...\provision\webservice\endpoint\impl\..EndPointImpl.war
    [jwsc] [EarFile] Application File : C:\..\...\..\...\code\ProvisioningService\src\com\.....\provision\webservice\deploy\ear_directory\META-INF\application.xml
    [AntUtil.deleteDir] Deleting directory C:\DOCUME~1\....\LOCALS~1\Temp\_lsgijm
    BUILD SUCCESSFUL
    Total time: 7 seconds
    Due to some limitations, I edited the path in the build.xml files.
    Please let me know what can be done. Thanks.
    Edited by: user9112073 on Nov 22, 2011 9:52 PM

  • Erratic Report Region Behavior with Dynamic SQL Queries

    I'm running HTMLDB v 1.5.1.00.12 and I've noticed some odd behavior with report regions using dynamic SQL queries. Every so often, our testers will run a page containing a dynamic sql report region and get the following error, (despite the fact the query was working only moments ago and no other developer has touched it):
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    or sometimes
    failed to parse SQL query:ORA-01403: no data found
    The only solution I've found so far is to:
    1) Make a copy of the failed report region.
    2) Disable or delete the original failed report region.
    The new copy of the report region runs without issue.
    My search of the forums turned up the following two threads, but neither provided me with a clear explanation of the cause, and how to avoid it:
    ORA-06502:PL/SQL: numeric or value error: character string buffer too small
    Re: Import Export Error (ORA-06502)
    The columns being returned are below the 4000 character limit, and the rows being returned are far less than 32k in size.
    Could this have anything to do with the way HTMLDB is internally storing the PL/SQL used to generate the dynamic SQL Query? Is there any known issue related to this with that version of HTMLDB?
    This problem occurs without any discernable pattern or consistency, making it hard to determine where I should focus my efforts in tracking down the cause.

    Hi all,
    My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
    Cheers,
    Joel

  • Strange window behavior with CS5

    I have begun experiencing strange behavior with PS CS5. I should begun with the machine configuration: 2.66GHz iMac (8,1) Intel Core Duo with 4GB RAM and OSX 10.6.6, Radeon HD 2600 Pro graphics card. The initial symptom showed up suddenly as an inability to display an image window; that is, I could open PS normally, everything would show up properly, but when I opened an image file of any sort, there would be no image window. Other cues indicated that the file was open; for example, the window menu would show it selected, and the layers palette would show the file's layers.
    It did not seem to matter what type of file was involved: PSD, JPG, TIF, whatever. Occasionally, this behavior would begin during a session. Sometimes it would happen right off the bat. Sometimes, stopping and restarting PS seemed to clean things up; other times, this had no effect. After messing around quite a bit with different permutations and combinations, all I could say was that the problem was random.
    I might add that I've had PS CS5 on this machine pretty much since it was announced, and had not had problems with it before. So this issue came along quite suddenly a couple of weeks ago. This was a little after I'd installed an update for Nik's Viveza 2; and I began to suspect that. Although why Viveza should do such a strange thing was odd, and Viveza was never part of the files I was experiencing issues with. Anyway, I went back to an earlier version of Viveza and the problem persisted.
    Since I run Time Machine, I also went back to versions of the entire PS folder from a month back, and found the same problem. Along the way, I experimented with the files I was using with PS CS4 & CS3, which I also have installed on this machine. These two versions of PS run perfectly well. At least the CS4 version has precisely the same plugins as the CS5 folder, and this seems to discount the potential problem with plugins.
    To be sure about CS5, I completely deactivated, deinstalled, and reinstalled it. The same issues occurred. Now, I have to admit that I let PS run its update process so that I brought it back to the most recent version in this step of my troubleshooting. So, I can't be certain that the issue isn't with some update of CS5.
    I might add that I have been running CS5 in 32-bit mode, for compatibility with certain plugins. This may or may not be an issue, since I have limited experience with running in 64-bit mode. At this point, I should add a bit more about the confusing behavior.
    While messing around with CS5, I also suspected the GPU support, since my problem had to do with windows. When the problem presents itself, the usual cycle through window views that you get by pressing the "F" key seems to get messed up. In particular, the "F" key doesn't work at all. Next, if you use the View menu to select different views, the full screen with menu bar view will often have garbled pixels, while the full screen view will show a blank grey screen. Then, cycling back to a window view will show a window with blank grey contents. This is interesting since the starting point was no window at all; but going into full screen and then back will produce a window with bogus contents.
    Now, the next strange thing, having to do with the GPU, is that CS5 often fails to recognize the Radeon HD 2600 card. Oddly enough, it did originally. And I had it running in Basic mode. However, CS4 does recognize the GPU; and I can set it in any variety of modes: Basic, Normal, and Advanced. This behavior is not consistent at all either; that is, while CS5 almost always now fails to detect the GPU, sometimes it does. As near as I can tell, this failure to detect the card does not depend upon whether I start CS5 in 32-bit or 64-bit mode. OTOH, CS4 always recognizes the GPU.
    Another form of this odd behavior arises if I start CS5 cold, and then just open a new blank window. This almost always works. I get a blank white window, and I can paint on it with a brush, etc. However, if I go ahead at this point and open a file, then the new file takes over the window; and there are no tabs. If I select the original new file, usually labelled "Untitled", the window bar will show the change of filename but the window's contents and the layers palette will continue to show the old file that I had opened. Cycling through views can sometimes get back to the new Untitled file, but just selecting file windows never works.
    Yet another aspect of this messed up window behavior is that the workspace bar, which shows the Bridge, MiniBridge and view icons on the upper left and the various workspace options and CS Live on the upper right, is present but blank. OTOH, the tool bar is always displayed correctly, as is the horizontal bar that shows the various tool options. Likewise, the palettes for the workspace such as layers, swatches, adjustments, and so on, are always correctly displayed on the left.
    My next steps in trying to figure this out will be to ensure that I am running the latest of all plugins so that I can get everything running in 64-bit mode and try this again. However, the single factor that seems consistent in this whole mess is that whenever I do find this odd behavior, the performance preferences window will indicate that CS5 is not detecting the GPU. Whenever this happens, if I open up CS4 and check the same performance preference in it, the GPU is detected. I can have the two preference windows side by side on the screen in fact, CS4 sees the GPU and CS5 does not. The counter-indication is that sometimes CS5 will work properly and the preferences window still shows that the GPU has not been detected. Having said that, I can add that if I have opened up CS5, and it has found the GPU, and I have set it into, say, Basic mode, and then later found CS5 messing up, and I go back and check the performance preferences again, the GPU has always been lost. So, CS5 can mess up windows with or without the GPU detected and active; but when if it started with the GPU present, it will show up as lost after the weird behavior starts.
    To add one more observation, I have had Macs and other computers with failing GPUs. This computer is showing none of the typical signs of that. Every other program seems to be working just fine, and I have a lot of these, many graphics intensive; e.g., Corel Painter 11, Parallels v6 running Windows 7, PS CS4, Lightroom v3, Aperture v3, and so on. It is just CS5 that is messing up.
    I could load up this message with screen shots of all this nonsense, but I'm not sure what that would add to the strange tale, other than I'm not pulling your legs. I am, however, pulling out my own hair.
    As I stated before, this began quite suddenly a couple of weeks ago, early Feb 2011. My best guess as to cause is some combination of incompatible updates between CS5, OSX, and maybe some plugin or other. I found unusual behavior with onOne's FocalPoint v2 last year after Apple updated GPU drivers in some OSX update, and cratered that program. It took onOne a month or two to fix that. I have CS5 on a laptop with the same OSX version, and on that I haven't seen these issues; but then, I haven't been using it as intensely over there. Also, that machine has different CPU and GPU models than this iMac.
    So, to the community: is anybody else starting to see this odd stuff? Am I alone?

    Here's the reason I say that the same plugins exist for both CS4 & CS5. Sometime last year, the internal hard drive on this computer died (as they so often do), and it was replaced under the Apple care warranty. As a consequence, I decided to rebuild the OS and applications from scratch and bring back my user files from backup. I among other things, I reinstalled all of CS4 as well as CS5 (and I had to put CS3 back too for reasons having to do with printing calibration images for Quad Tone RIP). Then, I went to reinstall the plugins that I needed. I use Nik Software, onOne, Portrait Professional and various Topaz plugins. To my recollection, most of these install in PS CS3, CS4, CS5, Aperture, and Lightroom. In short, it is not that I've copied or moved plugin folders from one application folder to another, just that the installers automatically detect the presence of the various applications and put the various plugins into each, as appropriate.
    The only 32-bit plugins that I have that don't fit into this category are from Vincent Versace. He provides special versions of certain Nik plugins (Tonal Contrast, Contrast Only, etc) that function with some Acme Educational extensions for performing B&W conversion, sharpening, blah blah blah. These plugins are only 32-bit and the extensions are only CS5 compatible. I've installed these ones only into CS5; so, you've got me. OTOH, I've had these from Vincent as soon as CS5 was available; and they've worked so far without problems. Perhaps I should just edit the extensions so I could use the latest plugins direct from Nik instead of the Versace special editions...
    I've checked fonts and repaired permissions. I am presently going through the rather tedious process of disabling plugins and extensions to see if anything yields consistent results. The rather random arrival of the strangeness makes ensuring that a change is really having an effect more difficult to validate, as you will appreciate.
    I apologize for my long-winded original post. I add all of the detail so that anyone who'd experienced similar strange behaviors might properly pattern-match what they were seeing. On the one hand, in finding the cause of a problem, you look for what's changed; and theoretically nothing is new. On the other hand, there's always so much changing behind the scenes with automatic updates of this, that, and the other thing that it's impossible to make the claim that nothing's new. 

  • Get default audit field behavior with an external datasource

    Others have posted and blogged extensively about creating a robust audit trail for LightSwitch. However, if you are looking to achieve the default behavior with an external datasource, you could simply add the fields to your database
    and write code in every entity's Inserting() and Updating() method.  However, if you have many tables in your app this can be a lot of work.  Here is a very easy way to DRY this up. 
    1. Add the audit fields to your tables
    - CreatedBy
    - DateCreated
    - UpdatedBy
    - DateUpdated
    2. Use this code in the DataService class for your datasource.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.LightSwitch;
    using Microsoft.LightSwitch.Security.Server;
    namespace LightSwitchApplication
    public partial class ApplicationDataService
    partial void SaveChanges_Executing()
    EntityChangeSet changes = this.Details.GetChanges();
    IReadOnlyCollection<IEntityObject> addedEntities = changes.AddedEntities;
    IReadOnlyCollection<IEntityObject> modifiedEntities = changes.ModifiedEntities;
    if (addedEntities.Any())
    foreach (IEntityObject entity in addedEntities)
    InsertAuditFields(entity);
    if (modifiedEntities.Any())
    foreach (IEntityObject entity in modifiedEntities)
    UpdateAuditFields(entity);
    private void InsertAuditFields(IEntityObject entity)
    string userName = this.Application.User.FullName;
    DateTimeOffset currentDateTime = DateTimeOffset.Now;
    entity.Details.Properties["CreatedBy"].Value = userName;
    entity.Details.Properties["DateCreated"].Value = currentDateTime;
    entity.Details.Properties["UpdatedBy"].Value = userName;
    entity.Details.Properties["DateUpdated"].Value = currentDateTime;
    private void UpdateAuditFields(IEntityObject entity)
    string userName = this.Application.User.FullName;
    DateTimeOffset currentDateTime = DateTimeOffset.Now;
    entity.Details.Properties["UpdatedBy"].Value = userName;
    entity.Details.Properties["DateUpdated"].Value = currentDateTime;
    Hopefully this helps someone.

    This version will check whether the table has the audit properties, thus allowing you to opt in.  Paul's solution is going to be better in the long run because it checks at compile time.  This was meant to be a quick way to get the default behavior. 
    This is not a substitute for a full audit capability (see Paul's blog) if that is your requirement.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.LightSwitch;
    using Microsoft.LightSwitch.Security.Server;
    using Microsoft.LightSwitch.Details;
    namespace LightSwitchApplication
    public partial class ApplicationDataService
    partial void SaveChanges_Executing()
    EntityChangeSet changes = this.Details.GetChanges();
    IReadOnlyCollection<IEntityObject> addedEntities = changes.AddedEntities;
    IReadOnlyCollection<IEntityObject> modifiedEntities = changes.ModifiedEntities;
    if (addedEntities.Any())
    foreach (IEntityObject entity in addedEntities)
    if (AuditProperties(entity))
    InsertAuditFields(entity);
    if (modifiedEntities.Any())
    foreach (IEntityObject entity in modifiedEntities)
    if (AuditProperties(entity))
    UpdateAuditFields(entity);
    private bool AuditProperties(IEntityObject entity)
    bool hasAuditProperties = true;
    bool createdBy = entity.Details.Properties.Contains("CreatedBy");
    bool dateCreated = entity.Details.Properties.Contains("DateCreated");
    bool updatedBy = entity.Details.Properties.Contains("UpdatedBy");
    bool dateUpdated = entity.Details.Properties.Contains("DateUpdated");
    bool[] checkForAuditProperties = new bool[]
    createdBy,
    dateCreated,
    updatedBy,
    dateUpdated
    if (checkForAuditProperties.Any(a => a == false))
    hasAuditProperties = false;
    return hasAuditProperties;
    private void InsertAuditFields(IEntityObject entity)
    string userName = this.Application.User.FullName;
    DateTimeOffset currentDateTime = DateTimeOffset.Now;
    entity.Details.Properties["CreatedBy"].Value = userName;
    entity.Details.Properties["DateCreated"].Value = currentDateTime;
    entity.Details.Properties["UpdatedBy"].Value = userName;
    entity.Details.Properties["DateUpdated"].Value = currentDateTime;
    private void UpdateAuditFields(IEntityObject entity)
    string userName = this.Application.User.FullName;
    DateTimeOffset currentDateTime = DateTimeOffset.Now;
    entity.Details.Properties["UpdatedBy"].Value = userName;
    entity.Details.Properties["DateUpdated"].Value = currentDateTime;

  • Strange behavior with Collections

    Hello!
    I have a - from my point of view - strange behavior with a List (same also applies to Vector, LinkedList, and others):
    List<String> myList = new myList<String>;
    myList.add("One");
    while (true) {
    try {
    System.out.println(myList.size());
    throw new Exception();
    } catch (Exception e) {
    e.printStackTrace();
    }And the result is 1, 2, 2, 2, ...although I added only one element. The two elements in the List point to the same object.
    What could case this issue?
    Regards,

    len00x wrote:
    List<String> myList = new myList<String>;This doesn't even look like it will compile for at least one reason, easily two.

  • Odd Compiler Error in JSPs

    I found a really odd compiler problem today in my JSPs. When I tried to do a rebuild on my JSPs, all of them came up with the exact same error. Basicall it said that I could not have a -- within a comment. This error was reported on three lines and the editor showed three sections as having problems (using a squiggly yellow line). However, none of the pages had anything like what was mentioned on those lines.
    It turned out that the real problem was that the web.xml file had the error. I had put some '--' in a comment section and when the compiler parsed the web.xml file and found the problem, it failed to tag that file as the source but rather ended up showing the JP as being the source.
    Took a bit if time to figure that one out.
    Bill Berks

    You can file a bug at http://bugs.sun.com/services/bugreport/index.jsp

  • "Run Script" (F5) Flacky Behavior with CREATE PROCEDURE and PACKAGE

    When I have the following create statement in a SQL Worksheet and run the script using "Run Script" (F5), I get the "PROCEDURE bogus Compiled." message. Why does it not tell me that there was a compile error? The procedure is marked with a little red "X" in the connections pane.
    CREATE OR REPLACE PROCEDURE bogus IS
    BEGIN
      x := 1;
    END;
    /Also, when I have the following command in a SQL Worksheet and run the script using "Run Script" (F5), I get the "PROCEDURE bogus Compiled." message. The difference is that I removed the slash after the CREATE PROCEDURE command. I can go into that procedure in the database via the Connections pane, click on the compile button, and the procedure compiles with no errors. Why does it not compile in a script when missing the slash?
    CREATE OR REPLACE PROCEDURE bogus IS
    BEGIN
      NULL;
    END;I noticed the same flaky behavior with CREATE PACKAGE BODY as well. This is in version 1.0.0.14.67 on Windows XP. Has this been fixed in the latest version?
    Mike

    I found a number of earlier posts on this (going back to at least v804), but I cannot find a thread with a response from the SQL Developer team - see:
    Package compilation error
    Succesful compilation message and Compiling Invalid Objects
    Creating a stored procedure from a file does not show compilation errors
    Re: Syntax Error Feedback
    I assume that it is just a bug with SQL Developer that it does not check for compilation errors when determining the status message to display (ie "PROCEDURE bogus Compiled"). At least now we get the little red cross on the navigator to tell us it is invalid :)

  • Random freezing and odd keyboard behaviors on 10.5.8

    My random freezing started on 10.5.6. Updated to 10.5.7 and the problem persist. I have decided to upgrade to 10.5.8. Everything seemed fine for a day and a half. Then all of a sudden random freezing when starting, login, wake from sleep, etc.. and now odd keyboard behaviors. function keys randomly work when computer is not frozen.
    I have tried every option listed in the discussions here and elsewhere. Does anyone have the same problems?

    I have tried so far:
    disk permissions repaired from dvd and startup,
    disk first aid,cleaned caches, virus checked, zapped the pram, reset power management, ran apple hardware check, ran disk warrior, trashed network prefs, deleted sleep image, replaced directory with techtool pro, tried new user account, re-updated, removed 3rd party software, and nothing works?????

  • Servlet 3.0 with annotations & tomcat 7

    Hey Folks,
    I am at my wits end here trying to deploy a servlet with annotations.
    I have managed to successfully deploy it without annotations i.e via the web.xml & everything is fine but I get a status 404 when trying to deploy with annotations.
    I am running tomcat :
    Server version: Apache Tomcat/7.0.12
    Server built: Apr 1 2011 06:13:02
    Server number: 7.0.12.0
    OS Name: Linux
    OS Version: 2.6.35-28-generic
    Architecture: i386
    JVM Version: 1.6.0_20-b02
    JVM Vendor: Sun Microsystems Inc.
    I followed the spec so I am sure I am doing everything right from a coding point of view, there is no mention of this servlet what so ever in the apps web.xml
    WebServlet(urlPatterns={"/HelloServlet3"})
    +public class HelloServlet3 extends HttpServlet {+
    +@Override+
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    +...+
    +}+
    The compiled class file (wihin package moreservlets) is located in the following directory
    *~/tomcat/apache-tomcat-7.0.12/webapps/onjava/WEB-INF/classes/moreservlets*
    The application onjava is mapped in the server.xml
    view plaincopy to clipboardprint?
    +<Context path="/onjava" docBase="/home/rob/tomcat/apache-tomcat-7.0.12/webapps/onjava" debug="0" reloadable="true" />+
    This application has both annotated servlets which don't work & regular servlets with web.xml which do work, can I mix both for onjava above?
    Any help greatly appreciated
    Thanks
    Rob

    Apologies for that, but I sent that thread a few days ago on javaranch but got no reply so I thought I would try this site, I intend to post the solution to both forums.
    Yes that was the issue I changed to the 3.0 version as specified below & all worked well
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">
    & it worked, thanks for your help!
    Regards
    /Rob

  • Odd Timer Behavior

    Hi,
    I was working on an AIR application today and noticed some odd behavior with the Timer class.  To isolate the problem, I created a stripped down file that contained only a simple timer and the problem persisted.  In a nutshell a timer calls a function 5x that traces "tick" does the following:  The first 2 times the function is called the trace appears as expected but then a delay ensues, perhaps 8 seconds, and then the last three traces ("ticks") appear together.  If I make it a flash file, it works as expected-- all ticks appear 1 second apart. 
    I was doing some work in JAVA recently on the same system, and wonder if something I did there (e.g. installing the SDK) may be interfering with the AIR Debug Launcher.
    Any ideas will be appreciated.
    Best,
    C.S.

    Hi,
    More testing seems to indicate that the timer is working but that the output (trace) is being delayed.  Has anyone run into problems with the output window not showing traces relative to a Timer?

  • Odd Calendar Behavior

    I found an odd behavior with the Calendar object in 1.5 that I guess wasn't in some previous versions. The following code shows setting the time to AM changing the hour part of the time.
    import java.util.*;
    public class Test{
         public static void main(String[] args){
              Calendar theDate = Calendar.getInstance();          
              theDate.set(Calendar.HOUR_OF_DAY, 0);
              theDate.set(Calendar.MINUTE, 0);
              //theDate.set(Calendar.AM_PM, Calendar.AM);
              theDate.set(Calendar.SECOND, 0);
              theDate.set(Calendar.MILLISECOND, 0);
              System.out.println(theDate.getTime());
              theDate = Calendar.getInstance();          
              theDate.set(Calendar.HOUR_OF_DAY, 0);
              theDate.set(Calendar.MINUTE, 0);
              theDate.set(Calendar.AM_PM, Calendar.AM);
              theDate.set(Calendar.SECOND, 0);
              theDate.set(Calendar.MILLISECOND, 0);
              System.out.println(theDate.getTime());
    }Message was edited by:
    Zephryl

    Read the javadoc:
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html
    Calendar Fields Resolution
    When computing a date and time from the calendar fields, there may be insufficient information for the computation (such as only year and month with no day of month), or there may be inconsistent information (such as Tuesday, July 15, 1996 (Gregorian) -- July 15, 1996 is actually a Monday). Calendar will resolve calendar field values to determine the date and time in the following way.
    If there is any conflict in calendar field values, Calendar gives priorities to calendar fields that have been set more recently. The following are the default combinations of the calendar fields. The most recent combination, as determined by the most recently set single field, will be used.
    For the time of day fields:
    HOUR_OF_DAY
    AM_PM + HOUR
    ====================
    You set AM_PM second, so it is obeying that.

  • Odd usage behavior

    iPhone v101: this odd usage behavior just started half a week ago. This is the second time it happened. During standby, the usage time continues to count forward. I leave my phone on my desk not using it, but the usage still goes up. For example, the usage was 1 hour and 20 minutes when I checked like three hours ago, now it says 4 hours and some minutes. WiFi off, not running any apps, great signal and I cannot find anything running. This behavior also appear to drain the battery a little bit. The phone was not being charged or on plugged in anywhere; just sitting still on my desk. Now, the usage is back to normal and not accumulating time when I am not using it. This is strange. Have anyone else seem this happening? I had the phone for over a month now...

    I didn't notice it causing any battery drain, but it sounds like I am charging it differently than you are. Here's how mine worked:
    I would plug the iPhone into the wall charger at night to charge while I slept. In the morning, it would show a full charge by showing a plug on the small battery icon, but the large green battery would still have a sliver that wasn't green. The usage and standby stats would show something in the 3-4 hour range, presumably the time since it hit full charge.
    I would disconnect the phone, check my email, and then take it to my desktop computer and plug it in to sync and update all my podcasts, etc. I would leave it plugged into my desktop while I showered while I got ready for work. By the time I was ready to leave, it would again show a full charge on the small icon, but now my stats would be reset to 0 and would function normally throughout the day. But nothing I did ever stopped the stats from running up during the night after attaining full charge.
    1.0.1 got rid of the stats problem (they always stay at 0/0 in the morning with a full charge until I unplug the phone) AND the weird behavior of the large green battery indicator went away. Now both indicators show full charge in the morning.

Maybe you are looking for