bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
protected List createActionList(ValidatorResources resources, Form form) { List actionMethods = new ArrayList(); // Get List of actions for this Form for (Iterator i = form.getFields().iterator(); i.hasNext();) { Field field = (Field)i.next(); for (Iterator x = field.getDependencies().iterator(); x.hasNext();) { Object o = x.next(); if (o != null && !actionMethods.contains(o)) { actionMethods.add(o); } } } List actions = new ArrayList(); // Create list of ValidatorActions based on actionMethods for (Iterator i = actionMethods.iterator(); i.hasNext();) { String depends = (String) i.next(); ValidatorAction va = resources.getValidatorAction(depends); // throw nicer NPE for easier debugging if (va == null) { throw new NullPointerException( "Depends string \"" + depends + "\" was not found in validator-rules.xml."); } String javascript = va.getJavascript(); if (javascript != null && javascript.length() > 0) { actions.add(va); } else { i.remove(); } } //TODO? make an instance of this class a static member Comparator comp = new ValidatorActionComparator(); Collections.sort(actions, comp); return actions; }
protected List createActionList(ValidatorResources resources, Form form) { List actionMethods = new ArrayList(); // Get List of actions for this Form for (Iterator i = form.getFields().iterator(); i.hasNext();) { Field field = (Field)i.next(); for (Iterator x = field.getDependencyList().iterator(); x.hasNext();) { Object o = x.next(); if (o != null && !actionMethods.contains(o)) { actionMethods.add(o); } } } List actions = new ArrayList(); // Create list of ValidatorActions based on actionMethods for (Iterator i = actionMethods.iterator(); i.hasNext();) { String depends = (String) i.next(); ValidatorAction va = resources.getValidatorAction(depends); // throw nicer NPE for easier debugging if (va == null) { throw new NullPointerException( "Depends string \"" + depends + "\" was not found in validator-rules.xml."); } String javascript = va.getJavascript(); if (javascript != null && javascript.length() > 0) { actions.add(va); } else { i.remove(); } } //TODO? make an instance of this class a static member Comparator comp = new ValidatorActionComparator(); Collections.sort(actions, comp); return actions; }
1,115,120
public void init(Object obj) { if (!(obj instanceof ViewContext)) { throw new IllegalArgumentException( "Tool can only be initialized with a ViewContext"); } this.context = (ViewContext)obj; this.request = context.getRequest(); this.session = request.getSession(false); this.app = context.getServletContext(); Boolean b = (Boolean)context.getAttribute(ViewContext.XHTML); if (b != null) { this.xhtml = b.booleanValue(); } /* Is there a mapping associated with this request? */ ActionConfig config = (ActionConfig)request.getAttribute(Globals.MAPPING_KEY); if (config != null) { /* Is there a form bean associated with this mapping? */ this.formName = config.getAttribute(); } ModuleConfig mconfig = RequestUtils.getModuleConfig(request, app); this.resources = (ValidatorResources)app.getAttribute(ValidatorPlugIn. VALIDATOR_KEY + mconfig.getPrefix()); }
public void init(Object obj) { if (!(obj instanceof ViewContext)) { throw new IllegalArgumentException( "Tool can only be initialized with a ViewContext"); } this.context = (ViewContext)obj; this.request = context.getRequest(); this.session = request.getSession(false); this.app = context.getServletContext(); Boolean b = (Boolean)context.getAttribute(ViewContext.XHTML); if (b != null) { this.xhtml = b.booleanValue(); } /* Is there a mapping associated with this request? */ ActionConfig config = (ActionConfig)request.getAttribute(Globals.MAPPING_KEY); if (config != null) { /* Is there a form bean associated with this mapping? */ this.formName = config.getAttribute(); } ModuleConfig mconfig = ModuleUtils.getInstance().getModuleConfig(request, app); this.resources = (ValidatorResources)app.getAttribute(ValidatorPlugIn. VALIDATOR_KEY + mconfig.getPrefix()); }
1,115,121
final void setParameter(final String name, final byte[] value) { parameters.add(new Parameter(name, byte[].class, value)); }
public final void setParameter(final String name, final byte[] value) { parameters.add(new Parameter(name, byte[].class, value)); }
1,115,122
private void setIcon() { switch(systemApplication.getConnection()) { case OFFLINE: systemTrayIcon.setIcon(Icons.Tray.TRAY_ICON_OFFLINE); break; case ONLINE: systemTrayIcon.setIcon(Icons.Tray.TRAY_ICON_ONLINE); default: throw Assert.createUnreachable("[UNKNOWN CONNECTION]"); } }
private void setIcon() { switch(systemApplication.getConnection()) { case OFFLINE: systemTrayIcon.setIcon(Icons.Tray.TRAY_ICON_OFFLINE); break; case ONLINE: systemTrayIcon.setIcon(Icons.Tray.TRAY_ICON_ONLINE); default: throw Assert.createUnreachable("Unknown connection."); } }
1,115,123
public static void notmain(String[] args) throws Exception { if(debug) verbose = true; parseArgs(args); printlnVerbose("Processing: " + dmgFile); RandomAccessFile dmgRaf = new RandomAccessFile(dmgFile, "r"); RandomAccessFile isoRaf = null; boolean testOnly = false; if(isoFile != null) { isoRaf = new RandomAccessFile(isoFile, "rw"); isoRaf.setLength(0); printlnVerbose("Extracting to: " + isoFile); } else { testOnly = true; printlnVerbose("Simulating extraction..."); } dmgRaf.seek(dmgRaf.length()-PLIST_ADDRESS_1); long plistBegin1 = dmgRaf.readLong(); long plistEnd = dmgRaf.readLong(); dmgRaf.seek(dmgRaf.length()-PLIST_ADDRESS_2); long plistBegin2 = dmgRaf.readLong(); long plistSize = dmgRaf.readLong(); if(debug) { println("Read addresses:", " " + plistBegin1, " " + plistBegin2); } if(plistBegin1 != plistBegin2) { println("ERROR: Addresses not equal! Assumption false.", plistBegin1 + " != " + plistBegin2); System.exit(0); } if(false && plistSize != (plistEnd-plistBegin1)) { // This assumption is proven false. plistEnd is not interpreted correctly println("NOTE: plistSize field does not match plistEnd marker. Assumption false.", "plistSize=" + plistSize + " plistBegin1=" + plistBegin1 + " plistEnd=" + plistEnd + " plistEnd-plistBegin1=" + (plistEnd-plistBegin1)); } printlnVerbose("Jumping to address..."); dmgRaf.seek(plistBegin1); byte[] buffer = new byte[(int)plistSize]; dmgRaf.read(buffer); InputStream is = new ByteArrayInputStream(buffer); NodeBuilder handler = new NodeBuilder(); SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); try {// System.out.println("validation: " + saxParser.getProperty("validation"));// System.out.println("external-general-entities: " + saxParser.getProperty("external-general-entities"));// System.out.println("external-parameter-entities: " + saxParser.getProperty("external-parameter-entities"));// System.out.println("is-standalone: " + saxParser.getProperty("is-standalone"));// System.out.println("lexical-handler: " + saxParser.getProperty("lexical-handler"));// System.out.println("parameter-entities: " + saxParser.getProperty("parameter-entities"));// System.out.println("namespaces: " + saxParser.getProperty("namespaces"));// System.out.println("namespace-prefixes: " + saxParser.getProperty("namespace-prefixes"));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty("")); //System.out.println("isValidating: " + saxParser.isValidating()); saxParser.parse(is, handler); } catch(SAXException se) { se.printStackTrace(); System.err.println("Could not read the partition list... exiting."); System.exit(1); } XMLNode[] rootNodes = handler.getRoots(); if(rootNodes.length != 1) { println("Could not parse DMG-file!"); System.exit(0); } /* Ok, now we have a tree built from the XML-document. Let's walk to the right place. */ /* cd plist cd dict cdkey resource-fork (type:dict) cdkey blkx (type:array) */ XMLNode current; XMLElement[] children; boolean keyFound; current = rootNodes[0]; //We are at plist... probably (there should be only one root node) current = current.cd("dict"); current = current.cdkey("resource-fork"); current = current.cdkey("blkx"); printlnVerbose("Found " + current.getChildren().length + " partitions:"); byte[] inBuffer = new byte[0x40000]; byte[] outBuffer = new byte[0x40000]; byte[] zeroblock = new byte[4096]; /* I think java always zeroes its arrays on creation... but let's play safe. */ for(int y = 0; y < zeroblock.length; ++y) zeroblock[y] = 0; LinkedList<DMGBlock> blocks = new LinkedList<DMGBlock>(); long elementNumber = 0; //long lastOffs = 0; long lastOutOffset = 0; long lastInOffset = 0; long totalSize = 0; int errorsReported = 0; int warningsReported = 0; reportProgress(0); for(XMLElement xe : current.getChildren()) { if(progmon != null && progmon.isCanceled()) System.exit(0); if(xe instanceof XMLNode) { XMLNode xn = (XMLNode)xe; byte[] data = Base64.decode(xn.getKeyValue("Data")); long partitionSize = calculatePartitionSize(data); totalSize += partitionSize; printlnVerbose(" " + xn.getKeyValue("Name")); printlnVerbose(" ID: " + xn.getKeyValue("ID")); printlnVerbose(" Attributes: " + xn.getKeyValue("Attributes")); printlnVerbose(" Partition map data length: " + data.length + " bytes"); printlnVerbose(" Partition size: " + partitionSize + " bytes"); if(debug) { File dumpFile = new File("data(" + xn.getKeyValue("ID") + ").bin"); println(" Dumping partition map to file: " + dumpFile); FileOutputStream dump = new FileOutputStream(dumpFile); dump.write(data); dump.close(); } int offset = 0xCC; int blockType = 0; /* Offset of the input data for the current block in the input file */ long inOffset = 0; /* Size of the input data for the current block */ long inSize = 0; /* Offset of the output data for the current block in the output file */ long outOffset = 0; /* Size of the output data (possibly larger than inSize because of decompression, zero expansion...) */ long outSize = 0; long lastByteReadInBlock = -1; boolean addInOffset = false; //, lastInOffs = 0; int blockCount = 0; while(blockType != BT_END) { if(progmon != null && progmon.isCanceled()) System.exit(0); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); int bytesSkipped = 0; while(bytesSkipped < offset) bytesSkipped += dis.skipBytes(offset-bytesSkipped); blockType = dis.readInt(); int skipped = dis.readInt(); //Skip 4 bytes forward outOffset = dis.readLong()*0x200;//(dis.readInt() & 0xffffffffL)*0x200; //unsigned int -> long //dis.readInt(); //Skip 4 bytes forward outSize = dis.readLong()*0x200;//(dis.readInt() & 0xffffffffL)*0x200; //unsigned int -> long inOffset = dis.readLong();// & 0xffffffffL; //unsigned int -> long //dis.readInt(); //Skip 4 bytes forward inSize = dis.readLong();//dis.readInt() & 0xffffffffL; //unsigned int -> long String blockTypeString = blockTypeToString(blockType); if(debug) println(" " + elementNumber + ":" + blockCount + ". " + blockTypeString + " processing..."); if(lastByteReadInBlock == -1) lastByteReadInBlock = inOffset; lastByteReadInBlock += inSize; /* The lines below are a "hack" that I had to do to make dmgx work with certain dmg-files. I don't understand the issue at all, which is why this hack is here, but sometimes inOffset == 0 means that it is 0 relative to the previous partition's last inOffset. And sometimes it doesn't (meaning the actual position 0 in the dmg file). */ if(addInOffset) { if(debug) println("------->NOTE: addInOffset mode: inOffset tranformation " + inOffset + "->" + (inOffset+lastInOffset)); inOffset += lastInOffset; } else if(inOffset == 0 && blockCount == 0) { if(debug) println("------->NOTE: Detected inOffset == 0, setting to " + lastInOffset); addInOffset = true; inOffset = lastInOffset; } outOffset += lastOutOffset; DMGBlock currentBlock = new DMGBlock(blockType, skipped, outOffset, outSize, inOffset, inSize); blocks.add(currentBlock); if(debug) { println(" outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset, " inSize=" + inSize + " lastOutOffset=" + lastOutOffset + " lastInOffset=" + lastInOffset /*+ " lastInOffs=" + lastInOffs + " lastOffs=" + lastOffs*/); } if(blockType == BT_ADC) { println("!------>ERROR: BT_ADC not supported."); ++errorsReported; if(!testOnly) System.exit(0); } else if(blockType == BT_ZLIB) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZLIB processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) println("!------>WARNING: BT_ZLIB FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); try { DMGBlockHandlers.processZlibBlock(currentBlock, dmgRaf, isoRaf, testOnly, dummyMonitor); } catch(DataFormatException dfe) { println("!------>ERROR: BT_ZLIB Could not decode..."); ++errorsReported; if(!debug) { println("!------> outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset + " inSize=" + inSize + " lastOutOffset=" + lastOutOffset + " lastInOffset=" + lastInOffset); } dfe.printStackTrace(); if(!testOnly) System.exit(0); else { println("!------> Testing mode, so continuing..."); //System.exit(0); break; } } } else if(blockType == BT_BZIP2) { println("!------>ERROR: BT_BZIP2 not currently supported."); ++errorsReported; if(!testOnly) System.exit(0); } else if(blockType == BT_COPY) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_COPY processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_COPY FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } dmgRaf.seek(/*lastOffs+*/inOffset); int bytesRead = dmgRaf.read(inBuffer, 0, Math.min((int)inSize, inBuffer.length)); long totalBytesRead = bytesRead; while(bytesRead != -1) { reportFilePointerProgress(dmgRaf); if(!testOnly) isoRaf.write(inBuffer, 0, bytesRead); if(totalBytesRead >= inSize) break; bytesRead = dmgRaf.read(inBuffer, 0, Math.min((int)(inSize-totalBytesRead), inBuffer.length)); if(bytesRead > 0) totalBytesRead += bytesRead; } //lastInOffs = inOffset+inSize; } else if(blockType == BT_ZERO) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZERO processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_ZERO FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } reportFilePointerProgress(dmgRaf); long numberOfZeroBlocks = outSize/zeroblock.length; int numberOfRemainingBytes = (int)(outSize%zeroblock.length); for(int j = 0; j < numberOfZeroBlocks; ++j) { if(!testOnly) isoRaf.write(zeroblock); } if(!testOnly) isoRaf.write(zeroblock, 0, numberOfRemainingBytes); //lastInOffs = inOffset+inSize; } else if(blockType == BT_ZERO2) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZERO2 processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_ZERO2 FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } reportFilePointerProgress(dmgRaf); long numberOfZeroBlocks = outSize/zeroblock.length; int numberOfRemainingBytes = (int)(outSize%zeroblock.length); for(int j = 0; j < numberOfZeroBlocks; ++j) { if(!testOnly) isoRaf.write(zeroblock); } if(!testOnly) isoRaf.write(zeroblock, 0, numberOfRemainingBytes); //lastInOffs = inOffset+inSize; } else if(blockType == BT_UNKNOWN) { /* I have no idea what this blocktype is... but it's common, and usually doesn't appear more than 2-3 times in a dmg. As long as its input and output sizes are 0, there's no reason to complain... is there? */// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_UNKNOWN processing..."); if(!(inSize == 0 && outSize == 0)) { println("!------>WARNING: Blocktype BT_UNKNOWN had non-zero sizes...", "!------> inSize=" + inSize + ", outSize=" + outSize); ++warningsReported; //println(" The author of the program would be pleased if you contacted him about this."); // ...or would I? } } else if(blockType == BT_END) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_END processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_END FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } //lastOffs += lastInOffs; lastOutOffset = outOffset; lastInOffset += lastByteReadInBlock; } else { println("!------>WARNING: previously unseen blocktype " + blockType + " [0x" + Integer.toHexString(blockType) + "]", "!------> outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset + " inSize=" + inSize); ++warningsReported; if(!testOnly && isoRaf.getFilePointer() != outOffset) println("!------>WARNING: unknown blocktype FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); } offset += 0x28; ++blockCount; } } ++elementNumber; } //printlnVerbose("Progress: 100% Done!"); reportProgress(100); String summary = (errorsReported != 0)?errorsReported+" errors reported":"No errors reported"; summary += (warningsReported != 0)?" ("+warningsReported+" warnings emitted).":"."; if(!graphical) { newline(); println(summary); printlnVerbose("Total extracted bytes: " + totalSize + " B"); } else { progmon.close(); JOptionPane.showMessageDialog(null, "Extraction complete! " + summary + "\n" + "Total extracted bytes: " + totalSize + " B", "Information", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } if(!debug) { if(isoRaf != null) isoRaf.close(); dmgRaf.close(); } else { if(isoRaf != null) isoRaf.close();// System.out.println("blocks.size()=" + blocks.size());// for(DMGBlock b : blocks)// System.out.println(" " + b.toString()); LinkedList<DMGBlock> merged = mergeBlocks(blocks);// System.out.println("merged.size()=" + merged.size());// for(DMGBlock b : merged)// System.out.println(" " + b.toString()); println("Extracting all the parts not containing block data from source file:"); int i = 1; DMGBlock previous = null; for(DMGBlock b : merged) { if(previous == null && b.inOffset > 0) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(0); byte[] data = new byte[(int)(b.inOffset)]; dmgRaf.read(data); curFos.write(data); curFos.close(); } else if(previous != null) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(previous.inOffset+previous.inSize); byte[] data = new byte[(int)(b.inOffset-(previous.inOffset+previous.inSize))]; dmgRaf.read(data); curFos.write(data); curFos.close(); } previous = b; } if(previous.inOffset+previous.inSize != dmgRaf.length()) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(previous.inOffset+previous.inSize); byte[] data = new byte[(int)(dmgRaf.length()-(previous.inOffset+previous.inSize))]; dmgRaf.read(data); curFos.write(data); curFos.close(); } dmgRaf.close(); System.out.println("done!"); } }
public static void notmain(String[] args) throws Exception { if(debug) verbose = true; parseArgs(args); printlnVerbose("Processing: " + dmgFile); RandomAccessFile dmgRaf = new RandomAccessFile(dmgFile, "r"); RandomAccessFile isoRaf = null; boolean testOnly = false; if(isoFile != null) { isoRaf = new RandomAccessFile(isoFile, "rw"); isoRaf.setLength(0); printlnVerbose("Extracting to: " + isoFile); } else { testOnly = true; printlnVerbose("Simulating extraction..."); } dmgRaf.seek(dmgRaf.length()-PLIST_ADDRESS_1); long plistBegin1 = dmgRaf.readLong(); long plistEnd = dmgRaf.readLong(); dmgRaf.seek(dmgRaf.length()-PLIST_ADDRESS_2); long plistBegin2 = dmgRaf.readLong(); long plistSize = dmgRaf.readLong(); if(debug) { println("Read addresses:", " " + plistBegin1, " " + plistBegin2); } if(plistBegin1 != plistBegin2) { println("ERROR: Addresses not equal! Assumption false.", plistBegin1 + " != " + plistBegin2); System.exit(0); } if(false && plistSize != (plistEnd-plistBegin1)) { // This assumption is proven false. plistEnd is not interpreted correctly println("NOTE: plistSize field does not match plistEnd marker. Assumption false.", "plistSize=" + plistSize + " plistBegin1=" + plistBegin1 + " plistEnd=" + plistEnd + " plistEnd-plistBegin1=" + (plistEnd-plistBegin1)); } printlnVerbose("Jumping to address..."); dmgRaf.seek(plistBegin1); byte[] buffer = new byte[(int)plistSize]; dmgRaf.read(buffer); InputStream is = new ByteArrayInputStream(buffer); NodeBuilder handler = new NodeBuilder(); SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); try {// System.out.println("validation: " + saxParser.getProperty("validation"));// System.out.println("external-general-entities: " + saxParser.getProperty("external-general-entities"));// System.out.println("external-parameter-entities: " + saxParser.getProperty("external-parameter-entities"));// System.out.println("is-standalone: " + saxParser.getProperty("is-standalone"));// System.out.println("lexical-handler: " + saxParser.getProperty("lexical-handler"));// System.out.println("parameter-entities: " + saxParser.getProperty("parameter-entities"));// System.out.println("namespaces: " + saxParser.getProperty("namespaces"));// System.out.println("namespace-prefixes: " + saxParser.getProperty("namespace-prefixes"));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty("")); //System.out.println("isValidating: " + saxParser.isValidating()); saxParser.parse(is, handler); } catch(SAXException se) { se.printStackTrace(); System.err.println("Could not read the partition list... exiting."); System.exit(1); } XMLNode[] rootNodes = handler.getRoots(); if(rootNodes.length != 1) { println("Could not parse DMG-file!"); System.exit(0); } /* Ok, now we have a tree built from the XML-document. Let's walk to the right place. */ /* cd plist cd dict cdkey resource-fork (type:dict) cdkey blkx (type:array) */ XMLNode current; XMLElement[] children; boolean keyFound; current = rootNodes[0]; //We are at plist... probably (there should be only one root node) current = current.cd("dict"); current = current.cdkey("resource-fork"); current = current.cdkey("blkx"); printlnVerbose("Found " + current.getChildren().length + " partitions:"); byte[] inBuffer = new byte[0x40000]; byte[] outBuffer = new byte[0x40000]; byte[] zeroblock = new byte[4096]; /* I think java always zeroes its arrays on creation... but let's play safe. */ for(int y = 0; y < zeroblock.length; ++y) zeroblock[y] = 0; LinkedList<DMGBlock> blocks = new LinkedList<DMGBlock>(); long elementNumber = 0; //long lastOffs = 0; long lastOutOffset = 0; long lastInOffset = 0; long totalSize = 0; int errorsReported = 0; int warningsReported = 0; reportProgress(0); for(XMLElement xe : current.getChildren()) { if(progmon != null && progmon.isCanceled()) System.exit(0); if(xe instanceof XMLNode) { XMLNode xn = (XMLNode)xe; byte[] data = Base64.decode(xn.getKeyValue("Data")); long partitionSize = calculatePartitionSize(data); totalSize += partitionSize; printlnVerbose(" " + xn.getKeyValue("Name")); printlnVerbose(" ID: " + xn.getKeyValue("ID")); printlnVerbose(" Attributes: " + xn.getKeyValue("Attributes")); printlnVerbose(" Partition map data length: " + data.length + " bytes"); printlnVerbose(" Partition size: " + partitionSize + " bytes"); if(debug) { File dumpFile = new File("data(" + xn.getKeyValue("ID") + ").bin"); println(" Dumping partition map to file: " + dumpFile); FileOutputStream dump = new FileOutputStream(dumpFile); dump.write(data); dump.close(); } int offset = 0xCC; int blockType = 0; /* Offset of the input data for the current block in the input file */ long inOffset = 0; /* Size of the input data for the current block */ long inSize = 0; /* Offset of the output data for the current block in the output file */ long outOffset = 0; /* Size of the output data (possibly larger than inSize because of decompression, zero expansion...) */ long outSize = 0; long lastByteReadInBlock = -1; boolean addInOffset = false; //, lastInOffs = 0; int blockCount = 0; while(blockType != BT_END) { if(progmon != null && progmon.isCanceled()) System.exit(0); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); int bytesSkipped = 0; while(bytesSkipped < offset) bytesSkipped += dis.skipBytes(offset-bytesSkipped); blockType = dis.readInt(); int skipped = dis.readInt(); //Skip 4 bytes forward outOffset = dis.readLong()*0x200;//(dis.readInt() & 0xffffffffL)*0x200; //unsigned int -> long //dis.readInt(); //Skip 4 bytes forward outSize = dis.readLong()*0x200;//(dis.readInt() & 0xffffffffL)*0x200; //unsigned int -> long inOffset = dis.readLong();// & 0xffffffffL; //unsigned int -> long //dis.readInt(); //Skip 4 bytes forward inSize = dis.readLong();//dis.readInt() & 0xffffffffL; //unsigned int -> long String blockTypeString = blockTypeToString(blockType); if(debug) println(" " + elementNumber + ":" + blockCount + ". " + blockTypeString + " processing..."); if(lastByteReadInBlock == -1) lastByteReadInBlock = inOffset; lastByteReadInBlock += inSize; /* The lines below are a "hack" that I had to do to make dmgx work with certain dmg-files. I don't understand the issue at all, which is why this hack is here, but sometimes inOffset == 0 means that it is 0 relative to the previous partition's last inOffset. And sometimes it doesn't (meaning the actual position 0 in the dmg file). */ if(addInOffset) { if(debug) println("------->NOTE: addInOffset mode: inOffset tranformation " + inOffset + "->" + (inOffset+lastInOffset)); inOffset += lastInOffset; } else if(inOffset == 0 && blockCount == 0) { if(debug) println("------->NOTE: Detected inOffset == 0, setting to " + lastInOffset); addInOffset = true; inOffset = lastInOffset; } outOffset += lastOutOffset; DMGBlock currentBlock = new DMGBlock(blockType, skipped, outOffset, outSize, inOffset, inSize); blocks.add(currentBlock); if(debug) { println(" outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset, " inSize=" + inSize + " lastOutOffset=" + lastOutOffset + " lastInOffset=" + lastInOffset /*+ " lastInOffs=" + lastInOffs + " lastOffs=" + lastOffs*/); } if(blockType == BT_ADC) { println("!------>ERROR: BT_ADC not supported."); ++errorsReported; if(!testOnly) System.exit(0); } else if(blockType == BT_ZLIB) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZLIB processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) println("!------>WARNING: BT_ZLIB FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); try { DMGBlockHandlers.processZlibBlock(currentBlock, dmgRaf, isoRaf, testOnly, dummyMonitor); } catch(DataFormatException dfe) { println("!------>ERROR: BT_ZLIB Could not decode..."); ++errorsReported; if(!debug) { println("!------> outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset + " inSize=" + inSize + " lastOutOffset=" + lastOutOffset + " lastInOffset=" + lastInOffset); } dfe.printStackTrace(); if(!testOnly) System.exit(0); else { println("!------> Testing mode, so continuing..."); //System.exit(0); break; } } } else if(blockType == BT_BZIP2) { println("!------>ERROR: BT_BZIP2 not currently supported."); ++errorsReported; if(!testOnly) System.exit(0); } else if(blockType == BT_COPY) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_COPY processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_COPY FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } dmgRaf.seek(/*lastOffs+*/inOffset); int bytesRead = dmgRaf.read(inBuffer, 0, Math.min((int)inSize, inBuffer.length)); long totalBytesRead = bytesRead; while(bytesRead != -1) { reportFilePointerProgress(dmgRaf); if(!testOnly) isoRaf.write(inBuffer, 0, bytesRead); if(totalBytesRead >= inSize) break; bytesRead = dmgRaf.read(inBuffer, 0, Math.min((int)(inSize-totalBytesRead), inBuffer.length)); if(bytesRead > 0) totalBytesRead += bytesRead; } //lastInOffs = inOffset+inSize; } else if(blockType == BT_ZERO) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZERO processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_ZERO FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } reportFilePointerProgress(dmgRaf); long numberOfZeroBlocks = outSize/zeroblock.length; int numberOfRemainingBytes = (int)(outSize%zeroblock.length); for(int j = 0; j < numberOfZeroBlocks; ++j) { if(!testOnly) isoRaf.write(zeroblock); } if(!testOnly) isoRaf.write(zeroblock, 0, numberOfRemainingBytes); //lastInOffs = inOffset+inSize; } else if(blockType == BT_ZERO2) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZERO2 processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_ZERO2 FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } reportFilePointerProgress(dmgRaf); long numberOfZeroBlocks = outSize/zeroblock.length; int numberOfRemainingBytes = (int)(outSize%zeroblock.length); for(int j = 0; j < numberOfZeroBlocks; ++j) { if(!testOnly) isoRaf.write(zeroblock); } if(!testOnly) isoRaf.write(zeroblock, 0, numberOfRemainingBytes); //lastInOffs = inOffset+inSize; } else if(blockType == BT_UNKNOWN) { /* I have no idea what this blocktype is... but it's common, and usually doesn't appear more than 2-3 times in a dmg. As long as its input and output sizes are 0, there's no reason to complain... is there? */// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_UNKNOWN processing..."); if(!(inSize == 0 && outSize == 0)) { println("!------>WARNING: Blocktype BT_UNKNOWN had non-zero sizes...", "!------> inSize=" + inSize + ", outSize=" + outSize); ++warningsReported; //println(" The author of the program would be pleased if you contacted him about this."); // ...or would I? } } else if(blockType == BT_END) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_END processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_END FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } //lastOffs += lastInOffs; lastOutOffset = outOffset; lastInOffset += lastByteReadInBlock; } else { println("!------>WARNING: previously unseen blocktype " + blockType + " [0x" + Integer.toHexString(blockType) + "]", "!------> outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset + " inSize=" + inSize); ++warningsReported; if(!testOnly && isoRaf.getFilePointer() != outOffset) println("!------>WARNING: unknown blocktype FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); } offset += 0x28; ++blockCount; } } ++elementNumber; } //printlnVerbose("Progress: 100% Done!"); reportProgress(100); String summary = (errorsReported != 0)?errorsReported+" errors reported":"No errors reported"; summary += (warningsReported != 0)?" ("+warningsReported+" warnings emitted).":"."; if(!graphical) { newline(); println(summary); printlnVerbose("Total extracted bytes: " + totalSize + " B"); } else { progmon.close(); JOptionPane.showMessageDialog(null, "Extraction complete! " + summary + "\n" + "Total extracted bytes: " + totalSize + " B", "Information", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } if(!debug) { if(isoRaf != null) isoRaf.close(); dmgRaf.close(); } else { if(isoRaf != null) isoRaf.close();// System.out.println("blocks.size()=" + blocks.size());// for(DMGBlock b : blocks)// System.out.println(" " + b.toString()); LinkedList<DMGBlock> merged = mergeBlocks(blocks);// System.out.println("merged.size()=" + merged.size());// for(DMGBlock b : merged)// System.out.println(" " + b.toString()); println("Extracting all the parts not containing block data from source file:"); int i = 1; DMGBlock previous = null; for(DMGBlock b : merged) { if(previous == null && b.inOffset > 0) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(0); byte[] data = new byte[(int)(b.inOffset)]; dmgRaf.read(data); curFos.write(data); curFos.close(); } else if(previous != null) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(previous.inOffset+previous.inSize); byte[] data = new byte[(int)(b.inOffset-(previous.inOffset+previous.inSize))]; dmgRaf.read(data); curFos.write(data); curFos.close(); } previous = b; } if(previous.inOffset+previous.inSize != dmgRaf.length()) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(previous.inOffset+previous.inSize); byte[] data = new byte[(int)(dmgRaf.length()-(previous.inOffset+previous.inSize))]; dmgRaf.read(data); curFos.write(data); curFos.close(); } dmgRaf.close(); System.out.println("done!"); } }
1,115,124
public static void notmain(String[] args) throws Exception { if(debug) verbose = true; parseArgs(args); printlnVerbose("Processing: " + dmgFile); RandomAccessFile dmgRaf = new RandomAccessFile(dmgFile, "r"); RandomAccessFile isoRaf = null; boolean testOnly = false; if(isoFile != null) { isoRaf = new RandomAccessFile(isoFile, "rw"); isoRaf.setLength(0); printlnVerbose("Extracting to: " + isoFile); } else { testOnly = true; printlnVerbose("Simulating extraction..."); } dmgRaf.seek(dmgRaf.length()-PLIST_ADDRESS_1); long plistBegin1 = dmgRaf.readLong(); long plistEnd = dmgRaf.readLong(); dmgRaf.seek(dmgRaf.length()-PLIST_ADDRESS_2); long plistBegin2 = dmgRaf.readLong(); long plistSize = dmgRaf.readLong(); if(debug) { println("Read addresses:", " " + plistBegin1, " " + plistBegin2); } if(plistBegin1 != plistBegin2) { println("ERROR: Addresses not equal! Assumption false.", plistBegin1 + " != " + plistBegin2); System.exit(0); } if(false && plistSize != (plistEnd-plistBegin1)) { // This assumption is proven false. plistEnd is not interpreted correctly println("NOTE: plistSize field does not match plistEnd marker. Assumption false.", "plistSize=" + plistSize + " plistBegin1=" + plistBegin1 + " plistEnd=" + plistEnd + " plistEnd-plistBegin1=" + (plistEnd-plistBegin1)); } printlnVerbose("Jumping to address..."); dmgRaf.seek(plistBegin1); byte[] buffer = new byte[(int)plistSize]; dmgRaf.read(buffer); InputStream is = new ByteArrayInputStream(buffer); NodeBuilder handler = new NodeBuilder(); SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); try {// System.out.println("validation: " + saxParser.getProperty("validation"));// System.out.println("external-general-entities: " + saxParser.getProperty("external-general-entities"));// System.out.println("external-parameter-entities: " + saxParser.getProperty("external-parameter-entities"));// System.out.println("is-standalone: " + saxParser.getProperty("is-standalone"));// System.out.println("lexical-handler: " + saxParser.getProperty("lexical-handler"));// System.out.println("parameter-entities: " + saxParser.getProperty("parameter-entities"));// System.out.println("namespaces: " + saxParser.getProperty("namespaces"));// System.out.println("namespace-prefixes: " + saxParser.getProperty("namespace-prefixes"));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty("")); //System.out.println("isValidating: " + saxParser.isValidating()); saxParser.parse(is, handler); } catch(SAXException se) { se.printStackTrace(); System.err.println("Could not read the partition list... exiting."); System.exit(1); } XMLNode[] rootNodes = handler.getRoots(); if(rootNodes.length != 1) { println("Could not parse DMG-file!"); System.exit(0); } /* Ok, now we have a tree built from the XML-document. Let's walk to the right place. */ /* cd plist cd dict cdkey resource-fork (type:dict) cdkey blkx (type:array) */ XMLNode current; XMLElement[] children; boolean keyFound; current = rootNodes[0]; //We are at plist... probably (there should be only one root node) current = current.cd("dict"); current = current.cdkey("resource-fork"); current = current.cdkey("blkx"); printlnVerbose("Found " + current.getChildren().length + " partitions:"); byte[] inBuffer = new byte[0x40000]; byte[] outBuffer = new byte[0x40000]; byte[] zeroblock = new byte[4096]; /* I think java always zeroes its arrays on creation... but let's play safe. */ for(int y = 0; y < zeroblock.length; ++y) zeroblock[y] = 0; LinkedList<DMGBlock> blocks = new LinkedList<DMGBlock>(); long elementNumber = 0; //long lastOffs = 0; long lastOutOffset = 0; long lastInOffset = 0; long totalSize = 0; int errorsReported = 0; int warningsReported = 0; reportProgress(0); for(XMLElement xe : current.getChildren()) { if(progmon != null && progmon.isCanceled()) System.exit(0); if(xe instanceof XMLNode) { XMLNode xn = (XMLNode)xe; byte[] data = Base64.decode(xn.getKeyValue("Data")); long partitionSize = calculatePartitionSize(data); totalSize += partitionSize; printlnVerbose(" " + xn.getKeyValue("Name")); printlnVerbose(" ID: " + xn.getKeyValue("ID")); printlnVerbose(" Attributes: " + xn.getKeyValue("Attributes")); printlnVerbose(" Partition map data length: " + data.length + " bytes"); printlnVerbose(" Partition size: " + partitionSize + " bytes"); if(debug) { File dumpFile = new File("data(" + xn.getKeyValue("ID") + ").bin"); println(" Dumping partition map to file: " + dumpFile); FileOutputStream dump = new FileOutputStream(dumpFile); dump.write(data); dump.close(); } int offset = 0xCC; int blockType = 0; /* Offset of the input data for the current block in the input file */ long inOffset = 0; /* Size of the input data for the current block */ long inSize = 0; /* Offset of the output data for the current block in the output file */ long outOffset = 0; /* Size of the output data (possibly larger than inSize because of decompression, zero expansion...) */ long outSize = 0; long lastByteReadInBlock = -1; boolean addInOffset = false; //, lastInOffs = 0; int blockCount = 0; while(blockType != BT_END) { if(progmon != null && progmon.isCanceled()) System.exit(0); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); int bytesSkipped = 0; while(bytesSkipped < offset) bytesSkipped += dis.skipBytes(offset-bytesSkipped); blockType = dis.readInt(); int skipped = dis.readInt(); //Skip 4 bytes forward outOffset = dis.readLong()*0x200;//(dis.readInt() & 0xffffffffL)*0x200; //unsigned int -> long //dis.readInt(); //Skip 4 bytes forward outSize = dis.readLong()*0x200;//(dis.readInt() & 0xffffffffL)*0x200; //unsigned int -> long inOffset = dis.readLong();// & 0xffffffffL; //unsigned int -> long //dis.readInt(); //Skip 4 bytes forward inSize = dis.readLong();//dis.readInt() & 0xffffffffL; //unsigned int -> long String blockTypeString = blockTypeToString(blockType); if(debug) println(" " + elementNumber + ":" + blockCount + ". " + blockTypeString + " processing..."); if(lastByteReadInBlock == -1) lastByteReadInBlock = inOffset; lastByteReadInBlock += inSize; /* The lines below are a "hack" that I had to do to make dmgx work with certain dmg-files. I don't understand the issue at all, which is why this hack is here, but sometimes inOffset == 0 means that it is 0 relative to the previous partition's last inOffset. And sometimes it doesn't (meaning the actual position 0 in the dmg file). */ if(addInOffset) { if(debug) println("------->NOTE: addInOffset mode: inOffset tranformation " + inOffset + "->" + (inOffset+lastInOffset)); inOffset += lastInOffset; } else if(inOffset == 0 && blockCount == 0) { if(debug) println("------->NOTE: Detected inOffset == 0, setting to " + lastInOffset); addInOffset = true; inOffset = lastInOffset; } outOffset += lastOutOffset; DMGBlock currentBlock = new DMGBlock(blockType, skipped, outOffset, outSize, inOffset, inSize); blocks.add(currentBlock); if(debug) { println(" outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset, " inSize=" + inSize + " lastOutOffset=" + lastOutOffset + " lastInOffset=" + lastInOffset /*+ " lastInOffs=" + lastInOffs + " lastOffs=" + lastOffs*/); } if(blockType == BT_ADC) { println("!------>ERROR: BT_ADC not supported."); ++errorsReported; if(!testOnly) System.exit(0); } else if(blockType == BT_ZLIB) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZLIB processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) println("!------>WARNING: BT_ZLIB FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); try { DMGBlockHandlers.processZlibBlock(currentBlock, dmgRaf, isoRaf, testOnly, dummyMonitor); } catch(DataFormatException dfe) { println("!------>ERROR: BT_ZLIB Could not decode..."); ++errorsReported; if(!debug) { println("!------> outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset + " inSize=" + inSize + " lastOutOffset=" + lastOutOffset + " lastInOffset=" + lastInOffset); } dfe.printStackTrace(); if(!testOnly) System.exit(0); else { println("!------> Testing mode, so continuing..."); //System.exit(0); break; } } } else if(blockType == BT_BZIP2) { println("!------>ERROR: BT_BZIP2 not currently supported."); ++errorsReported; if(!testOnly) System.exit(0); } else if(blockType == BT_COPY) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_COPY processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_COPY FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } dmgRaf.seek(/*lastOffs+*/inOffset); int bytesRead = dmgRaf.read(inBuffer, 0, Math.min((int)inSize, inBuffer.length)); long totalBytesRead = bytesRead; while(bytesRead != -1) { reportFilePointerProgress(dmgRaf); if(!testOnly) isoRaf.write(inBuffer, 0, bytesRead); if(totalBytesRead >= inSize) break; bytesRead = dmgRaf.read(inBuffer, 0, Math.min((int)(inSize-totalBytesRead), inBuffer.length)); if(bytesRead > 0) totalBytesRead += bytesRead; } //lastInOffs = inOffset+inSize; } else if(blockType == BT_ZERO) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZERO processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_ZERO FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } reportFilePointerProgress(dmgRaf); long numberOfZeroBlocks = outSize/zeroblock.length; int numberOfRemainingBytes = (int)(outSize%zeroblock.length); for(int j = 0; j < numberOfZeroBlocks; ++j) { if(!testOnly) isoRaf.write(zeroblock); } if(!testOnly) isoRaf.write(zeroblock, 0, numberOfRemainingBytes); //lastInOffs = inOffset+inSize; } else if(blockType == BT_ZERO2) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZERO2 processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_ZERO2 FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } reportFilePointerProgress(dmgRaf); long numberOfZeroBlocks = outSize/zeroblock.length; int numberOfRemainingBytes = (int)(outSize%zeroblock.length); for(int j = 0; j < numberOfZeroBlocks; ++j) { if(!testOnly) isoRaf.write(zeroblock); } if(!testOnly) isoRaf.write(zeroblock, 0, numberOfRemainingBytes); //lastInOffs = inOffset+inSize; } else if(blockType == BT_UNKNOWN) { /* I have no idea what this blocktype is... but it's common, and usually doesn't appear more than 2-3 times in a dmg. As long as its input and output sizes are 0, there's no reason to complain... is there? */// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_UNKNOWN processing..."); if(!(inSize == 0 && outSize == 0)) { println("!------>WARNING: Blocktype BT_UNKNOWN had non-zero sizes...", "!------> inSize=" + inSize + ", outSize=" + outSize); ++warningsReported; //println(" The author of the program would be pleased if you contacted him about this."); // ...or would I? } } else if(blockType == BT_END) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_END processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_END FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } //lastOffs += lastInOffs; lastOutOffset = outOffset; lastInOffset += lastByteReadInBlock; } else { println("!------>WARNING: previously unseen blocktype " + blockType + " [0x" + Integer.toHexString(blockType) + "]", "!------> outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset + " inSize=" + inSize); ++warningsReported; if(!testOnly && isoRaf.getFilePointer() != outOffset) println("!------>WARNING: unknown blocktype FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); } offset += 0x28; ++blockCount; } } ++elementNumber; } //printlnVerbose("Progress: 100% Done!"); reportProgress(100); String summary = (errorsReported != 0)?errorsReported+" errors reported":"No errors reported"; summary += (warningsReported != 0)?" ("+warningsReported+" warnings emitted).":"."; if(!graphical) { newline(); println(summary); printlnVerbose("Total extracted bytes: " + totalSize + " B"); } else { progmon.close(); JOptionPane.showMessageDialog(null, "Extraction complete! " + summary + "\n" + "Total extracted bytes: " + totalSize + " B", "Information", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } if(!debug) { if(isoRaf != null) isoRaf.close(); dmgRaf.close(); } else { if(isoRaf != null) isoRaf.close();// System.out.println("blocks.size()=" + blocks.size());// for(DMGBlock b : blocks)// System.out.println(" " + b.toString()); LinkedList<DMGBlock> merged = mergeBlocks(blocks);// System.out.println("merged.size()=" + merged.size());// for(DMGBlock b : merged)// System.out.println(" " + b.toString()); println("Extracting all the parts not containing block data from source file:"); int i = 1; DMGBlock previous = null; for(DMGBlock b : merged) { if(previous == null && b.inOffset > 0) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(0); byte[] data = new byte[(int)(b.inOffset)]; dmgRaf.read(data); curFos.write(data); curFos.close(); } else if(previous != null) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(previous.inOffset+previous.inSize); byte[] data = new byte[(int)(b.inOffset-(previous.inOffset+previous.inSize))]; dmgRaf.read(data); curFos.write(data); curFos.close(); } previous = b; } if(previous.inOffset+previous.inSize != dmgRaf.length()) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(previous.inOffset+previous.inSize); byte[] data = new byte[(int)(dmgRaf.length()-(previous.inOffset+previous.inSize))]; dmgRaf.read(data); curFos.write(data); curFos.close(); } dmgRaf.close(); System.out.println("done!"); } }
public static void notmain(String[] args) throws Exception { if(debug) verbose = true; parseArgs(args); printlnVerbose("Processing: " + dmgFile); RandomAccessFile dmgRaf = new RandomAccessFile(dmgFile, "r"); RandomAccessFile isoRaf = null; boolean testOnly = false; if(isoFile != null) { isoRaf = new RandomAccessFile(isoFile, "rw"); isoRaf.setLength(0); printlnVerbose("Extracting to: " + isoFile); } else { testOnly = true; printlnVerbose("Simulating extraction..."); } dmgRaf.seek(dmgRaf.length()-PLIST_ADDRESS_1); long plistBegin1 = dmgRaf.readLong(); long plistEnd = dmgRaf.readLong(); dmgRaf.seek(dmgRaf.length()-PLIST_ADDRESS_2); long plistBegin2 = dmgRaf.readLong(); long plistSize = dmgRaf.readLong(); if(debug) { println("Read addresses:", " " + plistBegin1, " " + plistBegin2); } if(plistBegin1 != plistBegin2) { println("ERROR: Addresses not equal! Assumption false.", plistBegin1 + " != " + plistBegin2); System.exit(0); } if(false && plistSize != (plistEnd-plistBegin1)) { // This assumption is proven false. plistEnd is not interpreted correctly println("NOTE: plistSize field does not match plistEnd marker. Assumption false.", "plistSize=" + plistSize + " plistBegin1=" + plistBegin1 + " plistEnd=" + plistEnd + " plistEnd-plistBegin1=" + (plistEnd-plistBegin1)); } printlnVerbose("Jumping to address..."); dmgRaf.seek(plistBegin1); byte[] buffer = new byte[(int)plistSize]; dmgRaf.read(buffer); InputStream is = new ByteArrayInputStream(buffer); NodeBuilder handler = new NodeBuilder(); SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); try {// System.out.println("validation: " + saxParser.getProperty("validation"));// System.out.println("external-general-entities: " + saxParser.getProperty("external-general-entities"));// System.out.println("external-parameter-entities: " + saxParser.getProperty("external-parameter-entities"));// System.out.println("is-standalone: " + saxParser.getProperty("is-standalone"));// System.out.println("lexical-handler: " + saxParser.getProperty("lexical-handler"));// System.out.println("parameter-entities: " + saxParser.getProperty("parameter-entities"));// System.out.println("namespaces: " + saxParser.getProperty("namespaces"));// System.out.println("namespace-prefixes: " + saxParser.getProperty("namespace-prefixes"));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println(": " + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty(""));// System.out.println("" + saxParser.getProperty("")); //System.out.println("isValidating: " + saxParser.isValidating()); saxParser.parse(is, handler); } catch(SAXException se) { se.printStackTrace(); System.err.println("Could not read the partition list... exiting."); System.exit(1); } XMLNode[] rootNodes = handler.getRoots(); if(rootNodes.length != 1) { println("Could not parse UDIF-file!"); System.exit(0); } /* Ok, now we have a tree built from the XML-document. Let's walk to the right place. */ /* cd plist cd dict cdkey resource-fork (type:dict) cdkey blkx (type:array) */ XMLNode current; XMLElement[] children; boolean keyFound; current = rootNodes[0]; //We are at plist... probably (there should be only one root node) current = current.cd("dict"); current = current.cdkey("resource-fork"); current = current.cdkey("blkx"); printlnVerbose("Found " + current.getChildren().length + " partitions:"); byte[] inBuffer = new byte[0x40000]; byte[] outBuffer = new byte[0x40000]; byte[] zeroblock = new byte[4096]; /* I think java always zeroes its arrays on creation... but let's play safe. */ for(int y = 0; y < zeroblock.length; ++y) zeroblock[y] = 0; LinkedList<DMGBlock> blocks = new LinkedList<DMGBlock>(); long elementNumber = 0; //long lastOffs = 0; long lastOutOffset = 0; long lastInOffset = 0; long totalSize = 0; int errorsReported = 0; int warningsReported = 0; reportProgress(0); for(XMLElement xe : current.getChildren()) { if(progmon != null && progmon.isCanceled()) System.exit(0); if(xe instanceof XMLNode) { XMLNode xn = (XMLNode)xe; byte[] data = Base64.decode(xn.getKeyValue("Data")); long partitionSize = calculatePartitionSize(data); totalSize += partitionSize; printlnVerbose(" " + xn.getKeyValue("Name")); printlnVerbose(" ID: " + xn.getKeyValue("ID")); printlnVerbose(" Attributes: " + xn.getKeyValue("Attributes")); printlnVerbose(" Partition map data length: " + data.length + " bytes"); printlnVerbose(" Partition size: " + partitionSize + " bytes"); if(debug) { File dumpFile = new File("data(" + xn.getKeyValue("ID") + ").bin"); println(" Dumping partition map to file: " + dumpFile); FileOutputStream dump = new FileOutputStream(dumpFile); dump.write(data); dump.close(); } int offset = 0xCC; int blockType = 0; /* Offset of the input data for the current block in the input file */ long inOffset = 0; /* Size of the input data for the current block */ long inSize = 0; /* Offset of the output data for the current block in the output file */ long outOffset = 0; /* Size of the output data (possibly larger than inSize because of decompression, zero expansion...) */ long outSize = 0; long lastByteReadInBlock = -1; boolean addInOffset = false; //, lastInOffs = 0; int blockCount = 0; while(blockType != BT_END) { if(progmon != null && progmon.isCanceled()) System.exit(0); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); int bytesSkipped = 0; while(bytesSkipped < offset) bytesSkipped += dis.skipBytes(offset-bytesSkipped); blockType = dis.readInt(); int skipped = dis.readInt(); //Skip 4 bytes forward outOffset = dis.readLong()*0x200;//(dis.readInt() & 0xffffffffL)*0x200; //unsigned int -> long //dis.readInt(); //Skip 4 bytes forward outSize = dis.readLong()*0x200;//(dis.readInt() & 0xffffffffL)*0x200; //unsigned int -> long inOffset = dis.readLong();// & 0xffffffffL; //unsigned int -> long //dis.readInt(); //Skip 4 bytes forward inSize = dis.readLong();//dis.readInt() & 0xffffffffL; //unsigned int -> long String blockTypeString = blockTypeToString(blockType); if(debug) println(" " + elementNumber + ":" + blockCount + ". " + blockTypeString + " processing..."); if(lastByteReadInBlock == -1) lastByteReadInBlock = inOffset; lastByteReadInBlock += inSize; /* The lines below are a "hack" that I had to do to make dmgx work with certain dmg-files. I don't understand the issue at all, which is why this hack is here, but sometimes inOffset == 0 means that it is 0 relative to the previous partition's last inOffset. And sometimes it doesn't (meaning the actual position 0 in the dmg file). */ if(addInOffset) { if(debug) println("------->NOTE: addInOffset mode: inOffset tranformation " + inOffset + "->" + (inOffset+lastInOffset)); inOffset += lastInOffset; } else if(inOffset == 0 && blockCount == 0) { if(debug) println("------->NOTE: Detected inOffset == 0, setting to " + lastInOffset); addInOffset = true; inOffset = lastInOffset; } outOffset += lastOutOffset; DMGBlock currentBlock = new DMGBlock(blockType, skipped, outOffset, outSize, inOffset, inSize); blocks.add(currentBlock); if(debug) { println(" outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset, " inSize=" + inSize + " lastOutOffset=" + lastOutOffset + " lastInOffset=" + lastInOffset /*+ " lastInOffs=" + lastInOffs + " lastOffs=" + lastOffs*/); } if(blockType == BT_ADC) { println("!------>ERROR: BT_ADC not supported."); ++errorsReported; if(!testOnly) System.exit(0); } else if(blockType == BT_ZLIB) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZLIB processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) println("!------>WARNING: BT_ZLIB FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); try { DMGBlockHandlers.processZlibBlock(currentBlock, dmgRaf, isoRaf, testOnly, dummyMonitor); } catch(DataFormatException dfe) { println("!------>ERROR: BT_ZLIB Could not decode..."); ++errorsReported; if(!debug) { println("!------> outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset + " inSize=" + inSize + " lastOutOffset=" + lastOutOffset + " lastInOffset=" + lastInOffset); } dfe.printStackTrace(); if(!testOnly) System.exit(0); else { println("!------> Testing mode, so continuing..."); //System.exit(0); break; } } } else if(blockType == BT_BZIP2) { println("!------>ERROR: BT_BZIP2 not currently supported."); ++errorsReported; if(!testOnly) System.exit(0); } else if(blockType == BT_COPY) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_COPY processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_COPY FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } dmgRaf.seek(/*lastOffs+*/inOffset); int bytesRead = dmgRaf.read(inBuffer, 0, Math.min((int)inSize, inBuffer.length)); long totalBytesRead = bytesRead; while(bytesRead != -1) { reportFilePointerProgress(dmgRaf); if(!testOnly) isoRaf.write(inBuffer, 0, bytesRead); if(totalBytesRead >= inSize) break; bytesRead = dmgRaf.read(inBuffer, 0, Math.min((int)(inSize-totalBytesRead), inBuffer.length)); if(bytesRead > 0) totalBytesRead += bytesRead; } //lastInOffs = inOffset+inSize; } else if(blockType == BT_ZERO) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZERO processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_ZERO FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } reportFilePointerProgress(dmgRaf); long numberOfZeroBlocks = outSize/zeroblock.length; int numberOfRemainingBytes = (int)(outSize%zeroblock.length); for(int j = 0; j < numberOfZeroBlocks; ++j) { if(!testOnly) isoRaf.write(zeroblock); } if(!testOnly) isoRaf.write(zeroblock, 0, numberOfRemainingBytes); //lastInOffs = inOffset+inSize; } else if(blockType == BT_ZERO2) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_ZERO2 processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_ZERO2 FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } reportFilePointerProgress(dmgRaf); long numberOfZeroBlocks = outSize/zeroblock.length; int numberOfRemainingBytes = (int)(outSize%zeroblock.length); for(int j = 0; j < numberOfZeroBlocks; ++j) { if(!testOnly) isoRaf.write(zeroblock); } if(!testOnly) isoRaf.write(zeroblock, 0, numberOfRemainingBytes); //lastInOffs = inOffset+inSize; } else if(blockType == BT_UNKNOWN) { /* I have no idea what this blocktype is... but it's common, and usually doesn't appear more than 2-3 times in a dmg. As long as its input and output sizes are 0, there's no reason to complain... is there? */// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_UNKNOWN processing..."); if(!(inSize == 0 && outSize == 0)) { println("!------>WARNING: Blocktype BT_UNKNOWN had non-zero sizes...", "!------> inSize=" + inSize + ", outSize=" + outSize); ++warningsReported; //println(" The author of the program would be pleased if you contacted him about this."); // ...or would I? } } else if(blockType == BT_END) {// if(debug)// println(" " + elementNumber + ":" + blockCount + ". BT_END processing..."); if(!testOnly && isoRaf.getFilePointer() != outOffset) { println("!------>WARNING: BT_END FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); ++warningsReported; } //lastOffs += lastInOffs; lastOutOffset = outOffset; lastInOffset += lastByteReadInBlock; } else { println("!------>WARNING: previously unseen blocktype " + blockType + " [0x" + Integer.toHexString(blockType) + "]", "!------> outOffset=" + outOffset + " outSize=" + outSize + " inOffset=" + inOffset + " inSize=" + inSize); ++warningsReported; if(!testOnly && isoRaf.getFilePointer() != outOffset) println("!------>WARNING: unknown blocktype FP != outOffset (" + isoRaf.getFilePointer() + " != " + outOffset + ")"); } offset += 0x28; ++blockCount; } } ++elementNumber; } //printlnVerbose("Progress: 100% Done!"); reportProgress(100); String summary = (errorsReported != 0)?errorsReported+" errors reported":"No errors reported"; summary += (warningsReported != 0)?" ("+warningsReported+" warnings emitted).":"."; if(!graphical) { newline(); println(summary); printlnVerbose("Total extracted bytes: " + totalSize + " B"); } else { progmon.close(); JOptionPane.showMessageDialog(null, "Extraction complete! " + summary + "\n" + "Total extracted bytes: " + totalSize + " B", "Information", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } if(!debug) { if(isoRaf != null) isoRaf.close(); dmgRaf.close(); } else { if(isoRaf != null) isoRaf.close();// System.out.println("blocks.size()=" + blocks.size());// for(DMGBlock b : blocks)// System.out.println(" " + b.toString()); LinkedList<DMGBlock> merged = mergeBlocks(blocks);// System.out.println("merged.size()=" + merged.size());// for(DMGBlock b : merged)// System.out.println(" " + b.toString()); println("Extracting all the parts not containing block data from source file:"); int i = 1; DMGBlock previous = null; for(DMGBlock b : merged) { if(previous == null && b.inOffset > 0) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(0); byte[] data = new byte[(int)(b.inOffset)]; dmgRaf.read(data); curFos.write(data); curFos.close(); } else if(previous != null) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(previous.inOffset+previous.inSize); byte[] data = new byte[(int)(b.inOffset-(previous.inOffset+previous.inSize))]; dmgRaf.read(data); curFos.write(data); curFos.close(); } previous = b; } if(previous.inOffset+previous.inSize != dmgRaf.length()) { String filename = i++ + ".block"; println(" " + new File(filename).getCanonicalPath() + "..."); FileOutputStream curFos = new FileOutputStream(new File(filename)); dmgRaf.seek(previous.inOffset+previous.inSize); byte[] data = new byte[(int)(dmgRaf.length()-(previous.inOffset+previous.inSize))]; dmgRaf.read(data); curFos.write(data); curFos.close(); } dmgRaf.close(); System.out.println("done!"); } }
1,115,125
private JFileChooser getJFileChooserForFileSelection() { if(null == jFileChooser) { jFileChooser = new JFileChooser(); jFileChooser.setMultiSelectionEnabled(Boolean.TRUE); } jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jFileChooser.setCurrentDirectory(persistence.get( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FILE_SELECTION, (File) null)); return jFileChooser; }
private JFileChooser getJFileChooserForFileSelection( final String currentDirectoryKey) { if(null == jFileChooser) { jFileChooser = new JFileChooser(); jFileChooser.setMultiSelectionEnabled(Boolean.TRUE); } jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jFileChooser.setCurrentDirectory(persistence.get( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FILE_SELECTION, (File) null)); return jFileChooser; }
1,115,127
private JFileChooser getJFileChooserForFileSelection() { if(null == jFileChooser) { jFileChooser = new JFileChooser(); jFileChooser.setMultiSelectionEnabled(Boolean.TRUE); } jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jFileChooser.setCurrentDirectory(persistence.get( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FILE_SELECTION, (File) null)); return jFileChooser; }
private JFileChooser getJFileChooserForFileSelection() { if(null == jFileChooser) { jFileChooser = new JFileChooser(); jFileChooser.setMultiSelectionEnabled(Boolean.TRUE); } jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jFileChooser.setCurrentDirectory(persistence.get( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FILE_SELECTION, (File) null)); return jFileChooser; }
1,115,128
private JFileChooser getJFileChooserForFolderSelection() { if(null == jFileChooser) { jFileChooser = new JFileChooser(); jFileChooser.setMultiSelectionEnabled(Boolean.FALSE); } jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jFileChooser.setCurrentDirectory(persistence.get( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FOLDER_SELECTION, (File) null)); return jFileChooser; }
private JFileChooser getJFileChooserForFolderSelection(final String currentDirectoryKey) { if(null == jFileChooser) { jFileChooser = new JFileChooser(); jFileChooser.setMultiSelectionEnabled(Boolean.FALSE); } jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jFileChooser.setCurrentDirectory(persistence.get( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FOLDER_SELECTION, (File) null)); return jFileChooser; }
1,115,129
private JFileChooser getJFileChooserForFolderSelection() { if(null == jFileChooser) { jFileChooser = new JFileChooser(); jFileChooser.setMultiSelectionEnabled(Boolean.FALSE); } jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jFileChooser.setCurrentDirectory(persistence.get( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FOLDER_SELECTION, (File) null)); return jFileChooser; }
private JFileChooser getJFileChooserForFolderSelection() { if(null == jFileChooser) { jFileChooser = new JFileChooser(); jFileChooser.setMultiSelectionEnabled(Boolean.FALSE); } jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); jFileChooser.setCurrentDirectory(persistence.get( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FOLDER_SELECTION, (File) null)); return jFileChooser; }
1,115,130
public void runAddContainerDocuments(final Long containerId) { if(JFileChooser.APPROVE_OPTION == getJFileChooserForFileSelection().showOpenDialog(mainWindow)) { persistence.set( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FILE_SELECTION, jFileChooser.getCurrentDirectory()); runAddContainerDocuments(containerId, jFileChooser.getSelectedFiles()); } }
public void runAddContainerDocuments(final Long containerId) { if(JFileChooser.APPROVE_OPTION == getJFileChooserForFileSelection().showOpenDialog(mainWindow)) { persistence.set( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FILE_SELECTION, jFileChooser.getCurrentDirectory()); runAddContainerDocuments(containerId, jFileChooser.getSelectedFiles()); } }
1,115,131
public void runExportDraft(final Long containerId) { if(JFileChooser.APPROVE_OPTION == getJFileChooserForFolderSelection().showOpenDialog(mainWindow)) { persistence.set( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FOLDER_SELECTION, jFileChooser.getCurrentDirectory()); runExportDraft(containerId, jFileChooser.getSelectedFile()); } }
public void runExportDraft(final Long containerId) { if(JFileChooser.APPROVE_OPTION == getJFileChooserForFolderSelection().showOpenDialog(mainWindow)) { persistence.set( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FOLDER_SELECTION, jFileChooser.getCurrentDirectory()); runExportDraft(containerId, jFileChooser.getSelectedFile()); } }
1,115,132
public void runExportVersion(final Long containerId, final Long versionId) { if(JFileChooser.APPROVE_OPTION == getJFileChooserForFolderSelection().showOpenDialog(mainWindow)) { persistence.set( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FOLDER_SELECTION, jFileChooser.getCurrentDirectory()); runExportVersion(containerId, versionId, jFileChooser.getSelectedFile()); } }
public void runExportVersion(final Long containerId, final Long versionId) { if(JFileChooser.APPROVE_OPTION == getJFileChooserForFolderSelection().showOpenDialog(mainWindow)) { persistence.set( Keys.Persistence.JFILECHOOSER_CURRENT_DIRECTORY_FOLDER_SELECTION, jFileChooser.getCurrentDirectory()); runExportVersion(containerId, versionId, jFileChooser.getSelectedFile()); } }
1,115,133
void send(final QueueItem queueItem) { logApiId(); logger.debug(queueItem); final JID jid = JIDBuilder.build(queueItem.getUsername()); try { final Document queueItemDocument = readXml(queueItem.getQueueMessage()); final IQ iq = new IQ(queueItemDocument.getRootElement()); iq.setTo(jid); send(JabberIdBuilder.parseQualifiedJabberId(jid.toBareJID()), iq); } catch (final Throwable t) { throw translateError(t); } }
void send(final QueueItem queueItem) { logApiId(); logger.debug(queueItem); final JID jid = JIDBuilder.build(queueItem.getUsername()); try { final Document queueItemDocument = readXml(queueItem.getQueueMessage()); final IQ iq = new IQ(queueItemDocument.getRootElement()); iq.setTo(jid); send(JabberIdBuilder.parseQualifiedUsername(jid.toBareJID()), iq); } catch (final Throwable t) { throw translateError(t); } }
1,115,134
public String getAuthorRelevance() { return getProperty(keyAuthorRelevance); }
public String getAuthorRelevance() { return getProperty(keyAuthorRelevance); }
1,115,136
public String getTopicRelevance() { return getProperty(keyTopicRelevance); }
public String getTopicRelevance() { return getProperty(keyTopicRelevance); }
1,115,137
public boolean canImport(final JComponent comp, final DataFlavor[] transferFlavors) { logger.debug(comp.getClass().getSimpleName()); if(TxUtils.containsJavaFileList(transferFlavors)) { return true; } return false; }
public boolean canImport(final JComponent comp, final DataFlavor[] transferFlavors) { logger.debug(comp.getClass().getSimpleName()); if(TxUtils.containsJavaFileList(transferFlavors)) { if(Connection.ONLINE == browser.getConnectionStatus()) { return true; } } return false; }
1,115,138
protected JMenuItem createJMenuItem(final String localKey, final Object[] arguments, final ActionListener actionListener) { return createJMenuItem(getString(localKey, arguments), getMnemonic(localKey), actionListener); }
protected JMenuItem createJMenuItem(final String localKey, final Object[] arguments, final ActionListener actionListener) { return createJMenuItem(getString(localKey, arguments), getMnemonic(localKey), actionListener); }
1,115,140
protected String createSessionId(final JabberId userId) { // TODO Generate a unique id per user id and store it in the user's // meta-data final String hashString = new StringBuffer(userId.toString()) .append("LSAHD-QOIUQOE-ZXBVMNZNX-MZXXNCBVMX") .insert(0, "LKSJD-ZXVBNZM-QPWOEIURY-NXBCVMXNBC") .toString(); return MD5Util.md5Hex(hashString.getBytes()); }
protected String createSessionId(final JabberId userId) { // TODO Generate a unique id per user id and store it in the user's // meta-data final String hashString = new StringBuffer(userId.toString()) .append("LSAHD-QOIUQOE-ZXBVMNZNX-MZXXNCBVMX") .insert(0, "LKSJD-ZXVBNZM-QPWOEIURY-NXBCVMXNBC") .toString(); return MD5Util.md5Hex(hashString.getBytes()); }
1,115,141
public void run() { logger.logApiId(); logger.logVariable("run", run); try { while (run) { started = true; synchronized (this) { notifyAll(); } final Socket clientSocket = serverSocket.accept(); logger.logTrace("Socket connected."); new StreamSocketDelegate(streamServer, clientSocket).run(); logger.logTrace("Socket handler executed."); } } catch (final Throwable t) { logger.logFatal(t, "Fatal stream socket server error."); } }
public void run() { logger.logApiId(); logger.logVariable("run", run); try { while (run) { started = true; synchronized (this) { notifyAll(); } final Socket clientSocket = serverSocket.accept(); logger.logTrace("Socket connected."); try { new StreamSocketDelegate(streamServer, clientSocket).run(); } catch (final Throwable t) { logger.logError(t, "Failed to negotiate stream {0}.", clientSocket.getRemoteSocketAddress()); } finally { clientSocket.close(); } logger.logTrace("Socket handler executed."); } } catch (final Throwable t) { logger.logFatal(t, "Fatal stream socket server error."); } }
1,115,142
void revertDraft(final Long documentId) { logger.logApiId(); logger.logVariable("documentId", documentId); revertDraft(documentId, readLatestVersion(documentId).getVersionId()); }
void revertDraft(final Long documentId) { logger.logApiId(); logger.logVariable("documentId", documentId); try { revertDraft(documentId, readLatestVersion(documentId).getVersionId()); } catch (final Throwable t) { throw translateError(t); } }
1,115,143
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
protected Reader acquireReader(String url) throws IOException, Exception { if (!isAbsoluteUrl(url)) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
1,115,144
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
1,115,145
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (UnsupportedEncodingException ueex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
1,115,146
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (huc == null) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
1,115,147
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
1,115,148
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } return r; } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
protected Reader acquireReader(String url) throws IOException, Exception { if (!this.isAbsoluteUrl) { // for relative URLs, delegate to our peer return new StringReader(acquireString(url)); } else { // absolute URL try { // handle absolute URLs ourselves, using java.net.URL URL u = new URL(url); //URL u = new URL("http", "proxy.hi.is", 8080, target); URLConnection uc = u.openConnection(); InputStream i = uc.getInputStream(); // okay, we've got a stream; encode it appropriately Reader r = null; String charSet; // charSet extracted according to RFC 2045, section 5.1 String contentType = uc.getContentType(); if (contentType != null) { charSet = ImportSupport.getContentTypeAttribute(contentType, "charset"); if (charSet == null) { charSet = DEFAULT_ENCODING; } } else { charSet = DEFAULT_ENCODING; } try { r = new InputStreamReader(i, charSet); } catch (Exception ex) { r = new InputStreamReader(i, DEFAULT_ENCODING); } // check response code for HTTP URLs before returning, per spec, // before returning if (uc instanceof HttpURLConnection) { int status = ((HttpURLConnection)uc).getResponseCode(); if (status < 200 || status > 299) { throw new Exception(status + " " + url); } } else { return new SafeClosingHttpURLConnectionReader(r, huc); } } catch (IOException ex) { throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { // because the spec makes us throw new Exception("Problem accessing the absolute URL \"" + url + "\". " + ex); } } }
1,115,149
protected String acquireString(String url) throws IOException, Exception { // Record whether our URL is absolute or relative this.isAbsoluteUrl = isAbsoluteUrl(url); if (this.isAbsoluteUrl) { // for absolute URLs, delegate to our peer BufferedReader r = new BufferedReader(acquireReader(url)); StringBuffer sb = new StringBuffer(); int i; // under JIT, testing seems to show this simple loop is as fast // as any of the alternatives while ((i = r.read()) != -1) { sb.append((char)i); } r.close(); return sb.toString(); } else // handle relative URLs ourselves { // URL is relative, so we must be an HTTP request if (!(request instanceof HttpServletRequest && response instanceof HttpServletResponse)) { throw new Exception("Relative import from non-HTTP request not allowed"); } // retrieve an appropriate ServletContext // normalize the URL if we have an HttpServletRequest if (!url.startsWith("/")) { String sp = ((HttpServletRequest)request).getServletPath(); url = sp.substring(0, sp.lastIndexOf('/')) + '/' + url; } // strip the session id from the url url = stripSession(url); // from this context, get a dispatcher RequestDispatcher rd = application.getRequestDispatcher(url); if (rd == null) { throw new Exception("Couldn't get a RequestDispatcher for \"" + url + "\""); } // include the resource, using our custom wrapper ImportResponseWrapper irw = new ImportResponseWrapper((HttpServletResponse)response); try { rd.include(request, irw); } catch (IOException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } // disallow inappropriate response codes per JSTL spec if (irw.getStatus() < 200 || irw.getStatus() > 299) { throw new Exception("Invalid response code '" + irw.getStatus() + "' for \"" + url + "\""); } // recover the response String from our wrapper return irw.getString(); } }
protected String acquireString(String url) throws IOException, Exception { // Record whether our URL is absolute or relative this.isAbsoluteUrl = isAbsoluteUrl(url); if (this.isAbsoluteUrl) { // for absolute URLs, delegate to our peer BufferedReader r = new BufferedReader(acquireReader(url)); StringBuffer sb = new StringBuffer(); int i; // under JIT, testing seems to show this simple loop is as fast // as any of the alternatives while ((i = r.read()) != -1) { sb.append((char)i); } r.close(); return sb.toString(); } else // handle relative URLs ourselves { // URL is relative, so we must be an HTTP request if (!(request instanceof HttpServletRequest && response instanceof HttpServletResponse)) { throw new Exception("Relative import from non-HTTP request not allowed"); } // retrieve an appropriate ServletContext // normalize the URL if we have an HttpServletRequest if (!url.startsWith("/")) { String sp = ((HttpServletRequest)request).getServletPath(); url = sp.substring(0, sp.lastIndexOf('/')) + '/' + url; } // strip the session id from the url url = stripSession(url); // from this context, get a dispatcher RequestDispatcher rd = application.getRequestDispatcher(url); if (rd == null) { throw new Exception("Couldn't get a RequestDispatcher for \"" + url + "\""); } // include the resource, using our custom wrapper ImportResponseWrapper irw = new ImportResponseWrapper((HttpServletResponse)response); try { rd.include(request, irw); } catch (IOException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } // disallow inappropriate response codes per JSTL spec if (irw.getStatus() < 200 || irw.getStatus() > 299) { throw new Exception("Invalid response code '" + irw.getStatus() + "' for \"" + url + "\""); } // recover the response String from our wrapper return irw.getString(); } }
1,115,151
protected String acquireString(String url) throws IOException, Exception { // Record whether our URL is absolute or relative this.isAbsoluteUrl = isAbsoluteUrl(url); if (this.isAbsoluteUrl) { // for absolute URLs, delegate to our peer BufferedReader r = new BufferedReader(acquireReader(url)); StringBuffer sb = new StringBuffer(); int i; // under JIT, testing seems to show this simple loop is as fast // as any of the alternatives while ((i = r.read()) != -1) { sb.append((char)i); } r.close(); return sb.toString(); } else // handle relative URLs ourselves { // URL is relative, so we must be an HTTP request if (!(request instanceof HttpServletRequest && response instanceof HttpServletResponse)) { throw new Exception("Relative import from non-HTTP request not allowed"); } // retrieve an appropriate ServletContext // normalize the URL if we have an HttpServletRequest if (!url.startsWith("/")) { String sp = ((HttpServletRequest)request).getServletPath(); url = sp.substring(0, sp.lastIndexOf('/')) + '/' + url; } // strip the session id from the url url = stripSession(url); // from this context, get a dispatcher RequestDispatcher rd = application.getRequestDispatcher(url); if (rd == null) { throw new Exception("Couldn't get a RequestDispatcher for \"" + url + "\""); } // include the resource, using our custom wrapper ImportResponseWrapper irw = new ImportResponseWrapper((HttpServletResponse)response); try { rd.include(request, irw); } catch (IOException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } // disallow inappropriate response codes per JSTL spec if (irw.getStatus() < 200 || irw.getStatus() > 299) { throw new Exception("Invalid response code '" + irw.getStatus() + "' for \"" + url + "\""); } // recover the response String from our wrapper return irw.getString(); } }
protected String acquireString(String url) throws IOException, Exception { // Record whether our URL is absolute or relative this.isAbsoluteUrl = isAbsoluteUrl(url); if (this.isAbsoluteUrl) { // for absolute URLs, delegate to our peer BufferedReader r = new BufferedReader(acquireReader(url)); StringBuffer sb = new StringBuffer(); int i; // under JIT, testing seems to show this simple loop is as fast // as any of the alternatives while ((i = r.read()) != -1) { sb.append((char)i); } r.close(); return sb.toString(); } else // handle relative URLs ourselves { // URL is relative, so we must be an HTTP request if (!(request instanceof HttpServletRequest && response instanceof HttpServletResponse)) { throw new Exception("Relative import from non-HTTP request not allowed"); } // retrieve an appropriate ServletContext // normalize the URL if we have an HttpServletRequest if (!url.startsWith("/")) { String sp = ((HttpServletRequest)request).getServletPath(); url = sp.substring(0, sp.lastIndexOf('/')) + '/' + url; } // strip the session id from the url url = stripSession(url); // from this context, get a dispatcher RequestDispatcher rd = application.getRequestDispatcher(url); if (rd == null) { throw new Exception("Couldn't get a RequestDispatcher for \"" + url + "\""); } // include the resource, using our custom wrapper ImportResponseWrapper irw = new ImportResponseWrapper((HttpServletResponse)response); try { rd.include(request, irw); } catch (IOException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } // disallow inappropriate response codes per JSTL spec if (irw.getStatus() < 200 || irw.getStatus() > 299) { throw new Exception("Invalid response code '" + irw.getStatus() + "' for \"" + url + "\""); } // recover the response String from our wrapper return irw.getString(); } }
1,115,152
protected String acquireString(String url) throws IOException, Exception { // Record whether our URL is absolute or relative this.isAbsoluteUrl = isAbsoluteUrl(url); if (this.isAbsoluteUrl) { // for absolute URLs, delegate to our peer BufferedReader r = new BufferedReader(acquireReader(url)); StringBuffer sb = new StringBuffer(); int i; // under JIT, testing seems to show this simple loop is as fast // as any of the alternatives while ((i = r.read()) != -1) { sb.append((char)i); } r.close(); return sb.toString(); } else // handle relative URLs ourselves { // URL is relative, so we must be an HTTP request if (!(request instanceof HttpServletRequest && response instanceof HttpServletResponse)) { throw new Exception("Relative import from non-HTTP request not allowed"); } // retrieve an appropriate ServletContext // normalize the URL if we have an HttpServletRequest if (!url.startsWith("/")) { String sp = ((HttpServletRequest)request).getServletPath(); url = sp.substring(0, sp.lastIndexOf('/')) + '/' + url; } // strip the session id from the url url = stripSession(url); // from this context, get a dispatcher RequestDispatcher rd = application.getRequestDispatcher(url); if (rd == null) { throw new Exception("Couldn't get a RequestDispatcher for \"" + url + "\""); } // include the resource, using our custom wrapper ImportResponseWrapper irw = new ImportResponseWrapper((HttpServletResponse)response); try { rd.include(request, irw); } catch (IOException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } // disallow inappropriate response codes per JSTL spec if (irw.getStatus() < 200 || irw.getStatus() > 299) { throw new Exception("Invalid response code '" + irw.getStatus() + "' for \"" + url + "\""); } // recover the response String from our wrapper return irw.getString(); } }
protected String acquireString(String url) throws IOException, Exception { // Record whether our URL is absolute or relative this.isAbsoluteUrl = isAbsoluteUrl(url); if (this.isAbsoluteUrl) { // for absolute URLs, delegate to our peer BufferedReader r = new BufferedReader(acquireReader(url)); StringBuffer sb = new StringBuffer(); int i; // under JIT, testing seems to show this simple loop is as fast // as any of the alternatives while ((i = r.read()) != -1) { r = new BufferedReader(acquireReader(url)); StringBuffer sb = new StringBuffer(); int i; while ((i = r.read()) != -1) { sb.append((char)i); } return sb.toString(); } r.close(); return sb.toString(); } else // handle relative URLs ourselves { // URL is relative, so we must be an HTTP request if (!(request instanceof HttpServletRequest && response instanceof HttpServletResponse)) { throw new Exception("Relative import from non-HTTP request not allowed"); } // retrieve an appropriate ServletContext // normalize the URL if we have an HttpServletRequest if (!url.startsWith("/")) { String sp = ((HttpServletRequest)request).getServletPath(); url = sp.substring(0, sp.lastIndexOf('/')) + '/' + url; } // strip the session id from the url url = stripSession(url); // from this context, get a dispatcher RequestDispatcher rd = application.getRequestDispatcher(url); if (rd == null) { throw new Exception("Couldn't get a RequestDispatcher for \"" + url + "\""); } // include the resource, using our custom wrapper ImportResponseWrapper irw = new ImportResponseWrapper((HttpServletResponse)response); try { rd.include(request, irw); } catch (IOException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } // disallow inappropriate response codes per JSTL spec if (irw.getStatus() < 200 || irw.getStatus() > 299) { throw new Exception("Invalid response code '" + irw.getStatus() + "' for \"" + url + "\""); } // recover the response String from our wrapper return irw.getString(); } }
1,115,153
protected String acquireString(String url) throws IOException, Exception { // Record whether our URL is absolute or relative this.isAbsoluteUrl = isAbsoluteUrl(url); if (this.isAbsoluteUrl) { // for absolute URLs, delegate to our peer BufferedReader r = new BufferedReader(acquireReader(url)); StringBuffer sb = new StringBuffer(); int i; // under JIT, testing seems to show this simple loop is as fast // as any of the alternatives while ((i = r.read()) != -1) { sb.append((char)i); } r.close(); return sb.toString(); } else // handle relative URLs ourselves { // URL is relative, so we must be an HTTP request if (!(request instanceof HttpServletRequest && response instanceof HttpServletResponse)) { throw new Exception("Relative import from non-HTTP request not allowed"); } // retrieve an appropriate ServletContext // normalize the URL if we have an HttpServletRequest if (!url.startsWith("/")) { String sp = ((HttpServletRequest)request).getServletPath(); url = sp.substring(0, sp.lastIndexOf('/')) + '/' + url; } // strip the session id from the url url = stripSession(url); // from this context, get a dispatcher RequestDispatcher rd = application.getRequestDispatcher(url); if (rd == null) { throw new Exception("Couldn't get a RequestDispatcher for \"" + url + "\""); } // include the resource, using our custom wrapper ImportResponseWrapper irw = new ImportResponseWrapper((HttpServletResponse)response); try { rd.include(request, irw); } catch (IOException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } // disallow inappropriate response codes per JSTL spec if (irw.getStatus() < 200 || irw.getStatus() > 299) { throw new Exception("Invalid response code '" + irw.getStatus() + "' for \"" + url + "\""); } // recover the response String from our wrapper return irw.getString(); } }
protected String acquireString(String url) throws IOException, Exception { // Record whether our URL is absolute or relative this.isAbsoluteUrl = isAbsoluteUrl(url); if (this.isAbsoluteUrl) { // for absolute URLs, delegate to our peer BufferedReader r = new BufferedReader(acquireReader(url)); StringBuffer sb = new StringBuffer(); int i; // under JIT, testing seems to show this simple loop is as fast // as any of the alternatives while ((i = r.read()) != -1) { sb.append((char)i); } r.close(); return sb.toString(); } else // handle relative URLs ourselves { // URL is relative, so we must be an HTTP request if (!(request instanceof HttpServletRequest && response instanceof HttpServletResponse)) { throw new Exception("Relative import from non-HTTP request not allowed"); } // retrieve an appropriate ServletContext // normalize the URL if we have an HttpServletRequest if (!url.startsWith("/")) { String sp = ((HttpServletRequest)request).getServletPath(); url = sp.substring(0, sp.lastIndexOf('/')) + '/' + url; } // strip the session id from the url url = stripSession(url); // from this context, get a dispatcher RequestDispatcher rd = application.getRequestDispatcher(url); if (rd == null) { throw new Exception("Couldn't get a RequestDispatcher for \"" + url + "\""); } // include the resource, using our custom wrapper ImportResponseWrapper irw = new ImportResponseWrapper((HttpServletResponse)response); try { rd.include(request, irw); } catch (IOException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } catch (RuntimeException ex) { throw new Exception("Problem importing the relative URL \"" + url + "\". " + ex); } // disallow inappropriate response codes per JSTL spec if (irw.getStatus() < 200 || irw.getStatus() > 299) { throw new Exception("Invalid response code '" + irw.getStatus() + "' for \"" + url + "\""); } // recover the response String from our wrapper return irw.getString(); } }
1,115,154
protected final InputStream downloadStream(final String streamId) throws IOException { final File streamFile = workspace.createTempFile(streamId); final FileOutputStream stream = new FileOutputStream(streamFile); final StreamSession session = getSessionModel().createStreamSession(); final StreamReader reader = new StreamReader(session); reader.open(); try { reader.read(streamId, stream); } finally { try { stream.close(); } finally { reader.close(); } } return new FileInputStream(streamFile); }
protected final File downloadStream(final String streamId) throws IOException { final File streamFile = workspace.createTempFile(streamId); final FileOutputStream stream = new FileOutputStream(streamFile); final StreamSession session = getSessionModel().createStreamSession(); final StreamReader reader = new StreamReader(session); reader.open(); try { reader.read(streamId, stream); } finally { try { stream.close(); } finally { reader.close(); } } return new FileInputStream(streamFile); }
1,115,155
protected final InputStream downloadStream(final String streamId) throws IOException { final File streamFile = workspace.createTempFile(streamId); final FileOutputStream stream = new FileOutputStream(streamFile); final StreamSession session = getSessionModel().createStreamSession(); final StreamReader reader = new StreamReader(session); reader.open(); try { reader.read(streamId, stream); } finally { try { stream.close(); } finally { reader.close(); } } return new FileInputStream(streamFile); }
protected final InputStream downloadStream(final String streamId) throws IOException { final File streamFile = workspace.createTempFile(streamId); final FileOutputStream stream = new FileOutputStream(streamFile); final StreamSession session = getSessionModel().createStreamSession(); final StreamReader reader = new StreamReader(session); reader.open(); try { reader.read(streamId, stream); } finally { try { stream.close(); } finally { reader.close(); } } return streamFile; }
1,115,156
protected void doInsertCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection) throws RepositoryException { if (collection == null) { return; } String jcrName = collectionDescriptor.getJcrName(); if (jcrName == null) { throw new JcrMappingException( "The JcrName attribute is not defined for the CollectionDescriptor : " + collectionDescriptor.getFieldName()); } Node collectionNode = parentNode.addNode(jcrName); Mapper mapper = collectionDescriptor.getClassDescriptor().getMappingDescriptor().getMapper(); ClassDescriptor elementClassDescriptor = mapper.getClassDescriptor( ReflectionUtils.forName(collectionDescriptor.getElementClassName())); Iterator collectionIterator = collection.getIterator(); int elementCollectionCount = 0; while (collectionIterator.hasNext()) { Object item = collectionIterator.next(); String elementJcrName = null; // If the element object has a unique id => the element jcr node name = the id value if (elementClassDescriptor.hasIdField()) { String idFieldName = elementClassDescriptor.getIdFieldDescriptor() .getFieldName(); elementJcrName = ReflectionUtils.getNestedProperty(item, idFieldName).toString(); } else { elementCollectionCount++; elementJcrName = COLLECTION_ELEMENT_NAME + elementCollectionCount; } objectConverter.insert(session, collectionNode, elementJcrName, item); } }
protected void doInsertCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection) throws RepositoryException { if (collection == null) { return; } String jcrName = collectionDescriptor.getJcrName(); if (jcrName == null) { throw new JcrMappingException( "The JcrName attribute is not defined for the CollectionDescriptor : " + collectionDescriptor.getFieldName()); } Node collectionNode = parentNode.addNode(jcrName); Mapper mapper = collectionDescriptor.getClassDescriptor().getMappingDescriptor().getMapper(); ClassDescriptor elementClassDescriptor = mapper.getClassDescriptor( ReflectionUtils.forName(collectionDescriptor.getElementClassName())); Iterator collectionIterator = collection.getIterator(); int elementCollectionCount = 0; while (collectionIterator.hasNext()) { Object item = collectionIterator.next(); String elementJcrName = null; // If the element object has a unique id => the element jcr node name = the id value if (elementClassDescriptor.hasIdField()) { String idFieldName = elementClassDescriptor.getIdFieldDescriptor() .getFieldName(); elementJcrName = ReflectionUtils.getNestedProperty(item, idFieldName).toString(); } else { elementCollectionCount++; elementJcrName = COLLECTION_ELEMENT_NAME + elementCollectionCount; } objectConverter.insert(session, collectionNode, elementJcrName, item); } }
1,115,157
protected void doUpdateCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection) throws RepositoryException { String jcrName = getCollectionJcrName(collectionDescriptor); if (collection == null) { if (parentNode.hasNode(jcrName)) { parentNode.getNode(jcrName).remove(); } return; } Mapper mapper = collectionDescriptor.getClassDescriptor().getMappingDescriptor().getMapper(); ClassDescriptor elementClassDescriptor = mapper.getClassDescriptor( ReflectionUtils.forName(collectionDescriptor.getElementClassName())); Node collectionNode = parentNode.getNode(jcrName); // If the collection elements have not an id, it is not possible to find the matching JCR nodes => delete the complete collection if (!elementClassDescriptor.hasIdField()) { collectionNode.remove(); collectionNode = parentNode.addNode(jcrName); } Iterator collectionIterator = collection.getIterator(); int elementCollectionCount = 0; Map updatedItems = new HashMap(); while (collectionIterator.hasNext()) { Object item = collectionIterator.next(); elementCollectionCount++; String elementJcrName = null; if (elementClassDescriptor.hasIdField()) { String idFieldName = elementClassDescriptor.getIdFieldDescriptor().getFieldName(); elementJcrName = ReflectionUtils.getNestedProperty(item, idFieldName).toString(); // Update existing JCR Nodes if (collectionNode.hasNode(elementJcrName)) { objectConverter.update(session, collectionNode, elementJcrName, item); } else { // Add new collection elements objectConverter.insert(session, collectionNode, elementJcrName, item); } updatedItems.put(elementJcrName, item); } else { elementCollectionCount++; elementJcrName = COLLECTION_ELEMENT_NAME + elementCollectionCount; objectConverter.insert(session, collectionNode, elementJcrName, item); } } // Delete JCR nodes that are not present in the collection if (elementClassDescriptor.hasIdField()) { NodeIterator nodeIterator = collectionNode.getNodes(); List removeNodes = new ArrayList(); while (nodeIterator.hasNext()) { Node child = nodeIterator.nextNode(); if (!updatedItems.containsKey(child.getName())) { removeNodes.add(child); } } for(int i = 0; i < removeNodes.size(); i++) { ((Node) removeNodes.get(i)).remove(); } } }
protected void doUpdateCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection) throws RepositoryException { String jcrName = getCollectionJcrName(collectionDescriptor); if (collection == null) { if (parentNode.hasNode(jcrName)) { parentNode.getNode(jcrName).remove(); } return; } Mapper mapper = collectionDescriptor.getClassDescriptor().getMappingDescriptor().getMapper(); ClassDescriptor elementClassDescriptor = mapper.getClassDescriptor( ReflectionUtils.forName(collectionDescriptor.getElementClassName())); Node collectionNode = parentNode.getNode(jcrName); // If the collection elements have not an id, it is not possible to find the matching JCR nodes => delete the complete collection if (!elementClassDescriptor.hasIdField()) { collectionNode.remove(); collectionNode = parentNode.addNode(jcrName); } Iterator collectionIterator = collection.getIterator(); int elementCollectionCount = 0; Map updatedItems = new HashMap(); while (collectionIterator.hasNext()) { Object item = collectionIterator.next(); elementCollectionCount++; String elementJcrName = null; if (elementClassDescriptor.hasIdField()) { String idFieldName = elementClassDescriptor.getIdFieldDescriptor().getFieldName(); elementJcrName = ReflectionUtils.getNestedProperty(item, idFieldName).toString(); // Update existing JCR Nodes if (collectionNode.hasNode(elementJcrName)) { objectConverter.update(session, collectionNode, elementJcrName, item); } else { // Add new collection elements objectConverter.insert(session, collectionNode, elementJcrName, item); } updatedItems.put(elementJcrName, item); } else { elementCollectionCount++; elementJcrName = COLLECTION_ELEMENT_NAME + elementCollectionCount; objectConverter.insert(session, collectionNode, elementJcrName, item); } } // Delete JCR nodes that are not present in the collection if (elementClassDescriptor.hasIdField()) { NodeIterator nodeIterator = collectionNode.getNodes(); List removeNodes = new ArrayList(); while (nodeIterator.hasNext()) { Node child = nodeIterator.nextNode(); if (!updatedItems.containsKey(child.getName())) { removeNodes.add(child); } } for(int i = 0; i < removeNodes.size(); i++) { ((Node) removeNodes.get(i)).remove(); } } }
1,115,158
protected void setUp() throws Exception { super.setUp(); data = new Vector<Fixture>(getInputFilesLength()); final DocumentModel documentModel = getDocumentModel(); String name, description; Document document; for(File testFile : getInputFiles()) { name = testFile.getName(); description = "Document: " + name; document = documentModel.create(name, description, testFile); documentModel.createVersion(document.getId()); documentModel.createVersion(document.getId()); documentModel.createVersion(document.getId()); data.add(new Fixture(document, documentModel, 4)); } }
protected void setUp() throws Exception { super.setUp(); data = new Vector<Fixture>(getInputFilesLength()); final DocumentModel documentModel = getDocumentModel(); String name, description; Document document; for(File testFile : getInputFiles()) { name = testFile.getName(); description = "Document: " + name; document = documentModel.create(name, description, testFile); documentModel.createVersion(document.getId()); documentModel.createVersion(document.getId()); documentModel.createVersion(document.getId()); data.add(new Fixture(document, documentModel, 3)); } }
1,115,160
void triggerPopup(final MainCell mainCell, final Component invoker, final MouseEvent e, final int x, final int y) { final JPopupMenu jPopupMenu = MenuFactory.createPopup(); if(mainCell instanceof MainCellDocument) { new PopupDocument((MainCellDocument) mainCell).trigger(browser, jPopupMenu, e); } else if(mainCell instanceof MainCellHistoryItem) { new PopupHistoryItem((MainCellHistoryItem) mainCell).trigger(browser, jPopupMenu, e); } jPopupMenu.show(invoker, x, y); }
void triggerPopup(final MainCell mainCell, final Component invoker, final MouseEvent e, final int x, final int y) { final JPopupMenu jPopupMenu = MenuFactory.createPopup(); if(mainCell instanceof MainCellDocument) { new PopupDocument((MainCellDocument) mainCell, browser.getConnectionStatus()).trigger(browser, jPopupMenu, e); } else if(mainCell instanceof MainCellHistoryItem) { new PopupHistoryItem((MainCellHistoryItem) mainCell).trigger(browser, jPopupMenu, e); } jPopupMenu.show(invoker, x, y); }
1,115,161
void triggerPopup(final MainCell mainCell, final Component invoker, final MouseEvent e, final int x, final int y) { final JPopupMenu jPopupMenu = MenuFactory.createPopup(); if(mainCell instanceof MainCellDocument) { new PopupDocument((MainCellDocument) mainCell).trigger(browser, jPopupMenu, e); } else if(mainCell instanceof MainCellHistoryItem) { new PopupHistoryItem((MainCellHistoryItem) mainCell).trigger(browser, jPopupMenu, e); } jPopupMenu.show(invoker, x, y); }
void triggerPopup(final MainCell mainCell, final Component invoker, final MouseEvent e, final int x, final int y) { final JPopupMenu jPopupMenu = MenuFactory.createPopup(); if(mainCell instanceof MainCellDocument) { new PopupDocument((MainCellDocument) mainCell).trigger(browser, jPopupMenu, e); } else if(mainCell instanceof MainCellHistoryItem) { new PopupHistoryItem((MainCellHistoryItem) mainCell, browser.getConnectionStatus()).trigger(browser, jPopupMenu, e); } jPopupMenu.show(invoker, x, y); }
1,115,162
public Map getToolbox(Object initData) { //we know the initData is a ViewContext ViewContext ctx = (ViewContext)initData; //create the toolbox map with the application tools in it Map toolbox = new HashMap(appTools); if (!sessionToolInfo.isEmpty()) { HttpSession session = ctx.getRequest().getSession(createSession); if (session != null) { // allow only one thread per session at a time synchronized(getMutex(session)) { // get the session tools Map stmap = (Map)session.getAttribute(SESSION_TOOLS_KEY); if (stmap == null) { // init and store session tools map stmap = new HashMap(sessionToolInfo.size()); Iterator i = sessionToolInfo.iterator(); while(i.hasNext()) { ToolInfo ti = (ToolInfo)i.next(); stmap.put(ti.getKey(), ti.getInstance(ctx)); } session.setAttribute(SESSION_TOOLS_KEY, stmap); } // add them to the toolbox toolbox.putAll(stmap); } } } //add and initialize request tools Iterator i = requestToolInfo.iterator(); while(i.hasNext()) { ToolInfo info = (ToolInfo)i.next(); toolbox.put(info.getKey(), info.getInstance(ctx)); } return toolbox; }
public Map getToolbox(Object initData) { //we know the initData is a ViewContext ViewContext ctx = (ViewContext)initData; //create the toolbox map with the application tools in it Map toolbox = new HashMap(appTools); if (!sessionToolInfo.isEmpty()) { HttpSession session = ctx.getRequest().getSession(createSession); if (session != null) { // allow only one thread per session at a time synchronized(getMutex(session)) { // get the session tools Map stmap = (Map)session.getAttribute(SESSION_TOOLS_KEY); if (stmap == null) { // init and store session tools map stmap = new HashMap(sessionToolInfo.size()); Iterator i = sessionToolInfo.iterator(); while(i.hasNext()) { ToolInfo ti = (ToolInfo)i.next(); stmap.put(ti.getKey(), ti.getInstance(ctx)); } session.setAttribute(SESSION_TOOLS_KEY, stmap); } // add them to the toolbox toolbox.putAll(stmap); } } } //add and initialize request tools Iterator i = requestToolInfo.iterator(); while(i.hasNext()) { ToolInfo info = (ToolInfo)i.next(); toolbox.put(info.getKey(), info.getInstance(ctx)); } return toolbox; }
1,115,165
public IQ parseIQ(final XmlPullParser parser) throws Exception { final XMPPMethodResponse response = new XMPPMethodResponse(); parser.next(); while(true) { logger.logVariable("parser.getName()", parser.getName()); logger.logVariable("parser.getDepth()", parser.getDepth()); logger.logVariable("parser.getNamespace()", parser.getNamespace()); // stop processing when we hit the trailing query tag if (XmlPullParser.END_TAG == parser.getEventType()) { if (Service.NAME.equals(parser.getName())) { break; } else { Assert.assertUnreachable(MessageFormat.format( "Parsing incomplete for xmlns {0}; tag {1} at depth {2}.", parser.getNamespace(), parser.getName(), parser.getDepth())); } } else { response.writeResult(parseResult(parser)); } } return response; }
public IQ parseIQ(final XmlPullParser parser) throws Exception { final XMPPMethodResponse response = new XMPPMethodResponse(); parser.next(); while(true) { logger.logVariable("parser.getName()", parser.getName()); logger.logVariable("parser.getDepth()", parser.getDepth()); logger.logVariable("parser.getNamespace()", parser.getNamespace()); // stop processing when we hit the trailing query tag if (XmlPullParser.END_TAG == parser.getEventType()) { if (Service.NAME.equals(parser.getName())) { break; } else { Assert.assertUnreachable(MessageFormat.format( "Parsing incomplete for xmlns {0}; tag {1} at depth {2}.", parser.getNamespace(), parser.getName(), parser.getDepth())); } } else { response.writeResult(parseResult(parser)); } } return response; }
1,115,167
public IQ parseIQ(final XmlPullParser parser) throws Exception { final XMPPMethodResponse response = new XMPPMethodResponse(); parser.next(); while(true) { logger.logVariable("parser.getName()", parser.getName()); logger.logVariable("parser.getDepth()", parser.getDepth()); logger.logVariable("parser.getNamespace()", parser.getNamespace()); // stop processing when we hit the trailing query tag if (XmlPullParser.END_TAG == parser.getEventType()) { if (Service.NAME.equals(parser.getName())) { break; } else { Assert.assertUnreachable(MessageFormat.format( "Parsing incomplete for xmlns {0}; tag {1} at depth {2}.", parser.getNamespace(), parser.getName(), parser.getDepth())); } } else { response.writeResult(parseResult(parser)); } } return response; }
public IQ parseIQ(final XmlPullParser parser) throws Exception { final XMPPMethodResponse response = new XMPPMethodResponse(); parser.next(); while(true) { logger.logVariable("parser.getName()", parser.getName()); logger.logVariable("parser.getDepth()", parser.getDepth()); logger.logVariable("parser.getNamespace()", parser.getNamespace()); // stop processing when we hit the trailing query tag if (XmlPullParser.END_TAG == parser.getEventType()) { if (Service.NAME.equals(parser.getName())) { break; } else { Assert.assertUnreachable(MessageFormat.format( "Parsing incomplete for xmlns {0}; tag {1} at depth {2}.", parser.getNamespace(), parser.getName(), parser.getDepth())); } } else { response.writeResult(parseResult(parser)); } } }
1,115,168
private Fixture(final List<Contact> contacts, final Container container, final ContainerModel containerModel) { this.contacts = contacts; this.container = container; this.containerModel = containerModel; this.didNotify = Boolean.FALSE; this.teamMembers = Collections.emptyList(); }
private Fixture(final List<Contact> contacts, final Container container, final ContainerModel containerModel) { this.contacts = contacts; this.container = container; this.containerModel = containerModel; this.didNotify = Boolean.FALSE; this.teamMembers = Collections.emptyList(); }
1,115,169
private Fixture(final List<Contact> contacts, final Container container, final ContainerModel containerModel) { this.contacts = contacts; this.container = container; this.containerModel = containerModel; this.didNotify = Boolean.FALSE; this.teamMembers = Collections.emptyList(); }
private Fixture(final List<Contact> contacts, final Container container, final ContainerModel containerModel) { this.contacts = contacts; this.container = container; this.containerModel = containerModel; this.didNotify = Boolean.FALSE; addQueueHelper(junit); addQueueHelper(junit_x); addQueueHelper(junit_y); }
1,115,170
protected void setUp() throws Exception { super.setUp(); login(OpheliaTestUser.JUNIT); final ContainerModel containerModel = getContainerModel(OpheliaTestUser.JUNIT); final Container container = createContainer(OpheliaTestUser.JUNIT, NAME); addDocuments(OpheliaTestUser.JUNIT, container); final List<Contact> contacts = readContacts(OpheliaTestUser.JUNIT); datum = new Fixture(contacts, container, containerModel); containerModel.addListener(datum); }
protected void setUp() throws Exception { super.setUp(); login(OpheliaTestUser.JUNIT); final ContainerModel containerModel = getContainerModel(OpheliaTestUser.JUNIT); final Container container = createContainer(OpheliaTestUser.JUNIT, NAME); addDocuments(OpheliaTestUser.JUNIT, container); final List<Contact> contacts = readContacts(OpheliaTestUser.JUNIT); datum = new Fixture(contacts, container, containerModel); containerModel.addListener(datum); }
1,115,171
protected void tearDown() throws Exception { logger.logTraceId(); datum.containerModel.removeListener(datum); datum = null; logger.logTraceId(); logout(OpheliaTestUser.JUNIT); logger.logTraceId(); super.tearDown(); logger.logTraceId(); }
protected void tearDown() throws Exception { logger.logTraceId(); datum.containerModel.removeListener(datum); datum = null; logger.logTraceId(); logout(OpheliaTestUser.JUNIT); logger.logTraceId(); super.tearDown(); logger.logTraceId(); }
1,115,172
protected void tearDown() throws Exception { logger.logTraceId(); datum.containerModel.removeListener(datum); datum = null; logger.logTraceId(); logout(OpheliaTestUser.JUNIT); logger.logTraceId(); super.tearDown(); logger.logTraceId(); }
protected void tearDown() throws Exception { logger.logTraceId(); datum.containerModel.removeListener(datum); datum = null; logger.logTraceId(); logout(OpheliaTestUser.JUNIT); logger.logTraceId(); super.tearDown(); logger.logTraceId(); }
1,115,173
protected void tearDown() throws Exception { logger.logTraceId(); datum.containerModel.removeListener(datum); datum = null; logger.logTraceId(); logout(OpheliaTestUser.JUNIT); logger.logTraceId(); super.tearDown(); logger.logTraceId(); }
protected void tearDown() throws Exception { datum.containerModel.removeListener(datum); datum = null; logout(OpheliaTestUser.JUNIT); super.tearDown(); }
1,115,174
public void testPublish() { logger.logTraceId(); datum.containerModel.publish( datum.container.getId(), datum.contacts, datum.teamMembers); logger.logTraceId(); assertTrue("The draft published event was not fired.", datum.didNotify); // ensure the system is the key holder again final JabberId keyHolder = getArtifactModel(OpheliaTestUser.JUNIT).readKeyHolder(datum.container.getId()); assertEquals("Local artifact key holder does not match expectation.", User.THINK_PARITY.getId(), keyHolder); assertTrue("Local key flag is still mistakenly applied.", !getArtifactModel(OpheliaTestUser.JUNIT).isFlagApplied(datum.container.getId(), ArtifactFlag.KEY)); }
public void testPublish() { logger.logTraceId(); datum.containerModel.publish( datum.container.getId(), datum.contacts, datum.teamMembers); logger.logTraceId(); assertTrue("The draft published event was not fired.", datum.didNotify); // ensure the system is the key holder again final JabberId keyHolder = getArtifactModel(OpheliaTestUser.JUNIT).readKeyHolder(datum.container.getId()); assertEquals("Local artifact key holder does not match expectation.", User.THINK_PARITY.getId(), keyHolder); assertTrue("Local key flag is still mistakenly applied.", !getArtifactModel(OpheliaTestUser.JUNIT).isFlagApplied(datum.container.getId(), ArtifactFlag.KEY)); }
1,115,175
public void testPublish() { logger.logTraceId(); datum.containerModel.publish( datum.container.getId(), datum.contacts, datum.teamMembers); logger.logTraceId(); assertTrue("The draft published event was not fired.", datum.didNotify); // ensure the system is the key holder again final JabberId keyHolder = getArtifactModel(OpheliaTestUser.JUNIT).readKeyHolder(datum.container.getId()); assertEquals("Local artifact key holder does not match expectation.", User.THINK_PARITY.getId(), keyHolder); assertTrue("Local key flag is still mistakenly applied.", !getArtifactModel(OpheliaTestUser.JUNIT).isFlagApplied(datum.container.getId(), ArtifactFlag.KEY)); }
public void testPublish() { logger.logTraceId(); datum.containerModel.publish( datum.container.getId(), datum.contacts, datum.teamMembers); logger.logTraceId(); assertTrue("The draft published event was not fired.", datum.didNotify); // ensure the system is the key holder again final JabberId keyHolder = getArtifactModel(OpheliaTestUser.JUNIT).readKeyHolder(datum.container.getId()); assertEquals("Local artifact key holder does not match expectation.", User.THINK_PARITY.getId(), keyHolder); assertTrue("Local key flag is still mistakenly applied.", !getArtifactModel(OpheliaTestUser.JUNIT).isFlagApplied(datum.container.getId(), ArtifactFlag.KEY)); }
1,115,176
private void initializeLogging() { final File logDirectory = new File(JiveGlobals.getHomeDirectory(), "logs"); System.setProperty("thinkparity.log4j.file", new File(logDirectory, "desdemona.log").getAbsolutePath()); logger = new Log4JWrapper(); }
private void initializeLogging() { final File logDirectory = new File(JiveGlobals.getHomeDirectory(), "logs"); System.setProperty("thinkparity.log4j.file", new File(logDirectory, "desdemona.log").getAbsolutePath()); logger = new Log4JWrapper(); }
1,115,178
private void reloadJList() { final List<TeamMember> teamMembers; final List<Contact> contacts; final Map<User, ArtifactReceipt> versionUsers; final User publisher; Boolean firstContact; if (getPublishTypeSpecific() == PublishTypeSpecific.PUBLISH_NOT_FIRST_TIME) { teamMembers = readTeamMembers(); versionUsers = readLatestVersionUsers(); publisher = readPublisher(); firstContact = !teamMembers.isEmpty(); } else { teamMembers = Collections.emptyList(); versionUsers = null; publisher = null; firstContact = Boolean.FALSE; } contacts = readContacts(teamMembers); namesListModel.clear(); for (final TeamMember teamMember : teamMembers) { namesListModel.addElement(new PublishContainerAvatarUser(teamMember, isVersionUser(teamMember, publisher, versionUsers))); } for (final Contact contact : contacts) { namesListModel.addElement(new PublishContainerAvatarUser(contact, Boolean.FALSE, firstContact)); firstContact = Boolean.FALSE; } }
private void reloadJList() { final List<TeamMember> teamMembers; final List<Contact> contacts; final Map<User, ArtifactReceipt> versionUsers; final User publisher; Boolean firstContact; if (getPublishTypeSpecific() == PublishTypeSpecific.PUBLISH_NOT_FIRST_TIME) { teamMembers = readTeamMembers(); versionUsers = readLatestVersionUsers(); publisher = readLatestPublisher(); firstContact = !teamMembers.isEmpty(); } else { teamMembers = Collections.emptyList(); versionUsers = null; publisher = null; firstContact = Boolean.FALSE; } contacts = readContacts(teamMembers); namesListModel.clear(); for (final TeamMember teamMember : teamMembers) { namesListModel.addElement(new PublishContainerAvatarUser(teamMember, isVersionUser(teamMember, publisher, versionUsers))); } for (final Contact contact : contacts) { namesListModel.addElement(new PublishContainerAvatarUser(contact, Boolean.FALSE, firstContact)); firstContact = Boolean.FALSE; } }
1,115,179
public void init( ExtendedProperties configuration) { rsvc.info("WebappLoader : initialization starting."); Object o = rsvc.getApplicationAttribute( "org.apache.velocity.tools.view.servlet.WebappLoader" ); if ( o instanceof WebappLoaderAppContext) { servletContext = ( (WebappLoaderAppContext) o ).getServletContext(); } else rsvc.error("WebappLoader : unable to retrieve ServletContext"); rsvc.info("WebappLoader : initialization complete."); }
public void init( ExtendedProperties configuration) { rsvc.info("WebappLoader : initialization starting."); Object obj = rsvc.getApplicationAttribute(VelocityViewServlet.SERVLET_CONTEXT_KEY); if ( o instanceof WebappLoaderAppContext) { servletContext = ( (WebappLoaderAppContext) o ).getServletContext(); } else rsvc.error("WebappLoader : unable to retrieve ServletContext"); rsvc.info("WebappLoader : initialization complete."); }
1,115,180
public void init( ExtendedProperties configuration) { rsvc.info("WebappLoader : initialization starting."); Object o = rsvc.getApplicationAttribute( "org.apache.velocity.tools.view.servlet.WebappLoader" ); if ( o instanceof WebappLoaderAppContext) { servletContext = ( (WebappLoaderAppContext) o ).getServletContext(); } else rsvc.error("WebappLoader : unable to retrieve ServletContext"); rsvc.info("WebappLoader : initialization complete."); }
public void init( ExtendedProperties configuration) { rsvc.info("WebappLoader : initialization starting."); Object o = rsvc.getApplicationAttribute( "org.apache.velocity.tools.view.servlet.WebappLoader" ); if (obj instanceof ServletContext) { servletContext = ( (WebappLoaderAppContext) o ).getServletContext(); } else rsvc.error("WebappLoader : unable to retrieve ServletContext"); rsvc.info("WebappLoader : initialization complete."); }
1,115,181
public void init( ExtendedProperties configuration) { rsvc.info("WebappLoader : initialization starting."); Object o = rsvc.getApplicationAttribute( "org.apache.velocity.tools.view.servlet.WebappLoader" ); if ( o instanceof WebappLoaderAppContext) { servletContext = ( (WebappLoaderAppContext) o ).getServletContext(); } else rsvc.error("WebappLoader : unable to retrieve ServletContext"); rsvc.info("WebappLoader : initialization complete."); }
public void init( ExtendedProperties configuration) { rsvc.info("WebappLoader : initialization starting."); Object o = rsvc.getApplicationAttribute( "org.apache.velocity.tools.view.servlet.WebappLoader" ); if ( o instanceof WebappLoaderAppContext) { servletContext = (ServletContext)obj; } else rsvc.error("WebappLoader : unable to retrieve ServletContext"); rsvc.info("WebappLoader : initialization complete."); }
1,115,182
public Applet(String moduleName) { super(moduleName); // TODO Auto-generated constructor stub }
public Applet(String moduleName) { super(moduleName); // TODO Auto-generated constructor stub }
1,115,183
public void setUtcTimeOnly(int field, Date value) { setUtcTimeOnly(field, value, false); }
public void setUtcTimeOnly(int field, Date value) throws NoTagValue { setUtcTimeOnly(field, value, false); }
1,115,184
public UtilDateTypeConverterImpl(ValueFactory factory) { super(factory); }
public UtilDateTypeConverterImpl(ValueFactory factory) { super(factory); }
1,115,185
public void testExternalDocument() { ExternalDocument externalDocument = new ExternalDocument(); externalDocument.setId(Long.MAX_VALUE); externalDocument.setId(Long.MIN_VALUE); externalDocument.setEntity(new Entity()); externalDocument.setDocCode(""); externalDocument.setDocName(""); externalDocument.setDocUrl(""); externalDocument.setDocType(DocumentType.CATEGORY.getValue()); externalDocument.setDocType(DocumentType.FILE.getValue()); externalDocument.setDocType(DocumentType.FOLDER.getValue()); externalDocument.setParent(new ExternalDocument()); }
public void testExternalDocument() { ExternalDocument externalDocument = new ExternalDocument(); externalDocument.setId(Long.MAX_VALUE); externalDocument.setId(Long.MIN_VALUE); externalDocument.setEntity(new Entity()); externalDocument.setDocCode(""); externalDocument.setDocName(""); externalDocument.setDocUrl(""); externalDocument.setDocType(DocumentType.CATEGORY.getValue()); externalDocument.setDocType(DocumentType.FILE.getValue()); externalDocument.setDocType(DocumentType.FOLDER.getValue()); }
1,115,187
protected final Map createEnvVarMap() { Map env = new HashMap(); buildEnvVars(env); return env; }
protected final Map createEnvVarMap(boolean overrideOnly) { Map env = new HashMap(); buildEnvVars(env); return env; }
1,115,190
protected final boolean run(Launcher launcher, String cmd, TaskListener listener, FilePath dir, OutputStream out) throws IOException { Map env = createEnvVarMap(); int r = launcher.launch(cmd,env,out,dir).join(); if(r!=0) listener.fatalError(getDescriptor().getDisplayName()+" failed"); return r==0; }
protected final boolean run(Launcher launcher, String cmd, TaskListener listener, FilePath dir, OutputStream out) throws IOException { Map env = createEnvVarMap(true); int r = launcher.launch(cmd,env,out,dir).join(); if(r!=0) listener.fatalError(getDescriptor().getDisplayName()+" failed"); return r==0; }
1,115,192
public Job doCreateJob(StaplerRequest req, StaplerResponse rsp) throws IOException { if(!Hudson.adminCheck(req,rsp)) return null; Job job = owner.doCreateJob(req, rsp); if(job!=null) { jobNames.add(job.getName()); owner.save(); } return job; }
public Job doCreateJob(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { if(!Hudson.adminCheck(req,rsp)) return null; Job job = owner.doCreateJob(req, rsp); if(job!=null) { jobNames.add(job.getName()); owner.save(); } return job; }
1,115,194
public abstract RecipeDetailsView getRecipeDetailsView();
public abstract RecipeDetailsView getRecipeDetailsView(String title);
1,115,195
public void validatePrincipal(Credential credential, Errors errors) { if (logger.isDebugEnabled()) { logger.debug("Validating Credential principal"); } String principal = credential.getPrincipal(); if (principal != null && principal.length() > 0) { errors.rejectValue("principal", "credential.error.whitespace", "Credential principal should not be empty or have whitespace"); } for (char c : principal.toCharArray()) { if (!Character.isLetterOrDigit(c)) { errors.rejectValue("principal", "credential.error.invalidchar", "Credential principal should include invalid char " + c); } } }
public void validatePrincipal(Credential credential, Errors errors) { if (logger.isDebugEnabled()) { logger.debug("Validating Credential principal"); } String principal = credential.getPrincipal(); if (principal == null || principal.length() == 0) { errors.rejectValue("principal", "credential.error.whitespace", "Credential principal should not be empty or have whitespace"); } for (char c : principal.toCharArray()) { if (!Character.isLetterOrDigit(c)) { errors.rejectValue("principal", "credential.error.invalidchar", "Credential principal should include invalid char " + c); } } }
1,115,197
public void validatePrincipal(Credential credential, Errors errors) { if (logger.isDebugEnabled()) { logger.debug("Validating Credential principal"); } String principal = credential.getPrincipal(); if (principal != null && principal.length() > 0) { errors.rejectValue("principal", "credential.error.whitespace", "Credential principal should not be empty or have whitespace"); } for (char c : principal.toCharArray()) { if (!Character.isLetterOrDigit(c)) { errors.rejectValue("principal", "credential.error.invalidchar", "Credential principal should include invalid char " + c); } } }
public void validatePrincipal(Credential credential, Errors errors) { if (logger.isDebugEnabled()) { logger.debug("Validating Credential principal"); } String principal = credential.getPrincipal(); if (principal != null && principal.length() > 0) { errors.rejectValue("principal", "credential.error.empty", "Credential principal should not be empty or have whitespace"); } for (char c : principal.toCharArray()) { if (!Character.isLetterOrDigit(c)) { errors.rejectValue("principal", "credential.error.invalidchar", "Credential principal should include invalid char " + c); } } }
1,115,198
public void validatePrincipal(Credential credential, Errors errors) { if (logger.isDebugEnabled()) { logger.debug("Validating Credential principal"); } String principal = credential.getPrincipal(); if (principal != null && principal.length() > 0) { errors.rejectValue("principal", "credential.error.whitespace", "Credential principal should not be empty or have whitespace"); } for (char c : principal.toCharArray()) { if (!Character.isLetterOrDigit(c)) { errors.rejectValue("principal", "credential.error.invalidchar", "Credential principal should include invalid char " + c); } } }
public void validatePrincipal(Credential credential, Errors errors) { if (logger.isDebugEnabled()) { logger.debug("Validating Credential principal"); } String principal = credential.getPrincipal(); if (principal != null && principal.length() > 0) { errors.rejectValue("principal", "credential.error.whitespace", "Credential principal should not be empty or have whitespace"); } for (char c : principal.toCharArray()) { if (!Character.isLetterOrDigit(c)) { errors.rejectValue("principal", "credential.error.invalidchar", "Credential principal should include invalid char " + c); } } }
1,115,199
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
1,115,200
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
1,115,201
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { getLog().onEvent( "Refresh at logon requested, but message store not capable: " + getStore().getClass().getName()); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
1,115,202
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
1,115,203
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { } catch (IOException e) { LogUtil.logThrowable(sessionID, "error processing message", e); } } if (!checkSessionTime()) { reset(); } catch (IOException e) { LogUtil.logThrowable(sessionID, "error processing message", e); } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } } catch (IOException e) { LogUtil.logThrowable(sessionID, "error processing message", e); } if (state.getHeartBeatInterval() == 0) { } catch (IOException e) { LogUtil.logThrowable(sessionID, "error processing message", e); } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { } catch (IOException e) { LogUtil.logThrowable(sessionID, "error processing message", e); } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
1,115,204
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
public synchronized void next() throws IOException { if (!enabled) { if (isLoggedOn()) { if (!state.isLogoutSent()) { state.logEvent("Initiated logout request"); generateLogout(logoutReason); } } else { return; } } if (!checkSessionTime()) { reset(); return; } if (!state.isLogonReceived()) { if (state.isLogonSendNeeded()) { if (generateLogon()) { state.logEvent("Initiated logon request"); } else { state.logEvent("Error during logon request initiation"); } } else if (state.isLogonAlreadySent() && state.isLogonTimedOut()) { state.logEvent("Timed out waiting for logon response"); disconnect(); } return; } if (state.getHeartBeatInterval() == 0) { return; } if (state.isLogoutTimedOut()) { state.logEvent("Timed out waiting for logout response"); disconnect(); } if (state.isWithinHeartBeat()) { return; } if (state.isTimedOut()) { state.logEvent("Timed out waiting for heartbeat"); disconnect(); } else { if (state.isTestRequestNeeded()) { generateTestRequest("TEST"); state.incrementTestRequestCounter(); state.logEvent("Sent test request TEST"); } else if (state.isHeartBeatNeeded()) { generateHeartbeat(); } } }
1,115,205
public String getString(String name, String defaultValue) { String result = getString(name); return (result == null) ? defaultValue : result; }
public String getString(String name, String defaultValue) { String result = getString(name); return (result == null) ? defaultValue : result; }
1,115,206
public MatrixValueI evaluate(MatrixNodeI node,MatrixJep mjep) throws ParseException { this.mjep=mjep; return (MatrixValueI) node.jjtAccept(this,null); }
public MatrixValueI evaluate(MatrixNodeI node,MatrixJep mj) throws ParseException { this.mjep=mjep; return (MatrixValueI) node.jjtAccept(this,null); }
1,115,207
public MatrixValueI evaluate(MatrixNodeI node,MatrixJep mjep) throws ParseException { this.mjep=mjep; return (MatrixValueI) node.jjtAccept(this,null); }
public MatrixValueI evaluate(MatrixNodeI node,MatrixJep mjep) throws ParseException { this.mjep=mj; return (MatrixValueI) node.jjtAccept(this,null); }
1,115,208
public void formatValue(Object val,StringBuffer sb) { if(format != null) { if(val instanceof Number) format.format(val,sb,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb.append(((Complex) val).toString(format,true)); else sb.append(((Complex) val).toString(format)); } else sb.append(val); } else sb.append(val); }
public void formatValue(Object val,StringBuffer sb1) { if(format != null) { if(val instanceof Number) format.format(val,sb,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb.append(((Complex) val).toString(format,true)); else sb.append(((Complex) val).toString(format)); } else sb.append(val); } else sb.append(val); }
1,115,209
public void formatValue(Object val,StringBuffer sb) { if(format != null) { if(val instanceof Number) format.format(val,sb,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb.append(((Complex) val).toString(format,true)); else sb.append(((Complex) val).toString(format)); } else sb.append(val); } else sb.append(val); }
public void formatValue(Object val,StringBuffer sb) { if(format != null) { if(val instanceof Number) format.format(val,sb1,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb.append(((Complex) val).toString(format,true)); else sb.append(((Complex) val).toString(format)); } else sb.append(val); } else sb.append(val); }
1,115,210
public void formatValue(Object val,StringBuffer sb) { if(format != null) { if(val instanceof Number) format.format(val,sb,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb.append(((Complex) val).toString(format,true)); else sb.append(((Complex) val).toString(format)); } else sb.append(val); } else sb.append(val); }
public void formatValue(Object val,StringBuffer sb) { if(format != null) { if(val instanceof Number) format.format(val,sb,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb1.append(((Complex) val).toString(format,true)); else sb.append(((Complex) val).toString(format)); } else sb.append(val); } else sb.append(val); }
1,115,211
public void formatValue(Object val,StringBuffer sb) { if(format != null) { if(val instanceof Number) format.format(val,sb,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb.append(((Complex) val).toString(format,true)); else sb.append(((Complex) val).toString(format)); } else sb.append(val); } else sb.append(val); }
public void formatValue(Object val,StringBuffer sb) { if(format != null) { if(val instanceof Number) format.format(val,sb,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb.append(((Complex) val).toString(format,true)); else sb1.append(((Complex) val).toString(format)); } else sb.append(val); } else sb.append(val); }
1,115,212
public void formatValue(Object val,StringBuffer sb) { if(format != null) { if(val instanceof Number) format.format(val,sb,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb.append(((Complex) val).toString(format,true)); else sb.append(((Complex) val).toString(format)); } else sb.append(val); } else sb.append(val); }
public void formatValue(Object val,StringBuffer sb) { if(format != null) { if(val instanceof Number) format.format(val,sb,fp); else if(val instanceof Complex) { if((mode | COMPLEX_I) == COMPLEX_I) sb.append(((Complex) val).toString(format,true)); else sb.append(((Complex) val).toString(format)); } else sb1.append(val); } else sb1.append(val); }
1,115,213
private boolean testRight(XOperator top,Node rhs){ if((mode & FULL_BRACKET)!= 0) { return true; } else if(rhs instanceof ASTFunNode && ((ASTFunNode) rhs).isOperator()) { XOperator rhsop = (XOperator) ((ASTFunNode) rhs).getOperator(); if(top == rhsop) { if(top.getBinding() == XOperator.RIGHT // 1=(2=3) -> 1=2=3 || top.isAssociative() ) // 1+(2-3) -> 1+2-3 return false; else return true; // 1-(2+3) -> 1-(2-3) } else if(top.getPrecedence() == rhsop.getPrecedence()) { if(top.getBinding() == XOperator.LEFT && top.isAssociative() ) // 1+(2-3) -> 1+2-3) return false; // a+(b-c) -> a+b-c else return true; // a-(b+c) -> a-(b+c) } else if(top.getPrecedence() > rhsop.getPrecedence()) // 1+(2*3) -> 1+2*3 return false; else return true; } else return false;}
private boolean testRight(XOperator top,Node rhs){ if((mode & FULL_BRACKET)!= 0) { return true; } else if(rhs instanceof ASTFunNode && ((ASTFunNode) rhs).isOperator()) { XOperator rhsop = (XOperator) ((ASTFunNode) rhs).getOperator(); if(top == rhsop) { if(top.getBinding() == XOperator.RIGHT // 1=(2=3) -> 1=2=3 || top.isAssociative() ) // 1+(2-3) -> 1+2-3 return false; else return true; // 1-(2+3) -> 1-(2-3) } else if(top.getPrecedence() == rhsop.getPrecedence()) { if(top.getBinding() == XOperator.LEFT && top.isAssociative() ) // 1+(2-3) -> 1+2-3) return false; // a+(b-c) -> a+b-c else return true; // a-(b+c) -> a-(b+c) } else if(top.getPrecedence() > rhsop.getPrecedence()) // 1+(2*3) -> 1+2*3 return false; else return true; } else return false;}
1,115,214
public void run(Stack stack) throws ParseException { checkStack(stack); // check the stack Object param1,param2; // get the parameter from the stack param2 = stack.pop(); param1 = stack.pop(); if(param1 instanceof MVector) { if(param2 instanceof Double) { Object val = ((MVector) param1).getEle(((Double) param2).intValue()-1); stack.push(val); return; } else throw new ParseException("Bad second argument to ele, expecting a double "+param2.toString()); } else if(param1 instanceof Matrix) { if(param2 instanceof MVector) { MVector vec = (MVector) param2; if(vec.getDim().equals(Dimensions.TWO)) { Double d1 = (Double) vec.getEle(0); Double d2 = (Double) vec.getEle(1); Object val = ((Matrix) param1).getEle(d1.intValue()-1,d2.intValue()-1); stack.push(val); return; } } else throw new ParseException("Bad second argument to ele, expecting [i,j] "+param2.toString()); } else if(param1 instanceof Tensor) { throw new ParseException("Sorry don't know how to find elements for a tensor"); } throw new ParseException("ele requires a vector matrix or tensor for first argument it has "+param1.toString()); }
public void run(Stack stack) throws ParseException { checkStack(stack); // check the stack Object param1,param2; // get the parameter from the stack param2 = stack.pop(); param1 = stack.pop(); if(param1 instanceof MVector) { if(param2 instanceof Double) { Object val = ((MVector) param1).getEle(((Double) param2).intValue()-1); stack.push(val); return; } throw new ParseException("Bad second argument to ele, expecting a double "+param2.toString()); } else if(param1 instanceof Matrix) { if(param2 instanceof MVector) { MVector vec = (MVector) param2; if(vec.getDim().equals(Dimensions.TWO)) { Double d1 = (Double) vec.getEle(0); Double d2 = (Double) vec.getEle(1); Object val = ((Matrix) param1).getEle(d1.intValue()-1,d2.intValue()-1); stack.push(val); return; } } else throw new ParseException("Bad second argument to ele, expecting [i,j] "+param2.toString()); } else if(param1 instanceof Tensor) { throw new ParseException("Sorry don't know how to find elements for a tensor"); } throw new ParseException("ele requires a vector matrix or tensor for first argument it has "+param1.toString()); }
1,115,215
public Object getEle(int i,int j) { return data[i][j]; }
public Object getEle(int n) { return data[i][j]; }
1,115,216
public void doBuildStatus( StaplerRequest req, StaplerResponse rsp ) throws IOException { // see Hudson.doNocacheImages. this is a work around for a bug in Firefox rsp.sendRedirect(req.getContextPath()+"/nocacheImages/48x48/"+getBuildStatusUrl()); }
public void doBuildStatus( StaplerRequest req, StaplerResponse rsp ) throws IOException { // see Hudson.doNocacheImages. this is a work around for a bug in Firefox rsp.sendRedirect2(req.getContextPath()+"/nocacheImages/48x48/"+getBuildStatusUrl()); }
1,115,218
protected final void serveFile(StaplerRequest req, StaplerResponse rsp, File root, String icon, boolean serveDirIndex) throws IOException, ServletException { if(req.getQueryString()!=null) { req.setCharacterEncoding("UTF-8"); String path = req.getParameter("path"); if(path!=null) { rsp.sendRedirect(URLEncoder.encode(path,"UTF-8")); return; } } String path = req.getRestOfPath(); if(path.length()==0) path = "/"; if(path.indexOf("..")!=-1 || path.length()<1) { // don't serve anything other than files in the artifacts dir rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } File f = new File(root,path.substring(1)); boolean isFingerprint=false; if(f.getName().equals("*fingerprint*")) { f = f.getParentFile(); isFingerprint = true; } if(!f.exists()) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if(f.isDirectory()) { if(!req.getRequestURL().toString().endsWith("/")) { rsp.sendRedirect2(req.getRequestURL().append('/').toString()); return; } if(serveDirIndex) { req.setAttribute("it",this); List<Path> parentPaths = buildParentPath(path); req.setAttribute("parentPath",parentPaths); req.setAttribute("topPath", parentPaths.isEmpty() ? "." : repeat("../",parentPaths.size())); req.setAttribute("files",buildChildPathList(f)); req.setAttribute("icon",icon); req.getView(this,"dir.jsp").forward(req,rsp); return; } else { f = new File(f,"index.html"); } } FileInputStream in = new FileInputStream(f); try { if(isFingerprint) { Hudson hudson = Hudson.getInstance(); rsp.forward(hudson.getFingerprint(hudson.getDigestOf(in)),"/",req); } else { // serve the file String contentType = req.getServletContext().getMimeType(f.getPath()); rsp.setContentType(contentType); rsp.setContentLength((int)f.length()); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0) rsp.getOutputStream().write(buf,0,len); } } finally { in.close(); } }
protected final void serveFile(StaplerRequest req, StaplerResponse rsp, File root, String icon, boolean serveDirIndex) throws IOException, ServletException { if(req.getQueryString()!=null) { req.setCharacterEncoding("UTF-8"); String path = req.getParameter("path"); if(path!=null) { rsp.sendRedirect(URLEncoder.encode(path,"UTF-8")); return; } } String path = req.getRestOfPath(); if(path.length()==0) path = "/"; if(path.indexOf("..")!=-1 || path.length()<1) { // don't serve anything other than files in the artifacts dir rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } File f = new File(root,path.substring(1)); boolean isFingerprint=false; if(f.getName().equals("*fingerprint*")) { f = f.getParentFile(); isFingerprint = true; } if(!f.exists()) { rsp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } if(f.isDirectory()) { if(!req.getRequestURL().toString().endsWith("/")) { rsp.sendRedirect2(req.getRequestURL().append('/').toString()); return; } if(serveDirIndex) { req.setAttribute("it",this); List<Path> parentPaths = buildParentPath(path); req.setAttribute("parentPath",parentPaths); req.setAttribute("topPath", parentPaths.isEmpty() ? "." : repeat("../",parentPaths.size())); req.setAttribute("files",buildChildPathList(f)); req.setAttribute("icon",icon); req.getView(this,"dir.jelly").forward(req,rsp); return; } else { f = new File(f,"index.html"); } } FileInputStream in = new FileInputStream(f); try { if(isFingerprint) { Hudson hudson = Hudson.getInstance(); rsp.forward(hudson.getFingerprint(hudson.getDigestOf(in)),"/",req); } else { // serve the file String contentType = req.getServletContext().getMimeType(f.getPath()); rsp.setContentType(contentType); rsp.setContentLength((int)f.length()); byte[] buf = new byte[1024]; int len; while((len=in.read(buf))>0) rsp.getOutputStream().write(buf,0,len); } } finally { in.close(); } }
1,115,219
public static void doStuff(String str) { try { Node node = j.parse(str); Node proc = j.preprocess(node); Node simp = j.simplify(proc); MRpEval rpe = new MRpEval(j); MRpCommandList list = rpe.compile(simp); MRpRes res = rpe.evaluate(list); j.print(node); // conversion to String System.out.println("\nres " + res.toString()); // conversion to MatrixValueI MatrixValueI mat = res.toVecMat(); System.out.println("matrix " + mat.toString()); // conversion to array if(res.getDims().is1D()) { double vecArray[] = (double []) res.toArray(); System.out.print("["); for(int i=0;i<vecArray.length;++i) System.out.print(""+vecArray[i]+" "); System.out.println("]"); } else if(res.getDims().is2D()) { double matArray[][] = (double [][]) res.toArray(); System.out.print("["); for(int i=0;i<matArray.length;++i) { System.out.print("["); for(int j=0;j<matArray[i].length;++j) System.out.print(""+matArray[i][j]+" "); System.out.print("]"); } System.out.println("]"); } // List of commands System.out.println("Commands"); System.out.println(list.toString()); } catch(ParseException e) { System.out.println("Parse error "+e.getMessage()); } catch(Exception e) { System.out.println("evaluation error "+e.getMessage()); e.printStackTrace(); } }
public static void doStuff(String str) { try { Node node = j.parse(str); Node proc = j.preprocess(node); Node simp = j.simplify(proc); MRpEval rpe = new MRpEval(j); MRpCommandList list = rpe.compile(simp); MRpRes res = rpe.evaluate(list); j.print(node); // conversion to String System.out.println("\nres " + res.toString()); // conversion to MatrixValueI MatrixValueI mat = res.toVecMat(); System.out.println("matrix " + mat.toString()); // conversion to array if(res.getDims().is1D()) { double vecArray[] = (double []) res.toArray(); System.out.print("["); for(int i=0;i<vecArray.length;++i) System.out.print(""+vecArray[i]+" "); System.out.println("]"); } else if(res.getDims().is2D()) { double matArray[][] = (double [][]) res.toArray(); System.out.print("["); for(int i=0;i<matArray.length;++i) { System.out.print("["); for(int j=0;j<matArray[i].length;++j) System.out.print(""+matArray[i][j]+" "); System.out.print("]"); } System.out.println("]"); } // List of commands System.out.println("Commands"); System.out.println(list.toString()); } catch(ParseException e) { System.out.println("Parse error "+e.getMessage()); } catch(Exception e) { System.out.println("evaluation error "+e.getMessage()); e.printStackTrace(); } }
1,115,220
public static void doStuff(String str) { try { Node node = j.parse(str); Node proc = j.preprocess(node); Node simp = j.simplify(proc); MRpEval rpe = new MRpEval(j); MRpCommandList list = rpe.compile(simp); MRpRes res = rpe.evaluate(list); j.print(node); // conversion to String System.out.println("\nres " + res.toString()); // conversion to MatrixValueI MatrixValueI mat = res.toVecMat(); System.out.println("matrix " + mat.toString()); // conversion to array if(res.getDims().is1D()) { double vecArray[] = (double []) res.toArray(); System.out.print("["); for(int i=0;i<vecArray.length;++i) System.out.print(""+vecArray[i]+" "); System.out.println("]"); } else if(res.getDims().is2D()) { double matArray[][] = (double [][]) res.toArray(); System.out.print("["); for(int i=0;i<matArray.length;++i) { System.out.print("["); for(int j=0;j<matArray[i].length;++j) System.out.print(""+matArray[i][j]+" "); System.out.print("]"); } System.out.println("]"); } // List of commands System.out.println("Commands"); System.out.println(list.toString()); } catch(ParseException e) { System.out.println("Parse error "+e.getMessage()); } catch(Exception e) { System.out.println("evaluation error "+e.getMessage()); e.printStackTrace(); } }
public static void doStuff(String str) { try { Node node = j.parse(str); Node proc = j.preprocess(node); Node simp = j.simplify(proc); MRpCommandList list = rpe.compile(simp); MRpRes res = rpe.evaluate(list); j.print(node); // conversion to String System.out.println("\nres " + res.toString()); // conversion to MatrixValueI MatrixValueI mat = res.toVecMat(); System.out.println("matrix " + mat.toString()); // conversion to array if(res.getDims().is1D()) { double vecArray[] = (double []) res.toArray(); System.out.print("["); for(int i=0;i<vecArray.length;++i) System.out.print(""+vecArray[i]+" "); System.out.println("]"); } else if(res.getDims().is2D()) { double matArray[][] = (double [][]) res.toArray(); System.out.print("["); for(int i=0;i<matArray.length;++i) { System.out.print("["); for(int j=0;j<matArray[i].length;++j) System.out.print(""+matArray[i][j]+" "); System.out.print("]"); } System.out.println("]"); } // List of commands System.out.println("Commands"); System.out.println(list.toString()); } catch(ParseException e) { System.out.println("Parse error "+e.getMessage()); } catch(Exception e) { System.out.println("evaluation error "+e.getMessage()); e.printStackTrace(); } }
1,115,221
public static void doStuff(String str) { try { Node node = j.parse(str); Node proc = j.preprocess(node); Node simp = j.simplify(proc); MRpEval rpe = new MRpEval(j); MRpCommandList list = rpe.compile(simp); MRpRes res = rpe.evaluate(list); j.print(node); // conversion to String System.out.println("\nres " + res.toString()); // conversion to MatrixValueI MatrixValueI mat = res.toVecMat(); System.out.println("matrix " + mat.toString()); // conversion to array if(res.getDims().is1D()) { double vecArray[] = (double []) res.toArray(); System.out.print("["); for(int i=0;i<vecArray.length;++i) System.out.print(""+vecArray[i]+" "); System.out.println("]"); } else if(res.getDims().is2D()) { double matArray[][] = (double [][]) res.toArray(); System.out.print("["); for(int i=0;i<matArray.length;++i) { System.out.print("["); for(int j=0;j<matArray[i].length;++j) System.out.print(""+matArray[i][j]+" "); System.out.print("]"); } System.out.println("]"); } // List of commands System.out.println("Commands"); System.out.println(list.toString()); } catch(ParseException e) { System.out.println("Parse error "+e.getMessage()); } catch(Exception e) { System.out.println("evaluation error "+e.getMessage()); e.printStackTrace(); } }
public static void doStuff(String str) { try { Node node = j.parse(str); Node proc = j.preprocess(node); Node simp = j.simplify(proc); MRpEval rpe = new MRpEval(j); MRpCommandList list = rpe.compile(simp); MRpRes res = rpe.evaluate(list); mj.print(node); // conversion to String System.out.println("\nres " + res.toString()); // conversion to MatrixValueI MatrixValueI mat = res.toVecMat(); System.out.println("matrix " + mat.toString()); // conversion to array if(res.getDims().is1D()) { double vecArray[] = (double []) res.toArray(); System.out.print("["); for(int i=0;i<vecArray.length;++i) System.out.print(""+vecArray[i]+" "); System.out.println("]"); } else if(res.getDims().is2D()) { double matArray[][] = (double [][]) res.toArray(); System.out.print("["); for(int i=0;i<matArray.length;++i) { System.out.print("["); for(int j=0;j<matArray[i].length;++j) System.out.print(""+matArray[i][j]+" "); System.out.print("]"); } System.out.println("]"); } // List of commands System.out.println("Commands"); System.out.println(list.toString()); } catch(ParseException e) { System.out.println("Parse error "+e.getMessage()); } catch(Exception e) { System.out.println("evaluation error "+e.getMessage()); e.printStackTrace(); } }
1,115,222
public static void main(String args[]) { j = new MatrixJep(); j.addStandardConstants(); j.addStandardFunctions(); j.addComplex(); j.setAllowUndeclared(true); j.setImplicitMul(true); j.setAllowAssignment(true); // parse and evaluate each equation in turn doStuff("[1,2,3]"); // Value: [1.0,2.0,3.0] doStuff("[1,2,3].[4,5,6]"); // Value: 32.0 doStuff("[1,2,3]^[4,5,6]"); // Value: [-3.0,6.0,-3.0] doStuff("[1,2,3]+[4,5,6]"); // Value: [5.0,7.0,9.0] doStuff("[[1,2],[3,4]]"); // Value: [[1.0,2.0],[3.0,4.0]] doStuff("[[1,2],[3,4]]*[1,0]"); // Value: [1.0,3.0] doStuff("[1,0]*[[1,2],[3,4]]"); // Value: [1.0,2.0] doStuff("[[1,2],[3,4]]*[[1,2],[3,4]]"); // Value: [[7.0,10.0],[15.0,22.0]] // vectors and matricies can be used with assignment// doStuff("x=[1,2,3]"); // Value: [1.0,2.0,3.0]// doStuff("x+x"); // Value: [2.0,4.0,6.0]// doStuff("x . x"); // Value: 14.0// doStuff("x^x"); // Value: [0.0,0.0,0.0]// doStuff("y=[[1,2],[3,4]]"); // Value: [[1.0,2.0],[3.0,4.0]]// doStuff("y * y"); // Value: [[7.0,10.0],[15.0,22.0]] // accessing the elements on an array or vector// doStuff("ele(x,2)"); // Value: 2.0// doStuff("ele(y,[1,2])"); // Value: 2.0 // using differentation// doStuff("x=2"); // 2.0// doStuff("y=[x^3,x^2,x]"); // [8.0,4.0,2.0]// doStuff("z=diff(y,x)"); // [12.0,4.0,1.0]// doStuff("diff([x^3,x^2,x],x)");// System.out.println("dim(z) "+((MatrixVariableI) j.getVar("z")).getDimensions()); }
public static void main(String args[]) { j = new MatrixJep(); j.addStandardConstants(); j.addStandardFunctions(); j.addComplex(); j.setAllowUndeclared(true); j.setImplicitMul(true); j.setAllowAssignment(true); // parse and evaluate each equation in turn doStuff("[1,2,3]"); // Value: [1.0,2.0,3.0] doStuff("[1,2,3].[4,5,6]"); // Value: 32.0 doStuff("[1,2,3]^[4,5,6]"); // Value: [-3.0,6.0,-3.0] doStuff("[1,2,3]+[4,5,6]"); // Value: [5.0,7.0,9.0] doStuff("[[1,2],[3,4]]"); // Value: [[1.0,2.0],[3.0,4.0]] doStuff("[[1,2],[3,4]]*[1,0]"); // Value: [1.0,3.0] doStuff("[1,0]*[[1,2],[3,4]]"); // Value: [1.0,2.0] doStuff("[[1,2],[3,4]]*[[1,2],[3,4]]"); // Value: [[7.0,10.0],[15.0,22.0]] // vectors and matricies can be used with assignment// doStuff("x=[1,2,3]"); // Value: [1.0,2.0,3.0]// doStuff("x+x"); // Value: [2.0,4.0,6.0]// doStuff("x . x"); // Value: 14.0// doStuff("x^x"); // Value: [0.0,0.0,0.0]// doStuff("y=[[1,2],[3,4]]"); // Value: [[1.0,2.0],[3.0,4.0]]// doStuff("y * y"); // Value: [[7.0,10.0],[15.0,22.0]] // accessing the elements on an array or vector// doStuff("ele(x,2)"); // Value: 2.0// doStuff("ele(y,[1,2])"); // Value: 2.0 // using differentation// doStuff("x=2"); // 2.0// doStuff("y=[x^3,x^2,x]"); // [8.0,4.0,2.0]// doStuff("z=diff(y,x)"); // [12.0,4.0,1.0]// doStuff("diff([x^3,x^2,x],x)");// System.out.println("dim(z) "+((MatrixVariableI) j.getVar("z")).getDimensions()); }
1,115,223
public final MRpCommandList compile(Node node) throws ParseException { curCommandList = new MRpCommandList(); node.jjtAccept(this,null); scalerStore.alloc(); v2Store.alloc(); v3Store.alloc(); v4Store.alloc(); vnStore.alloc(); m22Store.alloc(); m23Store.alloc(); m24Store.alloc(); m32Store.alloc(); m33Store.alloc(); m34Store.alloc(); m42Store.alloc(); m43Store.alloc(); m44Store.alloc(); mnnStore.alloc(); Dimensions dims = ((MatrixNodeI) node).getDim(); curCommandList.setFinalType(getDimType(dims));// returnObj = Tensor.getInstance(dims);// if(dims.is2D())// returnMat = (Matrix) returnObj; return curCommandList; }
public final MRpCommandList compile(MatrixVariableI var,Node node) throws ParseException { curCommandList = new MRpCommandList(); node.jjtAccept(this,null); scalerStore.alloc(); v2Store.alloc(); v3Store.alloc(); v4Store.alloc(); vnStore.alloc(); m22Store.alloc(); m23Store.alloc(); m24Store.alloc(); m32Store.alloc(); m33Store.alloc(); m34Store.alloc(); m42Store.alloc(); m43Store.alloc(); m44Store.alloc(); mnnStore.alloc(); Dimensions dims = ((MatrixNodeI) node).getDim(); curCommandList.setFinalType(getDimType(dims));// returnObj = Tensor.getInstance(dims);// if(dims.is2D())// returnMat = (Matrix) returnObj; return curCommandList; }
1,115,225
public final MRpCommandList compile(Node node) throws ParseException { curCommandList = new MRpCommandList(); node.jjtAccept(this,null); scalerStore.alloc(); v2Store.alloc(); v3Store.alloc(); v4Store.alloc(); vnStore.alloc(); m22Store.alloc(); m23Store.alloc(); m24Store.alloc(); m32Store.alloc(); m33Store.alloc(); m34Store.alloc(); m42Store.alloc(); m43Store.alloc(); m44Store.alloc(); mnnStore.alloc(); Dimensions dims = ((MatrixNodeI) node).getDim(); curCommandList.setFinalType(getDimType(dims));// returnObj = Tensor.getInstance(dims);// if(dims.is2D())// returnMat = (Matrix) returnObj; return curCommandList; }
public final MRpCommandList compile(Node node) throws ParseException { curCommandList = new MRpCommandList(); node.jjtAccept(this,null); scalerStore.alloc(); v2Store.alloc(); v3Store.alloc(); v4Store.alloc(); vnStore.alloc(); m22Store.alloc(); m23Store.alloc(); m24Store.alloc(); m32Store.alloc(); m33Store.alloc(); m34Store.alloc(); m42Store.alloc(); m43Store.alloc(); m44Store.alloc(); mnnStore.alloc(); Dimensions dims = ((MatrixNodeI) node).getDim(); curCommandList.setFinalType(getDimType(dims));// returnObj = Tensor.getInstance(dims);// if(dims.is2D())// returnMat = (Matrix) returnObj; return curCommandList; }
1,115,226
public MatrixJep() { super(); nf = new MatrixNodeFactory(); symTab = new DSymbolTable(mvf); opSet = new MatrixOperatorSet(); /* Operator.OP_ADD.setPFMC(new MAdd()); Operator.OP_SUBTRACT.setPFMC(new MSubtract()); Operator.OP_MULTIPLY.setPFMC(new MMultiply()); Operator.OP_POWER.setPFMC(new MPower()); Operator.OP_UMINUS.setPFMC(new MUMinus()); Operator.OP_DOT.setPFMC(new MDot()); Operator.OP_CROSS.setPFMC(new ExteriorProduct()); Operator.OP_ASSIGN.setPFMC(new Assignment());*/ Operator tens = ((MatrixOperatorSet) opSet).getMTensorFun(); pv.addSpecialRule(tens,(PrintVisitor.PrintRulesI) tens.getPFMC()); dv.addDiffRule(new PassThroughDiffRule(tens.getName(),tens.getPFMC())); }
public MatrixJep() { super(); nf = new MatrixNodeFactory(); symTab = new DSymbolTable(mvf); opSet = new MatrixOperatorSet(); /* Operator.OP_ADD.setPFMC(new MAdd()); Operator.OP_SUBTRACT.setPFMC(new MSubtract()); Operator.OP_MULTIPLY.setPFMC(new MMultiply()); Operator.OP_POWER.setPFMC(new MPower()); Operator.OP_UMINUS.setPFMC(new MUMinus()); Operator.OP_DOT.setPFMC(new MDot()); Operator.OP_CROSS.setPFMC(new ExteriorProduct()); Operator.OP_ASSIGN.setPFMC(new Assignment());*/ this.parser.setInitialTokenManagerState(Parser.NO_DOT_IN_IDENTIFIERS); Operator tens = ((MatrixOperatorSet) opSet).getMList(); pv.addSpecialRule(tens,(PrintVisitor.PrintRulesI) tens.getPFMC()); dv.addDiffRule(new PassThroughDiffRule(tens.getName(),tens.getPFMC())); }
1,115,227
public MatrixJep() { super(); nf = new MatrixNodeFactory(); symTab = new DSymbolTable(mvf); opSet = new MatrixOperatorSet(); /* Operator.OP_ADD.setPFMC(new MAdd()); Operator.OP_SUBTRACT.setPFMC(new MSubtract()); Operator.OP_MULTIPLY.setPFMC(new MMultiply()); Operator.OP_POWER.setPFMC(new MPower()); Operator.OP_UMINUS.setPFMC(new MUMinus()); Operator.OP_DOT.setPFMC(new MDot()); Operator.OP_CROSS.setPFMC(new ExteriorProduct()); Operator.OP_ASSIGN.setPFMC(new Assignment());*/ Operator tens = ((MatrixOperatorSet) opSet).getMTensorFun(); pv.addSpecialRule(tens,(PrintVisitor.PrintRulesI) tens.getPFMC()); dv.addDiffRule(new PassThroughDiffRule(tens.getName(),tens.getPFMC())); }
public MatrixJep() { super(); nf = new MatrixNodeFactory(); symTab = new DSymbolTable(mvf); opSet = new MatrixOperatorSet(); /* Operator.OP_ADD.setPFMC(new MAdd()); Operator.OP_SUBTRACT.setPFMC(new MSubtract()); Operator.OP_MULTIPLY.setPFMC(new MMultiply()); Operator.OP_POWER.setPFMC(new MPower()); Operator.OP_UMINUS.setPFMC(new MUMinus()); Operator.OP_DOT.setPFMC(new MDot()); Operator.OP_CROSS.setPFMC(new ExteriorProduct()); Operator.OP_ASSIGN.setPFMC(new Assignment());*/ Operator tens = ((MatrixOperatorSet) opSet).getMTensorFun(); pv.addSpecialRule(tens,(PrintVisitor.PrintRulesI) tens.getPFMC()); addDiffRule(new PassThroughDiffRule(tens.getName(),tens.getPFMC())); Operator cross = ((MatrixOperatorSet) opSet).getCross(); addDiffRule(new MultiplyDiffRule(cross.getName(),cross)); Operator dot = ((MatrixOperatorSet) opSet).getDot(); addDiffRule(new MultiplyDiffRule(dot.getName(),dot)); }
1,115,228
public Fermentable(){ // default constructor setName(""); pppg = 0; lov = 0; setAmount(1.0); setUnits("pounds"); mashed = true; // I want to get options working sometime, // but can't figure out how: // myOptions.getProperty("optMaltUnits"); }
public Fermentable(){ // default constructor setName(""); pppg = 0; lov = 0; setAmount(1.0); setUnits("pounds"); mashed = true; // I want to get options working sometime, // but can't figure out how: // myOptions.getProperty("optMaltUnits"); }
1,115,234
public Partner(Entity entity, String alias, char state, boolean strong) { this.entity = entity; this.alias = alias; this.state = state; this.strong = strong; }
public Partner(Entity entity, String alias, char state, boolean strong) { this.entity = entity; this.alias = alias; this.state = state; this.strong = strong; }
1,115,235
public void addSeismogram(DataSetSeismogram seis){ ampConfig.addSeismogram(seis); seismograms.put(seis, ampConfig.getAmpRange(seis)); }
public void addSeismogram(DataSetSeismogram seis){ ampConfig.addSeismogram(seis); }
1,115,236
public void removeSeismogram(DataSetSeismogram seis){ ampConfig.removeSeismogram(seis); seismograms.remove(seis); }
public void removeSeismogram(DataSetSeismogram seis){ ampConfig.removeSeismogram(seis); }
1,115,237
public void testUserRole() { UserRole userRole = new UserRole(); userRole.setId(Long.MAX_VALUE); userRole.setId(Long.MIN_VALUE); userRole.setUser(new User()); userRole.setService(new Service()); userRole.setServiceExtension(""); }
public void testUserRole() { UserRole userRole = new UserRole(); userRole.setId(Long.MAX_VALUE); userRole.setId(Long.MIN_VALUE); userRole.setUserGroup(new UserGroup()); userRole.setUserGroup(new User()); userRole.setService(new Service()); userRole.setServiceExtension(""); }
1,115,239
public void testUserRoleEquals() { UserRole copy, userRole = new UserRole(); userRole.setUser(new User()); userRole.setService(new Service()); copy = (UserRole) DomainTestSupport.minimalEqualsTest(userRole); copy.setUser(userRole.getUser()); assertFalse(userRole.equals(copy)); copy.setUser(null); copy.setService(userRole.getService()); assertFalse(userRole.equals(copy)); copy.setUser(userRole.getUser()); copy.setService(userRole.getService()); assertTrue(userRole.equals(copy)); }
public void testUserRoleEquals() { UserRole copy, userRole = new UserRole(); userRole.setUserGroup(new UserGroup()); userRole.setService(new Service()); copy = (UserRole) DomainTestSupport.minimalEqualsTest(userRole); copy.setUser(userRole.getUser()); assertFalse(userRole.equals(copy)); copy.setUser(null); copy.setService(userRole.getService()); assertFalse(userRole.equals(copy)); copy.setUser(userRole.getUser()); copy.setService(userRole.getService()); assertTrue(userRole.equals(copy)); }
1,115,240
public void testUserRoleEquals() { UserRole copy, userRole = new UserRole(); userRole.setUser(new User()); userRole.setService(new Service()); copy = (UserRole) DomainTestSupport.minimalEqualsTest(userRole); copy.setUser(userRole.getUser()); assertFalse(userRole.equals(copy)); copy.setUser(null); copy.setService(userRole.getService()); assertFalse(userRole.equals(copy)); copy.setUser(userRole.getUser()); copy.setService(userRole.getService()); assertTrue(userRole.equals(copy)); }
public void testUserRoleEquals() { UserRole copy, userRole = new UserRole(); userRole.setUser(new User()); userRole.setService(new Service()); copy = (UserRole) DomainTestSupport.minimalEqualsTest(userRole); copy.setUserGroup(userRole.getUserGroup()); assertFalse(userRole.equals(copy)); copy.setUser(null); copy.setService(userRole.getService()); assertFalse(userRole.equals(copy)); copy.setUserGroup(userRole.getUserGroup()); copy.setService(userRole.getService()); assertTrue(userRole.equals(copy)); }
1,115,241
public void testUserRoleEquals() { UserRole copy, userRole = new UserRole(); userRole.setUser(new User()); userRole.setService(new Service()); copy = (UserRole) DomainTestSupport.minimalEqualsTest(userRole); copy.setUser(userRole.getUser()); assertFalse(userRole.equals(copy)); copy.setUser(null); copy.setService(userRole.getService()); assertFalse(userRole.equals(copy)); copy.setUser(userRole.getUser()); copy.setService(userRole.getService()); assertTrue(userRole.equals(copy)); }
public void testUserRoleEquals() { UserRole copy, userRole = new UserRole(); userRole.setUser(new User()); userRole.setService(new Service()); copy = (UserRole) DomainTestSupport.minimalEqualsTest(userRole); copy.setUser(userRole.getUser()); assertFalse(userRole.equals(copy)); copy.setUserGroup(null); copy.setService(userRole.getService()); assertFalse(userRole.equals(copy)); copy.setUser(userRole.getUser()); copy.setService(userRole.getService()); assertTrue(userRole.equals(copy)); }
1,115,242