1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 /* 24 * Created on 2005 25 * by Christian Schmidt 26 */ 27 package com.sun.star.tooling.DirtyTags; 28 29 import java.io.BufferedReader; 30 import java.io.File; 31 import java.io.FileNotFoundException; 32 import java.io.FileReader; 33 import java.io.IOException; 34 35 36 37 public class DirtyTagWrapCheck { 38 static String line=""; main(String[] args)39 public static void main(String[] args) { 40 try { 41 File fi = new File("D:\\Testfiles\\KID_helpcontent.sdf");//Copy of 42 FileReader fr = new FileReader(fi); 43 BufferedReader br = new BufferedReader(fr); 44 45 int readCounter=0; 46 int missCounter=0; 47 int lineErrorCounter=0; 48 while((line=br.readLine())!=null){ 49 readCounter++; 50 String [] split = line.split("\t"); 51 if(split.length<15){ 52 53 lineErrorCounter++; 54 continue; 55 } 56 String string = split[10]; 57 String wrapped = DirtyTagWrapper.wrapString(string); 58 String unwrapped=DirtyTagWrapper.unwrapString(wrapped); 59 if(!string.equals(unwrapped)){ 60 61 missCounter++; 62 System.out.println(""+readCounter+"\n"+string+"\n"+unwrapped+"\n"+wrapped+"\n"); 63 } 64 } 65 System.out.println("Fertig "+readCounter+" "+missCounter+" "+lineErrorCounter); 66 } catch (FileNotFoundException e) { 67 // 68 e.printStackTrace(); 69 } catch (IOException e) { 70 // 71 e.printStackTrace(); 72 } catch (DirtyTagWrapper.TagWrapperException e) { 73 System.out.println(e.getMessage()+"\n"+line+"\n"); 74 75 } 76 77 } 78 } 79