Access violation Internal string variable

Hello ,
I have a code here that is kind of tricky to me. The code works fine when it it in the
main function of my C program. BUT when I try to run the same code in a custom function that I create, I get the error
Access violation writing location 0xNNNNNNNN  (N being any hex number)
So after reading on or two comments on the internet I understood that the variable in the custom might have been allocated memory in some read only area. BUT I need to use it in my custom function. So could anybody explain me what exactly is happenig and how
to move around it ?
Below is the code
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void test(void);
void main(void)
test();
_getch();
void test(void)
{char const * typeOP;
int repType = 0;
  do
        system("cls");
    printf("Enter a string)\n");
        typeOP = (const char*)malloc(sizeof(const char));
    fflush(stdin);
    if (!scanf_s("%s", typeOP))
            printf("ERROR\n");
            repType = 1;
    } while (repType);
_getch();
Below is the code that works fine
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main(void)
char const * typeOP;
int repType = 0;
do
system("cls");
printf("Enter a string)\n");
typeOP = (const char*)malloc(sizeof(const char));
fflush(stdin);
if (!scanf_s("%s", typeOP))
printf("ERROR\n");
repType = 1;
} while (repType);
_getch();

I see three obvious problems with the code:
The first, you seem to see yourself -- you are modifying a char const * string.  This is bad form.  Having said that, I doubt that it would cause a crash, because the actual address returned by malloc will be to memory that is read/write. 
Just get rid of the const though.  You only use const to announce you do not intend to change the data that typeOP points to.  However you obviously do intend to change the data.
The huge issue is that you are using malloc to allocate enough space to hold exactly one char, but you are trying to store an entire array of them in there.  Normally, if you want to malloc the storage, you would use something like:
typeOP = (const char*)malloc(1000 *sizeof(const char));
(You can replace 1000 with the size of the largest possible string you would expect someone to type -- be sure to include 1 for the null terminator).  This will allocate storage for an entire string.  scanf also has format specifiers to prevent
the user from entering more data than you provided storage.
Finally you leak the memory you allocated.   You need a free call before the end of your loop to release the memory.  Again, failure to release the memory won't cause a crash (unless you eventually leak so much that Windows cannot give you
any more)
Lastly, as a style note:  I would suggest using a fixed size array in this scenario instead of malloc -- then you cannot forget to free the memory. 
Something like:
char typeOP[1000]; // also remove the line with malloc

