[ 
https://issues.apache.org/jira/browse/PIVOT-880?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steven Swor updated PIVOT-880:
------------------------------

    Description: 
I'm using Pivot as the user interface to an enterprise application.  I want my 
users to be able to control applicaiton settings through the UI, such as where 
to save output files.  In this particular case, the users want to use a network 
share accessed via a UNC path ("\\server\share").

In testing, I discovered a NPE was being logged when I ran the following code:
{code}
  FileBrowser browser = ... //assume the browser is shown
  String path = ... //UNC path, such as "\\server\share" (escape slashes 
removed for legibility)
  java.io.File directory = new java.io.File(path);
  if (directory.exists()) {
      browser.setRootDirectory(directory);
  }
{code}

The exception stack trace is:
{quote}
  java.lang.NullPointerException
        at 
org.apache.pivot.wtk.skin.terra.TerraFileBrowserSkin$2.selectedItemChanged(TerraFileBrowserSkin.java:610)
        at 
org.apache.pivot.wtk.ListButton$ListButtonSelectionListenerList.selectedItemChanged(ListButton.java:131)
        at org.apache.pivot.wtk.ListButton.setSelectedIndex(ListButton.java:514)
        at org.apache.pivot.wtk.ListButton.setSelectedItem(ListButton.java:532)
        at 
org.apache.pivot.wtk.skin.terra.TerraFileBrowserSkin.rootDirectoryChanged(TerraFileBrowserSkin.java:955)
        at 
org.apache.pivot.wtk.FileBrowser$FileBrowserListenerList.rootDirectoryChanged(FileBrowser.java:44)
        at 
org.apache.pivot.wtk.FileBrowser.setRootDirectory(FileBrowser.java:127)
{quote}

Stepping through the code, it appears as though TerraFileBrowserSkin tries to 
select the drive by looking for path separators (slash characters), but it gets 
thrown off by the leading slashes in the UNC path.

  was:
I'm using Pivot as the user interface to an enterprise application.  I want my 
users to be able to control applicaiton settings through the UI, such as where 
to save output files.  In this particular case, the users want to use a network 
share accessed via a UNC path ("\\server\share").

In testing, I discovered a NPE was being logged when I ran the following code:

{code}
FileBrowser browser = ... //assume the browser is shown
String path = ... //UNC path, such as "\\server\share" (escape slashes removed 
for legibility)
java.io.File directory = new java.io.File(path);
if (directory.exists()) {
    browser.setRootDirectory(directory);
}
{code}

The exception stack trace is:

{code}
java.lang.NullPointerException
        at 
org.apache.pivot.wtk.skin.terra.TerraFileBrowserSkin$2.selectedItemChanged(TerraFileBrowserSkin.java:610)
        at 
org.apache.pivot.wtk.ListButton$ListButtonSelectionListenerList.selectedItemChanged(ListButton.java:131)
        at org.apache.pivot.wtk.ListButton.setSelectedIndex(ListButton.java:514)
        at org.apache.pivot.wtk.ListButton.setSelectedItem(ListButton.java:532)
        at 
org.apache.pivot.wtk.skin.terra.TerraFileBrowserSkin.rootDirectoryChanged(TerraFileBrowserSkin.java:955)
        at 
org.apache.pivot.wtk.FileBrowser$FileBrowserListenerList.rootDirectoryChanged(FileBrowser.java:44)
        at 
org.apache.pivot.wtk.FileBrowser.setRootDirectory(FileBrowser.java:127)
{code}

Stepping through the code, it appears as though TerraFileBrowserSkin tries to 
select the drive by looking for path separators (slash characters), but it gets 
thrown off by the leading slashes in the UNC path.

    
> NPE when calling FileBrowser.setRootDirectory using a UNC path
> --------------------------------------------------------------
>
>                 Key: PIVOT-880
>                 URL: https://issues.apache.org/jira/browse/PIVOT-880
>             Project: Pivot
>          Issue Type: Bug
>          Components: wtk-terra
>    Affects Versions: 2.0.1
>         Environment: Windows XP with network shares
>            Reporter: Steven Swor
>            Priority: Minor
>
> I'm using Pivot as the user interface to an enterprise application.  I want 
> my users to be able to control applicaiton settings through the UI, such as 
> where to save output files.  In this particular case, the users want to use a 
> network share accessed via a UNC path ("\\server\share").
> In testing, I discovered a NPE was being logged when I ran the following code:
> {code}
>   FileBrowser browser = ... //assume the browser is shown
>   String path = ... //UNC path, such as "\\server\share" (escape slashes 
> removed for legibility)
>   java.io.File directory = new java.io.File(path);
>   if (directory.exists()) {
>       browser.setRootDirectory(directory);
>   }
> {code}
> The exception stack trace is:
> {quote}
>   java.lang.NullPointerException
>       at 
> org.apache.pivot.wtk.skin.terra.TerraFileBrowserSkin$2.selectedItemChanged(TerraFileBrowserSkin.java:610)
>       at 
> org.apache.pivot.wtk.ListButton$ListButtonSelectionListenerList.selectedItemChanged(ListButton.java:131)
>       at org.apache.pivot.wtk.ListButton.setSelectedIndex(ListButton.java:514)
>       at org.apache.pivot.wtk.ListButton.setSelectedItem(ListButton.java:532)
>       at 
> org.apache.pivot.wtk.skin.terra.TerraFileBrowserSkin.rootDirectoryChanged(TerraFileBrowserSkin.java:955)
>       at 
> org.apache.pivot.wtk.FileBrowser$FileBrowserListenerList.rootDirectoryChanged(FileBrowser.java:44)
>       at 
> org.apache.pivot.wtk.FileBrowser.setRootDirectory(FileBrowser.java:127)
> {quote}
> Stepping through the code, it appears as though TerraFileBrowserSkin tries to 
> select the drive by looking for path separators (slash characters), but it 
> gets thrown off by the leading slashes in the UNC path.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to