CPD Results

The following document contains the results of PMD's CPD 3.9.

Duplications

File Line
net/sf/bluecove/awt/Main.java 657
net/sf/bluecove/swing/Main.java 312
	}

	public void appendLog(int level, String message, Throwable throwable) {
		if (output == null) {
			return;
		}
		final StringBuffer buf = new StringBuffer();

		if (Configuration.logTimeStamp) {
			String time = TimeUtils.timeNowToString();
			buf.append(time).append(" ");
		}

		switch (level) {
		case Logger.ERROR:
			// errorCount ++;
			buf.append("e.");
			break;
		case Logger.WARN:
			buf.append("w.");
			break;
		case Logger.INFO:
			buf.append("i.");
			break;
		}
		buf.append(message);
		if (throwable != null) {
			buf.append(' ');
			String className = throwable.getClass().getName();
			buf.append(className.substring(1 + className.lastIndexOf('.')));
			if (throwable.getMessage() != null) {
				buf.append(':');
				buf.append(throwable.getMessage());
			}
		}
		buf.append("\n");
		boolean createUpdater = false;
		synchronized (logLinesQueue) {
			if (logLinesQueue.isEmpty()) {
				createUpdater = true;
			} else {
				createUpdater = !logUpdaterRunning;
			}
			logLinesQueue.addElement(buf.toString());
		}
		if (createUpdater) {
			try {
				EventQueue.invokeLater(new AwtLogUpdater());

File Line
net/sf/bluecove/awt/Main.java 177
net/sf/bluecove/swing/Main.java 130
		final JMenuItem tckStart;
		if (Configuration.likedTCKAgent) {
			tckStart = addMenu(menuBluetooth, "Start TCK Agent", new ActionListener() {
				public void actionPerformed(ActionEvent e) {
					Switcher.startTCKAgent();
				}
			});
		} else {
			tckStart = null;
		}

		addMenu(menuBluetooth, "Discovery", new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Switcher.startDiscovery();
				updateTitle();
			}
		}, KeyEvent.VK_MULTIPLY);

		addMenu(menuBluetooth, "Services Search", new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Switcher.startServicesSearch();
				updateTitle();
			}
		}, KeyEvent.VK_7);

		addMenu(menuBluetooth, "Client Stress Start", new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Switcher.startClientStress();
				updateTitle();
			}
		});

		addMenu(menuBluetooth, "Client selectService Start", new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Switcher.startClientSelectService();
				updateTitle();
			}
		});

		addMenu(menuBluetooth, "Client Last service Start", new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Switcher.startClientLastURl();
				updateTitle();
			}
		});

		addMenu(menuBluetooth, "Client Last device Start", new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Switcher.startClientLastDevice();
				updateTitle();
			}
		});

		final JMenuItem stop = addMenu(menuBluetooth, "Stop all work", new ActionListener() {

File Line
net/sf/bluecove/awt/Main.java 522
net/sf/bluecove/swing/Main.java 256
			screenSize.setSize(240, 320);
		}
		if (this.isResizable()) {
			Rectangle b = this.getBounds();
			b.x = Integer.valueOf(Configuration.getStorageData("main.x", "0")).intValue();
			b.y = Integer.valueOf(Configuration.getStorageData("main.y", "0")).intValue();
			b.height = Integer.valueOf(Configuration.getStorageData("main.height", String.valueOf(screenSize.height)))
					.intValue();
			b.width = Integer.valueOf(Configuration.getStorageData("main.width", String.valueOf(screenSize.width)))
					.intValue();
			this.setBounds(b);
		}
	}

File Line
net/sf/bluecove/CommunicationTesterL2CAP.java 133
net/sf/bluecove/CommunicationTesterL2CAP.java 172
				while (!c.channel.ready()) {
					try {
						Thread.sleep(100);
					} catch (InterruptedException e) {
						break mainLoop;
					}
				}
				byte[] dataRecived = new byte[receiveMTU];
				int lengthdataRecived = c.channel.receive(dataRecived);
				Assert.assertTrue("seq " + i + " lengthdataRecived " + lengthdataRecived, lengthdataRecived >= 1);
				Assert.assertEquals("sequence", (byte) i, dataRecived[0]);
				Assert.assertEquals("lengthdataRecived", i, lengthdataRecived);
				for (int j = 1; j < lengthdataRecived; j++) {
					Assert.assertEquals("recived, byte [" + j + "]", (byte) (j + aKnowndNegativeByte), dataRecived[j]);

File Line
net/sf/bluecove/awt/Main.java 619
net/sf/bluecove/swing/Main.java 291
		}
		output.setText("");
		outputLines = 0;
	}

	private void quit() {
		Logger.debug("quit");
		Switcher.clientShutdown();
		Switcher.serverShutdownOnExit();

		Rectangle b = this.getBounds();
		Configuration.storeData("main.x", String.valueOf(b.x));
		Configuration.storeData("main.y", String.valueOf(b.y));
		Configuration.storeData("main.height", String.valueOf(b.height));
		Configuration.storeData("main.width", String.valueOf(b.width));

		Logger.removeAppender(this);
		BlueCoveSpecific.removeAppender();

		// this.dispose();
		System.exit(0);
	}

File Line
net/sf/bluecove/tests/L2TrafficGenerator.java 68
net/sf/bluecove/tests/RfTrafficGenerator.java 72
				}
			} else {
				sequenceSize = Configuration.tgSize & 0xFF;
				sequenceSleep = Configuration.tgSleep & 0xFF;
				durationMSec = Configuration.tgDurationMin;
			}
			sequenceSleep = sequenceSleep * 10;
			if (sequenceSize < sequenceSizeMin) {
				sequenceSize = sequenceSizeMin;
			}
			switch (sequenceSize) {
			case 251:
				// 1K
				sequenceSize = 0x400;
				break;
			case 252:
				// 2K
				sequenceSize = 0x800;
				break;
			case 253:
				// 3K
				sequenceSize = 0xC00;
				break;
			case 254:
				// 4K
				sequenceSize = 0x1000;
				break;
			case 255:
				// 5K
				sequenceSize = 0x1400;
				break;
			}
			Logger.debug(messagePrefix + " size selected " + sequenceSize + " byte");
			Logger.debug(messagePrefix + " duration " + durationMSec + " minutes");
			durationMSec *= 60000;

			return true;
		}
	}

	public static Config getConfig(ConnectionHolderStream c, boolean server, String messagePrefix) throws IOException {

File Line
net/sf/bluecove/CommunicationTesterL2CAP.java 126
net/sf/bluecove/CommunicationTesterL2CAP.java 221
				byte[] data = new byte[receiveMTU];
				data[0] = (byte) i;
				for (int j = 1; j < data.length; j++) {
					data[j] = (byte) (j + aKnowndNegativeByte);
				}
				c.channel.send(data);
				sequenceSentCount++;
				while (!c.channel.ready()) {
					try {
						Thread.sleep(100);
					} catch (InterruptedException e) {
						break mainLoop;
					}
				}
				byte[] dataRecived = new byte[receiveMTU];
				int lengthdataRecived = c.channel.receive(dataRecived);
				Assert.assertTrue("lengthdataRecived", lengthdataRecived >= 1);