You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2018/04/12 07:54:23 UTC

[Bug 62286] New: Illegalargument exception occurrs while parsing properties from a file that contains \u in its property key,value

https://bz.apache.org/bugzilla/show_bug.cgi?id=62286

            Bug ID: 62286
           Summary: Illegalargument exception occurrs while  parsing
                    properties from a file that contains \u in its
                    property key,value
           Product: Ant
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: vikas.pachisia@gmail.com
  Target Milestone: ---

Created attachment 35858
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35858&action=edit
two files with description given in problem description

Introduction
=========================
Consider the following code snippet in ant's build.xml file

<exec dir="${basedir}"
  executable="svn"
  output="${basedir}/svn.properties"
  failonerror="true">
  <arg value="info"/>
</exec>
<property prefix="svn" file="${basedir}/svn.properties"/>

Bascially the above snippet is trying to
1. Run "svn info" command and put the output into the file "svn.properties"
2. Read the properties from the file "svn.properties" and prefix it with SVN

Problem
===========================
We get the illegalargument exception while reading the properties from the file
"svn.propeties"

Cause
=====================
The property file contains "\universal..." as part of the string.
Java's "java.util.Properties.loadconvert" api reads the '\u' character and
assumes that the character is represented as Unicode character.
But the character after '\u' is 'n' and NOT one of the hex digits.
Thus the exception is raised.

Reproduction
===================
Two files have been attached to easily reproduce and see the issue.
svn.properties - contains the properties which can generate the mentioned
issue.
TestSvnProp.java - a main file which tries to load the svn.properties

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62286] Illegalargument exception occurrs while parsing properties from a file that contains \u in its property key,value

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62286

--- Comment #1 from Stefan Bodewig <bo...@apache.org> ---
This is not a bug in Ant, your svn-properties file simply is not a valid Java
properties file and the property task explicitly only supports reading that.
Apart from Unicode escapes there are a few other special rules you need to
adhere to like escaping colons and backslashes with backslashes.

In short you have to tweak svn's output in order to ensure it is a valid java
properties file.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62286] Illegalargument exception occurrs while parsing properties from a file that contains \u in its property key,value

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62286

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

-- 
You are receiving this mail because:
You are the assignee for the bug.