How to Aoid \ charcters in the stored properties file

I m using the code to store into .properties files but it adds \ before : How can i avoid this
Properties prop = new Properties();
prop.setProperty("URL", "jdbc:oracle:thin:@:host:port:schema");
properties.store(new FileOutputStream(db.properties), null);But my db.properties files is below
jdbc\:oracle\:thin\:@\:host\:port\:schemaI want to avoid '\' while storing.

http://www.docjar.com/html/api/java/util/Properties.java.htmlThat would be the code for java.util.Properties Class.
If you can notice through code there is a method called
private void formatForOutput(String str, StringBuffer buffer, boolean key)and inside the method there is a switch case
case '\\':
case '!':
case '#':
case '=':
case ':':
      buffer.append('\\').append(c);
       break;you might think of removing it as per your stated requirement and use the final implementation class accordingly.
Hope that might help :)
REGARDS,
RaHuL

Similar Messages

  • Commas in the weblogic.properties file

    I hate to ask this question because I'm sure the answer is a)obvious, and
    b)well-known, but I'm playing in the slow group today.
    How does one include a comma in a property value in the weblogic.properties
    file. Specfically, I'm trying to set weblogic.system.startupArgs as follows
    weblogic.system.startupArgs.xxxx=sql=select sysdate from dual where
    mod(to_number(to_char(sysdate, 'MI')), 2) = 0
    The value assigned to the "sql" arg is truncated at the first comma and a
    second argument "'MI'))" is created. Very irritating. Any ideas on how to
    prevent this from happening?
    Ignore the details of the sql statement, its just for testing.
    Brian Murray
    Management Information Systems
    Vanderbilt University

    Thanks for the reply, but that didn't seem to work. Escaping the commas
    with back-slash delivered the same result.
    It seems that since the value for the weblogic.system.startupArgs.xxxx
    property can itself be a set of multiple properties, the normal parsing
    rules don't apply when the "inner" set of properties is parsed. For
    example, if weblogic.properties has
    weblogic.system.startupArgs.xxxx=aaaa=X\,Y
    then it appears that "startupArgs.xxx" is being assgined "aaaa=X,Y".
    However, when the startup class gets the arguments, whatever routine is
    parsing the value of "startupArgs.xxx" is seeing the comma and deciding that
    there are two properties, not one. So the startup method of my startup
    class gets 2 arguments: "aaaa=X" and "Y=".
    I tried all the old Korn shell tricks I could remember like aaaa=X\\\,Y.
    But all I got was "aaaa=X\" and "Y=".
    Any other thoughts or am I trying something I wasn't supposed to do?
    ----- Original Message -----
    From: "Dimitri Rakitine" <[email protected]>
    escape commas with \'s
    Brian Murray <[email protected]> wrote:
    How does one include a comma in a property value in the
    weblogic.properties
    file. Specfically, I'm trying to set weblogic.system.startupArgs asfollows
    >
    weblogic.system.startupArgs.xxxx=sql=select sysdate from dual where
    mod(to_number(to_char(sysdate, 'MI')), 2) = 0

  • SAP-XI, permission of the instance.properties file changes unexpectedly

    Hi forum,
    I have XI installed in HP-UX,
    the permission of the instance.properties file (/usr/sap/<SID>/<instance name>/j2ee/cluster/instance.properties) in my XI system (installed in HP-UX), changes automatically, and hence the server starts giving problem like, JCO error while message-mapping, etc,
    can u tell me how the permission changes on the fly,
    I mean to say, in proper condition we keep it as rw_rw_rw, but it changes to rw_ ___ ___,
    pls help,

    Hi Sudeep
    I just checked on two systems. It looks like the permissions should be:
    sidadm > ll j2ee/cluster/instance.properties
    -rw-r--r--   1 sidadm     sapsys        3669 Nov 25 12:41 j2ee/cluster/instance.properties
    Can you please check if <b>sidadm> umask</b> returns 022?
    Regards Michael

  • Where can I find the wrapper.properties file?

    Does anyone know where I can find the wrapper.properties file?

    Yes I am talking about tomcat, except it is not in this directory. I even did a search my entire hard drive and could not find it. Why is this? and how do I change the class path for the server? I thought you do so in this file?

  • HT5177 How can two people edit the same FCPX file? One company, so both people/computers share the same license. Example: I work on revision A and my boss takes it and makes revision B and gives it back to me using two separate computers.

    How can two people edit the same FCPX file? One company, so both people/computers share the same license. Example: I work on revision A and my boss takes it and makes revision B and gives it back to me using two separate computers.

    Have the project, events and media on one drive which is common to both macs.
    You can download FCP X to both macs using the same Apple ID that it was purchased with.
    Andy

  • In a new Application, the ApplicationResources_en.properties file is not having the constraint messages created

    Hi Everyone:
              We are using JDev 11.1.2 and JHeadstart 11.1.2.  We have been having a multitude of problems when running applications through the migrator (and we have now been told by an Oracle consultant that the migrator is problematic), so we are trying to re-write things from scratch to bring them over from 11.1.1.4 to 11.1.2.
              I have been working on a simple application from scratch and discovered that the messages for constraints on the entities that I am using are not showing up in the ApplicationResources_en.properties.file.  We noticed a similar thing with converting an application using the migrator and that post is found here - java.lang.NullPointerException ADF_FACES-60097 message ***WITH SOLUTION*** -. 
              However, I didn't get a single reply to that thread. 
              I initially thought it was a migration issue, but this application is from scratch.  Whenever I tried to input an invalid value into a page column, the following exception would be received.
    "java.lang.NullPointerException  ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #"
               This Null Pointer turned out to be the missing message from the ApplicationResources_en.properties file.  In the new application I just wrote, I had to manually edit to add the following lines to the ApplicationResources_en.properties file and the application no longer gives me the error if I input an invalid value.
    VALIDATE_FEE_CATEGORY_3=Feecategory with this FeeCategory does not exist
    VALIDATE_ACADEMIC_TERM36=Academicterm with this EffectiveTermStart does not exist
    VALIDATE_ACADEMIC_TERM36_CASDEL=Cannot delete Academicterm while dependent Specialexchange exists
    VALIDATE_ACADEMIC_TERM37=Academicterm with this EffectiveTermEnd does not exist
    VALIDATE_ACADEMIC_TERM37_CASDEL=Cannot delete Academicterm while dependent Specialexchange exists
    VALIDATE_CURRENCY23=Currency with this Currency does not exist
    VALIDATE_CURRENCY23_CASDEL=Cannot delete Currency while dependent Specialexchange exists
    VALIDATE_FEE_CATEGORY_3=Feecategory with this FeeCategory does not exist
    VALIDATE_FEE_CATEGORY_3_CASDEL=Cannot delete Feecategory while dependent Specialexchange exists
    These constraints are found in the Entities .xml files  as shown below.  We are using a re-usable business components .jar file to import them in.
      <Key
        Name="UniqueFeeCategory"
        PrimaryKey="true">
        <DesignTime>
          <Attr Name="_DBObjectName" Value="UNIQUE_FEE_CATEGORY"/>
        </DesignTime>
        <AttrArray Name="Attributes">
          <Item
            Value="its.sis.uwbm.AREdit.entityobjects.Specialexchange.FeeCategory"/>
          <Item Value="its.sis.uwbm.AREdit.entityobjects.Specialexchange.Currency"/>
          <Item
            Value="its.sis.uwbm.AREdit.entityobjects.Specialexchange.EffectiveTermEnd"/>
        </AttrArray>
      </Key>
      <Key
        Name="ValidateAcademicTerm36">
        <DesignTime>
          <Attr Name="_referencedKey" Value="UNIQUE_ACADTERM_CODE"/>
          <Attr Name="_isForeign" Value="true"/>
          <Attr Name="_DBObjectName" Value="VALIDATE_ACADEMIC_TERM36"/>
        </DesignTime>
        <AttrArray Name="Attributes">
          <Item
            Value="its.sis.uwbm.AREdit.entityobjects.Specialexchange.EffectiveTermStart"/>
        </AttrArray>
      </Key>
      <Key
        Name="ValidateAcademicTerm37">
        <DesignTime>
          <Attr Name="_referencedKey" Value="UNIQUE_ACADTERM_CODE"/>
          <Attr Name="_isForeign" Value="true"/>
          <Attr Name="_DBObjectName" Value="VALIDATE_ACADEMIC_TERM37"/>
        </DesignTime>
        <AttrArray Name="Attributes">
          <Item
            Value="its.sis.uwbm.AREdit.entityobjects.Specialexchange.EffectiveTermEnd"/>
        </AttrArray>
      </Key>
      <Key
        Name="ValidateCurrency23">
        <DesignTime>
          <Attr Name="_referencedKey" Value="UNIQUE_CURRENCY_CODE"/>
          <Attr Name="_isForeign" Value="true"/>
          <Attr Name="_DBObjectName" Value="VALIDATE_CURRENCY23"/>
        </DesignTime>
        <AttrArray Name="Attributes">
          <Item Value="its.sis.uwbm.AREdit.entityobjects.Specialexchange.Currency"/>
        </AttrArray>
      </Key>
      <Key
        Name="ValidateFeeCategory3">
        <DesignTime>
          <Attr Name="_referencedKey" Value="UNIQUE_FEECAT_CODE"/>
          <Attr Name="_isForeign" Value="true"/>
          <Attr Name="_DBObjectName" Value="VALIDATE_FEE_CATEGORY_3"/>
        </DesignTime>
        <AttrArray Name="Attributes">
          <Item
            Value="its.sis.uwbm.AREdit.entityobjects.Specialexchange.FeeCategory"/>
        </AttrArray>
        Is this a known bug (I have searched and havent found it) and is there anything that I can do about it without having to manually add the messages?
    Mary
    UofW

    Hi Everyone:
               I have done some further testing.  We are using a re-usable Business Components .jar file to access our entities.  We import the .jar file into the project and create the ViewObjects and ViewLinks from that .jar file.
                It APPEARS that a test case using the HRSchema and using the Entities & Associates generates the constraint error messages, but when I use the .jar file of re-usable business components imported into the project, those constraint error messages are not created in the ApplicationResources_en.properties file.  I have created two testcases as well as the re-usable .jar file that I can send to you to show what I mean. 
                This behaviour seems to have shown up in 11.1.2 as there was no problem before this.
                 Please let me know where you'd like me to upload the testcases.
                 Thank you.
    Mary
    UofW

  • The charsetalias.properties file is gone in Firefox 4? Most web sites in Hong Kong use the Big5-HKSCS charset but declare the charset as Big5. Without charsetalias.properties, the encoding needs to be manually changed very often when viewing them.

    I have been defining Big5 as an alias of Big5-HKSCS in charsetalias.properties. This makes Firefox renders pages declared as "Big5" to be rendered in Big5-HKSCS instead. Big5-HKSCS is a standard published by the Hong Kong government because the Big5 charset does not contain many common Chinese characters used in Hong Kong. However, Big5-HKSCS is just an extension of Big5, so most (if not all) Chinese web sites in Hong Kong using Big5-HKSCS declare their pages to be in Big5 in the <meta> tag.
    I am now trying out Firefox 4 RC and found that the charsetalias.properties file is no longer there. So in order to read pages containing characters that are in Big5-HKSCS but not in Big5, I need to switch the encoding manually. This is extremely inconvenient. Can you consider bringing charsetalias.properties back?
    [http://groups.google.com/group/mozilla.dev.i18n/browse_thread/thread/415caa98a6246a00 Someone noticed this issue as well.]

    Here's the script I was working on.
    It determines the encoding of the site by checking a couple of different ways the meta tag can supply encodings. One way is to have a charset attribute on a meta tag, and the other way is to have a meta tag with http-equiv="content-type" and have charset= be part of the content attribute.
    (note: I think [https://developer.mozilla.org/en/DOM/document.characterSet document.characterSet()] might be a far more reliable way to detect encoding since it doesn't depend on the specific way the meta tag was written. But I haven't tested it.)
    Debugging messages showed that it could detect the specified encodings fine on the few test pages I was trying it on. The problem is in the way I change the encoding.
    It currently uses .setAttribute to attempt to modify the meta tags once it finds the encodings. Unfortunately, this doesn't change the selected encoding in Firefox. It doesn't affect the page source, either.
    I have to replace those setAttribute calls with something that will actually affect the selected encoding in Firefox.... but I'm not sure what would accomplish that.
    http://pastebin.com/Yt7fygXe
    Just a little warning, it's case- and whitespace-sensitive because I didn't get around to using regular expressions yet. So if a page says charset="BIG5", you'll probably need to make it uppercase in the script as well. Sorry, I'm lazy!
    Nonetheless, I ''hope'' this is a start...

  • Where is the swing.properties file?

    In J2SDK 1.5 beta, where is the swing.properties file.
    The file is supposed to be located in <Java Home>/lib/ but it is not there.
    Thanks,

    I'm not sure about 1.5, but normally there isn't one. The defaults are just used unless there is one.
    Look here
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/UIManager.html

  • By mistake i deleted the Propertysheet.properties file in VC admin

    Hi All,
    I have an issue in visual composer, I did the following.. then i got the error when I logged into VC that "Proxy error : Server error : Failed to read models list"
    1.  Log on to Visual Administrator. 
    2.  In the left panel, make sure the Global Configuration tab is chosen.
    3.  In the tree, expand the Services node and choose the Configuration Adapter service. In
    the main pane, in the Display configuration tab, the Configurations tree is displayed.
    4. Expand the development server node to display the client workspaces.
    Under client workspaces i have gone to my login name under that by mistake i deleted the Propertysheet.properties file.
    Then i refreshed the my model name, then  the Propertysheet.properties file came.
    Still I am getting the error. Can you help me out... Its very urgent to resolve this.. I will give points for good answers.
    Thanks
    Suresh.

    Hi,
    does this only happen for your user or for all?
    Anja

  • [svn:fx-trunk] 8057: Some errant renames in the project properties files.

    Revision: 8057
    Author:   [email protected]
    Date:     2009-06-22 12:27:26 -0700 (Mon, 22 Jun 2009)
    Log Message:
    Some errant renames in the project properties files.
    Modified Paths:
        flex/sdk/trunk/development/eclipse/flex/airframework/.actionScriptProperties
        flex/sdk/trunk/development/eclipse/flex/flash-integration/.project
        flex/sdk/trunk/development/eclipse/flex/sparkTest/.actionScriptProperties

    Thats good news.

  • In  elements 11 how do i bring back the 'show open files ' panel at the bottom  of the editor

    In elements 11 how do I bring back the show open files panel at the bottom of the editor expert workspace please

    Click the button in the bottom left that says Photo Bin. In the Photo Bin, make sure the drop-down menu is listed as "Show Open Files"

  • [svn:fx-trunk] 11314: add the empty properties file to svn to fix the build .properties

    Revision: 11314
    Author:   [email protected]
    Date:     2009-10-30 10:38:34 -0700 (Fri, 30 Oct 2009)
    Log Message:
    add the empty properties file to svn to fix the build.properties
    QE notes: 
    Doc notes:
    Bugs: fix the build
    Reviewer: Pete
    Tests run: checkintests
    Is noteworthy for integration: no
    Added Paths:
        flex/sdk/trunk/frameworks/projects/playerglobal/bundles/de_DE/empty.properties
        flex/sdk/trunk/frameworks/projects/playerglobal/bundles/fr_FR/empty.properties
        flex/sdk/trunk/frameworks/projects/playerglobal/bundles/ja_JP/empty.properties
        flex/sdk/trunk/frameworks/projects/playerglobal/bundles/ru_RU/empty.properties
        flex/sdk/trunk/frameworks/projects/playerglobal/bundles/zh_CN/empty.properties

    Thats good news.

  • Can I programatically read the wls properties file

    I'd like to set my own application specific properties in the properties
              file and then read them programmatically. Can I do this?
              thanks for any help,
              Edwin Marcial
              

    http://homepage.beasys.com/denali/classdocs/javadocs/weblogic/common/ConfigServicesDef.html#getProperty(java.lang.String)
              Yes, you can programmatically get this information with the help of a t3
              client. I am sure there is documentation on the web on how to do this.
              -- Prasad
              Edwin Marcial wrote:
              > I'd like to set my own application specific properties in the properties
              > file and then read them programmatically. Can I do this?
              >
              > thanks for any help,
              >
              > Edwin Marcial
              

  • Escape "\" by "\\ and "/" by "// before storing properties file

    Hi:
    I am manipulating an existing properties file by replacing a value of property in it.
    This file contains several directory separatorr "/" for Unix and "\" for Windows in it.
    After I load the file, set the property value and before I store the file, I want to replace all occurences of "\" by "\\ and "/" by "//" in th file and thereafter store it. If I do not do this, then I see java.lang.illegalArgumentException: Malformed \uxxxx enconding.
    How can I do this?
    Properties props = new Properties();
    try
    props.load(new FileInputStream(file));
    catch(IOException ioe)
    props.setProperty("key","val");
    //add code to replace "/" by "//" and "\" by "\\"
    try
    props.store(new FileOutputStream(file));
    catch()
    }

    No...
    What you see is probably not the right character, but something that Notepad displays. See, I think Notepad is probably only interpreting the file as ASCII. If it's a Chinese character, it's going to be 2 bytes (usually, or 3, depending on the encoding). So it's going to show as 2 chars. They may not be visible, it really depends on what the bytes are.
    Anyway, it doesn't matter what it is... The file MUST be in ISO 8859-1 encoding, which means Chinese and other multibyte chars are not allowed. The Properties API docs are clear about this:
    "When saving properties to a stream or loading them from a stream, the ISO 8859-1 character encoding is used. For characters that cannot be directly represented in this encoding, Unicode escapes are used; however, only a single 'u' character is allowed in an escape sequence. The native2ascii tool can be used to convert property files to and from other character encodings."
    If you have the strings properly defined in Java code, then using the store() method will encode them properly into the file it saves. Then when you view that in Notepad, then you should see \uXXXX where there are non-ISO8895-1 chars.
    Otherwise you have to generate your file, save it in the proper encoding for the langauge you are using and then use native2ascii to convert it before it can be used with Properties.load()

  • Need help for how to putting arabic content in java properties file

    Hi all,
    we have to support arabic in Java application.
    For that we are using java propeties file where key and value pair is used.
    In the Microsoft excel sheet arabic content is coming properly from right to left direction.
    When same thing is copied and paste in java properties file contents direction is reversed that is it is coming from left to right as in english.
    Please help how to put the arabic contents in propeties file
    Regards
    Vidya

    So in terms discussion.
    First I would suggest that you get a hex editor and validate exactly what is in the properties file. It appears to me that you are using one or more editors that are adjusting the display for you and thus that makes it hard to determine where the problem is. A hex editor should not adjust the display. Although even then you might want to right a simple java app and have it read bytes and print them just to validate that the hex editor isn't doing something.
    Only after you are exactly sure how the bytes appear in the file then proceed with other steps.
    For the java GUI only test the following.
    1. Properties file has it left to right then the java GUI displays it correctly right to left or not?
    2. Properties file has it right to left then the java GUI displays it correctly right to left or not?
    Myself I would expect that 2 should be the correct way to implement this. However that is dependent upon you correctly invoking the api as well. So if 2 is not working then you might want to look at the api. It might also have something to do with GUI display properties (of which I know even less.)

Maybe you are looking for

  • How to attach a document (word/excel file etc)

    Dear Sir, We need to attach documents (word/excel/pdf etc) in a FORM application and the attached document need to be stored in database also .  There may be multiple documents getting attached .  We also desire that if a transaction document  say Pu

  • Aperture 3.1.3 and Olympus E-PL2 RAW files

    Hi all; I'm using Aperture 3.1.3 on a mid-2010 MacBook Pro 2.66 GHz, 8 gig RAM. OS is OS X 10.7 My new Olympus E-PL2 RAW files  (.ORF) do not seem to be compatible, despite Apple indicating that they are supported. The corresponding DNG files produce

  • I cannot save in Editor.... error message = program error preview cannot be generated.

    I cannot save changes in Editor when I work with a picture. Could not build a preview because of a program error.

  • SAP SD - Foreign trade using third party

    Hi,   We have a requirement to use a third party system to determine if export licence is required or not. Once determined it needs to come back and block the order till the licence is generated ( also in the third party system). We do not want to us

  • Removal of bg color in header

    I'm using DW 8 and would like to remove the brown from the background of my header. I would like to just have the picture of the header there. How do I do this? I do not want the brown to show at all in the header just the picture. http://wimsarmstro