public static String cleanup(String s) { if (s == null) return null; return cleanup(s.getBytes(CDM.utf8Charset)); }
public static String cleanup(String s) { if (s == null) return null; return cleanup(s.getBytes(CDM.utf8Charset)); }
public static String cleanup(String s) { if (s == null) return null; return cleanup(s.getBytes(CDM.utf8Charset)); }
static public String cleanupHeader(byte[] raw) { String result = StringUtil2.cleanup(raw); int pos = result.indexOf("data"); if (pos > 0) result = result.substring(pos); return result; }
private boolean checkEnding(long ending) throws IOException { // check that end section = "7777" is correct raf.seek(ending - 4); for (int i = 0; i < 4; i++) { if (raf.read() != 55) { String clean = StringUtil2.cleanup(header); if (clean.length() > 40) clean = clean.substring(0, 40) + "..."; log.debug("Missing End of GRIB message at pos=" + ending + " header= " + clean + " for=" + raf.getLocation()); return false; } } return true; }
private List<Param> readTable2(Element table) { List<Param> result = new ArrayList<>(); Elements rows = table.select("tr"); for (Element row : rows) { Elements cols = row.select("td"); if (debug) { System.out.printf(" %d=", cols.size()); for (Element col : cols) System.out.printf("%s:", col.text()); System.out.printf("%n"); } if (cols.size() == 4) { String snum = StringUtil2.cleanup(cols.get(0).text()).trim(); try { int pnum = Integer.parseInt(snum); String desc = StringUtil2.cleanup(cols.get(1).text()).trim(); if (desc.startsWith("Reserved")) { System.out.printf("*** Skip Reserved %s%n", row.text()); continue; } result.add(new Param(pnum, desc, cols.get(2).text(), cols.get(3).text())); } catch (NumberFormatException e) { System.out.printf("*** Cant parse %s == %s%n", snum, row.text()); } } } return result; }
String snum = StringUtil2.cleanup(cols.get(0).text()).trim(); try { int pnum = Integer.parseInt(snum); String desc = StringUtil2.cleanup(cols.get(1).text()).trim(); String abbrev = StringUtil2.cleanup(cols.get(2).text()).trim(); if (desc.startsWith("Reserved")) { System.out.printf("*** Skip Reserved %s%n", row.text());
String snum = StringUtil2.cleanup(cols.get(0).text()).trim(); String desc = StringUtil2.cleanup(cols.get(1).text()).trim(); if (snum.contains("Reserved") || desc.contains("Reserved") || desc.contains("Missing") ) { if (debugParam) System.out.printf("*** Skip Reserved %s%n", row.text()); String snum = StringUtil2.cleanup(cols.get(0).text()).trim(); String desc = StringUtil2.cleanup(cols.get(1).text()).trim(); if (snum.contains("Reserved") || desc.contains("Reserved") || desc.contains("Missing") ) { if (debugParam) System.out.printf("*** Skip Reserved %s%n", row.text());
public void check(RandomAccessFile raf, Formatter f) throws IOException { long messLen = is.getMessageLength(); long startPos = is.getStartPos(); long endPos = is.getEndPos(); if (endPos > raf.length()) { f.format("End of GRIB message (start=%d len=%d) end=%d > file.length=%d for %s%n", startPos, messLen , endPos, raf.length(), raf.getLocation()); return; } raf.seek(endPos-4); for (int i = 0; i < 4; i++) { if (raf.read() != 55) { String clean = StringUtil2.cleanup(header); if (clean.length() > 40) clean = clean.substring(0,40) + "..."; f.format("Missing End of GRIB message (start=%d len=%d) end=%d header= %s for %s (len=%d)%n", startPos, messLen, endPos, clean, raf.getLocation(), raf.length()); break; } } long dataLen = dataSection.getMsgLength(); long dataStart = dataSection.getStartingPosition(); long dataEnd = dataStart + dataLen; if (dataEnd > raf.length()) { f.format("GRIB data section (start=%d len=%d) end=%d > file.length=%d for %s%n", dataStart, dataLen, dataEnd, raf.length(), raf.getLocation()); return; } if (dataEnd > endPos) { f.format("GRIB data section (start=%d len=%d) end=%d > message end=%d for %s%n", dataStart, dataLen, dataEnd, endPos, raf.getLocation()); } }
log.warn("BAD GRIB-1 data message at " + dataSection.getStartingPosition() + " header= " + StringUtil2.cleanup(header)+" for="+raf.getLocation()); throw new IllegalStateException("Illegal Grib1SectionBinaryData Message Length");
if (debug) System.out.printf(" REPEAT read until %d grib ending at %d header ='%s'%n", raf.getFilePointer(), ending, StringUtil2.cleanup(header)); for (int i = 0; i < 4; i++) { if (raf.read() != 55) { String clean = StringUtil2.cleanup(header); if (clean.length() > 40) clean = clean.substring(0,40) + "..."; log.warn(" REPEAT Missing End of GRIB message at pos=" + ending + " header= " + clean+" for="+raf.getLocation());