diff
stringlengths 164
2.11M
| is_single_chunk
bool 2
classes | is_single_function
bool 2
classes | buggy_function
stringlengths 0
335k
⌀ | fixed_function
stringlengths 23
335k
⌀ |
---|---|---|---|---|
diff --git a/src/main/org/codehaus/groovy/tools/shell/util/AnsiPrintWriter.java b/src/main/org/codehaus/groovy/tools/shell/util/AnsiPrintWriter.java
index 69c690462..fcf80cfba 100644
--- a/src/main/org/codehaus/groovy/tools/shell/util/AnsiPrintWriter.java
+++ b/src/main/org/codehaus/groovy/tools/shell/util/AnsiPrintWriter.java
@@ -1,82 +1,81 @@
/*
* Copyright 2003-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.groovy.tools.shell.util;
-import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.io.PrintWriter;
import java.lang.reflect.Method;
// import org.codehaus.groovy.tools.shell.util.AnsiString;
/**
* Automatically renders printed strings for {@link AnsiString} formated expressions.
*
* @version $Id$
* @author <a href="mailto:[email protected]">Jason Dillon</a>
*/
public class AnsiPrintWriter
extends PrintWriter
{
public AnsiPrintWriter(final OutputStream out) {
super(out);
}
public AnsiPrintWriter(final OutputStream out, final boolean autoFlush) {
super(out, autoFlush);
}
public AnsiPrintWriter(final Writer out) {
super(out);
}
public AnsiPrintWriter(final Writer out, final boolean autoFlush) {
super(out, autoFlush);
}
public void write(String text) {
if (text != null && text.indexOf("@|") >=0) {
text = render(text);
}
super.write(text);
}
//
// HACK: Invoke the AnsiString.render() method using reflection to avoid problems building...
// come on ubercompile already folks :-P
//
private Method renderMethod;
private String render(final String text) {
try {
if (renderMethod == null) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Class type = cl.loadClass("org.codehaus.groovy.tools.shell.util.AnsiString");
renderMethod = type.getMethod("render", new Class[]{ String.class });
}
return (String)renderMethod.invoke(null, new Object[]{ text });
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
}
| true | false | null | null |
diff --git a/yarb-service/src/test/java/ch/yarb/service/impl/YarbServiceImplTest.java b/yarb-service/src/test/java/ch/yarb/service/impl/YarbServiceImplTest.java
index ca574e8..1622fc0 100644
--- a/yarb-service/src/test/java/ch/yarb/service/impl/YarbServiceImplTest.java
+++ b/yarb-service/src/test/java/ch/yarb/service/impl/YarbServiceImplTest.java
@@ -1,86 +1,87 @@
package ch.yarb.service.impl;
+import java.io.File;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import ch.yarb.service.api.YarbService;
import ch.yarb.service.to.ChangeType;
import ch.yarb.service.to.ChangedPath;
import ch.yarb.service.to.LogEntry;
import ch.yarb.service.to.RepoConfiguration;
import ch.yarb.service.to.RevisionRange;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/**
* Tests for {@link YarbServiceImpl}.
*
* @author pellaton
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "/test-context.xml", inheritLocations = false)
public class YarbServiceImplTest {
@Autowired
private YarbService service;
/**
* Tests {@link YarbServiceImpl#ping()}.
*/
@Test
public void ping() {
assertEquals("yarb", this.service.ping());
}
/**
* Tests the {@code null} check of the {@code logRepoConfigurationNull}
* {@link YarbServiceImpl#getRepositoryLog(RepoConfiguration, RevisionRange)}.
*/
@Test(expected = IllegalArgumentException.class)
public void getRepositoryLogRepoConfigurationNull() {
this.service.getRepositoryLog(null, RevisionRange.ALL);
}
/**
* Tests the {@code null} check of the {@code revisionRange}
* {@link YarbServiceImpl#getRepositoryLog(RepoConfiguration, RevisionRange)}.
*/
@Test(expected = IllegalArgumentException.class)
public void getRepositoryLogRevisionRangeNull() {
this.service.getRepositoryLog(new RepoConfiguration(null, null, null), null);
}
/**
* Tests {@link YarbServiceImpl#getRepositoryLog(RepoConfiguration, RevisionRange)}.
*/
@Test
public void getRepositoryLogRevision() {
List<LogEntry> repositoryLog = this.service.getRepositoryLog(new RepoConfiguration(
- "file:///Users/michael/.gitrepositories/yarb/yarb-service/src/test/resources/svntestrepo/",
+ "file://" + new File("./src/test/resources/svntestrepo").getAbsolutePath(),
"anonymous", "anonymous"),
RevisionRange.ALL);
assertNotNull(repositoryLog);
assertFalse(repositoryLog.isEmpty());
assertTrue(repositoryLog.size() >= 8);
LogEntry logEntry = repositoryLog.get(1);
assertNotNull(logEntry);
assertEquals("commit revision", "1", logEntry.getRevision());
assertEquals("commit author", "michael", logEntry.getAuthor());
assertEquals("commit comment", "bump basic directory structure", logEntry.getComment());
assertNotNull("commit timestamp", logEntry.getTimestamp());
List<ChangedPath> changedPathList = logEntry.getChangedPathList();
assertNotNull(changedPathList);
assertFalse(changedPathList.isEmpty());
assertEquals(3, changedPathList.size());
assertEquals("/branches", changedPathList.get(0).getPath());
assertEquals(ChangeType.ADDED, changedPathList.get(0).getChangeType());
}
}
| false | false | null | null |
diff --git a/jbi/src/main/java/org/apache/ode/jbi/OdeConsumer.java b/jbi/src/main/java/org/apache/ode/jbi/OdeConsumer.java
index 6b88587d7..f3e2a18b9 100644
--- a/jbi/src/main/java/org/apache/ode/jbi/OdeConsumer.java
+++ b/jbi/src/main/java/org/apache/ode/jbi/OdeConsumer.java
@@ -1,266 +1,266 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ode.jbi;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
import org.apache.ode.jbi.msgmap.Mapper;
import org.apache.ode.jbi.msgmap.MessageTranslationException;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import javax.jbi.messaging.*;
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Bridge between ODE (consumers) and JBI (providers). An single object of this type handles all communications initiated by ODE
* that is destined for other JBI providers.
*/
abstract class OdeConsumer extends ServiceBridge implements JbiMessageExchangeProcessor {
private static final Log __log = LogFactory.getLog(OdeConsumer.class);
private static final long DEFAULT_RESPONSE_TIMEOUT = Long.getLong("org.apache.ode.jbi.timeout", 2 * 60 * 1000L);
protected OdeContext _ode;
protected long _responseTimeout = DEFAULT_RESPONSE_TIMEOUT;
protected Map<String, PartnerRoleMessageExchange> _outstandingExchanges = new ConcurrentHashMap<String, PartnerRoleMessageExchange>();
OdeConsumer(OdeContext ode) {
_ode = ode;
}
/**
* This is where we handle invocation where the ODE BPEL engine is the <em>client</em> and some other JBI service is the
* <em>provider</em>.
*/
public void invokePartner(final PartnerRoleMessageExchange odeMex) throws ContextException {
// Cast the EndpointReference to a JbiEndpointReference. This is the
// only type it can be (since we control the creation of these things).
JbiEndpointReference targetEndpoint = (JbiEndpointReference) odeMex.getEndpointReference();
if (targetEndpoint == null) {
String errmsg = "No endpoint for mex: " + odeMex;
__log.error(errmsg);
odeMex.replyWithFailure(FailureType.INVALID_ENDPOINT, errmsg, null);
return;
}
ServiceEndpoint se = targetEndpoint.getServiceEndpoint();
boolean isTwoWay = odeMex.getMessageExchangePattern() == org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern.REQUEST_RESPONSE;
QName opname = new QName(se.getServiceName().getNamespaceURI(), odeMex.getOperation().getName());
MessageExchangeFactory mexf = _ode.getChannel().createExchangeFactory(se);
final MessageExchange jbiMex;
try {
jbiMex = mexf.createExchange(isTwoWay ? MessageExchangePattern.IN_OUT : MessageExchangePattern.IN_ONLY);
jbiMex.setEndpoint(se);
jbiMex.setService(se.getServiceName());
jbiMex.setOperation(opname);
} catch (MessagingException e) {
String errmsg = "Unable to create JBI message exchange for ODE message exchange " + odeMex;
__log.error(errmsg, e);
odeMex.replyWithFailure(FailureType.COMMUNICATION_ERROR, errmsg, null);
return;
}
Mapper mapper = _ode.getDefaultMapper();
odeMex.setProperty(Mapper.class.getName(), mapper.getClass().getName());
try {
if (!isTwoWay) {
final InOnly inonly = ((InOnly) jbiMex);
NormalizedMessage nmsg = inonly.createMessage();
mapper.toNMS(nmsg, odeMex.getRequest(), odeMex.getOperation().getInput().getMessage(), null);
inonly.setInMessage(nmsg);
copyMexProperties(jbiMex, odeMex);
_ode._scheduler.registerSynchronizer(new Scheduler.Synchronizer() {
public void afterCompletion(boolean success) {
if (success) {
doSendOneWay(odeMex, inonly);
}
}
public void beforeCompletion() {
}
});
odeMex.replyOneWayOk();
} else {
final InOut inout = (InOut) jbiMex;
NormalizedMessage nmsg = inout.createMessage();
mapper.toNMS(nmsg, odeMex.getRequest(), odeMex.getOperation().getInput().getMessage(), null);
inout.setInMessage(nmsg);
copyMexProperties(jbiMex, odeMex);
_ode._scheduler.registerSynchronizer(new Scheduler.Synchronizer() {
public void afterCompletion(boolean success) {
if (success) {
doSendTwoWay(odeMex, inout);
}
}
public void beforeCompletion() {
}
});
odeMex.replyAsync();
}
} catch (MessagingException me) {
String errmsg = "JBI messaging error for ODE MEX " + odeMex;
__log.error(errmsg, me);
odeMex.replyWithFailure(FailureType.COMMUNICATION_ERROR, errmsg, null);
} catch (MessageTranslationException e) {
String errmsg = "Error converting ODE message to JBI format for mex " + odeMex;
__log.error(errmsg, e);
odeMex.replyWithFailure(FailureType.FORMAT_ERROR, errmsg, null);
}
}
protected abstract void doSendOneWay(PartnerRoleMessageExchange odeMex, InOnly inonly);
protected abstract void doSendTwoWay(PartnerRoleMessageExchange odeMex, InOut inout);
protected abstract void inOutDone(InOut inout);
public void onJbiMessageExchange(MessageExchange jbiMex) throws MessagingException {
if (!jbiMex.getPattern().equals(MessageExchangePattern.IN_ONLY) &&
!jbiMex.getPattern().equals(MessageExchangePattern.IN_OUT)) {
__log.error("JBI MessageExchange " + jbiMex.getExchangeId() + " is of an unsupported pattern " + jbiMex.getPattern());
return;
}
if (jbiMex.getStatus() == ExchangeStatus.ACTIVE) {
if (jbiMex.getPattern().equals(MessageExchangePattern.IN_OUT)) {
inOutDone((InOut) jbiMex);
outResponse((InOut) jbiMex);
}
jbiMex.setStatus(ExchangeStatus.DONE);
_ode.getChannel().send(jbiMex);
} else if (jbiMex.getStatus() == ExchangeStatus.ERROR) {
inOutDone((InOut) jbiMex);
outFailure((InOut) jbiMex);
} else if (jbiMex.getStatus() == ExchangeStatus.DONE) {
_outstandingExchanges.remove(jbiMex.getExchangeId());
} else {
__log.error("Unexpected status " + jbiMex.getStatus() + " for JBI message exchange: " + jbiMex.getExchangeId());
}
}
private void outFailure(final InOut jbiMex) {
final PartnerRoleMessageExchange pmex = _outstandingExchanges.remove(jbiMex.getExchangeId());
if (pmex == null) {
__log.warn("Received a response for unknown JBI message exchange " + jbiMex.getExchangeId());
return;
}
try {
_ode._scheduler.execTransaction(new Callable<Boolean>() {
public Boolean call() throws Exception {
pmex.replyWithFailure(FailureType.OTHER, "Error: " + jbiMex.getError(), null);
return null;
}
});
} catch (Exception ex) {
__log.error("error delivering failure: ", ex);
}
}
private void outResponse(final InOut jbiMex) {
final PartnerRoleMessageExchange outstanding = _outstandingExchanges.remove(jbiMex.getExchangeId());
if (outstanding == null) {
__log.warn("Received a response for unknown JBI message exchange " + jbiMex.getExchangeId());
return;
}
try {
_ode._scheduler.execTransaction(new Callable<Boolean>() {
@SuppressWarnings("unchecked")
public Boolean call() throws Exception {
// need to reload mex since we're in a different transaction
PartnerRoleMessageExchange pmex = (PartnerRoleMessageExchange) _ode._server.getEngine().getMessageExchange(outstanding.getMessageExchangeId());
if (pmex == null) {
- __log.warn("Received a response for unknown partner role message exchange " + pmex.getMessageExchangeId());
+ __log.warn("Received a response for unknown partner role message exchange " + outstanding.getMessageExchangeId());
return Boolean.FALSE;
}
String mapperName = pmex.getProperty(Mapper.class.getName());
Mapper mapper = mapperName == null ? _ode.getDefaultMapper() : _ode.getMapper(mapperName);
if (mapper == null) {
String errmsg = "Mapper not found.";
__log.error(errmsg);
pmex.replyWithFailure(FailureType.FORMAT_ERROR, errmsg, null);
} else {
try {
Fault jbiFlt = jbiMex.getFault();
if (jbiFlt != null) {
javax.wsdl.Fault wsdlFlt = mapper.toFaultType(jbiFlt, (Collection<javax.wsdl.Fault>) pmex.getOperation().getFaults().values());
if (wsdlFlt == null) {
pmex.replyWithFailure(FailureType.FORMAT_ERROR, "Unrecognized fault message.", null);
} else {
if (wsdlFlt.getMessage() != null) {
Message faultResponse = pmex.createMessage(wsdlFlt.getMessage().getQName());
mapper.toODE(faultResponse, jbiFlt, wsdlFlt.getMessage());
pmex.replyWithFault(new QName(pmex.getPortType().getQName().getNamespaceURI(), wsdlFlt
.getName()), faultResponse);
} else {
// Can this even happen?
__log.fatal("Internal Error: fault found without a message type: " + wsdlFlt);
pmex.replyWithFailure(FailureType.FORMAT_ERROR, "Fault has no message: "
+ wsdlFlt.getName(), null);
}
}
} else {
Message response = pmex.createMessage(pmex.getOperation().getOutput().getMessage().getQName());
mapper.toODE(response, jbiMex.getOutMessage(), pmex.getOperation().getOutput().getMessage());
pmex.reply(response);
}
} catch (MessageTranslationException mte) {
__log.error("Error translating message.", mte);
pmex.replyWithFailure(FailureType.FORMAT_ERROR, mte.getMessage(), null);
}
}
return null;
}
});
} catch (Exception ex) {
__log.error("error delivering RESPONSE: ", ex);
}
}
public void setResponseTimeout(long timeout) {
_responseTimeout = timeout;
}
public long getResponseTimeout() {
return _responseTimeout;
}
}
| true | false | null | null |
diff --git a/src/main/java/archimulator/model/Benchmark.java b/src/main/java/archimulator/model/Benchmark.java
index 7bf57704..a954e4c7 100644
--- a/src/main/java/archimulator/model/Benchmark.java
+++ b/src/main/java/archimulator/model/Benchmark.java
@@ -1,125 +1,129 @@
/*******************************************************************************
* Copyright (c) 2010-2012 by Min Cai ([email protected]).
*
* This file is part of the Archimulator multicore architectural simulator.
*
* Archimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Archimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Archimulator. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package archimulator.model;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import net.pickapack.dateTime.DateHelper;
import net.pickapack.model.ModelElement;
import java.util.Date;
@DatabaseTable(tableName = "Benchmark")
public class Benchmark implements ModelElement {
@DatabaseField(generatedId = true)
private long id;
@DatabaseField
private String title;
@DatabaseField
private long createTime;
@DatabaseField
private String workingDirectory;
@DatabaseField
private String executable;
@DatabaseField
private String defaultArguments;
@DatabaseField
private String standardIn;
@DatabaseField
private boolean helperThreadEnabled;
@DatabaseField
private boolean locked;
public Benchmark() {
}
public Benchmark(String title, String workingDirectory, String executable, String defaultArguments) {
this(title, workingDirectory, executable, defaultArguments, "", false);
}
public Benchmark(String title, String workingDirectory, String executable, String defaultArguments, String standardIn, boolean helperThreadEnabled) {
this.title = title;
this.workingDirectory = workingDirectory;
this.executable = executable;
this.defaultArguments = defaultArguments;
this.standardIn = standardIn;
this.helperThreadEnabled = helperThreadEnabled;
this.createTime = DateHelper.toTick(new Date());
}
public long getId() {
return id;
}
@Override
public long getParentId() {
return -1;
}
public String getTitle() {
return title;
}
public long getCreateTime() {
return createTime;
}
public String getWorkingDirectory() {
return workingDirectory;
}
public String getExecutable() {
return executable;
}
public String getDefaultArguments() {
return defaultArguments;
}
public String getStandardIn() {
+ if(standardIn == null) {
+ standardIn = "";
+ }
+
return standardIn;
}
public boolean getHelperThreadEnabled() {
return helperThreadEnabled;
}
public boolean getLocked() {
return locked;
}
public void setLocked(boolean locked) {
this.locked = locked;
}
@Override
public String toString() {
return String.format("Benchmark{id=%d, title='%s', workingDirectory='%s', executable='%s', standardIn='%s', helperThreadEnabled=%s, locked=%s}", id, title, workingDirectory, executable, standardIn, helperThreadEnabled, locked);
}
}
diff --git a/src/main/java/archimulator/model/ContextMapping.java b/src/main/java/archimulator/model/ContextMapping.java
index ffc034a6..4f121dcd 100644
--- a/src/main/java/archimulator/model/ContextMapping.java
+++ b/src/main/java/archimulator/model/ContextMapping.java
@@ -1,134 +1,134 @@
/*******************************************************************************
* Copyright (c) 2010-2012 by Min Cai ([email protected]).
*
* This file is part of the Archimulator multicore architectural simulator.
*
* Archimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Archimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Archimulator. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package archimulator.model;
import archimulator.service.ServiceManager;
import java.io.Serializable;
public class ContextMapping implements Serializable {
- private Integer threadId;
+ private int threadId;
private long benchmarkId;
private String arguments;
private String standardOut;
private int helperThreadLookahead;
private int helperThreadStride;
private boolean dynamicHelperThreadParams;
private transient Benchmark benchmark;
public ContextMapping(int threadId, Benchmark benchmark, String arguments) {
this(threadId, benchmark, arguments, getDefaultStandardOut(threadId));
}
public ContextMapping(int threadId, Benchmark benchmark, String arguments, String standardOut) {
this.threadId = threadId;
this.benchmarkId = benchmark.getId();
this.arguments = arguments;
this.standardOut = standardOut;
}
- public Integer getThreadId() {
+ public int getThreadId() {
return threadId;
}
- public void setThreadId(Integer threadId) {
+ public void setThreadId(int threadId) {
this.threadId = threadId;
}
public long getBenchmarkId() {
return benchmarkId;
}
public void setBenchmarkId(long benchmarkId) {
this.benchmarkId = benchmarkId;
this.benchmark = ServiceManager.getBenchmarkService().getBenchmarkById(benchmarkId);
}
public String getArguments() {
if(arguments == null) {
arguments = "";
}
return arguments;
}
public void setArguments(String arguments) {
this.arguments = arguments;
}
public String getStandardOut() {
if(standardOut == null) {
standardOut = "";
}
return standardOut;
}
public void setStandardOut(String standardOut) {
this.standardOut = standardOut;
}
public int getHelperThreadLookahead() {
return helperThreadLookahead;
}
public void setHelperThreadLookahead(int helperThreadLookahead) {
this.helperThreadLookahead = helperThreadLookahead;
}
public int getHelperThreadStride() {
return helperThreadStride;
}
public void setHelperThreadStride(int helperThreadStride) {
this.helperThreadStride = helperThreadStride;
}
public boolean getDynamicHelperThreadParams() {
return dynamicHelperThreadParams;
}
public void setDynamicHelperThreadParams(boolean dynamicHelperThreadParams) {
this.dynamicHelperThreadParams = dynamicHelperThreadParams;
}
public Benchmark getBenchmark() {
if (benchmark == null) {
benchmark = ServiceManager.getBenchmarkService().getBenchmarkById(benchmarkId);
}
return benchmark;
}
@Override
public String toString() {
return String.format("thread #%d->'%s'", threadId, getBenchmark().getTitle() + "_" + arguments + "-lookahead_" + helperThreadLookahead + "-stride_" + helperThreadStride);
}
- public static String getDefaultStandardOut(Integer threadId) {
+ public static String getDefaultStandardOut(int threadId) {
return "ctx" + threadId + "_out.txt";
}
}
diff --git a/src/main/java/archimulator/service/RunExperimentJob.java b/src/main/java/archimulator/service/RunExperimentJob.java
index aba539cf..4ee3abb8 100644
--- a/src/main/java/archimulator/service/RunExperimentJob.java
+++ b/src/main/java/archimulator/service/RunExperimentJob.java
@@ -1,76 +1,80 @@
/*******************************************************************************
* Copyright (c) 2010-2012 by Min Cai ([email protected]).
*
* This file is part of the Archimulator multicore architectural simulator.
*
* Archimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Archimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Archimulator. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package archimulator.service;
import archimulator.model.Experiment;
import archimulator.model.ExperimentState;
import archimulator.model.ExperimentType;
import archimulator.sim.common.*;
import archimulator.sim.os.Kernel;
import net.pickapack.Reference;
import net.pickapack.event.BlockingEventDispatcher;
import net.pickapack.event.CycleAccurateEventQueue;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class RunExperimentJob implements Job {
public void execute(JobExecutionContext context) throws JobExecutionException {
if (!ServiceManager.getSystemSettingService().getSystemSettingSingleton().isRunningExperimentsEnabled()) {
return;
}
Experiment experiment = ServiceManager.getExperimentService().getFirstExperimentToRun();
if (experiment != null) {
experiment.setState(ExperimentState.RUNNING);
ServiceManager.getExperimentService().updateExperiment(experiment);
- runExperiment(experiment);
+ try {
+ runExperiment(experiment);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
private void runExperiment(Experiment experiment) {
CycleAccurateEventQueue cycleAccurateEventQueue = new CycleAccurateEventQueue();
if (experiment.getType() == ExperimentType.FUNCTIONAL) {
BlockingEventDispatcher<SimulationEvent> blockingEventDispatcher = new BlockingEventDispatcher<SimulationEvent>();
new FunctionalSimulation(experiment.getTitle() + "/functional", experiment, blockingEventDispatcher, cycleAccurateEventQueue, experiment.getNumMaxInstructions()).simulate();
} else if (experiment.getType() == ExperimentType.DETAILED) {
BlockingEventDispatcher<SimulationEvent> blockingEventDispatcher = new BlockingEventDispatcher<SimulationEvent>();
new DetailedSimulation(experiment.getTitle() + "/detailed", experiment, blockingEventDispatcher, cycleAccurateEventQueue, experiment.getNumMaxInstructions()).simulate();
} else if (experiment.getType() == ExperimentType.TWO_PHASE) {
Reference<Kernel> kernelRef = new Reference<Kernel>();
BlockingEventDispatcher<SimulationEvent> blockingEventDispatcher = new BlockingEventDispatcher<SimulationEvent>();
new ToRoiFastForwardSimulation(experiment.getTitle() + "/twoPhase/phase0", experiment, blockingEventDispatcher, cycleAccurateEventQueue, experiment.getArchitecture().getHelperThreadPthreadSpawnIndex(), kernelRef).simulate();
blockingEventDispatcher.clearListeners();
cycleAccurateEventQueue.resetCurrentCycle();
new FromRoiDetailedSimulation(experiment.getTitle() + "/twoPhase/phase1", experiment, blockingEventDispatcher, cycleAccurateEventQueue, experiment.getNumMaxInstructions(), kernelRef).simulate();
}
experiment.setState(ExperimentState.COMPLETED);
experiment.setFailedReason("");
ServiceManager.getExperimentService().updateExperiment(experiment);
}
}
| false | false | null | null |
diff --git a/src/simpleserver/command/MyAreaCommand.java b/src/simpleserver/command/MyAreaCommand.java
index 0607c10..015754e 100644
--- a/src/simpleserver/command/MyAreaCommand.java
+++ b/src/simpleserver/command/MyAreaCommand.java
@@ -1,143 +1,145 @@
/*
* Copyright (c) 2010 SimpleServer authors (see CONTRIBUTORS)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package simpleserver.command;
import static simpleserver.lang.Translations.t;
import java.util.Set;
import simpleserver.Color;
import simpleserver.Player;
import simpleserver.config.xml.AllBlocks;
import simpleserver.config.xml.Area;
import simpleserver.config.xml.Chests;
import simpleserver.config.xml.Config;
import simpleserver.config.xml.DimensionConfig;
import simpleserver.config.xml.Permission;
import simpleserver.config.xml.Config.AreaStoragePair;
public class MyAreaCommand extends AbstractCommand implements PlayerCommand {
public MyAreaCommand() {
super("myarea [start|end|save|unsave|rename]",
"Manage your personal area");
}
private boolean areaSizeOk(Player player) {
return (Math.abs(player.areastart.x() - player.areaend.x()) < 50)
&& (Math.abs(player.areastart.z() - player.areaend.z()) < 50)
&& player.areaend.dimension() == player.areastart.dimension();
}
public void execute(Player player, String message) {
Config config = player.getServer().config;
String arguments[] = extractArguments(message);
if (arguments.length == 0) {
player.addTCaptionedMessage("Usage", commandPrefix() + "myarea [start|end|save|unsave|rename]");
return;
}
if (arguments[0].equals("start")) {
player.areastart = player.position();
player.areastart = player.areastart.setY((byte) 0); // no height limit
player.addTMessage(Color.GRAY, "Start coordinate set.");
} else if (arguments[0].equals("end")) {
player.areaend = player.position();
player.areaend = player.areaend.setY((byte) 127); // no height limit
player.addTMessage(Color.GRAY, "End coordinate set.");
} else if (arguments[0].equals("save")) {
if (player.areastart == null || player.areaend == null) {
player.addTMessage(Color.RED, "Define start and end coordinates for your area first!");
return;
}
if (!areaSizeOk(player)) {
player.addTMessage(Color.RED, "Your area is allowed to have a maximum size of 50x50!");
return;
}
if (player.getServer().config.playerArea(player) != null) {
player.addTMessage(Color.RED, "New area can not be saved before you remove your old one!");
return;
}
Area area = createPlayerArea(player);
Set<Area> overlaps = config.dimensions.overlaps(area);
if (!overlaps.isEmpty()) {
player.addTMessage(Color.RED, "Your area overlaps with other areas and could therefore not be saved!");
StringBuilder str = new StringBuilder();
for (Area overlap : overlaps) {
str.append(overlap.name);
str.append(", ");
}
str.delete(str.length() - 2, str.length() - 1);
player.addTCaptionedMessage("Overlapping areas", "%s", str);
return;
}
saveArea(area, player);
player.addTMessage(Color.GRAY, "Your area has been saved!");
- } else if (arguments[0].equals("unsave")) {
+ } else if (arguments[0].equals("unsave") || arguments[0].equals("remove")) {
AreaStoragePair area = config.playerArea(player);
if (area == null) {
player.addTMessage(Color.RED, "You currently have no personal area which can be removed!");
return;
}
area.storage.remove(area.area);
player.addTMessage(Color.GRAY, "Your area has been removed!");
+ player.getServer().saveConfig();
} else if (arguments[0].equals("rename")) {
AreaStoragePair area = config.playerArea(player);
if (area == null) {
player.addTMessage(Color.RED, "You currently have no personal area which can be renamed!");
return;
}
String label = extractArgument(message, 1);
if (label != null) {
area.area.name = label;
player.addTMessage(Color.GRAY, "Your area has been renamed!");
+ player.getServer().saveConfig();
} else {
player.addTMessage(Color.RED, "Please supply an area name.");
}
} else {
player.addTMessage(Color.RED, "You entered an invalid argument.");
}
}
private Area createPlayerArea(Player player) {
Area area = new Area(t("%s's area", player.getName()), player.areastart, player.areaend);
area.owner = player.getName().toLowerCase();
Permission perm = new Permission(player);
AllBlocks blocks = new AllBlocks();
blocks.destroy = perm;
blocks.place = perm;
blocks.use = perm;
area.allblocks.blocks = blocks;
area.chests.chests = new Chests(perm);
return area;
}
private void saveArea(Area area, Player player) {
DimensionConfig dimension = player.getServer().config.dimensions.get(area.start.dimension());
if (dimension == null) {
dimension = player.getServer().config.dimensions.add(area.start.dimension());
}
dimension.add(area);
player.getServer().saveConfig();
}
}
diff --git a/src/simpleserver/config/xml/AreaStorage.java b/src/simpleserver/config/xml/AreaStorage.java
index 85ca9a3..6340596 100644
--- a/src/simpleserver/config/xml/AreaStorage.java
+++ b/src/simpleserver/config/xml/AreaStorage.java
@@ -1,55 +1,59 @@
/*
* Copyright (c) 2010 SimpleServer authors (see CONTRIBUTORS)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package simpleserver.config.xml;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class AreaStorage extends Storage implements Iterable<Area> {
private DimensionAreaStorage globalStorage = DimensionAreaStorage.getInstance();
private List<Area> localStorage = new ArrayList<Area>();
void setOwner(Area owner) {
globalStorage.addTag(owner);
}
@Override
void add(XMLTag child) {
localStorage.add((Area) child);
}
public void add(Area area) {
localStorage.add(area);
globalStorage.add(area);
}
@Override
public Iterator<Area> iterator() {
return localStorage.iterator();
}
public void remove(Area area) {
localStorage.remove(area);
globalStorage.remove(area);
}
+ public boolean isEmpty() {
+ return localStorage.isEmpty();
+ }
+
}
diff --git a/src/simpleserver/config/xml/DimensionConfig.java b/src/simpleserver/config/xml/DimensionConfig.java
index 1ddad30..d118a90 100644
--- a/src/simpleserver/config/xml/DimensionConfig.java
+++ b/src/simpleserver/config/xml/DimensionConfig.java
@@ -1,64 +1,71 @@
/*
* Copyright (c) 2010 SimpleServer authors (see CONTRIBUTORS)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package simpleserver.config.xml;
+import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import simpleserver.Coordinate.Dimension;
public class DimensionConfig extends PermissionContainer {
Dimension dimension;
AreaStorage topAreas;
public DimensionAreaStorage areas;
DimensionConfig() {
super("dimension");
}
@Override
public void finish() {
areas.buildTree();
}
@Override
void addStorages() {
areas = DimensionAreaStorage.newInstance();
addStorage("area", topAreas = new AreaStorage());
super.addStorages();
}
@Override
void setAttribute(String name, String value) throws SAXException {
if (name.equals("name")) {
dimension = Dimension.get(value);
}
}
@Override
void saveAttributes(AttributeList attributes) {
attributes.addAttribute("name", dimension);
}
+ @Override
+ protected void save(ContentHandler handler, boolean childs, boolean pcdata) throws SAXException {
+ if (!topAreas.isEmpty()) {
+ super.save(handler, childs, pcdata);
+ }
+ }
+
public void add(Area area) {
topAreas.add(area);
- areas.add(area);
}
}
| false | false | null | null |
diff --git a/src/main/java/org/generationcp/breeding/manager/crosses/NurseryTemplateConditionsComponent.java b/src/main/java/org/generationcp/breeding/manager/crosses/NurseryTemplateConditionsComponent.java
index 5adf483..db95c7d 100644
--- a/src/main/java/org/generationcp/breeding/manager/crosses/NurseryTemplateConditionsComponent.java
+++ b/src/main/java/org/generationcp/breeding/manager/crosses/NurseryTemplateConditionsComponent.java
@@ -1,619 +1,622 @@
/*******************************************************************************
* Copyright (c) 2012, All Rights Reserved.
*
* Generation Challenge Programme (GCP)
*
*
* This software is licensed for use under the terms of the GNU General Public
* License (http://bit.ly/8Ztv8M) and the provisions of Part F of the Generation
* Challenge Programme Amended Consortium Agreement (http://bit.ly/KQX1nL)
*
*******************************************************************************/
package org.generationcp.breeding.manager.crosses;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import org.generationcp.breeding.manager.application.Message;
import org.generationcp.breeding.manager.crossingmanager.SelectGermplasmListWindow;
import org.generationcp.breeding.manager.crossingmanager.util.CrossingManagerExporterException;
import org.generationcp.breeding.manager.nurserytemplate.listeners.NurseryTemplateButtonClickListener;
import org.generationcp.breeding.manager.nurserytemplate.util.NurseryTemplateManagerExporter;
import org.generationcp.breeding.manager.pojos.ImportedGermplasmCrosses;
import org.generationcp.commons.util.FileDownloadResource;
import org.generationcp.commons.vaadin.spring.InternationalizableComponent;
import org.generationcp.commons.vaadin.spring.SimpleResourceBundleMessageSource;
import org.generationcp.commons.vaadin.util.MessageNotifier;
import org.generationcp.middleware.exceptions.MiddlewareQueryException;
import org.generationcp.middleware.manager.api.GermplasmDataManager;
import org.generationcp.middleware.manager.api.UserDataManager;
import org.generationcp.middleware.manager.api.WorkbenchDataManager;
import org.generationcp.middleware.pojos.Location;
import org.generationcp.middleware.pojos.Method;
import org.generationcp.middleware.pojos.Person;
import org.generationcp.middleware.pojos.User;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.vaadin.dialogs.ConfirmDialog;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
import com.vaadin.event.LayoutEvents.LayoutClickListener;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
/**
*
* @author Mark Agarrado
*
*/
@Configurable
public class NurseryTemplateConditionsComponent extends VerticalLayout implements InitializingBean, InternationalizableComponent{
/**
*
*/
private static final long serialVersionUID = 6926035577490148208L;
public static final String BACK_BUTTON_ID = "NurseryTemplateConditionsComponent Back Button";
public static final String DONE_BUTTON_ID = "NurseryTemplateConditionsComponent Done Button";
public static final String CONDITION_COLUMN = "Condition Column";
public static final String DESCRIPTION_COLUMN = "Description Column";
public static final String PROPERTY_COLUMN = "Property Column";
public static final String SCALE_COLUMN = "Scale Column";
public static final String VALUE_COLUMN = "Value Column";
public static final String FEMALE_LIST="Female";
public static final String MALE_LIST="Male";
private Table nurseryConditionsTable;
private Component buttonArea;
private Button backButton;
private Button doneButton;
private TextField nid;
private ComboBox comboBoxBreedingMethod;
private TextField methodId;
private ComboBox comboBoxSiteName;
private TextField siteId;
private ComboBox comboBoxBreedersName;
private TextField breederId;
private TextField femaleListName;
private TextField femaleListId;
private TextField maleListName;
private TextField maleListId;
@Autowired
private SimpleResourceBundleMessageSource messageSource;
@Autowired
private GermplasmDataManager germplasmDataManager;
@Autowired
private WorkbenchDataManager workbenchDataManager;
@Autowired
private UserDataManager userDataManager;
private List<Method> method;
private List<Location> locations;
private List<User> users;
private HashMap<String, Integer> mapBreedingMethod;
private HashMap<String, Integer> mapSiteName;
private HashMap<String, Integer> mapBreedersName;
private NurseryTemplateMain source;
public NurseryTemplateConditionsComponent(NurseryTemplateMain source) {
this.source=source;
}
@Override
public void afterPropertiesSet() throws Exception {
assemble();
}
protected void assemble() {
initializeComponents();
initializeValues();
initializeLayout();
initializeActions();
}
protected void initializeComponents() {
nid=new TextField();
comboBoxBreedingMethod= new ComboBox();
comboBoxBreedingMethod.setImmediate(true);
methodId=new TextField();
methodId.setImmediate(true);
comboBoxSiteName= new ComboBox();
comboBoxSiteName.setImmediate(true);
siteId=new TextField();
siteId.setImmediate(true);
comboBoxBreedersName= new ComboBox();
comboBoxBreedersName.setImmediate(true);
breederId=new TextField();
breederId.setImmediate(true);
femaleListName=new TextField();
femaleListId=new TextField();
maleListName=new TextField();
maleListId=new TextField();
generateConditionsTable();
addComponent(nurseryConditionsTable);
buttonArea = layoutButtonArea();
addComponent(buttonArea);
}
protected void initializeValues() {
}
protected void initializeLayout() {
setMargin(true);
setSpacing(true);
setComponentAlignment(buttonArea, Alignment.MIDDLE_RIGHT);
}
protected void initializeActions() {
backButton.addListener(new NurseryTemplateButtonClickListener(this));
doneButton.addListener(new NurseryTemplateButtonClickListener(this));
}
protected Component layoutButtonArea() {
HorizontalLayout buttonLayout = new HorizontalLayout();
buttonLayout.setSpacing(true);
buttonLayout.setMargin(true, false, false, false);
backButton = new Button();
backButton.setData(BACK_BUTTON_ID);
buttonLayout.addComponent(backButton);
doneButton = new Button();
doneButton.setData(DONE_BUTTON_ID);
buttonLayout.addComponent(doneButton);
return buttonLayout;
}
private void generateConditionsTable() {
nurseryConditionsTable = new Table();
nurseryConditionsTable.setStyleName("condition-rows");
nurseryConditionsTable.setSizeFull();
nurseryConditionsTable.addContainerProperty(CONDITION_COLUMN, String.class, null);
nurseryConditionsTable.addContainerProperty(DESCRIPTION_COLUMN, String.class, null);
nurseryConditionsTable.addContainerProperty(PROPERTY_COLUMN, String.class, null);
nurseryConditionsTable.addContainerProperty(SCALE_COLUMN, String.class, null);
nurseryConditionsTable.addContainerProperty(VALUE_COLUMN, Component.class, null);
addConditionRows();
nurseryConditionsTable.setPageLength(nurseryConditionsTable.size());
}
private void addConditionRows() {
//TODO: populate this table using values read from the Nursery Template file
nurseryConditionsTable.addItem(new Object[] {
"NID", "NURSERY SEQUENCE NUMBER", "NURSERY", "NUMBER", nid
},
"nid");
nurseryConditionsTable.addItem(new Object[] {
"BREEDER NAME", "PRINCIPAL INVESTIGATOR", "PERSON", "DBCV", getComboBoxBreedersName()
},
"breederName");
nurseryConditionsTable.addItem(new Object[] {
"BREEDER ID", "PRINCIPAL INVESTIGATOR", "PERSON", "DBID", getTextFieldBreederId()
},
"breederId");
nurseryConditionsTable.addItem(new Object[] {
"SITE", "NURSERY SITE NAME", "LOCATION", "DBCV", getComboBoxSiteName()
},
"site");
nurseryConditionsTable.addItem(new Object[] {
"SITE ID", "NURSERY SITE ID", "LOCATION", "DBID", getTextFieldSiteId()
},
"siteId");
nurseryConditionsTable.addItem(new Object[] {
"BREEDING METHOD", "Breeding method to be applied to this nursery", "METHOD", "DBCV", getComboBoxBreedingMethod()
},
"breedingMethod");
nurseryConditionsTable.addItem(new Object[] {
"BREEDING METHOD ID", "ID of Breeding Method", "METHOD", "DBID", getTextFieldMethodId()
},
"breedingMethodId");
nurseryConditionsTable.addItem(new Object[] {
"FEMALE LIST NAME", "FEMALE LIST NAME", "GERMPLASM LIST", "DBCV", getLayoutGermplasmListTextField(femaleListName,FEMALE_LIST)
},
"femaleListName");
nurseryConditionsTable.addItem(new Object[] {
"FEMALE LIST ID", "FEMALE LIST ID", "GERMPLASM LIST", "DBID", getLayoutGermplasmListTextField(femaleListId,FEMALE_LIST)
},
"femaleListId");
nurseryConditionsTable.addItem(new Object[] {
"MALE LIST NAME", "MALE LIST NAME", "GERMPLASM LIST", "DBCV", getLayoutGermplasmListTextField(maleListName,MALE_LIST)
},
"maleListName");
nurseryConditionsTable.addItem(new Object[] {
"MALE LIST ID", "MALE LIST ID", "GERMPLASM LIST", "DBID", getLayoutGermplasmListTextField(maleListId,MALE_LIST)
},
"maleListId");
}
private ComboBox getComboBoxSiteName() {
mapSiteName = new HashMap<String, Integer>();
try {
locations=germplasmDataManager.getAllBreedingLocations();
} catch (MiddlewareQueryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
comboBoxSiteName.addItem("");
for (Location loc : locations) {
if(loc.getLname().length()>0){
comboBoxSiteName.addItem(loc.getLname());
mapSiteName.put(loc.getLname(), new Integer(loc.getLocid()));
}
}
comboBoxSiteName.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
siteId.setValue(String.valueOf(mapSiteName.get(comboBoxSiteName.getValue())));
}
});
comboBoxSiteName.select("");
siteId.setValue("");
return comboBoxSiteName;
}
private TextField getTextFieldSiteId(){
siteId.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
Location loc = new Location();
boolean noError=true;
try {
loc = germplasmDataManager.getLocationByID(Integer.valueOf(siteId.getValue().toString()));
} catch (NumberFormatException e) {
noError=false;
} catch (MiddlewareQueryException e) {
noError=false;
}
if(loc!=null && noError){
comboBoxSiteName.setValue(loc.getLname());
}else{
getWindow().showNotification(messageSource.getMessage(Message.INVALID_SITE_ID));
comboBoxSiteName.select("");
siteId.setValue("");
}
}
});
return siteId;
}
private ComboBox getComboBoxBreedersName() {
mapBreedersName = new HashMap<String, Integer>();
try {
users=userDataManager.getAllUsers();
} catch (MiddlewareQueryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
comboBoxBreedersName.addItem("");
setComboBoxBreederDefaultValue();
for (User u : users) {
Person p = new Person();
try {
p = userDataManager.getPersonById(u.getPersonid());
} catch (MiddlewareQueryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- String name=p.getFirstName()+" "+p.getMiddleName() + " "+p.getLastName();
+ String name= u.getName();
+ if(p != null){
+ name = p.getFirstName()+" "+p.getMiddleName() + " "+p.getLastName();
+ }
comboBoxBreedersName.addItem(name);
mapBreedersName.put(name, new Integer(u.getUserid()));
}
comboBoxBreedersName.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
breederId.setValue(String.valueOf(mapBreedersName.get(comboBoxBreedersName.getValue())));
}
});
return comboBoxBreedersName;
}
private void setComboBoxBreederDefaultValue() {
try {
User user =workbenchDataManager.getUserById(workbenchDataManager.getWorkbenchRuntimeData().getUserId());
Integer projectId= workbenchDataManager.getLastOpenedProject(workbenchDataManager.getWorkbenchRuntimeData().getUserId()).getProjectId().intValue();
Integer ibdbUserId=workbenchDataManager.getLocalIbdbUserId(user.getUserid(),Long.valueOf(projectId));
User u=userDataManager.getUserById(ibdbUserId);
Person p=userDataManager.getPersonById(u.getPersonid());
String name=p.getFirstName()+" "+p.getMiddleName() + " "+p.getLastName();
comboBoxBreedersName.addItem(name);
mapBreedersName.put(name, new Integer(u.getUserid()));
comboBoxBreedersName.select(name);
breederId.setValue(String.valueOf(u.getUserid()));
} catch (MiddlewareQueryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private TextField getTextFieldBreederId(){
breederId.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
Person p = new Person();
User u= new User();
String name="";
boolean noError=true;
try {
u=userDataManager.getUserById(Integer.valueOf(breederId.getValue().toString()));
} catch (NumberFormatException e) {
noError=false;
} catch (MiddlewareQueryException e) {
noError=false;
}
if(u!=null && noError){
try {
p = userDataManager.getPersonById(u.getPersonid());
name=p.getFirstName()+" "+p.getMiddleName() + " "+p.getLastName();
} catch (MiddlewareQueryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
comboBoxBreedersName.setValue(name);
}else{
getWindow().showNotification(messageSource.getMessage(Message.INVALID_BREEDER_ID));
comboBoxBreedersName.select("");
breederId.setValue("");
}
}
});
return breederId;
}
private ComboBox getComboBoxBreedingMethod() {
mapBreedingMethod = new HashMap<String, Integer>();
try {
method=germplasmDataManager.getMethodsByType("GEN");
} catch (MiddlewareQueryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
comboBoxBreedingMethod.addItem("");
for (Method m : method) {
if(m.getMname().length()>0){
comboBoxBreedingMethod.addItem(m.getMname());
mapBreedingMethod.put(m.getMname(), new Integer(m.getMid()));
}
}
comboBoxBreedingMethod.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
methodId.setValue(String.valueOf(mapBreedingMethod.get(comboBoxBreedingMethod.getValue())));
}
});
comboBoxBreedingMethod.select("");
methodId.setValue("");
return comboBoxBreedingMethod;
}
private TextField getTextFieldMethodId(){
methodId.addListener(new Property.ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
Method m = new Method();
boolean noError=true;
try {
m=germplasmDataManager.getMethodByID(Integer.valueOf(methodId.getValue().toString()));
} catch (NumberFormatException e) {
noError=false;
} catch (MiddlewareQueryException e) {
noError=false;
}
if(m!=null && noError){
comboBoxBreedingMethod.setValue(m.getMname());
}else{
getWindow().showNotification(messageSource.getMessage(Message.INVALID_METHOD_ID));
comboBoxBreedingMethod.select("");
methodId.setValue("");
}
}
});
return methodId;
}
private VerticalLayout getLayoutGermplasmListTextField(final TextField txtField,final String germplasmListFor){
VerticalLayout germplasmListTextFieldLayout = new VerticalLayout();
germplasmListTextFieldLayout.addComponent(txtField);
germplasmListTextFieldLayout.addListener(new LayoutClickListener() {
public void layoutClick(LayoutClickEvent event) {
if (event.getChildComponent() == txtField) {
SelectGermplasmListWindow selectListWindow = new SelectGermplasmListWindow(getMainClass(),germplasmListFor);
getWindow().addWindow(selectListWindow);
}
}
});
return germplasmListTextFieldLayout;
}
@Override
public void attach() {
super.attach();
updateLabels();
}
@Override
public void updateLabels() {
messageSource.setColumnHeader(nurseryConditionsTable, CONDITION_COLUMN, Message.CONDITION_HEADER);
messageSource.setColumnHeader(nurseryConditionsTable, DESCRIPTION_COLUMN, Message.DESCRIPTION_HEADER);
messageSource.setColumnHeader(nurseryConditionsTable, PROPERTY_COLUMN, Message.PROPERTY_HEADER);
messageSource.setColumnHeader(nurseryConditionsTable, SCALE_COLUMN, Message.SCALE_HEADER);
messageSource.setColumnHeader(nurseryConditionsTable, VALUE_COLUMN, Message.VALUE_HEADER);
messageSource.setCaption(backButton, Message.BACK);
messageSource.setCaption(doneButton, Message.DONE);
}
public void backButtonClickAction() {
source.disableNurseryTemplateConditionsComponent();
}
public void doneButtonClickAction() {
String confirmDialogCaption=messageSource.getMessage(Message.CONFIRM_DIALOG_CAPTION_EXPORT_NURSERY_FILE);
String confirmDialogMessage=messageSource.getMessage(Message.CONFIRM_DIALOG_MESSAGE_EXPORT_NURSERY_FILE);
ConfirmDialog.show(this.getWindow(),confirmDialogCaption ,confirmDialogMessage ,
messageSource.getMessage(Message.OK), messageSource.getMessage(Message.CANCEL_LABEL), new ConfirmDialog.Listener() {
private static final long serialVersionUID = 1L;
public void onClose(ConfirmDialog dialog) {
if (dialog.isConfirmed()) {
createAndDownloadNurseryTemplateFile();
}
}
});
}
protected void createAndDownloadNurseryTemplateFile() {
// TODO Auto-generated method stub
ImportedGermplasmCrosses nurseryTemplateData=source.getSelectNurseryTemplateScreen().getCrossingManagerUploader().getImportedGermplasmCrosses();
String tempFileName = System.getProperty( "user.home" ) + "/temp.xls";
NurseryTemplateManagerExporter exporter = new NurseryTemplateManagerExporter(nurseryTemplateData,getNurseryConditionValue());
try {
exporter.exportNurseryTemplateManagerExcel(tempFileName);
FileDownloadResource fileDownloadResource = new FileDownloadResource(new File(tempFileName), this.getApplication());
fileDownloadResource.setFilename(nurseryTemplateData.getFilename());
this.getWindow().open(fileDownloadResource);
} catch (CrossingManagerExporterException e) {
MessageNotifier.showError(getWindow(), e.getMessage(), "");
}
}
private HashMap<String, String> getNurseryConditionValue() {
HashMap<String, String> conditionValue=new HashMap<String,String>();
conditionValue.put("NID", nid.getValue().toString());
conditionValue.put("BREEDER NAME", comboBoxBreedersName.getValue().toString());
conditionValue.put("BREEDER ID", breederId.getValue().toString());
conditionValue.put("SITE", comboBoxSiteName.getValue().toString());
conditionValue.put("SITE ID", siteId.getValue().toString());
conditionValue.put("BREEDING METHOD", comboBoxBreedingMethod.getValue().toString());
conditionValue.put("BREEDING METHOD ID", methodId.getValue().toString());
conditionValue.put("FEMALE LIST NAME", femaleListName.getValue().toString());
conditionValue.put("FEMALE LIST ID", femaleListId.getValue().toString());
conditionValue.put("MALE LIST NAME", maleListName.getValue().toString());
conditionValue.put("MALE LIST ID", maleListId.getValue().toString());
return conditionValue;
}
private NurseryTemplateConditionsComponent getMainClass(){
return this;
}
public TextField getFemaleListName() {
return femaleListName;
}
public TextField getFemaleListId() {
return femaleListId;
}
public TextField getMaleListName() {
return maleListName;
}
public TextField getMaleListId() {
return maleListId;
}
}
| true | false | null | null |
diff --git a/src/com/matburt/mobileorg/Synchronizers/SSHSynchronizer.java b/src/com/matburt/mobileorg/Synchronizers/SSHSynchronizer.java
index b263103..484b9d7 100644
--- a/src/com/matburt/mobileorg/Synchronizers/SSHSynchronizer.java
+++ b/src/com/matburt/mobileorg/Synchronizers/SSHSynchronizer.java
@@ -1,199 +1,202 @@
package com.matburt.mobileorg.Synchronizers;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import com.matburt.mobileorg.util.OrgUtils;
public class SSHSynchronizer implements SynchronizerInterface {
private final String LT = "MobileOrg";
private String user;
private String host;
private String path;
private String pass;
private int port;
private String pubFile;
private Session session;
private SharedPreferences appSettings;
private Context context;
public SSHSynchronizer(Context context) {
this.context = context;
this.appSettings = PreferenceManager
.getDefaultSharedPreferences(context.getApplicationContext());
path = appSettings.getString("scpPath", "");
user = appSettings.getString("scpUser", "");
host = appSettings.getString("scpHost", "");
pubFile = appSettings.getString("scpPubFile", "");
String tmpPort = appSettings.getString("scpPort", "");
if (tmpPort.equals("")) {
port = 22;
}
else {
port = Integer.parseInt(tmpPort);
}
pass = appSettings.getString("scpPass", "");
try {
this.connect();
} catch (Exception e) {
Log.e("MobileOrg", "SSH Connection failed");
}
}
public String testConnection(String path, String user, String pass, String host, int port, String pubFile) {
this.path = path;
this.user = user;
this.pass = pass;
this.host = host;
this.port = port;
this.pubFile = pubFile;
if (this.path.indexOf("index.org") < 0) {
Log.i("MobileOrg", "Invalid ssh path, must point to index.org");
return "Invalid ssh path, must point to index.org";
}
if (this.path.equals("") ||
this.user.equals("") ||
this.host.equals("") ||
(this.pass.equals("") && this.pubFile.equals(""))) {
Log.i("MobileOrg", "Test Connection Failed for not being configured");
return "Missing configuration values";
}
try {
this.connect();
BufferedReader r = this.getRemoteFile(this.getFileName());
r.close();
}
catch (Exception e) {
Log.i("MobileOrg", "SSH Get index file failed");
return "Failed to find index file with error: " + e.toString();
}
this.postSynchronize();
return null;
}
private String getFileName() {
String[] pathElements = this.path.split("/");
if (pathElements.length > 0) {
return pathElements[pathElements.length-1];
}
return "";
}
private String getRootUrl() {
String[] pathElements = this.path.split("/");
String directoryActual = "/";
if (pathElements.length > 1) {
for (int i = 0; i < pathElements.length - 1; i++) {
if (pathElements[i].length() > 0) {
directoryActual += pathElements[i] + "/";
}
}
}
return directoryActual;
}
@Override
public boolean isConfigured() {
if (this.appSettings.getString("scpPath", "").equals("")
|| this.appSettings.getString("scpUser", "").equals("")
|| this.appSettings.getString("scpHost", "").equals("")
|| (this.appSettings.getString("scpPass", "").equals("") && this.appSettings
.getString("scpPubFile", "").equals("")))
return false;
return true;
}
public void connect() throws JSchException {
JSch jsch = new JSch();
try {
session = jsch.getSession(user, host, port);
- if (!pubFile.equals("")) {
+ if (!pubFile.equals("") && !pass.equals("")) {
+ jsch.addIdentity(pubFile, pass);
+ }
+ else if (!pubFile.equals("")) {
jsch.addIdentity(pubFile);
}
else {
session.setPassword(pass);
}
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
Log.d(LT, "SSH Connected");
} catch (JSchException e) {
Log.d(LT, e.getLocalizedMessage());
throw e;
}
}
public void putRemoteFile(String filename, String contents) throws IOException {
try {
Channel channel = session.openChannel("sftp");
channel.connect();
ChannelSftp sftpChannel = (ChannelSftp) channel;
ByteArrayInputStream bas = new ByteArrayInputStream(contents.getBytes());
sftpChannel.put(bas, this.getRootUrl() + filename);
sftpChannel.exit();
} catch (Exception e) {
Log.e("MobileOrg", "Exception in putRemoteFile: " + e.toString());
throw new IOException(e);
}
}
public BufferedReader getRemoteFile(String filename) throws IOException {
StringBuilder contents = null;
try {
Channel channel = session.openChannel( "sftp" );
channel.connect();
ChannelSftp sftpChannel = (ChannelSftp) channel;
Log.i("MobileOrg", "SFTP Getting: " + this.getRootUrl() + filename);
InputStream in = sftpChannel.get(this.getRootUrl() + filename);
BufferedReader r = new BufferedReader(new InputStreamReader(in));
contents = new StringBuilder();
String line;
while ((line = r.readLine()) != null) {
contents.append(line + "\n");
}
sftpChannel.exit();
} catch (Exception e) {
Log.e("MobileOrg", "Exception in getRemoteFile: " + e.toString());
throw new IOException(e);
}
return new BufferedReader(new StringReader(contents.toString()));
}
@Override
public void postSynchronize() {
if(this.session != null)
this.session.disconnect();
}
@Override
public boolean isConnectable() {
return OrgUtils.isNetworkOnline(context);
}
}
| true | false | null | null |
diff --git a/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java b/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
index 56e4256ea..88eeca69a 100644
--- a/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
+++ b/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
@@ -1,212 +1,212 @@
/*******************************************************************************
* Copyright (c) 2007 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.tests;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.test.util.JUnitUtils;
/**
* @author eskimo
*
*/
public class AbstractResourceMarkerTest extends TestCase {
/**
*
*/
public AbstractResourceMarkerTest() {
}
/**
*
*/
public AbstractResourceMarkerTest(String name) {
super(name);
}
protected int findMarkerLine(IResource resource, String type, String pattern)
throws CoreException {
int number = -1;
IMarker[] markers = findMarkers(resource, type, pattern);
for (int i = 0; i < markers.length; i++) {
number = markers[i].getAttribute(IMarker.LINE_NUMBER, -1);
}
return number;
}
protected IMarker[] findMarkers(IResource resource, String type, String pattern) throws CoreException {
List<IMarker> result = new ArrayList<IMarker>();
IMarker[] markers = resource.findMarkers(type, true, IResource.DEPTH_INFINITE);
for (int i = 0; i < markers.length; i++) {
String message = markers[i].getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
if (message.matches(pattern) && markers[i].exists()) {
result.add(markers[i]);
}
}
return result.toArray(new IMarker[0]);
}
protected void assertMarkerIsCreated(IResource resource, MarkerData markerData) throws CoreException {
assertMarkerIsCreated(resource, markerData.type, markerData.pattern, markerData.line);
}
protected void assertMarkerIsCreated(IResource resource, String type, String pattern, int expectedLine)
throws CoreException {
int line = findMarkerLine(
resource, type, pattern);
assertTrue("Marker matches the '" + pattern + "' pattern wasn't found", //$NON-NLS-1$ //$NON-NLS-2$
line != -1);
assertEquals("Marker matches the '" + pattern + "' pattern was found at wrong line", //$NON-NLS-1$//$NON-NLS-2$
expectedLine,line);
}
protected void assertMarkerIsNotCreated(IResource resource, String type, String pattern) throws CoreException {
IMarker[] markers = findMarkers(resource, type, pattern);
assertFalse("Marker matches the '" + pattern + "' pattern was found", markers.length>0); //$NON-NLS-1$ //$NON-NLS-2$
}
protected void assertMarkerIsNotCreated(IResource resource, String type, String pattern, int expectedLine) throws CoreException {
int line = findMarkerLine(resource, type, pattern);
assertFalse("Marker matches the '" + pattern + "' pattern was found", line != -1); //$NON-NLS-1$ //$NON-NLS-2$
}
protected void assertMarkerIsCreated(IResource resource, String type, String pattern) throws CoreException {
IMarker[] markers = findMarkers(resource, type, pattern);
assertTrue("Marker matches the '" + pattern + "' pattern wasn't found", //$NON-NLS-1$ //$NON-NLS-2$
markers.length>0);
}
protected void assertMarkersIsCreated(IResource resource, MarkerData[] markersData) throws CoreException {
for (MarkerData markerData : markersData) {
assertMarkerIsCreated(resource, markerData);
}
}
public static int getMarkersNumber(IResource resource) {
return getMarkersNumber(resource, null);
}
public static int getMarkersNumber(IResource resource, IMarkerFilter filter) {
try{
IMarker[] markers = resource.findMarkers(null, true, IResource.DEPTH_INFINITE);
int length = markers.length;
for(int i=0;i<markers.length;i++){
// System.out.println("Marker - "+markers[i].getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-1$//$NON-NLS-2$
- if(markers[i].exists() && (filter==null || filter.accept(markers[i]))) {
+ if(markers[i].exists() && (filter==null || !filter.accept(markers[i]))) {
length--;
}
}
return length;
}catch(CoreException ex){
JUnitUtils.fail("Can't get problem markers", ex); //$NON-NLS-1$
}
return -1;
}
public static String[] getMarkersMessage(IResource resource) {
return getMarkersMessage(resource, null);
}
public static String[] getMarkersMessage(IResource resource, IMarkerFilter filter) {
List<String> messages = new ArrayList<String>();
try{
IMarker[] markers = resource.findMarkers(null, true, IResource.DEPTH_INFINITE);
// System.out.println("Marker - "+markers[i].getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-1$//$NON-NLS-2$
for(int i=0;i<markers.length;i++){
if(markers[i].exists() && (filter==null || filter.accept(markers[i]))) {
messages.add(markers[i].getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-1$
}
}
}catch(CoreException ex){
JUnitUtils.fail("Can't get problem markers", ex); //$NON-NLS-1$
}
return messages.toArray(new String[0]);
}
public static Integer[] getMarkersNumbersOfLine(IResource resource) {
return getMarkersNumbersOfLine(resource, null);
}
public static Integer[] getMarkersNumbersOfLine(IResource resource, IMarkerFilter filter) {
List<Integer> numbers = new ArrayList<Integer>();
try{
IMarker[] markers = resource.findMarkers(null, true, IResource.DEPTH_INFINITE);
for(int i=0;i<markers.length;i++){
// System.out.println("Marker line number - "+markers[i].getAttribute(IMarker.LINE_NUMBER, 0)); //$NON-NLS-1$
if(markers[i].exists() && (filter==null || filter.accept(markers[i]))) {
numbers.add(markers[i].getAttribute(IMarker.LINE_NUMBER, 0));
}
}
}catch(CoreException ex){
JUnitUtils.fail("Can't get problem markers.", ex); //$NON-NLS-1$
}
return numbers.toArray(new Integer[0]);
}
/**
*
* @author eskimo
*
*/
public static class MarkerData {
private String type;
private String pattern;
private int line = -1;
public MarkerData(String type, String pattern, int line) {
this.type = type;
this.pattern = pattern;
this.line = line;
}
public int getLine() {
return line;
}
public void setLine(int line) {
this.line = line;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getPattern() {
return pattern;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
}
}
\ No newline at end of file
| true | false | null | null |
"diff --git a/src/java/org/jdesktop/swingx/plaf/basic/BasicDatePickerUI.java b/src/java/org/jdesktop(...TRUNCATED) | false | false | null | null |
"diff --git a/src/groovy/org/pillarone/riskanalytics/domain/pc/reinsurance/contracts/MultiCompanyCov(...TRUNCATED) | false | false | null | null |
End of preview. Expand
in Dataset Viewer.
Megadiff, a dataset of source code changes
If you use Megadiff, please cite the following technical report:
"Megadiff: A Dataset of 600k Java Source Code Changes Categorized by Diff Size". Technical Report 2108.04631, Arxiv; 2021.
@techreport{megadiff,
TITLE = {{Megadiff: A Dataset of 600k Java Source Code Changes Categorized by Diff Size}},
AUTHOR = {Martin Monperrus and Matias Martinez and He Ye and Fernanda Madeiral and Thomas Durieux and Zhongxing Yu},
URL = {http://arxiv.org/pdf/2108.04631},
INSTITUTION = {Arxiv},
NUMBER = {2108.04631},
YEAR = {2021},
}
- Downloads last month
- 89