Skip to content

Commit

Permalink
Merge pull request #46 from Minjung-Baek/master
Browse files Browse the repository at this point in the history
Minor bug Fix :
  • Loading branch information
Min-Ho-Kim committed Mar 31, 2016
2 parents 38beb27 + f422160 commit 51afcaf
Show file tree
Hide file tree
Showing 30 changed files with 116 additions and 54 deletions.
2 changes: 1 addition & 1 deletion project/dexter-cppcheck/build-jar-without-lib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<jar destfile="${dist}/dexter-cppcheck_${version}.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Class-Path" value="."/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Version" value="0.9.4"/>
</manifest>

<fileset dir="bin"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,12 @@ public boolean copyCppcheckRunModule() {
String cppcheckPath = "";

if (DexterUtil.getOS() == DexterUtil.OS.WINDOWS) {
zipFilePath += "/temp/cppcheck-windows_" + CppcheckDexterPlugin.version.getVersion() + ".zip";
//zipFilePath += "/temp/cppcheck-windows_" + CppcheckDexterPlugin.version.getVersion() + ".zip";
zipFilePath += "/temp/cppcheck-windows_0.9.4.zip";

cppcheckPath = "/cppcheck-windows.zip";
} else {
return true;
/*
* zipFilePath += "/temp/cppcheck-linux_" +
* CppcheckDexterPlugin.version.getVersion() + ".zip"; cppcheckPath
* = "/cppcheck-linux.zip";
*/
}

final File file = new File(zipFilePath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.samsung.sec.dexter.core.config.DexterConfig.LANGUAGE;
import com.samsung.sec.dexter.core.defect.PreOccurence;
import com.samsung.sec.dexter.core.exception.DexterRuntimeException;
import com.samsung.sec.dexter.core.plugin.PluginVersion;
import com.samsung.sec.dexter.core.util.DexterUtil;
import com.samsung.sec.dexter.util.CppUtil;

Expand Down Expand Up @@ -100,7 +101,8 @@ public void startElement(final String uri, final String localName, final String

} catch (DexterRuntimeException e){
logger.info(e.getMessage());
Checker checker = new Checker(checkerCode, checkerCode, CppcheckDexterPlugin.version.getVersion(), true);
Checker checker = new Checker(checkerCode, checkerCode,
PluginVersion.fromImplementationVersion(CppcheckDexterPlugin.class).getVersion(), true);

if("true".equals(attributes.getValue("inconclusive"))){
checker.setSeverityCode("ETC");
Expand Down
6 changes: 6 additions & 0 deletions project/dexter-eclipse-help/.project
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>dexter-eclipse.dexterBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>dexter-eclipse.dexterNature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<br>2. You can check that icons changed from <img src="../../images/Defect.JPG" width="15" height="15"><font color="red">'Defect'</font> to <img src="../../images/Dismissed.jpg" width="13" height="13"><font color="green"> 'Dismissed'</font>.
<br><img src="../../images/DM2.jpg"/>
<br>
<br>3. If you undismiss defects, click <img src="../../images/Dismissed.jpg" width="13" height="13"><font color="green"> 'Dismissed'</font> icon.
<br>3. If you mark as defects, click <img src="../../images/Dismissed.jpg" width="13" height="13"><font color="green"> 'Dismissed'</font> icon.
<br><img src="../../images/DM3.jpg"/>
</font>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1><b><font color="Black" face="Verdana"> * Defect Manager</font> </b></h1>
<br>2. You can check that icons changed from <img src="../../images/Defect.JPG" width="15" height="15"><font color="red">'Defect'</font> to <img src="../../images/Dismissed.jpg" width="13" height="13"><font color="green"> 'Dismissed'</font>.
<br><img src="../../images/DM2.jpg"/>
<br>
<br>3. If you undismiss defects, click <img src="../../images/Dismissed.jpg" width="13" height="13"><font color="green"> 'Dismissed'</font> icon.
<br>3. If you mark as a defects, click <img src="../../images/Dismissed.jpg" width="13" height="13"><font color="green"> 'Dismissed'</font> icon.
<br><img src="../../images/DM3.jpg"/>

</body>
Expand Down
14 changes: 7 additions & 7 deletions project/dexter-eclipse-ui/OSGI-INF/l10n/bundle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Wed Mar 30 21:05:53 KST 2016
#Thu Mar 31 20:44:37 KST 2016
command.name.5=Open Code Metrics (Function)
command.mnemonic.7=T
command.name.4=Open Code Metrics
Expand Down Expand Up @@ -37,19 +37,19 @@ menu.mnemonic=M
view.name.2=Code Metrics(Function)
view.name.1=Code Metrics
view.name.0=Checker Description
action.tooltip=Undismiss defect that has the status of 'Dismissed'
command.tooltip=Login to Dexter Server (Coding-time Static Analysis Server)
action.tooltip=Mark as a defect that has the status of 'Dismissed'
command.tooltip.10=Open Code Metrics (Function) View
command.tooltip=Login to Dexter Server (Coding-time Static Analysis Server)
action.label=Mark it as a defect
view.name=Analysis Log
action.label.3=Code Metrics (Function) Description
action.label.2=Code Metrics Description
action.label.1=Checker Description
category.name.1=Dexter
action.label.0=Dismiss Defect
category.name.1=Dexter
category.name.0=Analysis
command.mnemonic.9=L
command.mnemonic.11=A
command.mnemonic.8=R
command.mnemonic.10=U
command.mnemonic.9=L
command.name.6=Open PLATZ View (http\://platz.sec.samsung.net)
command.mnemonic.10=U
command.mnemonic.8=R
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public void run(IAction action) {
return;
}

if(part == null){
DexterUIActivator.LOG.error("Cannot make a defect");
return ;
}

if(!(part.getSite().getPart() instanceof AnalysisLogTreeView)){
MessageDialog.openError(part.getSite().getShell(), "error", "invalid part");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ public void run() {

private void showTextArea(boolean visible) {
fMemento.putBoolean(P_SHOW_TEXT_AREA, visible);
if(messageText == null) return ;
Composite parentComposite = messageText.getParent();
GridData gd = (GridData) messageText.getLayoutData();
gd.exclude = !visible;
Expand Down Expand Up @@ -615,7 +616,9 @@ public TreeViewer getLogTreeView() {
public void handleDexterHomeChanged() {
rootLog = new RootAnalysisLog();
rootLog.loadFromLogFiles();
if(messageText == null) return;
messageText.setText("");
if(logTreeView == null ) return;
logTreeView.setInput(rootLog);
logTreeView.refresh();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public void run(IAction action) {
if(isNotAdmin()) return;

final StructuredSelection selection = (StructuredSelection) this.selection;
if(selection == null ) return ;

final Object selectedObject = selection.getFirstElement();
if(isNotProjectSelection(selectedObject)) return;

Expand Down Expand Up @@ -167,8 +169,9 @@ private boolean isLogout() {
}

private void showErrorMessage(final String title, final String message){
// if(targetPart != null && targetPart.getSite() != null && targetPart.getSite().getShell() != null){
MessageDialog.openError(targetPart.getSite().getShell(), title, message);
if (targetPart != null && targetPart.getSite() != null && targetPart.getSite().getShell() != null) {
MessageDialog.openError(targetPart.getSite().getShell(), title, message);
}
}

private void addResourceAsTargetFile(final IResource resource){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#Mon Mar 28 19:19:31 KST 2016
#Thu Mar 31 20:47:27 KST 2016
GetGlobalIdResolution_GET_GLOBAL_ID_LABEL=Get all global Did for local Did
CodeMetricsResolution_CODE_METRICS_ERROR=Error to open View
DefectHelpResolution_DEFECT_HELP_ERROR=Error to open View
DefectHelpResolution_SHOW_DEFECT_DESC=Show Defect Description
GetGlobalIdResolution_GET_GLOBAL_ID_DESC=Get all global Did for local Did
UndismissDefectResolution_UNDISMISS_DESC=undismiss this defect with all of the occurences
UndismissDefectResolution_UNDISMISS_DESC=Mark as a Defect with all of the occurences
CodeMetricsResolution_CODE_METRICS_DESC=open default system web browser to show code metrics description
CodeMetricsResolution_SHOW_CODE_METRICS_DESC=Show Code Metrics Description
DismissDefectResolution_DISMISS_ERROR_MSG=marker dosen't have a valid defect info or not IFile.
Expand All @@ -13,5 +13,5 @@ DefectHelpResolution_DEFECT_HELP_DESC=open default system web browser to show de
UndismissDefectResolution_UNDISMISS_ERROR=There is no defect info or not file
CodeMetricsResolution_CODE_METRICS_ERROR_DESC=Can't open Code Metrics Description View
DismissDefectResolution_DISMISS_DESC=dismiss this defect with all of the occurences
UndismissDefectResolution_UNDISMISS_LABEL=undismiss this defect with all of the occurences
UndismissDefectResolution_UNDISMISS_LABEL=Mark as a Defect with all of the occurences
DismissDefectResolution_DISMISS_LABEL=dismiss this defect with all of the occurences
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#Mon Mar 28 19:19:31 KST 2016
CodeMetricsResolution_CODE_METRICS_ERROR=\uCC3D\uC744 \uC5EC\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
#Thu Mar 31 20:47:27 KST 2016
GetGlobalIdResolution_GET_GLOBAL_ID_LABEL=\uACF5\uC2DD DID \uAD6C\uD558\uAE30
CodeMetricsResolution_CODE_METRICS_ERROR=\uCC3D\uC744 \uC5EC\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
DefectHelpResolution_DEFECT_HELP_ERROR=\uCC3D\uC744 \uC5EC\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
DefectHelpResolution_SHOW_DEFECT_DESC=\uACB0\uD568 \uC124\uBA85 \uBCF4\uAE30
GetGlobalIdResolution_GET_GLOBAL_ID_DESC=\uC9C0\uC5ED DID\uB97C \uD1B5\uD574 \uD504\uB85C\uC81D\uD2B8 \uACF5\uC2DD DID\uB97C \uAD6C\uD569\uB2C8\uB2E4.
UndismissDefectResolution_UNDISMISS_DESC=\uC774 \uACB0\uD568\uC5D0 \uC608\uC678\uCC98\uB9AC\uB97C \uD574\uC81C\uD569\uB2C8\uB2E4(\uBAA8\uB4E0 \uD558\uC704 Occurence\uC5D0 \uBC18\uC601\uB428).
CodeMetricsResolution_CODE_METRICS_DESC=\uCF54\uB4DC \uBA54\uD2B8\uB9AD \uC815\uBCF4\uB97C \uBCF4\uAE30 \uC704\uD55C \uCC3D\uC744 \uC5FD\uB2C8\uB2E4.
CodeMetricsResolution_SHOW_CODE_METRICS_DESC=\uCF54\uB4DC \uBA54\uD2B8\uB9AD \uBCF4\uAE30
UndismissDefectResolution_UNDISMISS_DESC=\uC774 \uACB0\uD568\uC5D0 \uC608\uC678\uCC98\uB9AC\uB97C \uD574\uC81C\uD569\uB2C8\uB2E4(\uBAA8\uB4E0 \uD558\uC704 Occurence\uC5D0 \uBC18\uC601\uB428).
DefectHelpResolution_DEFECT_HELP_ERROR_DESC=\uCC3D\uC744 \uC5EC\uB294\uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
DefectHelpResolution_DEFECT_HELP_DESC=\uACB0\uD568 \uC124\uBA85\uC744 \uBCF4\uAE30 \uC704\uD55C \uCC3D\uC744 \uC5FD\uB2C8\uB2E4.
DismissDefectResolution_DISMISS_ERROR_MSG=marker dosen't have a valid defect info or not IFile.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,13 @@ private void initEnableDetector() {
/**
* @return CheckerConfig
*/
public synchronized CheckerConfig getCheckerConfig() {
public CheckerConfig getCheckerConfig() {
if (this.checkerConfig == null) {
initCheckerConfig();
}

return this.checkerConfig;
synchronized (this.checkerConfig) {
return this.checkerConfig;
}
}

public void setCheckerConfig(CheckerConfig checkerConfig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import java.util.Map;

import org.apache.log4j.Logger;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
Expand All @@ -54,11 +55,11 @@
import com.samsung.sec.dexter.vdcpp.util.CppUtil;
import java.math.BigDecimal;


public class USleepCheckerLogic implements ICheckerLogic{

private int sleepTime;
private IASTTranslationUnit translationUnit;
private IASTTranslationUnit translationUnit;
private final static Logger LOG = Logger.getLogger(DexterVdCppPlugin.class);


@Override
Expand Down Expand Up @@ -122,16 +123,19 @@ private void visitFunctioncallExpressions(
{
if(expParameter instanceof IASTLiteralExpression)
{

int value =convertIntoDecimalNumber(expParameter.toString());
if(value <sleepTime)
try
{

String msg ="checkUsleep function argument "+expParameter.toString()+ " should be greater than "+sleepTime+ " to avoid performance issue;";
fillDefectData( config, result,checker,expParameter.getFileLocation(),msg,expParameter.toString());

int value =convertIntoDecimalNumber(expParameter.toString());
if(value <sleepTime)
{

String msg ="checkUsleep function argument "+expParameter.toString()+ " should be greater than "+sleepTime+ " to avoid performance issue;";
fillDefectData( config, result,checker,expParameter.getFileLocation(),msg,expParameter.toString());
}
}
catch (DexterRuntimeException e) {
LOG.error(e.getMessage(), e);
}

}
else if(expParameter instanceof IASTIdExpression)
{
Expand Down Expand Up @@ -180,9 +184,8 @@ private void visitIdExpressions(
fillDefectData( config, result,checker,astExpression.getFileLocation(),msg,expParameter.toString());
}
}
catch(Exception ex)
{
throw new DexterRuntimeException(ex.getMessage());
catch (DexterRuntimeException e) {
LOG.error(e.getMessage(), e);
}

}
Expand Down Expand Up @@ -241,19 +244,39 @@ private PreOccurence createPreOccurence(AnalysisConfig config,
}

private Integer convertIntoDecimalNumber(String string)
{
Integer outputDecimal = 0;
if(string.contains("e"))
{
outputDecimal = new BigDecimal(string).intValue();
}
else
{
outputDecimal =Integer.valueOf(string);
}
{
Integer outputDecimal=0;

return outputDecimal;
}
try
{
string = string.replaceAll("(U|u|LL|ll|L|l)", "");

if(string.contains("x") ||string.contains("X") ) //ex) 0xff : hexa-decimal
{
string = string.replaceFirst("(0x|0X)", "");
outputDecimal = Integer.parseInt(string, 16);
}
else if(string.contains("e") || string.contains("E")) //ex) 1e5
{
outputDecimal = new BigDecimal(string).intValue();
}
else if(string.startsWith("0") && string.length()>1 ) //ex) 033 : octa-decimal
{
string = string.replaceFirst("[0]", "");
outputDecimal = Integer.parseInt(string, 8);
}
else
{
outputDecimal =Integer.valueOf(string);
}

return outputDecimal;
}
catch(Exception e)
{
throw new DexterRuntimeException("Invalid input number " + e.getMessage(), e);
}
}

};

Expand Down
6 changes: 6 additions & 0 deletions project/dexter.daemon.feature.64/.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>dexter-eclipse.dexterBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>dexter-eclipse.dexterNature</nature>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions project/dexter.eclipse.feature.64/.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>dexter-eclipse.dexterBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>dexter-eclipse.dexterNature</nature>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions project/dexter.eclipse.update.64/.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>dexter-eclipse.dexterBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>dexter-eclipse.dexterNature</nature>
<nature>org.eclipse.pde.UpdateSiteNature</nature>
</natures>
</projectDescription>
Binary file modified project/dexter.eclipse.update.64/artifacts.jar
Binary file not shown.
Binary file modified project/dexter.eclipse.update.64/content.jar
Binary file not shown.
Binary file not shown.
Binary file modified project/dexter.eclipse.update.64/plugins/dexter-core_0.9.4.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified project/dexter.eclipse.update.64/plugins/dexter-executor_0.9.4.jar
Binary file not shown.
Binary file not shown.
Binary file modified project/dexter.eclipse.update.64/plugins/dexter-metrics_0.9.4.jar
Binary file not shown.
Binary file not shown.
6 changes: 5 additions & 1 deletion project/dexter.eclipse.update.64/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
<feature url="features/dexter.eclipse.feature.64_0.9.4.jar" id="dexter.eclipse.feature.64" version="0.9.4">
<category name="dexter-eclipse"/>
</feature>
<category-def name="dexter-eclipse" label="New Category 2"/>
<category-def name="dexter-eclipse" label="Dexter Eclipse Feature 64bit">
<description>
Samsung Electronics VD SE Lab
</description>
</category-def>
</site>

0 comments on commit 51afcaf

Please sign in to comment.