作業部屋の使い方を試しています。
不具合修正 SAVE時、上書きになっていなかった
| @@ -91,7 +91,7 @@ | ||
| 91 | 91 | * @param file |
| 92 | 92 | */ |
| 93 | 93 | public void write(File file) { |
| 94 | - try { | |
| 94 | + try (FileOutputStream os = new FileOutputStream(file)) { | |
| 95 | 95 | TransformerFactory transFactory = TransformerFactory.newInstance(); |
| 96 | 96 | Transformer transformer = transFactory.newTransformer(); |
| 97 | 97 |
| @@ -98,15 +98,19 @@ | ||
| 98 | 98 | transformer.setOutputProperty("indent", "yes"); // 改行指定 |
| 99 | 99 | transformer.setOutputProperty("method", "xml"); |
| 100 | 100 | |
| 101 | - FileOutputStream os = new FileOutputStream(file); | |
| 102 | 101 | DOMSource source = new DOMSource(writedoc); |
| 103 | 102 | StreamResult result = new StreamResult(os); |
| 104 | 103 | transformer.transform(source, result); |
| 105 | - | |
| 104 | + | |
| 105 | + // 作成したXMLをクリア | |
| 106 | + writedoc = null; | |
| 107 | + | |
| 106 | 108 | } catch (TransformerConfigurationException ex) { |
| 107 | 109 | Logger.getLogger(LibraryXml.class.getName()).log(Level.SEVERE, null, ex); |
| 108 | 110 | } catch (FileNotFoundException | TransformerException ex) { |
| 109 | 111 | Logger.getLogger(LibraryXml.class.getName()).log(Level.SEVERE, null, ex); |
| 112 | + } catch (IOException ex) { | |
| 113 | + Logger.getLogger(LibraryXml.class.getName()).log(Level.SEVERE, null, ex); | |
| 110 | 114 | } |
| 111 | 115 | } |
| 112 | 116 |
| @@ -81,7 +81,7 @@ | ||
| 81 | 81 | public void save(File file) { |
| 82 | 82 | |
| 83 | 83 | elementset(); |
| 84 | - | |
| 84 | + | |
| 85 | 85 | xlib.write(file); |
| 86 | 86 | } |
| 87 | 87 |
| @@ -65,7 +65,7 @@ | ||
| 65 | 65 | <htmltag>div</htmltag> |
| 66 | 66 | <htmlclass>lineFi clearfix</htmlclass> |
| 67 | 67 | <around>2</around> |
| 68 | -<regexp>^([,.0-9]+|-{3})\t</regexp> | |
| 68 | +<regexp>^((ストップ高\t|ストップ安\t)?[,0-9]+|-{3})</regexp> | |
| 69 | 69 | </searchlist> |
| 70 | 70 | <searchlist listNo="12"> |
| 71 | 71 | <item>安値</item> |
| @@ -72,7 +72,7 @@ | ||
| 72 | 72 | <htmltag>div</htmltag> |
| 73 | 73 | <htmlclass>lineFi clearfix</htmlclass> |
| 74 | 74 | <around>3</around> |
| 75 | -<regexp>^([,.0-9]+|-{3})\t</regexp> | |
| 75 | +<regexp>^((ストップ高\t|ストップ安\t)?[,0-9]+|-{3})</regexp> | |
| 76 | 76 | </searchlist> |
| 77 | 77 | <searchlist listNo="13"> |
| 78 | 78 | <item>出来高</item> |