You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "A.J. (JIRA)" <ji...@apache.org> on 2010/08/07 17:31:16 UTC

[jira] Created: (PIVOT-591) add a readObject(File) method to WTKXSerializer

add a readObject(File) method to WTKXSerializer
-----------------------------------------------

                 Key: PIVOT-591
                 URL: https://issues.apache.org/jira/browse/PIVOT-591
             Project: Pivot
          Issue Type: Improvement
          Components: wtk
    Affects Versions: 1.5
         Environment: mac os x 10.6
            Reporter: A.J.
            Priority: Trivial


When loadind a WTKX file using WTKXSerializer readObject(InputStream) method, the serializer fails to load included WTKX because its location is not set.
Adding a method readObject(File file) such as this one should fix this issue : 

    public Object readObject(File file) throws IOException, SerializationException {
    	return readObject(file.toURI().toURL());
    }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-591) add a readObject(File) method to WTKXSerializer

Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896539#action_12896539 ] 

Greg Brown commented on PIVOT-591:
----------------------------------

Includes should still work if you read from a File URL. However, you are correct that they won't work if you use the version that takes an InputStream. I agree that improving the Javadoc for readObject() would help. Thanks for the suggestion.


> add a readObject(File) method to WTKXSerializer
> -----------------------------------------------
>
>                 Key: PIVOT-591
>                 URL: https://issues.apache.org/jira/browse/PIVOT-591
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk
>    Affects Versions: 1.5
>         Environment: mac os x 10.6
>            Reporter: A.J.
>            Priority: Trivial
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> When loadind a WTKX file using WTKXSerializer readObject(InputStream) method, the serializer fails to load included WTKX because its location is not set.
> Adding a method readObject(File file) such as this one should fix this issue : 
>     public Object readObject(File file) throws IOException, SerializationException {
>     	return readObject(file.toURI().toURL());
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-591) add a readObject(File) method to WTKXSerializer

Posted by "A.J. (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896533#action_12896533 ] 

A.J. commented on PIVOT-591:
----------------------------

ok, but in practice, most people new to pivot (like me) will be tempted to use a pattern like this : new WTKXSerializer(new FileInputStream(file)).
(Especially when your're trying to load external wtkx files (not on classpath))
This works ... until your wtkx file do include another wtkx in which case you have a runtime exception (MalformedURLException).
So, it would be great to discourage the use of the readObject(InputSream) method (from a public api perspective) since it is used mainly by the framework, in favor of readObject(String resourceName) or readObject(URL location)
 
does it make sense ?

> add a readObject(File) method to WTKXSerializer
> -----------------------------------------------
>
>                 Key: PIVOT-591
>                 URL: https://issues.apache.org/jira/browse/PIVOT-591
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk
>    Affects Versions: 1.5
>         Environment: mac os x 10.6
>            Reporter: A.J.
>            Priority: Trivial
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> When loadind a WTKX file using WTKXSerializer readObject(InputStream) method, the serializer fails to load included WTKX because its location is not set.
> Adding a method readObject(File file) such as this one should fix this issue : 
>     public Object readObject(File file) throws IOException, SerializationException {
>     	return readObject(file.toURI().toURL());
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PIVOT-591) add a readObject(File) method to WTKXSerializer

Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Brown resolved PIVOT-591.
------------------------------

    Resolution: Won't Fix

In general it is recommended that you load your WTKX files via resource URL rather than file path, to avoid a hard dependency on a particular file system structure. Also, as demonstrated in your example, reading WTKX from the file system is a one-line call, so adding it to the platform wouldn't add much value anyway.



> add a readObject(File) method to WTKXSerializer
> -----------------------------------------------
>
>                 Key: PIVOT-591
>                 URL: https://issues.apache.org/jira/browse/PIVOT-591
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk
>    Affects Versions: 1.5
>         Environment: mac os x 10.6
>            Reporter: A.J.
>            Priority: Trivial
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> When loadind a WTKX file using WTKXSerializer readObject(InputStream) method, the serializer fails to load included WTKX because its location is not set.
> Adding a method readObject(File file) such as this one should fix this issue : 
>     public Object readObject(File file) throws IOException, SerializationException {
>     	return readObject(file.toURI().toURL());
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.