Similar Messages

  • Accessing String variables from several JAVA classes

    Hi.
    I have several java classes that accesses the same String variables. Instead of putting the String declarations in every java files, how can I put these declarations in a single file source, and get each java class to get the variables data from this file ?
    Please advice.
    Thanks.

    hi, of course you can solve it by the following methods:
    Method 1. define a superclass including the common string variable, and extend other classes from the superclass.
    Method 2. define a class , and define your common string variable as a static variable in it. In your other classes, you can call the string variable.
    Method 3. define it at your each classes.

  • How to find a string inside another String variable

    Hi,
    I need to find whether a string is available in a String of varying length.
    i.e., i want to know string "access" is available in a String variable( may have values like "microsoft access 2000 bla bla bla .." or "bla bla access microsoft").
    so, i dont know the starting point of the word 'access' in the String variable.
    Pls help me in doing this.
    Thanks in advance,
    Rao

    Check the API documentation for this method:
    "int indexOf(String str)
    Returns the index within this string of the first occurrence of the specified substring."

  • How to populate an internal table from a string variable

    Hi Experts,
    My internal table contains a field of length 255 characters.
    I have a string variable. I need to populate the internal table from the string variable.
    How should I code for this.
    Thanks,
    Sangeeta.

    Hi Sangeetha,
    <li>Try this way.
    REPORT ztest_notepad.
    DATA: BEGIN OF it_file OCCURS 0,
           data TYPE c LENGTH 255,
          END OF it_file.
    DATA str     TYPE string.
    DATA g_len   TYPE i.
    DATA g_off   TYPE i.
    DATA g_loops TYPE i.
    CONCATENATE
    '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890x'
    '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890y'
    '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890z'
    '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789m'
    INTO str SEPARATED BY space.
    g_len   = STRLEN( str ).
    g_loops = g_len / 255.
    g_off = 1.
    DO g_loops TIMES.
      IF g_loops NE sy-index.
        IF sy-index EQ 1.
          it_file-data = str+0(255).
        ELSE.
          it_file-data = str+g_off(255).
        ENDIF.
        APPEND it_file.
        CLEAR  it_file.
        g_off = sy-index * 255.
      ELSE.
        g_len = g_len - g_off.
        it_file-data = str+g_off(g_len).
        APPEND it_file.
        CLEAR  it_file.
      ENDIF.
    ENDDO.
    LOOP AT it_file.
      WRITE:/ it_file-data.
    ENDLOOP.
    Thanks
    Venkat.O

  • No mapping at the fault address error while accessing the string variable

    Hi
    we have a application which runs fine on AIX and HP but is throwing error on SOLARIS.
    the application runs well (and use of string variables are also working fine ) till it hits Zone.cpp file
    where the string variable is not getting initialized and throws no mapping at the fault address
    the code snippet is as follows
    #include <string>
    #include <vector>
    const string ZONE_ATTR_TYPE_ZN("ZN");
    const string ZONE_ATTR_TYPE_FC("FC");
    const string ZONE_ATTR_TYPE_ST("ST");
    void Zone::AddAttributeValueAndCountryCode(const string &attributeValue,
                                                      Int attribSeq,
                                                      const string &countryCode,
                                                      ZoneSearchLocMap& zoneSearchLocMap)
         string key = "";
         if ((_attributeType == ZONE_ATTR_TYPE_FC) ||
              (_attributeType == ZONE_ATTR_TYPE_CT))
              key = _attributeType+DELIM+attributeValue;
    we are running it on
    CC: Sun C++ 5.9 SunOS_sparc Patch 124863-04 2008/04/16
    compiled with these option
    -g0 -xspace -KPIC -D_XPG5 -m32 -xarch=sparcvis -mt -DNCURSES -DEXC_HANDLING -DRW_NO_BOOL
    and the created the execuatble with these option
    -i -z rescan -g0 -xspace -mt -D_XPG5 -m32 -xarch=sparcvis -mt -DNCURSES -DEXC_HANDLING -DRW_NO_BOOL -lpthread -lsocket -lnsl -ldl -lposix4 -lCrun -lCstd -lc -lm -lnsl -lsocket
    the dbx output
    t@1 (l@1) program terminated by signal SEGV (no mapping at the fault address)
    where -h
    Current function is Zone::AddAttributeValueAndCountryCode
    56 if ((_attributeType == ZONE_ATTR_TYPE_FC) ||
    (dbx) where -h
    current thread: t@1
    =>[1] Zone::AddAttributeValueAndCountryCode(this = 0x194c088, attributeValue = CLASS, attribSeq = 1, countryCode = CLASS, zoneSearchLocMap = CLASS), line 56 in "Zone.cpp"
    [2] ZoneLoader::Load(trans = CLASS, zoneList = CLASS, prZoneList = CLASS, zoneSearchLocMap = STRUCT, planningCompany = 0x1890f20), line 90 in "ZoneLoader.cpp"
    [3] ZoneManager::ZoneManager(this = 0x1933e28, shipperId = 1000, consDBConnection = CLASS), line 24 in "ZoneManager.cpp"

    I see you are compiling with -KPIC. Is the code going into a shared library?
    Run "ldd" on all the C++ shared libraries you create, and on the main program. You should see a dependency on /usr/lib/libCrun.so.1 and /usr/lib/libCstd.so.1, and no dependency on any other libCrun or libCstd.
    Do you have a particular reason for using -D_XPG5? Changing the Unix version presented by the system headers in /usr/include can sometimes create incompatibilities with the C++ headers and runtime libraries that are intended for the default Unix version.
    Are all of the object files created with the same options, especially the -mt option?
    If none of the above considerations raise any red flags, you might have run into a bug in the compiler or the C++ runtime libraries, or you might have a bug in your code that by accident does not show up in other environments.
    There is no way to evaluate whether you have a compiler or runtime library bug without a test case that demonstrates the problem.
    You might have heap or other data corruption in your program due to invalid pointer use, use of an uninitialized variable, reading or writing outside the bounds of an object, double deletion of an object, use of an object after it has been deleted. You might also have an MT programming error where a critical region is not properly guarded, or where a shared variable is not declared volatile.
    By accident, data can be read or written incorrectly, or a data-race condition can exist, but without causing program failure. A program containing these errors can appear to run successfully on one platform and fail on another, or on the same platform under other conditions.
    Running the program under dbx with Run-Time Checking enabled will show many of these errors.
    The Thread Analyzer can find data race conditions.
    If you think you have found a problem with the compiler or libraries, please file a bug report at
    [http://bugs.sun.com]
    with a test case that can be compiled and run to show the problem.

  • "Syntax error or access violation" on Data Flow Task OLE DB Data Source

    I am implementing expression parameter for a SQL Server connection string (like this: http://danajaatcse.wordpress.com/2010/05/20/using-an-xml-configuration-file-and-expressions-in-an-ssis-package/)  and it works fine except when it reaches data flow
    task - OLE DB Source task. In this task, I execute a stored procedure like this: 
    exec SelectFromTableA ?,?,?
    The error message is this:
    0xC0202009 at Data Flow Task, OLE DB Source [2]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
    An OLE DB record is available.  Source: "Microsoft OLE DB Provider for SQL Server"  Hresult: 0x80004005  Description: "Syntax error or access violation".
    Error: 0xC004706B at Data Flow Task, SSIS.Pipeline: "OLE DB Source" failed validation and returned validation status "VS_ISBROKEN"
    When I change the SQL command above with reading from table directly it works fine. I should also add that before changing connection string of the SQL data source to use expression, the SSIS package was working fine and I know that the connection string
    is fine because other tasks in the package works fine!
    Any idea why?

    Hi AL.M,
    As per my understanding, I think this problem is due to the mismatching between the source and the destination tables. We can reconfigured every of components of the package to check the table schemas and configuration settings, close the BIDS/SSDT and then
    open and try to see if there are errors.
    Besides, to trouble shoot this issue, we can use the variable window to see the variable's value. For more details, please refer to the following blog:
    http://consultingblogs.emc.com/jamiethomson/archive/2005/12/05/2462.aspx
    The following blog about “SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred: Reasons and troubleshooting” is for your reference:
    http://blogs.msdn.com/b/dataaccesstechnologies/archive/2009/11/10/ssis-error-code-dts-e-oledberror-an-ole-db-error-has-occurred-reasons-and-troubleshooting.aspx
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Access Violation calling GetMethodId

    Hi !
    I'm getting an access violation on the jvm.dll when trying to execute a call from the native side. Well, in fact, the exception is raised when a try to get the method reference, by calling GetMethodId ().
    The _javaClass variable is a class attribute and is correctly initialized since I'm being able to execute other calls.
    Can somebody help me, please ?
    This is the code:
    void JavaBridge::pushJava (const char* str)
    // To java push
    // Get some variables
    jmethodID javaMethod;
    jstring javaString;
    // Get the string     
    javaString = _env->NewStringUTF(str);
    if (javaString == 0) {
    JCB_ERROR ("JavaBridge::pushJava: Out of memory...");
    return;
    // Get the process() method
    javaMethod = env->GetMethodID(javaClass, "process", "(Ljava/lang/String;)V");
    if (javaMethod == 0) {
    JCB_ERROR ("Can't find CppBridge's process() method.");
    return;
    // Call it
    env->CallVoidMethod (javaObject, javaMethod, javaString);

    I think your class reference is null.

  • UIManager ClassPath ignored? (access violation)

    Appologies if this is a second post, but I do not believe my previous post worked. I do not see it in the list of topics...
    I've encountered a serious problem: I can not use any 3rd party look and feel
    implementations inside the Java Web Start secure sandbox. More specifically,
    they work unless you use the FileOpenService or FileSaveService, which bring
    up a JChooser with UI components that are in the wrong ClassLoader and cause
    access violation exceptions.
    Some code I have tried to (unsuccessfully) work around this problem:
    // Attempt #1
    ClassLoader jwsClassLoader = this.getClass().getClassLoader();
    UIManager.put("ClassLoader", jwsClassLoader);
    SlafLookAndFeel slaf = new SlafLookAndFeel("com.memoire.slaf.SlafLookAndFeel"); UIManager.setLookAndFeel(slaf);
    This brings up the SLAF look and feel for everything but the FileOpenService.
    Exception pasted below.
    // Attempt #2
    // After executing the above code, I also run this:
    Hashtable tb = UIManager.getDefaults();
    tb.put("ClassLoader", jwsClassLoader);
    Enumeration e = tb.keys();
    while (e.hasMoreElements()) {
    Object obj = e.nextElement();
    if (! (obj instanceof String))
    continue;
    String k = (String)obj;
    if (k.endsWith("UI")) {
    Class uic;
    try {
    uic = jwsClassLoader.loadClass(tb.get(k).toString());
    } catch(Exception ex) {
    // classnotfound...
    continue;
    tb.put(uic.getName(), uic);
    Again, this does not help.
    // Attempt #3
    In Sun bug:4155617 the username 'awiner' posted a message that contained
    some code to register your own ClassInstantiator (implements UIDefaults.LazyValue)
    I would like to try this, but I do not know how to use the code presented.
    I think it needs to be integrated within the Look and Feel code?
    Here's the exception:
    java.security.AccessControlException: access denied (java.io.FilePermission /tmp read)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
    at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
    at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
    at java.io.File.exists(File.java:677)
    at javax.swing.filechooser.FileSystemView.getSystemDisplayName(FileSystemView.java:140)
    at javax.swing.plaf.basic.BasicFileChooserUI$BasicFileView.getName(BasicFileChooserUI.java:1005)
    at javax.swing.JFileChooser.getName(JFileChooser.java:1437)
    at com.memoire.slaf.SlafFileChooserUI$DirectoryComboBoxRenderer.getListCellRendererComponent(SlafFileChooserUI.java:605)
    at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147) at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1097)
    at javax.swing.plaf.basic.BasicListUI$ListSelectionHandler.valueChanged(BasicListUI.java:1465)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:214)
    at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:402)
    at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:411)
    at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:435)
    at javax.swing.JList.setSelectedIndex(JList.java:1730)
    at javax.swing.plaf.basic.BasicComboPopup.setListSelection(BasicComboPopup.java:998)
    at javax.swing.plaf.basic.BasicComboPopup.access$000(BasicComboPopup.java:43)
    at javax.swing.plaf.basic.BasicComboPopup$ItemHandler.itemStateChanged(BasicComboPopup.java:782)
    at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1161)
    at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1218)
    at javax.swing.JComboBox.contentsChanged(JComboBox.java:1265)
    at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
    at com.memoire.slaf.SlafFileChooserUI$DirectoryComboBoxModel.setSelectedItem(SlafFileChooserUI.java:751)
    at com.memoire.slaf.SlafFileChooserUI$DirectoryComboBoxModel.addItem(SlafFileChooserUI.java:746)
    at com.memoire.slaf.SlafFileChooserUI$DirectoryComboBoxModel.access$500(SlafFileChooserUI.java:665)
    at com.memoire.slaf.SlafFileChooserUI$1.propertyChange(SlafFileChooserUI.java:500)
    at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:264)
    at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:232)
    at javax.swing.JComponent.firePropertyChange(JComponent.java:3814)
    at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:541)
    at javax.swing.JFileChooser.<init>(JFileChooser.java:333)
    at com.sun.jnlp.FileOpenServiceImpl$1.run(FileOpenServiceImpl.java:82)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.jnlp.FileOpenServiceImpl.openFileDialog(FileOpenServiceImpl.java:73) at com.wss.calendar.client.swing.InfoHTML.jButtonUpload_actionPerformed(InfoHTML.java:217)
    at com.wss.calendar.client.swing.InfoHTML$3.actionPerformed(InfoHTML.java:146) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5093)
    at java.awt.Component.processEvent(Component.java:4890)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    at java.awt.Container.dispatchEventImpl(Container.java:1609)
    at java.awt.Window.dispatchEventImpl(Window.java:1585)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:140)
    at java.awt.Dialog.show(Dialog.java:538)
    at java.awt.Component.show(Component.java:1134)
    at java.awt.Component.setVisible(Component.java:1089)
    at com.wss.calendar.client.swing.ScheduleWorldFrame.showInfoView(ScheduleWorldFrame.java:2247)
    at com.wss.calendar.client.swing.ScheduleWorldFrame.jMenuItem14_actionPerformed(ScheduleWorldFrame.java:2226)
    at com.wss.calendar.client.swing.ScheduleWorldFrame$44.actionPerformed(ScheduleWorldFrame.java:1127)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1109) at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)
    at java.awt.Component.processMouseEvent(Component.java:5093)
    at java.awt.Component.processEvent(Component.java:4890)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    at java.awt.Container.dispatchEventImpl(Container.java:1609)
    at java.awt.Window.dispatchEventImpl(Window.java:1585)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)

    Hi,
    I am using jdk1.1.6 and personal oracle 8.0.3.0.0.
    I set my classpath to [home]\jdbc\lib\classes111.zip.
    (I am not sure how to try with thin driver to make sure
    everything else is ok).
    I hope you guys got the information to suggest me some solution
    to the problem below. I would greately appeciate if any help to
    solve the problem..
    Thank you,
    Sreenivas.
    Oracle Product Development Team wrote:
    : Need more information :
    : What JDK are you using ?
    : What is the Server version ?
    : Try with THIN to make sure that everything else is okay
    : Sreenivas Kompelli (guest) wrote:
    : : I have Oracle 8i trial version installed on my NT work
    : station.
    : : After configuring the CLASSPATH and PATH, When I try to run a
    : : sample example from files given (I am just trying to connect
    to
    : : the database using JDBC oracle/oci, and display the EMP
    table).
    : : I am getting a Windows internal Error "Exception: Access
    : : Violation (0xc0000005).
    : : I have no clue what to do.. I would greately appeciate if any
    : : help to solve this problem..
    : : Thanks
    : : Sreenivas
    : Oracle Technology Network
    : http://technet.oracle.com
    null

  • Apex listener, POST, internal body-variable

    Hello,
    I am using Apex-Listener 1.1.2.131.15.23 on SUSE Linux 11.3./Oracle XE 10. I created a Resource Template with POST-methode and the following pl/sql-block:
    declare
    l_nuLen1 number;
    l_nuLen2 number;
    begin
    l_nuLen1 := length(:body);
    l_nuLen2 := dbms_lob.getLength(:body);
    :status := triple.coxSmsAt.fSetResponse(:contentType || '(' || to_char(length(:contentType)) || ')',to_char(l_nuLen1) || '/' || to_char(l_nuLen2),:body);
    end;
    In my STF on the database there is no problem to get the value of :contentType. But if I want to access to the :body-variable most of the tries ended in a server-error. With the PL/SQL-block above there is no server-error but the result is l_nuLen1 = 5, l_nuLen2 = 0 and no value apears in the fSetResponse-StoredFunction for :body.
    Can someone help me?
    Thanks
    Martin

    Well the idea behind APEX (Application Express ) is that you can develop mostly declarativly. This is what a RAD tool/framework should do. You seem to think that your requirements somehow force you to send your own constructed code to the listener. Why? Apex in general is very good at hiding this logic from you. Maybe instead of asking a deeply technical question, start by explaining what you want to achieve (business language not technical explaination!). Then lets talk how to use Apex in a normal way to achieve the same result. This might even help you to develop better stuff in faster time.
    Edited by: Sven W. on Sep 10, 2012 4:20 PM - typo corrections
    Your requirement would violate several standard design principles. One should not do so without good reasoning.
    Consider this link: http://effectivesoftwaredesign.com/2012/02/05/separation-of-concerns/
    Edited by: Sven W. on Sep 10, 2012 4:24 PM

  • How to access a JAVA Script variable in JSP Code

    How to access a JAVA Script variable in JSP Code. I have been unable todo this.
    Plz Suggest a way.
    Thanks
    Soumya

    try to do this code
    String s=request.getParameter("javascriptvariablename");

  • Looking for a better way to determine string variable from multiple options

    Hi,
    I trying to figure out a better way to determine a string variable from multiple options.
    Say i have five pictures each with a different filename: img1 - img5...these file names could be named anything really but for this example i will keep them as img1, img2, img3, img4 and img5.
    I want to display a messagebox with the string depending on what a certain variable is.
    So for example, we have the number X, if X = 1 then i want the messagebox to show "img1" as the message
    Essentially the way I have been doing it so far is:
    Private Sub WhichImage()
    Dim ImageName As String = ""
    Dim i as integer
    If i = 0 Then
    ImageName = "img1"
    End If
    If i = 1 Then
    ImageName = "img2"
    End If
    If i = 2 Then
    ImageName = "img3"
    End If
    If i = 3 Then
    ImageName = "img4"
    End If
    If i = 4 Then
    ImageName = "img5"
    End If
    MessageBox.show(imagename, "Name of image", MsgBox.Style.OkOnly, MsgBoxResult.Ok)
    end
    Up until now, this has been fine, but what if I have 50 images, do I have to do this for all 50 images? or is there an easier way like putting the image names into a text file and have it read from the file depending on what the variable i equals? If so,
    how do I go about this? Does each image name go on a separate line? can it just be separated by a comma instead? or is there a better way?
    Please note that i know that i have declared "i" above in my code and not intialised it with anything, in reality "i" comes from somewhere else in the program so please ignore that part, it is not what I am concerned with.
    Thanks
    Mersec

    Does each image name go on a separate line? can it just be separated by a comma instead? or is there a better way?
    Arrays are useful for this.
    Dim imagenames() As String = {"img1", "img2", "img3", "img4", "img5"}
    Dim imagename As String = imagenames(i)
    MessageBox.Show(imagename, "Name of image")
    Any sort of collection will do instead of an array, and may be simpler to manage. There are many other options - the most suitable one probably depends on where the names originally come from.  For instance, if you are getting them from a folder
    using the FileSystem.GetFiles method, then they are already in a collection.
    If the files names never change then you may as well include them in the program code, using something like the code above.  If they can change, then you could use a text file, but that means you need a file update routine.  If that is required
    then the way you store the names will dictate how you access them.

  • Access Violation while initialising WEBUTIL on Ora9iDS

    Hello,
    as part of an urgent evaluation I installed WEBUTIL as described in the documentation, did the additional steps described in the readme and added WEBUTIL as described to an existing form. Now the form raises an access violation error while executing trigger WHEN-CUSTOM-ITEM-EVENT on item WEBUTIL.WEBUTIL_FILETRANSFER_FUNCTIONS exactly when calling procedure WEBUTIL_CORE.CustomEventHandler while registering the beans.
    Did anybody experience the like? Any guess what's going wrong or what could help?
    The crash is documented in the log as follows:
    [09/09/03 08:38:46 Westeuropäische Sommerzeit]::Client Status [ConnId=0, PID=3048]
         >> ERROR: Abnormal termination, Error Code: C0000005 ACCESS_VIOLATION
    ======================= STACK DUMP =======================
    Fault address: 60A98D4D 01:00097D4D
    Module: E:\Programme\OraHome1\bin\orapls9.dll
    System Information:
    Operating System: Windows NT Version 5.0 Build 2195 Service Pack 4
    Command line: ifweb90 server webfile=HTTP-0,0,1,53.147.33.61
    FORM/BLOCK/FIELD: DOKUMENTE:DOKUMENTE.KLARTEXT
    Last Trigger: WHEN-CUSTOM-ITEM-EVENT - (In Progress)
    Msg: <NULL>
    Last Builtin: NAME_IN - (Successfully Completed)
    Registers:
    EAX:00000000
    EBX:0012D9C0
    ECX:00000000
    EDX:0012D9C0
    ESI:0777C6E4
    EDI:02A26C78
    CS:EIP:001B:60A98D4D
    SS:ESP:0023:0012D978 EBP:0012D998
    DS:0023 ES:0023 FS:003B GS:0000
    Flags:00010246
    ------------------- Call Stack Trace ---------------------
    Frameptr RetAddr Param#1 Param#2 Param#3 Param#4 Function Name
    0x0012d998 60a3d308 0777c6e4 00000001 0012d9c0 070468a8 pfrb1assign_aad2va
    0x0012d9ec 60a92b11 0777c6e4 00000001 66020030 070468a8 pevmGBVAR+d8
    0x0012e0f0 60a1ce7d 0777c6e4 02a26c78 0776dd6c 00000002 _pfrrun+6841       
    0x0012e158 6601ea45 02a26c78 0777c6e4 02a46f00 029de3b4 _peicnt+ed         
    0x02a26874 029de3b4 65fdb2a0 65fdb2e0 65da1f30 00000000 0x6601ea45
    0x02a46f00 00000001 0000000a 02a46fd8 0026181f 65d51752 0x029de3b4
    ------------------- End of Stack Trace -------------------
    WebUtil-Logfile is not very verbose (despite detailed logging enabled):
    53.147.33.61:ZSCHAU: Connection from Form=E:\ISAP_ASP4\isap\websourcen\Doktestweb.fmx Client O/S=Windows 2000 locale=de
    53.147.33.61:ZSCHAU: 2003-Sep-09 08:38:00.889 WUF[VBeanCommon.getIPAddress()] 53.147.33.61
    53.147.33.61:ZSCHAU: 2003-Sep-09 08:38:00.929 WUH[VBeanCommon.getIPAddress()] 53.147.33.61
    53.147.33.61:ZSCHAU: 2003-Sep-09 08:38:00.949 WUS[VBeanCommon.getIPAddress()] 53.147.33.61
    Java Console prints:
    JInitiator: Version 1.3.1.9
    Verwendung der JRE-Version 1.3.1.9 Java HotSpot(TM) Client VM
    Home-Verzeichnis des Benutzers = C:\Dokumente und Einstellungen\zschau
    Proxy-Konfiguration:Automatische Proxy-Konfiguration
    JAR cache enabled
    Location: C:\Dokumente und Einstellungen\zschau\Oracle Jar Cache
    Maximum size: 50 MB
    Compression level: 0
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    q: hide console
    s: dump system properties
    t: dump thread list
    x: clear classloader cache
    0-5: set trace level to <n>
    Loading http://localhost:8888/forms90/webutil/webutil.jar from JAR cache
    Loading http://localhost:8888/forms90/webutil/jacob.jar from JAR cache
    Loading http://localhost:8888/forms90/java/f90all_jinit.jar from JAR cache
    RegisterWebUtil - Loading Webutil Version 1.0.2 Beta
    connectMode=HTTP, native.
    Forms Applet-Version : 90290
    2003-Sep-09 08:38:00.819 WUI[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2003-Sep-09 08:38:00.839 WUI[VBeanCommon.getIPAddress()] 53.147.33.61
    2003-Sep-09 08:38:00.879 WUF[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2003-Sep-09 08:38:00.889 WUF[VBeanCommon.getIPAddress()] 53.147.33.61
    2003-Sep-09 08:38:00.909 WUH[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2003-Sep-09 08:38:00.929 WUH[VBeanCommon.getIPAddress()] 53.147.33.61
    2003-Sep-09 08:38:00.939 WUS[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2003-Sep-09 08:38:00.949 WUS[VBeanCommon.getIPAddress()] 53.147.33.61
    2003-Sep-09 08:38:00.969 WUT[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2003-Sep-09 08:38:00.969 WUT[VBeanCommon.getIPAddress()] 53.147.33.61
    2003-Sep-09 08:38:01.460 WUO[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2003-Sep-09 08:38:01.470 WUO[VBeanCommon.getIPAddress()] 53.147.33.61
    2003-Sep-09 08:38:01.500 WUL[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2003-Sep-09 08:38:01.510 WUL[VBeanCommon.getIPAddress()] 53.147.33.61
    2003-Sep-09 08:38:01.550 WUB[VBeanCommon.findLocalHost()] obtaining LocalHost info from InetAddress
    2003-Sep-09 08:38:01.560 WUB[VBeanCommon.getIPAddress()] 53.147.33.61
    2003-Sep-09 08:38:48.268 WUB[VBeanCommon.destroy()] WebUtil Browser Functions being removed..
    2003-Sep-09 08:38:48.298 WUL[VBeanCommon.destroy()] WebUtil C API Functions being removed..
    2003-Sep-09 08:38:49.59 WUO[VBeanCommon.destroy()] WebUtil Client Side Ole Functions being removed..
    2003-Sep-09 08:38:49.89 WUT[VBeanCommon.destroy()] WebUtil File Transfer Bean being removed..
    2003-Sep-09 08:38:49.89 WUS[VBeanCommon.destroy()] WebUtil Session Monitoring Facilities being removed..
    2003-Sep-09 08:38:49.89 WUH[VBeanCommon.destroy()] WebUtil Client Side Host Commands being removed..
    2003-Sep-09 08:38:49.99 WUF[VBeanCommon.destroy()] WebUtil Client Side File Functions being removed..
    2003-Sep-09 08:38:49.99 WUI[VBeanCommon.destroy()] WebUtil GetClientInfo Utility being removed..
    I run Ora9iDS on a Windows2000 system.
    Thanks to anybody who tries to help.

    Hello, Grant,
    the crash occurs before I try to do anything vital. There is some init stuff in the form (initialising items, global variables etc.), query execution for initial displaying of database entries and a sychronize statement. After that the triggers in the WEBUTIL section fire, as I understand to initialise the beans (registering). As part of this registering the crash occurs - before I call any of the WEBUTIL functionality from my own code.

  • Urgent problem: JRE Crashes with Access violation (c0000005)

    I have a problem where the JRE crashes with an Access violation (c0000005) at address (6d4218ce).
    The JVM is:
    java version "1.3.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
    Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)The application is swing based, and I have my suspicions that the problem occurs when exec'ing (Runtime.exec()) a script file (deletes data files and FTP's data files around an internal network), but I cannot categorically prove it as yet.
    The lack of a .map file does not help in analysing the Dr Watson log file. Does anyone know if a map file is available for 1.3.1?
    I have tried to raise this as a bug but as we cannot reproduce it on demand, I cannot get Sun to look into it.
    The Dr Watson log file shows:
    State Dump for Thread Id 0x13e
    eax=bf800000 ebx=0336b770 ecx=02b72168 edx=bf800008 esi=02b72168 edi=06ffd12c
    eip=6d4218ce esp=08d0fdbc ebp=08d0fddc iopl=0         nv up ei ng nz na pe nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00000282
    function: <nosymbols>
            6d4218b9 8d4df0           lea     ecx,[ebp-0x10]         ss:09c0e7e2=00000000
            6d4218bc e875000000       call    6d421936
            6d4218c1 5f               pop     edi
            6d4218c2 5e               pop     esi
            6d4218c3 c9               leave
            6d4218c4 c3               ret
            6d4218c5 56               push    esi
            6d4218c6 8bf1             mov     esi,ecx
            6d4218c8 8b5604           mov     edx,[esi+0x4]          ds:03a70b6e=????????
            6d4218cb 83c208           add     edx,0x8
    FAULT ->6d4218ce 8b4210           mov     eax,[edx+0x10]         ds:c06fea0e=????????
            6d4218d1 85c0             test    eax,eax
            6d4218d3 7f25             jg      6d4218fa
            6d4218d5 7d1b             jge     6d4218f2
            6d4218d7 83c9ff           or      ecx,0xff
            6d4218da 6a04             push    0x4
            6d4218dc 2bc8             sub     ecx,eax
            6d4218de 8b4608           mov     eax,[esi+0x8]          ds:03a70b6e=????????
            6d4218e1 d3e0             shl     eax,cl
            6d4218e3 8b4a44           mov     ecx,[edx+0x44]         ds:c06fea0e=????????
            6d4218e6 8d440807         lea     eax,[eax+ecx+0x7]      ds:03a70b6f=????????
            6d4218ea 59               pop     ecx
    *----> Stack Back Trace <----*
    FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
    08d0fddc 6d4710ee 0336b734 0336b734 6d4381b7 0336b734 <nosymbols>
    State Dump for Thread Id 0x140
    eax=06a82398 ebx=00000000 ecx=06ab34f0 edx=00000000 esi=0000017c edi=00000000
    eip=77f682db esp=08d4fc24 ebp=08d4fc48 iopl=0         nv up ei pl zr na po nc
    cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00000246
    function: NtWaitForSingleObject
            77f682d0 b8c5000000       mov     eax,0xc5
            77f682d5 8d542404         lea     edx,[esp+0x4]          ss:09c4e62b=00000000
            77f682d9 cd2e             int     2e
            77f682db c20c00           ret     0xc
            77f682de 8bc0             mov     eax,eax
    *----> Stack Back Trace <----*
    FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
    08d4fc48 77f04f37 0000017c ffffffff 00000000 6d466097 ntdll!NtWaitForSingleObject
    08d4fc90 6d476550 00000000 00000000 00000001 00765d80 kernel32!WaitForSingleObject Any help would be much appreciated.
    Regards,
    Dave Jackson

    Probably nothing to do with it but I had some dodgy memory, and windows would complain that there was an error to do with that exact memory location: c0000005

  • Re: (forte-users) access violation caught in debugmode

    Eric,
    There has been a problem with Forte debug mode for sometime now when the app
    is silent. If you attempt to inspect the variables when the app is in the
    'silent' mode, i.e., waiting on an event loop for a user input or a system
    event, then you get the "Access violation caught ..." exception message and
    the workspace including the launch server crashes.
    If you are getting this problem in the 'step-through' mode, you should look
    at the lauch server immediately after you get the exception before
    everything disappears. There could be a stack backtrace due to some illegal
    reference. We have faced a similar situation before but the error appeared
    both in the 'debug' and 'run' modes.
    Hope this helps.
    Braja K Chattaraj.
    From: Eric Decossaux <[email protected]>
    To: forte mailing <[email protected]>
    Subject: (forte-users) access violation caught in debug mode
    Date: Thu, 23 Sep 1999 17:31:39 +0200
    Hello,
    I have a problem using Forte in debug mode. If I run my program on my NT
    machine from the partition workshop (distributed run), the program works
    fine except that some object does not display what I'm expecting. So I
    want to use the debug mode to inspect the objets of this window. When I
    choose the "local variables" option to see the content of my window, I
    have a "access violation caught" and forte disappears. If I just let my
    program run without choosing this option, everything is the same than
    with the distributed run.
    Does somebody have an idea what to look for ? I really want to look the
    inside the attributes of this window.
    We recently upgraded from release 30G2 to release 30L2. Could it be the
    problem ?
    Eric Decossaux
    Cliniques Universitaires St Luc
    Informatique des Laboratoires
    av Hippocrate 10 / 1730
    1200 Bruxelles
    +32+2+764 17 53
    For the archives, go to: http://lists.sageit.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: [email protected]

    Eric,
    Another possibility has to do with the repository. You said you recently
    migrated 30G2 to release 30L2.
    Many strange problems have been traced to release migrations with old
    repositories. If the repository was properly migrated another thing you can try
    is to export the project(s) to PEX files, delete them from the repository, and
    then re-import. I know this can be time consuming but I have solved more than
    one unexplained problem in the IDE by doing it.
    ---------------------- Forwarded by Charlie Shell/Bsg/MetLife/US on 09/23/99
    01:19 PM ---------------------------
    "Ajith Kallambella" <[email protected]> on 09/23/99 12:08:54 PM
    To: [email protected], [email protected]
    cc: (bcc: Charlie Shell/Bsg/MetLife/US)
    Subject: Re: (forte-users) access violation caught in debug mode
    Eric,
    Sometimes( 90% ) you can solve this problem by
    checking out the class that is causing the crash
    and force-compiling it.
    If it doesn't help, run through this checklist.
    1. Do you have enough memory resources.?
    2. Is the object you are inspecting held in a lock ?
    ( mutex, transaction lock etc )
    3. Does it work when you wait for sometime at the
    breakpoint before inspecting the values? I mean
    are you interrupting some process thread?
    4. Does it work if you log the attributes using logmgr?
    5. Are you using any call-outs/call-ins? Any external
    systems integration? Sometimes( for reasons beyond
    my comprehension ) the objects allocated outside
    Forte gets corrupted when its passed back and forth.
    6. ...finally...Santa Clause, help me!
    Ajith Kallambella M.
    Forte Systems Consultant.
    From: Eric Decossaux <[email protected]>
    To: forte mailing <[email protected]>
    Subject: (forte-users) access violation caught in debug mode
    Date: Thu, 23 Sep 1999 17:31:39 +0200
    Hello,
    I have a problem using Forte in debug mode. If I run my program on my NT
    machine from the partition workshop (distributed run), the program works
    fine except that some object does not display what I'm expecting. So I
    want to use the debug mode to inspect the objets of this window. When I
    choose the "local variables" option to see the content of my window, I
    have a "access violation caught" and forte disappears. If I just let my
    program run without choosing this option, everything is the same than
    with the distributed run.
    Does somebody have an idea what to look for ? I really want to look the
    inside the attributes of this window.
    We recently upgraded from release 30G2 to release 30L2. Could it be the
    problem ?
    Eric Decossaux
    Cliniques Universitaires St Luc
    Informatique des Laboratoires
    av Hippocrate 10 / 1730
    1200 Bruxelles
    +32+2+764 17 53
    For the archives, go to: http://lists.sageit.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: [email protected]
    For the archives, go to: http://lists.sageit.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: [email protected]

  • Accessing a BPM Container Variable Inside A Mapping

    Hi
    Is It possible to access a BPM container variable (Simple type say a String )in a Mapping (message mapping). This mapping  is present in the same BPM itself. Is it possible to access the variable in the mapping.
    My basic objective is i need to read and update values between My message mapping and Bpm container simple type variable. I read a value  from BPM variable and then update this variable and again write it back to the BPM container variable and then again read it in a loop . Is it possible to do this exchange.

    Hi,
    The only way is to do with mapping. Totally you need to add your conatiner values into message and then thru mapping you can access.
    Using Container Operation-Append
    http://help.sap.com/saphelp_nw04/helpdata/en/59/e1283f2bbad036e10000000a114084/content.htm
    Regards,
    Moorthy

Maybe you are looking for

  • How do i use my copy of fireworks? I have expired trial on my computer

    Hi have a copy of cs4 web premium and it's registered to one of my emails. I recently had cs4 fireworks installed on my new computer on a trial basis and the trial is over. Now i want to use my copy of fireworks but am unable to install it since i do

  • Adobe Acrobat 9 Pro - Form Toolbar

    There has been a big change from Acrobat 8 Pro to 9 Pro regarding how the forms toolbar is displayed.  While the changes are a great improvement to make it easier to create forms...I am having trouble adjusting to editing forms.  Is there any way to

  • Appleworks 6.2.9 spreadsheet - limit columns

    I'm starting to save DB files as ASCII files and reopening as SS. Now I know in the past I have been able to limit the columns of the SS to 5 or 10 or whatever but can't seem to find how to do that any more, or is that one of those things that no lon

  • Removeing internal RAID to external housing?

    Hello! So, I have a couple drives formatted as a striped RAID and want to move them out (to make room for new drives) - can I put them in some external housing as is and expect the housing to understand that they are formatted as a Striped RAID? I am

  • Query error using User Defined Files and Parameters

    I am trying to select a date range with this query.  When it is run without the WHERE clause, it works fine.  When I add the WHERE clause, I get the error 'Received Alerts' (OAIB).  Here is the code: SELECT T0.DocNum, T0.DocDate, T0.CardName,  T0.U_R