| 1 | // Copyright © 2004-2006 University of Helsinki, Department of Computer Science | |
| 2 | // Copyright © 2012 various contributors | |
| 3 | // This software is released under GNU Lesser General Public License 2.1. | |
| 4 | // The license text is at http://www.gnu.org/licenses/lgpl-2.1.html | |
| 5 | ||
| 6 | package fi.helsinki.cs.titokone; | |
| 7 | ||
| 8 | import java.io.*; | |
| 9 | import java.net.*; | |
| 10 | import java.text.ParseException; | |
| 11 | import java.util.ResourceBundle; | |
| 12 | import java.util.logging.Logger; | |
| 13 | ||
| 14 | /** | |
| 15 | * This class transforms files into various sorts of buffer classes | |
| 16 | * depending on who needs them, and saves these buffer classes to | |
| 17 | * files when needed. The buffer classes will not be dependent on | |
| 18 | * files and I/O operations anymore, and therefore will not throw | |
| 19 | * eg. IOExceptions when read. | |
| 20 | */ | |
| 21 | public class FileHandler { | |
| 22 | /** | |
| 23 | * This logger will be used for logging the I/O activities. | |
| 24 | */ | |
| 25 | private Logger logger; | |
| 26 | /** | |
| 27 | * This class has its own logger. | |
| 28 | */ | |
| 29 | public static String loggerName = "fi.helsinki.cs.titokone.filehandler"; | |
| 30 | ||
| 31 | /** | |
| 32 | * Read only access to file | |
| 33 | */ | |
| 34 | public static final int READ_ACCESS = 1; | |
| 35 | ||
| 36 | /** | |
| 37 | * Append access to file | |
| 38 | */ | |
| 39 | public static final int APPEND_ACCESS = 2; | |
| 40 | ||
| 41 | /** | |
| 42 | * Write access to file | |
| 43 | */ | |
| 44 | public static final int WRITE_ACCESS = 3; | |
| 45 | ||
| 46 | /** | |
| 47 | * This class sets up a new FileHandler and sets up its Logger. | |
| 48 | */ | |
| 49 | public FileHandler() { | |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * This function loads up a Source file from a given file. | |
| 54 | * | |
| 55 | * @param srcFile The identifier of the file to read from. | |
| 56 | * @return A source instance which is no longer dependent on I/O. | |
| 57 | * @throws IOException If an I/O error occurs. Eg. one of the possible | |
| 58 | * IOExceptions is FileNotFoundException. | |
| 59 | */ | |
| 60 | public Source loadSource(File srcFile) throws IOException { | |
| 61 | 4 | return new Source(loadFileContentsToString(srcFile).toString()); |
| 62 | } | |
| 63 | ||
| 64 | /** | |
| 65 | * This method is used to save a source that has been modified. | |
| 66 | * | |
| 67 | * @param src The source object to save to file. | |
| 68 | * @param srcFile The file to save the source to. | |
| 69 | * @throws IOException If an I/O error occurds. | |
| 70 | */ | |
| 71 | public void saveSource(Source src, File srcFile) throws IOException { | |
| 72 | 2 | saveStringToFile(src.getSource(), srcFile); |
| 73 | } | |
| 74 | ||
| 75 | /** | |
| 76 | * This function loads a settings file into a StringBuffer. | |
| 77 | * | |
| 78 | * @param settingsFile The identifier of the file to read from. | |
| 79 | * @return A StringBuffer which no longer depends on I/O. | |
| 80 | * @throws IOException If an I/O error occurs. Eg. one of the possible | |
| 81 | * IOExceptions is FileNotFoundException. | |
| 82 | */ | |
| 83 | public StringBuffer loadSettings(File settingsFile) throws IOException { | |
| 84 | 2 | return loadFileContentsToString(settingsFile); |
| 85 | } | |
| 86 | ||
| 87 | /** | |
| 88 | * This function loads a settings input stream to a StringBuffer. | |
| 89 | * | |
| 90 | * @param settingsStream An input stream to read the contents | |
| 91 | * from. | |
| 92 | * @return A StringBuffer containing the stream's contents, | |
| 93 | * linebreaks unmodified, or null if the settingsStream was null. | |
| 94 | * @throws IOException If an I/O error occurs while reading or | |
| 95 | * closing the stream. | |
| 96 | */ | |
| 97 | public StringBuffer loadSettings(InputStream settingsStream) | |
| 98 | throws IOException { | |
| 99 | StringBuffer result; | |
| 100 | BufferedReader reader; | |
| 101 | 1 | if (settingsStream == null) { |
| 102 | 1 | return null; |
| 103 | } | |
| 104 | 2 | reader = new BufferedReader(new InputStreamReader(settingsStream)); |
| 105 | 2 | return loadReaderContentsToString(reader); |
| 106 | } | |
| 107 | ||
| 108 | /** | |
| 109 | * This method saves settings data from a StringBuffer to a file. | |
| 110 | * The line separator will be | |
| 111 | * System.getProperty("line.separator", "\n"). | |
| 112 | * | |
| 113 | * @param settingsData The settings data in a StringBuffer in the | |
| 114 | * form it is to be saved in. The linebreaks in the file will be \ns. | |
| 115 | * @param settingsFile The identifier of the file to save to. | |
| 116 | * @throws IOException If an I/O error occurs, eg. the directory | |
| 117 | * the file should be in does not exist or we cannot write to it. | |
| 118 | */ | |
| 119 | public void saveSettings(String settingsData, File settingsFile) | |
| 120 | throws IOException { | |
| 121 | 1 | saveStringToFile(settingsData, settingsFile); |
| 122 | } | |
| 123 | ||
| 124 | /** | |
| 125 | * This function loads a Binary from a binary .b91 file and | |
| 126 | * returns the result. The Binary class checks itself upon creation | |
| 127 | * and throws a ParseException if it is not syntactically correct. | |
| 128 | * | |
| 129 | * @param binaryFile Identifier of the file to read from. | |
| 130 | * @return An Binary instance containing the contents of the | |
| 131 | * .b91 file. | |
| 132 | * @throws IOException If an I/O error occurs. Eg. one of the possible | |
| 133 | * IOExceptions is FileNotFoundException. | |
| 134 | * @throws ParseException If the file does not contain a valid | |
| 135 | * binary. | |
| 136 | */ | |
| 137 | public Binary loadBinary(File binaryFile) | |
| 138 | throws IOException, ParseException { | |
| 139 | 4 | return new Binary(loadFileContentsToString(binaryFile).toString()); |
| 140 | } | |
| 141 | ||
| 142 | ||
| 143 | /** | |
| 144 | * This method saves a Binary to file in a .b91 binary format. | |
| 145 | * | |
| 146 | * @param bin The binary to save to file. | |
| 147 | * @param binarySaveFile The identifier for the file to save to. | |
| 148 | * @throws IOException If an I/O error occurs, eg. the given file | |
| 149 | * cannot be written to. | |
| 150 | */ | |
| 151 | public void saveBinary(Binary bin, File binarySaveFile) | |
| 152 | throws IOException { | |
| 153 | 2 | saveStringToFile(bin.toString(), binarySaveFile); |
| 154 | } | |
| 155 | ||
| 156 | /** | |
| 157 | * This method loads a "stdin" file representing the disk into | |
| 158 | * a string. The contents should be integers delimited by \n, | |
| 159 | * \r or \r\n, but the loader does not check that this is the | |
| 160 | * case. | |
| 161 | * | |
| 162 | * @param stdinFile The identifier for the file to read from. | |
| 163 | * @return A stringbuffer containing the contents of the file. | |
| 164 | * @throws IOException If an I/O error occurs, eg. the given | |
| 165 | * file is not found. | |
| 166 | */ | |
| 167 | public StringBuffer loadStdIn(File stdinFile) throws IOException { | |
| 168 | 2 | return loadFileContentsToString(stdinFile); |
| 169 | } | |
| 170 | ||
| 171 | /** | |
| 172 | * This method appends data to a stdout file. If the file does | |
| 173 | * not exist, it is created. | |
| 174 | * | |
| 175 | * @param dataItem The data to append to the file (a newline is | |
| 176 | * added automagically). | |
| 177 | * @param stdoutFile The file to append to. | |
| 178 | * @throws IOException If an I/O error occurs. | |
| 179 | */ | |
| 180 | public void appendDataToStdOut(String dataItem, File stdoutFile) | |
| 181 | throws IOException { | |
| 182 | 1 | boolean fileExisted = stdoutFile.exists(); |
| 183 | // Open the file in append mode. | |
| 184 | 4 | BufferedWriter writer = new BufferedWriter(new FileWriter(stdoutFile, |
| 185 | true)); | |
| 186 | //if(fileExisted) | |
| 187 | // writer.newLine(); | |
| 188 | 4 | writer.write(dataItem, 0, dataItem.length()); |
| 189 | 1 | writer.newLine(); // Add newlines to end instead of beginning. |
| 190 | 1 | writer.flush(); |
| 191 | 1 | writer.close(); |
| 192 | } | |
| 193 | ||
| 194 | /** | |
| 195 | * This method attempts to load a resource bundle from a file | |
| 196 | * (with an URLClassLoader). It bundles up the various exceptions | |
| 197 | * possibly created by this into ResourceLoadFailedException. | |
| 198 | * | |
| 199 | * @param rbFile The filename to load and instantiate the | |
| 200 | * ResourceBundle from. | |
| 201 | * @return A ResourceBundle found from the file. | |
| 202 | * @throws ResourceLoadFailedException If the file load would cast | |
| 203 | * an IOException, or the class loading would cast a | |
| 204 | * ClassNotFoundException or the instantiation would cast a | |
| 205 | * InstantiationException or the cast a ClassCastException. | |
| 206 | */ | |
| 207 | public ResourceBundle loadResourceBundle(File rbFile) | |
| 208 | throws ResourceLoadFailedException { | |
| 209 | ||
| 210 | Class theClass; | |
| 211 | Object translations; | |
| 212 | String className, errorMessage; | |
| 213 | 2 | String errorParams[] = new String[2]; |
| 214 | Logger logger = Logger.getLogger(getClass().getPackage().getName()); | |
| 215 | 2 | URL[] url = new URL[1]; |
| 216 | ||
| 217 | // Remove .class from the file. Note that package names will not be added. | |
| 218 | // We can't determine them sensibly from the file name. | |
| 219 | 2 | className = changeExtension(rbFile, "").getName(); |
| 220 | ||
| 221 | try { | |
| 222 | 5 | url[0] = rbFile.getParentFile().toURI().toURL(); // MalformedURLException, anyone? |
| 223 | 1 | URLClassLoader loader = new URLClassLoader(url); // SecurityExcp.. |
| 224 | 1 | theClass = loader.loadClass(className); // ClassNotFoundExcp..? |
| 225 | // InstantiationException or IllegalAccessException, anyone? | |
| 226 | 1 | translations = theClass.newInstance(); |
| 227 | 1 | return (ResourceBundle) translations; // ClassCastException? |
| 228 | } catch (Exception originalException) { | |
| 229 | // Throw an exception with a message like "<exception name> in | |
| 230 | // loadResourceBundle(): <original exception message>". | |
| 231 | 4 | errorParams[0] = originalException.getClass().getName(); |
| 232 | 3 | errorParams[1] = originalException.getMessage(); |
| 233 | 2 | errorMessage = new Message("{0} in loadResourceBundle(): {1}", |
| 234 | errorParams).toString(); | |
| 235 | logger.fine(errorMessage); | |
| 236 | 1 | throw new ResourceLoadFailedException(errorMessage); |
| 237 | } | |
| 238 | } | |
| 239 | ||
| 240 | /** | |
| 241 | * This function is a private assistant method for FileHandler and | |
| 242 | * it loads the contents of the given file into a string and returns | |
| 243 | * that string. It may throw an IOException in case of a read error. | |
| 244 | */ | |
| 245 | private StringBuffer loadFileContentsToString(File loadFile) | |
| 246 | throws IOException { | |
| 247 | 2 | BufferedReader loadFileContents = |
| 248 | new BufferedReader(new FileReader(loadFile)); | |
| 249 | ||
| 250 | 2 | return loadReaderContentsToString(loadFileContents); |
| 251 | } | |
| 252 | ||
| 253 | /** | |
| 254 | * This function is a private assistant method, which loads the | |
| 255 | * contents of a given reader into a string and returns that string. | |
| 256 | * The lines will be read using .readLine() and recombined with | |
| 257 | * \ns. | |
| 258 | * | |
| 259 | * @throws IOException If an I/O error occurs while reading the file. | |
| 260 | */ | |
| 261 | private StringBuffer loadReaderContentsToString(BufferedReader reader) | |
| 262 | throws IOException { | |
| 263 | StringBuffer result; | |
| 264 | String line = ""; | |
| 265 | ||
| 266 | 1 | result = new StringBuffer(""); |
| 267 | // readLine() returns null when the end of the stream has been | |
| 268 | // reached. | |
| 269 | 1 | while (line != null) { |
| 270 | 1 | result.append(line); |
| 271 | 1 | line = reader.readLine(); |
| 272 | 1 | if (line != null) { |
| 273 | 4 | line += "\n"; // (Result-str is internally used.) |
| 274 | } | |
| 275 | } | |
| 276 | 1 | reader.close(); |
| 277 | 1 | return result; |
| 278 | } | |
| 279 | ||
| 280 | /** | |
| 281 | * This method is a private helper method which handles saving strings | |
| 282 | * to files. | |
| 283 | */ | |
| 284 | private void saveStringToFile(String str, File saveFile) | |
| 285 | throws IOException { | |
| 286 | 2 | if (!saveFile.exists()) { |
| 287 | 1 | saveFile.createNewFile(); |
| 288 | } | |
| 289 | ||
| 290 | 2 | BufferedWriter saveFileWriter = |
| 291 | new BufferedWriter(new FileWriter(saveFile)); | |
| 292 | 4 | saveFileWriter.write(str, 0, str.length()); |
| 293 | 1 | saveFileWriter.flush(); |
| 294 | 1 | saveFileWriter.close(); |
| 295 | } | |
| 296 | ||
| 297 | /** | |
| 298 | * This method changes the extension of the given filename to | |
| 299 | * newExtension and returns the new filename as a File object. | |
| 300 | * File extensions are considered to be the part after the last period | |
| 301 | * in the File.getName(). If there are no periods in that part, | |
| 302 | * the file is considered to be without an extension and newExtension | |
| 303 | * is added. | |
| 304 | */ | |
| 305 | public File changeExtension(File f, String newExtension) { | |
| 306 | String filenamestr; | |
| 307 | File parent; | |
| 308 | 1 | filenamestr = f.getName(); |
| 309 | 1 | parent = f.getParentFile(); |
| 310 | ||
| 311 | 3 | return new File(parent, changeExtensionStr(filenamestr, |
| 312 | newExtension)); | |
| 313 | } | |
| 314 | ||
| 315 | /** | |
| 316 | * This method returns the first string modified so that the part of | |
| 317 | * it following the last period is removed, including the period, | |
| 318 | * and the result is this modified followed by newExtension. If | |
| 319 | * newExtension is not an empty string, the two are separated with a | |
| 320 | * ".". | |
| 321 | */ | |
| 322 | private String changeExtensionStr(String filename, String newExtension) { | |
| 323 | String result; | |
| 324 | int lastPeriod; | |
| 325 | 1 | lastPeriod = filename.lastIndexOf("."); |
| 326 | 3 | if (lastPeriod == -1) { |
| 327 | 1 | lastPeriod = filename.length(); |
| 328 | } | |
| 329 | 3 | result = filename.substring(0, lastPeriod); |
| 330 | 2 | if (!newExtension.equals("")) { |
| 331 | 5 | result += "." + newExtension; |
| 332 | } | |
| 333 | 1 | return result; |
| 334 | } | |
| 335 | ||
| 336 | /* This function tests if a given file can be accessed for | |
| 337 | reading, writing or appending operations. It throws a home-made | |
| 338 | IOException accordingly. | |
| 339 | @throws FileNotFoundException If a file checked for read | |
| 340 | access does not exist. | |
| 341 | @throws IOException (Excluding the above.) If a file does not | |
| 342 | allow the sort of access which is asked for. */ | |
| 343 | public void testAccess(File accessedFile, int accessType) | |
| 344 | throws IOException { | |
| 345 | String msg; | |
| 346 | 2 | boolean couldWrite = true; |
| 347 | 2 | if (accessedFile.exists() == false) { |
| 348 | 3 | if (accessType == READ_ACCESS) { |
| 349 | 2 | throw new FileNotFoundException(accessedFile.getName()); |
| 350 | } else { | |
| 351 | try { | |
| 352 | // Check if the file can be created. This may throw | |
| 353 | // a FileNotFoundException. | |
| 354 | 1 | accessedFile.createNewFile(); |
| 355 | 1 | couldWrite = accessedFile.canWrite(); |
| 356 | 1 | accessedFile.delete(); |
| 357 | } catch (IOException errorOccurred) { | |
| 358 | 3 | msg = new Message("No write access to {0}; " + |
| 359 | "file cannot be created.", | |
| 360 | accessedFile.getName()).toString(); | |
| 361 | 1 | throw new IOException(msg); |
| 362 | } | |
| 363 | 1 | if (!couldWrite) { |
| 364 | 3 | msg = new Message("No write access to {0}.", |
| 365 | accessedFile.getName()).toString(); | |
| 366 | 1 | throw new IOException(msg); |
| 367 | } | |
| 368 | return; // Write access and file can be created, assume ok. | |
| 369 | } | |
| 370 | } | |
| 371 | 5 | if (accessType == READ_ACCESS && accessedFile.canRead() == false) { |
| 372 | 3 | msg = new Message("No read access to {0}.", |
| 373 | accessedFile.getName()).toString(); | |
| 374 | 1 | throw new IOException(msg); |
| 375 | 8 | } else if ((accessType == WRITE_ACCESS || accessType == APPEND_ACCESS) && |
| 376 | accessedFile.canWrite() == false) { | |
| 377 | 3 | msg = new Message("No write access to {0}.", |
| 378 | accessedFile.getName()).toString(); | |
| 379 | 1 | throw new IOException(msg); |
| 380 | } | |
| 381 | } | |
| 382 | } | |
| 383 | ||
| 384 | ||
| 385 | ||
| 386 | ||
| 387 | ||
Mutations | ||
| 61 |
mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::loadSource to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) removed call to fi/helsinki/cs/titokone/Source::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) removed call to java/lang/StringBuffer::toString : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) removed call to fi/helsinki/cs/titokone/FileHandler::loadFileContentsToString : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) |
|
| 72 |
removed call to fi/helsinki/cs/titokone/Source::getSource : NO_COVERAGE removed call to fi/helsinki/cs/titokone/FileHandler::saveStringToFile : NO_COVERAGE |
|
| 84 |
removed call to fi/helsinki/cs/titokone/FileHandler::loadFileContentsToString : NO_COVERAGE mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::loadSettings to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |
|
| 101 |
negated conditional : NO_COVERAGE |
|
| 102 |
mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::loadSettings to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |
|
| 104 |
removed call to java/io/BufferedReader::<init> : NO_COVERAGE removed call to java/io/InputStreamReader::<init> : NO_COVERAGE |
|
| 105 |
removed call to fi/helsinki/cs/titokone/FileHandler::loadReaderContentsToString : NO_COVERAGE mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::loadSettings to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |
|
| 121 |
removed call to fi/helsinki/cs/titokone/FileHandler::saveStringToFile : NO_COVERAGE |
|
| 139 |
removed call to fi/helsinki/cs/titokone/FileHandler::loadFileContentsToString : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Binary::<init> : NO_COVERAGE mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::loadBinary to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE removed call to java/lang/StringBuffer::toString : NO_COVERAGE |
|
| 153 |
removed call to fi/helsinki/cs/titokone/FileHandler::saveStringToFile : SURVIVED removed call to fi/helsinki/cs/titokone/Binary::toString : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) |
|
| 168 |
removed call to fi/helsinki/cs/titokone/FileHandler::loadFileContentsToString : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSetDefaultStdin(fi.helsinki.cs.titokone.ControlTest) mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::loadStdIn to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSetDefaultStdin(fi.helsinki.cs.titokone.ControlTest) |
|
| 182 |
removed call to java/io/File::exists : SURVIVED |
|
| 184 |
removed call to java/io/FileWriter::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testLoad(fi.helsinki.cs.titokone.ControlTest) Substituted 1 with 0 : SURVIVED removed call to java/io/BufferedWriter::<init> : SURVIVED Substituted 1 with 0 : SURVIVED |
|
| 188 |
Substituted 0 with 1 : NO_COVERAGE removed call to java/lang/String::length : NO_COVERAGE Substituted 0 with 1 : NO_COVERAGE removed call to java/io/BufferedWriter::write : NO_COVERAGE |
|
| 189 |
removed call to java/io/BufferedWriter::newLine : NO_COVERAGE |
|
| 190 |
removed call to java/io/BufferedWriter::flush : NO_COVERAGE |
|
| 191 |
removed call to java/io/BufferedWriter::close : NO_COVERAGE |
|
| 213 |
Substituted 2 with 3 : NO_COVERAGE Substituted 2 with 3 : NO_COVERAGE |
|
| 215 |
Substituted 1 with 0 : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE |
|
| 219 |
removed call to java/io/File::getName : NO_COVERAGE removed call to fi/helsinki/cs/titokone/FileHandler::changeExtension : NO_COVERAGE |
|
| 222 |
Substituted 0 with 1 : NO_COVERAGE removed call to java/net/URI::toURL : NO_COVERAGE removed call to java/io/File::getParentFile : NO_COVERAGE Substituted 0 with 1 : NO_COVERAGE removed call to java/io/File::toURI : NO_COVERAGE |
|
| 223 |
removed call to java/net/URLClassLoader::<init> : NO_COVERAGE |
|
| 224 |
removed call to java/net/URLClassLoader::loadClass : NO_COVERAGE |
|
| 226 |
removed call to java/lang/Class::newInstance : NO_COVERAGE |
|
| 227 |
mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::loadResourceBundle to ( if (x != null) null else throw new RuntimeException ) : NO_COVERAGE |
|
| 231 |
Substituted 0 with 1 : NO_COVERAGE Substituted 0 with 1 : NO_COVERAGE removed call to java/lang/Object::getClass : NO_COVERAGE removed call to java/lang/Class::getName : NO_COVERAGE |
|
| 232 |
Substituted 1 with 0 : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE removed call to java/lang/Exception::getMessage : NO_COVERAGE |
|
| 233 |
removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE |
|
| 236 |
removed call to fi/helsinki/cs/titokone/ResourceLoadFailedException::<init> : NO_COVERAGE |
|
| 247 |
removed call to java/io/BufferedReader::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) removed call to java/io/FileReader::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) |
|
| 250 |
removed call to fi/helsinki/cs/titokone/FileHandler::loadReaderContentsToString : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::loadFileContentsToString to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) |
|
| 266 |
removed call to java/lang/StringBuffer::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) |
|
| 269 |
negated conditional : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) |
|
| 270 |
removed call to java/lang/StringBuffer::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) |
|
| 271 |
removed call to java/io/BufferedReader::readLine : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) |
|
| 272 |
negated conditional : TIMED_OUT |
|
| 273 |
removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) removed call to java/lang/StringBuilder::toString : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) |
|
| 276 |
removed call to java/io/BufferedReader::close : SURVIVED |
|
| 277 |
mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::loadReaderContentsToString to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.ControlTest.testOpenSource(fi.helsinki.cs.titokone.ControlTest) |
|
| 286 |
removed call to java/io/File::exists : SURVIVED negated conditional : SURVIVED |
|
| 287 |
removed call to java/io/File::createNewFile : SURVIVED |
|
| 290 |
removed call to java/io/FileWriter::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) removed call to java/io/BufferedWriter::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) |
|
| 292 |
removed call to java/lang/String::length : SURVIVED removed call to java/io/BufferedWriter::write : SURVIVED Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) |
|
| 293 |
removed call to java/io/BufferedWriter::flush : SURVIVED |
|
| 294 |
removed call to java/io/BufferedWriter::close : SURVIVED |
|
| 308 |
removed call to java/io/File::getName : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) |
|
| 309 |
removed call to java/io/File::getParentFile : SURVIVED |
|
| 311 |
removed call to fi/helsinki/cs/titokone/FileHandler::changeExtensionStr : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) removed call to java/io/File::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::changeExtension to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) |
|
| 325 |
removed call to java/lang/String::lastIndexOf : SURVIVED |
|
| 326 |
Substituted -1 with 1 : SURVIVED negated conditional : SURVIVED Substituted -1 with 0 : SURVIVED |
|
| 327 |
removed call to java/lang/String::length : NO_COVERAGE |
|
| 329 |
Substituted 0 with 1 : SURVIVED Substituted 0 with 1 : SURVIVED removed call to java/lang/String::substring : SURVIVED |
|
| 330 |
removed call to java/lang/String::equals : SURVIVED negated conditional : SURVIVED |
|
| 331 |
removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) removed call to java/lang/StringBuilder::toString : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) |
|
| 333 |
mutated return of Object value for fi/helsinki/cs/titokone/FileHandler::changeExtensionStr to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.ControlTest.testSaveBinaryGuessFilename(fi.helsinki.cs.titokone.ControlTest) |
|
| 346 |
Substituted 1 with 0 : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE |
|
| 347 |
negated conditional : NO_COVERAGE removed call to java/io/File::exists : NO_COVERAGE |
|
| 348 |
negated conditional : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE |
|
| 349 |
removed call to java/io/File::getName : NO_COVERAGE removed call to java/io/FileNotFoundException::<init> : NO_COVERAGE |
|
| 354 |
removed call to java/io/File::createNewFile : NO_COVERAGE |
|
| 355 |
removed call to java/io/File::canWrite : NO_COVERAGE |
|
| 356 |
removed call to java/io/File::delete : NO_COVERAGE |
|
| 358 |
removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE removed call to java/io/File::getName : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE |
|
| 361 |
removed call to java/io/IOException::<init> : NO_COVERAGE |
|
| 363 |
negated conditional : NO_COVERAGE |
|
| 364 |
removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE removed call to java/io/File::getName : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE |
|
| 366 |
removed call to java/io/IOException::<init> : NO_COVERAGE |
|
| 371 |
Substituted 1 with 0 : NO_COVERAGE removed call to java/io/File::canRead : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE negated conditional : NO_COVERAGE negated conditional : NO_COVERAGE |
|
| 372 |
removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE removed call to java/io/File::getName : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE |
|
| 374 |
removed call to java/io/IOException::<init> : NO_COVERAGE |
|
| 375 |
Substituted 3 with 4 : NO_COVERAGE negated conditional : NO_COVERAGE negated conditional : NO_COVERAGE Substituted 2 with 3 : NO_COVERAGE removed call to java/io/File::canWrite : NO_COVERAGE negated conditional : NO_COVERAGE Substituted 3 with 4 : NO_COVERAGE Substituted 2 with 3 : NO_COVERAGE |
|
| 377 |
removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE removed call to java/io/File::getName : NO_COVERAGE |
|
| 379 |
removed call to java/io/IOException::<init> : NO_COVERAGE |