mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8252354: Properties :: storeToXML method does not throw ClassCastException when supplied non strings
Reviewed-by: lancea, naoto
This commit is contained in:
parent
c61204b3f3
commit
38cd5d0936
2 changed files with 71 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -118,6 +118,9 @@ public class PropertiesDefaultHandler extends DefaultHandler {
|
|||
writer.writeAttribute(ATTR_KEY, (String)k);
|
||||
writer.writeCharacters((String)v);
|
||||
writer.writeEndElement();
|
||||
} else {
|
||||
throw new ClassCastException(
|
||||
"Keys and values in Properties must be Strings");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue