[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-30 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Attachment: new-patch-for-jdo780.patch

> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>  Components: tck
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Assignee: Michael Bouschen
>Priority: Major
>  Labels: NullPointerException
> Fix For: JDO 3.2
>
> Attachments: new-patch-for-jdo780.patch, patch-for-780.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The related part of that method is shown as follows.
> ```java
> public void printClasspath() {
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>   URL[] urls = ((URLClassLoader) loader).getURLs();
> }
> ```
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-23 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Attachment: patch-for-780.patch

> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>  Components: tck
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Assignee: Michael Bouschen
>Priority: Major
>  Labels: NullPointerException
> Fix For: JDO 3.2
>
> Attachments: patch-for-780.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The related part of that method is shown as follows.
> ```java
> public void printClasspath() {
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>   URL[] urls = ((URLClassLoader) loader).getURLs();
> }
> ```
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-20 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Description: 
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The related part of that method is shown as follows.

```java
public void printClasspath() {
  ClassLoader loader = ClassLoader.getSystemClassLoader();

  URL[] urls = ((URLClassLoader) loader).getURLs();

}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?

  was:
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The related part of that method is shown as follows.

```java
public void printClasspath() {
  ClassLoader loader = ClassLoader.getSystemClassLoader();

  URL[] urls = ((URLClassLoader) loader).getURLs();

}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?


> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Priority: Major
>  Labels: NullPointerException
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The related part of that method is shown as follows.
> ```java
> public void printClasspath() {
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>   URL[] urls = ((URLClassLoader) loader).getURLs();
> }
> ```
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-20 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Description: 
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The related part of that method is shown as follows.

```java
public void printClasspath() {
  ClassLoader loader = ClassLoader.getSystemClassLoader();

  URL[] urls = ((URLClassLoader) loader).getURLs();

}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?

  was:
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The related part of that method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader  


  ClassLoader loader = ClassLoader.getSystemClassLoader();


 //Get the URLs


  URL[] urls = ((URLClassLoader) loader).getURLs();

}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?


> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Priority: Major
>  Labels: NullPointerException
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The related part of that method is shown as follows.
> ```java
> public void printClasspath() {
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>   URL[] urls = ((URLClassLoader) loader).getURLs();
> }
> ```
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-20 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Description: 
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The related part of that method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader


  ClassLoader loader = ClassLoader.getSystemClassLoader();


 //Get the URLs


  URL[] urls = ((URLClassLoader) loader).getURLs();

}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?

  was:
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The related part of that method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader
  ClassLoader loader = ClassLoader.getSystemClassLoader();
 //Get the URLs
  URL[] urls = ((URLClassLoader) loader).getURLs();
}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?


> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Priority: Major
>  Labels: NullPointerException
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The related part of that method is shown as follows.
> ```java
> public void printClasspath() {
>   //Get the System Classloader
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>  //Get the URLs
>   URL[] urls = ((URLClassLoader) loader).getURLs();
> }
> ```
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-20 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Description: 
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The related part of that method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader  


  ClassLoader loader = ClassLoader.getSystemClassLoader();


 //Get the URLs


  URL[] urls = ((URLClassLoader) loader).getURLs();

}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?

  was:
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The related part of that method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader


  ClassLoader loader = ClassLoader.getSystemClassLoader();


 //Get the URLs


  URL[] urls = ((URLClassLoader) loader).getURLs();

}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?


> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Priority: Major
>  Labels: NullPointerException
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The related part of that method is shown as follows.
> ```java
> public void printClasspath() {
>   //Get the System Classloader  
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>  //Get the URLs
>   URL[] urls = ((URLClassLoader) loader).getURLs();
> }
> ```
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-20 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Description: 
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The related part of that method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader
  ClassLoader loader = ClassLoader.getSystemClassLoader();
 //Get the URLs
  URL[] urls = ((URLClassLoader) loader).getURLs();
}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?

  was:
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader
  ClassLoader loader = ClassLoader.getSystemClassLoader();
 //Get the URLs
  URL[] urls = ((URLClassLoader) loader).getURLs();
 ..
}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?


> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Priority: Major
>  Labels: NullPointerException
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The related part of that method is shown as follows.
> ```java
> public void printClasspath() {
>   //Get the System Classloader
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>  //Get the URLs
>   URL[] urls = ((URLClassLoader) loader).getURLs();
> }
> ```
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-20 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Description: 
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader
  ClassLoader loader = ClassLoader.getSystemClassLoader();
 //Get the URLs
  URL[] urls = ((URLClassLoader) loader).getURLs();
 ..
}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?

  was:
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader
  ClassLoader loader = ClassLoader.getSystemClassLoader();
  //Get the URLs
  URL[] urls = ((URLClassLoader) loader).getURLs();
 ..
}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?


> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Priority: Major
>  Labels: NullPointerException
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The method is shown as follows.
> ```java
> public void printClasspath() {
>   //Get the System Classloader
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>  //Get the URLs
>   URL[] urls = ((URLClassLoader) loader).getURLs();
>  ..
> }
> ```
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-20 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Description: 
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The method is shown as follows.

```java
public void printClasspath() {
  //Get the System Classloader
  ClassLoader loader = ClassLoader.getSystemClassLoader();
  //Get the URLs
  URL[] urls = ((URLClassLoader) loader).getURLs();
 ..
}
```

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?

  was:
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The method is shown as follows.

public void printClasspath() {

  //Get the System Classloader
  ClassLoader loader = ClassLoader.getSystemClassLoader();


  //Get the URLs
  URL[] urls = ((URLClassLoader) loader).getURLs();

 ..
}

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?


> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Priority: Major
>  Labels: NullPointerException
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The method is shown as follows.
> ```java
> public void printClasspath() {
>   //Get the System Classloader
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>   //Get the URLs
>   URL[] urls = ((URLClassLoader) loader).getURLs();
>  ..
> }
> ```
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Updated] (JDO-780) Potential NullPointerException in code

2019-08-20 Thread XiangzheXu (Jira)


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

XiangzheXu updated JDO-780:
---
Description: 
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The method is shown as follows.

public void printClasspath() {

  //Get the System Classloader
  ClassLoader loader = ClassLoader.getSystemClassLoader();


  //Get the URLs
  URL[] urls = ((URLClassLoader) loader).getURLs();

 ..
}

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?

  was:
In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` could 
throw an unexpected NullPointerException.

The method is shown as follows.

public void printClasspath() {

  //Get the System Classloader
  ClassLoader loader = ClassLoader.getSystemClassLoader();

  //Get the URLs
  URL[] urls = ((URLClassLoader) loader).getURLs();
 ..
}

The invocation of `ClassLoader.getSystemClassLoader()` could return null in JDK 
8, as is depicted in the Javadoc in its source code:

@return  The system ClassLoader for delegation, or
null if none

If that is the case, the invocation to `getURLs()` could cause a 
NullPointerException. 
Maybe we could check for null pointer here or mention the potential 
NullPointerException at the Javadoc?


> Potential NullPointerException in code
> --
>
> Key: JDO-780
> URL: https://issues.apache.org/jira/browse/JDO-780
> Project: JDO
>  Issue Type: Bug
>Affects Versions: JDO 3.2
>Reporter: XiangzheXu
>Priority: Major
>  Labels: NullPointerException
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.jdo.exectck.Utilities, the method `printClasspath()` 
> could throw an unexpected NullPointerException.
> The method is shown as follows.
> public void printClasspath() {
>   //Get the System Classloader
>   ClassLoader loader = ClassLoader.getSystemClassLoader();
>   //Get the URLs
>   URL[] urls = ((URLClassLoader) loader).getURLs();
>  ..
> }
> The invocation of `ClassLoader.getSystemClassLoader()` could return null in 
> JDK 8, as is depicted in the Javadoc in its source code:
> @return  The system ClassLoader for delegation, or
> null if none
> If that is the case, the invocation to `getURLs()` could cause a 
> NullPointerException. 
> Maybe we could check for null pointer here or mention the potential 
> NullPointerException at the Javadoc?



--
This message was sent by Atlassian Jira
(v8.3.2#803003)